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
@@ -1,184 +1,21 @@
1
- import { useSignInRedirect } from "../../lib/auth.js";
2
- import { STUDIO_CONTENT_PATH } from "../studio/routes.js";
3
- import { CamoxContent } from "../content/CamoxContent.js";
4
- import { AuthGate } from "../../components/AuthGate.js";
5
- import { AuthenticatedCamoxProvider } from "../provider/AuthenticatedCamoxProvider.js";
6
- import { CoreCamoxProvider } from "../provider/CoreCamoxProvider.js";
7
- import { CamoxStudio } from "../studio/CamoxStudio.js";
8
- import { CompleteBlockEditingRuntimeProvider } from "../../core/editing/CompleteBlockEditingRuntime.js";
9
- import { StudioNavigationProvider } from "./studioNavigation.js";
1
+ import { PageApp } from "./pageApp.js";
10
2
  import { c } from "react/compiler-runtime";
11
- import { HydrationBoundary, QueryClientProvider } from "@tanstack/react-query";
12
- import * as React from "react";
13
- import { Fragment, jsx } from "react/jsx-runtime";
3
+ import { jsx } from "react/jsx-runtime";
14
4
 
15
5
  //#region src/features/runtime/studioApp.tsx
16
- function StudioRouteContent(t0) {
17
- const $ = c(4);
18
- if ($[0] !== "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17") {
19
- for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
20
- $[0] = "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17";
6
+ function StudioApp(props) {
7
+ const $ = c(3);
8
+ if ($[0] !== "67c2b6f45da5572f3c7b8c4d68491571a2d455e4cd7067c0380e91fc49b09d93") {
9
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
10
+ $[0] = "67c2b6f45da5572f3c7b8c4d68491571a2d455e4cd7067c0380e91fc49b09d93";
21
11
  }
22
- const { input } = t0;
23
- if (input.pathname === STUDIO_CONTENT_PATH) {
24
- let t1;
25
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
26
- t1 = /* @__PURE__ */ jsx(CamoxContent, {});
27
- $[1] = t1;
28
- } else t1 = $[1];
29
- return t1;
30
- }
31
- if (input.routeKind === "studio-nested") {
32
- let t1;
33
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
34
- t1 = /* @__PURE__ */ jsx("div", {
35
- className: "text-muted-foreground p-6 text-sm",
36
- children: "Studio page not found"
37
- });
38
- $[2] = t1;
39
- } else t1 = $[2];
40
- return t1;
41
- }
42
- let t1;
43
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
44
- t1 = /* @__PURE__ */ jsx("div", {
45
- className: "text-muted-foreground p-6 text-sm",
46
- children: "Loading Studio…"
47
- });
48
- $[3] = t1;
49
- } else t1 = $[3];
50
- return t1;
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
- }
115
- function StudioApp(t0) {
116
- const $ = c(21);
117
- if ($[0] !== "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17") {
118
- for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
119
- $[0] = "4c9c648e70d7360e13c0b3d8d0f0633d0ab4263e359229c8802810bae1f42f17";
120
- }
121
- const { camoxApp, input, queryClient } = t0;
122
- const t1 = input.dehydratedState;
123
- let t2;
124
- if ($[1] !== input) {
125
- t2 = /* @__PURE__ */ jsx(StudioAccessGate, { children: /* @__PURE__ */ jsx(CompleteBlockEditingRuntimeProvider, { children: /* @__PURE__ */ jsx(CamoxStudio, { children: /* @__PURE__ */ jsx(StudioRouteContent, { input }) }) }) });
126
- $[1] = input;
127
- $[2] = t2;
128
- } else t2 = $[2];
129
- let t3;
130
- if ($[3] !== camoxApp || $[4] !== input.apiUrl || $[5] !== input.authenticationUrl || $[6] !== input.environmentName || $[7] !== input.projectSlug || $[8] !== t2) {
131
- t3 = /* @__PURE__ */ jsx(CoreCamoxProvider, {
132
- camoxApp,
133
- authenticationUrl: input.authenticationUrl,
134
- apiUrl: input.apiUrl,
135
- projectSlug: input.projectSlug,
136
- environmentName: input.environmentName,
137
- children: t2
138
- });
139
- $[3] = camoxApp;
140
- $[4] = input.apiUrl;
141
- $[5] = input.authenticationUrl;
142
- $[6] = input.environmentName;
143
- $[7] = input.projectSlug;
144
- $[8] = t2;
145
- $[9] = t3;
146
- } else t3 = $[9];
147
- let t4;
148
- if ($[10] !== input.href || $[11] !== input.pathname || $[12] !== input.runtimeBasePath || $[13] !== t3) {
149
- t4 = /* @__PURE__ */ jsx(StudioNavigationProvider, {
150
- href: input.href,
151
- pathname: input.pathname,
152
- runtimeBasePath: input.runtimeBasePath,
153
- children: t3
154
- });
155
- $[10] = input.href;
156
- $[11] = input.pathname;
157
- $[12] = input.runtimeBasePath;
158
- $[13] = t3;
159
- $[14] = t4;
160
- } else t4 = $[14];
161
- let t5;
162
- if ($[15] !== t1 || $[16] !== t4) {
163
- t5 = /* @__PURE__ */ jsx(HydrationBoundary, {
164
- state: t1,
165
- children: t4
166
- });
167
- $[15] = t1;
168
- $[16] = t4;
169
- $[17] = t5;
170
- } else t5 = $[17];
171
- let t6;
172
- if ($[18] !== queryClient || $[19] !== t5) {
173
- t6 = /* @__PURE__ */ jsx(QueryClientProvider, {
174
- client: queryClient,
175
- children: t5
176
- });
177
- $[18] = queryClient;
178
- $[19] = t5;
179
- $[20] = t6;
180
- } else t6 = $[20];
181
- return t6;
12
+ let t0;
13
+ if ($[1] !== props) {
14
+ t0 = /* @__PURE__ */ jsx(PageApp, { ...props });
15
+ $[1] = props;
16
+ $[2] = t0;
17
+ } else t0 = $[2];
18
+ return t0;
182
19
  }
183
20
 
184
21
  //#endregion
@@ -1,21 +1,23 @@
1
1
  import { Navigate, useLocation } from "../navigation/navigation.js";
2
2
  import { useAuthState, useSignInRedirect } from "../../lib/auth.js";
3
+ import { SharedChromeContext } from "../runtime/SharedChromeContext.js";
3
4
  import { STUDIO_BASE_PATH } from "./routes.js";
4
5
  import { trackClientEvent } from "../../lib/telemetry-client.js";
5
6
  import { Navbar } from "./components/Navbar.js";
6
7
  import { c } from "react/compiler-runtime";
7
8
  import * as React from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
10
 
10
11
  //#region src/features/studio/CamoxStudio.tsx
11
12
  const CamoxStudio = (t0) => {
12
- const $ = c(14);
13
- if ($[0] !== "869273f9f42924824ee2b9e5a0066bb2be142208aab9426269ff2984ede38347") {
14
- for (let $i = 0; $i < 14; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
- $[0] = "869273f9f42924824ee2b9e5a0066bb2be142208aab9426269ff2984ede38347";
13
+ const $ = c(16);
14
+ if ($[0] !== "424ccf9eb3e0b68f3206047ad39569798182b6392a92ca98a7e9d6cf3cc9ff22") {
15
+ for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
16
+ $[0] = "424ccf9eb3e0b68f3206047ad39569798182b6392a92ca98a7e9d6cf3cc9ff22";
16
17
  }
17
18
  const { children } = t0;
18
19
  const { isAuthenticated, isLoading: isLoadingAuth } = useAuthState();
20
+ const sharedChrome = React.useContext(SharedChromeContext);
19
21
  const { pathname } = useLocation();
20
22
  const signInRedirect = useSignInRedirect();
21
23
  let t1;
@@ -62,25 +64,37 @@ const CamoxStudio = (t0) => {
62
64
  if (pathname === STUDIO_BASE_PATH) {
63
65
  let t5;
64
66
  if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
65
- t5 = /* @__PURE__ */ jsx(Navigate, { to: "/" });
67
+ t5 = /* @__PURE__ */ jsx(Navigate, {
68
+ to: "/",
69
+ replace: true
70
+ });
66
71
  $[10] = t5;
67
72
  } else t5 = $[10];
68
73
  return t5;
69
74
  }
75
+ if (sharedChrome) {
76
+ let t5;
77
+ if ($[11] !== children) {
78
+ t5 = /* @__PURE__ */ jsx(Fragment, { children });
79
+ $[11] = children;
80
+ $[12] = t5;
81
+ } else t5 = $[12];
82
+ return t5;
83
+ }
70
84
  let t5;
71
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
85
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
72
86
  t5 = /* @__PURE__ */ jsx(Navbar, {});
73
- $[11] = t5;
74
- } else t5 = $[11];
87
+ $[13] = t5;
88
+ } else t5 = $[13];
75
89
  let t6;
76
- if ($[12] !== children) {
90
+ if ($[14] !== children) {
77
91
  t6 = /* @__PURE__ */ jsxs("div", {
78
92
  className: "bg-background flex h-screen flex-col overflow-hidden",
79
93
  children: [t5, children]
80
94
  });
81
- $[12] = children;
82
- $[13] = t6;
83
- } else t6 = $[13];
95
+ $[14] = children;
96
+ $[15] = t6;
97
+ } else t6 = $[15];
84
98
  return t6;
85
99
  };
86
100
 
@@ -2,6 +2,7 @@ import { Link as Link$1, useLocation, useNavigate } from "../../navigation/navig
2
2
  import { actionsStore } from "../../provider/actionsStore.js";
3
3
  import { useProjectSlug } from "../../../lib/auth.js";
4
4
  import { pageQueries, projectQueries } from "../../../lib/queries.js";
5
+ import { PlatformLabel } from "../../../components/PlatformLabel.js";
5
6
  import { cn } from "../../../lib/utils.js";
6
7
  import { STUDIO_CONTENT_PATH } from "../routes.js";
7
8
  import { studioStore } from "../studioStore.js";
@@ -34,121 +35,126 @@ const links = [{
34
35
  "CMS"
35
36
  ]
36
37
  }];
37
- const Navbar = () => {
38
- const $ = c(19);
39
- if ($[0] !== "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2") {
40
- for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
41
- $[0] = "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2";
38
+ const Navbar = (t0) => {
39
+ const $ = c(20);
40
+ if ($[0] !== "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d") {
41
+ for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
42
+ $[0] = "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d";
42
43
  }
44
+ const { isPreview: t1 } = t0;
45
+ const isPreview = t1 === void 0 ? false : t1;
43
46
  const projectSlug = useProjectSlug();
44
- let t0;
47
+ let t2;
45
48
  if ($[1] !== projectSlug) {
46
- t0 = projectQueries.getBySlug(projectSlug);
49
+ t2 = projectQueries.getBySlug(projectSlug);
47
50
  $[1] = projectSlug;
48
- $[2] = t0;
49
- } else t0 = $[2];
50
- const { data: project } = useQuery(t0);
51
- let t1;
51
+ $[2] = t2;
52
+ } else t2 = $[2];
53
+ const { data: project } = useQuery(t2);
54
+ let t3;
52
55
  if ($[3] !== project?.id) {
53
- t1 = pageQueries.list(project?.id ?? 0);
56
+ t3 = pageQueries.list(project?.id ?? 0);
54
57
  $[3] = project?.id;
55
- $[4] = t1;
56
- } else t1 = $[4];
57
- const t2 = !!project;
58
- let t3;
59
- if ($[5] !== t1 || $[6] !== t2) {
60
- t3 = {
61
- ...t1,
62
- enabled: t2
58
+ $[4] = t3;
59
+ } else t3 = $[4];
60
+ const t4 = !!project;
61
+ let t5;
62
+ if ($[5] !== t3 || $[6] !== t4) {
63
+ t5 = {
64
+ ...t3,
65
+ enabled: t4
63
66
  };
64
- $[5] = t1;
65
- $[6] = t2;
66
- $[7] = t3;
67
- } else t3 = $[7];
68
- const { data: pages } = useQuery(t3);
69
- const isMac = navigator.userAgent.toUpperCase().indexOf("MAC") >= 0;
67
+ $[5] = t3;
68
+ $[6] = t4;
69
+ $[7] = t5;
70
+ } else t5 = $[7];
71
+ const { data: pages } = useQuery(t5);
70
72
  const { pathname } = useLocation();
71
- let t4;
73
+ let t6;
72
74
  if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
73
- t4 = /* @__PURE__ */ jsxs("div", {
75
+ t6 = /* @__PURE__ */ jsxs("div", {
74
76
  className: "flew-row flex gap-1",
75
77
  children: [/* @__PURE__ */ jsx(ProjectMenu, {}), /* @__PURE__ */ jsx(EnvironmentMenu, {})]
76
78
  });
77
- $[8] = t4;
78
- } else t4 = $[8];
79
- let t5;
80
- if ($[9] !== pages || $[10] !== pathname) {
81
- t5 = links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link$1, {
79
+ $[8] = t6;
80
+ } else t6 = $[8];
81
+ let t7;
82
+ if ($[9] !== isPreview || $[10] !== pages || $[11] !== pathname) {
83
+ t7 = links.map((link, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link$1, {
82
84
  to: link.to,
83
- className: cn("flex gap-2 items-center rounded-md px-4 py-2 text-sm font-medium", "hover:bg-accent hover:text-accent-foreground outline-none transition-[color,box-shadow] focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-1", pages?.some((page) => page.fullPath === pathname) && index === 0 ? "bg-accent hover:bg-accent text-accent-foreground" : "text-muted-foreground"),
85
+ className: cn("flex gap-2 items-center rounded-md px-4 py-2 text-sm font-medium", "hover:bg-accent hover:text-accent-foreground outline-none transition-[color,box-shadow] focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-1", (isPreview || pages?.some((page) => page.fullPath === pathname)) && index === 0 ? "bg-accent hover:bg-accent text-accent-foreground" : "text-muted-foreground"),
84
86
  activeProps: { className: "bg-accent hover:bg-accent text-accent-foreground!" },
85
87
  children: link.children
86
88
  }) }, link.to));
87
- $[9] = pages;
88
- $[10] = pathname;
89
- $[11] = t5;
90
- } else t5 = $[11];
91
- let t6;
92
- if ($[12] !== t5) {
93
- t6 = /* @__PURE__ */ jsxs("div", {
89
+ $[9] = isPreview;
90
+ $[10] = pages;
91
+ $[11] = pathname;
92
+ $[12] = t7;
93
+ } else t7 = $[12];
94
+ let t8;
95
+ if ($[13] !== t7) {
96
+ t8 = /* @__PURE__ */ jsxs("div", {
94
97
  className: "flex flex-row gap-2",
95
- children: [t4, /* @__PURE__ */ jsx("ul", {
98
+ children: [t6, /* @__PURE__ */ jsx("ul", {
96
99
  className: "flex items-center gap-1",
97
- children: t5
100
+ children: t7
98
101
  })]
99
102
  });
100
- $[12] = t5;
101
- $[13] = t6;
102
- } else t6 = $[13];
103
- let t7;
104
- let t8;
105
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
106
- t7 = /* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground size-4" });
107
- t8 = /* @__PURE__ */ jsx("span", {
103
+ $[13] = t7;
104
+ $[14] = t8;
105
+ } else t8 = $[14];
106
+ let t10;
107
+ let t9;
108
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
109
+ t9 = /* @__PURE__ */ jsx(SearchIcon, { className: "text-muted-foreground size-4" });
110
+ t10 = /* @__PURE__ */ jsx("span", {
108
111
  className: "text-muted-foreground",
109
112
  children: "Quick find"
110
113
  });
111
- $[14] = t7;
112
- $[15] = t8;
114
+ $[15] = t10;
115
+ $[16] = t9;
113
116
  } else {
114
- t7 = $[14];
115
- t8 = $[15];
117
+ t10 = $[15];
118
+ t9 = $[16];
116
119
  }
117
- let t9;
118
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
119
- t9 = /* @__PURE__ */ jsxs("div", {
120
+ let t11;
121
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
122
+ t11 = /* @__PURE__ */ jsxs("div", {
120
123
  className: "flex items-center gap-2",
121
124
  children: [/* @__PURE__ */ jsxs(Button, {
122
125
  variant: "outline",
123
126
  onClick: _temp,
124
127
  children: [
125
- t7,
126
- t8,
127
- /* @__PURE__ */ jsxs(Kbd, {
128
+ t9,
129
+ t10,
130
+ /* @__PURE__ */ jsx(Kbd, {
128
131
  className: "ml-4",
129
- children: [isMac ? "⌘" : "Ctrl", " K"]
132
+ children: /* @__PURE__ */ jsx(PlatformLabel, {
133
+ mac: "⌘ K",
134
+ other: "Ctrl K"
135
+ })
130
136
  })
131
137
  ]
132
138
  }), /* @__PURE__ */ jsx(UserButton, {})]
133
139
  });
134
- $[16] = t9;
135
- } else t9 = $[16];
136
- let t10;
137
- if ($[17] !== t6) {
138
- t10 = /* @__PURE__ */ jsxs("nav", {
140
+ $[17] = t11;
141
+ } else t11 = $[17];
142
+ let t12;
143
+ if ($[18] !== t8) {
144
+ t12 = /* @__PURE__ */ jsxs("nav", {
139
145
  className: "bg-background relative flex items-center justify-between gap-4 border-b-2 px-2 py-2",
140
- children: [t6, t9]
146
+ children: [t8, t11]
141
147
  });
142
- $[17] = t6;
143
- $[18] = t10;
144
- } else t10 = $[18];
145
- return t10;
148
+ $[18] = t8;
149
+ $[19] = t12;
150
+ } else t12 = $[19];
151
+ return t12;
146
152
  };
147
153
  function useNavbarActions() {
148
154
  const $ = c(4);
149
- if ($[0] !== "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2") {
155
+ if ($[0] !== "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d") {
150
156
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
151
- $[0] = "4fd5828728ac76dc7c63a1b38dbea3991a6750be46540e90d91c5dccb46797e2";
157
+ $[0] = "4608f306773df1a594409c84a68bc5a0c72c93c4fbda9136da94d4900e84546d";
152
158
  }
153
159
  const navigate = useNavigate();
154
160
  let t0;
@@ -0,0 +1,25 @@
1
+ //#region src/features/studio/studioTheme.ts
2
+ const STUDIO_THEME_STORAGE_KEY = "camox:studio:theme";
3
+ function readStudioTheme() {
4
+ try {
5
+ const value = localStorage.getItem("camox:studio:theme") ?? localStorage.getItem("theme");
6
+ if (value === "light" || value === "dark") return value;
7
+ } catch {}
8
+ return "system";
9
+ }
10
+ function bootstrapStudioTheme(preference) {
11
+ let theme = preference ?? "system";
12
+ if (!preference) try {
13
+ theme = localStorage.getItem("camox:studio:theme") ?? localStorage.getItem("theme") ?? "system";
14
+ } catch {}
15
+ const resolved = theme === "dark" || theme !== "light" && matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
16
+ const root = document.documentElement;
17
+ root.classList.remove("light", "dark");
18
+ root.classList.add(resolved);
19
+ root.dataset.camoxStudioTheme = resolved;
20
+ root.style.colorScheme = resolved;
21
+ }
22
+ const STUDIO_THEME_SCRIPT = `(${bootstrapStudioTheme.toString()})();`;
23
+
24
+ //#endregion
25
+ export { STUDIO_THEME_SCRIPT, STUDIO_THEME_STORAGE_KEY, bootstrapStudioTheme, readStudioTheme };