camox 0.54.0 → 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.
- package/dist/features/canvas/CamoxCanvas.js +14 -11
- package/dist/features/canvas/CanvasLoadingScreen.js +1 -1
- package/dist/features/canvas/sidebar/CanvasViewHeader.js +1 -1
- package/dist/features/canvas/sidebar/{CanvasSidebar.js → ContentSidebar.js} +5 -5
- package/dist/features/canvas/sidebar/{CanvasSidebarFrame.js → ContentSidebarFrame.js} +4 -4
- package/dist/features/canvas/sidebar/{CanvasSidebarSkeleton.js → ContentSidebarSkeleton.js} +7 -7
- package/dist/features/preview/CamoxPreview.js +2 -2
- package/dist/features/preview/components/PreviewToolbar.js +1 -1
- package/dist/features/preview/components/SelectionEditor.js +2 -2
- package/dist/features/preview/components/SidebarStack.js +11 -13
- package/dist/features/preview/components/StudioEditingFallback.js +3 -3
- package/dist/features/routes/pageRuntime.d.ts +1 -1
- package/dist/features/runtime/RuntimeChrome.js +4 -4
- package/dist/features/studio/components/AgentSidebar.js +56 -0
- package/dist/features/studio/components/{ChatSidebar.js → ChatWidget.js} +60 -169
- package/dist/features/studio/components/DraftsControl.js +17 -17
- package/dist/features/studio/components/ReviewDraftSheet.js +38 -38
- package/dist/features/studio/components/Squareling.js +10 -8
- package/dist/features/studio/components/ThreadMessages.js +128 -105
- package/dist/features/studio/components/WorkersWidget.js +52 -0
- package/dist/features/studio/studioStore.js +5 -5
- package/dist/lib/queries.js +1 -1
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/SKILL.md +3 -10
- package/skills/camox/references/artifacts.md +2 -2
- package/skills/camox/references/block-definitions.md +1 -1
- package/skills/camox/references/layout-definitions.md +1 -1
- package/skills/camox/references/routed-layouts.md +2 -2
- package/skills/camox-cli/SKILL.md +15 -0
- package/skills/{camox → camox-cli}/references/cli-common.md +1 -1
- package/skills/{camox → camox-cli}/references/cli-content.md +2 -2
- package/skills/{camox → camox-cli}/references/cli-publishing.md +4 -4
- package/skills/camox-expand/SKILL.md +1 -1
- package/skills/camoxify/SKILL.md +1 -1
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { AuthContext } from "../../../lib/auth.js";
|
|
2
2
|
import { useCurrentDraftId, useDraftScope } from "../../../lib/draft-scope.js";
|
|
3
|
-
import { useNavigate } from "../../navigation/navigation.js";
|
|
4
3
|
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
5
4
|
import { cn } from "../../../lib/utils.js";
|
|
6
|
-
import { BOTTOM_CARD_EDGES, CARD_BODY_EDGES
|
|
7
|
-
import { draftLabel } from "../draftLabel.js";
|
|
5
|
+
import { BOTTOM_CARD_EDGES, CARD_BODY_EDGES } from "../../preview/components/SidebarStack.js";
|
|
8
6
|
import { FollowAgentContext } from "../followAgentContext.js";
|
|
9
7
|
import { useThread } from "../../../lib/use-thread.js";
|
|
10
|
-
import { Squareling } from "./Squareling.js";
|
|
11
8
|
import { ThreadComposer } from "./ThreadComposer.js";
|
|
12
9
|
import { ThreadMessages } from "./ThreadMessages.js";
|
|
13
10
|
import { c } from "react/compiler-runtime";
|
|
@@ -15,62 +12,54 @@ import * as React from "react";
|
|
|
15
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
13
|
import { EMPTY_THREAD_VIEW } from "@camox/api-contract/threads";
|
|
17
14
|
|
|
18
|
-
//#region src/features/studio/components/
|
|
15
|
+
//#region src/features/studio/components/ChatWidget.tsx
|
|
19
16
|
/**
|
|
20
|
-
*
|
|
17
|
+
* The Agent Sidebar's Chat widget, where an editor works with Camox's agent in a thread. Elsewhere in the
|
|
21
18
|
* studio it is only hidden: the studio keeps following the editor's runs there. It follows
|
|
22
19
|
* where the studio is: the editor's own Live thread on Live, and the draft's thread in a draft.
|
|
23
20
|
* When the Live thread starts a draft, the studio enters it with the thread.
|
|
24
21
|
*/
|
|
25
|
-
function
|
|
22
|
+
function ChatWidget(t0) {
|
|
26
23
|
const $ = c(6);
|
|
27
|
-
const {
|
|
28
|
-
|
|
24
|
+
const { className } = t0;
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] !== className) {
|
|
27
|
+
t1 = cn("flex flex-col", className);
|
|
28
|
+
$[0] = className;
|
|
29
|
+
$[1] = t1;
|
|
30
|
+
} else t1 = $[1];
|
|
29
31
|
let t2;
|
|
30
32
|
let t3;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
t3 = { width: 265 };
|
|
36
|
-
t4 = /* @__PURE__ */ jsxs("header", {
|
|
37
|
-
className: cn("bg-background flex h-11 min-w-0 shrink-0 items-center justify-center gap-2 px-3", BOTTOM_CARD_EDGES),
|
|
38
|
-
children: [/* @__PURE__ */ jsx(Squareling, {
|
|
39
|
-
status: "idle",
|
|
40
|
-
className: "size-5"
|
|
41
|
-
}), /* @__PURE__ */ jsx("h2", {
|
|
33
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
34
|
+
t2 = /* @__PURE__ */ jsx("header", {
|
|
35
|
+
className: cn("bg-background flex h-11 min-w-0 shrink-0 items-center justify-center px-3", BOTTOM_CARD_EDGES),
|
|
36
|
+
children: /* @__PURE__ */ jsx("h2", {
|
|
42
37
|
className: "truncate text-sm font-medium",
|
|
43
38
|
children: "Agent"
|
|
44
|
-
})
|
|
39
|
+
})
|
|
45
40
|
});
|
|
46
|
-
|
|
41
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
47
42
|
className: cn("bg-background flex min-h-0 flex-1 flex-col", CARD_BODY_EDGES),
|
|
48
43
|
children: /* @__PURE__ */ jsx(CurrentThread, {})
|
|
49
44
|
});
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[2] = t4;
|
|
53
|
-
$[3] = t5;
|
|
45
|
+
$[2] = t2;
|
|
46
|
+
$[3] = t3;
|
|
54
47
|
} else {
|
|
55
|
-
t2 = $[
|
|
56
|
-
t3 = $[
|
|
57
|
-
t4 = $[2];
|
|
58
|
-
t5 = $[3];
|
|
48
|
+
t2 = $[2];
|
|
49
|
+
t3 = $[3];
|
|
59
50
|
}
|
|
60
|
-
let
|
|
61
|
-
if ($[4] !==
|
|
62
|
-
|
|
63
|
-
"aria-label": "
|
|
64
|
-
"data-chat-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
style: t3,
|
|
68
|
-
children: [t4, t5]
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[4] !== t1) {
|
|
53
|
+
t4 = /* @__PURE__ */ jsxs("section", {
|
|
54
|
+
"aria-label": "Chat",
|
|
55
|
+
"data-chat-widget": true,
|
|
56
|
+
className: t1,
|
|
57
|
+
children: [t2, t3]
|
|
69
58
|
});
|
|
70
|
-
$[4] =
|
|
71
|
-
$[5] =
|
|
72
|
-
} else
|
|
73
|
-
return
|
|
59
|
+
$[4] = t1;
|
|
60
|
+
$[5] = t4;
|
|
61
|
+
} else t4 = $[5];
|
|
62
|
+
return t4;
|
|
74
63
|
}
|
|
75
64
|
function CurrentThread() {
|
|
76
65
|
const $ = c(15);
|
|
@@ -149,7 +138,7 @@ function CurrentThread() {
|
|
|
149
138
|
return t6;
|
|
150
139
|
}
|
|
151
140
|
function Thread(t0) {
|
|
152
|
-
const $ = c(
|
|
141
|
+
const $ = c(26);
|
|
153
142
|
const { apiUrl, projectId, draftId, carried, onEnterDraft } = t0;
|
|
154
143
|
let t1;
|
|
155
144
|
if ($[0] !== carried || $[1] !== onEnterDraft) {
|
|
@@ -199,148 +188,50 @@ function Thread(t0) {
|
|
|
199
188
|
const sendFollowing = t5;
|
|
200
189
|
let t6;
|
|
201
190
|
if ($[13] !== sending || $[14] !== view) {
|
|
202
|
-
t6 = {
|
|
191
|
+
t6 = /* @__PURE__ */ jsx(ThreadMessages, {
|
|
203
192
|
view,
|
|
204
193
|
sending
|
|
205
|
-
};
|
|
194
|
+
});
|
|
206
195
|
$[13] = sending;
|
|
207
196
|
$[14] = view;
|
|
208
197
|
$[15] = t6;
|
|
209
198
|
} else t6 = $[15];
|
|
210
|
-
const messages = t6;
|
|
211
|
-
const continuedIn = draftId === null ? view.continuedIn?.draftId : void 0;
|
|
212
199
|
let t7;
|
|
213
|
-
if ($[16] !==
|
|
214
|
-
t7 =
|
|
215
|
-
...messages,
|
|
216
|
-
projectId,
|
|
217
|
-
draftId: continuedIn
|
|
218
|
-
}) : /* @__PURE__ */ jsx(ThreadMessages, { ...messages });
|
|
219
|
-
$[16] = continuedIn;
|
|
220
|
-
$[17] = messages;
|
|
221
|
-
$[18] = projectId;
|
|
222
|
-
$[19] = t7;
|
|
223
|
-
} else t7 = $[19];
|
|
224
|
-
let t8;
|
|
225
|
-
if ($[20] !== error) {
|
|
226
|
-
t8 = error && /* @__PURE__ */ jsx("p", {
|
|
200
|
+
if ($[16] !== error) {
|
|
201
|
+
t7 = error && /* @__PURE__ */ jsx("p", {
|
|
227
202
|
role: "alert",
|
|
228
203
|
className: "text-destructive px-2 pt-2 text-sm",
|
|
229
204
|
children: error
|
|
230
205
|
});
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
} else
|
|
234
|
-
let
|
|
235
|
-
if ($[
|
|
236
|
-
|
|
206
|
+
$[16] = error;
|
|
207
|
+
$[17] = t7;
|
|
208
|
+
} else t7 = $[17];
|
|
209
|
+
let t8;
|
|
210
|
+
if ($[18] !== sendFollowing || $[19] !== stop || $[20] !== view.running) {
|
|
211
|
+
t8 = /* @__PURE__ */ jsx(ThreadComposer, {
|
|
237
212
|
onSend: sendFollowing,
|
|
238
213
|
onStop: stop,
|
|
239
214
|
running: view.running
|
|
240
215
|
});
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
} else
|
|
246
|
-
let
|
|
247
|
-
if ($[
|
|
248
|
-
|
|
216
|
+
$[18] = sendFollowing;
|
|
217
|
+
$[19] = stop;
|
|
218
|
+
$[20] = view.running;
|
|
219
|
+
$[21] = t8;
|
|
220
|
+
} else t8 = $[21];
|
|
221
|
+
let t9;
|
|
222
|
+
if ($[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
|
|
223
|
+
t9 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
224
|
+
t6,
|
|
249
225
|
t7,
|
|
250
|
-
t8
|
|
251
|
-
t9
|
|
226
|
+
t8
|
|
252
227
|
] });
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
} else
|
|
258
|
-
return
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* A fresh Live thread's messages, linking to the draft the editor's previous one continued in,
|
|
262
|
-
* named as the drafts control names it.
|
|
263
|
-
*/
|
|
264
|
-
function ContinuedInMessages(t0) {
|
|
265
|
-
const $ = c(22);
|
|
266
|
-
let draftId;
|
|
267
|
-
let messages;
|
|
268
|
-
let projectId;
|
|
269
|
-
if ($[0] !== t0) {
|
|
270
|
-
({projectId, draftId, ...messages} = t0);
|
|
271
|
-
$[0] = t0;
|
|
272
|
-
$[1] = draftId;
|
|
273
|
-
$[2] = messages;
|
|
274
|
-
$[3] = projectId;
|
|
275
|
-
} else {
|
|
276
|
-
draftId = $[1];
|
|
277
|
-
messages = $[2];
|
|
278
|
-
projectId = $[3];
|
|
279
|
-
}
|
|
280
|
-
const draftScope = useDraftScope();
|
|
281
|
-
const navigate = useNavigate();
|
|
282
|
-
let t1;
|
|
283
|
-
if ($[4] !== draftId || $[5] !== projectId) {
|
|
284
|
-
t1 = reads.draft({
|
|
285
|
-
projectId,
|
|
286
|
-
draftId
|
|
287
|
-
});
|
|
288
|
-
$[4] = draftId;
|
|
289
|
-
$[5] = projectId;
|
|
290
|
-
$[6] = t1;
|
|
291
|
-
} else t1 = $[6];
|
|
292
|
-
const { data: draft } = useReadQuery(t1);
|
|
293
|
-
let t2;
|
|
294
|
-
if ($[7] !== draft) {
|
|
295
|
-
t2 = draft ? draftLabel(draft) : "a draft";
|
|
296
|
-
$[7] = draft;
|
|
297
|
-
$[8] = t2;
|
|
298
|
-
} else t2 = $[8];
|
|
299
|
-
let t3;
|
|
300
|
-
if ($[9] !== draftId || $[10] !== draftScope) {
|
|
301
|
-
t3 = draftScope.hrefFor(window.location.href, { draft: draftId });
|
|
302
|
-
$[9] = draftId;
|
|
303
|
-
$[10] = draftScope;
|
|
304
|
-
$[11] = t3;
|
|
305
|
-
} else t3 = $[11];
|
|
306
|
-
let t4;
|
|
307
|
-
if ($[12] !== draftId || $[13] !== navigate) {
|
|
308
|
-
t4 = (event) => {
|
|
309
|
-
event.preventDefault();
|
|
310
|
-
navigate({
|
|
311
|
-
to: window.location.href,
|
|
312
|
-
draft: draftId
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
|
-
$[12] = draftId;
|
|
316
|
-
$[13] = navigate;
|
|
317
|
-
$[14] = t4;
|
|
318
|
-
} else t4 = $[14];
|
|
319
|
-
let t5;
|
|
320
|
-
if ($[15] !== t2 || $[16] !== t3 || $[17] !== t4) {
|
|
321
|
-
t5 = {
|
|
322
|
-
label: t2,
|
|
323
|
-
href: t3,
|
|
324
|
-
onOpen: t4
|
|
325
|
-
};
|
|
326
|
-
$[15] = t2;
|
|
327
|
-
$[16] = t3;
|
|
328
|
-
$[17] = t4;
|
|
329
|
-
$[18] = t5;
|
|
330
|
-
} else t5 = $[18];
|
|
331
|
-
const link = t5;
|
|
332
|
-
let t6;
|
|
333
|
-
if ($[19] !== link || $[20] !== messages) {
|
|
334
|
-
t6 = /* @__PURE__ */ jsx(ThreadMessages, {
|
|
335
|
-
...messages,
|
|
336
|
-
continuedIn: link
|
|
337
|
-
});
|
|
338
|
-
$[19] = link;
|
|
339
|
-
$[20] = messages;
|
|
340
|
-
$[21] = t6;
|
|
341
|
-
} else t6 = $[21];
|
|
342
|
-
return t6;
|
|
228
|
+
$[22] = t6;
|
|
229
|
+
$[23] = t7;
|
|
230
|
+
$[24] = t8;
|
|
231
|
+
$[25] = t9;
|
|
232
|
+
} else t9 = $[25];
|
|
233
|
+
return t9;
|
|
343
234
|
}
|
|
344
235
|
|
|
345
236
|
//#endregion
|
|
346
|
-
export {
|
|
237
|
+
export { ChatWidget };
|
|
@@ -7,7 +7,7 @@ import { cn } from "../../../lib/utils.js";
|
|
|
7
7
|
import { studioStore } from "../studioStore.js";
|
|
8
8
|
import { draftLabel, plural, timeAgo } from "../draftLabel.js";
|
|
9
9
|
import { RenameDraftDialog } from "./RenameDraftDialog.js";
|
|
10
|
-
import {
|
|
10
|
+
import { DeleteDraftDialog, ReviewDraftSheet, useLeaveDraft } from "./ReviewDraftSheet.js";
|
|
11
11
|
import { c } from "react/compiler-runtime";
|
|
12
12
|
import * as React from "react";
|
|
13
13
|
import { useSelector } from "@xstate/store-react";
|
|
@@ -99,7 +99,7 @@ function useDrafts() {
|
|
|
99
99
|
* Picks what the studio is viewing, Live or a draft (#203). Live is read-only; the first edit
|
|
100
100
|
* starts a draft. The localhost studio works only in the development draft, so it shows that
|
|
101
101
|
* draft alone, with nothing to switch to (ADR 0006). The command palette offers the same actions,
|
|
102
|
-
* and the picker hosts the draft's review and
|
|
102
|
+
* and the picker hosts the draft's review and delete confirmation they open. A `disabled` picker
|
|
103
103
|
* still names what the studio is viewing.
|
|
104
104
|
*/
|
|
105
105
|
function DraftPicker(t0) {
|
|
@@ -110,7 +110,7 @@ function DraftPicker(t0) {
|
|
|
110
110
|
const navigate = useNavigate();
|
|
111
111
|
const leaveDraft = useLeaveDraft();
|
|
112
112
|
const review = useSelector(studioStore, _temp);
|
|
113
|
-
const
|
|
113
|
+
const deleting = useSelector(studioStore, _temp2);
|
|
114
114
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
115
115
|
const [renaming, setRenaming] = React.useState(null);
|
|
116
116
|
let t2;
|
|
@@ -316,20 +316,20 @@ function DraftPicker(t0) {
|
|
|
316
316
|
$[46] = t20;
|
|
317
317
|
} else t20 = $[46];
|
|
318
318
|
let t21;
|
|
319
|
-
if ($[47] !==
|
|
319
|
+
if ($[47] !== deleting || $[48] !== draftId || $[49] !== leaveDraft || $[50] !== projectId || $[51] !== review) {
|
|
320
320
|
t21 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
|
|
321
321
|
projectId,
|
|
322
322
|
draftId,
|
|
323
323
|
open: review.open,
|
|
324
324
|
startRenaming: review.startRenaming,
|
|
325
325
|
onOpenChange: _temp7
|
|
326
|
-
}), /* @__PURE__ */ jsx(
|
|
326
|
+
}), /* @__PURE__ */ jsx(DeleteDraftDialog, {
|
|
327
327
|
projectId,
|
|
328
|
-
open:
|
|
328
|
+
open: deleting,
|
|
329
329
|
onOpenChange: _temp8,
|
|
330
|
-
|
|
330
|
+
onDeleted: leaveDraft
|
|
331
331
|
})] });
|
|
332
|
-
$[47] =
|
|
332
|
+
$[47] = deleting;
|
|
333
333
|
$[48] = draftId;
|
|
334
334
|
$[49] = leaveDraft;
|
|
335
335
|
$[50] = projectId;
|
|
@@ -351,7 +351,7 @@ function DraftPicker(t0) {
|
|
|
351
351
|
return t22;
|
|
352
352
|
}
|
|
353
353
|
function _temp8(open_1) {
|
|
354
|
-
if (!open_1) studioStore.send({ type: "
|
|
354
|
+
if (!open_1) studioStore.send({ type: "closeDeleteDraftDialog" });
|
|
355
355
|
}
|
|
356
356
|
function _temp7(open_0) {
|
|
357
357
|
if (!open_0) studioStore.send({ type: "closeReviewDraftSheet" });
|
|
@@ -364,20 +364,20 @@ function _temp5() {
|
|
|
364
364
|
}
|
|
365
365
|
function _temp4() {
|
|
366
366
|
studioStore.send({ type: "closeReviewDraftSheet" });
|
|
367
|
-
studioStore.send({ type: "
|
|
367
|
+
studioStore.send({ type: "closeDeleteDraftDialog" });
|
|
368
368
|
}
|
|
369
369
|
function _temp3(t0) {
|
|
370
370
|
const { move } = t0;
|
|
371
371
|
if (move === "started") toast.success("Started a new draft");
|
|
372
372
|
}
|
|
373
373
|
function _temp2(state_0) {
|
|
374
|
-
return state_0.context.
|
|
374
|
+
return state_0.context.isDeleteDraftDialogOpen;
|
|
375
375
|
}
|
|
376
376
|
function _temp(state) {
|
|
377
377
|
return state.context.reviewDraftSheet;
|
|
378
378
|
}
|
|
379
379
|
/**
|
|
380
|
-
* The current draft's pending changes, which open its review to publish or
|
|
380
|
+
* The current draft's pending changes, which open its review to publish or delete them. Live
|
|
381
381
|
* has none, so it shows nothing there.
|
|
382
382
|
*/
|
|
383
383
|
function PendingChanges() {
|
|
@@ -418,8 +418,8 @@ function _temp9() {
|
|
|
418
418
|
return studioStore.send({ type: "openReviewDraftSheet" });
|
|
419
419
|
}
|
|
420
420
|
/**
|
|
421
|
-
* The drafts controls' actions in the command palette, offered where the controls offer them. The palette only opens the review and the
|
|
422
|
-
*
|
|
421
|
+
* The drafts controls' actions in the command palette, offered where the controls offer them. The palette only opens the review and the delete confirmation; it never publishes or
|
|
422
|
+
* deletes by itself.
|
|
423
423
|
*/
|
|
424
424
|
function useDraftsActions(t0) {
|
|
425
425
|
const $ = c(7);
|
|
@@ -446,8 +446,8 @@ function useDraftsActions(t0) {
|
|
|
446
446
|
execute: _temp10
|
|
447
447
|
},
|
|
448
448
|
{
|
|
449
|
-
id: "
|
|
450
|
-
label: "
|
|
449
|
+
id: "delete-draft",
|
|
450
|
+
label: "Delete draft…",
|
|
451
451
|
aliases: [
|
|
452
452
|
"Delete draft",
|
|
453
453
|
"Throw away changes",
|
|
@@ -546,7 +546,7 @@ function _temp12() {
|
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
function _temp11() {
|
|
549
|
-
return studioStore.send({ type: "
|
|
549
|
+
return studioStore.send({ type: "openDeleteDraftDialog" });
|
|
550
550
|
}
|
|
551
551
|
function _temp10() {
|
|
552
552
|
return studioStore.send({ type: "openReviewDraftSheet" });
|
|
@@ -965,7 +965,7 @@ function _temp7(error) {
|
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
967
|
* Switches the studio to Live once its draft ended here, replacing the draft's URL entry. A
|
|
968
|
-
* development draft never ends: publishing or
|
|
968
|
+
* development draft never ends: publishing or deleting empties it, and dev mode stays in it.
|
|
969
969
|
*/
|
|
970
970
|
function useLeaveDraft() {
|
|
971
971
|
const $ = c(2);
|
|
@@ -1077,7 +1077,7 @@ function DraftNameInput(t0) {
|
|
|
1077
1077
|
return t7;
|
|
1078
1078
|
}
|
|
1079
1079
|
/**
|
|
1080
|
-
* Reviews a draft before publishing it whole, or
|
|
1080
|
+
* Reviews a draft before publishing it whole, or deletes it (ADR 0009). Publishing sends back
|
|
1081
1081
|
* the token of the preview shown; when Live changed since, nothing is published and the new
|
|
1082
1082
|
* preview is shown. Once the draft ends, the studio switches to Live.
|
|
1083
1083
|
*/
|
|
@@ -1085,7 +1085,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1085
1085
|
const $ = c(101);
|
|
1086
1086
|
const { projectId, draftId, open, startRenaming: t1, onOpenChange } = t0;
|
|
1087
1087
|
const startRenaming = t1 === void 0 ? false : t1;
|
|
1088
|
-
const [
|
|
1088
|
+
const [confirmingDelete, setConfirmingDelete] = React.useState(false);
|
|
1089
1089
|
let t2;
|
|
1090
1090
|
if ($[0] !== draftId || $[1] !== projectId) {
|
|
1091
1091
|
t2 = reads.publishPreview({
|
|
@@ -1391,7 +1391,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1391
1391
|
let t23;
|
|
1392
1392
|
let t24;
|
|
1393
1393
|
if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1394
|
-
t23 = () =>
|
|
1394
|
+
t23 = () => setConfirmingDelete(true);
|
|
1395
1395
|
t24 = /* @__PURE__ */ jsx(Trash2, {});
|
|
1396
1396
|
$[61] = t23;
|
|
1397
1397
|
$[62] = t24;
|
|
@@ -1406,7 +1406,7 @@ function ReviewDraftSheet(t0) {
|
|
|
1406
1406
|
className: "text-destructive",
|
|
1407
1407
|
disabled: busy,
|
|
1408
1408
|
onClick: t23,
|
|
1409
|
-
children: [t24, "
|
|
1409
|
+
children: [t24, "Delete draft"]
|
|
1410
1410
|
});
|
|
1411
1411
|
$[63] = busy;
|
|
1412
1412
|
$[64] = t25;
|
|
@@ -1506,14 +1506,14 @@ function ReviewDraftSheet(t0) {
|
|
|
1506
1506
|
$[93] = t34;
|
|
1507
1507
|
} else t34 = $[93];
|
|
1508
1508
|
let t35;
|
|
1509
|
-
if ($[94] !==
|
|
1510
|
-
t35 = /* @__PURE__ */ jsx(
|
|
1509
|
+
if ($[94] !== confirmingDelete || $[95] !== leave || $[96] !== projectId) {
|
|
1510
|
+
t35 = /* @__PURE__ */ jsx(DeleteDraftDialog, {
|
|
1511
1511
|
projectId,
|
|
1512
|
-
open:
|
|
1513
|
-
onOpenChange:
|
|
1514
|
-
|
|
1512
|
+
open: confirmingDelete,
|
|
1513
|
+
onOpenChange: setConfirmingDelete,
|
|
1514
|
+
onDeleted: leave
|
|
1515
1515
|
});
|
|
1516
|
-
$[94] =
|
|
1516
|
+
$[94] = confirmingDelete;
|
|
1517
1517
|
$[95] = leave;
|
|
1518
1518
|
$[96] = projectId;
|
|
1519
1519
|
$[97] = t35;
|
|
@@ -1527,78 +1527,78 @@ function ReviewDraftSheet(t0) {
|
|
|
1527
1527
|
} else t36 = $[100];
|
|
1528
1528
|
return t36;
|
|
1529
1529
|
}
|
|
1530
|
-
/** Asks before
|
|
1531
|
-
function
|
|
1530
|
+
/** Asks before deleting the draft the studio is in, then deletes it. */
|
|
1531
|
+
function DeleteDraftDialog(t0) {
|
|
1532
1532
|
const $ = c(26);
|
|
1533
|
-
const { projectId, open, onOpenChange,
|
|
1533
|
+
const { projectId, open, onOpenChange, onDeleted } = t0;
|
|
1534
1534
|
let t1;
|
|
1535
1535
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1536
|
-
t1 = draftMutations.
|
|
1536
|
+
t1 = draftMutations.delete();
|
|
1537
1537
|
$[0] = t1;
|
|
1538
1538
|
} else t1 = $[0];
|
|
1539
1539
|
let t2;
|
|
1540
|
-
if ($[1] !==
|
|
1540
|
+
if ($[1] !== onDeleted || $[2] !== onOpenChange) {
|
|
1541
1541
|
t2 = {
|
|
1542
1542
|
...t1,
|
|
1543
1543
|
onSuccess: (t3) => {
|
|
1544
1544
|
const { ended } = t3;
|
|
1545
1545
|
onOpenChange(false);
|
|
1546
|
-
|
|
1546
|
+
onDeleted(ended);
|
|
1547
1547
|
},
|
|
1548
1548
|
onError: _temp10
|
|
1549
1549
|
};
|
|
1550
|
-
$[1] =
|
|
1550
|
+
$[1] = onDeleted;
|
|
1551
1551
|
$[2] = onOpenChange;
|
|
1552
1552
|
$[3] = t2;
|
|
1553
1553
|
} else t2 = $[3];
|
|
1554
|
-
const
|
|
1554
|
+
const deleteDraft = useMutation(t2);
|
|
1555
1555
|
let t3;
|
|
1556
|
-
if ($[4] !==
|
|
1556
|
+
if ($[4] !== deleteDraft.isPending || $[5] !== onOpenChange) {
|
|
1557
1557
|
t3 = (next) => {
|
|
1558
|
-
if (!
|
|
1558
|
+
if (!deleteDraft.isPending) onOpenChange(next);
|
|
1559
1559
|
};
|
|
1560
|
-
$[4] =
|
|
1560
|
+
$[4] = deleteDraft.isPending;
|
|
1561
1561
|
$[5] = onOpenChange;
|
|
1562
1562
|
$[6] = t3;
|
|
1563
1563
|
} else t3 = $[6];
|
|
1564
1564
|
let t4;
|
|
1565
1565
|
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1566
|
-
t4 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "
|
|
1566
|
+
t4 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete this draft?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Every change in this draft is deleted for everyone. Live stays as it is. This can't be undone." })] });
|
|
1567
1567
|
$[7] = t4;
|
|
1568
1568
|
} else t4 = $[7];
|
|
1569
1569
|
let t5;
|
|
1570
|
-
if ($[8] !==
|
|
1570
|
+
if ($[8] !== deleteDraft.isPending) {
|
|
1571
1571
|
t5 = /* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
1572
1572
|
variant: "outline",
|
|
1573
1573
|
size: "default",
|
|
1574
|
-
disabled:
|
|
1574
|
+
disabled: deleteDraft.isPending,
|
|
1575
1575
|
children: "Cancel"
|
|
1576
1576
|
});
|
|
1577
|
-
$[8] =
|
|
1577
|
+
$[8] = deleteDraft.isPending;
|
|
1578
1578
|
$[9] = t5;
|
|
1579
1579
|
} else t5 = $[9];
|
|
1580
1580
|
let t6;
|
|
1581
|
-
if ($[10] !==
|
|
1582
|
-
t6 = () =>
|
|
1583
|
-
$[10] =
|
|
1581
|
+
if ($[10] !== deleteDraft || $[11] !== projectId) {
|
|
1582
|
+
t6 = () => deleteDraft.mutate({ projectId });
|
|
1583
|
+
$[10] = deleteDraft;
|
|
1584
1584
|
$[11] = projectId;
|
|
1585
1585
|
$[12] = t6;
|
|
1586
1586
|
} else t6 = $[12];
|
|
1587
1587
|
let t7;
|
|
1588
|
-
if ($[13] !==
|
|
1589
|
-
t7 =
|
|
1590
|
-
$[13] =
|
|
1588
|
+
if ($[13] !== deleteDraft.isPending) {
|
|
1589
|
+
t7 = deleteDraft.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1590
|
+
$[13] = deleteDraft.isPending;
|
|
1591
1591
|
$[14] = t7;
|
|
1592
1592
|
} else t7 = $[14];
|
|
1593
1593
|
let t8;
|
|
1594
|
-
if ($[15] !==
|
|
1594
|
+
if ($[15] !== deleteDraft.isPending || $[16] !== t6 || $[17] !== t7) {
|
|
1595
1595
|
t8 = /* @__PURE__ */ jsxs(AlertDialogAction, {
|
|
1596
1596
|
variant: "destructive",
|
|
1597
|
-
disabled:
|
|
1597
|
+
disabled: deleteDraft.isPending,
|
|
1598
1598
|
onClick: t6,
|
|
1599
|
-
children: [t7, "
|
|
1599
|
+
children: [t7, "Delete draft"]
|
|
1600
1600
|
});
|
|
1601
|
-
$[15] =
|
|
1601
|
+
$[15] = deleteDraft.isPending;
|
|
1602
1602
|
$[16] = t6;
|
|
1603
1603
|
$[17] = t7;
|
|
1604
1604
|
$[18] = t8;
|
|
@@ -1625,8 +1625,8 @@ function DiscardDraftDialog(t0) {
|
|
|
1625
1625
|
return t10;
|
|
1626
1626
|
}
|
|
1627
1627
|
function _temp10(error) {
|
|
1628
|
-
return toast.error(error.message || "Could not
|
|
1628
|
+
return toast.error(error.message || "Could not delete the draft");
|
|
1629
1629
|
}
|
|
1630
1630
|
|
|
1631
1631
|
//#endregion
|
|
1632
|
-
export {
|
|
1632
|
+
export { DeleteDraftDialog, ReviewDraftSheet, useLeaveDraft };
|
|
@@ -9,8 +9,8 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
* animations live in `studio.css`.
|
|
10
10
|
*/
|
|
11
11
|
function Squareling(t0) {
|
|
12
|
-
const $ = c(
|
|
13
|
-
const { status, className } = t0;
|
|
12
|
+
const $ = c(18);
|
|
13
|
+
const { status, className, ref } = t0;
|
|
14
14
|
let t1;
|
|
15
15
|
if ($[0] !== className) {
|
|
16
16
|
t1 = cn("squareling shrink-0 overflow-visible", className);
|
|
@@ -94,19 +94,21 @@ function Squareling(t0) {
|
|
|
94
94
|
$[12] = t6;
|
|
95
95
|
} else t6 = $[12];
|
|
96
96
|
let t7;
|
|
97
|
-
if ($[13] !==
|
|
97
|
+
if ($[13] !== ref || $[14] !== status || $[15] !== t1 || $[16] !== t6) {
|
|
98
98
|
t7 = /* @__PURE__ */ jsx("svg", {
|
|
99
|
+
ref,
|
|
99
100
|
viewBox: "0 0 100 100",
|
|
100
101
|
"aria-hidden": true,
|
|
101
102
|
"data-squareling": status,
|
|
102
103
|
className: t1,
|
|
103
104
|
children: t6
|
|
104
105
|
});
|
|
105
|
-
$[13] =
|
|
106
|
-
$[14] =
|
|
107
|
-
$[15] =
|
|
108
|
-
$[16] =
|
|
109
|
-
|
|
106
|
+
$[13] = ref;
|
|
107
|
+
$[14] = status;
|
|
108
|
+
$[15] = t1;
|
|
109
|
+
$[16] = t6;
|
|
110
|
+
$[17] = t7;
|
|
111
|
+
} else t7 = $[17];
|
|
110
112
|
return t7;
|
|
111
113
|
}
|
|
112
114
|
|