@questpie/admin 3.2.3 → 3.2.4

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 (61) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/components/admin-link.d.mts +2 -2
  3. package/dist/client/components/blocks/block-library-sidebar.mjs +126 -113
  4. package/dist/client/components/fields/json-field.mjs +114 -118
  5. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +38 -40
  6. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +6 -17
  7. package/dist/client/components/fields/rich-text-editor/index.mjs +71 -87
  8. package/dist/client/components/history-sidebar.mjs +25 -10
  9. package/dist/client/components/media/media-picker-dialog.mjs +237 -254
  10. package/dist/client/components/preview/live-preview-mode.mjs +230 -203
  11. package/dist/client/components/primitives/asset-preview.mjs +1 -1
  12. package/dist/client/contexts/focus-context.d.mts +4 -0
  13. package/dist/client/contexts/focus-context.mjs +106 -86
  14. package/dist/client/preview/block-scope-context.d.mts +2 -2
  15. package/dist/client/preview/diff.mjs +110 -0
  16. package/dist/client/preview/preview-banner.d.mts +2 -2
  17. package/dist/client/preview/preview-field.d.mts +4 -4
  18. package/dist/client/preview/preview-field.mjs +125 -187
  19. package/dist/client/preview/use-collection-preview.mjs +49 -21
  20. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  21. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  22. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  23. package/dist/client/views/auth/login-form.d.mts +2 -2
  24. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  25. package/dist/client/views/auth/setup-form.d.mts +2 -2
  26. package/dist/client/views/collection/bulk-action-toolbar.mjs +135 -156
  27. package/dist/client/views/collection/field-renderer.mjs +162 -51
  28. package/dist/client/views/collection/form-view.mjs +43 -81
  29. package/dist/client/views/collection/table-view.mjs +12 -10
  30. package/dist/client/views/common/global-search.mjs +199 -182
  31. package/dist/client/views/globals/global-form-view.mjs +625 -621
  32. package/dist/client/views/layout/admin-router.mjs +84 -100
  33. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  34. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  35. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  36. package/dist/client/views/pages/invite-page.d.mts +2 -2
  37. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  38. package/dist/client/views/pages/setup-page.d.mts +2 -2
  39. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  40. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  41. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  42. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  43. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  44. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  45. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  46. package/dist/server/modules/admin/collections/user.d.mts +63 -63
  47. package/dist/server/modules/admin/collections/verification.d.mts +32 -32
  48. package/dist/server/modules/admin/index.d.mts +1 -1
  49. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  50. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  51. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  52. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  53. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  54. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  55. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  56. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  57. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +41 -41
  58. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  59. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  60. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  61. package/package.json +3 -3
@@ -27,8 +27,12 @@ function getFocusStatePath(state) {
27
27
  if (state.type === "block") return state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`;
28
28
  return null;
29
29
  }
30
+ function isPreviewIframeFocused() {
31
+ const activeElement = document.activeElement;
32
+ return activeElement instanceof HTMLIFrameElement || activeElement?.tagName === "IFRAME";
33
+ }
30
34
  function useResizablePane(t0, t1, t2) {
31
- const $ = c(9);
35
+ const $ = c(11);
32
36
  const defaultSize = t0 === void 0 ? 50 : t0;
33
37
  const minSize = t1 === void 0 ? 30 : t1;
34
38
  const enabled = t2 === void 0 ? true : t2;
@@ -36,22 +40,45 @@ function useResizablePane(t0, t1, t2) {
36
40
  const isDragging = React.useRef(false);
37
41
  const containerRef = React.useRef(null);
38
42
  let t3;
39
- if ($[0] !== enabled) {
40
- t3 = (e) => {
43
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
44
+ t3 = {
45
+ cursor: "",
46
+ userSelect: ""
47
+ };
48
+ $[0] = t3;
49
+ } else t3 = $[0];
50
+ const previousBodyStyleRef = React.useRef(t3);
51
+ let t4;
52
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
53
+ t4 = () => {
54
+ Object.assign(document.body.style, previousBodyStyleRef.current);
55
+ };
56
+ $[1] = t4;
57
+ } else t4 = $[1];
58
+ const restoreBodyStyle = t4;
59
+ let t5;
60
+ if ($[2] !== enabled) {
61
+ t5 = (e) => {
41
62
  if (!enabled) return;
42
63
  e.preventDefault();
43
64
  isDragging.current = true;
44
- document.body.style.cursor = "col-resize";
45
- document.body.style.userSelect = "none";
65
+ previousBodyStyleRef.current = {
66
+ cursor: document.body.style.cursor,
67
+ userSelect: document.body.style.userSelect
68
+ };
69
+ Object.assign(document.body.style, {
70
+ cursor: "col-resize",
71
+ userSelect: "none"
72
+ });
46
73
  };
47
- $[0] = enabled;
48
- $[1] = t3;
49
- } else t3 = $[1];
50
- const handleMouseDown = t3;
51
- let t4;
52
- let t5;
53
- if ($[2] !== enabled || $[3] !== minSize) {
54
- t4 = () => {
74
+ $[2] = enabled;
75
+ $[3] = t5;
76
+ } else t5 = $[3];
77
+ const handleMouseDown = t5;
78
+ let t6;
79
+ let t7;
80
+ if ($[4] !== enabled || $[5] !== minSize) {
81
+ t6 = () => {
55
82
  if (!enabled) return;
56
83
  const handleMouseMove = (e_0) => {
57
84
  if (!isDragging.current || !containerRef.current) return;
@@ -62,8 +89,7 @@ function useResizablePane(t0, t1, t2) {
62
89
  const handleMouseUp = () => {
63
90
  if (isDragging.current) {
64
91
  isDragging.current = false;
65
- document.body.style.cursor = "";
66
- document.body.style.userSelect = "";
92
+ restoreBodyStyle();
67
93
  }
68
94
  };
69
95
  window.addEventListener("mousemove", handleMouseMove);
@@ -71,30 +97,38 @@ function useResizablePane(t0, t1, t2) {
71
97
  return () => {
72
98
  window.removeEventListener("mousemove", handleMouseMove);
73
99
  window.removeEventListener("mouseup", handleMouseUp);
100
+ if (isDragging.current) {
101
+ isDragging.current = false;
102
+ restoreBodyStyle();
103
+ }
74
104
  };
75
105
  };
76
- t5 = [enabled, minSize];
77
- $[2] = enabled;
78
- $[3] = minSize;
79
- $[4] = t4;
80
- $[5] = t5;
106
+ t7 = [
107
+ enabled,
108
+ minSize,
109
+ restoreBodyStyle
110
+ ];
111
+ $[4] = enabled;
112
+ $[5] = minSize;
113
+ $[6] = t6;
114
+ $[7] = t7;
81
115
  } else {
82
- t4 = $[4];
83
- t5 = $[5];
116
+ t6 = $[6];
117
+ t7 = $[7];
84
118
  }
85
- React.useEffect(t4, t5);
86
- let t6;
87
- if ($[6] !== handleMouseDown || $[7] !== previewPercent) {
88
- t6 = {
119
+ React.useEffect(t6, t7);
120
+ let t8;
121
+ if ($[8] !== handleMouseDown || $[9] !== previewPercent) {
122
+ t8 = {
89
123
  previewPercent,
90
124
  containerRef,
91
125
  handleMouseDown
92
126
  };
93
- $[6] = handleMouseDown;
94
- $[7] = previewPercent;
95
- $[8] = t6;
96
- } else t6 = $[8];
97
- return t6;
127
+ $[8] = handleMouseDown;
128
+ $[9] = previewPercent;
129
+ $[10] = t8;
130
+ } else t8 = $[10];
131
+ return t8;
98
132
  }
99
133
  function useLivePreviewRenderTelemetry(t0) {
100
134
  const $ = c(4);
@@ -131,7 +165,7 @@ function useLivePreviewRenderTelemetry(t0) {
131
165
  React.useEffect(t1);
132
166
  }
133
167
  function LivePreviewContent(t0) {
134
- const $ = c(79);
168
+ const $ = c(78);
135
169
  const { open, children, previewUrl, previewRef, onFieldValueEdited, onPatchApplied, onResyncRequest, defaultSize: t1, minSize: t2 } = t0;
136
170
  const defaultSize = t1 === void 0 ? 50 : t1;
137
171
  const minSize = t2 === void 0 ? 30 : t2;
@@ -152,39 +186,25 @@ function LivePreviewContent(t0) {
152
186
  } else t3 = $[3];
153
187
  useLivePreviewRenderTelemetry(t3);
154
188
  const { previewPercent, containerRef, handleMouseDown } = useResizablePane(defaultSize, minSize, open && !isMobile);
155
- const focusContext = useFocus();
156
- const focusState = focusContext.state;
189
+ const { state: focusState, focusField, focusBlock, focusRelation, requestBlockInsert } = useFocus();
157
190
  let t4;
158
- if ($[4] !== focusContext) {
191
+ if ($[4] !== focusBlock || $[5] !== focusField || $[6] !== focusRelation) {
159
192
  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);
193
+ if (state.type === "field") focusField(state.fieldPath);
194
+ else if (state.type === "block") focusBlock(state.blockId, state.fieldPath);
195
+ else if (state.type === "relation") focusRelation(state.fieldPath, state.targetCollection);
163
196
  };
164
- $[4] = focusContext;
165
- $[5] = t4;
166
- } else t4 = $[5];
197
+ $[4] = focusBlock;
198
+ $[5] = focusField;
199
+ $[6] = focusRelation;
200
+ $[7] = t4;
201
+ } else t4 = $[7];
167
202
  const applyFocusState = t4;
168
203
  const handleExitPreview = _temp;
169
204
  let t5;
170
205
  let t6;
171
- if ($[6] !== open) {
206
+ if ($[8] !== focusState || $[9] !== open || $[10] !== previewRef) {
172
207
  t5 = () => {
173
- if (!open) setActiveTab("form");
174
- };
175
- t6 = [open];
176
- $[6] = open;
177
- $[7] = t5;
178
- $[8] = t6;
179
- } else {
180
- t5 = $[7];
181
- t6 = $[8];
182
- }
183
- React.useEffect(t5, t6);
184
- let t7;
185
- let t8;
186
- if ($[9] !== focusState || $[10] !== open || $[11] !== previewRef) {
187
- t7 = () => {
188
208
  if (!open) return;
189
209
  if (!previewRef.current) return;
190
210
  if (focusState.type === "field" || focusState.type === "relation") previewRef.current.sendFocusToPreview(focusState.fieldPath);
@@ -196,25 +216,25 @@ function LivePreviewContent(t0) {
196
216
  previewRef.current.sendFocusToPreview(fullPath_0);
197
217
  }
198
218
  };
199
- t8 = [
219
+ t6 = [
200
220
  focusState,
201
221
  previewRef,
202
222
  open
203
223
  ];
204
- $[9] = focusState;
205
- $[10] = open;
206
- $[11] = previewRef;
207
- $[12] = t7;
208
- $[13] = t8;
224
+ $[8] = focusState;
225
+ $[9] = open;
226
+ $[10] = previewRef;
227
+ $[11] = t5;
228
+ $[12] = t6;
209
229
  } else {
210
- t7 = $[12];
211
- t8 = $[13];
230
+ t5 = $[11];
231
+ t6 = $[12];
212
232
  }
213
- React.useEffect(t7, t8);
214
- let t10;
215
- let t9;
216
- if ($[14] !== applyFocusState || $[15] !== focusState || $[16] !== open) {
217
- t9 = () => {
233
+ React.useEffect(t5, t6);
234
+ let t7;
235
+ let t8;
236
+ if ($[13] !== applyFocusState || $[14] !== focusState || $[15] !== open) {
237
+ t7 = () => {
218
238
  if (!open) return;
219
239
  const handleKeyDown = (e) => {
220
240
  if (e.key !== "Tab") return;
@@ -235,52 +255,52 @@ function LivePreviewContent(t0) {
235
255
  window.addEventListener("keydown", handleKeyDown);
236
256
  return () => window.removeEventListener("keydown", handleKeyDown);
237
257
  };
238
- t10 = [
258
+ t8 = [
239
259
  focusState,
240
260
  applyFocusState,
241
261
  open
242
262
  ];
243
- $[14] = applyFocusState;
244
- $[15] = focusState;
245
- $[16] = open;
246
- $[17] = t10;
247
- $[18] = t9;
263
+ $[13] = applyFocusState;
264
+ $[14] = focusState;
265
+ $[15] = open;
266
+ $[16] = t7;
267
+ $[17] = t8;
248
268
  } else {
249
- t10 = $[17];
250
- t9 = $[18];
269
+ t7 = $[16];
270
+ t8 = $[17];
251
271
  }
252
- React.useEffect(t9, t10);
253
- let t11;
254
- if ($[19] !== applyFocusState) {
255
- t11 = (fieldPath, context) => {
272
+ React.useEffect(t7, t8);
273
+ let t9;
274
+ if ($[18] !== applyFocusState) {
275
+ t9 = (fieldPath, context) => {
256
276
  applyFocusState(parsePreviewFieldPath(fieldPath, context));
257
277
  };
258
- $[19] = applyFocusState;
259
- $[20] = t11;
260
- } else t11 = $[20];
261
- const handlePreviewFieldClick = t11;
262
- let t12;
263
- if ($[21] !== focusContext) {
264
- t12 = (blockId) => {
265
- focusContext.focusBlock(blockId);
278
+ $[18] = applyFocusState;
279
+ $[19] = t9;
280
+ } else t9 = $[19];
281
+ const handlePreviewFieldClick = t9;
282
+ let t10;
283
+ if ($[20] !== focusBlock) {
284
+ t10 = (blockId) => {
285
+ focusBlock(blockId);
266
286
  };
267
- $[21] = focusContext;
268
- $[22] = t12;
269
- } else t12 = $[22];
270
- const handlePreviewBlockClick = t12;
271
- let t13;
272
- if ($[23] !== focusContext) {
273
- t13 = (message) => {
274
- focusContext.requestBlockInsert(message.position, message.referenceBlockId);
287
+ $[20] = focusBlock;
288
+ $[21] = t10;
289
+ } else t10 = $[21];
290
+ const handlePreviewBlockClick = t10;
291
+ let t11;
292
+ if ($[22] !== requestBlockInsert) {
293
+ t11 = (message) => {
294
+ requestBlockInsert(message.position, message.referenceBlockId);
275
295
  };
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", {
296
+ $[22] = requestBlockInsert;
297
+ $[23] = t11;
298
+ } else t11 = $[23];
299
+ const handlePreviewBlockInsertRequest = t11;
300
+ const t12 = open ? "bg-background fixed inset-0 z-50 flex flex-col" : "w-full";
301
+ let t13;
302
+ if ($[24] !== activeTab || $[25] !== isMobile || $[26] !== open || $[27] !== t) {
303
+ t13 = open && /* @__PURE__ */ jsxs("div", {
284
304
  className: "flex shrink-0 items-center justify-between border-b px-4 py-2",
285
305
  children: [
286
306
  /* @__PURE__ */ jsxs("div", {
@@ -329,46 +349,46 @@ function LivePreviewContent(t0) {
329
349
  })
330
350
  ]
331
351
  });
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";
352
+ $[24] = activeTab;
353
+ $[25] = isMobile;
354
+ $[26] = open;
355
+ $[27] = t;
356
+ $[28] = t13;
357
+ } else t13 = $[28];
358
+ const t14 = open && !isMobile ? containerRef : void 0;
359
+ const t15 = open ? isMobile ? "min-h-0 flex-1" : "flex min-h-0 flex-1" : "w-full";
360
+ let t16;
361
+ if ($[29] !== activeTab || $[30] !== isMobile || $[31] !== open) {
362
+ 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";
363
+ $[29] = activeTab;
364
+ $[30] = isMobile;
365
+ $[31] = open;
366
+ $[32] = t16;
367
+ } else t16 = $[32];
368
+ let t17;
369
+ if ($[33] !== isMobile || $[34] !== open || $[35] !== previewPercent) {
370
+ t17 = open && !isMobile ? { width: `${100 - previewPercent}%` } : void 0;
371
+ $[33] = isMobile;
372
+ $[34] = open;
373
+ $[35] = previewPercent;
374
+ $[36] = t17;
375
+ } else t17 = $[36];
340
376
  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;
344
- $[31] = isMobile;
345
- $[32] = open;
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", {
377
+ if ($[37] !== children || $[38] !== t16 || $[39] !== t17) {
378
+ t18 = /* @__PURE__ */ jsx("div", {
359
379
  "data-preview-form-scope": true,
360
- className: t18,
361
- style: t19,
380
+ className: t16,
381
+ style: t17,
362
382
  children
363
383
  });
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", {
384
+ $[37] = children;
385
+ $[38] = t16;
386
+ $[39] = t17;
387
+ $[40] = t18;
388
+ } else t18 = $[40];
389
+ let t19;
390
+ if ($[41] !== activeTab || $[42] !== handlePreviewBlockClick || $[43] !== handlePreviewBlockInsertRequest || $[44] !== handlePreviewFieldClick || $[45] !== isMobile || $[46] !== onFieldValueEdited || $[47] !== onPatchApplied || $[48] !== onResyncRequest || $[49] !== open || $[50] !== previewRef || $[51] !== previewUrl || $[52] !== t) {
391
+ t19 = open && isMobile && /* @__PURE__ */ jsx("div", {
372
392
  className: activeTab === "preview" ? "h-full" : "hidden",
373
393
  children: previewUrl ? /* @__PURE__ */ jsx(PreviewPane, {
374
394
  ref: previewRef,
@@ -390,23 +410,23 @@ function LivePreviewContent(t0) {
390
410
  })]
391
411
  })
392
412
  });
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", {
413
+ $[41] = activeTab;
414
+ $[42] = handlePreviewBlockClick;
415
+ $[43] = handlePreviewBlockInsertRequest;
416
+ $[44] = handlePreviewFieldClick;
417
+ $[45] = isMobile;
418
+ $[46] = onFieldValueEdited;
419
+ $[47] = onPatchApplied;
420
+ $[48] = onResyncRequest;
421
+ $[49] = open;
422
+ $[50] = previewRef;
423
+ $[51] = previewUrl;
424
+ $[52] = t;
425
+ $[53] = t19;
426
+ } else t19 = $[53];
427
+ let t20;
428
+ if ($[54] !== handleMouseDown || $[55] !== handlePreviewBlockClick || $[56] !== handlePreviewBlockInsertRequest || $[57] !== handlePreviewFieldClick || $[58] !== isMobile || $[59] !== onFieldValueEdited || $[60] !== onPatchApplied || $[61] !== onResyncRequest || $[62] !== open || $[63] !== previewPercent || $[64] !== previewRef || $[65] !== previewUrl || $[66] !== t) {
429
+ t20 = open && !isMobile && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
410
430
  type: "button",
411
431
  "aria-label": "Resize preview pane",
412
432
  onMouseDown: handleMouseDown,
@@ -435,51 +455,51 @@ function LivePreviewContent(t0) {
435
455
  })]
436
456
  })
437
457
  })] });
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,
458
+ $[54] = handleMouseDown;
459
+ $[55] = handlePreviewBlockClick;
460
+ $[56] = handlePreviewBlockInsertRequest;
461
+ $[57] = handlePreviewFieldClick;
462
+ $[58] = isMobile;
463
+ $[59] = onFieldValueEdited;
464
+ $[60] = onPatchApplied;
465
+ $[61] = onResyncRequest;
466
+ $[62] = open;
467
+ $[63] = previewPercent;
468
+ $[64] = previewRef;
469
+ $[65] = previewUrl;
470
+ $[66] = t;
471
+ $[67] = t20;
472
+ } else t20 = $[67];
473
+ let t21;
474
+ if ($[68] !== t14 || $[69] !== t15 || $[70] !== t18 || $[71] !== t19 || $[72] !== t20) {
475
+ t21 = /* @__PURE__ */ jsxs("div", {
476
+ ref: t14,
477
+ className: t15,
458
478
  children: [
459
- t20,
460
- t21,
461
- t22
479
+ t18,
480
+ t19,
481
+ t20
462
482
  ]
463
483
  });
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]
484
+ $[68] = t14;
485
+ $[69] = t15;
486
+ $[70] = t18;
487
+ $[71] = t19;
488
+ $[72] = t20;
489
+ $[73] = t21;
490
+ } else t21 = $[73];
491
+ let t22;
492
+ if ($[74] !== t12 || $[75] !== t13 || $[76] !== t21) {
493
+ t22 = /* @__PURE__ */ jsxs("div", {
494
+ className: t12,
495
+ children: [t13, t21]
476
496
  });
477
- $[75] = t14;
478
- $[76] = t15;
479
- $[77] = t23;
480
- $[78] = t24;
481
- } else t24 = $[78];
482
- return t24;
497
+ $[74] = t12;
498
+ $[75] = t13;
499
+ $[76] = t21;
500
+ $[77] = t22;
501
+ } else t22 = $[77];
502
+ return t22;
483
503
  }
484
504
  function _temp2(e_0) {
485
505
  return e_0.preventDefault();
@@ -525,12 +545,19 @@ function LivePreviewMode(t0) {
525
545
  return t1;
526
546
  }
527
547
  function _temp3(state) {
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 });
548
+ const shouldFocusForm = !isPreviewIframeFocused();
549
+ if (state.type === "field" || state.type === "relation") scheduleScrollFieldIntoView(state.fieldPath, { focus: shouldFocusForm });
550
+ else if (state.type === "block") scheduleScrollFieldIntoView(state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`, {
551
+ fallbackToBlock: true,
552
+ focus: shouldFocusForm
553
+ });
530
554
  else if (state.type === "block-insert") {
531
555
  const targetBlockId = state.referenceBlockId ?? state.position.parentId;
532
556
  if (!targetBlockId) return;
533
- scheduleScrollFieldIntoView(`content._values.${targetBlockId}`, { fallbackToBlock: true });
557
+ scheduleScrollFieldIntoView(`content._values.${targetBlockId}`, {
558
+ fallbackToBlock: true,
559
+ focus: shouldFocusForm
560
+ });
534
561
  }
535
562
  }
536
563
 
@@ -411,7 +411,7 @@ function AssetPreview(t0) {
411
411
  } else t16$1 = $[71];
412
412
  let t17$1;
413
413
  if ($[72] !== size) {
414
- t17$1 = size && /* @__PURE__ */ jsx("p", {
414
+ t17$1 = size != null && /* @__PURE__ */ jsx("p", {
415
415
  className: "text-muted-foreground text-xs tabular-nums",
416
416
  children: formatFileSize(size)
417
417
  });
@@ -92,6 +92,10 @@ declare function parsePreviewFieldPath(path: string, context?: {
92
92
  type ScrollFieldIntoViewOptions = {
93
93
  /** Scroll the owning block card if a nested block field is not rendered yet. */
94
94
  fallbackToBlock?: boolean;
95
+ /** Move DOM focus to the target form control. */
96
+ focus?: boolean;
97
+ behavior?: ScrollBehavior;
98
+ block?: ScrollLogicalPosition;
95
99
  };
96
100
  /**
97
101
  * Scroll a field into view and focus it.