@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
@@ -1,6 +1,5 @@
1
1
  import { cn } from "../../lib/utils.mjs";
2
2
  import { Skeleton } from "../ui/skeleton.mjs";
3
- import { c } from "react/compiler-runtime";
4
3
  import { jsx, jsxs } from "react/jsx-runtime";
5
4
 
6
5
  //#region src/client/components/auth/auth-loading.tsx
@@ -12,28 +11,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
12
11
  * <AuthLoading message="Checking authentication..." />
13
12
  * ```
14
13
  */
15
- function AuthLoading(t0) {
16
- const $ = c(10);
17
- const { className, message: t1, showMessage: t2 } = t0;
18
- const message = t1 === void 0 ? "Loading..." : t1;
19
- const showMessage = t2 === void 0 ? true : t2;
20
- let t3;
21
- if ($[0] !== className) {
22
- t3 = cn("flex min-h-screen flex-col items-center justify-center gap-4 px-6", className);
23
- $[0] = className;
24
- $[1] = t3;
25
- } else t3 = $[1];
26
- let t4;
27
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
28
- t4 = /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto size-12" });
29
- $[2] = t4;
30
- } else t4 = $[2];
31
- let t5;
32
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
33
- t5 = /* @__PURE__ */ jsxs("div", {
14
+ function AuthLoading({ className, message = "Loading...", showMessage = true }) {
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ className: cn("flex min-h-screen flex-col items-center justify-center gap-4 px-6", className),
17
+ "aria-busy": "true",
18
+ children: [/* @__PURE__ */ jsxs("div", {
34
19
  className: "w-full max-w-sm space-y-4",
35
20
  children: [
36
- t4,
21
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto size-12" }),
37
22
  /* @__PURE__ */ jsxs("div", {
38
23
  className: "space-y-2",
39
24
  children: [/* @__PURE__ */ jsx(Skeleton, {
@@ -46,32 +31,12 @@ function AuthLoading(t0) {
46
31
  }),
47
32
  /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })
48
33
  ]
49
- });
50
- $[3] = t5;
51
- } else t5 = $[3];
52
- let t6;
53
- if ($[4] !== message || $[5] !== showMessage) {
54
- t6 = showMessage && /* @__PURE__ */ jsx("p", {
34
+ }), showMessage && /* @__PURE__ */ jsx("p", {
55
35
  className: "text-muted-foreground text-sm",
56
36
  role: "status",
57
37
  children: message
58
- });
59
- $[4] = message;
60
- $[5] = showMessage;
61
- $[6] = t6;
62
- } else t6 = $[6];
63
- let t7;
64
- if ($[7] !== t3 || $[8] !== t6) {
65
- t7 = /* @__PURE__ */ jsxs("div", {
66
- className: t3,
67
- "aria-busy": "true",
68
- children: [t5, t6]
69
- });
70
- $[7] = t3;
71
- $[8] = t6;
72
- $[9] = t7;
73
- } else t7 = $[9];
74
- return t7;
38
+ })]
39
+ });
75
40
  }
76
41
 
77
42
  //#endregion
@@ -5,7 +5,6 @@ import { useBlockEditorActions, useBlockRegistry, useBlockTree } from "./block-e
5
5
  import { BlockIcon } from "./block-type-icon.mjs";
6
6
  import { findBlockById, findBlockPosition } from "./utils/tree-utils.mjs";
7
7
  import { BlockTree } from "./block-tree.mjs";
8
- import { c } from "react/compiler-runtime";
9
8
  import { Icon } from "@iconify/react";
10
9
  import * as React from "react";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -20,69 +19,38 @@ import { sortableKeyboardCoordinates } from "@dnd-kit/sortable";
20
19
  * Supports drag-and-drop reordering and inline field editing.
21
20
  */
22
21
  function BlockCanvas() {
23
- const $ = c(22);
24
22
  const actions = useBlockEditorActions();
25
23
  const tree = useBlockTree();
26
24
  const blocksByType = useBlockRegistry();
27
25
  const [activeId, setActiveId] = React.useState(null);
28
- let t0;
29
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
30
- t0 = { activationConstraint: { distance: 8 } };
31
- $[0] = t0;
32
- } else t0 = $[0];
33
- let t1;
34
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
35
- t1 = { coordinateGetter: sortableKeyboardCoordinates };
36
- $[1] = t1;
37
- } else t1 = $[1];
38
- const sensors = useSensors(useSensor(PointerSensor, t0), useSensor(KeyboardSensor, t1));
39
- let t2;
40
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
41
- t2 = (event) => {
42
- setActiveId(event.active.id);
43
- };
44
- $[2] = t2;
45
- } else t2 = $[2];
46
- const handleDragStart = t2;
47
- let t3;
48
- if ($[3] !== actions || $[4] !== tree) {
49
- t3 = (event_0) => {
50
- const { active, over } = event_0;
51
- setActiveId(null);
52
- if (!over || active.id === over.id) return;
53
- const draggedId = active.id;
54
- const overId = over.id;
55
- const activePosition = findBlockPosition(tree, draggedId);
56
- const overPosition = findBlockPosition(tree, overId);
57
- if (!activePosition || !overPosition) return;
58
- if (activePosition.parentId !== overPosition.parentId) return;
59
- actions.moveBlock(draggedId, activePosition.parentId, activePosition.index, overPosition.index);
60
- };
61
- $[3] = actions;
62
- $[4] = tree;
63
- $[5] = t3;
64
- } else t3 = $[5];
65
- const handleDragEnd = t3;
66
- let t4;
67
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
68
- t4 = () => {
69
- setActiveId(null);
70
- };
71
- $[6] = t4;
72
- } else t4 = $[6];
73
- const handleDragCancel = t4;
74
- let t5;
75
- if ($[7] !== activeId || $[8] !== tree) {
76
- t5 = activeId ? findBlockById(tree, activeId) : null;
77
- $[7] = activeId;
78
- $[8] = tree;
79
- $[9] = t5;
80
- } else t5 = $[9];
81
- const activeBlock = t5;
82
- const activeBlockSchema = activeBlock ? blocksByType[activeBlock.type] : null;
83
- let t6;
84
- if ($[10] !== tree) {
85
- t6 = /* @__PURE__ */ jsx(RenderProfiler, {
26
+ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 8 } }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
27
+ const handleDragStart = React.useCallback((event) => {
28
+ setActiveId(event.active.id);
29
+ }, []);
30
+ const handleDragEnd = React.useCallback((event) => {
31
+ const { active, over } = event;
32
+ setActiveId(null);
33
+ if (!over || active.id === over.id) return;
34
+ const draggedId = active.id;
35
+ const overId = over.id;
36
+ const activePosition = findBlockPosition(tree, draggedId);
37
+ const overPosition = findBlockPosition(tree, overId);
38
+ if (!activePosition || !overPosition) return;
39
+ if (activePosition.parentId !== overPosition.parentId) return;
40
+ actions.moveBlock(draggedId, activePosition.parentId, activePosition.index, overPosition.index);
41
+ }, [actions, tree]);
42
+ const handleDragCancel = React.useCallback(() => {
43
+ setActiveId(null);
44
+ }, []);
45
+ const activeBlock = React.useMemo(() => activeId ? findBlockById(tree, activeId) : null, [activeId, tree]);
46
+ const activeBlockSchema = React.useMemo(() => activeBlock ? blocksByType[activeBlock.type] : null, [activeBlock, blocksByType]);
47
+ return /* @__PURE__ */ jsxs(DndContext, {
48
+ sensors,
49
+ collisionDetection: closestCenter,
50
+ onDragStart: handleDragStart,
51
+ onDragEnd: handleDragEnd,
52
+ onDragCancel: handleDragCancel,
53
+ children: [/* @__PURE__ */ jsx(RenderProfiler, {
86
54
  id: "blocks.tree",
87
55
  minDurationMs: 8,
88
56
  children: /* @__PURE__ */ jsx(BlockTree, {
@@ -90,13 +58,7 @@ function BlockCanvas() {
90
58
  level: 0,
91
59
  parentId: null
92
60
  })
93
- });
94
- $[10] = tree;
95
- $[11] = t6;
96
- } else t6 = $[11];
97
- let t7;
98
- if ($[12] !== activeBlock || $[13] !== activeBlockSchema) {
99
- t7 = activeBlock && /* @__PURE__ */ jsxs("div", {
61
+ }), /* @__PURE__ */ jsx(DragOverlay, { children: activeBlock && /* @__PURE__ */ jsxs("div", {
100
62
  className: "bg-background flex items-center gap-2 border p-2 shadow-lg",
101
63
  children: [
102
64
  /* @__PURE__ */ jsx(Icon, {
@@ -113,34 +75,8 @@ function BlockCanvas() {
113
75
  children: getBlockLabel(activeBlockSchema, activeBlock.type)
114
76
  })
115
77
  ]
116
- });
117
- $[12] = activeBlock;
118
- $[13] = activeBlockSchema;
119
- $[14] = t7;
120
- } else t7 = $[14];
121
- let t8;
122
- if ($[15] !== t7) {
123
- t8 = /* @__PURE__ */ jsx(DragOverlay, { children: t7 });
124
- $[15] = t7;
125
- $[16] = t8;
126
- } else t8 = $[16];
127
- let t9;
128
- if ($[17] !== handleDragEnd || $[18] !== sensors || $[19] !== t6 || $[20] !== t8) {
129
- t9 = /* @__PURE__ */ jsxs(DndContext, {
130
- sensors,
131
- collisionDetection: closestCenter,
132
- onDragStart: handleDragStart,
133
- onDragEnd: handleDragEnd,
134
- onDragCancel: handleDragCancel,
135
- children: [t6, t8]
136
- });
137
- $[17] = handleDragEnd;
138
- $[18] = sensors;
139
- $[19] = t6;
140
- $[20] = t8;
141
- $[21] = t9;
142
- } else t9 = $[21];
143
- return t9;
78
+ }) })]
79
+ });
144
80
  }
145
81
  function getBlockLabel(blockSchema, type) {
146
82
  if (!blockSchema) return type.charAt(0).toUpperCase() + type.slice(1);
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
 
3
- import { c } from "react/compiler-runtime";
4
3
  import * as React from "react";
5
4
  import { useStore } from "zustand";
6
5
 
@@ -20,108 +19,65 @@ function useBlockEditorStore(selector) {
20
19
  if (!store) throw new Error("useBlockEditor must be used within BlockEditorProvider");
21
20
  return useStore(store, selector);
22
21
  }
22
+ /**
23
+ * Hook to access only block editor actions.
24
+ */
23
25
  function useBlockEditorActions() {
24
- return useBlockEditorStore(_temp2);
26
+ return useBlockEditorStore((state) => state.actions);
25
27
  }
26
28
  /**
27
29
  * Hook to access current block tree.
28
30
  */
29
- function _temp2(state) {
30
- return state.actions;
31
- }
32
31
  function useBlockTree() {
33
- return useBlockEditorStore(_temp3);
32
+ return useBlockEditorStore((state) => state.content._tree);
34
33
  }
35
34
  /**
36
35
  * Hook to access values for a specific block.
37
36
  */
38
- function _temp3(state) {
39
- return state.content._tree;
40
- }
41
37
  function useBlockValues(blockId) {
42
- const $ = c(2);
43
- let t0;
44
- if ($[0] !== blockId) {
45
- t0 = (state) => state.content._values[blockId];
46
- $[0] = blockId;
47
- $[1] = t0;
48
- } else t0 = $[1];
49
- return useBlockEditorStore(t0);
38
+ return useBlockEditorStore((state) => state.content._values[blockId]);
50
39
  }
51
40
  /**
52
41
  * Hook to access registered block definitions.
53
42
  */
54
43
  function useBlockRegistry() {
55
- return useBlockEditorStore(_temp4);
44
+ return useBlockEditorStore((state) => state.blocks);
56
45
  }
57
46
  /**
58
47
  * Hook to access allowed block type filter.
59
48
  */
60
- function _temp4(state) {
61
- return state.blocks;
62
- }
63
49
  function useAllowedBlockTypes() {
64
- return useBlockEditorStore(_temp5);
50
+ return useBlockEditorStore((state) => state.allowedBlocks);
65
51
  }
66
52
  /**
67
53
  * Hook to access current insert position.
68
54
  */
69
- function _temp5(state) {
70
- return state.allowedBlocks;
71
- }
72
55
  function useBlockInsertPosition() {
73
- return useBlockEditorStore(_temp6);
56
+ return useBlockEditorStore((state) => state.insertPosition);
74
57
  }
75
58
  /**
76
59
  * Hook to check if block library is open.
77
60
  */
78
- function _temp6(state) {
79
- return state.insertPosition;
80
- }
81
61
  function useBlockLibraryOpen() {
82
- return useBlockEditorStore(_temp7);
62
+ return useBlockEditorStore((state) => state.isLibraryOpen);
83
63
  }
84
64
  /**
85
65
  * Hook to check if a block is selected.
86
66
  */
87
- function _temp7(state) {
88
- return state.isLibraryOpen;
89
- }
90
67
  function useIsBlockSelected(blockId) {
91
- const $ = c(2);
92
- let t0;
93
- if ($[0] !== blockId) {
94
- t0 = (state) => state.selectedBlockId === blockId;
95
- $[0] = blockId;
96
- $[1] = t0;
97
- } else t0 = $[1];
98
- return useBlockEditorStore(t0);
68
+ return useBlockEditorStore((state) => state.selectedBlockId === blockId);
99
69
  }
100
70
  /**
101
71
  * Hook to check if a block is expanded.
102
72
  */
103
73
  function useIsBlockExpanded(blockId) {
104
- const $ = c(2);
105
- let t0;
106
- if ($[0] !== blockId) {
107
- t0 = (state) => state.expandedBlockIds.has(blockId);
108
- $[0] = blockId;
109
- $[1] = t0;
110
- } else t0 = $[1];
111
- return useBlockEditorStore(t0);
74
+ return useBlockEditorStore((state) => state.expandedBlockIds.has(blockId));
112
75
  }
113
76
  /**
114
77
  * Hook to get a block schema by type.
115
78
  */
116
79
  function useBlockSchema(blockType) {
117
- const $ = c(2);
118
- let t0;
119
- if ($[0] !== blockType) {
120
- t0 = (state) => state.blocks[blockType];
121
- $[0] = blockType;
122
- $[1] = t0;
123
- } else t0 = $[1];
124
- return useBlockEditorStore(t0);
80
+ return useBlockEditorStore((state) => state.blocks[blockType]);
125
81
  }
126
82
  /**
127
83
  * Hook to get a block schema by type.
@@ -8,7 +8,6 @@ import { RenderProfiler } from "../../lib/render-profiler.mjs";
8
8
  import { useBlockEditorActions, useBlockLibraryOpen, useBlockTree } from "./block-editor-context.mjs";
9
9
  import { BlockCanvas } from "./block-canvas.mjs";
10
10
  import { BlockLibrarySidebar } from "./block-library-sidebar.mjs";
11
- import { c } from "react/compiler-runtime";
12
11
  import { Icon } from "@iconify/react";
13
12
  import * as React from "react";
14
13
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -20,179 +19,86 @@ import { jsx, jsxs } from "react/jsx-runtime";
20
19
  * Main layout for the block editor with inline editable blocks.
21
20
  * Uses a scrollable container with FAB for adding blocks.
22
21
  */
23
- function BlockEditorLayout(t0) {
24
- const $ = c(31);
25
- const { className, minHeight: t1 } = t0;
26
- const minHeight = t1 === void 0 ? 500 : t1;
22
+ function BlockEditorLayout({ className, minHeight = 500 }) {
27
23
  const { t } = useTranslation();
28
24
  const actions = useBlockEditorActions();
29
25
  const tree = useBlockTree();
30
26
  const isLibraryOpen = useBlockLibraryOpen();
31
- let t2;
32
- let t3;
33
- if ($[0] !== isLibraryOpen) {
34
- t2 = () => {
35
- const url = new URL(window.location.href);
36
- if (isLibraryOpen) url.searchParams.set("sidebar", "block-library");
37
- else if (url.searchParams.get("sidebar") === "block-library") url.searchParams.delete("sidebar");
38
- window.history.replaceState({}, "", url.toString());
39
- window.dispatchEvent(new Event(SEARCH_PARAMS_EVENT));
40
- };
41
- t3 = [isLibraryOpen];
42
- $[0] = isLibraryOpen;
43
- $[1] = t2;
44
- $[2] = t3;
45
- } else {
46
- t2 = $[1];
47
- t3 = $[2];
48
- }
49
- React.useEffect(t2, t3);
27
+ React.useEffect(() => {
28
+ const url = new URL(window.location.href);
29
+ if (isLibraryOpen) url.searchParams.set("sidebar", "block-library");
30
+ else if (url.searchParams.get("sidebar") === "block-library") url.searchParams.delete("sidebar");
31
+ window.history.replaceState({}, "", url.toString());
32
+ window.dispatchEvent(new Event(SEARCH_PARAMS_EVENT));
33
+ }, [isLibraryOpen]);
50
34
  const treeLengthRef = React.useRef(tree.length);
51
- let t4;
52
- let t5;
53
- if ($[3] !== tree.length) {
54
- t4 = () => {
55
- treeLengthRef.current = tree.length;
56
- };
57
- t5 = [tree.length];
58
- $[3] = tree.length;
59
- $[4] = t4;
60
- $[5] = t5;
61
- } else {
62
- t4 = $[4];
63
- t5 = $[5];
64
- }
65
- React.useEffect(t4, t5);
66
- let t6;
67
- let t7;
68
- if ($[6] !== actions) {
69
- t6 = () => {
70
- if (new URLSearchParams(window.location.search).get("sidebar") === "block-library") actions.openLibrary({
71
- parentId: null,
72
- index: treeLengthRef.current
73
- });
74
- };
75
- t7 = [actions];
76
- $[6] = actions;
77
- $[7] = t6;
78
- $[8] = t7;
79
- } else {
80
- t6 = $[7];
81
- t7 = $[8];
82
- }
83
- React.useEffect(t6, t7);
84
- let t8;
85
- if ($[9] !== actions || $[10] !== tree.length) {
86
- t8 = () => {
87
- actions.openLibrary({
88
- parentId: null,
89
- index: tree.length
90
- });
91
- };
92
- $[9] = actions;
93
- $[10] = tree.length;
94
- $[11] = t8;
95
- } else t8 = $[11];
96
- const handleOpenSidebar = t8;
97
- let t9;
98
- if ($[12] !== actions) {
99
- t9 = () => {
100
- actions.closeLibrary();
101
- };
102
- $[12] = actions;
103
- $[13] = t9;
104
- } else t9 = $[13];
105
- const handleCloseSidebar = t9;
106
- const hasBlocks = tree.length > 0;
107
- let t10;
108
- if ($[14] !== className) {
109
- t10 = cn("qa-block-editor relative flex flex-col", className);
110
- $[14] = className;
111
- $[15] = t10;
112
- } else t10 = $[15];
113
- let t11;
114
- if ($[16] !== minHeight) {
115
- t11 = { minHeight };
116
- $[16] = minHeight;
117
- $[17] = t11;
118
- } else t11 = $[17];
119
- let t12;
120
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
121
- t12 = /* @__PURE__ */ jsx(RenderProfiler, {
122
- id: "blocks.canvas",
123
- minDurationMs: 8,
124
- children: /* @__PURE__ */ jsx(BlockCanvas, {})
35
+ React.useEffect(() => {
36
+ treeLengthRef.current = tree.length;
37
+ }, [tree.length]);
38
+ React.useEffect(() => {
39
+ if (new URLSearchParams(window.location.search).get("sidebar") === "block-library") actions.openLibrary({
40
+ parentId: null,
41
+ index: treeLengthRef.current
125
42
  });
126
- $[18] = t12;
127
- } else t12 = $[18];
128
- let t13;
129
- if ($[19] !== handleOpenSidebar || $[20] !== hasBlocks || $[21] !== t) {
130
- t13 = !hasBlocks && /* @__PURE__ */ jsxs("div", {
131
- className: "py-8 text-center",
132
- children: [/* @__PURE__ */ jsxs("div", {
133
- className: "text-muted-foreground",
134
- children: [
135
- /* @__PURE__ */ jsx(Icon, {
136
- icon: "ph:stack",
137
- className: "text-muted-foreground/30 mx-auto mb-4 h-12 w-12"
138
- }),
139
- /* @__PURE__ */ jsx("p", {
140
- className: "text-sm font-medium",
141
- children: t("blocks.emptyTitle")
142
- }),
143
- /* @__PURE__ */ jsx("p", {
144
- className: "text-muted-foreground mt-1 text-xs",
145
- children: t("blocks.addFirst")
146
- })
147
- ]
148
- }), /* @__PURE__ */ jsxs(Button, {
149
- variant: "outline",
150
- size: "sm",
151
- className: "mt-4",
152
- onClick: handleOpenSidebar,
153
- children: [/* @__PURE__ */ jsx(Icon, {
154
- icon: "ph:plus",
155
- className: "mr-2 h-4 w-4"
156
- }), t("blocks.add")]
157
- })]
43
+ }, [actions]);
44
+ const handleOpenSidebar = () => {
45
+ actions.openLibrary({
46
+ parentId: null,
47
+ index: tree.length
158
48
  });
159
- $[19] = handleOpenSidebar;
160
- $[20] = hasBlocks;
161
- $[21] = t;
162
- $[22] = t13;
163
- } else t13 = $[22];
164
- let t14;
165
- if ($[23] !== handleCloseSidebar || $[24] !== isLibraryOpen) {
166
- t14 = isLibraryOpen && /* @__PURE__ */ jsx(RenderProfiler, {
167
- id: "blocks.library",
168
- minDurationMs: 8,
169
- children: /* @__PURE__ */ jsx(BlockLibrarySidebar, {
170
- open: isLibraryOpen,
171
- onClose: handleCloseSidebar
49
+ };
50
+ const handleCloseSidebar = () => {
51
+ actions.closeLibrary();
52
+ };
53
+ const hasBlocks = tree.length > 0;
54
+ return /* @__PURE__ */ jsxs("div", {
55
+ className: cn("qa-block-editor relative flex flex-col", className),
56
+ style: { minHeight },
57
+ children: [
58
+ /* @__PURE__ */ jsx(RenderProfiler, {
59
+ id: "blocks.canvas",
60
+ minDurationMs: 8,
61
+ children: /* @__PURE__ */ jsx(BlockCanvas, {})
62
+ }),
63
+ !hasBlocks && /* @__PURE__ */ jsxs("div", {
64
+ className: "py-8 text-center",
65
+ children: [/* @__PURE__ */ jsxs("div", {
66
+ className: "text-muted-foreground",
67
+ children: [
68
+ /* @__PURE__ */ jsx(Icon, {
69
+ icon: "ph:stack",
70
+ className: "text-muted-foreground/30 mx-auto mb-4 h-12 w-12"
71
+ }),
72
+ /* @__PURE__ */ jsx("p", {
73
+ className: "text-sm font-medium",
74
+ children: t("blocks.emptyTitle")
75
+ }),
76
+ /* @__PURE__ */ jsx("p", {
77
+ className: "text-muted-foreground mt-1 text-xs",
78
+ children: t("blocks.addFirst")
79
+ })
80
+ ]
81
+ }), /* @__PURE__ */ jsxs(Button, {
82
+ variant: "outline",
83
+ size: "sm",
84
+ className: "mt-4",
85
+ onClick: handleOpenSidebar,
86
+ children: [/* @__PURE__ */ jsx(Icon, {
87
+ icon: "ph:plus",
88
+ className: "mr-2 h-4 w-4"
89
+ }), t("blocks.add")]
90
+ })]
91
+ }),
92
+ isLibraryOpen && /* @__PURE__ */ jsx(RenderProfiler, {
93
+ id: "blocks.library",
94
+ minDurationMs: 8,
95
+ children: /* @__PURE__ */ jsx(BlockLibrarySidebar, {
96
+ open: isLibraryOpen,
97
+ onClose: handleCloseSidebar
98
+ })
172
99
  })
173
- });
174
- $[23] = handleCloseSidebar;
175
- $[24] = isLibraryOpen;
176
- $[25] = t14;
177
- } else t14 = $[25];
178
- let t15;
179
- if ($[26] !== t10 || $[27] !== t11 || $[28] !== t13 || $[29] !== t14) {
180
- t15 = /* @__PURE__ */ jsxs("div", {
181
- className: t10,
182
- style: t11,
183
- children: [
184
- t12,
185
- t13,
186
- t14
187
- ]
188
- });
189
- $[26] = t10;
190
- $[27] = t11;
191
- $[28] = t13;
192
- $[29] = t14;
193
- $[30] = t15;
194
- } else t15 = $[30];
195
- return t15;
100
+ ]
101
+ });
196
102
  }
197
103
 
198
104
  //#endregion