@mgamadeus/ddd-design-studio 0.3.2 → 0.4.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.
@@ -1,6 +1,9 @@
1
1
  'use client';
2
2
  import {
3
3
  CODE_PARAM,
4
+ FRAME_GAP,
5
+ FRAME_LABEL_HEIGHT,
6
+ boardCanvasSize,
4
7
  boardCodeOf,
5
8
  buildBoardCodeLink,
6
9
  buildBoardDeepLink,
@@ -9,12 +12,23 @@ import {
9
12
  copyTextToClipboard,
10
13
  cx,
11
14
  findBoardForCode,
15
+ frameCanvasHeight,
16
+ framesOf,
17
+ initialViewportForBoard,
18
+ isPinInViewport,
19
+ isResponsiveBoard,
12
20
  normalizeBoardCode,
21
+ pageHeightAtWidth,
22
+ rotateViewport,
13
23
  splitThemeReference,
14
24
  useDesignStudio,
15
25
  useDesignStudioComponents,
16
- useDesignStudioTexts
17
- } from "../chunk-ICDABLFY.js";
26
+ useDesignStudioTexts,
27
+ viewportLabel,
28
+ viewportOfComment,
29
+ viewportOfDevice,
30
+ viewportWithWidth
31
+ } from "../chunk-D2DS4FPR.js";
18
32
 
19
33
  // src/canvas/DesignStudioCanvasScreen.tsx
20
34
  import { normalizeDddError as normalizeDddError3 } from "@mgamadeus/ddd-web/api";
@@ -32,9 +46,11 @@ import {
32
46
  PanelRightClose,
33
47
  PanelRightOpen,
34
48
  RefreshCw,
35
- Sun
49
+ Sun,
50
+ FoldVertical,
51
+ UnfoldVertical
36
52
  } from "lucide-react";
37
- import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo2, useRef as useRef3, useState as useState8 } from "react";
53
+ import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo2, useRef as useRef4, useState as useState9 } from "react";
38
54
 
39
55
  // src/canvas/BoardComments.tsx
40
56
  import { normalizeDddError } from "@mgamadeus/ddd-web/api";
@@ -94,9 +110,11 @@ var ThreadCard = ({
94
110
  authAccountId,
95
111
  writesAllowed,
96
112
  hasBoardChangedSince,
97
- isExpiring
113
+ isExpiring,
114
+ onSelectViewport
98
115
  }) => {
99
116
  const { root, replies, pinNumber } = thread;
117
+ const rootViewport = viewportOfComment(root);
100
118
  const [replyText, setReplyText] = useState("");
101
119
  const { api, components, notify } = useDesignStudio();
102
120
  const { Badge, Button, Textarea } = components;
@@ -138,6 +156,22 @@ var ThreadCard = ({
138
156
  " ",
139
157
  pinNumber
140
158
  ] }) : /* @__PURE__ */ jsx(Badge, { variant: "outline", children: "Board" }),
159
+ rootViewport && /* @__PURE__ */ jsxs(
160
+ "button",
161
+ {
162
+ type: "button",
163
+ className: "rounded-full bg-tint px-2 py-0.5 text-xs font-medium text-muted-foreground tabular-nums hover:bg-tint-strong hover:text-foreground disabled:cursor-default",
164
+ title: "Pinned in this viewport: show the board in it",
165
+ disabled: !onSelectViewport,
166
+ onClick: () => onSelectViewport?.(rootViewport),
167
+ children: [
168
+ rootViewport.width,
169
+ " \xD7 ",
170
+ rootViewport.height,
171
+ rootViewport.deviceKey ? ` \xB7 ${rootViewport.deviceKey}` : ""
172
+ ]
173
+ }
174
+ ),
141
175
  root.isDecision && /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "border-transparent bg-success/15 text-success", children: [
142
176
  /* @__PURE__ */ jsx(Flag, { "aria-hidden": true }),
143
177
  " Decision"
@@ -281,7 +315,8 @@ var BoardComments = ({
281
315
  showResolved,
282
316
  onShowResolvedChange,
283
317
  pinHint,
284
- onCopyThreadReference
318
+ onCopyThreadReference,
319
+ onSelectViewport
285
320
  }) => {
286
321
  const [text, setText] = useState("");
287
322
  const [isDecision, setIsDecision] = useState(false);
@@ -305,6 +340,9 @@ var BoardComments = ({
305
340
  text,
306
341
  x: pendingPin?.x ?? null,
307
342
  y: pendingPin?.y ?? null,
343
+ viewportWidth: pendingPin?.viewport?.width ?? null,
344
+ viewportHeight: pendingPin?.viewport?.height ?? null,
345
+ deviceKey: pendingPin?.viewport?.deviceKey ?? null,
308
346
  isDecision
309
347
  }
310
348
  }).unwrap();
@@ -370,6 +408,7 @@ var BoardComments = ({
370
408
  {
371
409
  thread,
372
410
  onCopyReference: onCopyThreadReference,
411
+ onSelectViewport,
373
412
  isHighlighted: highlightedCommentId === Number(thread.root.id),
374
413
  onHighlight: () => onHighlightComment(Number(thread.root.id)),
375
414
  authAccountId,
@@ -383,13 +422,23 @@ var BoardComments = ({
383
422
  };
384
423
 
385
424
  // src/canvas/BoardFocusView.tsx
386
- import { ChevronLeft, ChevronRight, ClipboardCopy as ClipboardCopy3, MapPin as MapPin2, MapPinPlus, SquareDashedMousePointer, X } from "lucide-react";
387
- import { useEffect as useEffect4, useState as useState6 } from "react";
425
+ import {
426
+ ChevronLeft,
427
+ ChevronRight,
428
+ ClipboardCopy as ClipboardCopy3,
429
+ MapPin as MapPin2,
430
+ MapPinPlus,
431
+ RotateCw,
432
+ Smartphone,
433
+ SquareDashedMousePointer,
434
+ X
435
+ } from "lucide-react";
436
+ import { useEffect as useEffect4, useRef as useRef2, useState as useState7 } from "react";
388
437
 
389
438
  // src/canvas/BoardNode.tsx
390
439
  import { useStore } from "@xyflow/react";
391
440
  import { ClipboardCopy as ClipboardCopy2, Download, Maximize2, MessageSquare } from "lucide-react";
392
- import { memo, useEffect as useEffect3, useRef, useState as useState5 } from "react";
441
+ import { memo, useEffect as useEffect3, useRef, useState as useState6 } from "react";
393
442
 
394
443
  // src/canvas/boardStatus.ts
395
444
  var boardStatusDefinition = (statuses, status) => statuses[status];
@@ -397,10 +446,20 @@ var boardStatusLabel = (statuses, status) => boardStatusDefinition(statuses, sta
397
446
 
398
447
  // src/canvas/boardDetail.ts
399
448
  var SMALL_THUMBNAIL_MAX_RENDERED_WIDTH = 130;
449
+ var PREVIEW_THUMBNAIL_MAX_RENDERED_WIDTH = 800;
400
450
  var LIVE_MIN_RENDERED_WIDTH_RATIO = 0.6;
401
451
  var LIVE_MIN_RENDERED_WIDTH_RATIO_WITHOUT_THUMBNAILS = 0.35;
402
452
  var MAX_LIVE_BOARDS = 6;
403
- var thumbnailVariantForZoom = (zoom, boardWidth) => boardWidth * zoom <= SMALL_THUMBNAIL_MAX_RENDERED_WIDTH ? "small" : "default";
453
+ var thumbnailVariantForZoom = (zoom, boardWidth) => {
454
+ const renderedWidth = boardWidth * zoom;
455
+ if (renderedWidth <= SMALL_THUMBNAIL_MAX_RENDERED_WIDTH) return "small";
456
+ return renderedWidth <= PREVIEW_THUMBNAIL_MAX_RENDERED_WIDTH ? "preview" : "default";
457
+ };
458
+ var thumbnailUrlForVariant = (urls, variant) => {
459
+ if (variant === "small") return urls.thumbnailSmallUrl ?? urls.thumbnailPreviewUrl ?? urls.thumbnailUrl ?? null;
460
+ if (variant === "preview") return urls.thumbnailPreviewUrl ?? urls.thumbnailUrl ?? null;
461
+ return urls.thumbnailUrl ?? null;
462
+ };
404
463
  var isZoomLiveCapable = (zoom, minRatio = LIVE_MIN_RENDERED_WIDTH_RATIO) => zoom >= minRatio;
405
464
  var selectLiveBoardIds = (boards, viewport, screen, maxLiveBoards = MAX_LIVE_BOARDS, minRatio = LIVE_MIN_RENDERED_WIDTH_RATIO) => {
406
465
  if (!isZoomLiveCapable(viewport.zoom, minRatio) || screen.width <= 0 || screen.height <= 0) {
@@ -781,6 +840,9 @@ var useDeferredMount = () => {
781
840
  return isMounted;
782
841
  };
783
842
 
843
+ // src/canvas/CanvasThumbnail.tsx
844
+ import { useState as useState5 } from "react";
845
+
784
846
  // src/canvas/stableContentUrl.ts
785
847
  import { useState as useState4 } from "react";
786
848
  var EXPIRY_MARGIN_SECONDS = 120;
@@ -829,9 +891,55 @@ var useStableContentUrl = (url, isDisplayed = false) => {
829
891
  return nextUrl;
830
892
  };
831
893
 
832
- // src/canvas/BoardNode.tsx
833
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
894
+ // src/canvas/CanvasThumbnail.tsx
895
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
834
896
  var isSameContent = (first, second) => Boolean(first && second) && withoutContentToken(first) === withoutContentToken(second);
897
+ var CanvasThumbnail = ({ urls, variant, title, imageClassName, isCompact }) => {
898
+ const { apiBaseUrl } = useDesignStudio();
899
+ const texts = useDesignStudioTexts();
900
+ const path = thumbnailUrlForVariant(urls, variant);
901
+ const latestUrl = path ? `${apiBaseUrl}${path}` : void 0;
902
+ const [loadedUrl, setLoadedUrl] = useState5(null);
903
+ const url = useStableContentUrl(latestUrl, isSameContent(loadedUrl, latestUrl));
904
+ const retry = useImageRetry(url);
905
+ if (!url) return null;
906
+ const isLoaded = isSameContent(loadedUrl, url);
907
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
908
+ !loadedUrl && /* @__PURE__ */ jsx2(
909
+ "span",
910
+ {
911
+ className: cx(
912
+ "pointer-events-none absolute inset-0 flex flex-col items-center justify-start gap-2 bg-tint px-6 pt-16 text-center text-muted-foreground",
913
+ "animate-pulse motion-reduce:animate-none"
914
+ ),
915
+ children: !isCompact && /* @__PURE__ */ jsxs2(Fragment2, { children: [
916
+ /* @__PURE__ */ jsx2("span", { className: "line-clamp-2 text-[19px] font-semibold", children: title }),
917
+ /* @__PURE__ */ jsx2("span", { className: "text-[16px]", children: texts.thumbnailLoading })
918
+ ] })
919
+ }
920
+ ),
921
+ loadedUrl && !isLoaded && // biome-ignore lint/performance/noImgElement: the picture shown before, from the browser cache, under the next one
922
+ /* @__PURE__ */ jsx2("img", { src: loadedUrl, alt: "", draggable: false, className: cx("pointer-events-none select-none", imageClassName) }),
923
+ /* @__PURE__ */ jsx2(
924
+ "img",
925
+ {
926
+ src: url,
927
+ alt: "",
928
+ loading: "lazy",
929
+ decoding: "async",
930
+ draggable: false,
931
+ onError: retry.onError,
932
+ onLoad: () => setLoadedUrl(url),
933
+ className: cx("pointer-events-none select-none", imageClassName, (retry.isFailed || !isLoaded) && "opacity-0")
934
+ },
935
+ retry.imageKey
936
+ )
937
+ ] });
938
+ };
939
+
940
+ // src/canvas/BoardNode.tsx
941
+ import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
942
+ var isSameContent2 = (first, second) => Boolean(first && second) && withoutContentToken(first) === withoutContentToken(second);
835
943
  var designContentUrl = (apiBaseUrl, path) => path ? `${apiBaseUrl}${path}` : void 0;
836
944
  var downloadName = (board, extension) => `${boardCodeOf(board.boardKey ?? "board")}.${extension}`;
837
945
  var CLICK_MAX_MOVE = 5;
@@ -842,61 +950,58 @@ var BoardNodeComponent = ({ id, data }) => {
842
950
  const texts = useDesignStudioTexts();
843
951
  const { StatusBadge } = components;
844
952
  const statusDefinition = board.status ? boardStatusDefinition(statuses, board.status) : void 0;
845
- const width = board.width ?? 390;
846
- const height = board.height ?? 844;
847
- const visibleHeight = Math.min(height, MAX_BOARD_CANVAS_HEIGHT);
848
- const isCut = height > visibleHeight;
849
- const thumbnailVariant = useStore((state) => thumbnailVariantForZoom(state.transform[2], width));
850
953
  const {
851
954
  liveBoardIds,
852
955
  selectedBoardIds,
853
956
  matchingBoardIds,
854
957
  openThreadCounts,
855
958
  defaultStatus,
959
+ frameHeightMode,
960
+ devices,
856
961
  onSelectBoard,
857
962
  onCopyReference,
858
963
  onOpenBoard
859
964
  } = useCanvasView();
965
+ const isResponsive = isResponsiveBoard(board);
966
+ const canvasSize = boardCanvasSize(board, frameHeightMode);
967
+ const width = canvasSize.width;
968
+ const height = canvasSize.height;
969
+ const visibleHeight = isResponsive ? height : Math.min(height, MAX_BOARD_CANVAS_HEIGHT);
970
+ const isCut = height > visibleHeight;
971
+ const thumbnailVariant = useStore((state) => thumbnailVariantForZoom(state.transform[2], width));
860
972
  const isLive = liveBoardIds.has(id);
861
973
  const isSelected = selectedBoardIds.has(id);
862
974
  const isDimmed = matchingBoardIds !== null && !matchingBoardIds.has(id);
863
975
  const openThreads = openThreadCounts.get(id) ?? 0;
864
976
  const isReady = useDeferredMount();
865
- const isThumbnailMissing = !board.thumbnailUrl;
866
- const latestThumbnailUrl = designContentUrl(
867
- apiBaseUrl,
868
- thumbnailVariant === "small" ? board.thumbnailSmallUrl ?? board.thumbnailUrl : board.thumbnailUrl
869
- );
977
+ const isThumbnailMissing = !isResponsive && !board.thumbnailUrl;
870
978
  const latestHtmlUrl = designContentUrl(apiBaseUrl, board.htmlUrl);
871
- const [loadedImageUrl, setLoadedImageUrl] = useState5(null);
872
- const [loadedFrameUrl, setLoadedFrameUrl] = useState5(null);
873
- const thumbnailUrl = useStableContentUrl(latestThumbnailUrl, isSameContent(loadedImageUrl, latestThumbnailUrl));
874
- const htmlUrl = useStableContentUrl(latestHtmlUrl, isSameContent(loadedFrameUrl, latestHtmlUrl));
875
- const isRememberedLive = isThumbnailMissing && thumbnailVariant === "default" && isReady && wasContentUrlLoaded(htmlUrl);
979
+ const [loadedFrameUrl, setLoadedFrameUrl] = useState6(null);
980
+ const htmlUrl = useStableContentUrl(latestHtmlUrl, isSameContent2(loadedFrameUrl, latestHtmlUrl));
981
+ const isRememberedLive = isThumbnailMissing && thumbnailVariant !== "small" && isReady && wasContentUrlLoaded(htmlUrl);
876
982
  const showsLiveHtml = isLive || isRememberedLive;
877
983
  const liveHtmlUrl = useCheckedContentUrl(showsLiveHtml && isReady ? htmlUrl : void 0);
878
- const thumbnailRetry = useImageRetry(thumbnailUrl);
879
984
  useEffect3(() => {
880
985
  if (!liveHtmlUrl) setLoadedFrameUrl(null);
881
986
  }, [liveHtmlUrl]);
882
987
  const title = board.title ?? board.boardKey ?? "";
883
988
  const boardCode = board.code ?? boardCodeOf(board.boardKey ?? "");
884
- const [isDownloadOpen, setIsDownloadOpen] = useState5(false);
989
+ const [isDownloadOpen, setIsDownloadOpen] = useState6(false);
885
990
  const pressPointRef = useRef(null);
886
991
  const isCompact = thumbnailVariant === "small";
887
992
  if (!isReady) {
888
- return /* @__PURE__ */ jsx2("div", { className: cx("h-full w-full", isDimmed && "opacity-15"), style: { paddingTop: BOARD_HEADER_HEIGHT }, children: /* @__PURE__ */ jsx2("div", { className: "rounded-[20px] bg-card/70", style: { width, height: visibleHeight } }) });
993
+ return /* @__PURE__ */ jsx3("div", { className: cx("h-full w-full", isDimmed && "opacity-15"), style: { paddingTop: BOARD_HEADER_HEIGHT }, children: /* @__PURE__ */ jsx3("div", { className: "rounded-[20px] bg-card/70", style: { width, height: visibleHeight } }) });
889
994
  }
890
- return /* @__PURE__ */ jsxs2("div", { className: cx("relative h-full w-full", isDimmed && "opacity-15"), children: [
891
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col justify-end gap-0.5 pb-1", style: { height: BOARD_HEADER_HEIGHT }, children: [
892
- /* @__PURE__ */ jsx2("span", { className: "line-clamp-2 text-[19px] leading-6 font-medium text-muted-foreground", title, children: title }),
893
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1", children: [
894
- /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate text-[15px] leading-5 font-semibold text-foreground/70 tabular-nums", title: boardCode, children: isCompact ? "" : boardCode }),
895
- !isCompact && openThreads > 0 && /* @__PURE__ */ jsxs2("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full bg-primary px-2 py-0.5 text-sm font-semibold text-primary-foreground", children: [
896
- /* @__PURE__ */ jsx2(MessageSquare, { className: "size-3.5", "aria-hidden": true }),
995
+ return /* @__PURE__ */ jsxs3("div", { className: cx("relative h-full w-full", isDimmed && "opacity-15"), children: [
996
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col justify-end gap-0.5 pb-1", style: { height: BOARD_HEADER_HEIGHT }, children: [
997
+ /* @__PURE__ */ jsx3("span", { className: "line-clamp-2 text-[19px] leading-6 font-medium text-muted-foreground", title, children: title }),
998
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1", children: [
999
+ /* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1 truncate text-[15px] leading-5 font-semibold text-foreground/70 tabular-nums", title: boardCode, children: isCompact ? "" : boardCode }),
1000
+ !isCompact && openThreads > 0 && /* @__PURE__ */ jsxs3("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full bg-primary px-2 py-0.5 text-sm font-semibold text-primary-foreground", children: [
1001
+ /* @__PURE__ */ jsx3(MessageSquare, { className: "size-3.5", "aria-hidden": true }),
897
1002
  openThreads
898
1003
  ] }),
899
- !isCompact && board.status && board.status !== defaultStatus && /* @__PURE__ */ jsx2(
1004
+ !isCompact && board.status && board.status !== defaultStatus && /* @__PURE__ */ jsx3(
900
1005
  StatusBadge,
901
1006
  {
902
1007
  tone: statusDefinition?.tone ?? "neutral",
@@ -906,7 +1011,7 @@ var BoardNodeComponent = ({ id, data }) => {
906
1011
  className: "shrink-0"
907
1012
  }
908
1013
  ),
909
- !isCompact && /* @__PURE__ */ jsx2(
1014
+ !isCompact && /* @__PURE__ */ jsx3(
910
1015
  "button",
911
1016
  {
912
1017
  type: "button",
@@ -914,10 +1019,10 @@ var BoardNodeComponent = ({ id, data }) => {
914
1019
  "aria-label": `Copy reference of ${title} for an agent`,
915
1020
  title: "Copy reference (C)",
916
1021
  onClick: () => onCopyReference(id),
917
- children: /* @__PURE__ */ jsx2(ClipboardCopy2, { className: "size-5" })
1022
+ children: /* @__PURE__ */ jsx3(ClipboardCopy2, { className: "size-5" })
918
1023
  }
919
1024
  ),
920
- !isCompact && /* @__PURE__ */ jsx2(
1025
+ !isCompact && /* @__PURE__ */ jsx3(
921
1026
  "button",
922
1027
  {
923
1028
  type: "button",
@@ -925,11 +1030,11 @@ var BoardNodeComponent = ({ id, data }) => {
925
1030
  "aria-label": `Open ${title} large`,
926
1031
  title: "Expand",
927
1032
  onClick: () => onOpenBoard(id),
928
- children: /* @__PURE__ */ jsx2(Maximize2, { className: "size-5" })
1033
+ children: /* @__PURE__ */ jsx3(Maximize2, { className: "size-5" })
929
1034
  }
930
1035
  ),
931
- !isCompact && /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
932
- /* @__PURE__ */ jsx2(
1036
+ !isCompact && /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
1037
+ /* @__PURE__ */ jsx3(
933
1038
  "button",
934
1039
  {
935
1040
  type: "button",
@@ -938,16 +1043,16 @@ var BoardNodeComponent = ({ id, data }) => {
938
1043
  "aria-expanded": isDownloadOpen,
939
1044
  title: "Download",
940
1045
  onClick: () => setIsDownloadOpen((isOpen) => !isOpen),
941
- children: /* @__PURE__ */ jsx2(Download, { className: "size-5" })
1046
+ children: /* @__PURE__ */ jsx3(Download, { className: "size-5" })
942
1047
  }
943
1048
  ),
944
1049
  isDownloadOpen && // a plain menu instead of a Radix one: mounted only while open, nothing per node at rest
945
- /* @__PURE__ */ jsxs2(
1050
+ /* @__PURE__ */ jsxs3(
946
1051
  "div",
947
1052
  {
948
1053
  className: "nodrag nopan absolute top-full right-0 z-20 mt-1 flex w-56 flex-col rounded-2xl bg-popover p-1.5 text-[18px] shadow-surface-raised ring-1 ring-foreground/5",
949
1054
  children: [
950
- board.thumbnailUrl && /* @__PURE__ */ jsx2(
1055
+ board.thumbnailUrl && /* @__PURE__ */ jsx3(
951
1056
  "a",
952
1057
  {
953
1058
  href: designContentUrl(apiBaseUrl, board.thumbnailUrl),
@@ -957,7 +1062,7 @@ var BoardNodeComponent = ({ id, data }) => {
957
1062
  children: "PNG (thumbnail)"
958
1063
  }
959
1064
  ),
960
- board.htmlUrl && /* @__PURE__ */ jsx2(
1065
+ board.htmlUrl && /* @__PURE__ */ jsx3(
961
1066
  "a",
962
1067
  {
963
1068
  href: htmlUrl,
@@ -973,37 +1078,39 @@ var BoardNodeComponent = ({ id, data }) => {
973
1078
  ] })
974
1079
  ] })
975
1080
  ] }),
976
- /* @__PURE__ */ jsxs2(
1081
+ /* @__PURE__ */ jsxs3(
977
1082
  "div",
978
1083
  {
979
1084
  className: cx(
980
- "relative overflow-hidden rounded-[20px] bg-card shadow-surface-raised ring-1 ring-foreground/10",
981
- isSelected && "ring-4 ring-brand"
1085
+ "relative",
1086
+ isResponsive ? cx("rounded-[20px]", isSelected && "ring-4 ring-brand ring-offset-8 ring-offset-transparent") : cx("overflow-hidden rounded-[20px] bg-card shadow-surface-raised ring-1 ring-foreground/10", isSelected && "ring-4 ring-brand")
982
1087
  ),
983
1088
  style: { width, height: visibleHeight },
984
1089
  children: [
985
- thumbnailUrl && // biome-ignore lint/performance/noImgElement: canvas thumbnails are API images at canvas scale, next/image cannot optimise them
986
- /* @__PURE__ */ jsx2(
987
- "img",
1090
+ isResponsive && /* @__PURE__ */ jsx3(
1091
+ ResponsiveBoardFrames,
988
1092
  {
989
- src: thumbnailUrl,
990
- alt: "",
991
- width,
992
- height,
993
- loading: "lazy",
994
- decoding: "async",
995
- draggable: false,
996
- onError: thumbnailRetry.onError,
997
- onLoad: () => setLoadedImageUrl(thumbnailUrl),
998
- className: cx(
999
- "pointer-events-none absolute inset-0 h-full w-full object-cover object-top select-none",
1000
- thumbnailRetry.isFailed && "invisible"
1001
- )
1002
- },
1003
- thumbnailRetry.imageKey
1093
+ board,
1094
+ frameHeightMode,
1095
+ devices,
1096
+ thumbnailVariant,
1097
+ showsLiveHtml: showsLiveHtml && isReady,
1098
+ htmlUrl,
1099
+ title
1100
+ }
1004
1101
  ),
1005
- isThumbnailMissing && !isCompact && !(showsLiveHtml && liveHtmlUrl) && /* @__PURE__ */ jsx2("span", { className: "pointer-events-none absolute inset-0 flex items-center justify-center px-6 text-center text-[17px] font-semibold text-muted-foreground", children: texts.thumbnailMissing }),
1006
- showsLiveHtml && liveHtmlUrl && /* @__PURE__ */ jsx2(
1102
+ !isResponsive && !isThumbnailMissing && /* @__PURE__ */ jsx3(
1103
+ CanvasThumbnail,
1104
+ {
1105
+ urls: board,
1106
+ variant: thumbnailVariant,
1107
+ title,
1108
+ imageClassName: "absolute inset-0 h-full w-full object-cover object-top",
1109
+ isCompact
1110
+ }
1111
+ ),
1112
+ isThumbnailMissing && !isCompact && !(showsLiveHtml && liveHtmlUrl) && /* @__PURE__ */ jsx3("span", { className: "pointer-events-none absolute inset-0 flex items-center justify-center px-6 text-center text-[17px] font-semibold text-muted-foreground", children: texts.thumbnailMissing }),
1113
+ !isResponsive && showsLiveHtml && liveHtmlUrl && /* @__PURE__ */ jsx3(
1007
1114
  "iframe",
1008
1115
  {
1009
1116
  src: liveHtmlUrl,
@@ -1017,12 +1124,12 @@ var BoardNodeComponent = ({ id, data }) => {
1017
1124
  className: "pointer-events-none absolute inset-0 border-0 bg-transparent"
1018
1125
  }
1019
1126
  ),
1020
- isCut && /* @__PURE__ */ jsxs2("span", { className: "pointer-events-none absolute inset-x-0 bottom-0 flex h-40 items-end justify-center bg-gradient-to-t from-card to-transparent pb-4 text-[16px] font-semibold text-muted-foreground", children: [
1127
+ isCut && /* @__PURE__ */ jsxs3("span", { className: "pointer-events-none absolute inset-x-0 bottom-0 flex h-40 items-end justify-center bg-gradient-to-t from-card to-transparent pb-4 text-[16px] font-semibold text-muted-foreground", children: [
1021
1128
  "\u2193 ",
1022
1129
  Math.round(height),
1023
1130
  " px \u2014 full length in the focus view"
1024
1131
  ] }),
1025
- /* @__PURE__ */ jsx2(
1132
+ /* @__PURE__ */ jsx3(
1026
1133
  "button",
1027
1134
  {
1028
1135
  type: "button",
@@ -1048,10 +1155,107 @@ var BoardNodeComponent = ({ id, data }) => {
1048
1155
  ] });
1049
1156
  };
1050
1157
  var BoardNode = memo(BoardNodeComponent);
1158
+ var ResponsiveBoardFrames = ({
1159
+ board,
1160
+ frameHeightMode,
1161
+ devices,
1162
+ thumbnailVariant,
1163
+ showsLiveHtml,
1164
+ htmlUrl,
1165
+ title
1166
+ }) => {
1167
+ let left = 0;
1168
+ return /* @__PURE__ */ jsx3(Fragment3, { children: framesOf(board).map((frame) => {
1169
+ const frameLeft = left;
1170
+ left += (frame.width ?? 0) + FRAME_GAP;
1171
+ return /* @__PURE__ */ jsx3(
1172
+ ResponsiveBoardFrame,
1173
+ {
1174
+ frame,
1175
+ left: frameLeft,
1176
+ frameHeightMode,
1177
+ deviceLabel: devices.find((device) => device.deviceKey === frame.deviceKey)?.label ?? frame.deviceKey ?? "",
1178
+ thumbnailVariant,
1179
+ showsLiveHtml,
1180
+ htmlUrl,
1181
+ title
1182
+ },
1183
+ frame.deviceKey ?? frameLeft
1184
+ );
1185
+ }) });
1186
+ };
1187
+ var ResponsiveBoardFrame = ({
1188
+ frame,
1189
+ left,
1190
+ frameHeightMode,
1191
+ deviceLabel,
1192
+ thumbnailVariant,
1193
+ showsLiveHtml,
1194
+ htmlUrl,
1195
+ title
1196
+ }) => {
1197
+ const texts = useDesignStudioTexts();
1198
+ const frameWidth = frame.width ?? 0;
1199
+ const frameHeight = frameCanvasHeight(frame, frameHeightMode);
1200
+ const frameThumbnailVariant = useStore(
1201
+ (state) => thumbnailVariant === "small" ? "small" : thumbnailVariantForZoom(state.transform[2], frameWidth)
1202
+ );
1203
+ const liveHtmlUrl = useCheckedContentUrl(showsLiveHtml ? htmlUrl : void 0);
1204
+ const isCut = frameHeightMode === "page" && (frame.pageHeight ?? 0) > frameHeight;
1205
+ return /* @__PURE__ */ jsxs3("div", { className: "absolute top-0", style: { left, width: frameWidth }, children: [
1206
+ /* @__PURE__ */ jsx3(
1207
+ "div",
1208
+ {
1209
+ className: "flex items-end truncate pb-2 text-[17px] font-semibold text-muted-foreground tabular-nums",
1210
+ style: { height: FRAME_LABEL_HEIGHT },
1211
+ title: `${deviceLabel} \xB7 ${frameWidth} \xD7 ${frame.height ?? 0}`,
1212
+ children: thumbnailVariant === "small" ? "" : `${deviceLabel} \xB7 ${frameWidth}`
1213
+ }
1214
+ ),
1215
+ /* @__PURE__ */ jsxs3(
1216
+ "div",
1217
+ {
1218
+ className: "relative overflow-hidden rounded-[20px] bg-card shadow-surface-raised ring-1 ring-foreground/10",
1219
+ style: { width: frameWidth, height: frameHeight },
1220
+ children: [
1221
+ frame.thumbnailUrl && /* @__PURE__ */ jsx3(
1222
+ CanvasThumbnail,
1223
+ {
1224
+ urls: frame,
1225
+ variant: frameThumbnailVariant,
1226
+ title: `${title} \xB7 ${deviceLabel}`,
1227
+ imageClassName: "absolute inset-x-0 top-0 w-full",
1228
+ isCompact: thumbnailVariant === "small"
1229
+ }
1230
+ ),
1231
+ !frame.thumbnailUrl && !(showsLiveHtml && liveHtmlUrl) && thumbnailVariant !== "small" && /* @__PURE__ */ jsx3("span", { className: "pointer-events-none absolute inset-0 flex items-center justify-center px-6 text-center text-[17px] font-semibold text-muted-foreground", children: texts.thumbnailMissing }),
1232
+ showsLiveHtml && liveHtmlUrl && /* @__PURE__ */ jsx3(
1233
+ "iframe",
1234
+ {
1235
+ src: liveHtmlUrl,
1236
+ title: `${title} \xB7 ${deviceLabel}`,
1237
+ sandbox: "",
1238
+ referrerPolicy: "no-referrer",
1239
+ loading: "lazy",
1240
+ width: frameWidth,
1241
+ height: frameHeight,
1242
+ className: "pointer-events-none absolute inset-0 border-0 bg-transparent"
1243
+ }
1244
+ ),
1245
+ isCut && /* @__PURE__ */ jsxs3("span", { className: "pointer-events-none absolute inset-x-0 bottom-0 flex h-40 items-end justify-center bg-gradient-to-t from-card to-transparent pb-4 text-[16px] font-semibold text-muted-foreground", children: [
1246
+ "\u2193 ",
1247
+ Math.round(frame.pageHeight ?? 0),
1248
+ " px \u2014 full length in the focus view"
1249
+ ] })
1250
+ ]
1251
+ }
1252
+ )
1253
+ ] });
1254
+ };
1051
1255
 
1052
1256
  // src/canvas/BoardStatusChips.tsx
1053
1257
  import { normalizeDddError as normalizeDddError2 } from "@mgamadeus/ddd-web/api";
1054
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1258
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1055
1259
  var BoardStatusChips = ({
1056
1260
  projectKey,
1057
1261
  canvasKey,
@@ -1062,11 +1266,11 @@ var BoardStatusChips = ({
1062
1266
  }) => {
1063
1267
  const { api, notify, statuses: statusDefinitions } = useDesignStudio();
1064
1268
  const [patchStatus, { isLoading }] = api.useSetBoardStatusMutation();
1065
- return /* @__PURE__ */ jsxs3("fieldset", { className: "m-0 flex flex-wrap items-center gap-1.5 border-0 p-0", "aria-label": "Board status", children: [
1269
+ return /* @__PURE__ */ jsxs4("fieldset", { className: "m-0 flex flex-wrap items-center gap-1.5 border-0 p-0", "aria-label": "Board status", children: [
1066
1270
  statuses.map((status) => {
1067
1271
  const Icon = boardStatusDefinition(statusDefinitions, status)?.icon;
1068
1272
  const isActive = board.status === status;
1069
- return /* @__PURE__ */ jsxs3(
1273
+ return /* @__PURE__ */ jsxs4(
1070
1274
  "button",
1071
1275
  {
1072
1276
  type: "button",
@@ -1091,19 +1295,19 @@ var BoardStatusChips = ({
1091
1295
  isActive ? "bg-primary text-primary-foreground" : "bg-tint text-muted-foreground hover:bg-tint-strong hover:text-foreground disabled:opacity-60"
1092
1296
  ),
1093
1297
  children: [
1094
- Icon && /* @__PURE__ */ jsx3(Icon, { className: "size-3.5", "aria-hidden": true }),
1298
+ Icon && /* @__PURE__ */ jsx4(Icon, { className: "size-3.5", "aria-hidden": true }),
1095
1299
  boardStatusLabel(statusDefinitions, status)
1096
1300
  ]
1097
1301
  },
1098
1302
  status
1099
1303
  );
1100
1304
  }),
1101
- board.hasChangedSinceStatus && /* @__PURE__ */ jsx3("span", { className: "text-xs text-muted-foreground", title: "The board file changed after this status was set", children: "changed since" })
1305
+ board.hasChangedSinceStatus && /* @__PURE__ */ jsx4("span", { className: "text-xs text-muted-foreground", title: "The board file changed after this status was set", children: "changed since" })
1102
1306
  ] });
1103
1307
  };
1104
1308
 
1105
1309
  // src/canvas/BoardFocusView.tsx
1106
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1310
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1107
1311
  var DEVICE_SCREEN_HEIGHT = 844;
1108
1312
  var BoardFocusView = ({
1109
1313
  projectKey,
@@ -1115,6 +1319,9 @@ var BoardFocusView = ({
1115
1319
  threads,
1116
1320
  writesAllowed,
1117
1321
  presentLabel,
1322
+ devices = [],
1323
+ viewport = null,
1324
+ onViewportChange,
1118
1325
  onClose,
1119
1326
  onPrevious,
1120
1327
  onNext,
@@ -1125,15 +1332,15 @@ var BoardFocusView = ({
1125
1332
  const { apiBaseUrl, components } = useDesignStudio();
1126
1333
  const texts = useDesignStudioTexts();
1127
1334
  const { Button, Dialog, DialogContent, DialogDescription, DialogTitle, Textarea } = components;
1128
- const [isPlacingPin, setIsPlacingPin] = useState6(false);
1129
- const [pendingPin, setPendingPin] = useState6(null);
1130
- const [highlightedCommentId, setHighlightedCommentId] = useState6(null);
1131
- const [showResolved, setShowResolved] = useState6(false);
1132
- const [isMarkingRegion, setIsMarkingRegion] = useState6(false);
1133
- const [region, setRegion] = useState6(null);
1134
- const [regionDraft, setRegionDraft] = useState6(null);
1135
- const [referenceNote, setReferenceNote] = useState6("");
1136
- const [isRegionFlashing, setIsRegionFlashing] = useState6(false);
1335
+ const [isPlacingPin, setIsPlacingPin] = useState7(false);
1336
+ const [pendingPin, setPendingPin] = useState7(null);
1337
+ const [highlightedCommentId, setHighlightedCommentId] = useState7(null);
1338
+ const [showResolved, setShowResolved] = useState7(false);
1339
+ const [isMarkingRegion, setIsMarkingRegion] = useState7(false);
1340
+ const [region, setRegion] = useState7(null);
1341
+ const [regionDraft, setRegionDraft] = useState7(null);
1342
+ const [referenceNote, setReferenceNote] = useState7("");
1343
+ const [isRegionFlashing, setIsRegionFlashing] = useState7(false);
1137
1344
  const boardKey = board?.boardKey ?? null;
1138
1345
  useEffect4(() => {
1139
1346
  if (boardKey === null) return;
@@ -1167,11 +1374,33 @@ var BoardFocusView = ({
1167
1374
  window.addEventListener("keydown", onKeyDown);
1168
1375
  return () => window.removeEventListener("keydown", onKeyDown);
1169
1376
  });
1170
- const width = board?.width ?? 390;
1171
- const height = board?.height ?? 844;
1377
+ const isResponsive = isResponsiveBoard(board) && viewport !== null;
1378
+ const [showsDeviceFrame, setShowsDeviceFrame] = useState7(true);
1379
+ const stageRef = useRef2(null);
1380
+ const [stageWidth, setStageWidth] = useState7(0);
1381
+ useEffect4(() => {
1382
+ const stage = stageRef.current;
1383
+ if (!stage || typeof ResizeObserver === "undefined") return;
1384
+ const observer = new ResizeObserver(() => setStageWidth(stage.clientWidth));
1385
+ observer.observe(stage);
1386
+ setStageWidth(stage.clientWidth);
1387
+ return () => observer.disconnect();
1388
+ }, [board]);
1389
+ const width = isResponsive ? viewport.width : board?.width ?? 390;
1390
+ const height = isResponsive && board ? pageHeightAtWidth(board, viewport.width, viewport.height) : board?.height ?? 844;
1391
+ const screenHeight = isResponsive ? viewport.height : Math.min(height, DEVICE_SCREEN_HEIGHT);
1392
+ const bezelPadding = !isResponsive || showsDeviceFrame ? 24 : 0;
1393
+ const scale = isResponsive && stageWidth > 0 ? Math.min(1, (stageWidth - 48) / (width + bezelPadding)) : 1;
1394
+ const frameOfWidth = isResponsive ? framesOf(board).find((frame) => frame.width === width) : void 0;
1172
1395
  const htmlUrl = useCheckedContentUrl(useStableContentUrl(designContentUrl(apiBaseUrl, board?.htmlUrl), true));
1173
- const thumbnailUrl = useStableContentUrl(designContentUrl(apiBaseUrl, board?.thumbnailUrl), true);
1174
- const pinnedThreads = threads.filter((thread) => thread.pinNumber !== null && (showResolved || !thread.root.isResolved));
1396
+ const thumbnailUrl = useStableContentUrl(
1397
+ designContentUrl(apiBaseUrl, isResponsive ? frameOfWidth?.thumbnailUrl : board?.thumbnailUrl),
1398
+ true
1399
+ );
1400
+ const pinnedThreads = threads.filter(
1401
+ (thread) => thread.pinNumber !== null && (showResolved || !thread.root.isResolved) && isPinInViewport(thread.root, isResponsive ? viewport : null)
1402
+ );
1403
+ const hiddenPinCount = threads.filter((thread) => thread.pinNumber !== null && !thread.root.isResolved).length - pinnedThreads.filter((thread) => !thread.root.isResolved).length;
1175
1404
  const copyReference = () => {
1176
1405
  onCopyReference({ region, note: referenceNote });
1177
1406
  if (region) {
@@ -1182,8 +1411,8 @@ var BoardFocusView = ({
1182
1411
  const boardPointOf = (event) => {
1183
1412
  const rect = event.currentTarget.getBoundingClientRect();
1184
1413
  return {
1185
- x: Math.max(0, Math.min(width, event.clientX - rect.left)),
1186
- y: Math.max(0, Math.min(height, event.clientY - rect.top))
1414
+ x: Math.max(0, Math.min(width, (event.clientX - rect.left) / scale)),
1415
+ y: Math.max(0, Math.min(height, (event.clientY - rect.top) / scale))
1187
1416
  };
1188
1417
  };
1189
1418
  const startRegion = (event) => {
@@ -1218,19 +1447,23 @@ var BoardFocusView = ({
1218
1447
  } : region;
1219
1448
  const placePin = (event) => {
1220
1449
  const rect = event.currentTarget.getBoundingClientRect();
1221
- setPendingPin({ x: Math.round(event.clientX - rect.left), y: Math.round(event.clientY - rect.top) });
1450
+ setPendingPin({
1451
+ x: Math.round((event.clientX - rect.left) / scale),
1452
+ y: Math.round((event.clientY - rect.top) / scale),
1453
+ viewport: isResponsive ? viewport : null
1454
+ });
1222
1455
  setIsPlacingPin(false);
1223
1456
  };
1224
- return /* @__PURE__ */ jsx4(Dialog, { open: board !== null, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsx4(
1457
+ return /* @__PURE__ */ jsx5(Dialog, { open: board !== null, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsx5(
1225
1458
  DialogContent,
1226
1459
  {
1227
1460
  showCloseButton: false,
1228
1461
  className: "flex h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-none flex-col gap-0 overflow-hidden rounded-3xl p-0 sm:max-w-none",
1229
- children: board && /* @__PURE__ */ jsxs4(Fragment2, { children: [
1230
- /* @__PURE__ */ jsxs4("header", { className: "flex flex-wrap items-center gap-3 border-b border-border px-5 py-3", children: [
1231
- /* @__PURE__ */ jsxs4("div", { className: "min-w-0 flex-1", children: [
1232
- /* @__PURE__ */ jsx4(DialogTitle, { className: "truncate text-lg font-semibold", children: board.title }),
1233
- /* @__PURE__ */ jsxs4(DialogDescription, { className: "truncate text-xs", children: [
1462
+ children: board && /* @__PURE__ */ jsxs5(Fragment4, { children: [
1463
+ /* @__PURE__ */ jsxs5("header", { className: "flex flex-wrap items-center gap-3 border-b border-border px-5 py-3", children: [
1464
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
1465
+ /* @__PURE__ */ jsx5(DialogTitle, { className: "truncate text-lg font-semibold", children: board.title }),
1466
+ /* @__PURE__ */ jsxs5(DialogDescription, { className: "truncate text-xs", children: [
1234
1467
  presentLabel ? "Present \xB7 " : "",
1235
1468
  sectionTitle ? `${sectionTitle} \xB7 ` : "",
1236
1469
  board.boardKey,
@@ -1242,7 +1475,7 @@ var BoardFocusView = ({
1242
1475
  position.count
1243
1476
  ] })
1244
1477
  ] }),
1245
- /* @__PURE__ */ jsx4(
1478
+ /* @__PURE__ */ jsx5(
1246
1479
  BoardStatusChips,
1247
1480
  {
1248
1481
  projectKey,
@@ -1253,113 +1486,150 @@ var BoardFocusView = ({
1253
1486
  onStatusChanged
1254
1487
  }
1255
1488
  ),
1256
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
1257
- /* @__PURE__ */ jsx4(Button, { variant: "outline", size: "icon", "aria-label": "Previous board (\u2190)", onClick: onPrevious, children: /* @__PURE__ */ jsx4(ChevronLeft, {}) }),
1258
- /* @__PURE__ */ jsx4(Button, { variant: "outline", size: "icon", "aria-label": "Next board (\u2192)", onClick: onNext, children: /* @__PURE__ */ jsx4(ChevronRight, {}) }),
1259
- /* @__PURE__ */ jsx4(Button, { variant: "ghost", size: "icon", "aria-label": "Close focus view", onClick: onClose, children: /* @__PURE__ */ jsx4(X, {}) })
1489
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
1490
+ /* @__PURE__ */ jsx5(Button, { variant: "outline", size: "icon", "aria-label": "Previous board (\u2190)", onClick: onPrevious, children: /* @__PURE__ */ jsx5(ChevronLeft, {}) }),
1491
+ /* @__PURE__ */ jsx5(Button, { variant: "outline", size: "icon", "aria-label": "Next board (\u2192)", onClick: onNext, children: /* @__PURE__ */ jsx5(ChevronRight, {}) }),
1492
+ /* @__PURE__ */ jsx5(Button, { variant: "ghost", size: "icon", "aria-label": "Close focus view", onClick: onClose, children: /* @__PURE__ */ jsx5(X, {}) })
1260
1493
  ] })
1261
1494
  ] }),
1262
- /* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [
1263
- /* @__PURE__ */ jsx4("div", { className: "flex min-h-0 flex-1 items-start justify-center overflow-auto bg-tint p-6", children: /* @__PURE__ */ jsx4("div", { className: "rounded-[56px] bg-foreground p-3 shadow-surface-raised", children: /* @__PURE__ */ jsx4(
1264
- "div",
1265
- {
1266
- className: "relative overflow-y-auto overflow-x-hidden rounded-[44px] bg-card",
1267
- style: { width, height: Math.min(height, DEVICE_SCREEN_HEIGHT) },
1268
- children: /* @__PURE__ */ jsxs4("div", { className: "relative", style: { width, height }, children: [
1269
- thumbnailUrl && // biome-ignore lint/performance/noImgElement: API thumbnail under the live board while it loads
1270
- /* @__PURE__ */ jsx4(
1271
- "img",
1272
- {
1273
- src: thumbnailUrl,
1274
- alt: "",
1275
- width,
1276
- height,
1277
- className: "pointer-events-none absolute inset-0 select-none"
1278
- }
1279
- ),
1280
- htmlUrl && /* @__PURE__ */ jsx4(
1281
- "iframe",
1282
- {
1283
- src: htmlUrl,
1284
- title: board.title ?? board.boardKey ?? "Board",
1285
- sandbox: "",
1286
- referrerPolicy: "no-referrer",
1287
- width,
1288
- height,
1289
- className: "absolute inset-0 border-0 bg-transparent"
1290
- },
1291
- htmlUrl
1292
- ),
1293
- isPlacingPin && /* @__PURE__ */ jsx4(
1294
- "button",
1295
- {
1296
- type: "button",
1297
- "aria-label": "Place the pin here",
1298
- className: "absolute inset-0 z-10 cursor-crosshair bg-brand/10",
1299
- onClick: placePin
1300
- }
1301
- ),
1302
- isMarkingRegion && /* @__PURE__ */ jsx4(
1303
- "button",
1304
- {
1305
- type: "button",
1306
- "aria-label": "Drag a rectangle to mark a region of the board",
1307
- className: "absolute inset-0 z-10 cursor-crosshair touch-none bg-brand/5",
1308
- onPointerDown: startRegion,
1309
- onPointerMove: moveRegion,
1310
- onPointerUp: endRegion
1311
- }
1495
+ /* @__PURE__ */ jsxs5("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [
1496
+ /* @__PURE__ */ jsxs5("div", { className: "flex min-h-0 flex-1 flex-col bg-tint", children: [
1497
+ isResponsive && /* @__PURE__ */ jsx5(
1498
+ ViewportToolbar,
1499
+ {
1500
+ devices,
1501
+ viewport,
1502
+ hiddenPinCount,
1503
+ showsDeviceFrame,
1504
+ onShowsDeviceFrameChange: setShowsDeviceFrame,
1505
+ onViewportChange: (nextViewport) => onViewportChange?.(nextViewport)
1506
+ }
1507
+ ),
1508
+ /* @__PURE__ */ jsx5("div", { ref: stageRef, className: "flex min-h-0 flex-1 items-start justify-center overflow-auto p-6", children: /* @__PURE__ */ jsx5("div", { style: { width: (width + bezelPadding) * scale, height: (screenHeight + bezelPadding) * scale }, children: /* @__PURE__ */ jsxs5(
1509
+ "div",
1510
+ {
1511
+ className: cx(
1512
+ "relative origin-top-left",
1513
+ (!isResponsive || showsDeviceFrame) && "bg-foreground p-3 shadow-surface-raised",
1514
+ !isResponsive || viewport.width < 600 ? "rounded-[56px]" : "rounded-[28px]"
1312
1515
  ),
1313
- shownRegion && /* @__PURE__ */ jsx4(
1314
- "span",
1315
- {
1316
- "aria-hidden": true,
1317
- className: cx(
1318
- "pointer-events-none absolute z-20 rounded-md border-2 border-dashed border-brand bg-brand/10 transition-shadow motion-reduce:transition-none",
1319
- isRegionFlashing && "shadow-[0_0_0_6px_var(--brand)]"
1320
- ),
1321
- style: {
1322
- left: shownRegion.x,
1323
- top: shownRegion.y,
1324
- width: shownRegion.width,
1325
- height: shownRegion.height
1516
+ style: { transform: scale !== 1 ? `scale(${scale})` : void 0, width: width + bezelPadding },
1517
+ children: [
1518
+ /* @__PURE__ */ jsx5(
1519
+ "div",
1520
+ {
1521
+ className: cx(
1522
+ "relative overflow-y-auto overflow-x-hidden bg-card",
1523
+ !isResponsive || showsDeviceFrame ? !isResponsive || viewport.width < 600 ? "rounded-[44px]" : "rounded-[18px]" : "rounded-md ring-1 ring-foreground/10"
1524
+ ),
1525
+ style: { width, height: screenHeight },
1526
+ children: /* @__PURE__ */ jsxs5("div", { className: "relative", style: { width, height }, children: [
1527
+ thumbnailUrl && // biome-ignore lint/performance/noImgElement: API thumbnail under the live board while it loads
1528
+ /* @__PURE__ */ jsx5(
1529
+ "img",
1530
+ {
1531
+ src: thumbnailUrl,
1532
+ alt: "",
1533
+ width,
1534
+ height,
1535
+ className: "pointer-events-none absolute inset-0 select-none"
1536
+ }
1537
+ ),
1538
+ htmlUrl && /* @__PURE__ */ jsx5(
1539
+ "iframe",
1540
+ {
1541
+ src: htmlUrl,
1542
+ title: board.title ?? board.boardKey ?? "Board",
1543
+ sandbox: "",
1544
+ referrerPolicy: "no-referrer",
1545
+ width,
1546
+ height,
1547
+ className: "absolute inset-0 border-0 bg-transparent"
1548
+ },
1549
+ htmlUrl
1550
+ ),
1551
+ isPlacingPin && /* @__PURE__ */ jsx5(
1552
+ "button",
1553
+ {
1554
+ type: "button",
1555
+ "aria-label": "Place the pin here",
1556
+ className: "absolute inset-0 z-10 cursor-crosshair bg-brand/10",
1557
+ onClick: placePin
1558
+ }
1559
+ ),
1560
+ isMarkingRegion && /* @__PURE__ */ jsx5(
1561
+ "button",
1562
+ {
1563
+ type: "button",
1564
+ "aria-label": "Drag a rectangle to mark a region of the board",
1565
+ className: "absolute inset-0 z-10 cursor-crosshair touch-none bg-brand/5",
1566
+ onPointerDown: startRegion,
1567
+ onPointerMove: moveRegion,
1568
+ onPointerUp: endRegion
1569
+ }
1570
+ ),
1571
+ shownRegion && /* @__PURE__ */ jsx5(
1572
+ "span",
1573
+ {
1574
+ "aria-hidden": true,
1575
+ className: cx(
1576
+ "pointer-events-none absolute z-20 rounded-md border-2 border-dashed border-brand bg-brand/10 transition-shadow motion-reduce:transition-none",
1577
+ isRegionFlashing && "shadow-[0_0_0_6px_var(--brand)]"
1578
+ ),
1579
+ style: {
1580
+ left: shownRegion.x,
1581
+ top: shownRegion.y,
1582
+ width: shownRegion.width,
1583
+ height: shownRegion.height
1584
+ }
1585
+ }
1586
+ ),
1587
+ pinnedThreads.map((thread) => /* @__PURE__ */ jsx5(
1588
+ "button",
1589
+ {
1590
+ type: "button",
1591
+ "aria-label": `Comment ${thread.pinNumber}`,
1592
+ onMouseEnter: () => setHighlightedCommentId(Number(thread.root.id)),
1593
+ onClick: () => setHighlightedCommentId(Number(thread.root.id)),
1594
+ className: cx(
1595
+ "absolute z-20 flex size-7 -translate-x-1/2 -translate-y-full items-center justify-center rounded-full rounded-bl-none text-xs font-bold shadow-surface-raised ring-2 ring-card",
1596
+ thread.root.isResolved ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground",
1597
+ highlightedCommentId === Number(thread.root.id) && "ring-brand scale-110"
1598
+ ),
1599
+ style: { left: thread.root.x ?? 0, top: thread.root.y ?? 0 },
1600
+ children: thread.pinNumber
1601
+ },
1602
+ String(thread.root.id)
1603
+ )),
1604
+ pendingPin && /* @__PURE__ */ jsx5(
1605
+ "span",
1606
+ {
1607
+ className: "absolute z-20 flex size-7 -translate-x-1/2 -translate-y-full items-center justify-center rounded-full rounded-bl-none bg-brand text-card shadow-surface-raised ring-2 ring-card",
1608
+ style: { left: pendingPin.x, top: pendingPin.y },
1609
+ "aria-hidden": true,
1610
+ children: /* @__PURE__ */ jsx5(MapPin2, { className: "size-4" })
1611
+ }
1612
+ )
1613
+ ] })
1326
1614
  }
1327
- }
1328
- ),
1329
- pinnedThreads.map((thread) => /* @__PURE__ */ jsx4(
1330
- "button",
1331
- {
1332
- type: "button",
1333
- "aria-label": `Comment ${thread.pinNumber}`,
1334
- onMouseEnter: () => setHighlightedCommentId(Number(thread.root.id)),
1335
- onClick: () => setHighlightedCommentId(Number(thread.root.id)),
1336
- className: cx(
1337
- "absolute z-20 flex size-7 -translate-x-1/2 -translate-y-full items-center justify-center rounded-full rounded-bl-none text-xs font-bold shadow-surface-raised ring-2 ring-card",
1338
- thread.root.isResolved ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground",
1339
- highlightedCommentId === Number(thread.root.id) && "ring-brand scale-110"
1340
- ),
1341
- style: { left: thread.root.x ?? 0, top: thread.root.y ?? 0 },
1342
- children: thread.pinNumber
1343
- },
1344
- String(thread.root.id)
1345
- )),
1346
- pendingPin && /* @__PURE__ */ jsx4(
1347
- "span",
1348
- {
1349
- className: "absolute z-20 flex size-7 -translate-x-1/2 -translate-y-full items-center justify-center rounded-full rounded-bl-none bg-brand text-card shadow-surface-raised ring-2 ring-card",
1350
- style: { left: pendingPin.x, top: pendingPin.y },
1351
- "aria-hidden": true,
1352
- children: /* @__PURE__ */ jsx4(MapPin2, { className: "size-4" })
1353
- }
1354
- )
1355
- ] })
1356
- }
1357
- ) }) }),
1358
- /* @__PURE__ */ jsxs4("aside", { className: "flex min-h-0 w-full flex-col border-t border-border lg:w-[400px] lg:border-t-0 lg:border-l", children: [
1359
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2 border-b border-border px-5 py-4", children: [
1360
- /* @__PURE__ */ jsx4("p", { className: "text-sm font-semibold", children: "Reference for an agent" }),
1361
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-2", children: [
1362
- /* @__PURE__ */ jsxs4(
1615
+ ),
1616
+ isResponsive && /* @__PURE__ */ jsx5(
1617
+ WidthDragHandle,
1618
+ {
1619
+ scale,
1620
+ width,
1621
+ onWidthChange: (nextWidth) => onViewportChange?.(viewportWithWidth(viewport, nextWidth))
1622
+ }
1623
+ )
1624
+ ]
1625
+ }
1626
+ ) }) })
1627
+ ] }),
1628
+ /* @__PURE__ */ jsxs5("aside", { className: "flex min-h-0 w-full flex-col border-t border-border lg:w-[400px] lg:border-t-0 lg:border-l", children: [
1629
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2 border-b border-border px-5 py-4", children: [
1630
+ /* @__PURE__ */ jsx5("p", { className: "text-sm font-semibold", children: "Reference for an agent" }),
1631
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-2", children: [
1632
+ /* @__PURE__ */ jsxs5(
1363
1633
  Button,
1364
1634
  {
1365
1635
  variant: isMarkingRegion ? "default" : "outline",
@@ -1367,19 +1637,19 @@ var BoardFocusView = ({
1367
1637
  "aria-pressed": isMarkingRegion,
1368
1638
  onClick: () => setIsMarkingRegion((marking) => !marking),
1369
1639
  children: [
1370
- /* @__PURE__ */ jsx4(SquareDashedMousePointer, {}),
1640
+ /* @__PURE__ */ jsx5(SquareDashedMousePointer, {}),
1371
1641
  " ",
1372
1642
  isMarkingRegion ? "Drag on the board\u2026" : "Mark region"
1373
1643
  ]
1374
1644
  }
1375
1645
  ),
1376
- region && /* @__PURE__ */ jsx4(Button, { variant: "ghost", size: "sm", onClick: () => setRegion(null), children: "Clear region" }),
1377
- /* @__PURE__ */ jsxs4(Button, { variant: "outline", size: "sm", className: "ml-auto", onClick: copyReference, children: [
1378
- /* @__PURE__ */ jsx4(ClipboardCopy3, {}),
1646
+ region && /* @__PURE__ */ jsx5(Button, { variant: "ghost", size: "sm", onClick: () => setRegion(null), children: "Clear region" }),
1647
+ /* @__PURE__ */ jsxs5(Button, { variant: "outline", size: "sm", className: "ml-auto", onClick: copyReference, children: [
1648
+ /* @__PURE__ */ jsx5(ClipboardCopy3, {}),
1379
1649
  " Copy reference"
1380
1650
  ] })
1381
1651
  ] }),
1382
- region && /* @__PURE__ */ jsxs4("p", { className: "text-xs text-muted-foreground tabular-nums", children: [
1652
+ region && /* @__PURE__ */ jsxs5("p", { className: "text-xs text-muted-foreground tabular-nums", children: [
1383
1653
  "Region ",
1384
1654
  Math.round(region.x),
1385
1655
  ",",
@@ -1391,7 +1661,7 @@ var BoardFocusView = ({
1391
1661
  Math.round(region.height),
1392
1662
  " px"
1393
1663
  ] }),
1394
- /* @__PURE__ */ jsx4(
1664
+ /* @__PURE__ */ jsx5(
1395
1665
  Textarea,
1396
1666
  {
1397
1667
  value: referenceNote,
@@ -1402,8 +1672,8 @@ var BoardFocusView = ({
1402
1672
  }
1403
1673
  )
1404
1674
  ] }),
1405
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 px-5 pt-4", children: [
1406
- /* @__PURE__ */ jsxs4(
1675
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 px-5 pt-4", children: [
1676
+ /* @__PURE__ */ jsxs5(
1407
1677
  Button,
1408
1678
  {
1409
1679
  variant: isPlacingPin ? "default" : "outline",
@@ -1412,18 +1682,18 @@ var BoardFocusView = ({
1412
1682
  "aria-pressed": isPlacingPin,
1413
1683
  onClick: () => setIsPlacingPin((placing) => !placing),
1414
1684
  children: [
1415
- /* @__PURE__ */ jsx4(MapPinPlus, {}),
1685
+ /* @__PURE__ */ jsx5(MapPinPlus, {}),
1416
1686
  " ",
1417
1687
  isPlacingPin ? "Click on the board\u2026" : "Add pin"
1418
1688
  ]
1419
1689
  }
1420
1690
  ),
1421
- /* @__PURE__ */ jsxs4("span", { className: "text-xs text-muted-foreground", children: [
1691
+ /* @__PURE__ */ jsxs5("span", { className: "text-xs text-muted-foreground", children: [
1422
1692
  threads.filter((thread) => !thread.root.isResolved).length,
1423
1693
  " open"
1424
1694
  ] })
1425
1695
  ] }),
1426
- /* @__PURE__ */ jsx4("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4", children: /* @__PURE__ */ jsx4(
1696
+ /* @__PURE__ */ jsx5("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4", children: /* @__PURE__ */ jsx5(
1427
1697
  BoardComments,
1428
1698
  {
1429
1699
  projectKey,
@@ -1438,7 +1708,8 @@ var BoardFocusView = ({
1438
1708
  showResolved,
1439
1709
  onShowResolvedChange: setShowResolved,
1440
1710
  pinHint: "\u201CAdd pin\u201D marks a spot on the board",
1441
- onCopyThreadReference
1711
+ onCopyThreadReference,
1712
+ onSelectViewport: isResponsive ? onViewportChange : void 0
1442
1713
  }
1443
1714
  ) })
1444
1715
  ] })
@@ -1447,6 +1718,101 @@ var BoardFocusView = ({
1447
1718
  }
1448
1719
  ) });
1449
1720
  };
1721
+ var ViewportToolbar = ({
1722
+ devices,
1723
+ viewport,
1724
+ hiddenPinCount,
1725
+ showsDeviceFrame,
1726
+ onShowsDeviceFrameChange,
1727
+ onViewportChange
1728
+ }) => {
1729
+ const { components } = useDesignStudio();
1730
+ const { Button } = components;
1731
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-2 border-b border-border px-5 py-2 text-sm", children: [
1732
+ /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2", children: [
1733
+ /* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Device" }),
1734
+ /* @__PURE__ */ jsxs5(
1735
+ "select",
1736
+ {
1737
+ className: "h-8 rounded-lg border border-border bg-card px-2 text-sm",
1738
+ value: viewport.deviceKey ?? "",
1739
+ onChange: (event) => {
1740
+ const device = devices.find((candidate) => candidate.deviceKey === event.target.value);
1741
+ if (device) onViewportChange(viewportOfDevice(device));
1742
+ },
1743
+ children: [
1744
+ viewport.deviceKey === null && /* @__PURE__ */ jsx5("option", { value: "", children: "Free width" }),
1745
+ devices.map((device) => /* @__PURE__ */ jsxs5("option", { value: device.deviceKey ?? "", children: [
1746
+ device.label,
1747
+ " \xB7 ",
1748
+ device.width,
1749
+ " \xD7 ",
1750
+ device.height
1751
+ ] }, device.deviceKey ?? ""))
1752
+ ]
1753
+ }
1754
+ )
1755
+ ] }),
1756
+ /* @__PURE__ */ jsxs5(
1757
+ Button,
1758
+ {
1759
+ variant: "outline",
1760
+ size: "sm",
1761
+ "aria-label": "Rotate (landscape / portrait)",
1762
+ onClick: () => onViewportChange(rotateViewport(viewport, devices)),
1763
+ children: [
1764
+ /* @__PURE__ */ jsx5(RotateCw, {}),
1765
+ " Rotate"
1766
+ ]
1767
+ }
1768
+ ),
1769
+ /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground tabular-nums", children: viewportLabel(viewport, devices) }),
1770
+ /* @__PURE__ */ jsxs5(
1771
+ Button,
1772
+ {
1773
+ variant: showsDeviceFrame ? "default" : "outline",
1774
+ size: "sm",
1775
+ "aria-pressed": showsDeviceFrame,
1776
+ onClick: () => onShowsDeviceFrameChange(!showsDeviceFrame),
1777
+ children: [
1778
+ /* @__PURE__ */ jsx5(Smartphone, {}),
1779
+ " Device frame"
1780
+ ]
1781
+ }
1782
+ ),
1783
+ hiddenPinCount > 0 && /* @__PURE__ */ jsxs5("span", { className: "ml-auto text-xs text-muted-foreground", children: [
1784
+ hiddenPinCount,
1785
+ " open pin(s) in other widths \u2014 pick their size in the comment list"
1786
+ ] })
1787
+ ] });
1788
+ };
1789
+ var WidthDragHandle = ({ scale, width, onWidthChange }) => {
1790
+ const dragStartRef = useRef2(null);
1791
+ return /* @__PURE__ */ jsx5(
1792
+ "button",
1793
+ {
1794
+ type: "button",
1795
+ "aria-label": `Viewport width ${width} px: drag to change`,
1796
+ className: "absolute top-1/2 -right-6 z-30 h-24 w-3 -translate-y-1/2 cursor-ew-resize touch-none rounded-full bg-foreground/40 hover:bg-foreground/70",
1797
+ onPointerDown: (event) => {
1798
+ event.currentTarget.setPointerCapture(event.pointerId);
1799
+ dragStartRef.current = { clientX: event.clientX, width };
1800
+ },
1801
+ onPointerMove: (event) => {
1802
+ const dragStart = dragStartRef.current;
1803
+ if (!dragStart) return;
1804
+ onWidthChange(dragStart.width + (event.clientX - dragStart.clientX) / Math.max(0.05, scale));
1805
+ },
1806
+ onPointerUp: () => {
1807
+ dragStartRef.current = null;
1808
+ },
1809
+ onKeyDown: (event) => {
1810
+ if (event.key === "ArrowLeft") onWidthChange(width - 10);
1811
+ if (event.key === "ArrowRight") onWidthChange(width + 10);
1812
+ }
1813
+ }
1814
+ );
1815
+ };
1450
1816
 
1451
1817
  // src/canvas/DesignCanvasFlow.tsx
1452
1818
  import "@xyflow/react/dist/style.css";
@@ -1461,26 +1827,26 @@ import {
1461
1827
  useStore as useStore3
1462
1828
  } from "@xyflow/react";
1463
1829
  import { ChevronDown, Hand, MousePointer2, Play } from "lucide-react";
1464
- import { useCallback, useEffect as useEffect5, useMemo, useRef as useRef2, useState as useState7 } from "react";
1830
+ import { useCallback, useEffect as useEffect5, useMemo, useRef as useRef3, useState as useState8 } from "react";
1465
1831
 
1466
1832
  // src/canvas/SectionNode.tsx
1467
1833
  import { useStore as useStore2 } from "@xyflow/react";
1468
1834
  import { memo as memo2 } from "react";
1469
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1835
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1470
1836
  var OVERVIEW_TITLE_SCREEN_PX = 15;
1471
1837
  var SectionNodeComponent = ({ data }) => {
1472
1838
  const { onZoomToSection } = useCanvasView();
1473
1839
  const zoom = useStore2((state) => data.isOverview ? Math.round(state.transform[2] * 1e3) / 1e3 : 1);
1474
1840
  if (!data.isOverview) {
1475
- return /* @__PURE__ */ jsx5("div", { className: "pointer-events-none h-full w-full rounded-[64px] bg-card/50 ring-2 ring-foreground/5 backdrop-blur-xl", children: /* @__PURE__ */ jsxs5(
1841
+ return /* @__PURE__ */ jsx6("div", { className: "pointer-events-none h-full w-full rounded-[64px] bg-card/50 ring-2 ring-foreground/5 backdrop-blur-xl", children: /* @__PURE__ */ jsxs6(
1476
1842
  "div",
1477
1843
  {
1478
1844
  className: "flex items-baseline gap-4 overflow-hidden text-ellipsis whitespace-nowrap",
1479
1845
  style: { padding: `${SECTION_PADDING}px ${SECTION_PADDING}px 0` },
1480
1846
  title: data.title,
1481
1847
  children: [
1482
- /* @__PURE__ */ jsx5("span", { className: "text-[56px] leading-none font-bold tracking-tight text-foreground", children: data.title }),
1483
- /* @__PURE__ */ jsxs5("span", { className: "text-[28px] leading-none text-muted-foreground", children: [
1848
+ /* @__PURE__ */ jsx6("span", { className: "text-[56px] leading-none font-bold tracking-tight text-foreground", children: data.title }),
1849
+ /* @__PURE__ */ jsxs6("span", { className: "text-[28px] leading-none text-muted-foreground", children: [
1484
1850
  data.boardCount,
1485
1851
  " boards"
1486
1852
  ] })
@@ -1489,7 +1855,7 @@ var SectionNodeComponent = ({ data }) => {
1489
1855
  ) });
1490
1856
  }
1491
1857
  const titleFontSize = Math.min(OVERVIEW_TITLE_SCREEN_PX / zoom, data.width / 7);
1492
- return /* @__PURE__ */ jsxs5(
1858
+ return /* @__PURE__ */ jsxs6(
1493
1859
  "button",
1494
1860
  {
1495
1861
  type: "button",
@@ -1498,21 +1864,21 @@ var SectionNodeComponent = ({ data }) => {
1498
1864
  className: "flex h-full w-full cursor-zoom-in flex-col overflow-hidden rounded-[64px] bg-card text-left shadow-surface-raised ring-1 ring-foreground/10 transition-shadow hover:ring-[24px] hover:ring-brand/40",
1499
1865
  style: { padding: titleFontSize },
1500
1866
  children: [
1501
- /* @__PURE__ */ jsxs5("span", { className: "block w-full", style: { fontSize: titleFontSize, lineHeight: 1.2 }, children: [
1502
- /* @__PURE__ */ jsx5("span", { className: "line-clamp-2 font-bold text-foreground", children: data.title }),
1503
- /* @__PURE__ */ jsxs5("span", { className: "block text-muted-foreground", style: { fontSize: titleFontSize * 0.8 }, children: [
1867
+ /* @__PURE__ */ jsxs6("span", { className: "block w-full", style: { fontSize: titleFontSize, lineHeight: 1.2 }, children: [
1868
+ /* @__PURE__ */ jsx6("span", { className: "line-clamp-2 font-bold text-foreground", children: data.title }),
1869
+ /* @__PURE__ */ jsxs6("span", { className: "block text-muted-foreground", style: { fontSize: titleFontSize * 0.8 }, children: [
1504
1870
  data.boardCount,
1505
1871
  " boards"
1506
1872
  ] })
1507
1873
  ] }),
1508
- /* @__PURE__ */ jsx5(
1874
+ /* @__PURE__ */ jsx6(
1509
1875
  "span",
1510
1876
  {
1511
1877
  className: "mt-auto grid min-h-0 flex-1 grid-cols-2 content-end",
1512
1878
  style: { gap: titleFontSize * 0.6, paddingTop: titleFontSize * 0.6 },
1513
1879
  children: data.coverUrls.map((coverUrl) => (
1514
1880
  // biome-ignore lint/performance/noImgElement: small cover thumbnails from the API at canvas scale
1515
- /* @__PURE__ */ jsx5(
1881
+ /* @__PURE__ */ jsx6(
1516
1882
  "img",
1517
1883
  {
1518
1884
  src: coverUrl,
@@ -1534,7 +1900,7 @@ var SectionNodeComponent = ({ data }) => {
1534
1900
  var SectionNode = memo2(SectionNodeComponent);
1535
1901
 
1536
1902
  // src/canvas/DesignCanvasFlow.tsx
1537
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1903
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1538
1904
  var NODE_TYPES = { board: BoardNode, section: SectionNode };
1539
1905
  var ZOOM_PRESETS = [0.25, 0.5, 1];
1540
1906
  var MIN_ZOOM = 5e-3;
@@ -1560,8 +1926,8 @@ var ZoomMenu = ({ onFitAll }) => {
1560
1926
  const { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } = useDesignStudioComponents();
1561
1927
  const reactFlow = useReactFlow();
1562
1928
  const zoomPercent = useStore3((state) => Math.round(state.transform[2] * 100));
1563
- return /* @__PURE__ */ jsxs6(DropdownMenu, { modal: false, children: [
1564
- /* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
1929
+ return /* @__PURE__ */ jsxs7(DropdownMenu, { modal: false, children: [
1930
+ /* @__PURE__ */ jsx7(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
1565
1931
  "button",
1566
1932
  {
1567
1933
  type: "button",
@@ -1570,19 +1936,19 @@ var ZoomMenu = ({ onFitAll }) => {
1570
1936
  children: [
1571
1937
  zoomPercent,
1572
1938
  "%",
1573
- /* @__PURE__ */ jsx6(ChevronDown, { className: "size-3.5 text-muted-foreground", "aria-hidden": true })
1939
+ /* @__PURE__ */ jsx7(ChevronDown, { className: "size-3.5 text-muted-foreground", "aria-hidden": true })
1574
1940
  ]
1575
1941
  }
1576
1942
  ) }),
1577
- /* @__PURE__ */ jsxs6(DropdownMenuContent, { align: "end", children: [
1578
- ZOOM_PRESETS.map((zoom) => /* @__PURE__ */ jsxs6(DropdownMenuItem, { onSelect: () => void reactFlow.zoomTo(zoom, { duration: 250 }), children: [
1943
+ /* @__PURE__ */ jsxs7(DropdownMenuContent, { align: "end", children: [
1944
+ ZOOM_PRESETS.map((zoom) => /* @__PURE__ */ jsxs7(DropdownMenuItem, { onSelect: () => void reactFlow.zoomTo(zoom, { duration: 250 }), children: [
1579
1945
  Math.round(zoom * 100),
1580
1946
  " %"
1581
1947
  ] }, zoom)),
1582
- /* @__PURE__ */ jsx6(DropdownMenuSeparator, {}),
1583
- /* @__PURE__ */ jsx6(DropdownMenuItem, { onSelect: () => void reactFlow.zoomIn({ duration: 200 }), children: "Zoom in" }),
1584
- /* @__PURE__ */ jsx6(DropdownMenuItem, { onSelect: () => void reactFlow.zoomOut({ duration: 200 }), children: "Zoom out" }),
1585
- /* @__PURE__ */ jsx6(DropdownMenuItem, { onSelect: onFitAll, children: "Fit all" })
1948
+ /* @__PURE__ */ jsx7(DropdownMenuSeparator, {}),
1949
+ /* @__PURE__ */ jsx7(DropdownMenuItem, { onSelect: () => void reactFlow.zoomIn({ duration: 200 }), children: "Zoom in" }),
1950
+ /* @__PURE__ */ jsx7(DropdownMenuItem, { onSelect: () => void reactFlow.zoomOut({ duration: 200 }), children: "Zoom out" }),
1951
+ /* @__PURE__ */ jsx7(DropdownMenuItem, { onSelect: onFitAll, children: "Fit all" })
1586
1952
  ] })
1587
1953
  ] });
1588
1954
  };
@@ -1752,11 +2118,11 @@ var FlowCanvas = ({
1752
2118
  }) => {
1753
2119
  const { apiBaseUrl, components, statusColors } = useDesignStudio();
1754
2120
  const { Tooltip, TooltipContent, TooltipTrigger } = components;
1755
- const containerRef = useRef2(null);
2121
+ const containerRef = useRef3(null);
1756
2122
  const reactFlow = useReactFlow();
1757
2123
  useWheelZoom(containerRef);
1758
2124
  const isOverview = useStore3((state) => state.transform[2] < OVERVIEW_ZOOM);
1759
- const previousNodesRef = useRef2([]);
2125
+ const previousNodesRef = useRef3([]);
1760
2126
  const nodes = useMemo(() => {
1761
2127
  const reused = reuseUnchangedNodes(
1762
2128
  previousNodesRef.current,
@@ -1773,7 +2139,7 @@ var FlowCanvas = ({
1773
2139
  () => [...layout.boards].map(([id, rect]) => ({ id, ...rect })),
1774
2140
  [layout]
1775
2141
  );
1776
- const liveBoardsTimerRef = useRef2(null);
2142
+ const liveBoardsTimerRef = useRef3(null);
1777
2143
  const cancelLiveBoardsUpdate = useCallback(() => {
1778
2144
  if (liveBoardsTimerRef.current) clearTimeout(liveBoardsTimerRef.current);
1779
2145
  liveBoardsTimerRef.current = null;
@@ -1789,7 +2155,7 @@ var FlowCanvas = ({
1789
2155
  },
1790
2156
  [boardRects, onLiveBoardIdsChange, onVisibleBoardIdsChange, liveMinRatio]
1791
2157
  );
1792
- const hasInitialFitRef = useRef2(false);
2158
+ const hasInitialFitRef = useRef3(false);
1793
2159
  const fitRect = useCallback(
1794
2160
  (rect, duration, fitWidthOnly = false) => {
1795
2161
  const container = containerRef.current;
@@ -1831,15 +2197,15 @@ var FlowCanvas = ({
1831
2197
  const fitAll = useCallback(() => {
1832
2198
  fitRect(layout.bounds, 400);
1833
2199
  }, [fitRect, layout]);
1834
- const handledFitKeyRef = useRef2(null);
2200
+ const handledFitKeyRef = useRef3(null);
1835
2201
  useEffect5(() => {
1836
2202
  if (!fitRequest || handledFitKeyRef.current === fitRequest.key) return;
1837
2203
  handledFitKeyRef.current = fitRequest.key;
1838
2204
  fitNodes(fitRequest.nodeIds);
1839
2205
  }, [fitRequest, fitNodes]);
1840
- const committedViewportRef = useRef2(null);
1841
- const isFlowReadyRef = useRef2(false);
1842
- const initialViewportRef = useRef2(initialViewport);
2206
+ const committedViewportRef = useRef3(null);
2207
+ const isFlowReadyRef = useRef3(false);
2208
+ const initialViewportRef = useRef3(initialViewport);
1843
2209
  const fitInitialView = useCallback(() => {
1844
2210
  if (!isFlowReadyRef.current || hasInitialFitRef.current || layout.sections.length === 0) return;
1845
2211
  const container = containerRef.current;
@@ -1857,7 +2223,7 @@ var FlowCanvas = ({
1857
2223
  committedViewportRef.current = formatViewportParam(viewport);
1858
2224
  }
1859
2225
  }, [layout, initialFitNodeIds, fitNodes, fitRect, reactFlow, updateLiveBoards]);
1860
- const viewportCommitTimerRef = useRef2(null);
2226
+ const viewportCommitTimerRef = useRef3(null);
1861
2227
  useEffect5(
1862
2228
  () => () => {
1863
2229
  if (viewportCommitTimerRef.current) clearTimeout(viewportCommitTimerRef.current);
@@ -1928,8 +2294,8 @@ var FlowCanvas = ({
1928
2294
  const presentationStart = findSectionPresentationStart(layout.sections, selectedNodeId, sectionInView());
1929
2295
  if (presentationStart) onPresentSection(presentationStart.sectionId, presentationStart.boardId);
1930
2296
  };
1931
- const [marquee, setMarquee] = useState7(null);
1932
- const isMarqueeJustEndedRef = useRef2(false);
2297
+ const [marquee, setMarquee] = useState8(null);
2298
+ const isMarqueeJustEndedRef = useRef3(false);
1933
2299
  const startMarquee = (event) => {
1934
2300
  const target = event.target;
1935
2301
  if (tool !== "select" || event.button !== 0 || !target.classList.contains("react-flow__pane")) return;
@@ -1977,14 +2343,14 @@ var FlowCanvas = ({
1977
2343
  const minimapHeight = Math.round(
1978
2344
  Math.min(180, Math.max(60, MINIMAP_WIDTH * layout.bounds.height / Math.max(1, layout.bounds.width)))
1979
2345
  );
1980
- return /* @__PURE__ */ jsxs6(
2346
+ return /* @__PURE__ */ jsxs7(
1981
2347
  "div",
1982
2348
  {
1983
2349
  ref: containerRef,
1984
2350
  className: cx("relative h-full w-full", tool === "hand" && "cursor-grab active:cursor-grabbing"),
1985
2351
  onPointerDownCapture: startMarquee,
1986
2352
  children: [
1987
- marquee && /* @__PURE__ */ jsx6(
2353
+ marquee && /* @__PURE__ */ jsx7(
1988
2354
  "div",
1989
2355
  {
1990
2356
  "aria-hidden": true,
@@ -1997,7 +2363,7 @@ var FlowCanvas = ({
1997
2363
  }
1998
2364
  }
1999
2365
  ),
2000
- /* @__PURE__ */ jsxs6(
2366
+ /* @__PURE__ */ jsxs7(
2001
2367
  ReactFlow,
2002
2368
  {
2003
2369
  nodes,
@@ -2030,13 +2396,13 @@ var FlowCanvas = ({
2030
2396
  selectionOnDrag: false,
2031
2397
  proOptions: { hideAttribution: true },
2032
2398
  children: [
2033
- /* @__PURE__ */ jsx6(Background, { variant: BackgroundVariant.Dots, gap: 32, size: 1.5, color: "var(--tint-strong)" }),
2034
- /* @__PURE__ */ jsxs6(Panel, { position: "top-left", className: "flex max-w-[calc(100%-32rem)] flex-wrap items-center gap-2", children: [
2035
- /* @__PURE__ */ jsx6("div", { className: TOOLBAR_GROUP_CLASS, role: "toolbar", "aria-label": "Canvas tools", children: [
2399
+ /* @__PURE__ */ jsx7(Background, { variant: BackgroundVariant.Dots, gap: 32, size: 1.5, color: "var(--tint-strong)" }),
2400
+ /* @__PURE__ */ jsxs7(Panel, { position: "top-left", className: "flex max-w-[calc(100%-32rem)] flex-wrap items-center gap-2", children: [
2401
+ /* @__PURE__ */ jsx7("div", { className: TOOLBAR_GROUP_CLASS, role: "toolbar", "aria-label": "Canvas tools", children: [
2036
2402
  ["hand", Hand, "Pan (H / Esc) \u2014 drag moves the canvas, click selects a board"],
2037
2403
  ["select", MousePointer2, "Select area (V) \u2014 drag a rectangle to select boards, Space + drag pans"]
2038
- ].map(([toolName, Icon, label]) => /* @__PURE__ */ jsxs6(Tooltip, { children: [
2039
- /* @__PURE__ */ jsx6(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
2404
+ ].map(([toolName, Icon, label]) => /* @__PURE__ */ jsxs7(Tooltip, { children: [
2405
+ /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(
2040
2406
  "button",
2041
2407
  {
2042
2408
  type: "button",
@@ -2044,32 +2410,32 @@ var FlowCanvas = ({
2044
2410
  "aria-pressed": tool === toolName,
2045
2411
  onClick: () => onToolChange(toolName),
2046
2412
  className: cx(TOOL_BUTTON_CLASS, tool === toolName && "bg-brand-light text-brand-emphasis"),
2047
- children: /* @__PURE__ */ jsx6(Icon, { className: "size-4" })
2413
+ children: /* @__PURE__ */ jsx7(Icon, { className: "size-4" })
2048
2414
  }
2049
2415
  ) }),
2050
- /* @__PURE__ */ jsx6(TooltipContent, { side: "bottom", children: label })
2416
+ /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: label })
2051
2417
  ] }, toolName)) }),
2052
2418
  toolbarStart
2053
2419
  ] }),
2054
- /* @__PURE__ */ jsx6(Panel, { position: "top-right", children: /* @__PURE__ */ jsxs6("div", { className: TOOLBAR_GROUP_CLASS, children: [
2420
+ /* @__PURE__ */ jsx7(Panel, { position: "top-right", children: /* @__PURE__ */ jsxs7("div", { className: TOOLBAR_GROUP_CLASS, children: [
2055
2421
  toolbarEnd,
2056
- /* @__PURE__ */ jsxs6(Tooltip, { children: [
2057
- /* @__PURE__ */ jsx6(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
2422
+ /* @__PURE__ */ jsxs7(Tooltip, { children: [
2423
+ /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(
2058
2424
  "button",
2059
2425
  {
2060
2426
  type: "button",
2061
2427
  "aria-label": "Present the section in view",
2062
2428
  onClick: presentCurrentSection,
2063
2429
  className: TOOL_BUTTON_CLASS,
2064
- children: /* @__PURE__ */ jsx6(Play, { className: "size-4" })
2430
+ children: /* @__PURE__ */ jsx7(Play, { className: "size-4" })
2065
2431
  }
2066
2432
  ) }),
2067
- /* @__PURE__ */ jsx6(TooltipContent, { side: "bottom", children: "Present this section (\u2190 / \u2192)" })
2433
+ /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: "Present this section (\u2190 / \u2192)" })
2068
2434
  ] }),
2069
- /* @__PURE__ */ jsx6(ZoomMenu, { onFitAll: fitAll })
2435
+ /* @__PURE__ */ jsx7(ZoomMenu, { onFitAll: fitAll })
2070
2436
  ] }) }),
2071
- /* @__PURE__ */ jsx6(Panel, { position: "bottom-left", className: "pointer-events-none", children: /* @__PURE__ */ jsx6("p", { className: "surface-glass-strong rounded-xl px-3 py-1.5 text-xs text-muted-foreground ring-1 ring-foreground/5", children: "Drag to pan \xB7 Scroll or pinch to zoom \xB7 Click selects \xB7 Double-click opens \xB7 + / \u2212 / 0 \xB7 Shift+1 fits all" }) }),
2072
- !isEverythingVisible && /* @__PURE__ */ jsx6(
2437
+ /* @__PURE__ */ jsx7(Panel, { position: "bottom-left", className: "pointer-events-none", children: /* @__PURE__ */ jsx7("p", { className: "surface-glass-strong rounded-xl px-3 py-1.5 text-xs text-muted-foreground ring-1 ring-foreground/5", children: "Drag to pan \xB7 Scroll or pinch to zoom \xB7 Click selects \xB7 Double-click opens \xB7 + / \u2212 / 0 \xB7 Shift+1 fits all" }) }),
2438
+ !isEverythingVisible && /* @__PURE__ */ jsx7(
2073
2439
  MiniMap,
2074
2440
  {
2075
2441
  pannable: true,
@@ -2093,10 +2459,10 @@ var FlowCanvas = ({
2093
2459
  }
2094
2460
  );
2095
2461
  };
2096
- var DesignCanvasFlow = (props) => /* @__PURE__ */ jsx6(ReactFlowProvider, { children: /* @__PURE__ */ jsx6(FlowCanvas, { ...props }) });
2462
+ var DesignCanvasFlow = (props) => /* @__PURE__ */ jsx7(ReactFlowProvider, { children: /* @__PURE__ */ jsx7(FlowCanvas, { ...props }) });
2097
2463
 
2098
2464
  // src/canvas/DesignStudioCanvasScreen.tsx
2099
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2465
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2100
2466
  var CANVAS_STATE_KEYS = ["q", "section", "status", "theme", "mode", "vp"];
2101
2467
  var UNCOUNTED_CANVAS_STATE_KEYS = ["q", "theme", "mode", "vp"];
2102
2468
  var LIVE_UPDATE_POLL_MS = 15e3;
@@ -2105,7 +2471,7 @@ var OPEN_RENDER_STATUSES = /* @__PURE__ */ new Set(["QUEUED", "RUNNING", "WAITIN
2105
2471
  var MAX_PRIORITY_BOARDS = 200;
2106
2472
  var LIVE_UPDATE_TOAST_ID = "design-canvas-live-update";
2107
2473
  var usePageVisible = () => {
2108
- const [isVisible, setIsVisible] = useState8(true);
2474
+ const [isVisible, setIsVisible] = useState9(true);
2109
2475
  useEffect6(() => {
2110
2476
  const update = () => setIsVisible(document.visibilityState === "visible");
2111
2477
  update();
@@ -2122,8 +2488,8 @@ var NO_SIDEBAR = [true, () => void 0];
2122
2488
  var useNoSidebar = () => NO_SIDEBAR;
2123
2489
  var useCollapsedSidebarWhileMounted = (useSidebarCollapsed = useNoSidebar) => {
2124
2490
  const [isCollapsed, toggleCollapsed] = useSidebarCollapsed();
2125
- const collapsedByCanvasRef = useRef3(false);
2126
- const toggleRef = useRef3(toggleCollapsed);
2491
+ const collapsedByCanvasRef = useRef4(false);
2492
+ const toggleRef = useRef4(toggleCollapsed);
2127
2493
  toggleRef.current = toggleCollapsed;
2128
2494
  useEffect6(() => {
2129
2495
  if (!isCollapsed) {
@@ -2157,17 +2523,17 @@ var SelectedBoardPanel = ({
2157
2523
  }) => {
2158
2524
  const { Button } = useDesignStudioComponents();
2159
2525
  const texts = useDesignStudioTexts();
2160
- const [showResolved, setShowResolved] = useState8(false);
2161
- return /* @__PURE__ */ jsxs7("div", { className: "space-y-5", children: [
2162
- /* @__PURE__ */ jsxs7("div", { className: "space-y-1", children: [
2163
- board.code && /* @__PURE__ */ jsx7("p", { className: "text-sm font-semibold tabular-nums text-foreground/70", children: board.code }),
2164
- /* @__PURE__ */ jsx7("h2", { className: "text-title-card font-semibold break-words", children: board.title }),
2165
- /* @__PURE__ */ jsxs7("p", { className: "text-xs text-muted-foreground", children: [
2526
+ const [showResolved, setShowResolved] = useState9(false);
2527
+ return /* @__PURE__ */ jsxs8("div", { className: "space-y-5", children: [
2528
+ /* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
2529
+ board.code && /* @__PURE__ */ jsx8("p", { className: "text-sm font-semibold tabular-nums text-foreground/70", children: board.code }),
2530
+ /* @__PURE__ */ jsx8("h2", { className: "text-title-card font-semibold break-words", children: board.title }),
2531
+ /* @__PURE__ */ jsxs8("p", { className: "text-xs text-muted-foreground", children: [
2166
2532
  sectionTitle ? `${sectionTitle} \xB7 ` : "",
2167
2533
  board.boardKey
2168
2534
  ] })
2169
2535
  ] }),
2170
- /* @__PURE__ */ jsx7(
2536
+ /* @__PURE__ */ jsx8(
2171
2537
  BoardStatusChips,
2172
2538
  {
2173
2539
  projectKey,
@@ -2178,22 +2544,22 @@ var SelectedBoardPanel = ({
2178
2544
  onStatusChanged
2179
2545
  }
2180
2546
  ),
2181
- /* @__PURE__ */ jsxs7("div", { className: "flex gap-2", children: [
2182
- /* @__PURE__ */ jsxs7(Button, { variant: "outline", className: "flex-1", onClick: onOpen, children: [
2183
- /* @__PURE__ */ jsx7(Maximize22, {}),
2547
+ /* @__PURE__ */ jsxs8("div", { className: "flex gap-2", children: [
2548
+ /* @__PURE__ */ jsxs8(Button, { variant: "outline", className: "flex-1", onClick: onOpen, children: [
2549
+ /* @__PURE__ */ jsx8(Maximize22, {}),
2184
2550
  " Open focus view"
2185
2551
  ] }),
2186
- onCopyLink && /* @__PURE__ */ jsxs7(Button, { variant: "outline", onClick: onCopyLink, "aria-label": `${texts.copyBoardLink}: ${board.code ?? ""}`, children: [
2187
- /* @__PURE__ */ jsx7(Link2, {}),
2552
+ onCopyLink && /* @__PURE__ */ jsxs8(Button, { variant: "outline", onClick: onCopyLink, "aria-label": `${texts.copyBoardLink}: ${board.code ?? ""}`, children: [
2553
+ /* @__PURE__ */ jsx8(Link2, {}),
2188
2554
  " ",
2189
2555
  texts.copyBoardLink
2190
2556
  ] })
2191
2557
  ] }),
2192
- board.contentHash && /* @__PURE__ */ jsxs7("p", { className: "text-xs text-muted-foreground", title: `Content hash of the board file: ${board.contentHash}`, children: [
2558
+ board.contentHash && /* @__PURE__ */ jsxs8("p", { className: "text-xs text-muted-foreground", title: `Content hash of the board file: ${board.contentHash}`, children: [
2193
2559
  "Version ",
2194
- /* @__PURE__ */ jsx7("span", { className: "font-mono", children: shortContentHash(board.contentHash) })
2560
+ /* @__PURE__ */ jsx8("span", { className: "font-mono", children: shortContentHash(board.contentHash) })
2195
2561
  ] }),
2196
- /* @__PURE__ */ jsx7(
2562
+ /* @__PURE__ */ jsx8(
2197
2563
  BoardComments,
2198
2564
  {
2199
2565
  projectKey,
@@ -2243,15 +2609,17 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2243
2609
  const writeSearchParams = router.useSearchParamsWriter();
2244
2610
  const writesAllowed = useCanWrite();
2245
2611
  const isPageVisible = usePageVisible();
2246
- const [statusOverrides, setStatusOverrides] = useState8(/* @__PURE__ */ new Map());
2247
- const [liveBoardIds, setLiveBoardIds] = useState8(/* @__PURE__ */ new Set());
2248
- const [selectedBoardId, setSelectedBoardId] = useState8(null);
2249
- const [selectedBoardIds, setSelectedBoardIds] = useState8(/* @__PURE__ */ new Set());
2250
- const [focusedBoardId, setFocusedBoardId] = useState8(null);
2251
- const [presentSectionId, setPresentSectionId] = useState8(null);
2252
- const [fitRequest, setFitRequest] = useState8(null);
2253
- const [tool, setTool] = useState8("hand");
2254
- const [isCommentsPanelOpen, setIsCommentsPanelOpen] = useState8(
2612
+ const [statusOverrides, setStatusOverrides] = useState9(/* @__PURE__ */ new Map());
2613
+ const [liveBoardIds, setLiveBoardIds] = useState9(/* @__PURE__ */ new Set());
2614
+ const [selectedBoardId, setSelectedBoardId] = useState9(null);
2615
+ const [selectedBoardIds, setSelectedBoardIds] = useState9(/* @__PURE__ */ new Set());
2616
+ const [focusedBoardId, setFocusedBoardId] = useState9(null);
2617
+ const [frameHeightMode, setFrameHeightMode] = useState9("viewport");
2618
+ const [chosenFocusViewport, setChosenFocusViewport] = useState9(null);
2619
+ const [presentSectionId, setPresentSectionId] = useState9(null);
2620
+ const [fitRequest, setFitRequest] = useState9(null);
2621
+ const [tool, setTool] = useState9("hand");
2622
+ const [isCommentsPanelOpen, setIsCommentsPanelOpen] = useState9(
2255
2623
  () => Boolean(searchParams.get(CODE_PARAM)) || storage.read("commentsPanelOpen") !== "0"
2256
2624
  );
2257
2625
  const canvasState = router.useUrlState(CANVAS_STATE_KEYS, {
@@ -2268,19 +2636,19 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2268
2636
  const setSearch = useCallback2((value) => setCanvasStateValue("q", value), [setCanvasStateValue]);
2269
2637
  const setSectionFilter = useCallback2((value) => setCanvasStateValue("section", value), [setCanvasStateValue]);
2270
2638
  const setStatusFilter = useCallback2((value) => setCanvasStateValue("status", value), [setCanvasStateValue]);
2271
- const [isFullscreen, setIsFullscreen] = useState8(false);
2272
- const canvasAreaRef = useRef3(null);
2273
- const [canvasAspectRatio, setCanvasAspectRatio] = useState8(null);
2639
+ const [isFullscreen, setIsFullscreen] = useState9(false);
2640
+ const canvasAreaRef = useRef4(null);
2641
+ const [canvasAspectRatio, setCanvasAspectRatio] = useState9(null);
2274
2642
  useCollapsedSidebarWhileMounted(shell?.useSidebarCollapsed);
2275
2643
  const debouncedSearch = canvasState.debounced.q;
2276
- const [codeAtLoad] = useState8(() => searchParams.get(CODE_PARAM));
2277
- const [initialViewport] = useState8(
2644
+ const [codeAtLoad] = useState9(() => searchParams.get(CODE_PARAM));
2645
+ const [initialViewport] = useState9(
2278
2646
  () => codeAtLoad ? null : parseViewportParam(canvasState.values.vp)
2279
2647
  );
2280
- const [hasInitialFilterWithViewport] = useState8(
2648
+ const [hasInitialFilterWithViewport] = useState9(
2281
2649
  () => initialViewport !== null && Boolean(canvasState.values.q.trim() || canvasState.values.section || canvasState.values.status)
2282
2650
  );
2283
- const currentViewportRef = useRef3(initialViewport ? formatViewportParam(initialViewport) : null);
2651
+ const currentViewportRef = useRef4(initialViewport ? formatViewportParam(initialViewport) : null);
2284
2652
  const commitViewport = useCallback2(
2285
2653
  (viewport) => {
2286
2654
  const value = formatViewportParam(viewport);
@@ -2302,7 +2670,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2302
2670
  const themes = useMemo2(() => themesData?.designThemes.elements ?? [], [themesData]);
2303
2671
  const isDefaultLook = chosenThemeId === null && chosenMode === null;
2304
2672
  const isLookResolved = isDefaultLook || (overviewData !== void 0 || isOverviewError) && (!hasThemes || themesData !== void 0 || isThemesError);
2305
- const [loadedReferenceTheme, setLoadedReferenceTheme] = useState8(void 0);
2673
+ const [loadedReferenceTheme, setLoadedReferenceTheme] = useState9(void 0);
2306
2674
  const referenceTheme = loadedReferenceTheme !== void 0 ? loadedReferenceTheme : canvasSummary?.referenceTheme;
2307
2675
  const referenceLook = useMemo2(() => splitThemeReference(referenceTheme), [referenceTheme]);
2308
2676
  const referenceThemeId = referenceLook?.themeId ?? null;
@@ -2317,7 +2685,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2317
2685
  () => ({ projectKey, canvasKey, ...themeArgument ? { theme: themeArgument } : {} }),
2318
2686
  [projectKey, canvasKey, themeArgument]
2319
2687
  );
2320
- const [isRenderPolling, setIsRenderPolling] = useState8(false);
2688
+ const [isRenderPolling, setIsRenderPolling] = useState9(false);
2321
2689
  const {
2322
2690
  data,
2323
2691
  currentData: currentCanvasData,
@@ -2351,7 +2719,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2351
2719
  [statuses, statusDefinitions]
2352
2720
  );
2353
2721
  const canvasBoards = canvas?.boards?.elements;
2354
- const [shownBoards, setShownBoards] = useState8({
2722
+ const [shownBoards, setShownBoards] = useState9({
2355
2723
  source: void 0,
2356
2724
  themeReference: "",
2357
2725
  boards: [],
@@ -2402,13 +2770,14 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2402
2770
  shownBoardList.map((board) => ({
2403
2771
  id: boardNodeId(board.boardKey ?? ""),
2404
2772
  sectionId: board.sectionKey && sectionKeys.has(board.sectionKey) ? board.sectionKey : null,
2405
- width: board.width ?? 390,
2406
- height: board.height ?? 844,
2773
+ ...boardCanvasSize(board, frameHeightMode),
2407
2774
  displayOrder: board.displayOrder ?? 0
2408
2775
  })),
2409
2776
  canvasAspectRatio ?? void 0
2410
2777
  );
2411
- }, [sections, shownBoardList, canvasAspectRatio]);
2778
+ }, [sections, shownBoardList, canvasAspectRatio, frameHeightMode]);
2779
+ const devices = useMemo2(() => canvas?.devices?.elements ?? [], [canvas?.devices]);
2780
+ const hasResponsiveBoards = useMemo2(() => shownBoardList.some((board) => isResponsiveBoard(board)), [shownBoardList]);
2412
2781
  const hasCanvas = Boolean(canvas);
2413
2782
  useEffect6(() => {
2414
2783
  const canvasArea = canvasAreaRef.current;
@@ -2431,13 +2800,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2431
2800
  const isRenderOpen = renderStatus !== null && OPEN_RENDER_STATUSES.has(renderStatus);
2432
2801
  useEffect6(() => setIsRenderPolling(isRenderOpen), [isRenderOpen]);
2433
2802
  const [requestThumbnailRendering] = api.useRequestThumbnailRenderingMutation();
2434
- const visibleBoardIdsRef = useRef3([]);
2803
+ const visibleBoardIdsRef = useRef4([]);
2435
2804
  const rememberVisibleBoardIds = useCallback2((visibleBoardIds) => {
2436
2805
  visibleBoardIdsRef.current = visibleBoardIds;
2437
2806
  }, []);
2438
- const boardsByNodeIdRef = useRef3(boardsByNodeId);
2807
+ const boardsByNodeIdRef = useRef4(boardsByNodeId);
2439
2808
  boardsByNodeIdRef.current = boardsByNodeId;
2440
- const requestedThumbnailsRef = useRef3(/* @__PURE__ */ new Set());
2809
+ const requestedThumbnailsRef = useRef4(/* @__PURE__ */ new Set());
2441
2810
  const fileRenderRequest = useCallback2(
2442
2811
  (isRetry) => {
2443
2812
  if (!writesAllowed || !currentCanvas) return;
@@ -2519,14 +2888,14 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2519
2888
  }
2520
2889
  return layoutOrder.filter((nodeId) => matchingBoardIds === null || matchingBoardIds.has(nodeId));
2521
2890
  }, [layout, layoutOrder, matchingBoardIds, presentSectionId]);
2522
- const fitKeyRef = useRef3(0);
2891
+ const fitKeyRef = useRef4(0);
2523
2892
  const requestFit = useCallback2((nodeIds) => {
2524
2893
  fitKeyRef.current += 1;
2525
2894
  setFitRequest({ nodeIds, key: fitKeyRef.current });
2526
2895
  }, []);
2527
2896
  const filterKey = matchingBoardIds === null ? null : `${debouncedSearch.trim()}|${sectionFilter}|${statusFilter}`;
2528
- const fittedFilterKeyRef = useRef3(null);
2529
- const skipInitialFilterFitRef = useRef3(hasInitialFilterWithViewport);
2897
+ const fittedFilterKeyRef = useRef4(null);
2898
+ const skipInitialFilterFitRef = useRef4(hasInitialFilterWithViewport);
2530
2899
  useEffect6(() => {
2531
2900
  if (filterKey === null || matchingBoardIds === null) {
2532
2901
  fittedFilterKeyRef.current = null;
@@ -2561,6 +2930,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2561
2930
  const closeFocus = useCallback2(() => {
2562
2931
  setFocusedBoardId(null);
2563
2932
  setPresentSectionId(null);
2933
+ setChosenFocusViewport(null);
2564
2934
  writeSearchParams({ [BOARD_PARAM]: null });
2565
2935
  }, [writeSearchParams]);
2566
2936
  const presentSection = useCallback2(
@@ -2574,7 +2944,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2574
2944
  [layout, openBoard]
2575
2945
  );
2576
2946
  const boardParam = searchParams.get(BOARD_PARAM);
2577
- const isDeepLinkHandledRef = useRef3(false);
2947
+ const isDeepLinkHandledRef = useRef4(false);
2578
2948
  useEffect6(() => {
2579
2949
  if (isDeepLinkHandledRef.current || !boardParam || boards.length === 0) return;
2580
2950
  isDeepLinkHandledRef.current = true;
@@ -2585,7 +2955,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2585
2955
  if (!initialViewport) requestFit([nodeId]);
2586
2956
  }, [boardParam, boards.length, boardsByNodeId, requestFit, initialViewport]);
2587
2957
  const codeParam = searchParams.get(CODE_PARAM);
2588
- const handledCodeRef = useRef3(null);
2958
+ const handledCodeRef = useRef4(null);
2589
2959
  useEffect6(() => {
2590
2960
  if (!codeParam) {
2591
2961
  if (handledCodeRef.current !== null) handledCodeRef.current = "";
@@ -2611,7 +2981,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2611
2981
  setIsCommentsPanelOpen(true);
2612
2982
  }
2613
2983
  }, [codeParam, codeAtLoad, boards, isCommentsPanelOpen, writeSearchParams, notify, texts, requestFit]);
2614
- const pendingCodeFitRef = useRef3(null);
2984
+ const pendingCodeFitRef = useRef4(null);
2615
2985
  useEffect6(() => {
2616
2986
  const nodeId = pendingCodeFitRef.current;
2617
2987
  if (!nodeId || layout.sections.length === 0) return;
@@ -2698,6 +3068,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2698
3068
  const copyThreadReference = useCallback2(
2699
3069
  (thread) => void copyReferences([
2700
3070
  buildReferenceFor(boardNodeId(thread.root.boardKey ?? ""), {
3071
+ viewport: viewportOfComment(thread.root),
2701
3072
  comment: {
2702
3073
  id: thread.root.id ?? "",
2703
3074
  x: thread.root.x ?? null,
@@ -2720,7 +3091,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2720
3091
  },
2721
3092
  [shownLook, notify, texts]
2722
3093
  );
2723
- const seenRevisionRef = useRef3(null);
3094
+ const seenRevisionRef = useRef4(null);
2724
3095
  const revision = currentRevisionData?.revision;
2725
3096
  const revisionLook = themeArgument ?? "";
2726
3097
  useEffect6(() => {
@@ -2742,7 +3113,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2742
3113
  },
2743
3114
  [requestFit]
2744
3115
  );
2745
- const layoutOrderRef = useRef3(layoutOrder);
3116
+ const layoutOrderRef = useRef4(layoutOrder);
2746
3117
  layoutOrderRef.current = layoutOrder;
2747
3118
  useEffect6(() => {
2748
3119
  const changedBoardKeys = shownBoards.changedBoardKeys;
@@ -2754,7 +3125,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2754
3125
  action: { label: texts.showUpdatedBoard, onClick: () => showBoard(firstNodeId) }
2755
3126
  });
2756
3127
  }, [shownBoards.serial]);
2757
- const shownBoardsRef = useRef3(shownBoards);
3128
+ const shownBoardsRef = useRef4(shownBoards);
2758
3129
  shownBoardsRef.current = shownBoards;
2759
3130
  const reloadCanvas = useCallback2(async () => {
2760
3131
  if (shownBoardsRef.current.source === void 0) return;
@@ -2767,7 +3138,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2767
3138
  notify.info(texts.canvasUpToDate, { id: LIVE_UPDATE_TOAST_ID });
2768
3139
  }
2769
3140
  }, [refetchCanvas, refetchComments, refetchRevision, notify, texts]);
2770
- const reloadCanvasRef = useRef3(reloadCanvas);
3141
+ const reloadCanvasRef = useRef4(reloadCanvas);
2771
3142
  reloadCanvasRef.current = reloadCanvas;
2772
3143
  const canvasView = useMemo2(
2773
3144
  () => ({
@@ -2777,6 +3148,8 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2777
3148
  matchingBoardIds,
2778
3149
  openThreadCounts,
2779
3150
  defaultStatus,
3151
+ frameHeightMode,
3152
+ devices,
2780
3153
  isHandTool: tool === "hand",
2781
3154
  onSelectBoard: selectBoard,
2782
3155
  onCopyReference: (nodeId) => void copyReferences([buildReferenceFor(nodeId)]),
@@ -2790,6 +3163,8 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2790
3163
  matchingBoardIds,
2791
3164
  openThreadCounts,
2792
3165
  defaultStatus,
3166
+ frameHeightMode,
3167
+ devices,
2793
3168
  tool,
2794
3169
  selectBoard,
2795
3170
  copyReferences,
@@ -2800,6 +3175,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2800
3175
  );
2801
3176
  const selectedBoard = selectedBoardId ? boardsByNodeId.get(selectedBoardId) ?? null : null;
2802
3177
  const focusedBoard = focusedBoardId ? boardsByNodeId.get(focusedBoardId) ?? null : null;
3178
+ const focusViewport = initialViewportForBoard(focusedBoard, chosenFocusViewport);
2803
3179
  const threadsOf = (nodeId) => nodeId ? buildCommentThreads(commentsByBoardNodeId.get(nodeId) ?? []) : [];
2804
3180
  const boardsWithOpenThreads = layoutOrder.filter((nodeId) => openThreadCounts.has(nodeId));
2805
3181
  const codeAtLoadBoard = useMemo2(
@@ -2812,7 +3188,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2812
3188
  }, [layout, codeAtLoadBoard]);
2813
3189
  const sectionOptions = layout.sections.map((section) => ({ value: section.id, label: section.title }));
2814
3190
  const presentedSectionTitle = presentSectionId ? layout.sections.find((section) => section.id === presentSectionId)?.title ?? null : null;
2815
- const copySelectedRef = useRef3(copySelectedReferences);
3191
+ const copySelectedRef = useRef4(copySelectedReferences);
2816
3192
  copySelectedRef.current = copySelectedReferences;
2817
3193
  useEffect6(() => {
2818
3194
  const onKeyDown = (event) => {
@@ -2828,10 +3204,10 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2828
3204
  return () => window.removeEventListener("keydown", onKeyDown);
2829
3205
  }, []);
2830
3206
  const activeFilterCount = (sectionFilter ? 1 : 0) + (statusFilter ? 1 : 0);
2831
- const toolbarStart = /* @__PURE__ */ jsxs7("div", { className: cx(TOOLBAR_GROUP_CLASS2, "min-w-0 pl-3"), children: [
2832
- /* @__PURE__ */ jsxs7("div", { className: "min-w-0 pr-1", children: [
2833
- /* @__PURE__ */ jsx7("h1", { className: "max-w-72 truncate text-sm leading-tight font-semibold", title: canvasName, children: canvasName }),
2834
- /* @__PURE__ */ jsxs7("p", { className: "text-xs leading-tight text-muted-foreground", children: [
3207
+ const toolbarStart = /* @__PURE__ */ jsxs8("div", { className: cx(TOOLBAR_GROUP_CLASS2, "min-w-0 pl-3"), children: [
3208
+ /* @__PURE__ */ jsxs8("div", { className: "min-w-0 pr-1", children: [
3209
+ /* @__PURE__ */ jsx8("h1", { className: "max-w-72 truncate text-sm leading-tight font-semibold", title: canvasName, children: canvasName }),
3210
+ /* @__PURE__ */ jsxs8("p", { className: "text-xs leading-tight text-muted-foreground", children: [
2835
3211
  boards.length,
2836
3212
  " boards \xB7 ",
2837
3213
  layout.sections.length,
@@ -2839,7 +3215,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2839
3215
  matchingBoardIds !== null ? ` \xB7 ${matchingBoardIds.size} matching` : ""
2840
3216
  ] })
2841
3217
  ] }),
2842
- /* @__PURE__ */ jsx7(
3218
+ /* @__PURE__ */ jsx8(
2843
3219
  SearchField,
2844
3220
  {
2845
3221
  size: "sm",
@@ -2851,15 +3227,15 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2851
3227
  className: "w-44"
2852
3228
  }
2853
3229
  ),
2854
- /* @__PURE__ */ jsxs7(Popover, { children: [
2855
- /* @__PURE__ */ jsx7(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7("button", { type: "button", className: cx(TOOL_BUTTON_CLASS2, activeFilterCount > 0 && "text-brand-emphasis"), "aria-label": "Filters", children: [
2856
- /* @__PURE__ */ jsx7(ListFilter, { className: "size-4" }),
2857
- activeFilterCount > 0 && /* @__PURE__ */ jsx7("span", { className: "absolute -top-1 -right-1 flex size-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground", children: activeFilterCount })
3230
+ /* @__PURE__ */ jsxs8(Popover, { children: [
3231
+ /* @__PURE__ */ jsx8(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8("button", { type: "button", className: cx(TOOL_BUTTON_CLASS2, activeFilterCount > 0 && "text-brand-emphasis"), "aria-label": "Filters", children: [
3232
+ /* @__PURE__ */ jsx8(ListFilter, { className: "size-4" }),
3233
+ activeFilterCount > 0 && /* @__PURE__ */ jsx8("span", { className: "absolute -top-1 -right-1 flex size-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground", children: activeFilterCount })
2858
3234
  ] }) }),
2859
- /* @__PURE__ */ jsxs7(PopoverContent, { align: "start", className: "w-[22rem] space-y-4 p-4", children: [
2860
- /* @__PURE__ */ jsxs7("div", { className: "space-y-1.5", children: [
2861
- /* @__PURE__ */ jsx7("p", { className: "text-[12.5px] font-bold text-muted-foreground", children: "Section" }),
2862
- /* @__PURE__ */ jsx7(
3235
+ /* @__PURE__ */ jsxs8(PopoverContent, { align: "start", className: "w-[22rem] space-y-4 p-4", children: [
3236
+ /* @__PURE__ */ jsxs8("div", { className: "space-y-1.5", children: [
3237
+ /* @__PURE__ */ jsx8("p", { className: "text-[12.5px] font-bold text-muted-foreground", children: "Section" }),
3238
+ /* @__PURE__ */ jsx8(
2863
3239
  Combobox,
2864
3240
  {
2865
3241
  size: "sm",
@@ -2873,9 +3249,9 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2873
3249
  }
2874
3250
  )
2875
3251
  ] }),
2876
- /* @__PURE__ */ jsxs7("div", { className: "space-y-1.5", children: [
2877
- /* @__PURE__ */ jsx7("p", { className: "text-[12.5px] font-bold text-muted-foreground", children: "Status" }),
2878
- /* @__PURE__ */ jsx7(
3252
+ /* @__PURE__ */ jsxs8("div", { className: "space-y-1.5", children: [
3253
+ /* @__PURE__ */ jsx8("p", { className: "text-[12.5px] font-bold text-muted-foreground", children: "Status" }),
3254
+ /* @__PURE__ */ jsx8(
2879
3255
  QuickFilterPills,
2880
3256
  {
2881
3257
  options: statusFilterOptions,
@@ -2887,7 +3263,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2887
3263
  }
2888
3264
  )
2889
3265
  ] }),
2890
- activeFilterCount > 0 && /* @__PURE__ */ jsx7(
3266
+ activeFilterCount > 0 && /* @__PURE__ */ jsx8(
2891
3267
  Button,
2892
3268
  {
2893
3269
  size: "sm",
@@ -2902,9 +3278,23 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2902
3278
  ] })
2903
3279
  ] })
2904
3280
  ] });
2905
- const toolbarEnd = /* @__PURE__ */ jsxs7(Fragment3, { children: [
2906
- /* @__PURE__ */ jsxs7(Tooltip, { children: [
2907
- /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(
3281
+ const toolbarEnd = /* @__PURE__ */ jsxs8(Fragment5, { children: [
3282
+ hasResponsiveBoards && /* @__PURE__ */ jsxs8(Tooltip, { children: [
3283
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
3284
+ "button",
3285
+ {
3286
+ type: "button",
3287
+ className: TOOL_BUTTON_CLASS2,
3288
+ "aria-pressed": frameHeightMode === "page",
3289
+ "aria-label": frameHeightMode === "page" ? "Device frames: whole page" : "Device frames: one screen",
3290
+ onClick: () => setFrameHeightMode((mode) => mode === "page" ? "viewport" : "page"),
3291
+ children: frameHeightMode === "page" ? /* @__PURE__ */ jsx8(FoldVertical, { className: "size-4" }) : /* @__PURE__ */ jsx8(UnfoldVertical, { className: "size-4" })
3292
+ }
3293
+ ) }),
3294
+ /* @__PURE__ */ jsx8(TooltipContent, { side: "bottom", children: frameHeightMode === "page" ? "Responsive boards: whole page \u2014 show one screen per device" : "Responsive boards: one screen \u2014 show the whole page per device" })
3295
+ ] }),
3296
+ /* @__PURE__ */ jsxs8(Tooltip, { children: [
3297
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
2908
3298
  "button",
2909
3299
  {
2910
3300
  type: "button",
@@ -2913,13 +3303,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2913
3303
  "aria-keyshortcuts": "r",
2914
3304
  "aria-busy": isFetchingCanvas,
2915
3305
  onClick: () => void reloadCanvas(),
2916
- children: /* @__PURE__ */ jsx7(RefreshCw, { className: cx("size-4", isFetchingCanvas && "animate-spin motion-reduce:animate-none") })
3306
+ children: /* @__PURE__ */ jsx8(RefreshCw, { className: cx("size-4", isFetchingCanvas && "animate-spin motion-reduce:animate-none") })
2917
3307
  }
2918
3308
  ) }),
2919
- /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: texts.reload })
3309
+ /* @__PURE__ */ jsx8(TooltipContent, { side: "bottom", children: texts.reload })
2920
3310
  ] }),
2921
- /* @__PURE__ */ jsxs7(Tooltip, { children: [
2922
- /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7("span", { children: /* @__PURE__ */ jsxs7(
3311
+ /* @__PURE__ */ jsxs8(Tooltip, { children: [
3312
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8("span", { children: /* @__PURE__ */ jsxs8(
2923
3313
  "button",
2924
3314
  {
2925
3315
  type: "button",
@@ -2928,14 +3318,14 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2928
3318
  "aria-label": `Copy reference of ${selectedBoardIds.size} selected board(s) for an agent (C)`,
2929
3319
  onClick: copySelectedReferences,
2930
3320
  children: [
2931
- /* @__PURE__ */ jsx7(ClipboardCopy4, { className: "size-4" }),
2932
- selectedBoardIds.size > 1 && /* @__PURE__ */ jsx7("span", { className: "absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand px-1 text-[10px] font-bold text-foreground", children: selectedBoardIds.size })
3321
+ /* @__PURE__ */ jsx8(ClipboardCopy4, { className: "size-4" }),
3322
+ selectedBoardIds.size > 1 && /* @__PURE__ */ jsx8("span", { className: "absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand px-1 text-[10px] font-bold text-foreground", children: selectedBoardIds.size })
2933
3323
  ]
2934
3324
  }
2935
3325
  ) }) }),
2936
- /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: selectedBoardIds.size === 0 ? "Select boards to copy their reference" : "Copy reference for an agent (C)" })
3326
+ /* @__PURE__ */ jsx8(TooltipContent, { side: "bottom", children: selectedBoardIds.size === 0 ? "Select boards to copy their reference" : "Copy reference for an agent (C)" })
2937
3327
  ] }),
2938
- hasThemes && themes.length > 0 && /* @__PURE__ */ jsx7(
3328
+ hasThemes && themes.length > 0 && /* @__PURE__ */ jsx8(
2939
3329
  Combobox,
2940
3330
  {
2941
3331
  shape: "pill",
@@ -2950,8 +3340,8 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2950
3340
  className: "w-44"
2951
3341
  }
2952
3342
  ),
2953
- isRendererEnabled && missingThumbnailCount > 0 && renderStatus !== null && renderStatus !== "DONE" ? /* @__PURE__ */ jsxs7(Tooltip, { children: [
2954
- /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
3343
+ isRendererEnabled && missingThumbnailCount > 0 && renderStatus !== null && renderStatus !== "DONE" ? /* @__PURE__ */ jsxs8(Tooltip, { children: [
3344
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
2955
3345
  "button",
2956
3346
  {
2957
3347
  type: "button",
@@ -2959,7 +3349,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2959
3349
  className: "flex h-8 shrink-0 items-center gap-1.5 rounded-full bg-tint px-3 text-xs font-semibold text-muted-foreground transition-colors enabled:hover:bg-tint-strong enabled:hover:text-foreground",
2960
3350
  onClick: () => fileRenderRequest(true),
2961
3351
  children: [
2962
- renderStatus === "FAILED" ? /* @__PURE__ */ jsx7(ImageDown, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsx7(LoaderCircle, { className: "size-4 animate-spin motion-reduce:animate-none", "aria-hidden": true }),
3352
+ renderStatus === "FAILED" ? /* @__PURE__ */ jsx8(ImageDown, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsx8(LoaderCircle, { className: "size-4 animate-spin motion-reduce:animate-none", "aria-hidden": true }),
2963
3353
  renderStatus === "FAILED" ? texts.thumbnailsFailed : renderStatus === "WAITING_FOR_RENDERER" ? texts.thumbnailsWaitingForRenderer(shownThemeLabel) : texts.thumbnailsRendering(shownThemeLabel),
2964
3354
  " ",
2965
3355
  "\xB7 ",
@@ -2969,13 +3359,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2969
3359
  ]
2970
3360
  }
2971
3361
  ) }),
2972
- /* @__PURE__ */ jsxs7(TooltipContent, { side: "bottom", className: "max-w-sm", children: [
3362
+ /* @__PURE__ */ jsxs8(TooltipContent, { side: "bottom", className: "max-w-sm", children: [
2973
3363
  texts.thumbnailsMissing(missingThumbnailCount),
2974
3364
  canvas?.renderRequestError ? ` ${texts.thumbnailsLastError(canvas.renderRequestError)}` : ""
2975
3365
  ] })
2976
3366
  ] }) : null,
2977
- hasThemes && themes.length > 0 && /* @__PURE__ */ jsxs7(Tooltip, { children: [
2978
- /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7("span", { children: /* @__PURE__ */ jsx7(
3367
+ hasThemes && themes.length > 0 && /* @__PURE__ */ jsxs8(Tooltip, { children: [
3368
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8("span", { children: /* @__PURE__ */ jsx8(
2979
3369
  "button",
2980
3370
  {
2981
3371
  type: "button",
@@ -2987,13 +3377,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2987
3377
  const nextMode = effectiveMode === "dark" ? "light" : "dark";
2988
3378
  setCanvasStateValue("mode", nextMode === defaultMode ? "" : nextMode);
2989
3379
  },
2990
- children: effectiveMode === "dark" ? /* @__PURE__ */ jsx7(Sun, { className: "size-4" }) : /* @__PURE__ */ jsx7(Moon, { className: "size-4" })
3380
+ children: effectiveMode === "dark" ? /* @__PURE__ */ jsx8(Sun, { className: "size-4" }) : /* @__PURE__ */ jsx8(Moon, { className: "size-4" })
2991
3381
  }
2992
3382
  ) }) }),
2993
- /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: supportsDark ? effectiveMode === "dark" ? "Light theme" : "Dark theme" : texts.themeWithoutDarkMode })
3383
+ /* @__PURE__ */ jsx8(TooltipContent, { side: "bottom", children: supportsDark ? effectiveMode === "dark" ? "Light theme" : "Dark theme" : texts.themeWithoutDarkMode })
2994
3384
  ] }),
2995
- /* @__PURE__ */ jsxs7(Tooltip, { children: [
2996
- /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
3385
+ /* @__PURE__ */ jsxs8(Tooltip, { children: [
3386
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
2997
3387
  "button",
2998
3388
  {
2999
3389
  type: "button",
@@ -3002,15 +3392,15 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3002
3392
  "aria-pressed": isCommentsPanelOpen,
3003
3393
  onClick: toggleCommentsPanel,
3004
3394
  children: [
3005
- isCommentsPanelOpen ? /* @__PURE__ */ jsx7(PanelRightClose, { className: "size-4" }) : /* @__PURE__ */ jsx7(PanelRightOpen, { className: "size-4" }),
3006
- openThreadTotal > 0 && /* @__PURE__ */ jsx7("span", { className: "absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground", children: openThreadTotal })
3395
+ isCommentsPanelOpen ? /* @__PURE__ */ jsx8(PanelRightClose, { className: "size-4" }) : /* @__PURE__ */ jsx8(PanelRightOpen, { className: "size-4" }),
3396
+ openThreadTotal > 0 && /* @__PURE__ */ jsx8("span", { className: "absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground", children: openThreadTotal })
3007
3397
  ]
3008
3398
  }
3009
3399
  ) }),
3010
- /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: isCommentsPanelOpen ? "Hide comments" : "Show comments" })
3400
+ /* @__PURE__ */ jsx8(TooltipContent, { side: "bottom", children: isCommentsPanelOpen ? "Hide comments" : "Show comments" })
3011
3401
  ] }),
3012
- /* @__PURE__ */ jsxs7(Tooltip, { children: [
3013
- /* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(
3402
+ /* @__PURE__ */ jsxs8(Tooltip, { children: [
3403
+ /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
3014
3404
  "button",
3015
3405
  {
3016
3406
  type: "button",
@@ -3018,13 +3408,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3018
3408
  "aria-label": isFullscreen ? "Exit fullscreen (F)" : "Fullscreen (F)",
3019
3409
  "aria-pressed": isFullscreen,
3020
3410
  onClick: () => setIsFullscreen((value) => !value),
3021
- children: isFullscreen ? /* @__PURE__ */ jsx7(Minimize, { className: "size-4" }) : /* @__PURE__ */ jsx7(Maximize, { className: "size-4" })
3411
+ children: isFullscreen ? /* @__PURE__ */ jsx8(Minimize, { className: "size-4" }) : /* @__PURE__ */ jsx8(Maximize, { className: "size-4" })
3022
3412
  }
3023
3413
  ) }),
3024
- /* @__PURE__ */ jsx7(TooltipContent, { side: "bottom", children: isFullscreen ? "Exit fullscreen (F)" : "Fullscreen (F)" })
3414
+ /* @__PURE__ */ jsx8(TooltipContent, { side: "bottom", children: isFullscreen ? "Exit fullscreen (F)" : "Fullscreen (F)" })
3025
3415
  ] })
3026
3416
  ] });
3027
- return /* @__PURE__ */ jsxs7(
3417
+ return /* @__PURE__ */ jsxs8(
3028
3418
  "div",
3029
3419
  {
3030
3420
  "data-page-frame": true,
@@ -3035,7 +3425,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3035
3425
  isFullscreen && "fixed inset-0 z-40 h-dvh bg-background"
3036
3426
  ),
3037
3427
  children: [
3038
- error && /* @__PURE__ */ jsx7("div", { className: "p-6", children: /* @__PURE__ */ jsx7(
3428
+ error && /* @__PURE__ */ jsx8("div", { className: "p-6", children: /* @__PURE__ */ jsx8(
3039
3429
  StatusCallout,
3040
3430
  {
3041
3431
  tone: "destructive",
@@ -3043,9 +3433,9 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3043
3433
  description: normalizeDddError3(error, "Request failed").message
3044
3434
  }
3045
3435
  ) }),
3046
- (isLoading || !isLookResolved && !canvas) && /* @__PURE__ */ jsx7(Skeleton, { className: "m-6 flex-1 rounded-2xl" }),
3047
- canvas && /* @__PURE__ */ jsxs7(CanvasViewContext.Provider, { value: canvasView, children: [
3048
- /* @__PURE__ */ jsx7("div", { ref: canvasAreaRef, className: "relative min-h-[480px] min-w-0 flex-1", children: canvasAspectRatio !== null && /* @__PURE__ */ jsx7(
3436
+ (isLoading || !isLookResolved && !canvas) && /* @__PURE__ */ jsx8(Skeleton, { className: "m-6 flex-1 rounded-2xl" }),
3437
+ canvas && /* @__PURE__ */ jsxs8(CanvasViewContext.Provider, { value: canvasView, children: [
3438
+ /* @__PURE__ */ jsx8("div", { ref: canvasAreaRef, className: "relative min-h-[480px] min-w-0 flex-1", children: canvasAspectRatio !== null && /* @__PURE__ */ jsx8(
3049
3439
  DesignCanvasFlow,
3050
3440
  {
3051
3441
  layout,
@@ -3067,7 +3457,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3067
3457
  selectedNodeId: selectedBoardId
3068
3458
  }
3069
3459
  ) }),
3070
- isCommentsPanelOpen && /* @__PURE__ */ jsx7("aside", { className: "surface-glass-strong m-3 shrink-0 overflow-y-auto rounded-3xl p-5 ring-1 ring-foreground/5 lg:my-3 lg:ml-0 lg:w-[380px]", children: selectedBoard ? /* @__PURE__ */ jsx7(
3460
+ isCommentsPanelOpen && /* @__PURE__ */ jsx8("aside", { className: "surface-glass-strong m-3 shrink-0 overflow-y-auto rounded-3xl p-5 ring-1 ring-foreground/5 lg:my-3 lg:ml-0 lg:w-[380px]", children: selectedBoard ? /* @__PURE__ */ jsx8(
3071
3461
  SelectedBoardPanel,
3072
3462
  {
3073
3463
  projectKey,
@@ -3083,13 +3473,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3083
3473
  onCopyThreadReference: copyThreadReference
3084
3474
  },
3085
3475
  selectedBoard.boardKey ?? ""
3086
- ) : /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
3087
- /* @__PURE__ */ jsxs7("div", { children: [
3088
- /* @__PURE__ */ jsx7("h2", { className: "text-title-card font-semibold", children: "Open comments" }),
3089
- /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Click a board to see its status and comments, double-click to open it large." })
3476
+ ) : /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
3477
+ /* @__PURE__ */ jsxs8("div", { children: [
3478
+ /* @__PURE__ */ jsx8("h2", { className: "text-title-card font-semibold", children: "Open comments" }),
3479
+ /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Click a board to see its status and comments, double-click to open it large." })
3090
3480
  ] }),
3091
- boardsWithOpenThreads.length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No open comments on this canvas." }),
3092
- /* @__PURE__ */ jsx7("ul", { className: "space-y-1", children: boardsWithOpenThreads.map((nodeId) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsxs7(
3481
+ boardsWithOpenThreads.length === 0 && /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "No open comments on this canvas." }),
3482
+ /* @__PURE__ */ jsx8("ul", { className: "space-y-1", children: boardsWithOpenThreads.map((nodeId) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs8(
3093
3483
  "button",
3094
3484
  {
3095
3485
  type: "button",
@@ -3099,9 +3489,9 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3099
3489
  requestFit([nodeId]);
3100
3490
  },
3101
3491
  children: [
3102
- /* @__PURE__ */ jsx7("span", { className: "truncate", children: boardsByNodeId.get(nodeId)?.title }),
3103
- /* @__PURE__ */ jsxs7("span", { className: "inline-flex shrink-0 items-center gap-1 text-xs font-semibold text-muted-foreground", children: [
3104
- /* @__PURE__ */ jsx7(MessageSquare2, { className: "size-3.5", "aria-hidden": true }),
3492
+ /* @__PURE__ */ jsx8("span", { className: "truncate", children: boardsByNodeId.get(nodeId)?.title }),
3493
+ /* @__PURE__ */ jsxs8("span", { className: "inline-flex shrink-0 items-center gap-1 text-xs font-semibold text-muted-foreground", children: [
3494
+ /* @__PURE__ */ jsx8(MessageSquare2, { className: "size-3.5", "aria-hidden": true }),
3105
3495
  " ",
3106
3496
  openThreadCounts.get(nodeId)
3107
3497
  ] })
@@ -3110,7 +3500,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3110
3500
  ) }, nodeId)) })
3111
3501
  ] }) })
3112
3502
  ] }),
3113
- /* @__PURE__ */ jsx7(
3503
+ /* @__PURE__ */ jsx8(
3114
3504
  BoardFocusView,
3115
3505
  {
3116
3506
  projectKey,
@@ -3129,7 +3519,10 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
3129
3519
  onPrevious: () => stepFocus(-1),
3130
3520
  onNext: () => stepFocus(1),
3131
3521
  onStatusChanged: (status) => focusedBoardId && setBoardStatus(focusedBoardId, status),
3132
- onCopyReference: ({ region, note }) => focusedBoardId && void copyReferences([buildReferenceFor(focusedBoardId, { region, note })]),
3522
+ devices,
3523
+ viewport: focusViewport,
3524
+ onViewportChange: setChosenFocusViewport,
3525
+ onCopyReference: ({ region, note }) => focusedBoardId && void copyReferences([buildReferenceFor(focusedBoardId, { region, note, viewport: focusViewport })]),
3133
3526
  onCopyThreadReference: copyThreadReference
3134
3527
  }
3135
3528
  )