@tulip-systems/core 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (840) hide show
  1. package/LICENSE +662 -0
  2. package/dist/auth/server.d.mts +3 -3
  3. package/dist/auth/server.mjs +3 -3
  4. package/dist/components/client.d.mts +19 -3
  5. package/dist/components/client.mjs +18 -2
  6. package/dist/components/editor/components/editor.client.d.mts +4 -3
  7. package/dist/components/editor/components/editor.client.d.mts.map +1 -1
  8. package/dist/components/editor/components/editor.client.mjs +5 -2
  9. package/dist/components/editor/components/editor.client.mjs.map +1 -1
  10. package/dist/components/editor/components/menu-nodes.client.mjs +1 -1
  11. package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -1
  12. package/dist/components/editor/components/menu.client.mjs +3 -3
  13. package/dist/components/editor/components/menu.client.mjs.map +1 -1
  14. package/dist/components/editor/extensions/file-handler/extension.d.mts +4 -4
  15. package/dist/components/editor/extensions/file-handler/extension.d.mts.map +1 -1
  16. package/dist/components/editor/extensions/file-handler/extension.mjs.map +1 -1
  17. package/dist/components/editor/extensions/file-handler/strategy.d.mts +4 -6
  18. package/dist/components/editor/extensions/file-handler/strategy.d.mts.map +1 -1
  19. package/dist/components/editor/extensions/file-handler/strategy.mjs +11 -11
  20. package/dist/components/editor/extensions/file-handler/strategy.mjs.map +1 -1
  21. package/dist/components/editor/extensions/file-handler/utils.mjs +1 -1
  22. package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -1
  23. package/dist/components/editor/extensions/image/extension.mjs +9 -9
  24. package/dist/components/editor/extensions/image/extension.mjs.map +1 -1
  25. package/dist/components/editor/lib/constants.d.mts +1 -1
  26. package/dist/components/editor/lib/constants.mjs +1 -1
  27. package/dist/components/editor/lib/extensions.d.mts +1 -1
  28. package/dist/components/editor/lib/helpers.d.mts +11 -3
  29. package/dist/components/editor/lib/helpers.d.mts.map +1 -1
  30. package/dist/components/editor/lib/helpers.mjs +27 -13
  31. package/dist/components/editor/lib/helpers.mjs.map +1 -1
  32. package/dist/components/emails/forget-password-email.mjs +6 -6
  33. package/dist/components/emails/forget-password-email.mjs.map +1 -1
  34. package/dist/components/header/back-button.client.mjs +2 -2
  35. package/dist/components/header/back-button.client.mjs.map +1 -1
  36. package/dist/components/header/bottom-bar.client.mjs +2 -2
  37. package/dist/components/header/bottom-bar.client.mjs.map +1 -1
  38. package/dist/components/header/breadcrumbs.client.mjs +1 -1
  39. package/dist/components/header/breadcrumbs.client.mjs.map +1 -1
  40. package/dist/components/header/header.client.mjs +1 -1
  41. package/dist/components/header/header.client.mjs.map +1 -1
  42. package/dist/components/layouts/empty-page.mjs +2 -2
  43. package/dist/components/layouts/empty-page.mjs.map +1 -1
  44. package/dist/components/layouts/error-page.mjs +3 -3
  45. package/dist/components/layouts/error-page.mjs.map +1 -1
  46. package/dist/components/layouts/providers.client.d.mts.map +1 -1
  47. package/dist/components/layouts/providers.client.mjs +3 -2
  48. package/dist/components/layouts/providers.client.mjs.map +1 -1
  49. package/dist/components/layouts/root-loading.mjs +2 -2
  50. package/dist/components/layouts/root-loading.mjs.map +1 -1
  51. package/dist/components/layouts/tab-layout.mjs +1 -1
  52. package/dist/components/layouts/tab-layout.mjs.map +1 -1
  53. package/dist/components/lists/data-list.mjs +1 -1
  54. package/dist/components/lists/data-list.mjs.map +1 -1
  55. package/dist/components/lists/data-stack.mjs +1 -1
  56. package/dist/components/lists/data-stack.mjs.map +1 -1
  57. package/dist/components/navigation/admin-sidebar-header.client.mjs +3 -3
  58. package/dist/components/navigation/admin-sidebar-header.client.mjs.map +1 -1
  59. package/dist/components/navigation/admin-sidebar-skeleton.mjs +1 -1
  60. package/dist/components/navigation/admin-sidebar-skeleton.mjs.map +1 -1
  61. package/dist/components/ui/accordion.client.d.mts +26 -0
  62. package/dist/components/ui/accordion.client.d.mts.map +1 -0
  63. package/dist/components/ui/accordion.client.mjs +58 -0
  64. package/dist/components/ui/accordion.client.mjs.map +1 -0
  65. package/dist/components/ui/alert-dialog.client.d.mts +61 -0
  66. package/dist/components/ui/alert-dialog.client.d.mts.map +1 -0
  67. package/dist/components/ui/alert-dialog.client.mjs +104 -0
  68. package/dist/components/ui/alert-dialog.client.mjs.map +1 -0
  69. package/dist/components/ui/alert.d.mts +5 -1
  70. package/dist/components/ui/alert.d.mts.map +1 -1
  71. package/dist/components/ui/alert.mjs +13 -6
  72. package/dist/components/ui/alert.mjs.map +1 -1
  73. package/dist/components/ui/aspect-ratio.client.d.mts +10 -0
  74. package/dist/components/ui/aspect-ratio.client.d.mts.map +1 -0
  75. package/dist/components/ui/aspect-ratio.client.mjs +16 -0
  76. package/dist/components/ui/aspect-ratio.client.mjs.map +1 -0
  77. package/dist/components/ui/avatar.client.d.mts +21 -6
  78. package/dist/components/ui/avatar.client.d.mts.map +1 -1
  79. package/dist/components/ui/avatar.client.mjs +31 -9
  80. package/dist/components/ui/avatar.client.mjs.map +1 -1
  81. package/dist/components/ui/badge.d.mts +1 -1
  82. package/dist/components/ui/badge.d.mts.map +1 -1
  83. package/dist/components/ui/badge.mjs +11 -8
  84. package/dist/components/ui/badge.mjs.map +1 -1
  85. package/dist/components/ui/breadcrumb.d.mts +3 -1
  86. package/dist/components/ui/breadcrumb.d.mts.map +1 -1
  87. package/dist/components/ui/breadcrumb.mjs +7 -7
  88. package/dist/components/ui/breadcrumb.mjs.map +1 -1
  89. package/dist/components/ui/button-group.d.mts +29 -0
  90. package/dist/components/ui/button-group.d.mts.map +1 -0
  91. package/dist/components/ui/button-group.mjs +41 -0
  92. package/dist/components/ui/button-group.mjs.map +1 -0
  93. package/dist/components/ui/button.d.mts +2 -2
  94. package/dist/components/ui/button.d.mts.map +1 -1
  95. package/dist/components/ui/button.mjs +19 -13
  96. package/dist/components/ui/button.mjs.map +1 -1
  97. package/dist/components/ui/{calendar.d.mts → calendar.client.d.mts} +7 -4
  98. package/dist/components/ui/calendar.client.d.mts.map +1 -0
  99. package/dist/components/ui/{calendar.mjs → calendar.client.mjs} +22 -19
  100. package/dist/components/ui/calendar.client.mjs.map +1 -0
  101. package/dist/components/ui/card.d.mts +9 -2
  102. package/dist/components/ui/card.d.mts.map +1 -1
  103. package/dist/components/ui/card.mjs +15 -7
  104. package/dist/components/ui/card.mjs.map +1 -1
  105. package/dist/components/ui/{carousel.d.mts → carousel.client.d.mts} +12 -3
  106. package/dist/components/ui/carousel.client.d.mts.map +1 -0
  107. package/dist/components/ui/{carousel.mjs → carousel.client.mjs} +10 -10
  108. package/dist/components/ui/carousel.client.mjs.map +1 -0
  109. package/dist/components/ui/chart.client.d.mts.map +1 -1
  110. package/dist/components/ui/chart.client.mjs +11 -11
  111. package/dist/components/ui/chart.client.mjs.map +1 -1
  112. package/dist/components/ui/checkbox.client.d.mts +12 -0
  113. package/dist/components/ui/checkbox.client.d.mts.map +1 -0
  114. package/dist/components/ui/checkbox.client.mjs +24 -0
  115. package/dist/components/ui/checkbox.client.mjs.map +1 -0
  116. package/dist/components/ui/collapsible.client.d.mts +6 -6
  117. package/dist/components/ui/collapsible.client.d.mts.map +1 -1
  118. package/dist/components/ui/collapsible.client.mjs +6 -6
  119. package/dist/components/ui/collapsible.client.mjs.map +1 -1
  120. package/dist/components/ui/combobox-dropdown.client.d.mts +1 -1
  121. package/dist/components/ui/combobox-dropdown.client.mjs +3 -2
  122. package/dist/components/ui/combobox-dropdown.client.mjs.map +1 -1
  123. package/dist/components/ui/combobox.client.mjs +5 -5
  124. package/dist/components/ui/combobox.client.mjs.map +1 -1
  125. package/dist/components/ui/{command.d.mts → command.client.d.mts} +8 -2
  126. package/dist/components/ui/command.client.d.mts.map +1 -0
  127. package/dist/components/ui/command.client.mjs +91 -0
  128. package/dist/components/ui/command.client.mjs.map +1 -0
  129. package/dist/components/ui/context-menu.client.d.mts +86 -0
  130. package/dist/components/ui/context-menu.client.d.mts.map +1 -0
  131. package/dist/components/ui/context-menu.client.mjs +128 -0
  132. package/dist/components/ui/context-menu.client.mjs.map +1 -0
  133. package/dist/components/ui/date-picker.client.mjs +2 -2
  134. package/dist/components/ui/date-picker.client.mjs.map +1 -1
  135. package/dist/components/ui/dialog.client.d.mts +19 -12
  136. package/dist/components/ui/dialog.client.d.mts.map +1 -1
  137. package/dist/components/ui/dialog.client.mjs +40 -29
  138. package/dist/components/ui/dialog.client.mjs.map +1 -1
  139. package/dist/components/ui/drawer.client.d.mts.map +1 -1
  140. package/dist/components/ui/drawer.client.mjs +5 -5
  141. package/dist/components/ui/drawer.client.mjs.map +1 -1
  142. package/dist/components/ui/dropdown-menu.client.d.mts +85 -0
  143. package/dist/components/ui/dropdown-menu.client.d.mts.map +1 -0
  144. package/dist/components/ui/dropdown-menu.client.mjs +131 -0
  145. package/dist/components/ui/dropdown-menu.client.mjs.map +1 -0
  146. package/dist/components/ui/empty.d.mts +36 -0
  147. package/dist/components/ui/empty.d.mts.map +1 -0
  148. package/dist/components/ui/empty.mjs +62 -0
  149. package/dist/components/ui/empty.mjs.map +1 -0
  150. package/dist/components/ui/field.client.d.mts +65 -0
  151. package/dist/components/ui/field.client.d.mts.map +1 -0
  152. package/dist/components/ui/field.client.mjs +114 -0
  153. package/dist/components/ui/field.client.mjs.map +1 -0
  154. package/dist/components/ui/form.client.d.mts +3 -4
  155. package/dist/components/ui/form.client.d.mts.map +1 -1
  156. package/dist/components/ui/form.client.mjs +4 -4
  157. package/dist/components/ui/form.client.mjs.map +1 -1
  158. package/dist/components/ui/hover-card.client.d.mts +6 -6
  159. package/dist/components/ui/hover-card.client.d.mts.map +1 -1
  160. package/dist/components/ui/hover-card.client.mjs +14 -11
  161. package/dist/components/ui/hover-card.client.mjs.map +1 -1
  162. package/dist/components/ui/{input-date-time.d.mts → input-date-time.client.d.mts} +3 -3
  163. package/dist/components/ui/input-date-time.client.d.mts.map +1 -0
  164. package/dist/components/ui/{input-date-time.mjs → input-date-time.client.mjs} +4 -2
  165. package/dist/components/ui/input-date-time.client.mjs.map +1 -0
  166. package/dist/components/ui/input-date.d.mts +1 -1
  167. package/dist/components/ui/input-date.d.mts.map +1 -1
  168. package/dist/components/ui/input-date.mjs.map +1 -1
  169. package/dist/components/ui/input-group.client.d.mts +59 -0
  170. package/dist/components/ui/input-group.client.d.mts.map +1 -0
  171. package/dist/components/ui/input-group.client.mjs +106 -0
  172. package/dist/components/ui/input-group.client.mjs.map +1 -0
  173. package/dist/components/ui/input-recipient.mjs +11 -11
  174. package/dist/components/ui/input-recipient.mjs.map +1 -1
  175. package/dist/components/ui/input-time.d.mts +1 -1
  176. package/dist/components/ui/input-time.d.mts.map +1 -1
  177. package/dist/components/ui/input-time.mjs.map +1 -1
  178. package/dist/components/ui/input.d.mts.map +1 -1
  179. package/dist/components/ui/input.mjs +1 -1
  180. package/dist/components/ui/input.mjs.map +1 -1
  181. package/dist/components/ui/item.d.mts +63 -0
  182. package/dist/components/ui/item.d.mts.map +1 -0
  183. package/dist/components/ui/item.mjs +119 -0
  184. package/dist/components/ui/item.mjs.map +1 -0
  185. package/dist/components/ui/kbd.d.mts +14 -0
  186. package/dist/components/ui/kbd.d.mts.map +1 -0
  187. package/dist/components/ui/kbd.mjs +22 -0
  188. package/dist/components/ui/kbd.mjs.map +1 -0
  189. package/dist/components/ui/label.d.mts +4 -4
  190. package/dist/components/ui/label.d.mts.map +1 -1
  191. package/dist/components/ui/label.mjs +5 -5
  192. package/dist/components/ui/label.mjs.map +1 -1
  193. package/dist/components/ui/loader.d.mts +7 -0
  194. package/dist/components/ui/loader.d.mts.map +1 -0
  195. package/dist/components/ui/loader.mjs +63 -0
  196. package/dist/components/ui/loader.mjs.map +1 -0
  197. package/dist/components/ui/navigation-menu.d.mts +11 -11
  198. package/dist/components/ui/navigation-menu.d.mts.map +1 -1
  199. package/dist/components/ui/navigation-menu.mjs +18 -20
  200. package/dist/components/ui/navigation-menu.mjs.map +1 -1
  201. package/dist/components/ui/pagination.d.mts +8 -2
  202. package/dist/components/ui/pagination.d.mts.map +1 -1
  203. package/dist/components/ui/pagination.mjs +29 -21
  204. package/dist/components/ui/pagination.mjs.map +1 -1
  205. package/dist/components/ui/popover.client.d.mts +35 -0
  206. package/dist/components/ui/popover.client.d.mts.map +1 -0
  207. package/dist/components/ui/popover.client.mjs +59 -0
  208. package/dist/components/ui/popover.client.mjs.map +1 -0
  209. package/dist/components/ui/progress.client.d.mts +4 -4
  210. package/dist/components/ui/progress.client.d.mts.map +1 -1
  211. package/dist/components/ui/progress.client.mjs +7 -7
  212. package/dist/components/ui/progress.client.mjs.map +1 -1
  213. package/dist/components/ui/radio-group.d.mts +5 -5
  214. package/dist/components/ui/radio-group.d.mts.map +1 -1
  215. package/dist/components/ui/radio-group.mjs +10 -11
  216. package/dist/components/ui/radio-group.mjs.map +1 -1
  217. package/dist/components/ui/resizable.client.d.mts +3 -4
  218. package/dist/components/ui/resizable.client.d.mts.map +1 -1
  219. package/dist/components/ui/resizable.client.mjs +5 -9
  220. package/dist/components/ui/resizable.client.mjs.map +1 -1
  221. package/dist/components/ui/scroll-area.d.mts +5 -5
  222. package/dist/components/ui/scroll-area.d.mts.map +1 -1
  223. package/dist/components/ui/scroll-area.mjs +12 -11
  224. package/dist/components/ui/scroll-area.mjs.map +1 -1
  225. package/dist/components/ui/select.client.d.mts +18 -13
  226. package/dist/components/ui/select.client.d.mts.map +1 -1
  227. package/dist/components/ui/select.client.mjs +37 -32
  228. package/dist/components/ui/select.client.mjs.map +1 -1
  229. package/dist/components/ui/separator.d.mts +4 -4
  230. package/dist/components/ui/separator.d.mts.map +1 -1
  231. package/dist/components/ui/separator.mjs +6 -6
  232. package/dist/components/ui/separator.mjs.map +1 -1
  233. package/dist/components/ui/sheet.client.d.mts +9 -7
  234. package/dist/components/ui/sheet.client.d.mts.map +1 -1
  235. package/dist/components/ui/sheet.client.mjs +30 -20
  236. package/dist/components/ui/sheet.client.mjs.map +1 -1
  237. package/dist/components/ui/sidebar.client.mjs +28 -28
  238. package/dist/components/ui/sidebar.client.mjs.map +1 -1
  239. package/dist/components/ui/skeleton.mjs +1 -1
  240. package/dist/components/ui/skeleton.mjs.map +1 -1
  241. package/dist/components/ui/slider.d.mts +4 -4
  242. package/dist/components/ui/slider.d.mts.map +1 -1
  243. package/dist/components/ui/slider.mjs +11 -11
  244. package/dist/components/ui/slider.mjs.map +1 -1
  245. package/dist/components/ui/spinner.d.mts +10 -0
  246. package/dist/components/ui/spinner.d.mts.map +1 -0
  247. package/dist/components/ui/spinner.mjs +9 -55
  248. package/dist/components/ui/spinner.mjs.map +1 -1
  249. package/dist/components/ui/switch.client.d.mts +15 -0
  250. package/dist/components/ui/switch.client.d.mts.map +1 -0
  251. package/dist/components/ui/switch.client.mjs +23 -0
  252. package/dist/components/ui/switch.client.mjs.map +1 -0
  253. package/dist/components/ui/tabs.client.d.mts +31 -0
  254. package/dist/components/ui/tabs.client.d.mts.map +1 -0
  255. package/dist/components/ui/tabs.client.mjs +49 -0
  256. package/dist/components/ui/tabs.client.mjs.map +1 -0
  257. package/dist/components/ui/textarea.d.mts.map +1 -1
  258. package/dist/components/ui/textarea.mjs +1 -1
  259. package/dist/components/ui/textarea.mjs.map +1 -1
  260. package/dist/components/ui/toggle-group.client.d.mts +11 -6
  261. package/dist/components/ui/toggle-group.client.d.mts.map +1 -1
  262. package/dist/components/ui/toggle-group.client.mjs +20 -12
  263. package/dist/components/ui/toggle-group.client.mjs.map +1 -1
  264. package/dist/components/ui/{toggle.d.mts → toggle.client.d.mts} +6 -6
  265. package/dist/components/ui/toggle.client.d.mts.map +1 -0
  266. package/dist/components/ui/toggle.client.mjs +40 -0
  267. package/dist/components/ui/toggle.client.mjs.map +1 -0
  268. package/dist/components/ui/tooltip.client.d.mts +7 -7
  269. package/dist/components/ui/tooltip.client.d.mts.map +1 -1
  270. package/dist/components/ui/tooltip.client.mjs +10 -10
  271. package/dist/components/ui/tooltip.client.mjs.map +1 -1
  272. package/dist/components.d.mts +13 -21
  273. package/dist/components.mjs +13 -21
  274. package/dist/config/server.d.mts +1 -3
  275. package/dist/config/server.mjs +1 -4
  276. package/dist/config.d.mts +2 -2
  277. package/dist/config.mjs +1 -1
  278. package/dist/data-tables/client.d.mts +2 -1
  279. package/dist/data-tables/client.mjs +2 -1
  280. package/dist/data-tables.d.mts +1 -1
  281. package/dist/database/client.d.mts +1 -0
  282. package/dist/database/client.mjs +1 -0
  283. package/dist/database/server.d.mts +2 -0
  284. package/dist/database/server.mjs +3 -0
  285. package/dist/database.d.mts +3 -0
  286. package/dist/database.mjs +3 -0
  287. package/dist/emails/client.d.mts +1 -0
  288. package/dist/emails/client.mjs +1 -0
  289. package/dist/emails/server.d.mts +2 -0
  290. package/dist/emails/server.mjs +3 -0
  291. package/dist/emails.d.mts +1 -0
  292. package/dist/emails.mjs +1 -0
  293. package/dist/inline-edit/client.d.mts +2 -2
  294. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  295. package/dist/lib/hooks/use-indicator.mjs.map +1 -1
  296. package/dist/lib/utils/markdown.d.mts +10 -0
  297. package/dist/lib/utils/markdown.d.mts.map +1 -0
  298. package/dist/lib/utils/markdown.mjs +15 -0
  299. package/dist/lib/utils/markdown.mjs.map +1 -0
  300. package/dist/lib/utils/url.mjs +2 -1
  301. package/dist/lib/utils/url.mjs.map +1 -1
  302. package/dist/lib/utils/user-agent.mjs +15 -0
  303. package/dist/lib/utils/user-agent.mjs.map +1 -1
  304. package/dist/lib.d.mts +2 -2
  305. package/dist/lib.mjs +2 -2
  306. package/dist/modules/auth/components/auth-layout.server.mjs +2 -2
  307. package/dist/modules/auth/components/auth-layout.server.mjs.map +1 -1
  308. package/dist/modules/auth/components/create-first-user-guard.server.d.mts +16 -0
  309. package/dist/modules/auth/components/create-first-user-guard.server.d.mts.map +1 -0
  310. package/dist/modules/auth/components/create-first-user-guard.server.mjs +16 -0
  311. package/dist/modules/auth/components/create-first-user-guard.server.mjs.map +1 -0
  312. package/dist/modules/auth/components/create-first-user-page.client.mjs +3 -3
  313. package/dist/modules/auth/components/create-first-user-page.client.mjs.map +1 -1
  314. package/dist/modules/auth/components/forget-password-page.client.mjs +1 -1
  315. package/dist/modules/auth/components/forget-password-page.client.mjs.map +1 -1
  316. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  317. package/dist/modules/auth/components/guard.server.mjs +1 -1
  318. package/dist/modules/auth/components/guard.server.mjs.map +1 -1
  319. package/dist/modules/auth/components/login-page.client.mjs +5 -5
  320. package/dist/modules/auth/components/login-page.client.mjs.map +1 -1
  321. package/dist/modules/auth/components/reset-password-page.client.mjs +5 -5
  322. package/dist/modules/auth/components/reset-password-page.client.mjs.map +1 -1
  323. package/dist/modules/auth/db/schema.d.mts +1 -1
  324. package/dist/modules/auth/db/schema.mjs +2 -2
  325. package/dist/modules/auth/handler/create-client.client.d.mts +4838 -229
  326. package/dist/modules/auth/handler/create-client.client.d.mts.map +1 -1
  327. package/dist/modules/auth/handler/create-client.client.mjs.map +1 -1
  328. package/dist/modules/auth/handler/proxy.server.mjs +2 -2
  329. package/dist/modules/auth/handler/proxy.server.mjs.map +1 -1
  330. package/dist/modules/auth/handler/route.server.d.mts +2 -2
  331. package/dist/modules/auth/handler/route.server.d.mts.map +1 -1
  332. package/dist/modules/auth/handler/route.server.mjs.map +1 -1
  333. package/dist/modules/auth/handler/{init.d.mts → service.server.d.mts} +322 -90
  334. package/dist/modules/auth/handler/service.server.d.mts.map +1 -0
  335. package/dist/modules/auth/handler/{init.mjs → service.server.mjs} +19 -8
  336. package/dist/modules/auth/handler/service.server.mjs.map +1 -0
  337. package/dist/modules/auth/hooks/use-session.d.mts +9 -4
  338. package/dist/modules/auth/hooks/use-session.d.mts.map +1 -1
  339. package/dist/modules/auth/lib/helpers.server.d.mts +1 -1
  340. package/dist/modules/auth/lib/permissions.d.mts +1 -1
  341. package/dist/modules/auth/lib/validators.mjs +1 -1
  342. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +9 -9
  343. package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
  344. package/dist/modules/commands/components/alert-dialog-command.client.mjs +3 -3
  345. package/dist/modules/commands/components/alert-dialog-command.client.mjs.map +1 -1
  346. package/dist/modules/commands/components/click-command.client.mjs +2 -2
  347. package/dist/modules/commands/components/click-command.client.mjs.map +1 -1
  348. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  349. package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
  350. package/dist/modules/commands/components/dialog-command.client.mjs +2 -2
  351. package/dist/modules/commands/components/dialog-command.client.mjs.map +1 -1
  352. package/dist/modules/commands/components/dropdown-command.client.mjs +2 -2
  353. package/dist/modules/commands/components/dropdown-command.client.mjs.map +1 -1
  354. package/dist/modules/commands/components/empty-command.client.mjs +2 -2
  355. package/dist/modules/commands/components/empty-command.client.mjs.map +1 -1
  356. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -9
  357. package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
  358. package/dist/modules/commands/components/form-dialog-command.client.mjs +8 -6
  359. package/dist/modules/commands/components/form-dialog-command.client.mjs.map +1 -1
  360. package/dist/modules/commands/menus/context-menu.client.d.mts +3 -3
  361. package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
  362. package/dist/modules/commands/menus/context-menu.client.mjs +1 -1
  363. package/dist/modules/commands/menus/context-menu.client.mjs.map +1 -1
  364. package/dist/modules/commands/menus/dropdown-menu.client.mjs +2 -2
  365. package/dist/modules/commands/menus/dropdown-menu.client.mjs.map +1 -1
  366. package/dist/modules/commands/menus/floating-menu.client.mjs +2 -2
  367. package/dist/modules/commands/menus/floating-menu.client.mjs.map +1 -1
  368. package/dist/modules/commands/utils/archive-command.client.mjs +1 -1
  369. package/dist/modules/commands/utils/archive-command.client.mjs.map +1 -1
  370. package/dist/modules/commands/utils/delete-command.client.mjs +1 -1
  371. package/dist/modules/commands/utils/delete-command.client.mjs.map +1 -1
  372. package/dist/modules/config/lib/context.d.mts +9 -10
  373. package/dist/modules/config/lib/context.d.mts.map +1 -1
  374. package/dist/modules/config/lib/context.mjs.map +1 -1
  375. package/dist/modules/data-tables/components/cell/select.client.mjs +1 -1
  376. package/dist/modules/data-tables/components/cell/select.client.mjs.map +1 -1
  377. package/dist/modules/data-tables/components/column-header.mjs +5 -5
  378. package/dist/modules/data-tables/components/column-header.mjs.map +1 -1
  379. package/dist/modules/data-tables/components/filters/combobox.client.mjs +6 -6
  380. package/dist/modules/data-tables/components/filters/combobox.client.mjs.map +1 -1
  381. package/dist/modules/data-tables/components/filters/slider.client.mjs +2 -2
  382. package/dist/modules/data-tables/components/filters/slider.client.mjs.map +1 -1
  383. package/dist/modules/data-tables/components/header.mjs +1 -1
  384. package/dist/modules/data-tables/components/header.mjs.map +1 -1
  385. package/dist/modules/data-tables/components/skeleton.mjs +2 -2
  386. package/dist/modules/data-tables/components/skeleton.mjs.map +1 -1
  387. package/dist/modules/data-tables/components/table.mjs +3 -3
  388. package/dist/modules/data-tables/components/table.mjs.map +1 -1
  389. package/dist/modules/data-tables/components/toolbar.mjs +1 -1
  390. package/dist/modules/data-tables/components/toolbar.mjs.map +1 -1
  391. package/dist/modules/data-tables/lib/converters/search.d.mts +1 -1
  392. package/dist/modules/data-tables/lib/converters/sorting.d.mts +1 -1
  393. package/dist/modules/data-tables/server/get-data.server.d.mts +3 -3
  394. package/dist/modules/data-tables/server/get-data.server.mjs +1 -1
  395. package/dist/modules/data-tables/server/get-data.server.mjs.map +1 -1
  396. package/dist/modules/data-tables/strategies/infinite/strategy.d.mts +1 -1
  397. package/dist/modules/data-tables/strategies/infinite/strategy.mjs +3 -0
  398. package/dist/modules/data-tables/strategies/infinite/strategy.mjs.map +1 -1
  399. package/dist/modules/data-tables/strategies/pagination/components.mjs +3 -3
  400. package/dist/modules/data-tables/strategies/pagination/components.mjs.map +1 -1
  401. package/dist/modules/data-tables/tables/data-table/components/row.mjs +5 -15
  402. package/dist/modules/data-tables/tables/data-table/components/row.mjs.map +1 -1
  403. package/dist/modules/data-tables/tables/inline-table/components/body.mjs +1 -1
  404. package/dist/modules/data-tables/tables/inline-table/components/body.mjs.map +1 -1
  405. package/dist/modules/data-tables/tables/inline-table/components/cells/common.mjs +1 -1
  406. package/dist/modules/data-tables/tables/inline-table/components/cells/common.mjs.map +1 -1
  407. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs +1 -1
  408. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs.map +1 -1
  409. package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.mjs +1 -1
  410. package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.mjs.map +1 -1
  411. package/dist/modules/data-tables/tables/inline-table/components/row.client.mjs +13 -23
  412. package/dist/modules/data-tables/tables/inline-table/components/row.client.mjs.map +1 -1
  413. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +1 -0
  414. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
  415. package/dist/modules/data-tables/tables/inline-table/components/table.mjs +2 -1
  416. package/dist/modules/data-tables/tables/inline-table/components/table.mjs.map +1 -1
  417. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +5 -1
  418. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
  419. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs +2 -1
  420. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs.map +1 -1
  421. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts +30 -0
  422. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts.map +1 -0
  423. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs +77 -9
  424. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs.map +1 -1
  425. package/dist/modules/{config/db → database/lib}/helpers.d.mts +2 -2
  426. package/dist/modules/database/lib/helpers.d.mts.map +1 -0
  427. package/dist/modules/{config/db → database/lib}/helpers.mjs +1 -1
  428. package/dist/modules/database/lib/helpers.mjs.map +1 -0
  429. package/dist/modules/database/lib/service.server.d.mts +34 -0
  430. package/dist/modules/database/lib/service.server.d.mts.map +1 -0
  431. package/dist/modules/database/lib/service.server.mjs +24 -0
  432. package/dist/modules/database/lib/service.server.mjs.map +1 -0
  433. package/dist/modules/{config/db → database/lib}/types.d.mts +1 -1
  434. package/dist/modules/database/lib/types.d.mts.map +1 -0
  435. package/dist/modules/emails/lib/service.server.d.mts +29 -0
  436. package/dist/modules/emails/lib/service.server.d.mts.map +1 -0
  437. package/dist/modules/emails/lib/service.server.mjs +21 -0
  438. package/dist/modules/emails/lib/service.server.mjs.map +1 -0
  439. package/dist/modules/inline-edit/components/date-input.client.mjs +4 -4
  440. package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
  441. package/dist/modules/inline-edit/components/date-picker.client.mjs +3 -2
  442. package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
  443. package/dist/modules/inline-edit/components/date-time.client.d.mts +1 -1
  444. package/dist/modules/inline-edit/components/date-time.client.mjs +2 -1
  445. package/dist/modules/inline-edit/components/date-time.client.mjs.map +1 -1
  446. package/dist/modules/inline-edit/components/editor.client.mjs +1 -0
  447. package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
  448. package/dist/modules/inline-edit/components/input-recipient.client.mjs +1 -0
  449. package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
  450. package/dist/modules/inline-edit/components/input-toggle.client.mjs +3 -2
  451. package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
  452. package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
  453. package/dist/modules/inline-edit/components/input.client.mjs +6 -3
  454. package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
  455. package/dist/modules/inline-edit/components/select.client.d.mts +8 -11
  456. package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
  457. package/dist/modules/inline-edit/components/select.client.mjs +1 -0
  458. package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
  459. package/dist/modules/inline-edit/components/switch.client.d.mts +3 -2
  460. package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
  461. package/dist/modules/inline-edit/components/switch.client.mjs +2 -1
  462. package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
  463. package/dist/modules/inline-edit/components/toggle.client.mjs +2 -1
  464. package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
  465. package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
  466. package/dist/modules/inline-edit/lib/variants.mjs +1 -1
  467. package/dist/modules/inline-edit/lib/variants.mjs.map +1 -1
  468. package/dist/modules/router/handler/context.server.d.mts +12 -10
  469. package/dist/modules/router/handler/context.server.d.mts.map +1 -1
  470. package/dist/modules/router/handler/init.server.d.mts +13 -11
  471. package/dist/modules/router/handler/init.server.d.mts.map +1 -1
  472. package/dist/modules/router/handler/init.server.mjs +2 -2
  473. package/dist/modules/router/handler/init.server.mjs.map +1 -1
  474. package/dist/modules/router/handler/route.server.d.mts +1 -1
  475. package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
  476. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  477. package/dist/modules/storage/components/dropzone.client.mjs +8 -8
  478. package/dist/modules/storage/components/dropzone.client.mjs.map +1 -1
  479. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  480. package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
  481. package/dist/modules/storage/components/image-grid.client.mjs +24 -26
  482. package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
  483. package/dist/modules/storage/components/image.client.d.mts +8 -0
  484. package/dist/modules/storage/components/image.client.d.mts.map +1 -0
  485. package/dist/modules/storage/components/image.client.mjs +17 -0
  486. package/dist/modules/storage/components/image.client.mjs.map +1 -0
  487. package/dist/modules/storage/components/upload-button.client.d.mts +12 -0
  488. package/dist/modules/storage/components/upload-button.client.d.mts.map +1 -0
  489. package/dist/modules/storage/components/upload-button.client.mjs +34 -0
  490. package/dist/modules/storage/components/upload-button.client.mjs.map +1 -0
  491. package/dist/modules/storage/components/upload-zone-context.client.d.mts +5 -5
  492. package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
  493. package/dist/modules/storage/components/upload-zone-context.client.mjs +2 -2
  494. package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
  495. package/dist/modules/storage/components/upload-zone.client.d.mts +4 -4
  496. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  497. package/dist/modules/storage/components/upload-zone.client.mjs +17 -10
  498. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  499. package/dist/modules/storage/lib/constants.d.mts +1 -5
  500. package/dist/modules/storage/lib/constants.d.mts.map +1 -1
  501. package/dist/modules/storage/lib/constants.mjs +1 -13
  502. package/dist/modules/storage/lib/constants.mjs.map +1 -1
  503. package/dist/modules/storage/lib/helpers.d.mts +14 -28
  504. package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
  505. package/dist/modules/storage/lib/helpers.mjs +17 -75
  506. package/dist/modules/storage/lib/helpers.mjs.map +1 -1
  507. package/dist/modules/storage/lib/procedures.server.d.mts +1991 -0
  508. package/dist/modules/{auth/handler/init.d.mts.map → storage/lib/procedures.server.d.mts.map} +1 -1
  509. package/dist/modules/storage/lib/procedures.server.mjs +22 -0
  510. package/dist/modules/storage/lib/procedures.server.mjs.map +1 -0
  511. package/dist/modules/storage/lib/router-handlers.server.d.mts +41 -0
  512. package/dist/modules/storage/lib/router-handlers.server.d.mts.map +1 -0
  513. package/dist/modules/storage/lib/router-handlers.server.mjs +124 -0
  514. package/dist/modules/storage/lib/router-handlers.server.mjs.map +1 -0
  515. package/dist/modules/storage/lib/schema.d.mts +68 -958
  516. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  517. package/dist/modules/storage/lib/schema.mjs +28 -65
  518. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  519. package/dist/modules/storage/lib/service.server.d.mts +2155 -141
  520. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  521. package/dist/modules/storage/lib/service.server.mjs +453 -242
  522. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  523. package/dist/modules/storage/lib/upload.client.d.mts +58 -0
  524. package/dist/modules/storage/lib/upload.client.d.mts.map +1 -0
  525. package/dist/modules/storage/lib/upload.client.mjs +87 -0
  526. package/dist/modules/storage/lib/upload.client.mjs.map +1 -0
  527. package/dist/modules/storage/lib/validators.d.mts +297 -835
  528. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  529. package/dist/modules/storage/lib/validators.mjs +32 -76
  530. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  531. package/dist/modules/storage/providers/adapters/s3.server.d.mts +19 -0
  532. package/dist/modules/storage/providers/adapters/s3.server.d.mts.map +1 -0
  533. package/dist/modules/storage/providers/adapters/s3.server.mjs +173 -0
  534. package/dist/modules/storage/providers/adapters/s3.server.mjs.map +1 -0
  535. package/dist/modules/storage/providers/lib/constants.d.mts +6 -0
  536. package/dist/modules/storage/providers/lib/constants.d.mts.map +1 -0
  537. package/dist/modules/storage/providers/lib/constants.mjs +6 -0
  538. package/dist/modules/storage/providers/lib/constants.mjs.map +1 -0
  539. package/dist/modules/storage/providers/lib/errors.d.mts +12 -0
  540. package/dist/modules/storage/providers/lib/errors.d.mts.map +1 -0
  541. package/dist/modules/storage/providers/lib/errors.mjs +13 -0
  542. package/dist/modules/storage/providers/lib/errors.mjs.map +1 -0
  543. package/dist/modules/storage/providers/lib/types.d.mts +21 -0
  544. package/dist/modules/storage/providers/lib/types.d.mts.map +1 -0
  545. package/dist/modules/storage/providers/lib/validators.d.mts +112 -0
  546. package/dist/modules/storage/providers/lib/validators.d.mts.map +1 -0
  547. package/dist/modules/storage/providers/lib/validators.mjs +75 -0
  548. package/dist/modules/storage/providers/lib/validators.mjs.map +1 -0
  549. package/dist/router/server.d.mts +1 -1
  550. package/dist/storage/client.d.mts +4 -2
  551. package/dist/storage/client.mjs +4 -2
  552. package/dist/storage/server.d.mts +5 -4
  553. package/dist/storage/server.mjs +5 -4
  554. package/dist/storage.d.mts +9 -6
  555. package/dist/storage.mjs +8 -6
  556. package/package.json +20 -32
  557. package/src/components/editor/components/editor.client.tsx +9 -1
  558. package/src/components/editor/components/menu-nodes.client.tsx +1 -1
  559. package/src/components/editor/components/menu.client.tsx +3 -3
  560. package/src/components/editor/extensions/file-handler/extension.ts +4 -4
  561. package/src/components/editor/extensions/file-handler/strategy.ts +15 -40
  562. package/src/components/editor/extensions/file-handler/utils.ts +1 -1
  563. package/src/components/editor/extensions/image/extension.ts +10 -10
  564. package/src/components/editor/lib/helpers.ts +28 -11
  565. package/src/components/emails/forget-password-email.tsx +6 -6
  566. package/src/components/entry.client.ts +16 -0
  567. package/src/components/entry.ts +6 -14
  568. package/src/components/header/back-button.client.tsx +2 -2
  569. package/src/components/header/bottom-bar.client.tsx +2 -2
  570. package/src/components/header/breadcrumbs.client.tsx +1 -1
  571. package/src/components/header/header.client.tsx +1 -1
  572. package/src/components/layouts/empty-page.tsx +2 -2
  573. package/src/components/layouts/error-page.tsx +3 -3
  574. package/src/components/layouts/providers.client.tsx +8 -5
  575. package/src/components/layouts/root-loading.tsx +2 -2
  576. package/src/components/layouts/tab-layout.tsx +1 -1
  577. package/src/components/lists/data-list.tsx +1 -1
  578. package/src/components/lists/data-stack.tsx +1 -1
  579. package/src/components/navigation/admin-sidebar-header.client.tsx +3 -3
  580. package/src/components/navigation/admin-sidebar-skeleton.tsx +1 -1
  581. package/src/components/ui/accordion.client.tsx +83 -0
  582. package/src/components/ui/alert-dialog.client.tsx +181 -0
  583. package/src/components/ui/alert.tsx +15 -7
  584. package/src/components/ui/aspect-ratio.client.tsx +9 -0
  585. package/src/components/ui/avatar.client.tsx +61 -6
  586. package/src/components/ui/badge.tsx +17 -11
  587. package/src/components/ui/breadcrumb.tsx +9 -10
  588. package/src/components/ui/button-group.tsx +78 -0
  589. package/src/components/ui/button.tsx +26 -16
  590. package/src/components/ui/{calendar.tsx → calendar.client.tsx} +27 -20
  591. package/src/components/ui/card.tsx +41 -8
  592. package/src/components/ui/{carousel.tsx → carousel.client.tsx} +12 -12
  593. package/src/components/ui/chart.client.tsx +105 -103
  594. package/src/components/ui/checkbox.client.tsx +28 -0
  595. package/src/components/ui/collapsible.client.tsx +2 -2
  596. package/src/components/ui/combobox-dropdown.client.tsx +3 -2
  597. package/src/components/ui/combobox.client.tsx +7 -7
  598. package/src/components/ui/command.client.tsx +179 -0
  599. package/src/components/ui/{context-menu.tsx → context-menu.client.tsx} +86 -64
  600. package/src/components/ui/date-picker.client.tsx +2 -2
  601. package/src/components/ui/dialog.client.tsx +43 -20
  602. package/src/components/ui/drawer.client.tsx +13 -15
  603. package/src/components/ui/{dropdown-menu.tsx → dropdown-menu.client.tsx} +45 -24
  604. package/src/components/ui/empty.tsx +93 -0
  605. package/src/components/ui/field.client.tsx +224 -0
  606. package/src/components/ui/form.client.tsx +4 -4
  607. package/src/components/ui/hover-card.client.tsx +14 -13
  608. package/src/components/ui/{input-date-time.tsx → input-date-time.client.tsx} +6 -1
  609. package/src/components/ui/input-date.tsx +1 -1
  610. package/src/components/ui/input-group.client.tsx +191 -0
  611. package/src/components/ui/input-recipient.tsx +12 -12
  612. package/src/components/ui/input-time.tsx +1 -1
  613. package/src/components/ui/input.tsx +2 -4
  614. package/src/components/ui/item.tsx +182 -0
  615. package/src/components/ui/kbd.tsx +26 -0
  616. package/src/components/ui/label.tsx +2 -3
  617. package/src/components/ui/loader.tsx +51 -0
  618. package/src/components/ui/navigation-menu.tsx +14 -17
  619. package/src/components/ui/pagination.tsx +31 -26
  620. package/src/components/ui/popover.client.tsx +73 -0
  621. package/src/components/ui/progress.client.tsx +6 -4
  622. package/src/components/ui/radio-group.tsx +5 -7
  623. package/src/components/ui/resizable.client.tsx +9 -19
  624. package/src/components/ui/scroll-area.tsx +5 -7
  625. package/src/components/ui/select.client.tsx +40 -22
  626. package/src/components/ui/separator.tsx +3 -4
  627. package/src/components/ui/sheet.client.tsx +19 -18
  628. package/src/components/ui/sidebar.client.tsx +27 -27
  629. package/src/components/ui/skeleton.tsx +1 -1
  630. package/src/components/ui/slider.tsx +5 -10
  631. package/src/components/ui/spinner.tsx +12 -48
  632. package/src/components/ui/switch.client.tsx +32 -0
  633. package/src/components/ui/tabs.client.tsx +79 -0
  634. package/src/components/ui/textarea.tsx +1 -2
  635. package/src/components/ui/toggle-group.client.tsx +26 -10
  636. package/src/components/ui/toggle.client.tsx +44 -0
  637. package/src/components/ui/tooltip.client.tsx +4 -9
  638. package/src/entry.ts +12 -51
  639. package/src/lib/entry.ts +1 -5
  640. package/src/lib/hooks/use-indicator.tsx +4 -7
  641. package/src/lib/utils/markdown.ts +10 -0
  642. package/src/lib/utils/url.ts +2 -1
  643. package/src/lib/utils/user-agent.ts +15 -0
  644. package/src/modules/auth/components/auth-layout.server.tsx +2 -2
  645. package/src/modules/auth/components/{guard-first-user.server.tsx → create-first-user-guard.server.tsx} +8 -8
  646. package/src/modules/auth/components/create-first-user-page.client.tsx +4 -4
  647. package/src/modules/auth/components/forget-password-page.client.tsx +1 -1
  648. package/src/modules/auth/components/guard.server.tsx +1 -1
  649. package/src/modules/auth/components/login-page.client.tsx +6 -6
  650. package/src/modules/auth/components/reset-password-page.client.tsx +7 -7
  651. package/src/modules/auth/entry.server.ts +4 -5
  652. package/src/modules/auth/handler/create-client.client.ts +2 -2
  653. package/src/modules/auth/handler/proxy.server.ts +1 -1
  654. package/src/modules/auth/handler/route.server.ts +2 -2
  655. package/src/modules/auth/handler/{init.ts → service.server.ts} +30 -9
  656. package/src/modules/commands/components/alert-dialog-command.client.tsx +20 -16
  657. package/src/modules/commands/components/click-command.client.tsx +2 -2
  658. package/src/modules/commands/components/dialog-command.client.tsx +11 -10
  659. package/src/modules/commands/components/dropdown-command.client.tsx +2 -2
  660. package/src/modules/commands/components/empty-command.client.tsx +2 -2
  661. package/src/modules/commands/components/form-dialog-command.client.tsx +29 -13
  662. package/src/modules/commands/menus/context-menu.client.tsx +3 -4
  663. package/src/modules/commands/menus/dropdown-menu.client.tsx +2 -2
  664. package/src/modules/commands/menus/floating-menu.client.tsx +2 -2
  665. package/src/modules/commands/utils/archive-command.client.tsx +1 -1
  666. package/src/modules/commands/utils/delete-command.client.tsx +1 -1
  667. package/src/modules/config/entry.server.ts +0 -9
  668. package/src/modules/config/entry.ts +2 -2
  669. package/src/modules/config/lib/context.ts +9 -9
  670. package/src/modules/data-tables/components/cell/select.client.tsx +1 -1
  671. package/src/modules/data-tables/components/column-header.tsx +5 -5
  672. package/src/modules/data-tables/components/filters/combobox.client.tsx +6 -6
  673. package/src/modules/data-tables/components/filters/slider.client.tsx +2 -2
  674. package/src/modules/data-tables/components/header.tsx +1 -1
  675. package/src/modules/data-tables/components/skeleton.tsx +2 -2
  676. package/src/modules/data-tables/components/table.tsx +3 -3
  677. package/src/modules/data-tables/components/toolbar.tsx +1 -1
  678. package/src/modules/data-tables/entry.client.ts +1 -0
  679. package/src/modules/data-tables/server/get-data.server.ts +1 -1
  680. package/src/modules/data-tables/strategies/infinite/strategy.ts +4 -1
  681. package/src/modules/data-tables/strategies/pagination/components.tsx +3 -3
  682. package/src/modules/data-tables/tables/data-table/components/row.tsx +12 -21
  683. package/src/modules/data-tables/tables/inline-table/components/body.tsx +1 -1
  684. package/src/modules/data-tables/tables/inline-table/components/cells/common.tsx +1 -1
  685. package/src/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.tsx +1 -1
  686. package/src/modules/data-tables/tables/inline-table/components/cells/read-only.tsx +1 -1
  687. package/src/modules/data-tables/tables/inline-table/components/row.client.tsx +24 -30
  688. package/src/modules/data-tables/tables/inline-table/components/table.tsx +6 -1
  689. package/src/modules/data-tables/tables/inline-table/hooks/context.client.tsx +5 -0
  690. package/src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.ts +119 -91
  691. package/src/modules/database/entry.client.ts +0 -0
  692. package/src/modules/database/entry.server.ts +4 -0
  693. package/src/modules/database/entry.ts +5 -0
  694. package/src/modules/database/lib/service.server.ts +33 -0
  695. package/src/modules/emails/entry.client.ts +0 -0
  696. package/src/modules/emails/entry.server.ts +4 -0
  697. package/src/modules/emails/entry.ts +0 -0
  698. package/src/modules/emails/lib/service.server.ts +29 -0
  699. package/src/modules/inline-edit/components/date-input.client.tsx +4 -4
  700. package/src/modules/inline-edit/components/date-picker.client.tsx +3 -2
  701. package/src/modules/inline-edit/components/date-time.client.tsx +2 -1
  702. package/src/modules/inline-edit/components/editor.client.tsx +3 -0
  703. package/src/modules/inline-edit/components/input-recipient.client.tsx +1 -0
  704. package/src/modules/inline-edit/components/input-toggle.client.tsx +3 -2
  705. package/src/modules/inline-edit/components/input.client.tsx +6 -3
  706. package/src/modules/inline-edit/components/select.client.tsx +11 -21
  707. package/src/modules/inline-edit/components/switch.client.tsx +4 -3
  708. package/src/modules/inline-edit/components/toggle.client.tsx +2 -1
  709. package/src/modules/inline-edit/lib/variants.ts +1 -1
  710. package/src/modules/router/handler/init.server.ts +2 -2
  711. package/src/modules/storage/components/dropzone.client.tsx +9 -9
  712. package/src/modules/storage/components/image-grid.client.tsx +28 -25
  713. package/src/modules/storage/components/image.client.tsx +8 -0
  714. package/src/modules/storage/components/upload-zone-context.client.tsx +11 -8
  715. package/src/modules/storage/components/upload-zone.client.tsx +23 -17
  716. package/src/modules/storage/entry.client.ts +3 -1
  717. package/src/modules/storage/entry.server.ts +9 -3
  718. package/src/modules/storage/entry.ts +13 -1
  719. package/src/modules/storage/lib/constants.ts +0 -11
  720. package/src/modules/storage/lib/helpers.ts +18 -65
  721. package/src/modules/storage/lib/procedures.server.ts +60 -0
  722. package/src/modules/storage/lib/router-handlers.server.ts +178 -0
  723. package/src/modules/storage/lib/schema.ts +26 -97
  724. package/src/modules/storage/lib/service.server.ts +636 -374
  725. package/src/modules/storage/lib/upload.client.ts +156 -0
  726. package/src/modules/storage/lib/validators.ts +50 -111
  727. package/src/modules/storage/providers/adapters/s3.server.ts +281 -0
  728. package/src/modules/storage/providers/lib/constants.ts +3 -0
  729. package/src/modules/storage/providers/lib/errors.ts +21 -0
  730. package/src/modules/storage/providers/lib/types.ts +28 -0
  731. package/src/modules/storage/providers/lib/validators.ts +122 -0
  732. package/src/styles.css +1 -3
  733. package/dist/components/ui/accordion.d.mts +0 -25
  734. package/dist/components/ui/accordion.d.mts.map +0 -1
  735. package/dist/components/ui/accordion.mjs +0 -46
  736. package/dist/components/ui/accordion.mjs.map +0 -1
  737. package/dist/components/ui/alert-dialog.d.mts +0 -43
  738. package/dist/components/ui/alert-dialog.d.mts.map +0 -1
  739. package/dist/components/ui/alert-dialog.mjs +0 -84
  740. package/dist/components/ui/alert-dialog.mjs.map +0 -1
  741. package/dist/components/ui/aspect-ratio.d.mts +0 -8
  742. package/dist/components/ui/aspect-ratio.d.mts.map +0 -1
  743. package/dist/components/ui/aspect-ratio.mjs +0 -16
  744. package/dist/components/ui/aspect-ratio.mjs.map +0 -1
  745. package/dist/components/ui/calendar.d.mts.map +0 -1
  746. package/dist/components/ui/calendar.mjs.map +0 -1
  747. package/dist/components/ui/carousel.d.mts.map +0 -1
  748. package/dist/components/ui/carousel.mjs.map +0 -1
  749. package/dist/components/ui/checkbox.d.mts +0 -12
  750. package/dist/components/ui/checkbox.d.mts.map +0 -1
  751. package/dist/components/ui/checkbox.mjs +0 -24
  752. package/dist/components/ui/checkbox.mjs.map +0 -1
  753. package/dist/components/ui/command.d.mts.map +0 -1
  754. package/dist/components/ui/command.mjs +0 -88
  755. package/dist/components/ui/command.mjs.map +0 -1
  756. package/dist/components/ui/context-menu.d.mts +0 -77
  757. package/dist/components/ui/context-menu.d.mts.map +0 -1
  758. package/dist/components/ui/context-menu.mjs +0 -125
  759. package/dist/components/ui/context-menu.mjs.map +0 -1
  760. package/dist/components/ui/dropdown-menu.d.mts +0 -78
  761. package/dist/components/ui/dropdown-menu.d.mts.map +0 -1
  762. package/dist/components/ui/dropdown-menu.mjs +0 -126
  763. package/dist/components/ui/dropdown-menu.mjs.map +0 -1
  764. package/dist/components/ui/input-date-time.d.mts.map +0 -1
  765. package/dist/components/ui/input-date-time.mjs.map +0 -1
  766. package/dist/components/ui/popover.d.mts +0 -23
  767. package/dist/components/ui/popover.d.mts.map +0 -1
  768. package/dist/components/ui/popover.mjs +0 -38
  769. package/dist/components/ui/popover.mjs.map +0 -1
  770. package/dist/components/ui/switch.d.mts +0 -12
  771. package/dist/components/ui/switch.d.mts.map +0 -1
  772. package/dist/components/ui/switch.mjs +0 -22
  773. package/dist/components/ui/switch.mjs.map +0 -1
  774. package/dist/components/ui/tabs.d.mts +0 -24
  775. package/dist/components/ui/tabs.d.mts.map +0 -1
  776. package/dist/components/ui/tabs.mjs +0 -39
  777. package/dist/components/ui/tabs.mjs.map +0 -1
  778. package/dist/components/ui/toggle.d.mts.map +0 -1
  779. package/dist/components/ui/toggle.mjs +0 -40
  780. package/dist/components/ui/toggle.mjs.map +0 -1
  781. package/dist/lib/config/constants.d.mts +0 -5
  782. package/dist/lib/config/constants.d.mts.map +0 -1
  783. package/dist/lib/config/constants.mjs +0 -6
  784. package/dist/lib/config/constants.mjs.map +0 -1
  785. package/dist/modules/auth/components/guard-first-user.server.d.mts +0 -18
  786. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +0 -1
  787. package/dist/modules/auth/components/guard-first-user.server.mjs +0 -16
  788. package/dist/modules/auth/components/guard-first-user.server.mjs.map +0 -1
  789. package/dist/modules/auth/handler/init.mjs.map +0 -1
  790. package/dist/modules/config/db/helpers.d.mts.map +0 -1
  791. package/dist/modules/config/db/helpers.mjs.map +0 -1
  792. package/dist/modules/config/db/init.d.mts +0 -20
  793. package/dist/modules/config/db/init.d.mts.map +0 -1
  794. package/dist/modules/config/db/init.mjs +0 -15
  795. package/dist/modules/config/db/init.mjs.map +0 -1
  796. package/dist/modules/config/db/types.d.mts.map +0 -1
  797. package/dist/modules/config/providers/email.d.mts +0 -12
  798. package/dist/modules/config/providers/email.d.mts.map +0 -1
  799. package/dist/modules/config/providers/email.mjs +0 -11
  800. package/dist/modules/config/providers/email.mjs.map +0 -1
  801. package/dist/modules/storage/config/filters.d.mts +0 -17
  802. package/dist/modules/storage/config/filters.d.mts.map +0 -1
  803. package/dist/modules/storage/config/filters.mjs +0 -17
  804. package/dist/modules/storage/config/filters.mjs.map +0 -1
  805. package/dist/modules/storage/lib/create-client.server.d.mts +0 -11
  806. package/dist/modules/storage/lib/create-client.server.d.mts.map +0 -1
  807. package/dist/modules/storage/lib/create-client.server.mjs +0 -11
  808. package/dist/modules/storage/lib/create-client.server.mjs.map +0 -1
  809. package/dist/modules/storage/lib/create-upload.client.d.mts +0 -56
  810. package/dist/modules/storage/lib/create-upload.client.d.mts.map +0 -1
  811. package/dist/modules/storage/lib/create-upload.client.mjs +0 -98
  812. package/dist/modules/storage/lib/create-upload.client.mjs.map +0 -1
  813. package/dist/modules/storage/lib/proxy.server.d.mts +0 -21
  814. package/dist/modules/storage/lib/proxy.server.d.mts.map +0 -1
  815. package/dist/modules/storage/lib/proxy.server.mjs +0 -46
  816. package/dist/modules/storage/lib/proxy.server.mjs.map +0 -1
  817. package/dist/modules/storage/lib/router.server.d.mts +0 -31002
  818. package/dist/modules/storage/lib/router.server.d.mts.map +0 -1
  819. package/dist/modules/storage/lib/router.server.mjs +0 -86
  820. package/dist/modules/storage/lib/router.server.mjs.map +0 -1
  821. package/src/components/ui/accordion.tsx +0 -63
  822. package/src/components/ui/alert-dialog.tsx +0 -133
  823. package/src/components/ui/aspect-ratio.tsx +0 -9
  824. package/src/components/ui/checkbox.tsx +0 -29
  825. package/src/components/ui/command.tsx +0 -154
  826. package/src/components/ui/popover.tsx +0 -42
  827. package/src/components/ui/switch.tsx +0 -28
  828. package/src/components/ui/tabs.tsx +0 -54
  829. package/src/components/ui/toggle.tsx +0 -46
  830. package/src/lib/config/constants.ts +0 -1
  831. package/src/lib/utils/time-picker.ts +0 -139
  832. package/src/modules/config/db/init.ts +0 -21
  833. package/src/modules/config/providers/email.ts +0 -13
  834. package/src/modules/storage/config/filters.ts +0 -12
  835. package/src/modules/storage/lib/create-client.server.ts +0 -14
  836. package/src/modules/storage/lib/create-upload.client.ts +0 -134
  837. package/src/modules/storage/lib/proxy.server.ts +0 -63
  838. package/src/modules/storage/lib/router.server.ts +0 -182
  839. /package/src/modules/{config/db → database/lib}/helpers.ts +0 -0
  840. /package/src/modules/{config/db → database/lib}/types.ts +0 -0
@@ -3,28 +3,28 @@
3
3
  import { Icons } from "../../../components/common/icons.mjs";
4
4
  import { cn } from "../../../lib/utils/cn.mjs";
5
5
  import { Button } from "../../../components/ui/button.mjs";
6
- import { getFileUrl, imageLoader } from "../lib/helpers.mjs";
6
+ import { getAssetURL } from "../lib/helpers.mjs";
7
7
  import { Skeleton } from "../../../components/ui/skeleton.mjs";
8
8
  import { Input } from "../../../components/ui/input.mjs";
9
+ import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../../../components/ui/carousel.client.mjs";
9
10
  import { Dialog, DialogContent, DialogTrigger } from "../../../components/ui/dialog.client.mjs";
10
11
  import { Card } from "../../../components/ui/card.mjs";
11
- import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../../../components/ui/carousel.mjs";
12
12
  import { useAction } from "../../../lib/hooks/use-action.mjs";
13
+ import { StorageImage } from "./image.client.mjs";
13
14
  import { useUploadZone } from "./upload-zone-context.client.mjs";
14
15
  import { GripIcon, UploadIcon } from "lucide-react";
15
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
17
  import React from "react";
17
- import Image$1 from "next/image";
18
18
  import { SortableContext, rectSortingStrategy, sortableKeyboardCoordinates, useSortable } from "@dnd-kit/sortable";
19
19
  import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
20
20
  import { CSS } from "@dnd-kit/utilities";
21
21
 
22
22
  //#region src/modules/storage/components/image-grid.client.tsx
23
- function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }) {
23
+ function ImageGrid({ assets, moveAction, optimistic, disabled, ...props }) {
24
24
  const uploadZone = useUploadZone();
25
- const images = nodes.flatMap((node) => ({
26
- ...node,
27
- url: getFileUrl(node.id)
25
+ const images = assets.flatMap((asset) => ({
26
+ ...asset,
27
+ url: getAssetURL(asset.id)
28
28
  }));
29
29
  const [current, setCurrent] = React.useState(0);
30
30
  const { setNodeRef } = useDroppable({ id: "image-grid" });
@@ -66,13 +66,13 @@ function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }) {
66
66
  children: /* @__PURE__ */ jsxs(SortableContext, {
67
67
  items: images.map((image) => image.id),
68
68
  strategy: rectSortingStrategy,
69
- children: [images.map((node, index) => /* @__PURE__ */ jsx(ImageGridItem, {
70
- node,
69
+ children: [images.map((asset, index) => /* @__PURE__ */ jsx(ImageGridItem, {
70
+ asset,
71
71
  index,
72
72
  setCurrent
73
- }, node.id)), !disabled && /* @__PURE__ */ jsxs("label", {
73
+ }, asset.id)), !disabled && /* @__PURE__ */ jsxs("label", {
74
74
  htmlFor: "file-upload",
75
- className: "border-muted-foreground bg-muted hover:border-primary relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-dashed",
75
+ className: "relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-muted-foreground border-dashed bg-muted hover:border-primary",
76
76
  children: [/* @__PURE__ */ jsx(UploadIcon, { className: "h-8 w-8" }), /* @__PURE__ */ jsx(Input, {
77
77
  id: "file-upload",
78
78
  type: "file",
@@ -97,13 +97,12 @@ function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }) {
97
97
  className: "md:max-h-[80vh]",
98
98
  children: images.map(({ id, url }) => /* @__PURE__ */ jsx(CarouselItem, {
99
99
  className: "overflow-hidden rounded-xl",
100
- children: /* @__PURE__ */ jsx(Image$1, {
100
+ children: /* @__PURE__ */ jsx(StorageImage, {
101
101
  src: url,
102
102
  alt: "Image Preview",
103
103
  width: 1920,
104
104
  height: 1080,
105
- className: "h-full w-full rounded-xl object-contain",
106
- loader: imageLoader
105
+ className: "h-full w-full rounded-xl object-contain"
107
106
  })
108
107
  }, id))
109
108
  }),
@@ -114,27 +113,26 @@ function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }) {
114
113
  })]
115
114
  });
116
115
  }
117
- function ImageGridItem({ node, index, setCurrent }) {
116
+ function ImageGridItem({ asset, index, setCurrent }) {
118
117
  const uploadZone = useUploadZone();
119
- const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: node.id });
118
+ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: asset.id });
120
119
  return /* @__PURE__ */ jsx(Card, {
121
- id: node.id,
120
+ id: asset.id,
122
121
  ref: setNodeRef,
123
122
  style: {
124
123
  transform: CSS.Transform.toString(transform),
125
124
  transition
126
125
  },
127
- className: cn("group relative aspect-square w-full", node.isPending && "opacity-30"),
128
- children: !node.isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
126
+ className: cn("group relative aspect-square w-full", asset.status === "pending" && "opacity-30"),
127
+ children: asset.status === "ready" ? /* @__PURE__ */ jsxs(Fragment, { children: [
129
128
  /* @__PURE__ */ jsx(DialogTrigger, {
130
129
  onClick: () => setCurrent(index),
131
- children: /* @__PURE__ */ jsx(Image$1, {
132
- src: node.url,
130
+ children: /* @__PURE__ */ jsx(StorageImage, {
131
+ src: asset.url,
133
132
  alt: "Image Preview",
134
133
  width: 100,
135
134
  height: 100,
136
- className: "bg-muted absolute inset-0 h-full w-full cursor-pointer rounded-lg object-contain",
137
- loader: imageLoader
135
+ className: "absolute inset-0 h-full w-full cursor-pointer rounded-lg bg-muted object-contain"
138
136
  })
139
137
  }),
140
138
  /* @__PURE__ */ jsx(Button, {
@@ -143,15 +141,15 @@ function ImageGridItem({ node, index, setCurrent }) {
143
141
  type: "button",
144
142
  variant: "secondary",
145
143
  size: "icon",
146
- className: "absolute right-2 top-2 hidden p-1 group-hover:flex",
144
+ className: "absolute top-2 right-2 hidden p-1 group-hover:flex",
147
145
  children: /* @__PURE__ */ jsx(GripIcon, { className: "size-4" })
148
146
  }),
149
147
  /* @__PURE__ */ jsx(Button, {
150
148
  type: "button",
151
149
  variant: "destructive",
152
150
  size: "icon",
153
- onClick: () => uploadZone.onRemove([node.id]),
154
- className: "absolute left-2 top-2 hidden p-1 group-hover:flex",
151
+ onClick: () => uploadZone.onRemove([asset.id]),
152
+ className: "absolute top-2 left-2 hidden p-1 group-hover:flex",
155
153
  children: /* @__PURE__ */ jsx(Icons.trash, { className: "size-4" })
156
154
  })
157
155
  ] }) : /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0 h-full w-full rounded-lg" })
@@ -1 +1 @@
1
- {"version":3,"file":"image-grid.client.mjs","names":["Image"],"sources":["../../../../src/modules/storage/components/image-grid.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useDroppable,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport {\n rectSortingStrategy,\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { GripIcon, UploadIcon } from \"lucide-react\";\nimport Image from \"next/image\";\nimport React, { type ComponentProps } from \"react\";\nimport { Icons } from \"@/components/common/icons\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card } from \"@/components/ui/card\";\nimport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n} from \"@/components/ui/carousel\";\nimport { Dialog, DialogContent, DialogTrigger } from \"@/components/ui/dialog.client\";\nimport { Input } from \"@/components/ui/input\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { useAction } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { getFileUrl, imageLoader } from \"../lib/helpers\";\nimport type { FileNode } from \"../lib/validators\";\nimport { useUploadZone } from \"./upload-zone-context.client\";\n\n/**\n * Image Grid\n */\ntype ImageGridProps = ComponentProps<\"div\"> & {\n nodes: FileNode[];\n disabled?: boolean;\n moveAction: (params: { fromIndex: number; toIndex: number }) => Promise<void>;\n optimistic?: {\n move?: (params: { fromIndex: number; toIndex: number }) => Promise<void> | void;\n };\n};\n\nexport function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }: ImageGridProps) {\n const uploadZone = useUploadZone();\n\n const images = nodes.flatMap((node) => ({ ...node, url: getFileUrl(node.id) }));\n\n const [current, setCurrent] = React.useState<number>(0);\n\n const { setNodeRef } = useDroppable({ id: \"image-grid\" });\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const moveMuration = useAction({\n mutationFn: async ({ active, over }: DragEndEvent) => {\n if (!moveAction) return Promise.resolve();\n\n const activeId = active.id;\n const overId = over?.id;\n if (!activeId || !overId || activeId === overId) return Promise.resolve();\n\n const fromIndex = images.findIndex((image) => image.id === activeId);\n const toIndex = images.findIndex((image) => image.id === overId);\n\n await optimistic?.move?.({ fromIndex, toIndex });\n await moveAction({ fromIndex, toIndex });\n },\n onSuccess: async () => {\n setCurrent(0);\n await uploadZone.optimistic?.invalidate?.();\n },\n onError: (error) => {\n console.error(\"Error moving image:\", error);\n },\n });\n\n return (\n <Dialog {...props}>\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={moveMuration.mutate}\n >\n <div\n ref={setNodeRef}\n className=\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\"\n >\n <SortableContext items={images.map((image) => image.id)} strategy={rectSortingStrategy}>\n {images.map((node, index) => (\n <ImageGridItem key={node.id} node={node} index={index} setCurrent={setCurrent} />\n ))}\n\n {!disabled && (\n <label\n htmlFor=\"file-upload\"\n className=\"border-muted-foreground bg-muted hover:border-primary relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-dashed\"\n >\n <UploadIcon className=\"h-8 w-8\" />\n <Input\n id=\"file-upload\"\n type=\"file\"\n accept=\"image/jpeg, image/png, image/webp, image/gif\"\n className=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n multiple\n onChange={(e) => {\n if (!e.target.files) return;\n return Array.from(e.target.files).map(uploadZone.onUpload);\n }}\n />\n </label>\n )}\n </SortableContext>\n </div>\n </DndContext>\n\n <Carousel className=\"w-full\" opts={{ startIndex: current }}>\n <DialogContent className=\"border-none bg-transparent p-0 shadow-none md:max-w-[80vw] xl:max-w-[60vw]\">\n <CarouselContent className=\"md:max-h-[80vh]\">\n {images.map(({ id, url }) => (\n <CarouselItem key={id} className=\"overflow-hidden rounded-xl\">\n <Image\n src={url}\n alt=\"Image Preview\"\n width={1920}\n height={1080}\n className=\"h-full w-full rounded-xl object-contain\"\n loader={imageLoader}\n />\n </CarouselItem>\n ))}\n </CarouselContent>\n <CarouselPrevious />\n <CarouselNext />\n </DialogContent>\n </Carousel>\n </Dialog>\n );\n}\n\n/**\n * Image Grid Item\n */\ntype ImageGridItemProps = {\n node: FileNode & { url: string };\n index: number;\n setCurrent: React.Dispatch<React.SetStateAction<number>>;\n};\n\nfunction ImageGridItem({ node, index, setCurrent }: ImageGridItemProps) {\n const uploadZone = useUploadZone();\n\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: node.id });\n\n return (\n <Card\n id={node.id}\n ref={setNodeRef}\n style={{\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n className={cn(\"group relative aspect-square w-full\", node.isPending && \"opacity-30\")}\n >\n {!node.isPending ? (\n <>\n <DialogTrigger onClick={() => setCurrent(index)}>\n <Image\n src={node.url}\n alt=\"Image Preview\"\n width={100}\n height={100}\n className=\"bg-muted absolute inset-0 h-full w-full cursor-pointer rounded-lg object-contain\"\n loader={imageLoader}\n />\n </DialogTrigger>\n\n <Button\n {...attributes}\n {...listeners}\n type=\"button\"\n variant=\"secondary\"\n size=\"icon\"\n className=\"absolute right-2 top-2 hidden p-1 group-hover:flex\"\n >\n <GripIcon className=\"size-4\" />\n </Button>\n\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"icon\"\n onClick={() => uploadZone.onRemove([node.id])}\n className=\"absolute left-2 top-2 hidden p-1 group-hover:flex\"\n >\n <Icons.trash className=\"size-4\" />\n </Button>\n </>\n ) : (\n <Skeleton className=\"absolute inset-0 h-full w-full rounded-lg\" />\n )}\n </Card>\n );\n}\n\nexport function ImageGridSkeleton(props: ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n className={cn(\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\", props.className)}\n >\n {Array.from({ length: 12 }).map((_, index) => (\n <Skeleton key={index} className=\"aspect-square w-full rounded-lg\" />\n ))}\n </div>\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"image-grid.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/image-grid.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useDroppable,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport {\n rectSortingStrategy,\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { GripIcon, UploadIcon } from \"lucide-react\";\nimport React, { type ComponentProps } from \"react\";\nimport { Icons } from \"@/components/common/icons\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card } from \"@/components/ui/card\";\nimport {\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n} from \"@/components/ui/carousel.client\";\nimport { Dialog, DialogContent, DialogTrigger } from \"@/components/ui/dialog.client\";\nimport { Input } from \"@/components/ui/input\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { useAction } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { getAssetURL } from \"../lib/helpers\";\nimport type { StorageAsset } from \"../lib/validators\";\nimport { StorageImage } from \"./image.client\";\nimport { useUploadZone } from \"./upload-zone-context.client\";\n\n/**\n * Image Grid\n */\ntype ImageGridProps = ComponentProps<\"div\"> & {\n assets: StorageAsset[];\n disabled?: boolean;\n moveAction: (params: { fromIndex: number; toIndex: number }) => Promise<void>;\n optimistic?: {\n move?: (params: { fromIndex: number; toIndex: number }) => Promise<void> | void;\n };\n};\n\nexport function ImageGrid({ assets, moveAction, optimistic, disabled, ...props }: ImageGridProps) {\n const uploadZone = useUploadZone();\n\n const images = assets.flatMap((asset) => ({ ...asset, url: getAssetURL(asset.id) }));\n\n const [current, setCurrent] = React.useState<number>(0);\n\n const { setNodeRef } = useDroppable({ id: \"image-grid\" });\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const moveMuration = useAction({\n mutationFn: async ({ active, over }: DragEndEvent) => {\n if (!moveAction) return Promise.resolve();\n\n const activeId = active.id;\n const overId = over?.id;\n if (!activeId || !overId || activeId === overId) return Promise.resolve();\n\n const fromIndex = images.findIndex((image) => image.id === activeId);\n const toIndex = images.findIndex((image) => image.id === overId);\n\n await optimistic?.move?.({ fromIndex, toIndex });\n await moveAction({ fromIndex, toIndex });\n },\n onSuccess: async () => {\n setCurrent(0);\n await uploadZone.optimistic?.invalidate?.();\n },\n onError: (error) => {\n console.error(\"Error moving image:\", error);\n },\n });\n\n return (\n <Dialog {...props}>\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={moveMuration.mutate}\n >\n <div\n ref={setNodeRef}\n className=\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\"\n >\n <SortableContext items={images.map((image) => image.id)} strategy={rectSortingStrategy}>\n {images.map((asset, index) => (\n <ImageGridItem key={asset.id} asset={asset} index={index} setCurrent={setCurrent} />\n ))}\n\n {!disabled && (\n <label\n htmlFor=\"file-upload\"\n className=\"relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-muted-foreground border-dashed bg-muted hover:border-primary\"\n >\n <UploadIcon className=\"h-8 w-8\" />\n <Input\n id=\"file-upload\"\n type=\"file\"\n accept=\"image/jpeg, image/png, image/webp, image/gif\"\n className=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n multiple\n onChange={(e) => {\n if (!e.target.files) return;\n return Array.from(e.target.files).map(uploadZone.onUpload);\n }}\n />\n </label>\n )}\n </SortableContext>\n </div>\n </DndContext>\n\n <Carousel className=\"w-full\" opts={{ startIndex: current }}>\n <DialogContent className=\"border-none bg-transparent p-0 shadow-none md:max-w-[80vw] xl:max-w-[60vw]\">\n <CarouselContent className=\"md:max-h-[80vh]\">\n {images.map(({ id, url }) => (\n <CarouselItem key={id} className=\"overflow-hidden rounded-xl\">\n <StorageImage\n src={url}\n alt=\"Image Preview\"\n width={1920}\n height={1080}\n className=\"h-full w-full rounded-xl object-contain\"\n />\n </CarouselItem>\n ))}\n </CarouselContent>\n <CarouselPrevious />\n <CarouselNext />\n </DialogContent>\n </Carousel>\n </Dialog>\n );\n}\n\n/**\n * Image Grid Item\n */\ntype ImageGridItemProps = {\n asset: StorageAsset & { url: string };\n index: number;\n setCurrent: React.Dispatch<React.SetStateAction<number>>;\n};\n\nfunction ImageGridItem({ asset, index, setCurrent }: ImageGridItemProps) {\n const uploadZone = useUploadZone();\n\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: asset.id,\n });\n\n return (\n <Card\n id={asset.id}\n ref={setNodeRef}\n style={{\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n className={cn(\n \"group relative aspect-square w-full\",\n asset.status === \"pending\" && \"opacity-30\",\n )}\n >\n {asset.status === \"ready\" ? (\n <>\n <DialogTrigger onClick={() => setCurrent(index)}>\n <StorageImage\n src={asset.url}\n alt=\"Image Preview\"\n width={100}\n height={100}\n className=\"absolute inset-0 h-full w-full cursor-pointer rounded-lg bg-muted object-contain\"\n />\n </DialogTrigger>\n\n <Button\n {...attributes}\n {...listeners}\n type=\"button\"\n variant=\"secondary\"\n size=\"icon\"\n className=\"absolute top-2 right-2 hidden p-1 group-hover:flex\"\n >\n <GripIcon className=\"size-4\" />\n </Button>\n\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"icon\"\n onClick={() => uploadZone.onRemove([asset.id])}\n className=\"absolute top-2 left-2 hidden p-1 group-hover:flex\"\n >\n <Icons.trash className=\"size-4\" />\n </Button>\n </>\n ) : (\n <Skeleton className=\"absolute inset-0 h-full w-full rounded-lg\" />\n )}\n </Card>\n );\n}\n\nexport function ImageGridSkeleton(props: ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n className={cn(\"grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-5\", props.className)}\n >\n {Array.from({ length: 12 }).map((_, index) => (\n <Skeleton key={index} className=\"aspect-square w-full rounded-lg\" />\n ))}\n </div>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { ImageProps } from "next/image";
3
+
4
+ //#region src/modules/storage/components/image.client.d.ts
5
+ declare function StorageImage(props: Omit<ImageProps, "loader">): react_jsx_runtime0.JSX.Element;
6
+ //#endregion
7
+ export { StorageImage };
8
+ //# sourceMappingURL=image.client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/image.client.tsx"],"mappings":";;;;iBAKgB,YAAA,CAAa,KAAA,EAAO,IAAA,CAAK,UAAA,cAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ import { imageLoader } from "../lib/helpers.mjs";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import Image from "next/image";
6
+
7
+ //#region src/modules/storage/components/image.client.tsx
8
+ function StorageImage(props) {
9
+ return /* @__PURE__ */ jsx(Image, {
10
+ ...props,
11
+ loader: imageLoader
12
+ });
13
+ }
14
+
15
+ //#endregion
16
+ export { StorageImage };
17
+ //# sourceMappingURL=image.client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/image.client.tsx"],"sourcesContent":["\"use client\";\n\nimport Image, { type ImageProps } from \"next/image\";\nimport { imageLoader } from \"../lib/helpers\";\n\nexport function StorageImage(props: Omit<ImageProps, \"loader\">) {\n return <Image {...props} loader={imageLoader} />;\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,aAAa,OAAmC;AAC9D,QAAO,oBAAC;EAAM,GAAI;EAAO,QAAQ;GAAe"}
@@ -0,0 +1,12 @@
1
+ import { Button } from "../../../components/ui/button.mjs";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { ComponentProps } from "react";
4
+
5
+ //#region src/modules/storage/components/upload-button.client.d.ts
6
+ declare function UploadButton({
7
+ className,
8
+ ...props
9
+ }: ComponentProps<typeof Button>): react_jsx_runtime0.JSX.Element;
10
+ //#endregion
11
+ export { UploadButton };
12
+ //# sourceMappingURL=upload-button.client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-button.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-button.client.tsx"],"mappings":";;;;;iBASgB,YAAA,CAAA;EAAe,SAAA;EAAA,GAAc;AAAA,GAAS,cAAA,QAAsB,MAAA,IAAO,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ import { cn } from "../../../lib/utils/cn.mjs";
4
+ import { Button } from "../../../components/ui/button.mjs";
5
+ import { Input } from "../../../components/ui/input.mjs";
6
+ import { useUploadZone } from "./upload-zone-context.client.mjs";
7
+ import { UploadIcon } from "lucide-react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/modules/storage/components/upload-button.client.tsx
11
+ function UploadButton({ className, ...props }) {
12
+ const { onUpload } = useUploadZone();
13
+ return /* @__PURE__ */ jsxs(Button, {
14
+ ...props,
15
+ className: cn("relative gap-2", className),
16
+ children: [
17
+ /* @__PURE__ */ jsx(UploadIcon, { className: "h-3 w-3" }),
18
+ /* @__PURE__ */ jsx("span", { children: "Upload" }),
19
+ /* @__PURE__ */ jsx(Input, {
20
+ type: "file",
21
+ className: "absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0",
22
+ multiple: true,
23
+ onChange: (e) => {
24
+ if (!e.target.files) return;
25
+ Array.from(e.target.files).forEach(onUpload);
26
+ }
27
+ })
28
+ ]
29
+ });
30
+ }
31
+
32
+ //#endregion
33
+ export { UploadButton };
34
+ //# sourceMappingURL=upload-button.client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-button.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-button.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { UploadIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useUploadZone } from \"./upload-zone-context.client\";\n\nexport function UploadButton({ className, ...props }: ComponentProps<typeof Button>) {\n const { onUpload } = useUploadZone();\n\n return (\n <Button {...props} className={cn(\"relative gap-2\", className)}>\n <UploadIcon className=\"h-3 w-3\" />\n <span>Upload</span>\n\n <Input\n type=\"file\"\n className=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n multiple\n onChange={(e) => {\n if (!e.target.files) return;\n Array.from(e.target.files).forEach(onUpload);\n }}\n />\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,aAAa,EAAE,WAAW,GAAG,SAAwC;CACnF,MAAM,EAAE,aAAa,eAAe;AAEpC,QACE,qBAAC;EAAO,GAAI;EAAO,WAAW,GAAG,kBAAkB,UAAU;;GAC3D,oBAAC,cAAW,WAAU,YAAY;GAClC,oBAAC,oBAAK,WAAa;GAEnB,oBAAC;IACC,MAAK;IACL,WAAU;IACV;IACA,WAAW,MAAM;AACf,SAAI,CAAC,EAAE,OAAO,MAAO;AACrB,WAAM,KAAK,EAAE,OAAO,MAAM,CAAC,QAAQ,SAAS;;KAE9C;;GACK"}
@@ -1,5 +1,5 @@
1
- import { FileNode, Node } from "../lib/validators.mjs";
2
- import { UploadClient } from "../lib/create-upload.client.mjs";
1
+ import { StorageAsset } from "../lib/validators.mjs";
2
+ import { UploadClient } from "../lib/upload.client.mjs";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/modules/storage/components/upload-zone-context.client.d.ts
@@ -8,10 +8,10 @@ import React from "react";
8
8
  */
9
9
  type UploadZoneContextValue = {
10
10
  uploadClient: UploadClient;
11
- onUpload: (file: File) => Promise<Node>;
11
+ onUpload: (file: File) => Promise<StorageAsset>;
12
12
  onRemove: (ids: string[]) => Promise<void>;
13
13
  optimistic?: {
14
- add?: (newValue: FileNode) => Promise<void> | void;
14
+ add?: (newValue: Omit<StorageAsset, "id" | "key" | "bucket" | "provider" | "createdAt" | "updatedAt">) => Promise<void> | void;
15
15
  remove?: (ids: string[]) => Promise<void> | void;
16
16
  invalidate?: () => Promise<void> | void;
17
17
  cancel?: () => Promise<void> | void;
@@ -21,7 +21,7 @@ type UploadZoneContextValue = {
21
21
  /**
22
22
  * Upload Zone Context
23
23
  */
24
- declare const UploadZoneContext: React.Context<UploadZoneContextValue>;
24
+ declare const UploadZoneContext: React.Context<UploadZoneContextValue | null>;
25
25
  /**
26
26
  * Upload Zone Hook
27
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"mappings":";;;;;;;AASA;KAAY,sBAAA;EACV,YAAA,EAAc,YAAA;EACd,QAAA,GAAW,IAAA,EAAM,IAAA,KAAS,OAAA,CAAQ,IAAA;EAClC,QAAA,GAAW,GAAA,eAAkB,OAAA;EAC7B,UAAA;IACE,GAAA,IAAO,QAAA,EAAU,QAAA,KAAa,OAAA;IAC9B,MAAA,IAAU,GAAA,eAAkB,OAAA;IAC5B,UAAA,SAAmB,OAAA;IACnB,MAAA,SAAe,OAAA;EAAA;EAEjB,QAAA;AAAA;;;;cAQW,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;;;;iBAKd,aAAA,CAAA,GAAa,sBAAA"}
1
+ {"version":3,"file":"upload-zone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"mappings":";;;;;;;AASA;KAAY,sBAAA;EACV,YAAA,EAAc,YAAA;EACd,QAAA,GAAW,IAAA,EAAM,IAAA,KAAS,OAAA,CAAQ,YAAA;EAClC,QAAA,GAAW,GAAA,eAAkB,OAAA;EAC7B,UAAA;IACE,GAAA,IACE,QAAA,EAAU,IAAA,CACR,YAAA,wEAGC,OAAA;IACL,MAAA,IAAU,GAAA,eAAkB,OAAA;IAC5B,UAAA,SAAmB,OAAA;IACnB,MAAA,SAAe,OAAA;EAAA;EAEjB,QAAA;AAAA;;;;cAMW,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;;;;iBAKd,aAAA,CAAA,GAAa,sBAAA"}
@@ -6,13 +6,13 @@ import React from "react";
6
6
  /**
7
7
  * Upload Zone Context
8
8
  */
9
- const UploadZoneContext = React.createContext({});
9
+ const UploadZoneContext = React.createContext(null);
10
10
  /**
11
11
  * Upload Zone Hook
12
12
  */
13
13
  function useUploadZone() {
14
14
  const context = React.useContext(UploadZoneContext);
15
- if (!context) throw new Error("useUploadZone must be used within an UploadZoneProvider");
15
+ if (!context) throw new Error("useUploadZone must be used within an UploadZoneContext provider");
16
16
  return context;
17
17
  }
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone-context.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { UploadClient } from \"../lib/create-upload.client\";\nimport type { FileNode, Node } from \"../lib/validators\";\n\n/**\n * Upload Zone Context Value\n */\nexport type UploadZoneContextValue = {\n uploadClient: UploadClient;\n onUpload: (file: File) => Promise<Node>;\n onRemove: (ids: string[]) => Promise<void>;\n optimistic?: {\n add?: (newValue: FileNode) => Promise<void> | void;\n remove?: (ids: string[]) => Promise<void> | void;\n invalidate?: () => Promise<void> | void;\n cancel?: () => Promise<void> | void;\n };\n disabled?: boolean;\n // updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;\n // invalidateQuery: () => Promise<void> | void;\n};\n\n/**\n * Upload Zone Context\n */\nexport const UploadZoneContext = React.createContext({} as UploadZoneContextValue);\n\n/**\n * Upload Zone Hook\n */\nexport function useUploadZone() {\n const context = React.useContext(UploadZoneContext);\n if (!context) {\n throw new Error(\"useUploadZone must be used within an UploadZoneProvider\");\n }\n return context;\n}\n"],"mappings":";;;;;;;;AA2BA,MAAa,oBAAoB,MAAM,cAAc,EAAE,CAA2B;;;;AAKlF,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,MAAM,WAAW,kBAAkB;AACnD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0DAA0D;AAE5E,QAAO"}
1
+ {"version":3,"file":"upload-zone-context.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { UploadClient } from \"../lib/upload.client\";\nimport type { StorageAsset } from \"../lib/validators\";\n\n/**\n * Upload Zone Context Value\n */\nexport type UploadZoneContextValue = {\n uploadClient: UploadClient;\n onUpload: (file: File) => Promise<StorageAsset>;\n onRemove: (ids: string[]) => Promise<void>;\n optimistic?: {\n add?: (\n newValue: Omit<\n StorageAsset,\n \"id\" | \"key\" | \"bucket\" | \"provider\" | \"createdAt\" | \"updatedAt\"\n >,\n ) => Promise<void> | void;\n remove?: (ids: string[]) => Promise<void> | void;\n invalidate?: () => Promise<void> | void;\n cancel?: () => Promise<void> | void;\n };\n disabled?: boolean;\n};\n\n/**\n * Upload Zone Context\n */\nexport const UploadZoneContext = React.createContext<UploadZoneContextValue | null>(null);\n\n/**\n * Upload Zone Hook\n */\nexport function useUploadZone() {\n const context = React.useContext(UploadZoneContext);\n if (!context) {\n throw new Error(\"useUploadZone must be used within an UploadZoneContext provider\");\n }\n return context;\n}\n"],"mappings":";;;;;;;;AA8BA,MAAa,oBAAoB,MAAM,cAA6C,KAAK;;;;AAKzF,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,MAAM,WAAW,kBAAkB;AACnD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,kEAAkE;AAEpF,QAAO"}
@@ -1,14 +1,14 @@
1
- import { Node, UploadFileSchema } from "../lib/validators.mjs";
2
- import { UploadHooks } from "../lib/create-upload.client.mjs";
1
+ import { StorageAsset, UploadInput } from "../lib/validators.mjs";
2
+ import { UploadHooks } from "../lib/upload.client.mjs";
3
3
  import { UploadZoneContextValue } from "./upload-zone-context.client.mjs";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
  import { ComponentProps } from "react";
6
6
 
7
7
  //#region src/modules/storage/components/upload-zone.client.d.ts
8
8
  type UploadZoneProps = ComponentProps<"div"> & Pick<UploadZoneContextValue, "optimistic" | "uploadClient" | "disabled"> & {
9
- variables: Pick<UploadFileSchema, "namespace" | "parentId" | "mode" | "hidden" | "readonly">;
9
+ variables: Pick<UploadInput, "visibility">;
10
10
  uploadHooks?: UploadHooks;
11
- onUploadCompleted?: (node: Node) => Promise<void> | void;
11
+ onUploadCompleted?: (asset: StorageAsset) => Promise<void> | void;
12
12
  onUploadFailed?: (error: unknown) => Promise<void> | void;
13
13
  };
14
14
  declare function UploadZone({
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"mappings":";;;;;;;KAWY,eAAA,GAAkB,cAAA,UAC5B,IAAA,CAAK,sBAAA;EACH,SAAA,EAAW,IAAA,CAAK,gBAAA;EAChB,WAAA,GAAc,WAAA;EAEd,iBAAA,IAAqB,IAAA,EAAM,IAAA,KAAS,OAAA;EACpC,cAAA,IAAkB,KAAA,cAAmB,OAAA;AAAA;AAAA,iBAGzB,UAAA,CAAA;EACd,SAAA;EACA,UAAA;EACA,YAAA;EACA,WAAA;EACA,iBAAA;EACA,cAAA;EACA,QAAA;EACA,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,eAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"upload-zone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"mappings":";;;;;;;KAWY,eAAA,GAAkB,cAAA,UAC5B,IAAA,CAAK,sBAAA;EACH,SAAA,EAAW,IAAA,CAAK,WAAA;EAChB,WAAA,GAAc,WAAA;EAEd,iBAAA,IAAqB,KAAA,EAAO,YAAA,KAAiB,OAAA;EAC7C,cAAA,IAAkB,KAAA,cAAmB,OAAA;AAAA;AAAA,iBAGzB,UAAA,CAAA;EACd,SAAA;EACA,UAAA;EACA,YAAA;EACA,WAAA;EACA,iBAAA;EACA,cAAA;EACA,QAAA;EACA,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,eAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -14,7 +14,9 @@ function UploadZone({ variables, optimistic, uploadClient, uploadHooks, onUpload
14
14
  * Delete mutation
15
15
  */
16
16
  const deleteMutation = useAction({
17
- mutationFn: async (ids) => uploadClient.deleteFiles(ids),
17
+ mutationFn: async (ids) => {
18
+ await uploadClient.deleteAssets(ids);
19
+ },
18
20
  onMutate: async (ids) => {
19
21
  await optimistic?.cancel?.();
20
22
  await optimistic?.remove?.(ids);
@@ -33,24 +35,29 @@ function UploadZone({ variables, optimistic, uploadClient, uploadHooks, onUpload
33
35
  const uploadMutation = useAction({
34
36
  mutationFn: async (params) => uploadClient.upload(params, uploadHooks),
35
37
  onMutate: async (variables) => {
36
- const newNode = {
38
+ await optimistic?.cancel?.();
39
+ const newAsset = {
37
40
  ...variables,
38
- type: "file",
39
- isPending: true
41
+ visibility: variables.visibility ?? "private",
42
+ status: "pending",
43
+ name: variables.file.name,
44
+ size: variables.file.size,
45
+ contentType: variables.file.type || "application/octet-stream",
46
+ etag: null,
47
+ metadata: null,
48
+ uploadedAt: /* @__PURE__ */ new Date(),
49
+ deletedAt: null
40
50
  };
41
- await optimistic?.cancel?.();
42
- await optimistic?.add?.(newNode);
51
+ await optimistic?.add?.(newAsset);
43
52
  },
44
53
  onSuccess: async (data) => {
45
54
  await onUploadCompleted?.(data);
46
55
  toast.success(`Succesvol geupload: ${data.name}`);
47
56
  },
48
- onError: async (error, variables) => {
57
+ onError: async (error) => {
49
58
  await onUploadFailed?.(error);
50
59
  console.error("Upload error: ", error);
51
60
  toast.error("Bestand uploaden mislukt", { description: error instanceof Error ? error.message : void 0 });
52
- console.info("Deleting failed upload");
53
- await deleteMutation.mutateAsync([variables.id]);
54
61
  },
55
62
  onSettled: () => {
56
63
  optimistic?.invalidate?.();
@@ -85,7 +92,7 @@ function UploadZone({ variables, optimistic, uploadClient, uploadHooks, onUpload
85
92
  className: cn("relative z-0", className),
86
93
  children: [
87
94
  /* @__PURE__ */ jsx("input", { ...getInputProps() }),
88
- isDragActive && /* @__PURE__ */ jsx("div", { className: "bg-primary/20 absolute inset-0 z-10 rounded-md opacity-70 backdrop-blur-3xl" }),
95
+ isDragActive && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 rounded-md bg-primary/20 opacity-70 backdrop-blur-3xl" }),
89
96
  /* @__PURE__ */ jsx(UploadZoneContext, {
90
97
  value: {
91
98
  uploadClient,
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentProps, useCallback } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { toast } from \"@/components/ui/sonner.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { cn } from \"@/lib/utils/cn\";\nimport type { UploadFileRequest, UploadHooks } from \"../lib/create-upload.client\";\nimport type { FileNode, Node, UploadFileSchema } from \"../lib/validators\";\nimport { UploadZoneContext, type UploadZoneContextValue } from \"./upload-zone-context.client\";\n\nexport type UploadZoneProps = ComponentProps<\"div\"> &\n Pick<UploadZoneContextValue, \"optimistic\" | \"uploadClient\" | \"disabled\"> & {\n variables: Pick<UploadFileSchema, \"namespace\" | \"parentId\" | \"mode\" | \"hidden\" | \"readonly\">;\n uploadHooks?: UploadHooks;\n\n onUploadCompleted?: (node: Node) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n };\n\nexport function UploadZone({\n variables,\n optimistic,\n uploadClient,\n uploadHooks,\n onUploadCompleted,\n onUploadFailed,\n disabled = false,\n children,\n className,\n ...props\n}: UploadZoneProps) {\n /**\n * Delete mutation\n */\n const deleteMutation = useAction({\n mutationFn: async (ids: string[]) => uploadClient.deleteFiles(ids),\n onMutate: async (ids) => {\n await optimistic?.cancel?.();\n await optimistic?.remove?.(ids);\n },\n onError: async (error) => {\n console.error(\"Delete failed upload error: \", error);\n await onUploadFailed?.(error);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload mutation\n */\n const uploadMutation = useAction({\n mutationFn: async (params: UploadFileRequest) => uploadClient.upload(params, uploadHooks),\n onMutate: async (variables) => {\n // Generate a new node\n const newNode = {\n ...variables,\n type: \"file\",\n isPending: true,\n } as FileNode;\n\n await optimistic?.cancel?.();\n await optimistic?.add?.(newNode);\n },\n onSuccess: async (data) => {\n await onUploadCompleted?.(data);\n toast.success(`Succesvol geupload: ${data.name}`);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Upload error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync([variables.id]);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload file handler\n */\n const onUpload = useCallback(\n async (file: File) => {\n console.info(\"Uploading file\", file);\n const req = uploadClient.prepareUpload({ ...variables, file });\n return await uploadMutation.mutateAsync(req);\n },\n [uploadClient, variables, uploadMutation],\n );\n\n /**\n * Drop handler\n */\n const onDrop = useCallback(\n async (acceptedFiles: File[]) => {\n if (acceptedFiles.length === 0) return;\n await Promise.allSettled(acceptedFiles.map(onUpload));\n },\n [onUpload],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n noClick: true,\n disabled,\n });\n\n return (\n <div {...props} {...getRootProps()} className={cn(\"relative z-0\", className)}>\n <input {...getInputProps()} />\n\n {/* Show drag overlay when drag is active */}\n {isDragActive && (\n <div className=\"bg-primary/20 absolute inset-0 z-10 rounded-md opacity-70 backdrop-blur-3xl\" />\n )}\n\n <UploadZoneContext\n value={{\n uploadClient,\n onUpload,\n onRemove: deleteMutation.mutateAsync,\n optimistic,\n disabled,\n }}\n >\n {children}\n </UploadZoneContext>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgB,WAAW,EACzB,WACA,YACA,cACA,aACA,mBACA,gBACA,WAAW,OACX,UACA,WACA,GAAG,SACe;;;;CAIlB,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,QAAkB,aAAa,YAAY,IAAI;EAClE,UAAU,OAAO,QAAQ;AACvB,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,SAAS,IAAI;;EAEjC,SAAS,OAAO,UAAU;AACxB,WAAQ,MAAM,gCAAgC,MAAM;AACpD,SAAM,iBAAiB,MAAM;;EAE/B,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,WAA8B,aAAa,OAAO,QAAQ,YAAY;EACzF,UAAU,OAAO,cAAc;GAE7B,MAAM,UAAU;IACd,GAAG;IACH,MAAM;IACN,WAAW;IACZ;AAED,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,MAAM,QAAQ;;EAElC,WAAW,OAAO,SAAS;AACzB,SAAM,oBAAoB,KAAK;AAC/B,SAAM,QAAQ,uBAAuB,KAAK,OAAO;;EAEnD,SAAS,OAAO,OAAO,cAAc;AACnC,SAAM,iBAAiB,MAAM;AAE7B,WAAQ,MAAM,kBAAkB,MAAM;AACtC,SAAM,MAAM,4BAA4B,EACtC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;AAEF,WAAQ,KAAK,yBAAyB;AACtC,SAAM,eAAe,YAAY,CAAC,UAAU,GAAG,CAAC;;EAElD,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,WAAW,YACf,OAAO,SAAe;AACpB,UAAQ,KAAK,kBAAkB,KAAK;EACpC,MAAM,MAAM,aAAa,cAAc;GAAE,GAAG;GAAW;GAAM,CAAC;AAC9D,SAAO,MAAM,eAAe,YAAY,IAAI;IAE9C;EAAC;EAAc;EAAW;EAAe,CAC1C;CAaD,MAAM,EAAE,cAAc,eAAe,iBAAiB,YAAY;EAChE,QATa,YACb,OAAO,kBAA0B;AAC/B,OAAI,cAAc,WAAW,EAAG;AAChC,SAAM,QAAQ,WAAW,cAAc,IAAI,SAAS,CAAC;KAEvD,CAAC,SAAS,CACX;EAIC,SAAS;EACT;EACD,CAAC;AAEF,QACE,qBAAC;EAAI,GAAI;EAAO,GAAI,cAAc;EAAE,WAAW,GAAG,gBAAgB,UAAU;;GAC1E,oBAAC,WAAM,GAAI,eAAe,GAAI;GAG7B,gBACC,oBAAC,SAAI,WAAU,gFAAgF;GAGjG,oBAAC;IACC,OAAO;KACL;KACA;KACA,UAAU,eAAe;KACzB;KACA;KACD;IAEA;KACiB;;GAChB"}
1
+ {"version":3,"file":"upload-zone.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentProps, useCallback } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { toast } from \"@/components/ui/sonner.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { cn } from \"@/lib/utils/cn\";\nimport type { UploadFileRequest, UploadHooks } from \"../lib/upload.client\";\nimport type { StorageAsset, UploadInput } from \"../lib/validators\";\nimport { UploadZoneContext, type UploadZoneContextValue } from \"./upload-zone-context.client\";\n\nexport type UploadZoneProps = ComponentProps<\"div\"> &\n Pick<UploadZoneContextValue, \"optimistic\" | \"uploadClient\" | \"disabled\"> & {\n variables: Pick<UploadInput, \"visibility\">;\n uploadHooks?: UploadHooks;\n\n onUploadCompleted?: (asset: StorageAsset) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n };\n\nexport function UploadZone({\n variables,\n optimistic,\n uploadClient,\n uploadHooks,\n onUploadCompleted,\n onUploadFailed,\n disabled = false,\n children,\n className,\n ...props\n}: UploadZoneProps) {\n /**\n * Delete mutation\n */\n const deleteMutation = useAction({\n mutationFn: async (ids: string[]) => {\n await uploadClient.deleteAssets(ids);\n },\n onMutate: async (ids) => {\n await optimistic?.cancel?.();\n await optimistic?.remove?.(ids);\n },\n onError: async (error) => {\n console.error(\"Delete failed upload error: \", error);\n await onUploadFailed?.(error);\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload mutation\n */\n const uploadMutation = useAction({\n mutationFn: async (params: UploadFileRequest) => uploadClient.upload(params, uploadHooks),\n onMutate: async (variables) => {\n await optimistic?.cancel?.();\n\n const newAsset = {\n ...variables,\n visibility: variables.visibility ?? \"private\",\n status: \"pending\",\n name: variables.file.name,\n size: variables.file.size,\n contentType: variables.file.type || \"application/octet-stream\",\n etag: null,\n metadata: null,\n uploadedAt: new Date(),\n deletedAt: null,\n } as Omit<StorageAsset, \"id\" | \"key\" | \"bucket\" | \"provider\" | \"createdAt\" | \"updatedAt\">;\n\n await optimistic?.add?.(newAsset);\n },\n onSuccess: async (data) => {\n await onUploadCompleted?.(data);\n toast.success(`Succesvol geupload: ${data.name}`);\n },\n onError: async (error) => {\n await onUploadFailed?.(error);\n\n console.error(\"Upload error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n },\n onSettled: () => {\n optimistic?.invalidate?.();\n },\n });\n\n /**\n * Upload file handler\n */\n const onUpload = useCallback(\n async (file: File) => {\n console.info(\"Uploading file\", file);\n const req = uploadClient.prepareUpload({ ...variables, file });\n return await uploadMutation.mutateAsync(req);\n },\n [uploadClient, variables, uploadMutation],\n );\n\n /**\n * Drop handler\n */\n const onDrop = useCallback(\n async (acceptedFiles: File[]) => {\n if (acceptedFiles.length === 0) return;\n await Promise.allSettled(acceptedFiles.map(onUpload));\n },\n [onUpload],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n noClick: true,\n disabled,\n });\n\n return (\n <div {...props} {...getRootProps()} className={cn(\"relative z-0\", className)}>\n <input {...getInputProps()} />\n\n {/* Show drag overlay when drag is active */}\n {isDragActive && (\n <div className=\"absolute inset-0 z-10 rounded-md bg-primary/20 opacity-70 backdrop-blur-3xl\" />\n )}\n\n <UploadZoneContext\n value={{\n uploadClient,\n onUpload,\n onRemove: deleteMutation.mutateAsync,\n optimistic,\n disabled,\n }}\n >\n {children}\n </UploadZoneContext>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgB,WAAW,EACzB,WACA,YACA,cACA,aACA,mBACA,gBACA,WAAW,OACX,UACA,WACA,GAAG,SACe;;;;CAIlB,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,QAAkB;AACnC,SAAM,aAAa,aAAa,IAAI;;EAEtC,UAAU,OAAO,QAAQ;AACvB,SAAM,YAAY,UAAU;AAC5B,SAAM,YAAY,SAAS,IAAI;;EAEjC,SAAS,OAAO,UAAU;AACxB,WAAQ,MAAM,gCAAgC,MAAM;AACpD,SAAM,iBAAiB,MAAM;;EAE/B,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,iBAAiB,UAAU;EAC/B,YAAY,OAAO,WAA8B,aAAa,OAAO,QAAQ,YAAY;EACzF,UAAU,OAAO,cAAc;AAC7B,SAAM,YAAY,UAAU;GAE5B,MAAM,WAAW;IACf,GAAG;IACH,YAAY,UAAU,cAAc;IACpC,QAAQ;IACR,MAAM,UAAU,KAAK;IACrB,MAAM,UAAU,KAAK;IACrB,aAAa,UAAU,KAAK,QAAQ;IACpC,MAAM;IACN,UAAU;IACV,4BAAY,IAAI,MAAM;IACtB,WAAW;IACZ;AAED,SAAM,YAAY,MAAM,SAAS;;EAEnC,WAAW,OAAO,SAAS;AACzB,SAAM,oBAAoB,KAAK;AAC/B,SAAM,QAAQ,uBAAuB,KAAK,OAAO;;EAEnD,SAAS,OAAO,UAAU;AACxB,SAAM,iBAAiB,MAAM;AAE7B,WAAQ,MAAM,kBAAkB,MAAM;AACtC,SAAM,MAAM,4BAA4B,EACtC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;;EAEJ,iBAAiB;AACf,eAAY,cAAc;;EAE7B,CAAC;;;;CAKF,MAAM,WAAW,YACf,OAAO,SAAe;AACpB,UAAQ,KAAK,kBAAkB,KAAK;EACpC,MAAM,MAAM,aAAa,cAAc;GAAE,GAAG;GAAW;GAAM,CAAC;AAC9D,SAAO,MAAM,eAAe,YAAY,IAAI;IAE9C;EAAC;EAAc;EAAW;EAAe,CAC1C;CAaD,MAAM,EAAE,cAAc,eAAe,iBAAiB,YAAY;EAChE,QATa,YACb,OAAO,kBAA0B;AAC/B,OAAI,cAAc,WAAW,EAAG;AAChC,SAAM,QAAQ,WAAW,cAAc,IAAI,SAAS,CAAC;KAEvD,CAAC,SAAS,CACX;EAIC,SAAS;EACT;EACD,CAAC;AAEF,QACE,qBAAC;EAAI,GAAI;EAAO,GAAI,cAAc;EAAE,WAAW,GAAG,gBAAgB,UAAU;;GAC1E,oBAAC,WAAM,GAAI,eAAe,GAAI;GAG7B,gBACC,oBAAC,SAAI,WAAU,gFAAgF;GAGjG,oBAAC;IACC,OAAO;KACL;KACA;KACA,UAAU,eAAe;KACzB;KACA;KACD;IAEA;KACiB;;GAChB"}
@@ -1,10 +1,6 @@
1
1
  //#region src/modules/storage/lib/constants.d.ts
2
- declare const deviceSizes: number[];
3
- declare const imageSizes: number[];
4
- declare const imageVariants: readonly ["main", ...`preview-${number}`[]];
5
- type ImageVariant = (typeof imageVariants)[number];
6
2
  declare const imageDispositions: readonly ["inline", "attachment"];
7
3
  type ImageDisposition = (typeof imageDispositions)[number];
8
4
  //#endregion
9
- export { ImageDisposition, ImageVariant, deviceSizes, imageDispositions, imageSizes, imageVariants };
5
+ export { ImageDisposition, imageDispositions };
10
6
  //# sourceMappingURL=constants.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/constants.ts"],"mappings":";cACa,WAAA;AAAA,cACA,UAAA;AAAA,cAGA,aAAA;AAAA,KAID,YAAA,WAAuB,aAAA;AAAA,cAGtB,iBAAA;AAAA,KACD,gBAAA,WAA2B,iBAAA"}
1
+ {"version":3,"file":"constants.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/constants.ts"],"mappings":";cACa,iBAAA;AAAA,KACD,gBAAA,WAA2B,iBAAA"}
@@ -1,18 +1,6 @@
1
1
  //#region src/modules/storage/lib/constants.ts
2
- const deviceSizes = [
3
- 640,
4
- 750,
5
- 828,
6
- 1080,
7
- 1200,
8
- 1920,
9
- 2048,
10
- 3840
11
- ];
12
- const imageSizes = deviceSizes;
13
- const imageVariants = ["main", ...deviceSizes.map((size) => `preview-${size}`)];
14
2
  const imageDispositions = ["inline", "attachment"];
15
3
 
16
4
  //#endregion
17
- export { deviceSizes, imageDispositions, imageSizes, imageVariants };
5
+ export { imageDispositions };
18
6
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":[],"sources":["../../../../src/modules/storage/lib/constants.ts"],"sourcesContent":["// Device sizes\nexport const deviceSizes = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\nexport const imageSizes = deviceSizes;\n\n// Image variants\nexport const imageVariants = [\n \"main\",\n ...deviceSizes.map((size) => `preview-${size}` as const),\n] as const;\nexport type ImageVariant = (typeof imageVariants)[number];\n\n// Image dispositions\nexport const imageDispositions = [\"inline\", \"attachment\"] as const;\nexport type ImageDisposition = (typeof imageDispositions)[number];\n"],"mappings":";AACA,MAAa,cAAc;CAAC;CAAK;CAAK;CAAK;CAAM;CAAM;CAAM;CAAM;CAAK;AACxE,MAAa,aAAa;AAG1B,MAAa,gBAAgB,CAC3B,QACA,GAAG,YAAY,KAAK,SAAS,WAAW,OAAgB,CACzD;AAID,MAAa,oBAAoB,CAAC,UAAU,aAAa"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../../../src/modules/storage/lib/constants.ts"],"sourcesContent":["// Image dispositions\nexport const imageDispositions = [\"inline\", \"attachment\"] as const;\nexport type ImageDisposition = (typeof imageDispositions)[number];\n"],"mappings":";AACA,MAAa,oBAAoB,CAAC,UAAU,aAAa"}
@@ -1,44 +1,30 @@
1
- import { ImageVariant } from "./constants.mjs";
2
- import { CreateNodeSchema, GetFileURLSchema, Node } from "./validators.mjs";
1
+ import { GetAssetURLInput } from "./validators.mjs";
3
2
  import { ImageLoaderProps } from "next/image";
4
3
 
5
4
  //#region src/modules/storage/lib/helpers.d.ts
6
5
  /**
7
- * Check if the node is a file
6
+ * Builds the public API route URL for a storage file proxy request.
7
+ *
8
+ * Use this helper when you need a stable file URL in the client/UI
9
+ * without manually composing the route path.
10
+ *
11
+ * @param id - Storage asset id
12
+ * @returns File proxy URL for the storage route handler
13
+ * @example
14
+ * const url = getAssetURL("019d0051-2c0d-741e-9e3c-e5a5bc4d16a2", { disposition: "attachment" });
15
+ * // /api/storage/files/019d0051-2c0d-741e-9e3c-e5a5bc4d16a2?disposition=attachment
8
16
  */
9
- declare function isFile(node: Pick<Node, "type">): node is Node;
10
- /**
11
- * Check if the node is a folder
12
- */
13
- declare function isFolder(node: Pick<Node, "type">): node is Node;
14
- /**
15
- * Get file url
16
- */
17
- declare function getFileUrl(id: string, options?: Partial<GetFileURLSchema>): string;
17
+ declare function getAssetURL(id: string, options?: Partial<GetAssetURLInput>): string;
18
18
  /**
19
19
  * Image loader
20
20
  */
21
21
  declare function imageLoader({
22
- src,
23
- width
22
+ src
24
23
  }: ImageLoaderProps): string;
25
- /**
26
- * Generate object key
27
- */
28
- declare function getDriveBucketKey(id: string, variant: ImageVariant): string;
29
- /**
30
- * Node subtype
31
- */
32
- declare const nodeSubtypes: readonly ["image", "document", "spreadsheet", "video", "audio", "archive", "other"];
33
- type NodeSubtype = (typeof nodeSubtypes)[number];
34
- declare function inferNodeSubtype({
35
- name,
36
- contentType
37
- }: Pick<CreateNodeSchema, "name" | "contentType">): NodeSubtype;
38
24
  /**
39
25
  * Render bytes
40
26
  */
41
27
  declare function renderBytes(bytes: number): string;
42
28
  //#endregion
43
- export { NodeSubtype, getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes };
29
+ export { getAssetURL, imageLoader, renderBytes };
44
30
  //# sourceMappingURL=helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/helpers.ts"],"mappings":";;;;;;;AAOA;iBAAgB,MAAA,CAAO,IAAA,EAAM,IAAA,CAAK,IAAA,YAAgB,IAAA,IAAQ,IAAA;;;;iBAO1C,QAAA,CAAS,IAAA,EAAM,IAAA,CAAK,IAAA,YAAgB,IAAA,IAAQ,IAAA;;;;iBAO5C,UAAA,CAAW,EAAA,UAAY,OAAA,GAAS,OAAA,CAAQ,gBAAA;;;;iBAYxC,WAAA,CAAA;EAAc,GAAA;EAAK;AAAA,GAAS,gBAAA;;AAnB5C;;iBA4BgB,iBAAA,CAAkB,EAAA,UAAY,OAAA,EAAS,YAAA;;;;cAO1C,YAAA;AAAA,KAUD,WAAA,WAAsB,YAAA;AAAA,iBAElB,gBAAA,CAAA;EACd,IAAA;EACA;AAAA,GACC,IAAA,CAAK,gBAAA,4BAA4C,WAAA;;;;iBAqBpC,WAAA,CAAY,KAAA"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/helpers.ts"],"mappings":";;;;;;AAgBA;;;;;;;;;;iBAAgB,WAAA,CAAY,EAAA,UAAY,OAAA,GAAS,OAAA,CAAQ,gBAAA;;;;iBAYzC,WAAA,CAAA;EAAc;AAAA,GAAO,gBAAA;;;;iBAUrB,WAAA,CAAY,KAAA"}