camox 0.34.0 → 0.36.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 (80) hide show
  1. package/dist/core/components/lexical/InlineLexicalEditor.js +1 -1
  2. package/dist/core/components/lexical/SidebarLexicalEditor.js +7 -7
  3. package/dist/core/components/lexical/TextLinkPopover.js +4 -4
  4. package/dist/core/createApp.d.ts +2 -1
  5. package/dist/core/createBlock.d.ts +5 -1451
  6. package/dist/core/createBlock.js +449 -1602
  7. package/dist/core/editing/BlockEditingRuntime.js +36 -0
  8. package/dist/core/editing/CompleteBlockEditingRuntime.js +76 -0
  9. package/dist/core/editing/createEditableBlock.d.ts +1455 -0
  10. package/dist/core/editing/createEditableBlock.js +1751 -0
  11. package/dist/core/lib/lexicalState.js +1 -1
  12. package/dist/features/agent-chat/components/AgentChatSidebar.js +1 -1
  13. package/dist/features/content/components/AssetCard.js +1 -1
  14. package/dist/features/page/PublishedPageContent.js +236 -0
  15. package/dist/features/page/PublishedPageExperience.js +23 -0
  16. package/dist/features/preview/CamoxPreview.d.ts +1 -0
  17. package/dist/features/preview/CamoxPreview.js +110 -93
  18. package/dist/features/preview/EditablePageContent.js +3 -0
  19. package/dist/features/preview/EditablePageExperience.js +24 -0
  20. package/dist/features/preview/components/AddBlockSidebar.js +3 -3
  21. package/dist/features/preview/components/AssetFieldEditor.js +1 -1
  22. package/dist/features/preview/components/AssetLightbox.js +47 -111
  23. package/dist/features/preview/components/BlockActionsPopover.js +6 -6
  24. package/dist/features/preview/components/CreatePageModal.js +4 -4
  25. package/dist/features/preview/components/DebouncedFieldEditor.js +2 -2
  26. package/dist/features/preview/components/DraftSwitchDialog.js +1 -1
  27. package/dist/features/preview/components/FieldToolbar.js +3 -3
  28. package/dist/features/preview/components/Frame.js +1 -1
  29. package/dist/features/preview/components/ItemFieldsEditor.js +3 -3
  30. package/dist/features/preview/components/LeftSidebar.js +1 -1
  31. package/dist/features/preview/components/LinkFieldEditor.js +3 -3
  32. package/dist/features/preview/components/Metadata.js +87 -0
  33. package/dist/features/preview/components/MultipleAssetFieldEditor.js +1 -1
  34. package/dist/features/preview/components/OverlayTracker.js +3 -3
  35. package/dist/features/preview/components/Overlays.js +3 -3
  36. package/dist/features/preview/components/PageEditorSidebar.js +40 -30
  37. package/dist/features/preview/components/PageInfoSidebar.js +158 -74
  38. package/dist/features/preview/components/PageLocationFieldset.js +1 -1
  39. package/dist/features/preview/components/PageNavigatorSidebar.js +244 -316
  40. package/dist/features/preview/components/PageNicknameField.js +2 -2
  41. package/dist/features/preview/components/PagePicker.js +3 -3
  42. package/dist/features/preview/components/PageTree.js +3 -3
  43. package/dist/features/preview/components/PeekedBlock.js +2 -2
  44. package/dist/features/preview/components/PreviewPanel.js +2 -2
  45. package/dist/features/preview/components/PreviewToolbar.js +77 -51
  46. package/dist/features/preview/components/PublishDialog.js +2 -2
  47. package/dist/features/preview/components/RepeatableItemsList.js +1 -1
  48. package/dist/features/preview/components/RightSidebar.js +1 -1
  49. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  50. package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
  51. package/dist/features/preview/previewStore.js +13 -6
  52. package/dist/features/provider/AuthenticatedCamoxProvider.js +63 -0
  53. package/dist/features/provider/CamoxProvider.d.ts +5 -12
  54. package/dist/features/provider/CamoxProvider.js +80 -338
  55. package/dist/features/provider/CoreCamoxProvider.js +37 -0
  56. package/dist/features/provider/LocalhostPreviewProvider.js +159 -0
  57. package/dist/features/provider/components/CommandPalette.js +1 -1
  58. package/dist/features/provider/useAdminShortcuts.js +1 -1
  59. package/dist/features/runtime/hydrationData.js +9 -0
  60. package/dist/features/runtime/pageApp.js +148 -35
  61. package/dist/features/runtime/pageClient.d.ts +1 -2
  62. package/dist/features/runtime/pageClient.js +3 -20
  63. package/dist/features/runtime/runtime.d.ts +1 -0
  64. package/dist/features/runtime/studioApp.js +76 -8
  65. package/dist/features/runtime/studioClient.d.ts +6 -0
  66. package/dist/features/runtime/studioClient.js +20 -0
  67. package/dist/features/runtime/studioNavigation.js +7 -2
  68. package/dist/features/studio/CamoxStudio.js +1 -1
  69. package/dist/features/studio/components/EnvironmentMenu.js +2 -2
  70. package/dist/features/studio/components/Navbar.js +5 -5
  71. package/dist/features/studio/components/ProjectMenu.js +5 -5
  72. package/dist/features/studio/useTheme.js +1 -22
  73. package/dist/features/vite/runtimeDev.js +24 -3
  74. package/dist/features/vite/vite.d.ts +1 -1
  75. package/dist/features/vite/vite.js +9 -3
  76. package/dist/lib/normalized-data.js +6 -6
  77. package/dist/lib/telemetry-client.js +2 -2
  78. package/dist/lib/view-queries.js +28 -0
  79. package/dist/studio.css +1 -1
  80. package/package.json +9 -4
@@ -1,27 +1,36 @@
1
- import { CamoxPreview, PageContent } from "../preview/CamoxPreview.js";
2
- import { CamoxProvider } from "../provider/CamoxProvider.js";
1
+ import { useAuthState } from "../../lib/auth.js";
2
+ import { CoreCamoxProvider, isLocalhostPreview } from "../provider/CoreCamoxProvider.js";
3
+ import { PublishedPageExperience } from "../page/PublishedPageExperience.js";
3
4
  import { PageNavigationProvider } from "./pageNavigation.js";
4
5
  import { c } from "react/compiler-runtime";
5
6
  import { HydrationBoundary, QueryClientProvider } from "@tanstack/react-query";
7
+ import * as React from "react";
6
8
  import { jsx } from "react/jsx-runtime";
7
9
 
8
10
  //#region src/features/runtime/pageApp.tsx
9
11
  function PageApp(t0) {
10
- const $ = c(18);
11
- if ($[0] !== "557a21bc6b4aed13935ede3368115a90db9c6fcffe823bb869ddbaeb394cf48e") {
12
- for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
13
- $[0] = "557a21bc6b4aed13935ede3368115a90db9c6fcffe823bb869ddbaeb394cf48e";
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";
14
16
  }
15
17
  const { camoxApp, input, queryClient } = t0;
16
18
  const t1 = input.dehydratedState;
17
19
  let t2;
18
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
19
- t2 = /* @__PURE__ */ jsx(CamoxPreview, { children: /* @__PURE__ */ jsx(PageContent, {}) });
20
- $[1] = t2;
21
- } else t2 = $[1];
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];
22
31
  let t3;
23
- if ($[2] !== camoxApp || $[3] !== input.apiUrl || $[4] !== input.authenticationUrl || $[5] !== input.environmentName || $[6] !== input.projectSlug) {
24
- t3 = /* @__PURE__ */ jsx(CamoxProvider, {
32
+ if ($[5] !== camoxApp || $[6] !== input.apiUrl || $[7] !== input.authenticationUrl || $[8] !== input.environmentName || $[9] !== input.projectSlug || $[10] !== t2) {
33
+ t3 = /* @__PURE__ */ jsx(CoreCamoxProvider, {
25
34
  camoxApp,
26
35
  authenticationUrl: input.authenticationUrl,
27
36
  apiUrl: input.apiUrl,
@@ -29,47 +38,151 @@ function PageApp(t0) {
29
38
  environmentName: input.environmentName,
30
39
  children: t2
31
40
  });
32
- $[2] = camoxApp;
33
- $[3] = input.apiUrl;
34
- $[4] = input.authenticationUrl;
35
- $[5] = input.environmentName;
36
- $[6] = input.projectSlug;
37
- $[7] = t3;
38
- } else t3 = $[7];
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];
39
49
  let t4;
40
- if ($[8] !== input || $[9] !== queryClient || $[10] !== t3) {
50
+ if ($[12] !== input || $[13] !== queryClient || $[14] !== t3) {
41
51
  t4 = /* @__PURE__ */ jsx(PageNavigationProvider, {
42
52
  initialInput: input,
43
53
  queryClient,
44
54
  children: t3
45
55
  });
46
- $[8] = input;
47
- $[9] = queryClient;
48
- $[10] = t3;
49
- $[11] = t4;
50
- } else t4 = $[11];
56
+ $[12] = input;
57
+ $[13] = queryClient;
58
+ $[14] = t3;
59
+ $[15] = t4;
60
+ } else t4 = $[15];
51
61
  let t5;
52
- if ($[12] !== t1 || $[13] !== t4) {
62
+ if ($[16] !== t1 || $[17] !== t4) {
53
63
  t5 = /* @__PURE__ */ jsx(HydrationBoundary, {
54
64
  state: t1,
55
65
  children: t4
56
66
  });
57
- $[12] = t1;
58
- $[13] = t4;
59
- $[14] = t5;
60
- } else t5 = $[14];
67
+ $[16] = t1;
68
+ $[17] = t4;
69
+ $[18] = t5;
70
+ } else t5 = $[18];
61
71
  let t6;
62
- if ($[15] !== queryClient || $[16] !== t5) {
72
+ if ($[19] !== queryClient || $[20] !== t5) {
63
73
  t6 = /* @__PURE__ */ jsx(QueryClientProvider, {
64
74
  client: queryClient,
65
75
  children: t5
66
76
  });
67
- $[15] = queryClient;
68
- $[16] = t5;
69
- $[17] = t6;
70
- } else t6 = $[17];
77
+ $[19] = queryClient;
78
+ $[20] = t5;
79
+ $[21] = t6;
80
+ } else t6 = $[21];
71
81
  return t6;
72
82
  }
83
+ const LazyEditablePageExperience = React.lazy(() => import("../preview/EditablePageExperience.js").then((module) => ({ default: module.EditablePageExperience })));
84
+ const LazyLocalhostPreviewProvider = React.lazy(() => import("../provider/LocalhostPreviewProvider.js").then((module) => ({ default: module.LocalhostPreviewProvider })));
85
+ var EditingActivationBoundary = class extends React.Component {
86
+ state = { failed: false };
87
+ static getDerivedStateFromError() {
88
+ return { failed: true };
89
+ }
90
+ componentDidCatch(error) {
91
+ console.error("Camox editing runtime failed to load; keeping the published page visible.", error);
92
+ }
93
+ render() {
94
+ if (this.state.failed) return this.props.fallback;
95
+ return this.props.children;
96
+ }
97
+ };
98
+ 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
+ }
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;
109
+ 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, {
120
+ camoxApp,
121
+ input,
122
+ queryClient
123
+ });
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
134
+ });
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
144
+ });
145
+ $[10] = published;
146
+ $[11] = t3;
147
+ $[12] = t4;
148
+ } else t4 = $[12];
149
+ return t4;
150
+ }
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, {
161
+ fallback: published,
162
+ children: t2
163
+ });
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
173
+ });
174
+ $[18] = published;
175
+ $[19] = t3;
176
+ $[20] = t4;
177
+ } else t4 = $[20];
178
+ return t4;
179
+ }
180
+ return published;
181
+ }
182
+ function _temp() {
183
+ if (typeof window === "undefined") return false;
184
+ return new URL(window.location.href).searchParams.has("ott");
185
+ }
73
186
 
74
187
  //#endregion
75
188
  export { PageApp };
@@ -2,6 +2,5 @@ import { CamoxApp } from "../../core/createApp.js";
2
2
 
3
3
  //#region src/features/runtime/pageClient.d.ts
4
4
  declare function hydratePageWithApp(camoxApp: CamoxApp): void;
5
- declare function hydrateRuntimeWithApp(camoxApp: CamoxApp): void;
6
5
  //#endregion
7
- export { hydratePageWithApp, hydrateRuntimeWithApp };
6
+ export { hydratePageWithApp };
@@ -1,37 +1,20 @@
1
1
  import { PageApp } from "./pageApp.js";
2
- import { StudioApp } from "./studioApp.js";
2
+ import { readHydrationData } from "./hydrationData.js";
3
3
  import { QueryClient } from "@tanstack/react-query";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { hydrateRoot } from "react-dom/client";
6
6
 
7
7
  //#region src/features/runtime/pageClient.tsx
8
- function readHydrationData() {
9
- const script = document.getElementById("__CAMOX_DATA__");
10
- if (!script?.textContent) throw new Error("Camox runtime hydration data was not found.");
11
- return JSON.parse(script.textContent);
12
- }
13
8
  function hydratePageWithApp(camoxApp) {
14
- hydrateRuntimeWithApp(camoxApp);
15
- }
16
- function hydrateRuntimeWithApp(camoxApp) {
17
9
  const root = document.getElementById("root");
18
10
  if (!root) throw new Error("Camox runtime root element was not found.");
19
11
  const queryClient = new QueryClient();
20
- const input = readHydrationData();
21
- if (input.runtimeKind === "studio") {
22
- hydrateRoot(root, /* @__PURE__ */ jsx(StudioApp, {
23
- camoxApp,
24
- input,
25
- queryClient
26
- }));
27
- return;
28
- }
29
12
  hydrateRoot(root, /* @__PURE__ */ jsx(PageApp, {
30
13
  camoxApp,
31
- input,
14
+ input: readHydrationData(),
32
15
  queryClient
33
16
  }));
34
17
  }
35
18
 
36
19
  //#endregion
37
- export { hydratePageWithApp, hydrateRuntimeWithApp };
20
+ export { hydratePageWithApp };
@@ -19,6 +19,7 @@ interface PageRenderInput {
19
19
  pathname: string;
20
20
  projectSlug: string;
21
21
  runtimeBasePath: string;
22
+ source: "live" | "draft";
22
23
  }
23
24
  //#endregion
24
25
  export { PageRenderInput };
@@ -1,18 +1,23 @@
1
+ import { useSignInRedirect } from "../../lib/auth.js";
1
2
  import { STUDIO_CONTENT_PATH } from "../studio/routes.js";
2
3
  import { CamoxContent } from "../content/CamoxContent.js";
3
- import { CamoxProvider } from "../provider/CamoxProvider.js";
4
+ import { AuthGate } from "../../components/AuthGate.js";
5
+ import { AuthenticatedCamoxProvider } from "../provider/AuthenticatedCamoxProvider.js";
6
+ import { CoreCamoxProvider } from "../provider/CoreCamoxProvider.js";
4
7
  import { CamoxStudio } from "../studio/CamoxStudio.js";
8
+ import { CompleteBlockEditingRuntimeProvider } from "../../core/editing/CompleteBlockEditingRuntime.js";
5
9
  import { StudioNavigationProvider } from "./studioNavigation.js";
6
10
  import { c } from "react/compiler-runtime";
7
11
  import { HydrationBoundary, QueryClientProvider } from "@tanstack/react-query";
8
- import { jsx } from "react/jsx-runtime";
12
+ import * as React from "react";
13
+ import { Fragment, jsx } from "react/jsx-runtime";
9
14
 
10
15
  //#region src/features/runtime/studioApp.tsx
11
16
  function StudioRouteContent(t0) {
12
17
  const $ = c(4);
13
- if ($[0] !== "4c7f5ba34e144c65d886d3b5a39ff5adc9765123d3c37bd6491f55534f919b1f") {
18
+ if ($[0] !== "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17") {
14
19
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
- $[0] = "4c7f5ba34e144c65d886d3b5a39ff5adc9765123d3c37bd6491f55534f919b1f";
20
+ $[0] = "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17";
16
21
  }
17
22
  const { input } = t0;
18
23
  if (input.pathname === STUDIO_CONTENT_PATH) {
@@ -44,23 +49,86 @@ function StudioRouteContent(t0) {
44
49
  } else t1 = $[3];
45
50
  return t1;
46
51
  }
52
+ function StudioAuthentication(t0) {
53
+ const $ = c(6);
54
+ if ($[0] !== "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17") {
55
+ for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
56
+ $[0] = "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17";
57
+ }
58
+ const { children } = t0;
59
+ const signInRedirect = useSignInRedirect(_temp);
60
+ let t1;
61
+ let t2;
62
+ if ($[1] !== signInRedirect) {
63
+ t1 = () => signInRedirect();
64
+ t2 = [signInRedirect];
65
+ $[1] = signInRedirect;
66
+ $[2] = t1;
67
+ $[3] = t2;
68
+ } else {
69
+ t1 = $[2];
70
+ t2 = $[3];
71
+ }
72
+ React.useEffect(t1, t2);
73
+ let t3;
74
+ if ($[4] !== children) {
75
+ t3 = /* @__PURE__ */ jsx(Fragment, { children });
76
+ $[4] = children;
77
+ $[5] = t3;
78
+ } else t3 = $[5];
79
+ return t3;
80
+ }
81
+ function _temp() {
82
+ if (typeof window === "undefined") return;
83
+ return new URL("/", window.location.href).href;
84
+ }
85
+ function StudioAccessGate(t0) {
86
+ const $ = c(6);
87
+ if ($[0] !== "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17") {
88
+ for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
89
+ $[0] = "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17";
90
+ }
91
+ const { children } = t0;
92
+ let t1;
93
+ if ($[1] !== children) {
94
+ t1 = /* @__PURE__ */ jsx(AuthenticatedCamoxProvider, { children });
95
+ $[1] = children;
96
+ $[2] = t1;
97
+ } else t1 = $[2];
98
+ let t2;
99
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t2 = /* @__PURE__ */ jsx(StudioAuthentication, { children: null });
101
+ $[3] = t2;
102
+ } else t2 = $[3];
103
+ let t3;
104
+ if ($[4] !== t1) {
105
+ t3 = /* @__PURE__ */ jsx(AuthGate, {
106
+ authenticated: t1,
107
+ loading: null,
108
+ unauthenticated: t2
109
+ });
110
+ $[4] = t1;
111
+ $[5] = t3;
112
+ } else t3 = $[5];
113
+ return t3;
114
+ }
47
115
  function StudioApp(t0) {
48
116
  const $ = c(21);
49
- if ($[0] !== "4c7f5ba34e144c65d886d3b5a39ff5adc9765123d3c37bd6491f55534f919b1f") {
117
+ if ($[0] !== "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17") {
50
118
  for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
51
- $[0] = "4c7f5ba34e144c65d886d3b5a39ff5adc9765123d3c37bd6491f55534f919b1f";
119
+ $[0] = "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17";
52
120
  }
53
121
  const { camoxApp, input, queryClient } = t0;
54
122
  const t1 = input.dehydratedState;
55
123
  let t2;
56
124
  if ($[1] !== input) {
57
- t2 = /* @__PURE__ */ jsx(CamoxStudio, { children: /* @__PURE__ */ jsx(StudioRouteContent, { input }) });
125
+ t2 = /* @__PURE__ */ jsx(StudioAccessGate, { children: /* @__PURE__ */ jsx(CompleteBlockEditingRuntimeProvider, { children: /* @__PURE__ */ jsx(CamoxStudio, { children: /* @__PURE__ */ jsx(StudioRouteContent, { input }) }) }) });
58
126
  $[1] = input;
59
127
  $[2] = t2;
60
128
  } else t2 = $[2];
61
129
  let t3;
62
130
  if ($[3] !== camoxApp || $[4] !== input.apiUrl || $[5] !== input.authenticationUrl || $[6] !== input.environmentName || $[7] !== input.projectSlug || $[8] !== t2) {
63
- t3 = /* @__PURE__ */ jsx(CamoxProvider, {
131
+ t3 = /* @__PURE__ */ jsx(CoreCamoxProvider, {
64
132
  camoxApp,
65
133
  authenticationUrl: input.authenticationUrl,
66
134
  apiUrl: input.apiUrl,
@@ -0,0 +1,6 @@
1
+ import { CamoxApp } from "../../core/createApp.js";
2
+
3
+ //#region src/features/runtime/studioClient.d.ts
4
+ declare function hydrateStudioWithApp(camoxApp: CamoxApp): void;
5
+ //#endregion
6
+ export { hydrateStudioWithApp };
@@ -0,0 +1,20 @@
1
+ import { readHydrationData } from "./hydrationData.js";
2
+ import { StudioApp } from "./studioApp.js";
3
+ import { QueryClient } from "@tanstack/react-query";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { hydrateRoot } from "react-dom/client";
6
+
7
+ //#region src/features/runtime/studioClient.tsx
8
+ function hydrateStudioWithApp(camoxApp) {
9
+ const root = document.getElementById("root");
10
+ if (!root) throw new Error("Camox runtime root element was not found.");
11
+ const queryClient = new QueryClient();
12
+ hydrateRoot(root, /* @__PURE__ */ jsx(StudioApp, {
13
+ camoxApp,
14
+ input: readHydrationData(),
15
+ queryClient
16
+ }));
17
+ }
18
+
19
+ //#endregion
20
+ export { hydrateStudioWithApp };
@@ -39,9 +39,9 @@ function getStudioTarget(to, runtimeBasePath) {
39
39
  }
40
40
  function StudioNavigationProvider(t0) {
41
41
  const $ = c(19);
42
- if ($[0] !== "df5809d38cc8796db839fa5b8c8d05f562a3e4cba7d51a1fec989dc85db9136b") {
42
+ if ($[0] !== "8131144acb7b9faccf5f5924d863b9186349bfc7c842e7feba7a3ac1e01ed910") {
43
43
  for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
44
- $[0] = "df5809d38cc8796db839fa5b8c8d05f562a3e4cba7d51a1fec989dc85db9136b";
44
+ $[0] = "8131144acb7b9faccf5f5924d863b9186349bfc7c842e7feba7a3ac1e01ed910";
45
45
  }
46
46
  const { children, href, pathname, runtimeBasePath } = t0;
47
47
  let t1;
@@ -53,6 +53,11 @@ function StudioNavigationProvider(t0) {
53
53
  window.location.assign(to);
54
54
  return;
55
55
  }
56
+ const currentPathname = normalizeRuntimePathname(window.location.pathname, runtimeBasePath);
57
+ if (normalizeRuntimePathname(target.pathname, runtimeBasePath) !== currentPathname) {
58
+ window.location.assign(target.href);
59
+ return;
60
+ }
56
61
  if (replace) window.history.replaceState(null, "", target.href);
57
62
  else window.history.pushState(null, "", target.href);
58
63
  window.dispatchEvent(new Event("camox:navigation"));
@@ -1,8 +1,8 @@
1
1
  import { Navigate, useLocation } from "../navigation/navigation.js";
2
2
  import { useAuthState, useSignInRedirect } from "../../lib/auth.js";
3
- import { trackClientEvent } from "../../lib/telemetry-client.js";
4
3
  import { STUDIO_BASE_PATH } from "./routes.js";
5
4
  import { Navbar } from "./components/Navbar.js";
5
+ import { trackClientEvent } from "../../lib/telemetry-client.js";
6
6
  import { c } from "react/compiler-runtime";
7
7
  import * as React from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,18 +1,18 @@
1
1
  import { AuthContext } from "../../../lib/auth.js";
2
2
  import { environmentMutations, environmentQueries, projectQueries } from "../../../lib/queries.js";
3
3
  import { c } from "react/compiler-runtime";
4
- import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
5
4
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
5
  import * as React from "react";
7
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { toast } from "@camox/ui/toaster";
9
7
  import { Button } from "@camox/ui/button";
10
8
  import { AlertCircle, ChevronDown, Download, Upload } from "lucide-react";
11
9
  import { Alert, AlertDescription } from "@camox/ui/alert";
12
10
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
13
11
  import { Badge } from "@camox/ui/badge";
12
+ import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
14
13
  import { Separator } from "@camox/ui/separator";
15
14
  import { Spinner } from "@camox/ui/spinner";
15
+ import { toast } from "@camox/ui/toaster";
16
16
 
17
17
  //#region src/features/studio/components/EnvironmentMenu.tsx
18
18
  const PRODUCTION_ENV = "production";
@@ -36,9 +36,9 @@ const links = [{
36
36
  }];
37
37
  const Navbar = () => {
38
38
  const $ = c(19);
39
- if ($[0] !== "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e") {
39
+ if ($[0] !== "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2") {
40
40
  for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
41
- $[0] = "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e";
41
+ $[0] = "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2";
42
42
  }
43
43
  const projectSlug = useProjectSlug();
44
44
  let t0;
@@ -136,7 +136,7 @@ const Navbar = () => {
136
136
  let t10;
137
137
  if ($[17] !== t6) {
138
138
  t10 = /* @__PURE__ */ jsxs("nav", {
139
- className: "relative flex items-center justify-between gap-4 border-b-2 bg-transparent px-2 py-2",
139
+ className: "bg-background relative flex items-center justify-between gap-4 border-b-2 px-2 py-2",
140
140
  children: [t6, t9]
141
141
  });
142
142
  $[17] = t6;
@@ -146,9 +146,9 @@ const Navbar = () => {
146
146
  };
147
147
  function useNavbarActions() {
148
148
  const $ = c(4);
149
- if ($[0] !== "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e") {
149
+ if ($[0] !== "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2") {
150
150
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
151
- $[0] = "9b1adcbc6464388cc572701469e917a5652b82c7ccc4e66be74fb1820176f49e";
151
+ $[0] = "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2";
152
152
  }
153
153
  const navigate = useNavigate();
154
154
  let t0;
@@ -13,9 +13,9 @@ import { Skeleton } from "@camox/ui/skeleton";
13
13
  //#region src/features/studio/components/ProjectMenu.tsx
14
14
  const Favicon = (t0) => {
15
15
  const $ = c(19);
16
- if ($[0] !== "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f") {
16
+ if ($[0] !== "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d") {
17
17
  for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
18
- $[0] = "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f";
18
+ $[0] = "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d";
19
19
  }
20
20
  const { size: t1 } = t0;
21
21
  const size = t1 === void 0 ? 16 : t1;
@@ -113,9 +113,9 @@ const Favicon = (t0) => {
113
113
  };
114
114
  const ProjectMenu = () => {
115
115
  const $ = c(41);
116
- if ($[0] !== "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f") {
116
+ if ($[0] !== "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d") {
117
117
  for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
118
- $[0] = "5b6284d7940526e6093811e0cb2663e0916c58abe0f07e36b7140e4a9eb93d0f";
118
+ $[0] = "d995cbe0a8e25c463e5078777395b1432b84ff5ecc4a4a3cc0e7e416badd244d";
119
119
  }
120
120
  const authCtx = React.useContext(AuthContext);
121
121
  let t0;
@@ -282,7 +282,7 @@ const ProjectMenu = () => {
282
282
  if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
283
283
  t22 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
284
284
  render: /* @__PURE__ */ jsx(Link$1, {
285
- to: "https://camox.ai",
285
+ to: "https://camox.dev",
286
286
  target: "_blank"
287
287
  }),
288
288
  children: [/* @__PURE__ */ jsx(Info, { className: "h-4 w-4" }), "Powered by Camox"]
@@ -9,27 +9,6 @@ function readStoredTheme() {
9
9
  return localStorage.getItem("theme") || "system";
10
10
  }
11
11
  /**
12
- * Read-only access to the studio theme. Does not mutate `<html>` or localStorage.
13
- * Use this when you need the current theme value (e.g. to pass to a Toaster) but
14
- * are not the owner of the studio chrome — applying the theme would bleed onto
15
- * the host site.
16
- */
17
- function useThemeValue() {
18
- const $ = c(3);
19
- if ($[0] !== "da3935c3f496f05138d1e012522f8d34be97b470fa5c8f37185df49127eab10f") {
20
- for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
21
- $[0] = "da3935c3f496f05138d1e012522f8d34be97b470fa5c8f37185df49127eab10f";
22
- }
23
- const [theme] = React.useState(readStoredTheme);
24
- let t0;
25
- if ($[1] !== theme) {
26
- t0 = { theme };
27
- $[1] = theme;
28
- $[2] = t0;
29
- } else t0 = $[2];
30
- return t0;
31
- }
32
- /**
33
12
  * Owns the studio theme: writes the active class onto `<html>` and persists
34
13
  * changes to localStorage. Should only be mounted from the studio chrome —
35
14
  * never from contexts that share `<html>` with the user's site.
@@ -222,4 +201,4 @@ function _temp() {
222
201
  }
223
202
 
224
203
  //#endregion
225
- export { useApplyTheme, useThemeActions, useThemeValue };
204
+ export { useApplyTheme, useThemeActions };