camox 0.68.0 → 0.71.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 (34) hide show
  1. package/dist/core/createBlock.js +14 -7
  2. package/dist/core/hooks/useArtifactHost.js +56 -46
  3. package/dist/core/lib/artifact.d.ts +4 -0
  4. package/dist/core/lib/artifactHost.js +40 -0
  5. package/dist/core/lib/artifactRuntime.js +20 -1
  6. package/dist/features/canvas/canvasFrameDocument.js +25 -2
  7. package/dist/features/canvas/useCanvasFrame.js +6 -2
  8. package/dist/features/preview/components/previewStyles.js +11 -2
  9. package/dist/features/provider/AuthenticatedCamoxProvider.js +33 -28
  10. package/dist/features/renderer/RendererApp.js +202 -154
  11. package/dist/features/renderer/RendererFrames.js +87 -55
  12. package/dist/features/renderer/definitionAnswers.js +1 -0
  13. package/dist/features/renderer/rendererHost.js +4 -0
  14. package/dist/features/renderer/studioConnection.js +9 -1
  15. package/dist/features/runtime/pageApp.js +7 -3
  16. package/dist/features/runtime/pageNavigation.js +93 -17
  17. package/dist/features/runtime/rendererClient.js +13 -6
  18. package/dist/features/studio/agentRunToast.js +71 -0
  19. package/dist/features/studio/components/ChatWidget.js +2 -0
  20. package/dist/features/studio/components/DraftBar.js +2 -3
  21. package/dist/features/studio/components/DraftsControl.js +181 -198
  22. package/dist/features/studio/components/LocalePicker.js +22 -4
  23. package/dist/features/studio/components/ReviewDraftSheet.js +345 -568
  24. package/dist/features/studio/draftLabel.js +1 -1
  25. package/dist/features/studio/studioStore.js +5 -17
  26. package/dist/features/studio/viewSwitch.js +62 -0
  27. package/dist/lib/auth.js +5 -1
  28. package/dist/lib/draft-scope.js +28 -15
  29. package/dist/lib/studio-reads.js +46 -13
  30. package/dist/lib/view-switch.js +64 -0
  31. package/dist/package.js +1 -1
  32. package/dist/studio.css +1 -1
  33. package/package.json +6 -4
  34. package/skills/camox/references/artifacts.md +85 -1
@@ -6,7 +6,8 @@ import { reads, useReadQuery } from "../../../lib/studio-reads.js";
6
6
  import { cn } from "../../../lib/utils.js";
7
7
  import { studioStore } from "../studioStore.js";
8
8
  import { draftLabel, plural, timeAgo } from "../draftLabel.js";
9
- import { DeleteDraftDialog, ReviewDraftSheet, useLeaveDraft } from "./ReviewDraftSheet.js";
9
+ import { useLeaveDraft, useSwitchView } from "../viewSwitch.js";
10
+ import { DeleteDraftDialog, ReviewDraftSheet } from "./ReviewDraftSheet.js";
10
11
  import { c } from "react/compiler-runtime";
11
12
  import * as React from "react";
12
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -103,7 +104,8 @@ function DraftPicker(t0) {
103
104
  const { draftScope, draftId, projectId, list, current } = useDrafts();
104
105
  const navigate = useNavigate();
105
106
  const leaveDraft = useLeaveDraft();
106
- const review = useSelector(studioStore, _temp);
107
+ const switchView = useSwitchView();
108
+ const reviewing = useSelector(studioStore, _temp);
107
109
  const deleting = useSelector(studioStore, _temp2);
108
110
  let t2;
109
111
  let t3;
@@ -134,229 +136,230 @@ function DraftPicker(t0) {
134
136
  } else t5 = $[6];
135
137
  const drafts = t5;
136
138
  let t6;
137
- if ($[7] !== draftId || $[8] !== navigate) {
139
+ if ($[7] !== draftId || $[8] !== drafts || $[9] !== navigate || $[10] !== switchView) {
138
140
  t6 = (next) => {
139
141
  if (next === draftId) return;
140
- navigate({
142
+ const target = next ? drafts.find((draft) => draft.id === next) : void 0;
143
+ const label = next ? target ? draftLabel(target) : "the draft" : "Live";
144
+ switchView(() => navigate({
141
145
  to: window.location.href,
142
146
  draft: next
147
+ }), {
148
+ loading: `Switching to ${label}…`,
149
+ success: `You're now viewing ${label}.`
143
150
  });
144
151
  };
145
152
  $[7] = draftId;
146
- $[8] = navigate;
147
- $[9] = t6;
148
- } else t6 = $[9];
153
+ $[8] = drafts;
154
+ $[9] = navigate;
155
+ $[10] = switchView;
156
+ $[11] = t6;
157
+ } else t6 = $[11];
149
158
  const switchTo = t6;
150
159
  const t7 = !!projectId;
151
- const t8 = current?.name === null;
152
- let t9;
153
- if ($[10] !== draftId || $[11] !== drafts || $[12] !== switchTo || $[13] !== t7 || $[14] !== t8) {
154
- t9 = {
160
+ let t8;
161
+ if ($[12] !== draftId || $[13] !== drafts || $[14] !== switchTo || $[15] !== t7) {
162
+ t8 = {
155
163
  enabled: t7,
156
164
  draftId,
157
- unnamed: t8,
158
165
  drafts,
159
166
  switchTo
160
167
  };
161
- $[10] = draftId;
162
- $[11] = drafts;
163
- $[12] = switchTo;
164
- $[13] = t7;
165
- $[14] = t8;
166
- $[15] = t9;
167
- } else t9 = $[15];
168
- useDraftsActions(t9);
168
+ $[12] = draftId;
169
+ $[13] = drafts;
170
+ $[14] = switchTo;
171
+ $[15] = t7;
172
+ $[16] = t8;
173
+ } else t8 = $[16];
174
+ useDraftsActions(t8);
169
175
  if (draftId && !current) return null;
170
- let t10;
171
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
172
- t10 = /* @__PURE__ */ jsx(Button, {
176
+ let t9;
177
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
178
+ t9 = /* @__PURE__ */ jsx(Button, {
173
179
  type: "button",
174
180
  variant: "ghost"
175
181
  });
176
- $[16] = t10;
177
- } else t10 = $[16];
178
- const t11 = draftId ? "bg-blue-500" : "bg-emerald-500";
182
+ $[17] = t9;
183
+ } else t9 = $[17];
184
+ const t10 = draftId ? "bg-blue-500" : "bg-emerald-500";
185
+ let t11;
186
+ if ($[18] !== t10) {
187
+ t11 = cn("size-2 shrink-0 rounded-full", t10);
188
+ $[18] = t10;
189
+ $[19] = t11;
190
+ } else t11 = $[19];
179
191
  let t12;
180
- if ($[17] !== t11) {
181
- t12 = cn("size-2 shrink-0 rounded-full", t11);
182
- $[17] = t11;
183
- $[18] = t12;
184
- } else t12 = $[18];
185
- let t13;
186
- if ($[19] !== t12) {
187
- t13 = /* @__PURE__ */ jsx("span", {
192
+ if ($[20] !== t11) {
193
+ t12 = /* @__PURE__ */ jsx("span", {
188
194
  "aria-hidden": true,
189
- className: t12
195
+ className: t11
190
196
  });
191
- $[19] = t12;
192
- $[20] = t13;
193
- } else t13 = $[20];
197
+ $[20] = t11;
198
+ $[21] = t12;
199
+ } else t12 = $[21];
200
+ let t13;
201
+ if ($[22] !== current || $[23] !== draftId) {
202
+ t13 = draftId ? draftLabel(current) : "Live";
203
+ $[22] = current;
204
+ $[23] = draftId;
205
+ $[24] = t13;
206
+ } else t13 = $[24];
194
207
  let t14;
195
- if ($[21] !== current || $[22] !== draftId) {
196
- t14 = draftId ? draftLabel(current) : "Live";
197
- $[21] = current;
198
- $[22] = draftId;
199
- $[23] = t14;
200
- } else t14 = $[23];
201
- let t15;
202
- if ($[24] !== t14) {
203
- t15 = /* @__PURE__ */ jsx("span", {
208
+ if ($[25] !== t13) {
209
+ t14 = /* @__PURE__ */ jsx("span", {
204
210
  className: "max-w-48 truncate",
205
- children: t14
211
+ children: t13
206
212
  });
207
- $[24] = t14;
208
- $[25] = t15;
209
- } else t15 = $[25];
210
- let t16;
211
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
212
- t16 = /* @__PURE__ */ jsx(ChevronsUpDown, {
213
+ $[25] = t13;
214
+ $[26] = t14;
215
+ } else t14 = $[26];
216
+ let t15;
217
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
218
+ t15 = /* @__PURE__ */ jsx(ChevronsUpDown, {
213
219
  "aria-hidden": true,
214
220
  className: "size-4 opacity-50"
215
221
  });
216
- $[26] = t16;
217
- } else t16 = $[26];
218
- let t17;
219
- if ($[27] !== disabled || $[28] !== t13 || $[29] !== t15) {
220
- t17 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
222
+ $[27] = t15;
223
+ } else t15 = $[27];
224
+ let t16;
225
+ if ($[28] !== disabled || $[29] !== t12 || $[30] !== t14) {
226
+ t16 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
221
227
  disabled,
222
- render: t10,
228
+ render: t9,
223
229
  children: [
224
- t13,
225
- t15,
226
- t16
230
+ t12,
231
+ t14,
232
+ t15
227
233
  ]
228
234
  });
229
- $[27] = disabled;
230
- $[28] = t13;
231
- $[29] = t15;
232
- $[30] = t17;
233
- } else t17 = $[30];
234
- let t18;
235
- if ($[31] !== draftId) {
236
- t18 = !draftId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
235
+ $[28] = disabled;
236
+ $[29] = t12;
237
+ $[30] = t14;
238
+ $[31] = t16;
239
+ } else t16 = $[31];
240
+ let t17;
241
+ if ($[32] !== draftId) {
242
+ t17 = !draftId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
237
243
  className: "text-muted-foreground font-normal",
238
244
  children: "Live is read-only. Your first edit starts a new draft."
239
245
  }) }), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] });
240
- $[31] = draftId;
241
- $[32] = t18;
242
- } else t18 = $[32];
243
- const t19 = draftId ?? LIVE;
246
+ $[32] = draftId;
247
+ $[33] = t17;
248
+ } else t17 = $[33];
249
+ const t18 = draftId ?? LIVE;
250
+ let t19;
251
+ if ($[34] !== switchTo) {
252
+ t19 = (value) => switchTo(value === LIVE ? null : String(value));
253
+ $[34] = switchTo;
254
+ $[35] = t19;
255
+ } else t19 = $[35];
244
256
  let t20;
245
- if ($[33] !== switchTo) {
246
- t20 = (value) => switchTo(value === LIVE ? null : String(value));
247
- $[33] = switchTo;
248
- $[34] = t20;
249
- } else t20 = $[34];
257
+ if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
258
+ t20 = /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Switch to" });
259
+ $[36] = t20;
260
+ } else t20 = $[36];
250
261
  let t21;
251
- if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
252
- t21 = /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Switch to" });
253
- $[35] = t21;
254
- } else t21 = $[35];
262
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
263
+ t21 = /* @__PURE__ */ jsx("span", { children: "Live" });
264
+ $[37] = t21;
265
+ } else t21 = $[37];
255
266
  let t22;
256
- if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
257
- t22 = /* @__PURE__ */ jsx("span", { children: "Live" });
258
- $[36] = t22;
259
- } else t22 = $[36];
260
- let t23;
261
- if ($[37] !== list) {
262
- t23 = list && /* @__PURE__ */ jsx("span", {
267
+ if ($[38] !== list) {
268
+ t22 = list && /* @__PURE__ */ jsx("span", {
263
269
  className: "text-muted-foreground text-xs",
264
270
  children: liveLine(list.live)
265
271
  });
266
- $[37] = list;
267
- $[38] = t23;
268
- } else t23 = $[38];
269
- let t24;
270
- if ($[39] !== t23) {
271
- t24 = /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
272
+ $[38] = list;
273
+ $[39] = t22;
274
+ } else t22 = $[39];
275
+ let t23;
276
+ if ($[40] !== t22) {
277
+ t23 = /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
272
278
  value: LIVE,
273
279
  closeOnClick: true,
274
280
  children: /* @__PURE__ */ jsxs("div", {
275
281
  className: "flex flex-col",
276
- children: [t22, t23]
282
+ children: [t21, t22]
277
283
  })
278
284
  });
279
- $[39] = t23;
280
- $[40] = t24;
281
- } else t24 = $[40];
285
+ $[40] = t22;
286
+ $[41] = t23;
287
+ } else t23 = $[41];
288
+ let t24;
289
+ if ($[42] !== drafts) {
290
+ t24 = drafts.map(_temp6);
291
+ $[42] = drafts;
292
+ $[43] = t24;
293
+ } else t24 = $[43];
282
294
  let t25;
283
- if ($[41] !== drafts) {
284
- t25 = drafts.map(_temp6);
285
- $[41] = drafts;
286
- $[42] = t25;
287
- } else t25 = $[42];
288
- let t26;
289
- if ($[43] !== t24 || $[44] !== t25) {
290
- t26 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
291
- t21,
292
- t24,
293
- t25
295
+ if ($[44] !== t23 || $[45] !== t24) {
296
+ t25 = /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
297
+ t20,
298
+ t23,
299
+ t24
294
300
  ] });
295
- $[43] = t24;
296
- $[44] = t25;
297
- $[45] = t26;
298
- } else t26 = $[45];
299
- let t27;
300
- if ($[46] !== t19 || $[47] !== t20 || $[48] !== t26) {
301
- t27 = /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
302
- value: t19,
303
- onValueChange: t20,
304
- children: t26
301
+ $[44] = t23;
302
+ $[45] = t24;
303
+ $[46] = t25;
304
+ } else t25 = $[46];
305
+ let t26;
306
+ if ($[47] !== t18 || $[48] !== t19 || $[49] !== t25) {
307
+ t26 = /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
308
+ value: t18,
309
+ onValueChange: t19,
310
+ children: t25
305
311
  });
306
- $[46] = t19;
307
- $[47] = t20;
308
- $[48] = t26;
309
- $[49] = t27;
310
- } else t27 = $[49];
311
- let t28;
312
- if ($[50] !== t18 || $[51] !== t27) {
313
- t28 = /* @__PURE__ */ jsx(DropdownMenuContent, {
312
+ $[47] = t18;
313
+ $[48] = t19;
314
+ $[49] = t25;
315
+ $[50] = t26;
316
+ } else t26 = $[50];
317
+ let t27;
318
+ if ($[51] !== t17 || $[52] !== t26) {
319
+ t27 = /* @__PURE__ */ jsx(DropdownMenuContent, {
314
320
  className: "w-80",
315
321
  align: "start",
316
- children: /* @__PURE__ */ jsxs(Fragment, { children: [t18, t27] })
322
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [t17, t26] })
317
323
  });
318
- $[50] = t18;
319
- $[51] = t27;
320
- $[52] = t28;
321
- } else t28 = $[52];
324
+ $[51] = t17;
325
+ $[52] = t26;
326
+ $[53] = t27;
327
+ } else t27 = $[53];
328
+ let t28;
329
+ if ($[54] !== t16 || $[55] !== t27) {
330
+ t28 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t16, t27] });
331
+ $[54] = t16;
332
+ $[55] = t27;
333
+ $[56] = t28;
334
+ } else t28 = $[56];
322
335
  let t29;
323
- if ($[53] !== t17 || $[54] !== t28) {
324
- t29 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t17, t28] });
325
- $[53] = t17;
326
- $[54] = t28;
327
- $[55] = t29;
328
- } else t29 = $[55];
329
- let t30;
330
- if ($[56] !== current?.name || $[57] !== deleting || $[58] !== draftId || $[59] !== leaveDraft || $[60] !== projectId || $[61] !== review) {
331
- t30 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
336
+ if ($[57] !== deleting || $[58] !== draftId || $[59] !== leaveDraft || $[60] !== projectId || $[61] !== reviewing) {
337
+ t29 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
332
338
  projectId,
333
339
  draftId,
334
- open: review.open,
335
- startRenaming: review.startRenaming,
340
+ open: reviewing,
336
341
  onOpenChange: _temp7
337
342
  }), /* @__PURE__ */ jsx(DeleteDraftDialog, {
338
343
  projectId,
339
344
  open: deleting,
340
- discard: current?.name === null,
341
345
  onOpenChange: _temp8,
342
- onDeleted: (ended) => leaveDraft(ended, { discarded: current?.name === null })
346
+ onDeleted: leaveDraft
343
347
  })] });
344
- $[56] = current?.name;
345
348
  $[57] = deleting;
346
349
  $[58] = draftId;
347
350
  $[59] = leaveDraft;
348
351
  $[60] = projectId;
349
- $[61] = review;
350
- $[62] = t30;
351
- } else t30 = $[62];
352
- let t31;
353
- if ($[63] !== t29 || $[64] !== t30) {
354
- t31 = /* @__PURE__ */ jsxs(Fragment, { children: [t29, t30] });
355
- $[63] = t29;
356
- $[64] = t30;
357
- $[65] = t31;
358
- } else t31 = $[65];
359
- return t31;
352
+ $[61] = reviewing;
353
+ $[62] = t29;
354
+ } else t29 = $[62];
355
+ let t30;
356
+ if ($[63] !== t28 || $[64] !== t29) {
357
+ t30 = /* @__PURE__ */ jsxs(Fragment, { children: [t28, t29] });
358
+ $[63] = t28;
359
+ $[64] = t29;
360
+ $[65] = t30;
361
+ } else t30 = $[65];
362
+ return t30;
360
363
  }
361
364
  function _temp8(open_0) {
362
365
  if (!open_0) studioStore.send({ type: "closeDeleteDraftDialog" });
@@ -364,8 +367,8 @@ function _temp8(open_0) {
364
367
  function _temp7(open) {
365
368
  if (!open) studioStore.send({ type: "closeReviewDraftSheet" });
366
369
  }
367
- function _temp6(draft) {
368
- return /* @__PURE__ */ jsx(DraftItem, { draft }, draft.id);
370
+ function _temp6(draft_0) {
371
+ return /* @__PURE__ */ jsx(DraftItem, { draft: draft_0 }, draft_0.id);
369
372
  }
370
373
  function _temp5() {
371
374
  return _temp4;
@@ -382,18 +385,18 @@ function _temp2(state_0) {
382
385
  return state_0.context.isDeleteDraftDialogOpen;
383
386
  }
384
387
  function _temp(state) {
385
- return state.context.reviewDraftSheet;
388
+ return state.context.isReviewDraftSheetOpen;
386
389
  }
387
390
  /**
388
391
  * 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
389
392
  * deletes by itself.
390
393
  */
391
394
  function useDraftsActions(t0) {
392
- const $ = c(7);
393
- const { enabled, draftId, unnamed, drafts, switchTo } = t0;
395
+ const $ = c(6);
396
+ const { enabled, draftId, drafts, switchTo } = t0;
394
397
  let t1;
395
398
  let t2;
396
- if ($[0] !== draftId || $[1] !== drafts || $[2] !== enabled || $[3] !== switchTo || $[4] !== unnamed) {
399
+ if ($[0] !== draftId || $[1] !== drafts || $[2] !== enabled || $[3] !== switchTo) {
397
400
  t1 = () => {
398
401
  const inDraft = enabled && !!draftId;
399
402
  const others = drafts.filter((listed) => listed.id !== draftId);
@@ -414,12 +417,8 @@ function useDraftsActions(t0) {
414
417
  },
415
418
  {
416
419
  id: "delete-draft",
417
- label: unnamed ? "Discard changes…" : "Delete draft…",
418
- aliases: unnamed ? [
419
- "Delete draft",
420
- "Throw away changes",
421
- "Revert changes"
422
- ] : [
420
+ label: "Delete draft…",
421
+ aliases: [
423
422
  "Discard changes",
424
423
  "Throw away changes",
425
424
  "Revert changes"
@@ -428,14 +427,6 @@ function useDraftsActions(t0) {
428
427
  checkIfAvailable: () => inDraft,
429
428
  execute: _temp10
430
429
  },
431
- {
432
- id: "rename-draft",
433
- label: unnamed ? "Name draft…" : "Rename draft…",
434
- aliases: unnamed ? ["Rename draft", "Save draft"] : ["Name draft"],
435
- groupLabel: "Drafts",
436
- checkIfAvailable: () => inDraft,
437
- execute: _temp11
438
- },
439
430
  {
440
431
  id: "switch-to-live",
441
432
  label: "Switch to Live",
@@ -460,7 +451,7 @@ function useDraftsActions(t0) {
460
451
  groupLabel: "Drafts",
461
452
  checkIfAvailable: () => others.length > 0,
462
453
  hasChildren: true,
463
- execute: _temp12
454
+ execute: _temp11
464
455
  },
465
456
  ...others.map((other) => ({
466
457
  id: `${SWITCH_TO_DRAFT_ID}-${other.id}`,
@@ -468,7 +459,7 @@ function useDraftsActions(t0) {
468
459
  label: `Switch to "${draftLabel(other)}"`,
469
460
  aliases: [other.createdBy.name],
470
461
  groupLabel: "Drafts",
471
- checkIfAvailable: _temp13,
462
+ checkIfAvailable: _temp12,
472
463
  execute: () => switchTo(other.id)
473
464
  }))
474
465
  ];
@@ -479,14 +470,13 @@ function useDraftsActions(t0) {
479
470
  return () => {
480
471
  actionsStore.send({
481
472
  type: "unregisterManyActions",
482
- ids: actions.map(_temp14)
473
+ ids: actions.map(_temp13)
483
474
  });
484
475
  };
485
476
  };
486
477
  t2 = [
487
478
  enabled,
488
479
  draftId,
489
- unnamed,
490
480
  drafts,
491
481
  switchTo
492
482
  ];
@@ -494,28 +484,21 @@ function useDraftsActions(t0) {
494
484
  $[1] = drafts;
495
485
  $[2] = enabled;
496
486
  $[3] = switchTo;
497
- $[4] = unnamed;
498
- $[5] = t1;
499
- $[6] = t2;
487
+ $[4] = t1;
488
+ $[5] = t2;
500
489
  } else {
501
- t1 = $[5];
502
- t2 = $[6];
490
+ t1 = $[4];
491
+ t2 = $[5];
503
492
  }
504
493
  React.useEffect(t1, t2);
505
494
  }
506
- function _temp14(a) {
495
+ function _temp13(a) {
507
496
  return a.id;
508
497
  }
509
- function _temp13() {
498
+ function _temp12() {
510
499
  return true;
511
500
  }
512
- function _temp12() {}
513
- function _temp11() {
514
- return studioStore.send({
515
- type: "openReviewDraftSheet",
516
- startRenaming: true
517
- });
518
- }
501
+ function _temp11() {}
519
502
  function _temp10() {
520
503
  return studioStore.send({ type: "openDeleteDraftDialog" });
521
504
  }
@@ -9,6 +9,7 @@ import { usePageDestinations } from "../../../hooks/use-page-destinations.js";
9
9
  import { useLocalePath } from "../../../lib/view-locale.js";
10
10
  import { studioStore } from "../studioStore.js";
11
11
  import { localeLabel, localeOptions } from "../localeOptions.js";
12
+ import { useSwitchView } from "../viewSwitch.js";
12
13
  import { pathInLocale } from "../localeSwitch.js";
13
14
  import { c } from "react/compiler-runtime";
14
15
  import * as React from "react";
@@ -283,7 +284,7 @@ function LocalePicker(t0) {
283
284
  projectId,
284
285
  locales,
285
286
  open: dialog === "add",
286
- onAdded: (added) => void switchTo(added)
287
+ onAdded: (added) => switchTo(added)
287
288
  }), !viewed.isDefault && /* @__PURE__ */ jsx(RemoveLocaleDialog, {
288
289
  projectId,
289
290
  locale: viewed,
@@ -385,7 +386,7 @@ function TranslatingSpinner(t0) {
385
386
  * its home.
386
387
  */
387
388
  function useSwitchLocale(recordPage) {
388
- const $ = c(10);
389
+ const $ = c(15);
389
390
  const navigate = useNavigate();
390
391
  const cache = useStudioCache();
391
392
  const projectUuid = useProjectUuid();
@@ -401,7 +402,6 @@ function useSwitchLocale(recordPage) {
401
402
  let t1;
402
403
  if ($[1] !== cache || $[2] !== destinations || $[3] !== navigate || $[4] !== path || $[5] !== projectUuid || $[6] !== recordPage || $[7] !== search || $[8] !== view.locale) {
403
404
  t1 = async (target) => {
404
- if (target.tag === view.locale.tag && target.isDefault === view.locale.isDefault) return;
405
405
  const pagesIn = (locale) => cache.ensure(reads.pageList({ projectUuid }), { locale }).catch(_temp8);
406
406
  const recordPath = recordPage ? cache.reload(reads.discoveredPath({
407
407
  projectUuid,
@@ -426,7 +426,25 @@ function useSwitchLocale(recordPage) {
426
426
  $[8] = view.locale;
427
427
  $[9] = t1;
428
428
  } else t1 = $[9];
429
- return t1;
429
+ const switchTo = t1;
430
+ const switchView = useSwitchView();
431
+ let t2;
432
+ if ($[10] !== switchTo || $[11] !== switchView || $[12] !== view.locale.isDefault || $[13] !== view.locale.tag) {
433
+ t2 = (target_0) => {
434
+ if (target_0.tag === view.locale.tag && target_0.isDefault === view.locale.isDefault) return;
435
+ const label = localeLabel(target_0.tag);
436
+ switchView(() => switchTo(target_0), {
437
+ loading: `Switching to ${label}…`,
438
+ success: `You're now viewing ${label}.`
439
+ });
440
+ };
441
+ $[10] = switchTo;
442
+ $[11] = switchView;
443
+ $[12] = view.locale.isDefault;
444
+ $[13] = view.locale.tag;
445
+ $[14] = t2;
446
+ } else t2 = $[14];
447
+ return t2;
430
448
  }
431
449
  function _temp9() {
432
450
  return null;