camox 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) 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 +18 -15
  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/createEditableBlock.d.ts +9 -8
  17. package/dist/core/editing/createEditableBlock.js +167 -168
  18. package/dist/core/lib/lexicalReact.d.ts +1 -26
  19. package/dist/core/lib/lexicalReact.js +46 -60
  20. package/dist/core/lib/lexicalState.js +164 -81
  21. package/dist/core/lib/modifierFormats.js +4 -15
  22. package/dist/core/lib/textStyles.d.ts +27 -0
  23. package/dist/core/lib/textStyles.js +47 -0
  24. package/dist/features/navigation/navigation.d.ts +2 -0
  25. package/dist/features/navigation/navigation.js +51 -46
  26. package/dist/features/page/DerivedPageContent.js +61 -0
  27. package/dist/features/page/PublishedPageContent.js +52 -83
  28. package/dist/features/page/SharedLayoutContent.js +66 -0
  29. package/dist/features/preview/CamoxPreview.d.ts +16 -1
  30. package/dist/features/preview/CamoxPreview.js +242 -265
  31. package/dist/features/preview/DerivedPreview.js +137 -0
  32. package/dist/features/preview/EditablePageExperience.js +25 -8
  33. package/dist/features/preview/components/AddBlockSidebar.js +43 -33
  34. package/dist/features/preview/components/AssetLightbox.js +1 -1
  35. package/dist/features/preview/components/BlockThumbnail.js +192 -0
  36. package/dist/features/preview/components/CreatePageModal.js +123 -115
  37. package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
  38. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
  39. package/dist/features/preview/components/DerivedLayoutSidebar.js +163 -0
  40. package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
  41. package/dist/features/preview/components/FieldToolbar.js +42 -20
  42. package/dist/features/preview/components/Frame.js +133 -140
  43. package/dist/features/preview/components/LeftSidebar.js +42 -38
  44. package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
  45. package/dist/features/preview/components/Overlays.js +57 -42
  46. package/dist/features/preview/components/PageInfoSidebar.js +63 -55
  47. package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
  48. package/dist/features/preview/components/PagePicker.js +205 -153
  49. package/dist/features/preview/components/PageTree.js +298 -206
  50. package/dist/features/preview/components/PreviewActivation.js +78 -0
  51. package/dist/features/preview/components/PreviewPanel.js +67 -35
  52. package/dist/features/preview/components/PreviewToolbar.js +218 -232
  53. package/dist/features/preview/components/PublicationRow.js +431 -0
  54. package/dist/features/preview/components/PublishDialog.js +180 -97
  55. package/dist/features/preview/components/RightSidebar.js +19 -34
  56. package/dist/features/preview/components/previewStyles.js +8 -0
  57. package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
  58. package/dist/features/preview/previewConstants.js +8 -0
  59. package/dist/features/preview/previewStore.js +0 -10
  60. package/dist/features/preview/publication.js +71 -0
  61. package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
  62. package/dist/features/provider/CoreCamoxProvider.js +11 -2
  63. package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
  64. package/dist/features/routes/pageRuntime.d.ts +10 -0
  65. package/dist/features/routes/pageRuntime.js +7 -9
  66. package/dist/features/runtime/PreviewDocumentContext.js +7 -0
  67. package/dist/features/runtime/RuntimeChrome.js +137 -0
  68. package/dist/features/runtime/SharedChromeContext.js +7 -0
  69. package/dist/features/runtime/navigationRequest.js +21 -0
  70. package/dist/features/runtime/navigationTarget.js +23 -0
  71. package/dist/features/runtime/pageApp.js +196 -121
  72. package/dist/features/runtime/pageNavigation.js +79 -130
  73. package/dist/features/runtime/runtime.d.ts +11 -0
  74. package/dist/features/runtime/runtime.js +183 -47
  75. package/dist/features/runtime/studioApp.d.ts +2 -11
  76. package/dist/features/runtime/studioApp.js +14 -177
  77. package/dist/features/studio/CamoxStudio.js +27 -13
  78. package/dist/features/studio/components/Navbar.js +80 -74
  79. package/dist/features/studio/studioTheme.js +25 -0
  80. package/dist/features/studio/useTheme.js +94 -109
  81. package/dist/features/vite/appGeneration.js +12 -3
  82. package/dist/features/vite/definitionsSync.js +4 -2
  83. package/dist/features/vite/layoutGeneration.js +38 -0
  84. package/dist/features/vite/runtimeDev.js +3 -1
  85. package/dist/lib/auth.js +15 -13
  86. package/dist/lib/normalized-data.js +4 -4
  87. package/dist/lib/platform.js +13 -0
  88. package/dist/lib/utils.js +90 -38
  89. package/dist/studio-overlays.css +5 -40
  90. package/dist/studio.css +1 -1
  91. package/package.json +8 -4
  92. package/skills/camox/SKILL.md +2 -0
  93. package/skills/camox/references/block-definitions.md +31 -12
  94. package/skills/camox/references/layout-definitions.md +2 -0
  95. package/dist/core/lib/modifiers.js +0 -24
  96. package/dist/features/preview/previewQueryFns.js +0 -23
  97. 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 { SharedChromeContext } from "../runtime/SharedChromeContext.js";
10
11
  import { previewStore } from "./previewStore.js";
11
12
  import { Navbar } from "../studio/components/Navbar.js";
12
13
  import { CreatePageModal } from "./components/CreatePageModal.js";
13
14
  import { DraftSwitchDialog } from "./components/DraftSwitchDialog.js";
15
+ import { EDIT_MODE_SHORTCUT } from "./previewConstants.js";
14
16
  import { LeftSidebar } from "./components/LeftSidebar.js";
15
17
  import { PeekedBlock } from "./components/PeekedBlock.js";
16
18
  import { PreviewPanel } from "./components/PreviewPanel.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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
39
40
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
40
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
41
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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,54 @@ 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] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
75
+ for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
76
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
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, _temp2);
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;
103
+ $[8] = t0;
104
+ $[9] = t1;
105
+ $[10] = t2;
106
+ } else t2 = $[10];
107
+ const { data: currentPage } = useSuspenseQuery(t2);
108
+ return currentPage;
167
109
  }
168
110
  function _temp2(state) {
169
- return state.context.peekedPagePathname;
111
+ return state.context.previewSource;
170
112
  }
171
113
  const BlockRenderer = (t0) => {
172
114
  const $ = c(23);
173
- if ($[0] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
115
+ if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
174
116
  for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
175
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
117
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
176
118
  }
177
119
  const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
178
- const previewSource = useSelector(previewStore, _temp4);
120
+ const previewSource = useSelector(previewStore, _temp3);
179
121
  let t1;
180
122
  if ($[1] !== blockId || $[2] !== previewSource) {
181
123
  t1 = blockQueries.get(blockId, previewSource);
@@ -315,9 +257,9 @@ const PageContent = () => {
315
257
  };
316
258
  function useHydrateDraftCache() {
317
259
  const $ = c(7);
318
- if ($[0] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
260
+ if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
319
261
  for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
320
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
262
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
321
263
  }
322
264
  const isAuthenticated = useIsAuthenticated();
323
265
  const queryClient = useQueryClient();
@@ -342,7 +284,7 @@ function useHydrateDraftCache() {
342
284
  projectName: data.projectName,
343
285
  project: data.project
344
286
  });
345
- }).catch(_temp5);
287
+ }).catch(_temp4);
346
288
  return () => {
347
289
  cancelled = true;
348
290
  };
@@ -365,44 +307,66 @@ function useHydrateDraftCache() {
365
307
  }
366
308
  React.useEffect(t0, t1);
367
309
  }
368
- function _temp5() {}
310
+ function _temp4() {}
369
311
  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";
312
+ const $ = c(4);
313
+ if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
314
+ for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
315
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
374
316
  }
375
317
  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
318
  const pageData = usePreviewedPage();
383
319
  useHydrateDraftCache();
384
- const hasLiveCheckpoint = pageData.page.livePublishedCheckpointId != null;
385
320
  let t1;
321
+ if ($[1] !== children || $[2] !== pageData) {
322
+ t1 = /* @__PURE__ */ jsx(PreviewShell, {
323
+ pageData,
324
+ children
325
+ });
326
+ $[1] = children;
327
+ $[2] = pageData;
328
+ $[3] = t1;
329
+ } else t1 = $[3];
330
+ return t1;
331
+ };
332
+ /** Studio chrome is shared; only curated previews require a Camox page record. */
333
+ const PreviewShell = (t0) => {
334
+ const $ = c(58);
335
+ if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
336
+ for (let $i = 0; $i < 58; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
337
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
338
+ }
339
+ const { children, pageData, hasLiveVersion: t1, derivedLayoutId, derivedLayout } = t0;
340
+ const hasLiveVersion = t1 === void 0 ? false : t1;
341
+ const isAuthenticated = useIsAuthenticated();
342
+ const isMobileStudio = useIsMobileStudio();
343
+ const sharedChrome = React.useContext(SharedChromeContext);
344
+ const isEditMode = useSelector(previewStore, _temp5);
345
+ const isToolbarHidden = useSelector(previewStore, _temp6);
346
+ const isAddBlockSidebarOpen = useSelector(previewStore, _temp7);
347
+ const previewSource = useSelector(previewStore, _temp8);
348
+ const hasLiveCheckpoint = pageData ? pageData.page.livePublishedCheckpointId != null : hasLiveVersion;
386
349
  let t2;
350
+ let t3;
387
351
  if ($[1] !== isMobileStudio) {
388
- t1 = () => {
352
+ t2 = () => {
389
353
  if (!isMobileStudio) return;
390
354
  previewStore.send({ type: "exitEditMode" });
391
355
  previewStore.send({ type: "closeAddBlockSidebar" });
392
356
  };
393
- t2 = [isMobileStudio];
357
+ t3 = [isMobileStudio];
394
358
  $[1] = isMobileStudio;
395
- $[2] = t1;
396
- $[3] = t2;
359
+ $[2] = t2;
360
+ $[3] = t3;
397
361
  } else {
398
- t1 = $[2];
399
- t2 = $[3];
362
+ t2 = $[2];
363
+ t3 = $[3];
400
364
  }
401
- React.useEffect(t1, t2);
402
- let t3;
365
+ React.useEffect(t2, t3);
403
366
  let t4;
367
+ let t5;
404
368
  if ($[4] !== hasLiveCheckpoint || $[5] !== isAuthenticated || $[6] !== isEditMode || $[7] !== isMobileStudio || $[8] !== previewSource) {
405
- t3 = () => {
369
+ t4 = () => {
406
370
  const actions = [
407
371
  {
408
372
  id: "exit-edit-mode",
@@ -415,11 +379,8 @@ const CamoxPreview = (t0) => {
415
379
  ],
416
380
  groupLabel: "Preview",
417
381
  checkIfAvailable: () => isAuthenticated && isEditMode,
418
- execute: _temp0,
419
- shortcut: {
420
- key: "Enter",
421
- withMeta: true
422
- }
382
+ execute: _temp9,
383
+ shortcut: EDIT_MODE_SHORTCUT
423
384
  },
424
385
  {
425
386
  id: "enter-edit-mode",
@@ -431,11 +392,8 @@ const CamoxPreview = (t0) => {
431
392
  ],
432
393
  groupLabel: "Preview",
433
394
  checkIfAvailable: () => isAuthenticated && !isEditMode && !isMobileStudio,
434
- execute: _temp1,
435
- shortcut: {
436
- key: "Enter",
437
- withMeta: true
438
- }
395
+ execute: _temp0,
396
+ shortcut: EDIT_MODE_SHORTCUT
439
397
  },
440
398
  {
441
399
  id: "preview-live-content",
@@ -447,7 +405,7 @@ const CamoxPreview = (t0) => {
447
405
  ],
448
406
  groupLabel: "Preview",
449
407
  checkIfAvailable: () => isAuthenticated && previewSource === "draft" && hasLiveCheckpoint,
450
- execute: _temp10,
408
+ execute: _temp1,
451
409
  shortcut: {
452
410
  key: "d",
453
411
  withAlt: true
@@ -463,7 +421,7 @@ const CamoxPreview = (t0) => {
463
421
  ],
464
422
  groupLabel: "Preview",
465
423
  checkIfAvailable: () => isAuthenticated && previewSource === "live",
466
- execute: _temp11,
424
+ execute: _temp10,
467
425
  shortcut: {
468
426
  key: "d",
469
427
  withAlt: true
@@ -474,8 +432,8 @@ const CamoxPreview = (t0) => {
474
432
  label: "Clear selection",
475
433
  aliases: ["Deselect", "Unselect"],
476
434
  groupLabel: "Preview",
477
- checkIfAvailable: _temp12,
478
- execute: _temp13,
435
+ checkIfAvailable: _temp11,
436
+ execute: _temp12,
479
437
  shortcut: { key: "Escape" }
480
438
  }
481
439
  ];
@@ -486,11 +444,11 @@ const CamoxPreview = (t0) => {
486
444
  return () => {
487
445
  actionsStore.send({
488
446
  type: "unregisterManyActions",
489
- ids: actions.map(_temp14)
447
+ ids: actions.map(_temp13)
490
448
  });
491
449
  };
492
450
  };
493
- t4 = [
451
+ t5 = [
494
452
  isEditMode,
495
453
  isAuthenticated,
496
454
  isMobileStudio,
@@ -502,142 +460,161 @@ const CamoxPreview = (t0) => {
502
460
  $[6] = isEditMode;
503
461
  $[7] = isMobileStudio;
504
462
  $[8] = previewSource;
505
- $[9] = t3;
506
- $[10] = t4;
463
+ $[9] = t4;
464
+ $[10] = t5;
507
465
  } else {
508
- t3 = $[9];
509
- t4 = $[10];
466
+ t4 = $[9];
467
+ t5 = $[10];
510
468
  }
511
- React.useEffect(t3, t4);
469
+ React.useEffect(t4, t5);
512
470
  if (!isAuthenticated) {
513
- let t5;
471
+ let t6;
514
472
  if ($[11] !== children) {
515
- t5 = /* @__PURE__ */ jsx(Fragment, { children });
473
+ t6 = /* @__PURE__ */ jsx(Fragment, { children });
516
474
  $[11] = children;
517
- $[12] = t5;
518
- } else t5 = $[12];
519
- return t5;
475
+ $[12] = t6;
476
+ } else t6 = $[12];
477
+ return t6;
520
478
  }
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", {
479
+ const t6 = sharedChrome ? "h-full" : "h-screen";
480
+ const t7 = !isEditMode && "bg-black";
481
+ let t8;
482
+ if ($[13] !== t6 || $[14] !== t7) {
483
+ t8 = cn("bg-background flex flex-col overflow-hidden", t6, t7);
484
+ $[13] = t6;
485
+ $[14] = t7;
486
+ $[15] = t8;
487
+ } else t8 = $[15];
488
+ let t9;
489
+ if ($[16] !== isAddBlockSidebarOpen || $[17] !== isMobileStudio || $[18] !== isToolbarHidden || $[19] !== pageData || $[20] !== sharedChrome) {
490
+ t9 = !sharedChrome && !isMobileStudio && !isToolbarHidden && /* @__PURE__ */ jsxs("div", {
531
491
  className: "relative",
532
- children: [/* @__PURE__ */ jsx(Navbar, {}), isAddBlockSidebarOpen && /* @__PURE__ */ jsx("div", {
492
+ children: [/* @__PURE__ */ jsx(Navbar, { isPreview: true }), pageData && isAddBlockSidebarOpen && /* @__PURE__ */ jsx("div", {
533
493
  className: "absolute inset-0 z-20",
534
494
  style: { background: "rgba(0, 0, 0, 0.66)" },
535
- onClick: _temp15
495
+ onClick: _temp14
536
496
  })]
537
497
  });
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,
498
+ $[16] = isAddBlockSidebarOpen;
499
+ $[17] = isMobileStudio;
500
+ $[18] = isToolbarHidden;
501
+ $[19] = pageData;
502
+ $[20] = sharedChrome;
503
+ $[21] = t9;
504
+ } else t9 = $[21];
505
+ let t10;
506
+ if ($[22] !== derivedLayout || $[23] !== derivedLayoutId || $[24] !== isEditMode || $[25] !== isMobileStudio || $[26] !== pageData) {
507
+ t10 = !isMobileStudio && (pageData || derivedLayoutId) && /* @__PURE__ */ jsx("div", {
508
+ className: isEditMode ? "contents" : "hidden",
509
+ children: /* @__PURE__ */ jsx(LeftSidebar, {
510
+ page: pageData?.page,
511
+ derivedLayout
512
+ })
513
+ });
514
+ $[22] = derivedLayout;
515
+ $[23] = derivedLayoutId;
516
+ $[24] = isEditMode;
517
+ $[25] = isMobileStudio;
518
+ $[26] = pageData;
519
+ $[27] = t10;
520
+ } else t10 = $[27];
521
+ const t11 = pageData?.page;
522
+ const t12 = pageData?.projectName;
523
+ const t13 = pageData?.page.status;
524
+ let t14;
525
+ if ($[28] !== hasLiveCheckpoint || $[29] !== t13) {
526
+ t14 = {
527
+ pageStatus: t13,
555
528
  hasLiveVersion: hasLiveCheckpoint
556
529
  };
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: {
530
+ $[28] = hasLiveCheckpoint;
531
+ $[29] = t13;
532
+ $[30] = t14;
533
+ } else t14 = $[30];
534
+ let t15;
535
+ if ($[31] !== isEditMode || $[32] !== isMobileStudio) {
536
+ t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx("div", { style: {
564
537
  height: "80px",
565
538
  background: "transparent"
566
539
  } });
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, {
540
+ $[31] = isEditMode;
541
+ $[32] = isMobileStudio;
542
+ $[33] = t15;
543
+ } else t15 = $[33];
544
+ let t16;
545
+ if ($[34] !== children || $[35] !== isMobileStudio || $[36] !== t11 || $[37] !== t12 || $[38] !== t14 || $[39] !== t15) {
546
+ t16 = /* @__PURE__ */ jsxs(PreviewPanel, {
574
547
  isMobileExperience: isMobileStudio,
575
- page: pageData.page,
576
- projectName: pageData.projectName,
577
- toolbarProps: t9,
578
- children: [children, t10]
548
+ page: t11,
549
+ projectName: t12,
550
+ toolbarProps: t14,
551
+ children: [children, t15]
579
552
  });
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", {
553
+ $[34] = children;
554
+ $[35] = isMobileStudio;
555
+ $[36] = t11;
556
+ $[37] = t12;
557
+ $[38] = t14;
558
+ $[39] = t15;
559
+ $[40] = t16;
560
+ } else t16 = $[40];
561
+ let t17;
562
+ if ($[41] !== derivedLayoutId || $[42] !== isEditMode || $[43] !== isMobileStudio || $[44] !== pageData?.page) {
563
+ t17 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
564
+ pageId: pageData?.page.id,
565
+ derivedLayoutId
566
+ });
567
+ $[41] = derivedLayoutId;
568
+ $[42] = isEditMode;
569
+ $[43] = isMobileStudio;
570
+ $[44] = pageData?.page;
571
+ $[45] = t17;
572
+ } else t17 = $[45];
573
+ let t18;
574
+ if ($[46] !== t10 || $[47] !== t16 || $[48] !== t17) {
575
+ t18 = /* @__PURE__ */ jsxs("div", {
599
576
  className: "flex h-full flex-row items-stretch",
600
577
  children: [
601
- t8,
602
- t11,
603
- t12
578
+ t10,
579
+ t16,
580
+ t17
604
581
  ]
605
582
  });
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,
583
+ $[46] = t10;
584
+ $[47] = t16;
585
+ $[48] = t17;
586
+ $[49] = t18;
587
+ } else t18 = $[49];
588
+ let t19;
589
+ if ($[50] !== isEditMode || $[51] !== isMobileStudio) {
590
+ t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), /* @__PURE__ */ jsx(DraftSwitchDialog, {})] });
591
+ $[50] = isEditMode;
592
+ $[51] = isMobileStudio;
593
+ $[52] = t19;
594
+ } else t19 = $[52];
595
+ let t20;
596
+ if ($[53] !== t18 || $[54] !== t19 || $[55] !== t8 || $[56] !== t9) {
597
+ t20 = /* @__PURE__ */ jsxs("div", {
598
+ className: t8,
622
599
  children: [
623
- t7,
624
- t13,
625
- t14
600
+ t9,
601
+ t18,
602
+ t19
626
603
  ]
627
604
  });
628
- $[47] = t13;
629
- $[48] = t14;
630
- $[49] = t6;
631
- $[50] = t7;
632
- $[51] = t15;
633
- } else t15 = $[51];
634
- return t15;
605
+ $[53] = t18;
606
+ $[54] = t19;
607
+ $[55] = t8;
608
+ $[56] = t9;
609
+ $[57] = t20;
610
+ } else t20 = $[57];
611
+ return t20;
635
612
  };
636
613
  function usePreviewPagesActions() {
637
614
  const $ = c(13);
638
- if ($[0] !== "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3") {
615
+ if ($[0] !== "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a") {
639
616
  for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
640
- $[0] = "29f1dc43006b541048efc4a08454742012d6157baa9fc62d4636c9c9d20b2ab3";
617
+ $[0] = "24b649dd4428fd20f053be5828fab17890ad150c780fc5ba746c0c95ac30dd2a";
641
618
  }
642
619
  const navigate = useNavigate();
643
620
  const { pathname } = useLocation();
@@ -678,8 +655,8 @@ function usePreviewPagesActions() {
678
655
  label: "Create page",
679
656
  aliases: ["New page", "Add page"],
680
657
  groupLabel: "Preview",
681
- checkIfAvailable: _temp16,
682
- execute: _temp17
658
+ checkIfAvailable: _temp15,
659
+ execute: _temp16
683
660
  },
684
661
  {
685
662
  id: "edit-current-page",
@@ -710,14 +687,14 @@ function usePreviewPagesActions() {
710
687
  groupLabel: "Preview",
711
688
  checkIfAvailable: () => !!pages,
712
689
  hasChildren: true,
713
- execute: _temp18
690
+ execute: _temp17
714
691
  },
715
692
  ...pages ? pages.map((page) => ({
716
693
  id: `go-to-page-${page.id}`,
717
694
  parentActionId: "go-to-page",
718
695
  label: `Go to "${page.nickname}"`,
719
696
  groupLabel: "Preview",
720
- checkIfAvailable: _temp19,
697
+ checkIfAvailable: _temp18,
721
698
  execute: () => navigate({ to: page.fullPath })
722
699
  })) : []
723
700
  ];
@@ -728,7 +705,7 @@ function usePreviewPagesActions() {
728
705
  return () => {
729
706
  actionsStore.send({
730
707
  type: "unregisterManyActions",
731
- ids: actions.map(_temp20)
708
+ ids: actions.map(_temp19)
732
709
  });
733
710
  };
734
711
  };
@@ -748,64 +725,64 @@ function usePreviewPagesActions() {
748
725
  }
749
726
  React.useEffect(t4, t5);
750
727
  }
751
- function _temp20(a) {
728
+ function _temp19(a) {
752
729
  return a.id;
753
730
  }
754
- function _temp19() {
731
+ function _temp18() {
755
732
  return true;
756
733
  }
757
- function _temp18() {}
758
- function _temp17() {
734
+ function _temp17() {}
735
+ function _temp16() {
759
736
  return previewStore.send({ type: "openCreatePageModal" });
760
737
  }
761
- function _temp16() {
738
+ function _temp15() {
762
739
  return true;
763
740
  }
764
- function _temp4(state) {
741
+ function _temp3(state) {
765
742
  return state.context.previewSource;
766
743
  }
767
- function _temp6(state) {
744
+ function _temp5(state) {
768
745
  return state.context.isEditMode;
769
746
  }
770
- function _temp7(state_0) {
747
+ function _temp6(state_0) {
771
748
  return state_0.context.isToolbarHidden;
772
749
  }
773
- function _temp8(state_1) {
750
+ function _temp7(state_1) {
774
751
  return state_1.context.isAddBlockSidebarOpen;
775
752
  }
776
- function _temp9(state_2) {
753
+ function _temp8(state_2) {
777
754
  return state_2.context.previewSource;
778
755
  }
779
- function _temp0() {
756
+ function _temp9() {
780
757
  return previewStore.send({ type: "exitEditMode" });
781
758
  }
782
- function _temp1() {
759
+ function _temp0() {
783
760
  return previewStore.send({ type: "enterEditMode" });
784
761
  }
785
- function _temp10() {
762
+ function _temp1() {
786
763
  return previewStore.send({
787
764
  type: "setPreviewSource",
788
765
  source: "live"
789
766
  });
790
767
  }
791
- function _temp11() {
768
+ function _temp10() {
792
769
  return previewStore.send({
793
770
  type: "setPreviewSource",
794
771
  source: "draft"
795
772
  });
796
773
  }
797
- function _temp12() {
774
+ function _temp11() {
798
775
  return true;
799
776
  }
800
- function _temp13() {
777
+ function _temp12() {
801
778
  previewStore.send({ type: "clearSelection" });
802
779
  }
803
- function _temp14(a) {
780
+ function _temp13(a) {
804
781
  return a.id;
805
782
  }
806
- function _temp15() {
783
+ function _temp14() {
807
784
  return previewStore.send({ type: "closeAddBlockSidebar" });
808
785
  }
809
786
 
810
787
  //#endregion
811
- export { CamoxPreview, PageContent, usePreviewPagesActions, usePreviewedPage };
788
+ export { CamoxPreview, PageContent, PreviewShell, usePreviewPagesActions, usePreviewedPage };