@nextsparkjs/core 0.1.0-beta.91 → 0.1.0-beta.94

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 (341) hide show
  1. package/dist/components/dashboard/block-editor/array-field.d.ts.map +1 -1
  2. package/dist/components/dashboard/block-editor/array-field.js +55 -3
  3. package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
  4. package/dist/components/dashboard/block-editor/dynamic-form.js +82 -2
  5. package/dist/components/dashboard/navigation/DynamicNavigation.d.ts.map +1 -1
  6. package/dist/components/dashboard/navigation/DynamicNavigation.js +7 -1
  7. package/dist/components/devtools/scheduled-actions/actions-table.d.ts +1 -0
  8. package/dist/components/devtools/scheduled-actions/actions-table.d.ts.map +1 -1
  9. package/dist/components/devtools/scheduled-actions/actions-table.js +182 -46
  10. package/dist/components/devtools/scheduled-actions/types.d.ts +1 -0
  11. package/dist/components/devtools/scheduled-actions/types.d.ts.map +1 -1
  12. package/dist/components/media/MediaCard.d.ts +23 -0
  13. package/dist/components/media/MediaCard.d.ts.map +1 -0
  14. package/dist/components/media/MediaCard.js +154 -0
  15. package/dist/components/media/MediaDetailPanel.d.ts +17 -0
  16. package/dist/components/media/MediaDetailPanel.d.ts.map +1 -0
  17. package/dist/components/media/MediaDetailPanel.js +331 -0
  18. package/dist/components/media/MediaGrid.d.ts +26 -0
  19. package/dist/components/media/MediaGrid.d.ts.map +1 -0
  20. package/dist/components/media/MediaGrid.js +77 -0
  21. package/dist/components/media/MediaLibrary.d.ts +20 -0
  22. package/dist/components/media/MediaLibrary.d.ts.map +1 -0
  23. package/dist/components/media/MediaLibrary.js +229 -0
  24. package/dist/components/media/MediaList.d.ts +24 -0
  25. package/dist/components/media/MediaList.d.ts.map +1 -0
  26. package/dist/components/media/MediaList.js +181 -0
  27. package/dist/components/media/MediaSelector.d.ts +19 -0
  28. package/dist/components/media/MediaSelector.d.ts.map +1 -0
  29. package/dist/components/media/MediaSelector.js +145 -0
  30. package/dist/components/media/MediaTagFilter.d.ts +16 -0
  31. package/dist/components/media/MediaTagFilter.d.ts.map +1 -0
  32. package/dist/components/media/MediaTagFilter.js +122 -0
  33. package/dist/components/media/MediaToolbar.d.ts +25 -0
  34. package/dist/components/media/MediaToolbar.d.ts.map +1 -0
  35. package/dist/components/media/MediaToolbar.js +136 -0
  36. package/dist/components/media/MediaUploadZone.d.ts +19 -0
  37. package/dist/components/media/MediaUploadZone.d.ts.map +1 -0
  38. package/dist/components/media/MediaUploadZone.js +248 -0
  39. package/dist/components/media/index.d.ts +15 -0
  40. package/dist/components/media/index.d.ts.map +1 -0
  41. package/dist/components/media/index.js +20 -0
  42. package/dist/contexts/TeamContext.js +1 -1
  43. package/dist/hooks/index.d.ts +2 -0
  44. package/dist/hooks/index.d.ts.map +1 -1
  45. package/dist/hooks/index.js +2 -0
  46. package/dist/hooks/useEnsureUserMetadata.d.ts +4 -0
  47. package/dist/hooks/useEnsureUserMetadata.d.ts.map +1 -1
  48. package/dist/hooks/useEnsureUserMetadata.js +85 -60
  49. package/dist/hooks/useEntityMutations.d.ts.map +1 -1
  50. package/dist/hooks/useEntityMutations.js +5 -9
  51. package/dist/hooks/useMedia.d.ts +56 -0
  52. package/dist/hooks/useMedia.d.ts.map +1 -0
  53. package/dist/hooks/useMedia.js +181 -0
  54. package/dist/hooks/useMediaUpload.d.ts +27 -0
  55. package/dist/hooks/useMediaUpload.d.ts.map +1 -0
  56. package/dist/hooks/useMediaUpload.js +36 -0
  57. package/dist/hooks/useUserSettings.d.ts +5 -4
  58. package/dist/hooks/useUserSettings.d.ts.map +1 -1
  59. package/dist/hooks/useUserSettings.js +42 -40
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +2 -3
  63. package/dist/lib/api/auth/dual-auth.d.ts +6 -2
  64. package/dist/lib/api/auth/dual-auth.d.ts.map +1 -1
  65. package/dist/lib/api/auth/dual-auth.js +5 -9
  66. package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
  67. package/dist/lib/api/entity/generic-handler.js +3 -3
  68. package/dist/lib/config/app.config.d.ts.map +1 -1
  69. package/dist/lib/config/app.config.js +37 -0
  70. package/dist/lib/config/config-sync.d.ts +1 -0
  71. package/dist/lib/config/config-sync.d.ts.map +1 -1
  72. package/dist/lib/config/config-sync.js +2 -0
  73. package/dist/lib/config/types.d.ts +29 -0
  74. package/dist/lib/config/types.d.ts.map +1 -1
  75. package/dist/lib/media/schemas.d.ts +39 -0
  76. package/dist/lib/media/schemas.d.ts.map +1 -0
  77. package/dist/lib/media/schemas.js +32 -0
  78. package/dist/lib/media/types.d.ts +69 -0
  79. package/dist/lib/media/types.d.ts.map +1 -0
  80. package/dist/lib/media/types.js +0 -0
  81. package/dist/lib/media/utils.d.ts +26 -0
  82. package/dist/lib/media/utils.d.ts.map +1 -0
  83. package/dist/lib/media/utils.js +33 -0
  84. package/dist/lib/rate-limit-redis.d.ts.map +1 -1
  85. package/dist/lib/rate-limit-redis.js +13 -4
  86. package/dist/lib/scheduled-actions/initializer.d.ts +6 -3
  87. package/dist/lib/scheduled-actions/initializer.d.ts.map +1 -1
  88. package/dist/lib/scheduled-actions/initializer.js +11 -6
  89. package/dist/lib/scheduled-actions/processor.d.ts +20 -4
  90. package/dist/lib/scheduled-actions/processor.d.ts.map +1 -1
  91. package/dist/lib/scheduled-actions/processor.js +128 -34
  92. package/dist/lib/scheduled-actions/registry.d.ts +3 -0
  93. package/dist/lib/scheduled-actions/registry.d.ts.map +1 -1
  94. package/dist/lib/scheduled-actions/registry.js +2 -1
  95. package/dist/lib/scheduled-actions/scheduler.d.ts +1 -1
  96. package/dist/lib/scheduled-actions/scheduler.d.ts.map +1 -1
  97. package/dist/lib/scheduled-actions/scheduler.js +76 -38
  98. package/dist/lib/scheduled-actions/types.d.ts +73 -0
  99. package/dist/lib/scheduled-actions/types.d.ts.map +1 -1
  100. package/dist/lib/selectors/core-selectors.d.ts +102 -0
  101. package/dist/lib/selectors/core-selectors.d.ts.map +1 -1
  102. package/dist/lib/selectors/core-selectors.js +3 -1
  103. package/dist/lib/selectors/domains/block-editor.selectors.d.ts +8 -0
  104. package/dist/lib/selectors/domains/block-editor.selectors.d.ts.map +1 -1
  105. package/dist/lib/selectors/domains/block-editor.selectors.js +9 -0
  106. package/dist/lib/selectors/domains/devtools.selectors.d.ts +6 -0
  107. package/dist/lib/selectors/domains/devtools.selectors.d.ts.map +1 -1
  108. package/dist/lib/selectors/domains/devtools.selectors.js +6 -0
  109. package/dist/lib/selectors/domains/index.d.ts +1 -0
  110. package/dist/lib/selectors/domains/index.d.ts.map +1 -1
  111. package/dist/lib/selectors/domains/index.js +2 -0
  112. package/dist/lib/selectors/domains/media.selectors.d.ts +96 -0
  113. package/dist/lib/selectors/domains/media.selectors.d.ts.map +1 -0
  114. package/dist/lib/selectors/domains/media.selectors.js +103 -0
  115. package/dist/lib/selectors/selectors.d.ts +204 -0
  116. package/dist/lib/selectors/selectors.d.ts.map +1 -1
  117. package/dist/lib/services/index.d.ts +2 -0
  118. package/dist/lib/services/index.d.ts.map +1 -1
  119. package/dist/lib/services/index.js +2 -0
  120. package/dist/lib/services/media.service.d.ts +158 -0
  121. package/dist/lib/services/media.service.d.ts.map +1 -0
  122. package/dist/lib/services/media.service.js +410 -0
  123. package/dist/messages/de/devtools.json +16 -0
  124. package/dist/messages/de/index.d.ts +16 -0
  125. package/dist/messages/de/index.d.ts.map +1 -1
  126. package/dist/messages/en/admin.json +4 -1
  127. package/dist/messages/en/devtools.json +16 -0
  128. package/dist/messages/en/index.d.ts +167 -0
  129. package/dist/messages/en/index.d.ts.map +1 -1
  130. package/dist/messages/en/index.js +2 -0
  131. package/dist/messages/en/index.ts +2 -0
  132. package/dist/messages/en/media.json +147 -0
  133. package/dist/messages/en/navigation.json +1 -0
  134. package/dist/messages/es/admin.json +4 -1
  135. package/dist/messages/es/devtools.json +16 -0
  136. package/dist/messages/es/index.d.ts +167 -0
  137. package/dist/messages/es/index.d.ts.map +1 -1
  138. package/dist/messages/es/index.js +2 -0
  139. package/dist/messages/es/index.ts +2 -0
  140. package/dist/messages/es/media.json +147 -0
  141. package/dist/messages/es/navigation.json +1 -0
  142. package/dist/messages/fr/devtools.json +16 -0
  143. package/dist/messages/fr/index.d.ts +16 -0
  144. package/dist/messages/fr/index.d.ts.map +1 -1
  145. package/dist/messages/it/devtools.json +16 -0
  146. package/dist/messages/it/index.d.ts +16 -0
  147. package/dist/messages/it/index.d.ts.map +1 -1
  148. package/dist/messages/pt/devtools.json +16 -0
  149. package/dist/messages/pt/index.d.ts +16 -0
  150. package/dist/messages/pt/index.d.ts.map +1 -1
  151. package/dist/migrations/017_scheduled_actions_table.sql +21 -0
  152. package/dist/migrations/021_media.sql +154 -0
  153. package/dist/migrations/090_sample_data.sql +53 -0
  154. package/dist/styles/classes.json +36 -3
  155. package/dist/styles/ui.css +1 -1
  156. package/dist/templates/app/api/devtools/config/entities/route.ts +18 -11
  157. package/dist/templates/app/api/devtools/config/theme/route.ts +5 -4
  158. package/dist/templates/app/api/devtools/tests/[...path]/route.ts +6 -5
  159. package/dist/templates/app/api/devtools/tests/route.ts +5 -4
  160. package/dist/templates/app/api/health/route.ts +6 -4
  161. package/dist/templates/app/api/internal/user-metadata/route.ts +3 -2
  162. package/dist/templates/app/api/superadmin/subscriptions/route.ts +5 -6
  163. package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +6 -7
  164. package/dist/templates/app/api/superadmin/teams/route.ts +5 -6
  165. package/dist/templates/app/api/superadmin/users/[userId]/route.ts +11 -16
  166. package/dist/templates/app/api/superadmin/users/route.ts +9 -10
  167. package/dist/templates/app/api/user/delete-account/route.ts +3 -2
  168. package/dist/templates/app/api/user/plan-flags/route.ts +11 -24
  169. package/dist/templates/app/api/user/profile/route.ts +7 -6
  170. package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +16 -18
  171. package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +17 -19
  172. package/dist/templates/app/api/v1/[entity]/[id]/route.ts +10 -12
  173. package/dist/templates/app/api/v1/[entity]/route.ts +9 -11
  174. package/dist/templates/app/api/v1/api-keys/[id]/route.ts +9 -8
  175. package/dist/templates/app/api/v1/api-keys/route.ts +7 -6
  176. package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +3 -2
  177. package/dist/templates/app/api/v1/billing/cancel/route.ts +15 -14
  178. package/dist/templates/app/api/v1/billing/change-plan/route.ts +10 -9
  179. package/dist/templates/app/api/v1/billing/check-action/route.ts +8 -7
  180. package/dist/templates/app/api/v1/billing/checkout/route.ts +10 -9
  181. package/dist/templates/app/api/v1/billing/plans/route.ts +5 -4
  182. package/dist/templates/app/api/v1/billing/portal/route.ts +9 -8
  183. package/dist/templates/app/api/v1/blocks/[slug]/route.ts +4 -3
  184. package/dist/templates/app/api/v1/blocks/route.ts +3 -2
  185. package/dist/templates/app/api/v1/blocks/validate/route.ts +5 -3
  186. package/dist/templates/app/api/v1/cron/process/route.ts +4 -6
  187. package/dist/templates/app/api/v1/devtools/blocks/route.ts +3 -2
  188. package/dist/templates/app/api/v1/devtools/docs/route.ts +3 -2
  189. package/dist/templates/app/api/v1/devtools/features/route.ts +3 -2
  190. package/dist/templates/app/api/v1/devtools/flows/route.ts +3 -2
  191. package/dist/templates/app/api/v1/devtools/scheduled-actions/route.ts +125 -3
  192. package/dist/templates/app/api/v1/devtools/scheduled-actions/run/route.ts +110 -0
  193. package/dist/templates/app/api/v1/devtools/testing/route.ts +3 -2
  194. package/dist/templates/app/api/v1/media/[id]/route.ts +144 -0
  195. package/dist/templates/app/api/v1/media/[id]/tags/route.ts +154 -0
  196. package/dist/templates/app/api/v1/media/check-duplicates/route.ts +56 -0
  197. package/dist/templates/app/api/v1/media/route.ts +56 -0
  198. package/dist/templates/app/api/v1/media/upload/route.ts +157 -33
  199. package/dist/templates/app/api/v1/media-tags/route.ts +65 -0
  200. package/dist/templates/app/api/v1/plugin/[...path]/route.ts +16 -15
  201. package/dist/templates/app/api/v1/plugin/route.ts +3 -2
  202. package/dist/templates/app/api/v1/post-categories/[id]/route.ts +10 -9
  203. package/dist/templates/app/api/v1/post-categories/route.ts +5 -4
  204. package/dist/templates/app/api/v1/team-invitations/[token]/accept/route.ts +3 -3
  205. package/dist/templates/app/api/v1/team-invitations/[token]/decline/route.ts +3 -3
  206. package/dist/templates/app/api/v1/team-invitations/[token]/route.ts +3 -2
  207. package/dist/templates/app/api/v1/team-invitations/route.ts +3 -2
  208. package/dist/templates/app/api/v1/teams/[teamId]/invitations/route.ts +5 -4
  209. package/dist/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +3 -2
  210. package/dist/templates/app/api/v1/teams/[teamId]/invoices/route.ts +3 -2
  211. package/dist/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +5 -4
  212. package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +5 -5
  213. package/dist/templates/app/api/v1/teams/[teamId]/route.ts +31 -58
  214. package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +3 -2
  215. package/dist/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +5 -4
  216. package/dist/templates/app/api/v1/teams/route.ts +18 -17
  217. package/dist/templates/app/api/v1/teams/switch/route.ts +3 -2
  218. package/dist/templates/app/api/v1/theme/[...path]/route.ts +16 -15
  219. package/dist/templates/app/api/v1/theme/route.ts +3 -2
  220. package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +7 -6
  221. package/dist/templates/app/api/v1/users/[id]/route.ts +9 -8
  222. package/dist/templates/app/api/v1/users/route.ts +7 -6
  223. package/dist/templates/app/dashboard/(main)/media/page.tsx +607 -0
  224. package/dist/templates/contents/themes/starter/messages/de/dev.json +106 -0
  225. package/dist/templates/contents/themes/starter/messages/de/index.ts +2 -0
  226. package/dist/templates/contents/themes/starter/messages/en/dev.json +106 -0
  227. package/dist/templates/contents/themes/starter/messages/en/index.ts +2 -0
  228. package/dist/templates/contents/themes/starter/messages/es/dev.json +106 -0
  229. package/dist/templates/contents/themes/starter/messages/es/index.ts +2 -0
  230. package/dist/templates/contents/themes/starter/messages/fr/dev.json +106 -0
  231. package/dist/templates/contents/themes/starter/messages/fr/index.ts +2 -0
  232. package/dist/templates/contents/themes/starter/messages/it/dev.json +106 -0
  233. package/dist/templates/contents/themes/starter/messages/it/index.ts +2 -0
  234. package/dist/templates/contents/themes/starter/messages/pt/dev.json +106 -0
  235. package/dist/templates/contents/themes/starter/messages/pt/index.ts +2 -0
  236. package/dist/templates/contents/themes/starter/styles/globals.css +14 -0
  237. package/dist/templates/instrumentation.ts +33 -0
  238. package/dist/types/blocks.d.ts +1 -1
  239. package/dist/types/blocks.d.ts.map +1 -1
  240. package/migrations/017_scheduled_actions_table.sql +21 -0
  241. package/migrations/021_media.sql +154 -0
  242. package/migrations/090_sample_data.sql +53 -0
  243. package/package.json +3 -2
  244. package/scripts/build/registry/config.mjs +41 -0
  245. package/scripts/build/registry/discovery/templates.mjs +0 -1
  246. package/scripts/build/registry/generators/entity-registry.mjs +16 -6
  247. package/scripts/build/registry/generators/route-handlers.mjs +8 -2
  248. package/scripts/build/registry/generators/template-registry.mjs +16 -4
  249. package/scripts/build/registry/post-build/route-cleanup.mjs +0 -1
  250. package/scripts/build/registry/validate-env.test.mjs +92 -0
  251. package/scripts/build/registry.mjs +18 -1
  252. package/scripts/deploy/vercel-deploy.mjs +1 -1
  253. package/templates/app/api/devtools/config/entities/route.ts +18 -11
  254. package/templates/app/api/devtools/config/theme/route.ts +5 -4
  255. package/templates/app/api/devtools/tests/[...path]/route.ts +6 -5
  256. package/templates/app/api/devtools/tests/route.ts +5 -4
  257. package/templates/app/api/health/route.ts +6 -4
  258. package/templates/app/api/internal/user-metadata/route.ts +3 -2
  259. package/templates/app/api/superadmin/subscriptions/route.ts +5 -6
  260. package/templates/app/api/superadmin/teams/[teamId]/route.ts +6 -7
  261. package/templates/app/api/superadmin/teams/route.ts +5 -6
  262. package/templates/app/api/superadmin/users/[userId]/route.ts +11 -16
  263. package/templates/app/api/superadmin/users/route.ts +9 -10
  264. package/templates/app/api/user/delete-account/route.ts +3 -2
  265. package/templates/app/api/user/plan-flags/route.ts +11 -24
  266. package/templates/app/api/user/profile/route.ts +7 -6
  267. package/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +16 -18
  268. package/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +17 -19
  269. package/templates/app/api/v1/[entity]/[id]/route.ts +10 -12
  270. package/templates/app/api/v1/[entity]/route.ts +9 -11
  271. package/templates/app/api/v1/api-keys/[id]/route.ts +9 -8
  272. package/templates/app/api/v1/api-keys/route.ts +7 -6
  273. package/templates/app/api/v1/auth/signup-with-invite/route.ts +3 -2
  274. package/templates/app/api/v1/billing/cancel/route.ts +15 -14
  275. package/templates/app/api/v1/billing/change-plan/route.ts +10 -9
  276. package/templates/app/api/v1/billing/check-action/route.ts +8 -7
  277. package/templates/app/api/v1/billing/checkout/route.ts +10 -9
  278. package/templates/app/api/v1/billing/plans/route.ts +5 -4
  279. package/templates/app/api/v1/billing/portal/route.ts +9 -8
  280. package/templates/app/api/v1/blocks/[slug]/route.ts +4 -3
  281. package/templates/app/api/v1/blocks/route.ts +3 -2
  282. package/templates/app/api/v1/blocks/validate/route.ts +5 -3
  283. package/templates/app/api/v1/cron/process/route.ts +4 -6
  284. package/templates/app/api/v1/devtools/blocks/route.ts +3 -2
  285. package/templates/app/api/v1/devtools/docs/route.ts +3 -2
  286. package/templates/app/api/v1/devtools/features/route.ts +3 -2
  287. package/templates/app/api/v1/devtools/flows/route.ts +3 -2
  288. package/templates/app/api/v1/devtools/scheduled-actions/route.ts +125 -3
  289. package/templates/app/api/v1/devtools/scheduled-actions/run/route.ts +110 -0
  290. package/templates/app/api/v1/devtools/testing/route.ts +3 -2
  291. package/templates/app/api/v1/media/[id]/route.ts +144 -0
  292. package/templates/app/api/v1/media/[id]/tags/route.ts +154 -0
  293. package/templates/app/api/v1/media/check-duplicates/route.ts +56 -0
  294. package/templates/app/api/v1/media/route.ts +56 -0
  295. package/templates/app/api/v1/media/upload/route.ts +157 -33
  296. package/templates/app/api/v1/media-tags/route.ts +65 -0
  297. package/templates/app/api/v1/plugin/[...path]/route.ts +16 -15
  298. package/templates/app/api/v1/plugin/route.ts +3 -2
  299. package/templates/app/api/v1/post-categories/[id]/route.ts +10 -9
  300. package/templates/app/api/v1/post-categories/route.ts +5 -4
  301. package/templates/app/api/v1/team-invitations/[token]/accept/route.ts +3 -3
  302. package/templates/app/api/v1/team-invitations/[token]/decline/route.ts +3 -3
  303. package/templates/app/api/v1/team-invitations/[token]/route.ts +3 -2
  304. package/templates/app/api/v1/team-invitations/route.ts +3 -2
  305. package/templates/app/api/v1/teams/[teamId]/invitations/route.ts +5 -4
  306. package/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +3 -2
  307. package/templates/app/api/v1/teams/[teamId]/invoices/route.ts +3 -2
  308. package/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +5 -4
  309. package/templates/app/api/v1/teams/[teamId]/members/route.ts +5 -5
  310. package/templates/app/api/v1/teams/[teamId]/route.ts +31 -58
  311. package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +3 -2
  312. package/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +5 -4
  313. package/templates/app/api/v1/teams/route.ts +18 -17
  314. package/templates/app/api/v1/teams/switch/route.ts +3 -2
  315. package/templates/app/api/v1/theme/[...path]/route.ts +16 -15
  316. package/templates/app/api/v1/theme/route.ts +3 -2
  317. package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +7 -6
  318. package/templates/app/api/v1/users/[id]/route.ts +9 -8
  319. package/templates/app/api/v1/users/route.ts +7 -6
  320. package/templates/app/dashboard/(main)/media/page.tsx +607 -0
  321. package/templates/contents/themes/starter/messages/de/dev.json +106 -0
  322. package/templates/contents/themes/starter/messages/de/index.ts +2 -0
  323. package/templates/contents/themes/starter/messages/en/dev.json +106 -0
  324. package/templates/contents/themes/starter/messages/en/index.ts +2 -0
  325. package/templates/contents/themes/starter/messages/es/dev.json +106 -0
  326. package/templates/contents/themes/starter/messages/es/index.ts +2 -0
  327. package/templates/contents/themes/starter/messages/fr/dev.json +106 -0
  328. package/templates/contents/themes/starter/messages/fr/index.ts +2 -0
  329. package/templates/contents/themes/starter/messages/it/dev.json +106 -0
  330. package/templates/contents/themes/starter/messages/it/index.ts +2 -0
  331. package/templates/contents/themes/starter/messages/pt/dev.json +106 -0
  332. package/templates/contents/themes/starter/messages/pt/index.ts +2 -0
  333. package/templates/contents/themes/starter/styles/globals.css +14 -0
  334. package/templates/instrumentation.ts +33 -0
  335. package/dist/presets/plugin/.env.example.template +0 -19
  336. package/dist/presets/plugin/entities/.gitkeep +0 -18
  337. package/dist/presets/theme/blocks/.gitkeep +0 -17
  338. package/dist/presets/theme/public/brand/.gitkeep +0 -8
  339. package/dist/presets/theme/tests/cypress/.gitkeep +0 -10
  340. package/dist/templates/contents/plugins/starter/plugin/.env.example.template +0 -19
  341. package/templates/contents/plugins/starter/plugin/.env.example.template +0 -19
@@ -0,0 +1,154 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { memo, useCallback } from "react";
4
+ import { useTranslations } from "next-intl";
5
+ import { VideoIcon, FileIcon, MoreVerticalIcon, Edit2Icon, Trash2Icon } from "lucide-react";
6
+ import { Card, CardContent } from "../ui/card.js";
7
+ import { Button } from "../ui/button.js";
8
+ import { Checkbox } from "../ui/checkbox.js";
9
+ import {
10
+ DropdownMenu,
11
+ DropdownMenuContent,
12
+ DropdownMenuItem,
13
+ DropdownMenuTrigger
14
+ } from "../ui/dropdown-menu.js";
15
+ import { cn } from "../../lib/utils/index.js";
16
+ import { sel } from "../../lib/selectors/index.js";
17
+ const MediaCard = memo(function MediaCard2({
18
+ media,
19
+ isSelected,
20
+ onSelect,
21
+ onEdit,
22
+ onDelete,
23
+ mode = "single"
24
+ }) {
25
+ const t = useTranslations("media");
26
+ const isImage = media.mimeType.startsWith("image/");
27
+ const isVideo = media.mimeType.startsWith("video/");
28
+ const handleCardClick = useCallback((e) => {
29
+ if (e.shiftKey && mode === "multiple") {
30
+ onSelect(media, { shiftKey: true });
31
+ } else if (onEdit) {
32
+ onEdit(media);
33
+ } else {
34
+ onSelect(media);
35
+ }
36
+ }, [media, onSelect, onEdit, mode]);
37
+ const handleCheckboxClick = useCallback((e) => {
38
+ e.stopPropagation();
39
+ onSelect(media, { shiftKey: e.shiftKey });
40
+ }, [media, onSelect]);
41
+ const handleMenuClick = useCallback((e) => {
42
+ e.stopPropagation();
43
+ }, []);
44
+ const handleEditClick = useCallback((e) => {
45
+ e.stopPropagation();
46
+ onEdit == null ? void 0 : onEdit(media);
47
+ }, [media, onEdit]);
48
+ const handleDeleteClick = useCallback((e) => {
49
+ e.stopPropagation();
50
+ onDelete == null ? void 0 : onDelete(media);
51
+ }, [media, onDelete]);
52
+ return /* @__PURE__ */ jsx(
53
+ Card,
54
+ {
55
+ "data-cy": sel("media.grid.item", { id: media.id }),
56
+ className: cn(
57
+ "group relative overflow-hidden transition-shadow cursor-pointer hover:shadow-md select-none",
58
+ "[content-visibility:auto] [contain-intrinsic-size:auto_200px]",
59
+ isSelected && "ring-2 ring-primary ring-offset-2 ring-offset-background"
60
+ ),
61
+ onClick: handleCardClick,
62
+ children: /* @__PURE__ */ jsxs(CardContent, { className: "p-0", children: [
63
+ /* @__PURE__ */ jsxs("div", { className: "aspect-square relative bg-muted flex items-center justify-center overflow-hidden", children: [
64
+ isImage ? /* @__PURE__ */ jsx(
65
+ "img",
66
+ {
67
+ "data-cy": sel("media.grid.thumbnail", { id: media.id }),
68
+ src: media.url,
69
+ alt: media.alt || media.filename,
70
+ className: "w-full h-full object-cover",
71
+ loading: "lazy",
72
+ decoding: "async"
73
+ }
74
+ ) : isVideo ? /* @__PURE__ */ jsx(VideoIcon, { className: "w-12 h-12 text-muted-foreground" }) : /* @__PURE__ */ jsx(FileIcon, { className: "w-12 h-12 text-muted-foreground" }),
75
+ isSelected && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-primary/10 z-[1] pointer-events-none" }),
76
+ mode === "multiple" && /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ className: cn(
80
+ "absolute top-2 left-2 z-10 transition-all duration-150",
81
+ isSelected ? "opacity-100 scale-100" : "opacity-0 scale-90 group-hover:opacity-100 group-hover:scale-100"
82
+ ),
83
+ onClick: handleCheckboxClick,
84
+ children: /* @__PURE__ */ jsx(
85
+ Checkbox,
86
+ {
87
+ "data-cy": sel("media.grid.checkbox", { id: media.id }),
88
+ checked: isSelected,
89
+ "aria-label": `${t("actions.select")} ${media.filename}`,
90
+ className: cn(
91
+ "h-5 w-5 rounded-md shadow-md border-2 transition-colors pointer-events-none",
92
+ isSelected ? "bg-primary border-primary text-primary-foreground" : "bg-white/90 border-white/60 backdrop-blur-sm"
93
+ )
94
+ }
95
+ )
96
+ }
97
+ ),
98
+ (onEdit || onDelete) && /* @__PURE__ */ jsx(
99
+ "div",
100
+ {
101
+ className: "absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity",
102
+ onClick: handleMenuClick,
103
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
104
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
105
+ Button,
106
+ {
107
+ "data-cy": sel("media.grid.menuBtn", { id: media.id }),
108
+ variant: "secondary",
109
+ size: "icon",
110
+ className: "h-8 w-8",
111
+ "aria-label": t("list.actions"),
112
+ children: /* @__PURE__ */ jsx(MoreVerticalIcon, { className: "h-4 w-4" })
113
+ }
114
+ ) }),
115
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
116
+ onEdit && /* @__PURE__ */ jsxs(
117
+ DropdownMenuItem,
118
+ {
119
+ "data-cy": sel("media.grid.menuEdit", { id: media.id }),
120
+ onClick: handleEditClick,
121
+ children: [
122
+ /* @__PURE__ */ jsx(Edit2Icon, { className: "mr-2 h-4 w-4" }),
123
+ t("actions.edit")
124
+ ]
125
+ }
126
+ ),
127
+ onDelete && /* @__PURE__ */ jsxs(
128
+ DropdownMenuItem,
129
+ {
130
+ "data-cy": sel("media.grid.menuDelete", { id: media.id }),
131
+ onClick: handleDeleteClick,
132
+ className: "text-destructive focus:text-destructive",
133
+ children: [
134
+ /* @__PURE__ */ jsx(Trash2Icon, { className: "mr-2 h-4 w-4" }),
135
+ t("actions.delete")
136
+ ]
137
+ }
138
+ )
139
+ ] })
140
+ ] })
141
+ }
142
+ )
143
+ ] }),
144
+ /* @__PURE__ */ jsxs("div", { className: "p-2", children: [
145
+ /* @__PURE__ */ jsx("p", { className: "text-sm truncate", title: media.title || media.filename, children: media.title || media.filename }),
146
+ media.width && media.height && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("grid.dimensions", { width: media.width, height: media.height }) })
147
+ ] })
148
+ ] })
149
+ }
150
+ );
151
+ });
152
+ export {
153
+ MediaCard
154
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * MediaDetailPanel Component
3
+ *
4
+ * Panel for editing media metadata (alt text, caption, tags).
5
+ * Shows file info in a compact grid and provides a polished editing experience.
6
+ * Used inside the media detail dialog (showPreview=false) or standalone.
7
+ */
8
+ import type { Media } from '../../lib/media/types';
9
+ interface MediaDetailPanelProps {
10
+ media: Media | null;
11
+ onClose?: () => void;
12
+ showPreview?: boolean;
13
+ className?: string;
14
+ }
15
+ export declare function MediaDetailPanel({ media, onClose, showPreview, className }: MediaDetailPanelProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=MediaDetailPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaDetailPanel.d.ts","sourceRoot":"","sources":["../../../src/components/media/MediaDetailPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,OAAO,KAAK,EAAE,KAAK,EAAY,MAAM,uBAAuB,CAAA;AAE5D,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAkB,EAAE,SAAS,EAAE,EAAE,qBAAqB,2CA6UxG"}
@@ -0,0 +1,331 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState, useEffect } from "react";
4
+ import { useTranslations } from "next-intl";
5
+ import { ImageIcon, LoaderIcon, TagIcon, XIcon, PlusIcon, CopyIcon, CheckIcon, CalendarIcon } from "lucide-react";
6
+ import { Button } from "../ui/button.js";
7
+ import { Badge } from "../ui/badge.js";
8
+ import { Input } from "../ui/input.js";
9
+ import { Label } from "../ui/label.js";
10
+ import { Textarea } from "../ui/textarea.js";
11
+ import {
12
+ Popover,
13
+ PopoverContent,
14
+ PopoverTrigger
15
+ } from "../ui/popover.js";
16
+ import { cn } from "../../lib/utils/index.js";
17
+ import { sel } from "../../lib/selectors/index.js";
18
+ import { useUpdateMedia, useMediaTags, useMediaItemTags, useAddMediaTag, useRemoveMediaTag, useCreateMediaTag } from "../../hooks/useMedia.js";
19
+ import { useToast } from "../../hooks/useToast.js";
20
+ function formatFileSize(bytes) {
21
+ if (bytes < 1024) return `${bytes} B`;
22
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
23
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
24
+ }
25
+ function MediaDetailPanel({ media, onClose, showPreview = true, className }) {
26
+ var _a;
27
+ const t = useTranslations("media");
28
+ const { toast } = useToast();
29
+ const updateMutation = useUpdateMedia();
30
+ const addTagMutation = useAddMediaTag();
31
+ const removeTagMutation = useRemoveMediaTag();
32
+ const createTagMutation = useCreateMediaTag();
33
+ const { data: allTags = [] } = useMediaTags();
34
+ const { data: mediaTags = [] } = useMediaItemTags((media == null ? void 0 : media.id) || null);
35
+ const [tagPopoverOpen, setTagPopoverOpen] = useState(false);
36
+ const [newTagName, setNewTagName] = useState("");
37
+ const [title, setTitle] = useState((media == null ? void 0 : media.title) || "");
38
+ const [alt, setAlt] = useState((media == null ? void 0 : media.alt) || "");
39
+ const [caption, setCaption] = useState((media == null ? void 0 : media.caption) || "");
40
+ const [urlCopied, setUrlCopied] = useState(false);
41
+ useEffect(() => {
42
+ if (media) {
43
+ setTitle(media.title || "");
44
+ setAlt(media.alt || "");
45
+ setCaption(media.caption || "");
46
+ }
47
+ }, [media]);
48
+ if (!media) return null;
49
+ const isImage = media.mimeType.startsWith("image/");
50
+ const hasChanges = title !== (media.title || "") || alt !== (media.alt || "") || caption !== (media.caption || "");
51
+ const handleSave = async () => {
52
+ try {
53
+ await updateMutation.mutateAsync({
54
+ id: media.id,
55
+ data: {
56
+ title: title || null,
57
+ alt: alt || null,
58
+ caption: caption || null
59
+ }
60
+ });
61
+ toast({
62
+ title: t("detail.saved")
63
+ });
64
+ onClose == null ? void 0 : onClose();
65
+ } catch (error) {
66
+ toast({
67
+ title: t("upload.error"),
68
+ description: error instanceof Error ? error.message : t("upload.error"),
69
+ variant: "destructive"
70
+ });
71
+ }
72
+ };
73
+ const handleCancel = () => {
74
+ setTitle(media.title || "");
75
+ setAlt(media.alt || "");
76
+ setCaption(media.caption || "");
77
+ onClose == null ? void 0 : onClose();
78
+ };
79
+ const handleCopyUrl = async () => {
80
+ try {
81
+ await navigator.clipboard.writeText(media.url);
82
+ setUrlCopied(true);
83
+ setTimeout(() => setUrlCopied(false), 2e3);
84
+ } catch {
85
+ }
86
+ };
87
+ const mimeShort = ((_a = media.mimeType.split("/")[1]) == null ? void 0 : _a.toUpperCase()) || media.mimeType;
88
+ return /* @__PURE__ */ jsxs(
89
+ "div",
90
+ {
91
+ "data-cy": sel("media.detail.panel"),
92
+ className: cn("flex flex-col", className),
93
+ children: [
94
+ showPreview && /* @__PURE__ */ jsx("div", { className: "aspect-video w-full bg-neutral-950 rounded-lg overflow-hidden flex items-center justify-center mb-4", children: isImage ? /* @__PURE__ */ jsx(
95
+ "img",
96
+ {
97
+ src: media.url,
98
+ alt: media.alt || media.filename,
99
+ className: "w-full h-full object-contain"
100
+ }
101
+ ) : /* @__PURE__ */ jsx(ImageIcon, { className: "h-16 w-16 text-neutral-600" }) }),
102
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto min-h-0", children: [
103
+ /* @__PURE__ */ jsxs("div", { className: "px-5 py-2.5 bg-muted/30", children: [
104
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
105
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground truncate", title: media.filename, children: media.filename }),
106
+ /* @__PURE__ */ jsx("span", { className: "shrink-0", children: mimeShort }),
107
+ /* @__PURE__ */ jsx("span", { className: "shrink-0", children: formatFileSize(media.fileSize) }),
108
+ media.width && media.height && /* @__PURE__ */ jsxs("span", { className: "shrink-0", children: [
109
+ media.width,
110
+ "\xD7",
111
+ media.height
112
+ ] }),
113
+ /* @__PURE__ */ jsxs("span", { className: "shrink-0 flex items-center gap-1", children: [
114
+ /* @__PURE__ */ jsx(CalendarIcon, { className: "h-3 w-3" }),
115
+ new Date(media.createdAt).toLocaleString(void 0, {
116
+ year: "numeric",
117
+ month: "short",
118
+ day: "numeric",
119
+ hour: "2-digit",
120
+ minute: "2-digit"
121
+ })
122
+ ] })
123
+ ] }),
124
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mt-1.5", children: [
125
+ /* @__PURE__ */ jsx("code", { className: "text-[11px] text-muted-foreground bg-muted/50 px-1.5 py-0.5 rounded truncate flex-1", title: media.url, children: media.url }),
126
+ /* @__PURE__ */ jsx(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ className: "shrink-0 p-1 rounded-md hover:bg-muted transition-colors",
131
+ onClick: handleCopyUrl,
132
+ "aria-label": t("detail.info.url"),
133
+ children: urlCopied ? /* @__PURE__ */ jsx(CheckIcon, { className: "h-3.5 w-3.5 text-green-600" }) : /* @__PURE__ */ jsx(CopyIcon, { className: "h-3.5 w-3.5 text-muted-foreground" })
134
+ }
135
+ )
136
+ ] })
137
+ ] }),
138
+ /* @__PURE__ */ jsxs("div", { className: "px-5 py-3 space-y-2.5", children: [
139
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
140
+ /* @__PURE__ */ jsx(Label, { htmlFor: "media-title", className: "text-xs font-medium", children: t("detail.titleLabel") }),
141
+ /* @__PURE__ */ jsx(
142
+ Input,
143
+ {
144
+ id: "media-title",
145
+ "data-cy": sel("media.detail.titleInput"),
146
+ value: title,
147
+ onChange: (e) => setTitle(e.target.value),
148
+ placeholder: t("detail.titlePlaceholder"),
149
+ maxLength: 255
150
+ }
151
+ )
152
+ ] }),
153
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
154
+ /* @__PURE__ */ jsx(Label, { htmlFor: "alt-text", className: "text-xs font-medium", children: t("detail.altLabel") }),
155
+ /* @__PURE__ */ jsx(
156
+ Input,
157
+ {
158
+ id: "alt-text",
159
+ "data-cy": sel("media.detail.altInput"),
160
+ value: alt,
161
+ onChange: (e) => setAlt(e.target.value),
162
+ placeholder: t("detail.altPlaceholder"),
163
+ maxLength: 500
164
+ }
165
+ )
166
+ ] }),
167
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
168
+ /* @__PURE__ */ jsx(Label, { htmlFor: "caption", className: "text-xs font-medium", children: t("detail.captionLabel") }),
169
+ /* @__PURE__ */ jsx(
170
+ Textarea,
171
+ {
172
+ id: "caption",
173
+ "data-cy": sel("media.detail.captionInput"),
174
+ value: caption,
175
+ onChange: (e) => setCaption(e.target.value),
176
+ placeholder: t("detail.captionPlaceholder"),
177
+ maxLength: 1e3,
178
+ rows: 2,
179
+ className: "resize-none"
180
+ }
181
+ )
182
+ ] })
183
+ ] }),
184
+ /* @__PURE__ */ jsxs("div", { className: "px-5 py-2.5 border-t", "data-cy": sel("media.detail.tags"), children: [
185
+ /* @__PURE__ */ jsxs(Label, { className: "flex items-center gap-1.5 text-xs font-medium mb-2", children: [
186
+ /* @__PURE__ */ jsx(TagIcon, { className: "h-3 w-3" }),
187
+ t("tags.title")
188
+ ] }),
189
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
190
+ mediaTags.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground italic", children: t("tags.empty") }) : mediaTags.map((tag) => /* @__PURE__ */ jsxs(
191
+ Badge,
192
+ {
193
+ "data-cy": sel("media.detail.tagBadge", { id: tag.id }),
194
+ variant: "secondary",
195
+ className: "gap-1 text-xs pr-1",
196
+ style: tag.color ? { borderColor: tag.color, borderLeftWidth: 3 } : void 0,
197
+ children: [
198
+ tag.name,
199
+ /* @__PURE__ */ jsx(
200
+ "button",
201
+ {
202
+ type: "button",
203
+ className: "ml-0.5 rounded-full p-0.5 hover:bg-destructive/10 hover:text-destructive transition-colors",
204
+ onClick: () => {
205
+ removeTagMutation.mutate({ mediaId: media.id, tagId: tag.id });
206
+ },
207
+ children: /* @__PURE__ */ jsx(XIcon, { className: "h-3 w-3" })
208
+ }
209
+ )
210
+ ]
211
+ },
212
+ tag.id
213
+ )),
214
+ /* @__PURE__ */ jsxs(Popover, { open: tagPopoverOpen, onOpenChange: setTagPopoverOpen, children: [
215
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
216
+ Button,
217
+ {
218
+ "data-cy": sel("media.detail.addTagBtn"),
219
+ variant: "outline",
220
+ size: "sm",
221
+ className: "h-[22px] px-2 text-xs gap-1 border-dashed",
222
+ children: [
223
+ /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" }),
224
+ t("tags.add")
225
+ ]
226
+ }
227
+ ) }),
228
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-60 p-3", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
229
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
230
+ allTags.filter((tag) => !mediaTags.some((mt) => mt.id === tag.id)).map((tag) => /* @__PURE__ */ jsx(
231
+ Badge,
232
+ {
233
+ variant: "outline",
234
+ className: "cursor-pointer text-xs hover:bg-secondary",
235
+ style: tag.color ? { borderColor: tag.color } : void 0,
236
+ onClick: () => {
237
+ addTagMutation.mutate({ mediaId: media.id, tagId: tag.id });
238
+ setTagPopoverOpen(false);
239
+ },
240
+ children: tag.name
241
+ },
242
+ tag.id
243
+ )),
244
+ allTags.filter((tag) => !mediaTags.some((mt) => mt.id === tag.id)).length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground p-1", children: t("dashboard.noTags") })
245
+ ] }),
246
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1 pt-2 border-t", children: [
247
+ /* @__PURE__ */ jsx(
248
+ Input,
249
+ {
250
+ value: newTagName,
251
+ onChange: (e) => setNewTagName(e.target.value),
252
+ placeholder: t("tags.createPlaceholder"),
253
+ className: "h-7 text-xs",
254
+ onKeyDown: (e) => {
255
+ if (e.key === "Enter" && newTagName.trim()) {
256
+ e.preventDefault();
257
+ createTagMutation.mutate(newTagName.trim(), {
258
+ onSuccess: (tag) => {
259
+ if (tag == null ? void 0 : tag.id) {
260
+ addTagMutation.mutate({ mediaId: media.id, tagId: tag.id });
261
+ }
262
+ setNewTagName("");
263
+ setTagPopoverOpen(false);
264
+ }
265
+ });
266
+ }
267
+ }
268
+ }
269
+ ),
270
+ /* @__PURE__ */ jsx(
271
+ Button,
272
+ {
273
+ variant: "secondary",
274
+ size: "sm",
275
+ className: "h-7 px-2 shrink-0",
276
+ disabled: !newTagName.trim() || createTagMutation.isPending,
277
+ onClick: () => {
278
+ if (newTagName.trim()) {
279
+ createTagMutation.mutate(newTagName.trim(), {
280
+ onSuccess: (tag) => {
281
+ if (tag == null ? void 0 : tag.id) {
282
+ addTagMutation.mutate({ mediaId: media.id, tagId: tag.id });
283
+ }
284
+ setNewTagName("");
285
+ setTagPopoverOpen(false);
286
+ }
287
+ });
288
+ }
289
+ },
290
+ children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" })
291
+ }
292
+ )
293
+ ] })
294
+ ] }) })
295
+ ] })
296
+ ] })
297
+ ] })
298
+ ] }),
299
+ /* @__PURE__ */ jsxs("div", { className: "px-5 py-2.5 border-t bg-muted/20 shrink-0 flex items-center justify-end gap-2", children: [
300
+ /* @__PURE__ */ jsx(
301
+ Button,
302
+ {
303
+ "data-cy": sel("media.detail.cancelBtn"),
304
+ onClick: handleCancel,
305
+ variant: "ghost",
306
+ size: "sm",
307
+ disabled: updateMutation.isPending,
308
+ children: t("detail.cancel")
309
+ }
310
+ ),
311
+ /* @__PURE__ */ jsxs(
312
+ Button,
313
+ {
314
+ "data-cy": sel("media.detail.saveBtn"),
315
+ onClick: handleSave,
316
+ disabled: !hasChanges || updateMutation.isPending,
317
+ size: "sm",
318
+ children: [
319
+ updateMutation.isPending && /* @__PURE__ */ jsx(LoaderIcon, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
320
+ updateMutation.isPending ? t("detail.saving") : t("detail.save")
321
+ ]
322
+ }
323
+ )
324
+ ] })
325
+ ]
326
+ }
327
+ );
328
+ }
329
+ export {
330
+ MediaDetailPanel
331
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * MediaGrid Component
3
+ *
4
+ * Grid view of media items using MediaCard components.
5
+ * Responsive: 6 cols desktop, 4 cols tablet, 2 cols mobile.
6
+ *
7
+ * Performance: Memoized gridStyle to prevent object recreation.
8
+ * MediaCard children benefit from memo.
9
+ */
10
+ import type { Media } from '../../lib/media/types';
11
+ interface MediaGridProps {
12
+ items: Media[];
13
+ isLoading: boolean;
14
+ selectedIds: Set<string>;
15
+ onSelect: (media: Media, options?: {
16
+ shiftKey?: boolean;
17
+ }) => void;
18
+ onEdit?: (media: Media) => void;
19
+ onDelete?: (media: Media) => void;
20
+ mode?: 'single' | 'multiple';
21
+ columns?: number;
22
+ className?: string;
23
+ }
24
+ export declare function MediaGrid({ items, isLoading, selectedIds, onSelect, onEdit, onDelete, mode, columns, className, }: MediaGridProps): import("react/jsx-runtime").JSX.Element;
25
+ export {};
26
+ //# sourceMappingURL=MediaGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaGrid.d.ts","sourceRoot":"","sources":["../../../src/components/media/MediaGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAElD,UAAU,cAAc;IACtB,KAAK,EAAE,KAAK,EAAE,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;IAClE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACjC,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAe,EACf,OAAW,EACX,SAAS,GACV,EAAE,cAAc,2CAwDhB"}
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ import { useTranslations } from "next-intl";
5
+ import { ImageIcon } from "lucide-react";
6
+ import { MediaCard } from "./MediaCard.js";
7
+ import { Skeleton } from "../ui/skeleton.js";
8
+ import { cn } from "../../lib/utils/index.js";
9
+ import { sel } from "../../lib/selectors/index.js";
10
+ function MediaGrid({
11
+ items,
12
+ isLoading,
13
+ selectedIds,
14
+ onSelect,
15
+ onEdit,
16
+ onDelete,
17
+ mode = "single",
18
+ columns = 6,
19
+ className
20
+ }) {
21
+ const t = useTranslations("media");
22
+ const gridStyle = useMemo(
23
+ () => ({ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }),
24
+ [columns]
25
+ );
26
+ if (isLoading) {
27
+ return /* @__PURE__ */ jsx(
28
+ "div",
29
+ {
30
+ "data-cy": sel("media.grid.container"),
31
+ className: cn("grid gap-3", className),
32
+ style: gridStyle,
33
+ children: Array.from({ length: columns * 2 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
34
+ /* @__PURE__ */ jsx(Skeleton, { className: "aspect-square w-full rounded-lg" }),
35
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4" })
36
+ ] }, i))
37
+ }
38
+ );
39
+ }
40
+ if (items.length === 0) {
41
+ return /* @__PURE__ */ jsxs(
42
+ "div",
43
+ {
44
+ "data-cy": sel("media.empty.container"),
45
+ className: "flex flex-col items-center justify-center py-12 text-center",
46
+ children: [
47
+ /* @__PURE__ */ jsx(ImageIcon, { className: "h-16 w-16 text-muted-foreground mb-4" }),
48
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: t("empty.title") }),
49
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("grid.noResults") })
50
+ ]
51
+ }
52
+ );
53
+ }
54
+ return /* @__PURE__ */ jsx(
55
+ "div",
56
+ {
57
+ "data-cy": sel("media.grid.container"),
58
+ className: cn("grid gap-3", className),
59
+ style: gridStyle,
60
+ children: items.map((media) => /* @__PURE__ */ jsx(
61
+ MediaCard,
62
+ {
63
+ media,
64
+ isSelected: selectedIds.has(media.id),
65
+ onSelect,
66
+ onEdit,
67
+ onDelete,
68
+ mode
69
+ },
70
+ media.id
71
+ ))
72
+ }
73
+ );
74
+ }
75
+ export {
76
+ MediaGrid
77
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * MediaLibrary Component
3
+ *
4
+ * Main modal for browsing, uploading, and selecting media.
5
+ * Manages state for search, filtering, sorting, selection, and view mode.
6
+ *
7
+ * Performance: Stable callbacks with useCallback + functional setState.
8
+ */
9
+ import type { Media } from '../../lib/media/types';
10
+ interface MediaLibraryProps {
11
+ isOpen: boolean;
12
+ onClose: () => void;
13
+ onSelect?: (media: Media | Media[]) => void;
14
+ mode?: 'single' | 'multiple';
15
+ allowedTypes?: ('image' | 'video')[];
16
+ maxSelections?: number;
17
+ }
18
+ export declare function MediaLibrary({ isOpen, onClose, onSelect, mode, allowedTypes, maxSelections, }: MediaLibraryProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=MediaLibrary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaLibrary.d.ts","sourceRoot":"","sources":["../../../src/components/media/MediaLibrary.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyBH,OAAO,KAAK,EAAE,KAAK,EAAoB,MAAM,uBAAuB,CAAA;AAEpE,UAAU,iBAAiB;IACzB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,CAAA;IAC3C,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC5B,YAAY,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,EAAE,CAAA;IACpC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAID,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,IAAe,EACf,YAAY,EACZ,aAAa,GACd,EAAE,iBAAiB,2CAyOnB"}