@questpie/admin 3.2.0 → 3.2.2

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 (86) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +12 -2
  2. package/dist/client/blocks/block-renderer.mjs +357 -49
  3. package/dist/client/components/blocks/block-editor-context.mjs +11 -1
  4. package/dist/client/components/blocks/block-editor-provider.mjs +68 -26
  5. package/dist/client/components/blocks/block-item.mjs +181 -170
  6. package/dist/client/components/blocks/utils/tree-utils.mjs +13 -1
  7. package/dist/client/components/fields/array-field.mjs +177 -118
  8. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +305 -310
  9. package/dist/client/components/filter-builder/filters-tab.mjs +1 -1
  10. package/dist/client/components/history-sidebar.mjs +121 -114
  11. package/dist/client/components/preview/live-preview-mode.mjs +210 -175
  12. package/dist/client/components/preview/preview-pane.mjs +288 -333
  13. package/dist/client/components/primitives/option-label.mjs +44 -0
  14. package/dist/client/components/primitives/select-multi.mjs +408 -383
  15. package/dist/client/components/primitives/select-single.mjs +387 -357
  16. package/dist/client/components/widgets/chart-widget.mjs +168 -143
  17. package/dist/client/contexts/focus-context.d.mts +16 -1
  18. package/dist/client/contexts/focus-context.mjs +90 -38
  19. package/dist/client/hooks/use-brand.mjs +2 -1
  20. package/dist/client/preview/block-scope-context.d.mts +2 -2
  21. package/dist/client/preview/block-scope-context.mjs +10 -20
  22. package/dist/client/preview/index.d.mts +1 -1
  23. package/dist/client/preview/patch.mjs +100 -0
  24. package/dist/client/preview/preview-banner.d.mts +2 -2
  25. package/dist/client/preview/preview-field.d.mts +34 -5
  26. package/dist/client/preview/preview-field.mjs +385 -118
  27. package/dist/client/preview/types.d.mts +82 -3
  28. package/dist/client/preview/types.mjs +85 -6
  29. package/dist/client/preview/use-collection-preview.d.mts +19 -1
  30. package/dist/client/preview/use-collection-preview.mjs +182 -58
  31. package/dist/client/runtime/index.d.mts +2 -2
  32. package/dist/client/runtime/index.mjs +2 -2
  33. package/dist/client/runtime/provider.d.mts +5 -5
  34. package/dist/client/utils/build-field-definitions-from-schema.mjs +8 -3
  35. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  36. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  37. package/dist/client/views/auth/login-form.d.mts +2 -2
  38. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  39. package/dist/client/views/auth/setup-form.d.mts +2 -2
  40. package/dist/client/views/collection/bulk-action-toolbar.mjs +23 -25
  41. package/dist/client/views/collection/cells/primitive-cells.mjs +63 -13
  42. package/dist/client/views/collection/columns/build-columns.mjs +1 -0
  43. package/dist/client/views/collection/form-view.mjs +262 -33
  44. package/dist/client/views/collection/table-view.mjs +16 -11
  45. package/dist/client/views/layout/admin-layout-provider.d.mts +5 -5
  46. package/dist/client/views/layout/admin-layout-provider.mjs +107 -16
  47. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  48. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  49. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  50. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  51. package/dist/client/views/pages/setup-page.d.mts +2 -2
  52. package/dist/client.d.mts +2 -2
  53. package/dist/client.mjs +1 -1
  54. package/dist/index.d.mts +2 -2
  55. package/dist/index.mjs +1 -1
  56. package/dist/server/augmentation/common.d.mts +8 -4
  57. package/dist/server/augmentation/form-layout.d.mts +1 -1
  58. package/dist/server/i18n/messages/cs.mjs +11 -0
  59. package/dist/server/i18n/messages/de.mjs +11 -0
  60. package/dist/server/i18n/messages/en.mjs +11 -0
  61. package/dist/server/i18n/messages/es.mjs +11 -0
  62. package/dist/server/i18n/messages/fr.mjs +11 -0
  63. package/dist/server/i18n/messages/pl.mjs +11 -0
  64. package/dist/server/i18n/messages/pt.mjs +11 -0
  65. package/dist/server/i18n/messages/sk.mjs +11 -0
  66. package/dist/server/modules/admin/block/block-builder.d.mts +7 -10
  67. package/dist/server/modules/admin/block/block-builder.mjs +7 -10
  68. package/dist/server/modules/admin/collections/apikey.d.mts +64 -64
  69. package/dist/server/modules/admin/collections/assets.d.mts +57 -20
  70. package/dist/server/modules/admin/collections/session.d.mts +38 -38
  71. package/dist/server/modules/admin/collections/user.d.mts +100 -34
  72. package/dist/server/modules/admin/collections/user.mjs +4 -4
  73. package/dist/server/modules/admin/collections/verification.d.mts +31 -31
  74. package/dist/server/modules/admin/index.d.mts +3 -3
  75. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  76. package/dist/server/modules/admin/routes/admin-config.mjs +9 -12
  77. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  78. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  79. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  80. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  81. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  82. package/dist/server/modules/admin/routes/translations.mjs +1 -1
  83. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +4 -6
  84. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +4 -6
  85. package/dist/server/modules/admin-preferences/collections/saved-views.mjs +4 -6
  86. package/package.json +3 -3
@@ -4,8 +4,8 @@ import { useTranslation } from "../../i18n/hooks.mjs";
4
4
  import { cn } from "../../lib/utils.mjs";
5
5
  import { Button } from "../ui/button.mjs";
6
6
  import { Tabs, TabsList, TabsTrigger } from "../ui/tabs.mjs";
7
+ import { FocusProvider, parsePreviewFieldPath, scheduleScrollFieldIntoView, useFocus } from "../../contexts/focus-context.mjs";
7
8
  import { useIsMobile } from "../../hooks/use-media-query.mjs";
8
- import { FocusProvider, parsePreviewFieldPath, scrollFieldIntoView, useFocus } from "../../contexts/focus-context.mjs";
9
9
  import { PreviewPane } from "./preview-pane.mjs";
10
10
  import { c } from "react/compiler-runtime";
11
11
  import { Icon } from "@iconify/react";
@@ -22,6 +22,11 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
22
  * Mobile: Tabs to switch between form and preview
23
23
  */
24
24
  const DEV_TELEMETRY = process.env.NODE_ENV === "development";
25
+ function getFocusStatePath(state) {
26
+ if (state.type === "field" || state.type === "relation") return state.fieldPath;
27
+ if (state.type === "block") return state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`;
28
+ return null;
29
+ }
25
30
  function useResizablePane(t0, t1, t2) {
26
31
  const $ = c(9);
27
32
  const defaultSize = t0 === void 0 ? 50 : t0;
@@ -126,8 +131,8 @@ function useLivePreviewRenderTelemetry(t0) {
126
131
  React.useEffect(t1);
127
132
  }
128
133
  function LivePreviewContent(t0) {
129
- const $ = c(68);
130
- const { open, onClose, children, previewUrl, previewRef, defaultSize: t1, minSize: t2 } = t0;
134
+ const $ = c(79);
135
+ const { open, children, previewUrl, previewRef, onFieldValueEdited, onPatchApplied, onResyncRequest, defaultSize: t1, minSize: t2 } = t0;
131
136
  const defaultSize = t1 === void 0 ? 50 : t1;
132
137
  const minSize = t2 === void 0 ? 30 : t2;
133
138
  const { t } = useTranslation();
@@ -149,29 +154,40 @@ function LivePreviewContent(t0) {
149
154
  const { previewPercent, containerRef, handleMouseDown } = useResizablePane(defaultSize, minSize, open && !isMobile);
150
155
  const focusContext = useFocus();
151
156
  const focusState = focusContext.state;
152
- const handleExitPreview = _temp;
153
157
  let t4;
158
+ if ($[4] !== focusContext) {
159
+ t4 = (state) => {
160
+ if (state.type === "field") focusContext.focusField(state.fieldPath);
161
+ else if (state.type === "block") focusContext.focusBlock(state.blockId, state.fieldPath);
162
+ else if (state.type === "relation") focusContext.focusRelation(state.fieldPath, state.targetCollection);
163
+ };
164
+ $[4] = focusContext;
165
+ $[5] = t4;
166
+ } else t4 = $[5];
167
+ const applyFocusState = t4;
168
+ const handleExitPreview = _temp;
154
169
  let t5;
155
- if ($[4] !== open) {
156
- t4 = () => {
170
+ let t6;
171
+ if ($[6] !== open) {
172
+ t5 = () => {
157
173
  if (!open) setActiveTab("form");
158
174
  };
159
- t5 = [open];
160
- $[4] = open;
161
- $[5] = t4;
162
- $[6] = t5;
175
+ t6 = [open];
176
+ $[6] = open;
177
+ $[7] = t5;
178
+ $[8] = t6;
163
179
  } else {
164
- t4 = $[5];
165
- t5 = $[6];
180
+ t5 = $[7];
181
+ t6 = $[8];
166
182
  }
167
- React.useEffect(t4, t5);
168
- let t6;
183
+ React.useEffect(t5, t6);
169
184
  let t7;
170
- if ($[7] !== focusState || $[8] !== open || $[9] !== previewRef) {
171
- t6 = () => {
185
+ let t8;
186
+ if ($[9] !== focusState || $[10] !== open || $[11] !== previewRef) {
187
+ t7 = () => {
172
188
  if (!open) return;
173
189
  if (!previewRef.current) return;
174
- if (focusState.type === "field") previewRef.current.sendFocusToPreview(focusState.fieldPath);
190
+ if (focusState.type === "field" || focusState.type === "relation") previewRef.current.sendFocusToPreview(focusState.fieldPath);
175
191
  else if (focusState.type === "block") if (focusState.fieldPath) {
176
192
  const fullPath = `content._values.${focusState.blockId}.${focusState.fieldPath}`;
177
193
  previewRef.current.sendFocusToPreview(fullPath);
@@ -180,25 +196,25 @@ function LivePreviewContent(t0) {
180
196
  previewRef.current.sendFocusToPreview(fullPath_0);
181
197
  }
182
198
  };
183
- t7 = [
199
+ t8 = [
184
200
  focusState,
185
201
  previewRef,
186
202
  open
187
203
  ];
188
- $[7] = focusState;
189
- $[8] = open;
190
- $[9] = previewRef;
191
- $[10] = t6;
192
- $[11] = t7;
204
+ $[9] = focusState;
205
+ $[10] = open;
206
+ $[11] = previewRef;
207
+ $[12] = t7;
208
+ $[13] = t8;
193
209
  } else {
194
- t6 = $[10];
195
- t7 = $[11];
210
+ t7 = $[12];
211
+ t8 = $[13];
196
212
  }
197
- React.useEffect(t6, t7);
198
- let t8;
213
+ React.useEffect(t7, t8);
214
+ let t10;
199
215
  let t9;
200
- if ($[12] !== focusContext || $[13] !== focusState || $[14] !== open) {
201
- t8 = () => {
216
+ if ($[14] !== applyFocusState || $[15] !== focusState || $[16] !== open) {
217
+ t9 = () => {
202
218
  if (!open) return;
203
219
  const handleKeyDown = (e) => {
204
220
  if (e.key !== "Tab") return;
@@ -208,57 +224,63 @@ function LivePreviewContent(t0) {
208
224
  if (fields.length === 0) return;
209
225
  if (!formScope.contains(document.activeElement)) return;
210
226
  e.preventDefault();
211
- const currentPath = focusState.type === "field" ? focusState.fieldPath : null;
227
+ const currentPath = getFocusStatePath(focusState);
212
228
  const currentIdx = currentPath ? fields.findIndex((el) => el.getAttribute("data-field-path") === currentPath) : -1;
213
229
  let nextIdx;
214
230
  if (e.shiftKey) nextIdx = currentIdx <= 0 ? fields.length - 1 : currentIdx - 1;
215
231
  else nextIdx = currentIdx >= fields.length - 1 ? 0 : currentIdx + 1;
216
232
  const nextPath = fields[nextIdx]?.getAttribute("data-field-path");
217
- if (nextPath) focusContext.focusField(nextPath);
233
+ if (nextPath) applyFocusState(parsePreviewFieldPath(nextPath));
218
234
  };
219
235
  window.addEventListener("keydown", handleKeyDown);
220
236
  return () => window.removeEventListener("keydown", handleKeyDown);
221
237
  };
222
- t9 = [
238
+ t10 = [
223
239
  focusState,
224
- focusContext,
240
+ applyFocusState,
225
241
  open
226
242
  ];
227
- $[12] = focusContext;
228
- $[13] = focusState;
229
- $[14] = open;
230
- $[15] = t8;
231
- $[16] = t9;
243
+ $[14] = applyFocusState;
244
+ $[15] = focusState;
245
+ $[16] = open;
246
+ $[17] = t10;
247
+ $[18] = t9;
232
248
  } else {
233
- t8 = $[15];
234
- t9 = $[16];
249
+ t10 = $[17];
250
+ t9 = $[18];
235
251
  }
236
- React.useEffect(t8, t9);
237
- let t10;
238
- if ($[17] !== focusContext) {
239
- t10 = (fieldPath, context) => {
240
- const state = parsePreviewFieldPath(fieldPath, context);
241
- if (state.type === "field") focusContext.focusField(state.fieldPath);
242
- else if (state.type === "block") focusContext.focusBlock(state.blockId, state.fieldPath);
243
- else if (state.type === "relation") focusContext.focusRelation(state.fieldPath, state.targetCollection);
244
- };
245
- $[17] = focusContext;
246
- $[18] = t10;
247
- } else t10 = $[18];
248
- const handlePreviewFieldClick = t10;
252
+ React.useEffect(t9, t10);
249
253
  let t11;
250
- if ($[19] !== focusContext) {
251
- t11 = (blockId) => {
252
- focusContext.focusBlock(blockId);
254
+ if ($[19] !== applyFocusState) {
255
+ t11 = (fieldPath, context) => {
256
+ applyFocusState(parsePreviewFieldPath(fieldPath, context));
253
257
  };
254
- $[19] = focusContext;
258
+ $[19] = applyFocusState;
255
259
  $[20] = t11;
256
260
  } else t11 = $[20];
257
- const handlePreviewBlockClick = t11;
258
- const t12 = open ? "bg-background fixed inset-0 z-50 flex flex-col" : "w-full";
261
+ const handlePreviewFieldClick = t11;
262
+ let t12;
263
+ if ($[21] !== focusContext) {
264
+ t12 = (blockId) => {
265
+ focusContext.focusBlock(blockId);
266
+ };
267
+ $[21] = focusContext;
268
+ $[22] = t12;
269
+ } else t12 = $[22];
270
+ const handlePreviewBlockClick = t12;
259
271
  let t13;
260
- if ($[21] !== activeTab || $[22] !== isMobile || $[23] !== onClose || $[24] !== open || $[25] !== t) {
261
- t13 = open && /* @__PURE__ */ jsxs("div", {
272
+ if ($[23] !== focusContext) {
273
+ t13 = (message) => {
274
+ focusContext.requestBlockInsert(message.position, message.referenceBlockId);
275
+ };
276
+ $[23] = focusContext;
277
+ $[24] = t13;
278
+ } else t13 = $[24];
279
+ const handlePreviewBlockInsertRequest = t13;
280
+ const t14 = open ? "bg-background fixed inset-0 z-50 flex flex-col" : "w-full";
281
+ let t15;
282
+ if ($[25] !== activeTab || $[26] !== isMobile || $[27] !== open || $[28] !== t) {
283
+ t15 = open && /* @__PURE__ */ jsxs("div", {
262
284
  className: "flex shrink-0 items-center justify-between border-b px-4 py-2",
263
285
  children: [
264
286
  /* @__PURE__ */ jsxs("div", {
@@ -288,9 +310,9 @@ function LivePreviewContent(t0) {
288
310
  })]
289
311
  })
290
312
  }),
291
- /* @__PURE__ */ jsxs("div", {
313
+ /* @__PURE__ */ jsx("div", {
292
314
  className: "flex items-center gap-1",
293
- children: [/* @__PURE__ */ jsxs(Button, {
315
+ children: /* @__PURE__ */ jsxs(Button, {
294
316
  variant: "ghost",
295
317
  size: "sm",
296
318
  onClick: handleExitPreview,
@@ -303,68 +325,60 @@ function LivePreviewContent(t0) {
303
325
  className: "hidden sm:inline",
304
326
  children: t("preview.exitPreview")
305
327
  })]
306
- }), /* @__PURE__ */ jsxs(Button, {
307
- variant: "ghost",
308
- size: "icon",
309
- onClick: onClose,
310
- children: [/* @__PURE__ */ jsx(Icon, {
311
- icon: "ph:x",
312
- className: "h-4 w-4"
313
- }), /* @__PURE__ */ jsx("span", {
314
- className: "sr-only",
315
- children: t("common.close")
316
- })]
317
- })]
328
+ })
318
329
  })
319
330
  ]
320
331
  });
321
- $[21] = activeTab;
322
- $[22] = isMobile;
323
- $[23] = onClose;
324
- $[24] = open;
325
- $[25] = t;
326
- $[26] = t13;
327
- } else t13 = $[26];
328
- const t14 = open && !isMobile ? containerRef : void 0;
329
- const t15 = open ? isMobile ? "min-h-0 flex-1" : "flex min-h-0 flex-1" : "w-full";
330
- let t16;
331
- if ($[27] !== activeTab || $[28] !== isMobile || $[29] !== open) {
332
- t16 = open ? isMobile ? cn("h-full overflow-y-auto p-6", activeTab !== "form" && "hidden") : "bg-background h-full overflow-y-auto border-r p-6" : "w-full";
333
- $[27] = activeTab;
334
- $[28] = isMobile;
335
- $[29] = open;
336
- $[30] = t16;
337
- } else t16 = $[30];
338
- let t17;
339
- if ($[31] !== isMobile || $[32] !== open || $[33] !== previewPercent) {
340
- t17 = open && !isMobile ? { width: `${100 - previewPercent}%` } : void 0;
332
+ $[25] = activeTab;
333
+ $[26] = isMobile;
334
+ $[27] = open;
335
+ $[28] = t;
336
+ $[29] = t15;
337
+ } else t15 = $[29];
338
+ const t16 = open && !isMobile ? containerRef : void 0;
339
+ const t17 = open ? isMobile ? "min-h-0 flex-1" : "flex min-h-0 flex-1" : "w-full";
340
+ let t18;
341
+ if ($[30] !== activeTab || $[31] !== isMobile || $[32] !== open) {
342
+ t18 = open ? isMobile ? cn("h-full overflow-y-auto p-6", activeTab !== "form" && "hidden") : "bg-background h-full overflow-y-auto border-r p-6" : "w-full";
343
+ $[30] = activeTab;
341
344
  $[31] = isMobile;
342
345
  $[32] = open;
343
- $[33] = previewPercent;
344
- $[34] = t17;
345
- } else t17 = $[34];
346
- let t18;
347
- if ($[35] !== children || $[36] !== t16 || $[37] !== t17) {
348
- t18 = /* @__PURE__ */ jsx("div", {
346
+ $[33] = t18;
347
+ } else t18 = $[33];
348
+ let t19;
349
+ if ($[34] !== isMobile || $[35] !== open || $[36] !== previewPercent) {
350
+ t19 = open && !isMobile ? { width: `${100 - previewPercent}%` } : void 0;
351
+ $[34] = isMobile;
352
+ $[35] = open;
353
+ $[36] = previewPercent;
354
+ $[37] = t19;
355
+ } else t19 = $[37];
356
+ let t20;
357
+ if ($[38] !== children || $[39] !== t18 || $[40] !== t19) {
358
+ t20 = /* @__PURE__ */ jsx("div", {
349
359
  "data-preview-form-scope": true,
350
- className: t16,
351
- style: t17,
360
+ className: t18,
361
+ style: t19,
352
362
  children
353
363
  });
354
- $[35] = children;
355
- $[36] = t16;
356
- $[37] = t17;
357
- $[38] = t18;
358
- } else t18 = $[38];
359
- let t19;
360
- if ($[39] !== activeTab || $[40] !== handlePreviewBlockClick || $[41] !== handlePreviewFieldClick || $[42] !== isMobile || $[43] !== open || $[44] !== previewRef || $[45] !== previewUrl || $[46] !== t) {
361
- t19 = open && isMobile && /* @__PURE__ */ jsx("div", {
364
+ $[38] = children;
365
+ $[39] = t18;
366
+ $[40] = t19;
367
+ $[41] = t20;
368
+ } else t20 = $[41];
369
+ let t21;
370
+ if ($[42] !== activeTab || $[43] !== handlePreviewBlockClick || $[44] !== handlePreviewBlockInsertRequest || $[45] !== handlePreviewFieldClick || $[46] !== isMobile || $[47] !== onFieldValueEdited || $[48] !== onPatchApplied || $[49] !== onResyncRequest || $[50] !== open || $[51] !== previewRef || $[52] !== previewUrl || $[53] !== t) {
371
+ t21 = open && isMobile && /* @__PURE__ */ jsx("div", {
362
372
  className: activeTab === "preview" ? "h-full" : "hidden",
363
373
  children: previewUrl ? /* @__PURE__ */ jsx(PreviewPane, {
364
374
  ref: previewRef,
365
375
  url: previewUrl,
366
376
  onFieldClick: handlePreviewFieldClick,
367
- onBlockClick: handlePreviewBlockClick
377
+ onBlockClick: handlePreviewBlockClick,
378
+ onBlockInsertRequest: handlePreviewBlockInsertRequest,
379
+ onFieldValueEdited,
380
+ onPatchApplied,
381
+ onResyncRequest
368
382
  }) : /* @__PURE__ */ jsxs("div", {
369
383
  className: "flex h-full items-center justify-center",
370
384
  children: [/* @__PURE__ */ jsx(Icon, {
@@ -376,19 +390,23 @@ function LivePreviewContent(t0) {
376
390
  })]
377
391
  })
378
392
  });
379
- $[39] = activeTab;
380
- $[40] = handlePreviewBlockClick;
381
- $[41] = handlePreviewFieldClick;
382
- $[42] = isMobile;
383
- $[43] = open;
384
- $[44] = previewRef;
385
- $[45] = previewUrl;
386
- $[46] = t;
387
- $[47] = t19;
388
- } else t19 = $[47];
389
- let t20;
390
- if ($[48] !== handleMouseDown || $[49] !== handlePreviewBlockClick || $[50] !== handlePreviewFieldClick || $[51] !== isMobile || $[52] !== open || $[53] !== previewPercent || $[54] !== previewRef || $[55] !== previewUrl || $[56] !== t) {
391
- t20 = open && !isMobile && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
393
+ $[42] = activeTab;
394
+ $[43] = handlePreviewBlockClick;
395
+ $[44] = handlePreviewBlockInsertRequest;
396
+ $[45] = handlePreviewFieldClick;
397
+ $[46] = isMobile;
398
+ $[47] = onFieldValueEdited;
399
+ $[48] = onPatchApplied;
400
+ $[49] = onResyncRequest;
401
+ $[50] = open;
402
+ $[51] = previewRef;
403
+ $[52] = previewUrl;
404
+ $[53] = t;
405
+ $[54] = t21;
406
+ } else t21 = $[54];
407
+ let t22;
408
+ if ($[55] !== handleMouseDown || $[56] !== handlePreviewBlockClick || $[57] !== handlePreviewBlockInsertRequest || $[58] !== handlePreviewFieldClick || $[59] !== isMobile || $[60] !== onFieldValueEdited || $[61] !== onPatchApplied || $[62] !== onResyncRequest || $[63] !== open || $[64] !== previewPercent || $[65] !== previewRef || $[66] !== previewUrl || $[67] !== t) {
409
+ t22 = open && !isMobile && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
392
410
  type: "button",
393
411
  "aria-label": "Resize preview pane",
394
412
  onMouseDown: handleMouseDown,
@@ -401,7 +419,11 @@ function LivePreviewContent(t0) {
401
419
  ref: previewRef,
402
420
  url: previewUrl,
403
421
  onFieldClick: handlePreviewFieldClick,
404
- onBlockClick: handlePreviewBlockClick
422
+ onBlockClick: handlePreviewBlockClick,
423
+ onBlockInsertRequest: handlePreviewBlockInsertRequest,
424
+ onFieldValueEdited,
425
+ onPatchApplied,
426
+ onResyncRequest
405
427
  }) : /* @__PURE__ */ jsxs("div", {
406
428
  className: "flex h-full items-center justify-center",
407
429
  children: [/* @__PURE__ */ jsx(Icon, {
@@ -413,47 +435,51 @@ function LivePreviewContent(t0) {
413
435
  })]
414
436
  })
415
437
  })] });
416
- $[48] = handleMouseDown;
417
- $[49] = handlePreviewBlockClick;
418
- $[50] = handlePreviewFieldClick;
419
- $[51] = isMobile;
420
- $[52] = open;
421
- $[53] = previewPercent;
422
- $[54] = previewRef;
423
- $[55] = previewUrl;
424
- $[56] = t;
425
- $[57] = t20;
426
- } else t20 = $[57];
427
- let t21;
428
- if ($[58] !== t14 || $[59] !== t15 || $[60] !== t18 || $[61] !== t19 || $[62] !== t20) {
429
- t21 = /* @__PURE__ */ jsxs("div", {
430
- ref: t14,
431
- className: t15,
438
+ $[55] = handleMouseDown;
439
+ $[56] = handlePreviewBlockClick;
440
+ $[57] = handlePreviewBlockInsertRequest;
441
+ $[58] = handlePreviewFieldClick;
442
+ $[59] = isMobile;
443
+ $[60] = onFieldValueEdited;
444
+ $[61] = onPatchApplied;
445
+ $[62] = onResyncRequest;
446
+ $[63] = open;
447
+ $[64] = previewPercent;
448
+ $[65] = previewRef;
449
+ $[66] = previewUrl;
450
+ $[67] = t;
451
+ $[68] = t22;
452
+ } else t22 = $[68];
453
+ let t23;
454
+ if ($[69] !== t16 || $[70] !== t17 || $[71] !== t20 || $[72] !== t21 || $[73] !== t22) {
455
+ t23 = /* @__PURE__ */ jsxs("div", {
456
+ ref: t16,
457
+ className: t17,
432
458
  children: [
433
- t18,
434
- t19,
435
- t20
459
+ t20,
460
+ t21,
461
+ t22
436
462
  ]
437
463
  });
438
- $[58] = t14;
439
- $[59] = t15;
440
- $[60] = t18;
441
- $[61] = t19;
442
- $[62] = t20;
443
- $[63] = t21;
444
- } else t21 = $[63];
445
- let t22;
446
- if ($[64] !== t12 || $[65] !== t13 || $[66] !== t21) {
447
- t22 = /* @__PURE__ */ jsxs("div", {
448
- className: t12,
449
- children: [t13, t21]
464
+ $[69] = t16;
465
+ $[70] = t17;
466
+ $[71] = t20;
467
+ $[72] = t21;
468
+ $[73] = t22;
469
+ $[74] = t23;
470
+ } else t23 = $[74];
471
+ let t24;
472
+ if ($[75] !== t14 || $[76] !== t15 || $[77] !== t23) {
473
+ t24 = /* @__PURE__ */ jsxs("div", {
474
+ className: t14,
475
+ children: [t15, t23]
450
476
  });
451
- $[64] = t12;
452
- $[65] = t13;
453
- $[66] = t21;
454
- $[67] = t22;
455
- } else t22 = $[67];
456
- return t22;
477
+ $[75] = t14;
478
+ $[76] = t15;
479
+ $[77] = t23;
480
+ $[78] = t24;
481
+ } else t24 = $[78];
482
+ return t24;
457
483
  }
458
484
  function _temp2(e_0) {
459
485
  return e_0.preventDefault();
@@ -462,13 +488,13 @@ function _temp() {
462
488
  window.location.href = "/api/preview?disable=true";
463
489
  }
464
490
  function LivePreviewMode(t0) {
465
- const $ = c(8);
466
- const { open, onClose, children, previewUrl, previewRef: previewRefProp, defaultSize, minSize } = t0;
491
+ const $ = c(11);
492
+ const { open, onClose, children, previewUrl, previewRef: previewRefProp, onFieldValueEdited, onPatchApplied, onResyncRequest, defaultSize, minSize } = t0;
467
493
  const fallbackPreviewRef = React.useRef(null);
468
494
  const previewRef = previewRefProp ?? fallbackPreviewRef;
469
495
  const handleFocusChange = _temp3;
470
496
  let t1;
471
- if ($[0] !== children || $[1] !== defaultSize || $[2] !== minSize || $[3] !== onClose || $[4] !== open || $[5] !== previewRef || $[6] !== previewUrl) {
497
+ if ($[0] !== children || $[1] !== defaultSize || $[2] !== minSize || $[3] !== onClose || $[4] !== onFieldValueEdited || $[5] !== onPatchApplied || $[6] !== onResyncRequest || $[7] !== open || $[8] !== previewRef || $[9] !== previewUrl) {
472
498
  t1 = /* @__PURE__ */ jsx(FocusProvider, {
473
499
  onFocusChange: handleFocusChange,
474
500
  children: /* @__PURE__ */ jsx(LivePreviewContent, {
@@ -476,6 +502,9 @@ function LivePreviewMode(t0) {
476
502
  onClose,
477
503
  previewUrl,
478
504
  previewRef,
505
+ onFieldValueEdited,
506
+ onPatchApplied,
507
+ onResyncRequest,
479
508
  defaultSize,
480
509
  minSize,
481
510
  children
@@ -485,18 +514,24 @@ function LivePreviewMode(t0) {
485
514
  $[1] = defaultSize;
486
515
  $[2] = minSize;
487
516
  $[3] = onClose;
488
- $[4] = open;
489
- $[5] = previewRef;
490
- $[6] = previewUrl;
491
- $[7] = t1;
492
- } else t1 = $[7];
517
+ $[4] = onFieldValueEdited;
518
+ $[5] = onPatchApplied;
519
+ $[6] = onResyncRequest;
520
+ $[7] = open;
521
+ $[8] = previewRef;
522
+ $[9] = previewUrl;
523
+ $[10] = t1;
524
+ } else t1 = $[10];
493
525
  return t1;
494
526
  }
495
527
  function _temp3(state) {
496
- if (state.type === "field") scrollFieldIntoView(state.fieldPath);
497
- else if (state.type === "block") setTimeout(() => {
498
- scrollFieldIntoView(state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`);
499
- }, 150);
528
+ if (state.type === "field" || state.type === "relation") scheduleScrollFieldIntoView(state.fieldPath);
529
+ else if (state.type === "block") scheduleScrollFieldIntoView(state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`, { fallbackToBlock: true });
530
+ else if (state.type === "block-insert") {
531
+ const targetBlockId = state.referenceBlockId ?? state.position.parentId;
532
+ if (!targetBlockId) return;
533
+ scheduleScrollFieldIntoView(`content._values.${targetBlockId}`, { fallbackToBlock: true });
534
+ }
500
535
  }
501
536
 
502
537
  //#endregion