camox 0.79.0 → 0.81.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.
- package/dist/core/lib/artifact.d.ts +26 -1
- package/dist/core/lib/artifactData.d.ts +5 -1
- package/dist/core/lib/artifactHost.d.ts +43 -0
- package/dist/features/brand/BrandPart.js +116 -0
- package/dist/features/brand/CamoxBrand.js +758 -0
- package/dist/features/brand/VoiceGroup.js +443 -0
- package/dist/features/preview/EditablePageExperience.js +2 -2
- package/dist/features/runtime/artifactReplay.d.ts +3 -0
- package/dist/features/runtime/artifactReplay.js +4 -0
- package/dist/features/runtime/runtime.d.ts +1 -1
- package/dist/features/runtime/runtime.js +4 -4
- package/dist/features/studio/components/DraftReview.js +8 -8
- package/dist/features/studio/components/Navbar.js +9 -7
- package/dist/features/studio/routes.js +3 -3
- package/dist/lib/queries.js +7 -7
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/dist/features/memory/CamoxMemory.js +0 -756
- package/dist/features/memory/VoiceGroup.js +0 -350
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import { useDraftScope } from "../../lib/draft-scope.js";
|
|
2
|
-
import { useNavigate } from "../navigation/navigation.js";
|
|
3
|
-
import { reads, useReadQuery, useStudioCache } from "../../lib/studio-reads.js";
|
|
4
|
-
import { memoryMutations } from "../../lib/queries.js";
|
|
5
|
-
import { previewStore } from "../preview/previewStore.js";
|
|
6
|
-
import { useWebsiteHref } from "../studio/components/Navbar.js";
|
|
7
|
-
import { c } from "react/compiler-runtime";
|
|
8
|
-
import * as React from "react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { useMutation } from "@tanstack/react-query";
|
|
11
|
-
import { Button } from "@camox/ui/button";
|
|
12
|
-
import { Skeleton } from "@camox/ui/skeleton";
|
|
13
|
-
import { Spinner } from "@camox/ui/spinner";
|
|
14
|
-
import { VOICE_AXES } from "@camox/api-contract/voice";
|
|
15
|
-
import { Slider } from "@camox/ui/slider";
|
|
16
|
-
|
|
17
|
-
//#region src/features/memory/VoiceGroup.tsx
|
|
18
|
-
/**
|
|
19
|
-
* The Voice group, at the top of the Memory Section (ADR 0051): a slider per Voice Axis, showing
|
|
20
|
-
* its chosen step and that step's definition, as models read it. Moving sliders saves nothing:
|
|
21
|
-
* Save shows while they differ from the saved Voice, and saves every moved axis as one change.
|
|
22
|
-
* Like any memory edit, saving while viewing Live starts a draft. "Save and rewrite", beside it,
|
|
23
|
-
* also asks Camox's agent, as the member, to rewrite the site's copy in the new Voice, and shows
|
|
24
|
-
* the draft with its thread beside the Canvas, where the rewrite happens.
|
|
25
|
-
*/
|
|
26
|
-
function VoiceGroup(t0) {
|
|
27
|
-
const $ = c(31);
|
|
28
|
-
const { projectId } = t0;
|
|
29
|
-
let t1;
|
|
30
|
-
if ($[0] !== projectId) {
|
|
31
|
-
t1 = reads.voice({ projectId });
|
|
32
|
-
$[0] = projectId;
|
|
33
|
-
$[1] = t1;
|
|
34
|
-
} else t1 = $[1];
|
|
35
|
-
const { data: saved } = useReadQuery(t1);
|
|
36
|
-
let t2;
|
|
37
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
38
|
-
t2 = {};
|
|
39
|
-
$[2] = t2;
|
|
40
|
-
} else t2 = $[2];
|
|
41
|
-
const [moved, setMoved] = React.useState(t2);
|
|
42
|
-
const cache = useStudioCache();
|
|
43
|
-
const draftScope = useDraftScope();
|
|
44
|
-
const navigate = useNavigate();
|
|
45
|
-
const websiteHref = useWebsiteHref();
|
|
46
|
-
let t3;
|
|
47
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
48
|
-
t3 = memoryMutations.saveVoice();
|
|
49
|
-
$[3] = t3;
|
|
50
|
-
} else t3 = $[3];
|
|
51
|
-
let t4;
|
|
52
|
-
if ($[4] !== cache || $[5] !== draftScope || $[6] !== navigate || $[7] !== projectId || $[8] !== websiteHref) {
|
|
53
|
-
t4 = {
|
|
54
|
-
...t3,
|
|
55
|
-
onSuccess: (_voice, t5) => {
|
|
56
|
-
const { rewrite } = t5;
|
|
57
|
-
setMoved({});
|
|
58
|
-
cache.invalidate(reads.voice({ projectId }));
|
|
59
|
-
if (!rewrite) return;
|
|
60
|
-
previewStore.send({ type: "showCanvas" });
|
|
61
|
-
navigate({
|
|
62
|
-
to: websiteHref(),
|
|
63
|
-
draft: draftScope.current() ?? void 0
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
$[4] = cache;
|
|
68
|
-
$[5] = draftScope;
|
|
69
|
-
$[6] = navigate;
|
|
70
|
-
$[7] = projectId;
|
|
71
|
-
$[8] = websiteHref;
|
|
72
|
-
$[9] = t4;
|
|
73
|
-
} else t4 = $[9];
|
|
74
|
-
const save = useMutation(t4);
|
|
75
|
-
if (!saved) {
|
|
76
|
-
let t5;
|
|
77
|
-
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
78
|
-
t5 = /* @__PURE__ */ jsx(Skeleton, { className: "h-72" });
|
|
79
|
-
$[10] = t5;
|
|
80
|
-
} else t5 = $[10];
|
|
81
|
-
return t5;
|
|
82
|
-
}
|
|
83
|
-
let t5;
|
|
84
|
-
let voice;
|
|
85
|
-
if ($[11] !== moved || $[12] !== saved) {
|
|
86
|
-
voice = {
|
|
87
|
-
...saved,
|
|
88
|
-
...moved
|
|
89
|
-
};
|
|
90
|
-
t5 = changedAxes(saved, voice);
|
|
91
|
-
$[11] = moved;
|
|
92
|
-
$[12] = saved;
|
|
93
|
-
$[13] = t5;
|
|
94
|
-
$[14] = voice;
|
|
95
|
-
} else {
|
|
96
|
-
t5 = $[13];
|
|
97
|
-
voice = $[14];
|
|
98
|
-
}
|
|
99
|
-
const changed = t5;
|
|
100
|
-
let t6;
|
|
101
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
102
|
-
t6 = /* @__PURE__ */ jsxs("header", {
|
|
103
|
-
className: "flex flex-col gap-1",
|
|
104
|
-
children: [/* @__PURE__ */ jsx("h2", {
|
|
105
|
-
id: "camox-voice-title",
|
|
106
|
-
className: "text-sm font-semibold",
|
|
107
|
-
children: "Voice"
|
|
108
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
109
|
-
className: "text-muted-foreground text-xs",
|
|
110
|
-
children: "How the website speaks. Every model that writes for visitors keeps to it."
|
|
111
|
-
})]
|
|
112
|
-
});
|
|
113
|
-
$[15] = t6;
|
|
114
|
-
} else t6 = $[15];
|
|
115
|
-
let t7;
|
|
116
|
-
if ($[16] !== save || $[17] !== voice) {
|
|
117
|
-
t7 = VOICE_AXES.map((axis) => /* @__PURE__ */ jsx(VoiceAxisRow, {
|
|
118
|
-
axis,
|
|
119
|
-
step: voice[axis.key],
|
|
120
|
-
disabled: save.isPending,
|
|
121
|
-
onStep: (step) => {
|
|
122
|
-
setMoved((current) => ({
|
|
123
|
-
...current,
|
|
124
|
-
[axis.key]: step
|
|
125
|
-
}));
|
|
126
|
-
save.reset();
|
|
127
|
-
}
|
|
128
|
-
}, axis.key));
|
|
129
|
-
$[16] = save;
|
|
130
|
-
$[17] = voice;
|
|
131
|
-
$[18] = t7;
|
|
132
|
-
} else t7 = $[18];
|
|
133
|
-
let t8;
|
|
134
|
-
if ($[19] !== t7) {
|
|
135
|
-
t8 = /* @__PURE__ */ jsx("ul", {
|
|
136
|
-
className: "flex flex-col gap-5",
|
|
137
|
-
children: t7
|
|
138
|
-
});
|
|
139
|
-
$[19] = t7;
|
|
140
|
-
$[20] = t8;
|
|
141
|
-
} else t8 = $[20];
|
|
142
|
-
let t9;
|
|
143
|
-
if ($[21] !== save.error) {
|
|
144
|
-
t9 = save.error && /* @__PURE__ */ jsx("p", {
|
|
145
|
-
"data-voice-error": true,
|
|
146
|
-
className: "text-destructive text-xs",
|
|
147
|
-
children: save.error.message
|
|
148
|
-
});
|
|
149
|
-
$[21] = save.error;
|
|
150
|
-
$[22] = t9;
|
|
151
|
-
} else t9 = $[22];
|
|
152
|
-
let t10;
|
|
153
|
-
if ($[23] !== changed || $[24] !== projectId || $[25] !== save) {
|
|
154
|
-
t10 = Object.keys(changed).length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
155
|
-
className: "flex flex-wrap gap-2",
|
|
156
|
-
children: [/* @__PURE__ */ jsxs(Button, {
|
|
157
|
-
disabled: save.isPending,
|
|
158
|
-
onClick: () => save.mutate({
|
|
159
|
-
projectId,
|
|
160
|
-
steps: changed
|
|
161
|
-
}),
|
|
162
|
-
children: [save.isPending && !save.variables?.rewrite && /* @__PURE__ */ jsx(Spinner, {}), "Save"]
|
|
163
|
-
}), /* @__PURE__ */ jsxs(Button, {
|
|
164
|
-
variant: "outline",
|
|
165
|
-
disabled: save.isPending,
|
|
166
|
-
onClick: () => save.mutate({
|
|
167
|
-
projectId,
|
|
168
|
-
steps: changed,
|
|
169
|
-
rewrite: true
|
|
170
|
-
}),
|
|
171
|
-
children: [save.isPending && save.variables?.rewrite && /* @__PURE__ */ jsx(Spinner, {}), "Save and rewrite"]
|
|
172
|
-
})]
|
|
173
|
-
});
|
|
174
|
-
$[23] = changed;
|
|
175
|
-
$[24] = projectId;
|
|
176
|
-
$[25] = save;
|
|
177
|
-
$[26] = t10;
|
|
178
|
-
} else t10 = $[26];
|
|
179
|
-
let t11;
|
|
180
|
-
if ($[27] !== t10 || $[28] !== t8 || $[29] !== t9) {
|
|
181
|
-
t11 = /* @__PURE__ */ jsxs("section", {
|
|
182
|
-
"data-voice": true,
|
|
183
|
-
"aria-labelledby": "camox-voice-title",
|
|
184
|
-
className: "flex flex-col gap-5 rounded-lg border p-4",
|
|
185
|
-
children: [
|
|
186
|
-
t6,
|
|
187
|
-
t8,
|
|
188
|
-
t9,
|
|
189
|
-
t10
|
|
190
|
-
]
|
|
191
|
-
});
|
|
192
|
-
$[27] = t10;
|
|
193
|
-
$[28] = t8;
|
|
194
|
-
$[29] = t9;
|
|
195
|
-
$[30] = t11;
|
|
196
|
-
} else t11 = $[30];
|
|
197
|
-
return t11;
|
|
198
|
-
}
|
|
199
|
-
/** The axes `voice` moves away from `saved`, with their new steps. */
|
|
200
|
-
function changedAxes(saved, voice) {
|
|
201
|
-
const changed = {};
|
|
202
|
-
for (const { key } of VOICE_AXES) if (voice[key] !== saved[key]) changed[key] = voice[key];
|
|
203
|
-
return changed;
|
|
204
|
-
}
|
|
205
|
-
const sentenceCase = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
206
|
-
/** One Voice Axis: its name, its chosen step and that step's definition, over a slider. */
|
|
207
|
-
function VoiceAxisRow(t0) {
|
|
208
|
-
const $ = c(39);
|
|
209
|
-
const { axis, step, disabled, onStep } = t0;
|
|
210
|
-
const steps = axis.steps;
|
|
211
|
-
let t1;
|
|
212
|
-
if ($[0] !== step || $[1] !== steps) {
|
|
213
|
-
let t2;
|
|
214
|
-
if ($[3] !== step) {
|
|
215
|
-
t2 = (candidate) => candidate.key === step;
|
|
216
|
-
$[3] = step;
|
|
217
|
-
$[4] = t2;
|
|
218
|
-
} else t2 = $[4];
|
|
219
|
-
t1 = steps.findIndex(t2);
|
|
220
|
-
$[0] = step;
|
|
221
|
-
$[1] = steps;
|
|
222
|
-
$[2] = t1;
|
|
223
|
-
} else t1 = $[2];
|
|
224
|
-
const index = Math.max(t1, 0);
|
|
225
|
-
const chosen = steps[index];
|
|
226
|
-
let t2;
|
|
227
|
-
if ($[5] !== axis.name) {
|
|
228
|
-
t2 = /* @__PURE__ */ jsx("span", {
|
|
229
|
-
"data-voice-axis-name": true,
|
|
230
|
-
className: "font-medium",
|
|
231
|
-
children: axis.name
|
|
232
|
-
});
|
|
233
|
-
$[5] = axis.name;
|
|
234
|
-
$[6] = t2;
|
|
235
|
-
} else t2 = $[6];
|
|
236
|
-
let t3;
|
|
237
|
-
if ($[7] !== chosen.name) {
|
|
238
|
-
t3 = /* @__PURE__ */ jsx("span", {
|
|
239
|
-
"data-voice-step": true,
|
|
240
|
-
children: chosen.name
|
|
241
|
-
});
|
|
242
|
-
$[7] = chosen.name;
|
|
243
|
-
$[8] = t3;
|
|
244
|
-
} else t3 = $[8];
|
|
245
|
-
let t4;
|
|
246
|
-
if ($[9] !== t2 || $[10] !== t3) {
|
|
247
|
-
t4 = /* @__PURE__ */ jsxs("div", {
|
|
248
|
-
className: "flex items-baseline justify-between gap-3 text-sm",
|
|
249
|
-
children: [t2, t3]
|
|
250
|
-
});
|
|
251
|
-
$[9] = t2;
|
|
252
|
-
$[10] = t3;
|
|
253
|
-
$[11] = t4;
|
|
254
|
-
} else t4 = $[11];
|
|
255
|
-
const t5 = steps.length - 1;
|
|
256
|
-
let t6;
|
|
257
|
-
if ($[12] !== onStep || $[13] !== steps) {
|
|
258
|
-
t6 = (value) => {
|
|
259
|
-
const next = steps[value];
|
|
260
|
-
if (next) onStep(next.key);
|
|
261
|
-
};
|
|
262
|
-
$[12] = onStep;
|
|
263
|
-
$[13] = steps;
|
|
264
|
-
$[14] = t6;
|
|
265
|
-
} else t6 = $[14];
|
|
266
|
-
let t7;
|
|
267
|
-
if ($[15] !== axis.name || $[16] !== chosen.name || $[17] !== disabled || $[18] !== index || $[19] !== steps.length || $[20] !== t5 || $[21] !== t6) {
|
|
268
|
-
t7 = /* @__PURE__ */ jsx(Slider, {
|
|
269
|
-
label: axis.name,
|
|
270
|
-
valueText: chosen.name,
|
|
271
|
-
min: 0,
|
|
272
|
-
max: t5,
|
|
273
|
-
step: 1,
|
|
274
|
-
marks: steps.length,
|
|
275
|
-
value: index,
|
|
276
|
-
disabled,
|
|
277
|
-
onValueChange: t6
|
|
278
|
-
});
|
|
279
|
-
$[15] = axis.name;
|
|
280
|
-
$[16] = chosen.name;
|
|
281
|
-
$[17] = disabled;
|
|
282
|
-
$[18] = index;
|
|
283
|
-
$[19] = steps.length;
|
|
284
|
-
$[20] = t5;
|
|
285
|
-
$[21] = t6;
|
|
286
|
-
$[22] = t7;
|
|
287
|
-
} else t7 = $[22];
|
|
288
|
-
let t8;
|
|
289
|
-
if ($[23] !== steps[0].name) {
|
|
290
|
-
t8 = /* @__PURE__ */ jsx("span", { children: steps[0].name });
|
|
291
|
-
$[23] = steps[0].name;
|
|
292
|
-
$[24] = t8;
|
|
293
|
-
} else t8 = $[24];
|
|
294
|
-
const t9 = steps[steps.length - 1];
|
|
295
|
-
let t10;
|
|
296
|
-
if ($[25] !== t9.name) {
|
|
297
|
-
t10 = /* @__PURE__ */ jsx("span", { children: t9.name });
|
|
298
|
-
$[25] = t9.name;
|
|
299
|
-
$[26] = t10;
|
|
300
|
-
} else t10 = $[26];
|
|
301
|
-
let t11;
|
|
302
|
-
if ($[27] !== t10 || $[28] !== t8) {
|
|
303
|
-
t11 = /* @__PURE__ */ jsxs("div", {
|
|
304
|
-
"aria-hidden": true,
|
|
305
|
-
className: "text-muted-foreground flex justify-between text-[11px]",
|
|
306
|
-
children: [t8, t10]
|
|
307
|
-
});
|
|
308
|
-
$[27] = t10;
|
|
309
|
-
$[28] = t8;
|
|
310
|
-
$[29] = t11;
|
|
311
|
-
} else t11 = $[29];
|
|
312
|
-
let t12;
|
|
313
|
-
if ($[30] !== chosen.definition) {
|
|
314
|
-
t12 = sentenceCase(chosen.definition);
|
|
315
|
-
$[30] = chosen.definition;
|
|
316
|
-
$[31] = t12;
|
|
317
|
-
} else t12 = $[31];
|
|
318
|
-
let t13;
|
|
319
|
-
if ($[32] !== t12) {
|
|
320
|
-
t13 = /* @__PURE__ */ jsx("p", {
|
|
321
|
-
"data-voice-definition": true,
|
|
322
|
-
className: "text-muted-foreground text-xs",
|
|
323
|
-
children: t12
|
|
324
|
-
});
|
|
325
|
-
$[32] = t12;
|
|
326
|
-
$[33] = t13;
|
|
327
|
-
} else t13 = $[33];
|
|
328
|
-
let t14;
|
|
329
|
-
if ($[34] !== t11 || $[35] !== t13 || $[36] !== t4 || $[37] !== t7) {
|
|
330
|
-
t14 = /* @__PURE__ */ jsxs("li", {
|
|
331
|
-
"data-voice-axis": true,
|
|
332
|
-
className: "flex flex-col gap-2",
|
|
333
|
-
children: [
|
|
334
|
-
t4,
|
|
335
|
-
t7,
|
|
336
|
-
t11,
|
|
337
|
-
t13
|
|
338
|
-
]
|
|
339
|
-
});
|
|
340
|
-
$[34] = t11;
|
|
341
|
-
$[35] = t13;
|
|
342
|
-
$[36] = t4;
|
|
343
|
-
$[37] = t7;
|
|
344
|
-
$[38] = t14;
|
|
345
|
-
} else t14 = $[38];
|
|
346
|
-
return t14;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
//#endregion
|
|
350
|
-
export { VoiceGroup };
|