camox 0.26.0 → 0.28.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/components/lexical/InlineLexicalEditor.js +14 -11
- package/dist/core/components/lexical/SidebarLexicalEditor.js +10 -7
- package/dist/features/preview/CamoxPreview.d.ts +1 -0
- package/dist/features/preview/CamoxPreview.js +507 -147
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +23 -8
- package/dist/features/preview/components/FieldToolbar.js +1 -1
- package/dist/features/preview/components/LinkFieldEditor.js +192 -204
- package/dist/features/preview/components/PageContentSheet.js +1 -1
- package/dist/features/preview/components/PageLocationFieldset.js +3 -4
- package/dist/features/preview/components/{EditPageModal.js → PageMetadataModal.js} +413 -229
- package/dist/features/preview/components/PageNicknameField.js +69 -0
- package/dist/features/preview/components/PagePicker.js +21 -84
- package/dist/features/preview/components/PageStatusBadge.js +97 -0
- package/dist/features/preview/components/PreviewPanel.js +111 -117
- package/dist/features/preview/components/PreviewToolbar.js +4 -4
- package/dist/features/preview/components/PublishDialog.js +1 -1
- package/dist/features/preview/components/UnlinkAssetButton.js +1 -1
- package/dist/features/routes/pageRoute.d.ts +3 -1
- package/dist/features/routes/pageRoute.js +34 -11
- package/dist/features/studio/components/EnvironmentMenu.js +1 -1
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/lib/auth.js +43 -15
- package/dist/lib/queries.js +1 -0
- package/dist/lib/utils.js +1 -11
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox-cli/SKILL.md +79 -12
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { Input } from "@camox/ui/input";
|
|
3
|
+
import { Label } from "@camox/ui/label";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/features/preview/components/PageNicknameField.tsx
|
|
7
|
+
const PAGE_NICKNAME_MAX_LENGTH = 80;
|
|
8
|
+
const PageNicknameField = (t0) => {
|
|
9
|
+
const $ = c(11);
|
|
10
|
+
if ($[0] !== "162dc2b9b16d70dc0796d14680eaaca4d0c3fb2e642401f82c11c475d9d72a71") {
|
|
11
|
+
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
12
|
+
$[0] = "162dc2b9b16d70dc0796d14680eaaca4d0c3fb2e642401f82c11c475d9d72a71";
|
|
13
|
+
}
|
|
14
|
+
const { value, onChange, autoFocus } = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17
|
+
t1 = /* @__PURE__ */ jsx(Label, {
|
|
18
|
+
htmlFor: "pageNickname",
|
|
19
|
+
children: "Nickname"
|
|
20
|
+
});
|
|
21
|
+
$[1] = t1;
|
|
22
|
+
} else t1 = $[1];
|
|
23
|
+
let t2;
|
|
24
|
+
if ($[2] !== onChange) {
|
|
25
|
+
t2 = (e) => onChange(e.target.value);
|
|
26
|
+
$[2] = onChange;
|
|
27
|
+
$[3] = t2;
|
|
28
|
+
} else t2 = $[3];
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[4] !== autoFocus || $[5] !== t2 || $[6] !== value) {
|
|
31
|
+
t3 = /* @__PURE__ */ jsx(Input, {
|
|
32
|
+
id: "pageNickname",
|
|
33
|
+
value,
|
|
34
|
+
onChange: t2,
|
|
35
|
+
placeholder: "e.g. Home, Pricing, About",
|
|
36
|
+
maxLength: 80,
|
|
37
|
+
autoFocus
|
|
38
|
+
});
|
|
39
|
+
$[4] = autoFocus;
|
|
40
|
+
$[5] = t2;
|
|
41
|
+
$[6] = value;
|
|
42
|
+
$[7] = t3;
|
|
43
|
+
} else t3 = $[7];
|
|
44
|
+
let t4;
|
|
45
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
46
|
+
t4 = /* @__PURE__ */ jsx("p", {
|
|
47
|
+
className: "text-muted-foreground text-xs",
|
|
48
|
+
children: "A short internal name used in Camox Studio. It does not affect the public page or SEO."
|
|
49
|
+
});
|
|
50
|
+
$[8] = t4;
|
|
51
|
+
} else t4 = $[8];
|
|
52
|
+
let t5;
|
|
53
|
+
if ($[9] !== t3) {
|
|
54
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "space-y-2",
|
|
56
|
+
children: [
|
|
57
|
+
t1,
|
|
58
|
+
t3,
|
|
59
|
+
t4
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
$[9] = t3;
|
|
63
|
+
$[10] = t5;
|
|
64
|
+
} else t5 = $[10];
|
|
65
|
+
return t5;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { PageNicknameField };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { previewStore } from "../previewStore.js";
|
|
2
2
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
3
3
|
import { pageMutations, pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
4
|
-
import { cn
|
|
5
|
-
import {
|
|
4
|
+
import { cn } from "../../../lib/utils.js";
|
|
5
|
+
import { PageStatusBadge } from "./PageStatusBadge.js";
|
|
6
6
|
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
7
7
|
import { toast } from "@camox/ui/toaster";
|
|
8
8
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
@@ -10,87 +10,13 @@ import { useLocation, useNavigate } from "@tanstack/react-router";
|
|
|
10
10
|
import { useSelector } from "@xstate/store-react";
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
13
14
|
import { Button } from "@camox/ui/button";
|
|
14
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
15
15
|
import { Check, ChevronsUpDown, Pencil, Plus, Trash2 } from "lucide-react";
|
|
16
|
-
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
17
|
-
import { Badge } from "@camox/ui/badge";
|
|
18
16
|
import { Skeleton } from "@camox/ui/skeleton";
|
|
19
17
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "@camox/ui/command";
|
|
20
18
|
|
|
21
19
|
//#region src/features/preview/components/PagePicker.tsx
|
|
22
|
-
const StatusBadge = (t0) => {
|
|
23
|
-
const $ = c(9);
|
|
24
|
-
if ($[0] !== "b1d62d8bb85e72a5793231a5fd9f232264a809f20c92f8c88b773f51f15623ec") {
|
|
25
|
-
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
|
-
$[0] = "b1d62d8bb85e72a5793231a5fd9f232264a809f20c92f8c88b773f51f15623ec";
|
|
27
|
-
}
|
|
28
|
-
const { page } = t0;
|
|
29
|
-
if (page.status === "draft") {
|
|
30
|
-
let t1;
|
|
31
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
32
|
-
t1 = /* @__PURE__ */ jsx(Badge, {
|
|
33
|
-
variant: "outline",
|
|
34
|
-
className: "h-4 shrink-0 px-1.5",
|
|
35
|
-
children: "Draft"
|
|
36
|
-
});
|
|
37
|
-
$[1] = t1;
|
|
38
|
-
} else t1 = $[1];
|
|
39
|
-
return t1;
|
|
40
|
-
}
|
|
41
|
-
if (page.status === "published") {
|
|
42
|
-
let t1;
|
|
43
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
-
t1 = /* @__PURE__ */ jsx(Badge, {
|
|
45
|
-
variant: "secondary",
|
|
46
|
-
className: "h-4 shrink-0 px-1.5",
|
|
47
|
-
children: "Published"
|
|
48
|
-
});
|
|
49
|
-
$[2] = t1;
|
|
50
|
-
} else t1 = $[2];
|
|
51
|
-
return t1;
|
|
52
|
-
}
|
|
53
|
-
const reason = page.modifiedReason;
|
|
54
|
-
let t1;
|
|
55
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
56
|
-
t1 = /* @__PURE__ */ jsx(Badge, {
|
|
57
|
-
variant: "default",
|
|
58
|
-
className: "h-4 shrink-0 px-1.5",
|
|
59
|
-
children: "Modified"
|
|
60
|
-
});
|
|
61
|
-
$[3] = t1;
|
|
62
|
-
} else t1 = $[3];
|
|
63
|
-
const badge = t1;
|
|
64
|
-
if (reason && (reason.reason === "layout" || reason.reason === "both")) {
|
|
65
|
-
const pluralized = reason.affectedPagesCount === 1 ? "page" : "pages";
|
|
66
|
-
const headline = reason.reason === "layout" ? `Layout ${reason.layoutHandle} has unpublished changes` : `This page and layout ${reason.layoutHandle} both have unpublished changes`;
|
|
67
|
-
let t2;
|
|
68
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
69
|
-
t2 = /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
70
|
-
render: /* @__PURE__ */ jsx("span", { className: "shrink-0" }),
|
|
71
|
-
children: badge
|
|
72
|
-
});
|
|
73
|
-
$[4] = t2;
|
|
74
|
-
} else t2 = $[4];
|
|
75
|
-
let t3;
|
|
76
|
-
if ($[5] !== headline || $[6] !== pluralized || $[7] !== reason.affectedPagesCount) {
|
|
77
|
-
t3 = /* @__PURE__ */ jsxs(Tooltip, { children: [t2, /* @__PURE__ */ jsxs(TooltipContent, { children: [
|
|
78
|
-
headline,
|
|
79
|
-
" (affects ",
|
|
80
|
-
reason.affectedPagesCount,
|
|
81
|
-
" ",
|
|
82
|
-
pluralized,
|
|
83
|
-
")"
|
|
84
|
-
] })] });
|
|
85
|
-
$[5] = headline;
|
|
86
|
-
$[6] = pluralized;
|
|
87
|
-
$[7] = reason.affectedPagesCount;
|
|
88
|
-
$[8] = t3;
|
|
89
|
-
} else t3 = $[8];
|
|
90
|
-
return t3;
|
|
91
|
-
}
|
|
92
|
-
return badge;
|
|
93
|
-
};
|
|
94
20
|
const CREATE_PAGE_VALUE = "__create_page__";
|
|
95
21
|
const PagePicker = () => {
|
|
96
22
|
const [open, setOpen] = React.useState(false);
|
|
@@ -110,7 +36,7 @@ const PagePicker = () => {
|
|
|
110
36
|
setOpen(false);
|
|
111
37
|
};
|
|
112
38
|
const handleDeletePage = async (page) => {
|
|
113
|
-
const displayName = page.
|
|
39
|
+
const displayName = page.nickname;
|
|
114
40
|
try {
|
|
115
41
|
await deletePage.mutateAsync({ id: page.id });
|
|
116
42
|
toast.success(`Deleted ${displayName} page`);
|
|
@@ -145,9 +71,16 @@ const PagePicker = () => {
|
|
|
145
71
|
role: "combobox",
|
|
146
72
|
className: "min-w-0 flex-1 justify-between"
|
|
147
73
|
}),
|
|
148
|
-
children: [/* @__PURE__ */
|
|
149
|
-
className: "
|
|
150
|
-
children:
|
|
74
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
76
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
77
|
+
className: "truncate",
|
|
78
|
+
children: currentPage.nickname
|
|
79
|
+
}), /* @__PURE__ */ jsx(PageStatusBadge, {
|
|
80
|
+
size: "sm",
|
|
81
|
+
status: currentPage.status,
|
|
82
|
+
modifiedReason: currentPage.modifiedReason
|
|
83
|
+
})]
|
|
151
84
|
}), /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
152
85
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
153
86
|
className: "flex h-[300px] w-[400px] flex-col p-0",
|
|
@@ -187,13 +120,17 @@ const PagePicker = () => {
|
|
|
187
120
|
className: "flex min-w-0 flex-col",
|
|
188
121
|
children: [/* @__PURE__ */ jsx("p", {
|
|
189
122
|
className: "truncate",
|
|
190
|
-
children: page_1.
|
|
123
|
+
children: page_1.nickname
|
|
191
124
|
}), /* @__PURE__ */ jsxs("div", {
|
|
192
125
|
className: "flex min-w-0 items-center gap-1.5",
|
|
193
126
|
children: [/* @__PURE__ */ jsx("p", {
|
|
194
127
|
className: "text-muted-foreground truncate font-mono text-xs",
|
|
195
128
|
children: page_1.fullPath
|
|
196
|
-
}), /* @__PURE__ */ jsx(
|
|
129
|
+
}), /* @__PURE__ */ jsx(PageStatusBadge, {
|
|
130
|
+
size: "sm",
|
|
131
|
+
status: page_1.status,
|
|
132
|
+
modifiedReason: page_1.modifiedReason
|
|
133
|
+
})]
|
|
197
134
|
})]
|
|
198
135
|
})]
|
|
199
136
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -258,7 +195,7 @@ const PagePicker = () => {
|
|
|
258
195
|
children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete page" }), /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
|
|
259
196
|
"Are you sure you want to delete",
|
|
260
197
|
" ",
|
|
261
|
-
/* @__PURE__ */ jsx("strong", { children: pageToDelete ? pageToDelete.
|
|
198
|
+
/* @__PURE__ */ jsx("strong", { children: pageToDelete ? pageToDelete.nickname : "" }),
|
|
262
199
|
"? This action cannot be undone."
|
|
263
200
|
] })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
264
201
|
variant: "outline",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
6
|
+
import { Badge } from "@camox/ui/badge";
|
|
7
|
+
|
|
8
|
+
//#region src/features/preview/components/PageStatusBadge.tsx
|
|
9
|
+
const statusStyles = {
|
|
10
|
+
draft: {
|
|
11
|
+
className: "bg-blue-500/10 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400",
|
|
12
|
+
label: "Draft"
|
|
13
|
+
},
|
|
14
|
+
published: {
|
|
15
|
+
className: "bg-primary/10 text-primary dark:bg-primary/20",
|
|
16
|
+
label: "Published"
|
|
17
|
+
},
|
|
18
|
+
modified: {
|
|
19
|
+
className: "bg-purple-500/10 text-purple-700 dark:bg-purple-500/20 dark:text-purple-400",
|
|
20
|
+
label: "Modified"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const PageStatusBadge = (t0) => {
|
|
24
|
+
const $ = c(18);
|
|
25
|
+
if ($[0] !== "9168a870b9514df0e89a2bb3f4bf1b341d85dcccf45743f1d6f9b68bbb30a7d4") {
|
|
26
|
+
for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
27
|
+
$[0] = "9168a870b9514df0e89a2bb3f4bf1b341d85dcccf45743f1d6f9b68bbb30a7d4";
|
|
28
|
+
}
|
|
29
|
+
const { status, modifiedReason, size: t1, className } = t0;
|
|
30
|
+
const size = t1 === void 0 ? "default" : t1;
|
|
31
|
+
const { className: statusClassName, label } = statusStyles[status];
|
|
32
|
+
let t2;
|
|
33
|
+
if ($[1] !== className || $[2] !== statusClassName) {
|
|
34
|
+
t2 = cn(statusClassName, className);
|
|
35
|
+
$[1] = className;
|
|
36
|
+
$[2] = statusClassName;
|
|
37
|
+
$[3] = t2;
|
|
38
|
+
} else t2 = $[3];
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[4] !== label || $[5] !== size || $[6] !== t2) {
|
|
41
|
+
t3 = /* @__PURE__ */ jsx(Badge, {
|
|
42
|
+
size,
|
|
43
|
+
className: t2,
|
|
44
|
+
children: label
|
|
45
|
+
});
|
|
46
|
+
$[4] = label;
|
|
47
|
+
$[5] = size;
|
|
48
|
+
$[6] = t2;
|
|
49
|
+
$[7] = t3;
|
|
50
|
+
} else t3 = $[7];
|
|
51
|
+
const badge = t3;
|
|
52
|
+
if (status === "modified" && modifiedReason && (modifiedReason.reason === "layout" || modifiedReason.reason === "both")) {
|
|
53
|
+
const pluralized = modifiedReason.affectedPagesCount === 1 ? "page" : "pages";
|
|
54
|
+
const headline = modifiedReason.reason === "layout" ? `Layout ${modifiedReason.layoutHandle} has unpublished changes` : `This page and layout ${modifiedReason.layoutHandle} both have unpublished changes`;
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
57
|
+
t4 = /* @__PURE__ */ jsx("span", { className: "shrink-0" });
|
|
58
|
+
$[8] = t4;
|
|
59
|
+
} else t4 = $[8];
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[9] !== badge) {
|
|
62
|
+
t5 = /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
63
|
+
render: t4,
|
|
64
|
+
children: badge
|
|
65
|
+
});
|
|
66
|
+
$[9] = badge;
|
|
67
|
+
$[10] = t5;
|
|
68
|
+
} else t5 = $[10];
|
|
69
|
+
let t6;
|
|
70
|
+
if ($[11] !== headline || $[12] !== modifiedReason.affectedPagesCount || $[13] !== pluralized) {
|
|
71
|
+
t6 = /* @__PURE__ */ jsxs(TooltipContent, { children: [
|
|
72
|
+
headline,
|
|
73
|
+
" (affects ",
|
|
74
|
+
modifiedReason.affectedPagesCount,
|
|
75
|
+
" ",
|
|
76
|
+
pluralized,
|
|
77
|
+
")"
|
|
78
|
+
] });
|
|
79
|
+
$[11] = headline;
|
|
80
|
+
$[12] = modifiedReason.affectedPagesCount;
|
|
81
|
+
$[13] = pluralized;
|
|
82
|
+
$[14] = t6;
|
|
83
|
+
} else t6 = $[14];
|
|
84
|
+
let t7;
|
|
85
|
+
if ($[15] !== t5 || $[16] !== t6) {
|
|
86
|
+
t7 = /* @__PURE__ */ jsxs(Tooltip, { children: [t5, t6] });
|
|
87
|
+
$[15] = t5;
|
|
88
|
+
$[16] = t6;
|
|
89
|
+
$[17] = t7;
|
|
90
|
+
} else t7 = $[17];
|
|
91
|
+
return t7;
|
|
92
|
+
}
|
|
93
|
+
return badge;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { PageStatusBadge };
|
|
@@ -18,9 +18,9 @@ import { PanelContent } from "@camox/ui/panel";
|
|
|
18
18
|
//#region src/features/preview/components/PreviewPanel.tsx
|
|
19
19
|
const PreviewFrame = (t0) => {
|
|
20
20
|
const $ = c(9);
|
|
21
|
-
if ($[0] !== "
|
|
21
|
+
if ($[0] !== "d799d12f8899aeada62843d5bb83029c25038cd1566b1870e63b1f293c26d992") {
|
|
22
22
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
23
|
-
$[0] = "
|
|
23
|
+
$[0] = "d799d12f8899aeada62843d5bb83029c25038cd1566b1870e63b1f293c26d992";
|
|
24
24
|
}
|
|
25
25
|
const { children, style, className, onIframeReady } = t0;
|
|
26
26
|
let t1;
|
|
@@ -61,9 +61,9 @@ const PreviewFrame = (t0) => {
|
|
|
61
61
|
};
|
|
62
62
|
const KeyDownForwarder = () => {
|
|
63
63
|
const $ = c(5);
|
|
64
|
-
if ($[0] !== "
|
|
64
|
+
if ($[0] !== "d799d12f8899aeada62843d5bb83029c25038cd1566b1870e63b1f293c26d992") {
|
|
65
65
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
66
|
-
$[0] = "
|
|
66
|
+
$[0] = "d799d12f8899aeada62843d5bb83029c25038cd1566b1870e63b1f293c26d992";
|
|
67
67
|
}
|
|
68
68
|
const { window: iframeWindow } = useFrame();
|
|
69
69
|
const actions = useSelector(actionsStore, _temp);
|
|
@@ -119,17 +119,16 @@ const KeyDownForwarder = () => {
|
|
|
119
119
|
return null;
|
|
120
120
|
};
|
|
121
121
|
const PreviewPanel = (t0) => {
|
|
122
|
-
const $ = c(
|
|
123
|
-
if ($[0] !== "
|
|
124
|
-
for (let $i = 0; $i <
|
|
125
|
-
$[0] = "
|
|
122
|
+
const $ = c(14);
|
|
123
|
+
if ($[0] !== "d799d12f8899aeada62843d5bb83029c25038cd1566b1870e63b1f293c26d992") {
|
|
124
|
+
for (let $i = 0; $i < 14; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
125
|
+
$[0] = "d799d12f8899aeada62843d5bb83029c25038cd1566b1870e63b1f293c26d992";
|
|
126
126
|
}
|
|
127
127
|
const { children } = t0;
|
|
128
128
|
useBlockActionsShortcuts();
|
|
129
129
|
const iframeElement = useSelector(previewStore, _temp2);
|
|
130
130
|
const handleIframeReady = _temp3;
|
|
131
131
|
const isMobileMode = useSelector(previewStore, _temp4);
|
|
132
|
-
const isAgentChatSheetOpen = useSelector(previewStore, _temp5);
|
|
133
132
|
const isAnySideSheetOpen = useIsPreviewSheetOpen();
|
|
134
133
|
const wrapperRef = React.useRef(null);
|
|
135
134
|
const [panelWidth, setPanelWidth] = React.useState(0);
|
|
@@ -161,92 +160,27 @@ const PreviewPanel = (t0) => {
|
|
|
161
160
|
const sheetOverlap = Math.max(0, 400 - panelLeft);
|
|
162
161
|
const sheetOpenScale = panelWidth > 0 ? (panelWidth - sheetOverlap) / panelWidth : 1;
|
|
163
162
|
let t3;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
key: "b",
|
|
176
|
-
withAlt: true
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: "toggle-lock-content",
|
|
181
|
-
label: "Toggle lock content",
|
|
182
|
-
groupLabel: "Preview",
|
|
183
|
-
checkIfAvailable: _temp8,
|
|
184
|
-
execute: _temp9
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
id: "toggle-mobile-mode",
|
|
188
|
-
label: "Toggle mobile mode",
|
|
189
|
-
groupLabel: "Preview",
|
|
190
|
-
checkIfAvailable: _temp0,
|
|
191
|
-
execute: _temp1,
|
|
192
|
-
shortcut: { key: "m" }
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
id: "open-agent-chat",
|
|
196
|
-
label: "Ask for changes",
|
|
197
|
-
groupLabel: "Preview",
|
|
198
|
-
checkIfAvailable: () => !isAgentChatSheetOpen,
|
|
199
|
-
execute: _temp10,
|
|
200
|
-
shortcut: {
|
|
201
|
-
key: "i",
|
|
202
|
-
withAlt: true
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: "clear-selection",
|
|
207
|
-
label: "Clear selection",
|
|
208
|
-
groupLabel: "Preview",
|
|
209
|
-
checkIfAvailable: _temp11,
|
|
210
|
-
execute: _temp12,
|
|
211
|
-
shortcut: { key: "Escape" }
|
|
212
|
-
}
|
|
213
|
-
];
|
|
214
|
-
actionsStore.send({
|
|
215
|
-
type: "registerManyActions",
|
|
216
|
-
actions
|
|
217
|
-
});
|
|
218
|
-
return () => {
|
|
219
|
-
actionsStore.send({
|
|
220
|
-
type: "unregisterManyActions",
|
|
221
|
-
ids: actions.map(_temp13)
|
|
222
|
-
});
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
t4 = [isAgentChatSheetOpen];
|
|
226
|
-
$[3] = isAgentChatSheetOpen;
|
|
227
|
-
$[4] = t3;
|
|
228
|
-
$[5] = t4;
|
|
229
|
-
} else {
|
|
230
|
-
t3 = $[4];
|
|
231
|
-
t4 = $[5];
|
|
232
|
-
}
|
|
233
|
-
React.useEffect(t3, t4);
|
|
234
|
-
const t5 = isAnySideSheetOpen ? `${100 / sheetOpenScale}%` : "100%";
|
|
235
|
-
const t6 = isAnySideSheetOpen ? `scale(${sheetOpenScale})` : "scale(1)";
|
|
236
|
-
let t7;
|
|
237
|
-
if ($[6] !== t5 || $[7] !== t6) {
|
|
238
|
-
t7 = {
|
|
239
|
-
height: t5,
|
|
163
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
164
|
+
t3 = [];
|
|
165
|
+
$[3] = t3;
|
|
166
|
+
} else t3 = $[3];
|
|
167
|
+
React.useEffect(_temp14, t3);
|
|
168
|
+
const t4 = isAnySideSheetOpen ? `${100 / sheetOpenScale}%` : "100%";
|
|
169
|
+
const t5 = isAnySideSheetOpen ? `scale(${sheetOpenScale})` : "scale(1)";
|
|
170
|
+
let t6;
|
|
171
|
+
if ($[4] !== t4 || $[5] !== t5) {
|
|
172
|
+
t6 = {
|
|
173
|
+
height: t4,
|
|
240
174
|
transformOrigin: "top right",
|
|
241
|
-
transform:
|
|
175
|
+
transform: t5
|
|
242
176
|
};
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
} else
|
|
247
|
-
let
|
|
248
|
-
if ($[
|
|
249
|
-
|
|
177
|
+
$[4] = t4;
|
|
178
|
+
$[5] = t5;
|
|
179
|
+
$[6] = t6;
|
|
180
|
+
} else t6 = $[6];
|
|
181
|
+
let t7;
|
|
182
|
+
if ($[7] !== children || $[8] !== iframeElement || $[9] !== isMobileMode) {
|
|
183
|
+
t7 = isMobileMode ? /* @__PURE__ */ jsxs("div", {
|
|
250
184
|
className: "checkered flex h-full justify-center",
|
|
251
185
|
children: [
|
|
252
186
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -270,27 +204,27 @@ const PreviewPanel = (t0) => {
|
|
|
270
204
|
/* @__PURE__ */ jsx(FieldToolbar, {}),
|
|
271
205
|
/* @__PURE__ */ jsx(PreviewToolbar, {})
|
|
272
206
|
] });
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
} else
|
|
278
|
-
let
|
|
279
|
-
if ($[
|
|
280
|
-
|
|
207
|
+
$[7] = children;
|
|
208
|
+
$[8] = iframeElement;
|
|
209
|
+
$[9] = isMobileMode;
|
|
210
|
+
$[10] = t7;
|
|
211
|
+
} else t7 = $[10];
|
|
212
|
+
let t8;
|
|
213
|
+
if ($[11] !== t6 || $[12] !== t7) {
|
|
214
|
+
t8 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(PanelContent, {
|
|
281
215
|
className: "relative overflow-hidden bg-black",
|
|
282
216
|
children: /* @__PURE__ */ jsx("div", {
|
|
283
217
|
ref: wrapperRef,
|
|
284
218
|
className: "absolute inset-0 transition-[transform,height] duration-500 ease-in-out will-change-transform",
|
|
285
|
-
style:
|
|
286
|
-
children:
|
|
219
|
+
style: t6,
|
|
220
|
+
children: t7
|
|
287
221
|
})
|
|
288
222
|
}) });
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else
|
|
293
|
-
return
|
|
223
|
+
$[11] = t6;
|
|
224
|
+
$[12] = t7;
|
|
225
|
+
$[13] = t8;
|
|
226
|
+
} else t8 = $[13];
|
|
227
|
+
return t8;
|
|
294
228
|
};
|
|
295
229
|
function _temp(state) {
|
|
296
230
|
return state.context.actions;
|
|
@@ -307,29 +241,30 @@ function _temp3(element) {
|
|
|
307
241
|
function _temp4(state_0) {
|
|
308
242
|
return state_0.context.isMobileMode;
|
|
309
243
|
}
|
|
310
|
-
function _temp5(
|
|
311
|
-
return
|
|
244
|
+
function _temp5() {
|
|
245
|
+
return true;
|
|
312
246
|
}
|
|
313
247
|
function _temp6() {
|
|
314
|
-
return
|
|
248
|
+
return previewStore.send({ type: "toggleSidebar" });
|
|
315
249
|
}
|
|
316
250
|
function _temp7() {
|
|
317
|
-
return
|
|
251
|
+
return true;
|
|
318
252
|
}
|
|
319
253
|
function _temp8() {
|
|
320
|
-
return
|
|
254
|
+
return previewStore.send({ type: "toggleLockContent" });
|
|
321
255
|
}
|
|
322
256
|
function _temp9() {
|
|
323
|
-
return
|
|
257
|
+
return true;
|
|
324
258
|
}
|
|
325
259
|
function _temp0() {
|
|
326
|
-
return
|
|
260
|
+
return previewStore.send({ type: "toggleMobileMode" });
|
|
327
261
|
}
|
|
328
262
|
function _temp1() {
|
|
329
|
-
return
|
|
263
|
+
return true;
|
|
330
264
|
}
|
|
331
265
|
function _temp10() {
|
|
332
|
-
|
|
266
|
+
const { isAgentChatSheetOpen } = previewStore.getSnapshot().context;
|
|
267
|
+
previewStore.send({ type: isAgentChatSheetOpen ? "closeAgentChatSheet" : "openAgentChatSheet" });
|
|
333
268
|
}
|
|
334
269
|
function _temp11() {
|
|
335
270
|
return true;
|
|
@@ -340,6 +275,65 @@ function _temp12() {
|
|
|
340
275
|
function _temp13(a) {
|
|
341
276
|
return a.id;
|
|
342
277
|
}
|
|
278
|
+
function _temp14() {
|
|
279
|
+
const actions = [
|
|
280
|
+
{
|
|
281
|
+
id: "toggle-editing-panel",
|
|
282
|
+
label: "Toggle editing panel",
|
|
283
|
+
groupLabel: "Preview",
|
|
284
|
+
checkIfAvailable: _temp5,
|
|
285
|
+
execute: _temp6,
|
|
286
|
+
shortcut: {
|
|
287
|
+
key: "b",
|
|
288
|
+
withAlt: true
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "toggle-lock-content",
|
|
293
|
+
label: "Toggle lock content",
|
|
294
|
+
groupLabel: "Preview",
|
|
295
|
+
checkIfAvailable: _temp7,
|
|
296
|
+
execute: _temp8
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
id: "toggle-mobile-mode",
|
|
300
|
+
label: "Toggle mobile mode",
|
|
301
|
+
groupLabel: "Preview",
|
|
302
|
+
checkIfAvailable: _temp9,
|
|
303
|
+
execute: _temp0,
|
|
304
|
+
shortcut: { key: "m" }
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: "toggle-agent-chat",
|
|
308
|
+
label: "Toggle agent chat",
|
|
309
|
+
groupLabel: "Preview",
|
|
310
|
+
checkIfAvailable: _temp1,
|
|
311
|
+
execute: _temp10,
|
|
312
|
+
shortcut: {
|
|
313
|
+
key: "i",
|
|
314
|
+
withAlt: true
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: "clear-selection",
|
|
319
|
+
label: "Clear selection",
|
|
320
|
+
groupLabel: "Preview",
|
|
321
|
+
checkIfAvailable: _temp11,
|
|
322
|
+
execute: _temp12,
|
|
323
|
+
shortcut: { key: "Escape" }
|
|
324
|
+
}
|
|
325
|
+
];
|
|
326
|
+
actionsStore.send({
|
|
327
|
+
type: "registerManyActions",
|
|
328
|
+
actions
|
|
329
|
+
});
|
|
330
|
+
return () => {
|
|
331
|
+
actionsStore.send({
|
|
332
|
+
type: "unregisterManyActions",
|
|
333
|
+
ids: actions.map(_temp13)
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
}
|
|
343
337
|
|
|
344
338
|
//#endregion
|
|
345
339
|
export { PreviewFrame, PreviewPanel };
|
|
@@ -6,18 +6,18 @@ import { Kbd } from "@camox/ui/kbd";
|
|
|
6
6
|
import { useSelector } from "@xstate/store-react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Button } from "@camox/ui/button";
|
|
9
|
+
import { ButtonGroup } from "@camox/ui/button-group";
|
|
9
10
|
import * as Tooltip$1 from "@camox/ui/tooltip";
|
|
10
11
|
import { Lock, MonitorPlay, PanelRight, TabletSmartphone } from "lucide-react";
|
|
11
|
-
import { ButtonGroup } from "@camox/ui/button-group";
|
|
12
12
|
import { FloatingToolbar } from "@camox/ui/floating-toolbar";
|
|
13
13
|
import { Toggle } from "@camox/ui/toggle";
|
|
14
14
|
|
|
15
15
|
//#region src/features/preview/components/PreviewToolbar.tsx
|
|
16
16
|
const PreviewToolbar = () => {
|
|
17
17
|
const $ = c(70);
|
|
18
|
-
if ($[0] !== "
|
|
18
|
+
if ($[0] !== "9eb26d2e74b59f556130f84b8d22fd9907b3e87a936f560c3c15b54462b76f83") {
|
|
19
19
|
for (let $i = 0; $i < 70; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
20
|
-
$[0] = "
|
|
20
|
+
$[0] = "9eb26d2e74b59f556130f84b8d22fd9907b3e87a936f560c3c15b54462b76f83";
|
|
21
21
|
}
|
|
22
22
|
const isEditingLocked = useSelector(previewStore, _temp);
|
|
23
23
|
const isEditingPanelOpen = useSelector(previewStore, _temp2);
|
|
@@ -247,7 +247,7 @@ const PreviewToolbar = () => {
|
|
|
247
247
|
} else t32 = $[61];
|
|
248
248
|
let t33;
|
|
249
249
|
if ($[62] !== actions) {
|
|
250
|
-
t33 = getActionShortcut(actions, "
|
|
250
|
+
t33 = getActionShortcut(actions, "toggle-agent-chat");
|
|
251
251
|
$[62] = actions;
|
|
252
252
|
$[63] = t33;
|
|
253
253
|
} else t33 = $[63];
|
|
@@ -5,8 +5,8 @@ import { toast } from "@camox/ui/toaster";
|
|
|
5
5
|
import { useMutation } from "@tanstack/react-query";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { Switch } from "@camox/ui/switch";
|
|
9
8
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
9
|
+
import { Switch } from "@camox/ui/switch";
|
|
10
10
|
|
|
11
11
|
//#region src/features/preview/components/PublishDialog.tsx
|
|
12
12
|
/**
|
|
@@ -4,10 +4,10 @@ import { c } from "react/compiler-runtime";
|
|
|
4
4
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
7
8
|
import { Button } from "@camox/ui/button";
|
|
8
9
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
9
10
|
import { X } from "lucide-react";
|
|
10
|
-
import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
11
11
|
|
|
12
12
|
//#region src/features/preview/components/UnlinkAssetButton.tsx
|
|
13
13
|
const UnlinkAssetButton = (t0) => {
|