@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
@@ -201,86 +201,42 @@ function StandalonePreviewField(t0) {
201
201
  return t5;
202
202
  }
203
203
  function PreviewFieldElement(t0) {
204
- const $ = c(66);
204
+ const $ = c(54);
205
205
  const { Component, blockId, children, className, editable, fieldType, fullPath, isFocused, onClick, onValueCommit, style } = t0;
206
206
  const [isEditing, setIsEditing] = React.useState(false);
207
207
  const [draftValue, setDraftValue] = React.useState("");
208
- const [isHovered, setIsHovered] = React.useState(false);
209
- const [hasDomFocus, setHasDomFocus] = React.useState(false);
210
- const inputRef = React.useRef(null);
211
208
  const isEditable = editable === "text" || editable === "textarea";
212
- const shouldShowAffordance = isHovered || hasDomFocus || isFocused || isEditing;
213
- const t1 = shouldShowAffordance ? "var(--ring, var(--highlight, #b700ff))" : "transparent";
214
- const t2 = shouldShowAffordance ? `0 0 0 ${isEditing ? 5 : 4}px color-mix(in srgb, var(--ring, var(--highlight, #b700ff)) ${isEditing ? 24 : 16}%, transparent)` : void 0;
215
- const t3 = isEditable ? "text" : "pointer";
216
- let t4;
217
- if ($[0] !== style || $[1] !== t1 || $[2] !== t2 || $[3] !== t3) {
218
- t4 = {
219
- outlineColor: t1,
220
- outlineOffset: "2px",
221
- outlineStyle: "solid",
222
- outlineWidth: "2px",
223
- boxShadow: t2,
224
- borderRadius: "2px",
225
- cursor: t3,
226
- transition: "outline-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease",
227
- ...style
228
- };
229
- $[0] = style;
230
- $[1] = t1;
231
- $[2] = t2;
232
- $[3] = t3;
233
- $[4] = t4;
234
- } else t4 = $[4];
235
- const previewStyle = t4;
236
- let t5;
237
- let t6;
238
- if ($[5] !== isEditing) {
239
- t5 = () => {
240
- if (isEditing) {
241
- inputRef.current?.focus();
242
- inputRef.current?.select();
243
- }
244
- };
245
- t6 = [isEditing];
246
- $[5] = isEditing;
247
- $[6] = t5;
248
- $[7] = t6;
249
- } else {
250
- t5 = $[6];
251
- t6 = $[7];
252
- }
253
- React.useEffect(t5, t6);
254
- let t7;
255
- if ($[8] !== children || $[9] !== isEditable) {
256
- t7 = () => {
209
+ const setEditorRef = _temp2;
210
+ let t1;
211
+ if ($[0] !== children || $[1] !== isEditable) {
212
+ t1 = () => {
257
213
  if (!isEditable) return;
258
214
  setDraftValue(childrenToEditableValue(children));
259
215
  setIsEditing(true);
260
216
  };
261
- $[8] = children;
262
- $[9] = isEditable;
263
- $[10] = t7;
264
- } else t7 = $[10];
265
- const startEditing = t7;
266
- let t8;
267
- if ($[11] !== blockId || $[12] !== fieldType || $[13] !== fullPath || $[14] !== onClick) {
268
- t8 = () => {
217
+ $[0] = children;
218
+ $[1] = isEditable;
219
+ $[2] = t1;
220
+ } else t1 = $[2];
221
+ const startEditing = t1;
222
+ let t2;
223
+ if ($[3] !== blockId || $[4] !== fieldType || $[5] !== fullPath || $[6] !== onClick) {
224
+ t2 = () => {
269
225
  onClick(fullPath, {
270
226
  blockId,
271
227
  fieldType
272
228
  });
273
229
  };
274
- $[11] = blockId;
275
- $[12] = fieldType;
276
- $[13] = fullPath;
277
- $[14] = onClick;
278
- $[15] = t8;
279
- } else t8 = $[15];
280
- const routeClick = t8;
281
- let t9;
282
- if ($[16] !== blockId || $[17] !== draftValue || $[18] !== editable || $[19] !== fieldType || $[20] !== fullPath || $[21] !== isEditing || $[22] !== onValueCommit) {
283
- t9 = () => {
230
+ $[3] = blockId;
231
+ $[4] = fieldType;
232
+ $[5] = fullPath;
233
+ $[6] = onClick;
234
+ $[7] = t2;
235
+ } else t2 = $[7];
236
+ const routeClick = t2;
237
+ let t3;
238
+ if ($[8] !== blockId || $[9] !== draftValue || $[10] !== editable || $[11] !== fieldType || $[12] !== fullPath || $[13] !== isEditing || $[14] !== onValueCommit) {
239
+ t3 = () => {
284
240
  if (!isEditing || !editable) return;
285
241
  const payload = {
286
242
  path: fullPath,
@@ -293,52 +249,52 @@ function PreviewFieldElement(t0) {
293
249
  else postFieldValueEdited(payload);
294
250
  setIsEditing(false);
295
251
  };
296
- $[16] = blockId;
297
- $[17] = draftValue;
298
- $[18] = editable;
299
- $[19] = fieldType;
300
- $[20] = fullPath;
301
- $[21] = isEditing;
302
- $[22] = onValueCommit;
303
- $[23] = t9;
304
- } else t9 = $[23];
305
- const commitEdit = t9;
306
- let t10;
307
- if ($[24] !== children) {
308
- t10 = () => {
252
+ $[8] = blockId;
253
+ $[9] = draftValue;
254
+ $[10] = editable;
255
+ $[11] = fieldType;
256
+ $[12] = fullPath;
257
+ $[13] = isEditing;
258
+ $[14] = onValueCommit;
259
+ $[15] = t3;
260
+ } else t3 = $[15];
261
+ const commitEdit = t3;
262
+ let t4;
263
+ if ($[16] !== children) {
264
+ t4 = () => {
309
265
  setIsEditing(false);
310
266
  setDraftValue(childrenToEditableValue(children));
311
267
  };
312
- $[24] = children;
313
- $[25] = t10;
314
- } else t10 = $[25];
315
- const cancelEdit = t10;
316
- let t11;
317
- if ($[26] !== isEditing || $[27] !== routeClick) {
318
- t11 = (event) => {
268
+ $[16] = children;
269
+ $[17] = t4;
270
+ } else t4 = $[17];
271
+ const cancelEdit = t4;
272
+ let t5;
273
+ if ($[18] !== isEditing || $[19] !== routeClick) {
274
+ t5 = (event) => {
319
275
  event.preventDefault();
320
276
  event.stopPropagation();
321
277
  if (!isEditing) routeClick();
322
278
  };
323
- $[26] = isEditing;
324
- $[27] = routeClick;
325
- $[28] = t11;
326
- } else t11 = $[28];
327
- const handleClick = t11;
328
- let t12;
329
- if ($[29] !== startEditing) {
330
- t12 = (event_0) => {
279
+ $[18] = isEditing;
280
+ $[19] = routeClick;
281
+ $[20] = t5;
282
+ } else t5 = $[20];
283
+ const handleClick = t5;
284
+ let t6;
285
+ if ($[21] !== startEditing) {
286
+ t6 = (event_0) => {
331
287
  event_0.preventDefault();
332
288
  event_0.stopPropagation();
333
289
  startEditing();
334
290
  };
335
- $[29] = startEditing;
336
- $[30] = t12;
337
- } else t12 = $[30];
338
- const handleDoubleClick = t12;
339
- let t13;
340
- if ($[31] !== cancelEdit || $[32] !== commitEdit || $[33] !== editable || $[34] !== isEditable || $[35] !== isEditing || $[36] !== routeClick || $[37] !== startEditing) {
341
- t13 = (event_1) => {
291
+ $[21] = startEditing;
292
+ $[22] = t6;
293
+ } else t6 = $[22];
294
+ const handleDoubleClick = t6;
295
+ let t7;
296
+ if ($[23] !== cancelEdit || $[24] !== commitEdit || $[25] !== editable || $[26] !== isEditable || $[27] !== isEditing || $[28] !== routeClick || $[29] !== startEditing) {
297
+ t7 = (event_1) => {
342
298
  event_1.stopPropagation();
343
299
  if (!isEditing) {
344
300
  if (event_1.key === "Enter" && isEditable) {
@@ -363,118 +319,100 @@ function PreviewFieldElement(t0) {
363
319
  commitEdit();
364
320
  }
365
321
  };
366
- $[31] = cancelEdit;
367
- $[32] = commitEdit;
368
- $[33] = editable;
369
- $[34] = isEditable;
370
- $[35] = isEditing;
371
- $[36] = routeClick;
372
- $[37] = startEditing;
373
- $[38] = t13;
374
- } else t13 = $[38];
375
- const handleKeyDown = t13;
376
- let t14;
377
- if ($[39] !== commitEdit || $[40] !== draftValue || $[41] !== editable || $[42] !== handleKeyDown) {
378
- t14 = editable === "textarea" ? /* @__PURE__ */ jsx("textarea", {
379
- ref: inputRef,
322
+ $[23] = cancelEdit;
323
+ $[24] = commitEdit;
324
+ $[25] = editable;
325
+ $[26] = isEditable;
326
+ $[27] = isEditing;
327
+ $[28] = routeClick;
328
+ $[29] = startEditing;
329
+ $[30] = t7;
330
+ } else t7 = $[30];
331
+ const handleKeyDown = t7;
332
+ let t8;
333
+ if ($[31] !== commitEdit || $[32] !== draftValue || $[33] !== editable || $[34] !== handleKeyDown) {
334
+ t8 = editable === "textarea" ? /* @__PURE__ */ jsx("textarea", {
335
+ ref: setEditorRef,
380
336
  value: draftValue,
381
337
  onChange: (event_2) => setDraftValue(event_2.target.value),
382
338
  onBlur: commitEdit,
383
- onClick: _temp2,
339
+ onClick: _temp3,
384
340
  onKeyDown: handleKeyDown,
385
341
  className: "min-h-[4lh] w-full resize-y bg-transparent p-0 [letter-spacing:inherit] text-inherit outline-none [font:inherit]"
386
342
  }) : /* @__PURE__ */ jsx("input", {
387
- ref: inputRef,
343
+ ref: setEditorRef,
388
344
  type: "text",
389
345
  value: draftValue,
390
346
  onChange: (event_4) => setDraftValue(event_4.target.value),
391
347
  onBlur: commitEdit,
392
- onClick: _temp3,
348
+ onClick: _temp4,
393
349
  onKeyDown: handleKeyDown,
394
350
  className: "w-full bg-transparent p-0 [letter-spacing:inherit] text-inherit outline-none [font:inherit]"
395
351
  });
396
- $[39] = commitEdit;
397
- $[40] = draftValue;
398
- $[41] = editable;
399
- $[42] = handleKeyDown;
400
- $[43] = t14;
401
- } else t14 = $[43];
402
- const editor = t14;
403
- const t15 = isEditing ? "true" : void 0;
404
- let t16;
405
- let t17;
406
- let t18;
407
- let t19;
408
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
409
- t16 = () => setIsHovered(true);
410
- t17 = () => setIsHovered(false);
411
- t18 = () => setHasDomFocus(true);
412
- t19 = () => setHasDomFocus(false);
413
- $[44] = t16;
414
- $[45] = t17;
415
- $[46] = t18;
416
- $[47] = t19;
417
- } else {
418
- t16 = $[44];
419
- t17 = $[45];
420
- t18 = $[46];
421
- t19 = $[47];
422
- }
423
- const t20 = isEditable && "cursor-text";
424
- const t21 = isFocused && "outline-primary shadow-[0_0_0_4px_hsl(var(--primary)/0.14)]";
425
- const t22 = isEditing && "outline-primary bg-background/80 shadow-[0_0_0_4px_hsl(var(--primary)/0.18)]";
426
- let t23;
427
- if ($[48] !== className || $[49] !== t20 || $[50] !== t21 || $[51] !== t22) {
428
- t23 = cn(className, "group/preview-field relative rounded-[2px] transition-[box-shadow,outline-color,outline-offset] duration-150", "cursor-pointer outline outline-2 outline-offset-2 outline-transparent", "hover:outline-primary/50 hover:shadow-[0_0_0_4px_hsl(var(--primary)/0.10)]", "focus-visible:outline-primary/70 focus-visible:shadow-[0_0_0_4px_hsl(var(--primary)/0.12)]", t20, t21, t22);
429
- $[48] = className;
430
- $[49] = t20;
431
- $[50] = t21;
432
- $[51] = t22;
433
- $[52] = t23;
434
- } else t23 = $[52];
435
- const t24 = isEditing ? editor : children;
436
- let t25;
437
- if ($[53] !== Component || $[54] !== blockId || $[55] !== editable || $[56] !== fieldType || $[57] !== fullPath || $[58] !== handleClick || $[59] !== handleDoubleClick || $[60] !== handleKeyDown || $[61] !== previewStyle || $[62] !== t15 || $[63] !== t23 || $[64] !== t24) {
438
- t25 = /* @__PURE__ */ jsx(Component, {
352
+ $[31] = commitEdit;
353
+ $[32] = draftValue;
354
+ $[33] = editable;
355
+ $[34] = handleKeyDown;
356
+ $[35] = t8;
357
+ } else t8 = $[35];
358
+ const editor = t8;
359
+ const t9 = isEditing ? "true" : void 0;
360
+ const t10 = isEditable && "cursor-text";
361
+ const t11 = isFocused && "outline-primary shadow-[0_0_0_4px_hsl(var(--primary)/0.14)]";
362
+ const t12 = isEditing && "outline-primary bg-background/80 shadow-[0_0_0_4px_hsl(var(--primary)/0.18)]";
363
+ let t13;
364
+ if ($[36] !== className || $[37] !== t10 || $[38] !== t11 || $[39] !== t12) {
365
+ t13 = cn(className, "group/preview-field relative rounded-[2px] transition-[box-shadow,outline-color,outline-offset] duration-150", "cursor-pointer outline outline-2 outline-offset-2 outline-transparent", "hover:outline-primary/50 hover:shadow-[0_0_0_4px_hsl(var(--primary)/0.10)]", "focus-visible:outline-primary/70 focus-visible:shadow-[0_0_0_4px_hsl(var(--primary)/0.12)]", t10, t11, t12);
366
+ $[36] = className;
367
+ $[37] = t10;
368
+ $[38] = t11;
369
+ $[39] = t12;
370
+ $[40] = t13;
371
+ } else t13 = $[40];
372
+ const t14 = isEditing ? editor : children;
373
+ let t15;
374
+ if ($[41] !== Component || $[42] !== blockId || $[43] !== editable || $[44] !== fieldType || $[45] !== fullPath || $[46] !== handleClick || $[47] !== handleDoubleClick || $[48] !== handleKeyDown || $[49] !== style || $[50] !== t13 || $[51] !== t14 || $[52] !== t9) {
375
+ t15 = /* @__PURE__ */ jsx(Component, {
439
376
  "data-preview-field": fullPath,
440
377
  "data-block-id": blockId,
441
378
  "data-field-type": fieldType,
442
379
  "data-preview-editable": editable,
443
- "data-preview-editing": t15,
380
+ "data-preview-editing": t9,
444
381
  tabIndex: 0,
445
382
  onClick: handleClick,
446
383
  onDoubleClick: handleDoubleClick,
447
384
  onKeyDown: handleKeyDown,
448
- onMouseEnter: t16,
449
- onMouseLeave: t17,
450
- onFocus: t18,
451
- onBlur: t19,
452
- style: previewStyle,
453
- className: t23,
454
- children: t24
385
+ style,
386
+ className: t13,
387
+ children: t14
455
388
  });
456
- $[53] = Component;
457
- $[54] = blockId;
458
- $[55] = editable;
459
- $[56] = fieldType;
460
- $[57] = fullPath;
461
- $[58] = handleClick;
462
- $[59] = handleDoubleClick;
463
- $[60] = handleKeyDown;
464
- $[61] = previewStyle;
465
- $[62] = t15;
466
- $[63] = t23;
467
- $[64] = t24;
468
- $[65] = t25;
469
- } else t25 = $[65];
470
- return t25;
389
+ $[41] = Component;
390
+ $[42] = blockId;
391
+ $[43] = editable;
392
+ $[44] = fieldType;
393
+ $[45] = fullPath;
394
+ $[46] = handleClick;
395
+ $[47] = handleDoubleClick;
396
+ $[48] = handleKeyDown;
397
+ $[49] = style;
398
+ $[50] = t13;
399
+ $[51] = t14;
400
+ $[52] = t9;
401
+ $[53] = t15;
402
+ } else t15 = $[53];
403
+ return t15;
471
404
  }
472
- function _temp3(event_5) {
405
+ function _temp4(event_5) {
473
406
  return event_5.stopPropagation();
474
407
  }
475
- function _temp2(event_3) {
408
+ function _temp3(event_3) {
476
409
  return event_3.stopPropagation();
477
410
  }
411
+ function _temp2(node) {
412
+ if (!node) return;
413
+ node.focus({ preventScroll: true });
414
+ node.select();
415
+ }
478
416
  function childrenToEditableValue(children) {
479
417
  if (children === null || children === void 0 || typeof children === "boolean") return "";
480
418
  if (typeof children === "string" || typeof children === "number") return String(children);
@@ -57,6 +57,7 @@ function useCollectionPreview(t0) {
57
57
  const [isPreviewMode, setIsPreviewMode] = React.useState(false);
58
58
  const lastAppliedSeqRef = React.useRef(null);
59
59
  const initialDataRef = React.useRef(initialData);
60
+ const focusScrollTimerRef = React.useRef(null);
60
61
  let t2;
61
62
  let t3;
62
63
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
@@ -113,10 +114,22 @@ function useCollectionPreview(t0) {
113
114
  t8 = () => {
114
115
  if (!isPreviewMode) return;
115
116
  window.parent.postMessage({ type: "PREVIEW_READY" }, "*");
117
+ const scheduleFocusScroll = (fieldPath) => {
118
+ if (focusScrollTimerRef.current !== null) window.clearTimeout(focusScrollTimerRef.current);
119
+ focusScrollTimerRef.current = window.setTimeout(() => {
120
+ focusScrollTimerRef.current = null;
121
+ const element = findPreviewFieldElement(fieldPath);
122
+ if (!element || shouldSkipPreviewAutoScroll(element)) return;
123
+ if (!isElementNearViewport(element)) element.scrollIntoView({
124
+ behavior: "auto",
125
+ block: "nearest"
126
+ });
127
+ }, 80);
128
+ };
116
129
  const handleMessage = async (event) => {
117
130
  const message = event.data;
118
131
  if (!isPreviewAdminMessage(message)) return;
119
- bb24: switch (message.type) {
132
+ bb37: switch (message.type) {
120
133
  case "PREVIEW_REFRESH":
121
134
  await onRefreshRef.current();
122
135
  setDraftData(cloneSnapshot(initialDataRef.current));
@@ -124,28 +137,24 @@ function useCollectionPreview(t0) {
124
137
  type: "REFRESH_COMPLETE",
125
138
  timestamp: Date.now()
126
139
  }, "*");
127
- break bb24;
140
+ break bb37;
128
141
  case "SELECT_BLOCK":
129
- setSelectedBlockId(message.blockId);
130
- break bb24;
142
+ setSelectedBlockId((current_1) => current_1 === message.blockId ? current_1 : message.blockId);
143
+ break bb37;
131
144
  case "FOCUS_FIELD":
132
- setFocusedField(message.fieldPath);
133
- setTimeout(() => {
134
- const element = findPreviewFieldElement(message.fieldPath);
135
- if (element) element.scrollIntoView({
136
- behavior: "smooth",
137
- block: "center"
138
- });
139
- }, 150);
140
- break bb24;
145
+ setFocusedField((current_0) => current_0 === message.fieldPath ? current_0 : message.fieldPath);
146
+ scheduleFocusScroll(message.fieldPath);
147
+ break bb37;
141
148
  case "INIT_SNAPSHOT":
142
149
  lastAppliedSeqRef.current = message.seq;
143
150
  setDraftData(cloneSnapshot(message.data));
144
- break bb24;
151
+ break bb37;
145
152
  case "PATCH_BATCH":
146
- if (!shouldApplyPatchBatch(lastAppliedSeqRef.current, message.seq)) break bb24;
153
+ if (!shouldApplyPatchBatch(lastAppliedSeqRef.current, message.seq)) break bb37;
147
154
  try {
148
- setDraftData((current) => applyPatchBatchImmutable(current, message.ops));
155
+ React.startTransition(() => {
156
+ setDraftData((current) => applyPatchBatchImmutable(current, message.ops));
157
+ });
149
158
  lastAppliedSeqRef.current = message.seq;
150
159
  window.parent.postMessage({
151
160
  type: "PATCH_APPLIED",
@@ -159,11 +168,11 @@ function useCollectionPreview(t0) {
159
168
  reason: error instanceof Error ? error.message : "Failed to apply preview patch batch"
160
169
  }, "*");
161
170
  }
162
- break bb24;
171
+ break bb37;
163
172
  case "COMMIT":
164
173
  lastAppliedSeqRef.current = message.seq;
165
174
  setDraftData(cloneSnapshot(message.data));
166
- break bb24;
175
+ break bb37;
167
176
  case "FULL_RESYNC":
168
177
  await onRefreshRef.current();
169
178
  setDraftData(cloneSnapshot(initialDataRef.current));
@@ -174,7 +183,13 @@ function useCollectionPreview(t0) {
174
183
  }
175
184
  };
176
185
  window.addEventListener("message", handleMessage);
177
- return () => window.removeEventListener("message", handleMessage);
186
+ return () => {
187
+ window.removeEventListener("message", handleMessage);
188
+ if (focusScrollTimerRef.current !== null) {
189
+ window.clearTimeout(focusScrollTimerRef.current);
190
+ focusScrollTimerRef.current = null;
191
+ }
192
+ };
178
193
  };
179
194
  t9 = [isPreviewMode];
180
195
  $[10] = isPreviewMode;
@@ -187,10 +202,10 @@ function useCollectionPreview(t0) {
187
202
  React.useEffect(t8, t9);
188
203
  let t10;
189
204
  if ($[13] !== isPreviewMode) {
190
- t10 = (fieldPath, context) => {
205
+ t10 = (fieldPath_0, context) => {
191
206
  if (isPreviewMode) window.parent.postMessage({
192
207
  type: "FIELD_CLICKED",
193
- fieldPath,
208
+ fieldPath: fieldPath_0,
194
209
  blockId: context?.blockId,
195
210
  fieldType: context?.fieldType
196
211
  }, "*");
@@ -282,6 +297,19 @@ function findPreviewFieldElement(fieldPath) {
282
297
  const escaped = typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(fieldPath) : fieldPath.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
283
298
  return document.querySelector(`[data-preview-field="${escaped}"]`);
284
299
  }
300
+ function shouldSkipPreviewAutoScroll(element) {
301
+ const activeElement = document.activeElement;
302
+ if (activeElement && element.contains(activeElement)) return true;
303
+ return element instanceof HTMLElement && element.dataset.previewEditing === "true";
304
+ }
305
+ function isElementNearViewport(element) {
306
+ const rect = element.getBoundingClientRect();
307
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
308
+ const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
309
+ const verticalMargin = Math.min(120, viewportHeight * .2);
310
+ const horizontalMargin = Math.min(120, viewportWidth * .2);
311
+ return rect.bottom >= -verticalMargin && rect.top <= viewportHeight + verticalMargin && rect.right >= -horizontalMargin && rect.left <= viewportWidth + horizontalMargin;
312
+ }
285
313
 
286
314
  //#endregion
287
315
  export { useCollectionPreview };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/views/auth/accept-invite-form.d.ts
4
4
  /**
@@ -67,6 +67,6 @@ declare function AcceptInviteForm({
67
67
  className,
68
68
  error,
69
69
  minPasswordLength
70
- }: AcceptInviteFormProps): react_jsx_runtime0.JSX.Element;
70
+ }: AcceptInviteFormProps): react_jsx_runtime1.JSX.Element;
71
71
  //#endregion
72
72
  export { AcceptInviteForm };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/client/views/auth/auth-layout.d.ts
5
5
 
@@ -26,7 +26,7 @@ declare function AuthDefaultLogo({
26
26
  brandName
27
27
  }: {
28
28
  brandName: string;
29
- }): react_jsx_runtime1.JSX.Element;
29
+ }): react_jsx_runtime2.JSX.Element;
30
30
  /**
31
31
  * Minimal split layout for authentication pages (login, register, forgot password, etc.)
32
32
  *
@@ -50,6 +50,6 @@ declare function AuthDefaultLogo({
50
50
  * </AuthLayout>
51
51
  * ```
52
52
  */
53
- declare function AuthLayout(props: AuthLayoutProps): react_jsx_runtime1.JSX.Element;
53
+ declare function AuthLayout(props: AuthLayoutProps): react_jsx_runtime2.JSX.Element;
54
54
  //#endregion
55
55
  export { AuthDefaultLogo, AuthLayout, AuthLayoutProps };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/views/auth/forgot-password-form.d.ts
4
4
  /**
@@ -53,6 +53,6 @@ declare function ForgotPasswordForm({
53
53
  defaultValues,
54
54
  className,
55
55
  error
56
- }: ForgotPasswordFormProps): react_jsx_runtime3.JSX.Element;
56
+ }: ForgotPasswordFormProps): react_jsx_runtime4.JSX.Element;
57
57
  //#endregion
58
58
  export { ForgotPasswordForm };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/views/auth/login-form.d.ts
4
4
  /**
@@ -70,6 +70,6 @@ declare function LoginForm({
70
70
  className,
71
71
  error,
72
72
  minPasswordLength
73
- }: LoginFormProps): react_jsx_runtime4.JSX.Element;
73
+ }: LoginFormProps): react_jsx_runtime5.JSX.Element;
74
74
  //#endregion
75
75
  export { LoginForm };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime5 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/views/auth/reset-password-form.d.ts
4
4
  /**
@@ -60,6 +60,6 @@ declare function ResetPasswordForm({
60
60
  minPasswordLength,
61
61
  className,
62
62
  error
63
- }: ResetPasswordFormProps): react_jsx_runtime5.JSX.Element;
63
+ }: ResetPasswordFormProps): react_jsx_runtime6.JSX.Element;
64
64
  //#endregion
65
65
  export { ResetPasswordForm };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime6 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/views/auth/setup-form.d.ts
4
4
  /**
@@ -55,6 +55,6 @@ declare function SetupForm({
55
55
  className,
56
56
  error,
57
57
  minPasswordLength
58
- }: SetupFormProps): react_jsx_runtime6.JSX.Element;
58
+ }: SetupFormProps): react_jsx_runtime7.JSX.Element;
59
59
  //#endregion
60
60
  export { SetupForm, SetupFormValues };