@questpie/admin 3.2.4 → 3.2.5

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 (248) 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.mjs +40 -126
  8. package/dist/client/components/auth/auth-loading.mjs +9 -44
  9. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  10. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  11. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  12. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  13. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  14. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  15. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  16. package/dist/client/components/blocks/block-item.mjs +136 -370
  17. package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
  18. package/dist/client/components/blocks/block-tree.mjs +12 -68
  19. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  20. package/dist/client/components/brand-logo.mjs +35 -149
  21. package/dist/client/components/component-renderer.mjs +42 -118
  22. package/dist/client/components/error-boundary.mjs +14 -58
  23. package/dist/client/components/fields/array-field.mjs +209 -521
  24. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  25. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  26. package/dist/client/components/fields/boolean-field.mjs +29 -59
  27. package/dist/client/components/fields/date-field.mjs +7 -37
  28. package/dist/client/components/fields/datetime-field.mjs +7 -38
  29. package/dist/client/components/fields/email-field.mjs +25 -54
  30. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  31. package/dist/client/components/fields/json-field.mjs +94 -296
  32. package/dist/client/components/fields/locale-badge.mjs +6 -15
  33. package/dist/client/components/fields/number-field.mjs +27 -60
  34. package/dist/client/components/fields/object-array-field.mjs +283 -659
  35. package/dist/client/components/fields/object-field.mjs +165 -633
  36. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  37. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  38. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  39. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  40. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  41. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  42. package/dist/client/components/fields/relation-field.mjs +10 -66
  43. package/dist/client/components/fields/relation-picker.mjs +18 -18
  44. package/dist/client/components/fields/relation-select.mjs +12 -12
  45. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
  46. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  47. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  48. package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
  49. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  50. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  51. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  52. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  53. package/dist/client/components/fields/select-field.mjs +39 -74
  54. package/dist/client/components/fields/text-field.mjs +26 -59
  55. package/dist/client/components/fields/textarea-field.mjs +26 -58
  56. package/dist/client/components/fields/time-field.mjs +7 -35
  57. package/dist/client/components/fields/upload-field.mjs +47 -165
  58. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  59. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  60. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  61. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  62. package/dist/client/components/history-sidebar.mjs +285 -605
  63. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  64. package/dist/client/components/locale-switcher.mjs +106 -228
  65. package/dist/client/components/media/media-grid.mjs +84 -273
  66. package/dist/client/components/media/media-picker-dialog.mjs +176 -476
  67. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  68. package/dist/client/components/preview/preview-pane.mjs +22 -22
  69. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  70. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  71. package/dist/client/components/primitives/date-input.mjs +109 -327
  72. package/dist/client/components/primitives/dropzone.mjs +209 -336
  73. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  74. package/dist/client/components/primitives/number-input.mjs +4 -4
  75. package/dist/client/components/primitives/select-multi.mjs +200 -559
  76. package/dist/client/components/primitives/select-single.mjs +165 -499
  77. package/dist/client/components/primitives/time-input.mjs +43 -117
  78. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  79. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  80. package/dist/client/components/ui/accordion.mjs +35 -155
  81. package/dist/client/components/ui/alert.mjs +13 -68
  82. package/dist/client/components/ui/badge.mjs +9 -51
  83. package/dist/client/components/ui/button.mjs +8 -54
  84. package/dist/client/components/ui/card.mjs +37 -193
  85. package/dist/client/components/ui/checkbox.mjs +12 -68
  86. package/dist/client/components/ui/command.mjs +48 -219
  87. package/dist/client/components/ui/dialog.mjs +50 -262
  88. package/dist/client/components/ui/drawer.mjs +55 -259
  89. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  90. package/dist/client/components/ui/empty-state.mjs +28 -98
  91. package/dist/client/components/ui/field.mjs +73 -309
  92. package/dist/client/components/ui/input-group.mjs +42 -167
  93. package/dist/client/components/ui/input.mjs +7 -37
  94. package/dist/client/components/ui/kbd.mjs +6 -36
  95. package/dist/client/components/ui/label.mjs +7 -37
  96. package/dist/client/components/ui/popover.mjs +34 -169
  97. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  98. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  99. package/dist/client/components/ui/search-input.mjs +33 -100
  100. package/dist/client/components/ui/select.mjs +72 -393
  101. package/dist/client/components/ui/separator.mjs +7 -38
  102. package/dist/client/components/ui/sheet.mjs +49 -269
  103. package/dist/client/components/ui/sidebar.mjs +171 -690
  104. package/dist/client/components/ui/skeleton.mjs +7 -38
  105. package/dist/client/components/ui/sonner.mjs +11 -42
  106. package/dist/client/components/ui/switch.mjs +9 -45
  107. package/dist/client/components/ui/table.mjs +48 -266
  108. package/dist/client/components/ui/tabs.mjs +26 -139
  109. package/dist/client/components/ui/textarea.mjs +6 -32
  110. package/dist/client/components/ui/tooltip.mjs +27 -129
  111. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  112. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  113. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  114. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  115. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  116. package/dist/client/components/widgets/table-widget.mjs +9 -9
  117. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  118. package/dist/client/components/widgets/value-widget.mjs +74 -381
  119. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  120. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  121. package/dist/client/contexts/focus-context.mjs +63 -146
  122. package/dist/client/hooks/typed-hooks.mjs +241 -701
  123. package/dist/client/hooks/use-action.mjs +62 -198
  124. package/dist/client/hooks/use-admin-config.mjs +5 -35
  125. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  126. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  127. package/dist/client/hooks/use-audit-history.mjs +21 -69
  128. package/dist/client/hooks/use-brand.mjs +1 -9
  129. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  130. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  131. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  132. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  133. package/dist/client/hooks/use-collection.mjs +194 -614
  134. package/dist/client/hooks/use-current-user.mjs +0 -1
  135. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  136. package/dist/client/hooks/use-field-options.mjs +61 -202
  137. package/dist/client/hooks/use-global-fields.mjs +14 -46
  138. package/dist/client/hooks/use-global-meta.mjs +9 -30
  139. package/dist/client/hooks/use-global-schema.mjs +9 -30
  140. package/dist/client/hooks/use-global.mjs +63 -219
  141. package/dist/client/hooks/use-locks.mjs +117 -325
  142. package/dist/client/hooks/use-media-query.mjs +16 -36
  143. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  144. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  145. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  146. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  147. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  148. package/dist/client/hooks/use-saved-views.mjs +22 -103
  149. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  150. package/dist/client/hooks/use-search.mjs +31 -143
  151. package/dist/client/hooks/use-server-actions.mjs +18 -50
  152. package/dist/client/hooks/use-server-validation.mjs +72 -166
  153. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  154. package/dist/client/hooks/use-setup-status.mjs +12 -25
  155. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  156. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  157. package/dist/client/hooks/use-upload.mjs +54 -152
  158. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  159. package/dist/client/hooks/use-view-state.mjs +187 -437
  160. package/dist/client/i18n/hooks.mjs +65 -197
  161. package/dist/client/lib/render-profiler.mjs +14 -41
  162. package/dist/client/preview/block-scope-context.d.mts +2 -2
  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.d.mts +2 -2
  174. package/dist/client/scope/picker.mjs +86 -321
  175. package/dist/client/scope/provider.d.mts +2 -2
  176. package/dist/client/scope/provider.mjs +8 -17
  177. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  178. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  179. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  180. package/dist/client/views/auth/auth-layout.mjs +104 -284
  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 +109 -363
  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.mjs +41 -121
  222. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  223. package/dist/client/views/pages/setup-page.mjs +33 -95
  224. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  225. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  226. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  227. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  228. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  229. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  230. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  231. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  232. package/dist/server/modules/admin/collections/session.d.mts +41 -41
  233. package/dist/server/modules/admin/collections/user.d.mts +63 -63
  234. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  235. package/dist/server/modules/admin/index.d.mts +20 -19
  236. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  237. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  238. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  239. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  240. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  241. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  242. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  243. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  244. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  245. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  246. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  247. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  248. package/package.json +3 -5
@@ -6,8 +6,7 @@ import { getCookie } from "../lib/cookies.mjs";
6
6
  import { buildNavigation } from "./routes.mjs";
7
7
  import { TranslationsProvider, getUiLocaleFromCookie as getUiLocaleFromCookie$1 } from "./translations-provider.mjs";
8
8
  import { ContentLocalesProvider } from "./content-locales-provider.mjs";
9
- import { c } from "react/compiler-runtime";
10
- import { createContext, useContext, useEffect, useState } from "react";
9
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
11
10
  import { DEFAULT_LOCALE } from "questpie/shared";
12
11
  import { createStore, useStore } from "zustand";
13
12
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -70,47 +69,22 @@ function mergeMessages(baseMessages, customTranslations) {
70
69
  };
71
70
  return result;
72
71
  }
73
- function LegacyI18nProvider(t0) {
74
- const $ = c(11);
75
- const { admin, locale, localeConfig, defaultLocale, customI18nAdapter, children } = t0;
76
- let t1;
77
- if ($[0] !== admin || $[1] !== customI18nAdapter || $[2] !== defaultLocale || $[3] !== locale || $[4] !== localeConfig) {
78
- t1 = () => {
79
- if (customI18nAdapter) return customI18nAdapter;
80
- const messages = mergeMessages(adminMessages, admin.getTranslations());
81
- return createSimpleI18n({
82
- locale,
83
- locales: localeConfig.supported ?? [DEFAULT_LOCALE],
84
- messages,
85
- fallbackLocale: defaultLocale,
86
- onLocaleChange: setUiLocaleCookie
87
- });
88
- };
89
- $[0] = admin;
90
- $[1] = customI18nAdapter;
91
- $[2] = defaultLocale;
92
- $[3] = locale;
93
- $[4] = localeConfig;
94
- $[5] = t1;
95
- } else t1 = $[5];
96
- const [i18nAdapter] = useState(t1);
97
- let t2;
98
- if ($[6] !== children) {
99
- t2 = /* @__PURE__ */ jsx(ContentLocalesProvider, { children });
100
- $[6] = children;
101
- $[7] = t2;
102
- } else t2 = $[7];
103
- let t3;
104
- if ($[8] !== i18nAdapter || $[9] !== t2) {
105
- t3 = /* @__PURE__ */ jsx(I18nProvider, {
106
- adapter: i18nAdapter,
107
- children: t2
72
+ function LegacyI18nProvider({ admin, locale, localeConfig, defaultLocale, customI18nAdapter, children }) {
73
+ const [i18nAdapter] = useState(() => {
74
+ if (customI18nAdapter) return customI18nAdapter;
75
+ const messages = mergeMessages(adminMessages, admin.getTranslations());
76
+ return createSimpleI18n({
77
+ locale,
78
+ locales: localeConfig.supported ?? [DEFAULT_LOCALE],
79
+ messages,
80
+ fallbackLocale: defaultLocale,
81
+ onLocaleChange: setUiLocaleCookie
108
82
  });
109
- $[8] = i18nAdapter;
110
- $[9] = t2;
111
- $[10] = t3;
112
- } else t3 = $[10];
113
- return t3;
83
+ });
84
+ return /* @__PURE__ */ jsx(I18nProvider, {
85
+ adapter: i18nAdapter,
86
+ children: /* @__PURE__ */ jsx(ContentLocalesProvider, { children })
87
+ });
114
88
  }
115
89
  /**
116
90
  * Admin provider component
@@ -138,187 +112,72 @@ function LegacyI18nProvider(t0) {
138
112
  * }
139
113
  * ```
140
114
  */
141
- function AdminProvider(t0) {
142
- const $ = c(49);
143
- const { admin: adminInput, client, authClient, basePath: t1, realtime, navigate: navigateProp, initialUiLocale, initialContentLocale, i18nAdapter: customI18nAdapter, useServerTranslations: t2, translationsFallback, children } = t0;
144
- const basePath = t1 === void 0 ? "/admin" : t1;
145
- const useServerTranslations = t2 === void 0 ? false : t2;
146
- let t3;
147
- if ($[0] !== adminInput) {
148
- t3 = Admin.normalize(adminInput);
149
- $[0] = adminInput;
150
- $[1] = t3;
151
- } else t3 = $[1];
152
- const admin = t3;
153
- let t4;
154
- if ($[2] !== navigateProp) {
155
- t4 = (path) => {
156
- if (navigateProp) {
157
- navigateProp(path);
158
- return;
159
- }
160
- if (typeof window !== "undefined") window.location.href = path;
161
- };
162
- $[2] = navigateProp;
163
- $[3] = t4;
164
- } else t4 = $[3];
165
- const navigate = t4;
166
- let t5;
167
- if ($[4] !== admin) {
168
- t5 = admin.getLocale();
169
- $[4] = admin;
170
- $[5] = t5;
171
- } else t5 = $[5];
172
- const localeConfig = t5;
115
+ function AdminProvider({ admin: adminInput, client, authClient, basePath = "/admin", realtime, navigate: navigateProp, initialUiLocale, initialContentLocale, i18nAdapter: customI18nAdapter, useServerTranslations = false, translationsFallback, children }) {
116
+ const admin = useMemo(() => Admin.normalize(adminInput), [adminInput]);
117
+ const navigate = useCallback((path) => {
118
+ if (navigateProp) {
119
+ navigateProp(path);
120
+ return;
121
+ }
122
+ if (typeof window !== "undefined") window.location.href = path;
123
+ }, [navigateProp]);
124
+ const localeConfig = admin.getLocale();
173
125
  const defaultLocale = localeConfig.default ?? DEFAULT_LOCALE;
174
- let t6;
175
- if ($[6] !== defaultLocale || $[7] !== initialUiLocale || $[8] !== useServerTranslations) {
176
- t6 = useServerTranslations ? initialUiLocale ?? getUiLocaleFromCookie$1() ?? defaultLocale : initialUiLocale ?? getUiLocaleFromCookie() ?? defaultLocale;
177
- $[6] = defaultLocale;
178
- $[7] = initialUiLocale;
179
- $[8] = useServerTranslations;
180
- $[9] = t6;
181
- } else t6 = $[9];
182
- const resolvedUiLocale = t6;
183
- let t7;
184
- if ($[10] !== defaultLocale || $[11] !== initialContentLocale) {
185
- t7 = initialContentLocale ?? getContentLocaleFromCookie() ?? defaultLocale;
186
- $[10] = defaultLocale;
187
- $[11] = initialContentLocale;
188
- $[12] = t7;
189
- } else t7 = $[12];
190
- const resolvedContentLocale = t7;
191
- const t8 = typeof realtime === "boolean" ? realtime : realtime?.enabled ?? true;
192
- let t9;
193
- if ($[13] !== t8) {
194
- t9 = { enabled: t8 };
195
- $[13] = t8;
196
- $[14] = t9;
197
- } else t9 = $[14];
198
- const realtimeConfig = t9;
199
- let t10;
200
- if ($[15] !== admin || $[16] !== authClient || $[17] !== basePath || $[18] !== client || $[19] !== navigate || $[20] !== realtimeConfig || $[21] !== resolvedContentLocale) {
201
- t10 = () => createAdminStore({
202
- admin,
203
- client,
204
- authClient: authClient ?? null,
205
- basePath,
206
- navigate,
207
- realtime: realtimeConfig,
208
- initialContentLocale: resolvedContentLocale
209
- });
210
- $[15] = admin;
211
- $[16] = authClient;
212
- $[17] = basePath;
213
- $[18] = client;
214
- $[19] = navigate;
215
- $[20] = realtimeConfig;
216
- $[21] = resolvedContentLocale;
217
- $[22] = t10;
218
- } else t10 = $[22];
219
- const [store] = useState(t10);
220
- let t11;
221
- let t12;
222
- if ($[23] !== admin || $[24] !== authClient || $[25] !== basePath || $[26] !== client || $[27] !== navigate || $[28] !== realtimeConfig || $[29] !== store) {
223
- t11 = () => {
224
- const current = store.getState();
225
- const nextAuthClient = authClient ?? null;
226
- const patch = {};
227
- if (current.admin !== admin || current.basePath !== basePath) {
228
- patch.admin = admin;
229
- patch.basePath = basePath;
230
- patch.navigation = buildNavigation(admin, { basePath });
231
- }
232
- if (current.client !== client) patch.client = client;
233
- if (current.authClient !== nextAuthClient) patch.authClient = nextAuthClient;
234
- if (current.navigate !== navigate) patch.navigate = navigate;
235
- if (current.realtime.enabled !== realtimeConfig.enabled) patch.realtime = realtimeConfig;
236
- if (Object.keys(patch).length > 0) store.setState(patch);
237
- };
238
- t12 = [
239
- admin,
240
- basePath,
241
- realtimeConfig,
242
- client,
243
- authClient,
244
- navigate,
245
- store
246
- ];
247
- $[23] = admin;
248
- $[24] = authClient;
249
- $[25] = basePath;
250
- $[26] = client;
251
- $[27] = navigate;
252
- $[28] = realtimeConfig;
253
- $[29] = store;
254
- $[30] = t11;
255
- $[31] = t12;
256
- } else {
257
- t11 = $[30];
258
- t12 = $[31];
259
- }
260
- useEffect(t11, t12);
261
- const contentLocale = useStore(store, _temp);
262
- let t13;
263
- let t14;
264
- if ($[32] !== client || $[33] !== contentLocale) {
265
- t13 = () => {
266
- if (client && contentLocale && "setLocale" in client) client.setLocale(contentLocale);
267
- };
268
- t14 = [client, contentLocale];
269
- $[32] = client;
270
- $[33] = contentLocale;
271
- $[34] = t13;
272
- $[35] = t14;
273
- } else {
274
- t13 = $[34];
275
- t14 = $[35];
276
- }
277
- useEffect(t13, t14);
278
- let t15;
279
- if ($[36] !== admin || $[37] !== children || $[38] !== customI18nAdapter || $[39] !== defaultLocale || $[40] !== localeConfig || $[41] !== resolvedUiLocale || $[42] !== translationsFallback || $[43] !== useServerTranslations) {
280
- t15 = useServerTranslations ? /* @__PURE__ */ jsx(TranslationsProvider, {
281
- initialLocale: resolvedUiLocale,
282
- fallback: translationsFallback,
283
- children: /* @__PURE__ */ jsx(ContentLocalesProvider, { children })
284
- }) : /* @__PURE__ */ jsx(LegacyI18nProvider, {
285
- admin,
286
- locale: resolvedUiLocale,
287
- localeConfig,
288
- defaultLocale,
289
- customI18nAdapter,
290
- children
291
- });
292
- $[36] = admin;
293
- $[37] = children;
294
- $[38] = customI18nAdapter;
295
- $[39] = defaultLocale;
296
- $[40] = localeConfig;
297
- $[41] = resolvedUiLocale;
298
- $[42] = translationsFallback;
299
- $[43] = useServerTranslations;
300
- $[44] = t15;
301
- } else t15 = $[44];
302
- const i18nContent = t15;
303
- let t16;
304
- if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
305
- t16 = /* @__PURE__ */ jsx(BrandingSync, {});
306
- $[45] = t16;
307
- } else t16 = $[45];
308
- let t17;
309
- if ($[46] !== i18nContent || $[47] !== store) {
310
- t17 = /* @__PURE__ */ jsxs(AdminStoreContext.Provider, {
311
- value: store,
312
- children: [t16, i18nContent]
313
- });
314
- $[46] = i18nContent;
315
- $[47] = store;
316
- $[48] = t17;
317
- } else t17 = $[48];
318
- return t17;
319
- }
320
- function _temp(s) {
321
- return s.contentLocale;
126
+ const resolvedUiLocale = useServerTranslations ? initialUiLocale ?? getUiLocaleFromCookie$1() ?? defaultLocale : initialUiLocale ?? getUiLocaleFromCookie() ?? defaultLocale;
127
+ const resolvedContentLocale = initialContentLocale ?? getContentLocaleFromCookie() ?? defaultLocale;
128
+ const realtimeConfig = useMemo(() => ({ enabled: typeof realtime === "boolean" ? realtime : realtime?.enabled ?? true }), [realtime]);
129
+ const [store] = useState(() => createAdminStore({
130
+ admin,
131
+ client,
132
+ authClient: authClient ?? null,
133
+ basePath,
134
+ navigate,
135
+ realtime: realtimeConfig,
136
+ initialContentLocale: resolvedContentLocale
137
+ }));
138
+ useEffect(() => {
139
+ const current = store.getState();
140
+ const nextAuthClient = authClient ?? null;
141
+ const patch = {};
142
+ if (current.admin !== admin || current.basePath !== basePath) {
143
+ patch.admin = admin;
144
+ patch.basePath = basePath;
145
+ patch.navigation = buildNavigation(admin, { basePath });
146
+ }
147
+ if (current.client !== client) patch.client = client;
148
+ if (current.authClient !== nextAuthClient) patch.authClient = nextAuthClient;
149
+ if (current.navigate !== navigate) patch.navigate = navigate;
150
+ if (current.realtime.enabled !== realtimeConfig.enabled) patch.realtime = realtimeConfig;
151
+ if (Object.keys(patch).length > 0) store.setState(patch);
152
+ }, [
153
+ admin,
154
+ basePath,
155
+ realtimeConfig,
156
+ client,
157
+ authClient,
158
+ navigate,
159
+ store
160
+ ]);
161
+ const contentLocale = useStore(store, (s) => s.contentLocale);
162
+ useEffect(() => {
163
+ if (client && contentLocale && "setLocale" in client) client.setLocale(contentLocale);
164
+ }, [client, contentLocale]);
165
+ const i18nContent = useServerTranslations ? /* @__PURE__ */ jsx(TranslationsProvider, {
166
+ initialLocale: resolvedUiLocale,
167
+ fallback: translationsFallback,
168
+ children: /* @__PURE__ */ jsx(ContentLocalesProvider, { children })
169
+ }) : /* @__PURE__ */ jsx(LegacyI18nProvider, {
170
+ admin,
171
+ locale: resolvedUiLocale,
172
+ localeConfig,
173
+ defaultLocale,
174
+ customI18nAdapter,
175
+ children
176
+ });
177
+ return /* @__PURE__ */ jsxs(AdminStoreContext.Provider, {
178
+ value: store,
179
+ children: [/* @__PURE__ */ jsx(BrandingSync, {}), i18nContent]
180
+ });
322
181
  }
323
182
  function resolveBrandText(value, fallback) {
324
183
  if (typeof value === "string") return value;
@@ -343,39 +202,26 @@ function applyFavicon(href) {
343
202
  link.href = href;
344
203
  }
345
204
  function BrandingSync() {
346
- const $ = c(3);
347
205
  const store = useContext(AdminStoreContext);
348
- let t0;
349
- let t1;
350
- if ($[0] !== store) {
351
- t0 = () => {
352
- if (!store) return;
353
- const client = store.getState().client;
354
- if (!client || !client.routes?.getAdminConfig) return;
355
- client.routes.getAdminConfig().then((config) => {
356
- const branding = config?.branding;
357
- if (!branding) return;
358
- const next = {};
359
- if (branding.name !== void 0) next.brandName = resolveBrandText(branding.name, "Admin");
360
- if (branding.logo !== void 0) next.brandLogo = branding.logo ?? null;
361
- if (branding.tagline !== void 0) next.brandTagline = branding.tagline ? resolveBrandText(branding.tagline, "") : null;
362
- if (branding.favicon !== void 0) {
363
- const favicon = branding.favicon ?? null;
364
- next.brandFavicon = favicon;
365
- applyFavicon(favicon);
366
- }
367
- if (Object.keys(next).length > 0) store.setState(next);
368
- }).catch(_temp2);
369
- };
370
- t1 = [store];
371
- $[0] = store;
372
- $[1] = t0;
373
- $[2] = t1;
374
- } else {
375
- t0 = $[1];
376
- t1 = $[2];
377
- }
378
- useEffect(t0, t1);
206
+ useEffect(() => {
207
+ if (!store) return;
208
+ const client = store.getState().client;
209
+ if (!client || !client.routes?.getAdminConfig) return;
210
+ client.routes.getAdminConfig().then((config) => {
211
+ const branding = config?.branding;
212
+ if (!branding) return;
213
+ const next = {};
214
+ if (branding.name !== void 0) next.brandName = resolveBrandText(branding.name, "Admin");
215
+ if (branding.logo !== void 0) next.brandLogo = branding.logo ?? null;
216
+ if (branding.tagline !== void 0) next.brandTagline = branding.tagline ? resolveBrandText(branding.tagline, "") : null;
217
+ if (branding.favicon !== void 0) {
218
+ const favicon = branding.favicon ?? null;
219
+ next.brandFavicon = favicon;
220
+ applyFavicon(favicon);
221
+ }
222
+ if (Object.keys(next).length > 0) store.setState(next);
223
+ }).catch(() => {});
224
+ }, [store]);
379
225
  return null;
380
226
  }
381
227
  /**
@@ -396,7 +242,6 @@ function BrandingSync() {
396
242
  * const navigation = useAdminStore((s) => s.navigation);
397
243
  * ```
398
244
  */
399
- function _temp2() {}
400
245
  function useAdminStore(selector) {
401
246
  const store = useContext(AdminStoreContext);
402
247
  if (!store) throw new Error("useAdminStore must be used within AdminProvider. Wrap your app with <AdminProvider admin={admin} client={client}>");
@@ -2,8 +2,7 @@ import { I18nProvider } from "../i18n/hooks.mjs";
2
2
  import { createSimpleI18n } from "../i18n/simple.mjs";
3
3
  import { getCookie } from "../lib/cookies.mjs";
4
4
  import { selectClient, useAdminStore } from "./provider.mjs";
5
- import { c } from "react/compiler-runtime";
6
- import { Suspense, useState } from "react";
5
+ import { Suspense, useCallback, useMemo, useState } from "react";
7
6
  import { useSuspenseQuery } from "@tanstack/react-query";
8
7
  import { DEFAULT_LOCALE } from "questpie/shared";
9
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -107,80 +106,43 @@ function getAdminLocalesQueryOptions(client) {
107
106
  gcTime: Number.POSITIVE_INFINITY
108
107
  };
109
108
  }
110
- function TranslationsInner(t0) {
111
- const $ = c(14);
112
- const { initialLocale, children } = t0;
109
+ function TranslationsInner({ initialLocale, children }) {
113
110
  const client = useAdminStore(selectClient);
114
111
  const [locale, setLocaleState] = useState(initialLocale);
115
- let t1;
116
- if ($[0] !== client) {
117
- t1 = getAdminLocalesQueryOptions(client);
118
- $[0] = client;
119
- $[1] = t1;
120
- } else t1 = $[1];
121
- const { data: localesData } = useSuspenseQuery(t1);
122
- let t2;
123
- if ($[2] !== client || $[3] !== locale) {
124
- t2 = getAdminTranslationsQueryOptions(client, locale);
125
- $[2] = client;
126
- $[3] = locale;
127
- $[4] = t2;
128
- } else t2 = $[4];
129
- const { data: translationsData } = useSuspenseQuery(t2);
130
- let t3;
131
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
132
- t3 = (newLocale) => {
133
- setLocaleState(newLocale);
134
- setUiLocaleCookie(newLocale);
135
- };
136
- $[5] = t3;
137
- } else t3 = $[5];
138
- const setLocale = t3;
139
- let t4;
140
- if ($[6] !== localesData.locales || $[7] !== translationsData.fallbackLocale || $[8] !== translationsData.locale || $[9] !== translationsData.messages) {
141
- t4 = createSimpleI18n({
142
- locale: translationsData.locale,
143
- locales: localesData.locales,
144
- messages: { [translationsData.locale]: translationsData.messages },
145
- fallbackLocale: translationsData.fallbackLocale,
146
- onLocaleChange: setLocale
147
- });
148
- $[6] = localesData.locales;
149
- $[7] = translationsData.fallbackLocale;
150
- $[8] = translationsData.locale;
151
- $[9] = translationsData.messages;
152
- $[10] = t4;
153
- } else t4 = $[10];
154
- const i18nAdapter = t4;
155
- let t5;
156
- if ($[11] !== children || $[12] !== i18nAdapter) {
157
- t5 = /* @__PURE__ */ jsx(I18nProvider, {
158
- adapter: i18nAdapter,
159
- children
160
- });
161
- $[11] = children;
162
- $[12] = i18nAdapter;
163
- $[13] = t5;
164
- } else t5 = $[13];
165
- return t5;
112
+ const { data: localesData } = useSuspenseQuery(getAdminLocalesQueryOptions(client));
113
+ const { data: translationsData } = useSuspenseQuery(getAdminTranslationsQueryOptions(client, locale));
114
+ const setLocale = useCallback((newLocale) => {
115
+ setLocaleState(newLocale);
116
+ setUiLocaleCookie(newLocale);
117
+ }, []);
118
+ return /* @__PURE__ */ jsx(I18nProvider, {
119
+ adapter: useMemo(() => {
120
+ return createSimpleI18n({
121
+ locale: translationsData.locale,
122
+ locales: localesData.locales,
123
+ messages: { [translationsData.locale]: translationsData.messages },
124
+ fallbackLocale: translationsData.fallbackLocale,
125
+ onLocaleChange: setLocale
126
+ });
127
+ }, [
128
+ translationsData,
129
+ localesData.locales,
130
+ setLocale
131
+ ]),
132
+ children
133
+ });
166
134
  }
167
135
  function LoadingFallback() {
168
- const $ = c(1);
169
- let t0;
170
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
171
- t0 = /* @__PURE__ */ jsx("div", {
172
- className: "qp-flex qp-h-screen qp-w-screen qp-items-center qp-justify-center qp-bg-background",
173
- children: /* @__PURE__ */ jsxs("div", {
174
- className: "qp-flex qp-flex-col qp-items-center qp-gap-4",
175
- children: [/* @__PURE__ */ jsx("div", { className: "qp-h-8 qp-w-8 qp-animate-spin qp-rounded-full qp-border-4 qp-border-foreground qp-border-t-transparent" }), /* @__PURE__ */ jsx("span", {
176
- className: "qp-text-sm qp-text-muted-foreground",
177
- children: "Loading..."
178
- })]
179
- })
180
- });
181
- $[0] = t0;
182
- } else t0 = $[0];
183
- return t0;
136
+ return /* @__PURE__ */ jsx("div", {
137
+ className: "qp-flex qp-h-screen qp-w-screen qp-items-center qp-justify-center qp-bg-background",
138
+ children: /* @__PURE__ */ jsxs("div", {
139
+ className: "qp-flex qp-flex-col qp-items-center qp-gap-4",
140
+ children: [/* @__PURE__ */ jsx("div", { className: "qp-h-8 qp-w-8 qp-animate-spin qp-rounded-full qp-border-4 qp-border-foreground qp-border-t-transparent" }), /* @__PURE__ */ jsx("span", {
141
+ className: "qp-text-sm qp-text-muted-foreground",
142
+ children: "Loading..."
143
+ })]
144
+ })
145
+ });
184
146
  }
185
147
  /**
186
148
  * Translations Provider
@@ -199,43 +161,15 @@ function LoadingFallback() {
199
161
  * </AdminStoreContext.Provider>
200
162
  * ```
201
163
  */
202
- function TranslationsProvider(t0) {
203
- const $ = c(10);
204
- const { initialLocale, children, fallback } = t0;
205
- let t1;
206
- if ($[0] !== initialLocale) {
207
- t1 = initialLocale ?? getUiLocaleFromCookie() ?? DEFAULT_LOCALE;
208
- $[0] = initialLocale;
209
- $[1] = t1;
210
- } else t1 = $[1];
211
- const resolvedLocale = t1;
212
- let t2;
213
- if ($[2] !== fallback) {
214
- t2 = fallback ?? /* @__PURE__ */ jsx(LoadingFallback, {});
215
- $[2] = fallback;
216
- $[3] = t2;
217
- } else t2 = $[3];
218
- let t3;
219
- if ($[4] !== children || $[5] !== resolvedLocale) {
220
- t3 = /* @__PURE__ */ jsx(TranslationsInner, {
164
+ function TranslationsProvider({ initialLocale, children, fallback }) {
165
+ const resolvedLocale = initialLocale ?? getUiLocaleFromCookie() ?? DEFAULT_LOCALE;
166
+ return /* @__PURE__ */ jsx(Suspense, {
167
+ fallback: fallback ?? /* @__PURE__ */ jsx(LoadingFallback, {}),
168
+ children: /* @__PURE__ */ jsx(TranslationsInner, {
221
169
  initialLocale: resolvedLocale,
222
170
  children
223
- });
224
- $[4] = children;
225
- $[5] = resolvedLocale;
226
- $[6] = t3;
227
- } else t3 = $[6];
228
- let t4;
229
- if ($[7] !== t2 || $[8] !== t3) {
230
- t4 = /* @__PURE__ */ jsx(Suspense, {
231
- fallback: t2,
232
- children: t3
233
- });
234
- $[7] = t2;
235
- $[8] = t3;
236
- $[9] = t4;
237
- } else t4 = $[9];
238
- return t4;
171
+ })
172
+ });
239
173
  }
240
174
 
241
175
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { ScopePickerProps } from "./types.mjs";
2
- import * as react_jsx_runtime26 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime27 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/client/scope/picker.d.ts
5
5
 
@@ -48,6 +48,6 @@ declare function ScopePicker({
48
48
  clearText,
49
49
  className,
50
50
  compact
51
- }: ScopePickerProps): react_jsx_runtime26.JSX.Element;
51
+ }: ScopePickerProps): react_jsx_runtime27.JSX.Element;
52
52
  //#endregion
53
53
  export { ScopePicker };