camox 0.56.0 → 0.58.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 (38) hide show
  1. package/dist/core/createApp.d.ts +2 -2
  2. package/dist/core/createBlock.js +6 -2
  3. package/dist/core/createLayout.d.ts +1 -1
  4. package/dist/core/editing/createEditableBlock.d.ts +1 -1
  5. package/dist/core/lib/artifact.d.ts +14 -4
  6. package/dist/core/lib/artifact.js +57 -16
  7. package/dist/core/lib/artifactRuntime.js +4 -2
  8. package/dist/features/canvas/CanvasPageHeader.js +1 -1
  9. package/dist/features/canvas/canvasFrameDocument.js +13 -6
  10. package/dist/features/preview/components/Frame.js +1 -18
  11. package/dist/features/preview/components/SidebarStack.js +193 -106
  12. package/dist/features/preview/components/previewStyles.js +25 -1
  13. package/dist/features/renderer/RendererApp.js +55 -37
  14. package/dist/features/runtime/artifactDocuments.js +58 -0
  15. package/dist/features/runtime/artifactSources.js +36 -2
  16. package/dist/features/runtime/runtime.js +30 -12
  17. package/dist/features/runtime/runtimeRoutes.d.ts +6 -5
  18. package/dist/features/runtime/runtimeRoutes.js +12 -5
  19. package/dist/features/studio/components/AgentSidebar.js +4 -4
  20. package/dist/features/studio/components/ChatWidget.js +62 -80
  21. package/dist/features/studio/components/DraftsControl.js +60 -134
  22. package/dist/features/studio/components/Patrol.js +676 -0
  23. package/dist/features/studio/components/ReviewDraftSheet.js +52 -4
  24. package/dist/features/studio/components/Squareling.js +169 -84
  25. package/dist/features/studio/components/ThreadMessages.js +155 -58
  26. package/dist/features/studio/localeOptions.js +7 -3
  27. package/dist/features/studio/reportSentence.js +75 -0
  28. package/dist/features/studio/routes.js +2 -1
  29. package/dist/features/studio/showInCanvas.js +9 -2
  30. package/dist/features/studio/workingSentence.js +55 -0
  31. package/dist/lib/studio-reads.d.ts +1 -0
  32. package/dist/lib/studio-reads.js +5 -0
  33. package/dist/lib/use-thread.js +156 -190
  34. package/dist/package.js +1 -1
  35. package/dist/studio.css +1 -1
  36. package/package.json +4 -4
  37. package/dist/features/studio/components/RenameDraftDialog.js +0 -206
  38. package/dist/features/studio/components/WorkersWidget.js +0 -52
@@ -6,14 +6,13 @@ 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 { RenameDraftDialog } from "./RenameDraftDialog.js";
10
9
  import { DeleteDraftDialog, ReviewDraftSheet, useLeaveDraft } from "./ReviewDraftSheet.js";
11
10
  import { c } from "react/compiler-runtime";
12
11
  import * as React from "react";
13
12
  import { useSelector } from "@xstate/store-react";
14
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
14
  import { Button } from "@camox/ui/button";
16
- import { ChevronsUpDown, Pencil } from "lucide-react";
15
+ import { ChevronsUpDown } from "lucide-react";
17
16
  import { toast } from "@camox/ui/toaster";
18
17
  import { Badge } from "@camox/ui/badge";
19
18
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@camox/ui/dropdown-menu";
@@ -103,7 +102,7 @@ function useDrafts() {
103
102
  * still names what the studio is viewing.
104
103
  */
105
104
  function DraftPicker(t0) {
106
- const $ = c(57);
105
+ const $ = c(52);
107
106
  const { disabled: t1 } = t0;
108
107
  const disabled = t1 === void 0 ? false : t1;
109
108
  const { draftScope, draftId, developmentMode, projectId, list, current } = useDrafts();
@@ -111,8 +110,6 @@ function DraftPicker(t0) {
111
110
  const leaveDraft = useLeaveDraft();
112
111
  const review = useSelector(studioStore, _temp);
113
112
  const deleting = useSelector(studioStore, _temp2);
114
- const [menuOpen, setMenuOpen] = React.useState(false);
115
- const [renaming, setRenaming] = React.useState(null);
116
113
  let t2;
117
114
  let t3;
118
115
  if ($[0] !== draftScope) {
@@ -273,13 +270,7 @@ function DraftPicker(t0) {
273
270
  })]
274
271
  })
275
272
  }),
276
- regular.map((listed_0) => /* @__PURE__ */ jsx(DraftItem, {
277
- draft: listed_0,
278
- onRename: () => {
279
- setMenuOpen(false);
280
- setRenaming(listed_0);
281
- }
282
- }, listed_0.id))
273
+ regular.map(_temp7)
283
274
  ] })
284
275
  })] })
285
276
  });
@@ -291,70 +282,50 @@ function DraftPicker(t0) {
291
282
  $[39] = t18;
292
283
  } else t18 = $[39];
293
284
  let t19;
294
- if ($[40] !== menuOpen || $[41] !== t17 || $[42] !== t18) {
295
- t19 = /* @__PURE__ */ jsxs(DropdownMenu, {
296
- open: menuOpen,
297
- onOpenChange: setMenuOpen,
298
- children: [t17, t18]
299
- });
300
- $[40] = menuOpen;
301
- $[41] = t17;
302
- $[42] = t18;
303
- $[43] = t19;
304
- } else t19 = $[43];
285
+ if ($[40] !== t17 || $[41] !== t18) {
286
+ t19 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t17, t18] });
287
+ $[40] = t17;
288
+ $[41] = t18;
289
+ $[42] = t19;
290
+ } else t19 = $[42];
305
291
  let t20;
306
- if ($[44] !== projectId || $[45] !== renaming) {
307
- t20 = projectId && /* @__PURE__ */ jsx(RenameDraftDialog, {
308
- projectId,
309
- draft: renaming,
310
- onOpenChange: (open) => {
311
- if (!open) setRenaming(null);
312
- }
313
- });
314
- $[44] = projectId;
315
- $[45] = renaming;
316
- $[46] = t20;
317
- } else t20 = $[46];
318
- let t21;
319
- if ($[47] !== deleting || $[48] !== draftId || $[49] !== leaveDraft || $[50] !== projectId || $[51] !== review) {
320
- t21 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
292
+ if ($[43] !== deleting || $[44] !== draftId || $[45] !== leaveDraft || $[46] !== projectId || $[47] !== review) {
293
+ t20 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
321
294
  projectId,
322
295
  draftId,
323
296
  open: review.open,
324
297
  startRenaming: review.startRenaming,
325
- onOpenChange: _temp7
298
+ onOpenChange: _temp8
326
299
  }), /* @__PURE__ */ jsx(DeleteDraftDialog, {
327
300
  projectId,
328
301
  open: deleting,
329
- onOpenChange: _temp8,
302
+ onOpenChange: _temp9,
330
303
  onDeleted: leaveDraft
331
304
  })] });
332
- $[47] = deleting;
333
- $[48] = draftId;
334
- $[49] = leaveDraft;
335
- $[50] = projectId;
336
- $[51] = review;
337
- $[52] = t21;
338
- } else t21 = $[52];
339
- let t22;
340
- if ($[53] !== t19 || $[54] !== t20 || $[55] !== t21) {
341
- t22 = /* @__PURE__ */ jsxs(Fragment, { children: [
342
- t19,
343
- t20,
344
- t21
345
- ] });
346
- $[53] = t19;
347
- $[54] = t20;
348
- $[55] = t21;
349
- $[56] = t22;
350
- } else t22 = $[56];
351
- return t22;
305
+ $[43] = deleting;
306
+ $[44] = draftId;
307
+ $[45] = leaveDraft;
308
+ $[46] = projectId;
309
+ $[47] = review;
310
+ $[48] = t20;
311
+ } else t20 = $[48];
312
+ let t21;
313
+ if ($[49] !== t19 || $[50] !== t20) {
314
+ t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t19, t20] });
315
+ $[49] = t19;
316
+ $[50] = t20;
317
+ $[51] = t21;
318
+ } else t21 = $[51];
319
+ return t21;
320
+ }
321
+ function _temp9(open_0) {
322
+ if (!open_0) studioStore.send({ type: "closeDeleteDraftDialog" });
352
323
  }
353
- function _temp8(open_1) {
354
- if (!open_1) studioStore.send({ type: "closeDeleteDraftDialog" });
324
+ function _temp8(open) {
325
+ if (!open) studioStore.send({ type: "closeReviewDraftSheet" });
355
326
  }
356
- function _temp7(open_0) {
357
- if (!open_0) studioStore.send({ type: "closeReviewDraftSheet" });
327
+ function _temp7(listed_0) {
328
+ return /* @__PURE__ */ jsx(DraftItem, { draft: listed_0 }, listed_0.id);
358
329
  }
359
330
  function _temp6(listed) {
360
331
  return listed.kind === "regular";
@@ -405,7 +376,7 @@ function PendingChanges() {
405
376
  t3 = /* @__PURE__ */ jsxs(Button, {
406
377
  type: "button",
407
378
  "aria-label": t1,
408
- onClick: _temp9,
379
+ onClick: _temp10,
409
380
  children: ["Review changes", t2]
410
381
  });
411
382
  $[4] = t1;
@@ -414,7 +385,7 @@ function PendingChanges() {
414
385
  } else t3 = $[6];
415
386
  return t3;
416
387
  }
417
- function _temp9() {
388
+ function _temp10() {
418
389
  return studioStore.send({ type: "openReviewDraftSheet" });
419
390
  }
420
391
  /**
@@ -443,7 +414,7 @@ function useDraftsActions(t0) {
443
414
  ],
444
415
  groupLabel: "Drafts",
445
416
  checkIfAvailable: () => inDraft,
446
- execute: _temp10
417
+ execute: _temp11
447
418
  },
448
419
  {
449
420
  id: "delete-draft",
@@ -455,7 +426,7 @@ function useDraftsActions(t0) {
455
426
  ],
456
427
  groupLabel: "Drafts",
457
428
  checkIfAvailable: () => inDraft,
458
- execute: _temp11
429
+ execute: _temp12
459
430
  },
460
431
  {
461
432
  id: "rename-draft",
@@ -463,7 +434,7 @@ function useDraftsActions(t0) {
463
434
  aliases: ["Name draft"],
464
435
  groupLabel: "Drafts",
465
436
  checkIfAvailable: () => inDraft && !developmentMode,
466
- execute: _temp12
437
+ execute: _temp13
467
438
  },
468
439
  {
469
440
  id: "switch-to-live",
@@ -489,7 +460,7 @@ function useDraftsActions(t0) {
489
460
  groupLabel: "Drafts",
490
461
  checkIfAvailable: () => others.length > 0,
491
462
  hasChildren: true,
492
- execute: _temp13
463
+ execute: _temp14
493
464
  },
494
465
  ...others.map((other) => ({
495
466
  id: `${SWITCH_TO_DRAFT_ID}-${other.id}`,
@@ -497,7 +468,7 @@ function useDraftsActions(t0) {
497
468
  label: `Switch to "${draftLabel(other)}"`,
498
469
  aliases: [other.createdBy.name],
499
470
  groupLabel: "Drafts",
500
- checkIfAvailable: _temp14,
471
+ checkIfAvailable: _temp15,
501
472
  execute: () => switchTo(other.id)
502
473
  }))
503
474
  ];
@@ -508,7 +479,7 @@ function useDraftsActions(t0) {
508
479
  return () => {
509
480
  actionsStore.send({
510
481
  type: "unregisterManyActions",
511
- ids: actions.map(_temp15)
482
+ ids: actions.map(_temp16)
512
483
  });
513
484
  };
514
485
  };
@@ -532,23 +503,23 @@ function useDraftsActions(t0) {
532
503
  }
533
504
  React.useEffect(t1, t2);
534
505
  }
535
- function _temp15(a) {
506
+ function _temp16(a) {
536
507
  return a.id;
537
508
  }
538
- function _temp14() {
509
+ function _temp15() {
539
510
  return true;
540
511
  }
541
- function _temp13() {}
542
- function _temp12() {
512
+ function _temp14() {}
513
+ function _temp13() {
543
514
  return studioStore.send({
544
515
  type: "openReviewDraftSheet",
545
516
  startRenaming: true
546
517
  });
547
518
  }
548
- function _temp11() {
519
+ function _temp12() {
549
520
  return studioStore.send({ type: "openDeleteDraftDialog" });
550
521
  }
551
- function _temp10() {
522
+ function _temp11() {
552
523
  return studioStore.send({ type: "openReviewDraftSheet" });
553
524
  }
554
525
  /** Who published Live last and when: a member, a release, or nobody yet. */
@@ -557,11 +528,10 @@ function liveLine(live) {
557
528
  const by = live.publishedBy ? live.publishedBy.name : "a release";
558
529
  return `Published ${timeAgo(live.publishedAt)} by ${by}`;
559
530
  }
560
- /** A draft to switch to, with a button to rename it that leaves the selection alone. */
531
+ /** A draft to switch to. */
561
532
  function DraftItem(t0) {
562
- const $ = c(27);
563
- const { draft, onRename } = t0;
564
- const keep = _temp16;
533
+ const $ = c(18);
534
+ const { draft } = t0;
565
535
  const t1 = draft.id;
566
536
  let t2;
567
537
  if ($[0] !== draft) {
@@ -620,61 +590,17 @@ function DraftItem(t0) {
620
590
  $[14] = t8;
621
591
  } else t8 = $[14];
622
592
  let t9;
623
- if ($[15] !== draft) {
624
- t9 = draftLabel(draft);
625
- $[15] = draft;
626
- $[16] = t9;
627
- } else t9 = $[16];
628
- const t10 = `Rename "${t9}"`;
629
- let t11;
630
- if ($[17] !== onRename) {
631
- t11 = (event_0) => {
632
- keep(event_0);
633
- onRename();
634
- };
635
- $[17] = onRename;
636
- $[18] = t11;
637
- } else t11 = $[18];
638
- let t12;
639
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
640
- t12 = /* @__PURE__ */ jsx(Pencil, {});
641
- $[19] = t12;
642
- } else t12 = $[19];
643
- let t13;
644
- if ($[20] !== t10 || $[21] !== t11) {
645
- t13 = /* @__PURE__ */ jsx(Button, {
646
- type: "button",
647
- variant: "ghost",
648
- size: "icon-xs",
649
- "aria-label": t10,
650
- className: "opacity-0 group-data-highlighted/draft-item:opacity-100 focus-visible:opacity-100",
651
- onPointerDown: keep,
652
- onPointerUp: keep,
653
- onMouseUp: keep,
654
- onClick: t11,
655
- children: t12
656
- });
657
- $[20] = t10;
658
- $[21] = t11;
659
- $[22] = t13;
660
- } else t13 = $[22];
661
- let t14;
662
- if ($[23] !== draft.id || $[24] !== t13 || $[25] !== t8) {
663
- t14 = /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
593
+ if ($[15] !== draft.id || $[16] !== t8) {
594
+ t9 = /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
664
595
  value: t1,
665
596
  closeOnClick: true,
666
- className: "group/draft-item",
667
- children: [t8, t13]
597
+ children: t8
668
598
  });
669
- $[23] = draft.id;
670
- $[24] = t13;
671
- $[25] = t8;
672
- $[26] = t14;
673
- } else t14 = $[26];
674
- return t14;
675
- }
676
- function _temp16(event) {
677
- return event.stopPropagation();
599
+ $[15] = draft.id;
600
+ $[16] = t8;
601
+ $[17] = t9;
602
+ } else t9 = $[17];
603
+ return t9;
678
604
  }
679
605
 
680
606
  //#endregion