@mgamadeus/ddd-design-studio 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/index.js +534 -161
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-ICDABLFY.js → chunk-YYKTDLFF.js} +80 -2
- package/dist/chunk-YYKTDLFF.js.map +1 -0
- package/dist/index.d.ts +78 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ICDABLFY.js.map +0 -1
package/dist/canvas/index.js
CHANGED
|
@@ -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
|
-
|
|
26
|
+
useDesignStudioTexts,
|
|
27
|
+
viewportLabel,
|
|
28
|
+
viewportOfComment,
|
|
29
|
+
viewportOfDevice,
|
|
30
|
+
viewportWithWidth
|
|
31
|
+
} from "../chunk-YYKTDLFF.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
|
|
53
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo2, useRef as useRef4, useState as useState8 } 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,8 +422,18 @@ var BoardComments = ({
|
|
|
383
422
|
};
|
|
384
423
|
|
|
385
424
|
// src/canvas/BoardFocusView.tsx
|
|
386
|
-
import {
|
|
387
|
-
|
|
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 useState6 } from "react";
|
|
388
437
|
|
|
389
438
|
// src/canvas/BoardNode.tsx
|
|
390
439
|
import { useStore } from "@xyflow/react";
|
|
@@ -568,6 +617,14 @@ var findSectionAt = (sections, x, y) => {
|
|
|
568
617
|
}
|
|
569
618
|
return nearest;
|
|
570
619
|
};
|
|
620
|
+
var findSectionPresentationStart = (sections, selectedBoardId, sectionInView) => {
|
|
621
|
+
if (selectedBoardId) {
|
|
622
|
+
const sectionOfSelectedBoard = sections.find((section) => section.boardIds.includes(selectedBoardId));
|
|
623
|
+
if (sectionOfSelectedBoard) return { sectionId: sectionOfSelectedBoard.id, boardId: selectedBoardId };
|
|
624
|
+
}
|
|
625
|
+
const firstBoardId = sectionInView?.boardIds[0];
|
|
626
|
+
return sectionInView && firstBoardId ? { sectionId: sectionInView.id, boardId: firstBoardId } : void 0;
|
|
627
|
+
};
|
|
571
628
|
|
|
572
629
|
// src/canvas/canvasLiveUpdate.ts
|
|
573
630
|
var VIEWPORT_MIN_ZOOM = 1e-3;
|
|
@@ -822,7 +879,7 @@ var useStableContentUrl = (url, isDisplayed = false) => {
|
|
|
822
879
|
};
|
|
823
880
|
|
|
824
881
|
// src/canvas/BoardNode.tsx
|
|
825
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
882
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
826
883
|
var isSameContent = (first, second) => Boolean(first && second) && withoutContentToken(first) === withoutContentToken(second);
|
|
827
884
|
var designContentUrl = (apiBaseUrl, path) => path ? `${apiBaseUrl}${path}` : void 0;
|
|
828
885
|
var downloadName = (board, extension) => `${boardCodeOf(board.boardKey ?? "board")}.${extension}`;
|
|
@@ -834,27 +891,31 @@ var BoardNodeComponent = ({ id, data }) => {
|
|
|
834
891
|
const texts = useDesignStudioTexts();
|
|
835
892
|
const { StatusBadge } = components;
|
|
836
893
|
const statusDefinition = board.status ? boardStatusDefinition(statuses, board.status) : void 0;
|
|
837
|
-
const width = board.width ?? 390;
|
|
838
|
-
const height = board.height ?? 844;
|
|
839
|
-
const visibleHeight = Math.min(height, MAX_BOARD_CANVAS_HEIGHT);
|
|
840
|
-
const isCut = height > visibleHeight;
|
|
841
|
-
const thumbnailVariant = useStore((state) => thumbnailVariantForZoom(state.transform[2], width));
|
|
842
894
|
const {
|
|
843
895
|
liveBoardIds,
|
|
844
896
|
selectedBoardIds,
|
|
845
897
|
matchingBoardIds,
|
|
846
898
|
openThreadCounts,
|
|
847
899
|
defaultStatus,
|
|
900
|
+
frameHeightMode,
|
|
901
|
+
devices,
|
|
848
902
|
onSelectBoard,
|
|
849
903
|
onCopyReference,
|
|
850
904
|
onOpenBoard
|
|
851
905
|
} = useCanvasView();
|
|
906
|
+
const isResponsive = isResponsiveBoard(board);
|
|
907
|
+
const canvasSize = boardCanvasSize(board, frameHeightMode);
|
|
908
|
+
const width = canvasSize.width;
|
|
909
|
+
const height = canvasSize.height;
|
|
910
|
+
const visibleHeight = isResponsive ? height : Math.min(height, MAX_BOARD_CANVAS_HEIGHT);
|
|
911
|
+
const isCut = height > visibleHeight;
|
|
912
|
+
const thumbnailVariant = useStore((state) => thumbnailVariantForZoom(state.transform[2], width));
|
|
852
913
|
const isLive = liveBoardIds.has(id);
|
|
853
914
|
const isSelected = selectedBoardIds.has(id);
|
|
854
915
|
const isDimmed = matchingBoardIds !== null && !matchingBoardIds.has(id);
|
|
855
916
|
const openThreads = openThreadCounts.get(id) ?? 0;
|
|
856
917
|
const isReady = useDeferredMount();
|
|
857
|
-
const isThumbnailMissing = !board.thumbnailUrl;
|
|
918
|
+
const isThumbnailMissing = !isResponsive && !board.thumbnailUrl;
|
|
858
919
|
const latestThumbnailUrl = designContentUrl(
|
|
859
920
|
apiBaseUrl,
|
|
860
921
|
thumbnailVariant === "small" ? board.thumbnailSmallUrl ?? board.thumbnailUrl : board.thumbnailUrl
|
|
@@ -969,12 +1030,24 @@ var BoardNodeComponent = ({ id, data }) => {
|
|
|
969
1030
|
"div",
|
|
970
1031
|
{
|
|
971
1032
|
className: cx(
|
|
972
|
-
"relative
|
|
973
|
-
isSelected && "ring-4 ring-brand"
|
|
1033
|
+
"relative",
|
|
1034
|
+
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")
|
|
974
1035
|
),
|
|
975
1036
|
style: { width, height: visibleHeight },
|
|
976
1037
|
children: [
|
|
977
|
-
|
|
1038
|
+
isResponsive && /* @__PURE__ */ jsx2(
|
|
1039
|
+
ResponsiveBoardFrames,
|
|
1040
|
+
{
|
|
1041
|
+
board,
|
|
1042
|
+
frameHeightMode,
|
|
1043
|
+
devices,
|
|
1044
|
+
thumbnailVariant,
|
|
1045
|
+
showsLiveHtml: showsLiveHtml && isReady,
|
|
1046
|
+
htmlUrl,
|
|
1047
|
+
title
|
|
1048
|
+
}
|
|
1049
|
+
),
|
|
1050
|
+
!isResponsive && thumbnailUrl && // biome-ignore lint/performance/noImgElement: canvas thumbnails are API images at canvas scale, next/image cannot optimise them
|
|
978
1051
|
/* @__PURE__ */ jsx2(
|
|
979
1052
|
"img",
|
|
980
1053
|
{
|
|
@@ -995,7 +1068,7 @@ var BoardNodeComponent = ({ id, data }) => {
|
|
|
995
1068
|
thumbnailRetry.imageKey
|
|
996
1069
|
),
|
|
997
1070
|
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 }),
|
|
998
|
-
showsLiveHtml && liveHtmlUrl && /* @__PURE__ */ jsx2(
|
|
1071
|
+
!isResponsive && showsLiveHtml && liveHtmlUrl && /* @__PURE__ */ jsx2(
|
|
999
1072
|
"iframe",
|
|
1000
1073
|
{
|
|
1001
1074
|
src: liveHtmlUrl,
|
|
@@ -1040,6 +1113,116 @@ var BoardNodeComponent = ({ id, data }) => {
|
|
|
1040
1113
|
] });
|
|
1041
1114
|
};
|
|
1042
1115
|
var BoardNode = memo(BoardNodeComponent);
|
|
1116
|
+
var ResponsiveBoardFrames = ({
|
|
1117
|
+
board,
|
|
1118
|
+
frameHeightMode,
|
|
1119
|
+
devices,
|
|
1120
|
+
thumbnailVariant,
|
|
1121
|
+
showsLiveHtml,
|
|
1122
|
+
htmlUrl,
|
|
1123
|
+
title
|
|
1124
|
+
}) => {
|
|
1125
|
+
let left = 0;
|
|
1126
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: framesOf(board).map((frame) => {
|
|
1127
|
+
const frameLeft = left;
|
|
1128
|
+
left += (frame.width ?? 0) + FRAME_GAP;
|
|
1129
|
+
return /* @__PURE__ */ jsx2(
|
|
1130
|
+
ResponsiveBoardFrame,
|
|
1131
|
+
{
|
|
1132
|
+
frame,
|
|
1133
|
+
left: frameLeft,
|
|
1134
|
+
frameHeightMode,
|
|
1135
|
+
deviceLabel: devices.find((device) => device.deviceKey === frame.deviceKey)?.label ?? frame.deviceKey ?? "",
|
|
1136
|
+
thumbnailVariant,
|
|
1137
|
+
showsLiveHtml,
|
|
1138
|
+
htmlUrl,
|
|
1139
|
+
title
|
|
1140
|
+
},
|
|
1141
|
+
frame.deviceKey ?? frameLeft
|
|
1142
|
+
);
|
|
1143
|
+
}) });
|
|
1144
|
+
};
|
|
1145
|
+
var ResponsiveBoardFrame = ({
|
|
1146
|
+
frame,
|
|
1147
|
+
left,
|
|
1148
|
+
frameHeightMode,
|
|
1149
|
+
deviceLabel,
|
|
1150
|
+
thumbnailVariant,
|
|
1151
|
+
showsLiveHtml,
|
|
1152
|
+
htmlUrl,
|
|
1153
|
+
title
|
|
1154
|
+
}) => {
|
|
1155
|
+
const { apiBaseUrl } = useDesignStudio();
|
|
1156
|
+
const texts = useDesignStudioTexts();
|
|
1157
|
+
const frameWidth = frame.width ?? 0;
|
|
1158
|
+
const frameHeight = frameCanvasHeight(frame, frameHeightMode);
|
|
1159
|
+
const latestThumbnailUrl = designContentUrl(
|
|
1160
|
+
apiBaseUrl,
|
|
1161
|
+
thumbnailVariant === "small" ? frame.thumbnailSmallUrl ?? frame.thumbnailUrl : frame.thumbnailUrl
|
|
1162
|
+
);
|
|
1163
|
+
const [loadedImageUrl, setLoadedImageUrl] = useState5(null);
|
|
1164
|
+
const thumbnailUrl = useStableContentUrl(latestThumbnailUrl, isSameContent(loadedImageUrl, latestThumbnailUrl));
|
|
1165
|
+
const thumbnailRetry = useImageRetry(thumbnailUrl);
|
|
1166
|
+
const liveHtmlUrl = useCheckedContentUrl(showsLiveHtml ? htmlUrl : void 0);
|
|
1167
|
+
const isCut = frameHeightMode === "page" && (frame.pageHeight ?? 0) > frameHeight;
|
|
1168
|
+
return /* @__PURE__ */ jsxs2("div", { className: "absolute top-0", style: { left, width: frameWidth }, children: [
|
|
1169
|
+
/* @__PURE__ */ jsx2(
|
|
1170
|
+
"div",
|
|
1171
|
+
{
|
|
1172
|
+
className: "flex items-end truncate pb-2 text-[17px] font-semibold text-muted-foreground tabular-nums",
|
|
1173
|
+
style: { height: FRAME_LABEL_HEIGHT },
|
|
1174
|
+
title: `${deviceLabel} \xB7 ${frameWidth} \xD7 ${frame.height ?? 0}`,
|
|
1175
|
+
children: thumbnailVariant === "small" ? "" : `${deviceLabel} \xB7 ${frameWidth}`
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
/* @__PURE__ */ jsxs2(
|
|
1179
|
+
"div",
|
|
1180
|
+
{
|
|
1181
|
+
className: "relative overflow-hidden rounded-[20px] bg-card shadow-surface-raised ring-1 ring-foreground/10",
|
|
1182
|
+
style: { width: frameWidth, height: frameHeight },
|
|
1183
|
+
children: [
|
|
1184
|
+
thumbnailUrl && // biome-ignore lint/performance/noImgElement: canvas thumbnails are API images at canvas scale
|
|
1185
|
+
/* @__PURE__ */ jsx2(
|
|
1186
|
+
"img",
|
|
1187
|
+
{
|
|
1188
|
+
src: thumbnailUrl,
|
|
1189
|
+
alt: "",
|
|
1190
|
+
loading: "lazy",
|
|
1191
|
+
decoding: "async",
|
|
1192
|
+
draggable: false,
|
|
1193
|
+
onError: thumbnailRetry.onError,
|
|
1194
|
+
onLoad: () => setLoadedImageUrl(thumbnailUrl),
|
|
1195
|
+
className: cx(
|
|
1196
|
+
"pointer-events-none absolute inset-x-0 top-0 w-full select-none",
|
|
1197
|
+
thumbnailRetry.isFailed && "invisible"
|
|
1198
|
+
)
|
|
1199
|
+
},
|
|
1200
|
+
thumbnailRetry.imageKey
|
|
1201
|
+
),
|
|
1202
|
+
!frame.thumbnailUrl && !(showsLiveHtml && liveHtmlUrl) && thumbnailVariant !== "small" && /* @__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 }),
|
|
1203
|
+
showsLiveHtml && liveHtmlUrl && /* @__PURE__ */ jsx2(
|
|
1204
|
+
"iframe",
|
|
1205
|
+
{
|
|
1206
|
+
src: liveHtmlUrl,
|
|
1207
|
+
title: `${title} \xB7 ${deviceLabel}`,
|
|
1208
|
+
sandbox: "",
|
|
1209
|
+
referrerPolicy: "no-referrer",
|
|
1210
|
+
loading: "lazy",
|
|
1211
|
+
width: frameWidth,
|
|
1212
|
+
height: frameHeight,
|
|
1213
|
+
className: "pointer-events-none absolute inset-0 border-0 bg-transparent"
|
|
1214
|
+
}
|
|
1215
|
+
),
|
|
1216
|
+
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: [
|
|
1217
|
+
"\u2193 ",
|
|
1218
|
+
Math.round(frame.pageHeight ?? 0),
|
|
1219
|
+
" px \u2014 full length in the focus view"
|
|
1220
|
+
] })
|
|
1221
|
+
]
|
|
1222
|
+
}
|
|
1223
|
+
)
|
|
1224
|
+
] });
|
|
1225
|
+
};
|
|
1043
1226
|
|
|
1044
1227
|
// src/canvas/BoardStatusChips.tsx
|
|
1045
1228
|
import { normalizeDddError as normalizeDddError2 } from "@mgamadeus/ddd-web/api";
|
|
@@ -1095,7 +1278,7 @@ var BoardStatusChips = ({
|
|
|
1095
1278
|
};
|
|
1096
1279
|
|
|
1097
1280
|
// src/canvas/BoardFocusView.tsx
|
|
1098
|
-
import { Fragment as
|
|
1281
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1099
1282
|
var DEVICE_SCREEN_HEIGHT = 844;
|
|
1100
1283
|
var BoardFocusView = ({
|
|
1101
1284
|
projectKey,
|
|
@@ -1107,6 +1290,9 @@ var BoardFocusView = ({
|
|
|
1107
1290
|
threads,
|
|
1108
1291
|
writesAllowed,
|
|
1109
1292
|
presentLabel,
|
|
1293
|
+
devices = [],
|
|
1294
|
+
viewport = null,
|
|
1295
|
+
onViewportChange,
|
|
1110
1296
|
onClose,
|
|
1111
1297
|
onPrevious,
|
|
1112
1298
|
onNext,
|
|
@@ -1159,11 +1345,33 @@ var BoardFocusView = ({
|
|
|
1159
1345
|
window.addEventListener("keydown", onKeyDown);
|
|
1160
1346
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1161
1347
|
});
|
|
1162
|
-
const
|
|
1163
|
-
const
|
|
1348
|
+
const isResponsive = isResponsiveBoard(board) && viewport !== null;
|
|
1349
|
+
const [showsDeviceFrame, setShowsDeviceFrame] = useState6(true);
|
|
1350
|
+
const stageRef = useRef2(null);
|
|
1351
|
+
const [stageWidth, setStageWidth] = useState6(0);
|
|
1352
|
+
useEffect4(() => {
|
|
1353
|
+
const stage = stageRef.current;
|
|
1354
|
+
if (!stage || typeof ResizeObserver === "undefined") return;
|
|
1355
|
+
const observer = new ResizeObserver(() => setStageWidth(stage.clientWidth));
|
|
1356
|
+
observer.observe(stage);
|
|
1357
|
+
setStageWidth(stage.clientWidth);
|
|
1358
|
+
return () => observer.disconnect();
|
|
1359
|
+
}, [board]);
|
|
1360
|
+
const width = isResponsive ? viewport.width : board?.width ?? 390;
|
|
1361
|
+
const height = isResponsive && board ? pageHeightAtWidth(board, viewport.width, viewport.height) : board?.height ?? 844;
|
|
1362
|
+
const screenHeight = isResponsive ? viewport.height : Math.min(height, DEVICE_SCREEN_HEIGHT);
|
|
1363
|
+
const bezelPadding = !isResponsive || showsDeviceFrame ? 24 : 0;
|
|
1364
|
+
const scale = isResponsive && stageWidth > 0 ? Math.min(1, (stageWidth - 48) / (width + bezelPadding)) : 1;
|
|
1365
|
+
const frameOfWidth = isResponsive ? framesOf(board).find((frame) => frame.width === width) : void 0;
|
|
1164
1366
|
const htmlUrl = useCheckedContentUrl(useStableContentUrl(designContentUrl(apiBaseUrl, board?.htmlUrl), true));
|
|
1165
|
-
const thumbnailUrl = useStableContentUrl(
|
|
1166
|
-
|
|
1367
|
+
const thumbnailUrl = useStableContentUrl(
|
|
1368
|
+
designContentUrl(apiBaseUrl, isResponsive ? frameOfWidth?.thumbnailUrl : board?.thumbnailUrl),
|
|
1369
|
+
true
|
|
1370
|
+
);
|
|
1371
|
+
const pinnedThreads = threads.filter(
|
|
1372
|
+
(thread) => thread.pinNumber !== null && (showResolved || !thread.root.isResolved) && isPinInViewport(thread.root, isResponsive ? viewport : null)
|
|
1373
|
+
);
|
|
1374
|
+
const hiddenPinCount = threads.filter((thread) => thread.pinNumber !== null && !thread.root.isResolved).length - pinnedThreads.filter((thread) => !thread.root.isResolved).length;
|
|
1167
1375
|
const copyReference = () => {
|
|
1168
1376
|
onCopyReference({ region, note: referenceNote });
|
|
1169
1377
|
if (region) {
|
|
@@ -1174,8 +1382,8 @@ var BoardFocusView = ({
|
|
|
1174
1382
|
const boardPointOf = (event) => {
|
|
1175
1383
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
1176
1384
|
return {
|
|
1177
|
-
x: Math.max(0, Math.min(width, event.clientX - rect.left)),
|
|
1178
|
-
y: Math.max(0, Math.min(height, event.clientY - rect.top))
|
|
1385
|
+
x: Math.max(0, Math.min(width, (event.clientX - rect.left) / scale)),
|
|
1386
|
+
y: Math.max(0, Math.min(height, (event.clientY - rect.top) / scale))
|
|
1179
1387
|
};
|
|
1180
1388
|
};
|
|
1181
1389
|
const startRegion = (event) => {
|
|
@@ -1210,7 +1418,11 @@ var BoardFocusView = ({
|
|
|
1210
1418
|
} : region;
|
|
1211
1419
|
const placePin = (event) => {
|
|
1212
1420
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
1213
|
-
setPendingPin({
|
|
1421
|
+
setPendingPin({
|
|
1422
|
+
x: Math.round((event.clientX - rect.left) / scale),
|
|
1423
|
+
y: Math.round((event.clientY - rect.top) / scale),
|
|
1424
|
+
viewport: isResponsive ? viewport : null
|
|
1425
|
+
});
|
|
1214
1426
|
setIsPlacingPin(false);
|
|
1215
1427
|
};
|
|
1216
1428
|
return /* @__PURE__ */ jsx4(Dialog, { open: board !== null, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsx4(
|
|
@@ -1218,7 +1430,7 @@ var BoardFocusView = ({
|
|
|
1218
1430
|
{
|
|
1219
1431
|
showCloseButton: false,
|
|
1220
1432
|
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",
|
|
1221
|
-
children: board && /* @__PURE__ */ jsxs4(
|
|
1433
|
+
children: board && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1222
1434
|
/* @__PURE__ */ jsxs4("header", { className: "flex flex-wrap items-center gap-3 border-b border-border px-5 py-3", children: [
|
|
1223
1435
|
/* @__PURE__ */ jsxs4("div", { className: "min-w-0 flex-1", children: [
|
|
1224
1436
|
/* @__PURE__ */ jsx4(DialogTitle, { className: "truncate text-lg font-semibold", children: board.title }),
|
|
@@ -1252,101 +1464,138 @@ var BoardFocusView = ({
|
|
|
1252
1464
|
] })
|
|
1253
1465
|
] }),
|
|
1254
1466
|
/* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [
|
|
1255
|
-
/* @__PURE__ */
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
"
|
|
1274
|
-
{
|
|
1275
|
-
src: htmlUrl,
|
|
1276
|
-
title: board.title ?? board.boardKey ?? "Board",
|
|
1277
|
-
sandbox: "",
|
|
1278
|
-
referrerPolicy: "no-referrer",
|
|
1279
|
-
width,
|
|
1280
|
-
height,
|
|
1281
|
-
className: "absolute inset-0 border-0 bg-transparent"
|
|
1282
|
-
},
|
|
1283
|
-
htmlUrl
|
|
1284
|
-
),
|
|
1285
|
-
isPlacingPin && /* @__PURE__ */ jsx4(
|
|
1286
|
-
"button",
|
|
1287
|
-
{
|
|
1288
|
-
type: "button",
|
|
1289
|
-
"aria-label": "Place the pin here",
|
|
1290
|
-
className: "absolute inset-0 z-10 cursor-crosshair bg-brand/10",
|
|
1291
|
-
onClick: placePin
|
|
1292
|
-
}
|
|
1293
|
-
),
|
|
1294
|
-
isMarkingRegion && /* @__PURE__ */ jsx4(
|
|
1295
|
-
"button",
|
|
1296
|
-
{
|
|
1297
|
-
type: "button",
|
|
1298
|
-
"aria-label": "Drag a rectangle to mark a region of the board",
|
|
1299
|
-
className: "absolute inset-0 z-10 cursor-crosshair touch-none bg-brand/5",
|
|
1300
|
-
onPointerDown: startRegion,
|
|
1301
|
-
onPointerMove: moveRegion,
|
|
1302
|
-
onPointerUp: endRegion
|
|
1303
|
-
}
|
|
1467
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1 flex-col bg-tint", children: [
|
|
1468
|
+
isResponsive && /* @__PURE__ */ jsx4(
|
|
1469
|
+
ViewportToolbar,
|
|
1470
|
+
{
|
|
1471
|
+
devices,
|
|
1472
|
+
viewport,
|
|
1473
|
+
hiddenPinCount,
|
|
1474
|
+
showsDeviceFrame,
|
|
1475
|
+
onShowsDeviceFrameChange: setShowsDeviceFrame,
|
|
1476
|
+
onViewportChange: (nextViewport) => onViewportChange?.(nextViewport)
|
|
1477
|
+
}
|
|
1478
|
+
),
|
|
1479
|
+
/* @__PURE__ */ jsx4("div", { ref: stageRef, className: "flex min-h-0 flex-1 items-start justify-center overflow-auto p-6", children: /* @__PURE__ */ jsx4("div", { style: { width: (width + bezelPadding) * scale, height: (screenHeight + bezelPadding) * scale }, children: /* @__PURE__ */ jsxs4(
|
|
1480
|
+
"div",
|
|
1481
|
+
{
|
|
1482
|
+
className: cx(
|
|
1483
|
+
"relative origin-top-left",
|
|
1484
|
+
(!isResponsive || showsDeviceFrame) && "bg-foreground p-3 shadow-surface-raised",
|
|
1485
|
+
!isResponsive || viewport.width < 600 ? "rounded-[56px]" : "rounded-[28px]"
|
|
1304
1486
|
),
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
"
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1487
|
+
style: { transform: scale !== 1 ? `scale(${scale})` : void 0, width: width + bezelPadding },
|
|
1488
|
+
children: [
|
|
1489
|
+
/* @__PURE__ */ jsx4(
|
|
1490
|
+
"div",
|
|
1491
|
+
{
|
|
1492
|
+
className: cx(
|
|
1493
|
+
"relative overflow-y-auto overflow-x-hidden bg-card",
|
|
1494
|
+
!isResponsive || showsDeviceFrame ? !isResponsive || viewport.width < 600 ? "rounded-[44px]" : "rounded-[18px]" : "rounded-md ring-1 ring-foreground/10"
|
|
1495
|
+
),
|
|
1496
|
+
style: { width, height: screenHeight },
|
|
1497
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "relative", style: { width, height }, children: [
|
|
1498
|
+
thumbnailUrl && // biome-ignore lint/performance/noImgElement: API thumbnail under the live board while it loads
|
|
1499
|
+
/* @__PURE__ */ jsx4(
|
|
1500
|
+
"img",
|
|
1501
|
+
{
|
|
1502
|
+
src: thumbnailUrl,
|
|
1503
|
+
alt: "",
|
|
1504
|
+
width,
|
|
1505
|
+
height,
|
|
1506
|
+
className: "pointer-events-none absolute inset-0 select-none"
|
|
1507
|
+
}
|
|
1508
|
+
),
|
|
1509
|
+
htmlUrl && /* @__PURE__ */ jsx4(
|
|
1510
|
+
"iframe",
|
|
1511
|
+
{
|
|
1512
|
+
src: htmlUrl,
|
|
1513
|
+
title: board.title ?? board.boardKey ?? "Board",
|
|
1514
|
+
sandbox: "",
|
|
1515
|
+
referrerPolicy: "no-referrer",
|
|
1516
|
+
width,
|
|
1517
|
+
height,
|
|
1518
|
+
className: "absolute inset-0 border-0 bg-transparent"
|
|
1519
|
+
},
|
|
1520
|
+
htmlUrl
|
|
1521
|
+
),
|
|
1522
|
+
isPlacingPin && /* @__PURE__ */ jsx4(
|
|
1523
|
+
"button",
|
|
1524
|
+
{
|
|
1525
|
+
type: "button",
|
|
1526
|
+
"aria-label": "Place the pin here",
|
|
1527
|
+
className: "absolute inset-0 z-10 cursor-crosshair bg-brand/10",
|
|
1528
|
+
onClick: placePin
|
|
1529
|
+
}
|
|
1530
|
+
),
|
|
1531
|
+
isMarkingRegion && /* @__PURE__ */ jsx4(
|
|
1532
|
+
"button",
|
|
1533
|
+
{
|
|
1534
|
+
type: "button",
|
|
1535
|
+
"aria-label": "Drag a rectangle to mark a region of the board",
|
|
1536
|
+
className: "absolute inset-0 z-10 cursor-crosshair touch-none bg-brand/5",
|
|
1537
|
+
onPointerDown: startRegion,
|
|
1538
|
+
onPointerMove: moveRegion,
|
|
1539
|
+
onPointerUp: endRegion
|
|
1540
|
+
}
|
|
1541
|
+
),
|
|
1542
|
+
shownRegion && /* @__PURE__ */ jsx4(
|
|
1543
|
+
"span",
|
|
1544
|
+
{
|
|
1545
|
+
"aria-hidden": true,
|
|
1546
|
+
className: cx(
|
|
1547
|
+
"pointer-events-none absolute z-20 rounded-md border-2 border-dashed border-brand bg-brand/10 transition-shadow motion-reduce:transition-none",
|
|
1548
|
+
isRegionFlashing && "shadow-[0_0_0_6px_var(--brand)]"
|
|
1549
|
+
),
|
|
1550
|
+
style: {
|
|
1551
|
+
left: shownRegion.x,
|
|
1552
|
+
top: shownRegion.y,
|
|
1553
|
+
width: shownRegion.width,
|
|
1554
|
+
height: shownRegion.height
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1558
|
+
pinnedThreads.map((thread) => /* @__PURE__ */ jsx4(
|
|
1559
|
+
"button",
|
|
1560
|
+
{
|
|
1561
|
+
type: "button",
|
|
1562
|
+
"aria-label": `Comment ${thread.pinNumber}`,
|
|
1563
|
+
onMouseEnter: () => setHighlightedCommentId(Number(thread.root.id)),
|
|
1564
|
+
onClick: () => setHighlightedCommentId(Number(thread.root.id)),
|
|
1565
|
+
className: cx(
|
|
1566
|
+
"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",
|
|
1567
|
+
thread.root.isResolved ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground",
|
|
1568
|
+
highlightedCommentId === Number(thread.root.id) && "ring-brand scale-110"
|
|
1569
|
+
),
|
|
1570
|
+
style: { left: thread.root.x ?? 0, top: thread.root.y ?? 0 },
|
|
1571
|
+
children: thread.pinNumber
|
|
1572
|
+
},
|
|
1573
|
+
String(thread.root.id)
|
|
1574
|
+
)),
|
|
1575
|
+
pendingPin && /* @__PURE__ */ jsx4(
|
|
1576
|
+
"span",
|
|
1577
|
+
{
|
|
1578
|
+
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",
|
|
1579
|
+
style: { left: pendingPin.x, top: pendingPin.y },
|
|
1580
|
+
"aria-hidden": true,
|
|
1581
|
+
children: /* @__PURE__ */ jsx4(MapPin2, { className: "size-4" })
|
|
1582
|
+
}
|
|
1583
|
+
)
|
|
1584
|
+
] })
|
|
1318
1585
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
),
|
|
1333
|
-
style: { left: thread.root.x ?? 0, top: thread.root.y ?? 0 },
|
|
1334
|
-
children: thread.pinNumber
|
|
1335
|
-
},
|
|
1336
|
-
String(thread.root.id)
|
|
1337
|
-
)),
|
|
1338
|
-
pendingPin && /* @__PURE__ */ jsx4(
|
|
1339
|
-
"span",
|
|
1340
|
-
{
|
|
1341
|
-
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",
|
|
1342
|
-
style: { left: pendingPin.x, top: pendingPin.y },
|
|
1343
|
-
"aria-hidden": true,
|
|
1344
|
-
children: /* @__PURE__ */ jsx4(MapPin2, { className: "size-4" })
|
|
1345
|
-
}
|
|
1346
|
-
)
|
|
1347
|
-
] })
|
|
1348
|
-
}
|
|
1349
|
-
) }) }),
|
|
1586
|
+
),
|
|
1587
|
+
isResponsive && /* @__PURE__ */ jsx4(
|
|
1588
|
+
WidthDragHandle,
|
|
1589
|
+
{
|
|
1590
|
+
scale,
|
|
1591
|
+
width,
|
|
1592
|
+
onWidthChange: (nextWidth) => onViewportChange?.(viewportWithWidth(viewport, nextWidth))
|
|
1593
|
+
}
|
|
1594
|
+
)
|
|
1595
|
+
]
|
|
1596
|
+
}
|
|
1597
|
+
) }) })
|
|
1598
|
+
] }),
|
|
1350
1599
|
/* @__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: [
|
|
1351
1600
|
/* @__PURE__ */ jsxs4("div", { className: "space-y-2 border-b border-border px-5 py-4", children: [
|
|
1352
1601
|
/* @__PURE__ */ jsx4("p", { className: "text-sm font-semibold", children: "Reference for an agent" }),
|
|
@@ -1430,7 +1679,8 @@ var BoardFocusView = ({
|
|
|
1430
1679
|
showResolved,
|
|
1431
1680
|
onShowResolvedChange: setShowResolved,
|
|
1432
1681
|
pinHint: "\u201CAdd pin\u201D marks a spot on the board",
|
|
1433
|
-
onCopyThreadReference
|
|
1682
|
+
onCopyThreadReference,
|
|
1683
|
+
onSelectViewport: isResponsive ? onViewportChange : void 0
|
|
1434
1684
|
}
|
|
1435
1685
|
) })
|
|
1436
1686
|
] })
|
|
@@ -1439,6 +1689,101 @@ var BoardFocusView = ({
|
|
|
1439
1689
|
}
|
|
1440
1690
|
) });
|
|
1441
1691
|
};
|
|
1692
|
+
var ViewportToolbar = ({
|
|
1693
|
+
devices,
|
|
1694
|
+
viewport,
|
|
1695
|
+
hiddenPinCount,
|
|
1696
|
+
showsDeviceFrame,
|
|
1697
|
+
onShowsDeviceFrameChange,
|
|
1698
|
+
onViewportChange
|
|
1699
|
+
}) => {
|
|
1700
|
+
const { components } = useDesignStudio();
|
|
1701
|
+
const { Button } = components;
|
|
1702
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-2 border-b border-border px-5 py-2 text-sm", children: [
|
|
1703
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2", children: [
|
|
1704
|
+
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Device" }),
|
|
1705
|
+
/* @__PURE__ */ jsxs4(
|
|
1706
|
+
"select",
|
|
1707
|
+
{
|
|
1708
|
+
className: "h-8 rounded-lg border border-border bg-card px-2 text-sm",
|
|
1709
|
+
value: viewport.deviceKey ?? "",
|
|
1710
|
+
onChange: (event) => {
|
|
1711
|
+
const device = devices.find((candidate) => candidate.deviceKey === event.target.value);
|
|
1712
|
+
if (device) onViewportChange(viewportOfDevice(device));
|
|
1713
|
+
},
|
|
1714
|
+
children: [
|
|
1715
|
+
viewport.deviceKey === null && /* @__PURE__ */ jsx4("option", { value: "", children: "Free width" }),
|
|
1716
|
+
devices.map((device) => /* @__PURE__ */ jsxs4("option", { value: device.deviceKey ?? "", children: [
|
|
1717
|
+
device.label,
|
|
1718
|
+
" \xB7 ",
|
|
1719
|
+
device.width,
|
|
1720
|
+
" \xD7 ",
|
|
1721
|
+
device.height
|
|
1722
|
+
] }, device.deviceKey ?? ""))
|
|
1723
|
+
]
|
|
1724
|
+
}
|
|
1725
|
+
)
|
|
1726
|
+
] }),
|
|
1727
|
+
/* @__PURE__ */ jsxs4(
|
|
1728
|
+
Button,
|
|
1729
|
+
{
|
|
1730
|
+
variant: "outline",
|
|
1731
|
+
size: "sm",
|
|
1732
|
+
"aria-label": "Rotate (landscape / portrait)",
|
|
1733
|
+
onClick: () => onViewportChange(rotateViewport(viewport, devices)),
|
|
1734
|
+
children: [
|
|
1735
|
+
/* @__PURE__ */ jsx4(RotateCw, {}),
|
|
1736
|
+
" Rotate"
|
|
1737
|
+
]
|
|
1738
|
+
}
|
|
1739
|
+
),
|
|
1740
|
+
/* @__PURE__ */ jsx4("span", { className: "text-muted-foreground tabular-nums", children: viewportLabel(viewport, devices) }),
|
|
1741
|
+
/* @__PURE__ */ jsxs4(
|
|
1742
|
+
Button,
|
|
1743
|
+
{
|
|
1744
|
+
variant: showsDeviceFrame ? "default" : "outline",
|
|
1745
|
+
size: "sm",
|
|
1746
|
+
"aria-pressed": showsDeviceFrame,
|
|
1747
|
+
onClick: () => onShowsDeviceFrameChange(!showsDeviceFrame),
|
|
1748
|
+
children: [
|
|
1749
|
+
/* @__PURE__ */ jsx4(Smartphone, {}),
|
|
1750
|
+
" Device frame"
|
|
1751
|
+
]
|
|
1752
|
+
}
|
|
1753
|
+
),
|
|
1754
|
+
hiddenPinCount > 0 && /* @__PURE__ */ jsxs4("span", { className: "ml-auto text-xs text-muted-foreground", children: [
|
|
1755
|
+
hiddenPinCount,
|
|
1756
|
+
" open pin(s) in other widths \u2014 pick their size in the comment list"
|
|
1757
|
+
] })
|
|
1758
|
+
] });
|
|
1759
|
+
};
|
|
1760
|
+
var WidthDragHandle = ({ scale, width, onWidthChange }) => {
|
|
1761
|
+
const dragStartRef = useRef2(null);
|
|
1762
|
+
return /* @__PURE__ */ jsx4(
|
|
1763
|
+
"button",
|
|
1764
|
+
{
|
|
1765
|
+
type: "button",
|
|
1766
|
+
"aria-label": `Viewport width ${width} px: drag to change`,
|
|
1767
|
+
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",
|
|
1768
|
+
onPointerDown: (event) => {
|
|
1769
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1770
|
+
dragStartRef.current = { clientX: event.clientX, width };
|
|
1771
|
+
},
|
|
1772
|
+
onPointerMove: (event) => {
|
|
1773
|
+
const dragStart = dragStartRef.current;
|
|
1774
|
+
if (!dragStart) return;
|
|
1775
|
+
onWidthChange(dragStart.width + (event.clientX - dragStart.clientX) / Math.max(0.05, scale));
|
|
1776
|
+
},
|
|
1777
|
+
onPointerUp: () => {
|
|
1778
|
+
dragStartRef.current = null;
|
|
1779
|
+
},
|
|
1780
|
+
onKeyDown: (event) => {
|
|
1781
|
+
if (event.key === "ArrowLeft") onWidthChange(width - 10);
|
|
1782
|
+
if (event.key === "ArrowRight") onWidthChange(width + 10);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
);
|
|
1786
|
+
};
|
|
1442
1787
|
|
|
1443
1788
|
// src/canvas/DesignCanvasFlow.tsx
|
|
1444
1789
|
import "@xyflow/react/dist/style.css";
|
|
@@ -1453,7 +1798,7 @@ import {
|
|
|
1453
1798
|
useStore as useStore3
|
|
1454
1799
|
} from "@xyflow/react";
|
|
1455
1800
|
import { ChevronDown, Hand, MousePointer2, Play } from "lucide-react";
|
|
1456
|
-
import { useCallback, useEffect as useEffect5, useMemo, useRef as
|
|
1801
|
+
import { useCallback, useEffect as useEffect5, useMemo, useRef as useRef3, useState as useState7 } from "react";
|
|
1457
1802
|
|
|
1458
1803
|
// src/canvas/SectionNode.tsx
|
|
1459
1804
|
import { useStore as useStore2 } from "@xyflow/react";
|
|
@@ -1744,11 +2089,11 @@ var FlowCanvas = ({
|
|
|
1744
2089
|
}) => {
|
|
1745
2090
|
const { apiBaseUrl, components, statusColors } = useDesignStudio();
|
|
1746
2091
|
const { Tooltip, TooltipContent, TooltipTrigger } = components;
|
|
1747
|
-
const containerRef =
|
|
2092
|
+
const containerRef = useRef3(null);
|
|
1748
2093
|
const reactFlow = useReactFlow();
|
|
1749
2094
|
useWheelZoom(containerRef);
|
|
1750
2095
|
const isOverview = useStore3((state) => state.transform[2] < OVERVIEW_ZOOM);
|
|
1751
|
-
const previousNodesRef =
|
|
2096
|
+
const previousNodesRef = useRef3([]);
|
|
1752
2097
|
const nodes = useMemo(() => {
|
|
1753
2098
|
const reused = reuseUnchangedNodes(
|
|
1754
2099
|
previousNodesRef.current,
|
|
@@ -1765,7 +2110,7 @@ var FlowCanvas = ({
|
|
|
1765
2110
|
() => [...layout.boards].map(([id, rect]) => ({ id, ...rect })),
|
|
1766
2111
|
[layout]
|
|
1767
2112
|
);
|
|
1768
|
-
const liveBoardsTimerRef =
|
|
2113
|
+
const liveBoardsTimerRef = useRef3(null);
|
|
1769
2114
|
const cancelLiveBoardsUpdate = useCallback(() => {
|
|
1770
2115
|
if (liveBoardsTimerRef.current) clearTimeout(liveBoardsTimerRef.current);
|
|
1771
2116
|
liveBoardsTimerRef.current = null;
|
|
@@ -1781,7 +2126,7 @@ var FlowCanvas = ({
|
|
|
1781
2126
|
},
|
|
1782
2127
|
[boardRects, onLiveBoardIdsChange, onVisibleBoardIdsChange, liveMinRatio]
|
|
1783
2128
|
);
|
|
1784
|
-
const hasInitialFitRef =
|
|
2129
|
+
const hasInitialFitRef = useRef3(false);
|
|
1785
2130
|
const fitRect = useCallback(
|
|
1786
2131
|
(rect, duration, fitWidthOnly = false) => {
|
|
1787
2132
|
const container = containerRef.current;
|
|
@@ -1823,15 +2168,15 @@ var FlowCanvas = ({
|
|
|
1823
2168
|
const fitAll = useCallback(() => {
|
|
1824
2169
|
fitRect(layout.bounds, 400);
|
|
1825
2170
|
}, [fitRect, layout]);
|
|
1826
|
-
const handledFitKeyRef =
|
|
2171
|
+
const handledFitKeyRef = useRef3(null);
|
|
1827
2172
|
useEffect5(() => {
|
|
1828
2173
|
if (!fitRequest || handledFitKeyRef.current === fitRequest.key) return;
|
|
1829
2174
|
handledFitKeyRef.current = fitRequest.key;
|
|
1830
2175
|
fitNodes(fitRequest.nodeIds);
|
|
1831
2176
|
}, [fitRequest, fitNodes]);
|
|
1832
|
-
const committedViewportRef =
|
|
1833
|
-
const isFlowReadyRef =
|
|
1834
|
-
const initialViewportRef =
|
|
2177
|
+
const committedViewportRef = useRef3(null);
|
|
2178
|
+
const isFlowReadyRef = useRef3(false);
|
|
2179
|
+
const initialViewportRef = useRef3(initialViewport);
|
|
1835
2180
|
const fitInitialView = useCallback(() => {
|
|
1836
2181
|
if (!isFlowReadyRef.current || hasInitialFitRef.current || layout.sections.length === 0) return;
|
|
1837
2182
|
const container = containerRef.current;
|
|
@@ -1849,7 +2194,7 @@ var FlowCanvas = ({
|
|
|
1849
2194
|
committedViewportRef.current = formatViewportParam(viewport);
|
|
1850
2195
|
}
|
|
1851
2196
|
}, [layout, initialFitNodeIds, fitNodes, fitRect, reactFlow, updateLiveBoards]);
|
|
1852
|
-
const viewportCommitTimerRef =
|
|
2197
|
+
const viewportCommitTimerRef = useRef3(null);
|
|
1853
2198
|
useEffect5(
|
|
1854
2199
|
() => () => {
|
|
1855
2200
|
if (viewportCommitTimerRef.current) clearTimeout(viewportCommitTimerRef.current);
|
|
@@ -1917,11 +2262,11 @@ var FlowCanvas = ({
|
|
|
1917
2262
|
if (section) fitNodes([sectionNodeId(section.id)]);
|
|
1918
2263
|
};
|
|
1919
2264
|
const presentCurrentSection = () => {
|
|
1920
|
-
const
|
|
1921
|
-
if (
|
|
2265
|
+
const presentationStart = findSectionPresentationStart(layout.sections, selectedNodeId, sectionInView());
|
|
2266
|
+
if (presentationStart) onPresentSection(presentationStart.sectionId, presentationStart.boardId);
|
|
1922
2267
|
};
|
|
1923
2268
|
const [marquee, setMarquee] = useState7(null);
|
|
1924
|
-
const isMarqueeJustEndedRef =
|
|
2269
|
+
const isMarqueeJustEndedRef = useRef3(false);
|
|
1925
2270
|
const startMarquee = (event) => {
|
|
1926
2271
|
const target = event.target;
|
|
1927
2272
|
if (tool !== "select" || event.button !== 0 || !target.classList.contains("react-flow__pane")) return;
|
|
@@ -2088,7 +2433,7 @@ var FlowCanvas = ({
|
|
|
2088
2433
|
var DesignCanvasFlow = (props) => /* @__PURE__ */ jsx6(ReactFlowProvider, { children: /* @__PURE__ */ jsx6(FlowCanvas, { ...props }) });
|
|
2089
2434
|
|
|
2090
2435
|
// src/canvas/DesignStudioCanvasScreen.tsx
|
|
2091
|
-
import { Fragment as
|
|
2436
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2092
2437
|
var CANVAS_STATE_KEYS = ["q", "section", "status", "theme", "mode", "vp"];
|
|
2093
2438
|
var UNCOUNTED_CANVAS_STATE_KEYS = ["q", "theme", "mode", "vp"];
|
|
2094
2439
|
var LIVE_UPDATE_POLL_MS = 15e3;
|
|
@@ -2114,8 +2459,8 @@ var NO_SIDEBAR = [true, () => void 0];
|
|
|
2114
2459
|
var useNoSidebar = () => NO_SIDEBAR;
|
|
2115
2460
|
var useCollapsedSidebarWhileMounted = (useSidebarCollapsed = useNoSidebar) => {
|
|
2116
2461
|
const [isCollapsed, toggleCollapsed] = useSidebarCollapsed();
|
|
2117
|
-
const collapsedByCanvasRef =
|
|
2118
|
-
const toggleRef =
|
|
2462
|
+
const collapsedByCanvasRef = useRef4(false);
|
|
2463
|
+
const toggleRef = useRef4(toggleCollapsed);
|
|
2119
2464
|
toggleRef.current = toggleCollapsed;
|
|
2120
2465
|
useEffect6(() => {
|
|
2121
2466
|
if (!isCollapsed) {
|
|
@@ -2240,6 +2585,8 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2240
2585
|
const [selectedBoardId, setSelectedBoardId] = useState8(null);
|
|
2241
2586
|
const [selectedBoardIds, setSelectedBoardIds] = useState8(/* @__PURE__ */ new Set());
|
|
2242
2587
|
const [focusedBoardId, setFocusedBoardId] = useState8(null);
|
|
2588
|
+
const [frameHeightMode, setFrameHeightMode] = useState8("viewport");
|
|
2589
|
+
const [chosenFocusViewport, setChosenFocusViewport] = useState8(null);
|
|
2243
2590
|
const [presentSectionId, setPresentSectionId] = useState8(null);
|
|
2244
2591
|
const [fitRequest, setFitRequest] = useState8(null);
|
|
2245
2592
|
const [tool, setTool] = useState8("hand");
|
|
@@ -2261,7 +2608,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2261
2608
|
const setSectionFilter = useCallback2((value) => setCanvasStateValue("section", value), [setCanvasStateValue]);
|
|
2262
2609
|
const setStatusFilter = useCallback2((value) => setCanvasStateValue("status", value), [setCanvasStateValue]);
|
|
2263
2610
|
const [isFullscreen, setIsFullscreen] = useState8(false);
|
|
2264
|
-
const canvasAreaRef =
|
|
2611
|
+
const canvasAreaRef = useRef4(null);
|
|
2265
2612
|
const [canvasAspectRatio, setCanvasAspectRatio] = useState8(null);
|
|
2266
2613
|
useCollapsedSidebarWhileMounted(shell?.useSidebarCollapsed);
|
|
2267
2614
|
const debouncedSearch = canvasState.debounced.q;
|
|
@@ -2272,7 +2619,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2272
2619
|
const [hasInitialFilterWithViewport] = useState8(
|
|
2273
2620
|
() => initialViewport !== null && Boolean(canvasState.values.q.trim() || canvasState.values.section || canvasState.values.status)
|
|
2274
2621
|
);
|
|
2275
|
-
const currentViewportRef =
|
|
2622
|
+
const currentViewportRef = useRef4(initialViewport ? formatViewportParam(initialViewport) : null);
|
|
2276
2623
|
const commitViewport = useCallback2(
|
|
2277
2624
|
(viewport) => {
|
|
2278
2625
|
const value = formatViewportParam(viewport);
|
|
@@ -2394,13 +2741,14 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2394
2741
|
shownBoardList.map((board) => ({
|
|
2395
2742
|
id: boardNodeId(board.boardKey ?? ""),
|
|
2396
2743
|
sectionId: board.sectionKey && sectionKeys.has(board.sectionKey) ? board.sectionKey : null,
|
|
2397
|
-
|
|
2398
|
-
height: board.height ?? 844,
|
|
2744
|
+
...boardCanvasSize(board, frameHeightMode),
|
|
2399
2745
|
displayOrder: board.displayOrder ?? 0
|
|
2400
2746
|
})),
|
|
2401
2747
|
canvasAspectRatio ?? void 0
|
|
2402
2748
|
);
|
|
2403
|
-
}, [sections, shownBoardList, canvasAspectRatio]);
|
|
2749
|
+
}, [sections, shownBoardList, canvasAspectRatio, frameHeightMode]);
|
|
2750
|
+
const devices = useMemo2(() => canvas?.devices?.elements ?? [], [canvas?.devices]);
|
|
2751
|
+
const hasResponsiveBoards = useMemo2(() => shownBoardList.some((board) => isResponsiveBoard(board)), [shownBoardList]);
|
|
2404
2752
|
const hasCanvas = Boolean(canvas);
|
|
2405
2753
|
useEffect6(() => {
|
|
2406
2754
|
const canvasArea = canvasAreaRef.current;
|
|
@@ -2423,13 +2771,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2423
2771
|
const isRenderOpen = renderStatus !== null && OPEN_RENDER_STATUSES.has(renderStatus);
|
|
2424
2772
|
useEffect6(() => setIsRenderPolling(isRenderOpen), [isRenderOpen]);
|
|
2425
2773
|
const [requestThumbnailRendering] = api.useRequestThumbnailRenderingMutation();
|
|
2426
|
-
const visibleBoardIdsRef =
|
|
2774
|
+
const visibleBoardIdsRef = useRef4([]);
|
|
2427
2775
|
const rememberVisibleBoardIds = useCallback2((visibleBoardIds) => {
|
|
2428
2776
|
visibleBoardIdsRef.current = visibleBoardIds;
|
|
2429
2777
|
}, []);
|
|
2430
|
-
const boardsByNodeIdRef =
|
|
2778
|
+
const boardsByNodeIdRef = useRef4(boardsByNodeId);
|
|
2431
2779
|
boardsByNodeIdRef.current = boardsByNodeId;
|
|
2432
|
-
const requestedThumbnailsRef =
|
|
2780
|
+
const requestedThumbnailsRef = useRef4(/* @__PURE__ */ new Set());
|
|
2433
2781
|
const fileRenderRequest = useCallback2(
|
|
2434
2782
|
(isRetry) => {
|
|
2435
2783
|
if (!writesAllowed || !currentCanvas) return;
|
|
@@ -2511,14 +2859,14 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2511
2859
|
}
|
|
2512
2860
|
return layoutOrder.filter((nodeId) => matchingBoardIds === null || matchingBoardIds.has(nodeId));
|
|
2513
2861
|
}, [layout, layoutOrder, matchingBoardIds, presentSectionId]);
|
|
2514
|
-
const fitKeyRef =
|
|
2862
|
+
const fitKeyRef = useRef4(0);
|
|
2515
2863
|
const requestFit = useCallback2((nodeIds) => {
|
|
2516
2864
|
fitKeyRef.current += 1;
|
|
2517
2865
|
setFitRequest({ nodeIds, key: fitKeyRef.current });
|
|
2518
2866
|
}, []);
|
|
2519
2867
|
const filterKey = matchingBoardIds === null ? null : `${debouncedSearch.trim()}|${sectionFilter}|${statusFilter}`;
|
|
2520
|
-
const fittedFilterKeyRef =
|
|
2521
|
-
const skipInitialFilterFitRef =
|
|
2868
|
+
const fittedFilterKeyRef = useRef4(null);
|
|
2869
|
+
const skipInitialFilterFitRef = useRef4(hasInitialFilterWithViewport);
|
|
2522
2870
|
useEffect6(() => {
|
|
2523
2871
|
if (filterKey === null || matchingBoardIds === null) {
|
|
2524
2872
|
fittedFilterKeyRef.current = null;
|
|
@@ -2553,11 +2901,13 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2553
2901
|
const closeFocus = useCallback2(() => {
|
|
2554
2902
|
setFocusedBoardId(null);
|
|
2555
2903
|
setPresentSectionId(null);
|
|
2904
|
+
setChosenFocusViewport(null);
|
|
2556
2905
|
writeSearchParams({ [BOARD_PARAM]: null });
|
|
2557
2906
|
}, [writeSearchParams]);
|
|
2558
2907
|
const presentSection = useCallback2(
|
|
2559
|
-
(sectionId) => {
|
|
2560
|
-
const
|
|
2908
|
+
(sectionId, startBoardId) => {
|
|
2909
|
+
const sectionBoardIds = layout.sections.find((section) => section.id === sectionId)?.boardIds ?? [];
|
|
2910
|
+
const firstBoardId = startBoardId && sectionBoardIds.includes(startBoardId) ? startBoardId : sectionBoardIds[0];
|
|
2561
2911
|
if (!firstBoardId) return;
|
|
2562
2912
|
setPresentSectionId(sectionId);
|
|
2563
2913
|
openBoard(firstBoardId);
|
|
@@ -2565,7 +2915,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2565
2915
|
[layout, openBoard]
|
|
2566
2916
|
);
|
|
2567
2917
|
const boardParam = searchParams.get(BOARD_PARAM);
|
|
2568
|
-
const isDeepLinkHandledRef =
|
|
2918
|
+
const isDeepLinkHandledRef = useRef4(false);
|
|
2569
2919
|
useEffect6(() => {
|
|
2570
2920
|
if (isDeepLinkHandledRef.current || !boardParam || boards.length === 0) return;
|
|
2571
2921
|
isDeepLinkHandledRef.current = true;
|
|
@@ -2576,7 +2926,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2576
2926
|
if (!initialViewport) requestFit([nodeId]);
|
|
2577
2927
|
}, [boardParam, boards.length, boardsByNodeId, requestFit, initialViewport]);
|
|
2578
2928
|
const codeParam = searchParams.get(CODE_PARAM);
|
|
2579
|
-
const handledCodeRef =
|
|
2929
|
+
const handledCodeRef = useRef4(null);
|
|
2580
2930
|
useEffect6(() => {
|
|
2581
2931
|
if (!codeParam) {
|
|
2582
2932
|
if (handledCodeRef.current !== null) handledCodeRef.current = "";
|
|
@@ -2602,7 +2952,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2602
2952
|
setIsCommentsPanelOpen(true);
|
|
2603
2953
|
}
|
|
2604
2954
|
}, [codeParam, codeAtLoad, boards, isCommentsPanelOpen, writeSearchParams, notify, texts, requestFit]);
|
|
2605
|
-
const pendingCodeFitRef =
|
|
2955
|
+
const pendingCodeFitRef = useRef4(null);
|
|
2606
2956
|
useEffect6(() => {
|
|
2607
2957
|
const nodeId = pendingCodeFitRef.current;
|
|
2608
2958
|
if (!nodeId || layout.sections.length === 0) return;
|
|
@@ -2689,6 +3039,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2689
3039
|
const copyThreadReference = useCallback2(
|
|
2690
3040
|
(thread) => void copyReferences([
|
|
2691
3041
|
buildReferenceFor(boardNodeId(thread.root.boardKey ?? ""), {
|
|
3042
|
+
viewport: viewportOfComment(thread.root),
|
|
2692
3043
|
comment: {
|
|
2693
3044
|
id: thread.root.id ?? "",
|
|
2694
3045
|
x: thread.root.x ?? null,
|
|
@@ -2711,7 +3062,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2711
3062
|
},
|
|
2712
3063
|
[shownLook, notify, texts]
|
|
2713
3064
|
);
|
|
2714
|
-
const seenRevisionRef =
|
|
3065
|
+
const seenRevisionRef = useRef4(null);
|
|
2715
3066
|
const revision = currentRevisionData?.revision;
|
|
2716
3067
|
const revisionLook = themeArgument ?? "";
|
|
2717
3068
|
useEffect6(() => {
|
|
@@ -2733,7 +3084,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2733
3084
|
},
|
|
2734
3085
|
[requestFit]
|
|
2735
3086
|
);
|
|
2736
|
-
const layoutOrderRef =
|
|
3087
|
+
const layoutOrderRef = useRef4(layoutOrder);
|
|
2737
3088
|
layoutOrderRef.current = layoutOrder;
|
|
2738
3089
|
useEffect6(() => {
|
|
2739
3090
|
const changedBoardKeys = shownBoards.changedBoardKeys;
|
|
@@ -2745,7 +3096,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2745
3096
|
action: { label: texts.showUpdatedBoard, onClick: () => showBoard(firstNodeId) }
|
|
2746
3097
|
});
|
|
2747
3098
|
}, [shownBoards.serial]);
|
|
2748
|
-
const shownBoardsRef =
|
|
3099
|
+
const shownBoardsRef = useRef4(shownBoards);
|
|
2749
3100
|
shownBoardsRef.current = shownBoards;
|
|
2750
3101
|
const reloadCanvas = useCallback2(async () => {
|
|
2751
3102
|
if (shownBoardsRef.current.source === void 0) return;
|
|
@@ -2758,7 +3109,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2758
3109
|
notify.info(texts.canvasUpToDate, { id: LIVE_UPDATE_TOAST_ID });
|
|
2759
3110
|
}
|
|
2760
3111
|
}, [refetchCanvas, refetchComments, refetchRevision, notify, texts]);
|
|
2761
|
-
const reloadCanvasRef =
|
|
3112
|
+
const reloadCanvasRef = useRef4(reloadCanvas);
|
|
2762
3113
|
reloadCanvasRef.current = reloadCanvas;
|
|
2763
3114
|
const canvasView = useMemo2(
|
|
2764
3115
|
() => ({
|
|
@@ -2768,6 +3119,8 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2768
3119
|
matchingBoardIds,
|
|
2769
3120
|
openThreadCounts,
|
|
2770
3121
|
defaultStatus,
|
|
3122
|
+
frameHeightMode,
|
|
3123
|
+
devices,
|
|
2771
3124
|
isHandTool: tool === "hand",
|
|
2772
3125
|
onSelectBoard: selectBoard,
|
|
2773
3126
|
onCopyReference: (nodeId) => void copyReferences([buildReferenceFor(nodeId)]),
|
|
@@ -2781,6 +3134,8 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2781
3134
|
matchingBoardIds,
|
|
2782
3135
|
openThreadCounts,
|
|
2783
3136
|
defaultStatus,
|
|
3137
|
+
frameHeightMode,
|
|
3138
|
+
devices,
|
|
2784
3139
|
tool,
|
|
2785
3140
|
selectBoard,
|
|
2786
3141
|
copyReferences,
|
|
@@ -2791,6 +3146,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2791
3146
|
);
|
|
2792
3147
|
const selectedBoard = selectedBoardId ? boardsByNodeId.get(selectedBoardId) ?? null : null;
|
|
2793
3148
|
const focusedBoard = focusedBoardId ? boardsByNodeId.get(focusedBoardId) ?? null : null;
|
|
3149
|
+
const focusViewport = initialViewportForBoard(focusedBoard, chosenFocusViewport);
|
|
2794
3150
|
const threadsOf = (nodeId) => nodeId ? buildCommentThreads(commentsByBoardNodeId.get(nodeId) ?? []) : [];
|
|
2795
3151
|
const boardsWithOpenThreads = layoutOrder.filter((nodeId) => openThreadCounts.has(nodeId));
|
|
2796
3152
|
const codeAtLoadBoard = useMemo2(
|
|
@@ -2803,7 +3159,7 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2803
3159
|
}, [layout, codeAtLoadBoard]);
|
|
2804
3160
|
const sectionOptions = layout.sections.map((section) => ({ value: section.id, label: section.title }));
|
|
2805
3161
|
const presentedSectionTitle = presentSectionId ? layout.sections.find((section) => section.id === presentSectionId)?.title ?? null : null;
|
|
2806
|
-
const copySelectedRef =
|
|
3162
|
+
const copySelectedRef = useRef4(copySelectedReferences);
|
|
2807
3163
|
copySelectedRef.current = copySelectedReferences;
|
|
2808
3164
|
useEffect6(() => {
|
|
2809
3165
|
const onKeyDown = (event) => {
|
|
@@ -2893,7 +3249,21 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
2893
3249
|
] })
|
|
2894
3250
|
] })
|
|
2895
3251
|
] });
|
|
2896
|
-
const toolbarEnd = /* @__PURE__ */ jsxs7(
|
|
3252
|
+
const toolbarEnd = /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
3253
|
+
hasResponsiveBoards && /* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
3254
|
+
/* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(
|
|
3255
|
+
"button",
|
|
3256
|
+
{
|
|
3257
|
+
type: "button",
|
|
3258
|
+
className: TOOL_BUTTON_CLASS2,
|
|
3259
|
+
"aria-pressed": frameHeightMode === "page",
|
|
3260
|
+
"aria-label": frameHeightMode === "page" ? "Device frames: whole page" : "Device frames: one screen",
|
|
3261
|
+
onClick: () => setFrameHeightMode((mode) => mode === "page" ? "viewport" : "page"),
|
|
3262
|
+
children: frameHeightMode === "page" ? /* @__PURE__ */ jsx7(FoldVertical, { className: "size-4" }) : /* @__PURE__ */ jsx7(UnfoldVertical, { className: "size-4" })
|
|
3263
|
+
}
|
|
3264
|
+
) }),
|
|
3265
|
+
/* @__PURE__ */ jsx7(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" })
|
|
3266
|
+
] }),
|
|
2897
3267
|
/* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
2898
3268
|
/* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx7(
|
|
2899
3269
|
"button",
|
|
@@ -3120,7 +3490,10 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
|
|
|
3120
3490
|
onPrevious: () => stepFocus(-1),
|
|
3121
3491
|
onNext: () => stepFocus(1),
|
|
3122
3492
|
onStatusChanged: (status) => focusedBoardId && setBoardStatus(focusedBoardId, status),
|
|
3123
|
-
|
|
3493
|
+
devices,
|
|
3494
|
+
viewport: focusViewport,
|
|
3495
|
+
onViewportChange: setChosenFocusViewport,
|
|
3496
|
+
onCopyReference: ({ region, note }) => focusedBoardId && void copyReferences([buildReferenceFor(focusedBoardId, { region, note, viewport: focusViewport })]),
|
|
3124
3497
|
onCopyThreadReference: copyThreadReference
|
|
3125
3498
|
}
|
|
3126
3499
|
)
|