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.
Files changed (108) hide show
  1. package/dist/components/PlatformLabel.js +62 -0
  2. package/dist/core/components/lexical/GradientNode.js +126 -0
  3. package/dist/core/components/lexical/InlineLexicalEditor.js +37 -56
  4. package/dist/core/components/lexical/InlineStylesPlugin.js +183 -0
  5. package/dist/core/components/lexical/SelectionBroadcaster.js +49 -46
  6. package/dist/core/components/lexical/SidebarLexicalEditor.js +197 -151
  7. package/dist/core/components/lexical/editorConfig.js +25 -7
  8. package/dist/core/components/lexical/selectTextLink.js +21 -0
  9. package/dist/core/createApp.d.ts +30 -17
  10. package/dist/core/createApp.js +14 -3
  11. package/dist/core/createBlock.d.ts +2 -2
  12. package/dist/core/createBlock.js +17 -28
  13. package/dist/core/createLayout.d.ts +48 -4
  14. package/dist/core/createLayout.js +51 -23
  15. package/dist/core/derivedRoutes.js +36 -0
  16. package/dist/core/editing/BlockEditingRuntime.js +4 -4
  17. package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
  18. package/dist/core/editing/createEditableBlock.d.ts +9 -8
  19. package/dist/core/editing/createEditableBlock.js +265 -403
  20. package/dist/core/hooks/useIsEditable.js +4 -7
  21. package/dist/core/hooks/useRequireDraftSource.js +7 -11
  22. package/dist/core/lib/lexicalReact.d.ts +1 -26
  23. package/dist/core/lib/lexicalReact.js +46 -60
  24. package/dist/core/lib/lexicalState.js +164 -81
  25. package/dist/core/lib/modifierFormats.js +4 -15
  26. package/dist/core/lib/textStyles.d.ts +27 -0
  27. package/dist/core/lib/textStyles.js +47 -0
  28. package/dist/features/navigation/navigation.d.ts +2 -0
  29. package/dist/features/navigation/navigation.js +51 -46
  30. package/dist/features/page/DerivedPageContent.js +61 -0
  31. package/dist/features/page/PublishedPageContent.js +52 -83
  32. package/dist/features/page/SharedLayoutContent.js +66 -0
  33. package/dist/features/preview/CamoxPreview.d.ts +16 -1
  34. package/dist/features/preview/CamoxPreview.js +246 -290
  35. package/dist/features/preview/DerivedPreview.js +134 -0
  36. package/dist/features/preview/EditablePageExperience.js +25 -8
  37. package/dist/features/preview/components/AddBlockSidebar.js +43 -33
  38. package/dist/features/preview/components/AssetLightbox.js +1 -1
  39. package/dist/features/preview/components/BlockActionsPopover.js +8 -8
  40. package/dist/features/preview/components/BlockThumbnail.js +192 -0
  41. package/dist/features/preview/components/CreatePageModal.js +123 -115
  42. package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
  43. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
  44. package/dist/features/preview/components/DerivedLayoutSidebar.js +160 -0
  45. package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
  46. package/dist/features/preview/components/FieldToolbar.js +42 -20
  47. package/dist/features/preview/components/Frame.js +133 -140
  48. package/dist/features/preview/components/LeftSidebar.js +42 -38
  49. package/dist/features/preview/components/LinkFieldEditor.js +3 -4
  50. package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
  51. package/dist/features/preview/components/Overlays.js +59 -47
  52. package/dist/features/preview/components/PageEditorSidebar.js +194 -203
  53. package/dist/features/preview/components/PageInfoSidebar.js +63 -55
  54. package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
  55. package/dist/features/preview/components/PagePicker.js +205 -153
  56. package/dist/features/preview/components/PageTree.js +366 -340
  57. package/dist/features/preview/components/PreviewActivation.js +78 -0
  58. package/dist/features/preview/components/PreviewPanel.js +98 -68
  59. package/dist/features/preview/components/PreviewToolbar.js +224 -241
  60. package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
  61. package/dist/features/preview/components/PublicationRow.js +425 -0
  62. package/dist/features/preview/components/PublishDialog.js +180 -97
  63. package/dist/features/preview/components/RightSidebar.js +19 -34
  64. package/dist/features/preview/components/previewStyles.js +8 -0
  65. package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
  66. package/dist/features/preview/previewConstants.js +8 -0
  67. package/dist/features/preview/previewStore.js +18 -39
  68. package/dist/features/preview/publication.js +71 -0
  69. package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
  70. package/dist/features/provider/CoreCamoxProvider.js +11 -2
  71. package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
  72. package/dist/features/provider/useAdminShortcuts.js +5 -4
  73. package/dist/features/routes/pageRuntime.d.ts +10 -0
  74. package/dist/features/routes/pageRuntime.js +7 -9
  75. package/dist/features/runtime/PreviewDocumentContext.js +7 -0
  76. package/dist/features/runtime/RuntimeChrome.js +149 -0
  77. package/dist/features/runtime/SharedChromeContext.js +7 -0
  78. package/dist/features/runtime/navigationRequest.js +21 -0
  79. package/dist/features/runtime/navigationTarget.js +23 -0
  80. package/dist/features/runtime/pageApp.js +196 -121
  81. package/dist/features/runtime/pageNavigation.js +79 -130
  82. package/dist/features/runtime/runtime.d.ts +11 -0
  83. package/dist/features/runtime/runtime.js +183 -47
  84. package/dist/features/runtime/studioApp.d.ts +2 -11
  85. package/dist/features/runtime/studioApp.js +14 -177
  86. package/dist/features/studio/CamoxStudio.js +27 -13
  87. package/dist/features/studio/components/Navbar.js +80 -74
  88. package/dist/features/studio/components/UserButton.js +4 -4
  89. package/dist/features/studio/studioTheme.js +25 -0
  90. package/dist/features/studio/useTheme.js +94 -109
  91. package/dist/features/vite/appGeneration.js +12 -3
  92. package/dist/features/vite/definitionsSync.js +4 -2
  93. package/dist/features/vite/layoutGeneration.js +38 -0
  94. package/dist/features/vite/runtimeDev.js +3 -1
  95. package/dist/lib/auth.js +15 -13
  96. package/dist/lib/normalized-data.js +4 -4
  97. package/dist/lib/platform.js +13 -0
  98. package/dist/lib/utils.js +90 -38
  99. package/dist/studio-overlays.css +5 -40
  100. package/dist/studio.css +1 -1
  101. package/package.json +8 -4
  102. package/skills/camox/SKILL.md +2 -0
  103. package/skills/camox/references/block-definitions.md +31 -12
  104. package/skills/camox/references/layout-definitions.md +2 -0
  105. package/dist/core/lib/modifiers.js +0 -24
  106. package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
  107. package/dist/features/preview/previewQueryFns.js +0 -23
  108. 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 { previewStore } from "./previewStore.js";
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 { DraftSwitchDialog } from "./components/DraftSwitchDialog.js";
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 { keepPreviousData, useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
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] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
39
+ if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
39
40
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
40
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
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(26);
74
- if ($[0] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
75
- for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
76
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
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 peekedPagePathname = useSelector(previewStore, _temp2);
82
- const previewSource = useSelector(previewStore, _temp3);
83
- const prevPathnameRef = React.useRef(pathname);
80
+ const previewSource = useSelector(previewStore, selectPreviewSource);
84
81
  let t0;
85
- let t1;
86
- if ($[1] !== pathname) {
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] = t0;
96
- $[3] = t1;
97
- } else {
98
- t0 = $[2];
99
- t1 = $[3];
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] = t2;
108
- } else t2 = $[6];
109
- let t3;
110
- if ($[7] !== pathname || $[8] !== previewSource || $[9] !== projectSlug) {
111
- t3 = pageStructureQueryFn(pathname, projectSlug, previewSource);
112
- $[7] = pathname;
113
- $[8] = previewSource;
114
- $[9] = projectSlug;
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
- $[22] = t5;
158
- $[23] = t7;
159
- $[24] = t8;
160
- $[25] = t9;
161
- } else t9 = $[25];
162
- const { data: peekedPage } = useQuery(t9);
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] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
112
+ if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
174
113
  for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
175
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
114
+ $[0] = "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d";
176
115
  }
177
116
  const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
178
- const previewSource = useSelector(previewStore, _temp4);
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, (state) => state.context.previewSource));
253
- const peekedBlockPosition = useSelector(previewStore, (state_0) => state_0.context.peekedBlockPosition);
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] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
257
+ if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
319
258
  for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
320
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
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(_temp5);
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 _temp5() {}
307
+ function _temp2() {}
369
308
  const CamoxPreview = (t0) => {
370
- const $ = c(52);
371
- if ($[0] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
372
- for (let $i = 0; $i < 52; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
373
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
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
- t1 = () => {
349
+ t2 = () => {
389
350
  if (!isMobileStudio) return;
390
351
  previewStore.send({ type: "exitEditMode" });
391
352
  previewStore.send({ type: "closeAddBlockSidebar" });
392
353
  };
393
- t2 = [isMobileStudio];
354
+ t3 = [isMobileStudio];
394
355
  $[1] = isMobileStudio;
395
- $[2] = t1;
396
- $[3] = t2;
356
+ $[2] = t2;
357
+ $[3] = t3;
397
358
  } else {
398
- t1 = $[2];
399
- t2 = $[3];
359
+ t2 = $[2];
360
+ t3 = $[3];
400
361
  }
401
- React.useEffect(t1, t2);
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
- t3 = () => {
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: _temp0,
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: _temp1,
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: _temp10,
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: _temp11,
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: _temp12,
478
- execute: _temp13,
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(_temp14)
444
+ ids: actions.map(_temp1)
490
445
  });
491
446
  };
492
447
  };
493
- t4 = [
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] = t3;
506
- $[10] = t4;
460
+ $[9] = t4;
461
+ $[10] = t5;
507
462
  } else {
508
- t3 = $[9];
509
- t4 = $[10];
463
+ t4 = $[9];
464
+ t5 = $[10];
510
465
  }
511
- React.useEffect(t3, t4);
466
+ React.useEffect(t4, t5);
512
467
  if (!isAuthenticated) {
513
- let t5;
468
+ let t6;
514
469
  if ($[11] !== children) {
515
- t5 = /* @__PURE__ */ jsx(Fragment, { children });
470
+ t6 = /* @__PURE__ */ jsx(Fragment, { children });
516
471
  $[11] = children;
517
- $[12] = t5;
518
- } else t5 = $[12];
519
- return t5;
472
+ $[12] = t6;
473
+ } else t6 = $[12];
474
+ return t6;
520
475
  }
521
- const t5 = !isEditMode && "bg-black";
522
- let t6;
523
- if ($[13] !== t5) {
524
- t6 = cn("bg-background flex h-screen flex-col overflow-hidden", t5);
525
- $[13] = t5;
526
- $[14] = t6;
527
- } else t6 = $[14];
528
- let t7;
529
- if ($[15] !== isAddBlockSidebarOpen || $[16] !== isMobileStudio || $[17] !== isToolbarHidden) {
530
- t7 = !isMobileStudio && !isToolbarHidden && /* @__PURE__ */ jsxs("div", {
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: _temp15
492
+ onClick: _temp10
536
493
  })]
537
494
  });
538
- $[15] = isAddBlockSidebarOpen;
539
- $[16] = isMobileStudio;
540
- $[17] = isToolbarHidden;
541
- $[18] = t7;
542
- } else t7 = $[18];
543
- let t8;
544
- if ($[19] !== isEditMode || $[20] !== isMobileStudio || $[21] !== pageData.page) {
545
- t8 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(LeftSidebar, { page: pageData.page });
546
- $[19] = isEditMode;
547
- $[20] = isMobileStudio;
548
- $[21] = pageData.page;
549
- $[22] = t8;
550
- } else t8 = $[22];
551
- let t9;
552
- if ($[23] !== hasLiveCheckpoint || $[24] !== pageData.page.status) {
553
- t9 = {
554
- pageStatus: pageData.page.status,
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
- $[23] = hasLiveCheckpoint;
558
- $[24] = pageData.page.status;
559
- $[25] = t9;
560
- } else t9 = $[25];
561
- let t10;
562
- if ($[26] !== isEditMode || $[27] !== isMobileStudio) {
563
- t10 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx("div", { style: {
564
- height: "80px",
565
- background: "transparent"
566
- } });
567
- $[26] = isEditMode;
568
- $[27] = isMobileStudio;
569
- $[28] = t10;
570
- } else t10 = $[28];
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: pageData.page,
576
- projectName: pageData.projectName,
577
- toolbarProps: t9,
578
- children: [children, t10]
542
+ page: t11,
543
+ projectName: t12,
544
+ toolbarProps: t14,
545
+ children: [children, t15]
579
546
  });
580
- $[29] = children;
581
- $[30] = isMobileStudio;
582
- $[31] = pageData.page;
583
- $[32] = pageData.projectName;
584
- $[33] = t10;
585
- $[34] = t9;
586
- $[35] = t11;
587
- } else t11 = $[35];
588
- let t12;
589
- if ($[36] !== isEditMode || $[37] !== isMobileStudio || $[38] !== pageData.page.id) {
590
- t12 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, { pageId: pageData.page.id });
591
- $[36] = isEditMode;
592
- $[37] = isMobileStudio;
593
- $[38] = pageData.page.id;
594
- $[39] = t12;
595
- } else t12 = $[39];
596
- let t13;
597
- if ($[40] !== t11 || $[41] !== t12 || $[42] !== t8) {
598
- t13 = /* @__PURE__ */ jsxs("div", {
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
- t8,
602
- t11,
603
- t12
572
+ t10,
573
+ t16,
574
+ t17
604
575
  ]
605
576
  });
606
- $[40] = t11;
607
- $[41] = t12;
608
- $[42] = t8;
609
- $[43] = t13;
610
- } else t13 = $[43];
611
- let t14;
612
- if ($[44] !== isEditMode || $[45] !== isMobileStudio) {
613
- t14 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), /* @__PURE__ */ jsx(DraftSwitchDialog, {})] });
614
- $[44] = isEditMode;
615
- $[45] = isMobileStudio;
616
- $[46] = t14;
617
- } else t14 = $[46];
618
- let t15;
619
- if ($[47] !== t13 || $[48] !== t14 || $[49] !== t6 || $[50] !== t7) {
620
- t15 = /* @__PURE__ */ jsxs("div", {
621
- className: t6,
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
- t7,
624
- t13,
625
- t14
594
+ t9,
595
+ t18,
596
+ t19
626
597
  ]
627
598
  });
628
- $[47] = t13;
629
- $[48] = t14;
630
- $[49] = t6;
631
- $[50] = t7;
632
- $[51] = t15;
633
- } else t15 = $[51];
634
- return t15;
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] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
609
+ if ($[0] !== "11649479464867dae9140a3e12df376e886901a1c7db652f3f404c61e069d60d") {
639
610
  for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
640
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
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: _temp16,
682
- execute: _temp17
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: _temp18
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: _temp19,
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(_temp20)
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 _temp20(a) {
722
+ function _temp15(a) {
752
723
  return a.id;
753
724
  }
754
- function _temp19() {
725
+ function _temp14() {
755
726
  return true;
756
727
  }
757
- function _temp18() {}
758
- function _temp17() {
728
+ function _temp13() {}
729
+ function _temp12() {
759
730
  return previewStore.send({ type: "openCreatePageModal" });
760
731
  }
761
- function _temp16() {
732
+ function _temp11() {
762
733
  return true;
763
734
  }
764
- function _temp4(state) {
765
- return state.context.previewSource;
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 _temp8(state_1) {
774
- return state_1.context.isAddBlockSidebarOpen;
738
+ function _temp4(state_0) {
739
+ return state_0.context.isAddBlockSidebarOpen;
775
740
  }
776
- function _temp9(state_2) {
777
- return state_2.context.previewSource;
778
- }
779
- function _temp0() {
741
+ function _temp5() {
780
742
  return previewStore.send({ type: "exitEditMode" });
781
743
  }
782
- function _temp1() {
744
+ function _temp6() {
783
745
  return previewStore.send({ type: "enterEditMode" });
784
746
  }
785
- function _temp10() {
786
- return previewStore.send({
787
- type: "setPreviewSource",
788
- source: "live"
789
- });
747
+ function _temp7() {
748
+ return previewStore.send({ type: "viewLivePage" });
790
749
  }
791
- function _temp11() {
792
- return previewStore.send({
793
- type: "setPreviewSource",
794
- source: "draft"
795
- });
750
+ function _temp8() {
751
+ return previewStore.send({ type: "viewDraftPage" });
796
752
  }
797
- function _temp12() {
753
+ function _temp9() {
798
754
  return true;
799
755
  }
800
- function _temp13() {
756
+ function _temp0() {
801
757
  previewStore.send({ type: "clearSelection" });
802
758
  }
803
- function _temp14(a) {
759
+ function _temp1(a) {
804
760
  return a.id;
805
761
  }
806
- function _temp15() {
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 };