camox 0.53.1 → 0.56.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 (52) hide show
  1. package/dist/features/canvas/CamoxCanvas.js +14 -11
  2. package/dist/features/canvas/CanvasLoadingScreen.js +1 -1
  3. package/dist/features/canvas/sidebar/CanvasViewHeader.js +1 -1
  4. package/dist/features/canvas/sidebar/{CanvasSidebar.js → ContentSidebar.js} +5 -5
  5. package/dist/features/canvas/sidebar/{CanvasSidebarFrame.js → ContentSidebarFrame.js} +4 -4
  6. package/dist/features/canvas/sidebar/{CanvasSidebarSkeleton.js → ContentSidebarSkeleton.js} +7 -7
  7. package/dist/features/og/documentFonts.js +49 -0
  8. package/dist/features/og/imageResponse.d.ts +14 -5
  9. package/dist/features/og/imageResponse.js +20 -21
  10. package/dist/features/og/pageImage.js +7 -4
  11. package/dist/features/preview/CamoxPreview.js +2 -2
  12. package/dist/features/preview/components/BlockActionsPopover.js +1 -1
  13. package/dist/features/preview/components/IconFieldEditor.js +1 -1
  14. package/dist/features/preview/components/LinkFieldEditor.js +1 -1
  15. package/dist/features/preview/components/PagePicker.js +1 -1
  16. package/dist/features/preview/components/PreviewToolbar.js +1 -1
  17. package/dist/features/preview/components/SelectionEditor.js +136 -110
  18. package/dist/features/preview/components/SidebarStack.js +110 -83
  19. package/dist/features/preview/components/StudioEditingFallback.js +3 -3
  20. package/dist/features/routes/pageRuntime.d.ts +1 -1
  21. package/dist/features/runtime/RuntimeChrome.js +4 -4
  22. package/dist/features/runtime/runtime.d.ts +5 -0
  23. package/dist/features/runtime/runtime.js +15 -4
  24. package/dist/features/studio/components/AgentSidebar.js +56 -0
  25. package/dist/features/studio/components/ChatWidget.js +237 -0
  26. package/dist/features/studio/components/DraftsControl.js +17 -17
  27. package/dist/features/studio/components/ReviewDraftSheet.js +38 -38
  28. package/dist/features/studio/components/Squareling.js +116 -0
  29. package/dist/features/studio/components/ThreadMessages.js +190 -165
  30. package/dist/features/studio/components/WorkersWidget.js +52 -0
  31. package/dist/features/studio/studioStore.js +5 -5
  32. package/dist/features/vite/bundlerLogs.js +1 -0
  33. package/dist/features/vite/runtimeDev.js +11 -0
  34. package/dist/features/vite/vite.js +3 -1
  35. package/dist/lib/queries.js +1 -1
  36. package/dist/package.js +1 -1
  37. package/dist/studio.css +1 -1
  38. package/package.json +5 -5
  39. package/skills/camox/SKILL.md +3 -10
  40. package/skills/camox/references/artifacts.md +2 -2
  41. package/skills/camox/references/block-definitions.md +1 -1
  42. package/skills/camox/references/layout-definitions.md +12 -17
  43. package/skills/camox/references/routed-layouts.md +2 -2
  44. package/skills/camox-cli/SKILL.md +15 -0
  45. package/skills/{camox → camox-cli}/references/cli-common.md +1 -1
  46. package/skills/{camox → camox-cli}/references/cli-content.md +2 -2
  47. package/skills/{camox → camox-cli}/references/cli-publishing.md +4 -4
  48. package/skills/camox-expand/SKILL.md +1 -1
  49. package/skills/camoxify/SKILL.md +1 -1
  50. package/dist/features/og/defaultFonts.js +0 -31
  51. package/dist/features/og/geist-variable-ttf-base64.js +0 -21
  52. package/dist/features/studio/components/ChatSidebar.js +0 -364
@@ -1,364 +0,0 @@
1
- import { AuthContext } from "../../../lib/auth.js";
2
- import { useCurrentDraftId, useDraftScope } from "../../../lib/draft-scope.js";
3
- import { useNavigate } from "../../navigation/navigation.js";
4
- import { reads, useReadQuery } from "../../../lib/studio-reads.js";
5
- import { cn } from "../../../lib/utils.js";
6
- import { BOTTOM_CARD_EDGES, CARD_BODY_EDGES, SIDEBAR_GUTTER } from "../../preview/components/SidebarStack.js";
7
- import { draftLabel } from "../draftLabel.js";
8
- import { FollowAgentContext } from "../followAgentContext.js";
9
- import { useThread } from "../../../lib/use-thread.js";
10
- import { ThreadComposer } from "./ThreadComposer.js";
11
- import { ThreadMessages } from "./ThreadMessages.js";
12
- import { c } from "react/compiler-runtime";
13
- import * as React from "react";
14
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
- import { EMPTY_THREAD_VIEW } from "@camox/api-contract/threads";
16
-
17
- //#region src/features/studio/components/ChatSidebar.tsx
18
- /**
19
- * Where an editor works with Camox's agent in a thread, beside the Canvas. Elsewhere in the
20
- * studio it is only hidden: the studio keeps following the editor's runs there. It follows
21
- * where the studio is: the editor's own Live thread on Live, and the draft's thread in a draft.
22
- * When the Live thread starts a draft, the studio enters it with the thread.
23
- */
24
- function ChatSidebar(t0) {
25
- const $ = c(6);
26
- const { hidden: t1 } = t0;
27
- const hidden = t1 === void 0 ? false : t1;
28
- let t2;
29
- let t3;
30
- let t4;
31
- let t5;
32
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
33
- t2 = cn("absolute inset-y-0 right-0 z-10 flex flex-col py-2 max-md:hidden", SIDEBAR_GUTTER);
34
- t3 = { width: 265 };
35
- t4 = /* @__PURE__ */ jsxs("header", {
36
- className: cn("bg-background flex h-11 min-w-0 shrink-0 items-center justify-center gap-2 px-3", BOTTOM_CARD_EDGES),
37
- children: [/* @__PURE__ */ jsx(CamoxMark, {}), /* @__PURE__ */ jsx("h2", {
38
- className: "truncate text-sm font-medium",
39
- children: "Chat"
40
- })]
41
- });
42
- t5 = /* @__PURE__ */ jsx("div", {
43
- className: cn("bg-background flex min-h-0 flex-1 flex-col", CARD_BODY_EDGES),
44
- children: /* @__PURE__ */ jsx(CurrentThread, {})
45
- });
46
- $[0] = t2;
47
- $[1] = t3;
48
- $[2] = t4;
49
- $[3] = t5;
50
- } else {
51
- t2 = $[0];
52
- t3 = $[1];
53
- t4 = $[2];
54
- t5 = $[3];
55
- }
56
- let t6;
57
- if ($[4] !== hidden) {
58
- t6 = /* @__PURE__ */ jsxs("aside", {
59
- "aria-label": "Chat",
60
- "data-chat-sidebar": true,
61
- hidden,
62
- className: t2,
63
- style: t3,
64
- children: [t4, t5]
65
- });
66
- $[4] = hidden;
67
- $[5] = t6;
68
- } else t6 = $[5];
69
- return t6;
70
- }
71
- /** Camox's logo, beside the heading: the agent is Camox. */
72
- function CamoxMark() {
73
- const $ = c(1);
74
- let t0;
75
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
76
- t0 = /* @__PURE__ */ jsx("svg", {
77
- "aria-hidden": true,
78
- viewBox: "0 0 191.03 132",
79
- className: "size-5 shrink-0",
80
- xmlns: "http://www.w3.org/2000/svg",
81
- children: /* @__PURE__ */ jsx("path", {
82
- d: "M0 22.55A22.55 22.55 0 0 1 22.55 0L90.19 0A5.32 5.32 0 0 1 95.52 5.32L95.52 36.48L36.48 36.48L36.48 95.52L5.32 95.52A5.32 5.32 0 0 1 0 90.19ZM95.52 36.48L181.48 36.48A5.32 5.32 0 0 1 186.01 44.61L138.61 121.31A22.55 22.55 0 0 1 119.43 132L41.81 132A5.32 5.32 0 0 1 36.48 126.68L36.48 95.52L95.52 95.52Z",
83
- fill: "#00BC7D"
84
- })
85
- });
86
- $[0] = t0;
87
- } else t0 = $[0];
88
- return t0;
89
- }
90
- function CurrentThread() {
91
- const $ = c(15);
92
- const { apiUrl, projectUuid } = React.useContext(AuthContext);
93
- let t0;
94
- if ($[0] !== projectUuid) {
95
- t0 = reads.project({ projectUuid });
96
- $[0] = projectUuid;
97
- $[1] = t0;
98
- } else t0 = $[1];
99
- const { data: project } = useReadQuery(t0);
100
- const draftId = useCurrentDraftId();
101
- const draftScope = useDraftScope();
102
- const [carried, setCarried] = React.useState();
103
- let t1;
104
- if ($[2] !== draftScope) {
105
- t1 = (started, thread) => {
106
- if (draftScope.current() !== null) return;
107
- const { startedDraft: _, continuedIn: __, ...state } = thread.state;
108
- setCarried({
109
- draftId: started,
110
- thread: {
111
- ...thread,
112
- state
113
- }
114
- });
115
- draftScope.enterStarted(started);
116
- };
117
- $[2] = draftScope;
118
- $[3] = t1;
119
- } else t1 = $[3];
120
- const enterDraft = t1;
121
- let t2;
122
- let t3;
123
- if ($[4] !== draftScope) {
124
- t2 = () => draftScope.subscribe((t4) => {
125
- const { move } = t4;
126
- if (move !== "started") setCarried(void 0);
127
- });
128
- t3 = [draftScope];
129
- $[4] = draftScope;
130
- $[5] = t2;
131
- $[6] = t3;
132
- } else {
133
- t2 = $[5];
134
- t3 = $[6];
135
- }
136
- React.useEffect(t2, t3);
137
- if (!project) {
138
- let t4;
139
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
140
- t4 = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ThreadMessages, { view: EMPTY_THREAD_VIEW }), /* @__PURE__ */ jsx(ThreadComposer, { disabled: true })] });
141
- $[7] = t4;
142
- } else t4 = $[7];
143
- return t4;
144
- }
145
- const t4 = `${project.id}:${draftId ?? "live"}`;
146
- const t5 = carried?.draftId === draftId ? carried.thread : void 0;
147
- let t6;
148
- if ($[8] !== apiUrl || $[9] !== draftId || $[10] !== enterDraft || $[11] !== project.id || $[12] !== t4 || $[13] !== t5) {
149
- t6 = /* @__PURE__ */ jsx(Thread, {
150
- apiUrl,
151
- projectId: project.id,
152
- draftId,
153
- carried: t5,
154
- onEnterDraft: enterDraft
155
- }, t4);
156
- $[8] = apiUrl;
157
- $[9] = draftId;
158
- $[10] = enterDraft;
159
- $[11] = project.id;
160
- $[12] = t4;
161
- $[13] = t5;
162
- $[14] = t6;
163
- } else t6 = $[14];
164
- return t6;
165
- }
166
- function Thread(t0) {
167
- const $ = c(31);
168
- const { apiUrl, projectId, draftId, carried, onEnterDraft } = t0;
169
- let t1;
170
- if ($[0] !== carried || $[1] !== onEnterDraft) {
171
- t1 = {
172
- carried,
173
- onEnterDraft
174
- };
175
- $[0] = carried;
176
- $[1] = onEnterDraft;
177
- $[2] = t1;
178
- } else t1 = $[2];
179
- const { view, sending, send, stop, error, touched } = useThread(apiUrl, projectId, draftId, t1);
180
- const follow = React.use(FollowAgentContext);
181
- let t2;
182
- if ($[3] !== follow) {
183
- t2 = (batch) => follow?.receive(batch);
184
- $[3] = follow;
185
- $[4] = t2;
186
- } else t2 = $[4];
187
- const followTouched = React.useEffectEvent(t2);
188
- let t3;
189
- if ($[5] !== followTouched || $[6] !== touched) {
190
- t3 = () => {
191
- if (touched) followTouched(touched.batch);
192
- };
193
- $[5] = followTouched;
194
- $[6] = touched;
195
- $[7] = t3;
196
- } else t3 = $[7];
197
- let t4;
198
- if ($[8] !== touched) {
199
- t4 = [touched];
200
- $[8] = touched;
201
- $[9] = t4;
202
- } else t4 = $[9];
203
- React.useEffect(t3, t4);
204
- let t5;
205
- if ($[10] !== follow || $[11] !== send) {
206
- t5 = (text) => {
207
- follow?.resume();
208
- send(text);
209
- };
210
- $[10] = follow;
211
- $[11] = send;
212
- $[12] = t5;
213
- } else t5 = $[12];
214
- const sendFollowing = t5;
215
- const t6 = draftId !== null;
216
- let t7;
217
- if ($[13] !== sending || $[14] !== t6 || $[15] !== view) {
218
- t7 = {
219
- view,
220
- sending,
221
- showSenders: t6
222
- };
223
- $[13] = sending;
224
- $[14] = t6;
225
- $[15] = view;
226
- $[16] = t7;
227
- } else t7 = $[16];
228
- const messages = t7;
229
- const continuedIn = draftId === null ? view.continuedIn?.draftId : void 0;
230
- let t8;
231
- if ($[17] !== continuedIn || $[18] !== messages || $[19] !== projectId) {
232
- t8 = continuedIn ? /* @__PURE__ */ jsx(ContinuedInMessages, {
233
- ...messages,
234
- projectId,
235
- draftId: continuedIn
236
- }) : /* @__PURE__ */ jsx(ThreadMessages, { ...messages });
237
- $[17] = continuedIn;
238
- $[18] = messages;
239
- $[19] = projectId;
240
- $[20] = t8;
241
- } else t8 = $[20];
242
- let t9;
243
- if ($[21] !== error) {
244
- t9 = error && /* @__PURE__ */ jsx("p", {
245
- role: "alert",
246
- className: "text-destructive px-2 pt-2 text-sm",
247
- children: error
248
- });
249
- $[21] = error;
250
- $[22] = t9;
251
- } else t9 = $[22];
252
- let t10;
253
- if ($[23] !== sendFollowing || $[24] !== stop || $[25] !== view.running) {
254
- t10 = /* @__PURE__ */ jsx(ThreadComposer, {
255
- onSend: sendFollowing,
256
- onStop: stop,
257
- running: view.running
258
- });
259
- $[23] = sendFollowing;
260
- $[24] = stop;
261
- $[25] = view.running;
262
- $[26] = t10;
263
- } else t10 = $[26];
264
- let t11;
265
- if ($[27] !== t10 || $[28] !== t8 || $[29] !== t9) {
266
- t11 = /* @__PURE__ */ jsxs(Fragment, { children: [
267
- t8,
268
- t9,
269
- t10
270
- ] });
271
- $[27] = t10;
272
- $[28] = t8;
273
- $[29] = t9;
274
- $[30] = t11;
275
- } else t11 = $[30];
276
- return t11;
277
- }
278
- /**
279
- * A fresh Live thread's messages, linking to the draft the editor's previous one continued in,
280
- * named as the drafts control names it.
281
- */
282
- function ContinuedInMessages(t0) {
283
- const $ = c(22);
284
- let draftId;
285
- let messages;
286
- let projectId;
287
- if ($[0] !== t0) {
288
- ({projectId, draftId, ...messages} = t0);
289
- $[0] = t0;
290
- $[1] = draftId;
291
- $[2] = messages;
292
- $[3] = projectId;
293
- } else {
294
- draftId = $[1];
295
- messages = $[2];
296
- projectId = $[3];
297
- }
298
- const draftScope = useDraftScope();
299
- const navigate = useNavigate();
300
- let t1;
301
- if ($[4] !== draftId || $[5] !== projectId) {
302
- t1 = reads.draft({
303
- projectId,
304
- draftId
305
- });
306
- $[4] = draftId;
307
- $[5] = projectId;
308
- $[6] = t1;
309
- } else t1 = $[6];
310
- const { data: draft } = useReadQuery(t1);
311
- let t2;
312
- if ($[7] !== draft) {
313
- t2 = draft ? draftLabel(draft) : "a draft";
314
- $[7] = draft;
315
- $[8] = t2;
316
- } else t2 = $[8];
317
- let t3;
318
- if ($[9] !== draftId || $[10] !== draftScope) {
319
- t3 = draftScope.hrefFor(window.location.href, { draft: draftId });
320
- $[9] = draftId;
321
- $[10] = draftScope;
322
- $[11] = t3;
323
- } else t3 = $[11];
324
- let t4;
325
- if ($[12] !== draftId || $[13] !== navigate) {
326
- t4 = (event) => {
327
- event.preventDefault();
328
- navigate({
329
- to: window.location.href,
330
- draft: draftId
331
- });
332
- };
333
- $[12] = draftId;
334
- $[13] = navigate;
335
- $[14] = t4;
336
- } else t4 = $[14];
337
- let t5;
338
- if ($[15] !== t2 || $[16] !== t3 || $[17] !== t4) {
339
- t5 = {
340
- label: t2,
341
- href: t3,
342
- onOpen: t4
343
- };
344
- $[15] = t2;
345
- $[16] = t3;
346
- $[17] = t4;
347
- $[18] = t5;
348
- } else t5 = $[18];
349
- const link = t5;
350
- let t6;
351
- if ($[19] !== link || $[20] !== messages) {
352
- t6 = /* @__PURE__ */ jsx(ThreadMessages, {
353
- ...messages,
354
- continuedIn: link
355
- });
356
- $[19] = link;
357
- $[20] = messages;
358
- $[21] = t6;
359
- } else t6 = $[21];
360
- return t6;
361
- }
362
-
363
- //#endregion
364
- export { ChatSidebar };