camox 0.65.1 → 0.66.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 (30) hide show
  1. package/dist/features/canvas/CamoxCanvas.js +195 -173
  2. package/dist/features/canvas/canvasFrameCapture.js +5 -12
  3. package/dist/features/canvas/canvasFrameDocument.js +90 -29
  4. package/dist/features/canvas/canvasItems.js +22 -6
  5. package/dist/features/canvas/sidebar/ContentSidebar.js +19 -21
  6. package/dist/features/canvas/sidebar/LayoutPageOverview.js +22 -49
  7. package/dist/features/canvas/sidebar/LayoutPageSeo.js +73 -76
  8. package/dist/features/canvas/sidebar/PageInspector.js +61 -50
  9. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +4 -4
  10. package/dist/features/canvas/useCanvasCamera.js +22 -5
  11. package/dist/features/preview/components/PageInfo.js +103 -100
  12. package/dist/features/runtime/RuntimeChrome.js +66 -40
  13. package/dist/features/studio/components/AgentSidebar.js +3 -3
  14. package/dist/features/studio/components/ChatWidget.js +34 -29
  15. package/dist/features/studio/components/DraftsControl.js +172 -159
  16. package/dist/features/studio/components/Patrol.js +423 -418
  17. package/dist/features/studio/components/ReviewDraftSheet.js +227 -188
  18. package/dist/features/studio/components/ThreadComposer.js +183 -121
  19. package/dist/features/studio/components/ThreadMessages.js +19 -11
  20. package/dist/features/studio/components/UnnamedDraftBar.js +349 -0
  21. package/dist/features/studio/patrollerBio.js +40 -0
  22. package/dist/features/studio/studioStore.js +13 -0
  23. package/dist/features/studio/workingSentence.js +2 -7
  24. package/dist/lib/revisions.js +25 -3
  25. package/dist/lib/use-thread.js +1 -1
  26. package/dist/package.js +1 -1
  27. package/dist/studio.css +1 -1
  28. package/package.json +4 -4
  29. package/dist/features/canvas/sidebar/DerivedPageInspector.js +0 -49
  30. package/dist/features/canvas/sidebar/SingletonPageInspector.js +0 -39
@@ -14,13 +14,13 @@ import { useRendererHost } from "../renderer/RendererFrames.js";
14
14
  import { STUDIO_CANVAS_PATH } from "../studio/routes.js";
15
15
  import { PREVIEW_PAGE_SLOT_ATTRIBUTE, PreviewPageFrameContext } from "../preview/previewPageFrame.js";
16
16
  import { PreviewPreparationContext } from "../preview/previewPreparation.js";
17
- import { canvasBlockOverlap } from "./canvasFrameDocument.js";
18
- import { PageRecordContext, getPageRecord } from "../preview/pageRecord.js";
17
+ import { canvasSeamCover } from "./canvasFrameDocument.js";
18
+ import { PageRecordContext } from "../preview/pageRecord.js";
19
19
  import { CuratedBlockShortcuts } from "../preview/components/PreviewPanel.js";
20
20
  import { FollowAgentContext } from "../studio/followAgentContext.js";
21
21
  import { useCanvasFrameMode } from "./canvasFrameMode.js";
22
22
  import { CANVAS_DEVICES, canvasLayoutId, canvasPageId, derivedLayoutIdOf, getCanvasPages } from "./canvasPages.js";
23
- import { CANVAS_SLOT_WIDTH, canvasSnapTargets, positionCanvasPages } from "./canvasItems.js";
23
+ import { CANVAS_SLOT_WIDTH, canvasItemGap, canvasSnapTargets, positionCanvasPages } from "./canvasItems.js";
24
24
  import { CanvasOverlaysShownContext } from "./CanvasOverlays.js";
25
25
  import { CanvasPageEdge } from "./CanvasPageEdge.js";
26
26
  import { CANVAS_THUMBNAIL_MAX_ZOOM, CanvasThumbnailsContext, canvasThumbnailsSupported, createCanvasThumbnails, useCanvasThumbnail } from "./canvasThumbnails.js";
@@ -51,6 +51,35 @@ const CANVAS_INSETS = {
51
51
  bottom: 8,
52
52
  left: 265
53
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;
82
+ }
54
83
  function usePreparationFailure(error, t0) {
55
84
  const $ = c(5);
56
85
  const selected = t0 === void 0 ? true : t0;
@@ -237,7 +266,7 @@ function CanvasPagePreview(props) {
237
266
  if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
238
267
  t6 = (frame) => {
239
268
  setSettledFrame(frame);
240
- setSettles(_temp);
269
+ setSettles(_temp3);
241
270
  };
242
271
  $[22] = t6;
243
272
  } else t6 = $[22];
@@ -252,16 +281,16 @@ function CanvasPagePreview(props) {
252
281
  if (started.current >= settles) return;
253
282
  const request = settles;
254
283
  started.current = request;
255
- const pixelRatio = window.devicePixelRatio;
284
+ const scale = Math.min(1, CANVAS_THUMBNAIL_MAX_ZOOM * window.devicePixelRatio);
256
285
  const options = {
257
- scale: Math.min(1, CANVAS_THUMBNAIL_MAX_ZOOM * pixelRatio),
258
- blockOverlap: canvasBlockOverlap(CANVAS_THUMBNAIL_MAX_ZOOM, pixelRatio)
286
+ scale,
287
+ seamCover: canvasSeamCover(scale, 1)
259
288
  };
260
289
  const tokens = [
261
290
  props.pathname,
262
291
  props.pageId,
263
292
  props.derivedLayoutId
264
- ].filter(_temp2);
293
+ ].filter(_temp4);
265
294
  thumbnails.capture(key, settledFrame, tokens, options).catch((error) => {
266
295
  thumbnails.abandon(key);
267
296
  console.warn(`[camox] Could not capture ${props.pathname} for the Canvas.`, error);
@@ -366,10 +395,10 @@ function CanvasPagePreview(props) {
366
395
  } else t13 = $[52];
367
396
  return t13;
368
397
  }
369
- function _temp2(token) {
398
+ function _temp4(token) {
370
399
  return !!token;
371
400
  }
372
- function _temp(count) {
401
+ function _temp3(count) {
373
402
  return count + 1;
374
403
  }
375
404
  function CanvasPageFrameLoader(t0) {
@@ -802,7 +831,7 @@ function useWorkspaceThumbnails(workspaceKey) {
802
831
  return thumbnails;
803
832
  }
804
833
  function CanvasWorkspace(t0) {
805
- const $ = c(42);
834
+ const $ = c(43);
806
835
  const { ref, pages, selectedPage, previewedPage, intendedPageKey, runtimeBasePath, viewport, onActivate, onSelectionIntent } = t0;
807
836
  const { apiUrl, projectUuid } = useAuthContext();
808
837
  const renamePage = useRenamePage();
@@ -871,7 +900,8 @@ function CanvasWorkspace(t0) {
871
900
  $[14] = t5;
872
901
  } else t5 = $[14];
873
902
  const [previewPathnames, setPreviewPathnames] = React.useState(t5);
874
- const { items, width } = positionCanvasPages(pages);
903
+ const gap = useCanvasItemGap();
904
+ const { items, width } = positionCanvasPages(pages, gap);
875
905
  let t6;
876
906
  if ($[15] !== previewPathnames || $[16] !== previewedPage?.key || $[17] !== previewedPath || $[18] !== selectedPage?.key || $[19] !== selectedPath) {
877
907
  t6 = (t7) => {
@@ -987,14 +1017,15 @@ function CanvasWorkspace(t0) {
987
1017
  $[35] = t13;
988
1018
  } else t13 = $[35];
989
1019
  let t14;
990
- if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
1020
+ if ($[36] !== gap) {
991
1021
  t14 = {
992
- gap: 240,
1022
+ gap,
993
1023
  transform: CANVAS_WORLD_TRANSFORM,
994
1024
  transformOrigin: "0 0"
995
1025
  };
996
- $[36] = t14;
997
- } else t14 = $[36];
1026
+ $[36] = gap;
1027
+ $[37] = t14;
1028
+ } else t14 = $[37];
998
1029
  const t17 = [...pageSlots.values()].map((t16) => {
999
1030
  const { page: page_1, pathname: pathname_4, left: left_0 } = t16;
1000
1031
  return /* @__PURE__ */ jsx(CanvasHeaderSlot, {
@@ -1025,26 +1056,26 @@ function CanvasWorkspace(t0) {
1025
1056
  }, page_1.key);
1026
1057
  });
1027
1058
  let t18;
1028
- if ($[37] !== pages.length) {
1059
+ if ($[38] !== pages.length) {
1029
1060
  t18 = !pages.length && /* @__PURE__ */ jsx(CanvasMessage, { children: "No pages to preview yet." });
1030
- $[37] = pages.length;
1031
- $[38] = t18;
1032
- } else t18 = $[38];
1061
+ $[38] = pages.length;
1062
+ $[39] = t18;
1063
+ } else t18 = $[39];
1033
1064
  let t19;
1034
- if ($[39] !== instructionsId) {
1065
+ if ($[40] !== instructionsId) {
1035
1066
  t19 = /* @__PURE__ */ jsx("p", {
1036
1067
  id: instructionsId,
1037
1068
  className: "sr-only",
1038
1069
  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."
1039
1070
  });
1040
- $[39] = instructionsId;
1041
- $[40] = t19;
1042
- } else t19 = $[40];
1071
+ $[40] = instructionsId;
1072
+ $[41] = t19;
1073
+ } else t19 = $[41];
1043
1074
  let t20;
1044
- if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
1045
- t20 = ["left", "right"].map(_temp3);
1046
- $[41] = t20;
1047
- } else t20 = $[41];
1075
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
1076
+ t20 = ["left", "right"].map(_temp5);
1077
+ $[42] = t20;
1078
+ } else t20 = $[42];
1048
1079
  return /* @__PURE__ */ jsxs("div", {
1049
1080
  ref: viewportRef,
1050
1081
  role: "region",
@@ -1092,7 +1123,7 @@ function CanvasWorkspace(t0) {
1092
1123
  ]
1093
1124
  });
1094
1125
  }
1095
- function _temp3(side) {
1126
+ function _temp5(side) {
1096
1127
  return /* @__PURE__ */ jsx("div", {
1097
1128
  "aria-hidden": true,
1098
1129
  "data-canvas-scrim": side,
@@ -1106,11 +1137,11 @@ function _temp3(side) {
1106
1137
  }, side);
1107
1138
  }
1108
1139
  function CamoxCanvas(t0) {
1109
- const $ = c(68);
1140
+ const $ = c(65);
1110
1141
  const { runtimeBasePath } = t0;
1111
1142
  const layouts = useRoutableLayouts();
1112
1143
  const location = useLocation();
1113
- const viewportMode = useSelector(previewStore, _temp4);
1144
+ const viewportMode = useSelector(previewStore, _temp6);
1114
1145
  const viewport = CANVAS_DEVICES[viewportMode === "full" ? "desktop" : viewportMode];
1115
1146
  const [activeFrame, setActiveFrame] = React.useState(null);
1116
1147
  const selectedPath = location.pathname;
@@ -1140,7 +1171,7 @@ function CamoxCanvas(t0) {
1140
1171
  t3 = [];
1141
1172
  $[4] = t3;
1142
1173
  } else t3 = $[4];
1143
- React.useEffect(_temp6, t3);
1174
+ React.useEffect(_temp8, t3);
1144
1175
  const projectUuid = useProjectUuid();
1145
1176
  let t4;
1146
1177
  if ($[5] !== projectUuid) {
@@ -1195,19 +1226,12 @@ function CamoxCanvas(t0) {
1195
1226
  derivedLayoutId: derivedLayoutIdOf(intendedPage)
1196
1227
  }), t9);
1197
1228
  const recordResult = derivedLayoutIdOf(intendedPage) ? intendedFrameInput?.derived?.result : void 0;
1198
- let t10;
1199
- if ($[14] !== recordResult) {
1200
- t10 = getPageRecord(recordResult);
1201
- $[14] = recordResult;
1202
- $[15] = t10;
1203
- } else t10 = $[15];
1204
- const pageRecord = t10;
1205
1229
  usePreparationFailure((!project.isFetching ? project.error : null) ?? (!pages.isFetching ? pages.error : null));
1206
1230
  const preparation = React.useContext(PreviewPreparationContext);
1231
+ let t10;
1207
1232
  let t11;
1208
- let t12;
1209
- if ($[16] !== location.pathname || $[17] !== pages.error || $[18] !== pages.isPending || $[19] !== preparation || $[20] !== project.error || $[21] !== project.isPending || $[22] !== selectedPage || $[23] !== viewLocale.locales) {
1210
- t11 = () => {
1233
+ if ($[14] !== location.pathname || $[15] !== pages.error || $[16] !== pages.isPending || $[17] !== preparation || $[18] !== project.error || $[19] !== project.isPending || $[20] !== selectedPage || $[21] !== viewLocale.locales) {
1234
+ t10 = () => {
1211
1235
  if (project.isPending || pages.isPending || project.error || pages.error) return;
1212
1236
  if (parseLocalePath(location.pathname, viewLocale.locales).path === "/camox/canvas") {
1213
1237
  preparation?.ready();
@@ -1216,7 +1240,7 @@ function CamoxCanvas(t0) {
1216
1240
  if (selectedPage) return;
1217
1241
  preparation?.fail(/* @__PURE__ */ new Error(`No canvas page matches ${location.pathname}.`));
1218
1242
  };
1219
- t12 = [
1243
+ t11 = [
1220
1244
  project.isPending,
1221
1245
  pages.isPending,
1222
1246
  project.error,
@@ -1226,32 +1250,32 @@ function CamoxCanvas(t0) {
1226
1250
  viewLocale.locales,
1227
1251
  preparation
1228
1252
  ];
1229
- $[16] = location.pathname;
1230
- $[17] = pages.error;
1231
- $[18] = pages.isPending;
1232
- $[19] = preparation;
1233
- $[20] = project.error;
1234
- $[21] = project.isPending;
1235
- $[22] = selectedPage;
1236
- $[23] = viewLocale.locales;
1237
- $[24] = t11;
1238
- $[25] = t12;
1253
+ $[14] = location.pathname;
1254
+ $[15] = pages.error;
1255
+ $[16] = pages.isPending;
1256
+ $[17] = preparation;
1257
+ $[18] = project.error;
1258
+ $[19] = project.isPending;
1259
+ $[20] = selectedPage;
1260
+ $[21] = viewLocale.locales;
1261
+ $[22] = t10;
1262
+ $[23] = t11;
1239
1263
  } else {
1240
- t11 = $[24];
1241
- t12 = $[25];
1264
+ t10 = $[22];
1265
+ t11 = $[23];
1242
1266
  }
1243
- React.useEffect(t11, t12);
1267
+ React.useEffect(t10, t11);
1244
1268
  if (project.error || pages.error) {
1269
+ let t12;
1270
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
1271
+ t12 = /* @__PURE__ */ jsx("p", { children: "Could not load the site’s pages." });
1272
+ $[24] = t12;
1273
+ } else t12 = $[24];
1245
1274
  let t13;
1246
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
1247
- t13 = /* @__PURE__ */ jsx("p", { children: "Could not load the site’s pages." });
1248
- $[26] = t13;
1249
- } else t13 = $[26];
1250
- let t14;
1251
- if ($[27] !== pages || $[28] !== project) {
1252
- t14 = /* @__PURE__ */ jsx(CanvasMessage, { children: /* @__PURE__ */ jsxs("div", {
1275
+ if ($[25] !== pages || $[26] !== project) {
1276
+ t13 = /* @__PURE__ */ jsx(CanvasMessage, { children: /* @__PURE__ */ jsxs("div", {
1253
1277
  role: "alert",
1254
- children: [t13, /* @__PURE__ */ jsx("button", {
1278
+ children: [t12, /* @__PURE__ */ jsx("button", {
1255
1279
  className: "mt-4 underline",
1256
1280
  onClick: () => {
1257
1281
  if (project.error) project.refetch();
@@ -1260,104 +1284,102 @@ function CamoxCanvas(t0) {
1260
1284
  children: "Try again"
1261
1285
  })]
1262
1286
  }) });
1263
- $[27] = pages;
1264
- $[28] = project;
1265
- $[29] = t14;
1266
- } else t14 = $[29];
1267
- return t14;
1287
+ $[25] = pages;
1288
+ $[26] = project;
1289
+ $[27] = t13;
1290
+ } else t13 = $[27];
1291
+ return t13;
1268
1292
  }
1269
1293
  if (project.isPending || pages.isPending) {
1270
- let t13;
1271
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
1272
- t13 = /* @__PURE__ */ jsx(CanvasMessage, { children: /* @__PURE__ */ jsx("span", {
1294
+ let t12;
1295
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
1296
+ t12 = /* @__PURE__ */ jsx(CanvasMessage, { children: /* @__PURE__ */ jsx("span", {
1273
1297
  role: "status",
1274
1298
  children: "Loading canvas…"
1275
1299
  }) });
1276
- $[30] = t13;
1277
- } else t13 = $[30];
1278
- return t13;
1300
+ $[28] = t12;
1301
+ } else t12 = $[28];
1302
+ return t12;
1279
1303
  }
1280
1304
  const editingOwner = activeFrame?.pathname === intended.pathname ? activeFrame.owner : null;
1281
- let t13;
1282
- if ($[31] !== selectedPage?.kind) {
1283
- t13 = selectedPage?.kind === "curated" && /* @__PURE__ */ jsx(CuratedBlockShortcuts, {});
1284
- $[31] = selectedPage?.kind;
1285
- $[32] = t13;
1286
- } else t13 = $[32];
1287
- const t14 = intendedPage?.key;
1305
+ let t12;
1306
+ if ($[29] !== selectedPage?.kind) {
1307
+ t12 = selectedPage?.kind === "curated" && /* @__PURE__ */ jsx(CuratedBlockShortcuts, {});
1308
+ $[29] = selectedPage?.kind;
1309
+ $[30] = t12;
1310
+ } else t12 = $[30];
1311
+ const t13 = intendedPage?.key;
1312
+ let t14;
1313
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
1314
+ t14 = (key) => workspace.current?.showPage(key);
1315
+ $[31] = t14;
1316
+ } else t14 = $[31];
1288
1317
  let t15;
1289
- if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
1290
- t15 = (key) => workspace.current?.showPage(key);
1291
- $[33] = t15;
1292
- } else t15 = $[33];
1293
- let t16;
1294
- if ($[34] !== canvasPages || $[35] !== t14) {
1295
- t16 = {
1318
+ if ($[32] !== canvasPages || $[33] !== t13) {
1319
+ t15 = {
1296
1320
  pages: canvasPages,
1297
- selectedKey: t14,
1298
- onShowPage: t15
1321
+ selectedKey: t13,
1322
+ onShowPage: t14
1299
1323
  };
1300
- $[34] = canvasPages;
1301
- $[35] = t14;
1302
- $[36] = t16;
1303
- } else t16 = $[36];
1324
+ $[32] = canvasPages;
1325
+ $[33] = t13;
1326
+ $[34] = t15;
1327
+ } else t15 = $[34];
1328
+ let t16;
1329
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
1330
+ t16 = () => workspace.current?.showWholeCanvas();
1331
+ $[35] = t16;
1332
+ } else t16 = $[35];
1304
1333
  let t17;
1305
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
1306
- t17 = () => workspace.current?.showWholeCanvas();
1307
- $[37] = t17;
1308
- } else t17 = $[37];
1309
- let t18;
1310
- if ($[38] !== editingOwner || $[39] !== intendedPage || $[40] !== pageRecord || $[41] !== runtimeBasePath || $[42] !== t16) {
1311
- t18 = /* @__PURE__ */ jsx(ContentSidebar, {
1334
+ if ($[36] !== editingOwner || $[37] !== intendedPage || $[38] !== runtimeBasePath || $[39] !== t15) {
1335
+ t17 = /* @__PURE__ */ jsx(ContentSidebar, {
1312
1336
  page: intendedPage,
1313
- navigator: t16,
1314
- onShowWholeCanvas: t17,
1337
+ navigator: t15,
1338
+ onShowWholeCanvas: t16,
1315
1339
  owner: editingOwner,
1316
- pageRecord,
1317
1340
  runtimeBasePath
1318
1341
  });
1319
- $[38] = editingOwner;
1320
- $[39] = intendedPage;
1321
- $[40] = pageRecord;
1322
- $[41] = runtimeBasePath;
1323
- $[42] = t16;
1342
+ $[36] = editingOwner;
1343
+ $[37] = intendedPage;
1344
+ $[38] = runtimeBasePath;
1345
+ $[39] = t15;
1346
+ $[40] = t17;
1347
+ } else t17 = $[40];
1348
+ let t18;
1349
+ if ($[41] !== recordResult || $[42] !== t17) {
1350
+ t18 = /* @__PURE__ */ jsx(PageRecordContext, {
1351
+ value: recordResult,
1352
+ children: t17
1353
+ });
1354
+ $[41] = recordResult;
1355
+ $[42] = t17;
1324
1356
  $[43] = t18;
1325
1357
  } else t18 = $[43];
1326
1358
  let t19;
1327
- if ($[44] !== recordResult || $[45] !== t18) {
1328
- t19 = /* @__PURE__ */ jsx(PageRecordContext, {
1329
- value: recordResult,
1330
- children: t18
1331
- });
1332
- $[44] = recordResult;
1333
- $[45] = t18;
1334
- $[46] = t19;
1335
- } else t19 = $[46];
1336
- let t20;
1337
- if ($[47] !== intended || $[48] !== navigate || $[49] !== t19) {
1338
- t20 = /* @__PURE__ */ jsx(NavigationProvider, {
1359
+ if ($[44] !== intended || $[45] !== navigate || $[46] !== t18) {
1360
+ t19 = /* @__PURE__ */ jsx(NavigationProvider, {
1339
1361
  location: intended,
1340
1362
  navigate,
1341
- children: t19
1363
+ children: t18
1342
1364
  });
1343
- $[47] = intended;
1344
- $[48] = navigate;
1345
- $[49] = t19;
1346
- $[50] = t20;
1347
- } else t20 = $[50];
1348
- const t21 = intendedPage?.key;
1349
- let t22;
1350
- if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
1351
- t22 = (pathname, owner, release) => setActiveFrame({
1365
+ $[44] = intended;
1366
+ $[45] = navigate;
1367
+ $[46] = t18;
1368
+ $[47] = t19;
1369
+ } else t19 = $[47];
1370
+ const t20 = intendedPage?.key;
1371
+ let t21;
1372
+ if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
1373
+ t21 = (pathname, owner, release) => setActiveFrame({
1352
1374
  pathname,
1353
1375
  owner,
1354
1376
  release
1355
1377
  });
1356
- $[51] = t22;
1357
- } else t22 = $[51];
1358
- let t23;
1359
- if ($[52] !== location || $[53] !== setIntent) {
1360
- t23 = (pathname_0) => setIntent({
1378
+ $[48] = t21;
1379
+ } else t21 = $[48];
1380
+ let t22;
1381
+ if ($[49] !== location || $[50] !== setIntent) {
1382
+ t22 = (pathname_0) => setIntent({
1361
1383
  from: location.pathname,
1362
1384
  to: {
1363
1385
  ...location,
@@ -1365,58 +1387,58 @@ function CamoxCanvas(t0) {
1365
1387
  href: new URL(`${pathname_0}${location.search}${location.hash}`, window.location.href).href
1366
1388
  }
1367
1389
  });
1368
- $[52] = location;
1369
- $[53] = setIntent;
1370
- $[54] = t23;
1371
- } else t23 = $[54];
1372
- let t24;
1373
- if ($[55] !== canvasPages || $[56] !== previewedPage || $[57] !== project.data.id || $[58] !== runtimeBasePath || $[59] !== selectedPage || $[60] !== t21 || $[61] !== t23 || $[62] !== viewport) {
1374
- t24 = /* @__PURE__ */ jsx(CanvasWorkspace, {
1390
+ $[49] = location;
1391
+ $[50] = setIntent;
1392
+ $[51] = t22;
1393
+ } else t22 = $[51];
1394
+ let t23;
1395
+ if ($[52] !== canvasPages || $[53] !== previewedPage || $[54] !== project.data.id || $[55] !== runtimeBasePath || $[56] !== selectedPage || $[57] !== t20 || $[58] !== t22 || $[59] !== viewport) {
1396
+ t23 = /* @__PURE__ */ jsx(CanvasWorkspace, {
1375
1397
  ref: workspace,
1376
1398
  pages: canvasPages,
1377
1399
  selectedPage,
1378
1400
  previewedPage,
1379
- intendedPageKey: t21,
1401
+ intendedPageKey: t20,
1380
1402
  runtimeBasePath,
1381
1403
  viewport,
1382
- onActivate: t22,
1383
- onSelectionIntent: t23
1404
+ onActivate: t21,
1405
+ onSelectionIntent: t22
1384
1406
  }, project.data.id);
1385
- $[55] = canvasPages;
1386
- $[56] = previewedPage;
1387
- $[57] = project.data.id;
1388
- $[58] = runtimeBasePath;
1389
- $[59] = selectedPage;
1390
- $[60] = t21;
1391
- $[61] = t23;
1392
- $[62] = viewport;
1393
- $[63] = t24;
1394
- } else t24 = $[63];
1395
- let t25;
1396
- if ($[64] !== t13 || $[65] !== t20 || $[66] !== t24) {
1397
- t25 = /* @__PURE__ */ jsxs("div", {
1407
+ $[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;
1415
+ $[60] = t23;
1416
+ } else t23 = $[60];
1417
+ let t24;
1418
+ if ($[61] !== t12 || $[62] !== t19 || $[63] !== t23) {
1419
+ t24 = /* @__PURE__ */ jsxs("div", {
1398
1420
  className: "relative flex min-h-0 flex-1 overflow-hidden",
1399
1421
  children: [
1400
- t13,
1401
- t20,
1402
- t24
1422
+ t12,
1423
+ t19,
1424
+ t23
1403
1425
  ]
1404
1426
  });
1405
- $[64] = t13;
1406
- $[65] = t20;
1407
- $[66] = t24;
1408
- $[67] = t25;
1409
- } else t25 = $[67];
1410
- return t25;
1427
+ $[61] = t12;
1428
+ $[62] = t19;
1429
+ $[63] = t23;
1430
+ $[64] = t24;
1431
+ } else t24 = $[64];
1432
+ return t24;
1411
1433
  }
1412
- function _temp6() {
1434
+ function _temp8() {
1413
1435
  previewStore.send({ type: "clearSelection" });
1414
- return _temp5;
1436
+ return _temp7;
1415
1437
  }
1416
- function _temp5() {
1438
+ function _temp7() {
1417
1439
  previewStore.send({ type: "clearSelection" });
1418
1440
  }
1419
- function _temp4(state) {
1441
+ function _temp6(state) {
1420
1442
  return state.context.viewportMode;
1421
1443
  }
1422
1444
 
@@ -1,5 +1,3 @@
1
- import { BLOCK_OVERLAP_SELECTOR } from "./canvasFrameDocument.js";
2
-
3
1
  //#region src/features/canvas/canvasFrameCapture.ts
4
2
  const XHTML = "http://www.w3.org/1999/xhtml";
5
3
  const URL_PATTERN = /url\(\s*(["']?)([^"')]+)\1\s*\)/g;
@@ -149,7 +147,7 @@ function createFrameCapturer() {
149
147
  }))).filter(Boolean).join("\n");
150
148
  }
151
149
  /** The SVG drawing `doc`'s content at `width` by `height` CSS pixels, at `scale`. */
152
- async function documentSvg(doc, width, height, scale, blockOverlap) {
150
+ async function documentSvg(doc, width, height, scale, seamCover) {
153
151
  const view = doc.defaultView;
154
152
  if (!view || !doc.body) throw new Error("The frame has no document to capture.");
155
153
  const html = doc.documentElement.cloneNode(false);
@@ -211,7 +209,7 @@ function createFrameCapturer() {
211
209
  for (const element of Array.from(body.querySelectorAll("[data-camox-studio]"))) element.remove();
212
210
  freezeAnimations(doc, clonesOf);
213
211
  const background = [doc.documentElement, doc.body].map((element) => view.getComputedStyle(element).backgroundColor).find((color) => color && color !== "rgba(0, 0, 0, 0)");
214
- if (blockOverlap !== void 0) html.style.setProperty("--camox-block-overlap", `${blockOverlap}px`);
212
+ if (seamCover !== void 0) html.style.setProperty("--camox-seam-cover", `${seamCover}px`);
215
213
  html.style.setProperty("width", `${width}px`);
216
214
  html.style.setProperty("height", `${height}px`);
217
215
  html.style.setProperty("overflow", "hidden", "important");
@@ -234,14 +232,12 @@ function createFrameCapturer() {
234
232
  * Draws a same-origin frame, as its content is now, at `scale` times its CSS size. Its
235
233
  * animations are frozen where they are.
236
234
  */
237
- async function capture(frame, { scale, blockOverlap }) {
235
+ async function capture(frame, { scale, seamCover }) {
238
236
  const doc = sameOriginDocument(frame);
239
237
  const width = frame.offsetWidth;
240
- let height = frame.offsetHeight;
238
+ const height = frame.offsetHeight;
241
239
  if (!doc || !width || !height) throw new Error("The frame can't be captured.");
242
- const overlap = blockOverlapOf(doc);
243
- if (blockOverlap !== void 0 && blockOverlap !== overlap) height += doc.querySelectorAll(BLOCK_OVERLAP_SELECTOR).length * (overlap - blockOverlap);
244
- const svg = await documentSvg(doc, width, height, scale, blockOverlap);
240
+ const svg = await documentSvg(doc, width, height, scale, seamCover);
245
241
  const image = new Image();
246
242
  image.src = svgUrl(svg);
247
243
  await image.decode();
@@ -345,9 +341,6 @@ function freezeAnimations(doc, clonesOf) {
345
341
  }
346
342
  }
347
343
  }
348
- function blockOverlapOf(doc) {
349
- return parseFloat(doc.documentElement.style.getPropertyValue("--camox-block-overlap")) || 0;
350
- }
351
344
  function svgUrl(svg) {
352
345
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
353
346
  }