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