@questpie/admin 3.2.4 → 3.2.6

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 (255) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +94 -296
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +61 -72
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +285 -605
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +176 -476
  68. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +229 -572
  77. package/dist/client/components/primitives/select-single.mjs +179 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.mjs +63 -146
  123. package/dist/client/hooks/typed-hooks.mjs +241 -701
  124. package/dist/client/hooks/use-action.mjs +62 -198
  125. package/dist/client/hooks/use-admin-config.mjs +5 -35
  126. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  127. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  128. package/dist/client/hooks/use-audit-history.mjs +21 -69
  129. package/dist/client/hooks/use-brand.mjs +1 -9
  130. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  131. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  132. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  133. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  134. package/dist/client/hooks/use-collection.mjs +194 -614
  135. package/dist/client/hooks/use-current-user.mjs +0 -1
  136. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  137. package/dist/client/hooks/use-field-options.mjs +61 -202
  138. package/dist/client/hooks/use-global-fields.mjs +14 -46
  139. package/dist/client/hooks/use-global-meta.mjs +9 -30
  140. package/dist/client/hooks/use-global-schema.mjs +9 -30
  141. package/dist/client/hooks/use-global.mjs +63 -219
  142. package/dist/client/hooks/use-locks.mjs +117 -325
  143. package/dist/client/hooks/use-media-query.mjs +16 -36
  144. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  145. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  146. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  147. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  148. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  149. package/dist/client/hooks/use-saved-views.mjs +22 -103
  150. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  151. package/dist/client/hooks/use-search.mjs +31 -143
  152. package/dist/client/hooks/use-server-actions.mjs +18 -50
  153. package/dist/client/hooks/use-server-validation.mjs +72 -166
  154. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  155. package/dist/client/hooks/use-setup-status.mjs +12 -25
  156. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  157. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  158. package/dist/client/hooks/use-upload.mjs +54 -152
  159. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  160. package/dist/client/hooks/use-view-state.mjs +187 -437
  161. package/dist/client/i18n/hooks.mjs +65 -197
  162. package/dist/client/lib/render-profiler.mjs +14 -41
  163. package/dist/client/preview/block-scope-context.mjs +14 -36
  164. package/dist/client/preview/preview-banner.d.mts +2 -2
  165. package/dist/client/preview/preview-banner.mjs +42 -108
  166. package/dist/client/preview/preview-field.d.mts +4 -4
  167. package/dist/client/preview/preview-field.mjs +167 -348
  168. package/dist/client/preview/use-collection-preview.mjs +121 -215
  169. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  170. package/dist/client/runtime/locale-scope.mjs +22 -63
  171. package/dist/client/runtime/provider.mjs +100 -255
  172. package/dist/client/runtime/translations-provider.mjs +41 -107
  173. package/dist/client/scope/picker.mjs +86 -321
  174. package/dist/client/scope/provider.mjs +8 -17
  175. package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
  176. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  177. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  178. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  179. package/dist/client/views/auth/auth-layout.mjs +104 -284
  180. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  181. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  182. package/dist/client/views/auth/invite-form.mjs +107 -442
  183. package/dist/client/views/auth/login-form.d.mts +2 -2
  184. package/dist/client/views/auth/login-form.mjs +116 -337
  185. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  186. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  187. package/dist/client/views/auth/setup-form.d.mts +2 -2
  188. package/dist/client/views/auth/setup-form.mjs +140 -478
  189. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  190. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
  191. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  192. package/dist/client/views/collection/cells/primitive-cells.mjs +116 -356
  193. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  194. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  195. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  196. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  197. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  198. package/dist/client/views/collection/field-renderer.mjs +58 -182
  199. package/dist/client/views/collection/form-view.mjs +284 -518
  200. package/dist/client/views/collection/table-view.mjs +231 -463
  201. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  202. package/dist/client/views/common/global-search.mjs +241 -560
  203. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  204. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  205. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  206. package/dist/client/views/globals/global-form-view.mjs +477 -1301
  207. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  208. package/dist/client/views/layout/admin-layout.mjs +83 -246
  209. package/dist/client/views/layout/admin-router.mjs +458 -1274
  210. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  211. package/dist/client/views/layout/admin-theme.mjs +30 -64
  212. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  213. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  216. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  217. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  218. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  219. package/dist/client/views/pages/invite-page.d.mts +2 -2
  220. package/dist/client/views/pages/invite-page.mjs +35 -90
  221. package/dist/client/views/pages/login-page.d.mts +2 -2
  222. package/dist/client/views/pages/login-page.mjs +41 -121
  223. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  224. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  225. package/dist/client/views/pages/setup-page.d.mts +2 -2
  226. package/dist/client/views/pages/setup-page.mjs +33 -95
  227. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  228. package/dist/server/adapters/index.d.mts +2 -0
  229. package/dist/server/adapters/nextjs.d.mts +1 -0
  230. package/dist/server/auth-helpers.d.mts +1 -0
  231. package/dist/server/modules/admin/.generated/module.d.mts +1 -0
  232. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  233. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  234. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  235. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  236. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  237. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  238. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  239. package/dist/server/modules/admin/collections/user.d.mts +62 -62
  240. package/dist/server/modules/admin/collections/verification.d.mts +23 -23
  241. package/dist/server/modules/admin/index.d.mts +20 -19
  242. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  243. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  244. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  245. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  246. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  247. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  248. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  249. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  250. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  251. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  252. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  253. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  254. package/dist/server.d.mts +2 -0
  255. package/package.json +3 -5
@@ -3,7 +3,6 @@
3
3
  import { useTranslation } from "../i18n/hooks.mjs";
4
4
  import { selectBasePath, selectClient, selectContentLocale, selectNavigate, useAdminStore } from "../runtime/provider.mjs";
5
5
  import { getDefaultActionsConfig } from "../builder/types/action-registry.mjs";
6
- import { c } from "react/compiler-runtime";
7
6
  import * as React from "react";
8
7
  import { useQueryClient } from "@tanstack/react-query";
9
8
  import { toast } from "sonner";
@@ -34,40 +33,27 @@ const QUERY_KEY_PREFIX = ["questpie", "collections"];
34
33
  * );
35
34
  * ```
36
35
  */
37
- function useActionHelpers(t0) {
38
- const $ = c(34);
39
- const { collection, onRefresh } = t0;
36
+ function useActionHelpers({ collection, onRefresh }) {
40
37
  const basePath = useAdminStore(selectBasePath);
41
38
  const navigate = useAdminStore(selectNavigate);
42
39
  const client = useAdminStore(selectClient);
43
40
  const contentLocale = useAdminStore(selectContentLocale);
44
41
  const queryClient = useQueryClient();
45
42
  const { t } = useTranslation();
46
- const t1 = client;
47
- let t2;
48
- if ($[0] !== contentLocale || $[1] !== t1) {
49
- t2 = createQuestpieQueryOptions(t1, {
50
- keyPrefix: QUERY_KEY_PREFIX,
51
- locale: contentLocale
52
- });
53
- $[0] = contentLocale;
54
- $[1] = t1;
55
- $[2] = t2;
56
- } else t2 = $[2];
57
- const queryOpts = t2;
58
- let t3;
59
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
60
- t3 = {
43
+ const queryOpts = React.useMemo(() => createQuestpieQueryOptions(client, {
44
+ keyPrefix: QUERY_KEY_PREFIX,
45
+ locale: contentLocale
46
+ }), [client, contentLocale]);
47
+ return { helpers: React.useMemo(() => ({
48
+ navigate,
49
+ toast: {
61
50
  success: toast.success,
62
51
  error: toast.error,
63
52
  info: toast.info,
64
53
  warning: toast.warning
65
- };
66
- $[3] = t3;
67
- } else t3 = $[3];
68
- let t4;
69
- if ($[4] !== collection || $[5] !== contentLocale || $[6] !== onRefresh || $[7] !== queryClient || $[8] !== queryOpts) {
70
- t4 = async (targetCollection) => {
54
+ },
55
+ t,
56
+ invalidateCollection: async (targetCollection) => {
71
57
  const col = targetCollection || collection;
72
58
  await queryClient.invalidateQueries({ queryKey: queryOpts.key([
73
59
  "collections",
@@ -82,51 +68,28 @@ function useActionHelpers(t0) {
82
68
  contentLocale
83
69
  ]) });
84
70
  onRefresh?.();
85
- };
86
- $[4] = collection;
87
- $[5] = contentLocale;
88
- $[6] = onRefresh;
89
- $[7] = queryClient;
90
- $[8] = queryOpts;
91
- $[9] = t4;
92
- } else t4 = $[9];
93
- let t5;
94
- if ($[10] !== collection || $[11] !== contentLocale || $[12] !== queryClient || $[13] !== queryOpts) {
95
- t5 = async (itemId, targetCollection_0) => {
96
- const col_0 = targetCollection_0 || collection;
71
+ },
72
+ invalidateItem: async (itemId, targetCollection) => {
73
+ const col = targetCollection || collection;
97
74
  await queryClient.invalidateQueries({ queryKey: queryOpts.key([
98
75
  "collections",
99
- col_0,
76
+ col,
100
77
  "findOne",
101
78
  contentLocale,
102
79
  { id: itemId }
103
80
  ]) });
104
81
  await queryClient.invalidateQueries({ queryKey: queryOpts.key([
105
82
  "collections",
106
- col_0,
83
+ col,
107
84
  "find",
108
85
  contentLocale
109
86
  ]) });
110
- };
111
- $[10] = collection;
112
- $[11] = contentLocale;
113
- $[12] = queryClient;
114
- $[13] = queryOpts;
115
- $[14] = t5;
116
- } else t5 = $[14];
117
- let t6;
118
- if ($[15] !== onRefresh || $[16] !== queryClient) {
119
- t6 = async () => {
87
+ },
88
+ invalidateAll: async () => {
120
89
  await queryClient.invalidateQueries({ queryKey: [...QUERY_KEY_PREFIX] });
121
90
  onRefresh?.();
122
- };
123
- $[15] = onRefresh;
124
- $[16] = queryClient;
125
- $[17] = t6;
126
- } else t6 = $[17];
127
- let t7;
128
- if ($[18] !== collection || $[19] !== contentLocale || $[20] !== onRefresh || $[21] !== queryClient || $[22] !== queryOpts) {
129
- t7 = () => {
91
+ },
92
+ refresh: () => {
130
93
  queryClient.invalidateQueries({ queryKey: queryOpts.key([
131
94
  "collections",
132
95
  collection,
@@ -140,44 +103,19 @@ function useActionHelpers(t0) {
140
103
  contentLocale
141
104
  ]) });
142
105
  onRefresh?.();
143
- };
144
- $[18] = collection;
145
- $[19] = contentLocale;
146
- $[20] = onRefresh;
147
- $[21] = queryClient;
148
- $[22] = queryOpts;
149
- $[23] = t7;
150
- } else t7 = $[23];
151
- let t8;
152
- if ($[24] !== basePath || $[25] !== navigate || $[26] !== t || $[27] !== t4 || $[28] !== t5 || $[29] !== t6 || $[30] !== t7) {
153
- t8 = {
154
- navigate,
155
- toast: t3,
156
- t,
157
- invalidateCollection: t4,
158
- invalidateItem: t5,
159
- invalidateAll: t6,
160
- refresh: t7,
161
- closeDialog: _temp,
162
- basePath
163
- };
164
- $[24] = basePath;
165
- $[25] = navigate;
166
- $[26] = t;
167
- $[27] = t4;
168
- $[28] = t5;
169
- $[29] = t6;
170
- $[30] = t7;
171
- $[31] = t8;
172
- } else t8 = $[31];
173
- const helpers = t8;
174
- let t9;
175
- if ($[32] !== helpers) {
176
- t9 = { helpers };
177
- $[32] = helpers;
178
- $[33] = t9;
179
- } else t9 = $[33];
180
- return t9;
106
+ },
107
+ closeDialog: () => {},
108
+ basePath
109
+ }), [
110
+ navigate,
111
+ queryClient,
112
+ queryOpts,
113
+ collection,
114
+ contentLocale,
115
+ onRefresh,
116
+ basePath,
117
+ t
118
+ ]) };
181
119
  }
182
120
  /**
183
121
  * Hook to manage collection actions with dialog state
@@ -219,118 +157,44 @@ function useActionHelpers(t0) {
219
157
  * );
220
158
  * ```
221
159
  */
222
- function _temp() {}
223
- function useActions(t0) {
224
- const $ = c(25);
225
- const { collection, actionsConfig, onRefresh } = t0;
160
+ function useActions({ collection, actionsConfig, onRefresh }) {
226
161
  const [dialogAction, setDialogAction] = React.useState(null);
227
162
  const [dialogItem, setDialogItem] = React.useState(null);
228
- let t1;
229
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
230
- t1 = getDefaultActionsConfig();
231
- $[0] = t1;
232
- } else t1 = $[0];
233
- const defaultActions = t1;
234
- let t2;
235
- if ($[1] !== actionsConfig) {
236
- t2 = actionsConfig?.header !== void 0 ? actionsConfig.header : defaultActions.header ?? {
163
+ const defaultActions = React.useMemo(() => getDefaultActionsConfig(), []);
164
+ const actions = React.useMemo(() => ({
165
+ header: actionsConfig?.header !== void 0 ? actionsConfig.header : defaultActions.header ?? {
237
166
  primary: [],
238
167
  secondary: []
239
- };
240
- $[1] = actionsConfig;
241
- $[2] = t2;
242
- } else t2 = $[2];
243
- let t3;
244
- if ($[3] !== actionsConfig?.row) {
245
- t3 = actionsConfig?.row ?? [];
246
- $[3] = actionsConfig?.row;
247
- $[4] = t3;
248
- } else t3 = $[4];
249
- let t4;
250
- if ($[5] !== actionsConfig) {
251
- t4 = actionsConfig?.bulk !== void 0 ? actionsConfig.bulk : defaultActions.bulk ?? [];
252
- $[5] = actionsConfig;
253
- $[6] = t4;
254
- } else t4 = $[6];
255
- let t5;
256
- if ($[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
257
- t5 = {
258
- header: t2,
259
- row: t3,
260
- bulk: t4
261
- };
262
- $[7] = t2;
263
- $[8] = t3;
264
- $[9] = t4;
265
- $[10] = t5;
266
- } else t5 = $[10];
267
- const actions = t5;
268
- let t6;
269
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
270
- t6 = () => {
271
- setDialogAction(null);
272
- setDialogItem(null);
273
- };
274
- $[11] = t6;
275
- } else t6 = $[11];
276
- const closeDialog = t6;
277
- let t7;
278
- if ($[12] !== onRefresh) {
279
- t7 = () => {
168
+ },
169
+ row: actionsConfig?.row ?? [],
170
+ bulk: actionsConfig?.bulk !== void 0 ? actionsConfig.bulk : defaultActions.bulk ?? []
171
+ }), [actionsConfig, defaultActions]);
172
+ const closeDialog = React.useCallback(() => {
173
+ setDialogAction(null);
174
+ setDialogItem(null);
175
+ }, []);
176
+ const { helpers: baseHelpers } = useActionHelpers({
177
+ collection,
178
+ onRefresh: () => {
280
179
  onRefresh?.();
281
- };
282
- $[12] = onRefresh;
283
- $[13] = t7;
284
- } else t7 = $[13];
285
- let t8;
286
- if ($[14] !== collection || $[15] !== t7) {
287
- t8 = {
288
- collection,
289
- onRefresh: t7
290
- };
291
- $[14] = collection;
292
- $[15] = t7;
293
- $[16] = t8;
294
- } else t8 = $[16];
295
- const { helpers: baseHelpers } = useActionHelpers(t8);
296
- let t9;
297
- if ($[17] !== baseHelpers) {
298
- t9 = {
180
+ }
181
+ });
182
+ return {
183
+ helpers: React.useMemo(() => ({
299
184
  ...baseHelpers,
300
185
  closeDialog
301
- };
302
- $[17] = baseHelpers;
303
- $[18] = t9;
304
- } else t9 = $[18];
305
- const helpers = t9;
306
- let t10;
307
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
308
- t10 = (action, item) => {
186
+ }), [baseHelpers, closeDialog]),
187
+ actions,
188
+ dialogAction,
189
+ setDialogAction,
190
+ dialogItem,
191
+ setDialogItem,
192
+ openDialog: React.useCallback((action, item) => {
309
193
  setDialogAction(action);
310
194
  setDialogItem(item ?? null);
311
- };
312
- $[19] = t10;
313
- } else t10 = $[19];
314
- const openDialog = t10;
315
- let t11;
316
- if ($[20] !== actions || $[21] !== dialogAction || $[22] !== dialogItem || $[23] !== helpers) {
317
- t11 = {
318
- helpers,
319
- actions,
320
- dialogAction,
321
- setDialogAction,
322
- dialogItem,
323
- setDialogItem,
324
- openDialog,
325
- closeDialog
326
- };
327
- $[20] = actions;
328
- $[21] = dialogAction;
329
- $[22] = dialogItem;
330
- $[23] = helpers;
331
- $[24] = t11;
332
- } else t11 = $[24];
333
- return t11;
195
+ }, []),
196
+ closeDialog
197
+ };
334
198
  }
335
199
 
336
200
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { selectClient, useAdminStore } from "../runtime/provider.mjs";
2
- import { c } from "react/compiler-runtime";
3
2
  import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
4
3
 
5
4
  //#region src/client/hooks/use-admin-config.ts
@@ -26,43 +25,14 @@ function getAdminConfigQueryOptions(client) {
26
25
  }
27
26
  /** Standard query hook - returns loading/error states */
28
27
  function useAdminConfig(queryOptions) {
29
- const $ = c(5);
30
- const client = useAdminStore(selectClient);
31
- let t0;
32
- if ($[0] !== client) {
33
- t0 = getAdminConfigQueryOptions(client);
34
- $[0] = client;
35
- $[1] = t0;
36
- } else t0 = $[1];
37
- let t1;
38
- if ($[2] !== queryOptions || $[3] !== t0) {
39
- t1 = {
40
- ...t0,
41
- ...queryOptions
42
- };
43
- $[2] = queryOptions;
44
- $[3] = t0;
45
- $[4] = t1;
46
- } else t1 = $[4];
47
- return useQuery(t1);
28
+ return useQuery({
29
+ ...getAdminConfigQueryOptions(useAdminStore(selectClient)),
30
+ ...queryOptions
31
+ });
48
32
  }
49
33
  /** Suspense query hook - suspends until data is ready, no loading checks needed */
50
34
  function useSuspenseAdminConfig() {
51
- const $ = c(4);
52
- const client = useAdminStore(selectClient);
53
- let t0;
54
- if ($[0] !== client) {
55
- t0 = getAdminConfigQueryOptions(client);
56
- $[0] = client;
57
- $[1] = t0;
58
- } else t0 = $[1];
59
- let t1;
60
- if ($[2] !== t0) {
61
- t1 = { ...t0 };
62
- $[2] = t0;
63
- $[3] = t1;
64
- } else t1 = $[3];
65
- return useSuspenseQuery(t1);
35
+ return useSuspenseQuery({ ...getAdminConfigQueryOptions(useAdminStore(selectClient)) });
66
36
  }
67
37
 
68
38
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { useAdminStore } from "../runtime/provider.mjs";
2
2
  import { useCurrentUser } from "./use-current-user.mjs";
3
- import { c } from "react/compiler-runtime";
4
3
  import { useMutation, useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
5
4
 
6
5
  //#region src/client/hooks/use-admin-preferences.ts
@@ -28,49 +27,23 @@ function getAdminPreferenceQueryKey(userId, key) {
28
27
  * ```
29
28
  */
30
29
  function useAdminPreference(key) {
31
- const $ = c(11);
32
- const client = useAdminStore(_temp);
30
+ const client = useAdminStore((s) => s.client);
33
31
  const user = useCurrentUser();
34
- const t0 = user?.id;
35
- let t1;
36
- if ($[0] !== key || $[1] !== t0) {
37
- t1 = [
32
+ return useQuery({
33
+ queryKey: [
38
34
  "admin_preferences",
39
- t0,
35
+ user?.id,
40
36
  key
41
- ];
42
- $[0] = key;
43
- $[1] = t0;
44
- $[2] = t1;
45
- } else t1 = $[2];
46
- let t2;
47
- if ($[3] !== client || $[4] !== key || $[5] !== user) {
48
- t2 = async () => {
37
+ ],
38
+ queryFn: async () => {
49
39
  if (!user?.id) return null;
50
40
  return (await client.collections.admin_preferences.findOne({ where: {
51
41
  userId: user.id,
52
42
  key
53
43
  } }))?.value ?? null;
54
- };
55
- $[3] = client;
56
- $[4] = key;
57
- $[5] = user;
58
- $[6] = t2;
59
- } else t2 = $[6];
60
- const t3 = !!client && !!user?.id;
61
- let t4;
62
- if ($[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
63
- t4 = {
64
- queryKey: t1,
65
- queryFn: t2,
66
- enabled: t3
67
- };
68
- $[7] = t1;
69
- $[8] = t2;
70
- $[9] = t3;
71
- $[10] = t4;
72
- } else t4 = $[10];
73
- return useQuery(t4);
44
+ },
45
+ enabled: !!client && !!user?.id
46
+ });
74
47
  }
75
48
  /**
76
49
  * Hook to set an admin preference
@@ -89,17 +62,12 @@ function useAdminPreference(key) {
89
62
  * };
90
63
  * ```
91
64
  */
92
- function _temp(s) {
93
- return s.client;
94
- }
95
65
  function useSetAdminPreference(key) {
96
- const $ = c(11);
97
- const client = useAdminStore(_temp2);
66
+ const client = useAdminStore((s) => s.client);
98
67
  const user = useCurrentUser();
99
68
  const queryClient = useQueryClient();
100
- let t0;
101
- if ($[0] !== client?.collections || $[1] !== key || $[2] !== user) {
102
- t0 = async (value) => {
69
+ return useMutation({
70
+ mutationFn: async (value) => {
103
71
  if (!user?.id) throw new Error("User must be logged in to save preferences");
104
72
  const collections = client?.collections;
105
73
  if (!collections?.admin_preferences) throw new Error("admin_preferences collection not available. Make sure to use the adminModule in your app setup.");
@@ -116,55 +84,15 @@ function useSetAdminPreference(key) {
116
84
  key,
117
85
  value
118
86
  });
119
- };
120
- $[0] = client?.collections;
121
- $[1] = key;
122
- $[2] = user;
123
- $[3] = t0;
124
- } else t0 = $[3];
125
- let t1;
126
- if ($[4] !== key || $[5] !== queryClient || $[6] !== user?.id) {
127
- t1 = () => {
87
+ },
88
+ onSuccess: () => {
128
89
  queryClient.invalidateQueries({ queryKey: [
129
90
  "admin_preferences",
130
91
  user?.id,
131
92
  key
132
93
  ] });
133
- };
134
- $[4] = key;
135
- $[5] = queryClient;
136
- $[6] = user?.id;
137
- $[7] = t1;
138
- } else t1 = $[7];
139
- let t2;
140
- if ($[8] !== t0 || $[9] !== t1) {
141
- t2 = {
142
- mutationFn: t0,
143
- onSuccess: t1
144
- };
145
- $[8] = t0;
146
- $[9] = t1;
147
- $[10] = t2;
148
- } else t2 = $[10];
149
- return useMutation(t2);
150
- }
151
- /**
152
- * Hook to delete an admin preference
153
- *
154
- * @param key - Preference key (e.g., "viewState:posts")
155
- * @returns Mutation for deleting the preference
156
- *
157
- * @example
158
- * ```tsx
159
- * const { mutate: deletePreference } = useDeleteAdminPreference("viewState:posts");
160
- *
161
- * const handleReset = () => {
162
- * deletePreference();
163
- * };
164
- * ```
165
- */
166
- function _temp2(s) {
167
- return s.client;
94
+ }
95
+ });
168
96
  }
169
97
 
170
98
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { selectAdmin, selectBasePath, selectNavigate, useAdminStore } from "../runtime/provider.mjs";
2
2
  import { createAdminRoutes, createNavigator } from "../utils/routes.mjs";
3
- import { c } from "react/compiler-runtime";
3
+ import * as React from "react";
4
4
 
5
5
  //#region src/client/hooks/use-admin-routes.ts
6
6
  /**
@@ -38,66 +38,32 @@ import { c } from "react/compiler-runtime";
38
38
  * }
39
39
  * ```
40
40
  */
41
- function useAdminRoutes(t0) {
42
- const $ = c(16);
43
- let t1;
44
- if ($[0] !== t0) {
45
- t1 = t0 === void 0 ? {} : t0;
46
- $[0] = t0;
47
- $[1] = t1;
48
- } else t1 = $[1];
49
- const options = t1;
41
+ function useAdminRoutes(options = {}) {
50
42
  const admin = useAdminStore(selectAdmin);
51
43
  const storeBasePath = useAdminStore(selectBasePath);
52
44
  const storeNavigate = useAdminStore(selectNavigate);
53
45
  const basePath = options.basePath ?? storeBasePath;
54
- let t2;
55
- if ($[2] !== admin || $[3] !== basePath) {
56
- t2 = createAdminRoutes(admin, { basePath });
57
- $[2] = admin;
58
- $[3] = basePath;
59
- $[4] = t2;
60
- } else t2 = $[4];
61
- const routes = t2;
46
+ const routes = React.useMemo(() => createAdminRoutes(admin, { basePath }), [admin, basePath]);
62
47
  const navigate = storeNavigate;
63
- let t3;
64
- if ($[5] !== navigate || $[6] !== routes) {
65
- t3 = createNavigator(routes, navigate);
66
- $[5] = navigate;
67
- $[6] = routes;
68
- $[7] = t3;
69
- } else t3 = $[7];
70
- const nav = t3;
71
- let t4;
72
- if ($[8] !== nav.collection || $[9] !== nav.collectionCreate || $[10] !== nav.collectionEdit || $[11] !== nav.dashboard || $[12] !== nav.global || $[13] !== nav.page || $[14] !== routes) {
73
- t4 = {
74
- routes,
75
- toDashboard: nav.dashboard,
76
- toCollection: nav.collection,
77
- toCollectionCreate: nav.collectionCreate,
78
- toCollectionEdit: nav.collectionEdit,
79
- toGlobal: nav.global,
80
- toPage: nav.page,
81
- dashboardUrl: routes.dashboard,
82
- collectionUrl: routes.collections.list,
83
- collectionCreateUrl: routes.collections.create,
84
- collectionEditUrl: routes.collections.edit,
85
- globalUrl: routes.globals.edit,
86
- pageUrl: routes.pages.byId,
87
- allPageUrls: routes.pages.all,
88
- parse: routes.parse,
89
- matches: routes.matches
90
- };
91
- $[8] = nav.collection;
92
- $[9] = nav.collectionCreate;
93
- $[10] = nav.collectionEdit;
94
- $[11] = nav.dashboard;
95
- $[12] = nav.global;
96
- $[13] = nav.page;
97
- $[14] = routes;
98
- $[15] = t4;
99
- } else t4 = $[15];
100
- return t4;
48
+ const nav = React.useMemo(() => createNavigator(routes, navigate), [routes, navigate]);
49
+ return {
50
+ routes,
51
+ toDashboard: nav.dashboard,
52
+ toCollection: nav.collection,
53
+ toCollectionCreate: nav.collectionCreate,
54
+ toCollectionEdit: nav.collectionEdit,
55
+ toGlobal: nav.global,
56
+ toPage: nav.page,
57
+ dashboardUrl: routes.dashboard,
58
+ collectionUrl: routes.collections.list,
59
+ collectionCreateUrl: routes.collections.create,
60
+ collectionEditUrl: routes.collections.edit,
61
+ globalUrl: routes.globals.edit,
62
+ pageUrl: routes.pages.byId,
63
+ allPageUrls: routes.pages.all,
64
+ parse: routes.parse,
65
+ matches: routes.matches
66
+ };
101
67
  }
102
68
  /**
103
69
  * Get href for admin link props