camox 0.77.0 → 0.78.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 (29) hide show
  1. package/dist/features/canvas/CamoxCanvas.js +187 -197
  2. package/dist/features/canvas/canvasCameraController.js +1 -1
  3. package/dist/features/canvas/canvasItems.js +40 -9
  4. package/dist/features/canvas/sidebar/ContentSidebarFrame.js +15 -11
  5. package/dist/features/canvas/useCanvasLayout.js +34 -0
  6. package/dist/features/memory/CamoxMemory.js +747 -0
  7. package/dist/features/preview/EditablePageExperience.js +2 -0
  8. package/dist/features/runtime/publicCache.d.ts +2 -0
  9. package/dist/features/runtime/publicCache.js +27 -4
  10. package/dist/features/runtime/runtime.d.ts +1 -1
  11. package/dist/features/runtime/runtime.js +34 -15
  12. package/dist/features/studio/FollowAgentProvider.js +1 -1
  13. package/dist/features/studio/components/AgentSidebar.js +22 -16
  14. package/dist/features/studio/components/DraftBar.js +167 -103
  15. package/dist/features/studio/components/{ReviewDraftDialog.js → DraftReview.js} +191 -218
  16. package/dist/features/studio/components/DraftsControl.js +174 -202
  17. package/dist/features/studio/components/DraftsSheet.js +102 -94
  18. package/dist/features/studio/components/Navbar.js +121 -84
  19. package/dist/features/studio/components/PublishedTab.js +21 -20
  20. package/dist/features/studio/routes.js +3 -1
  21. package/dist/features/studio/studioStore.js +12 -9
  22. package/dist/features/studio/usePublishDraft.js +116 -0
  23. package/dist/features/studio/viewSwitch.js +10 -7
  24. package/dist/lib/queries.js +7 -1
  25. package/dist/lib/studio-reads.js +6 -0
  26. package/dist/package.js +1 -1
  27. package/dist/studio.css +1 -1
  28. package/package.json +5 -5
  29. package/LICENSE.md +0 -21
@@ -9,6 +9,9 @@ import { useRoutableLayouts } from "../../lib/studio-definitions.js";
9
9
  import { useLocalizedPath } from "../../lib/view-locale.js";
10
10
  import { canvasStore } from "./canvasStore.js";
11
11
  import { previewStore } from "../preview/previewStore.js";
12
+ import { CANVAS_DEVICES, canvasLayoutId, canvasPageId, derivedLayoutIdOf, getCanvasPages } from "./canvasPages.js";
13
+ import { canvasSnapTargets, positionCanvasPages } from "./canvasItems.js";
14
+ import { useCanvasLayout } from "./useCanvasLayout.js";
12
15
  import { CanvasWorkspaceContext } from "./canvasZoom.js";
13
16
  import { useRendererHost } from "../renderer/RendererFrames.js";
14
17
  import { STUDIO_CANVAS_PATH } from "../studio/routes.js";
@@ -19,8 +22,6 @@ import { PageRecordContext } from "../preview/pageRecord.js";
19
22
  import { CuratedBlockShortcuts } from "../preview/components/PreviewPanel.js";
20
23
  import { FollowAgentContext } from "../studio/followAgentContext.js";
21
24
  import { useCanvasFrameMode } from "./canvasFrameMode.js";
22
- import { CANVAS_DEVICES, canvasLayoutId, canvasPageId, derivedLayoutIdOf, getCanvasPages } from "./canvasPages.js";
23
- import { CANVAS_SLOT_WIDTH, canvasItemGap, canvasSnapTargets, positionCanvasPages } from "./canvasItems.js";
24
25
  import { CanvasOverlaysShownContext } from "./CanvasOverlays.js";
25
26
  import { CanvasPageEdge } from "./CanvasPageEdge.js";
26
27
  import { CANVAS_THUMBNAIL_MAX_ZOOM, CanvasThumbnailsContext, canvasThumbnailsSupported, createCanvasThumbnails, useCanvasThumbnail } from "./canvasThumbnails.js";
@@ -45,40 +46,13 @@ import { createStore as createStore$1 } from "@xstate/store";
45
46
  * The Canvas spans the studio under its sidebars, the Content Sidebar on its left and the Agent Sidebar on
46
47
  * its right: the camera frames and snaps Pages between them, and above the studio's bottom edge.
47
48
  */
48
- const CANVAS_INSETS = {
49
- top: 0,
50
- right: 265,
51
- bottom: 8,
52
- left: 265
53
- };
54
- function subscribeToWindowWidth(onChange) {
55
- window.addEventListener("resize", onChange);
56
- return () => window.removeEventListener("resize", onChange);
57
- }
58
- /**
59
- * The gap between Pages in the Canvas row. The Canvas spans the window, so the gap follows the
60
- * window's width. It reads the window from the first render, before the camera measures the Canvas.
61
- */
62
- function useCanvasItemGap() {
63
- const $ = c(2);
64
- const windowWidth = React.useSyncExternalStore(subscribeToWindowWidth, _temp, _temp2);
65
- const width = Math.max(0, windowWidth - CANVAS_INSETS.left - CANVAS_INSETS.right);
66
- let t0;
67
- if ($[0] !== width) {
68
- t0 = canvasItemGap({
69
- width,
70
- height: 0
71
- }, CANVAS_INSETS.right);
72
- $[0] = width;
73
- $[1] = t0;
74
- } else t0 = $[1];
75
- return t0;
76
- }
77
- function _temp2() {
78
- return 0;
79
- }
80
- function _temp() {
81
- return window.innerWidth;
49
+ function canvasInsets(sidebarWidth) {
50
+ return {
51
+ top: 0,
52
+ right: sidebarWidth,
53
+ bottom: 8,
54
+ left: sidebarWidth
55
+ };
82
56
  }
83
57
  function usePreparationFailure(error, t0) {
84
58
  const $ = c(5);
@@ -266,7 +240,7 @@ function CanvasPagePreview(props) {
266
240
  if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
267
241
  t6 = (frame) => {
268
242
  setSettledFrame(frame);
269
- setSettles(_temp3);
243
+ setSettles(_temp);
270
244
  };
271
245
  $[22] = t6;
272
246
  } else t6 = $[22];
@@ -290,7 +264,7 @@ function CanvasPagePreview(props) {
290
264
  props.pathname,
291
265
  props.pageId,
292
266
  props.derivedLayoutId
293
- ].filter(_temp4);
267
+ ].filter(_temp2);
294
268
  thumbnails.capture(key, settledFrame, tokens, options).catch((error) => {
295
269
  thumbnails.abandon(key);
296
270
  console.warn(`[camox] Could not capture ${props.pathname} for the Canvas.`, error);
@@ -395,10 +369,10 @@ function CanvasPagePreview(props) {
395
369
  } else t13 = $[52];
396
370
  return t13;
397
371
  }
398
- function _temp4(token) {
372
+ function _temp2(token) {
399
373
  return !!token;
400
374
  }
401
- function _temp3(count) {
375
+ function _temp(count) {
402
376
  return count + 1;
403
377
  }
404
378
  function CanvasPageFrameLoader(t0) {
@@ -518,8 +492,8 @@ function scrimGradient(towards, inset) {
518
492
  }
519
493
  /** A frame header above an item's slot, at a constant on-screen height. */
520
494
  function CanvasHeaderSlot(t0) {
521
- const $ = c(10);
522
- const { itemKey, left, children } = t0;
495
+ const $ = c(12);
496
+ const { itemKey, left, width, children } = t0;
523
497
  let t1;
524
498
  if ($[0] !== left) {
525
499
  t1 = canvasScreenX(left);
@@ -533,12 +507,13 @@ function CanvasHeaderSlot(t0) {
533
507
  } else t2 = $[2];
534
508
  const t3 = `translate(${t1}, ${t2})`;
535
509
  let t4;
536
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
537
- t4 = canvasScreenLength(CANVAS_SLOT_WIDTH);
538
- $[3] = t4;
539
- } else t4 = $[3];
510
+ if ($[3] !== width) {
511
+ t4 = canvasScreenLength(width);
512
+ $[3] = width;
513
+ $[4] = t4;
514
+ } else t4 = $[4];
540
515
  let t5;
541
- if ($[4] !== t3) {
516
+ if ($[5] !== t3 || $[6] !== t4) {
542
517
  t5 = {
543
518
  height: 52,
544
519
  transform: t3,
@@ -546,22 +521,23 @@ function CanvasHeaderSlot(t0) {
546
521
  willChange: "transform",
547
522
  zIndex: 2
548
523
  };
549
- $[4] = t3;
550
- $[5] = t5;
551
- } else t5 = $[5];
524
+ $[5] = t3;
525
+ $[6] = t4;
526
+ $[7] = t5;
527
+ } else t5 = $[7];
552
528
  let t6;
553
- if ($[6] !== children || $[7] !== itemKey || $[8] !== t5) {
529
+ if ($[8] !== children || $[9] !== itemKey || $[10] !== t5) {
554
530
  t6 = /* @__PURE__ */ jsx("div", {
555
531
  "data-canvas-header": itemKey,
556
532
  className: "@container/canvas-header absolute top-0 left-0 pb-3",
557
533
  style: t5,
558
534
  children
559
535
  });
560
- $[6] = children;
561
- $[7] = itemKey;
562
- $[8] = t5;
563
- $[9] = t6;
564
- } else t6 = $[9];
536
+ $[8] = children;
537
+ $[9] = itemKey;
538
+ $[10] = t5;
539
+ $[11] = t6;
540
+ } else t6 = $[11];
565
541
  return t6;
566
542
  }
567
543
  /** World-space room above and below a frame narrower than its area. */
@@ -572,21 +548,22 @@ const CANVAS_FRAMED_PADDING = 40;
572
548
  * shade of its own, with room above and below the frame.
573
549
  */
574
550
  function CanvasSlot(t0) {
575
- const $ = c(7);
576
- const { itemKey, framed, children } = t0;
551
+ const $ = c(8);
552
+ const { itemKey, width, framed, children } = t0;
577
553
  const t1 = framed || void 0;
578
554
  const t2 = framed ? CANVAS_FRAMED_PADDING : 0;
579
555
  let t3;
580
- if ($[0] !== t2) {
556
+ if ($[0] !== t2 || $[1] !== width) {
581
557
  t3 = {
582
- width: CANVAS_SLOT_WIDTH,
558
+ width,
583
559
  paddingBlock: t2
584
560
  };
585
561
  $[0] = t2;
586
- $[1] = t3;
587
- } else t3 = $[1];
562
+ $[1] = width;
563
+ $[2] = t3;
564
+ } else t3 = $[2];
588
565
  let t4;
589
- if ($[2] !== children || $[3] !== itemKey || $[4] !== t1 || $[5] !== t3) {
566
+ if ($[3] !== children || $[4] !== itemKey || $[5] !== t1 || $[6] !== t3) {
590
567
  t4 = /* @__PURE__ */ jsx("div", {
591
568
  "data-canvas-slot": itemKey,
592
569
  "data-canvas-slot-shaded": t1,
@@ -594,12 +571,12 @@ function CanvasSlot(t0) {
594
571
  style: t3,
595
572
  children
596
573
  });
597
- $[2] = children;
598
- $[3] = itemKey;
599
- $[4] = t1;
600
- $[5] = t3;
601
- $[6] = t4;
602
- } else t4 = $[6];
574
+ $[3] = children;
575
+ $[4] = itemKey;
576
+ $[5] = t1;
577
+ $[6] = t3;
578
+ $[7] = t4;
579
+ } else t4 = $[7];
603
580
  return t4;
604
581
  }
605
582
  /**
@@ -614,8 +591,8 @@ function createCanvasHover() {
614
591
  }
615
592
  /** A Page's area in the Canvas row, with its frame. */
616
593
  function CanvasPageItem(t0) {
617
- const $ = c(39);
618
- const { page, pathname, selected, previewed, framed, viewport, runtimeBasePath, onActivate, selectPage, hover } = t0;
594
+ const $ = c(40);
595
+ const { page, pathname, selected, previewed, slotWidth, framed, viewport, runtimeBasePath, onActivate, selectPage, hover } = t0;
619
596
  let t1;
620
597
  if ($[0] !== page.key) {
621
598
  t1 = (state) => state.context.pageKey === page.key;
@@ -722,17 +699,19 @@ function CanvasPageItem(t0) {
722
699
  $[34] = t8;
723
700
  } else t8 = $[34];
724
701
  let t9;
725
- if ($[35] !== framed || $[36] !== page.key || $[37] !== t8) {
702
+ if ($[35] !== framed || $[36] !== page.key || $[37] !== slotWidth || $[38] !== t8) {
726
703
  t9 = /* @__PURE__ */ jsx(CanvasSlot, {
727
704
  itemKey: page.key,
705
+ width: slotWidth,
728
706
  framed,
729
707
  children: t8
730
708
  });
731
709
  $[35] = framed;
732
710
  $[36] = page.key;
733
- $[37] = t8;
734
- $[38] = t9;
735
- } else t9 = $[38];
711
+ $[37] = slotWidth;
712
+ $[38] = t8;
713
+ $[39] = t9;
714
+ } else t9 = $[39];
736
715
  return t9;
737
716
  }
738
717
  /** Gives a Page a new nickname, keeping its path. */
@@ -831,8 +810,8 @@ function useWorkspaceThumbnails(workspaceKey) {
831
810
  return thumbnails;
832
811
  }
833
812
  function CanvasWorkspace(t0) {
834
- const $ = c(43);
835
- const { ref, pages, selectedPage, previewedPage, intendedPageKey, runtimeBasePath, viewport, onActivate, onSelectionIntent } = t0;
813
+ const $ = c(46);
814
+ const { ref, pages, selectedPage, previewedPage, intendedPageKey, runtimeBasePath, device, onActivate, onSelectionIntent } = t0;
836
815
  const { apiUrl, projectUuid } = useAuthContext();
837
816
  const renamePage = useRenamePage();
838
817
  const location = useLocation();
@@ -900,51 +879,62 @@ function CanvasWorkspace(t0) {
900
879
  $[14] = t5;
901
880
  } else t5 = $[14];
902
881
  const [previewPathnames, setPreviewPathnames] = React.useState(t5);
903
- const gap = useCanvasItemGap();
904
- const { items, width } = positionCanvasPages(pages, gap);
882
+ const { sidebarWidth, slotWidth, gap } = useCanvasLayout();
905
883
  let t6;
906
- if ($[15] !== previewPathnames || $[16] !== previewedPage?.key || $[17] !== previewedPath || $[18] !== selectedPage?.key || $[19] !== selectedPath) {
907
- t6 = (t7) => {
908
- const { key, page, left } = t7;
884
+ if ($[15] !== sidebarWidth) {
885
+ t6 = canvasInsets(sidebarWidth);
886
+ $[15] = sidebarWidth;
887
+ $[16] = t6;
888
+ } else t6 = $[16];
889
+ const insets = t6;
890
+ const { items, width } = positionCanvasPages(pages, gap, slotWidth);
891
+ const viewport = device === "desktop" ? {
892
+ width: slotWidth,
893
+ height: CANVAS_DEVICES.desktop.height
894
+ } : CANVAS_DEVICES[device];
895
+ let t7;
896
+ if ($[17] !== previewPathnames || $[18] !== previewedPage?.key || $[19] !== previewedPath || $[20] !== selectedPage?.key || $[21] !== selectedPath) {
897
+ t7 = (t8) => {
898
+ const { key, page, left } = t8;
909
899
  return [key, {
910
900
  page,
911
901
  left,
912
902
  pathname: key === selectedPage?.key ? selectedPath : previewedPath && key === previewedPage?.key ? previewedPath : previewPathnames[key] ?? page.pathname
913
903
  }];
914
904
  };
915
- $[15] = previewPathnames;
916
- $[16] = previewedPage?.key;
917
- $[17] = previewedPath;
918
- $[18] = selectedPage?.key;
919
- $[19] = selectedPath;
920
- $[20] = t6;
921
- } else t6 = $[20];
922
- const pageSlots = new Map(items.map(t6));
923
- const framed = viewport.width < CANVAS_SLOT_WIDTH;
924
- const snapTargets = canvasSnapTargets(items);
925
- let t7;
926
- if ($[21] !== selectedPage?.key) {
927
- t7 = (t8) => {
928
- const { key: key_0 } = t8;
929
- return key_0 === selectedPage?.key;
930
- };
931
- $[21] = selectedPage?.key;
905
+ $[17] = previewPathnames;
906
+ $[18] = previewedPage?.key;
907
+ $[19] = previewedPath;
908
+ $[20] = selectedPage?.key;
909
+ $[21] = selectedPath;
932
910
  $[22] = t7;
933
911
  } else t7 = $[22];
912
+ const pageSlots = new Map(items.map(t7));
913
+ const framed = viewport.width < slotWidth;
914
+ const snapTargets = canvasSnapTargets(items);
934
915
  let t8;
935
- if ($[23] !== goTo || $[24] !== localized) {
936
- t8 = () => goTo(localized(STUDIO_CANVAS_PATH));
937
- $[23] = goTo;
938
- $[24] = localized;
939
- $[25] = t8;
940
- } else t8 = $[25];
916
+ if ($[23] !== selectedPage?.key) {
917
+ t8 = (t9) => {
918
+ const { key: key_0 } = t9;
919
+ return key_0 === selectedPage?.key;
920
+ };
921
+ $[23] = selectedPage?.key;
922
+ $[24] = t8;
923
+ } else t8 = $[24];
941
924
  let t9;
942
- if ($[26] !== follow) {
943
- t9 = () => follow?.takeOver();
944
- $[26] = follow;
925
+ if ($[25] !== goTo || $[26] !== localized) {
926
+ t9 = () => goTo(localized(STUDIO_CANVAS_PATH));
927
+ $[25] = goTo;
928
+ $[26] = localized;
945
929
  $[27] = t9;
946
930
  } else t9 = $[27];
947
- const { viewportRef, contentRef, flyTo, mirrorCamera, reveal, fitAll } = useCanvasCamera(workspaceKey, snapTargets.find(t7), {
931
+ let t10;
932
+ if ($[28] !== follow) {
933
+ t10 = () => follow?.takeOver();
934
+ $[28] = follow;
935
+ $[29] = t10;
936
+ } else t10 = $[29];
937
+ const { viewportRef, contentRef, flyTo, mirrorCamera, reveal, fitAll } = useCanvasCamera(workspaceKey, snapTargets.find(t8), {
948
938
  targets: snapTargets,
949
939
  width,
950
940
  onSelect: (key_1) => {
@@ -952,47 +942,47 @@ function CanvasWorkspace(t0) {
952
942
  if (pathname_2) selectPage(pathname_2);
953
943
  },
954
944
  selected: intendedPageKey && pageSlots.has(intendedPageKey) ? intendedPageKey : null,
955
- onDeselect: t8,
956
- insets: CANVAS_INSETS,
957
- onEditorMove: t9
945
+ onDeselect: t9,
946
+ insets,
947
+ onEditorMove: t10
958
948
  });
959
- let t10;
960
- if ($[28] !== mirrorCamera || $[29] !== reveal || $[30] !== workspaceKey) {
961
- t10 = {
949
+ let t11;
950
+ if ($[30] !== mirrorCamera || $[31] !== reveal || $[32] !== workspaceKey) {
951
+ t11 = {
962
952
  workspaceKey,
963
953
  mirrorCamera,
964
954
  reveal
965
955
  };
966
- $[28] = mirrorCamera;
967
- $[29] = reveal;
968
- $[30] = workspaceKey;
969
- $[31] = t10;
970
- } else t10 = $[31];
971
- const workspace = t10;
956
+ $[30] = mirrorCamera;
957
+ $[31] = reveal;
958
+ $[32] = workspaceKey;
959
+ $[33] = t11;
960
+ } else t11 = $[33];
961
+ const workspace = t11;
972
962
  const thumbnails = useWorkspaceThumbnails(workspaceKey);
973
963
  const instructionsId = React.useId();
974
- let t11;
975
964
  let t12;
976
- if ($[32] !== fitAll) {
977
- t11 = () => {
965
+ let t13;
966
+ if ($[34] !== fitAll) {
967
+ t12 = () => {
978
968
  let answered = canvasStore.getSnapshot().context.overviewRequests;
979
- const subscription = canvasStore.subscribe((t13) => {
980
- const { context } = t13;
969
+ const subscription = canvasStore.subscribe((t14) => {
970
+ const { context } = t14;
981
971
  if (context.overviewRequests === answered) return;
982
972
  answered = context.overviewRequests;
983
973
  fitAll();
984
974
  });
985
975
  return () => subscription.unsubscribe();
986
976
  };
987
- t12 = [fitAll];
988
- $[32] = fitAll;
989
- $[33] = t11;
990
- $[34] = t12;
977
+ t13 = [fitAll];
978
+ $[34] = fitAll;
979
+ $[35] = t12;
980
+ $[36] = t13;
991
981
  } else {
992
- t11 = $[33];
993
- t12 = $[34];
982
+ t12 = $[35];
983
+ t13 = $[36];
994
984
  }
995
- React.useEffect(t11, t12);
985
+ React.useEffect(t12, t13);
996
986
  React.useImperativeHandle(ref, () => ({
997
987
  showPage(key_2) {
998
988
  const slot = pageSlots.get(key_2);
@@ -1008,29 +998,30 @@ function CanvasWorkspace(t0) {
1008
998
  fitAll();
1009
999
  }
1010
1000
  }));
1011
- let t13;
1012
- if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
1013
- t13 = {
1001
+ let t14;
1002
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
1003
+ t14 = {
1014
1004
  userSelect: "none",
1015
1005
  overscrollBehavior: "none"
1016
1006
  };
1017
- $[35] = t13;
1018
- } else t13 = $[35];
1019
- let t14;
1020
- if ($[36] !== gap) {
1021
- t14 = {
1007
+ $[37] = t14;
1008
+ } else t14 = $[37];
1009
+ let t15;
1010
+ if ($[38] !== gap) {
1011
+ t15 = {
1022
1012
  gap,
1023
1013
  transform: CANVAS_WORLD_TRANSFORM,
1024
1014
  transformOrigin: "0 0"
1025
1015
  };
1026
- $[36] = gap;
1027
- $[37] = t14;
1028
- } else t14 = $[37];
1029
- const t17 = [...pageSlots.values()].map((t16) => {
1030
- const { page: page_1, pathname: pathname_4, left: left_0 } = t16;
1016
+ $[38] = gap;
1017
+ $[39] = t15;
1018
+ } else t15 = $[39];
1019
+ const t18 = [...pageSlots.values()].map((t17) => {
1020
+ const { page: page_1, pathname: pathname_4, left: left_0 } = t17;
1031
1021
  return /* @__PURE__ */ jsx(CanvasHeaderSlot, {
1032
1022
  itemKey: page_1.key,
1033
1023
  left: left_0,
1024
+ width: slotWidth,
1034
1025
  children: /* @__PURE__ */ jsx(CanvasPageHeader, {
1035
1026
  page: page_1,
1036
1027
  pathname: pathname_4,
@@ -1055,27 +1046,38 @@ function CanvasWorkspace(t0) {
1055
1046
  })
1056
1047
  }, page_1.key);
1057
1048
  });
1058
- let t18;
1059
- if ($[38] !== pages.length) {
1060
- t18 = !pages.length && /* @__PURE__ */ jsx(CanvasMessage, { children: "No pages to preview yet." });
1061
- $[38] = pages.length;
1062
- $[39] = t18;
1063
- } else t18 = $[39];
1064
1049
  let t19;
1065
- if ($[40] !== instructionsId) {
1066
- t19 = /* @__PURE__ */ jsx("p", {
1050
+ if ($[40] !== pages.length) {
1051
+ t19 = !pages.length && /* @__PURE__ */ jsx(CanvasMessage, { children: "No pages to preview yet." });
1052
+ $[40] = pages.length;
1053
+ $[41] = t19;
1054
+ } else t19 = $[41];
1055
+ let t20;
1056
+ if ($[42] !== instructionsId) {
1057
+ t20 = /* @__PURE__ */ jsx("p", {
1067
1058
  id: instructionsId,
1068
1059
  className: "sr-only",
1069
1060
  children: "Scroll, or hold Space and drag, to pan. Pinch or Ctrl/⌘ + scroll to zoom. Click a page to edit it. Focus the canvas and use plus or minus to zoom, arrow keys to pan, 0 for 100%, or Home / Shift+1 to fit all pages."
1070
1061
  });
1071
- $[40] = instructionsId;
1072
- $[41] = t19;
1073
- } else t19 = $[41];
1074
- let t20;
1075
- if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
1076
- t20 = ["left", "right"].map(_temp5);
1077
- $[42] = t20;
1078
- } else t20 = $[42];
1062
+ $[42] = instructionsId;
1063
+ $[43] = t20;
1064
+ } else t20 = $[43];
1065
+ let t21;
1066
+ if ($[44] !== insets) {
1067
+ t21 = ["left", "right"].map((side) => /* @__PURE__ */ jsx("div", {
1068
+ "aria-hidden": true,
1069
+ "data-canvas-scrim": side,
1070
+ className: "pointer-events-none absolute inset-y-0",
1071
+ style: {
1072
+ [side]: 0,
1073
+ width: insets[side] + 16,
1074
+ background: scrimGradient(side, insets[side]),
1075
+ zIndex: 2
1076
+ }
1077
+ }, side));
1078
+ $[44] = insets;
1079
+ $[45] = t21;
1080
+ } else t21 = $[45];
1079
1081
  return /* @__PURE__ */ jsxs("div", {
1080
1082
  ref: viewportRef,
1081
1083
  role: "region",
@@ -1084,7 +1086,7 @@ function CanvasWorkspace(t0) {
1084
1086
  tabIndex: 0,
1085
1087
  "data-camox-canvas": true,
1086
1088
  className: "bg-canvas relative min-h-0 min-w-0 flex-1 touch-none overflow-clip outline-none *:*:[--canvas-x:initial] *:*:[--canvas-y:initial] data-[canvas-pan]:cursor-grab data-[canvas-pan]:**:cursor-[inherit]! data-[canvas-pan=dragging]:cursor-grabbing data-[canvas-pan]:[&_iframe]:pointer-events-none",
1087
- style: t13,
1089
+ style: t14,
1088
1090
  children: [
1089
1091
  /* @__PURE__ */ jsx(CanvasWorkspaceContext, {
1090
1092
  value: workspace,
@@ -1096,15 +1098,16 @@ function CanvasWorkspace(t0) {
1096
1098
  ref: contentRef,
1097
1099
  "data-canvas-items": true,
1098
1100
  className: "absolute top-0 left-0 flex w-max items-start in-data-[canvas-promoted]:will-change-transform",
1099
- style: t14,
1100
- children: [...pageSlots.values()].map((t15) => {
1101
- const { page: page_0, pathname: pathname_3 } = t15;
1101
+ style: t15,
1102
+ children: [...pageSlots.values()].map((t16) => {
1103
+ const { page: page_0, pathname: pathname_3 } = t16;
1102
1104
  return /* @__PURE__ */ jsx(CanvasPageItem, {
1103
1105
  page: page_0,
1104
1106
  pathname: pathname_3,
1105
1107
  selected: page_0.key === selectedPage?.key,
1106
1108
  hover,
1107
1109
  previewed: !!previewPageFrame && page_0.key === previewedPage?.key && pathname_3 === previewedPath,
1110
+ slotWidth,
1108
1111
  framed,
1109
1112
  viewport,
1110
1113
  runtimeBasePath,
@@ -1116,33 +1119,20 @@ function CanvasWorkspace(t0) {
1116
1119
  })
1117
1120
  })
1118
1121
  }),
1119
- t17,
1120
1122
  t18,
1121
1123
  t19,
1122
- t20
1124
+ t20,
1125
+ t21
1123
1126
  ]
1124
1127
  });
1125
1128
  }
1126
- function _temp5(side) {
1127
- return /* @__PURE__ */ jsx("div", {
1128
- "aria-hidden": true,
1129
- "data-canvas-scrim": side,
1130
- className: "pointer-events-none absolute inset-y-0",
1131
- style: {
1132
- [side]: 0,
1133
- width: CANVAS_INSETS[side] + 16,
1134
- background: scrimGradient(side, CANVAS_INSETS[side]),
1135
- zIndex: 2
1136
- }
1137
- }, side);
1138
- }
1139
1129
  function CamoxCanvas(t0) {
1140
1130
  const $ = c(65);
1141
1131
  const { runtimeBasePath } = t0;
1142
1132
  const layouts = useRoutableLayouts();
1143
1133
  const location = useLocation();
1144
- const viewportMode = useSelector(previewStore, _temp6);
1145
- const viewport = CANVAS_DEVICES[viewportMode === "full" ? "desktop" : viewportMode];
1134
+ const viewportMode = useSelector(previewStore, _temp3);
1135
+ const device = viewportMode === "full" ? "desktop" : viewportMode;
1146
1136
  const [activeFrame, setActiveFrame] = React.useState(null);
1147
1137
  const selectedPath = location.pathname;
1148
1138
  const previousPath = React.useRef(selectedPath);
@@ -1171,7 +1161,7 @@ function CamoxCanvas(t0) {
1171
1161
  t3 = [];
1172
1162
  $[4] = t3;
1173
1163
  } else t3 = $[4];
1174
- React.useEffect(_temp8, t3);
1164
+ React.useEffect(_temp5, t3);
1175
1165
  const projectUuid = useProjectUuid();
1176
1166
  let t4;
1177
1167
  if ($[5] !== projectUuid) {
@@ -1392,7 +1382,7 @@ function CamoxCanvas(t0) {
1392
1382
  $[51] = t22;
1393
1383
  } else t22 = $[51];
1394
1384
  let t23;
1395
- if ($[52] !== canvasPages || $[53] !== previewedPage || $[54] !== project.data.id || $[55] !== runtimeBasePath || $[56] !== selectedPage || $[57] !== t20 || $[58] !== t22 || $[59] !== viewport) {
1385
+ if ($[52] !== canvasPages || $[53] !== device || $[54] !== previewedPage || $[55] !== project.data.id || $[56] !== runtimeBasePath || $[57] !== selectedPage || $[58] !== t20 || $[59] !== t22) {
1396
1386
  t23 = /* @__PURE__ */ jsx(CanvasWorkspace, {
1397
1387
  ref: workspace,
1398
1388
  pages: canvasPages,
@@ -1400,18 +1390,18 @@ function CamoxCanvas(t0) {
1400
1390
  previewedPage,
1401
1391
  intendedPageKey: t20,
1402
1392
  runtimeBasePath,
1403
- viewport,
1393
+ device,
1404
1394
  onActivate: t21,
1405
1395
  onSelectionIntent: t22
1406
1396
  }, project.data.id);
1407
1397
  $[52] = canvasPages;
1408
- $[53] = previewedPage;
1409
- $[54] = project.data.id;
1410
- $[55] = runtimeBasePath;
1411
- $[56] = selectedPage;
1412
- $[57] = t20;
1413
- $[58] = t22;
1414
- $[59] = viewport;
1398
+ $[53] = device;
1399
+ $[54] = previewedPage;
1400
+ $[55] = project.data.id;
1401
+ $[56] = runtimeBasePath;
1402
+ $[57] = selectedPage;
1403
+ $[58] = t20;
1404
+ $[59] = t22;
1415
1405
  $[60] = t23;
1416
1406
  } else t23 = $[60];
1417
1407
  let t24;
@@ -1431,14 +1421,14 @@ function CamoxCanvas(t0) {
1431
1421
  } else t24 = $[64];
1432
1422
  return t24;
1433
1423
  }
1434
- function _temp8() {
1424
+ function _temp5() {
1435
1425
  previewStore.send({ type: "clearSelection" });
1436
- return _temp7;
1426
+ return _temp4;
1437
1427
  }
1438
- function _temp7() {
1428
+ function _temp4() {
1439
1429
  previewStore.send({ type: "clearSelection" });
1440
1430
  }
1441
- function _temp6(state) {
1431
+ function _temp3(state) {
1442
1432
  return state.context.viewportMode;
1443
1433
  }
1444
1434
 
@@ -1,5 +1,5 @@
1
- import { revealScrollDelta } from "../preview/selectionReveal.js";
2
1
  import { CANVAS_WHEEL_ZOOM_RATE, ZOOM_STRETCH, canvasMaximumScale, canvasMinimumScale, canvasOverview, canvasVerticalRail, canvasWheelDelta, constrainCanvasCamera, findCanvasSnapTarget, fitCanvasPage, isCanvasCameraSnapped, isCanvasPageScale, isInCanvasSnapWindow, placeCanvasPageAnchor, snapCanvasZoom, stretchCanvasZoom, unstretchCanvasZoom, zoomCanvasAt } from "./canvasCamera.js";
2
+ import { revealScrollDelta } from "../preview/selectionReveal.js";
3
3
  import { createCanvasFlight, createCanvasPan } from "./canvasFlight.js";
4
4
 
5
5
  //#region src/features/canvas/canvasCameraController.ts