@questpie/admin 3.2.2 → 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.
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +126 -113
- package/dist/client/components/fields/json-field.mjs +114 -118
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +38 -40
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +6 -17
- package/dist/client/components/fields/rich-text-editor/index.mjs +71 -87
- package/dist/client/components/history-sidebar.mjs +25 -10
- package/dist/client/components/media/media-picker-dialog.mjs +237 -254
- package/dist/client/components/preview/live-preview-mode.mjs +230 -203
- package/dist/client/components/primitives/asset-preview.mjs +1 -1
- package/dist/client/contexts/focus-context.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +106 -86
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/diff.mjs +110 -0
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +125 -187
- package/dist/client/preview/use-collection-preview.mjs +49 -21
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/collection/bulk-action-toolbar.mjs +135 -156
- package/dist/client/views/collection/field-renderer.mjs +162 -51
- package/dist/client/views/collection/form-view.mjs +43 -81
- package/dist/client/views/collection/table-view.mjs +12 -10
- package/dist/client/views/common/global-search.mjs +199 -182
- package/dist/client/views/globals/global-form-view.mjs +625 -621
- package/dist/client/views/layout/admin-router.mjs +84 -100
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +67 -67
- package/dist/server/modules/admin/collections/assets.d.mts +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +62 -62
- package/dist/server/modules/admin/collections/verification.d.mts +23 -23
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +41 -41
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- 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(
|
|
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
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
} else
|
|
265
|
-
const startEditing =
|
|
266
|
-
let
|
|
267
|
-
if ($[
|
|
268
|
-
|
|
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
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
} else
|
|
280
|
-
const routeClick =
|
|
281
|
-
let
|
|
282
|
-
if ($[
|
|
283
|
-
|
|
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
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
} else
|
|
305
|
-
const commitEdit =
|
|
306
|
-
let
|
|
307
|
-
if ($[
|
|
308
|
-
|
|
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
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
} else
|
|
315
|
-
const cancelEdit =
|
|
316
|
-
let
|
|
317
|
-
if ($[
|
|
318
|
-
|
|
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
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
} else
|
|
327
|
-
const handleClick =
|
|
328
|
-
let
|
|
329
|
-
if ($[
|
|
330
|
-
|
|
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
|
-
$[
|
|
336
|
-
$[
|
|
337
|
-
} else
|
|
338
|
-
const handleDoubleClick =
|
|
339
|
-
let
|
|
340
|
-
if ($[
|
|
341
|
-
|
|
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
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
} else
|
|
375
|
-
const handleKeyDown =
|
|
376
|
-
let
|
|
377
|
-
if ($[
|
|
378
|
-
|
|
379
|
-
ref:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
399
|
-
$[
|
|
400
|
-
$[
|
|
401
|
-
} else
|
|
402
|
-
const editor =
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
let
|
|
408
|
-
if ($[
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
$[
|
|
414
|
-
$[
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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":
|
|
380
|
+
"data-preview-editing": t9,
|
|
444
381
|
tabIndex: 0,
|
|
445
382
|
onClick: handleClick,
|
|
446
383
|
onDoubleClick: handleDoubleClick,
|
|
447
384
|
onKeyDown: handleKeyDown,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
onBlur: t19,
|
|
452
|
-
style: previewStyle,
|
|
453
|
-
className: t23,
|
|
454
|
-
children: t24
|
|
385
|
+
style,
|
|
386
|
+
className: t13,
|
|
387
|
+
children: t14
|
|
455
388
|
});
|
|
456
|
-
$[
|
|
457
|
-
$[
|
|
458
|
-
$[
|
|
459
|
-
$[
|
|
460
|
-
$[
|
|
461
|
-
$[
|
|
462
|
-
$[
|
|
463
|
-
$[
|
|
464
|
-
$[
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
467
|
-
$[
|
|
468
|
-
$[
|
|
469
|
-
} else
|
|
470
|
-
return
|
|
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
|
|
405
|
+
function _temp4(event_5) {
|
|
473
406
|
return event_5.stopPropagation();
|
|
474
407
|
}
|
|
475
|
-
function
|
|
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
|
-
|
|
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
|
|
140
|
+
break bb37;
|
|
128
141
|
case "SELECT_BLOCK":
|
|
129
|
-
setSelectedBlockId(message.blockId);
|
|
130
|
-
break
|
|
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
|
-
|
|
134
|
-
|
|
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
|
|
151
|
+
break bb37;
|
|
145
152
|
case "PATCH_BATCH":
|
|
146
|
-
if (!shouldApplyPatchBatch(lastAppliedSeqRef.current, message.seq)) break
|
|
153
|
+
if (!shouldApplyPatchBatch(lastAppliedSeqRef.current, message.seq)) break bb37;
|
|
147
154
|
try {
|
|
148
|
-
|
|
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
|
|
171
|
+
break bb37;
|
|
163
172
|
case "COMMIT":
|
|
164
173
|
lastAppliedSeqRef.current = message.seq;
|
|
165
174
|
setDraftData(cloneSnapshot(message.data));
|
|
166
|
-
break
|
|
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 () =>
|
|
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 = (
|
|
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
|
|
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):
|
|
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
|
|
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
|
-
}):
|
|
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):
|
|
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
|
|
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):
|
|
56
|
+
}: ForgotPasswordFormProps): react_jsx_runtime4.JSX.Element;
|
|
57
57
|
//#endregion
|
|
58
58
|
export { ForgotPasswordForm };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
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):
|
|
63
|
+
}: ResetPasswordFormProps): react_jsx_runtime6.JSX.Element;
|
|
64
64
|
//#endregion
|
|
65
65
|
export { ResetPasswordForm };
|