@tulip-systems/core 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/dist/auth/server.d.mts +3 -3
  2. package/dist/auth/server.mjs +3 -3
  3. package/dist/components/editor/components/editor.client.d.mts +4 -3
  4. package/dist/components/editor/components/editor.client.d.mts.map +1 -1
  5. package/dist/components/editor/components/editor.client.mjs +5 -2
  6. package/dist/components/editor/components/editor.client.mjs.map +1 -1
  7. package/dist/components/editor/extensions/file-handler/extension.d.mts +4 -4
  8. package/dist/components/editor/extensions/file-handler/extension.d.mts.map +1 -1
  9. package/dist/components/editor/extensions/file-handler/extension.mjs.map +1 -1
  10. package/dist/components/editor/extensions/file-handler/strategy.d.mts +4 -6
  11. package/dist/components/editor/extensions/file-handler/strategy.d.mts.map +1 -1
  12. package/dist/components/editor/extensions/file-handler/strategy.mjs +11 -11
  13. package/dist/components/editor/extensions/file-handler/strategy.mjs.map +1 -1
  14. package/dist/components/editor/extensions/file-handler/utils.mjs +1 -1
  15. package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -1
  16. package/dist/components/editor/extensions/image/extension.mjs +9 -9
  17. package/dist/components/editor/extensions/image/extension.mjs.map +1 -1
  18. package/dist/components/editor/lib/constants.d.mts +1 -1
  19. package/dist/components/editor/lib/constants.mjs +1 -1
  20. package/dist/components/editor/lib/extensions.d.mts +1 -1
  21. package/dist/components/editor/lib/helpers.d.mts +11 -3
  22. package/dist/components/editor/lib/helpers.d.mts.map +1 -1
  23. package/dist/components/editor/lib/helpers.mjs +27 -13
  24. package/dist/components/editor/lib/helpers.mjs.map +1 -1
  25. package/dist/components/ui/combobox-dropdown.client.mjs +1 -0
  26. package/dist/components/ui/combobox-dropdown.client.mjs.map +1 -1
  27. package/dist/components/ui/combobox.client.mjs +1 -1
  28. package/dist/components/ui/combobox.client.mjs.map +1 -1
  29. package/dist/components.d.mts +2 -2
  30. package/dist/components.mjs +2 -2
  31. package/dist/config/server.d.mts +1 -3
  32. package/dist/config/server.mjs +1 -4
  33. package/dist/config.d.mts +2 -2
  34. package/dist/config.mjs +1 -1
  35. package/dist/data-tables/client.d.mts +2 -1
  36. package/dist/data-tables/client.mjs +2 -1
  37. package/dist/data-tables.d.mts +1 -1
  38. package/dist/database/client.d.mts +1 -0
  39. package/dist/database/client.mjs +1 -0
  40. package/dist/database/server.d.mts +2 -0
  41. package/dist/database/server.mjs +3 -0
  42. package/dist/database.d.mts +3 -0
  43. package/dist/database.mjs +3 -0
  44. package/dist/emails/client.d.mts +1 -0
  45. package/dist/emails/client.mjs +1 -0
  46. package/dist/emails/server.d.mts +2 -0
  47. package/dist/emails/server.mjs +3 -0
  48. package/dist/emails.d.mts +1 -0
  49. package/dist/emails.mjs +1 -0
  50. package/dist/lib/utils/markdown.d.mts +10 -0
  51. package/dist/lib/utils/markdown.d.mts.map +1 -0
  52. package/dist/lib/utils/markdown.mjs +15 -0
  53. package/dist/lib/utils/markdown.mjs.map +1 -0
  54. package/dist/lib/utils/url.mjs +2 -1
  55. package/dist/lib/utils/url.mjs.map +1 -1
  56. package/dist/lib/utils/user-agent.mjs +15 -0
  57. package/dist/lib/utils/user-agent.mjs.map +1 -1
  58. package/dist/lib.d.mts +2 -2
  59. package/dist/lib.mjs +2 -2
  60. package/dist/modules/auth/components/create-first-user-guard.server.d.mts +16 -0
  61. package/dist/modules/auth/components/create-first-user-guard.server.d.mts.map +1 -0
  62. package/dist/modules/auth/components/create-first-user-guard.server.mjs +16 -0
  63. package/dist/modules/auth/components/create-first-user-guard.server.mjs.map +1 -0
  64. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  65. package/dist/modules/auth/components/guard.server.mjs +1 -1
  66. package/dist/modules/auth/components/guard.server.mjs.map +1 -1
  67. package/dist/modules/auth/db/schema.d.mts +1 -1
  68. package/dist/modules/auth/db/schema.mjs +2 -2
  69. package/dist/modules/auth/handler/create-client.client.d.mts +4838 -229
  70. package/dist/modules/auth/handler/create-client.client.d.mts.map +1 -1
  71. package/dist/modules/auth/handler/create-client.client.mjs.map +1 -1
  72. package/dist/modules/auth/handler/proxy.server.mjs +2 -2
  73. package/dist/modules/auth/handler/proxy.server.mjs.map +1 -1
  74. package/dist/modules/auth/handler/route.server.d.mts +2 -2
  75. package/dist/modules/auth/handler/route.server.d.mts.map +1 -1
  76. package/dist/modules/auth/handler/route.server.mjs.map +1 -1
  77. package/dist/modules/auth/handler/{init.d.mts → service.server.d.mts} +322 -90
  78. package/dist/modules/auth/handler/service.server.d.mts.map +1 -0
  79. package/dist/modules/auth/handler/{init.mjs → service.server.mjs} +19 -8
  80. package/dist/modules/auth/handler/service.server.mjs.map +1 -0
  81. package/dist/modules/auth/hooks/use-session.d.mts +9 -4
  82. package/dist/modules/auth/hooks/use-session.d.mts.map +1 -1
  83. package/dist/modules/auth/lib/helpers.server.d.mts +1 -1
  84. package/dist/modules/auth/lib/permissions.d.mts +1 -1
  85. package/dist/modules/auth/lib/validators.mjs +1 -1
  86. package/dist/modules/config/lib/context.d.mts +9 -10
  87. package/dist/modules/config/lib/context.d.mts.map +1 -1
  88. package/dist/modules/config/lib/context.mjs.map +1 -1
  89. package/dist/modules/data-tables/lib/converters/search.d.mts +1 -1
  90. package/dist/modules/data-tables/lib/converters/sorting.d.mts +1 -1
  91. package/dist/modules/data-tables/server/get-data.server.d.mts +3 -3
  92. package/dist/modules/data-tables/server/get-data.server.mjs +1 -1
  93. package/dist/modules/data-tables/server/get-data.server.mjs.map +1 -1
  94. package/dist/modules/data-tables/strategies/infinite/strategy.d.mts +1 -1
  95. package/dist/modules/data-tables/strategies/infinite/strategy.mjs +3 -0
  96. package/dist/modules/data-tables/strategies/infinite/strategy.mjs.map +1 -1
  97. package/dist/modules/data-tables/tables/data-table/components/row.mjs +5 -15
  98. package/dist/modules/data-tables/tables/data-table/components/row.mjs.map +1 -1
  99. package/dist/modules/data-tables/tables/inline-table/components/body.mjs +1 -1
  100. package/dist/modules/data-tables/tables/inline-table/components/body.mjs.map +1 -1
  101. package/dist/modules/data-tables/tables/inline-table/components/row.client.mjs +13 -23
  102. package/dist/modules/data-tables/tables/inline-table/components/row.client.mjs.map +1 -1
  103. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +1 -0
  104. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
  105. package/dist/modules/data-tables/tables/inline-table/components/table.mjs +2 -1
  106. package/dist/modules/data-tables/tables/inline-table/components/table.mjs.map +1 -1
  107. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +5 -1
  108. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
  109. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs +2 -1
  110. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs.map +1 -1
  111. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts +30 -0
  112. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts.map +1 -0
  113. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs +77 -9
  114. package/dist/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs.map +1 -1
  115. package/dist/modules/{config/db → database/lib}/helpers.d.mts +2 -2
  116. package/dist/modules/database/lib/helpers.d.mts.map +1 -0
  117. package/dist/modules/{config/db → database/lib}/helpers.mjs +1 -1
  118. package/dist/modules/database/lib/helpers.mjs.map +1 -0
  119. package/dist/modules/database/lib/service.server.d.mts +34 -0
  120. package/dist/modules/database/lib/service.server.d.mts.map +1 -0
  121. package/dist/modules/database/lib/service.server.mjs +24 -0
  122. package/dist/modules/database/lib/service.server.mjs.map +1 -0
  123. package/dist/modules/{config/db → database/lib}/types.d.mts +1 -1
  124. package/dist/modules/database/lib/types.d.mts.map +1 -0
  125. package/dist/modules/emails/lib/service.server.d.mts +29 -0
  126. package/dist/modules/emails/lib/service.server.d.mts.map +1 -0
  127. package/dist/modules/emails/lib/service.server.mjs +21 -0
  128. package/dist/modules/emails/lib/service.server.mjs.map +1 -0
  129. package/dist/modules/inline-edit/components/date-input.client.mjs +1 -1
  130. package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
  131. package/dist/modules/inline-edit/components/date-picker.client.mjs +1 -0
  132. package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
  133. package/dist/modules/inline-edit/components/date-time.client.mjs +1 -0
  134. package/dist/modules/inline-edit/components/date-time.client.mjs.map +1 -1
  135. package/dist/modules/inline-edit/components/editor.client.mjs +1 -0
  136. package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
  137. package/dist/modules/inline-edit/components/input-recipient.client.mjs +1 -0
  138. package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
  139. package/dist/modules/inline-edit/components/input-toggle.client.mjs +1 -0
  140. package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
  141. package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
  142. package/dist/modules/inline-edit/components/input.client.mjs +3 -0
  143. package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
  144. package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
  145. package/dist/modules/inline-edit/components/select.client.mjs +1 -0
  146. package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
  147. package/dist/modules/inline-edit/components/switch.client.mjs +1 -0
  148. package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
  149. package/dist/modules/inline-edit/components/toggle.client.mjs +1 -0
  150. package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
  151. package/dist/modules/router/handler/context.server.d.mts +12 -10
  152. package/dist/modules/router/handler/context.server.d.mts.map +1 -1
  153. package/dist/modules/router/handler/init.server.d.mts +13 -11
  154. package/dist/modules/router/handler/init.server.d.mts.map +1 -1
  155. package/dist/modules/router/handler/init.server.mjs +2 -2
  156. package/dist/modules/router/handler/init.server.mjs.map +1 -1
  157. package/dist/modules/router/handler/route.server.d.mts +1 -1
  158. package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
  159. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  160. package/dist/modules/storage/components/dropzone.client.mjs.map +1 -1
  161. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  162. package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
  163. package/dist/modules/storage/components/image-grid.client.mjs +20 -22
  164. package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
  165. package/dist/modules/storage/components/image.client.d.mts +8 -0
  166. package/dist/modules/storage/components/image.client.d.mts.map +1 -0
  167. package/dist/modules/storage/components/image.client.mjs +17 -0
  168. package/dist/modules/storage/components/image.client.mjs.map +1 -0
  169. package/dist/modules/storage/components/upload-button.client.d.mts +12 -0
  170. package/dist/modules/storage/components/upload-button.client.d.mts.map +1 -0
  171. package/dist/modules/storage/components/upload-button.client.mjs +34 -0
  172. package/dist/modules/storage/components/upload-button.client.mjs.map +1 -0
  173. package/dist/modules/storage/components/upload-zone-context.client.d.mts +5 -5
  174. package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
  175. package/dist/modules/storage/components/upload-zone-context.client.mjs +2 -2
  176. package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
  177. package/dist/modules/storage/components/upload-zone.client.d.mts +4 -4
  178. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  179. package/dist/modules/storage/components/upload-zone.client.mjs +16 -9
  180. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  181. package/dist/modules/storage/lib/constants.d.mts +1 -5
  182. package/dist/modules/storage/lib/constants.d.mts.map +1 -1
  183. package/dist/modules/storage/lib/constants.mjs +1 -13
  184. package/dist/modules/storage/lib/constants.mjs.map +1 -1
  185. package/dist/modules/storage/lib/helpers.d.mts +14 -28
  186. package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
  187. package/dist/modules/storage/lib/helpers.mjs +17 -75
  188. package/dist/modules/storage/lib/helpers.mjs.map +1 -1
  189. package/dist/modules/storage/lib/procedures.server.d.mts +1991 -0
  190. package/dist/modules/{auth/handler/init.d.mts.map → storage/lib/procedures.server.d.mts.map} +1 -1
  191. package/dist/modules/storage/lib/procedures.server.mjs +22 -0
  192. package/dist/modules/storage/lib/procedures.server.mjs.map +1 -0
  193. package/dist/modules/storage/lib/router-handlers.server.d.mts +41 -0
  194. package/dist/modules/storage/lib/router-handlers.server.d.mts.map +1 -0
  195. package/dist/modules/storage/lib/router-handlers.server.mjs +124 -0
  196. package/dist/modules/storage/lib/router-handlers.server.mjs.map +1 -0
  197. package/dist/modules/storage/lib/schema.d.mts +68 -958
  198. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  199. package/dist/modules/storage/lib/schema.mjs +28 -65
  200. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  201. package/dist/modules/storage/lib/service.server.d.mts +2155 -141
  202. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  203. package/dist/modules/storage/lib/service.server.mjs +453 -242
  204. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  205. package/dist/modules/storage/lib/upload.client.d.mts +58 -0
  206. package/dist/modules/storage/lib/upload.client.d.mts.map +1 -0
  207. package/dist/modules/storage/lib/upload.client.mjs +87 -0
  208. package/dist/modules/storage/lib/upload.client.mjs.map +1 -0
  209. package/dist/modules/storage/lib/validators.d.mts +297 -835
  210. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  211. package/dist/modules/storage/lib/validators.mjs +32 -76
  212. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  213. package/dist/modules/storage/providers/adapters/s3.server.d.mts +19 -0
  214. package/dist/modules/storage/providers/adapters/s3.server.d.mts.map +1 -0
  215. package/dist/modules/storage/providers/adapters/s3.server.mjs +173 -0
  216. package/dist/modules/storage/providers/adapters/s3.server.mjs.map +1 -0
  217. package/dist/modules/storage/providers/lib/constants.d.mts +6 -0
  218. package/dist/modules/storage/providers/lib/constants.d.mts.map +1 -0
  219. package/dist/modules/storage/providers/lib/constants.mjs +6 -0
  220. package/dist/modules/storage/providers/lib/constants.mjs.map +1 -0
  221. package/dist/modules/storage/providers/lib/errors.d.mts +12 -0
  222. package/dist/modules/storage/providers/lib/errors.d.mts.map +1 -0
  223. package/dist/modules/storage/providers/lib/errors.mjs +13 -0
  224. package/dist/modules/storage/providers/lib/errors.mjs.map +1 -0
  225. package/dist/modules/storage/providers/lib/types.d.mts +21 -0
  226. package/dist/modules/storage/providers/lib/types.d.mts.map +1 -0
  227. package/dist/modules/storage/providers/lib/validators.d.mts +112 -0
  228. package/dist/modules/storage/providers/lib/validators.d.mts.map +1 -0
  229. package/dist/modules/storage/providers/lib/validators.mjs +75 -0
  230. package/dist/modules/storage/providers/lib/validators.mjs.map +1 -0
  231. package/dist/router/server.d.mts +1 -1
  232. package/dist/storage/client.d.mts +4 -2
  233. package/dist/storage/client.mjs +4 -2
  234. package/dist/storage/server.d.mts +5 -4
  235. package/dist/storage/server.mjs +5 -4
  236. package/dist/storage.d.mts +9 -6
  237. package/dist/storage.mjs +8 -6
  238. package/package.json +18 -5
  239. package/src/components/editor/components/editor.client.tsx +9 -1
  240. package/src/components/editor/extensions/file-handler/extension.ts +4 -4
  241. package/src/components/editor/extensions/file-handler/strategy.ts +15 -40
  242. package/src/components/editor/extensions/file-handler/utils.ts +1 -1
  243. package/src/components/editor/extensions/image/extension.ts +10 -10
  244. package/src/components/editor/lib/helpers.ts +28 -11
  245. package/src/components/ui/combobox-dropdown.client.tsx +1 -0
  246. package/src/components/ui/combobox.client.tsx +1 -1
  247. package/src/entry.ts +12 -51
  248. package/src/lib/entry.ts +1 -5
  249. package/src/lib/utils/markdown.ts +10 -0
  250. package/src/lib/utils/url.ts +2 -1
  251. package/src/lib/utils/user-agent.ts +15 -0
  252. package/src/modules/auth/components/{guard-first-user.server.tsx → create-first-user-guard.server.tsx} +8 -8
  253. package/src/modules/auth/components/guard.server.tsx +1 -1
  254. package/src/modules/auth/entry.server.ts +4 -5
  255. package/src/modules/auth/handler/create-client.client.ts +2 -2
  256. package/src/modules/auth/handler/proxy.server.ts +1 -1
  257. package/src/modules/auth/handler/route.server.ts +2 -2
  258. package/src/modules/auth/handler/{init.ts → service.server.ts} +30 -9
  259. package/src/modules/config/entry.server.ts +0 -9
  260. package/src/modules/config/entry.ts +2 -2
  261. package/src/modules/config/lib/context.ts +9 -9
  262. package/src/modules/data-tables/entry.client.ts +1 -0
  263. package/src/modules/data-tables/server/get-data.server.ts +1 -1
  264. package/src/modules/data-tables/strategies/infinite/strategy.ts +4 -1
  265. package/src/modules/data-tables/tables/data-table/components/row.tsx +12 -21
  266. package/src/modules/data-tables/tables/inline-table/components/body.tsx +1 -1
  267. package/src/modules/data-tables/tables/inline-table/components/row.client.tsx +24 -30
  268. package/src/modules/data-tables/tables/inline-table/components/table.tsx +6 -1
  269. package/src/modules/data-tables/tables/inline-table/hooks/context.client.tsx +5 -0
  270. package/src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.ts +119 -91
  271. package/src/modules/database/entry.client.ts +0 -0
  272. package/src/modules/database/entry.server.ts +4 -0
  273. package/src/modules/database/entry.ts +5 -0
  274. package/src/modules/database/lib/service.server.ts +33 -0
  275. package/src/modules/emails/entry.client.ts +0 -0
  276. package/src/modules/emails/entry.server.ts +4 -0
  277. package/src/modules/emails/entry.ts +0 -0
  278. package/src/modules/emails/lib/service.server.ts +29 -0
  279. package/src/modules/inline-edit/components/date-input.client.tsx +1 -1
  280. package/src/modules/inline-edit/components/date-picker.client.tsx +1 -0
  281. package/src/modules/inline-edit/components/date-time.client.tsx +1 -0
  282. package/src/modules/inline-edit/components/editor.client.tsx +3 -0
  283. package/src/modules/inline-edit/components/input-recipient.client.tsx +1 -0
  284. package/src/modules/inline-edit/components/input-toggle.client.tsx +1 -0
  285. package/src/modules/inline-edit/components/input.client.tsx +3 -0
  286. package/src/modules/inline-edit/components/select.client.tsx +5 -1
  287. package/src/modules/inline-edit/components/switch.client.tsx +1 -0
  288. package/src/modules/inline-edit/components/toggle.client.tsx +1 -0
  289. package/src/modules/router/handler/init.server.ts +2 -2
  290. package/src/modules/storage/components/dropzone.client.tsx +1 -1
  291. package/src/modules/storage/components/image-grid.client.tsx +23 -20
  292. package/src/modules/storage/components/image.client.tsx +8 -0
  293. package/src/modules/storage/components/upload-zone-context.client.tsx +11 -8
  294. package/src/modules/storage/components/upload-zone.client.tsx +22 -16
  295. package/src/modules/storage/entry.client.ts +3 -1
  296. package/src/modules/storage/entry.server.ts +9 -3
  297. package/src/modules/storage/entry.ts +13 -1
  298. package/src/modules/storage/lib/constants.ts +0 -11
  299. package/src/modules/storage/lib/helpers.ts +18 -65
  300. package/src/modules/storage/lib/procedures.server.ts +60 -0
  301. package/src/modules/storage/lib/router-handlers.server.ts +178 -0
  302. package/src/modules/storage/lib/schema.ts +26 -97
  303. package/src/modules/storage/lib/service.server.ts +636 -374
  304. package/src/modules/storage/lib/upload.client.ts +156 -0
  305. package/src/modules/storage/lib/validators.ts +50 -111
  306. package/src/modules/storage/providers/adapters/s3.server.ts +281 -0
  307. package/src/modules/storage/providers/lib/constants.ts +3 -0
  308. package/src/modules/storage/providers/lib/errors.ts +21 -0
  309. package/src/modules/storage/providers/lib/types.ts +28 -0
  310. package/src/modules/storage/providers/lib/validators.ts +122 -0
  311. package/dist/lib/config/constants.d.mts +0 -5
  312. package/dist/lib/config/constants.d.mts.map +0 -1
  313. package/dist/lib/config/constants.mjs +0 -6
  314. package/dist/lib/config/constants.mjs.map +0 -1
  315. package/dist/modules/auth/components/guard-first-user.server.d.mts +0 -18
  316. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +0 -1
  317. package/dist/modules/auth/components/guard-first-user.server.mjs +0 -16
  318. package/dist/modules/auth/components/guard-first-user.server.mjs.map +0 -1
  319. package/dist/modules/auth/handler/init.mjs.map +0 -1
  320. package/dist/modules/config/db/helpers.d.mts.map +0 -1
  321. package/dist/modules/config/db/helpers.mjs.map +0 -1
  322. package/dist/modules/config/db/init.d.mts +0 -20
  323. package/dist/modules/config/db/init.d.mts.map +0 -1
  324. package/dist/modules/config/db/init.mjs +0 -15
  325. package/dist/modules/config/db/init.mjs.map +0 -1
  326. package/dist/modules/config/db/types.d.mts.map +0 -1
  327. package/dist/modules/config/providers/email.d.mts +0 -12
  328. package/dist/modules/config/providers/email.d.mts.map +0 -1
  329. package/dist/modules/config/providers/email.mjs +0 -11
  330. package/dist/modules/config/providers/email.mjs.map +0 -1
  331. package/dist/modules/storage/config/filters.d.mts +0 -17
  332. package/dist/modules/storage/config/filters.d.mts.map +0 -1
  333. package/dist/modules/storage/config/filters.mjs +0 -17
  334. package/dist/modules/storage/config/filters.mjs.map +0 -1
  335. package/dist/modules/storage/lib/create-client.server.d.mts +0 -11
  336. package/dist/modules/storage/lib/create-client.server.d.mts.map +0 -1
  337. package/dist/modules/storage/lib/create-client.server.mjs +0 -11
  338. package/dist/modules/storage/lib/create-client.server.mjs.map +0 -1
  339. package/dist/modules/storage/lib/create-upload.client.d.mts +0 -56
  340. package/dist/modules/storage/lib/create-upload.client.d.mts.map +0 -1
  341. package/dist/modules/storage/lib/create-upload.client.mjs +0 -98
  342. package/dist/modules/storage/lib/create-upload.client.mjs.map +0 -1
  343. package/dist/modules/storage/lib/proxy.server.d.mts +0 -21
  344. package/dist/modules/storage/lib/proxy.server.d.mts.map +0 -1
  345. package/dist/modules/storage/lib/proxy.server.mjs +0 -46
  346. package/dist/modules/storage/lib/proxy.server.mjs.map +0 -1
  347. package/dist/modules/storage/lib/router.server.d.mts +0 -31002
  348. package/dist/modules/storage/lib/router.server.d.mts.map +0 -1
  349. package/dist/modules/storage/lib/router.server.mjs +0 -86
  350. package/dist/modules/storage/lib/router.server.mjs.map +0 -1
  351. package/src/lib/config/constants.ts +0 -1
  352. package/src/lib/utils/time-picker.ts +0 -139
  353. package/src/modules/config/db/init.ts +0 -21
  354. package/src/modules/config/providers/email.ts +0 -13
  355. package/src/modules/storage/config/filters.ts +0 -12
  356. package/src/modules/storage/lib/create-client.server.ts +0 -14
  357. package/src/modules/storage/lib/create-upload.client.ts +0 -134
  358. package/src/modules/storage/lib/proxy.server.ts +0 -63
  359. package/src/modules/storage/lib/router.server.ts +0 -182
  360. /package/src/modules/{config/db → database/lib}/helpers.ts +0 -0
  361. /package/src/modules/{config/db → database/lib}/types.ts +0 -0
package/src/entry.ts CHANGED
@@ -38,6 +38,18 @@ export const entry = {
38
38
  "data-tables": "./src/modules/data-tables/entry.ts",
39
39
  "data-tables/client": "./src/modules/data-tables/entry.client.ts",
40
40
  "data-tables/server": "./src/modules/data-tables/entry.server.ts",
41
+ /**
42
+ * Database Module
43
+ */
44
+ database: "./src/modules/database/entry.ts",
45
+ "database/client": "./src/modules/database/entry.client.ts",
46
+ "database/server": "./src/modules/database/entry.server.ts",
47
+ /**
48
+ * Emails Module
49
+ */
50
+ emails: "./src/modules/emails/entry.ts",
51
+ "emails/client": "./src/modules/emails/entry.client.ts",
52
+ "emails/server": "./src/modules/emails/entry.server.ts",
41
53
  /**
42
54
  * Inline Edit Module
43
55
  */
@@ -57,54 +69,3 @@ export const entry = {
57
69
  "storage/client": "./src/modules/storage/entry.client.ts",
58
70
  "storage/server": "./src/modules/storage/entry.server.ts",
59
71
  };
60
-
61
- // export const entry = [
62
- // /**
63
- // * Components
64
- // */
65
- // "./src/components/entry.ts",
66
- // "./src/components/entry.client.ts",
67
- // "./src/components/entry.server.ts",
68
- // /**
69
- // * Lib
70
- // */
71
- // "./src/lib/entry.ts",
72
- // "./src/lib/entry.client.ts",
73
- // "./src/lib/entry.server.ts",
74
- // /**
75
- // * Auth Module
76
- // */
77
- // "./src/modules/auth/entry.ts",
78
- // "./src/modules/auth/entry.client.ts",
79
- // "./src/modules/auth/entry.server.ts",
80
- // /**
81
- // * Commands Module
82
- // */
83
- // "./src/modules/commands/entry.ts",
84
- // "./src/modules/commands/entry.client.ts",
85
- // "./src/modules/commands/entry.server.ts",
86
- // /**
87
- // * Config Module
88
- // */
89
- // "./src/modules/config/entry.ts",
90
- // "./src/modules/config/entry.client.ts",
91
- // "./src/modules/config/entry.server.ts",
92
- // /**
93
- // * Data Table Module
94
- // */
95
- // "./src/modules/data-tables/entry.ts",
96
- // "./src/modules/data-tables/entry.client.ts",
97
- // "./src/modules/data-tables/entry.server.ts",
98
- // /**
99
- // * Inline Edit Module
100
- // */
101
- // "./src/modules/inline-edit/entry.ts",
102
- // "./src/modules/inline-edit/entry.client.ts",
103
- // "./src/modules/inline-edit/entry.server.ts",
104
- // /**
105
- // * Uploads Module
106
- // */
107
- // "./src/modules/uploads/entry.ts",
108
- // "./src/modules/uploads/entry.client.ts",
109
- // "./src/modules/uploads/entry.server.ts",
110
- // ];
package/src/lib/entry.ts CHANGED
@@ -1,8 +1,3 @@
1
- /**
2
- * Config
3
- */
4
- export * from "./config/constants";
5
-
6
1
  /**
7
2
  * Types
8
3
  */
@@ -15,4 +10,5 @@ export * from "./utils/array-move";
15
10
  export * from "./utils/cn";
16
11
  export * from "./utils/format";
17
12
  export * from "./utils/manifest";
13
+ export * from "./utils/markdown";
18
14
  export * from "./utils/url";
@@ -0,0 +1,10 @@
1
+ import MarkdownIt from "markdown-it";
2
+
3
+ /**
4
+ * Convert markdown to HTML
5
+ */
6
+ export const markdownParser = new MarkdownIt({
7
+ html: false, // safer default
8
+ linkify: true,
9
+ breaks: true,
10
+ });
@@ -5,8 +5,9 @@
5
5
  */
6
6
  export function url(path: string = ""): string {
7
7
  const base = process.env.NEXT_PUBLIC_DEPLOYMENT_URL ?? process.env.NEXT_PUBLIC_VERCEL_URL;
8
+ const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
8
9
 
9
- if (base) return `https://${base}${path}`;
10
+ if (base) return `${protocol}://${base}${path}`;
10
11
 
11
12
  return `http://localhost:${process.env.NEXT_PUBLIC_PORT ?? 3000}${path}`;
12
13
  }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Detects the browser name and version from a user agent string.
3
+ * @param ua - The user agent string.
4
+ * @returns An object with the browser name and optional version.
5
+ */
1
6
  export function detectBrowser(ua: string): { name: string; version?: string } {
2
7
  // Edge
3
8
  let m = ua.match(/Edg\/(\d+)/);
@@ -22,6 +27,11 @@ export function detectBrowser(ua: string): { name: string; version?: string } {
22
27
  return { name: "Unknown browser" };
23
28
  }
24
29
 
30
+ /**
31
+ * Detects the operating system name and version from a user agent string.
32
+ * @param ua - The user agent string.
33
+ * @returns An object with the OS name and optional version.
34
+ */
25
35
  export function detectOS(ua: string): { name: string; version?: string } {
26
36
  // macOS
27
37
  let m = ua.match(/Mac OS X ([\d_]+)/);
@@ -48,6 +58,11 @@ export function detectOS(ua: string): { name: string; version?: string } {
48
58
  return { name: "Unknown OS" };
49
59
  }
50
60
 
61
+ /**
62
+ * Detects the device type (Desktop, Mobile, or Tablet) from a user agent string.
63
+ * @param ua - The user agent string.
64
+ * @returns The device type as "Desktop", "Mobile", or "Tablet".
65
+ */
51
66
  export function detectDevice(ua: string): "Desktop" | "Mobile" | "Tablet" {
52
67
  const s = ua.toLowerCase();
53
68
 
@@ -1,25 +1,25 @@
1
+ import "server-cli-only";
2
+
1
3
  import { redirect } from "next/navigation";
4
+ import { connection } from "next/server";
2
5
  import type { PropsWithChildren } from "react";
3
6
  import type { TDatabaseSchema, TulipContext } from "@/modules/config/entry";
4
7
  import { users } from "../db/schema";
5
8
 
6
9
  type AuthGuardFirstUserProps<TSchema extends TDatabaseSchema> = PropsWithChildren<
7
- Pick<TulipContext<TSchema>, "db"> & { login?: boolean }
10
+ Pick<TulipContext<TSchema>, "db">
8
11
  >;
9
12
 
10
- export async function AuthGuardFirstUser<TSchema extends TDatabaseSchema>({
13
+ export async function CreateFirstUserPageGuard<TSchema extends TDatabaseSchema>({
11
14
  children,
12
15
  db,
13
- login = false,
14
16
  }: AuthGuardFirstUserProps<TSchema>) {
17
+ await connection();
18
+
15
19
  const allUsers = await db.select().from(users).limit(1);
16
20
  const usersExist = allUsers.length > 0;
17
21
 
18
- if (login) {
19
- if (!usersExist) redirect("/auth/create-first-user");
20
- } else {
21
- if (usersExist) redirect("/auth/login");
22
- }
22
+ if (usersExist) redirect("/auth/login");
23
23
 
24
24
  return <>{children}</>;
25
25
  }
@@ -1,4 +1,4 @@
1
- import "server-only";
1
+ import "server-cli-only";
2
2
 
3
3
  import { redirect } from "next/navigation";
4
4
  import type { PropsWithChildren } from "react";
@@ -2,15 +2,14 @@
2
2
  * Components
3
3
  */
4
4
  export * from "./components/auth-layout.server";
5
+ export * from "./components/create-first-user-guard.server";
5
6
  export * from "./components/guard.server";
6
- export * from "./components/guard-first-user.server";
7
-
7
+ export * from "./handler/proxy.server";
8
+ export * from "./handler/route.server";
8
9
  /**
9
10
  * Handlers
10
11
  */
11
- export * from "./handler/init";
12
- export * from "./handler/proxy.server";
13
- export * from "./handler/route.server";
12
+ export * from "./handler/service.server";
14
13
 
15
14
  /**
16
15
  * Lib
@@ -5,7 +5,7 @@ import { adminClient, emailOTPClient, inferAdditionalFields } from "better-auth/
5
5
  import type { AccessControl, Role } from "better-auth/plugins";
6
6
  import { createAuthClient as createBetterAuthClient } from "better-auth/react";
7
7
  import { url } from "@/lib/utils/url";
8
- import type { AuthClient } from "./init";
8
+ import type { Auth } from "./service.server";
9
9
 
10
10
  /**
11
11
  * Create auth client
@@ -39,7 +39,7 @@ export function createAuthClient<
39
39
  emailOTPClient(),
40
40
  passkeyClient(),
41
41
  adminClient({ ac, roles }),
42
- inferAdditionalFields<AuthClient>(),
42
+ inferAdditionalFields<Auth>(),
43
43
  ],
44
44
  });
45
45
  }
@@ -1,6 +1,6 @@
1
1
  import { getSessionCookie } from "better-auth/cookies";
2
2
  import { type NextRequest, NextResponse } from "next/server";
3
- import { authCookiePrefix } from "./init";
3
+ import { authCookiePrefix } from "./service.server";
4
4
 
5
5
  /**
6
6
  * Create auth proxy
@@ -1,12 +1,12 @@
1
1
  import { toNextJsHandler } from "better-auth/next-js";
2
2
  import type { NextRequest } from "next/server";
3
3
  import "server-cli-only";
4
- import type { AuthClient } from "./init";
4
+ import type { Auth } from "./service.server";
5
5
 
6
6
  /**
7
7
  * Handle the auth routes
8
8
  */
9
- export function handleAuthRoute(props: { auth: AuthClient }) {
9
+ export function handleAuthRoute(props: { auth: Auth }) {
10
10
  /**
11
11
  * GET route handler
12
12
  */
@@ -1,30 +1,36 @@
1
1
  import { passkey } from "@better-auth/passkey";
2
2
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
3
+ import { createAuthMiddleware } from "better-auth/api";
3
4
  import { betterAuth } from "better-auth/minimal";
4
- import { nextCookies } from "better-auth/next-js";
5
- import { admin, createAuthMiddleware, emailOTP } from "better-auth/plugins";
5
+ import { admin, emailOTP } from "better-auth/plugins";
6
6
  import { eq } from "drizzle-orm";
7
7
  import ForgetPasswordEmail from "@/components/emails/forget-password-email";
8
8
  import { url } from "@/lib/utils/url";
9
9
  import type { TDatabaseSchema } from "@/modules/config/entry";
10
- import type { DatabaseClient, EmailClient } from "@/modules/config/entry.server";
11
10
  import type { TulipConfig } from "@/modules/config/lib/config";
11
+ import type { Database } from "@/modules/database/lib/service.server";
12
+ import type { Email } from "@/modules/emails/lib/service.server";
12
13
  import { users } from "../entry";
13
14
  import type { createAccessControl, Role } from "../lib/permissions";
14
15
 
15
16
  export const authCookiePrefix = "tulip";
16
17
 
17
18
  type InitAuthProps<TSchema extends TDatabaseSchema> = {
18
- db: DatabaseClient<TSchema>;
19
- email: EmailClient;
19
+ db: Database<TSchema>;
20
+ email: Email;
20
21
  config: TulipConfig;
21
22
  ac: ReturnType<typeof createAccessControl>;
22
23
  roles: {
23
24
  [key in string]?: Role;
24
25
  };
26
+ allowedHosts: string[];
27
+ defaultRole?: string;
25
28
  };
26
29
 
27
- export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<TSchema>) {
30
+ /**
31
+ * Create the Better Auth server instance.
32
+ */
33
+ function createAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<TSchema>) {
28
34
  return betterAuth({
29
35
  advanced: {
30
36
  cookiePrefix: authCookiePrefix,
@@ -32,10 +38,12 @@ export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<T
32
38
  generateId: () => false,
33
39
  },
34
40
  },
41
+ baseURL: {
42
+ allowedHosts: props.allowedHosts,
43
+ },
35
44
  database: drizzleAdapter(props.db, {
36
45
  provider: "pg",
37
46
  usePlural: true,
38
- // schema: props.schema,
39
47
  }),
40
48
  emailAndPassword: {
41
49
  enabled: true,
@@ -75,12 +83,12 @@ export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<T
75
83
  }),
76
84
  },
77
85
  plugins: [
78
- nextCookies(),
79
86
  passkey(),
80
87
  admin({
81
88
  roles: props.roles,
82
89
  ac: props.ac,
83
90
  adminRoles: ["admin", "developer"],
91
+ defaultRole: props.defaultRole ?? "user",
84
92
  }),
85
93
  emailOTP({
86
94
  sendVerificationOTP: async ({ email, otp, type }) => {
@@ -108,4 +116,17 @@ export function initAuth<TSchema extends TDatabaseSchema>(props: InitAuthProps<T
108
116
  });
109
117
  }
110
118
 
111
- export type AuthClient = ReturnType<typeof initAuth>;
119
+ /**
120
+ * Better Auth instance type returned by `Auth.init()`.
121
+ */
122
+ export type Auth = ReturnType<typeof createAuth>;
123
+
124
+ /**
125
+ * Auth service namespace.
126
+ *
127
+ * @example
128
+ * const auth = Auth.init({ db, email, config, ac, roles, allowedHosts });
129
+ */
130
+ export const Auth = {
131
+ init: createAuth,
132
+ };
@@ -1,9 +0,0 @@
1
- /**
2
- * Database
3
- */
4
- export * from "./db/init";
5
-
6
- /**
7
- * Providers
8
- */
9
- export * from "./providers/email";
@@ -1,5 +1,5 @@
1
- export * from "./db/helpers";
2
- export * from "./db/types";
1
+ export * from "../database/lib/helpers";
2
+ export * from "../database/lib/types";
3
3
 
4
4
  export * from "./lib/config";
5
5
  export * from "./lib/context";
@@ -1,15 +1,15 @@
1
- import type { StorageClient } from "@/modules/storage/lib/create-client.server";
2
- import type { AuthClient } from "../../auth/handler/init";
3
- import type { DatabaseClient } from "../db/init";
4
- import type { TDatabaseSchema } from "../entry";
5
- import type { EmailClient } from "../providers/email";
1
+ import type { Auth } from "@/modules/auth/handler/service.server";
2
+ import type { Database } from "@/modules/database/lib/service.server";
3
+ import type { TDatabaseSchema } from "@/modules/database/lib/types";
4
+ import type { Email } from "@/modules/emails/lib/service.server";
5
+ import type { Storage } from "@/modules/storage/lib/service.server";
6
6
 
7
7
  export type TulipContext<TSchema extends TDatabaseSchema> = {
8
- db: DatabaseClient<TSchema>;
8
+ db: Database<TSchema>;
9
9
  schema: TSchema;
10
- auth: AuthClient;
11
- email: EmailClient;
12
- storage: StorageClient<TSchema>;
10
+ auth: Auth;
11
+ email: Email;
12
+ storage: Storage<TSchema>;
13
13
  };
14
14
 
15
15
  export function createContext<TSchema extends TDatabaseSchema>(props: TulipContext<TSchema>) {
@@ -29,3 +29,4 @@ export * from "./tables/inline-table/components/cells/drag-handle.client";
29
29
  export * from "./tables/inline-table/components/cells/read-only";
30
30
  export * from "./tables/inline-table/components/table";
31
31
  export * from "./tables/inline-table/hooks/context.client";
32
+ export * from "./tables/inline-table/hooks/use-hotkeys.client";
@@ -1,4 +1,4 @@
1
- import "server-only";
1
+ import "server-cli-only";
2
2
 
3
3
  import { and, type DBQueryConfig, getTableName, isTable, type SQL } from "drizzle-orm";
4
4
  import type { PgTable } from "drizzle-orm/pg-core";
@@ -16,7 +16,7 @@ export interface UseInfiniteStrategyInput {
16
16
 
17
17
  export type InfiniteStrategyMeta = Pick<
18
18
  UseInfiniteStrategyInput,
19
- "isFetching" | "isFetchingNextPage"
19
+ "isFetching" | "isFetchingNextPage" | "total" | "cursor" | "fetchNextPage"
20
20
  >;
21
21
 
22
22
  export function useInfiniteStrategy({
@@ -63,6 +63,9 @@ export function useInfiniteStrategy({
63
63
  manualSorting: true,
64
64
  onSortingChange: handleSortingChange({ sortingState, setQuery, resetCursor }),
65
65
  meta: {
66
+ total,
67
+ cursor,
68
+ fetchNextPage,
66
69
  isFetching,
67
70
  isFetchingNextPage,
68
71
  } satisfies InfiniteStrategyMeta,
@@ -1,12 +1,6 @@
1
1
  import type { Row, Table } from "@tanstack/react-table";
2
2
  import type * as React from "react";
3
- import {
4
- ContextCommandMenu,
5
- ContextCommandMenuContent,
6
- ContextCommandMenuTrigger,
7
- } from "@/modules/commands/menus/context-menu.client";
8
3
  import { TableRow } from "@/modules/data-tables/components/table";
9
- import type { TableMeta } from "../../../lib/types";
10
4
 
11
5
  export type DataTableRowProps<TData extends { id: string }> = React.ComponentProps<
12
6
  typeof TableRow
@@ -21,20 +15,17 @@ export function DataTableRow<TData extends { id: string }>({
21
15
  className,
22
16
  ...props
23
17
  }: DataTableRowProps<TData>) {
24
- const meta = table.options.meta as TableMeta<TData>;
18
+ return <TableRow {...props} data-state={row.getIsSelected() && "selected"} />;
19
+ }
25
20
 
26
- return (
27
- <ContextCommandMenu>
28
- <ContextCommandMenuTrigger asChild>
29
- <TableRow {...props} data-state={row.getIsSelected() && "selected"} />
30
- </ContextCommandMenuTrigger>
21
+ // <ContextCommandMenu>
22
+ // <ContextCommandMenuTrigger asChild>
23
+ // </ContextCommandMenuTrigger>
31
24
 
32
- <ContextCommandMenuContent
33
- data={row.original}
34
- commands={meta.commands || []}
35
- meta={meta as never}
36
- className="w-[300px]"
37
- />
38
- </ContextCommandMenu>
39
- );
40
- }
25
+ // <ContextCommandMenuContent
26
+ // data={row.original}
27
+ // commands={meta.commands || []}
28
+ // meta={meta as never}
29
+ // className="w-[300px]"
30
+ // />
31
+ // </ContextCommandMenu>
@@ -38,7 +38,7 @@ export function InlineTableBody<TData extends { id: string }>({ table }: { table
38
38
  }),
39
39
  );
40
40
 
41
- useInlineDataTableHotkeys();
41
+ useInlineDataTableHotkeys(context.hotkeys);
42
42
 
43
43
  if (rows?.length === 0) {
44
44
  return (
@@ -4,14 +4,8 @@ import { useSortable } from "@dnd-kit/sortable";
4
4
  import { CSS } from "@dnd-kit/utilities";
5
5
  import type { Row, Table } from "@tanstack/react-table";
6
6
  import type * as React from "react";
7
- import {
8
- ContextCommandMenu,
9
- ContextCommandMenuContent,
10
- ContextCommandMenuTrigger,
11
- } from "@/modules/commands/entry.client";
12
7
  import { TableRow } from "@/modules/data-tables/components/table";
13
8
  import { InlineEditProvider } from "@/modules/inline-edit/entry.client";
14
- import type { TableMeta } from "../../../lib/types";
15
9
 
16
10
  export type InlineTableRowProps<TData extends { id: string }> =
17
11
  React.HTMLAttributes<HTMLTableRowElement> & {
@@ -25,34 +19,34 @@ export function InlineTableRow<TData extends { id: string }>({
25
19
  children,
26
20
  ...props
27
21
  }: InlineTableRowProps<TData>) {
28
- const meta = table.options.meta as TableMeta<TData>;
29
-
30
22
  const rowId = (row.original as { id: string }).id;
31
23
 
32
24
  const { setNodeRef, transform, transition } = useSortable({ id: rowId });
33
25
 
34
26
  return (
35
- <ContextCommandMenu>
36
- <ContextCommandMenuTrigger asChild>
37
- <TableRow
38
- {...props}
39
- ref={setNodeRef}
40
- data-state={row.getIsSelected() && "selected"}
41
- style={{
42
- transform: CSS.Transform.toString(transform),
43
- transition,
44
- }}
45
- >
46
- <InlineEditProvider id={row.original.id}>{children}</InlineEditProvider>
47
- </TableRow>
48
- </ContextCommandMenuTrigger>
49
-
50
- <ContextCommandMenuContent
51
- data={row.original}
52
- commands={meta.commands || []}
53
- meta={meta as never}
54
- className="w-[300px]"
55
- />
56
- </ContextCommandMenu>
27
+ <TableRow
28
+ {...props}
29
+ ref={setNodeRef}
30
+ data-state={row.getIsSelected() && "selected"}
31
+ style={{
32
+ transform: CSS.Transform.toString(transform),
33
+ transition,
34
+ }}
35
+ >
36
+ <InlineEditProvider id={row.original.id}>{children}</InlineEditProvider>
37
+ </TableRow>
57
38
  );
58
39
  }
40
+
41
+ {
42
+ /* <ContextCommandMenu>
43
+ <ContextCommandMenuTrigger asChild></ContextCommandMenuTrigger>
44
+
45
+ <ContextCommandMenuContent
46
+ data={row.original}
47
+ commands={meta.commands || []}
48
+ meta={meta as never}
49
+ className="w-[300px]"
50
+ />
51
+ </ContextCommandMenu>; */
52
+ }
@@ -14,13 +14,18 @@ import { InlineTableHeader } from "./header";
14
14
  export function InlineTable<TData extends { id: string }>({
15
15
  disabledColumns,
16
16
  moveRowAction,
17
+ hotkeys,
17
18
  ...props
18
19
  }: ComponentProps<typeof Table> & ComponentProps<typeof InlineTableProvider>) {
19
20
  const table = useTable<TData>();
20
21
  const meta = table.options.meta as TableMeta<TData>;
21
22
 
22
23
  return (
23
- <InlineTableProvider disabledColumns={disabledColumns} moveRowAction={moveRowAction}>
24
+ <InlineTableProvider
25
+ disabledColumns={disabledColumns}
26
+ moveRowAction={moveRowAction}
27
+ hotkeys={hotkeys}
28
+ >
24
29
  <div className="space-y-4">
25
30
  <div className="rounded-md border">
26
31
  <Table {...props}>
@@ -5,6 +5,7 @@ import React, { type PropsWithChildren } from "react";
5
5
  import { arrayMove } from "@/lib/entry";
6
6
  import { useAction } from "@/lib/hooks/use-action";
7
7
  import { useTableConfigContext } from "@/modules/data-tables/entry.client";
8
+ import type { InlineDataTableHotkeysConfig } from "./use-hotkeys.client";
8
9
 
9
10
  /**
10
11
  * Move row method as meta
@@ -24,6 +25,7 @@ type MoveRowMethod =
24
25
  */
25
26
  export type InlineTableContextValue = MoveRowMethod & {
26
27
  disabledColumns?: VisibilityState;
28
+ hotkeys?: InlineDataTableHotkeysConfig;
27
29
  // setData: React.Dispatch<React.SetStateAction<TData[]>>;
28
30
  };
29
31
 
@@ -49,9 +51,11 @@ export function InlineTableProvider<TData extends { id: string }>({
49
51
  children,
50
52
  disabledColumns,
51
53
  moveRowAction,
54
+ hotkeys,
52
55
  }: PropsWithChildren<{
53
56
  disabledColumns?: VisibilityState;
54
57
  moveRowAction?: (input: { fromIndex: number; toIndex: number }) => Promise<unknown>;
58
+ hotkeys?: InlineDataTableHotkeysConfig;
55
59
  }>) {
56
60
  const { queryData, setData } = useTableConfigContext<TData>();
57
61
 
@@ -74,6 +78,7 @@ export function InlineTableProvider<TData extends { id: string }>({
74
78
  <InlineTableContext.Provider
75
79
  value={{
76
80
  disabledColumns,
81
+ hotkeys,
77
82
  ...(moveRowAction
78
83
  ? { isDraggable: true, moveRow: moveRowMutation.mutate }
79
84
  : { isDraggable: false, moveRow: undefined }),