camox 0.75.0 → 0.76.1

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 (72) hide show
  1. package/dist/core/editing/createEditableBlock.js +1077 -1681
  2. package/dist/core/editing/fieldSlot.js +251 -0
  3. package/dist/core/editing/useFieldSlot.js +159 -0
  4. package/dist/core/layoutContext.d.ts +2 -0
  5. package/dist/core/layoutContext.js +27 -1
  6. package/dist/features/canvas/CanvasPageFrame.js +2 -2
  7. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
  8. package/dist/features/canvas/canvasCameraController.js +595 -0
  9. package/dist/features/canvas/useCanvasCamera.js +141 -587
  10. package/dist/features/canvas/useCanvasFrame.js +1 -1
  11. package/dist/features/page/DerivedPageContent.js +4 -8
  12. package/dist/features/preview/components/AssetLightbox.js +6 -65
  13. package/dist/features/preview/components/CanvasPreview.js +2 -2
  14. package/dist/features/preview/components/Frame.js +3 -3
  15. package/dist/features/preview/components/ItemFieldsEditor.js +376 -460
  16. package/dist/features/preview/components/Overlays.js +4 -9
  17. package/dist/features/preview/components/PreviewPanel.js +3 -3
  18. package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
  19. package/dist/features/preview/components/SelectionEditor.js +285 -339
  20. package/dist/features/preview/components/ZoomableImage.js +105 -0
  21. package/dist/features/preview/components/contentFieldSchema.js +3 -1
  22. package/dist/features/preview/components/useFieldWriter.js +30 -51
  23. package/dist/features/preview/components/useRecordView.js +3 -3
  24. package/dist/features/preview/overlayMessages.js +20 -58
  25. package/dist/features/preview/previewStore.js +6 -123
  26. package/dist/features/preview/repeatableItemPath.js +47 -0
  27. package/dist/features/provider/AuthenticatedCamoxProvider.js +75 -63
  28. package/dist/features/renderer/RendererApp.js +6 -6
  29. package/dist/features/renderer/RendererFrames.js +2 -2
  30. package/dist/features/renderer/rendererHost.js +1 -1
  31. package/dist/features/routes/pageRuntime.d.ts +8 -12
  32. package/dist/features/routes/pageRuntime.js +26 -106
  33. package/dist/features/runtime/pageApp.js +1 -1
  34. package/dist/features/runtime/pageRead.js +105 -0
  35. package/dist/features/runtime/reader.d.ts +25 -0
  36. package/dist/features/runtime/reader.js +142 -0
  37. package/dist/features/runtime/runtime.d.ts +9 -3
  38. package/dist/features/runtime/runtime.js +608 -776
  39. package/dist/features/sdkBundle/buildSdkBundle.d.ts +5 -0
  40. package/dist/features/sdkBundle/buildSdkBundle.js +9 -3
  41. package/dist/features/studio/components/ChatWidget.js +137 -121
  42. package/dist/features/studio/components/ClearThread.js +121 -0
  43. package/dist/features/studio/components/DeleteDraftDialog.js +67 -65
  44. package/dist/features/studio/components/DraftBar.js +60 -49
  45. package/dist/features/studio/components/DraftNotices.js +149 -0
  46. package/dist/features/studio/components/DraftsControl.js +217 -180
  47. package/dist/features/studio/components/DraftsSheet.js +446 -0
  48. package/dist/features/studio/components/PublishedTab.js +511 -0
  49. package/dist/features/studio/components/ReviewDraftDialog.js +104 -89
  50. package/dist/features/studio/components/SheetTable.js +46 -0
  51. package/dist/features/studio/components/Specialists.js +1 -1
  52. package/dist/features/studio/components/ThreadMessages.js +227 -176
  53. package/dist/features/studio/draftLabel.js +15 -1
  54. package/dist/features/studio/draftNotice.js +1 -0
  55. package/dist/features/studio/showInCanvas.js +9 -19
  56. package/dist/features/studio/studioStore.js +5 -5
  57. package/dist/features/studio/useArchiveDraft.js +60 -0
  58. package/dist/features/studio/useEditorSelection.js +8 -19
  59. package/dist/features/studio/useRestoreDraft.js +70 -0
  60. package/dist/features/studio/viewSwitch.js +19 -11
  61. package/dist/lib/draft-scope.d.ts +1 -1
  62. package/dist/lib/draft-scope.js +6 -3
  63. package/dist/lib/queries.js +12 -1
  64. package/dist/lib/studio-reads.js +22 -0
  65. package/dist/lib/use-project-room.js +19 -13
  66. package/dist/lib/use-thread.js +1 -1
  67. package/dist/package.js +1 -1
  68. package/dist/studio.css +1 -1
  69. package/package.json +4 -4
  70. package/dist/core/hooks/useFieldSelection.js +0 -67
  71. package/dist/core/hooks/useIsEditable.js +0 -21
  72. package/dist/core/hooks/useOverlayMessage.js +0 -70
@@ -1,10 +1,11 @@
1
1
  import { reads, useReadQuery } from "../../../lib/studio-reads.js";
2
+ import { cn } from "../../../lib/utils.js";
2
3
  import { draftMutations } from "../../../lib/queries.js";
3
4
  import { studioStore } from "../studioStore.js";
4
5
  import { localeName } from "../localeOptions.js";
5
6
  import { fixMessage, whereSentence } from "../fixMessage.js";
6
- import { draftLabel, plural } from "../draftLabel.js";
7
7
  import { useLeaveDraft } from "../viewSwitch.js";
8
+ import { draftLabel, plural } from "../draftLabel.js";
8
9
  import { useShowInCanvas } from "../showInCanvas.js";
9
10
  import { c } from "react/compiler-runtime";
10
11
  import { useState } from "react";
@@ -424,12 +425,17 @@ function _temp4(error) {
424
425
  return toast.error(error.message || "Could not summarize the draft");
425
426
  }
426
427
  /**
428
+ * The review's body is tall enough for a typical overview from the start, so the dialog doesn't
429
+ * grow once it's written. A longer one scrolls within the dialog's own limit.
430
+ */
431
+ const REVIEW_BODY_HEIGHT = "min-h-52";
432
+ /**
427
433
  * Reviews a draft before publishing it whole (ADR 0009, ADR 0043). Publish is held only by
428
434
  * blockers or an empty draft, never by work Camox still runs. Once the draft ends, the studio
429
435
  * switches to Live.
430
436
  */
431
437
  function ReviewDraftDialog(t0) {
432
- const $ = c(60);
438
+ const $ = c(66);
433
439
  const { projectId, draftId, open, onOpenChange } = t0;
434
440
  let t1;
435
441
  if ($[0] !== draftId || $[1] !== projectId) {
@@ -482,10 +488,7 @@ function ReviewDraftDialog(t0) {
482
488
  let t7;
483
489
  if ($[12] !== leaveDraft || $[13] !== onOpenChange || $[14] !== preview) {
484
490
  t7 = (result) => {
485
- if ("publishing" in result && result.publishing) {
486
- preview.refetch();
487
- return;
488
- }
491
+ if ("publishing" in result && result.publishing) return preview.refetch();
489
492
  if (!result.empty) {
490
493
  onOpenChange(false);
491
494
  return leaveDraft(result.ended);
@@ -531,33 +534,40 @@ function ReviewDraftDialog(t0) {
531
534
  let t12;
532
535
  let t13;
533
536
  let t14;
534
- if ($[21] !== data || $[22] !== draft.data || $[23] !== failed || $[24] !== onOpenChange || $[25] !== open || $[26] !== projectId || $[27] !== showInCanvas) {
537
+ let t15;
538
+ if ($[21] !== data || $[22] !== draft.data || $[23] !== failed || $[24] !== onOpenChange || $[25] !== open || $[26] !== projectId || $[27] !== publishing || $[28] !== showInCanvas) {
535
539
  const lines = data ? reviewLines(data) : [];
536
540
  if (failed && !lines.includes(PUBLISH_FAILED)) lines.push(PUBLISH_FAILED);
537
541
  T1 = Dialog;
538
- t13 = open;
539
- t14 = onOpenChange;
542
+ t14 = open;
543
+ if ($[37] !== onOpenChange || $[38] !== publishing) {
544
+ t15 = (next) => (next || !publishing) && onOpenChange(next);
545
+ $[37] = onOpenChange;
546
+ $[38] = publishing;
547
+ $[39] = t15;
548
+ } else t15 = $[39];
540
549
  T0 = DialogContent;
541
- t10 = "flex max-h-[85vh] flex-col gap-4 sm:max-w-lg";
542
- let t15;
543
- if ($[35] !== draft.data) {
544
- t15 = draft.data ? draftLabel(draft.data) : "Draft";
545
- $[35] = draft.data;
546
- $[36] = t15;
547
- } else t15 = $[36];
548
- if ($[37] !== t15) {
549
- t11 = /* @__PURE__ */ jsx(DialogHeader, {
550
+ t10 = "flex max-h-[85vh] flex-col gap-4 sm:max-w-xl";
551
+ t11 = !publishing;
552
+ let t16;
553
+ if ($[40] !== draft.data) {
554
+ t16 = draft.data ? draftLabel(draft.data) : "Draft";
555
+ $[40] = draft.data;
556
+ $[41] = t16;
557
+ } else t16 = $[41];
558
+ if ($[42] !== t16) {
559
+ t12 = /* @__PURE__ */ jsx(DialogHeader, {
550
560
  className: "pr-8",
551
561
  children: /* @__PURE__ */ jsx(DialogTitle, {
552
562
  className: "truncate text-base",
553
- children: t15
563
+ children: t16
554
564
  })
555
565
  });
556
- $[37] = t15;
557
- $[38] = t11;
558
- } else t11 = $[38];
559
- t12 = data ? /* @__PURE__ */ jsxs("div", {
560
- className: "-mx-6 flex min-h-0 flex-col gap-4 overflow-y-auto px-6",
566
+ $[42] = t16;
567
+ $[43] = t12;
568
+ } else t12 = $[43];
569
+ t13 = data ? /* @__PURE__ */ jsxs("div", {
570
+ className: cn("-mx-6 flex flex-col gap-4 overflow-y-auto px-6", REVIEW_BODY_HEIGHT),
561
571
  children: [
562
572
  /* @__PURE__ */ jsx(DraftOverview, {
563
573
  projectId,
@@ -573,7 +583,7 @@ function ReviewDraftDialog(t0) {
573
583
  lines.map(_temp7)
574
584
  ]
575
585
  }) : /* @__PURE__ */ jsx("div", {
576
- className: "flex items-center justify-center py-6",
586
+ className: cn("flex items-center justify-center", REVIEW_BODY_HEIGHT),
577
587
  children: /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" })
578
588
  });
579
589
  $[21] = data;
@@ -582,81 +592,86 @@ function ReviewDraftDialog(t0) {
582
592
  $[24] = onOpenChange;
583
593
  $[25] = open;
584
594
  $[26] = projectId;
585
- $[27] = showInCanvas;
586
- $[28] = T0;
587
- $[29] = T1;
588
- $[30] = t10;
589
- $[31] = t11;
590
- $[32] = t12;
591
- $[33] = t13;
592
- $[34] = t14;
595
+ $[27] = publishing;
596
+ $[28] = showInCanvas;
597
+ $[29] = T0;
598
+ $[30] = T1;
599
+ $[31] = t10;
600
+ $[32] = t11;
601
+ $[33] = t12;
602
+ $[34] = t13;
603
+ $[35] = t14;
604
+ $[36] = t15;
593
605
  } else {
594
- T0 = $[28];
595
- T1 = $[29];
596
- t10 = $[30];
597
- t11 = $[31];
598
- t12 = $[32];
599
- t13 = $[33];
600
- t14 = $[34];
606
+ T0 = $[29];
607
+ T1 = $[30];
608
+ t10 = $[31];
609
+ t11 = $[32];
610
+ t12 = $[33];
611
+ t13 = $[34];
612
+ t14 = $[35];
613
+ t15 = $[36];
601
614
  }
602
- const t15 = !data || data.blockers.length > 0 || empty || publishing;
603
- let t16;
604
- if ($[39] !== data || $[40] !== projectId || $[41] !== publish) {
605
- t16 = () => data && publish.mutate(publishInput(projectId, data));
606
- $[39] = data;
607
- $[40] = projectId;
608
- $[41] = publish;
609
- $[42] = t16;
610
- } else t16 = $[42];
615
+ const t16 = !data || data.blockers.length > 0 || empty || publishing;
611
616
  let t17;
612
- if ($[43] !== publishing) {
613
- t17 = publishing ? /* @__PURE__ */ jsx(Spinner, {}) : null;
614
- $[43] = publishing;
615
- $[44] = t17;
616
- } else t17 = $[44];
617
- let t18;
618
- if ($[45] !== t15 || $[46] !== t16 || $[47] !== t17) {
619
- t18 = /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsxs(Button, {
620
- disabled: t15,
621
- onClick: t16,
622
- children: [t17, "Publish"]
623
- }) });
624
- $[45] = t15;
625
- $[46] = t16;
617
+ if ($[44] !== data || $[45] !== projectId || $[46] !== publish) {
618
+ t17 = () => data && publish.mutate(publishInput(projectId, data));
619
+ $[44] = data;
620
+ $[45] = projectId;
621
+ $[46] = publish;
626
622
  $[47] = t17;
627
- $[48] = t18;
628
- } else t18 = $[48];
623
+ } else t17 = $[47];
624
+ let t18;
625
+ if ($[48] !== publishing) {
626
+ t18 = publishing ? /* @__PURE__ */ jsx(Spinner, {}) : null;
627
+ $[48] = publishing;
628
+ $[49] = t18;
629
+ } else t18 = $[49];
629
630
  let t19;
630
- if ($[49] !== T0 || $[50] !== t10 || $[51] !== t11 || $[52] !== t12 || $[53] !== t18) {
631
- t19 = /* @__PURE__ */ jsxs(T0, {
631
+ if ($[50] !== t16 || $[51] !== t17 || $[52] !== t18) {
632
+ t19 = /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsxs(Button, {
633
+ disabled: t16,
634
+ onClick: t17,
635
+ children: [t18, "Publish"]
636
+ }) });
637
+ $[50] = t16;
638
+ $[51] = t17;
639
+ $[52] = t18;
640
+ $[53] = t19;
641
+ } else t19 = $[53];
642
+ let t20;
643
+ if ($[54] !== T0 || $[55] !== t10 || $[56] !== t11 || $[57] !== t12 || $[58] !== t13 || $[59] !== t19) {
644
+ t20 = /* @__PURE__ */ jsxs(T0, {
632
645
  className: t10,
646
+ showCloseButton: t11,
633
647
  children: [
634
- t11,
635
648
  t12,
636
- t18
649
+ t13,
650
+ t19
637
651
  ]
638
652
  });
639
- $[49] = T0;
640
- $[50] = t10;
641
- $[51] = t11;
642
- $[52] = t12;
643
- $[53] = t18;
644
- $[54] = t19;
645
- } else t19 = $[54];
646
- let t20;
647
- if ($[55] !== T1 || $[56] !== t13 || $[57] !== t14 || $[58] !== t19) {
648
- t20 = /* @__PURE__ */ jsx(T1, {
649
- open: t13,
650
- onOpenChange: t14,
651
- children: t19
653
+ $[54] = T0;
654
+ $[55] = t10;
655
+ $[56] = t11;
656
+ $[57] = t12;
657
+ $[58] = t13;
658
+ $[59] = t19;
659
+ $[60] = t20;
660
+ } else t20 = $[60];
661
+ let t21;
662
+ if ($[61] !== T1 || $[62] !== t14 || $[63] !== t15 || $[64] !== t20) {
663
+ t21 = /* @__PURE__ */ jsx(T1, {
664
+ open: t14,
665
+ onOpenChange: t15,
666
+ children: t20
652
667
  });
653
- $[55] = T1;
654
- $[56] = t13;
655
- $[57] = t14;
656
- $[58] = t19;
657
- $[59] = t20;
658
- } else t20 = $[59];
659
- return t20;
668
+ $[61] = T1;
669
+ $[62] = t14;
670
+ $[63] = t15;
671
+ $[64] = t20;
672
+ $[65] = t21;
673
+ } else t21 = $[65];
674
+ return t21;
660
675
  }
661
676
  function _temp7(line) {
662
677
  return /* @__PURE__ */ jsx("p", {
@@ -0,0 +1,46 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region src/features/studio/components/SheetTable.tsx
7
+ /** A header cell of the drafts sheet's tables. */
8
+ const Th = (t0) => {
9
+ const $ = c(2);
10
+ const { children } = t0;
11
+ let t1;
12
+ if ($[0] !== children) {
13
+ t1 = /* @__PURE__ */ jsx("th", {
14
+ className: "px-2 py-2 font-medium",
15
+ children
16
+ });
17
+ $[0] = children;
18
+ $[1] = t1;
19
+ } else t1 = $[1];
20
+ return t1;
21
+ };
22
+ /** A cell of the drafts sheet's tables. */
23
+ const Td = (t0) => {
24
+ const $ = c(5);
25
+ const { children, className } = t0;
26
+ let t1;
27
+ if ($[0] !== className) {
28
+ t1 = cn("px-2 py-2", className);
29
+ $[0] = className;
30
+ $[1] = t1;
31
+ } else t1 = $[1];
32
+ let t2;
33
+ if ($[2] !== children || $[3] !== t1) {
34
+ t2 = /* @__PURE__ */ jsx("td", {
35
+ className: t1,
36
+ children
37
+ });
38
+ $[2] = children;
39
+ $[3] = t1;
40
+ $[4] = t2;
41
+ } else t2 = $[4];
42
+ return t2;
43
+ };
44
+
45
+ //#endregion
46
+ export { Td, Th };
@@ -11,8 +11,8 @@ import { BOTTOM_CARD_EDGES, CARD_BODY_EDGES } from "../../preview/components/Sid
11
11
  import { editCollectionItemPath } from "../routes.js";
12
12
  import { studioStore } from "../studioStore.js";
13
13
  import { dismissLabel, dismissedSentence, findingSentence, fixWithAgentMessage } from "../findingSentence.js";
14
- import { useShowInCanvas } from "../showInCanvas.js";
15
14
  import { Squareling } from "./Squareling.js";
15
+ import { useShowInCanvas } from "../showInCanvas.js";
16
16
  import { moreSentence, reportSentence, shortTimeAgo, whereReportLeads } from "../reportSentence.js";
17
17
  import { aboutSentence, whenTag } from "../specialistBio.js";
18
18
  import { workingSentence } from "../workingSentence.js";