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
@@ -0,0 +1,10 @@
1
+ import { QueryClient } from "@tanstack/react-query";
2
+ import { Router } from "@camox/api-contract";
3
+ import { RouterClient } from "@orpc/server";
4
+
5
+ //#region src/features/routes/pageRuntime.d.ts
6
+ declare function createServerApiClient(apiUrl: string, environmentName?: string, options?: {
7
+ authCookieHeader?: string;
8
+ }): RouterClient<Router>;
9
+ //#endregion
10
+ export { createServerApiClient };
@@ -194,15 +194,13 @@ function buildCamoxPageHead(camoxApp, loaderData) {
194
194
  let title = pageMetaTitle;
195
195
  if (page.layout) {
196
196
  const layout = camoxApp.getLayoutById(page.layout.layoutId);
197
- if (layout) {
198
- title = layout._internal.buildMetaTitle({
199
- pageMetaTitle,
200
- projectName: page.projectName,
201
- pageFullPath: page.page.fullPath
202
- });
203
- meta.push({ title });
204
- }
197
+ if (layout) title = layout._internal.buildMetaTitle({
198
+ pageMetaTitle,
199
+ projectName: page.projectName,
200
+ pageFullPath: page.page.fullPath
201
+ });
205
202
  }
203
+ meta.push({ title });
206
204
  if (page.page.metaDescription) meta.push({
207
205
  name: "description",
208
206
  content: page.page.metaDescription
@@ -241,4 +239,4 @@ function buildCamoxPageHead(camoxApp, loaderData) {
241
239
  }
242
240
 
243
241
  //#endregion
244
- export { buildCamoxPageHead, createMarkdownResponse, createServerApiClient, isNotFoundError, loadCamoxPageForRequest };
242
+ export { buildCamoxPageHead, createMarkdownResponse, createServerApiClient, isAuthSessionError, isNotFoundError, loadCamoxPageForRequest, seedBlockCaches };
@@ -0,0 +1,7 @@
1
+ import { createContext } from "react";
2
+
3
+ //#region src/features/runtime/PreviewDocumentContext.ts
4
+ const PreviewDocumentContext = createContext(void 0);
5
+
6
+ //#endregion
7
+ export { PreviewDocumentContext };
@@ -0,0 +1,137 @@
1
+ import { SharedChromeContext } from "./SharedChromeContext.js";
2
+ import { previewStore } from "../preview/previewStore.js";
3
+ import { Navbar } from "../studio/components/Navbar.js";
4
+ import { PreviewToolbar } from "../preview/components/PreviewToolbar.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { skipToken, useQuery } from "@tanstack/react-query";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { useSelector } from "@xstate/store-react";
9
+ import { queryKeys } from "@camox/api-contract/query-keys";
10
+ import studioCssUrl from "virtual:camox-studio-css";
11
+
12
+ //#region src/features/runtime/RuntimeChrome.tsx
13
+ function RuntimeChrome(t0) {
14
+ const $ = c(28);
15
+ if ($[0] !== "aeb65c1f74ba1b6829f439e1b5b486e7595e47ca43050621ed9eca5dd60f7680") {
16
+ for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
17
+ $[0] = "aeb65c1f74ba1b6829f439e1b5b486e7595e47ca43050621ed9eca5dd60f7680";
18
+ }
19
+ const { input, children } = t0;
20
+ const preview = !input.routeKind;
21
+ const hidden = useSelector(previewStore, _temp);
22
+ const source = useSelector(previewStore, _temp2);
23
+ let t1;
24
+ if ($[1] !== input.pathname || $[2] !== source) {
25
+ t1 = queryKeys.pages.getByPath(input.pathname, source);
26
+ $[1] = input.pathname;
27
+ $[2] = source;
28
+ $[3] = t1;
29
+ } else t1 = $[3];
30
+ let t2;
31
+ if ($[4] !== t1) {
32
+ t2 = {
33
+ queryKey: t1,
34
+ queryFn: skipToken
35
+ };
36
+ $[4] = t1;
37
+ $[5] = t2;
38
+ } else t2 = $[5];
39
+ const { data: page } = useQuery(t2);
40
+ let t3;
41
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
42
+ t3 = /* @__PURE__ */ jsx("link", {
43
+ rel: "stylesheet",
44
+ href: studioCssUrl,
45
+ "data-camox-studio": true
46
+ });
47
+ $[6] = t3;
48
+ } else t3 = $[6];
49
+ const t4 = preview ? "max-md:hidden" : void 0;
50
+ const t5 = preview && hidden;
51
+ let t6;
52
+ if ($[7] !== preview) {
53
+ t6 = /* @__PURE__ */ jsx(Navbar, { isPreview: preview });
54
+ $[7] = preview;
55
+ $[8] = t6;
56
+ } else t6 = $[8];
57
+ let t7;
58
+ if ($[9] !== t4 || $[10] !== t5 || $[11] !== t6) {
59
+ t7 = /* @__PURE__ */ jsx("div", {
60
+ className: t4,
61
+ hidden: t5,
62
+ children: t6
63
+ });
64
+ $[9] = t4;
65
+ $[10] = t5;
66
+ $[11] = t6;
67
+ $[12] = t7;
68
+ } else t7 = $[12];
69
+ let t8;
70
+ if ($[13] !== children) {
71
+ t8 = /* @__PURE__ */ jsx("div", {
72
+ className: "flex min-h-0 flex-1 flex-col overflow-auto",
73
+ children
74
+ });
75
+ $[13] = children;
76
+ $[14] = t8;
77
+ } else t8 = $[14];
78
+ const t9 = !preview;
79
+ const t10 = input.derived ? void 0 : "max-md:hidden";
80
+ const t11 = preview && !input.derived ? page?.page.status : void 0;
81
+ const t12 = !!page?.page.livePublishedCheckpointId;
82
+ let t13;
83
+ if ($[15] !== t11 || $[16] !== t12) {
84
+ t13 = /* @__PURE__ */ jsx(PreviewToolbar, {
85
+ pageStatus: t11,
86
+ hasLiveVersion: t12
87
+ });
88
+ $[15] = t11;
89
+ $[16] = t12;
90
+ $[17] = t13;
91
+ } else t13 = $[17];
92
+ let t14;
93
+ if ($[18] !== t10 || $[19] !== t13 || $[20] !== t9) {
94
+ t14 = /* @__PURE__ */ jsx("div", {
95
+ hidden: t9,
96
+ className: t10,
97
+ children: t13
98
+ });
99
+ $[18] = t10;
100
+ $[19] = t13;
101
+ $[20] = t9;
102
+ $[21] = t14;
103
+ } else t14 = $[21];
104
+ let t15;
105
+ if ($[22] !== t14 || $[23] !== t8) {
106
+ t15 = /* @__PURE__ */ jsxs("div", {
107
+ className: "relative flex min-h-0 flex-1 flex-col",
108
+ children: [t8, t14]
109
+ });
110
+ $[22] = t14;
111
+ $[23] = t8;
112
+ $[24] = t15;
113
+ } else t15 = $[24];
114
+ let t16;
115
+ if ($[25] !== t15 || $[26] !== t7) {
116
+ t16 = /* @__PURE__ */ jsxs(SharedChromeContext.Provider, {
117
+ value: true,
118
+ children: [t3, /* @__PURE__ */ jsxs("div", {
119
+ className: "bg-background flex h-screen flex-col overflow-hidden",
120
+ children: [t7, t15]
121
+ })]
122
+ });
123
+ $[25] = t15;
124
+ $[26] = t7;
125
+ $[27] = t16;
126
+ } else t16 = $[27];
127
+ return t16;
128
+ }
129
+ function _temp2(state_0) {
130
+ return state_0.context.previewSource;
131
+ }
132
+ function _temp(state) {
133
+ return state.context.isToolbarHidden;
134
+ }
135
+
136
+ //#endregion
137
+ export { RuntimeChrome };
@@ -0,0 +1,7 @@
1
+ import { createContext } from "react";
2
+
3
+ //#region src/features/runtime/SharedChromeContext.ts
4
+ const SharedChromeContext = createContext(false);
5
+
6
+ //#endregion
7
+ export { SharedChromeContext };
@@ -0,0 +1,21 @@
1
+ //#region src/features/runtime/navigationRequest.ts
2
+ function createNavigationRequestTracker() {
3
+ let current;
4
+ return {
5
+ begin() {
6
+ current?.abort();
7
+ const controller = new AbortController();
8
+ current = controller;
9
+ return {
10
+ signal: controller.signal,
11
+ isCurrent: () => current === controller && !controller.signal.aborted
12
+ };
13
+ },
14
+ cancel() {
15
+ current?.abort();
16
+ }
17
+ };
18
+ }
19
+
20
+ //#endregion
21
+ export { createNavigationRequestTracker };
@@ -0,0 +1,23 @@
1
+ //#region src/features/runtime/navigationTarget.ts
2
+ function runtimePath(pathname, basePath) {
3
+ const base = basePath.replace(/\/$/, "");
4
+ if (!base || pathname === base || pathname.startsWith(`${base}/`)) return pathname;
5
+ return `${base}${pathname.startsWith("/") ? pathname : `/${pathname}`}`;
6
+ }
7
+ function getNavigationTarget(to, currentHref, basePath) {
8
+ const url = new URL(to, currentHref);
9
+ const current = new URL(currentHref);
10
+ if (url.origin !== current.origin || !["http:", "https:"].includes(url.protocol)) return null;
11
+ const base = basePath.replace(/\/$/, "");
12
+ if (base && /^(https?:)?\/\//.test(to) && url.pathname !== base && !url.pathname.startsWith(`${base}/`)) return null;
13
+ const pathname = base && (url.pathname === base || url.pathname.startsWith(`${base}/`)) ? url.pathname.slice(base.length) || "/" : url.pathname;
14
+ if (pathname === "/_camox" || pathname.startsWith("/_camox/") || pathname === "/og" || pathname === "/sitemap.xml") return null;
15
+ url.pathname = runtimePath(pathname, base);
16
+ return {
17
+ url,
18
+ pathname
19
+ };
20
+ }
21
+
22
+ //#endregion
23
+ export { getNavigationTarget, runtimePath };
@@ -1,7 +1,12 @@
1
- import { useAuthState } from "../../lib/auth.js";
1
+ import { useAuthState, useSignInRedirect } from "../../lib/auth.js";
2
+ import { PreviewDocumentContext } from "./PreviewDocumentContext.js";
3
+ import { PreviewActivation } from "../preview/components/PreviewActivation.js";
4
+ import { Frame } from "../preview/components/Frame.js";
2
5
  import { CoreCamoxProvider, isLocalhostPreview } from "../provider/CoreCamoxProvider.js";
6
+ import { DerivedPageContent } from "../page/DerivedPageContent.js";
3
7
  import { PublishedPageExperience } from "../page/PublishedPageExperience.js";
4
8
  import { PageNavigationProvider } from "./pageNavigation.js";
9
+ import { RuntimeChrome } from "./RuntimeChrome.js";
5
10
  import { c } from "react/compiler-runtime";
6
11
  import { HydrationBoundary, QueryClientProvider } from "@tanstack/react-query";
7
12
  import * as React from "react";
@@ -9,76 +14,75 @@ import { jsx } from "react/jsx-runtime";
9
14
 
10
15
  //#region src/features/runtime/pageApp.tsx
11
16
  function PageApp(t0) {
12
- const $ = c(22);
13
- if ($[0] !== "41b609b6b6e9223ab6f76c85adfea25789d9d089bc02ca12ea1dd789dd8294d1") {
14
- for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
- $[0] = "41b609b6b6e9223ab6f76c85adfea25789d9d089bc02ca12ea1dd789dd8294d1";
17
+ const $ = c(19);
18
+ if ($[0] !== "9929b5234f34e8dc8642da9eb491a90e9a57f3ab875ddfc1a186f42f4452f2f5") {
19
+ for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
20
+ $[0] = "9929b5234f34e8dc8642da9eb491a90e9a57f3ab875ddfc1a186f42f4452f2f5";
16
21
  }
17
22
  const { camoxApp, input, queryClient } = t0;
18
23
  const t1 = input.dehydratedState;
19
24
  let t2;
20
- if ($[1] !== camoxApp || $[2] !== input || $[3] !== queryClient) {
21
- t2 = /* @__PURE__ */ jsx(PageExperience, {
22
- camoxApp,
23
- input,
24
- queryClient
25
- });
26
- $[1] = camoxApp;
27
- $[2] = input;
28
- $[3] = queryClient;
29
- $[4] = t2;
30
- } else t2 = $[4];
31
- let t3;
32
- if ($[5] !== camoxApp || $[6] !== input.apiUrl || $[7] !== input.authenticationUrl || $[8] !== input.environmentName || $[9] !== input.projectSlug || $[10] !== t2) {
33
- t3 = /* @__PURE__ */ jsx(CoreCamoxProvider, {
25
+ if ($[1] !== camoxApp || $[2] !== input.apiUrl || $[3] !== input.authenticationUrl || $[4] !== input.environmentName || $[5] !== input.presentation || $[6] !== input.projectSlug || $[7] !== queryClient) {
26
+ t2 = (currentInput) => /* @__PURE__ */ jsx(CoreCamoxProvider, {
34
27
  camoxApp,
35
28
  authenticationUrl: input.authenticationUrl,
36
29
  apiUrl: input.apiUrl,
37
30
  projectSlug: input.projectSlug,
38
31
  environmentName: input.environmentName,
39
- children: t2
32
+ initialAuthenticated: input.presentation === "studio",
33
+ initialProject: currentInput.project,
34
+ children: /* @__PURE__ */ jsx(PreviewDocumentContext.Provider, {
35
+ value: currentInput.previewDocument,
36
+ children: /* @__PURE__ */ jsx(PageExperience, {
37
+ camoxApp,
38
+ input: currentInput,
39
+ queryClient,
40
+ studioDocument: input.presentation === "studio"
41
+ })
42
+ })
40
43
  });
41
- $[5] = camoxApp;
42
- $[6] = input.apiUrl;
43
- $[7] = input.authenticationUrl;
44
- $[8] = input.environmentName;
45
- $[9] = input.projectSlug;
46
- $[10] = t2;
47
- $[11] = t3;
48
- } else t3 = $[11];
49
- let t4;
50
- if ($[12] !== input || $[13] !== queryClient || $[14] !== t3) {
51
- t4 = /* @__PURE__ */ jsx(PageNavigationProvider, {
44
+ $[1] = camoxApp;
45
+ $[2] = input.apiUrl;
46
+ $[3] = input.authenticationUrl;
47
+ $[4] = input.environmentName;
48
+ $[5] = input.presentation;
49
+ $[6] = input.projectSlug;
50
+ $[7] = queryClient;
51
+ $[8] = t2;
52
+ } else t2 = $[8];
53
+ let t3;
54
+ if ($[9] !== input || $[10] !== queryClient || $[11] !== t2) {
55
+ t3 = /* @__PURE__ */ jsx(PageNavigationProvider, {
52
56
  initialInput: input,
53
57
  queryClient,
58
+ children: t2
59
+ });
60
+ $[9] = input;
61
+ $[10] = queryClient;
62
+ $[11] = t2;
63
+ $[12] = t3;
64
+ } else t3 = $[12];
65
+ let t4;
66
+ if ($[13] !== t1 || $[14] !== t3) {
67
+ t4 = /* @__PURE__ */ jsx(HydrationBoundary, {
68
+ state: t1,
54
69
  children: t3
55
70
  });
56
- $[12] = input;
57
- $[13] = queryClient;
71
+ $[13] = t1;
58
72
  $[14] = t3;
59
73
  $[15] = t4;
60
74
  } else t4 = $[15];
61
75
  let t5;
62
- if ($[16] !== t1 || $[17] !== t4) {
63
- t5 = /* @__PURE__ */ jsx(HydrationBoundary, {
64
- state: t1,
76
+ if ($[16] !== queryClient || $[17] !== t4) {
77
+ t5 = /* @__PURE__ */ jsx(QueryClientProvider, {
78
+ client: queryClient,
65
79
  children: t4
66
80
  });
67
- $[16] = t1;
81
+ $[16] = queryClient;
68
82
  $[17] = t4;
69
83
  $[18] = t5;
70
84
  } else t5 = $[18];
71
- let t6;
72
- if ($[19] !== queryClient || $[20] !== t5) {
73
- t6 = /* @__PURE__ */ jsx(QueryClientProvider, {
74
- client: queryClient,
75
- children: t5
76
- });
77
- $[19] = queryClient;
78
- $[20] = t5;
79
- $[21] = t6;
80
- } else t6 = $[21];
81
- return t6;
85
+ return t5;
82
86
  }
83
87
  const LazyEditablePageExperience = React.lazy(() => import("../preview/EditablePageExperience.js").then((module) => ({ default: module.EditablePageExperience })));
84
88
  const LazyLocalhostPreviewProvider = React.lazy(() => import("../provider/LocalhostPreviewProvider.js").then((module) => ({ default: module.LocalhostPreviewProvider })));
@@ -88,100 +92,171 @@ var EditingActivationBoundary = class extends React.Component {
88
92
  return { failed: true };
89
93
  }
90
94
  componentDidCatch(error) {
91
- console.error("Camox editing runtime failed to load; keeping the published page visible.", error);
95
+ console.error("Camox editing runtime failed to load.", error);
92
96
  }
93
97
  render() {
94
- if (this.state.failed) return this.props.fallback;
95
- return this.props.children;
98
+ return this.state.failed ? this.props.fallback : this.props.children;
96
99
  }
97
100
  };
101
+ const subscribeToHydration = () => () => {};
98
102
  function PageExperience(t0) {
99
- const $ = c(21);
100
- if ($[0] !== "41b609b6b6e9223ab6f76c85adfea25789d9d089bc02ca12ea1dd789dd8294d1") {
101
- for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
102
- $[0] = "41b609b6b6e9223ab6f76c85adfea25789d9d089bc02ca12ea1dd789dd8294d1";
103
+ const $ = c(39);
104
+ if ($[0] !== "9929b5234f34e8dc8642da9eb491a90e9a57f3ab875ddfc1a186f42f4452f2f5") {
105
+ for (let $i = 0; $i < 39; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
106
+ $[0] = "9929b5234f34e8dc8642da9eb491a90e9a57f3ab875ddfc1a186f42f4452f2f5";
103
107
  }
104
- const { camoxApp, input, queryClient } = t0;
105
- const { isAuthenticated } = useAuthState();
106
- const [hasOtt] = React.useState(_temp);
107
- const local = isLocalhostPreview();
108
- const shouldActivateEditing = isAuthenticated || input.source === "draft" || hasOtt;
108
+ const { camoxApp, input, queryClient, studioDocument } = t0;
109
+ const { isAuthenticated, isLoading } = useAuthState();
110
+ const hasHydrated = React.useSyncExternalStore(subscribeToHydration, _temp, _temp2);
111
+ const signIn = useSignInRedirect();
109
112
  let t1;
110
- if ($[1] !== input.source) {
111
- t1 = /* @__PURE__ */ jsx(PublishedPageExperience, { source: input.source });
112
- $[1] = input.source;
113
- $[2] = t1;
114
- } else t1 = $[2];
115
- const published = t1;
116
- if (shouldActivateEditing) {
117
- let t2;
118
- if ($[3] !== camoxApp || $[4] !== input || $[5] !== queryClient) {
119
- t2 = /* @__PURE__ */ jsx(LazyEditablePageExperience, {
113
+ let t2;
114
+ if ($[1] !== input.routeKind || $[2] !== isAuthenticated || $[3] !== isLoading || $[4] !== signIn) {
115
+ t1 = () => {
116
+ if (input.routeKind && !isAuthenticated && !isLoading) signIn();
117
+ };
118
+ t2 = [
119
+ input.routeKind,
120
+ isAuthenticated,
121
+ isLoading,
122
+ signIn
123
+ ];
124
+ $[1] = input.routeKind;
125
+ $[2] = isAuthenticated;
126
+ $[3] = isLoading;
127
+ $[4] = signIn;
128
+ $[5] = t1;
129
+ $[6] = t2;
130
+ } else {
131
+ t1 = $[5];
132
+ t2 = $[6];
133
+ }
134
+ React.useEffect(t1, t2);
135
+ let t3;
136
+ if ($[7] !== camoxApp || $[8] !== input.derived || $[9] !== input.routeKind || $[10] !== input.source) {
137
+ t3 = input.routeKind ? /* @__PURE__ */ jsx("div", {
138
+ className: "text-muted-foreground p-6 text-sm",
139
+ children: "Loading Studio…"
140
+ }) : input.derived ? /* @__PURE__ */ jsx(DerivedPageContent, {
141
+ camoxApp,
142
+ derived: input.derived,
143
+ source: input.source
144
+ }) : /* @__PURE__ */ jsx(PublishedPageExperience, { source: input.source });
145
+ $[7] = camoxApp;
146
+ $[8] = input.derived;
147
+ $[9] = input.routeKind;
148
+ $[10] = input.source;
149
+ $[11] = t3;
150
+ } else t3 = $[11];
151
+ const published = t3;
152
+ let t4;
153
+ if ($[12] !== published) {
154
+ t4 = /* @__PURE__ */ jsx(Frame, { children: published });
155
+ $[12] = published;
156
+ $[13] = t4;
157
+ } else t4 = $[13];
158
+ const isolatedPage = t4;
159
+ const fallback = input.routeKind ? published : isolatedPage;
160
+ if (isAuthenticated) {
161
+ let t5;
162
+ if ($[14] !== camoxApp || $[15] !== hasHydrated || $[16] !== input || $[17] !== queryClient) {
163
+ t5 = hasHydrated ? /* @__PURE__ */ jsx(LazyEditablePageExperience, {
120
164
  camoxApp,
121
165
  input,
122
166
  queryClient
167
+ }) : null;
168
+ $[14] = camoxApp;
169
+ $[15] = hasHydrated;
170
+ $[16] = input;
171
+ $[17] = queryClient;
172
+ $[18] = t5;
173
+ } else t5 = $[18];
174
+ const editor = t5;
175
+ let t6;
176
+ if ($[19] !== editor || $[20] !== fallback || $[21] !== input.previewDocument || $[22] !== input.routeKind || $[23] !== published) {
177
+ t6 = input.routeKind ? /* @__PURE__ */ jsx(React.Suspense, {
178
+ fallback,
179
+ children: editor ?? fallback
180
+ }) : /* @__PURE__ */ jsx(PreviewActivation, {
181
+ fallback: /* @__PURE__ */ jsx(Frame, {
182
+ serverOnly: !!input.previewDocument,
183
+ children: published
184
+ }),
185
+ children: editor
123
186
  });
124
- $[3] = camoxApp;
125
- $[4] = input;
126
- $[5] = queryClient;
127
- $[6] = t2;
128
- } else t2 = $[6];
129
- let t3;
130
- if ($[7] !== published || $[8] !== t2) {
131
- t3 = /* @__PURE__ */ jsx(React.Suspense, {
132
- fallback: published,
133
- children: t2
187
+ $[19] = editor;
188
+ $[20] = fallback;
189
+ $[21] = input.previewDocument;
190
+ $[22] = input.routeKind;
191
+ $[23] = published;
192
+ $[24] = t6;
193
+ } else t6 = $[24];
194
+ let t7;
195
+ if ($[25] !== fallback || $[26] !== t6) {
196
+ t7 = /* @__PURE__ */ jsx(EditingActivationBoundary, {
197
+ fallback,
198
+ children: t6
134
199
  });
135
- $[7] = published;
136
- $[8] = t2;
137
- $[9] = t3;
138
- } else t3 = $[9];
139
- let t4;
140
- if ($[10] !== published || $[11] !== t3) {
141
- t4 = /* @__PURE__ */ jsx(EditingActivationBoundary, {
142
- fallback: published,
143
- children: t3
200
+ $[25] = fallback;
201
+ $[26] = t6;
202
+ $[27] = t7;
203
+ } else t7 = $[27];
204
+ let t8;
205
+ if ($[28] !== input || $[29] !== t7) {
206
+ t8 = /* @__PURE__ */ jsx(RuntimeChrome, {
207
+ input,
208
+ children: t7
144
209
  });
145
- $[10] = published;
146
- $[11] = t3;
147
- $[12] = t4;
148
- } else t4 = $[12];
149
- return t4;
210
+ $[28] = input;
211
+ $[29] = t7;
212
+ $[30] = t8;
213
+ } else t8 = $[30];
214
+ return t8;
150
215
  }
151
- if (local) {
152
- let t2;
153
- if ($[13] !== published) {
154
- t2 = /* @__PURE__ */ jsx(LazyLocalhostPreviewProvider, { children: published });
155
- $[13] = published;
156
- $[14] = t2;
157
- } else t2 = $[14];
158
- let t3;
159
- if ($[15] !== published || $[16] !== t2) {
160
- t3 = /* @__PURE__ */ jsx(React.Suspense, {
216
+ if (input.routeKind) return null;
217
+ if (hasHydrated && isLocalhostPreview()) {
218
+ let t5;
219
+ if ($[31] !== published) {
220
+ t5 = /* @__PURE__ */ jsx(LazyLocalhostPreviewProvider, { children: published });
221
+ $[31] = published;
222
+ $[32] = t5;
223
+ } else t5 = $[32];
224
+ let t6;
225
+ if ($[33] !== published || $[34] !== t5) {
226
+ t6 = /* @__PURE__ */ jsx(React.Suspense, {
161
227
  fallback: published,
162
- children: t2
228
+ children: t5
163
229
  });
164
- $[15] = published;
165
- $[16] = t2;
166
- $[17] = t3;
167
- } else t3 = $[17];
168
- let t4;
169
- if ($[18] !== published || $[19] !== t3) {
170
- t4 = /* @__PURE__ */ jsx(EditingActivationBoundary, {
171
- fallback: published,
172
- children: t3
230
+ $[33] = published;
231
+ $[34] = t5;
232
+ $[35] = t6;
233
+ } else t6 = $[35];
234
+ return t6;
235
+ }
236
+ if (studioDocument) {
237
+ let t5;
238
+ if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
239
+ t5 = { height: "100vh" };
240
+ $[36] = t5;
241
+ } else t5 = $[36];
242
+ let t6;
243
+ if ($[37] !== isolatedPage) {
244
+ t6 = /* @__PURE__ */ jsx("div", {
245
+ style: t5,
246
+ children: isolatedPage
173
247
  });
174
- $[18] = published;
175
- $[19] = t3;
176
- $[20] = t4;
177
- } else t4 = $[20];
178
- return t4;
248
+ $[37] = isolatedPage;
249
+ $[38] = t6;
250
+ } else t6 = $[38];
251
+ return t6;
179
252
  }
180
253
  return published;
181
254
  }
255
+ function _temp2() {
256
+ return false;
257
+ }
182
258
  function _temp() {
183
- if (typeof window === "undefined") return false;
184
- return new URL(window.location.href).searchParams.has("ott");
259
+ return true;
185
260
  }
186
261
 
187
262
  //#endregion