camox 0.41.1 → 0.42.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 (49) hide show
  1. package/dist/core/components/lexical/SidebarLexicalEditor.js +42 -39
  2. package/dist/core/createApp.d.ts +18 -4
  3. package/dist/core/createLayout.d.ts +1 -1
  4. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  5. package/dist/core/editing/createEditableBlock.js +636 -459
  6. package/dist/core/hooks/useOverlayState.js +11 -0
  7. package/dist/core/lib/fieldTypes.js +5 -5
  8. package/dist/core/lib/lexicalState.js +17 -1
  9. package/dist/features/preview/CamoxPreview.js +80 -73
  10. package/dist/features/preview/commentsEnabled.js +8 -0
  11. package/dist/features/preview/components/AddBlockSidebar.js +79 -89
  12. package/dist/features/preview/components/AssetLightbox.js +4 -11
  13. package/dist/features/preview/components/AttachedComments.js +194 -0
  14. package/dist/features/preview/components/BlockActionsPopover.js +13 -64
  15. package/dist/features/preview/components/CommentHeader.js +122 -0
  16. package/dist/features/preview/components/CommentSidebar.js +29 -0
  17. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  18. package/dist/features/preview/components/CreatePageModal.js +2 -8
  19. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  20. package/dist/features/preview/components/LeftSidebar.js +18 -18
  21. package/dist/features/preview/components/OverlayTracker.js +14 -20
  22. package/dist/features/preview/components/Overlays.js +26 -35
  23. package/dist/features/preview/components/PageEditorSidebar.js +89 -90
  24. package/dist/features/preview/components/PageInfoSidebar.js +126 -157
  25. package/dist/features/preview/components/PagePicker.js +13 -8
  26. package/dist/features/preview/components/PageTree.js +158 -156
  27. package/dist/features/preview/components/PreviewComments.js +56 -0
  28. package/dist/features/preview/components/PreviewPanel.js +122 -78
  29. package/dist/features/preview/components/PreviewToolbar.js +280 -231
  30. package/dist/features/preview/components/PublicationRow.js +4 -11
  31. package/dist/features/preview/components/RightSidebar.js +14 -11
  32. package/dist/features/preview/components/SidebarSection.js +121 -0
  33. package/dist/features/preview/previewCommentsStore.js +115 -0
  34. package/dist/features/preview/previewSelection.js +75 -0
  35. package/dist/features/preview/previewStore.js +19 -39
  36. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  37. package/dist/features/provider/components/CommandPalette.js +142 -58
  38. package/dist/features/provider/useAdminShortcuts.js +19 -8
  39. package/dist/features/routes/pageRuntime.js +0 -6
  40. package/dist/features/runtime/RuntimeChrome.js +40 -37
  41. package/dist/features/studio/CamoxStudio.js +30 -50
  42. package/dist/features/vite/runtimeDev.js +4 -1
  43. package/dist/features/vite/vite.d.ts +3 -2
  44. package/dist/features/vite/vite.js +9 -5
  45. package/dist/hooks/use-file-upload.js +0 -2
  46. package/dist/studio.css +1 -1
  47. package/package.json +5 -7
  48. package/dist/lib/telemetry-client.js +0 -66
  49. package/dist/lib/telemetry.js +0 -26
@@ -5,14 +5,15 @@ import { c } from "react/compiler-runtime";
5
5
  import * as React from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useSelector } from "@xstate/store-react";
8
+ import { Kbd } from "@camox/ui/kbd";
8
9
  import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut } from "@camox/ui/command";
9
10
 
10
11
  //#region src/features/provider/components/CommandPalette.tsx
11
12
  function CommandPalette() {
12
- const $ = c(36);
13
- if ($[0] !== "85ba0b6dafc30e5e42d7a8100e19fddf7f674f2db2d4daf495b1cb749edf3f68") {
14
- for (let $i = 0; $i < 36; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
- $[0] = "85ba0b6dafc30e5e42d7a8100e19fddf7f674f2db2d4daf495b1cb749edf3f68";
13
+ const $ = c(43);
14
+ if ($[0] !== "911725dec1e42161265ff27436f9ae9c6c82392d2b8fce53f3eb80dfb29cb6f0") {
15
+ for (let $i = 0; $i < 43; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
16
+ $[0] = "911725dec1e42161265ff27436f9ae9c6c82392d2b8fce53f3eb80dfb29cb6f0";
16
17
  }
17
18
  const isOpen = useSelector(studioStore, _temp);
18
19
  const [search, setSearch] = React.useState("");
@@ -119,75 +120,158 @@ function CommandPalette() {
119
120
  } else t5 = $[19];
120
121
  const handleOpenChange = t5;
121
122
  let t6;
122
- if ($[20] !== search) {
123
- t6 = (e) => {
123
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
124
+ t6 = /* @__PURE__ */ jsxs("div", {
125
+ className: "px-5 pt-5 pr-14 pb-3",
126
+ children: [/* @__PURE__ */ jsx("h2", {
127
+ className: "text-lg font-semibold tracking-tight",
128
+ children: "Command palette"
129
+ }), /* @__PURE__ */ jsx("p", {
130
+ className: "text-muted-foreground mt-1 text-sm",
131
+ children: "Navigate your site and switch settings quickly."
132
+ })]
133
+ });
134
+ $[20] = t6;
135
+ } else t6 = $[20];
136
+ let t7;
137
+ if ($[21] !== search) {
138
+ t7 = (e) => {
124
139
  if (e.key === "Escape" || e.key === "Backspace" && !search) {
125
140
  e.preventDefault();
126
141
  studioStore.send({ type: "popCommandPalettePage" });
127
142
  }
128
143
  };
129
- $[20] = search;
130
- $[21] = t6;
131
- } else t6 = $[21];
132
- let t7;
133
- if ($[22] !== search || $[23] !== t6) {
134
- t7 = /* @__PURE__ */ jsx(CommandInput, {
135
- value: search,
136
- onValueChange: setSearch,
137
- placeholder: "Type a command or search...",
138
- onKeyDown: t6
144
+ $[21] = search;
145
+ $[22] = t7;
146
+ } else t7 = $[22];
147
+ let t8;
148
+ if ($[23] !== search || $[24] !== t7) {
149
+ t8 = /* @__PURE__ */ jsx("div", {
150
+ className: "px-4 pb-4",
151
+ children: /* @__PURE__ */ jsx(CommandInput, {
152
+ className: "placeholder:text-muted-foreground h-full text-base",
153
+ inputGroupClassName: "h-11! border-2 border-primary bg-background rounded-xl! *:data-[slot=input-group-addon]:pl-4!",
154
+ value: search,
155
+ onValueChange: setSearch,
156
+ placeholder: "Type a command or search...",
157
+ onKeyDown: t7
158
+ })
139
159
  });
140
- $[22] = search;
141
- $[23] = t6;
160
+ $[23] = search;
142
161
  $[24] = t7;
143
- } else t7 = $[24];
144
- let t8;
145
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
146
- t8 = /* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." });
147
162
  $[25] = t8;
148
163
  } else t8 = $[25];
149
164
  let t9;
150
- if ($[26] !== groupedActions || $[27] !== handleSelect) {
151
- t9 = /* @__PURE__ */ jsxs(CommandList, { children: [t8, Array.from(groupedActions.entries()).map((t10) => {
152
- const [groupLabel_0, groupActions] = t10;
153
- return /* @__PURE__ */ jsx(CommandGroup, {
154
- heading: groupLabel_0,
155
- children: groupActions.map((action_2) => /* @__PURE__ */ jsxs(CommandItem, {
156
- keywords: action_2.aliases,
157
- onSelect: () => handleSelect(action_2.id),
158
- className: "justify-between",
159
- children: [action_2.label, action_2.shortcut && /* @__PURE__ */ jsx(CommandShortcut, { children: formatShortcut(action_2.shortcut) })]
160
- }, action_2.id))
161
- }, groupLabel_0);
162
- })] });
163
- $[26] = groupedActions;
164
- $[27] = handleSelect;
165
- $[28] = t9;
166
- } else t9 = $[28];
165
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
166
+ t9 = /* @__PURE__ */ jsxs("span", {
167
+ className: "flex items-center gap-1.5",
168
+ children: [
169
+ /* @__PURE__ */ jsx(Kbd, { children: "↑" }),
170
+ /* @__PURE__ */ jsx(Kbd, { children: "↓" }),
171
+ " to navigate"
172
+ ]
173
+ });
174
+ $[26] = t9;
175
+ } else t9 = $[26];
167
176
  let t10;
168
- if ($[29] !== t7 || $[30] !== t9 || $[31] !== value) {
169
- t10 = /* @__PURE__ */ jsxs(Command, {
177
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
178
+ t10 = /* @__PURE__ */ jsxs("span", {
179
+ className: "flex items-center gap-1.5",
180
+ children: [/* @__PURE__ */ jsx(Kbd, { children: "↵" }), " to select"]
181
+ });
182
+ $[27] = t10;
183
+ } else t10 = $[27];
184
+ let t11;
185
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
186
+ t11 = /* @__PURE__ */ jsx(Kbd, { children: "Esc" });
187
+ $[28] = t11;
188
+ } else t11 = $[28];
189
+ const t12 = page ? "to go back" : "to close";
190
+ let t13;
191
+ if ($[29] !== t12) {
192
+ t13 = /* @__PURE__ */ jsxs("div", {
193
+ className: "text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-2 border-b px-5 pb-3 text-xs",
194
+ children: [
195
+ t9,
196
+ t10,
197
+ /* @__PURE__ */ jsxs("span", {
198
+ className: "flex items-center gap-1.5",
199
+ children: [
200
+ t11,
201
+ " ",
202
+ t12
203
+ ]
204
+ })
205
+ ]
206
+ });
207
+ $[29] = t12;
208
+ $[30] = t13;
209
+ } else t13 = $[30];
210
+ let t14;
211
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
212
+ t14 = /* @__PURE__ */ jsx(CommandEmpty, {
213
+ className: "text-muted-foreground py-8",
214
+ children: "No results found."
215
+ });
216
+ $[31] = t14;
217
+ } else t14 = $[31];
218
+ let t15;
219
+ if ($[32] !== groupedActions || $[33] !== handleSelect) {
220
+ t15 = /* @__PURE__ */ jsxs(CommandList, {
221
+ className: "max-h-[min(24rem,45dvh)] min-h-0 scroll-py-1 px-2 pt-1 pb-2",
222
+ children: [t14, Array.from(groupedActions.entries()).map((t16) => {
223
+ const [groupLabel_0, groupActions] = t16;
224
+ return /* @__PURE__ */ jsx(CommandGroup, {
225
+ heading: groupLabel_0,
226
+ className: "mb-2 p-0 last:mb-0 **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2 **:[[cmdk-group-heading]]:text-[11px] **:[[cmdk-group-heading]]:tracking-widest **:[[cmdk-group-heading]]:uppercase",
227
+ children: groupActions.map((action_2) => /* @__PURE__ */ jsxs(CommandItem, {
228
+ keywords: action_2.aliases,
229
+ onSelect: () => handleSelect(action_2.id),
230
+ className: "min-h-10 justify-between gap-3 px-3 py-2 text-sm",
231
+ hideCheck: true,
232
+ children: [action_2.label, action_2.shortcut && /* @__PURE__ */ jsx(CommandShortcut, { children: formatShortcut(action_2.shortcut) })]
233
+ }, action_2.id))
234
+ }, groupLabel_0);
235
+ })]
236
+ });
237
+ $[32] = groupedActions;
238
+ $[33] = handleSelect;
239
+ $[34] = t15;
240
+ } else t15 = $[34];
241
+ let t16;
242
+ if ($[35] !== t13 || $[36] !== t15 || $[37] !== t8 || $[38] !== value) {
243
+ t16 = /* @__PURE__ */ jsxs(Command, {
170
244
  value,
171
245
  onValueChange: setValue,
172
- children: [t7, t9]
246
+ className: "h-auto max-h-[80dvh] p-0",
247
+ children: [
248
+ t6,
249
+ t8,
250
+ t13,
251
+ t15
252
+ ]
173
253
  });
174
- $[29] = t7;
175
- $[30] = t9;
176
- $[31] = value;
177
- $[32] = t10;
178
- } else t10 = $[32];
179
- let t11;
180
- if ($[33] !== isOpen || $[34] !== t10) {
181
- t11 = /* @__PURE__ */ jsx(CommandDialog, {
254
+ $[35] = t13;
255
+ $[36] = t15;
256
+ $[37] = t8;
257
+ $[38] = value;
258
+ $[39] = t16;
259
+ } else t16 = $[39];
260
+ let t17;
261
+ if ($[40] !== isOpen || $[41] !== t16) {
262
+ t17 = /* @__PURE__ */ jsx(CommandDialog, {
182
263
  open: isOpen,
183
264
  onOpenChange: handleOpenChange,
184
- children: t10
265
+ className: "top-[12vh] sm:max-w-xl",
266
+ description: "Navigate your site and switch settings quickly.",
267
+ showCloseButton: true,
268
+ children: t16
185
269
  });
186
- $[33] = isOpen;
187
- $[34] = t10;
188
- $[35] = t11;
189
- } else t11 = $[35];
190
- return t11;
270
+ $[40] = isOpen;
271
+ $[41] = t16;
272
+ $[42] = t17;
273
+ } else t17 = $[42];
274
+ return t17;
191
275
  }
192
276
  function _temp3(state_1) {
193
277
  return state_1.context.commandPalettePages;
@@ -200,9 +284,9 @@ function _temp(state) {
200
284
  }
201
285
  function useCommandPaletteActions() {
202
286
  const $ = c(2);
203
- if ($[0] !== "85ba0b6dafc30e5e42d7a8100e19fddf7f674f2db2d4daf495b1cb749edf3f68") {
287
+ if ($[0] !== "911725dec1e42161265ff27436f9ae9c6c82392d2b8fce53f3eb80dfb29cb6f0") {
204
288
  for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
205
- $[0] = "85ba0b6dafc30e5e42d7a8100e19fddf7f674f2db2d4daf495b1cb749edf3f68";
289
+ $[0] = "911725dec1e42161265ff27436f9ae9c6c82392d2b8fce53f3eb80dfb29cb6f0";
206
290
  }
207
291
  let t0;
208
292
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
@@ -10,9 +10,9 @@ import { useSelector } from "@xstate/store-react";
10
10
  */
11
11
  function useAdminShortcuts() {
12
12
  const $ = c(4);
13
- if ($[0] !== "0255d4249a070c82da3a967d899d13f2ef37b37575822c7a0d008029181a2db4") {
13
+ if ($[0] !== "bebc7f337697130a10955205113d613ef306f5f46f2a4a506e5e0a4faba82906") {
14
14
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
- $[0] = "0255d4249a070c82da3a967d899d13f2ef37b37575822c7a0d008029181a2db4";
15
+ $[0] = "bebc7f337697130a10955205113d613ef306f5f46f2a4a506e5e0a4faba82906";
16
16
  }
17
17
  const actions = useSelector(actionsStore, _temp);
18
18
  let t0;
@@ -29,24 +29,35 @@ function useAdminShortcuts() {
29
29
  if (!matchingAction) return;
30
30
  const shortcut = matchingAction.shortcut;
31
31
  if (checkIfInputFocused()) {
32
- if (!shortcut.withMeta && !shortcut.withAlt) return;
32
+ if (shortcut.key !== "Escape" && !shortcut.withMeta && !shortcut.withAlt) return;
33
33
  if (shortcut.key === "Backspace") return;
34
34
  }
35
35
  event.preventDefault();
36
36
  event.stopPropagation();
37
+ if (shortcut.key === "Escape" && checkIfInputFocused()) document.activeElement.blur();
37
38
  matchingAction.execute();
38
39
  };
39
- const handleMessage = (event_0) => {
40
- if (event_0.data?.type === "executeAction") {
41
- const { actionId } = event_0.data;
40
+ const handleCapturedKeyDown = (event_0) => {
41
+ if (event_0.key === "Escape") return;
42
+ handleKeyDown(event_0);
43
+ };
44
+ const handleEscape = (event_1) => {
45
+ if (event_1.key !== "Escape" || event_1.defaultPrevented) return;
46
+ handleKeyDown(event_1);
47
+ };
48
+ const handleMessage = (event_2) => {
49
+ if (event_2.data?.type === "executeAction") {
50
+ const { actionId } = event_2.data;
42
51
  const action_0 = actions.find((a) => a.id === actionId);
43
52
  if (action_0) action_0.execute();
44
53
  }
45
54
  };
46
- document.addEventListener("keydown", handleKeyDown, true);
55
+ document.addEventListener("keydown", handleCapturedKeyDown, true);
56
+ window.addEventListener("keydown", handleEscape);
47
57
  window.addEventListener("message", handleMessage);
48
58
  return () => {
49
- document.removeEventListener("keydown", handleKeyDown, true);
59
+ document.removeEventListener("keydown", handleCapturedKeyDown, true);
60
+ window.removeEventListener("keydown", handleEscape);
50
61
  window.removeEventListener("message", handleMessage);
51
62
  };
52
63
  };
@@ -1,4 +1,3 @@
1
- import { trackEvent } from "../../lib/telemetry.js";
2
1
  import { queryKeys } from "@camox/api-contract/query-keys";
3
2
  import { createORPCClient } from "@orpc/client";
4
3
  import { RPCLink } from "@orpc/client/fetch";
@@ -176,11 +175,6 @@ async function createMarkdownResponse({ apiUrl, environmentName, pathname, proje
176
175
  });
177
176
  const { markdown } = await api.blocks.getPageMarkdown({ pageId: page.page.id });
178
177
  if (!markdown) return null;
179
- trackEvent("markdown_served", {
180
- pathname: requestPathname,
181
- projectId: page.page.projectId,
182
- projectName: page.projectName
183
- });
184
178
  return new Response(markdown, { headers: { "Content-Type": "text/markdown; charset=utf-8" } });
185
179
  } catch {
186
180
  return null;
@@ -12,10 +12,10 @@ import studioCssUrl from "virtual:camox-studio-css";
12
12
 
13
13
  //#region src/features/runtime/RuntimeChrome.tsx
14
14
  function RuntimeChrome(t0) {
15
- const $ = c(33);
16
- if ($[0] !== "b6bc64556f010bff957a9ab8a6f788b2f582426a19b86427f9d0314970d7a4dc") {
17
- for (let $i = 0; $i < 33; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
18
- $[0] = "b6bc64556f010bff957a9ab8a6f788b2f582426a19b86427f9d0314970d7a4dc";
15
+ const $ = c(34);
16
+ if ($[0] !== "4f2448cdd08f7a2c7703fe11bfa7e45ebc2f0485d14029a9a68ae33e62958b54") {
17
+ for (let $i = 0; $i < 34; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
18
+ $[0] = "4f2448cdd08f7a2c7703fe11bfa7e45ebc2f0485d14029a9a68ae33e62958b54";
19
19
  }
20
20
  const { input, children } = t0;
21
21
  const preview = !input.routeKind;
@@ -92,54 +92,57 @@ function RuntimeChrome(t0) {
92
92
  } else t9 = $[19];
93
93
  const t10 = !preview;
94
94
  const t11 = input.derived ? void 0 : "max-md:hidden";
95
- const t12 = preview && !input.derived ? page?.page.status : void 0;
96
- const t13 = !!page?.page.livePublishedCheckpointId;
97
- let t14;
98
- if ($[20] !== t12 || $[21] !== t13) {
99
- t14 = /* @__PURE__ */ jsx(PreviewToolbar, {
100
- pageStatus: t12,
101
- hasLiveVersion: t13
95
+ const t12 = page?.page.id;
96
+ const t13 = preview && !input.derived ? page?.page.status : void 0;
97
+ const t14 = !!page?.page.livePublishedCheckpointId;
98
+ let t15;
99
+ if ($[20] !== t12 || $[21] !== t13 || $[22] !== t14) {
100
+ t15 = /* @__PURE__ */ jsx(PreviewToolbar, {
101
+ pageId: t12,
102
+ pageStatus: t13,
103
+ hasLiveVersion: t14
102
104
  });
103
105
  $[20] = t12;
104
106
  $[21] = t13;
105
107
  $[22] = t14;
106
- } else t14 = $[22];
107
- let t15;
108
- if ($[23] !== t10 || $[24] !== t11 || $[25] !== t14) {
109
- t15 = /* @__PURE__ */ jsx("div", {
108
+ $[23] = t15;
109
+ } else t15 = $[23];
110
+ let t16;
111
+ if ($[24] !== t10 || $[25] !== t11 || $[26] !== t15) {
112
+ t16 = /* @__PURE__ */ jsx("div", {
110
113
  hidden: t10,
111
114
  className: t11,
112
- children: t14
115
+ children: t15
113
116
  });
114
- $[23] = t10;
115
- $[24] = t11;
116
- $[25] = t14;
117
+ $[24] = t10;
118
+ $[25] = t11;
117
119
  $[26] = t15;
118
- } else t15 = $[26];
119
- let t16;
120
- if ($[27] !== t15 || $[28] !== t9) {
121
- t16 = /* @__PURE__ */ jsxs("div", {
120
+ $[27] = t16;
121
+ } else t16 = $[27];
122
+ let t17;
123
+ if ($[28] !== t16 || $[29] !== t9) {
124
+ t17 = /* @__PURE__ */ jsxs("div", {
122
125
  className: "relative flex min-h-0 flex-1 flex-col",
123
- children: [t9, t15]
126
+ children: [t9, t16]
124
127
  });
125
- $[27] = t15;
126
- $[28] = t9;
127
- $[29] = t16;
128
- } else t16 = $[29];
129
- let t17;
130
- if ($[30] !== t16 || $[31] !== t8) {
131
- t17 = /* @__PURE__ */ jsxs(SharedChromeContext.Provider, {
128
+ $[28] = t16;
129
+ $[29] = t9;
130
+ $[30] = t17;
131
+ } else t17 = $[30];
132
+ let t18;
133
+ if ($[31] !== t17 || $[32] !== t8) {
134
+ t18 = /* @__PURE__ */ jsxs(SharedChromeContext.Provider, {
132
135
  value: true,
133
136
  children: [t4, /* @__PURE__ */ jsxs("div", {
134
137
  className: "bg-background flex h-screen flex-col overflow-hidden",
135
- children: [t8, t16]
138
+ children: [t8, t17]
136
139
  })]
137
140
  });
138
- $[30] = t16;
139
- $[31] = t8;
140
- $[32] = t17;
141
- } else t17 = $[32];
142
- return t17;
141
+ $[31] = t17;
142
+ $[32] = t8;
143
+ $[33] = t18;
144
+ } else t18 = $[33];
145
+ return t18;
143
146
  }
144
147
  function _temp(state) {
145
148
  return state.context.isToolbarHidden;
@@ -2,7 +2,6 @@ import { Navigate, useLocation } from "../navigation/navigation.js";
2
2
  import { useAuthState, useSignInRedirect } from "../../lib/auth.js";
3
3
  import { SharedChromeContext } from "../runtime/SharedChromeContext.js";
4
4
  import { STUDIO_BASE_PATH } from "./routes.js";
5
- import { trackClientEvent } from "../../lib/telemetry-client.js";
6
5
  import { Navbar } from "./components/Navbar.js";
7
6
  import { c } from "react/compiler-runtime";
8
7
  import * as React from "react";
@@ -10,10 +9,10 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
9
 
11
10
  //#region src/features/studio/CamoxStudio.tsx
12
11
  const CamoxStudio = (t0) => {
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";
12
+ const $ = c(12);
13
+ if ($[0] !== "5f0b5c1c244f7af982fa1d0e99a04fcbc60b872999562c3737760c88a71ce1d0") {
14
+ for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
+ $[0] = "5f0b5c1c244f7af982fa1d0e99a04fcbc60b872999562c3737760c88a71ce1d0";
17
16
  }
18
17
  const { children } = t0;
19
18
  const { isAuthenticated, isLoading: isLoadingAuth } = useAuthState();
@@ -41,61 +40,42 @@ const CamoxStudio = (t0) => {
41
40
  t2 = $[5];
42
41
  }
43
42
  React.useEffect(t1, t2);
44
- const hasTrackedOpenRef = React.useRef(false);
45
- let t3;
46
- let t4;
47
- if ($[6] !== isAuthenticated || $[7] !== pathname) {
48
- t3 = () => {
49
- if (!isAuthenticated || hasTrackedOpenRef.current) return;
50
- hasTrackedOpenRef.current = true;
51
- trackClientEvent("studio_opened", { route: pathname });
52
- };
53
- t4 = [isAuthenticated, pathname];
54
- $[6] = isAuthenticated;
55
- $[7] = pathname;
56
- $[8] = t3;
57
- $[9] = t4;
58
- } else {
59
- t3 = $[8];
60
- t4 = $[9];
61
- }
62
- React.useEffect(t3, t4);
63
43
  if (!isAuthenticated) return null;
64
44
  if (pathname === STUDIO_BASE_PATH) {
65
- let t5;
66
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
67
- t5 = /* @__PURE__ */ jsx(Navigate, {
45
+ let t3;
46
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
47
+ t3 = /* @__PURE__ */ jsx(Navigate, {
68
48
  to: "/",
69
49
  replace: true
70
50
  });
71
- $[10] = t5;
72
- } else t5 = $[10];
73
- return t5;
51
+ $[6] = t3;
52
+ } else t3 = $[6];
53
+ return t3;
74
54
  }
75
55
  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;
56
+ let t3;
57
+ if ($[7] !== children) {
58
+ t3 = /* @__PURE__ */ jsx(Fragment, { children });
59
+ $[7] = children;
60
+ $[8] = t3;
61
+ } else t3 = $[8];
62
+ return t3;
83
63
  }
84
- let t5;
85
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
86
- t5 = /* @__PURE__ */ jsx(Navbar, {});
87
- $[13] = t5;
88
- } else t5 = $[13];
89
- let t6;
90
- if ($[14] !== children) {
91
- t6 = /* @__PURE__ */ jsxs("div", {
64
+ let t3;
65
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
66
+ t3 = /* @__PURE__ */ jsx(Navbar, {});
67
+ $[9] = t3;
68
+ } else t3 = $[9];
69
+ let t4;
70
+ if ($[10] !== children) {
71
+ t4 = /* @__PURE__ */ jsxs("div", {
92
72
  className: "bg-background flex h-screen flex-col overflow-hidden",
93
- children: [t5, children]
73
+ children: [t3, children]
94
74
  });
95
- $[14] = children;
96
- $[15] = t6;
97
- } else t6 = $[15];
98
- return t6;
75
+ $[10] = children;
76
+ $[11] = t4;
77
+ } else t4 = $[11];
78
+ return t4;
99
79
  };
100
80
 
101
81
  //#endregion
@@ -267,7 +267,10 @@ function loadRuntimeDevModule(id, options = {}) {
267
267
  if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT) return generateVirtualStudioClient();
268
268
  if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT_URL) return generateVirtualStudioClientUrl();
269
269
  if (id === RESOLVED_VIRTUAL_APP_STYLESHEET_URL) return generateVirtualAppStylesheetUrl();
270
- if (id === RESOLVED_VIRTUAL_STUDIO_CSS) return `export default "/@fs/${resolve(sdkRoot, "dist/studio.css")}";`;
270
+ if (id === RESOLVED_VIRTUAL_STUDIO_CSS) {
271
+ const cssUrl = `/@fs/${resolve(sdkRoot, "dist/studio.css").replaceAll("\\", "/").replace(/^\/+/, "")}`;
272
+ return `export default ${JSON.stringify(cssUrl)};`;
273
+ }
271
274
  if (id === RESOLVED_VIRTUAL_OVERLAY_CSS) return `export default ${JSON.stringify(readFileSync(resolve(sdkRoot, "dist/studio-overlays.css"), "utf-8"))};`;
272
275
  }
273
276
  function normalizeRuntimeBasePath(basePath) {
@@ -23,13 +23,14 @@ type CamoxVitePlugin = Plugin & {
23
23
  interface CamoxPluginOptions {
24
24
  /** Stable, human-readable slug identifying this project (e.g. "prestigious-impala-84") */
25
25
  projectSlug: string;
26
- /** Disable PostHog telemetry collection (default: false) */
26
+ /** Disable telemetry collection (default: false) */
27
27
  disableTelemetry?: boolean;
28
28
  /** Internal options (intended for Camox contributors in development, not for public use) */
29
29
  _internal?: {
30
30
  /** URL of the Camox API backend, used for data fetching */apiUrl?: string; /** URL of the Camox authentication backend (default: https://app.camox.dev) */
31
31
  authenticationUrl?: string; /** Show Tanstack query devtools (default: false) */
32
- enableTanstackDevtools?: boolean; /** Disable automatic code generation (route files and app file) (default: false) */
32
+ enableTanstackDevtools?: boolean; /** Enable the frontend-only comments prototype (default: false). */
33
+ enableComments?: boolean; /** Disable automatic code generation (route files and app file) (default: false) */
33
34
  disableCodeGen?: boolean; /** Mount the Camox-owned dev runtime at this base path. Use "/" for root mode. */
34
35
  runtimeBasePath?: string;
35
36
  };
@@ -11,7 +11,9 @@ import { fileURLToPath } from "node:url";
11
11
  import { createServer } from "vite-plus";
12
12
 
13
13
  //#region src/features/vite/vite.ts
14
- const sdkRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
14
+ const pluginDir = dirname(fileURLToPath(import.meta.url));
15
+ const sdkRoot = resolve(pluginDir, "../../..");
16
+ const isSdkSource = pluginDir === resolve(sdkRoot, "src/features/vite");
15
17
  const VIRTUAL_STUDIO_CSS = "virtual:camox-studio-css";
16
18
  const RESOLVED_VIRTUAL_STUDIO_CSS = "\0" + VIRTUAL_STUDIO_CSS;
17
19
  const VIRTUAL_OVERLAY_CSS = "virtual:camox-overlay-css";
@@ -58,17 +60,19 @@ function camox(options) {
58
60
  if (id === VIRTUAL_OVERLAY_CSS) return RESOLVED_VIRTUAL_OVERLAY_CSS;
59
61
  },
60
62
  load(id) {
63
+ const stylesDir = resolve(sdkRoot, !isBuild && isSdkSource ? ".dev" : "dist");
61
64
  if (id === RESOLVED_VIRTUAL_STUDIO_CSS) {
62
- const cssPath = resolve(sdkRoot, "dist/studio.css");
65
+ const cssPath = resolve(stylesDir, "studio.css");
63
66
  if (isBuild) {
64
67
  const css = readFileSync(cssPath, "utf-8");
65
68
  const dataUrl = `data:text/css;base64,${Buffer.from(css).toString("base64")}`;
66
69
  return `export default ${JSON.stringify(dataUrl)};`;
67
70
  }
68
- return `export default "/@fs/${cssPath}";`;
71
+ const cssUrl = `/@fs/${cssPath.replaceAll("\\", "/").replace(/^\/+/, "")}`;
72
+ return `export default ${JSON.stringify(cssUrl)};`;
69
73
  }
70
74
  if (id === RESOLVED_VIRTUAL_OVERLAY_CSS) {
71
- const css = readFileSync(resolve(sdkRoot, "dist/studio-overlays.css"), "utf-8");
75
+ const css = readFileSync(resolve(stylesDir, "studio-overlays.css"), "utf-8");
72
76
  return `export default ${JSON.stringify(css)};`;
73
77
  }
74
78
  if (id === RESOLVED_VIRTUAL_PAGE_CLIENT_URL && isBuild) return "export default \"/_chunks/camox-page-client.mjs\";";
@@ -101,6 +105,7 @@ function camox(options) {
101
105
  define: {
102
106
  __CAMOX_TELEMETRY_DISABLED__: JSON.stringify(!!options.disableTelemetry),
103
107
  __ENABLE_TANSTACK_DEVTOOLS__: JSON.stringify(enableTanstackDevtools),
108
+ __CAMOX_ENABLE_COMMENTS__: JSON.stringify(options._internal?.enableComments ?? false),
104
109
  __CAMOX_ENVIRONMENT_NAME__: JSON.stringify(environmentName),
105
110
  __CAMOX_API_URL__: JSON.stringify(apiUrl),
106
111
  __CAMOX_AUTHENTICATION_URL__: JSON.stringify(authenticationUrl),
@@ -181,7 +186,6 @@ function camox(options) {
181
186
  "camox > fractional-indexing",
182
187
  "camox > lexical",
183
188
  "camox > lucide-react",
184
- "camox > posthog-js",
185
189
  "camox > @tanstack/react-query-devtools/production",
186
190
  "camox > partysocket/react"
187
191
  ] }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { getAuthCookieHeader } from "../lib/auth.js";
4
4
  import { getApiUrl, getEnvironmentName } from "../lib/api-client.js";
5
- import { trackClientEvent } from "../lib/telemetry-client.js";
6
5
  import { useCallback, useRef, useState } from "react";
7
6
 
8
7
  //#region src/hooks/use-file-upload.ts
@@ -54,7 +53,6 @@ function useFileUpload(options) {
54
53
  filename: result.filename,
55
54
  mimeType: result.mimeType
56
55
  });
57
- trackClientEvent("file_uploaded", { mimeType: file.type });
58
56
  setUploads((prev_0) => prev_0.map((u_0) => u_0.id === itemId ? {
59
57
  ...u_0,
60
58
  status: "complete",