@mgamadeus/ddd-design-studio 0.9.3 → 0.11.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/README.md +16 -2
- package/dist/canvas/index.js +26 -8
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-WFH4CMA6.js → chunk-PCXDVGGG.js} +92 -21
- package/dist/chunk-PCXDVGGG.js.map +1 -0
- package/dist/index.d.ts +37 -5
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-WFH4CMA6.js.map +0 -1
|
@@ -183,6 +183,7 @@ var splitThemeReference = (themeReference) => {
|
|
|
183
183
|
return { themeId: reference, mode: "light" };
|
|
184
184
|
};
|
|
185
185
|
var buildThemeReference = (themeId, mode) => mode === "dark" ? `${themeId}:dark` : themeId;
|
|
186
|
+
var hasCanvasThemes = (overviewHasThemes, canvasHasThemes) => Boolean(overviewHasThemes) || Boolean(canvasHasThemes);
|
|
186
187
|
|
|
187
188
|
// src/provider/texts.ts
|
|
188
189
|
var DEFAULT_DESIGN_STUDIO_TEXTS = {
|
|
@@ -220,7 +221,12 @@ var DEFAULT_DESIGN_STUDIO_TEXTS = {
|
|
|
220
221
|
exportSvgSizes: (svg, gzip, raster) => `SVG ${svg} (gzip ${gzip}) \xB7 raster ${raster}`,
|
|
221
222
|
exportSvgDiffering: (percent) => `Differs from the raster picture in ${percent} of the pixels.`,
|
|
222
223
|
exportSvgLostEffects: "Raster | SVG | differing pixels in red. Glass (backdrop-filter), blend modes and some filters are lost in SVG.",
|
|
223
|
-
exportSvgDownload: "Download SVG"
|
|
224
|
+
exportSvgDownload: "Download SVG",
|
|
225
|
+
threadDependenciesChangedSince: "Assets or theme changed since",
|
|
226
|
+
threadDependenciesChangedSinceTitle: "An image or script the board loads, or the style of the theme it is shown in, changed after this thread was written",
|
|
227
|
+
showCommentedVersion: "Show the commented version",
|
|
228
|
+
statusDependenciesChangedSince: "assets changed since",
|
|
229
|
+
statusDependenciesChangedSinceTitle: "An image or script the board loads changed after this status was set"
|
|
224
230
|
};
|
|
225
231
|
var resolveDesignStudioTexts = (texts) => {
|
|
226
232
|
if (!texts) return DEFAULT_DESIGN_STUDIO_TEXTS;
|
|
@@ -257,8 +263,34 @@ var cx = (...inputs) => twMerge(clsx(inputs));
|
|
|
257
263
|
|
|
258
264
|
// src/canvas/BoardComments.tsx
|
|
259
265
|
import { normalizeDddError } from "@mgamadeus/ddd-web/api";
|
|
260
|
-
import { Bot, CheckCircle2, ClipboardCopy, Flag, History, Hourglass, MapPin, RotateCcw, Trash2 } from "lucide-react";
|
|
266
|
+
import { Bot, CheckCircle2, ClipboardCopy, ExternalLink, Flag, History, Hourglass, Layers, MapPin, RotateCcw, Trash2 } from "lucide-react";
|
|
261
267
|
import { useState } from "react";
|
|
268
|
+
|
|
269
|
+
// src/canvas/threadState.ts
|
|
270
|
+
var buildCommentedVersionUrl = (currentHtmlUrl, comment) => {
|
|
271
|
+
if (!currentHtmlUrl || !comment.contentHash) return null;
|
|
272
|
+
const queryStart = currentHtmlUrl.indexOf("?");
|
|
273
|
+
const path = queryStart === -1 ? currentHtmlUrl : currentHtmlUrl.slice(0, queryStart);
|
|
274
|
+
const params = new URLSearchParams(queryStart === -1 ? "" : currentHtmlUrl.slice(queryStart + 1));
|
|
275
|
+
params.set("contentHash", comment.contentHash);
|
|
276
|
+
if (comment.dependenciesHash) params.set("assetsHash", comment.dependenciesHash);
|
|
277
|
+
else params.delete("assetsHash");
|
|
278
|
+
if (comment.themeReference && comment.themeHash) {
|
|
279
|
+
params.set("theme", comment.themeReference);
|
|
280
|
+
params.set("themeHash", comment.themeHash);
|
|
281
|
+
}
|
|
282
|
+
return `${path}?${params.toString()}`;
|
|
283
|
+
};
|
|
284
|
+
var compareThreadState = (comment, board, shownThemeHash) => {
|
|
285
|
+
const hasBoardChangedSince = Boolean(comment.contentHash && board.contentHash) && comment.contentHash !== board.contentHash;
|
|
286
|
+
const hasDependenciesChangedSince = Boolean(comment.dependenciesHash) && comment.dependenciesHash !== (board.dependenciesHash ?? null);
|
|
287
|
+
const hasThemeChangedSince = Boolean(comment.themeHash) && shownThemeHash !== void 0 && comment.themeHash !== (shownThemeHash ?? null);
|
|
288
|
+
const hasDependenciesOrThemeChangedSince = hasDependenciesChangedSince || hasThemeChangedSince;
|
|
289
|
+
const commentedVersionUrl = (hasBoardChangedSince || hasDependenciesOrThemeChangedSince) && comment.snapshotObjectKey && board.htmlUrl ? buildCommentedVersionUrl(board.htmlUrl, comment) : null;
|
|
290
|
+
return { hasBoardChangedSince, hasDependenciesOrThemeChangedSince, commentedVersionUrl };
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// src/canvas/BoardComments.tsx
|
|
262
294
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
263
295
|
var buildCommentThreads = (comments) => {
|
|
264
296
|
const repliesByRootId = /* @__PURE__ */ new Map();
|
|
@@ -313,13 +345,16 @@ var ThreadCard = ({
|
|
|
313
345
|
authAccountId,
|
|
314
346
|
writesAllowed,
|
|
315
347
|
hasBoardChangedSince,
|
|
348
|
+
hasDependenciesOrThemeChangedSince,
|
|
349
|
+
commentedVersionUrl,
|
|
316
350
|
isExpiring,
|
|
317
351
|
onSelectViewport
|
|
318
352
|
}) => {
|
|
319
353
|
const { root, replies, pinNumber } = thread;
|
|
320
354
|
const rootViewport = viewportOfComment(root);
|
|
321
355
|
const [replyText, setReplyText] = useState("");
|
|
322
|
-
const { api, components, notify } = useDesignStudio();
|
|
356
|
+
const { api, apiBaseUrl, components, notify } = useDesignStudio();
|
|
357
|
+
const texts = useDesignStudioTexts();
|
|
323
358
|
const { Badge, Button, Textarea } = components;
|
|
324
359
|
const [createReply, { isLoading: isReplying }] = api.useReplyToCommentMutation();
|
|
325
360
|
const [resolveThread, { isLoading: isResolving }] = api.useResolveCommentMutation();
|
|
@@ -395,6 +430,19 @@ var ThreadCard = ({
|
|
|
395
430
|
]
|
|
396
431
|
}
|
|
397
432
|
),
|
|
433
|
+
hasDependenciesOrThemeChangedSince && /* @__PURE__ */ jsxs(
|
|
434
|
+
Badge,
|
|
435
|
+
{
|
|
436
|
+
variant: "outline",
|
|
437
|
+
className: "border-transparent bg-warning/15 text-warning",
|
|
438
|
+
title: texts.threadDependenciesChangedSinceTitle,
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx2(Layers, { "aria-hidden": true }),
|
|
441
|
+
" ",
|
|
442
|
+
texts.threadDependenciesChangedSince
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
),
|
|
398
446
|
isExpiring && /* @__PURE__ */ jsxs(
|
|
399
447
|
Badge,
|
|
400
448
|
{
|
|
@@ -408,6 +456,20 @@ var ThreadCard = ({
|
|
|
408
456
|
}
|
|
409
457
|
)
|
|
410
458
|
] }),
|
|
459
|
+
commentedVersionUrl && /* @__PURE__ */ jsxs(
|
|
460
|
+
"a",
|
|
461
|
+
{
|
|
462
|
+
href: `${apiBaseUrl}${commentedVersionUrl}`,
|
|
463
|
+
target: "_blank",
|
|
464
|
+
rel: "noopener noreferrer",
|
|
465
|
+
className: "inline-flex items-center gap-1 text-xs font-medium text-brand-emphasis hover:underline",
|
|
466
|
+
children: [
|
|
467
|
+
/* @__PURE__ */ jsx2(ExternalLink, { className: "size-3.5", "aria-hidden": true }),
|
|
468
|
+
" ",
|
|
469
|
+
texts.showCommentedVersion
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
),
|
|
411
473
|
/* @__PURE__ */ jsx2(CommentLine, { comment: root, isOwn: authAccountId !== null && root.authorAccountId === authAccountId, writesAllowed }),
|
|
412
474
|
replies.map((reply) => /* @__PURE__ */ jsx2("div", { className: "border-l-2 border-border pl-3", children: /* @__PURE__ */ jsx2(
|
|
413
475
|
CommentLine,
|
|
@@ -519,7 +581,9 @@ var BoardComments = ({
|
|
|
519
581
|
onShowResolvedChange,
|
|
520
582
|
pinHint,
|
|
521
583
|
onCopyThreadReference,
|
|
522
|
-
onSelectViewport
|
|
584
|
+
onSelectViewport,
|
|
585
|
+
themeReference,
|
|
586
|
+
themeHash
|
|
523
587
|
}) => {
|
|
524
588
|
const [text, setText] = useState("");
|
|
525
589
|
const [isDecision, setIsDecision] = useState(false);
|
|
@@ -546,7 +610,8 @@ var BoardComments = ({
|
|
|
546
610
|
viewportWidth: pendingPin?.viewport?.width ?? null,
|
|
547
611
|
viewportHeight: pendingPin?.viewport?.height ?? null,
|
|
548
612
|
deviceKey: pendingPin?.viewport?.deviceKey ?? null,
|
|
549
|
-
isDecision
|
|
613
|
+
isDecision,
|
|
614
|
+
...themeReference ? { theme: themeReference } : {}
|
|
550
615
|
}
|
|
551
616
|
}).unwrap();
|
|
552
617
|
setText("");
|
|
@@ -606,21 +671,26 @@ var BoardComments = ({
|
|
|
606
671
|
] })
|
|
607
672
|
] }),
|
|
608
673
|
visibleThreads.length === 0 && /* @__PURE__ */ jsx2("p", { className: "text-sm text-muted-foreground", children: "No open comments on this board." }),
|
|
609
|
-
visibleThreads.map((thread) =>
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
674
|
+
visibleThreads.map((thread) => {
|
|
675
|
+
const threadState = compareThreadState(thread.root, board, themeHash);
|
|
676
|
+
return /* @__PURE__ */ jsx2(
|
|
677
|
+
ThreadCard,
|
|
678
|
+
{
|
|
679
|
+
thread,
|
|
680
|
+
onCopyReference: onCopyThreadReference,
|
|
681
|
+
onSelectViewport,
|
|
682
|
+
isHighlighted: highlightedCommentId === Number(thread.root.id),
|
|
683
|
+
onHighlight: () => onHighlightComment(Number(thread.root.id)),
|
|
684
|
+
authAccountId,
|
|
685
|
+
writesAllowed,
|
|
686
|
+
hasBoardChangedSince: threadState.hasBoardChangedSince,
|
|
687
|
+
hasDependenciesOrThemeChangedSince: threadState.hasDependenciesOrThemeChangedSince,
|
|
688
|
+
commentedVersionUrl: threadState.commentedVersionUrl,
|
|
689
|
+
isExpiring: expiringCommentIds.has(Number(thread.root.id))
|
|
690
|
+
},
|
|
691
|
+
String(thread.root.id)
|
|
692
|
+
);
|
|
693
|
+
})
|
|
624
694
|
] });
|
|
625
695
|
};
|
|
626
696
|
|
|
@@ -911,6 +981,7 @@ export {
|
|
|
911
981
|
findBoardForCode,
|
|
912
982
|
splitThemeReference,
|
|
913
983
|
buildThemeReference,
|
|
984
|
+
hasCanvasThemes,
|
|
914
985
|
DEFAULT_DESIGN_STUDIO_TEXTS,
|
|
915
986
|
resolveDesignStudioTexts,
|
|
916
987
|
DesignStudioProvider,
|
|
@@ -934,4 +1005,4 @@ export {
|
|
|
934
1005
|
resolveSiteHref,
|
|
935
1006
|
parseSiteFrameMessage
|
|
936
1007
|
};
|
|
937
|
-
//# sourceMappingURL=chunk-
|
|
1008
|
+
//# sourceMappingURL=chunk-PCXDVGGG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/canvas/deviceViewport.ts","../src/canvas/designReference.ts","../src/canvas/boardKey.ts","../src/canvas/boardCode.ts","../src/canvas/designTheme.ts","../src/provider/texts.ts","../src/provider/DesignStudioProvider.tsx","../src/utils/cx.ts","../src/canvas/BoardComments.tsx","../src/canvas/threadState.ts","../src/canvas/ViewportControls.tsx","../src/canvas/useCheckedContentUrl.ts","../src/site/siteNavigation.ts"],"sourcesContent":["/**\n * Responsive boards: the viewport a board is shown in (a device preset, rotated, or a free width), the size of a\n * responsive board on the canvas (its device frames side by side) and which comments belong to a viewport. Pure\n * functions, no React (tested in deviceViewport.test.ts).\n */\n\nimport type { DesignDevice, DesignStudioBoardFrameView, DesignStudioBoardView, DesignStudioComment } from '../api/types';\n\n/** Gap between the device frames of a responsive board on the canvas (the backend's FRAME_GAP). */\nexport const FRAME_GAP = 48;\n\n/** Height of the label line above each device frame on the canvas. */\nexport const FRAME_LABEL_HEIGHT = 40;\n\n/** Narrowest and widest free width of the focus view's drag handle (the backend's device width bounds). */\nexport const MINIMUM_VIEWPORT_WIDTH = 240;\nexport const MAXIMUM_VIEWPORT_WIDTH = 3840;\n\n/** Highest a responsive board is drawn on the canvas in page mode (longer pages are cut, whole in the focus view). */\nexport const MAX_PAGE_CANVAS_HEIGHT = 8000;\n\n/** How high the device frames of responsive boards are drawn on the canvas. */\nexport type FrameHeightMode = 'viewport' | 'page';\n\n/** The viewport a responsive board is shown in. `deviceKey` null = a free width (or a rotation without a preset). */\nexport interface DeviceViewport {\n width: number;\n height: number;\n deviceKey: string | null;\n}\n\nexport const isResponsiveBoard = (board: DesignStudioBoardView | null | undefined): boolean =>\n Boolean(board?.isResponsive && (board.frames?.elements?.length ?? 0) > 0);\n\nexport const framesOf = (board: DesignStudioBoardView | null | undefined): DesignStudioBoardFrameView[] =>\n board?.frames?.elements ?? [];\n\nexport const viewportOfDevice = (device: DesignDevice): DeviceViewport => ({\n width: device.width ?? 0,\n height: device.height ?? 0,\n deviceKey: device.deviceKey ?? null,\n});\n\n/**\n * The viewport a responsive board opens in: the current one when there is one (a device picked in the focus view or\n * for present mode stays while stepping through boards), else the board's first frame.\n */\nexport const initialViewportForBoard = (\n board: DesignStudioBoardView | null | undefined,\n current: DeviceViewport | null\n): DeviceViewport | null => {\n if (!isResponsiveBoard(board)) return null;\n if (current) return current;\n const firstFrame = framesOf(board)[0];\n return { width: firstFrame.width ?? 0, height: firstFrame.height ?? 0, deviceKey: firstFrame.deviceKey ?? null };\n};\n\n/**\n * The viewport the site view opens a page in: its widest frame (a website is first looked at on a desktop), the\n * current one when one was picked.\n */\nexport const siteViewportForBoard = (\n board: DesignStudioBoardView | null | undefined,\n current: DeviceViewport | null\n): DeviceViewport | null => {\n if (!isResponsiveBoard(board)) return null;\n if (current) return current;\n const widestFrame = framesOf(board).reduce((widest, frame) => ((frame.width ?? 0) > (widest.width ?? 0) ? frame : widest));\n return { width: widestFrame.width ?? 0, height: widestFrame.height ?? 0, deviceKey: widestFrame.deviceKey ?? null };\n};\n\n/** Landscape ↔ portrait: width and height swapped; the preset with exactly that size when there is one. */\nexport const rotateViewport = (viewport: DeviceViewport, devices: readonly DesignDevice[]): DeviceViewport => {\n const rotated = { width: viewport.height, height: viewport.width };\n const matchingDevice = devices.find(device => device.width === rotated.width && device.height === rotated.height);\n return { ...rotated, deviceKey: matchingDevice?.deviceKey ?? null };\n};\n\n/** A free width from the drag handle (bounded); the height stays, the preset is left. */\nexport const viewportWithWidth = (viewport: DeviceViewport, width: number): DeviceViewport => ({\n width: Math.round(Math.max(MINIMUM_VIEWPORT_WIDTH, Math.min(MAXIMUM_VIEWPORT_WIDTH, width))),\n height: viewport.height,\n deviceKey: null,\n});\n\n/** `iPhone 16 / 15 · 393 × 852`, `Free width · 900 × 852`. */\nexport const viewportLabel = (viewport: DeviceViewport, devices: readonly DesignDevice[]): string => {\n const device = viewport.deviceKey ? devices.find(candidate => candidate.deviceKey === viewport.deviceKey) : undefined;\n return `${device?.label ?? (viewport.deviceKey ?? 'Free width')} · ${viewport.width} × ${viewport.height}`;\n};\n\n/**\n * The page height of a responsive board at a width: the rendered height of the frame of that width; else the frame of\n * the nearest width (a narrower page is taller: scaled by the width ratio); else three screens.\n */\nexport const pageHeightAtWidth = (board: DesignStudioBoardView, width: number, viewportHeight: number): number => {\n const frames = framesOf(board).filter(frame => (frame.pageHeight ?? 0) > 0 && (frame.width ?? 0) > 0);\n const exactFrame = frames.find(frame => frame.width === width);\n if (exactFrame) return Math.max(viewportHeight, exactFrame.pageHeight ?? 0);\n if (frames.length === 0) return viewportHeight * 3;\n const nearestFrame = frames.reduce((nearest, frame) =>\n Math.abs((frame.width ?? 0) - width) < Math.abs((nearest.width ?? 0) - width) ? frame : nearest\n );\n return Math.max(viewportHeight, Math.round(((nearestFrame.pageHeight ?? 0) * (nearestFrame.width ?? 1)) / Math.max(1, width)));\n};\n\n/** Height of one device frame on the canvas in a mode (page mode: the rendered page, once there is one). */\nexport const frameCanvasHeight = (frame: DesignStudioBoardFrameView, mode: FrameHeightMode): number => {\n const viewportHeight = frame.height ?? 0;\n if (mode === 'viewport') return viewportHeight;\n return Math.min(MAX_PAGE_CANVAS_HEIGHT, Math.max(viewportHeight, frame.pageHeight ?? viewportHeight));\n};\n\n/** Size of a board on the canvas below its header: a responsive board = its frames side by side with their labels. */\nexport const boardCanvasSize = (\n board: DesignStudioBoardView,\n mode: FrameHeightMode\n): { width: number; height: number } => {\n if (!isResponsiveBoard(board)) return { width: board.width ?? 390, height: board.height ?? 844 };\n const frames = framesOf(board);\n const width = frames.reduce((sum, frame) => sum + (frame.width ?? 0), 0) + FRAME_GAP * (frames.length - 1);\n const height = FRAME_LABEL_HEIGHT + Math.max(...frames.map(frame => frameCanvasHeight(frame, mode)));\n return { width, height };\n};\n\n/** The viewport a comment's pin was placed in, null for a comment on a fixed board (or without a pin). */\nexport const viewportOfComment = (comment: DesignStudioComment): DeviceViewport | null =>\n comment.viewportWidth\n ? { width: comment.viewportWidth, height: comment.viewportHeight ?? comment.viewportWidth, deviceKey: comment.deviceKey ?? null }\n : null;\n\n/**\n * Whether a comment's pin is shown in a viewport: a pin placed in a viewport shows at that width only (its position\n * is a position in the page at that width); a pin without a viewport (a fixed board) shows when no viewport is set.\n */\nexport const isPinInViewport = (comment: DesignStudioComment, viewport: DeviceViewport | null): boolean => {\n const commentViewport = viewportOfComment(comment);\n if (!viewport) return commentViewport === null;\n return commentViewport !== null && commentViewport.width === viewport.width;\n};\n\n/** `393x852 iphone-16` / `900x852`: the viewport as a design reference and the console print it. */\nexport const viewportReferenceText = (viewport: DeviceViewport): string =>\n `${viewport.width}x${viewport.height}${viewport.deviceKey ? ` ${viewport.deviceKey}` : ''}`;\n","/**\n * Design references for agentic editing (\"send to agent\"): a plain-text block that names one\n * board (and optionally a region of it, a comment, a note) with stable keys, so an agent session can resolve it.\n * Format (one line per board, fields joined by \" · \", the deep link always last; optional\n * extra lines below):\n *\n * [design-ref] App › Onboarding – first run › 2 Welcome · code APP ONB-W2 · file onb-w-2-welcome.dc.html · canvas app/onboarding\n * · v3f9c2ab · theme brand:1:dark · viewport 393x852 iphone-16 · region 24,180,342,220\n * · https://…/app/canvases/onboarding?board=onb-w-2-welcome.dc.html&theme=brand:1&mode=dark\n * note: make the tab bar more compact\n *\n * `code` is the board code (left out when the board has none), `file` the board key (the file name in the canvas folder), `v…` the first 7 characters of the board file's\n * content hash (git blob hash), `theme` the theme reference the board was looked at in (`none` = as authored),\n * `viewport` (responsive boards only) the viewport width × height and device preset the board was looked at in — a\n * region or a comment position is a position in the page at that width.\n *\n * Pure functions, no React (tested in designReference.test.ts).\n */\n\nimport { type DeviceViewport, viewportReferenceText } from './deviceViewport.ts';\n\nexport const DESIGN_REFERENCE_PREFIX = '[design-ref]';\n\n/** A rectangle on a board in board pixels (independent of the zoom). */\nexport interface BoardRegion {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface DesignReferenceInput {\n projectName: string;\n canvasName: string;\n projectKey: string;\n canvasKey: string;\n boardTitle: string;\n /** File name of the board in the canvas folder. */\n boardKey: string;\n /** Board code (`APP ONB-W2`), null / absent = the board has none. */\n boardCode?: string | null;\n /** Content hash of the board file (git blob hash); the reference carries its first 7 characters. */\n contentHash: string | null;\n /** Theme reference the board is shown in (`<themeId>` or `<themeId>:dark`), null = as authored. */\n themeReference: string | null;\n /** Deep link to the board on the canvas (with theme and mode). */\n url: string;\n /** The viewport a responsive board is looked at in (region / comment positions are page positions at its width). */\n viewport?: DeviceViewport | null;\n region?: BoardRegion | null;\n /** A comment thread the reference is about (id + pin position). */\n comment?: { id: number | string; x: number | null; y: number | null; lines: string[] } | null;\n /** What should change (free text). */\n note?: string | null;\n}\n\nconst oneLine = (text: string) => text.replace(/\\s+/g, ' ').trim();\n\n/** One reference block (first line + optional `comment:` / `note:` lines). */\nexport const buildDesignReference = (input: DesignReferenceInput): string => {\n const fields = [\n `${DESIGN_REFERENCE_PREFIX} ${oneLine(input.projectName)} › ${oneLine(input.canvasName)} › ${oneLine(input.boardTitle)}`,\n ...(input.boardCode ? [`code ${oneLine(input.boardCode)}`] : []),\n `file ${input.boardKey}`,\n `canvas ${input.projectKey}/${input.canvasKey}`,\n `v${input.contentHash ? input.contentHash.slice(0, 7) : '?'}`,\n `theme ${input.themeReference || 'none'}`,\n ...(input.viewport ? [`viewport ${viewportReferenceText(input.viewport)}`] : []),\n ];\n if (input.region) {\n const { x, y, width, height } = input.region;\n fields.push(`region ${Math.round(x)},${Math.round(y)},${Math.round(width)},${Math.round(height)}`);\n }\n if (input.comment) {\n const position =\n input.comment.x != null && input.comment.y != null\n ? ` at ${Math.round(input.comment.x)},${Math.round(input.comment.y)}`\n : '';\n fields.push(`comment ${input.comment.id}${position}`);\n }\n fields.push(input.url);\n const lines = [fields.join(' · ')];\n for (const commentLine of input.comment?.lines ?? []) {\n if (commentLine.trim()) lines.push(`comment: ${oneLine(commentLine)}`);\n }\n if (input.note?.trim()) lines.push(`note: ${oneLine(input.note)}`);\n return lines.join('\\n');\n};\n\n/**\n * Deep link to a board: the current page URL with `board` (the board key), the look (`theme`, `mode`; left out when\n * the board is shown as authored) and, when given, the canvas viewport `vp` (other canvas parameters dropped) — the\n * link reopens the focus view over the same part of the canvas.\n */\nexport const buildBoardDeepLink = (\n pageUrl: string,\n boardKey: string,\n themeId: string | null,\n mode: 'light' | 'dark',\n viewport?: string | null\n): string => {\n const url = new URL(pageUrl);\n url.search = '';\n url.hash = '';\n url.searchParams.set('board', boardKey);\n if (themeId) {\n url.searchParams.set('theme', themeId);\n url.searchParams.set('mode', mode);\n }\n if (viewport) url.searchParams.set('vp', viewport);\n // commas and colons are valid in a query; unescaped, the viewport and the theme stay readable in a pasted reference\n return url.toString().replace(/%2C/gi, ',').replace(/%3A/gi, ':');\n};\n\n/**\n * Copies text: the async Clipboard API, else a hidden textarea + `execCommand('copy')` (older browsers, insecure\n * origins).\n * @returns whether the text reached the clipboard\n */\nexport const copyTextToClipboard = async (text: string): Promise<boolean> => {\n if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n // fall through to the textarea fallback (permission denied, document not focused)\n }\n }\n if (typeof document === 'undefined') return false;\n const textarea = document.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n document.body.appendChild(textarea);\n textarea.select();\n const isCopied = document.execCommand('copy');\n textarea.remove();\n return isCopied;\n};\n","/**\n * A board's code: its key (the file name in the canvas folder) without the `.html` extension and without an optional\n * `.dc` before it (`welcome.html` and `welcome.dc.html` both give `welcome`). Shown under the title and used as the\n * base name of downloads. A key without `.html` is returned as it is.\n */\nexport const boardCodeOf = (boardKey: string): string => boardKey.replace(/(?:\\.dc)?\\.html$/, '');\n","/**\n * Board codes (`APP ONB-W2`): the short name of a board that people say in a chat or paste into the studio. The\n * backend sets them (project code + canvas code + a board part from the file name or canvas.json); here they are\n * matched and turned into links. A code link opens the canvas on that board: the view moves to it, the board is\n * selected and its side panel shows.\n *\n * Pure functions, no React (tested in boardCode.test.ts).\n */\n\nimport { boardCodeOf } from './boardKey.ts';\n\n/** URL parameter of a code link (`?code=APP-ONB-W2`). */\nexport const CODE_PARAM = 'code';\n\n/** A code for comparisons: upper case, letters and digits only (`app onb-w2` → `APPONBW2`). */\nexport const normalizeBoardCode = (code: string): string => code.toUpperCase().replace(/[^A-Z0-9]/g, '');\n\n/** The parts of a code: `APP ONB-W2` → `['APP', 'ONB', 'W2']`. */\nconst codeParts = (code: string): string[] => code.trim().toUpperCase().split(/[\\s-]+/).filter(Boolean);\n\n/**\n * Whether a typed code names a board on its canvas: the full code, the code without the project part, or the board\n * part alone (`APP ONB-W2`, `ONB-W2`, `w2`) — case, spaces and dashes do not matter, a fragment (`2`, `NBW2`) does not\n * match.\n */\nexport const boardCodeMatches = (typedCode: string, boardCode: string | null | undefined): boolean => {\n const typed = normalizeBoardCode(typedCode);\n if (!typed || !boardCode) return false;\n const parts = codeParts(boardCode);\n return parts.some((_, index) => parts.slice(index).join('') === typed);\n};\n\n/**\n * Whether a typed code belongs to a canvas: it starts with the canvas' code prefix, with or without the project part\n * (`APP ONB-W2` and `ONB-W2` belong to `APP ONB`). Used by the overview to send a pasted code to its canvas.\n */\nexport const codeBelongsToCanvas = (typedCode: string, canvasCode: string | null | undefined): boolean => {\n const typed = normalizeBoardCode(typedCode);\n if (!typed || !canvasCode) return false;\n const parts = codeParts(canvasCode);\n return parts.some((_, index) => {\n const prefix = parts.slice(index).join('');\n return typed.length > prefix.length && typed.startsWith(prefix);\n });\n};\n\n/** A code as a URL value: parts joined by dashes (`APP ONB-W2` → `APP-ONB-W2`), readable in a pasted link. */\nexport const boardCodeUrlValue = (code: string): string => codeParts(code).join('-');\n\n/**\n * Link that opens a canvas on one board by its code: the canvas page URL (other parameters dropped) with `code`,\n * plus the look (`theme`, `mode`) when the board is shown in one.\n */\nexport const buildBoardCodeLink = (\n canvasPageUrl: string,\n code: string,\n themeId: string | null,\n mode: 'light' | 'dark'\n): string => {\n const url = new URL(canvasPageUrl);\n url.search = '';\n url.hash = '';\n url.searchParams.set(CODE_PARAM, boardCodeUrlValue(code));\n if (themeId) {\n url.searchParams.set('theme', themeId);\n url.searchParams.set('mode', mode);\n }\n return url.toString().replace(/%3A/gi, ':');\n};\n\n/**\n * The board a typed code names on a canvas: by its code (`boardCodeMatches`), else by its file name without extension\n * (`onb-w-2-welcome`, for boards without a code). Null when none or more than one board matches.\n */\nexport const findBoardForCode = <Board extends { code?: string | null; boardKey?: string | null }>(\n boards: readonly Board[],\n typedCode: string\n): Board | null => {\n const byCode = boards.filter(board => boardCodeMatches(typedCode, board.code));\n if (byCode.length > 0) return byCode.length === 1 ? byCode[0] : null;\n const typed = typedCode.trim().toLowerCase();\n const byName = boards.filter(board => board.boardKey && boardCodeOf(board.boardKey).toLowerCase() === typed);\n return byName.length === 1 ? byName[0] : null;\n};\n","/**\n * Theme references of the design studio: `<themeId>` or `<themeId>:<mode>` (mode `light` or `dark`), e.g.\n * `brand:1:dark` — the theme id itself may contain colons, only a trailing `:light` / `:dark` is the mode (same rule\n * as `DesignThemeReference::fromString`). Pure functions, no React (tested in designTheme.test.ts).\n */\n\nexport type ThemeMode = 'light' | 'dark';\n\nexport interface ThemeLook {\n themeId: string;\n mode: ThemeMode;\n}\n\n/** Splits a theme reference; null without one (the boards are shown as authored). */\nexport const splitThemeReference = (themeReference: string | null | undefined): ThemeLook | null => {\n const reference = (themeReference ?? '').trim();\n if (!reference) return null;\n for (const mode of ['light', 'dark'] as const) {\n if (reference.endsWith(`:${mode}`)) return { themeId: reference.slice(0, -(mode.length + 1)), mode };\n }\n return { themeId: reference, mode: 'light' };\n};\n\n/** `<themeId>` for light, `<themeId>:dark` for dark. */\nexport const buildThemeReference = (themeId: string, mode: ThemeMode): string =>\n mode === 'dark' ? `${themeId}:dark` : themeId;\n\n/**\n * Whether a canvas offers a theme switcher: the application's provider has themes (`hasThemes` of the overview), or\n * the canvas' design system has theme files (`hasThemes` of the canvas view, known once the canvas is loaded).\n */\nexport const hasCanvasThemes = (overviewHasThemes: boolean | null | undefined, canvasHasThemes: boolean | null | undefined): boolean =>\n Boolean(overviewHasThemes) || Boolean(canvasHasThemes);\n","import type { DesignStudioTexts } from './types';\n\n/** The English defaults of the texts an application can replace through `environment.texts`. */\nexport const DEFAULT_DESIGN_STUDIO_TEXTS: DesignStudioTexts = {\n referencesCopied: count => (count > 1 ? `References copied (${count})` : 'Reference copied'),\n boardsUpdated: count => (count === 1 ? '1 board updated' : `${count} boards updated`),\n showUpdatedBoard: 'Show',\n canvasUpToDate: 'Canvas is up to date',\n reload: 'Reload (R)',\n thumbnailsFailed: 'Thumbnails failed · try again',\n thumbnailsWaitingForRenderer: themeLabel => `Thumbnails for ${themeLabel} are waiting for the renderer`,\n thumbnailsRendering: themeLabel => `Thumbnails for ${themeLabel} are being rendered`,\n thumbnailsFallbackThemeLabel: 'this look',\n thumbnailsMissing: count =>\n count === 1\n ? '1 board has no thumbnail in this look yet; it appears as soon as it is rendered.'\n : `${count} boards have no thumbnail in this look yet; they appear as soon as they are rendered.`,\n thumbnailsLastError: error => `Last error: ${error}`,\n thumbnailsProgress: (renderedCount, pictureCount, failedCount) =>\n failedCount > 0 ? `${renderedCount} of ${pictureCount}, ${failedCount} failed` : `${renderedCount} of ${pictureCount}`,\n thumbnailsPending: 'Thumbnails missing · render',\n thumbnailsPartlyFailed: 'Some thumbnails failed · try again',\n thumbnailsThemeUnstable: 'No thumbnails: the theme returns different styles on each call',\n thumbnailFailedBoard: (renderTargetKey, error) => `${renderTargetKey}: ${error}`,\n themeWithoutDarkMode: 'This theme has no dark mode',\n thumbnailMissing: 'No thumbnail yet',\n thumbnailLoading: 'Loading…',\n sitePageMissing: path => `No page for ${path}`,\n siteExternalLink: href => `External link, not followed: ${href}`,\n openAsWebsite: 'Open as website',\n referenceNotePlaceholder: 'What should change? (optional, goes into the reference)',\n boardCodeNotFound: code => `No board has the code ${code}`,\n boardLinkCopied: code => `Link to ${code} copied`,\n copyBoardLink: 'Copy link',\n exportSvg: 'SVG',\n exportSvgTitle: 'Export as SVG',\n exportSvgScope: (themeLabel, hasRegion) => `${hasRegion ? 'The marked region' : 'The whole board'} in ${themeLabel}.`,\n exportSvgStart: 'Export',\n exportSvgRunning: 'Exporting…',\n exportSvgSizes: (svg, gzip, raster) => `SVG ${svg} (gzip ${gzip}) · raster ${raster}`,\n exportSvgDiffering: percent => `Differs from the raster picture in ${percent} of the pixels.`,\n exportSvgLostEffects:\n 'Raster | SVG | differing pixels in red. Glass (backdrop-filter), blend modes and some filters are lost in SVG.',\n exportSvgDownload: 'Download SVG',\n threadDependenciesChangedSince: 'Assets or theme changed since',\n threadDependenciesChangedSinceTitle:\n 'An image or script the board loads, or the style of the theme it is shown in, changed after this thread was written',\n showCommentedVersion: 'Show the commented version',\n statusDependenciesChangedSince: 'assets changed since',\n statusDependenciesChangedSinceTitle: 'An image or script the board loads changed after this status was set',\n};\n\n/** The defaults with the application's replacements on top; an entry that is missing or `undefined` keeps its default. */\nexport const resolveDesignStudioTexts = (texts: Partial<DesignStudioTexts> | undefined): DesignStudioTexts => {\n if (!texts) return DEFAULT_DESIGN_STUDIO_TEXTS;\n const defined = Object.fromEntries(Object.entries(texts).filter(([, value]) => value !== undefined));\n return { ...DEFAULT_DESIGN_STUDIO_TEXTS, ...defined };\n};\n","'use client';\n\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\n\nimport type { DesignStudioApi } from '../api/createDesignStudioApi';\nimport { resolveDesignStudioTexts } from './texts';\nimport type {\n DesignStudioComponents,\n DesignStudioEnvironment,\n DesignStudioNotify,\n DesignStudioPaths,\n DesignStudioRouter,\n DesignStudioTexts,\n} from './types';\n\nconst DesignStudioContext = createContext<DesignStudioEnvironment | null>(null);\n\nexport interface DesignStudioProviderProps {\n /** Keep it referentially stable (a module constant): every studio component reads it. */\n environment: DesignStudioEnvironment;\n children: ReactNode;\n}\n\n/** Hands the application's environment (API, router, UI primitives, …) to the studio's screens below it. */\nexport const DesignStudioProvider = ({ environment, children }: DesignStudioProviderProps) => (\n <DesignStudioContext.Provider value={environment}>{children}</DesignStudioContext.Provider>\n);\n\n/** The whole environment. */\nexport const useDesignStudio = (): DesignStudioEnvironment => {\n const environment = useContext(DesignStudioContext);\n if (!environment) {\n throw new Error('The design studio needs a DesignStudioProvider above it');\n }\n return environment;\n};\n\nexport const useDesignStudioApi = (): DesignStudioApi => useDesignStudio().api;\n\nexport const useDesignStudioComponents = (): DesignStudioComponents => useDesignStudio().components;\n\nexport const useDesignStudioRouter = (): DesignStudioRouter => useDesignStudio().router;\n\nexport const useDesignStudioPaths = (): DesignStudioPaths => useDesignStudio().paths;\n\nexport const useDesignStudioNotify = (): DesignStudioNotify => useDesignStudio().notify;\n\n/** The UI texts: the application's replacements (`environment.texts`) on top of the English defaults. Stable per environment. */\nexport const useDesignStudioTexts = (): DesignStudioTexts => {\n const { texts } = useDesignStudio();\n return useMemo(() => resolveDesignStudioTexts(texts), [texts]);\n};\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/** Conditional class names, later Tailwind classes winning over earlier ones (`clsx` + `tailwind-merge`). */\nexport const cx = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/api';\nimport { Bot, CheckCircle2, ClipboardCopy, ExternalLink, Flag, History, Hourglass, Layers, MapPin, RotateCcw, Trash2 } from 'lucide-react';\nimport { useState } from 'react';\n\nimport type { DesignStudioBoardView, DesignStudioComment } from '../api/types';\nimport { useDesignStudio, useDesignStudioTexts } from '../provider/DesignStudioProvider';\nimport { cx } from '../utils/cx';\nimport { type DeviceViewport, viewportOfComment } from './deviceViewport';\nimport { compareThreadState } from './threadState';\n\n/**\n * A pin position on a board: board pixels on a fixed board, page pixels at the viewport's width on a responsive one.\n */\nexport interface BoardPin {\n x: number;\n y: number;\n /** The viewport the pin was placed in (a responsive board), null on a fixed board. */\n viewport?: DeviceViewport | null;\n}\n\n/** Thread roots of a board with their replies, oldest first. */\nexport interface CommentThread {\n root: DesignStudioComment;\n replies: DesignStudioComment[];\n /** 1-based number of a pinned root (shown on the board), null for a board-level comment. */\n pinNumber: number | null;\n}\n\n/** Groups a board's comments into threads by `parentDesignStudioCommentId` (null = a thread root). */\nexport const buildCommentThreads = (comments: DesignStudioComment[]): CommentThread[] => {\n const repliesByRootId = new Map<number, DesignStudioComment[]>();\n for (const comment of comments) {\n if (comment.parentDesignStudioCommentId != null) {\n const replies = repliesByRootId.get(comment.parentDesignStudioCommentId) ?? [];\n replies.push(comment);\n repliesByRootId.set(comment.parentDesignStudioCommentId, replies);\n }\n }\n let pinNumber = 0;\n return comments\n .filter(comment => comment.parentDesignStudioCommentId == null)\n .map(root => ({\n root,\n replies: repliesByRootId.get(Number(root.id)) ?? [],\n pinNumber: root.x != null && root.y != null ? ++pinNumber : null,\n }));\n};\n\nconst errorMessage = (error: unknown) => normalizeDddError(error, 'Request failed').message;\n\ninterface CommentLineProps {\n comment: DesignStudioComment;\n isOwn: boolean;\n writesAllowed: boolean;\n}\n\nconst CommentLine = ({ comment, isOwn, writesAllowed }: CommentLineProps) => {\n const { api, components, formatDateTime, notify } = useDesignStudio();\n const { Button } = components;\n const [deleteComment, { isLoading: isDeleting }] = api.useDeleteCommentMutation();\n return (\n <div className=\"space-y-1\">\n <p className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n {comment.authorKind === 'AGENT' && <Bot className=\"size-3.5 text-brand-emphasis\" aria-label=\"Agent\" />}\n <span className=\"font-semibold text-foreground\">{comment.authorName ?? 'Unknown'}</span>\n <span>· {formatDateTime(comment.changeHistory?.createdTime)}</span>\n {isOwn && (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n className=\"ml-auto size-6\"\n aria-label=\"Delete comment\"\n disabled={!writesAllowed || isDeleting}\n onClick={() =>\n deleteComment({ designStudioCommentId: Number(comment.id) })\n .unwrap()\n .catch(error => notify.error(errorMessage(error)))\n }\n >\n <Trash2 className=\"size-3.5\" />\n </Button>\n )}\n </p>\n <p className=\"text-sm whitespace-pre-wrap break-words\">{comment.text}</p>\n </div>\n );\n};\n\ninterface ThreadCardProps {\n thread: CommentThread;\n /** \"Copy for agent\": the board reference with this thread (pin + texts). */\n onCopyReference: (thread: CommentThread) => void;\n isHighlighted: boolean;\n onHighlight: () => void;\n authAccountId: number | null;\n writesAllowed: boolean;\n /** The board file is another version than the one the thread was written on. */\n hasBoardChangedSince: boolean;\n /** What the board pulls in (asset files) or its theme changed since the thread was written. */\n hasDependenciesOrThemeChangedSince: boolean;\n /** Delivery path of the board in the state the thread was written on, null when not offered. */\n commentedVersionUrl: string | null;\n /** The thread is deleted soon unless something happens in it (\"Keep\" postpones that). */\n isExpiring: boolean;\n /** A thread pinned in a viewport (responsive board): shows the board in that viewport. */\n onSelectViewport?: (viewport: DeviceViewport) => void;\n}\n\nconst ThreadCard = ({\n thread,\n onCopyReference,\n isHighlighted,\n onHighlight,\n authAccountId,\n writesAllowed,\n hasBoardChangedSince,\n hasDependenciesOrThemeChangedSince,\n commentedVersionUrl,\n isExpiring,\n onSelectViewport,\n}: ThreadCardProps) => {\n const { root, replies, pinNumber } = thread;\n const rootViewport = viewportOfComment(root);\n const [replyText, setReplyText] = useState('');\n const { api, apiBaseUrl, components, notify } = useDesignStudio();\n const texts = useDesignStudioTexts();\n const { Badge, Button, Textarea } = components;\n const [createReply, { isLoading: isReplying }] = api.useReplyToCommentMutation();\n const [resolveThread, { isLoading: isResolving }] = api.useResolveCommentMutation();\n const [reopenThread, { isLoading: isReopening }] = api.useReopenCommentMutation();\n const [patchComment, { isLoading: isPatching }] = api.usePatchCommentMutation();\n const [keepThread, { isLoading: isKeeping }] = api.useKeepCommentMutation();\n const designStudioCommentId = Number(root.id);\n\n const sendReply = async () => {\n try {\n await createReply({\n designStudioCommentId,\n body: { text: replyText },\n }).unwrap();\n setReplyText('');\n } catch (error) {\n notify.error(errorMessage(error));\n }\n };\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: an article that highlights its pin on hover / focus, not a control\n <article\n className={cx(\n 'space-y-3 rounded-2xl bg-card p-4 shadow-surface-raised ring-1 ring-foreground/5',\n root.isResolved && 'opacity-70',\n isHighlighted && 'ring-2 ring-brand'\n )}\n onMouseEnter={onHighlight}\n onFocus={onHighlight}\n role=\"group\"\n aria-label={`Comment thread${pinNumber ? ` ${pinNumber}` : ''}`}\n >\n <div className=\"flex flex-wrap items-center gap-1.5\">\n {pinNumber !== null ? (\n <Badge className=\"bg-primary text-primary-foreground\">\n <MapPin aria-hidden /> {pinNumber}\n </Badge>\n ) : (\n <Badge variant=\"outline\">Board</Badge>\n )}\n {rootViewport && (\n <button\n type=\"button\"\n 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\"\n title=\"Pinned in this viewport: show the board in it\"\n disabled={!onSelectViewport}\n onClick={() => onSelectViewport?.(rootViewport)}\n >\n {rootViewport.width} × {rootViewport.height}\n {rootViewport.deviceKey ? ` · ${rootViewport.deviceKey}` : ''}\n </button>\n )}\n {root.isDecision && (\n <Badge variant=\"outline\" className=\"border-transparent bg-success/15 text-success\">\n <Flag aria-hidden /> Decision\n </Badge>\n )}\n {root.isResolved && (\n <Badge variant=\"outline\" className=\"border-transparent bg-tint text-muted-foreground\">\n Resolved{root.resolvedByName ? ` by ${root.resolvedByName}` : ''}\n </Badge>\n )}\n {hasBoardChangedSince && (\n <Badge\n variant=\"outline\"\n className=\"border-transparent bg-warning/15 text-warning\"\n title=\"The board file is another version than the one this thread was written on\"\n >\n <History aria-hidden /> Board changed since\n </Badge>\n )}\n {hasDependenciesOrThemeChangedSince && (\n <Badge\n variant=\"outline\"\n className=\"border-transparent bg-warning/15 text-warning\"\n title={texts.threadDependenciesChangedSinceTitle}\n >\n <Layers aria-hidden /> {texts.threadDependenciesChangedSince}\n </Badge>\n )}\n {isExpiring && (\n <Badge\n variant=\"outline\"\n className=\"border-transparent bg-tint text-muted-foreground\"\n title=\"Idle threads are deleted; “Keep” or any reply postpones that\"\n >\n <Hourglass aria-hidden /> Expires soon\n </Badge>\n )}\n </div>\n {commentedVersionUrl && (\n <a\n href={`${apiBaseUrl}${commentedVersionUrl}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-xs font-medium text-brand-emphasis hover:underline\"\n >\n <ExternalLink className=\"size-3.5\" aria-hidden /> {texts.showCommentedVersion}\n </a>\n )}\n <CommentLine comment={root} isOwn={authAccountId !== null && root.authorAccountId === authAccountId} writesAllowed={writesAllowed} />\n {replies.map(reply => (\n <div key={String(reply.id)} className=\"border-l-2 border-border pl-3\">\n <CommentLine\n comment={reply}\n isOwn={authAccountId !== null && reply.authorAccountId === authAccountId}\n writesAllowed={writesAllowed}\n />\n </div>\n ))}\n <Textarea\n value={replyText}\n onChange={event => setReplyText(event.target.value)}\n placeholder=\"Reply…\"\n rows={2}\n aria-label=\"Reply\"\n disabled={!writesAllowed}\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button size=\"sm\" variant=\"outline\" disabled={!writesAllowed || !replyText.trim() || isReplying} onClick={sendReply}>\n Reply\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={!writesAllowed || isPatching}\n aria-pressed={Boolean(root.isDecision)}\n onClick={() =>\n patchComment({\n designStudioCommentId,\n body: { isDecision: !root.isDecision },\n })\n .unwrap()\n .catch(error => notify.error(errorMessage(error)))\n }\n >\n <Flag /> {root.isDecision ? 'Not a decision' : 'Decision'}\n </Button>\n <Button size=\"sm\" variant=\"outline\" onClick={() => onCopyReference(thread)} aria-label=\"Copy for agent\">\n <ClipboardCopy /> Copy for agent\n </Button>\n {isExpiring && (\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={!writesAllowed || isKeeping}\n onClick={() =>\n keepThread({ designStudioCommentId })\n .unwrap()\n .catch(error => notify.error(errorMessage(error)))\n }\n >\n Keep\n </Button>\n )}\n {root.isResolved ? (\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"ml-auto\"\n disabled={!writesAllowed || isReopening}\n onClick={() =>\n reopenThread({ designStudioCommentId })\n .unwrap()\n .catch(error => notify.error(errorMessage(error)))\n }\n >\n <RotateCcw /> Reopen\n </Button>\n ) : (\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"ml-auto\"\n disabled={!writesAllowed || isResolving}\n onClick={async () => {\n try {\n await resolveThread({\n designStudioCommentId,\n body: { replyText: replyText.trim() ? replyText : null },\n }).unwrap();\n setReplyText('');\n } catch (error) {\n notify.error(errorMessage(error));\n }\n }}\n >\n <CheckCircle2 /> Resolve\n </Button>\n )}\n </div>\n </article>\n );\n};\n\nexport interface BoardCommentsProps {\n projectKey: string;\n canvasKey: string;\n board: DesignStudioBoardView;\n threads: CommentThread[];\n /** A pin placed on the board in focus view, waiting for its comment. */\n pendingPin: BoardPin | null;\n onClearPendingPin: () => void;\n highlightedCommentId: number | null;\n onHighlightComment: (designStudioCommentId: number | null) => void;\n writesAllowed: boolean;\n /** Show resolved threads too. */\n showResolved: boolean;\n onShowResolvedChange: (showResolved: boolean) => void;\n /** How to pin a comment from where the panel is shown (placeholder of the new-comment field). */\n pinHint: string;\n /** \"Copy for agent\" on a thread. */\n onCopyThreadReference: (thread: CommentThread) => void;\n /** A thread pinned in a viewport (responsive board): shows the board in that viewport. */\n onSelectViewport?: (viewport: DeviceViewport) => void;\n /** Reference of the theme the board is shown in (`themeReference` of the canvas): a new thread is written in it. */\n themeReference?: string | null;\n /**\n * Hash of that theme's style (`themeHash` of the canvas), null = no theme; omitted = unknown (a thread's theme is\n * then not compared).\n */\n themeHash?: string | null;\n}\n\n/** Comments of one board: new thread (on the board or at a placed pin), threads with replies, resolve, decision. */\nexport const BoardComments = ({\n projectKey,\n canvasKey,\n board,\n threads,\n pendingPin,\n onClearPendingPin,\n highlightedCommentId,\n onHighlightComment,\n writesAllowed,\n showResolved,\n onShowResolvedChange,\n pinHint,\n onCopyThreadReference,\n onSelectViewport,\n themeReference,\n themeHash,\n}: BoardCommentsProps) => {\n const [text, setText] = useState('');\n const [isDecision, setIsDecision] = useState(false);\n const { api, components, notify, useCurrentAccountId } = useDesignStudio();\n const { Button, Checkbox, Label, Textarea } = components;\n const [createComment, { isLoading }] = api.useCreateCommentMutation();\n const authAccountId = useCurrentAccountId();\n // threads that are deleted soon unless something happens in them (all canvases; one cached request)\n const { data: expiringData } = api.useExpiringCommentsQuery();\n const expiringCommentIds = new Set(\n (expiringData?.designStudioComments.elements ?? []).map(comment => Number(comment.id))\n );\n const visibleThreads = showResolved ? threads : threads.filter(thread => !thread.root.isResolved);\n const resolvedCount = threads.length - threads.filter(thread => !thread.root.isResolved).length;\n\n const addComment = async () => {\n try {\n await createComment({\n projectKey,\n canvasKey,\n boardKey: board.boardKey ?? '',\n body: {\n text,\n x: pendingPin?.x ?? null,\n y: pendingPin?.y ?? null,\n viewportWidth: pendingPin?.viewport?.width ?? null,\n viewportHeight: pendingPin?.viewport?.height ?? null,\n deviceKey: pendingPin?.viewport?.deviceKey ?? null,\n isDecision,\n ...(themeReference ? { theme: themeReference } : {}),\n },\n }).unwrap();\n setText('');\n setIsDecision(false);\n onClearPendingPin();\n } catch (error) {\n notify.error(errorMessage(error));\n }\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"design-comment-text\" className=\"flex items-center gap-1.5\">\n {pendingPin ? (\n <>\n <MapPin className=\"size-4 text-brand-emphasis\" aria-hidden /> Comment at the placed pin\n </>\n ) : (\n 'New comment on the board'\n )}\n </Label>\n <Textarea\n id=\"design-comment-text\"\n value={text}\n onChange={event => setText(event.target.value)}\n placeholder={pendingPin ? 'What should change here?' : `Comment… (${pinHint})`}\n rows={3}\n disabled={!writesAllowed}\n />\n <div className=\"flex flex-wrap items-center gap-3\">\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id=\"design-comment-decision\"\n checked={isDecision}\n onCheckedChange={checked => setIsDecision(checked === true)}\n disabled={!writesAllowed}\n />\n <Label htmlFor=\"design-comment-decision\" className=\"font-normal\">\n Decision\n </Label>\n </div>\n {pendingPin && (\n <Button size=\"sm\" variant=\"ghost\" onClick={onClearPendingPin}>\n Remove pin\n </Button>\n )}\n <Button size=\"sm\" className=\"ml-auto\" disabled={!writesAllowed || !text.trim() || isLoading || !board.boardKey} onClick={addComment}>\n Comment\n </Button>\n </div>\n </div>\n {resolvedCount > 0 && (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id=\"design-comment-show-resolved\"\n checked={showResolved}\n onCheckedChange={checked => onShowResolvedChange(checked === true)}\n />\n <Label htmlFor=\"design-comment-show-resolved\" className=\"font-normal text-muted-foreground\">\n Show {resolvedCount} resolved\n </Label>\n </div>\n )}\n {visibleThreads.length === 0 && <p className=\"text-sm text-muted-foreground\">No open comments on this board.</p>}\n {visibleThreads.map(thread => {\n const threadState = compareThreadState(thread.root, board, themeHash);\n return (\n <ThreadCard\n key={String(thread.root.id)}\n thread={thread}\n onCopyReference={onCopyThreadReference}\n onSelectViewport={onSelectViewport}\n isHighlighted={highlightedCommentId === Number(thread.root.id)}\n onHighlight={() => onHighlightComment(Number(thread.root.id))}\n authAccountId={authAccountId}\n writesAllowed={writesAllowed}\n hasBoardChangedSince={threadState.hasBoardChangedSince}\n hasDependenciesOrThemeChangedSince={threadState.hasDependenciesOrThemeChangedSince}\n commentedVersionUrl={threadState.commentedVersionUrl}\n isExpiring={expiringCommentIds.has(Number(thread.root.id))}\n />\n );\n })}\n </div>\n );\n};\n","/**\n * The state a comment thread was written on (board version, what the board pulled in, the theme) compared with the\n * board as it is shown now, and the URL of the commented version. Pure functions, no React (tested in\n * threadState.test.ts).\n */\n\n/** What a thread root keeps of the state it was written on (a subset of DesignStudioComment). */\nexport interface ThreadStateOfComment {\n /** Version of the board file (git blob hash). */\n contentHash?: string | null;\n /** What the board pulled in (its asset files); null = nothing, or a thread older than the value. */\n dependenciesHash?: string | null;\n /** Theme reference; null = no theme, or a thread older than the value. */\n themeReference?: string | null;\n /** Hash of the theme style; null = no theme, or a thread older than the value. */\n themeHash?: string | null;\n /** Set when the studio kept the commented state (a configured object store). */\n snapshotObjectKey?: string | null;\n}\n\n/** The board as shown now (a subset of DesignStudioBoardView) and the hash of the shown theme. */\nexport interface ShownBoardState {\n contentHash?: string | null;\n dependenciesHash?: string | null;\n /** The board's delivery URL (`htmlUrl`), carrying the content token. */\n htmlUrl?: string | null;\n}\n\nexport interface ThreadStateComparison {\n /** The board file is another version than the one the thread was written on. */\n hasBoardChangedSince: boolean;\n /** What the board pulls in or its theme differs from the thread's state (never for a thread without the values). */\n hasDependenciesOrThemeChangedSince: boolean;\n /** The URL of the commented state, null when nothing changed, nothing was kept or the board has no URL. */\n commentedVersionUrl: string | null;\n}\n\n/**\n * The board's delivery URL in the thread's state: `contentHash`, `assetsHash` (the thread's dependencies hash) and,\n * when the thread kept a theme, `theme` / `themeHash` replace the current ones. A thread without a dependencies hash\n * drops `assetsHash` (the board version's kept files, as before states were kept); a thread without a theme keeps the\n * current look (its look is unknown). The token and every other parameter stay.\n */\nexport const buildCommentedVersionUrl = (currentHtmlUrl: string, comment: ThreadStateOfComment): string | null => {\n if (!currentHtmlUrl || !comment.contentHash) return null;\n const queryStart = currentHtmlUrl.indexOf('?');\n const path = queryStart === -1 ? currentHtmlUrl : currentHtmlUrl.slice(0, queryStart);\n const params = new URLSearchParams(queryStart === -1 ? '' : currentHtmlUrl.slice(queryStart + 1));\n params.set('contentHash', comment.contentHash);\n if (comment.dependenciesHash) params.set('assetsHash', comment.dependenciesHash);\n else params.delete('assetsHash');\n if (comment.themeReference && comment.themeHash) {\n params.set('theme', comment.themeReference);\n params.set('themeHash', comment.themeHash);\n }\n return `${path}?${params.toString()}`;\n};\n\n/**\n * Compares a thread root with the board as shown now. A value the thread does not have (a thread older than it, or\n * nothing pulled in / no theme then) never counts as changed. The commented version is offered when something changed\n * and the studio kept the state.\n */\nexport const compareThreadState = (\n comment: ThreadStateOfComment,\n board: ShownBoardState,\n shownThemeHash: string | null | undefined\n): ThreadStateComparison => {\n const hasBoardChangedSince =\n Boolean(comment.contentHash && board.contentHash) && comment.contentHash !== board.contentHash;\n const hasDependenciesChangedSince =\n Boolean(comment.dependenciesHash) && comment.dependenciesHash !== (board.dependenciesHash ?? null);\n const hasThemeChangedSince =\n Boolean(comment.themeHash) && shownThemeHash !== undefined && comment.themeHash !== (shownThemeHash ?? null);\n const hasDependenciesOrThemeChangedSince = hasDependenciesChangedSince || hasThemeChangedSince;\n const commentedVersionUrl =\n (hasBoardChangedSince || hasDependenciesOrThemeChangedSince) && comment.snapshotObjectKey && board.htmlUrl\n ? buildCommentedVersionUrl(board.htmlUrl, comment)\n : null;\n return { hasBoardChangedSince, hasDependenciesOrThemeChangedSince, commentedVersionUrl };\n};\n","'use client';\n\nimport { RotateCw, Smartphone } from 'lucide-react';\nimport { useRef } from 'react';\n\nimport type { DesignDevice } from '../api/types';\nimport { useDesignStudio } from '../provider/DesignStudioProvider';\nimport { type DeviceViewport, rotateViewport, viewportLabel, viewportOfDevice } from './deviceViewport';\n\n/** Viewport controls of a responsive board (focus view, site view): device picker, rotation, width handle. */\nexport interface ViewportToolbarProps {\n devices: readonly DesignDevice[];\n viewport: DeviceViewport;\n /** Open pins placed in other viewport widths (not shown in this one). */\n hiddenPinCount: number;\n showsDeviceFrame: boolean;\n onShowsDeviceFrameChange: (showsDeviceFrame: boolean) => void;\n onViewportChange: (viewport: DeviceViewport) => void;\n}\n\n/** Device picker (presets), landscape / portrait, the current size and the device frame switch of a responsive board. */\nexport const ViewportToolbar = ({\n devices,\n viewport,\n hiddenPinCount,\n showsDeviceFrame,\n onShowsDeviceFrameChange,\n onViewportChange,\n}: ViewportToolbarProps) => {\n const { components } = useDesignStudio();\n const { Button } = components;\n return (\n <div className=\"flex flex-wrap items-center gap-2 border-b border-border px-5 py-2 text-sm\">\n <label className=\"flex items-center gap-2\">\n <span className=\"sr-only\">Device</span>\n <select\n className=\"h-8 rounded-lg border border-border bg-card px-2 text-sm\"\n value={viewport.deviceKey ?? ''}\n onChange={event => {\n const device = devices.find(candidate => candidate.deviceKey === event.target.value);\n if (device) onViewportChange(viewportOfDevice(device));\n }}\n >\n {viewport.deviceKey === null && <option value=\"\">Free width</option>}\n {devices.map(device => (\n <option key={device.deviceKey ?? ''} value={device.deviceKey ?? ''}>\n {device.label} · {device.width} × {device.height}\n </option>\n ))}\n </select>\n </label>\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label=\"Rotate (landscape / portrait)\"\n onClick={() => onViewportChange(rotateViewport(viewport, devices))}\n >\n <RotateCw /> Rotate\n </Button>\n <span className=\"text-muted-foreground tabular-nums\">{viewportLabel(viewport, devices)}</span>\n <Button\n variant={showsDeviceFrame ? 'default' : 'outline'}\n size=\"sm\"\n aria-pressed={showsDeviceFrame}\n onClick={() => onShowsDeviceFrameChange(!showsDeviceFrame)}\n >\n <Smartphone /> Device frame\n </Button>\n {hiddenPinCount > 0 && (\n <span className=\"ml-auto text-xs text-muted-foreground\">\n {hiddenPinCount} open pin(s) in other widths — pick their size in the comment list\n </span>\n )}\n </div>\n );\n};\n\nexport interface WidthDragHandleProps {\n /** Scale the viewport is drawn at (screen pixels per page pixel). */\n scale: number;\n width: number;\n onWidthChange: (width: number) => void;\n}\n\n/** The handle at the right edge of the viewport: dragging it sets a free width (page pixels). */\nexport const WidthDragHandle = ({ scale, width, onWidthChange }: WidthDragHandleProps) => {\n const dragStartRef = useRef<{ clientX: number; width: number } | null>(null);\n return (\n <button\n type=\"button\"\n aria-label={`Viewport width ${width} px: drag to change`}\n 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\"\n onPointerDown={event => {\n event.currentTarget.setPointerCapture(event.pointerId);\n dragStartRef.current = { clientX: event.clientX, width };\n }}\n onPointerMove={event => {\n const dragStart = dragStartRef.current;\n if (!dragStart) return;\n onWidthChange(dragStart.width + (event.clientX - dragStart.clientX) / Math.max(0.05, scale));\n }}\n onPointerUp={() => {\n dragStartRef.current = null;\n }}\n onKeyDown={event => {\n if (event.key === 'ArrowLeft') onWidthChange(width - 10);\n if (event.key === 'ArrowRight') onWidthChange(width + 10);\n }}\n />\n );\n};\n","'use client';\n\nimport { useEffect, useState } from 'react';\n\n/**\n * Loads a board's delivery URL (HTML) before an iframe shows it. An `<iframe src>` renders whatever the server answers —\n * on a storage error that was the raw error JSON on top of the thumbnail. The URL is fetched first (at most\n * MAX_CONCURRENT_LOADS at once across the canvas, so a zoom does not fire every board at the object storage); only a 2xx\n * answer is handed to the iframe, which then reads it from the browser cache (the endpoint answers `private,\n * immutable`). A failed load leaves the thumbnail in place and is retried with growing delays while the board stays\n * live.\n */\nconst MAX_CONCURRENT_LOADS = 2;\n\n/** Delays (ms) before the next attempt after a failure; the last one repeats. */\nconst RETRY_DELAYS_MS = [2000, 5000, 15000, 30000];\n\n/**\n * URLs already loaded successfully in this page, least recently used first (a remount shows them at once; the browser\n * cache holds the bytes). Bounded: it also decides which boards remount their live HTML outside the live set.\n */\nconst MAX_REMEMBERED_URLS = 24;\nconst loadedUrls = new Set<string>();\n\nconst rememberLoadedUrl = (url: string) => {\n loadedUrls.delete(url);\n loadedUrls.add(url);\n while (loadedUrls.size > MAX_REMEMBERED_URLS) {\n const oldestUrl = loadedUrls.values().next().value;\n if (oldestUrl === undefined) break;\n loadedUrls.delete(oldestUrl);\n }\n};\n\n/** Whether this board HTML URL (content hash + theme in its query) was shown live before in this page. */\nexport const wasContentUrlLoaded = (url: string | undefined): boolean => Boolean(url && loadedUrls.has(url));\n\nlet activeLoads = 0;\nconst waitingLoads: Array<() => void> = [];\n\nconst acquireLoadSlot = (): Promise<void> =>\n new Promise(resolve => {\n if (activeLoads < MAX_CONCURRENT_LOADS) {\n activeLoads += 1;\n resolve();\n return;\n }\n waitingLoads.push(() => {\n activeLoads += 1;\n resolve();\n });\n });\n\nconst releaseLoadSlot = () => {\n activeLoads -= 1;\n waitingLoads.shift()?.();\n};\n\nconst loadUrl = async (url: string, signal: AbortSignal): Promise<boolean> => {\n await acquireLoadSlot();\n try {\n if (signal.aborted) return false;\n const response = await fetch(url, { signal, credentials: 'omit', referrerPolicy: 'no-referrer' });\n if (!response.ok) return false;\n // read the whole body so the browser cache holds the complete answer for the iframe\n await response.blob();\n return true;\n } catch {\n // network error or abort: the caller retries while the board is still live\n return false;\n } finally {\n releaseLoadSlot();\n }\n};\n\n/**\n * @param url the delivery URL, undefined when nothing should load (board not live)\n * @returns the URL once it answered 2xx, else undefined (show the thumbnail)\n */\nexport const useCheckedContentUrl = (url: string | undefined): string | undefined => {\n const [checkedUrl, setCheckedUrl] = useState<string | undefined>(() =>\n url && loadedUrls.has(url) ? url : undefined\n );\n\n useEffect(() => {\n if (!url) {\n setCheckedUrl(undefined);\n return;\n }\n if (loadedUrls.has(url)) {\n rememberLoadedUrl(url);\n setCheckedUrl(url);\n return;\n }\n setCheckedUrl(undefined);\n const abortController = new AbortController();\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n let attempt = 0;\n const tryLoad = async () => {\n const isLoaded = await loadUrl(url, abortController.signal);\n if (abortController.signal.aborted) return;\n if (isLoaded) {\n rememberLoadedUrl(url);\n setCheckedUrl(url);\n return;\n }\n const delay = RETRY_DELAYS_MS[Math.min(attempt, RETRY_DELAYS_MS.length - 1)];\n attempt += 1;\n retryTimer = setTimeout(tryLoad, delay);\n };\n void tryLoad();\n return () => {\n abortController.abort();\n if (retryTimer) clearTimeout(retryTimer);\n };\n }, [url]);\n\n return checkedUrl;\n};\n\n/**\n * Retries a failed `<img>` (a thumbnail answered with an error): the image is hidden, and after a growing delay it is\n * mounted again under a new key, which requests the URL once more (error answers are not cached).\n * @returns the key for the `<img>`, whether it failed (hide it until the retry) and its `onError` handler\n */\nexport const useImageRetry = (url: string | undefined) => {\n const [attempt, setAttempt] = useState(0);\n const [isFailed, setIsFailed] = useState(false);\n const [previousUrl, setPreviousUrl] = useState(url);\n // a new URL (another theme, a new token window) starts over (state reset during render, no effect needed)\n if (url !== previousUrl) {\n setPreviousUrl(url);\n setAttempt(0);\n setIsFailed(false);\n }\n\n useEffect(() => {\n if (!isFailed) return;\n const retryTimer = setTimeout(\n () => {\n setIsFailed(false);\n setAttempt(previousAttempt => previousAttempt + 1);\n },\n RETRY_DELAYS_MS[Math.min(attempt, RETRY_DELAYS_MS.length - 1)]\n );\n return () => clearTimeout(retryTimer);\n }, [isFailed, attempt]);\n\n return { imageKey: `${url ?? ''}#${attempt}`, isFailed, onError: () => setIsFailed(true) };\n};\n","/**\n * The site view: a canvas as a clickable website. Boards with a `route` are its pages; a link clicked inside a board\n * (reported by the board's navigation script, see the backend's DesignBoardContentService::addSiteNavigationScript;\n * `#anchors` the page scrolls to itself) is resolved here to a page, an external link (not followed) or a missing\n * page. Pure functions, no React\n * (tested in siteNavigation.test.ts).\n */\n\nimport type { DesignStudioBoardView } from '../api/types';\n\n/** Where a clicked link leads. */\nexport type SiteLinkTarget =\n | { kind: 'page'; board: DesignStudioBoardView; route: string; hash: string | null }\n | { kind: 'anchor'; hash: string }\n | { kind: 'external'; href: string }\n | { kind: 'missing'; path: string };\n\n/** A message of the board's navigation script. */\nexport type SiteFrameMessage =\n | { type: 'navigate'; href: string }\n | { type: 'scroll'; top: number }\n | { type: 'height'; height: number };\n\n/** `/pricing/` → `/pricing`, `pricing` → `/pricing`, `` → `/`; null when it is no plain path. */\nexport const normalizeSitePath = (path: string): string | null => {\n const trimmed = path.trim();\n if (/[?#]/.test(trimmed) || trimmed.includes('..') || trimmed.includes('//')) return null;\n const segments = trimmed.split('/').filter(segment => segment !== '' && segment !== '.');\n return `/${segments.join('/')}`;\n};\n\n/** The pages of a canvas: route → board (boards without a route are no page). */\nexport const sitePagesOf = (boards: readonly DesignStudioBoardView[]): Map<string, DesignStudioBoardView> => {\n const pages = new Map<string, DesignStudioBoardView>();\n for (const board of boards) {\n if (board.route && !pages.has(board.route)) pages.set(board.route, board);\n }\n return pages;\n};\n\n/** The route a site view opens at: the given one when it is a page, else `/`, else the first page. */\nexport const startRouteOf = (pages: ReadonlyMap<string, DesignStudioBoardView>, route: string | null): string | null => {\n const normalized = route !== null ? normalizeSitePath(route) : null;\n if (normalized !== null && pages.has(normalized)) return normalized;\n if (pages.has('/')) return '/';\n return pages.keys().next().value ?? null;\n};\n\n/**\n * Resolves the `href` of a clicked link: `#x` an anchor on the page, `board:<file>` the board with that file name\n * (its route, else no page), `/path` or a relative `path` (relative to the current page's folder) a page by its route,\n * anything with a scheme or `//` external.\n */\nexport const resolveSiteHref = (\n href: string,\n currentRoute: string,\n boards: readonly DesignStudioBoardView[]\n): SiteLinkTarget => {\n const trimmed = href.trim();\n if (trimmed === '' || trimmed.startsWith('#')) return { kind: 'anchor', hash: trimmed };\n if (trimmed.startsWith('board:')) {\n const boardKey = trimmed.slice('board:'.length).split('#')[0];\n const board = boards.find(candidate => candidate.boardKey === boardKey);\n return board?.route\n ? { kind: 'page', board, route: board.route, hash: null }\n : { kind: 'missing', path: trimmed };\n }\n if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed) || trimmed.startsWith('//')) return { kind: 'external', href: trimmed };\n const hashIndex = trimmed.indexOf('#');\n const hash = hashIndex >= 0 ? trimmed.slice(hashIndex) : null;\n const pathWithQuery = hashIndex >= 0 ? trimmed.slice(0, hashIndex) : trimmed;\n const path = pathWithQuery.split('?')[0];\n const absolutePath = path.startsWith('/')\n ? path\n : `${currentRoute.endsWith('/') ? currentRoute : currentRoute.slice(0, currentRoute.lastIndexOf('/') + 1)}${path}`;\n const route = normalizeSitePath(absolutePath);\n const board = route !== null ? sitePagesOf(boards).get(route) : undefined;\n return board && route !== null ? { kind: 'page', board, route, hash } : { kind: 'missing', path: route ?? path };\n};\n\n/** The message of the board's navigation script, null for anything else. */\nexport const parseSiteFrameMessage = (data: unknown): SiteFrameMessage | null => {\n if (typeof data !== 'object' || data === null) return null;\n const message = data as Record<string, unknown>;\n if (message.source !== 'design-studio-site') return null;\n if (message.type === 'navigate' && typeof message.href === 'string') return { type: 'navigate', href: message.href };\n if (message.type === 'scroll' && typeof message.top === 'number' && Number.isFinite(message.top)) {\n return { type: 'scroll', top: Math.max(0, Math.round(message.top)) };\n }\n if (message.type === 'height' && typeof message.height === 'number' && Number.isFinite(message.height)) {\n return { type: 'height', height: Math.max(1, Math.min(100_000, Math.round(message.height))) };\n }\n return null;\n};\n"],"mappings":";;;AASO,IAAM,YAAY;AAGlB,IAAM,qBAAqB;AAG3B,IAAM,yBAAyB;AAC/B,IAAM,yBAAyB;AAG/B,IAAM,yBAAyB;AAY/B,IAAM,oBAAoB,CAAC,UAChC,QAAQ,OAAO,iBAAiB,MAAM,QAAQ,UAAU,UAAU,KAAK,CAAC;AAEnE,IAAM,WAAW,CAAC,UACvB,O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U,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,KAAS,KAAK,MAAM,QAAQ,MAAM,CAAC,CAAC,EAAE;AAAA,EAC9F;AACA,SAAO;AACT;","names":["jsx","jsx","jsxs","useState","board"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,12 @@ interface DesignStudioComment {
|
|
|
57
57
|
isDecision: boolean | null;
|
|
58
58
|
/** Object key of the board file as it was when the thread started (thread roots only) */
|
|
59
59
|
snapshotObjectKey?: string | null;
|
|
60
|
+
/** What the board pulled in when the thread started (its asset files and design system files; thread roots only); null = nothing, or an older thread */
|
|
61
|
+
dependenciesHash?: string | null;
|
|
62
|
+
/** Theme reference the thread was written in (thread roots only); null = no theme, or an older thread */
|
|
63
|
+
themeReference?: string | null;
|
|
64
|
+
/** Hash of the theme style the thread was written in (thread roots only; the style is kept); null = no theme, or an older thread */
|
|
65
|
+
themeHash?: string | null;
|
|
60
66
|
/** Last activity in the thread (comment, reply, resolve, reopen, keep); set on the thread root, drives expiry */
|
|
61
67
|
lastActivityAt?: string | null;
|
|
62
68
|
objectType?: string | null;
|
|
@@ -77,6 +83,8 @@ interface DesignStudioBoardStatus {
|
|
|
77
83
|
status: string | null;
|
|
78
84
|
/** Content hash of the board file when the status was set (git blob hash) */
|
|
79
85
|
contentHash?: string | null;
|
|
86
|
+
/** What the board pulled in when the status was set (its asset files and design system files); null = nothing, or an older status */
|
|
87
|
+
dependenciesHash?: string | null;
|
|
80
88
|
/** Id of the account that set the status; no relation, the account may be gone */
|
|
81
89
|
changedByAccountId?: number | null;
|
|
82
90
|
/** Who set the status, as shown in the studio */
|
|
@@ -127,10 +135,14 @@ interface DesignStudioBoardView {
|
|
|
127
135
|
displayOrder?: number;
|
|
128
136
|
/** Content hash of the board file (git blob hash) */
|
|
129
137
|
contentHash?: string | null;
|
|
138
|
+
/** What the delivered board pulls in (its asset files and, on a canvas with a design system, the system's files; the `assetsHash` of `htmlUrl`); null = nothing */
|
|
139
|
+
dependenciesHash?: string | null;
|
|
130
140
|
/** Review status (one of the configured statuses; the default without a stored one) */
|
|
131
141
|
status?: string | null;
|
|
132
142
|
/** The board file changed after the status was set */
|
|
133
143
|
hasChangedSinceStatus?: boolean;
|
|
144
|
+
/** What the board pulls in (its asset files and design system files) changed after the status was set */
|
|
145
|
+
hasDependenciesChangedSinceStatus?: boolean;
|
|
134
146
|
/** Comment threads on the board that are not resolved */
|
|
135
147
|
openThreadCount?: number;
|
|
136
148
|
/** URL of the board for the sandboxed iframe (carries the content token) */
|
|
@@ -190,7 +202,7 @@ interface DesignDevice {
|
|
|
190
202
|
interface DesignStudioThumbnailRenderFailure {
|
|
191
203
|
/** The board key, `<boardKey>@<deviceKey>` for a device frame */
|
|
192
204
|
renderTargetKey?: string | null;
|
|
193
|
-
/** Version of the board that failed (`<contentHash>:<
|
|
205
|
+
/** Version of the board that failed (`<contentHash>:<dependenciesHash>`) */
|
|
194
206
|
boardVersion?: string | null;
|
|
195
207
|
/** Why the picture is missing */
|
|
196
208
|
error?: string | null;
|
|
@@ -218,15 +230,19 @@ interface DesignStudioCanvasView {
|
|
|
218
230
|
label?: string | null;
|
|
219
231
|
/** Reference of the theme the delivery URLs and thumbnails are in, null = no theme */
|
|
220
232
|
themeReference?: string | null;
|
|
233
|
+
/** Hash of that theme's style (part of every `htmlUrl`), null = no theme */
|
|
234
|
+
themeHash?: string | null;
|
|
221
235
|
/** Reference of the theme the canvas names as its usual look */
|
|
222
236
|
referenceTheme?: string | null;
|
|
237
|
+
/** The canvas can be shown in themes: the application offers themes, or the canvas' design system has theme files */
|
|
238
|
+
hasThemes?: boolean;
|
|
223
239
|
sections?: DesignDirectorySections;
|
|
224
240
|
boards?: DesignStudioBoardViews;
|
|
225
241
|
/** Problems found while reading the folder (missing files, oversized boards) */
|
|
226
242
|
warnings?: string[];
|
|
227
243
|
/** The configured status keys in display order */
|
|
228
244
|
statuses?: string[];
|
|
229
|
-
/** Fingerprint of boards, comments and
|
|
245
|
+
/** Fingerprint of boards, asset files, comments, statuses and the shown theme's style */
|
|
230
246
|
revision?: string | null;
|
|
231
247
|
/** Thumbnails are rendered and shown */
|
|
232
248
|
isRendererEnabled?: boolean;
|
|
@@ -284,7 +300,7 @@ interface DesignStudioOverview {
|
|
|
284
300
|
statuses?: string[];
|
|
285
301
|
/** Thumbnails are rendered and shown */
|
|
286
302
|
isRendererEnabled?: boolean;
|
|
287
|
-
/** The application offers themes (looks) for the boards */
|
|
303
|
+
/** The application's theme provider offers themes (looks) for the boards; a canvas with a design system may have theme files of its own (`hasThemes` of the canvas view) */
|
|
288
304
|
hasThemes?: boolean;
|
|
289
305
|
/** Days a thread may be idle before it is deleted */
|
|
290
306
|
threadIdleDays?: number;
|
|
@@ -294,7 +310,7 @@ interface DesignStudioOverview {
|
|
|
294
310
|
}
|
|
295
311
|
/** A look the application offers for the boards. */
|
|
296
312
|
interface DesignTheme {
|
|
297
|
-
/** Id the application's theme provider resolves (no `:light` / `:dark` suffix) */
|
|
313
|
+
/** Id the application's theme provider resolves, or the name of a theme file of the canvas' design system (no `:light` / `:dark` suffix) */
|
|
298
314
|
themeId?: string | null;
|
|
299
315
|
/** Name shown in the theme switcher */
|
|
300
316
|
label?: string | null;
|
|
@@ -316,7 +332,7 @@ interface DesignStudioCanvasResponse {
|
|
|
316
332
|
designStudioCanvasView: DesignStudioCanvasView;
|
|
317
333
|
}
|
|
318
334
|
interface DesignStudioCanvasRevisionResponse {
|
|
319
|
-
/** Changes with every board file, position, comment and status of the canvas */
|
|
335
|
+
/** Changes with every board file, asset file, position, comment and status of the canvas and with the shown theme's style */
|
|
320
336
|
revision: string;
|
|
321
337
|
}
|
|
322
338
|
interface DesignStudioBoardStatusResponse {
|
|
@@ -376,6 +392,10 @@ interface DesignStudioSharedParams {
|
|
|
376
392
|
interface DesignStudioThemesArg extends DesignStudioSharedParams {
|
|
377
393
|
/** Text the theme name contains */
|
|
378
394
|
search?: string;
|
|
395
|
+
/** With `canvasKey`: the themes of that canvas (the provider's, then the theme files of its design system) */
|
|
396
|
+
projectKey?: string;
|
|
397
|
+
/** With `projectKey`: the themes of that canvas; omitted = the provider's themes only */
|
|
398
|
+
canvasKey?: string;
|
|
379
399
|
}
|
|
380
400
|
interface DesignStudioCanvasArg extends DesignStudioSharedParams {
|
|
381
401
|
projectKey: string;
|
|
@@ -434,6 +454,8 @@ interface DesignStudioCommentCreateArg extends DesignStudioBoardArg {
|
|
|
434
454
|
deviceKey?: string | null;
|
|
435
455
|
/** Marks the comment as a decision */
|
|
436
456
|
isDecision?: boolean | null;
|
|
457
|
+
/** Theme reference the board is shown in (`themeReference` of the canvas); omitted = the reference theme of the canvas */
|
|
458
|
+
theme?: string | null;
|
|
437
459
|
};
|
|
438
460
|
}
|
|
439
461
|
interface DesignStudioCommentArg extends DesignStudioSharedParams {
|
|
@@ -975,6 +997,16 @@ interface DesignStudioTexts {
|
|
|
975
997
|
exportSvgLostEffects: string;
|
|
976
998
|
/** Button that saves the SVG file. */
|
|
977
999
|
exportSvgDownload: string;
|
|
1000
|
+
/** Badge of a comment thread: what the board pulls in (asset files) or its theme changed since the thread was written. */
|
|
1001
|
+
threadDependenciesChangedSince: string;
|
|
1002
|
+
/** Tooltip of that badge. */
|
|
1003
|
+
threadDependenciesChangedSinceTitle: string;
|
|
1004
|
+
/** Link of a comment thread: opens the board in the state the thread was written on. */
|
|
1005
|
+
showCommentedVersion: string;
|
|
1006
|
+
/** Next to the board status: the board's asset files changed after the status was set. */
|
|
1007
|
+
statusDependenciesChangedSince: string;
|
|
1008
|
+
/** Tooltip of that hint. */
|
|
1009
|
+
statusDependenciesChangedSinceTitle: string;
|
|
978
1010
|
}
|
|
979
1011
|
/** Everything the studio takes from the application it runs in (`DesignStudioProvider`). */
|
|
980
1012
|
interface DesignStudioEnvironment {
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
useDesignStudioRouter,
|
|
37
37
|
useDesignStudioTexts,
|
|
38
38
|
viewportWithWidth
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-PCXDVGGG.js";
|
|
40
40
|
|
|
41
41
|
// src/api/createDesignStudioApi.ts
|
|
42
42
|
var DESIGN_STUDIO_TAG = "DesignStudio";
|
|
@@ -58,7 +58,13 @@ var createDesignStudioApi = ({
|
|
|
58
58
|
designStudioThemes: build.query({
|
|
59
59
|
query: (arg) => ({
|
|
60
60
|
url: `${apiPrefix}/themes`,
|
|
61
|
-
params: {
|
|
61
|
+
params: {
|
|
62
|
+
search: arg.search,
|
|
63
|
+
projectKey: arg.projectKey,
|
|
64
|
+
canvasKey: arg.canvasKey,
|
|
65
|
+
noCache: arg.noCache,
|
|
66
|
+
outputFormat: arg.outputFormat
|
|
67
|
+
}
|
|
62
68
|
}),
|
|
63
69
|
providesTags: PROVIDED
|
|
64
70
|
}),
|
|
@@ -752,7 +758,9 @@ var DesignStudioSiteScreen = ({ projectKey, canvasKey, route }) => {
|
|
|
752
758
|
onShowResolvedChange: setShowResolved,
|
|
753
759
|
pinHint: "\u201CAdd pin\u201D marks a spot on the page",
|
|
754
760
|
onCopyThreadReference: () => void 0,
|
|
755
|
-
onSelectViewport: isResponsiveBoard(board) ? setChosenViewport : void 0
|
|
761
|
+
onSelectViewport: isResponsiveBoard(board) ? setChosenViewport : void 0,
|
|
762
|
+
themeReference: canvas?.themeReference ?? null,
|
|
763
|
+
themeHash: canvas?.themeHash ?? null
|
|
756
764
|
}
|
|
757
765
|
) })
|
|
758
766
|
] })
|