@questpie/admin 3.2.1 → 3.2.3

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 (29) 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/preview/live-preview-mode.mjs +172 -163
  4. package/dist/client/contexts/focus-context.d.mts +5 -1
  5. package/dist/client/contexts/focus-context.mjs +39 -4
  6. package/dist/client/preview/block-scope-context.d.mts +2 -2
  7. package/dist/client/preview/preview-banner.d.mts +2 -2
  8. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  9. package/dist/client/views/pages/setup-page.d.mts +2 -2
  10. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  11. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  12. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  13. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  14. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +37 -37
  15. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  16. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  17. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  18. package/dist/server/modules/admin/collections/verification.d.mts +23 -23
  19. package/dist/server/modules/admin/index.d.mts +1 -1
  20. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  21. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  22. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  23. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  24. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  25. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  26. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  27. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  28. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  29. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import { BlockContent } from "./types.mjs";
2
2
  import * as React from "react";
3
- import * as react_jsx_runtime20 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/client/blocks/block-renderer.d.ts
6
6
 
@@ -50,6 +50,6 @@ declare function BlockRenderer({
50
50
  onBlockClick,
51
51
  onBlockInsert,
52
52
  className
53
- }: BlockRendererProps): react_jsx_runtime20.JSX.Element | null;
53
+ }: BlockRendererProps): react_jsx_runtime19.JSX.Element | null;
54
54
  //#endregion
55
55
  export { BlockRenderer, BlockRendererProps };
@@ -1,6 +1,6 @@
1
1
  import { CollectionNames, GlobalNames } from "../builder/index.mjs";
2
2
  import * as React from "react";
3
- import * as react_jsx_runtime14 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
4
4
  import { QuestpieApp } from "questpie/client";
5
5
 
6
6
  //#region src/client/components/admin-link.d.ts
@@ -61,6 +61,6 @@ declare function AdminLink<TApp extends QuestpieApp>({
61
61
  children,
62
62
  onClick,
63
63
  ...rest
64
- }: AdminLinkProps<TApp>): react_jsx_runtime14.JSX.Element;
64
+ }: AdminLinkProps<TApp>): react_jsx_runtime12.JSX.Element;
65
65
  //#endregion
66
66
  export { AdminLink };
@@ -4,7 +4,7 @@ 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, scrollFieldIntoView, useFocus } from "../../contexts/focus-context.mjs";
7
+ import { FocusProvider, parsePreviewFieldPath, scheduleScrollFieldIntoView, useFocus } from "../../contexts/focus-context.mjs";
8
8
  import { useIsMobile } from "../../hooks/use-media-query.mjs";
9
9
  import { PreviewPane } from "./preview-pane.mjs";
10
10
  import { c } from "react/compiler-runtime";
@@ -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,7 +131,7 @@ function useLivePreviewRenderTelemetry(t0) {
126
131
  React.useEffect(t1);
127
132
  }
128
133
  function LivePreviewContent(t0) {
129
- const $ = c(77);
134
+ const $ = c(79);
130
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;
@@ -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,66 +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;
261
+ const handlePreviewFieldClick = t11;
258
262
  let t12;
259
263
  if ($[21] !== focusContext) {
260
- t12 = (message) => {
261
- focusContext.requestBlockInsert(message.position, message.referenceBlockId);
264
+ t12 = (blockId) => {
265
+ focusContext.focusBlock(blockId);
262
266
  };
263
267
  $[21] = focusContext;
264
268
  $[22] = t12;
265
269
  } else t12 = $[22];
266
- const handlePreviewBlockInsertRequest = t12;
267
- const t13 = open ? "bg-background fixed inset-0 z-50 flex flex-col" : "w-full";
268
- let t14;
269
- if ($[23] !== activeTab || $[24] !== isMobile || $[25] !== open || $[26] !== t) {
270
- t14 = open && /* @__PURE__ */ jsxs("div", {
270
+ const handlePreviewBlockClick = t12;
271
+ let t13;
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", {
271
284
  className: "flex shrink-0 items-center justify-between border-b px-4 py-2",
272
285
  children: [
273
286
  /* @__PURE__ */ jsxs("div", {
@@ -316,46 +329,46 @@ function LivePreviewContent(t0) {
316
329
  })
317
330
  ]
318
331
  });
319
- $[23] = activeTab;
320
- $[24] = isMobile;
321
- $[25] = open;
322
- $[26] = t;
323
- $[27] = t14;
324
- } else t14 = $[27];
325
- const t15 = open && !isMobile ? containerRef : void 0;
326
- const t16 = open ? isMobile ? "min-h-0 flex-1" : "flex min-h-0 flex-1" : "w-full";
327
- let t17;
328
- if ($[28] !== activeTab || $[29] !== isMobile || $[30] !== open) {
329
- t17 = 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";
330
- $[28] = activeTab;
331
- $[29] = isMobile;
332
- $[30] = open;
333
- $[31] = t17;
334
- } else t17 = $[31];
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";
335
340
  let t18;
336
- if ($[32] !== isMobile || $[33] !== open || $[34] !== previewPercent) {
337
- t18 = open && !isMobile ? { width: `${100 - previewPercent}%` } : void 0;
338
- $[32] = isMobile;
339
- $[33] = open;
340
- $[34] = previewPercent;
341
- $[35] = t18;
342
- } else t18 = $[35];
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];
343
348
  let t19;
344
- if ($[36] !== children || $[37] !== t17 || $[38] !== t18) {
345
- t19 = /* @__PURE__ */ jsx("div", {
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", {
346
359
  "data-preview-form-scope": true,
347
- className: t17,
348
- style: t18,
360
+ className: t18,
361
+ style: t19,
349
362
  children
350
363
  });
351
- $[36] = children;
352
- $[37] = t17;
353
- $[38] = t18;
354
- $[39] = t19;
355
- } else t19 = $[39];
356
- let t20;
357
- if ($[40] !== activeTab || $[41] !== handlePreviewBlockClick || $[42] !== handlePreviewBlockInsertRequest || $[43] !== handlePreviewFieldClick || $[44] !== isMobile || $[45] !== onFieldValueEdited || $[46] !== onPatchApplied || $[47] !== onResyncRequest || $[48] !== open || $[49] !== previewRef || $[50] !== previewUrl || $[51] !== t) {
358
- t20 = 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", {
359
372
  className: activeTab === "preview" ? "h-full" : "hidden",
360
373
  children: previewUrl ? /* @__PURE__ */ jsx(PreviewPane, {
361
374
  ref: previewRef,
@@ -377,23 +390,23 @@ function LivePreviewContent(t0) {
377
390
  })]
378
391
  })
379
392
  });
380
- $[40] = activeTab;
381
- $[41] = handlePreviewBlockClick;
382
- $[42] = handlePreviewBlockInsertRequest;
383
- $[43] = handlePreviewFieldClick;
384
- $[44] = isMobile;
385
- $[45] = onFieldValueEdited;
386
- $[46] = onPatchApplied;
387
- $[47] = onResyncRequest;
388
- $[48] = open;
389
- $[49] = previewRef;
390
- $[50] = previewUrl;
391
- $[51] = t;
392
- $[52] = t20;
393
- } else t20 = $[52];
394
- let t21;
395
- if ($[53] !== handleMouseDown || $[54] !== handlePreviewBlockClick || $[55] !== handlePreviewBlockInsertRequest || $[56] !== handlePreviewFieldClick || $[57] !== isMobile || $[58] !== onFieldValueEdited || $[59] !== onPatchApplied || $[60] !== onResyncRequest || $[61] !== open || $[62] !== previewPercent || $[63] !== previewRef || $[64] !== previewUrl || $[65] !== t) {
396
- t21 = 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", {
397
410
  type: "button",
398
411
  "aria-label": "Resize preview pane",
399
412
  onMouseDown: handleMouseDown,
@@ -422,51 +435,51 @@ function LivePreviewContent(t0) {
422
435
  })]
423
436
  })
424
437
  })] });
425
- $[53] = handleMouseDown;
426
- $[54] = handlePreviewBlockClick;
427
- $[55] = handlePreviewBlockInsertRequest;
428
- $[56] = handlePreviewFieldClick;
429
- $[57] = isMobile;
430
- $[58] = onFieldValueEdited;
431
- $[59] = onPatchApplied;
432
- $[60] = onResyncRequest;
433
- $[61] = open;
434
- $[62] = previewPercent;
435
- $[63] = previewRef;
436
- $[64] = previewUrl;
437
- $[65] = t;
438
- $[66] = t21;
439
- } else t21 = $[66];
440
- let t22;
441
- if ($[67] !== t15 || $[68] !== t16 || $[69] !== t19 || $[70] !== t20 || $[71] !== t21) {
442
- t22 = /* @__PURE__ */ jsxs("div", {
443
- ref: t15,
444
- className: t16,
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,
445
458
  children: [
446
- t19,
447
459
  t20,
448
- t21
460
+ t21,
461
+ t22
449
462
  ]
450
463
  });
451
- $[67] = t15;
452
- $[68] = t16;
453
- $[69] = t19;
454
- $[70] = t20;
455
- $[71] = t21;
456
- $[72] = t22;
457
- } else t22 = $[72];
458
- let t23;
459
- if ($[73] !== t13 || $[74] !== t14 || $[75] !== t22) {
460
- t23 = /* @__PURE__ */ jsxs("div", {
461
- className: t13,
462
- children: [t14, t22]
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]
463
476
  });
464
- $[73] = t13;
465
- $[74] = t14;
466
- $[75] = t22;
467
- $[76] = t23;
468
- } else t23 = $[76];
469
- return t23;
477
+ $[75] = t14;
478
+ $[76] = t15;
479
+ $[77] = t23;
480
+ $[78] = t24;
481
+ } else t24 = $[78];
482
+ return t24;
470
483
  }
471
484
  function _temp2(e_0) {
472
485
  return e_0.preventDefault();
@@ -512,16 +525,12 @@ function LivePreviewMode(t0) {
512
525
  return t1;
513
526
  }
514
527
  function _temp3(state) {
515
- if (state.type === "field") scrollFieldIntoView(state.fieldPath);
516
- else if (state.type === "block") setTimeout(() => {
517
- scrollFieldIntoView(state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`);
518
- }, 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 });
519
530
  else if (state.type === "block-insert") {
520
531
  const targetBlockId = state.referenceBlockId ?? state.position.parentId;
521
532
  if (!targetBlockId) return;
522
- setTimeout(() => {
523
- scrollFieldIntoView(`content._values.${targetBlockId}`);
524
- }, 150);
533
+ scheduleScrollFieldIntoView(`content._values.${targetBlockId}`, { fallbackToBlock: true });
525
534
  }
526
535
  }
527
536
 
@@ -89,10 +89,14 @@ declare function parsePreviewFieldPath(path: string, context?: {
89
89
  fieldType?: "regular" | "block" | "relation";
90
90
  targetCollection?: string;
91
91
  }): FocusState;
92
+ type ScrollFieldIntoViewOptions = {
93
+ /** Scroll the owning block card if a nested block field is not rendered yet. */
94
+ fallbackToBlock?: boolean;
95
+ };
92
96
  /**
93
97
  * Scroll a field into view and focus it.
94
98
  * Finds the field wrapper by data-field-path within the preview form scope.
95
99
  */
96
- declare function scrollFieldIntoView(fieldPath: string): void;
100
+ declare function scrollFieldIntoView(fieldPath: string, options?: ScrollFieldIntoViewOptions): boolean;
97
101
  //#endregion
98
102
  export { FocusContextValue, FocusProvider, FocusProviderProps, FocusState, parsePreviewFieldPath, scrollFieldIntoView, useFocus, useFocusOptional, useIsBlockFocused, useIsFieldFocused };
@@ -243,13 +243,35 @@ function extractRelativeField(path, blockId) {
243
243
  if (path.startsWith(prefix)) return path.slice(prefix.length);
244
244
  return path;
245
245
  }
246
+ function getPreviewFormSearchRoot() {
247
+ return document.querySelector("[data-preview-form-scope]") ?? document;
248
+ }
249
+ function findExactFieldWrapper(searchRoot, fieldPath) {
250
+ for (const element of searchRoot.querySelectorAll("[data-field-path]")) if (element.getAttribute("data-field-path") === fieldPath) return element;
251
+ return null;
252
+ }
253
+ function getOwningBlockFieldPath(fieldPath) {
254
+ const blockMatch = fieldPath.match(/^content\._values\.([^.]+)/);
255
+ if (!blockMatch) return null;
256
+ return `content._values.${blockMatch[1]}`;
257
+ }
258
+ function findFieldWrapper(fieldPath, options) {
259
+ const searchRoot = getPreviewFormSearchRoot();
260
+ const exactWrapper = findExactFieldWrapper(searchRoot, fieldPath);
261
+ if (exactWrapper) return exactWrapper;
262
+ if (!options.fallbackToBlock) return null;
263
+ const owningBlockPath = getOwningBlockFieldPath(fieldPath);
264
+ if (!owningBlockPath) return null;
265
+ return findExactFieldWrapper(searchRoot, owningBlockPath);
266
+ }
246
267
  /**
247
268
  * Scroll a field into view and focus it.
248
269
  * Finds the field wrapper by data-field-path within the preview form scope.
249
270
  */
250
- function scrollFieldIntoView(fieldPath) {
251
- const wrapper = (document.querySelector("[data-preview-form-scope]") ?? document).querySelector(`[data-field-path="${fieldPath}"]`);
252
- if (!wrapper) return;
271
+ function scrollFieldIntoView(fieldPath, options = {}) {
272
+ if (typeof document === "undefined") return false;
273
+ const wrapper = findFieldWrapper(fieldPath, options);
274
+ if (!wrapper) return false;
253
275
  const focusable = wrapper.querySelector("input:not([type=\"hidden\"]), textarea, button, select, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]");
254
276
  (focusable ?? wrapper).scrollIntoView({
255
277
  behavior: "smooth",
@@ -261,7 +283,20 @@ function scrollFieldIntoView(fieldPath) {
261
283
  window.focus();
262
284
  focusable.focus();
263
285
  });
286
+ return true;
287
+ }
288
+ function scheduleScrollFieldIntoView(fieldPath, options = {}) {
289
+ if (typeof window === "undefined") return;
290
+ const { attempts = 12, delayMs = 80, fallbackToBlock = false } = options;
291
+ let attempt = 0;
292
+ const tryScroll = () => {
293
+ attempt += 1;
294
+ const isLastAttempt = attempt >= attempts;
295
+ if (scrollFieldIntoView(fieldPath, { fallbackToBlock: fallbackToBlock && isLastAttempt }) || isLastAttempt) return;
296
+ window.setTimeout(tryScroll, delayMs);
297
+ };
298
+ tryScroll();
264
299
  }
265
300
 
266
301
  //#endregion
267
- export { FocusProvider, parsePreviewFieldPath, scrollFieldIntoView, useFocus, useFocusOptional, useIsBlockFocused, useIsFieldFocused };
302
+ export { FocusProvider, parsePreviewFieldPath, scheduleScrollFieldIntoView, scrollFieldIntoView, useFocus, useFocusOptional, useIsBlockFocused, useIsFieldFocused };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import * as react_jsx_runtime21 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime22 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/client/preview/block-scope-context.d.ts
5
5
 
@@ -35,7 +35,7 @@ declare function BlockScopeProvider({
35
35
  blockId,
36
36
  basePath,
37
37
  children
38
- }: BlockScopeProviderProps): react_jsx_runtime21.JSX.Element;
38
+ }: BlockScopeProviderProps): react_jsx_runtime22.JSX.Element;
39
39
  /**
40
40
  * Get current block scope context.
41
41
  *
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime22 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime21 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/preview/preview-banner.d.ts
4
4
 
@@ -40,6 +40,6 @@ declare function PreviewBanner({
40
40
  isPreviewMode,
41
41
  className,
42
42
  exitPreviewUrl
43
- }: PreviewBannerProps): react_jsx_runtime22.JSX.Element | null;
43
+ }: PreviewBannerProps): react_jsx_runtime21.JSX.Element | null;
44
44
  //#endregion
45
45
  export { PreviewBanner, PreviewBannerProps };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/client/views/pages/reset-password-page.d.ts
5
5
 
@@ -58,6 +58,6 @@ declare function ResetPasswordPage({
58
58
  loginPath,
59
59
  minPasswordLength,
60
60
  getToken
61
- }: ResetPasswordPageProps): react_jsx_runtime13.JSX.Element;
61
+ }: ResetPasswordPageProps): react_jsx_runtime14.JSX.Element;
62
62
  //#endregion
63
63
  export { ResetPasswordPage };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import * as react_jsx_runtime12 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/client/views/pages/setup-page.d.ts
5
5
 
@@ -56,6 +56,6 @@ declare function SetupPage({
56
56
  redirectTo,
57
57
  loginPath,
58
58
  showLoginLink
59
- }: SetupPageProps): react_jsx_runtime12.JSX.Element;
59
+ }: SetupPageProps): react_jsx_runtime15.JSX.Element;
60
60
  //#endregion
61
61
  export { SetupPage, SetupPageProps };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime19 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime20 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/rich-text/rich-text-renderer.d.ts
4
4
  /**
@@ -98,6 +98,6 @@ declare function RichTextRenderer({
98
98
  content,
99
99
  styles: customStyles,
100
100
  className
101
- }: RichTextRendererProps): react_jsx_runtime19.JSX.Element | null;
101
+ }: RichTextRendererProps): react_jsx_runtime20.JSX.Element | null;
102
102
  //#endregion
103
103
  export { RichTextRenderer, RichTextStyles, TipTapDoc, TipTapNode };