@tulip-systems/core 0.5.0 → 0.5.2

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 (252) hide show
  1. package/dist/components/client.d.mts +2 -2
  2. package/dist/components/client.mjs +2 -2
  3. package/dist/components/common/icons.d.mts +52 -52
  4. package/dist/components/common/status.d.mts +3 -3
  5. package/dist/components/editor/components/content.client.d.mts +2 -2
  6. package/dist/components/editor/components/editor.client.d.mts +3 -3
  7. package/dist/components/editor/components/editor.client.d.mts.map +1 -1
  8. package/dist/components/editor/components/{block-dropdown.mjs → menu-nodes.client.mjs} +7 -11
  9. package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -0
  10. package/dist/components/editor/components/menu.client.d.mts +10 -0
  11. package/dist/components/editor/components/menu.client.d.mts.map +1 -0
  12. package/dist/components/editor/components/menu.client.mjs +166 -0
  13. package/dist/components/editor/components/menu.client.mjs.map +1 -0
  14. package/dist/components/editor/lib/extensions.d.mts +3 -0
  15. package/dist/components/editor/lib/extensions.d.mts.map +1 -1
  16. package/dist/components/editor/lib/extensions.mjs.map +1 -1
  17. package/dist/components/header/back-button.client.d.mts +2 -2
  18. package/dist/components/header/bottom-bar.client.d.mts +3 -3
  19. package/dist/components/header/breadcrumbs.client.d.mts +7 -7
  20. package/dist/components/header/header.client.d.mts +2 -2
  21. package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
  22. package/dist/components/header/top-bar.client.d.mts +4 -4
  23. package/dist/components/layouts/admin-content.client.d.mts +2 -2
  24. package/dist/components/layouts/admin-layout.d.mts +2 -2
  25. package/dist/components/layouts/admin-layout.d.mts.map +1 -1
  26. package/dist/components/layouts/admin-loading.d.mts +2 -2
  27. package/dist/components/layouts/empty-page.d.mts +4 -4
  28. package/dist/components/layouts/list-layout.d.mts +2 -2
  29. package/dist/components/layouts/not-found-page.d.mts +3 -3
  30. package/dist/components/layouts/providers.client.d.mts +2 -2
  31. package/dist/components/layouts/root-layout.server.d.mts +2 -2
  32. package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
  33. package/dist/components/layouts/root-loading.d.mts +2 -2
  34. package/dist/components/layouts/tab-layout.d.mts +2 -2
  35. package/dist/components/lists/data-list.d.mts +5 -5
  36. package/dist/components/lists/data-stack.d.mts +8 -8
  37. package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
  38. package/dist/components/ui/accordion.d.mts +5 -5
  39. package/dist/components/ui/accordion.d.mts.map +1 -1
  40. package/dist/components/ui/alert-dialog.d.mts +12 -12
  41. package/dist/components/ui/alert-dialog.d.mts.map +1 -1
  42. package/dist/components/ui/alert.d.mts +4 -4
  43. package/dist/components/ui/alert.d.mts.map +1 -1
  44. package/dist/components/ui/aspect-ratio.d.mts +2 -2
  45. package/dist/components/ui/aspect-ratio.d.mts.map +1 -1
  46. package/dist/components/ui/avatar.client.d.mts +4 -4
  47. package/dist/components/ui/badge.d.mts +2 -2
  48. package/dist/components/ui/badge.d.mts.map +1 -1
  49. package/dist/components/ui/breadcrumb.d.mts +8 -8
  50. package/dist/components/ui/breadcrumb.d.mts.map +1 -1
  51. package/dist/components/ui/button.d.mts +2 -2
  52. package/dist/components/ui/button.d.mts.map +1 -1
  53. package/dist/components/ui/calendar.d.mts +3 -3
  54. package/dist/components/ui/calendar.d.mts.map +1 -1
  55. package/dist/components/ui/card.d.mts +7 -7
  56. package/dist/components/ui/card.d.mts.map +1 -1
  57. package/dist/components/ui/carousel.d.mts +6 -6
  58. package/dist/components/ui/carousel.d.mts.map +1 -1
  59. package/dist/components/ui/chart.client.d.mts +5 -5
  60. package/dist/components/ui/checkbox.d.mts +2 -2
  61. package/dist/components/ui/checkbox.d.mts.map +1 -1
  62. package/dist/components/ui/collapsible.client.d.mts +4 -4
  63. package/dist/components/ui/color-picker.client.d.mts +2 -2
  64. package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
  65. package/dist/components/ui/combobox.client.d.mts +2 -2
  66. package/dist/components/ui/command.d.mts +10 -10
  67. package/dist/components/ui/command.d.mts.map +1 -1
  68. package/dist/components/ui/context-menu.d.mts +16 -16
  69. package/dist/components/ui/context-menu.d.mts.map +1 -1
  70. package/dist/components/ui/date-picker.client.d.mts +2 -2
  71. package/dist/components/ui/dialog.client.d.mts +11 -11
  72. package/dist/components/ui/drawer.client.d.mts +11 -11
  73. package/dist/components/ui/dropdown-menu.d.mts +16 -16
  74. package/dist/components/ui/form.client.d.mts +7 -7
  75. package/dist/components/ui/hover-card.client.d.mts +4 -4
  76. package/dist/components/ui/input-recipient.d.mts +2 -2
  77. package/dist/components/ui/input.d.mts +2 -2
  78. package/dist/components/ui/label.d.mts +2 -2
  79. package/dist/components/ui/navigation-menu.d.mts +9 -9
  80. package/dist/components/ui/pagination.d.mts +8 -8
  81. package/dist/components/ui/popover.d.mts +5 -5
  82. package/dist/components/ui/progress.client.d.mts +2 -2
  83. package/dist/components/ui/radio-group.d.mts +3 -3
  84. package/dist/components/ui/resizable.client.d.mts +4 -4
  85. package/dist/components/ui/scroll-area.d.mts +3 -3
  86. package/dist/components/ui/select.client.d.mts +11 -11
  87. package/dist/components/ui/separator.d.mts +2 -2
  88. package/dist/components/ui/sheet.client.d.mts +9 -9
  89. package/dist/components/ui/sidebar.client.d.mts +24 -24
  90. package/dist/components/ui/skeleton.d.mts +2 -2
  91. package/dist/components/ui/slider.d.mts +2 -2
  92. package/dist/components/ui/sonner.client.d.mts +2 -2
  93. package/dist/components/ui/switch.d.mts +2 -2
  94. package/dist/components/ui/tabs.d.mts +5 -5
  95. package/dist/components/ui/textarea.d.mts +2 -2
  96. package/dist/components/ui/time-input.client.d.mts +2 -2
  97. package/dist/components/ui/toggle-group.client.d.mts +3 -3
  98. package/dist/components/ui/toggle.d.mts +2 -2
  99. package/dist/components/ui/tooltip.client.d.mts +5 -5
  100. package/dist/lib/hooks/use-action.d.mts +2 -2
  101. package/dist/lib/hooks/use-indicator.d.mts +2 -2
  102. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  103. package/dist/modules/auth/components/allowed.client.d.mts +2 -2
  104. package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
  105. package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
  106. package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
  107. package/dist/modules/auth/components/auth-loading.d.mts +2 -2
  108. package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
  109. package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
  110. package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
  111. package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
  112. package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
  113. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
  114. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  115. package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
  116. package/dist/modules/auth/components/login-page.client.d.mts +2 -2
  117. package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
  118. package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
  119. package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
  120. package/dist/modules/auth/components/update-password-command.d.mts +2 -2
  121. package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
  122. package/dist/modules/auth/db/schema.d.mts +73 -73
  123. package/dist/modules/auth/db/schema.d.mts.map +1 -1
  124. package/dist/modules/auth/hooks/use-permission.d.mts +2 -2
  125. package/dist/modules/auth/lib/validators.d.mts +2 -2
  126. package/dist/modules/auth/lib/validators.d.mts.map +1 -1
  127. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
  128. package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
  129. package/dist/modules/commands/components/click-command.client.d.mts +2 -2
  130. package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
  131. package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
  132. package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
  133. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  134. package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
  135. package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
  136. package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
  137. package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
  138. package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
  139. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
  140. package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
  141. package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
  142. package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
  143. package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
  144. package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
  145. package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
  146. package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
  147. package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
  148. package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
  149. package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
  150. package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
  151. package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
  152. package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
  153. package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
  154. package/dist/modules/config/db/helpers.d.mts +5 -5
  155. package/dist/modules/config/db/helpers.d.mts.map +1 -1
  156. package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
  157. package/dist/modules/data-tables/components/column-header.d.mts +2 -2
  158. package/dist/modules/data-tables/components/column-header.d.mts.map +1 -1
  159. package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
  160. package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
  161. package/dist/modules/data-tables/components/header.d.mts +4 -4
  162. package/dist/modules/data-tables/components/header.d.mts.map +1 -1
  163. package/dist/modules/data-tables/components/layout.d.mts +2 -2
  164. package/dist/modules/data-tables/components/layout.d.mts.map +1 -1
  165. package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
  166. package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
  167. package/dist/modules/data-tables/components/skeleton.d.mts.map +1 -1
  168. package/dist/modules/data-tables/components/table.d.mts +7 -7
  169. package/dist/modules/data-tables/components/table.d.mts.map +1 -1
  170. package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
  171. package/dist/modules/data-tables/components/toolbar.d.mts.map +1 -1
  172. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  173. package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
  174. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
  175. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
  176. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
  177. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
  178. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
  179. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
  180. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
  181. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
  182. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
  183. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
  184. package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
  185. package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
  186. package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
  187. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +2 -2
  188. package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
  189. package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
  190. package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
  191. package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
  192. package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
  193. package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
  194. package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
  195. package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
  196. package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
  197. package/dist/modules/router/lib/query-client.server.d.mts +2 -2
  198. package/dist/modules/router/lib/query-client.server.d.mts.map +1 -1
  199. package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
  200. package/dist/modules/storage/components/dropzone-context.client.d.mts.map +1 -1
  201. package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
  202. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  203. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  204. package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
  205. package/dist/modules/storage/components/upload-zone.client.d.mts +5 -3
  206. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  207. package/dist/modules/storage/components/upload-zone.client.mjs +6 -4
  208. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  209. package/dist/modules/storage/config/filters.d.mts +1 -0
  210. package/dist/modules/storage/config/filters.d.mts.map +1 -1
  211. package/dist/modules/storage/config/filters.mjs +2 -1
  212. package/dist/modules/storage/config/filters.mjs.map +1 -1
  213. package/dist/modules/storage/lib/helpers.d.mts +2 -2
  214. package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
  215. package/dist/modules/storage/lib/helpers.mjs +1 -0
  216. package/dist/modules/storage/lib/helpers.mjs.map +1 -1
  217. package/dist/modules/storage/lib/router.server.d.mts +3205 -2227
  218. package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
  219. package/dist/modules/storage/lib/router.server.mjs +1 -0
  220. package/dist/modules/storage/lib/router.server.mjs.map +1 -1
  221. package/dist/modules/storage/lib/schema.d.mts +122 -88
  222. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  223. package/dist/modules/storage/lib/schema.mjs +1 -0
  224. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  225. package/dist/modules/storage/lib/service.server.d.mts +48 -21
  226. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  227. package/dist/modules/storage/lib/service.server.mjs +15 -8
  228. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  229. package/dist/modules/storage/lib/validators.d.mts +215 -134
  230. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  231. package/dist/modules/storage/lib/validators.mjs +14 -24
  232. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  233. package/dist/storage.d.mts +2 -2
  234. package/dist/storage.mjs +2 -2
  235. package/package.json +3 -3
  236. package/src/components/editor/components/{block-dropdown.tsx → menu-nodes.client.tsx} +24 -29
  237. package/src/components/editor/components/menu.client.tsx +214 -0
  238. package/src/components/editor/lib/extensions.ts +3 -3
  239. package/src/components/entry.client.ts +1 -1
  240. package/src/modules/storage/components/upload-zone.client.tsx +5 -2
  241. package/src/modules/storage/config/filters.ts +1 -0
  242. package/src/modules/storage/lib/helpers.ts +3 -2
  243. package/src/modules/storage/lib/router.server.ts +6 -0
  244. package/src/modules/storage/lib/schema.ts +1 -0
  245. package/src/modules/storage/lib/service.server.ts +25 -4
  246. package/src/modules/storage/lib/validators.ts +20 -31
  247. package/dist/components/editor/components/block-dropdown.mjs.map +0 -1
  248. package/dist/components/editor/components/menu-fixed.client.d.mts +0 -7
  249. package/dist/components/editor/components/menu-fixed.client.d.mts.map +0 -1
  250. package/dist/components/editor/components/menu-fixed.client.mjs +0 -128
  251. package/dist/components/editor/components/menu-fixed.client.mjs.map +0 -1
  252. package/src/components/editor/components/menu-fixed.client.tsx +0 -165
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/validators.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AoB,GAAA,CAAE,aAAa;;;;cAKlC;;;;cAEA,kBAAgB,GAAA,CAAA;;;;;;;;;;KAKjB,eAAA,GAAkB,GAAA,CAAE,aAAa;KACjC,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;;cAKjC,0BAAwB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,uBAAA,GAA0B,GAAA,CAAE,aAAa;;;;cAKxC,iBAAe,GAAA,CAAA;;;;;;;;KAMhB,cAAA,GAAiB,GAAA,CAAE,aAAa;KAChC,eAAA,GAAkB,GAAA,CAAE,aAAa;;;;cAKhC,iBAAe,GAAA,CAAA;;;;;;;;;;;KAShB,cAAA,GAAiB,GAAA,CAAE,aAAa;SACnC;;KAGG,eAAA,GAAkB,GAAA,CAAE,aAAa"}
@@ -20,19 +20,6 @@ const createNodeSchema = createInsertSchema(nodes, { namespace: z$1.string() });
20
20
  */
21
21
  const updateNodeSchema = createUpdateSchema(nodes);
22
22
  /**
23
- * Create folder node
24
- */
25
- const createFolderNodeSchema = createNodeSchema.omit({
26
- type: true,
27
- contentType: true,
28
- size: true,
29
- subtype: true
30
- });
31
- /**
32
- * Create file node
33
- */
34
- const createFileNodeSchema = createNodeSchema.omit({ type: true });
35
- /**
36
23
  * Select node
37
24
  */
38
25
  const selectNodeSchema = createSelectSchema(nodes);
@@ -45,20 +32,23 @@ const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters).partial(
45
32
  parentId: z$1.string().nullable()
46
33
  }).transform((input) => ({
47
34
  ...input,
35
+ hidden: input?.hidden ?? false,
48
36
  isDeleted: input?.isDeleted ?? false
49
37
  }));
50
38
  /**
51
- * Upload file schema
39
+ * Create folder node
52
40
  */
53
- const uploadFileSchema = z$1.object({
54
- name: z$1.string().min(1),
55
- namespace: z$1.string(),
56
- mode: nodeModeSchema.optional(),
57
- parentId: z$1.uuid().nullable(),
58
- size: z$1.number().optional().default(0),
59
- contentType: z$1.string().optional().default("")
41
+ const createFolderNodeSchema = createNodeSchema.omit({
42
+ type: true,
43
+ contentType: true,
44
+ size: true,
45
+ subtype: true
60
46
  });
61
47
  /**
48
+ * Upload file schema
49
+ */
50
+ const uploadFileSchema = createNodeSchema.omit({ type: true });
51
+ /**
62
52
  * Presign file schema
63
53
  */
64
54
  const presignFileSchema = uploadFileSchema.extend({ id: z$1.uuid() });
@@ -97,10 +87,10 @@ const putObjectSchema = z$1.object({
97
87
  name: z$1.string().optional().default(""),
98
88
  variant: z$1.enum(imageVariants).optional().default("main"),
99
89
  body: z$1.any().optional(),
100
- contentType: z$1.string().optional().default(""),
101
- size: z$1.number().optional().default(0)
90
+ contentType: z$1.string().nullable().optional(),
91
+ size: z$1.number().nullable().optional()
102
92
  });
103
93
 
104
94
  //#endregion
105
- export { createFileNodeSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
95
+ export { createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
106
96
  //# sourceMappingURL=validators.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.mjs","names":["z"],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":["import { tableQuerySchema } from \"@/modules/data-tables/entry\";\nimport { resolveFiltersSchema } from \"@/modules/data-tables/lib/filters/resolvers\";\nimport { PutObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { nodesTableFilters } from \"../config/filters\";\nimport { imageDispositions, imageVariants } from \"./constants\";\nimport { nodeModeEnum, nodes } from \"./schema\";\n\n/**\n * Nodes\n */\nexport type Node = typeof nodes.$inferSelect;\nexport type FileNode = typeof nodes.$inferSelect & { type: \"file\" };\nexport type FolderNode = typeof nodes.$inferSelect & { type: \"folder\" };\n\n/**\n * Node mode\n */\nexport const nodeModeSchema = z.enum(nodeModeEnum.enumValues);\nexport type NodeMode = z.infer<typeof nodeModeSchema>;\n\n/**\n * Create node\n */\nexport const createNodeSchema = createInsertSchema(nodes, {\n namespace: z.string(),\n});\n\nexport type CreateNodeInput = z.input<typeof createNodeSchema>;\nexport type CreateNodeSchema = z.infer<typeof createNodeSchema>;\n\n/**\n * Update node\n */\nexport const updateNodeSchema = createUpdateSchema(nodes);\n\nexport type UpdateNodeInput = z.input<typeof updateNodeSchema>;\nexport type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;\n\n/**\n * Create folder node\n */\nexport const createFolderNodeSchema = createNodeSchema.omit({\n type: true,\n contentType: true,\n size: true,\n subtype: true,\n});\n\nexport type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;\n\n/**\n * Create file node\n */\nexport const createFileNodeSchema = createNodeSchema.omit({\n type: true,\n});\nexport type CreateFileNodeSchema = z.infer<typeof createFileNodeSchema>;\n\n/**\n * Select node\n */\nexport const selectNodeSchema = createSelectSchema(nodes);\nexport const selectNodeWithChildrenSchema = selectNodeSchema.extend({\n children: z.array(selectNodeSchema),\n});\n\nexport type SelectNodeSchema = z.infer<typeof selectNodeSchema>;\nexport type SelectNodeWithChildrenSchema = z.infer<typeof selectNodeWithChildrenSchema>;\n\n/**\n * Where input\n */\nexport const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)\n .partial()\n .extend({\n namespace: z.string(),\n parentId: z.string().nullable(),\n })\n .transform((input) => ({ ...input, isDeleted: input?.isDeleted ?? false }));\n\nexport type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;\n\n/**\n * Upload file schema\n */\nexport const uploadFileSchema = z.object({\n name: z.string().min(1),\n namespace: z.string(),\n mode: nodeModeSchema.optional(),\n parentId: z.uuid().nullable(),\n size: z.number().optional().default(0),\n contentType: z.string().optional().default(\"\"),\n});\n\nexport type UploadFileSchema = z.infer<typeof uploadFileSchema>;\n\n/**\n * Presign file schema\n */\nexport const presignFileSchema = uploadFileSchema.extend({ id: z.uuid() });\n\nexport type PresignFileSchema = z.infer<typeof presignFileSchema>;\n\n/**\n * Get file url schema\n */\nexport const getFileURLSchemaDefaults = { variant: \"main\", disposition: \"inline\" } as const;\n\nexport const getFileURLSchema = z.object({\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.enum(imageDispositions).optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetFileUrlInput = z.input<typeof getFileURLSchema>;\nexport type GetFileURLSchema = z.infer<typeof getFileURLSchema>;\n\n/**\n * Get by parent id input\n */\nexport const getNodesByParentIdSchema = tableQuerySchema\n .pick({ order: true, sort: true, search: true })\n .extend({ filters: nodesTableFiltersSchema });\n\nexport type GetNodesByParentIdInput = z.input<typeof getNodesByParentIdSchema>;\n\n/**\n * Get object input\n */\nexport const getObjectSchema = z.object({\n id: z.string(),\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.string().optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetObjectInput = z.input<typeof getObjectSchema>;\nexport type GetObjectSchema = z.infer<typeof getObjectSchema>;\n\n/**\n * Put object input\n */\nexport const putObjectSchema = z.object({\n id: z.string(),\n name: z.string().optional().default(\"\"),\n variant: z.enum(imageVariants).optional().default(\"main\"),\n body: z.any().optional(),\n contentType: z.string().optional().default(\"\"),\n size: z.number().optional().default(0),\n});\n\nexport type PutObjectInput = z.input<typeof putObjectSchema> & {\n body?: PutObjectCommandInput[\"Body\"];\n};\n\nexport type PutObjectSchema = z.infer<typeof putObjectSchema>;\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAAiBA,IAAE,KAAK,aAAa,WAAW;;;;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Aa,2BAA2B,iBACrC,KAAK;CAAE,OAAO;CAAM,MAAM;CAAM,QAAQ;CAAM,CAAC,CAC/C,OAAO,EAAE,SAAS,yBAAyB,CAAC;;;;AAO/C,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,yBAAyB,QAAQ;CACnF,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,yBAAyB,YAAY;CACjF,CAAC;;;;AAQF,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG;CACvC,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,OAAO;CACzD,MAAMA,IAAE,KAAK,CAAC,UAAU;CACxB,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG;CAC9C,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE;CACvC,CAAC"}
1
+ {"version":3,"file":"validators.mjs","names":["z"],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":["import { tableQuerySchema } from \"@/modules/data-tables/entry\";\nimport { resolveFiltersSchema } from \"@/modules/data-tables/lib/filters/resolvers\";\nimport { PutObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { nodesTableFilters } from \"../config/filters\";\nimport { imageDispositions, imageVariants } from \"./constants\";\nimport { nodeModeEnum, nodes } from \"./schema\";\n\n/**\n * Nodes\n */\nexport type Node = typeof nodes.$inferSelect;\nexport type FileNode = typeof nodes.$inferSelect & { type: \"file\" };\nexport type FolderNode = typeof nodes.$inferSelect & { type: \"folder\" };\n\n/**\n * Node mode\n */\nexport const nodeModeSchema = z.enum(nodeModeEnum.enumValues);\nexport type NodeMode = z.infer<typeof nodeModeSchema>;\n\n/**\n * Create node\n */\nexport const createNodeSchema = createInsertSchema(nodes, {\n namespace: z.string(),\n});\n\nexport type CreateNodeInput = z.input<typeof createNodeSchema>;\nexport type CreateNodeSchema = z.infer<typeof createNodeSchema>;\n\n/**\n * Update node\n */\nexport const updateNodeSchema = createUpdateSchema(nodes);\n\nexport type UpdateNodeInput = z.input<typeof updateNodeSchema>;\nexport type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;\n\n/**\n * Select node\n */\nexport const selectNodeSchema = createSelectSchema(nodes);\nexport const selectNodeWithChildrenSchema = selectNodeSchema.extend({\n children: z.array(selectNodeSchema),\n});\n\nexport type SelectNodeSchema = z.infer<typeof selectNodeSchema>;\nexport type SelectNodeWithChildrenSchema = z.infer<typeof selectNodeWithChildrenSchema>;\n\n/**\n * Where input\n */\nexport const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)\n .partial()\n .extend({\n namespace: z.string(),\n parentId: z.string().nullable(),\n })\n .transform((input) => ({\n ...input,\n hidden: input?.hidden ?? false,\n isDeleted: input?.isDeleted ?? false,\n }));\n\nexport type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;\n\n/**\n * Create folder node\n */\nexport const createFolderNodeSchema = createNodeSchema.omit({\n type: true,\n contentType: true,\n size: true,\n subtype: true,\n});\n\nexport type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;\n\n/**\n * Upload file schema\n */\nexport const uploadFileSchema = createNodeSchema.omit({ type: true });\n\nexport type UploadFileSchema = z.infer<typeof uploadFileSchema>;\n\n/**\n * Presign file schema\n */\nexport const presignFileSchema = uploadFileSchema.extend({ id: z.uuid() });\n\nexport type PresignFileSchema = z.infer<typeof presignFileSchema>;\n\n/**\n * Get file url schema\n */\nexport const getFileURLSchemaDefaults = { variant: \"main\", disposition: \"inline\" } as const;\n\nexport const getFileURLSchema = z.object({\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.enum(imageDispositions).optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetFileUrlInput = z.input<typeof getFileURLSchema>;\nexport type GetFileURLSchema = z.infer<typeof getFileURLSchema>;\n\n/**\n * Get by parent id input\n */\nexport const getNodesByParentIdSchema = tableQuerySchema\n .pick({ order: true, sort: true, search: true })\n .extend({ filters: nodesTableFiltersSchema });\n\nexport type GetNodesByParentIdInput = z.input<typeof getNodesByParentIdSchema>;\n\n/**\n * Get object input\n */\nexport const getObjectSchema = z.object({\n id: z.string(),\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.string().optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetObjectInput = z.input<typeof getObjectSchema>;\nexport type GetObjectSchema = z.infer<typeof getObjectSchema>;\n\n/**\n * Put object input\n */\nexport const putObjectSchema = z.object({\n id: z.string(),\n name: z.string().optional().default(\"\"),\n variant: z.enum(imageVariants).optional().default(\"main\"),\n body: z.any().optional(),\n contentType: z.string().nullable().optional(),\n size: z.number().nullable().optional(),\n});\n\nexport type PutObjectInput = z.input<typeof putObjectSchema> & {\n body?: PutObjectCommandInput[\"Body\"];\n};\n\nexport type PutObjectSchema = z.infer<typeof putObjectSchema>;\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAAiBA,IAAE,KAAK,aAAa,WAAW;;;;AAM7D,MAAa,mBAAmB,mBAAmB,OAAO,EACxD,WAAWA,IAAE,QAAQ,EACtB,CAAC;;;;AAQF,MAAa,mBAAmB,mBAAmB,MAAM;;;;AAQzD,MAAa,mBAAmB,mBAAmB,MAAM;AACzD,MAAa,+BAA+B,iBAAiB,OAAO,EAClE,UAAUA,IAAE,MAAM,iBAAiB,EACpC,CAAC;;;;AAQF,MAAa,0BAA0B,qBAAqB,kBAAkB,CAC3E,SAAS,CACT,OAAO;CACN,WAAWA,IAAE,QAAQ;CACrB,UAAUA,IAAE,QAAQ,CAAC,UAAU;CAChC,CAAC,CACD,WAAW,WAAW;CAC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,6 +1,6 @@
1
1
  import { DriveSchema, nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
2
- import { CreateFileNodeSchema, CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, Node, NodeMode, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFileNodeSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
2
+ import { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, Node, NodeMode, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
3
3
  import { nodesTableFilters } from "./modules/storage/config/filters.mjs";
4
4
  import { ImageDisposition, ImageVariant, deviceSizes, imageDispositions, imageSizes, imageVariants } from "./modules/storage/lib/constants.mjs";
5
5
  import { NodeSubtype, getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes } from "./modules/storage/lib/helpers.mjs";
6
- export { CreateFileNodeSchema, CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, DriveSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, ImageDisposition, ImageVariant, Node, NodeMode, NodeSubtype, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFileNodeSchema, createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
6
+ export { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, DriveSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, ImageDisposition, ImageVariant, Node, NodeMode, NodeSubtype, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
package/dist/storage.mjs CHANGED
@@ -2,6 +2,6 @@ import { deviceSizes, imageDispositions, imageSizes, imageVariants } from "./mod
2
2
  import { getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes } from "./modules/storage/lib/helpers.mjs";
3
3
  import { nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
4
4
  import { nodesTableFilters } from "./modules/storage/config/filters.mjs";
5
- import { createFileNodeSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
5
+ import { createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
6
6
 
7
- export { createFileNodeSchema, createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
7
+ export { createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tulip-systems/core",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -13,8 +13,8 @@
13
13
  "tw-animate-css": "^1.4.0",
14
14
  "typescript": "5.9.3",
15
15
  "vite": "^7.2.7",
16
- "@tulip-systems/eslint-config": "0.0.0",
17
- "@tulip-systems/typescript-config": "0.0.0"
16
+ "@tulip-systems/typescript-config": "0.0.0",
17
+ "@tulip-systems/eslint-config": "0.0.0"
18
18
  },
19
19
  "dependencies": {
20
20
  "@aws-sdk/client-s3": "^3.946.0",
@@ -5,7 +5,6 @@ import {
5
5
  DropdownMenuItem,
6
6
  DropdownMenuTrigger,
7
7
  } from "@/components/ui/dropdown-menu";
8
- import { Separator } from "@/components/ui/separator";
9
8
  import { Editor } from "@tiptap/react";
10
9
  import {
11
10
  ChevronDown,
@@ -81,7 +80,7 @@ const blocks = [
81
80
  },
82
81
  ];
83
82
 
84
- export function BlockDropdown() {
83
+ export function EditorMenuNodes() {
85
84
  const { editor, extensions } = useContext(EditorContext);
86
85
 
87
86
  const selectedBlock = blocks.find((block) => block.selected(editor));
@@ -92,34 +91,30 @@ export function BlockDropdown() {
92
91
  if (filteredBlocks.length === 0) return null;
93
92
 
94
93
  return (
95
- <>
96
- <DropdownMenu>
97
- <DropdownMenuTrigger asChild>
98
- <Button variant="outline" size="sm" className="flex items-center gap-8 p-2">
99
- <span className="flex items-center gap-2">
100
- {Icon && <Icon className="size-3.5" />}
101
- {selectedBlock?.label ?? "Select a block"}
102
- </span>
94
+ <DropdownMenu>
95
+ <DropdownMenuTrigger asChild>
96
+ <Button variant="outline" size="sm" className="flex items-center gap-8 p-2">
97
+ <span className="flex items-center gap-2">
98
+ {Icon && <Icon className="size-3.5" />}
99
+ {selectedBlock?.label ?? "Select a block"}
100
+ </span>
103
101
 
104
- <ChevronDown className="size-3.5" />
105
- </Button>
106
- </DropdownMenuTrigger>
102
+ <ChevronDown className="size-3.5" />
103
+ </Button>
104
+ </DropdownMenuTrigger>
107
105
 
108
- <DropdownMenuContent>
109
- {filteredBlocks.map(({ label, icon: Icon, handler }, index) => (
110
- <DropdownMenuItem
111
- key={index}
112
- onClick={() => handler(editor)}
113
- className="flex items-center gap-2"
114
- >
115
- {Icon && <Icon className="size-3.5" />}
116
- {label}
117
- </DropdownMenuItem>
118
- ))}
119
- </DropdownMenuContent>
120
- </DropdownMenu>
121
-
122
- <Separator orientation="vertical" className="h-8" />
123
- </>
106
+ <DropdownMenuContent>
107
+ {filteredBlocks.map(({ label, icon: Icon, handler }, index) => (
108
+ <DropdownMenuItem
109
+ key={index}
110
+ onClick={() => handler(editor)}
111
+ className="flex items-center gap-2"
112
+ >
113
+ {Icon && <Icon className="size-3.5" />}
114
+ {label}
115
+ </DropdownMenuItem>
116
+ ))}
117
+ </DropdownMenuContent>
118
+ </DropdownMenu>
124
119
  );
125
120
  }
@@ -0,0 +1,214 @@
1
+ import { Button } from "@/components/ui/button";
2
+ import { ColorPicker } from "@/components/ui/color-picker.client";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
4
+ import { cn } from "@/lib/entry";
5
+ import { BubbleMenu } from "@tiptap/react/menus";
6
+ import {
7
+ BaselineIcon,
8
+ BoldIcon,
9
+ EraserIcon,
10
+ ItalicIcon,
11
+ PaintBucketIcon,
12
+ RedoIcon,
13
+ StrikethroughIcon,
14
+ UnderlineIcon,
15
+ UndoIcon,
16
+ } from "lucide-react";
17
+ import { ComponentProps, PropsWithChildren, useContext } from "react";
18
+ import { EditorContext } from "./editor.client";
19
+ import { EditorMenuNodes } from "./menu-nodes.client";
20
+
21
+ export function EditorMenuFixed(props: React.ComponentProps<"div">) {
22
+ return (
23
+ <div
24
+ {...props}
25
+ className={cn("border-input bg-muted/30 z-10 overflow-auto border-b p-2", props.className)}
26
+ >
27
+ <EditorMenuContent>
28
+ <EditorMenuUndoRedo />
29
+ <EditorMenuNodes />
30
+ <EditorMenuMarks />
31
+ <EditorMenuColor />
32
+ </EditorMenuContent>
33
+ </div>
34
+ );
35
+ }
36
+
37
+ export function EditorMenuBubble(props: ComponentProps<typeof BubbleMenu>) {
38
+ const { editor } = useContext(EditorContext);
39
+
40
+ return (
41
+ <BubbleMenu
42
+ {...props}
43
+ editor={editor}
44
+ options={{ ...props.options, strategy: "fixed" }}
45
+ className={cn("border-input bg-muted z-10 rounded-lg border p-2", props.className)}
46
+ >
47
+ <EditorMenuContent>
48
+ <EditorMenuMarks />
49
+ </EditorMenuContent>
50
+ </BubbleMenu>
51
+ );
52
+ }
53
+
54
+ function EditorMenuContent(props: PropsWithChildren) {
55
+ return <div className="flex items-center gap-6">{props.children}</div>;
56
+ }
57
+
58
+ /**
59
+ * Editor menu undo/redo
60
+ */
61
+ function EditorMenuUndoRedo() {
62
+ const { editor, extensions } = useContext(EditorContext);
63
+
64
+ if (!extensions.undoRedo) return null;
65
+
66
+ return (
67
+ <div className="flex items-center gap-1">
68
+ <Button
69
+ onClick={() => editor.commands.undo()}
70
+ disabled={!editor?.can().undo()}
71
+ type="button"
72
+ aria-label="Undo"
73
+ size="icon"
74
+ className="p-2"
75
+ variant="outline"
76
+ >
77
+ <UndoIcon className="size-3.5" />
78
+ </Button>
79
+
80
+ <Button
81
+ onClick={() => editor.commands.redo()}
82
+ disabled={!editor?.can().redo()}
83
+ type="button"
84
+ aria-label="Redo"
85
+ size="icon"
86
+ className="p-2"
87
+ variant="outline"
88
+ >
89
+ <RedoIcon className="size-3.5" />
90
+ </Button>
91
+ </div>
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Editor menu marks
97
+ */
98
+ function EditorMenuMarks() {
99
+ const { editor, extensions } = useContext(EditorContext);
100
+
101
+ if (!extensions.bold && !extensions.italic && !extensions.underline && !extensions.strike) {
102
+ return null;
103
+ }
104
+
105
+ return (
106
+ <div className="flex items-center gap-1">
107
+ {extensions.bold && (
108
+ <Button
109
+ type="button"
110
+ size="icon"
111
+ variant={editor?.isActive("bold") ? "secondary" : "outline"}
112
+ onClick={() => editor.chain().focus().toggleBold().run()}
113
+ className="border"
114
+ >
115
+ <BoldIcon className="h-3.5 w-3.5" />
116
+ </Button>
117
+ )}
118
+
119
+ {extensions.italic && (
120
+ <Button
121
+ type="button"
122
+ size="icon"
123
+ variant={editor?.isActive("italic") ? "secondary" : "outline"}
124
+ onClick={() => editor.chain().focus().toggleItalic().run()}
125
+ className="border"
126
+ >
127
+ <ItalicIcon className="size-3.5" />
128
+ </Button>
129
+ )}
130
+
131
+ {extensions.underline && (
132
+ <Button
133
+ type="button"
134
+ size="icon"
135
+ variant={editor?.isActive("underline") ? "secondary" : "outline"}
136
+ onClick={() => editor.chain().focus().toggleUnderline().run()}
137
+ className="border"
138
+ >
139
+ <UnderlineIcon className="size-3.5" />
140
+ </Button>
141
+ )}
142
+
143
+ {extensions.strike && (
144
+ <Button
145
+ type="button"
146
+ size="icon"
147
+ variant={editor?.isActive("strike") ? "secondary" : "outline"}
148
+ onClick={() => editor.chain().focus().toggleStrike().run()}
149
+ className="border"
150
+ >
151
+ <StrikethroughIcon className="size-3.5" />
152
+ </Button>
153
+ )}
154
+ </div>
155
+ );
156
+ }
157
+
158
+ /**
159
+ * Editor menu alignment
160
+ */
161
+ function EditorMenuColor() {
162
+ const { editor, extensions } = useContext(EditorContext);
163
+
164
+ if (!extensions.color && !extensions.highlight) {
165
+ return null;
166
+ }
167
+
168
+ return (
169
+ <div className="flex items-center gap-1">
170
+ {extensions.color && (
171
+ <Popover>
172
+ <PopoverTrigger asChild>
173
+ <Button size="icon" variant="outline">
174
+ <BaselineIcon className="size-3.5" />
175
+ </Button>
176
+ </PopoverTrigger>
177
+
178
+ <PopoverContent className="w-fit p-0">
179
+ <ColorPicker onValueChange={(color) => editor.chain().focus().setColor(color).run()} />
180
+ </PopoverContent>
181
+ </Popover>
182
+ )}
183
+
184
+ {extensions.highlight && (
185
+ <Popover>
186
+ <PopoverTrigger asChild>
187
+ <Button size="icon" variant="outline" disabled={!editor?.can().setHighlight()}>
188
+ <PaintBucketIcon className="size-3.5" />
189
+ </Button>
190
+ </PopoverTrigger>
191
+
192
+ <PopoverContent className="w-fit p-0">
193
+ <ColorPicker
194
+ onValueChange={(color) => editor.chain().focus().setHighlight({ color }).run()}
195
+ />
196
+ </PopoverContent>
197
+ </Popover>
198
+ )}
199
+
200
+ <Button
201
+ type="button"
202
+ size="icon"
203
+ variant="outline"
204
+ className="border"
205
+ onClick={() => {
206
+ editor.commands.unsetColor();
207
+ editor.commands.unsetHighlight();
208
+ }}
209
+ >
210
+ <EraserIcon className="h-4 w-4" />
211
+ </Button>
212
+ </div>
213
+ );
214
+ }
@@ -48,9 +48,9 @@ export type EditorExtensionsConfig = {
48
48
  paragraph: Partial<ParagraphOptions> | boolean;
49
49
  text: Partial<TextStyleOptions> | boolean;
50
50
  image: Partial<ImageOptions> | boolean;
51
- // /**
52
- // * Marks
53
- // */
51
+ /**
52
+ * Marks
53
+ */
54
54
  bold: Partial<BoldOptions> | boolean;
55
55
  italic: Partial<ItalicOptions> | boolean;
56
56
  link: Partial<LinkOptions> | boolean;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export * from "./editor/components/content.client";
5
5
  export * from "./editor/components/editor.client";
6
- export * from "./editor/components/menu-fixed.client";
6
+ export * from "./editor/components/menu.client";
7
7
 
8
8
  /**
9
9
  * Components headers
@@ -7,12 +7,13 @@ import { useAction } from "@/lib/hooks/use-action";
7
7
  import { generateDefaultUUID } from "@/modules/config/entry";
8
8
  import { useQueryClient } from "@tanstack/react-query";
9
9
  import { ComponentProps, useCallback, useState } from "react";
10
- import { FileNode, Node, PresignFileSchema } from "../lib/validators";
10
+ import { FileNode, Node, PresignFileSchema, UploadFileSchema } from "../lib/validators";
11
11
  import { UploadZoneContext } from "./upload-zone-context.client";
12
12
 
13
13
  export type UploadZoneProps = ComponentProps<"div"> & {
14
14
  namespace: string;
15
15
  parentId: string | null;
16
+ options?: Pick<UploadFileSchema, "readonly" | "hidden" | "mode">;
16
17
 
17
18
  queryKey: readonly unknown[];
18
19
 
@@ -33,6 +34,7 @@ export type UploadZoneProps = ComponentProps<"div"> & {
33
34
  export function UploadZone({
34
35
  namespace,
35
36
  parentId,
37
+ options,
36
38
  queryKey,
37
39
  presignAction,
38
40
  confirmAction,
@@ -191,6 +193,7 @@ export function UploadZone({
191
193
  * Send the presign request
192
194
  */
193
195
  const { id, presignedUrl } = await presignMutation.mutateAsync({
196
+ ...options,
194
197
  id: generateDefaultUUID(),
195
198
  name: file.name,
196
199
  size: file.size,
@@ -209,7 +212,7 @@ export function UploadZone({
209
212
  */
210
213
  return await confirmMutation.mutateAsync({ id });
211
214
  },
212
- [presignMutation, uploadMutation, confirmMutation, namespace, parentId],
215
+ [presignMutation, options, namespace, parentId, uploadMutation, confirmMutation],
213
216
  );
214
217
 
215
218
  return (
@@ -7,4 +7,5 @@ export const nodesTableFilters = createTableFilters({
7
7
  types: parseFilterArray(z.array(z.enum(nodeTypeEnum.enumValues))),
8
8
  nodeIds: parseFilterArray(z.array(z.string())),
9
9
  isDeleted: parseFilterBoolean(z.boolean()),
10
+ hidden: parseFilterBoolean(z.boolean()),
10
11
  });
@@ -1,6 +1,6 @@
1
1
  import { ImageLoaderProps } from "next/image";
2
2
  import { ImageVariant } from "./constants";
3
- import { FileNode, GetFileURLSchema, Node } from "./validators";
3
+ import { CreateNodeSchema, GetFileURLSchema, Node } from "./validators";
4
4
 
5
5
  /**
6
6
  * Check if the node is a file
@@ -62,7 +62,8 @@ export type NodeSubtype = (typeof nodeSubtypes)[number];
62
62
  export function inferNodeSubtype({
63
63
  name,
64
64
  contentType,
65
- }: Pick<FileNode, "name" | "contentType">): NodeSubtype {
65
+ }: Pick<CreateNodeSchema, "name" | "contentType">): NodeSubtype {
66
+ if (!contentType) return "other";
66
67
  if (contentType?.startsWith("image/")) return "image";
67
68
  if (contentType === "application/pdf") return "document";
68
69
  if (contentType?.includes("spreadsheet")) return "spreadsheet";
@@ -141,6 +141,12 @@ export function createDriveBaseProcedures() {
141
141
  /**
142
142
  * Validate
143
143
  */
144
+ if (node?.readonly) {
145
+ throw new ServerError("BAD_REQUEST", {
146
+ message: "Deze node is alleen leesbaar en kan niet worden gewijzigd",
147
+ });
148
+ }
149
+
144
150
  if (input.parentId && !parent)
145
151
  throw new ServerError("BAD_REQUEST", { message: "Parent not found" });
146
152
  if (!node) throw new ServerError("BAD_REQUEST", { message: "Node not found" });
@@ -21,6 +21,7 @@ export const nodes = pgTable("nodes", (t) => ({
21
21
  size: t.integer().default(0),
22
22
  contentType: t.varchar({ length: 255 }),
23
23
  readonly: boolean().default(false),
24
+ hidden: boolean().default(false),
24
25
  createdBy: t.uuid().references(() => users.id, { onDelete: "set null" }),
25
26
  isPending: t.boolean().default(false).notNull(),
26
27
  isDeleted: t.boolean().default(false).notNull(),
@@ -101,11 +101,10 @@ export class StorageService<TSchema extends TDatabaseSchema> {
101
101
  Bucket: BUCKET_NAME,
102
102
  Key: getDriveBucketKey(input.id, input.variant),
103
103
  Body: input.body,
104
- ContentType: input.contentType,
105
- ContentLength: input.size,
104
+ ContentType: input.contentType ?? "",
105
+ ContentLength: input.size ?? 0,
106
106
  Metadata: {
107
107
  nodeId: input.id,
108
- filename: input.name,
109
108
  },
110
109
  });
111
110
  }
@@ -118,6 +117,13 @@ export class StorageService<TSchema extends TDatabaseSchema> {
118
117
  return await this.#blob.send(putCommand);
119
118
  }
120
119
 
120
+ /**
121
+ * Get node by id
122
+ */
123
+ async getNodeById(id: string) {
124
+ return this.#db.select().from(nodes).where(eq(nodes.id, id));
125
+ }
126
+
121
127
  /**
122
128
  * Get nodes by parent id
123
129
  */
@@ -133,6 +139,7 @@ export class StorageService<TSchema extends TDatabaseSchema> {
133
139
  filters.nodeIds != null ? inArray(nodes.id, filters.nodeIds) : undefined,
134
140
  filters.types != null ? inArray(nodes.type, filters.types) : undefined,
135
141
  filters.isDeleted != null ? eq(nodes.isDeleted, filters.isDeleted) : undefined,
142
+ filters.hidden != null ? eq(nodes.hidden, filters.hidden) : undefined,
136
143
  filters.parentId ? eq(nodes.parentId, filters.parentId) : isNull(nodes.parentId),
137
144
  eq(nodes.namespace, filters.namespace),
138
145
  search,
@@ -411,6 +418,15 @@ export class StorageService<TSchema extends TDatabaseSchema> {
411
418
  * Update a node
412
419
  */
413
420
  async updateNode(input: { id: string; data: UpdateNodeSchema }) {
421
+ const [node] = await this.#db
422
+ .select({ readonly: nodes.readonly })
423
+ .from(nodes)
424
+ .where(eq(nodes.id, input.id));
425
+
426
+ if (node?.readonly) {
427
+ throw new ServerError("BAD_REQUEST", { message: "Node is readonly" });
428
+ }
429
+
414
430
  const [result] = await this.#db
415
431
  .update(nodes)
416
432
  .set(input.data)
@@ -431,10 +447,15 @@ export class StorageService<TSchema extends TDatabaseSchema> {
431
447
  */
432
448
  async deleteNodes(input: BulkActionSchema) {
433
449
  const items = await this.#db
434
- .select({ id: nodes.id, type: nodes.type })
450
+ .select({ id: nodes.id, type: nodes.type, readonly: nodes.readonly })
435
451
  .from(nodes)
436
452
  .where(inArray(nodes.id, input.ids));
437
453
 
454
+ // Check if the nodes are readonly
455
+ if (items.some((item) => item.readonly)) {
456
+ throw new ServerError("BAD_REQUEST", { message: "Nodes are readonly" });
457
+ }
458
+
438
459
  // Split the nodes into folders and files
439
460
  const folders = items.filter(isFolder).map((folder) => folder.id);
440
461
  const files = items.filter(isFile).map((file) => file.id);