camox 0.77.0 → 0.79.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 (32) hide show
  1. package/dist/features/canvas/CamoxCanvas.js +187 -197
  2. package/dist/features/canvas/canvasCameraController.js +1 -1
  3. package/dist/features/canvas/canvasItems.js +40 -9
  4. package/dist/features/canvas/sidebar/ContentSidebarFrame.js +15 -11
  5. package/dist/features/canvas/useCanvasLayout.js +34 -0
  6. package/dist/features/memory/CamoxMemory.js +756 -0
  7. package/dist/features/memory/VoiceGroup.js +350 -0
  8. package/dist/features/preview/EditablePageExperience.js +2 -0
  9. package/dist/features/runtime/publicCache.d.ts +2 -0
  10. package/dist/features/runtime/publicCache.js +27 -4
  11. package/dist/features/runtime/runtime.d.ts +1 -1
  12. package/dist/features/runtime/runtime.js +34 -15
  13. package/dist/features/studio/FollowAgentProvider.js +1 -1
  14. package/dist/features/studio/components/AgentSidebar.js +22 -16
  15. package/dist/features/studio/components/DraftBar.js +167 -103
  16. package/dist/features/studio/components/{ReviewDraftDialog.js → DraftReview.js} +214 -218
  17. package/dist/features/studio/components/DraftsControl.js +174 -202
  18. package/dist/features/studio/components/DraftsSheet.js +102 -94
  19. package/dist/features/studio/components/Navbar.js +121 -84
  20. package/dist/features/studio/components/PublishedTab.js +21 -20
  21. package/dist/features/studio/routes.js +3 -1
  22. package/dist/features/studio/studioStore.js +12 -9
  23. package/dist/features/studio/usePublishDraft.js +116 -0
  24. package/dist/features/studio/viewSwitch.js +10 -7
  25. package/dist/features/vite/vite.js +1 -0
  26. package/dist/lib/queries.js +11 -1
  27. package/dist/lib/studio-reads.d.ts +1 -0
  28. package/dist/lib/studio-reads.js +12 -0
  29. package/dist/package.js +1 -1
  30. package/dist/studio.css +1 -1
  31. package/package.json +5 -5
  32. package/LICENSE.md +0 -21
@@ -3,6 +3,8 @@ import { studioStore } from "../studioStore.js";
3
3
  import { plural } from "../draftLabel.js";
4
4
  import { useArchiveDraft } from "../useArchiveDraft.js";
5
5
  import { useDrafts } from "./DraftsControl.js";
6
+ import { usePublishDraft } from "../usePublishDraft.js";
7
+ import { DraftReview } from "./DraftReview.js";
6
8
  import { c } from "react/compiler-runtime";
7
9
  import * as React from "react";
8
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -18,143 +20,205 @@ import { FloatingToolbar } from "@camox/ui/floating-toolbar";
18
20
  const SETTLE_MS = 1500;
19
21
  /**
20
22
  * Asks what to do with the draft being viewed, once its edits settle: archive it, unless it's
21
- * Camox's Catch-up Draft, or publish it.
22
- * Publishing waits while Camox's agent is mid-turn in the draft, so half a change never goes live;
23
+ * Camox's Catch-up Draft, or publish it right away, which a toast follows. Its count of pending
24
+ * changes opens the draft's review, as does a publish that blockers held or stopped. Publishing
25
+ * waits while Camox's agent is mid-turn in the draft, so half a change never goes live;
23
26
  * nothing else Camox does holds it here. `stacked` places it in the Preview toolbar's column, just above the toolbar;
24
27
  * otherwise it floats at the bottom of the screen on its own.
25
28
  */
26
29
  function DraftBar(t0) {
27
- const $ = c(32);
30
+ const $ = c(10);
28
31
  const { stacked: t1 } = t0;
29
32
  const stacked = t1 === void 0 ? false : t1;
30
33
  const { projectId, current } = useDrafts();
31
34
  const { archive, archiving } = useArchiveDraft(projectId);
32
35
  const settled = useSettled(current?.id ?? null, current?.lastChangedAt ?? null);
36
+ const reviewing = useSelector(studioStore, _temp);
33
37
  let t2;
34
38
  if ($[0] !== current) {
35
- t2 = (state) => !!current && state.context.agentWorkingIn === current.id;
39
+ t2 = (state_0) => !!current && state_0.context.agentWorkingIn === current.id;
36
40
  $[0] = current;
37
41
  $[1] = t2;
38
42
  } else t2 = $[1];
39
43
  const working = useSelector(studioStore, t2);
40
- if (!projectId || !current || !settled) return null;
41
- const empty = current.changeCount === 0;
42
- const t3 = stacked ? "pointer-events-auto relative left-auto translate-x-0" : "fixed bottom-2";
44
+ if (!projectId || !current || !(settled || reviewing)) return null;
45
+ let t3;
46
+ if ($[2] !== archive || $[3] !== archiving || $[4] !== current || $[5] !== projectId || $[6] !== reviewing || $[7] !== stacked || $[8] !== working) {
47
+ t3 = /* @__PURE__ */ jsx(Bar, {
48
+ projectId,
49
+ draft: current,
50
+ archive,
51
+ archiving,
52
+ working,
53
+ reviewing,
54
+ stacked
55
+ }, current.id);
56
+ $[2] = archive;
57
+ $[3] = archiving;
58
+ $[4] = current;
59
+ $[5] = projectId;
60
+ $[6] = reviewing;
61
+ $[7] = stacked;
62
+ $[8] = working;
63
+ $[9] = t3;
64
+ } else t3 = $[9];
65
+ return t3;
66
+ }
67
+ function _temp(state) {
68
+ return state.context.isDraftReviewOpen;
69
+ }
70
+ function Bar(t0) {
71
+ const $ = c(37);
72
+ const { projectId, draft, archive, archiving, working, reviewing, stacked } = t0;
73
+ const review = _temp2;
74
+ let t1;
75
+ if ($[0] !== draft.id || $[1] !== projectId) {
76
+ t1 = {
77
+ projectId,
78
+ draftId: draft.id,
79
+ onBlocked: review
80
+ };
81
+ $[0] = draft.id;
82
+ $[1] = projectId;
83
+ $[2] = t1;
84
+ } else t1 = $[2];
85
+ const { publish, publishing } = usePublishDraft(t1);
86
+ const empty = draft.changeCount === 0;
87
+ const toolbar = React.useRef(null);
88
+ const t2 = stacked ? "pointer-events-auto relative left-auto translate-x-0" : "fixed bottom-2";
89
+ let t3;
90
+ if ($[3] !== t2) {
91
+ t3 = cn("w-max gap-4", t2);
92
+ $[3] = t2;
93
+ $[4] = t3;
94
+ } else t3 = $[4];
43
95
  let t4;
44
- if ($[2] !== t3) {
45
- t4 = cn("w-max gap-4", t3);
46
- $[2] = t3;
47
- $[3] = t4;
48
- } else t4 = $[3];
49
- let t5;
50
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
51
- t5 = /* @__PURE__ */ jsx("span", {
52
- "aria-hidden": true,
53
- className: "size-2 shrink-0 rounded-full bg-blue-500"
54
- });
55
- $[4] = t5;
56
- } else t5 = $[4];
57
- let t6;
58
- if ($[5] !== current.changeCount || $[6] !== empty) {
59
- t6 = empty ? "No changes yet" : plural(current.changeCount, "pending change");
60
- $[5] = current.changeCount;
61
- $[6] = empty;
62
- $[7] = t6;
63
- } else t6 = $[7];
64
- let t7;
65
- if ($[8] !== t6) {
66
- t7 = /* @__PURE__ */ jsxs("span", {
96
+ if ($[5] !== draft.changeCount || $[6] !== draft.id || $[7] !== empty || $[8] !== projectId || $[9] !== reviewing) {
97
+ t4 = empty ? /* @__PURE__ */ jsxs("span", {
67
98
  className: "flex items-center gap-2 px-2 text-sm",
68
- children: [t5, t6]
99
+ children: [/* @__PURE__ */ jsx("span", {
100
+ "aria-hidden": true,
101
+ className: "size-2 shrink-0 rounded-full bg-blue-500"
102
+ }), "No changes yet"]
103
+ }) : /* @__PURE__ */ jsx(DraftReview, {
104
+ projectId,
105
+ draftId: draft.id,
106
+ open: reviewing,
107
+ anchor: toolbar,
108
+ onOpenChange: _temp3,
109
+ trigger: /* @__PURE__ */ jsxs(Button, {
110
+ type: "button",
111
+ variant: "ghost",
112
+ children: [/* @__PURE__ */ jsx("span", {
113
+ "aria-hidden": true,
114
+ className: "size-2 shrink-0 rounded-full bg-blue-500"
115
+ }), plural(draft.changeCount, "pending change")]
116
+ })
69
117
  });
70
- $[8] = t6;
71
- $[9] = t7;
72
- } else t7 = $[9];
73
- let t8;
74
- if ($[10] !== archive || $[11] !== archiving || $[12] !== current.catchUp) {
75
- t8 = !current.catchUp && /* @__PURE__ */ jsx(Button, {
118
+ $[5] = draft.changeCount;
119
+ $[6] = draft.id;
120
+ $[7] = empty;
121
+ $[8] = projectId;
122
+ $[9] = reviewing;
123
+ $[10] = t4;
124
+ } else t4 = $[10];
125
+ let t5;
126
+ if ($[11] !== archive || $[12] !== archiving || $[13] !== draft.catchUp || $[14] !== publishing) {
127
+ t5 = !draft.catchUp && /* @__PURE__ */ jsx(Button, {
76
128
  type: "button",
77
129
  variant: "outline",
78
- disabled: archiving,
130
+ disabled: archiving || publishing,
79
131
  onClick: archive,
80
132
  children: "Archive"
81
133
  });
82
- $[10] = archive;
83
- $[11] = archiving;
84
- $[12] = current.catchUp;
85
- $[13] = t8;
86
- } else t8 = $[13];
87
- const t9 = !working;
88
- const t10 = working ? 0 : void 0;
134
+ $[11] = archive;
135
+ $[12] = archiving;
136
+ $[13] = draft.catchUp;
137
+ $[14] = publishing;
138
+ $[15] = t5;
139
+ } else t5 = $[15];
140
+ const t6 = !working;
141
+ const t7 = working ? 0 : void 0;
142
+ let t8;
143
+ if ($[16] !== t7) {
144
+ t8 = /* @__PURE__ */ jsx("span", { tabIndex: t7 });
145
+ $[16] = t7;
146
+ $[17] = t8;
147
+ } else t8 = $[17];
148
+ const t9 = empty || working || publishing;
149
+ let t10;
150
+ if ($[18] !== publish) {
151
+ t10 = () => void publish();
152
+ $[18] = publish;
153
+ $[19] = t10;
154
+ } else t10 = $[19];
89
155
  let t11;
90
- if ($[14] !== t10) {
91
- t11 = /* @__PURE__ */ jsx("span", { tabIndex: t10 });
92
- $[14] = t10;
93
- $[15] = t11;
94
- } else t11 = $[15];
95
- const t12 = empty || working;
96
- let t13;
97
- if ($[16] !== t12) {
98
- t13 = /* @__PURE__ */ jsx(Button, {
156
+ if ($[20] !== t10 || $[21] !== t9) {
157
+ t11 = /* @__PURE__ */ jsx(Button, {
99
158
  type: "button",
100
- disabled: t12,
101
- onClick: _temp,
102
- children: "Publish…"
159
+ disabled: t9,
160
+ onClick: t10,
161
+ children: "Publish"
162
+ });
163
+ $[20] = t10;
164
+ $[21] = t9;
165
+ $[22] = t11;
166
+ } else t11 = $[22];
167
+ let t12;
168
+ if ($[23] !== t11 || $[24] !== t8) {
169
+ t12 = /* @__PURE__ */ jsx(TooltipTrigger, {
170
+ render: t8,
171
+ children: t11
103
172
  });
104
- $[16] = t12;
105
- $[17] = t13;
106
- } else t13 = $[17];
173
+ $[23] = t11;
174
+ $[24] = t8;
175
+ $[25] = t12;
176
+ } else t12 = $[25];
177
+ let t13;
178
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
179
+ t13 = /* @__PURE__ */ jsx(TooltipContent, { children: "Camox's agent is working" });
180
+ $[26] = t13;
181
+ } else t13 = $[26];
107
182
  let t14;
108
- if ($[18] !== t11 || $[19] !== t13) {
109
- t14 = /* @__PURE__ */ jsx(TooltipTrigger, {
110
- render: t11,
111
- children: t13
183
+ if ($[27] !== t12 || $[28] !== t6) {
184
+ t14 = /* @__PURE__ */ jsxs(Tooltip, {
185
+ disabled: t6,
186
+ children: [t12, t13]
112
187
  });
113
- $[18] = t11;
114
- $[19] = t13;
115
- $[20] = t14;
116
- } else t14 = $[20];
188
+ $[27] = t12;
189
+ $[28] = t6;
190
+ $[29] = t14;
191
+ } else t14 = $[29];
117
192
  let t15;
118
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
119
- t15 = /* @__PURE__ */ jsx(TooltipContent, { children: "Camox's agent is working" });
120
- $[21] = t15;
121
- } else t15 = $[21];
122
- let t16;
123
- if ($[22] !== t14 || $[23] !== t9) {
124
- t16 = /* @__PURE__ */ jsxs(Tooltip, {
125
- disabled: t9,
126
- children: [t14, t15]
127
- });
128
- $[22] = t14;
129
- $[23] = t9;
130
- $[24] = t16;
131
- } else t16 = $[24];
132
- let t17;
133
- if ($[25] !== t16 || $[26] !== t8) {
134
- t17 = /* @__PURE__ */ jsxs("div", {
193
+ if ($[30] !== t14 || $[31] !== t5) {
194
+ t15 = /* @__PURE__ */ jsxs("div", {
135
195
  className: "flex items-center gap-2",
136
- children: [t8, t16]
196
+ children: [t5, t14]
137
197
  });
138
- $[25] = t16;
139
- $[26] = t8;
140
- $[27] = t17;
141
- } else t17 = $[27];
142
- let t18;
143
- if ($[28] !== t17 || $[29] !== t4 || $[30] !== t7) {
144
- t18 = /* @__PURE__ */ jsxs(FloatingToolbar, {
198
+ $[30] = t14;
199
+ $[31] = t5;
200
+ $[32] = t15;
201
+ } else t15 = $[32];
202
+ let t16;
203
+ if ($[33] !== t15 || $[34] !== t3 || $[35] !== t4) {
204
+ t16 = /* @__PURE__ */ jsxs(FloatingToolbar, {
205
+ ref: toolbar,
145
206
  "aria-label": "Draft",
146
- className: t4,
147
- children: [t7, t17]
207
+ className: t3,
208
+ children: [t4, t15]
148
209
  });
149
- $[28] = t17;
150
- $[29] = t4;
151
- $[30] = t7;
152
- $[31] = t18;
153
- } else t18 = $[31];
154
- return t18;
210
+ $[33] = t15;
211
+ $[34] = t3;
212
+ $[35] = t4;
213
+ $[36] = t16;
214
+ } else t16 = $[36];
215
+ return t16;
216
+ }
217
+ function _temp3(open) {
218
+ return studioStore.send({ type: open ? "openDraftReview" : "closeDraftReview" });
155
219
  }
156
- function _temp() {
157
- return studioStore.send({ type: "openReviewDraftDialog" });
220
+ function _temp2() {
221
+ return studioStore.send({ type: "openDraftReview" });
158
222
  }
159
223
  /**
160
224
  * Whether the draft went without a change for `SETTLE_MS`. Once settled it stays so for that