camox 0.41.0 → 0.41.1
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/createApp.d.ts +2 -2
- package/dist/core/createBlock.js +11 -25
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.js +169 -306
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/features/preview/CamoxPreview.js +59 -80
- package/dist/features/preview/DerivedPreview.js +6 -9
- package/dist/features/preview/components/BlockActionsPopover.js +8 -8
- package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
- package/dist/features/preview/components/Overlays.js +6 -9
- package/dist/features/preview/components/PageEditorSidebar.js +194 -203
- package/dist/features/preview/components/PageTree.js +162 -228
- package/dist/features/preview/components/PreviewPanel.js +39 -41
- package/dist/features/preview/components/PreviewToolbar.js +15 -18
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +11 -17
- package/dist/features/preview/previewStore.js +18 -29
- package/dist/features/provider/useAdminShortcuts.js +5 -4
- package/dist/features/runtime/RuntimeChrome.js +98 -86
- package/dist/features/studio/components/UserButton.js +4 -4
- package/package.json +4 -4
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { getApiClient } from "../../lib/api-client.js";
|
|
1
2
|
import { SharedChromeContext } from "./SharedChromeContext.js";
|
|
2
|
-
import { previewStore } from "../preview/previewStore.js";
|
|
3
|
+
import { previewStore, selectPreviewSource } from "../preview/previewStore.js";
|
|
3
4
|
import { Navbar } from "../studio/components/Navbar.js";
|
|
4
5
|
import { PreviewToolbar } from "../preview/components/PreviewToolbar.js";
|
|
5
6
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import {
|
|
7
|
+
import { useQuery } from "@tanstack/react-query";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { useSelector } from "@xstate/store-react";
|
|
9
10
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
@@ -11,15 +12,15 @@ import studioCssUrl from "virtual:camox-studio-css";
|
|
|
11
12
|
|
|
12
13
|
//#region src/features/runtime/RuntimeChrome.tsx
|
|
13
14
|
function RuntimeChrome(t0) {
|
|
14
|
-
const $ = c(
|
|
15
|
-
if ($[0] !== "
|
|
16
|
-
for (let $i = 0; $i <
|
|
17
|
-
$[0] = "
|
|
15
|
+
const $ = c(33);
|
|
16
|
+
if ($[0] !== "b6bc64556f010bff957a9ab8a6f788b2f582426a19b86427f9d0314970d7a4dc") {
|
|
17
|
+
for (let $i = 0; $i < 33; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
18
|
+
$[0] = "b6bc64556f010bff957a9ab8a6f788b2f582426a19b86427f9d0314970d7a4dc";
|
|
18
19
|
}
|
|
19
20
|
const { input, children } = t0;
|
|
20
21
|
const preview = !input.routeKind;
|
|
21
22
|
const hidden = useSelector(previewStore, _temp);
|
|
22
|
-
const source = useSelector(previewStore,
|
|
23
|
+
const source = useSelector(previewStore, selectPreviewSource);
|
|
23
24
|
let t1;
|
|
24
25
|
if ($[1] !== input.pathname || $[2] !== source) {
|
|
25
26
|
t1 = queryKeys.pages.getByPath(input.pathname, source);
|
|
@@ -28,106 +29,117 @@ function RuntimeChrome(t0) {
|
|
|
28
29
|
$[3] = t1;
|
|
29
30
|
} else t1 = $[3];
|
|
30
31
|
let t2;
|
|
31
|
-
if ($[4] !==
|
|
32
|
-
t2 = {
|
|
32
|
+
if ($[4] !== input.pathname || $[5] !== input.projectSlug || $[6] !== source) {
|
|
33
|
+
t2 = () => getApiClient().pages.getStructure({
|
|
34
|
+
path: input.pathname,
|
|
35
|
+
projectSlug: input.projectSlug,
|
|
36
|
+
source
|
|
37
|
+
});
|
|
38
|
+
$[4] = input.pathname;
|
|
39
|
+
$[5] = input.projectSlug;
|
|
40
|
+
$[6] = source;
|
|
41
|
+
$[7] = t2;
|
|
42
|
+
} else t2 = $[7];
|
|
43
|
+
let t3;
|
|
44
|
+
if ($[8] !== t1 || $[9] !== t2) {
|
|
45
|
+
t3 = {
|
|
33
46
|
queryKey: t1,
|
|
34
|
-
queryFn:
|
|
47
|
+
queryFn: t2,
|
|
48
|
+
enabled: false
|
|
35
49
|
};
|
|
36
|
-
$[
|
|
37
|
-
$[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
$[8] = t1;
|
|
51
|
+
$[9] = t2;
|
|
52
|
+
$[10] = t3;
|
|
53
|
+
} else t3 = $[10];
|
|
54
|
+
const { data: page } = useQuery(t3);
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
57
|
+
t4 = /* @__PURE__ */ jsx("link", {
|
|
43
58
|
rel: "stylesheet",
|
|
44
59
|
href: studioCssUrl,
|
|
45
60
|
"data-camox-studio": true
|
|
46
61
|
});
|
|
47
|
-
$[
|
|
48
|
-
} else
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
let t6;
|
|
52
|
-
if ($[7] !== preview) {
|
|
53
|
-
t6 = /* @__PURE__ */ jsx(Navbar, { isPreview: preview });
|
|
54
|
-
$[7] = preview;
|
|
55
|
-
$[8] = t6;
|
|
56
|
-
} else t6 = $[8];
|
|
62
|
+
$[11] = t4;
|
|
63
|
+
} else t4 = $[11];
|
|
64
|
+
const t5 = preview ? "max-md:hidden" : void 0;
|
|
65
|
+
const t6 = preview && hidden;
|
|
57
66
|
let t7;
|
|
58
|
-
if ($[
|
|
59
|
-
t7 = /* @__PURE__ */ jsx(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
$[9] = t4;
|
|
65
|
-
$[10] = t5;
|
|
66
|
-
$[11] = t6;
|
|
67
|
-
$[12] = t7;
|
|
68
|
-
} else t7 = $[12];
|
|
67
|
+
if ($[12] !== preview) {
|
|
68
|
+
t7 = /* @__PURE__ */ jsx(Navbar, { isPreview: preview });
|
|
69
|
+
$[12] = preview;
|
|
70
|
+
$[13] = t7;
|
|
71
|
+
} else t7 = $[13];
|
|
69
72
|
let t8;
|
|
70
|
-
if ($[
|
|
73
|
+
if ($[14] !== t5 || $[15] !== t6 || $[16] !== t7) {
|
|
71
74
|
t8 = /* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: t5,
|
|
76
|
+
hidden: t6,
|
|
77
|
+
children: t7
|
|
78
|
+
});
|
|
79
|
+
$[14] = t5;
|
|
80
|
+
$[15] = t6;
|
|
81
|
+
$[16] = t7;
|
|
82
|
+
$[17] = t8;
|
|
83
|
+
} else t8 = $[17];
|
|
84
|
+
let t9;
|
|
85
|
+
if ($[18] !== children) {
|
|
86
|
+
t9 = /* @__PURE__ */ jsx("div", {
|
|
72
87
|
className: "flex min-h-0 flex-1 flex-col overflow-auto",
|
|
73
88
|
children
|
|
74
89
|
});
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
} else
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
let t13;
|
|
83
|
-
if ($[15] !== t11 || $[16] !== t12) {
|
|
84
|
-
t13 = /* @__PURE__ */ jsx(PreviewToolbar, {
|
|
85
|
-
pageStatus: t11,
|
|
86
|
-
hasLiveVersion: t12
|
|
87
|
-
});
|
|
88
|
-
$[15] = t11;
|
|
89
|
-
$[16] = t12;
|
|
90
|
-
$[17] = t13;
|
|
91
|
-
} else t13 = $[17];
|
|
90
|
+
$[18] = children;
|
|
91
|
+
$[19] = t9;
|
|
92
|
+
} else t9 = $[19];
|
|
93
|
+
const t10 = !preview;
|
|
94
|
+
const t11 = input.derived ? void 0 : "max-md:hidden";
|
|
95
|
+
const t12 = preview && !input.derived ? page?.page.status : void 0;
|
|
96
|
+
const t13 = !!page?.page.livePublishedCheckpointId;
|
|
92
97
|
let t14;
|
|
93
|
-
if ($[
|
|
94
|
-
t14 = /* @__PURE__ */ jsx(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
children: t13
|
|
98
|
+
if ($[20] !== t12 || $[21] !== t13) {
|
|
99
|
+
t14 = /* @__PURE__ */ jsx(PreviewToolbar, {
|
|
100
|
+
pageStatus: t12,
|
|
101
|
+
hasLiveVersion: t13
|
|
98
102
|
});
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
|
|
103
|
-
} else t14 = $[21];
|
|
103
|
+
$[20] = t12;
|
|
104
|
+
$[21] = t13;
|
|
105
|
+
$[22] = t14;
|
|
106
|
+
} else t14 = $[22];
|
|
104
107
|
let t15;
|
|
105
|
-
if ($[
|
|
106
|
-
t15 = /* @__PURE__ */
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
if ($[23] !== t10 || $[24] !== t11 || $[25] !== t14) {
|
|
109
|
+
t15 = /* @__PURE__ */ jsx("div", {
|
|
110
|
+
hidden: t10,
|
|
111
|
+
className: t11,
|
|
112
|
+
children: t14
|
|
109
113
|
});
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
|
|
114
|
+
$[23] = t10;
|
|
115
|
+
$[24] = t11;
|
|
116
|
+
$[25] = t14;
|
|
117
|
+
$[26] = t15;
|
|
118
|
+
} else t15 = $[26];
|
|
114
119
|
let t16;
|
|
115
|
-
if ($[
|
|
116
|
-
t16 = /* @__PURE__ */ jsxs(
|
|
120
|
+
if ($[27] !== t15 || $[28] !== t9) {
|
|
121
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
122
|
+
className: "relative flex min-h-0 flex-1 flex-col",
|
|
123
|
+
children: [t9, t15]
|
|
124
|
+
});
|
|
125
|
+
$[27] = t15;
|
|
126
|
+
$[28] = t9;
|
|
127
|
+
$[29] = t16;
|
|
128
|
+
} else t16 = $[29];
|
|
129
|
+
let t17;
|
|
130
|
+
if ($[30] !== t16 || $[31] !== t8) {
|
|
131
|
+
t17 = /* @__PURE__ */ jsxs(SharedChromeContext.Provider, {
|
|
117
132
|
value: true,
|
|
118
|
-
children: [
|
|
133
|
+
children: [t4, /* @__PURE__ */ jsxs("div", {
|
|
119
134
|
className: "bg-background flex h-screen flex-col overflow-hidden",
|
|
120
|
-
children: [
|
|
135
|
+
children: [t8, t16]
|
|
121
136
|
})]
|
|
122
137
|
});
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
} else
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
|
-
function _temp2(state_0) {
|
|
130
|
-
return state_0.context.previewSource;
|
|
138
|
+
$[30] = t16;
|
|
139
|
+
$[31] = t8;
|
|
140
|
+
$[32] = t17;
|
|
141
|
+
} else t17 = $[32];
|
|
142
|
+
return t17;
|
|
131
143
|
}
|
|
132
144
|
function _temp(state) {
|
|
133
145
|
return state.context.isToolbarHidden;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLocation, useNavigate } from "../../navigation/navigation.js";
|
|
2
2
|
import { useAuthContext, useAuthState } from "../../../lib/auth.js";
|
|
3
3
|
import { STUDIO_BASE_PATH } from "../routes.js";
|
|
4
|
-
import { previewStore } from "../../preview/previewStore.js";
|
|
4
|
+
import { previewStore, selectIsEditMode } from "../../preview/previewStore.js";
|
|
5
5
|
import { useApplyTheme } from "../useTheme.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -14,9 +14,9 @@ import { Avatar, AvatarFallback, AvatarImage } from "@camox/ui/avatar";
|
|
|
14
14
|
//#region src/features/studio/components/UserButton.tsx
|
|
15
15
|
const UserButton = () => {
|
|
16
16
|
const $ = c(5);
|
|
17
|
-
if ($[0] !== "
|
|
17
|
+
if ($[0] !== "b876c985f56cb759905567177978ca8597789d0818f006e69fd4bcfb86c58f94") {
|
|
18
18
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
19
|
-
$[0] = "
|
|
19
|
+
$[0] = "b876c985f56cb759905567177978ca8597789d0818f006e69fd4bcfb86c58f94";
|
|
20
20
|
}
|
|
21
21
|
const { isAuthenticated, isLoading } = useAuthState();
|
|
22
22
|
const { theme, setTheme } = useApplyTheme();
|
|
@@ -48,7 +48,7 @@ function AuthenticatedUserButton({ theme, setTheme }) {
|
|
|
48
48
|
const authCtx = useAuthContext();
|
|
49
49
|
const { data: session } = authCtx.authClient.useSession();
|
|
50
50
|
const authenticationUrl = authCtx.authenticationUrl;
|
|
51
|
-
const isEditMode = useSelector(previewStore,
|
|
51
|
+
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
52
52
|
const { pathname } = useLocation();
|
|
53
53
|
const navigate = useNavigate();
|
|
54
54
|
const isPreviewPage = pathname !== STUDIO_BASE_PATH && !pathname.startsWith(`${STUDIO_BASE_PATH}/`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camox",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"camox": "./bin/camox.mjs"
|
|
@@ -136,9 +136,9 @@
|
|
|
136
136
|
"shiki": "^4.1.0",
|
|
137
137
|
"unhead": "^3.1.7",
|
|
138
138
|
"zod": "^4.4.3",
|
|
139
|
-
"@camox/
|
|
140
|
-
"@camox/
|
|
141
|
-
"@camox/ui": "0.41.
|
|
139
|
+
"@camox/cli": "0.41.1",
|
|
140
|
+
"@camox/api-contract": "0.41.1",
|
|
141
|
+
"@camox/ui": "0.41.1"
|
|
142
142
|
},
|
|
143
143
|
"devDependencies": {
|
|
144
144
|
"@babel/core": "^7.29.0",
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { previewStore } from "../previewStore.js";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useSelector } from "@xstate/store-react";
|
|
5
|
-
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
6
|
-
|
|
7
|
-
//#region src/features/preview/components/DraftSwitchDialog.tsx
|
|
8
|
-
/**
|
|
9
|
-
* Global confirmation that the user wants to leave a non-draft preview
|
|
10
|
-
* before editing. The CTA only flips `previewSource` to `'draft'` — the
|
|
11
|
-
* original edit attempt is intentionally NOT replayed; the user re-issues it
|
|
12
|
-
* once back on draft. This keeps the action explicit and avoids "magical"
|
|
13
|
-
* delayed edits the user might no longer want.
|
|
14
|
-
*/
|
|
15
|
-
function DraftSwitchDialog() {
|
|
16
|
-
const $ = c(5);
|
|
17
|
-
if ($[0] !== "3be875184f6abab2ae16a64fbececa2389b1e6a2f4ea614823966b8277e4826b") {
|
|
18
|
-
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
19
|
-
$[0] = "3be875184f6abab2ae16a64fbececa2389b1e6a2f4ea614823966b8277e4826b";
|
|
20
|
-
}
|
|
21
|
-
const open = useSelector(previewStore, _temp);
|
|
22
|
-
let t0;
|
|
23
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
24
|
-
t0 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Switch to draft to edit?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "You're previewing the live version. Switch to the draft to make changes." })] });
|
|
25
|
-
$[1] = t0;
|
|
26
|
-
} else t0 = $[1];
|
|
27
|
-
let t1;
|
|
28
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
29
|
-
t1 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t0, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
30
|
-
variant: "outline",
|
|
31
|
-
size: "default",
|
|
32
|
-
children: "Cancel"
|
|
33
|
-
}), /* @__PURE__ */ jsx(AlertDialogAction, {
|
|
34
|
-
onClick: _temp3,
|
|
35
|
-
children: "Switch to draft"
|
|
36
|
-
})] })] });
|
|
37
|
-
$[2] = t1;
|
|
38
|
-
} else t1 = $[2];
|
|
39
|
-
let t2;
|
|
40
|
-
if ($[3] !== open) {
|
|
41
|
-
t2 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
42
|
-
open,
|
|
43
|
-
onOpenChange: _temp2,
|
|
44
|
-
children: t1
|
|
45
|
-
});
|
|
46
|
-
$[3] = open;
|
|
47
|
-
$[4] = t2;
|
|
48
|
-
} else t2 = $[4];
|
|
49
|
-
return t2;
|
|
50
|
-
}
|
|
51
|
-
function _temp3() {
|
|
52
|
-
previewStore.send({
|
|
53
|
-
type: "setPreviewSource",
|
|
54
|
-
source: "draft"
|
|
55
|
-
});
|
|
56
|
-
previewStore.send({ type: "dismissDraftSwitch" });
|
|
57
|
-
}
|
|
58
|
-
function _temp2(next) {
|
|
59
|
-
if (!next) previewStore.send({ type: "dismissDraftSwitch" });
|
|
60
|
-
}
|
|
61
|
-
function _temp(state) {
|
|
62
|
-
return state.context.isDraftSwitchDialogOpen;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//#endregion
|
|
66
|
-
export { DraftSwitchDialog };
|