camox 0.40.0 → 0.41.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/components/PlatformLabel.js +62 -0
- package/dist/core/components/lexical/GradientNode.js +126 -0
- package/dist/core/components/lexical/InlineLexicalEditor.js +37 -56
- package/dist/core/components/lexical/InlineStylesPlugin.js +183 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +49 -46
- package/dist/core/components/lexical/SidebarLexicalEditor.js +197 -151
- package/dist/core/components/lexical/editorConfig.js +25 -7
- package/dist/core/components/lexical/selectTextLink.js +21 -0
- package/dist/core/createApp.d.ts +30 -17
- package/dist/core/createApp.js +14 -3
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +18 -15
- package/dist/core/createLayout.d.ts +48 -4
- package/dist/core/createLayout.js +51 -23
- package/dist/core/derivedRoutes.js +36 -0
- package/dist/core/editing/createEditableBlock.d.ts +9 -8
- package/dist/core/editing/createEditableBlock.js +167 -168
- package/dist/core/lib/lexicalReact.d.ts +1 -26
- package/dist/core/lib/lexicalReact.js +46 -60
- package/dist/core/lib/lexicalState.js +164 -81
- package/dist/core/lib/modifierFormats.js +4 -15
- package/dist/core/lib/textStyles.d.ts +27 -0
- package/dist/core/lib/textStyles.js +47 -0
- package/dist/features/navigation/navigation.d.ts +2 -0
- package/dist/features/navigation/navigation.js +51 -46
- package/dist/features/page/DerivedPageContent.js +61 -0
- package/dist/features/page/PublishedPageContent.js +52 -83
- package/dist/features/page/SharedLayoutContent.js +66 -0
- package/dist/features/preview/CamoxPreview.d.ts +16 -1
- package/dist/features/preview/CamoxPreview.js +242 -265
- package/dist/features/preview/DerivedPreview.js +137 -0
- package/dist/features/preview/EditablePageExperience.js +25 -8
- package/dist/features/preview/components/AddBlockSidebar.js +43 -33
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockThumbnail.js +192 -0
- package/dist/features/preview/components/CreatePageModal.js +123 -115
- package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.js +163 -0
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
- package/dist/features/preview/components/FieldToolbar.js +42 -20
- package/dist/features/preview/components/Frame.js +133 -140
- package/dist/features/preview/components/LeftSidebar.js +42 -38
- package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
- package/dist/features/preview/components/Overlays.js +57 -42
- package/dist/features/preview/components/PageInfoSidebar.js +63 -55
- package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
- package/dist/features/preview/components/PagePicker.js +205 -153
- package/dist/features/preview/components/PageTree.js +298 -206
- package/dist/features/preview/components/PreviewActivation.js +78 -0
- package/dist/features/preview/components/PreviewPanel.js +67 -35
- package/dist/features/preview/components/PreviewToolbar.js +218 -232
- package/dist/features/preview/components/PublicationRow.js +431 -0
- package/dist/features/preview/components/PublishDialog.js +180 -97
- package/dist/features/preview/components/RightSidebar.js +19 -34
- package/dist/features/preview/components/previewStyles.js +8 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
- package/dist/features/preview/previewConstants.js +8 -0
- package/dist/features/preview/previewStore.js +0 -10
- package/dist/features/preview/publication.js +71 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
- package/dist/features/provider/CoreCamoxProvider.js +11 -2
- package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
- package/dist/features/routes/pageRuntime.d.ts +10 -0
- package/dist/features/routes/pageRuntime.js +7 -9
- package/dist/features/runtime/PreviewDocumentContext.js +7 -0
- package/dist/features/runtime/RuntimeChrome.js +137 -0
- package/dist/features/runtime/SharedChromeContext.js +7 -0
- package/dist/features/runtime/navigationRequest.js +21 -0
- package/dist/features/runtime/navigationTarget.js +23 -0
- package/dist/features/runtime/pageApp.js +196 -121
- package/dist/features/runtime/pageNavigation.js +79 -130
- package/dist/features/runtime/runtime.d.ts +11 -0
- package/dist/features/runtime/runtime.js +183 -47
- package/dist/features/runtime/studioApp.d.ts +2 -11
- package/dist/features/runtime/studioApp.js +14 -177
- package/dist/features/studio/CamoxStudio.js +27 -13
- package/dist/features/studio/components/Navbar.js +80 -74
- package/dist/features/studio/studioTheme.js +25 -0
- package/dist/features/studio/useTheme.js +94 -109
- package/dist/features/vite/appGeneration.js +12 -3
- package/dist/features/vite/definitionsSync.js +4 -2
- package/dist/features/vite/layoutGeneration.js +38 -0
- package/dist/features/vite/runtimeDev.js +3 -1
- package/dist/lib/auth.js +15 -13
- package/dist/lib/normalized-data.js +4 -4
- package/dist/lib/platform.js +13 -0
- package/dist/lib/utils.js +90 -38
- package/dist/studio-overlays.css +5 -40
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +2 -0
- package/skills/camox/references/block-definitions.md +31 -12
- package/skills/camox/references/layout-definitions.md +2 -0
- package/dist/core/lib/modifiers.js +0 -24
- package/dist/features/preview/previewQueryFns.js +0 -23
- package/dist/features/runtime/studioNavigation.js +0 -120
|
@@ -11,7 +11,7 @@ import * as React from "react";
|
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { useSelector } from "@xstate/store-react";
|
|
13
13
|
import { Button } from "@camox/ui/button";
|
|
14
|
-
import { Ellipsis, GripVertical, LayoutTemplate, Plus } from "lucide-react";
|
|
14
|
+
import { Ellipsis, GripVertical, LayoutTemplate, Pencil, Plus } from "lucide-react";
|
|
15
15
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
16
16
|
import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
17
17
|
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
@@ -21,17 +21,17 @@ import { CSS } from "@dnd-kit/utilities";
|
|
|
21
21
|
//#region src/features/preview/components/PageTree.tsx
|
|
22
22
|
const usePreviewSource = () => {
|
|
23
23
|
const $ = c(1);
|
|
24
|
-
if ($[0] !== "
|
|
24
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
25
25
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
|
-
$[0] = "
|
|
26
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
27
27
|
}
|
|
28
28
|
return useSelector(previewStore, _temp);
|
|
29
29
|
};
|
|
30
30
|
function useBlockTreeItem(block, t0) {
|
|
31
31
|
const $ = c(17);
|
|
32
|
-
if ($[0] !== "
|
|
32
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
33
33
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
34
|
-
$[0] = "
|
|
34
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
35
35
|
}
|
|
36
36
|
const isDragging = t0 === void 0 ? false : t0;
|
|
37
37
|
const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
|
|
@@ -114,9 +114,9 @@ function _temp2(state) {
|
|
|
114
114
|
}
|
|
115
115
|
const BlockTreeItemHeader = (t0) => {
|
|
116
116
|
const $ = c(17);
|
|
117
|
-
if ($[0] !== "
|
|
117
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
118
118
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
119
|
-
$[0] = "
|
|
119
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
120
120
|
}
|
|
121
121
|
let children;
|
|
122
122
|
let className;
|
|
@@ -169,9 +169,9 @@ const BlockTreeItemHeader = (t0) => {
|
|
|
169
169
|
};
|
|
170
170
|
const BlockTreeItemTrigger = (t0) => {
|
|
171
171
|
const $ = c(5);
|
|
172
|
-
if ($[0] !== "
|
|
172
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
173
173
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
174
|
-
$[0] = "
|
|
174
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
175
175
|
}
|
|
176
176
|
const { displayText, onClick } = t0;
|
|
177
177
|
let t1;
|
|
@@ -196,9 +196,9 @@ const BlockTreeItemTrigger = (t0) => {
|
|
|
196
196
|
};
|
|
197
197
|
const BlockTreeItemEllipsis = (t0) => {
|
|
198
198
|
const $ = c(12);
|
|
199
|
-
if ($[0] !== "
|
|
199
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
200
200
|
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
201
|
-
$[0] = "
|
|
201
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
202
202
|
}
|
|
203
203
|
let className;
|
|
204
204
|
let open;
|
|
@@ -249,9 +249,9 @@ const animateLayoutChanges = (args) => {
|
|
|
249
249
|
};
|
|
250
250
|
const SortableBlock = (t0) => {
|
|
251
251
|
const $ = c(52);
|
|
252
|
-
if ($[0] !== "
|
|
252
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
253
253
|
for (let $i = 0; $i < 52; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
254
|
-
$[0] = "
|
|
254
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
255
255
|
}
|
|
256
256
|
const { block } = t0;
|
|
257
257
|
const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
|
|
@@ -433,73 +433,89 @@ const SortableBlock = (t0) => {
|
|
|
433
433
|
return t18;
|
|
434
434
|
};
|
|
435
435
|
const LayoutBlockItem = (t0) => {
|
|
436
|
-
const $ = c(
|
|
437
|
-
if ($[0] !== "
|
|
438
|
-
for (let $i = 0; $i <
|
|
439
|
-
$[0] = "
|
|
436
|
+
const $ = c(30);
|
|
437
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
438
|
+
for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
439
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
440
440
|
}
|
|
441
|
-
const { block, layoutName } = t0;
|
|
441
|
+
const { block, layoutName, derived: t1 } = t0;
|
|
442
|
+
const derived = t1 === void 0 ? false : t1;
|
|
442
443
|
const camoxApp = useCamoxApp();
|
|
443
|
-
let
|
|
444
|
+
let t2;
|
|
444
445
|
if ($[1] !== block.type || $[2] !== camoxApp) {
|
|
445
|
-
|
|
446
|
+
t2 = camoxApp.getBlockById(block.type);
|
|
446
447
|
$[1] = block.type;
|
|
447
448
|
$[2] = camoxApp;
|
|
448
|
-
$[3] =
|
|
449
|
-
} else
|
|
450
|
-
const blockDef =
|
|
449
|
+
$[3] = t2;
|
|
450
|
+
} else t2 = $[3];
|
|
451
|
+
const blockDef = t2;
|
|
451
452
|
const ctx = useBlockTreeItem(block);
|
|
452
453
|
const previewSource = usePreviewSource();
|
|
453
454
|
const requireDraft = useRequireDraftSource();
|
|
454
455
|
const isReadOnly = previewSource !== "draft";
|
|
455
456
|
const displayText = blockDef?._internal.title ?? block.type;
|
|
456
|
-
let t2;
|
|
457
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
458
|
-
t2 = /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-4 w-4" }) });
|
|
459
|
-
$[4] = t2;
|
|
460
|
-
} else t2 = $[4];
|
|
461
457
|
let t3;
|
|
458
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
459
|
+
t3 = /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-4 w-4" }) });
|
|
460
|
+
$[4] = t3;
|
|
461
|
+
} else t3 = $[4];
|
|
462
|
+
let t4;
|
|
462
463
|
if ($[5] !== layoutName) {
|
|
463
|
-
|
|
464
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
464
465
|
className: "font-semibold",
|
|
465
466
|
children: layoutName
|
|
466
467
|
});
|
|
467
468
|
$[5] = layoutName;
|
|
468
|
-
$[6] =
|
|
469
|
-
} else
|
|
470
|
-
let t4;
|
|
471
|
-
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
472
|
-
t4 = /* @__PURE__ */ jsx("br", {});
|
|
473
|
-
$[7] = t4;
|
|
474
|
-
} else t4 = $[7];
|
|
469
|
+
$[6] = t4;
|
|
470
|
+
} else t4 = $[6];
|
|
475
471
|
let t5;
|
|
476
|
-
if ($[
|
|
477
|
-
t5 = /* @__PURE__ */ jsx("
|
|
472
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
473
|
+
t5 = /* @__PURE__ */ jsx("br", {});
|
|
474
|
+
$[7] = t5;
|
|
475
|
+
} else t5 = $[7];
|
|
476
|
+
const t6 = blockDef?._internal.synced ? "Synced: editing this block updates it across all layouts and pages" : "Changing the content may affect other pages";
|
|
477
|
+
let t7;
|
|
478
|
+
if ($[8] !== t4 || $[9] !== t6) {
|
|
479
|
+
t7 = /* @__PURE__ */ jsx("div", {
|
|
478
480
|
className: "text-muted-foreground flex size-8 shrink-0 items-center justify-center",
|
|
479
|
-
children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
481
|
+
children: /* @__PURE__ */ jsxs(Tooltip, { children: [t3, /* @__PURE__ */ jsxs(TooltipContent, { children: [
|
|
480
482
|
"From ",
|
|
481
|
-
t3,
|
|
482
|
-
" layout.",
|
|
483
483
|
t4,
|
|
484
|
-
"
|
|
484
|
+
" layout.",
|
|
485
|
+
t5,
|
|
486
|
+
t6
|
|
485
487
|
] })] })
|
|
486
488
|
});
|
|
487
|
-
$[8] =
|
|
488
|
-
$[9] =
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
489
|
+
$[8] = t4;
|
|
490
|
+
$[9] = t6;
|
|
491
|
+
$[10] = t7;
|
|
492
|
+
} else t7 = $[10];
|
|
493
|
+
let t8;
|
|
494
|
+
if ($[11] !== ctx.toggleSelection || $[12] !== displayText) {
|
|
495
|
+
t8 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
|
|
493
496
|
displayText,
|
|
494
497
|
onClick: ctx.toggleSelection
|
|
495
498
|
});
|
|
496
|
-
$[
|
|
497
|
-
$[
|
|
498
|
-
$[
|
|
499
|
-
} else
|
|
500
|
-
let
|
|
501
|
-
if ($[
|
|
502
|
-
|
|
499
|
+
$[11] = ctx.toggleSelection;
|
|
500
|
+
$[12] = displayText;
|
|
501
|
+
$[13] = t8;
|
|
502
|
+
} else t8 = $[13];
|
|
503
|
+
let t9;
|
|
504
|
+
if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived || $[18] !== displayText || $[19] !== isReadOnly || $[20] !== requireDraft) {
|
|
505
|
+
t9 = derived ? /* @__PURE__ */ jsx(Button, {
|
|
506
|
+
variant: "ghost",
|
|
507
|
+
size: "icon-sm",
|
|
508
|
+
className: "text-muted-foreground hidden group-focus-within:flex group-hover:flex",
|
|
509
|
+
"aria-label": `Edit ${displayText} in form`,
|
|
510
|
+
onClick: () => {
|
|
511
|
+
if (!requireDraft()) return;
|
|
512
|
+
previewStore.send({
|
|
513
|
+
type: "openBlockContentSheet",
|
|
514
|
+
blockId: block.id
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
children: /* @__PURE__ */ jsx(Pencil, { className: "size-4" })
|
|
518
|
+
}) : isReadOnly ? /* @__PURE__ */ jsx(BlockTreeItemEllipsis, {
|
|
503
519
|
open: false,
|
|
504
520
|
onClick: (e) => {
|
|
505
521
|
e.preventDefault();
|
|
@@ -514,45 +530,85 @@ const LayoutBlockItem = (t0) => {
|
|
|
514
530
|
layoutPlacement: block.placement,
|
|
515
531
|
children: /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen })
|
|
516
532
|
});
|
|
517
|
-
$[
|
|
518
|
-
$[
|
|
519
|
-
$[
|
|
520
|
-
$[
|
|
521
|
-
$[
|
|
522
|
-
$[
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
533
|
+
$[14] = block;
|
|
534
|
+
$[15] = ctx.ellipsisPopoverOpen;
|
|
535
|
+
$[16] = ctx.setEllipsisPopoverOpen;
|
|
536
|
+
$[17] = derived;
|
|
537
|
+
$[18] = displayText;
|
|
538
|
+
$[19] = isReadOnly;
|
|
539
|
+
$[20] = requireDraft;
|
|
540
|
+
$[21] = t9;
|
|
541
|
+
} else t9 = $[21];
|
|
542
|
+
let t10;
|
|
543
|
+
if ($[22] !== ctx.handleBlockMouseEnter || $[23] !== ctx.handleBlockMouseLeave || $[24] !== ctx.shouldShowActive || $[25] !== ctx.shouldShowHover || $[26] !== t7 || $[27] !== t8 || $[28] !== t9) {
|
|
544
|
+
t10 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
|
|
527
545
|
className: "group",
|
|
528
546
|
shouldShowHover: ctx.shouldShowHover,
|
|
529
547
|
shouldShowActive: ctx.shouldShowActive,
|
|
530
548
|
onMouseEnter: ctx.handleBlockMouseEnter,
|
|
531
549
|
onMouseLeave: ctx.handleBlockMouseLeave,
|
|
532
550
|
children: [
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
551
|
+
t7,
|
|
552
|
+
t8,
|
|
553
|
+
t9
|
|
536
554
|
]
|
|
537
555
|
});
|
|
538
|
-
$[
|
|
539
|
-
$[
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
$[
|
|
543
|
-
$[
|
|
544
|
-
$[
|
|
545
|
-
$[
|
|
546
|
-
} else
|
|
547
|
-
return
|
|
556
|
+
$[22] = ctx.handleBlockMouseEnter;
|
|
557
|
+
$[23] = ctx.handleBlockMouseLeave;
|
|
558
|
+
$[24] = ctx.shouldShowActive;
|
|
559
|
+
$[25] = ctx.shouldShowHover;
|
|
560
|
+
$[26] = t7;
|
|
561
|
+
$[27] = t8;
|
|
562
|
+
$[28] = t9;
|
|
563
|
+
$[29] = t10;
|
|
564
|
+
} else t10 = $[29];
|
|
565
|
+
return t10;
|
|
566
|
+
};
|
|
567
|
+
const BlockInsertionIndicator = () => {
|
|
568
|
+
const $ = c(4);
|
|
569
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
570
|
+
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
571
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
572
|
+
}
|
|
573
|
+
const ref = React.useRef(null);
|
|
574
|
+
let t0;
|
|
575
|
+
let t1;
|
|
576
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
577
|
+
t0 = () => {
|
|
578
|
+
ref.current?.scrollIntoView({ block: "nearest" });
|
|
579
|
+
};
|
|
580
|
+
t1 = [];
|
|
581
|
+
$[1] = t0;
|
|
582
|
+
$[2] = t1;
|
|
583
|
+
} else {
|
|
584
|
+
t0 = $[1];
|
|
585
|
+
t1 = $[2];
|
|
586
|
+
}
|
|
587
|
+
React.useEffect(t0, t1);
|
|
588
|
+
let t2;
|
|
589
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
590
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
591
|
+
ref,
|
|
592
|
+
className: "pointer-events-none relative z-30 h-2 shrink-0",
|
|
593
|
+
"aria-hidden": "true",
|
|
594
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
595
|
+
className: "bg-primary absolute inset-x-1 top-1/2 h-0.5 -translate-y-1/2 rounded-full motion-safe:animate-pulse",
|
|
596
|
+
children: /* @__PURE__ */ jsx("div", { className: "bg-primary absolute -top-0.5 -left-0.5 size-1.5 rounded-full" })
|
|
597
|
+
})
|
|
598
|
+
});
|
|
599
|
+
$[3] = t2;
|
|
600
|
+
} else t2 = $[3];
|
|
601
|
+
return t2;
|
|
548
602
|
};
|
|
549
603
|
const PageTree = () => {
|
|
550
|
-
const $ = c(
|
|
551
|
-
if ($[0] !== "
|
|
552
|
-
for (let $i = 0; $i <
|
|
553
|
-
$[0] = "
|
|
604
|
+
const $ = c(71);
|
|
605
|
+
if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
|
|
606
|
+
for (let $i = 0; $i < 71; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
607
|
+
$[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
|
|
554
608
|
}
|
|
555
609
|
const page = usePreviewedPage();
|
|
610
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp4);
|
|
611
|
+
const peekedBlockPosition = useSelector(previewStore, _temp5);
|
|
556
612
|
const previewSource = usePreviewSource();
|
|
557
613
|
const requireDraft = useRequireDraftSource();
|
|
558
614
|
const isReadOnly = previewSource !== "draft";
|
|
@@ -642,52 +698,85 @@ const PageTree = () => {
|
|
|
642
698
|
} else t5 = $[12];
|
|
643
699
|
const layout = t5;
|
|
644
700
|
let t6;
|
|
645
|
-
if ($[13] !==
|
|
701
|
+
if ($[13] !== pageBlocks || $[14] !== peekedBlockPosition) {
|
|
646
702
|
let t7;
|
|
647
|
-
if ($[16] !==
|
|
648
|
-
t7 = (block_1) =>
|
|
649
|
-
|
|
650
|
-
layoutName: layout?._internal.title ?? "Unknown"
|
|
651
|
-
}, String(block_1.id));
|
|
652
|
-
$[16] = layout?._internal;
|
|
703
|
+
if ($[16] !== peekedBlockPosition) {
|
|
704
|
+
t7 = (block_1) => peekedBlockPosition != null && block_1.position > peekedBlockPosition;
|
|
705
|
+
$[16] = peekedBlockPosition;
|
|
653
706
|
$[17] = t7;
|
|
654
707
|
} else t7 = $[17];
|
|
655
|
-
t6 =
|
|
656
|
-
$[13] =
|
|
657
|
-
$[14] =
|
|
708
|
+
t6 = pageBlocks.findIndex(t7);
|
|
709
|
+
$[13] = pageBlocks;
|
|
710
|
+
$[14] = peekedBlockPosition;
|
|
658
711
|
$[15] = t6;
|
|
659
712
|
} else t6 = $[15];
|
|
713
|
+
const nextBlockIndex = t6;
|
|
714
|
+
const insertionIndex = peekedBlockPosition === "" ? 0 : nextBlockIndex === -1 ? pageBlocks.length : nextBlockIndex;
|
|
660
715
|
let t7;
|
|
661
|
-
if ($[18]
|
|
662
|
-
|
|
663
|
-
$[
|
|
664
|
-
|
|
716
|
+
if ($[18] !== layout?._internal || $[19] !== layoutBeforeBlocks) {
|
|
717
|
+
let t8;
|
|
718
|
+
if ($[21] !== layout?._internal) {
|
|
719
|
+
t8 = (block_2) => /* @__PURE__ */ jsx(LayoutBlockItem, {
|
|
720
|
+
block: block_2,
|
|
721
|
+
layoutName: layout?._internal.title ?? "Unknown"
|
|
722
|
+
}, String(block_2.id));
|
|
723
|
+
$[21] = layout?._internal;
|
|
724
|
+
$[22] = t8;
|
|
725
|
+
} else t8 = $[22];
|
|
726
|
+
t7 = layoutBeforeBlocks.map(t8);
|
|
727
|
+
$[18] = layout?._internal;
|
|
728
|
+
$[19] = layoutBeforeBlocks;
|
|
729
|
+
$[20] = t7;
|
|
730
|
+
} else t7 = $[20];
|
|
665
731
|
let t8;
|
|
666
|
-
if ($[
|
|
667
|
-
t8 =
|
|
668
|
-
$[
|
|
669
|
-
|
|
670
|
-
} else t8 = $[20];
|
|
732
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
733
|
+
t8 = [restrictToVerticalAxis];
|
|
734
|
+
$[23] = t8;
|
|
735
|
+
} else t8 = $[23];
|
|
671
736
|
let t9;
|
|
672
|
-
if ($[
|
|
673
|
-
t9 = pageBlocks.map(
|
|
674
|
-
$[
|
|
675
|
-
$[
|
|
676
|
-
} else t9 = $[
|
|
737
|
+
if ($[24] !== pageBlocks) {
|
|
738
|
+
t9 = pageBlocks.map(_temp6);
|
|
739
|
+
$[24] = pageBlocks;
|
|
740
|
+
$[25] = t9;
|
|
741
|
+
} else t9 = $[25];
|
|
677
742
|
let t10;
|
|
678
|
-
if ($[
|
|
679
|
-
|
|
680
|
-
|
|
743
|
+
if ($[26] !== insertionIndex || $[27] !== isAddBlockSidebarOpen || $[28] !== pageBlocks) {
|
|
744
|
+
let t11;
|
|
745
|
+
if ($[30] !== insertionIndex || $[31] !== isAddBlockSidebarOpen) {
|
|
746
|
+
t11 = (block_4, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [isAddBlockSidebarOpen && index === insertionIndex && /* @__PURE__ */ jsx(BlockInsertionIndicator, {}), /* @__PURE__ */ jsx(SortableBlock, { block: block_4 })] }, String(block_4.id));
|
|
747
|
+
$[30] = insertionIndex;
|
|
748
|
+
$[31] = isAddBlockSidebarOpen;
|
|
749
|
+
$[32] = t11;
|
|
750
|
+
} else t11 = $[32];
|
|
751
|
+
t10 = pageBlocks.map(t11);
|
|
752
|
+
$[26] = insertionIndex;
|
|
753
|
+
$[27] = isAddBlockSidebarOpen;
|
|
754
|
+
$[28] = pageBlocks;
|
|
755
|
+
$[29] = t10;
|
|
756
|
+
} else t10 = $[29];
|
|
757
|
+
let t11;
|
|
758
|
+
if ($[33] !== insertionIndex || $[34] !== isAddBlockSidebarOpen || $[35] !== pageBlocks.length) {
|
|
759
|
+
t11 = isAddBlockSidebarOpen && insertionIndex === pageBlocks.length && /* @__PURE__ */ jsx(BlockInsertionIndicator, {});
|
|
760
|
+
$[33] = insertionIndex;
|
|
761
|
+
$[34] = isAddBlockSidebarOpen;
|
|
762
|
+
$[35] = pageBlocks.length;
|
|
763
|
+
$[36] = t11;
|
|
764
|
+
} else t11 = $[36];
|
|
765
|
+
let t12;
|
|
766
|
+
if ($[37] !== t10 || $[38] !== t11 || $[39] !== t9) {
|
|
767
|
+
t12 = /* @__PURE__ */ jsxs(SortableContext, {
|
|
768
|
+
items: t9,
|
|
681
769
|
strategy: verticalListSortingStrategy,
|
|
682
|
-
children:
|
|
770
|
+
children: [t10, t11]
|
|
683
771
|
});
|
|
684
|
-
$[
|
|
685
|
-
$[
|
|
686
|
-
$[
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
772
|
+
$[37] = t10;
|
|
773
|
+
$[38] = t11;
|
|
774
|
+
$[39] = t9;
|
|
775
|
+
$[40] = t12;
|
|
776
|
+
} else t12 = $[40];
|
|
777
|
+
let t13;
|
|
778
|
+
if ($[41] !== activeId || $[42] !== pageBlocks) {
|
|
779
|
+
t13 = activeId ? (() => {
|
|
691
780
|
const activeBlock = pageBlocks.find((b) => String(b.id) === activeId);
|
|
692
781
|
if (!activeBlock) return null;
|
|
693
782
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -701,121 +790,124 @@ const PageTree = () => {
|
|
|
701
790
|
})
|
|
702
791
|
});
|
|
703
792
|
})() : null;
|
|
704
|
-
$[
|
|
705
|
-
$[
|
|
706
|
-
$[
|
|
707
|
-
} else
|
|
708
|
-
let
|
|
709
|
-
if ($[
|
|
710
|
-
|
|
793
|
+
$[41] = activeId;
|
|
794
|
+
$[42] = pageBlocks;
|
|
795
|
+
$[43] = t13;
|
|
796
|
+
} else t13 = $[43];
|
|
797
|
+
let t14;
|
|
798
|
+
if ($[44] !== t13) {
|
|
799
|
+
t14 = /* @__PURE__ */ jsx(DragOverlay, {
|
|
711
800
|
dropAnimation: null,
|
|
712
|
-
children:
|
|
801
|
+
children: t13
|
|
713
802
|
});
|
|
714
|
-
$[
|
|
715
|
-
$[
|
|
716
|
-
} else
|
|
717
|
-
let
|
|
718
|
-
if ($[
|
|
719
|
-
|
|
803
|
+
$[44] = t13;
|
|
804
|
+
$[45] = t14;
|
|
805
|
+
} else t14 = $[45];
|
|
806
|
+
let t15;
|
|
807
|
+
if ($[46] !== handleDragEnd || $[47] !== sensors || $[48] !== t12 || $[49] !== t14) {
|
|
808
|
+
t15 = /* @__PURE__ */ jsxs(DndContext, {
|
|
720
809
|
sensors,
|
|
721
810
|
collisionDetection: closestCenter,
|
|
722
811
|
onDragStart: handleDragStart,
|
|
723
812
|
onDragEnd: handleDragEnd,
|
|
724
813
|
onDragCancel: handleDragCancel,
|
|
725
|
-
modifiers:
|
|
726
|
-
children: [
|
|
814
|
+
modifiers: t8,
|
|
815
|
+
children: [t12, t14]
|
|
727
816
|
});
|
|
728
|
-
$[
|
|
729
|
-
$[
|
|
730
|
-
$[
|
|
731
|
-
$[
|
|
732
|
-
$[
|
|
733
|
-
} else
|
|
734
|
-
let
|
|
735
|
-
if ($[
|
|
736
|
-
let
|
|
737
|
-
if ($[
|
|
738
|
-
|
|
739
|
-
block:
|
|
817
|
+
$[46] = handleDragEnd;
|
|
818
|
+
$[47] = sensors;
|
|
819
|
+
$[48] = t12;
|
|
820
|
+
$[49] = t14;
|
|
821
|
+
$[50] = t15;
|
|
822
|
+
} else t15 = $[50];
|
|
823
|
+
let t16;
|
|
824
|
+
if ($[51] !== layout?._internal || $[52] !== layoutAfterBlocks) {
|
|
825
|
+
let t17;
|
|
826
|
+
if ($[54] !== layout?._internal) {
|
|
827
|
+
t17 = (block_5) => /* @__PURE__ */ jsx(LayoutBlockItem, {
|
|
828
|
+
block: block_5,
|
|
740
829
|
layoutName: layout?._internal.title ?? "Unknown"
|
|
741
|
-
}, String(
|
|
742
|
-
$[
|
|
743
|
-
$[
|
|
744
|
-
} else
|
|
745
|
-
|
|
746
|
-
$[
|
|
747
|
-
$[
|
|
748
|
-
$[
|
|
749
|
-
} else
|
|
750
|
-
let
|
|
751
|
-
if ($[
|
|
752
|
-
|
|
830
|
+
}, String(block_5.id));
|
|
831
|
+
$[54] = layout?._internal;
|
|
832
|
+
$[55] = t17;
|
|
833
|
+
} else t17 = $[55];
|
|
834
|
+
t16 = layoutAfterBlocks.map(t17);
|
|
835
|
+
$[51] = layout?._internal;
|
|
836
|
+
$[52] = layoutAfterBlocks;
|
|
837
|
+
$[53] = t16;
|
|
838
|
+
} else t16 = $[53];
|
|
839
|
+
let t17;
|
|
840
|
+
if ($[56] !== t15 || $[57] !== t16 || $[58] !== t7) {
|
|
841
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
753
842
|
className: "flex flex-col gap-0.5",
|
|
754
843
|
children: [
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
844
|
+
t7,
|
|
845
|
+
t15,
|
|
846
|
+
t16
|
|
758
847
|
]
|
|
759
848
|
});
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
$[
|
|
763
|
-
$[
|
|
764
|
-
} else
|
|
765
|
-
const
|
|
766
|
-
let
|
|
767
|
-
if ($[
|
|
768
|
-
|
|
769
|
-
$[
|
|
770
|
-
$[
|
|
771
|
-
} else
|
|
772
|
-
let
|
|
773
|
-
if ($[
|
|
774
|
-
|
|
849
|
+
$[56] = t15;
|
|
850
|
+
$[57] = t16;
|
|
851
|
+
$[58] = t7;
|
|
852
|
+
$[59] = t17;
|
|
853
|
+
} else t17 = $[59];
|
|
854
|
+
const t18 = isReadOnly && "opacity-50 cursor-not-allowed";
|
|
855
|
+
let t19;
|
|
856
|
+
if ($[60] !== t18) {
|
|
857
|
+
t19 = cn(t18);
|
|
858
|
+
$[60] = t18;
|
|
859
|
+
$[61] = t19;
|
|
860
|
+
} else t19 = $[61];
|
|
861
|
+
let t20;
|
|
862
|
+
if ($[62] !== requireDraft) {
|
|
863
|
+
t20 = () => {
|
|
775
864
|
if (!requireDraft()) return;
|
|
776
865
|
previewStore.send({
|
|
777
866
|
type: "openAddBlockSidebar",
|
|
778
867
|
via: "page-tree"
|
|
779
868
|
});
|
|
780
869
|
};
|
|
781
|
-
$[
|
|
782
|
-
$[
|
|
783
|
-
} else
|
|
784
|
-
let
|
|
785
|
-
if ($[
|
|
786
|
-
|
|
787
|
-
$[
|
|
788
|
-
} else
|
|
789
|
-
let
|
|
790
|
-
if ($[
|
|
791
|
-
|
|
870
|
+
$[62] = requireDraft;
|
|
871
|
+
$[63] = t20;
|
|
872
|
+
} else t20 = $[63];
|
|
873
|
+
let t21;
|
|
874
|
+
if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
|
|
875
|
+
t21 = /* @__PURE__ */ jsx(Plus, {});
|
|
876
|
+
$[64] = t21;
|
|
877
|
+
} else t21 = $[64];
|
|
878
|
+
let t22;
|
|
879
|
+
if ($[65] !== t19 || $[66] !== t20) {
|
|
880
|
+
t22 = /* @__PURE__ */ jsxs(Button, {
|
|
792
881
|
variant: "secondary",
|
|
793
|
-
className:
|
|
794
|
-
onClick:
|
|
795
|
-
children: [
|
|
882
|
+
className: t19,
|
|
883
|
+
onClick: t20,
|
|
884
|
+
children: [t21, "Add block"]
|
|
796
885
|
});
|
|
797
|
-
$[
|
|
798
|
-
$[
|
|
799
|
-
$[
|
|
800
|
-
} else
|
|
801
|
-
let
|
|
802
|
-
if ($[
|
|
803
|
-
|
|
804
|
-
$[
|
|
805
|
-
$[
|
|
806
|
-
$[
|
|
807
|
-
} else
|
|
808
|
-
return
|
|
886
|
+
$[65] = t19;
|
|
887
|
+
$[66] = t20;
|
|
888
|
+
$[67] = t22;
|
|
889
|
+
} else t22 = $[67];
|
|
890
|
+
let t23;
|
|
891
|
+
if ($[68] !== t17 || $[69] !== t22) {
|
|
892
|
+
t23 = /* @__PURE__ */ jsxs(Fragment, { children: [t17, t22] });
|
|
893
|
+
$[68] = t17;
|
|
894
|
+
$[69] = t22;
|
|
895
|
+
$[70] = t23;
|
|
896
|
+
} else t23 = $[70];
|
|
897
|
+
return t23;
|
|
809
898
|
};
|
|
810
899
|
function _temp(state) {
|
|
811
900
|
return state.context.previewSource;
|
|
812
901
|
}
|
|
813
|
-
function _temp4(
|
|
814
|
-
return
|
|
902
|
+
function _temp4(state) {
|
|
903
|
+
return state.context.isAddBlockSidebarOpen;
|
|
904
|
+
}
|
|
905
|
+
function _temp5(state_0) {
|
|
906
|
+
return state_0.context.peekedBlockPosition;
|
|
815
907
|
}
|
|
816
|
-
function
|
|
817
|
-
return
|
|
908
|
+
function _temp6(block_3) {
|
|
909
|
+
return String(block_3.id);
|
|
818
910
|
}
|
|
819
911
|
|
|
820
912
|
//#endregion
|
|
821
|
-
export { PageTree };
|
|
913
|
+
export { LayoutBlockItem, PageTree };
|