camox 0.24.1 → 0.26.0
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/core/hooks/useRequireDraftSource.js +27 -0
- package/dist/features/preview/CamoxPreview.d.ts +4 -0
- package/dist/features/preview/CamoxPreview.js +454 -181
- package/dist/features/preview/components/AddBlockSheet.js +79 -75
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +39 -22
- package/dist/features/preview/components/DraftSwitchDialog.js +66 -0
- package/dist/features/preview/components/EditPageModal.js +9 -9
- package/dist/features/preview/components/LinkFieldEditor.js +1 -1
- package/dist/features/preview/components/Overlays.js +6 -2
- package/dist/features/preview/components/PageContentSheet.js +222 -190
- package/dist/features/preview/components/PagePicker.js +81 -3
- package/dist/features/preview/components/PageTree.js +418 -327
- package/dist/features/preview/components/PreviewToolbar.js +172 -158
- package/dist/features/preview/components/PublishDialog.js +111 -0
- package/dist/features/preview/components/useRepeatableItemActions.js +26 -20
- package/dist/features/preview/components/useUpdateBlockPosition.js +10 -9
- package/dist/features/preview/previewStore.js +38 -1
- package/dist/features/provider/useAdminShortcuts.js +7 -2
- package/dist/features/routes/pageRoute.d.ts +6 -2
- package/dist/features/routes/pageRoute.js +10 -6
- package/dist/features/vite/vite.js +6 -5
- package/dist/lib/normalized-data.js +87 -88
- package/dist/lib/queries.js +12 -6
- package/dist/studio.css +1 -1
- package/package.json +4 -4
|
@@ -3,6 +3,7 @@ import { blockQueries } from "../../../lib/queries.js";
|
|
|
3
3
|
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
5
5
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
6
|
+
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
6
7
|
import { fieldTypesDictionary } from "../../../core/lib/fieldTypes.js";
|
|
7
8
|
import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
|
|
8
9
|
import { BlockActionsPopover } from "./BlockActionsPopover.js";
|
|
@@ -22,11 +23,19 @@ import { CSS } from "@dnd-kit/utilities";
|
|
|
22
23
|
import { Accordion } from "@base-ui/react/accordion";
|
|
23
24
|
|
|
24
25
|
//#region src/features/preview/components/PageTree.tsx
|
|
26
|
+
const usePreviewSource = () => {
|
|
27
|
+
const $ = c(1);
|
|
28
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
29
|
+
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
30
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
31
|
+
}
|
|
32
|
+
return useSelector(previewStore, _temp);
|
|
33
|
+
};
|
|
25
34
|
function useEmbedTitle(url) {
|
|
26
35
|
const $ = c(4);
|
|
27
|
-
if ($[0] !== "
|
|
36
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
28
37
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
29
|
-
$[0] = "
|
|
38
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
30
39
|
}
|
|
31
40
|
const [title, setTitle] = React.useState(null);
|
|
32
41
|
let t0;
|
|
@@ -36,10 +45,10 @@ function useEmbedTitle(url) {
|
|
|
36
45
|
if (!url) return;
|
|
37
46
|
setTitle(null);
|
|
38
47
|
const controller = new AbortController();
|
|
39
|
-
fetch(url, { signal: controller.signal }).then(
|
|
48
|
+
fetch(url, { signal: controller.signal }).then(_temp2).then((html) => {
|
|
40
49
|
const match = html.match(/<title[^>]*>([^<]*)<\/title>/i);
|
|
41
50
|
if (match?.[1]) setTitle(match[1].trim());
|
|
42
|
-
}).catch(
|
|
51
|
+
}).catch(_temp3);
|
|
43
52
|
return () => controller.abort();
|
|
44
53
|
};
|
|
45
54
|
t1 = [url];
|
|
@@ -53,15 +62,15 @@ function useEmbedTitle(url) {
|
|
|
53
62
|
React.useEffect(t0, t1);
|
|
54
63
|
return title;
|
|
55
64
|
}
|
|
56
|
-
function
|
|
57
|
-
function
|
|
65
|
+
function _temp3() {}
|
|
66
|
+
function _temp2(res) {
|
|
58
67
|
return res.text();
|
|
59
68
|
}
|
|
60
69
|
const FieldItem = (t0) => {
|
|
61
70
|
const $ = c(29);
|
|
62
|
-
if ($[0] !== "
|
|
71
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
63
72
|
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
64
|
-
$[0] = "
|
|
73
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
65
74
|
}
|
|
66
75
|
const { fieldName, value, fieldType, schemaTitle, isSelected, onFieldClick, onFieldDoubleClick, onMouseEnter, onMouseLeave } = t0;
|
|
67
76
|
const fetchedEmbedTitle = useEmbedTitle(fieldType === "Embed" ? value : null);
|
|
@@ -146,26 +155,28 @@ const FieldItem = (t0) => {
|
|
|
146
155
|
return t9;
|
|
147
156
|
};
|
|
148
157
|
const BlockFields = (t0) => {
|
|
149
|
-
const $ = c(
|
|
150
|
-
if ($[0] !== "
|
|
151
|
-
for (let $i = 0; $i <
|
|
152
|
-
$[0] = "
|
|
158
|
+
const $ = c(6);
|
|
159
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
160
|
+
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
161
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
153
162
|
}
|
|
154
163
|
const { block } = t0;
|
|
155
164
|
const schemaProperties = useCamoxApp().getBlockById(block.type)?._internal.contentSchema.properties;
|
|
156
|
-
const selection = useSelector(previewStore,
|
|
157
|
-
const iframeElement = useSelector(previewStore,
|
|
165
|
+
const selection = useSelector(previewStore, _temp4);
|
|
166
|
+
const iframeElement = useSelector(previewStore, _temp5);
|
|
167
|
+
const previewSource = usePreviewSource();
|
|
158
168
|
let t1;
|
|
159
|
-
if ($[1] !== block.id) {
|
|
160
|
-
t1 = blockQueries.get(block.id);
|
|
169
|
+
if ($[1] !== block.id || $[2] !== previewSource) {
|
|
170
|
+
t1 = blockQueries.get(block.id, previewSource);
|
|
161
171
|
$[1] = block.id;
|
|
162
|
-
$[2] =
|
|
163
|
-
|
|
172
|
+
$[2] = previewSource;
|
|
173
|
+
$[3] = t1;
|
|
174
|
+
} else t1 = $[3];
|
|
164
175
|
const { data: blockBundle } = useQuery(t1);
|
|
165
176
|
let selectedFieldName = null;
|
|
166
177
|
if (selection?.type === "block-field" && selection.blockId === block.id) selectedFieldName = selection.fieldName;
|
|
167
178
|
else if ((selection?.type === "item" || selection?.type === "item-field") && selection.blockId === block.id && blockBundle) {
|
|
168
|
-
const itemsById = new Map(blockBundle.repeatableItems.map(
|
|
179
|
+
const itemsById = new Map(blockBundle.repeatableItems.map(_temp6));
|
|
169
180
|
let current = itemsById.get(selection.itemId);
|
|
170
181
|
while (current?.parentItemId != null) current = itemsById.get(current.parentItemId);
|
|
171
182
|
selectedFieldName = current?.fieldName ?? null;
|
|
@@ -238,26 +249,26 @@ const BlockFields = (t0) => {
|
|
|
238
249
|
}, fieldName_3);
|
|
239
250
|
});
|
|
240
251
|
let t4;
|
|
241
|
-
if ($[
|
|
252
|
+
if ($[4] !== t3) {
|
|
242
253
|
t4 = /* @__PURE__ */ jsx("ul", {
|
|
243
254
|
className: t2,
|
|
244
255
|
children: t3
|
|
245
256
|
});
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
} else t4 = $[
|
|
257
|
+
$[4] = t3;
|
|
258
|
+
$[5] = t4;
|
|
259
|
+
} else t4 = $[5];
|
|
249
260
|
return t4;
|
|
250
261
|
};
|
|
251
262
|
function useBlockTreeItem(block, t0) {
|
|
252
263
|
const $ = c(17);
|
|
253
|
-
if ($[0] !== "
|
|
264
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
254
265
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
255
|
-
$[0] = "
|
|
266
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
256
267
|
}
|
|
257
268
|
const isDragging = t0 === void 0 ? false : t0;
|
|
258
269
|
const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
|
|
259
|
-
const selection = useSelector(previewStore,
|
|
260
|
-
const iframeElement = useSelector(previewStore,
|
|
270
|
+
const selection = useSelector(previewStore, _temp7);
|
|
271
|
+
const iframeElement = useSelector(previewStore, _temp8);
|
|
261
272
|
const isBlockSelected = selection?.type === "block" && selection.blockId === block.id;
|
|
262
273
|
const shouldShowHover = !isDragging && !isBlockSelected;
|
|
263
274
|
const shouldShowActive = isDragging || isBlockSelected;
|
|
@@ -326,17 +337,17 @@ function useBlockTreeItem(block, t0) {
|
|
|
326
337
|
} else t4 = $[16];
|
|
327
338
|
return t4;
|
|
328
339
|
}
|
|
329
|
-
function
|
|
340
|
+
function _temp8(state_0) {
|
|
330
341
|
return state_0.context.iframeElement;
|
|
331
342
|
}
|
|
332
|
-
function
|
|
343
|
+
function _temp7(state) {
|
|
333
344
|
return state.context.selection;
|
|
334
345
|
}
|
|
335
346
|
const BlockTreeItemHeader = (t0) => {
|
|
336
347
|
const $ = c(17);
|
|
337
|
-
if ($[0] !== "
|
|
348
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
338
349
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
339
|
-
$[0] = "
|
|
350
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
340
351
|
}
|
|
341
352
|
let children;
|
|
342
353
|
let className;
|
|
@@ -389,9 +400,9 @@ const BlockTreeItemHeader = (t0) => {
|
|
|
389
400
|
};
|
|
390
401
|
const BlockTreeItemTrigger = (t0) => {
|
|
391
402
|
const $ = c(5);
|
|
392
|
-
if ($[0] !== "
|
|
403
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
393
404
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
394
|
-
$[0] = "
|
|
405
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
395
406
|
}
|
|
396
407
|
const { displayText, onClick } = t0;
|
|
397
408
|
let t1;
|
|
@@ -418,9 +429,9 @@ const BlockTreeItemTrigger = (t0) => {
|
|
|
418
429
|
};
|
|
419
430
|
const BlockTreeItemEllipsis = (t0) => {
|
|
420
431
|
const $ = c(12);
|
|
421
|
-
if ($[0] !== "
|
|
432
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
422
433
|
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
423
|
-
$[0] = "
|
|
434
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
424
435
|
}
|
|
425
436
|
let className;
|
|
426
437
|
let open;
|
|
@@ -466,9 +477,9 @@ const BlockTreeItemEllipsis = (t0) => {
|
|
|
466
477
|
};
|
|
467
478
|
const BlockTreeItemContent = (t0) => {
|
|
468
479
|
const $ = c(3);
|
|
469
|
-
if ($[0] !== "
|
|
480
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
470
481
|
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
471
|
-
$[0] = "
|
|
482
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
472
483
|
}
|
|
473
484
|
const { block } = t0;
|
|
474
485
|
let t1;
|
|
@@ -488,201 +499,245 @@ const animateLayoutChanges = (args) => {
|
|
|
488
499
|
return defaultAnimateLayoutChanges(args);
|
|
489
500
|
};
|
|
490
501
|
const SortableBlock = (t0) => {
|
|
491
|
-
const $ = c(
|
|
492
|
-
if ($[0] !== "
|
|
493
|
-
for (let $i = 0; $i <
|
|
494
|
-
$[0] = "
|
|
502
|
+
const $ = c(67);
|
|
503
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
504
|
+
for (let $i = 0; $i < 67; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
505
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
495
506
|
}
|
|
496
507
|
const { block } = t0;
|
|
497
508
|
const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
|
|
509
|
+
const previewSource = usePreviewSource();
|
|
510
|
+
const requireDraft = useRequireDraftSource();
|
|
511
|
+
const isReadOnly = previewSource !== "draft";
|
|
498
512
|
const t1 = String(block.id);
|
|
499
513
|
let t2;
|
|
500
|
-
if ($[1] !== t1) {
|
|
514
|
+
if ($[1] !== isReadOnly || $[2] !== t1) {
|
|
501
515
|
t2 = {
|
|
502
516
|
id: t1,
|
|
503
|
-
animateLayoutChanges
|
|
517
|
+
animateLayoutChanges,
|
|
518
|
+
disabled: isReadOnly
|
|
504
519
|
};
|
|
505
|
-
$[1] =
|
|
506
|
-
$[2] =
|
|
507
|
-
|
|
520
|
+
$[1] = isReadOnly;
|
|
521
|
+
$[2] = t1;
|
|
522
|
+
$[3] = t2;
|
|
523
|
+
} else t2 = $[3];
|
|
508
524
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable(t2);
|
|
509
525
|
let t3;
|
|
510
|
-
if ($[
|
|
526
|
+
if ($[4] !== transform) {
|
|
511
527
|
t3 = CSS.Transform.toString(transform);
|
|
512
|
-
$[
|
|
513
|
-
$[
|
|
514
|
-
} else t3 = $[
|
|
528
|
+
$[4] = transform;
|
|
529
|
+
$[5] = t3;
|
|
530
|
+
} else t3 = $[5];
|
|
515
531
|
const t4 = isDragging ? 0 : 1;
|
|
516
532
|
let t5;
|
|
517
|
-
if ($[
|
|
533
|
+
if ($[6] !== t3 || $[7] !== t4 || $[8] !== transition) {
|
|
518
534
|
t5 = {
|
|
519
535
|
transform: t3,
|
|
520
536
|
transition,
|
|
521
537
|
opacity: t4
|
|
522
538
|
};
|
|
523
|
-
$[
|
|
524
|
-
$[
|
|
525
|
-
$[
|
|
526
|
-
$[
|
|
527
|
-
} else t5 = $[
|
|
539
|
+
$[6] = t3;
|
|
540
|
+
$[7] = t4;
|
|
541
|
+
$[8] = transition;
|
|
542
|
+
$[9] = t5;
|
|
543
|
+
} else t5 = $[9];
|
|
528
544
|
const style = t5;
|
|
529
545
|
const ctx = useBlockTreeItem(block, isDragging);
|
|
530
546
|
let t6;
|
|
531
|
-
if ($[
|
|
547
|
+
if ($[10] !== block.id) {
|
|
532
548
|
t6 = (state) => state.context.selection?.blockId === block.id;
|
|
533
|
-
$[
|
|
534
|
-
$[
|
|
535
|
-
} else t6 = $[
|
|
549
|
+
$[10] = block.id;
|
|
550
|
+
$[11] = t6;
|
|
551
|
+
} else t6 = $[11];
|
|
536
552
|
const isBlockFocused = useSelector(previewStore, t6);
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
$[12] =
|
|
542
|
-
$[13] =
|
|
543
|
-
} else
|
|
544
|
-
const t8 = String(block.id);
|
|
553
|
+
const t7 = isReadOnly ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing";
|
|
554
|
+
let t8;
|
|
555
|
+
if ($[12] !== t7) {
|
|
556
|
+
t8 = cn("text-muted-foreground hover:text-foreground flex", t7);
|
|
557
|
+
$[12] = t7;
|
|
558
|
+
$[13] = t8;
|
|
559
|
+
} else t8 = $[13];
|
|
545
560
|
let t9;
|
|
546
|
-
if ($[14]
|
|
547
|
-
t9 =
|
|
548
|
-
$[14] =
|
|
549
|
-
|
|
561
|
+
if ($[14] !== attributes || $[15] !== isReadOnly) {
|
|
562
|
+
t9 = isReadOnly ? {} : attributes;
|
|
563
|
+
$[14] = attributes;
|
|
564
|
+
$[15] = isReadOnly;
|
|
565
|
+
$[16] = t9;
|
|
566
|
+
} else t9 = $[16];
|
|
550
567
|
let t10;
|
|
568
|
+
if ($[17] !== isReadOnly || $[18] !== listeners) {
|
|
569
|
+
t10 = isReadOnly ? {} : listeners;
|
|
570
|
+
$[17] = isReadOnly;
|
|
571
|
+
$[18] = listeners;
|
|
572
|
+
$[19] = t10;
|
|
573
|
+
} else t10 = $[19];
|
|
551
574
|
let t11;
|
|
552
|
-
if ($[
|
|
553
|
-
|
|
575
|
+
if ($[20] !== isReadOnly || $[21] !== requireDraft) {
|
|
576
|
+
t11 = isReadOnly ? (e) => {
|
|
577
|
+
e.preventDefault();
|
|
578
|
+
e.stopPropagation();
|
|
579
|
+
requireDraft();
|
|
580
|
+
} : void 0;
|
|
581
|
+
$[20] = isReadOnly;
|
|
582
|
+
$[21] = requireDraft;
|
|
583
|
+
$[22] = t11;
|
|
584
|
+
} else t11 = $[22];
|
|
585
|
+
let t12;
|
|
586
|
+
let t13;
|
|
587
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
588
|
+
t12 = /* @__PURE__ */ jsx("span", {
|
|
554
589
|
className: "sr-only",
|
|
555
590
|
children: "Click and use arrow keys to reorder"
|
|
556
591
|
});
|
|
557
|
-
|
|
558
|
-
$[
|
|
559
|
-
$[
|
|
592
|
+
t13 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
|
|
593
|
+
$[23] = t12;
|
|
594
|
+
$[24] = t13;
|
|
560
595
|
} else {
|
|
561
|
-
|
|
562
|
-
|
|
596
|
+
t12 = $[23];
|
|
597
|
+
t13 = $[24];
|
|
563
598
|
}
|
|
564
|
-
let
|
|
565
|
-
if ($[
|
|
566
|
-
|
|
599
|
+
let t14;
|
|
600
|
+
if ($[25] !== t10 || $[26] !== t11 || $[27] !== t8 || $[28] !== t9) {
|
|
601
|
+
t14 = /* @__PURE__ */ jsxs(Button, {
|
|
567
602
|
variant: "ghost",
|
|
568
603
|
size: "icon-sm",
|
|
569
|
-
className:
|
|
570
|
-
...
|
|
571
|
-
...
|
|
572
|
-
|
|
604
|
+
className: t8,
|
|
605
|
+
...t9,
|
|
606
|
+
...t10,
|
|
607
|
+
onClick: t11,
|
|
608
|
+
children: [t12, t13]
|
|
573
609
|
});
|
|
574
|
-
$[
|
|
575
|
-
$[
|
|
576
|
-
$[
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
610
|
+
$[25] = t10;
|
|
611
|
+
$[26] = t11;
|
|
612
|
+
$[27] = t8;
|
|
613
|
+
$[28] = t9;
|
|
614
|
+
$[29] = t14;
|
|
615
|
+
} else t14 = $[29];
|
|
616
|
+
const gripButton = t14;
|
|
617
|
+
let t15;
|
|
618
|
+
if ($[30] !== block.id || $[31] !== isBlockFocused) {
|
|
619
|
+
t15 = isBlockFocused ? [String(block.id)] : [];
|
|
620
|
+
$[30] = block.id;
|
|
621
|
+
$[31] = isBlockFocused;
|
|
622
|
+
$[32] = t15;
|
|
623
|
+
} else t15 = $[32];
|
|
624
|
+
const t16 = String(block.id);
|
|
625
|
+
let t17;
|
|
626
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
627
|
+
t17 = /* @__PURE__ */ jsx("div", {});
|
|
628
|
+
$[33] = t17;
|
|
629
|
+
} else t17 = $[33];
|
|
630
|
+
let t18;
|
|
631
|
+
if ($[34] !== block || $[35] !== gripButton || $[36] !== gripPopoverOpen || $[37] !== isReadOnly) {
|
|
632
|
+
t18 = isReadOnly ? gripButton : /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
581
633
|
block,
|
|
582
634
|
open: gripPopoverOpen,
|
|
583
635
|
onOpenChange: setGripPopoverOpen,
|
|
584
|
-
children:
|
|
636
|
+
children: gripButton
|
|
585
637
|
});
|
|
586
|
-
$[
|
|
587
|
-
$[
|
|
588
|
-
$[
|
|
589
|
-
$[
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
638
|
+
$[34] = block;
|
|
639
|
+
$[35] = gripButton;
|
|
640
|
+
$[36] = gripPopoverOpen;
|
|
641
|
+
$[37] = isReadOnly;
|
|
642
|
+
$[38] = t18;
|
|
643
|
+
} else t18 = $[38];
|
|
644
|
+
const t19 = block.summary || block.type;
|
|
645
|
+
let t20;
|
|
646
|
+
if ($[39] !== ctx.toggleSelection || $[40] !== t19) {
|
|
647
|
+
t20 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
|
|
648
|
+
displayText: t19,
|
|
596
649
|
onClick: ctx.toggleSelection
|
|
597
650
|
});
|
|
598
|
-
$[
|
|
599
|
-
$[
|
|
600
|
-
$[
|
|
601
|
-
} else
|
|
602
|
-
let
|
|
603
|
-
if ($[
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
651
|
+
$[39] = ctx.toggleSelection;
|
|
652
|
+
$[40] = t19;
|
|
653
|
+
$[41] = t20;
|
|
654
|
+
} else t20 = $[41];
|
|
655
|
+
let t21;
|
|
656
|
+
if ($[42] !== block || $[43] !== ctx.ellipsisPopoverOpen || $[44] !== ctx.setEllipsisPopoverOpen || $[45] !== isReadOnly || $[46] !== requireDraft) {
|
|
657
|
+
t21 = isReadOnly ? /* @__PURE__ */ jsx(BlockTreeItemEllipsis, {
|
|
658
|
+
open: false,
|
|
659
|
+
onClick: (e_0) => {
|
|
660
|
+
e_0.preventDefault();
|
|
661
|
+
e_0.stopPropagation();
|
|
662
|
+
requireDraft();
|
|
663
|
+
}
|
|
664
|
+
}) : /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
611
665
|
block,
|
|
612
666
|
open: ctx.ellipsisPopoverOpen,
|
|
613
667
|
onOpenChange: ctx.setEllipsisPopoverOpen,
|
|
614
|
-
children:
|
|
668
|
+
children: /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen })
|
|
615
669
|
});
|
|
616
|
-
$[
|
|
617
|
-
$[
|
|
618
|
-
$[
|
|
619
|
-
$[
|
|
620
|
-
$[
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
670
|
+
$[42] = block;
|
|
671
|
+
$[43] = ctx.ellipsisPopoverOpen;
|
|
672
|
+
$[44] = ctx.setEllipsisPopoverOpen;
|
|
673
|
+
$[45] = isReadOnly;
|
|
674
|
+
$[46] = requireDraft;
|
|
675
|
+
$[47] = t21;
|
|
676
|
+
} else t21 = $[47];
|
|
677
|
+
let t22;
|
|
678
|
+
if ($[48] !== ctx.shouldShowActive || $[49] !== ctx.shouldShowHover || $[50] !== t18 || $[51] !== t20 || $[52] !== t21) {
|
|
679
|
+
t22 = /* @__PURE__ */ jsx(Accordion.Header, {
|
|
680
|
+
render: t17,
|
|
626
681
|
children: /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
|
|
627
682
|
shouldShowHover: ctx.shouldShowHover,
|
|
628
683
|
shouldShowActive: ctx.shouldShowActive,
|
|
629
684
|
children: [
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
685
|
+
t18,
|
|
686
|
+
t20,
|
|
687
|
+
t21
|
|
633
688
|
]
|
|
634
689
|
})
|
|
635
690
|
});
|
|
636
|
-
$[
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
$[
|
|
640
|
-
$[
|
|
641
|
-
$[
|
|
642
|
-
} else
|
|
643
|
-
let
|
|
644
|
-
if ($[
|
|
645
|
-
|
|
646
|
-
$[
|
|
647
|
-
$[
|
|
648
|
-
} else
|
|
649
|
-
let
|
|
650
|
-
if ($[
|
|
651
|
-
|
|
652
|
-
value:
|
|
691
|
+
$[48] = ctx.shouldShowActive;
|
|
692
|
+
$[49] = ctx.shouldShowHover;
|
|
693
|
+
$[50] = t18;
|
|
694
|
+
$[51] = t20;
|
|
695
|
+
$[52] = t21;
|
|
696
|
+
$[53] = t22;
|
|
697
|
+
} else t22 = $[53];
|
|
698
|
+
let t23;
|
|
699
|
+
if ($[54] !== block) {
|
|
700
|
+
t23 = /* @__PURE__ */ jsx(BlockTreeItemContent, { block });
|
|
701
|
+
$[54] = block;
|
|
702
|
+
$[55] = t23;
|
|
703
|
+
} else t23 = $[55];
|
|
704
|
+
let t24;
|
|
705
|
+
if ($[56] !== ctx.handleBlockMouseEnter || $[57] !== ctx.handleBlockMouseLeave || $[58] !== setNodeRef || $[59] !== style || $[60] !== t16 || $[61] !== t22 || $[62] !== t23) {
|
|
706
|
+
t24 = /* @__PURE__ */ jsxs(Accordion.Item, {
|
|
707
|
+
value: t16,
|
|
653
708
|
ref: setNodeRef,
|
|
654
709
|
style,
|
|
655
710
|
className: "group",
|
|
656
711
|
onMouseEnter: ctx.handleBlockMouseEnter,
|
|
657
712
|
onMouseLeave: ctx.handleBlockMouseLeave,
|
|
658
|
-
children: [
|
|
713
|
+
children: [t22, t23]
|
|
659
714
|
});
|
|
660
|
-
$[
|
|
661
|
-
$[
|
|
662
|
-
$[
|
|
663
|
-
$[
|
|
664
|
-
$[
|
|
665
|
-
$[
|
|
666
|
-
$[
|
|
667
|
-
$[
|
|
668
|
-
} else
|
|
669
|
-
let
|
|
670
|
-
if ($[
|
|
671
|
-
|
|
672
|
-
value:
|
|
673
|
-
children:
|
|
715
|
+
$[56] = ctx.handleBlockMouseEnter;
|
|
716
|
+
$[57] = ctx.handleBlockMouseLeave;
|
|
717
|
+
$[58] = setNodeRef;
|
|
718
|
+
$[59] = style;
|
|
719
|
+
$[60] = t16;
|
|
720
|
+
$[61] = t22;
|
|
721
|
+
$[62] = t23;
|
|
722
|
+
$[63] = t24;
|
|
723
|
+
} else t24 = $[63];
|
|
724
|
+
let t25;
|
|
725
|
+
if ($[64] !== t15 || $[65] !== t24) {
|
|
726
|
+
t25 = /* @__PURE__ */ jsx(Accordion.Root, {
|
|
727
|
+
value: t15,
|
|
728
|
+
children: t24
|
|
674
729
|
});
|
|
675
|
-
$[
|
|
676
|
-
$[
|
|
677
|
-
$[
|
|
678
|
-
} else
|
|
679
|
-
return
|
|
730
|
+
$[64] = t15;
|
|
731
|
+
$[65] = t24;
|
|
732
|
+
$[66] = t25;
|
|
733
|
+
} else t25 = $[66];
|
|
734
|
+
return t25;
|
|
680
735
|
};
|
|
681
736
|
const LayoutBlockItem = (t0) => {
|
|
682
|
-
const $ = c(
|
|
683
|
-
if ($[0] !== "
|
|
684
|
-
for (let $i = 0; $i <
|
|
685
|
-
$[0] = "
|
|
737
|
+
const $ = c(42);
|
|
738
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
739
|
+
for (let $i = 0; $i < 42; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
740
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
686
741
|
}
|
|
687
742
|
const { block, layoutName } = t0;
|
|
688
743
|
const camoxApp = useCamoxApp();
|
|
@@ -695,6 +750,9 @@ const LayoutBlockItem = (t0) => {
|
|
|
695
750
|
} else t1 = $[3];
|
|
696
751
|
const blockDef = t1;
|
|
697
752
|
const ctx = useBlockTreeItem(block);
|
|
753
|
+
const previewSource = usePreviewSource();
|
|
754
|
+
const requireDraft = useRequireDraftSource();
|
|
755
|
+
const isReadOnly = previewSource !== "draft";
|
|
698
756
|
const displayText = blockDef?._internal.title ?? block.type;
|
|
699
757
|
let t2;
|
|
700
758
|
if ($[4] !== block.id) {
|
|
@@ -738,7 +796,7 @@ const LayoutBlockItem = (t0) => {
|
|
|
738
796
|
let t9;
|
|
739
797
|
if ($[14] !== t7) {
|
|
740
798
|
t9 = /* @__PURE__ */ jsx("div", {
|
|
741
|
-
className: "text-muted-foreground flex size-
|
|
799
|
+
className: "text-muted-foreground flex size-8 shrink-0 items-center justify-center",
|
|
742
800
|
children: /* @__PURE__ */ jsxs(Tooltip, { children: [t6, /* @__PURE__ */ jsxs(TooltipContent, { children: [
|
|
743
801
|
"From ",
|
|
744
802
|
t7,
|
|
@@ -760,33 +818,33 @@ const LayoutBlockItem = (t0) => {
|
|
|
760
818
|
$[17] = displayText;
|
|
761
819
|
$[18] = t10;
|
|
762
820
|
} else t10 = $[18];
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
821
|
+
let t11;
|
|
822
|
+
if ($[19] !== block || $[20] !== ctx.ellipsisPopoverOpen || $[21] !== ctx.setEllipsisPopoverOpen || $[22] !== isReadOnly || $[23] !== requireDraft) {
|
|
823
|
+
t11 = isReadOnly ? /* @__PURE__ */ jsx(BlockTreeItemEllipsis, {
|
|
824
|
+
open: false,
|
|
825
|
+
onClick: (e) => {
|
|
826
|
+
e.preventDefault();
|
|
827
|
+
e.stopPropagation();
|
|
828
|
+
requireDraft();
|
|
829
|
+
}
|
|
830
|
+
}) : /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
773
831
|
block,
|
|
774
832
|
open: ctx.ellipsisPopoverOpen,
|
|
775
833
|
onOpenChange: ctx.setEllipsisPopoverOpen,
|
|
776
834
|
isLayoutBlock: true,
|
|
777
|
-
layoutPlacement:
|
|
778
|
-
children:
|
|
835
|
+
layoutPlacement: block.placement,
|
|
836
|
+
children: /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen })
|
|
779
837
|
});
|
|
780
|
-
$[
|
|
781
|
-
$[
|
|
782
|
-
$[
|
|
838
|
+
$[19] = block;
|
|
839
|
+
$[20] = ctx.ellipsisPopoverOpen;
|
|
840
|
+
$[21] = ctx.setEllipsisPopoverOpen;
|
|
841
|
+
$[22] = isReadOnly;
|
|
842
|
+
$[23] = requireDraft;
|
|
783
843
|
$[24] = t11;
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
if ($[27] !== ctx.shouldShowActive || $[28] !== ctx.shouldShowHover || $[29] !== t10 || $[30] !== t13 || $[31] !== t9) {
|
|
789
|
-
t14 = /* @__PURE__ */ jsx(Accordion.Header, {
|
|
844
|
+
} else t11 = $[24];
|
|
845
|
+
let t12;
|
|
846
|
+
if ($[25] !== ctx.shouldShowActive || $[26] !== ctx.shouldShowHover || $[27] !== t10 || $[28] !== t11 || $[29] !== t9) {
|
|
847
|
+
t12 = /* @__PURE__ */ jsx(Accordion.Header, {
|
|
790
848
|
render: t5,
|
|
791
849
|
children: /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
|
|
792
850
|
shouldShowHover: ctx.shouldShowHover,
|
|
@@ -794,59 +852,62 @@ const LayoutBlockItem = (t0) => {
|
|
|
794
852
|
children: [
|
|
795
853
|
t9,
|
|
796
854
|
t10,
|
|
797
|
-
|
|
855
|
+
t11
|
|
798
856
|
]
|
|
799
857
|
})
|
|
800
858
|
});
|
|
801
|
-
$[
|
|
802
|
-
$[
|
|
803
|
-
$[
|
|
804
|
-
$[
|
|
805
|
-
$[
|
|
806
|
-
$[
|
|
807
|
-
} else
|
|
808
|
-
let
|
|
809
|
-
if ($[
|
|
810
|
-
|
|
811
|
-
$[
|
|
812
|
-
$[
|
|
813
|
-
} else
|
|
814
|
-
let
|
|
815
|
-
if ($[
|
|
816
|
-
|
|
859
|
+
$[25] = ctx.shouldShowActive;
|
|
860
|
+
$[26] = ctx.shouldShowHover;
|
|
861
|
+
$[27] = t10;
|
|
862
|
+
$[28] = t11;
|
|
863
|
+
$[29] = t9;
|
|
864
|
+
$[30] = t12;
|
|
865
|
+
} else t12 = $[30];
|
|
866
|
+
let t13;
|
|
867
|
+
if ($[31] !== block) {
|
|
868
|
+
t13 = /* @__PURE__ */ jsx(BlockTreeItemContent, { block });
|
|
869
|
+
$[31] = block;
|
|
870
|
+
$[32] = t13;
|
|
871
|
+
} else t13 = $[32];
|
|
872
|
+
let t14;
|
|
873
|
+
if ($[33] !== ctx.handleBlockMouseEnter || $[34] !== ctx.handleBlockMouseLeave || $[35] !== t12 || $[36] !== t13 || $[37] !== t4) {
|
|
874
|
+
t14 = /* @__PURE__ */ jsxs(Accordion.Item, {
|
|
817
875
|
value: t4,
|
|
818
876
|
className: "group",
|
|
819
877
|
onMouseEnter: ctx.handleBlockMouseEnter,
|
|
820
878
|
onMouseLeave: ctx.handleBlockMouseLeave,
|
|
821
|
-
children: [
|
|
879
|
+
children: [t12, t13]
|
|
822
880
|
});
|
|
823
|
-
$[
|
|
824
|
-
$[
|
|
825
|
-
$[
|
|
826
|
-
$[
|
|
827
|
-
$[
|
|
828
|
-
$[
|
|
829
|
-
} else
|
|
830
|
-
let
|
|
831
|
-
if ($[
|
|
832
|
-
|
|
881
|
+
$[33] = ctx.handleBlockMouseEnter;
|
|
882
|
+
$[34] = ctx.handleBlockMouseLeave;
|
|
883
|
+
$[35] = t12;
|
|
884
|
+
$[36] = t13;
|
|
885
|
+
$[37] = t4;
|
|
886
|
+
$[38] = t14;
|
|
887
|
+
} else t14 = $[38];
|
|
888
|
+
let t15;
|
|
889
|
+
if ($[39] !== t14 || $[40] !== t3) {
|
|
890
|
+
t15 = /* @__PURE__ */ jsx(Accordion.Root, {
|
|
833
891
|
value: t3,
|
|
834
|
-
children:
|
|
892
|
+
children: t14
|
|
835
893
|
});
|
|
836
|
-
$[
|
|
837
|
-
$[
|
|
838
|
-
$[
|
|
839
|
-
} else
|
|
840
|
-
return
|
|
894
|
+
$[39] = t14;
|
|
895
|
+
$[40] = t3;
|
|
896
|
+
$[41] = t15;
|
|
897
|
+
} else t15 = $[41];
|
|
898
|
+
return t15;
|
|
841
899
|
};
|
|
842
900
|
const PageTree = () => {
|
|
843
|
-
const $ = c(
|
|
844
|
-
if ($[0] !== "
|
|
845
|
-
for (let $i = 0; $i <
|
|
846
|
-
$[0] = "
|
|
901
|
+
const $ = c(56);
|
|
902
|
+
if ($[0] !== "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7") {
|
|
903
|
+
for (let $i = 0; $i < 56; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
904
|
+
$[0] = "4252672317e9d976c47102ba1a26a55d6393ec9a518eb0503aaa3be0355ffab7";
|
|
847
905
|
}
|
|
848
906
|
const page = usePreviewedPage();
|
|
849
|
-
const
|
|
907
|
+
const previewSource = usePreviewSource();
|
|
908
|
+
const requireDraft = useRequireDraftSource();
|
|
909
|
+
const isReadOnly = previewSource !== "draft";
|
|
910
|
+
const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page, previewSource);
|
|
850
911
|
const camoxApp = useCamoxApp();
|
|
851
912
|
const updatePosition = useUpdateBlockPosition();
|
|
852
913
|
const [activeId, setActiveId] = React.useState(null);
|
|
@@ -874,13 +935,17 @@ const PageTree = () => {
|
|
|
874
935
|
} else t2 = $[3];
|
|
875
936
|
const handleDragStart = t2;
|
|
876
937
|
let t3;
|
|
877
|
-
if ($[4] !== page || $[5] !== pageBlocks || $[6] !== updatePosition) {
|
|
938
|
+
if ($[4] !== page || $[5] !== pageBlocks || $[6] !== requireDraft || $[7] !== updatePosition) {
|
|
878
939
|
t3 = (event_0) => {
|
|
879
940
|
const { active, over } = event_0;
|
|
880
941
|
if (!over || active.id === over.id || !page) {
|
|
881
942
|
setActiveId(null);
|
|
882
943
|
return;
|
|
883
944
|
}
|
|
945
|
+
if (!requireDraft()) {
|
|
946
|
+
setActiveId(null);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
884
949
|
const oldIndex = pageBlocks.findIndex((block) => String(block.id) === active.id);
|
|
885
950
|
const newIndex = pageBlocks.findIndex((block_0) => String(block_0.id) === over.id);
|
|
886
951
|
if (oldIndex === -1 || newIndex === -1) {
|
|
@@ -905,73 +970,74 @@ const PageTree = () => {
|
|
|
905
970
|
};
|
|
906
971
|
$[4] = page;
|
|
907
972
|
$[5] = pageBlocks;
|
|
908
|
-
$[6] =
|
|
909
|
-
$[7] =
|
|
910
|
-
|
|
973
|
+
$[6] = requireDraft;
|
|
974
|
+
$[7] = updatePosition;
|
|
975
|
+
$[8] = t3;
|
|
976
|
+
} else t3 = $[8];
|
|
911
977
|
const handleDragEnd = t3;
|
|
912
978
|
let t4;
|
|
913
|
-
if ($[
|
|
979
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
914
980
|
t4 = () => {
|
|
915
981
|
setActiveId(null);
|
|
916
982
|
};
|
|
917
|
-
$[
|
|
918
|
-
} else t4 = $[
|
|
983
|
+
$[9] = t4;
|
|
984
|
+
} else t4 = $[9];
|
|
919
985
|
const handleDragCancel = t4;
|
|
920
986
|
if (!page) return null;
|
|
921
987
|
let t5;
|
|
922
|
-
if ($[
|
|
988
|
+
if ($[10] !== camoxApp || $[11] !== page.layout) {
|
|
923
989
|
t5 = page.layout ? camoxApp.getLayoutById(page.layout.layoutId) : void 0;
|
|
924
|
-
$[
|
|
925
|
-
$[
|
|
926
|
-
$[
|
|
927
|
-
} else t5 = $[
|
|
990
|
+
$[10] = camoxApp;
|
|
991
|
+
$[11] = page.layout;
|
|
992
|
+
$[12] = t5;
|
|
993
|
+
} else t5 = $[12];
|
|
928
994
|
const layout = t5;
|
|
929
995
|
let t6;
|
|
930
|
-
if ($[
|
|
996
|
+
if ($[13] !== layout?._internal || $[14] !== layoutBeforeBlocks) {
|
|
931
997
|
let t7;
|
|
932
|
-
if ($[
|
|
998
|
+
if ($[16] !== layout?._internal) {
|
|
933
999
|
t7 = (block_1) => /* @__PURE__ */ jsx(LayoutBlockItem, {
|
|
934
1000
|
block: block_1,
|
|
935
1001
|
layoutName: layout?._internal.title ?? "Unknown"
|
|
936
1002
|
}, String(block_1.id));
|
|
937
|
-
$[
|
|
938
|
-
$[
|
|
939
|
-
} else t7 = $[
|
|
1003
|
+
$[16] = layout?._internal;
|
|
1004
|
+
$[17] = t7;
|
|
1005
|
+
} else t7 = $[17];
|
|
940
1006
|
t6 = layoutBeforeBlocks.map(t7);
|
|
941
|
-
$[
|
|
942
|
-
$[
|
|
943
|
-
$[
|
|
944
|
-
} else t6 = $[
|
|
1007
|
+
$[13] = layout?._internal;
|
|
1008
|
+
$[14] = layoutBeforeBlocks;
|
|
1009
|
+
$[15] = t6;
|
|
1010
|
+
} else t6 = $[15];
|
|
945
1011
|
let t7;
|
|
946
|
-
if ($[
|
|
1012
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
947
1013
|
t7 = [restrictToVerticalAxis];
|
|
948
|
-
$[
|
|
949
|
-
} else t7 = $[
|
|
1014
|
+
$[18] = t7;
|
|
1015
|
+
} else t7 = $[18];
|
|
950
1016
|
let t8;
|
|
951
|
-
if ($[
|
|
952
|
-
t8 = pageBlocks.map(
|
|
953
|
-
$[
|
|
954
|
-
$[
|
|
955
|
-
} else t8 = $[
|
|
1017
|
+
if ($[19] !== pageBlocks) {
|
|
1018
|
+
t8 = pageBlocks.map(_temp9);
|
|
1019
|
+
$[19] = pageBlocks;
|
|
1020
|
+
$[20] = t8;
|
|
1021
|
+
} else t8 = $[20];
|
|
956
1022
|
let t9;
|
|
957
|
-
if ($[
|
|
958
|
-
t9 = pageBlocks.map(
|
|
959
|
-
$[
|
|
960
|
-
$[
|
|
961
|
-
} else t9 = $[
|
|
1023
|
+
if ($[21] !== pageBlocks) {
|
|
1024
|
+
t9 = pageBlocks.map(_temp0);
|
|
1025
|
+
$[21] = pageBlocks;
|
|
1026
|
+
$[22] = t9;
|
|
1027
|
+
} else t9 = $[22];
|
|
962
1028
|
let t10;
|
|
963
|
-
if ($[
|
|
1029
|
+
if ($[23] !== t8 || $[24] !== t9) {
|
|
964
1030
|
t10 = /* @__PURE__ */ jsx(SortableContext, {
|
|
965
1031
|
items: t8,
|
|
966
1032
|
strategy: verticalListSortingStrategy,
|
|
967
1033
|
children: t9
|
|
968
1034
|
});
|
|
969
|
-
$[
|
|
970
|
-
$[
|
|
971
|
-
$[
|
|
972
|
-
} else t10 = $[
|
|
1035
|
+
$[23] = t8;
|
|
1036
|
+
$[24] = t9;
|
|
1037
|
+
$[25] = t10;
|
|
1038
|
+
} else t10 = $[25];
|
|
973
1039
|
let t11;
|
|
974
|
-
if ($[
|
|
1040
|
+
if ($[26] !== activeId || $[27] !== pageBlocks) {
|
|
975
1041
|
t11 = activeId ? (() => {
|
|
976
1042
|
const activeBlock = pageBlocks.find((b) => String(b.id) === activeId);
|
|
977
1043
|
if (!activeBlock) return null;
|
|
@@ -986,21 +1052,21 @@ const PageTree = () => {
|
|
|
986
1052
|
})
|
|
987
1053
|
});
|
|
988
1054
|
})() : null;
|
|
989
|
-
$[
|
|
990
|
-
$[
|
|
991
|
-
$[
|
|
992
|
-
} else t11 = $[
|
|
1055
|
+
$[26] = activeId;
|
|
1056
|
+
$[27] = pageBlocks;
|
|
1057
|
+
$[28] = t11;
|
|
1058
|
+
} else t11 = $[28];
|
|
993
1059
|
let t12;
|
|
994
|
-
if ($[
|
|
1060
|
+
if ($[29] !== t11) {
|
|
995
1061
|
t12 = /* @__PURE__ */ jsx(DragOverlay, {
|
|
996
1062
|
dropAnimation: null,
|
|
997
1063
|
children: t11
|
|
998
1064
|
});
|
|
999
|
-
$[
|
|
1000
|
-
$[
|
|
1001
|
-
} else t12 = $[
|
|
1065
|
+
$[29] = t11;
|
|
1066
|
+
$[30] = t12;
|
|
1067
|
+
} else t12 = $[30];
|
|
1002
1068
|
let t13;
|
|
1003
|
-
if ($[
|
|
1069
|
+
if ($[31] !== handleDragEnd || $[32] !== sensors || $[33] !== t10 || $[34] !== t12) {
|
|
1004
1070
|
t13 = /* @__PURE__ */ jsxs(DndContext, {
|
|
1005
1071
|
sensors,
|
|
1006
1072
|
collisionDetection: closestCenter,
|
|
@@ -1010,30 +1076,30 @@ const PageTree = () => {
|
|
|
1010
1076
|
modifiers: t7,
|
|
1011
1077
|
children: [t10, t12]
|
|
1012
1078
|
});
|
|
1013
|
-
$[
|
|
1014
|
-
$[
|
|
1015
|
-
$[
|
|
1016
|
-
$[
|
|
1017
|
-
$[
|
|
1018
|
-
} else t13 = $[
|
|
1079
|
+
$[31] = handleDragEnd;
|
|
1080
|
+
$[32] = sensors;
|
|
1081
|
+
$[33] = t10;
|
|
1082
|
+
$[34] = t12;
|
|
1083
|
+
$[35] = t13;
|
|
1084
|
+
} else t13 = $[35];
|
|
1019
1085
|
let t14;
|
|
1020
|
-
if ($[
|
|
1086
|
+
if ($[36] !== layout?._internal || $[37] !== layoutAfterBlocks) {
|
|
1021
1087
|
let t15;
|
|
1022
|
-
if ($[
|
|
1088
|
+
if ($[39] !== layout?._internal) {
|
|
1023
1089
|
t15 = (block_4) => /* @__PURE__ */ jsx(LayoutBlockItem, {
|
|
1024
1090
|
block: block_4,
|
|
1025
1091
|
layoutName: layout?._internal.title ?? "Unknown"
|
|
1026
1092
|
}, String(block_4.id));
|
|
1027
|
-
$[
|
|
1028
|
-
$[
|
|
1029
|
-
} else t15 = $[
|
|
1093
|
+
$[39] = layout?._internal;
|
|
1094
|
+
$[40] = t15;
|
|
1095
|
+
} else t15 = $[40];
|
|
1030
1096
|
t14 = layoutAfterBlocks.map(t15);
|
|
1031
|
-
$[
|
|
1032
|
-
$[
|
|
1033
|
-
$[
|
|
1034
|
-
} else t14 = $[
|
|
1097
|
+
$[36] = layout?._internal;
|
|
1098
|
+
$[37] = layoutAfterBlocks;
|
|
1099
|
+
$[38] = t14;
|
|
1100
|
+
} else t14 = $[38];
|
|
1035
1101
|
let t15;
|
|
1036
|
-
if ($[
|
|
1102
|
+
if ($[41] !== t13 || $[42] !== t14 || $[43] !== t6) {
|
|
1037
1103
|
t15 = /* @__PURE__ */ jsxs("div", {
|
|
1038
1104
|
className: "flex flex-col gap-0.5",
|
|
1039
1105
|
children: [
|
|
@@ -1042,49 +1108,74 @@ const PageTree = () => {
|
|
|
1042
1108
|
t14
|
|
1043
1109
|
]
|
|
1044
1110
|
});
|
|
1045
|
-
$[
|
|
1046
|
-
$[
|
|
1047
|
-
$[
|
|
1048
|
-
$[
|
|
1049
|
-
} else t15 = $[
|
|
1050
|
-
|
|
1051
|
-
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1052
|
-
t16 = /* @__PURE__ */ jsxs(Button, {
|
|
1053
|
-
variant: "secondary",
|
|
1054
|
-
onClick: _temp0,
|
|
1055
|
-
children: [/* @__PURE__ */ jsx(Plus, {}), "Add block"]
|
|
1056
|
-
});
|
|
1057
|
-
$[44] = t16;
|
|
1058
|
-
} else t16 = $[44];
|
|
1111
|
+
$[41] = t13;
|
|
1112
|
+
$[42] = t14;
|
|
1113
|
+
$[43] = t6;
|
|
1114
|
+
$[44] = t15;
|
|
1115
|
+
} else t15 = $[44];
|
|
1116
|
+
const t16 = isReadOnly && "opacity-50 cursor-not-allowed";
|
|
1059
1117
|
let t17;
|
|
1060
|
-
if ($[45] !==
|
|
1061
|
-
t17 =
|
|
1062
|
-
$[45] =
|
|
1118
|
+
if ($[45] !== t16) {
|
|
1119
|
+
t17 = cn(t16);
|
|
1120
|
+
$[45] = t16;
|
|
1063
1121
|
$[46] = t17;
|
|
1064
1122
|
} else t17 = $[46];
|
|
1065
|
-
|
|
1123
|
+
let t18;
|
|
1124
|
+
if ($[47] !== requireDraft) {
|
|
1125
|
+
t18 = () => {
|
|
1126
|
+
if (!requireDraft()) return;
|
|
1127
|
+
previewStore.send({
|
|
1128
|
+
type: "openAddBlockSheet",
|
|
1129
|
+
via: "page-tree"
|
|
1130
|
+
});
|
|
1131
|
+
};
|
|
1132
|
+
$[47] = requireDraft;
|
|
1133
|
+
$[48] = t18;
|
|
1134
|
+
} else t18 = $[48];
|
|
1135
|
+
let t19;
|
|
1136
|
+
if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1137
|
+
t19 = /* @__PURE__ */ jsx(Plus, {});
|
|
1138
|
+
$[49] = t19;
|
|
1139
|
+
} else t19 = $[49];
|
|
1140
|
+
let t20;
|
|
1141
|
+
if ($[50] !== t17 || $[51] !== t18) {
|
|
1142
|
+
t20 = /* @__PURE__ */ jsxs(Button, {
|
|
1143
|
+
variant: "secondary",
|
|
1144
|
+
className: t17,
|
|
1145
|
+
onClick: t18,
|
|
1146
|
+
children: [t19, "Add block"]
|
|
1147
|
+
});
|
|
1148
|
+
$[50] = t17;
|
|
1149
|
+
$[51] = t18;
|
|
1150
|
+
$[52] = t20;
|
|
1151
|
+
} else t20 = $[52];
|
|
1152
|
+
let t21;
|
|
1153
|
+
if ($[53] !== t15 || $[54] !== t20) {
|
|
1154
|
+
t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t15, t20] });
|
|
1155
|
+
$[53] = t15;
|
|
1156
|
+
$[54] = t20;
|
|
1157
|
+
$[55] = t21;
|
|
1158
|
+
} else t21 = $[55];
|
|
1159
|
+
return t21;
|
|
1066
1160
|
};
|
|
1067
|
-
function
|
|
1161
|
+
function _temp(state) {
|
|
1162
|
+
return state.context.previewSource;
|
|
1163
|
+
}
|
|
1164
|
+
function _temp4(state) {
|
|
1068
1165
|
return state.context.selection;
|
|
1069
1166
|
}
|
|
1070
|
-
function
|
|
1167
|
+
function _temp5(state_0) {
|
|
1071
1168
|
return state_0.context.iframeElement;
|
|
1072
1169
|
}
|
|
1073
|
-
function
|
|
1170
|
+
function _temp6(i) {
|
|
1074
1171
|
return [i.id, i];
|
|
1075
1172
|
}
|
|
1076
|
-
function
|
|
1173
|
+
function _temp9(block_2) {
|
|
1077
1174
|
return String(block_2.id);
|
|
1078
1175
|
}
|
|
1079
|
-
function
|
|
1176
|
+
function _temp0(block_3) {
|
|
1080
1177
|
return /* @__PURE__ */ jsx(SortableBlock, { block: block_3 }, String(block_3.id));
|
|
1081
1178
|
}
|
|
1082
|
-
function _temp0() {
|
|
1083
|
-
return previewStore.send({
|
|
1084
|
-
type: "openAddBlockSheet",
|
|
1085
|
-
via: "page-tree"
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
1179
|
|
|
1089
1180
|
//#endregion
|
|
1090
1181
|
export { PageTree };
|