@questpie/admin 3.2.3 → 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 (244) 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 +106 -220
  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 +107 -313
  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 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  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 +196 -530
  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 +39 -74
  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 +306 -611
  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 +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  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 +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -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.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. package/package.json +3 -5
@@ -1,6 +1,6 @@
1
1
  import { BlockContent } from "./types.mjs";
2
2
  import * as React from "react";
3
- import * as react_jsx_runtime19 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime25 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/client/blocks/block-renderer.d.ts
6
6
 
@@ -50,6 +50,6 @@ declare function BlockRenderer({
50
50
  onBlockClick,
51
51
  onBlockInsert,
52
52
  className
53
- }: BlockRendererProps): react_jsx_runtime19.JSX.Element | null;
53
+ }: BlockRendererProps): react_jsx_runtime25.JSX.Element | null;
54
54
  //#endregion
55
55
  export { BlockRenderer, BlockRendererProps };
@@ -1,6 +1,5 @@
1
1
  import { cn } from "../lib/utils.mjs";
2
2
  import { BlockScopeProvider } from "../preview/block-scope-context.mjs";
3
- import { c } from "react/compiler-runtime";
4
3
  import * as React from "react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
6
5
 
@@ -34,126 +33,85 @@ const EMPTY_DATA = {};
34
33
  * registered renderer component. Layout blocks receive their rendered
35
34
  * children as the `children` prop.
36
35
  */
37
- function BlockRenderer(t0) {
38
- const $ = c(13);
39
- const { content, renderers, data, selectedBlockId, onBlockClick, onBlockInsert, className } = t0;
36
+ function BlockRenderer({ content, renderers, data, selectedBlockId, onBlockClick, onBlockInsert, className }) {
40
37
  const resolvedData = data ?? EMPTY_DATA;
41
- let t1;
42
- let t2;
43
- let t3;
44
- if ($[0] !== className || $[1] !== content || $[2] !== onBlockClick || $[3] !== onBlockInsert || $[4] !== renderers || $[5] !== resolvedData || $[6] !== selectedBlockId) {
45
- t3 = Symbol.for("react.early_return_sentinel");
46
- bb0: {
47
- function renderBlock(node, parentId, index) {
48
- const renderFn = renderers[node.type] ?? renderers[kebabToCamelCase(node.type)];
49
- if (!renderFn) {
50
- if (process.env.NODE_ENV !== "production") console.warn(`[BlockRenderer] No renderer found for block type "${node.type}"`);
51
- return null;
52
- }
53
- const values = content._values[node.id] || {};
54
- const blockData = resolvedData[node.id];
55
- const isSelected = selectedBlockId === node.id;
56
- const renderedChildren = node.children.length > 0 ? node.children.map((child, childIndex) => renderBlock(child, node.id, childIndex)) : void 0;
57
- const blockElement = /* @__PURE__ */ jsx(renderFn, {
58
- id: node.id,
59
- type: node.type,
60
- values,
61
- data: blockData,
62
- children: renderedChildren
63
- });
64
- const scopedBlockElement = /* @__PURE__ */ jsx(BlockScopeProvider, {
65
- blockId: node.id,
66
- basePath: "content._values",
67
- children: blockElement
68
- });
69
- if (onBlockClick) return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(PreviewBlockWrapper, {
70
- id: node.id,
71
- isSelected,
72
- onBlockClick,
73
- type: node.type,
74
- children: scopedBlockElement
75
- }), onBlockInsert && /* @__PURE__ */ jsx(PreviewBlockInsertControl, {
76
- onBlockInsert,
77
- parentId,
78
- referenceBlockId: node.id,
79
- insertIndex: index + 1
80
- })] }, node.id);
81
- return /* @__PURE__ */ jsx("div", {
82
- "data-block-id": node.id,
83
- "data-block-type": node.type,
84
- children: scopedBlockElement
85
- }, node.id);
86
- }
87
- if (!content?._tree?.length) {
88
- t3 = null;
89
- break bb0;
90
- }
91
- t1 = className;
92
- t2 = content._tree.map((node_0, index_0) => renderBlock(node_0, null, index_0));
38
+ /**
39
+ * Recursively render a block node.
40
+ */
41
+ function renderBlock(node, parentId, index) {
42
+ const renderFn = renderers[node.type] ?? renderers[kebabToCamelCase(node.type)];
43
+ if (!renderFn) {
44
+ if (process.env.NODE_ENV !== "production") console.warn(`[BlockRenderer] No renderer found for block type "${node.type}"`);
45
+ return null;
93
46
  }
94
- $[0] = className;
95
- $[1] = content;
96
- $[2] = onBlockClick;
97
- $[3] = onBlockInsert;
98
- $[4] = renderers;
99
- $[5] = resolvedData;
100
- $[6] = selectedBlockId;
101
- $[7] = t1;
102
- $[8] = t2;
103
- $[9] = t3;
104
- } else {
105
- t1 = $[7];
106
- t2 = $[8];
107
- t3 = $[9];
108
- }
109
- if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
110
- let t4;
111
- if ($[10] !== t1 || $[11] !== t2) {
112
- t4 = /* @__PURE__ */ jsx("div", {
113
- className: t1,
114
- children: t2
47
+ const values = content._values[node.id] || {};
48
+ const blockData = resolvedData[node.id];
49
+ const isSelected = selectedBlockId === node.id;
50
+ const renderedChildren = node.children.length > 0 ? node.children.map((child, childIndex) => renderBlock(child, node.id, childIndex)) : void 0;
51
+ const blockElement = /* @__PURE__ */ jsx(renderFn, {
52
+ id: node.id,
53
+ type: node.type,
54
+ values,
55
+ data: blockData,
56
+ children: renderedChildren
57
+ });
58
+ const scopedBlockElement = /* @__PURE__ */ jsx(BlockScopeProvider, {
59
+ blockId: node.id,
60
+ basePath: "content._values",
61
+ children: blockElement
115
62
  });
116
- $[10] = t1;
117
- $[11] = t2;
118
- $[12] = t4;
119
- } else t4 = $[12];
120
- return t4;
63
+ if (onBlockClick) return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(PreviewBlockWrapper, {
64
+ id: node.id,
65
+ isSelected,
66
+ onBlockClick,
67
+ type: node.type,
68
+ children: scopedBlockElement
69
+ }), onBlockInsert && /* @__PURE__ */ jsx(PreviewBlockInsertControl, {
70
+ onBlockInsert,
71
+ parentId,
72
+ referenceBlockId: node.id,
73
+ insertIndex: index + 1
74
+ })] }, node.id);
75
+ return /* @__PURE__ */ jsx("div", {
76
+ "data-block-id": node.id,
77
+ "data-block-type": node.type,
78
+ children: scopedBlockElement
79
+ }, node.id);
80
+ }
81
+ if (!content?._tree?.length) return null;
82
+ return /* @__PURE__ */ jsx("div", {
83
+ className,
84
+ children: content._tree.map((node, index) => renderBlock(node, null, index))
85
+ });
121
86
  }
122
- function PreviewBlockInsertControl(t0) {
123
- const $ = c(29);
124
- const { insertIndex, onBlockInsert, parentId, referenceBlockId } = t0;
87
+ function PreviewBlockInsertControl({ insertIndex, onBlockInsert, parentId, referenceBlockId }) {
125
88
  const [isHovered, setIsHovered] = React.useState(false);
126
- let t1;
127
- if ($[0] !== insertIndex || $[1] !== onBlockInsert || $[2] !== parentId || $[3] !== referenceBlockId) {
128
- t1 = (event) => {
129
- event.preventDefault();
130
- event.stopPropagation();
131
- onBlockInsert({
132
- position: {
133
- parentId,
134
- index: insertIndex
135
- },
136
- referenceBlockId
137
- });
138
- };
139
- $[0] = insertIndex;
140
- $[1] = onBlockInsert;
141
- $[2] = parentId;
142
- $[3] = referenceBlockId;
143
- $[4] = t1;
144
- } else t1 = $[4];
145
- const handleInsert = t1;
146
- let t2;
147
- let t3;
148
- let t4;
149
- let t5;
150
- let t6;
151
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
152
- t2 = () => setIsHovered(true);
153
- t3 = () => setIsHovered(false);
154
- t4 = () => setIsHovered(true);
155
- t5 = () => setIsHovered(false);
156
- t6 = {
89
+ const previewRingColor = "var(--ring, var(--highlight, #b700ff))";
90
+ const softRingColor = `color-mix(in srgb, ${previewRingColor} 34%, transparent)`;
91
+ const mutedRingColor = `color-mix(in srgb, ${previewRingColor} 12%, transparent)`;
92
+ const handleInsert = React.useCallback((event) => {
93
+ event.preventDefault();
94
+ event.stopPropagation();
95
+ onBlockInsert({
96
+ position: {
97
+ parentId,
98
+ index: insertIndex
99
+ },
100
+ referenceBlockId
101
+ });
102
+ }, [
103
+ insertIndex,
104
+ onBlockInsert,
105
+ parentId,
106
+ referenceBlockId
107
+ ]);
108
+ return /* @__PURE__ */ jsxs("div", {
109
+ "data-preview-block-insert": "",
110
+ onMouseEnter: () => setIsHovered(true),
111
+ onMouseLeave: () => setIsHovered(false),
112
+ onFocus: () => setIsHovered(true),
113
+ onBlur: () => setIsHovered(false),
114
+ style: {
157
115
  alignItems: "center",
158
116
  display: "flex",
159
117
  height: 24,
@@ -163,250 +121,117 @@ function PreviewBlockInsertControl(t0) {
163
121
  pointerEvents: "auto",
164
122
  position: "relative",
165
123
  zIndex: 40
166
- };
167
- $[5] = t2;
168
- $[6] = t3;
169
- $[7] = t4;
170
- $[8] = t5;
171
- $[9] = t6;
172
- } else {
173
- t2 = $[5];
174
- t3 = $[6];
175
- t4 = $[7];
176
- t5 = $[8];
177
- t6 = $[9];
178
- }
179
- const t7 = isHovered ? .82 : 0;
180
- const t8 = isHovered ? "translateX(-50%) scaleX(1)" : "translateX(-50%) scaleX(0.58)";
181
- let t9;
182
- if ($[10] !== t7 || $[11] !== t8) {
183
- t9 = /* @__PURE__ */ jsx("span", {
124
+ },
125
+ children: [/* @__PURE__ */ jsx("span", {
184
126
  "aria-hidden": "true",
185
127
  style: {
186
- background: "linear-gradient(90deg, transparent, color-mix(in srgb, var(--ring, var(--highlight, #b700ff)) 34%, transparent), transparent)",
128
+ background: `linear-gradient(90deg, transparent, ${softRingColor}, transparent)`,
187
129
  height: 1,
188
130
  left: "50%",
189
- opacity: t7,
131
+ opacity: isHovered ? .82 : 0,
190
132
  position: "absolute",
191
- transform: t8,
133
+ transform: isHovered ? "translateX(-50%) scaleX(1)" : "translateX(-50%) scaleX(0.58)",
192
134
  transformOrigin: "center",
193
135
  transition: "opacity 140ms ease, transform 140ms ease",
194
136
  width: "min(240px, calc(100% - 48px))"
195
137
  }
196
- });
197
- $[10] = t7;
198
- $[11] = t8;
199
- $[12] = t9;
200
- } else t9 = $[12];
201
- let t10;
202
- if ($[13] !== handleInsert) {
203
- t10 = (event_0) => {
204
- if (event_0.key === "Enter" || event_0.key === " ") handleInsert(event_0);
205
- };
206
- $[13] = handleInsert;
207
- $[14] = t10;
208
- } else t10 = $[14];
209
- const t11 = isHovered ? 1 : .28;
210
- const t12 = isHovered ? "scale(1)" : "scale(0.92)";
211
- let t13;
212
- if ($[15] !== t11 || $[16] !== t12) {
213
- t13 = {
214
- alignItems: "center",
215
- background: "transparent",
216
- border: 0,
217
- borderRadius: 999,
218
- color: "var(--ring, var(--highlight, #b700ff))",
219
- cursor: "pointer",
220
- display: "inline-flex",
221
- height: 32,
222
- justifyContent: "center",
223
- lineHeight: 1,
224
- opacity: t11,
225
- outline: "none",
226
- padding: 0,
227
- pointerEvents: "auto",
228
- position: "relative",
229
- transition: "opacity 140ms ease, transform 140ms ease",
230
- transform: t12,
231
- width: 40
232
- };
233
- $[15] = t11;
234
- $[16] = t12;
235
- $[17] = t13;
236
- } else t13 = $[17];
237
- const t14 = `1px solid ${isHovered ? "color-mix(in srgb, var(--ring, var(--highlight, #b700ff)) 34%, transparent)" : "color-mix(in srgb, var(--ring, var(--highlight, #b700ff)) 12%, transparent)"}`;
238
- const t15 = isHovered ? "0 0 0 3px color-mix(in srgb, var(--ring, var(--highlight, #b700ff)) 8%, transparent), 0 5px 14px rgba(0, 0, 0, 0.12)" : "0 2px 8px rgba(0, 0, 0, 0.10)";
239
- let t16;
240
- if ($[18] !== t14 || $[19] !== t15) {
241
- t16 = /* @__PURE__ */ jsx("span", {
242
- "aria-hidden": "true",
138
+ }), /* @__PURE__ */ jsx("button", {
139
+ type: "button",
140
+ "aria-label": "Add block here",
141
+ onClick: handleInsert,
142
+ onKeyDown: (event) => {
143
+ if (event.key === "Enter" || event.key === " ") handleInsert(event);
144
+ },
243
145
  style: {
244
146
  alignItems: "center",
245
- background: "var(--background, #fff)",
246
- border: t14,
147
+ background: "transparent",
148
+ border: 0,
247
149
  borderRadius: 999,
248
- boxShadow: t15,
150
+ color: previewRingColor,
151
+ cursor: "pointer",
249
152
  display: "inline-flex",
250
- fontSize: 13,
251
- fontWeight: 500,
252
- height: 24,
153
+ height: 32,
253
154
  justifyContent: "center",
254
- transition: "border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease",
255
- width: 24
155
+ lineHeight: 1,
156
+ opacity: isHovered ? 1 : .28,
157
+ outline: "none",
158
+ padding: 0,
159
+ pointerEvents: "auto",
160
+ position: "relative",
161
+ transition: "opacity 140ms ease, transform 140ms ease",
162
+ transform: isHovered ? "scale(1)" : "scale(0.92)",
163
+ width: 40
256
164
  },
257
- children: "+"
258
- });
259
- $[18] = t14;
260
- $[19] = t15;
261
- $[20] = t16;
262
- } else t16 = $[20];
263
- let t17;
264
- if ($[21] !== handleInsert || $[22] !== t10 || $[23] !== t13 || $[24] !== t16) {
265
- t17 = /* @__PURE__ */ jsx("button", {
266
- type: "button",
267
- "aria-label": "Add block here",
268
- onClick: handleInsert,
269
- onKeyDown: t10,
270
- style: t13,
271
- children: t16
272
- });
273
- $[21] = handleInsert;
274
- $[22] = t10;
275
- $[23] = t13;
276
- $[24] = t16;
277
- $[25] = t17;
278
- } else t17 = $[25];
279
- let t18;
280
- if ($[26] !== t17 || $[27] !== t9) {
281
- t18 = /* @__PURE__ */ jsxs("div", {
282
- "data-preview-block-insert": "",
283
- onMouseEnter: t2,
284
- onMouseLeave: t3,
285
- onFocus: t4,
286
- onBlur: t5,
287
- style: t6,
288
- children: [t9, t17]
289
- });
290
- $[26] = t17;
291
- $[27] = t9;
292
- $[28] = t18;
293
- } else t18 = $[28];
294
- return t18;
165
+ children: /* @__PURE__ */ jsx("span", {
166
+ "aria-hidden": "true",
167
+ style: {
168
+ alignItems: "center",
169
+ background: "var(--background, #fff)",
170
+ border: `1px solid ${isHovered ? softRingColor : mutedRingColor}`,
171
+ borderRadius: 999,
172
+ boxShadow: isHovered ? `0 0 0 3px color-mix(in srgb, ${previewRingColor} 8%, transparent), 0 5px 14px rgba(0, 0, 0, 0.12)` : "0 2px 8px rgba(0, 0, 0, 0.10)",
173
+ display: "inline-flex",
174
+ fontSize: 13,
175
+ fontWeight: 500,
176
+ height: 24,
177
+ justifyContent: "center",
178
+ transition: "border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease",
179
+ width: 24
180
+ },
181
+ children: "+"
182
+ })
183
+ })]
184
+ });
295
185
  }
296
- function PreviewBlockWrapper(t0) {
297
- const $ = c(25);
298
- const { children, id, isSelected, onBlockClick, type } = t0;
186
+ function PreviewBlockWrapper({ children, id, isSelected, onBlockClick, type }) {
299
187
  const [isHovered, setIsHovered] = React.useState(false);
300
188
  const [hasDomFocus, setHasDomFocus] = React.useState(false);
301
- const t1 = isHovered || hasDomFocus || isSelected ? "var(--ring, var(--highlight, #b700ff))" : "transparent";
302
- const t2 = isSelected ? "solid" : "dashed";
303
- const t3 = isSelected ? "0 0 0 4px color-mix(in srgb, var(--ring, var(--highlight, #b700ff)) 18%, transparent)" : void 0;
304
- let t4;
305
- if ($[0] !== t1 || $[1] !== t2 || $[2] !== t3) {
306
- t4 = {
307
- outlineColor: t1,
308
- outlineOffset: "4px",
309
- outlineStyle: t2,
310
- outlineWidth: "2px",
311
- boxShadow: t3,
312
- cursor: "pointer",
313
- transition: "outline-color 150ms ease, box-shadow 150ms ease"
314
- };
315
- $[0] = t1;
316
- $[1] = t2;
317
- $[2] = t3;
318
- $[3] = t4;
319
- } else t4 = $[3];
320
- const previewStyle = t4;
321
- let t5;
322
- if ($[4] !== id || $[5] !== onBlockClick) {
323
- t5 = (e) => {
324
- const target = e.target;
325
- if (target?.closest("[data-preview-field]")) return;
326
- const closestBlock = target?.closest("[data-block-id]");
327
- if (closestBlock && closestBlock !== e.currentTarget) return;
189
+ const shouldShowAffordance = isHovered || hasDomFocus || isSelected;
190
+ const previewRingColor = "var(--ring, var(--highlight, #b700ff))";
191
+ const previewStyle = React.useMemo(() => ({
192
+ outlineColor: shouldShowAffordance ? previewRingColor : "transparent",
193
+ outlineOffset: "4px",
194
+ outlineStyle: isSelected ? "solid" : "dashed",
195
+ outlineWidth: "2px",
196
+ boxShadow: isSelected ? `0 0 0 4px color-mix(in srgb, ${previewRingColor} 18%, transparent)` : void 0,
197
+ cursor: "pointer",
198
+ transition: "outline-color 150ms ease, box-shadow 150ms ease"
199
+ }), [isSelected, shouldShowAffordance]);
200
+ const handleClick = React.useCallback((e) => {
201
+ const target = e.target;
202
+ if (target?.closest("[data-preview-field]")) return;
203
+ const closestBlock = target?.closest("[data-block-id]");
204
+ if (closestBlock && closestBlock !== e.currentTarget) return;
205
+ e.preventDefault();
206
+ e.stopPropagation();
207
+ onBlockClick(id);
208
+ }, [id, onBlockClick]);
209
+ const handleKeyDown = React.useCallback((e) => {
210
+ const target = e.target;
211
+ if (target?.closest("[data-preview-field]") || target?.closest("[data-block-id]") !== e.currentTarget) return;
212
+ if (e.key === "Enter" || e.key === " ") {
328
213
  e.preventDefault();
329
214
  e.stopPropagation();
330
215
  onBlockClick(id);
331
- };
332
- $[4] = id;
333
- $[5] = onBlockClick;
334
- $[6] = t5;
335
- } else t5 = $[6];
336
- const handleClick = t5;
337
- let t6;
338
- if ($[7] !== id || $[8] !== onBlockClick) {
339
- t6 = (e_0) => {
340
- const target_0 = e_0.target;
341
- if (target_0?.closest("[data-preview-field]") || target_0?.closest("[data-block-id]") !== e_0.currentTarget) return;
342
- if (e_0.key === "Enter" || e_0.key === " ") {
343
- e_0.preventDefault();
344
- e_0.stopPropagation();
345
- onBlockClick(id);
346
- }
347
- };
348
- $[7] = id;
349
- $[8] = onBlockClick;
350
- $[9] = t6;
351
- } else t6 = $[9];
352
- const handleKeyDown = t6;
353
- const t7 = isSelected ? "true" : void 0;
354
- let t10;
355
- let t11;
356
- let t8;
357
- let t9;
358
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
359
- t8 = () => setIsHovered(true);
360
- t9 = () => setIsHovered(false);
361
- t10 = () => setHasDomFocus(true);
362
- t11 = () => setHasDomFocus(false);
363
- $[10] = t10;
364
- $[11] = t11;
365
- $[12] = t8;
366
- $[13] = t9;
367
- } else {
368
- t10 = $[10];
369
- t11 = $[11];
370
- t8 = $[12];
371
- t9 = $[13];
372
- }
373
- const t12 = isSelected && "outline-primary shadow-primary/20 shadow-[0_0_0_4px] outline outline-2 outline-offset-4";
374
- let t13;
375
- if ($[14] !== t12) {
376
- t13 = cn("group/preview-block relative cursor-pointer transition-[outline-color,outline-offset,box-shadow] duration-150", "hover:outline-primary/40 hover:outline hover:outline-2 hover:outline-offset-4 hover:outline-dashed", t12);
377
- $[14] = t12;
378
- $[15] = t13;
379
- } else t13 = $[15];
380
- let t14;
381
- if ($[16] !== children || $[17] !== handleClick || $[18] !== handleKeyDown || $[19] !== id || $[20] !== previewStyle || $[21] !== t13 || $[22] !== t7 || $[23] !== type) {
382
- t14 = /* @__PURE__ */ jsx("div", {
383
- "data-block-id": id,
384
- "data-block-type": type,
385
- "data-preview-block": "",
386
- "data-preview-block-selected": t7,
387
- onClick: handleClick,
388
- onKeyDown: handleKeyDown,
389
- onMouseEnter: t8,
390
- onMouseLeave: t9,
391
- onFocus: t10,
392
- onBlur: t11,
393
- role: "button",
394
- tabIndex: 0,
395
- style: previewStyle,
396
- className: t13,
397
- children
398
- });
399
- $[16] = children;
400
- $[17] = handleClick;
401
- $[18] = handleKeyDown;
402
- $[19] = id;
403
- $[20] = previewStyle;
404
- $[21] = t13;
405
- $[22] = t7;
406
- $[23] = type;
407
- $[24] = t14;
408
- } else t14 = $[24];
409
- return t14;
216
+ }
217
+ }, [id, onBlockClick]);
218
+ return /* @__PURE__ */ jsx("div", {
219
+ "data-block-id": id,
220
+ "data-block-type": type,
221
+ "data-preview-block": "",
222
+ "data-preview-block-selected": isSelected ? "true" : void 0,
223
+ onClick: handleClick,
224
+ onKeyDown: handleKeyDown,
225
+ onMouseEnter: () => setIsHovered(true),
226
+ onMouseLeave: () => setIsHovered(false),
227
+ onFocus: () => setHasDomFocus(true),
228
+ onBlur: () => setHasDomFocus(false),
229
+ role: "button",
230
+ tabIndex: 0,
231
+ style: previewStyle,
232
+ className: cn("group/preview-block relative cursor-pointer transition-[outline-color,outline-offset,box-shadow] duration-150", "hover:outline-primary/40 hover:outline hover:outline-2 hover:outline-offset-4 hover:outline-dashed", isSelected && "outline-primary shadow-primary/20 shadow-[0_0_0_4px] outline outline-2 outline-offset-4"),
233
+ children
234
+ });
410
235
  }
411
236
  function kebabToCamelCase(value) {
412
237
  return value.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
@@ -40,8 +40,8 @@ function ActionButton({ action, collection, item, items, helpers, size = "defaul
40
40
  const [isLoading, setIsLoading] = React.useState(false);
41
41
  const actionQueryClient = React.useMemo(() => ({
42
42
  invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
43
- refetchQueries: (filters_0) => queryClient.refetchQueries(filters_0),
44
- resetQueries: (filters_1) => queryClient.resetQueries(filters_1)
43
+ refetchQueries: (filters) => queryClient.refetchQueries(filters),
44
+ resetQueries: (filters) => queryClient.resetQueries(filters)
45
45
  }), [queryClient]);
46
46
  const ctx = React.useMemo(() => ({
47
47
  item,
@@ -80,14 +80,14 @@ function ActionButton({ action, collection, item, items, helpers, size = "defaul
80
80
  case "api": {
81
81
  setIsLoading(true);
82
82
  const itemAny = item;
83
- const itemId_0 = itemAny != null ? String(itemAny.id) : "";
83
+ const itemId = itemAny != null ? String(itemAny.id) : "";
84
84
  const method = handler.method ? handler.method : "POST";
85
- const endpoint = handler.endpoint.replace("{id}", itemId_0);
85
+ const endpoint = handler.endpoint.replace("{id}", itemId);
86
86
  try {
87
87
  const collectionClient = client.collections?.[collection];
88
88
  if (method === "DELETE" && collectionClient?.delete) {
89
- if (!itemId_0) throw new Error(t("toast.deleteFailed"));
90
- await collectionClient.delete({ id: itemId_0 });
89
+ if (!itemId) throw new Error(t("toast.deleteFailed"));
90
+ await collectionClient.delete({ id: itemId });
91
91
  helpers.toast.success(t("toast.deleteSuccess"));
92
92
  await helpers.invalidateCollection(collection);
93
93
  } else {
@@ -95,8 +95,8 @@ function ActionButton({ action, collection, item, items, helpers, size = "defaul
95
95
  helpers.refresh();
96
96
  }
97
97
  setIsLoading(false);
98
- } catch (error_1) {
99
- helpers.toast.error(error_1 instanceof Error ? error_1.message : t("error.actionFailed"));
98
+ } catch (error) {
99
+ helpers.toast.error(error instanceof Error ? error.message : t("error.actionFailed"));
100
100
  setIsLoading(false);
101
101
  }
102
102
  break;
@@ -106,7 +106,7 @@ function ActionButton({ action, collection, item, items, helpers, size = "defaul
106
106
  try {
107
107
  await handler.fn(ctx);
108
108
  setIsLoading(false);
109
- } catch (error_0) {
109
+ } catch (error) {
110
110
  helpers.toast.error(t("error.actionFailed"));
111
111
  setIsLoading(false);
112
112
  }