camox 0.40.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/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 +17 -28
- 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/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.d.ts +9 -8
- package/dist/core/editing/createEditableBlock.js +265 -403
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- 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 +246 -290
- package/dist/features/preview/DerivedPreview.js +134 -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/BlockActionsPopover.js +8 -8
- 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 +160 -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/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
- package/dist/features/preview/components/Overlays.js +59 -47
- package/dist/features/preview/components/PageEditorSidebar.js +194 -203
- 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 +366 -340
- package/dist/features/preview/components/PreviewActivation.js +78 -0
- package/dist/features/preview/components/PreviewPanel.js +98 -68
- package/dist/features/preview/components/PreviewToolbar.js +224 -241
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +425 -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 +18 -39
- 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/provider/useAdminShortcuts.js +5 -4
- 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 +149 -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/components/UserButton.js +4 -4
- 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/components/DraftSwitchDialog.js +0 -66
- package/dist/features/preview/previewQueryFns.js +0 -23
- package/dist/features/runtime/studioNavigation.js +0 -120
|
@@ -7,17 +7,18 @@ import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
|
|
|
7
7
|
import { blockQueries, pageQueries, projectQueries } from "../../lib/queries.js";
|
|
8
8
|
import { cn } from "../../lib/utils.js";
|
|
9
9
|
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
10
|
-
import {
|
|
10
|
+
import { SharedChromeContext } from "../runtime/SharedChromeContext.js";
|
|
11
|
+
import { previewStore, selectIsEditMode, selectPreviewSource } from "./previewStore.js";
|
|
11
12
|
import { Navbar } from "../studio/components/Navbar.js";
|
|
12
13
|
import { CreatePageModal } from "./components/CreatePageModal.js";
|
|
13
|
-
import {
|
|
14
|
+
import { EDIT_MODE_SHORTCUT } from "./previewConstants.js";
|
|
14
15
|
import { LeftSidebar } from "./components/LeftSidebar.js";
|
|
15
16
|
import { PeekedBlock } from "./components/PeekedBlock.js";
|
|
16
17
|
import { PreviewPanel } from "./components/PreviewPanel.js";
|
|
18
|
+
import { PreviewToolbarSpacer } from "./components/PreviewToolbarSpacer.js";
|
|
17
19
|
import { RightSidebar } from "./components/RightSidebar.js";
|
|
18
|
-
import { pageFullQueryFn } from "./previewQueryFns.js";
|
|
19
20
|
import { c } from "react/compiler-runtime";
|
|
20
|
-
import {
|
|
21
|
+
import { useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
|
21
22
|
import * as React from "react";
|
|
22
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
24
|
import { useSelector } from "@xstate/store-react";
|
|
@@ -35,15 +36,14 @@ function getMobileStudioSnapshot() {
|
|
|
35
36
|
}
|
|
36
37
|
function useIsMobileStudio() {
|
|
37
38
|
const $ = c(1);
|
|
38
|
-
if ($[0] !== "
|
|
39
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
39
40
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
40
|
-
$[0] = "
|
|
41
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
41
42
|
}
|
|
42
43
|
return React.useSyncExternalStore(subscribeToMobileStudio, getMobileStudioSnapshot, _temp);
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Fetches the current page being previewed, with live updates for authenticated users.
|
|
46
|
-
* Also will switch to peeked page data if there is one.
|
|
47
47
|
*
|
|
48
48
|
* Data for the current route is guaranteed in queryClient cache from the loader's
|
|
49
49
|
* ensureQueryData. Live updates are gated by useProjectRoom only running in
|
|
@@ -70,112 +70,51 @@ function pageStructureQueryFn(path, projectSlug, source) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
function usePreviewedPage() {
|
|
73
|
-
const $ = c(
|
|
74
|
-
if ($[0] !== "
|
|
75
|
-
for (let $i = 0; $i <
|
|
76
|
-
$[0] = "
|
|
73
|
+
const $ = c(11);
|
|
74
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
75
|
+
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
76
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
77
77
|
}
|
|
78
78
|
const { pathname } = useLocation();
|
|
79
|
-
const queryClient = useQueryClient();
|
|
80
79
|
const projectSlug = useProjectSlug();
|
|
81
|
-
const
|
|
82
|
-
const previewSource = useSelector(previewStore, _temp3);
|
|
83
|
-
const prevPathnameRef = React.useRef(pathname);
|
|
80
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
84
81
|
let t0;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
t0 = () => {
|
|
88
|
-
if (prevPathnameRef.current !== pathname) {
|
|
89
|
-
prevPathnameRef.current = pathname;
|
|
90
|
-
previewStore.send({ type: "clearPeekedPage" });
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
t1 = [pathname];
|
|
82
|
+
if ($[1] !== pathname || $[2] !== previewSource) {
|
|
83
|
+
t0 = queryKeys.pages.getByPath(pathname, previewSource);
|
|
94
84
|
$[1] = pathname;
|
|
95
|
-
$[2] =
|
|
96
|
-
$[3] =
|
|
97
|
-
} else
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
React.useEffect(t0, t1);
|
|
102
|
-
let t2;
|
|
103
|
-
if ($[4] !== pathname || $[5] !== previewSource) {
|
|
104
|
-
t2 = queryKeys.pages.getByPath(pathname, previewSource);
|
|
85
|
+
$[2] = previewSource;
|
|
86
|
+
$[3] = t0;
|
|
87
|
+
} else t0 = $[3];
|
|
88
|
+
let t1;
|
|
89
|
+
if ($[4] !== pathname || $[5] !== previewSource || $[6] !== projectSlug) {
|
|
90
|
+
t1 = pageStructureQueryFn(pathname, projectSlug, previewSource);
|
|
105
91
|
$[4] = pathname;
|
|
106
92
|
$[5] = previewSource;
|
|
107
|
-
$[6] =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
$[10] = t3;
|
|
116
|
-
} else t3 = $[10];
|
|
117
|
-
let t4;
|
|
118
|
-
if ($[11] !== t2 || $[12] !== t3) {
|
|
119
|
-
t4 = {
|
|
120
|
-
queryKey: t2,
|
|
121
|
-
queryFn: t3,
|
|
122
|
-
staleTime: Infinity
|
|
123
|
-
};
|
|
124
|
-
$[11] = t2;
|
|
125
|
-
$[12] = t3;
|
|
126
|
-
$[13] = t4;
|
|
127
|
-
} else t4 = $[13];
|
|
128
|
-
const { data: currentPage } = useSuspenseQuery(t4);
|
|
129
|
-
const isAuthenticated = useIsAuthenticated();
|
|
130
|
-
let t5;
|
|
131
|
-
if ($[14] !== peekedPagePathname || $[15] !== previewSource) {
|
|
132
|
-
t5 = queryKeys.pages.getByPath(peekedPagePathname ?? "", previewSource);
|
|
133
|
-
$[14] = peekedPagePathname;
|
|
134
|
-
$[15] = previewSource;
|
|
135
|
-
$[16] = t5;
|
|
136
|
-
} else t5 = $[16];
|
|
137
|
-
const t6 = peekedPagePathname ?? "";
|
|
138
|
-
let t7;
|
|
139
|
-
if ($[17] !== previewSource || $[18] !== projectSlug || $[19] !== queryClient || $[20] !== t6) {
|
|
140
|
-
t7 = pageFullQueryFn(queryClient, t6, projectSlug, previewSource);
|
|
141
|
-
$[17] = previewSource;
|
|
142
|
-
$[18] = projectSlug;
|
|
143
|
-
$[19] = queryClient;
|
|
144
|
-
$[20] = t6;
|
|
145
|
-
$[21] = t7;
|
|
146
|
-
} else t7 = $[21];
|
|
147
|
-
const t8 = isAuthenticated && !!peekedPagePathname;
|
|
148
|
-
let t9;
|
|
149
|
-
if ($[22] !== t5 || $[23] !== t7 || $[24] !== t8) {
|
|
150
|
-
t9 = {
|
|
151
|
-
queryKey: t5,
|
|
152
|
-
queryFn: t7,
|
|
153
|
-
enabled: t8,
|
|
154
|
-
placeholderData: keepPreviousData,
|
|
93
|
+
$[6] = projectSlug;
|
|
94
|
+
$[7] = t1;
|
|
95
|
+
} else t1 = $[7];
|
|
96
|
+
let t2;
|
|
97
|
+
if ($[8] !== t0 || $[9] !== t1) {
|
|
98
|
+
t2 = {
|
|
99
|
+
queryKey: t0,
|
|
100
|
+
queryFn: t1,
|
|
155
101
|
staleTime: Infinity
|
|
156
102
|
};
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return peekedPagePathname ? peekedPage ?? currentPage : currentPage;
|
|
164
|
-
}
|
|
165
|
-
function _temp3(state_0) {
|
|
166
|
-
return state_0.context.previewSource;
|
|
167
|
-
}
|
|
168
|
-
function _temp2(state) {
|
|
169
|
-
return state.context.peekedPagePathname;
|
|
103
|
+
$[8] = t0;
|
|
104
|
+
$[9] = t1;
|
|
105
|
+
$[10] = t2;
|
|
106
|
+
} else t2 = $[10];
|
|
107
|
+
const { data: currentPage } = useSuspenseQuery(t2);
|
|
108
|
+
return currentPage;
|
|
170
109
|
}
|
|
171
110
|
const BlockRenderer = (t0) => {
|
|
172
111
|
const $ = c(23);
|
|
173
|
-
if ($[0] !== "
|
|
112
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
174
113
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
175
|
-
$[0] = "
|
|
114
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
176
115
|
}
|
|
177
116
|
const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
|
|
178
|
-
const previewSource = useSelector(previewStore,
|
|
117
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
179
118
|
let t1;
|
|
180
119
|
if ($[1] !== blockId || $[2] !== previewSource) {
|
|
181
120
|
t1 = blockQueries.get(blockId, previewSource);
|
|
@@ -249,8 +188,8 @@ const BlockRenderer = (t0) => {
|
|
|
249
188
|
};
|
|
250
189
|
const PageContent = () => {
|
|
251
190
|
const pageData = usePreviewedPage();
|
|
252
|
-
const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, useSelector(previewStore,
|
|
253
|
-
const peekedBlockPosition = useSelector(previewStore, (
|
|
191
|
+
const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, useSelector(previewStore, selectPreviewSource));
|
|
192
|
+
const peekedBlockPosition = useSelector(previewStore, (state) => state.context.peekedBlockPosition);
|
|
254
193
|
const displayedPositionRef = React.useRef(null);
|
|
255
194
|
if (peekedBlockPosition !== null) displayedPositionRef.current = peekedBlockPosition;
|
|
256
195
|
const effectivePosition = peekedBlockPosition ?? displayedPositionRef.current;
|
|
@@ -315,9 +254,9 @@ const PageContent = () => {
|
|
|
315
254
|
};
|
|
316
255
|
function useHydrateDraftCache() {
|
|
317
256
|
const $ = c(7);
|
|
318
|
-
if ($[0] !== "
|
|
257
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
319
258
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
320
|
-
$[0] = "
|
|
259
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
321
260
|
}
|
|
322
261
|
const isAuthenticated = useIsAuthenticated();
|
|
323
262
|
const queryClient = useQueryClient();
|
|
@@ -342,7 +281,7 @@ function useHydrateDraftCache() {
|
|
|
342
281
|
projectName: data.projectName,
|
|
343
282
|
project: data.project
|
|
344
283
|
});
|
|
345
|
-
}).catch(
|
|
284
|
+
}).catch(_temp2);
|
|
346
285
|
return () => {
|
|
347
286
|
cancelled = true;
|
|
348
287
|
};
|
|
@@ -365,44 +304,66 @@ function useHydrateDraftCache() {
|
|
|
365
304
|
}
|
|
366
305
|
React.useEffect(t0, t1);
|
|
367
306
|
}
|
|
368
|
-
function
|
|
307
|
+
function _temp2() {}
|
|
369
308
|
const CamoxPreview = (t0) => {
|
|
370
|
-
const $ = c(
|
|
371
|
-
if ($[0] !== "
|
|
372
|
-
for (let $i = 0; $i <
|
|
373
|
-
$[0] = "
|
|
309
|
+
const $ = c(4);
|
|
310
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
311
|
+
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
312
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
374
313
|
}
|
|
375
314
|
const { children } = t0;
|
|
376
|
-
const isAuthenticated = useIsAuthenticated();
|
|
377
|
-
const isMobileStudio = useIsMobileStudio();
|
|
378
|
-
const isEditMode = useSelector(previewStore, _temp6);
|
|
379
|
-
const isToolbarHidden = useSelector(previewStore, _temp7);
|
|
380
|
-
const isAddBlockSidebarOpen = useSelector(previewStore, _temp8);
|
|
381
|
-
const previewSource = useSelector(previewStore, _temp9);
|
|
382
315
|
const pageData = usePreviewedPage();
|
|
383
316
|
useHydrateDraftCache();
|
|
384
|
-
const hasLiveCheckpoint = pageData.page.livePublishedCheckpointId != null;
|
|
385
317
|
let t1;
|
|
318
|
+
if ($[1] !== children || $[2] !== pageData) {
|
|
319
|
+
t1 = /* @__PURE__ */ jsx(PreviewShell, {
|
|
320
|
+
pageData,
|
|
321
|
+
children
|
|
322
|
+
});
|
|
323
|
+
$[1] = children;
|
|
324
|
+
$[2] = pageData;
|
|
325
|
+
$[3] = t1;
|
|
326
|
+
} else t1 = $[3];
|
|
327
|
+
return t1;
|
|
328
|
+
};
|
|
329
|
+
/** Studio chrome is shared; only curated previews require a Camox page record. */
|
|
330
|
+
const PreviewShell = (t0) => {
|
|
331
|
+
const $ = c(58);
|
|
332
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
333
|
+
for (let $i = 0; $i < 58; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
334
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
335
|
+
}
|
|
336
|
+
const { children, pageData, hasLiveVersion: t1, derivedLayoutId, derivedLayout } = t0;
|
|
337
|
+
const hasLiveVersion = t1 === void 0 ? false : t1;
|
|
338
|
+
const isAuthenticated = useIsAuthenticated();
|
|
339
|
+
const isMobileStudio = useIsMobileStudio();
|
|
340
|
+
const sharedChrome = React.useContext(SharedChromeContext);
|
|
341
|
+
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
342
|
+
const isToolbarHidden = useSelector(previewStore, _temp3);
|
|
343
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp4);
|
|
344
|
+
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
345
|
+
const hasLiveCheckpoint = pageData ? pageData.page.livePublishedCheckpointId != null : hasLiveVersion;
|
|
386
346
|
let t2;
|
|
347
|
+
let t3;
|
|
387
348
|
if ($[1] !== isMobileStudio) {
|
|
388
|
-
|
|
349
|
+
t2 = () => {
|
|
389
350
|
if (!isMobileStudio) return;
|
|
390
351
|
previewStore.send({ type: "exitEditMode" });
|
|
391
352
|
previewStore.send({ type: "closeAddBlockSidebar" });
|
|
392
353
|
};
|
|
393
|
-
|
|
354
|
+
t3 = [isMobileStudio];
|
|
394
355
|
$[1] = isMobileStudio;
|
|
395
|
-
$[2] =
|
|
396
|
-
$[3] =
|
|
356
|
+
$[2] = t2;
|
|
357
|
+
$[3] = t3;
|
|
397
358
|
} else {
|
|
398
|
-
|
|
399
|
-
|
|
359
|
+
t2 = $[2];
|
|
360
|
+
t3 = $[3];
|
|
400
361
|
}
|
|
401
|
-
React.useEffect(
|
|
402
|
-
let t3;
|
|
362
|
+
React.useEffect(t2, t3);
|
|
403
363
|
let t4;
|
|
364
|
+
let t5;
|
|
404
365
|
if ($[4] !== hasLiveCheckpoint || $[5] !== isAuthenticated || $[6] !== isEditMode || $[7] !== isMobileStudio || $[8] !== previewSource) {
|
|
405
|
-
|
|
366
|
+
t4 = () => {
|
|
406
367
|
const actions = [
|
|
407
368
|
{
|
|
408
369
|
id: "exit-edit-mode",
|
|
@@ -415,11 +376,8 @@ const CamoxPreview = (t0) => {
|
|
|
415
376
|
],
|
|
416
377
|
groupLabel: "Preview",
|
|
417
378
|
checkIfAvailable: () => isAuthenticated && isEditMode,
|
|
418
|
-
execute:
|
|
419
|
-
shortcut:
|
|
420
|
-
key: "Enter",
|
|
421
|
-
withMeta: true
|
|
422
|
-
}
|
|
379
|
+
execute: _temp5,
|
|
380
|
+
shortcut: EDIT_MODE_SHORTCUT
|
|
423
381
|
},
|
|
424
382
|
{
|
|
425
383
|
id: "enter-edit-mode",
|
|
@@ -431,11 +389,8 @@ const CamoxPreview = (t0) => {
|
|
|
431
389
|
],
|
|
432
390
|
groupLabel: "Preview",
|
|
433
391
|
checkIfAvailable: () => isAuthenticated && !isEditMode && !isMobileStudio,
|
|
434
|
-
execute:
|
|
435
|
-
shortcut:
|
|
436
|
-
key: "Enter",
|
|
437
|
-
withMeta: true
|
|
438
|
-
}
|
|
392
|
+
execute: _temp6,
|
|
393
|
+
shortcut: EDIT_MODE_SHORTCUT
|
|
439
394
|
},
|
|
440
395
|
{
|
|
441
396
|
id: "preview-live-content",
|
|
@@ -447,7 +402,7 @@ const CamoxPreview = (t0) => {
|
|
|
447
402
|
],
|
|
448
403
|
groupLabel: "Preview",
|
|
449
404
|
checkIfAvailable: () => isAuthenticated && previewSource === "draft" && hasLiveCheckpoint,
|
|
450
|
-
execute:
|
|
405
|
+
execute: _temp7,
|
|
451
406
|
shortcut: {
|
|
452
407
|
key: "d",
|
|
453
408
|
withAlt: true
|
|
@@ -463,7 +418,7 @@ const CamoxPreview = (t0) => {
|
|
|
463
418
|
],
|
|
464
419
|
groupLabel: "Preview",
|
|
465
420
|
checkIfAvailable: () => isAuthenticated && previewSource === "live",
|
|
466
|
-
execute:
|
|
421
|
+
execute: _temp8,
|
|
467
422
|
shortcut: {
|
|
468
423
|
key: "d",
|
|
469
424
|
withAlt: true
|
|
@@ -474,8 +429,8 @@ const CamoxPreview = (t0) => {
|
|
|
474
429
|
label: "Clear selection",
|
|
475
430
|
aliases: ["Deselect", "Unselect"],
|
|
476
431
|
groupLabel: "Preview",
|
|
477
|
-
checkIfAvailable:
|
|
478
|
-
execute:
|
|
432
|
+
checkIfAvailable: _temp9,
|
|
433
|
+
execute: _temp0,
|
|
479
434
|
shortcut: { key: "Escape" }
|
|
480
435
|
}
|
|
481
436
|
];
|
|
@@ -486,11 +441,11 @@ const CamoxPreview = (t0) => {
|
|
|
486
441
|
return () => {
|
|
487
442
|
actionsStore.send({
|
|
488
443
|
type: "unregisterManyActions",
|
|
489
|
-
ids: actions.map(
|
|
444
|
+
ids: actions.map(_temp1)
|
|
490
445
|
});
|
|
491
446
|
};
|
|
492
447
|
};
|
|
493
|
-
|
|
448
|
+
t5 = [
|
|
494
449
|
isEditMode,
|
|
495
450
|
isAuthenticated,
|
|
496
451
|
isMobileStudio,
|
|
@@ -502,142 +457,158 @@ const CamoxPreview = (t0) => {
|
|
|
502
457
|
$[6] = isEditMode;
|
|
503
458
|
$[7] = isMobileStudio;
|
|
504
459
|
$[8] = previewSource;
|
|
505
|
-
$[9] =
|
|
506
|
-
$[10] =
|
|
460
|
+
$[9] = t4;
|
|
461
|
+
$[10] = t5;
|
|
507
462
|
} else {
|
|
508
|
-
|
|
509
|
-
|
|
463
|
+
t4 = $[9];
|
|
464
|
+
t5 = $[10];
|
|
510
465
|
}
|
|
511
|
-
React.useEffect(
|
|
466
|
+
React.useEffect(t4, t5);
|
|
512
467
|
if (!isAuthenticated) {
|
|
513
|
-
let
|
|
468
|
+
let t6;
|
|
514
469
|
if ($[11] !== children) {
|
|
515
|
-
|
|
470
|
+
t6 = /* @__PURE__ */ jsx(Fragment, { children });
|
|
516
471
|
$[11] = children;
|
|
517
|
-
$[12] =
|
|
518
|
-
} else
|
|
519
|
-
return
|
|
472
|
+
$[12] = t6;
|
|
473
|
+
} else t6 = $[12];
|
|
474
|
+
return t6;
|
|
520
475
|
}
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
$[
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
476
|
+
const t6 = sharedChrome ? "h-full" : "h-screen";
|
|
477
|
+
const t7 = !isEditMode && "bg-black";
|
|
478
|
+
let t8;
|
|
479
|
+
if ($[13] !== t6 || $[14] !== t7) {
|
|
480
|
+
t8 = cn("bg-background flex flex-col overflow-hidden", t6, t7);
|
|
481
|
+
$[13] = t6;
|
|
482
|
+
$[14] = t7;
|
|
483
|
+
$[15] = t8;
|
|
484
|
+
} else t8 = $[15];
|
|
485
|
+
let t9;
|
|
486
|
+
if ($[16] !== isAddBlockSidebarOpen || $[17] !== isMobileStudio || $[18] !== isToolbarHidden || $[19] !== pageData || $[20] !== sharedChrome) {
|
|
487
|
+
t9 = !sharedChrome && !isMobileStudio && !isToolbarHidden && /* @__PURE__ */ jsxs("div", {
|
|
531
488
|
className: "relative",
|
|
532
|
-
children: [/* @__PURE__ */ jsx(Navbar, {}), isAddBlockSidebarOpen && /* @__PURE__ */ jsx("div", {
|
|
489
|
+
children: [/* @__PURE__ */ jsx(Navbar, { isPreview: true }), pageData && isAddBlockSidebarOpen && /* @__PURE__ */ jsx("div", {
|
|
533
490
|
className: "absolute inset-0 z-20",
|
|
534
491
|
style: { background: "rgba(0, 0, 0, 0.66)" },
|
|
535
|
-
onClick:
|
|
492
|
+
onClick: _temp10
|
|
536
493
|
})]
|
|
537
494
|
});
|
|
538
|
-
$[
|
|
539
|
-
$[
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
495
|
+
$[16] = isAddBlockSidebarOpen;
|
|
496
|
+
$[17] = isMobileStudio;
|
|
497
|
+
$[18] = isToolbarHidden;
|
|
498
|
+
$[19] = pageData;
|
|
499
|
+
$[20] = sharedChrome;
|
|
500
|
+
$[21] = t9;
|
|
501
|
+
} else t9 = $[21];
|
|
502
|
+
let t10;
|
|
503
|
+
if ($[22] !== derivedLayout || $[23] !== derivedLayoutId || $[24] !== isEditMode || $[25] !== isMobileStudio || $[26] !== pageData) {
|
|
504
|
+
t10 = !isMobileStudio && (pageData || derivedLayoutId) && /* @__PURE__ */ jsx("div", {
|
|
505
|
+
className: isEditMode ? "contents" : "hidden",
|
|
506
|
+
children: /* @__PURE__ */ jsx(LeftSidebar, {
|
|
507
|
+
page: pageData?.page,
|
|
508
|
+
derivedLayout
|
|
509
|
+
})
|
|
510
|
+
});
|
|
511
|
+
$[22] = derivedLayout;
|
|
512
|
+
$[23] = derivedLayoutId;
|
|
513
|
+
$[24] = isEditMode;
|
|
514
|
+
$[25] = isMobileStudio;
|
|
515
|
+
$[26] = pageData;
|
|
516
|
+
$[27] = t10;
|
|
517
|
+
} else t10 = $[27];
|
|
518
|
+
const t11 = pageData?.page;
|
|
519
|
+
const t12 = pageData?.projectName;
|
|
520
|
+
const t13 = pageData?.page.status;
|
|
521
|
+
let t14;
|
|
522
|
+
if ($[28] !== hasLiveCheckpoint || $[29] !== t13) {
|
|
523
|
+
t14 = {
|
|
524
|
+
pageStatus: t13,
|
|
555
525
|
hasLiveVersion: hasLiveCheckpoint
|
|
556
526
|
};
|
|
557
|
-
$[
|
|
558
|
-
$[
|
|
559
|
-
$[
|
|
560
|
-
} else
|
|
561
|
-
let
|
|
562
|
-
if ($[
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
let t11;
|
|
572
|
-
if ($[29] !== children || $[30] !== isMobileStudio || $[31] !== pageData.page || $[32] !== pageData.projectName || $[33] !== t10 || $[34] !== t9) {
|
|
573
|
-
t11 = /* @__PURE__ */ jsxs(PreviewPanel, {
|
|
527
|
+
$[28] = hasLiveCheckpoint;
|
|
528
|
+
$[29] = t13;
|
|
529
|
+
$[30] = t14;
|
|
530
|
+
} else t14 = $[30];
|
|
531
|
+
let t15;
|
|
532
|
+
if ($[31] !== isEditMode || $[32] !== isMobileStudio) {
|
|
533
|
+
t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
534
|
+
$[31] = isEditMode;
|
|
535
|
+
$[32] = isMobileStudio;
|
|
536
|
+
$[33] = t15;
|
|
537
|
+
} else t15 = $[33];
|
|
538
|
+
let t16;
|
|
539
|
+
if ($[34] !== children || $[35] !== isMobileStudio || $[36] !== t11 || $[37] !== t12 || $[38] !== t14 || $[39] !== t15) {
|
|
540
|
+
t16 = /* @__PURE__ */ jsxs(PreviewPanel, {
|
|
574
541
|
isMobileExperience: isMobileStudio,
|
|
575
|
-
page:
|
|
576
|
-
projectName:
|
|
577
|
-
toolbarProps:
|
|
578
|
-
children: [children,
|
|
542
|
+
page: t11,
|
|
543
|
+
projectName: t12,
|
|
544
|
+
toolbarProps: t14,
|
|
545
|
+
children: [children, t15]
|
|
579
546
|
});
|
|
580
|
-
$[
|
|
581
|
-
$[
|
|
582
|
-
$[
|
|
583
|
-
$[
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
$[
|
|
587
|
-
} else
|
|
588
|
-
let
|
|
589
|
-
if ($[
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
$[
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
547
|
+
$[34] = children;
|
|
548
|
+
$[35] = isMobileStudio;
|
|
549
|
+
$[36] = t11;
|
|
550
|
+
$[37] = t12;
|
|
551
|
+
$[38] = t14;
|
|
552
|
+
$[39] = t15;
|
|
553
|
+
$[40] = t16;
|
|
554
|
+
} else t16 = $[40];
|
|
555
|
+
let t17;
|
|
556
|
+
if ($[41] !== derivedLayoutId || $[42] !== isEditMode || $[43] !== isMobileStudio || $[44] !== pageData?.page) {
|
|
557
|
+
t17 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
|
|
558
|
+
pageId: pageData?.page.id,
|
|
559
|
+
derivedLayoutId
|
|
560
|
+
});
|
|
561
|
+
$[41] = derivedLayoutId;
|
|
562
|
+
$[42] = isEditMode;
|
|
563
|
+
$[43] = isMobileStudio;
|
|
564
|
+
$[44] = pageData?.page;
|
|
565
|
+
$[45] = t17;
|
|
566
|
+
} else t17 = $[45];
|
|
567
|
+
let t18;
|
|
568
|
+
if ($[46] !== t10 || $[47] !== t16 || $[48] !== t17) {
|
|
569
|
+
t18 = /* @__PURE__ */ jsxs("div", {
|
|
599
570
|
className: "flex h-full flex-row items-stretch",
|
|
600
571
|
children: [
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
572
|
+
t10,
|
|
573
|
+
t16,
|
|
574
|
+
t17
|
|
604
575
|
]
|
|
605
576
|
});
|
|
606
|
-
$[
|
|
607
|
-
$[
|
|
608
|
-
$[
|
|
609
|
-
$[
|
|
610
|
-
} else
|
|
611
|
-
let
|
|
612
|
-
if ($[
|
|
613
|
-
|
|
614
|
-
$[
|
|
615
|
-
$[
|
|
616
|
-
$[
|
|
617
|
-
} else
|
|
618
|
-
let
|
|
619
|
-
if ($[
|
|
620
|
-
|
|
621
|
-
className:
|
|
577
|
+
$[46] = t10;
|
|
578
|
+
$[47] = t16;
|
|
579
|
+
$[48] = t17;
|
|
580
|
+
$[49] = t18;
|
|
581
|
+
} else t18 = $[49];
|
|
582
|
+
let t19;
|
|
583
|
+
if ($[50] !== isEditMode || $[51] !== isMobileStudio) {
|
|
584
|
+
t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
585
|
+
$[50] = isEditMode;
|
|
586
|
+
$[51] = isMobileStudio;
|
|
587
|
+
$[52] = t19;
|
|
588
|
+
} else t19 = $[52];
|
|
589
|
+
let t20;
|
|
590
|
+
if ($[53] !== t18 || $[54] !== t19 || $[55] !== t8 || $[56] !== t9) {
|
|
591
|
+
t20 = /* @__PURE__ */ jsxs("div", {
|
|
592
|
+
className: t8,
|
|
622
593
|
children: [
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
594
|
+
t9,
|
|
595
|
+
t18,
|
|
596
|
+
t19
|
|
626
597
|
]
|
|
627
598
|
});
|
|
628
|
-
$[
|
|
629
|
-
$[
|
|
630
|
-
$[
|
|
631
|
-
$[
|
|
632
|
-
$[
|
|
633
|
-
} else
|
|
634
|
-
return
|
|
599
|
+
$[53] = t18;
|
|
600
|
+
$[54] = t19;
|
|
601
|
+
$[55] = t8;
|
|
602
|
+
$[56] = t9;
|
|
603
|
+
$[57] = t20;
|
|
604
|
+
} else t20 = $[57];
|
|
605
|
+
return t20;
|
|
635
606
|
};
|
|
636
607
|
function usePreviewPagesActions() {
|
|
637
608
|
const $ = c(13);
|
|
638
|
-
if ($[0] !== "
|
|
609
|
+
if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
|
|
639
610
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
640
|
-
$[0] = "
|
|
611
|
+
$[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
|
|
641
612
|
}
|
|
642
613
|
const navigate = useNavigate();
|
|
643
614
|
const { pathname } = useLocation();
|
|
@@ -678,8 +649,8 @@ function usePreviewPagesActions() {
|
|
|
678
649
|
label: "Create page",
|
|
679
650
|
aliases: ["New page", "Add page"],
|
|
680
651
|
groupLabel: "Preview",
|
|
681
|
-
checkIfAvailable:
|
|
682
|
-
execute:
|
|
652
|
+
checkIfAvailable: _temp11,
|
|
653
|
+
execute: _temp12
|
|
683
654
|
},
|
|
684
655
|
{
|
|
685
656
|
id: "edit-current-page",
|
|
@@ -710,14 +681,14 @@ function usePreviewPagesActions() {
|
|
|
710
681
|
groupLabel: "Preview",
|
|
711
682
|
checkIfAvailable: () => !!pages,
|
|
712
683
|
hasChildren: true,
|
|
713
|
-
execute:
|
|
684
|
+
execute: _temp13
|
|
714
685
|
},
|
|
715
686
|
...pages ? pages.map((page) => ({
|
|
716
687
|
id: `go-to-page-${page.id}`,
|
|
717
688
|
parentActionId: "go-to-page",
|
|
718
689
|
label: `Go to "${page.nickname}"`,
|
|
719
690
|
groupLabel: "Preview",
|
|
720
|
-
checkIfAvailable:
|
|
691
|
+
checkIfAvailable: _temp14,
|
|
721
692
|
execute: () => navigate({ to: page.fullPath })
|
|
722
693
|
})) : []
|
|
723
694
|
];
|
|
@@ -728,7 +699,7 @@ function usePreviewPagesActions() {
|
|
|
728
699
|
return () => {
|
|
729
700
|
actionsStore.send({
|
|
730
701
|
type: "unregisterManyActions",
|
|
731
|
-
ids: actions.map(
|
|
702
|
+
ids: actions.map(_temp15)
|
|
732
703
|
});
|
|
733
704
|
};
|
|
734
705
|
};
|
|
@@ -748,64 +719,49 @@ function usePreviewPagesActions() {
|
|
|
748
719
|
}
|
|
749
720
|
React.useEffect(t4, t5);
|
|
750
721
|
}
|
|
751
|
-
function
|
|
722
|
+
function _temp15(a) {
|
|
752
723
|
return a.id;
|
|
753
724
|
}
|
|
754
|
-
function
|
|
725
|
+
function _temp14() {
|
|
755
726
|
return true;
|
|
756
727
|
}
|
|
757
|
-
function
|
|
758
|
-
function
|
|
728
|
+
function _temp13() {}
|
|
729
|
+
function _temp12() {
|
|
759
730
|
return previewStore.send({ type: "openCreatePageModal" });
|
|
760
731
|
}
|
|
761
|
-
function
|
|
732
|
+
function _temp11() {
|
|
762
733
|
return true;
|
|
763
734
|
}
|
|
764
|
-
function
|
|
765
|
-
return state.context.
|
|
766
|
-
}
|
|
767
|
-
function _temp6(state) {
|
|
768
|
-
return state.context.isEditMode;
|
|
769
|
-
}
|
|
770
|
-
function _temp7(state_0) {
|
|
771
|
-
return state_0.context.isToolbarHidden;
|
|
735
|
+
function _temp3(state) {
|
|
736
|
+
return state.context.isToolbarHidden;
|
|
772
737
|
}
|
|
773
|
-
function
|
|
774
|
-
return
|
|
738
|
+
function _temp4(state_0) {
|
|
739
|
+
return state_0.context.isAddBlockSidebarOpen;
|
|
775
740
|
}
|
|
776
|
-
function
|
|
777
|
-
return state_2.context.previewSource;
|
|
778
|
-
}
|
|
779
|
-
function _temp0() {
|
|
741
|
+
function _temp5() {
|
|
780
742
|
return previewStore.send({ type: "exitEditMode" });
|
|
781
743
|
}
|
|
782
|
-
function
|
|
744
|
+
function _temp6() {
|
|
783
745
|
return previewStore.send({ type: "enterEditMode" });
|
|
784
746
|
}
|
|
785
|
-
function
|
|
786
|
-
return previewStore.send({
|
|
787
|
-
type: "setPreviewSource",
|
|
788
|
-
source: "live"
|
|
789
|
-
});
|
|
747
|
+
function _temp7() {
|
|
748
|
+
return previewStore.send({ type: "viewLivePage" });
|
|
790
749
|
}
|
|
791
|
-
function
|
|
792
|
-
return previewStore.send({
|
|
793
|
-
type: "setPreviewSource",
|
|
794
|
-
source: "draft"
|
|
795
|
-
});
|
|
750
|
+
function _temp8() {
|
|
751
|
+
return previewStore.send({ type: "viewDraftPage" });
|
|
796
752
|
}
|
|
797
|
-
function
|
|
753
|
+
function _temp9() {
|
|
798
754
|
return true;
|
|
799
755
|
}
|
|
800
|
-
function
|
|
756
|
+
function _temp0() {
|
|
801
757
|
previewStore.send({ type: "clearSelection" });
|
|
802
758
|
}
|
|
803
|
-
function
|
|
759
|
+
function _temp1(a) {
|
|
804
760
|
return a.id;
|
|
805
761
|
}
|
|
806
|
-
function
|
|
762
|
+
function _temp10() {
|
|
807
763
|
return previewStore.send({ type: "closeAddBlockSidebar" });
|
|
808
764
|
}
|
|
809
765
|
|
|
810
766
|
//#endregion
|
|
811
|
-
export { CamoxPreview, PageContent, usePreviewPagesActions, usePreviewedPage };
|
|
767
|
+
export { CamoxPreview, PageContent, PreviewShell, usePreviewPagesActions, usePreviewedPage };
|