@mgamadeus/ddd-design-studio 0.4.1 → 0.5.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.
@@ -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/ViewportControls.tsx","../src/canvas/useCheckedContentUrl.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/** 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","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 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};\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, Flag, History, Hourglass, MapPin, RotateCcw, Trash2 } from 'lucide-react';\nimport { useState } from 'react';\n\nimport type { DesignStudioBoardView, DesignStudioComment } from '../api/types';\nimport { useDesignStudio } from '../provider/DesignStudioProvider';\nimport { cx } from '../utils/cx';\nimport { type DeviceViewport, viewportOfComment } from './deviceViewport';\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 /** 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 isExpiring,\n onSelectViewport,\n}: ThreadCardProps) => {\n const { root, replies, pinNumber } = thread;\n const rootViewport = viewportOfComment(root);\n const [replyText, setReplyText] = useState('');\n const { api, components, notify } = useDesignStudio();\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 {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 <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}\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}: 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 },\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 <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={\n Boolean(thread.root.contentHash && board.contentHash) && thread.root.contentHash !== board.contentHash\n }\n isExpiring={expiringCommentIds.has(Number(thread.root.id))}\n />\n ))}\n </div>\n );\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"],"mappings":";;;AASO,IAAM,YAAY;AAGlB,IAAM,qBAAqB;AA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AU,YAAY;AAC1B,YAAM,WAAW,MAAM,QAAQ,KAAK,gBAAgB,MAAM;AAC1D,UAAI,gBAAgB,OAAO,QAAS;AACpC,UAAI,UAAU;AACZ,0BAAkB,GAAG;AACrB,sBAAc,GAAG;AACjB;AAAA,MACF;AACA,YAAM,QAAQ,gBAAgB,KAAK,IAAI,SAAS,gBAAgB,SAAS,CAAC,CAAC;AAC3E,iBAAW;AACX,mBAAa,WAAW,SAAS,KAAK;AAAA,IACxC;AACA,SAAK,QAAQ;AACb,WAAO,MAAM;AACX,sBAAgB,MAAM;AACtB,UAAI,WAAY,cAAa,UAAU;AAAA,IACzC;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AACT;AAOO,IAAM,gBAAgB,CAAC,QAA4B;AACxD,QAAM,CAAC,SAAS,UAAU,IAAIA,UAAS,CAAC;AACxC,QAAM,CAAC,UAAU,WAAW,IAAIA,UAAS,KAAK;AAC9C,QAAM,CAAC,aAAa,cAAc,IAAIA,UAAS,GAAG;AAElD,MAAI,QAAQ,aAAa;AACvB,mBAAe,GAAG;AAClB,eAAW,CAAC;AACZ,gBAAY,KAAK;AAAA,EACnB;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,SAAU;AACf,UAAM,aAAa;AAAA,MACjB,MAAM;AACJ,oBAAY,KAAK;AACjB,mBAAW,qBAAmB,kBAAkB,CAAC;AAAA,MACnD;AAAA,MACA,gBAAgB,KAAK,IAAI,SAAS,gBAAgB,SAAS,CAAC,CAAC;AAAA,IAC/D;AACA,WAAO,MAAM,aAAa,UAAU;AAAA,EACtC,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,SAAO,EAAE,UAAU,GAAG,OAAO,EAAE,IAAI,OAAO,IAAI,UAAU,SAAS,MAAM,YAAY,IAAI,EAAE;AAC3F;","names":["jsx","jsx","jsxs","useState"]}
package/dist/index.d.ts CHANGED
@@ -625,6 +625,11 @@ interface DesignStudioPaths {
625
625
  overview: () => string;
626
626
  project: (projectKey: string) => string;
627
627
  canvas: (projectKey: string, canvasKey: string) => string;
628
+ /**
629
+ * Optional: the site view of a canvas at a page (`route` = `/`, `/pricing`; the application maps the rest of the
630
+ * path to `DesignStudioSiteScreen`'s `route`). Without it the canvas offers no "Open as website".
631
+ */
632
+ site?: (projectKey: string, canvasKey: string, route: string) => string;
628
633
  }
629
634
  type DesignStudioStatusTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'highlight' | 'brand';
630
635
  /** How one review status is shown. */
@@ -855,6 +860,12 @@ interface DesignStudioTexts {
855
860
  thumbnailMissing: string;
856
861
  /** Shown on a board card while its picture loads. */
857
862
  thumbnailLoading: string;
863
+ /** Site view: a clicked link names no page (`path` = the link's path). */
864
+ sitePageMissing: (path: string) => string;
865
+ /** Site view: a clicked link leads outside the design (not followed). */
866
+ siteExternalLink: (href: string) => string;
867
+ /** Canvas toolbar: opens the canvas as a clickable website. */
868
+ openAsWebsite: string;
858
869
  /** Placeholder of the note field in the focus view's reference panel. */
859
870
  referenceNotePlaceholder: string;
860
871
  /** Toast of a code link (`?code=`) or a pasted code that names no board (`code` = what was given). */
@@ -940,8 +951,25 @@ interface DesignStudioReviewsScreenProps {
940
951
  /** Reviews linked to boards (empty for now: review documents come with a later step of the studio). */
941
952
  declare const DesignStudioReviewsScreen: ({ description, emptyDescription, }: DesignStudioReviewsScreenProps) => react.JSX.Element;
942
953
 
954
+ interface DesignStudioSiteScreenProps {
955
+ projectKey: string;
956
+ canvasKey: string;
957
+ /** The page's path (`/`, `/pricing`) from the application's route; null / empty = the start page. */
958
+ route: string | null;
959
+ }
960
+ /**
961
+ * A canvas as a clickable website: the boards with a `route` are its pages, one at a time, full width in the chosen
962
+ * device: the page keeps the device's viewport height and scrolls itself (`vh` units as on the device). Links inside a
963
+ * page open the mapped page (a history entry per page: back / forward work), `#anchors` scroll, external links are
964
+ * not followed, a link without a page says so. Comments are placed on the page as on the canvas (page positions in the
965
+ * viewport they were placed in, the pins move with the page's scroll position; same threads). The look comes from the `theme` / `mode` query
966
+ * parameters, as on the canvas. The page runs the studio's navigation script only (opaque origin, the board's own
967
+ * scripts removed).
968
+ */
969
+ declare const DesignStudioSiteScreen: ({ projectKey, canvasKey, route }: DesignStudioSiteScreenProps) => react.JSX.Element;
970
+
943
971
  /** Conditional class names, later Tailwind classes winning over earlier ones (`clsx` + `tailwind-merge`). */
944
972
  declare const cx: (...inputs: ClassValue[]) => string;
945
973
 
946
- export { CODE_PARAM, DEFAULT_DESIGN_STUDIO_TEXTS, DESIGN_REFERENCE_PREFIX, DESIGN_STUDIO_TAG, DesignStudioOverviewScreen, DesignStudioProjectScreen, DesignStudioProvider, DesignStudioReviewsScreen, boardCodeMatches, boardCodeUrlValue, buildBoardCodeLink, buildBoardDeepLink, buildDesignReference, buildThemeReference, codeBelongsToCanvas, createDesignStudioApi, cx, findBoardForCode, normalizeBoardCode, resolveDesignStudioTexts, splitThemeReference, useDesignStudio, useDesignStudioApi, useDesignStudioComponents, useDesignStudioNotify, useDesignStudioPaths, useDesignStudioRouter, useDesignStudioTexts };
947
- export type { BoardRegion, CreateDesignStudioApiOptions, DesignDevice, DesignDevices, DesignDirectorySection, DesignDirectorySections, DesignReferenceInput, DesignStudioApi, DesignStudioBadgeProps, DesignStudioBaseApi, DesignStudioBaseQuery, DesignStudioBoardArg, DesignStudioBoardFrameView, DesignStudioBoardFrameViews, DesignStudioBoardStatus, DesignStudioBoardStatusPatchArg, DesignStudioBoardStatusResponse, DesignStudioBoardView, DesignStudioBoardViews, DesignStudioButtonProps, DesignStudioCanvasArg, DesignStudioCanvasCommentsArg, DesignStudioCanvasResponse, DesignStudioCanvasRevisionResponse, DesignStudioCanvasSummaries, DesignStudioCanvasSummary, DesignStudioCanvasView, DesignStudioChangeHistory, DesignStudioCheckboxProps, DesignStudioComboboxProps, DesignStudioComment, DesignStudioCommentArg, DesignStudioCommentCreateArg, DesignStudioCommentPatchArg, DesignStudioCommentReplyArg, DesignStudioCommentResolveArg, DesignStudioCommentResponse, DesignStudioComments, DesignStudioCommentsResponse, DesignStudioComponents, DesignStudioDeleteResponse, DesignStudioDialogContentProps, DesignStudioDialogProps, DesignStudioEnvironment, DesignStudioLinkProps, DesignStudioNotify, DesignStudioOption, DesignStudioOverview, DesignStudioOverviewResponse, DesignStudioOverviewScreenProps, DesignStudioPageHeaderProps, DesignStudioPaths, DesignStudioProjectScreenProps, DesignStudioProjectSummaries, DesignStudioProjectSummary, DesignStudioProviderProps, DesignStudioQuickFilterPillsProps, DesignStudioReviewsScreenProps, DesignStudioRouter, DesignStudioSearchFieldProps, DesignStudioSearchParamUpdates, DesignStudioSharedParams, DesignStudioShell, DesignStudioStatusBadgeProps, DesignStudioStatusCalloutProps, DesignStudioStatusDefinition, DesignStudioStatusTone, DesignStudioStatuses, DesignStudioStorage, DesignStudioStorageKey, DesignStudioTexts, DesignStudioThemesArg, DesignStudioThemesResponse, DesignStudioThumbnailRenderRequestArg, DesignStudioToastOptions, DesignStudioUrlState, DesignStudioUrlStateOptions, DesignTheme, DesignThemes, ThemeLook, ThemeMode };
974
+ export { CODE_PARAM, DEFAULT_DESIGN_STUDIO_TEXTS, DESIGN_REFERENCE_PREFIX, DESIGN_STUDIO_TAG, DesignStudioOverviewScreen, DesignStudioProjectScreen, DesignStudioProvider, DesignStudioReviewsScreen, DesignStudioSiteScreen, boardCodeMatches, boardCodeUrlValue, buildBoardCodeLink, buildBoardDeepLink, buildDesignReference, buildThemeReference, codeBelongsToCanvas, createDesignStudioApi, cx, findBoardForCode, normalizeBoardCode, resolveDesignStudioTexts, splitThemeReference, useDesignStudio, useDesignStudioApi, useDesignStudioComponents, useDesignStudioNotify, useDesignStudioPaths, useDesignStudioRouter, useDesignStudioTexts };
975
+ export type { BoardRegion, CreateDesignStudioApiOptions, DesignDevice, DesignDevices, DesignDirectorySection, DesignDirectorySections, DesignReferenceInput, DesignStudioApi, DesignStudioBadgeProps, DesignStudioBaseApi, DesignStudioBaseQuery, DesignStudioBoardArg, DesignStudioBoardFrameView, DesignStudioBoardFrameViews, DesignStudioBoardStatus, DesignStudioBoardStatusPatchArg, DesignStudioBoardStatusResponse, DesignStudioBoardView, DesignStudioBoardViews, DesignStudioButtonProps, DesignStudioCanvasArg, DesignStudioCanvasCommentsArg, DesignStudioCanvasResponse, DesignStudioCanvasRevisionResponse, DesignStudioCanvasSummaries, DesignStudioCanvasSummary, DesignStudioCanvasView, DesignStudioChangeHistory, DesignStudioCheckboxProps, DesignStudioComboboxProps, DesignStudioComment, DesignStudioCommentArg, DesignStudioCommentCreateArg, DesignStudioCommentPatchArg, DesignStudioCommentReplyArg, DesignStudioCommentResolveArg, DesignStudioCommentResponse, DesignStudioComments, DesignStudioCommentsResponse, DesignStudioComponents, DesignStudioDeleteResponse, DesignStudioDialogContentProps, DesignStudioDialogProps, DesignStudioEnvironment, DesignStudioLinkProps, DesignStudioNotify, DesignStudioOption, DesignStudioOverview, DesignStudioOverviewResponse, DesignStudioOverviewScreenProps, DesignStudioPageHeaderProps, DesignStudioPaths, DesignStudioProjectScreenProps, DesignStudioProjectSummaries, DesignStudioProjectSummary, DesignStudioProviderProps, DesignStudioQuickFilterPillsProps, DesignStudioReviewsScreenProps, DesignStudioRouter, DesignStudioSearchFieldProps, DesignStudioSearchParamUpdates, DesignStudioSharedParams, DesignStudioShell, DesignStudioSiteScreenProps, DesignStudioStatusBadgeProps, DesignStudioStatusCalloutProps, DesignStudioStatusDefinition, DesignStudioStatusTone, DesignStudioStatuses, DesignStudioStorage, DesignStudioStorageKey, DesignStudioTexts, DesignStudioThemesArg, DesignStudioThemesResponse, DesignStudioThumbnailRenderRequestArg, DesignStudioToastOptions, DesignStudioUrlState, DesignStudioUrlStateOptions, DesignTheme, DesignThemes, ThemeLook, ThemeMode };
package/dist/index.js CHANGED
@@ -1,29 +1,38 @@
1
1
  'use client';
2
2
  import {
3
+ BoardComments,
3
4
  CODE_PARAM,
4
5
  DEFAULT_DESIGN_STUDIO_TEXTS,
5
6
  DESIGN_REFERENCE_PREFIX,
6
7
  DesignStudioProvider,
8
+ ViewportToolbar,
9
+ WidthDragHandle,
7
10
  boardCodeMatches,
8
11
  boardCodeUrlValue,
9
12
  buildBoardCodeLink,
10
13
  buildBoardDeepLink,
14
+ buildCommentThreads,
11
15
  buildDesignReference,
12
16
  buildThemeReference,
13
17
  codeBelongsToCanvas,
14
18
  cx,
15
19
  findBoardForCode,
20
+ initialViewportForBoard,
21
+ isPinInViewport,
22
+ isResponsiveBoard,
16
23
  normalizeBoardCode,
17
24
  resolveDesignStudioTexts,
18
25
  splitThemeReference,
26
+ useCheckedContentUrl,
19
27
  useDesignStudio,
20
28
  useDesignStudioApi,
21
29
  useDesignStudioComponents,
22
30
  useDesignStudioNotify,
23
31
  useDesignStudioPaths,
24
32
  useDesignStudioRouter,
25
- useDesignStudioTexts
26
- } from "./chunk-D2DS4FPR.js";
33
+ useDesignStudioTexts,
34
+ viewportWithWidth
35
+ } from "./chunk-NCMXGWLC.js";
27
36
 
28
37
  // src/api/createDesignStudioApi.ts
29
38
  var DESIGN_STUDIO_TAG = "DesignStudio";
@@ -435,6 +444,361 @@ var DesignStudioReviewsScreen = ({
435
444
  /* @__PURE__ */ jsx3(StatusCallout, { icon: ClipboardCheck, title: "No reviews imported yet", description: emptyDescription })
436
445
  ] });
437
446
  };
447
+
448
+ // src/screens/DesignStudioSiteScreen.tsx
449
+ import { normalizeDddError as normalizeDddError3 } from "@mgamadeus/ddd-web/api";
450
+ import { ArrowLeft, MapPin, MapPinPlus, MessageSquare as MessageSquare2, X } from "lucide-react";
451
+ import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
452
+
453
+ // src/site/siteNavigation.ts
454
+ var normalizeSitePath = (path) => {
455
+ const trimmed = path.trim();
456
+ if (/[?#]/.test(trimmed) || trimmed.includes("..") || trimmed.includes("//")) return null;
457
+ const segments = trimmed.split("/").filter((segment) => segment !== "" && segment !== ".");
458
+ return `/${segments.join("/")}`;
459
+ };
460
+ var sitePagesOf = (boards) => {
461
+ const pages = /* @__PURE__ */ new Map();
462
+ for (const board of boards) {
463
+ if (board.route && !pages.has(board.route)) pages.set(board.route, board);
464
+ }
465
+ return pages;
466
+ };
467
+ var startRouteOf = (pages, route) => {
468
+ const normalized = route !== null ? normalizeSitePath(route) : null;
469
+ if (normalized !== null && pages.has(normalized)) return normalized;
470
+ if (pages.has("/")) return "/";
471
+ return pages.keys().next().value ?? null;
472
+ };
473
+ var resolveSiteHref = (href, currentRoute, boards) => {
474
+ const trimmed = href.trim();
475
+ if (trimmed === "" || trimmed.startsWith("#")) return { kind: "anchor", hash: trimmed };
476
+ if (trimmed.startsWith("board:")) {
477
+ const boardKey = trimmed.slice("board:".length).split("#")[0];
478
+ const board2 = boards.find((candidate) => candidate.boardKey === boardKey);
479
+ return board2?.route ? { kind: "page", board: board2, route: board2.route, hash: null } : { kind: "missing", path: trimmed };
480
+ }
481
+ if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed) || trimmed.startsWith("//")) return { kind: "external", href: trimmed };
482
+ const hashIndex = trimmed.indexOf("#");
483
+ const hash = hashIndex >= 0 ? trimmed.slice(hashIndex) : null;
484
+ const pathWithQuery = hashIndex >= 0 ? trimmed.slice(0, hashIndex) : trimmed;
485
+ const path = pathWithQuery.split("?")[0];
486
+ const absolutePath = path.startsWith("/") ? path : `${currentRoute.endsWith("/") ? currentRoute : currentRoute.slice(0, currentRoute.lastIndexOf("/") + 1)}${path}`;
487
+ const route = normalizeSitePath(absolutePath);
488
+ const board = route !== null ? sitePagesOf(boards).get(route) : void 0;
489
+ return board && route !== null ? { kind: "page", board, route, hash } : { kind: "missing", path: route ?? path };
490
+ };
491
+ var parseSiteFrameMessage = (data) => {
492
+ if (typeof data !== "object" || data === null) return null;
493
+ const message = data;
494
+ if (message.source !== "design-studio-site") return null;
495
+ if (message.type === "navigate" && typeof message.href === "string") return { type: "navigate", href: message.href };
496
+ if (message.type === "scroll" && typeof message.top === "number" && Number.isFinite(message.top)) {
497
+ return { type: "scroll", top: Math.max(0, Math.round(message.top)) };
498
+ }
499
+ if (message.type === "height" && typeof message.height === "number" && Number.isFinite(message.height)) {
500
+ return { type: "height", height: Math.max(1, Math.min(1e5, Math.round(message.height))) };
501
+ }
502
+ return null;
503
+ };
504
+
505
+ // src/screens/DesignStudioSiteScreen.tsx
506
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
507
+ var DesignStudioSiteScreen = ({ projectKey, canvasKey, route }) => {
508
+ const { api, apiBaseUrl, components, notify, paths, router, useCanWrite } = useDesignStudio();
509
+ const texts = useDesignStudioTexts();
510
+ const { Button, Skeleton, StatusCallout } = components;
511
+ const { Link } = router;
512
+ const navigate = router.useNavigate?.();
513
+ const searchParams = router.useSearchParams();
514
+ const writesAllowed = useCanWrite();
515
+ const themeId = searchParams.get("theme");
516
+ const mode = searchParams.get("mode") === "dark" ? "dark" : "light";
517
+ const themeArgument = themeId ? buildThemeReference(themeId, mode) : void 0;
518
+ const { data, isLoading, error } = api.useCanvasQuery({
519
+ projectKey,
520
+ canvasKey,
521
+ ...themeArgument ? { theme: themeArgument } : {}
522
+ });
523
+ const { data: commentsData } = api.useCanvasCommentsQuery({ projectKey, canvasKey });
524
+ const canvas = data?.designStudioCanvasView;
525
+ const boards = useMemo2(() => canvas?.boards?.elements ?? [], [canvas]);
526
+ const devices = useMemo2(() => canvas?.devices?.elements ?? [], [canvas]);
527
+ const pages = useMemo2(() => sitePagesOf(boards), [boards]);
528
+ const currentRoute = startRouteOf(pages, route);
529
+ const board = currentRoute !== null ? pages.get(currentRoute) ?? null : null;
530
+ const [chosenViewport, setChosenViewport] = useState2(null);
531
+ const viewport = initialViewportForBoard(board, chosenViewport) ?? (board ? chosenViewport ?? { width: board.width ?? 390, height: board.height ?? 844, deviceKey: null } : null);
532
+ const [pageScrollTop, setPageScrollTop] = useState2(0);
533
+ const [showsDeviceFrame, setShowsDeviceFrame] = useState2(false);
534
+ const [isCommenting, setIsCommenting] = useState2(false);
535
+ const [isPlacingPin, setIsPlacingPin] = useState2(false);
536
+ const [pendingPin, setPendingPin] = useState2(null);
537
+ const [highlightedCommentId, setHighlightedCommentId] = useState2(null);
538
+ const [showResolved, setShowResolved] = useState2(false);
539
+ const frameRef = useRef2(null);
540
+ const stageRef = useRef2(null);
541
+ const [stageWidth, setStageWidth] = useState2(0);
542
+ const boardKey = board?.boardKey ?? null;
543
+ useEffect2(() => {
544
+ if (boardKey === null) return;
545
+ setPageScrollTop(0);
546
+ setPendingPin(null);
547
+ setIsPlacingPin(false);
548
+ }, [boardKey]);
549
+ useEffect2(() => {
550
+ const stage = stageRef.current;
551
+ if (!stage || typeof ResizeObserver === "undefined") return;
552
+ const observer = new ResizeObserver(() => setStageWidth(stage.clientWidth));
553
+ observer.observe(stage);
554
+ setStageWidth(stage.clientWidth);
555
+ return () => observer.disconnect();
556
+ }, []);
557
+ const goToRoute = useCallback(
558
+ (nextRoute) => {
559
+ if (!paths.site) return;
560
+ const query = themeId ? `?theme=${encodeURIComponent(themeId)}&mode=${mode}` : "";
561
+ const href = `${paths.site(projectKey, canvasKey, nextRoute)}${query}`;
562
+ if (navigate) navigate(href);
563
+ else if (typeof window !== "undefined") window.location.assign(href);
564
+ },
565
+ [paths, projectKey, canvasKey, themeId, mode, navigate]
566
+ );
567
+ useEffect2(() => {
568
+ const onMessage = (event) => {
569
+ if (!frameRef.current || event.source !== frameRef.current.contentWindow) return;
570
+ const message = parseSiteFrameMessage(event.data);
571
+ if (!message || currentRoute === null) return;
572
+ if (message.type === "scroll") {
573
+ setPageScrollTop(message.top);
574
+ return;
575
+ }
576
+ if (message.type === "height") return;
577
+ const target = resolveSiteHref(message.href, currentRoute, boards);
578
+ if (target.kind === "page") {
579
+ if (target.route !== currentRoute) goToRoute(target.route);
580
+ } else if (target.kind === "external") {
581
+ notify.info(texts.siteExternalLink(target.href));
582
+ } else if (target.kind === "missing") {
583
+ notify.info(texts.sitePageMissing(target.path));
584
+ }
585
+ };
586
+ window.addEventListener("message", onMessage);
587
+ return () => window.removeEventListener("message", onMessage);
588
+ });
589
+ const width = viewport?.width ?? 390;
590
+ const screenHeight = viewport?.height ?? 844;
591
+ const bezelPadding = showsDeviceFrame ? 24 : 0;
592
+ const scale = stageWidth > 0 ? Math.min(1, (stageWidth - 48) / (width + bezelPadding)) : 1;
593
+ const siteHtmlUrl = board?.htmlUrl ? `${board.htmlUrl}&site=1` : null;
594
+ const htmlUrl = useCheckedContentUrl(siteHtmlUrl ? `${apiBaseUrl}${siteHtmlUrl}` : void 0);
595
+ const threads = useMemo2(
596
+ () => buildCommentThreads(
597
+ (commentsData?.designStudioComments.elements ?? []).filter((comment) => comment.boardKey === boardKey)
598
+ ),
599
+ [commentsData, boardKey]
600
+ );
601
+ const shownViewport = board && isResponsiveBoard(board) ? viewport : null;
602
+ const pinnedThreads = threads.filter(
603
+ (thread) => thread.pinNumber !== null && (showResolved || !thread.root.isResolved) && isPinInViewport(thread.root, shownViewport)
604
+ );
605
+ const placePin = (event) => {
606
+ const rect = event.currentTarget.getBoundingClientRect();
607
+ setPendingPin({
608
+ x: Math.round((event.clientX - rect.left) / scale),
609
+ y: Math.round((event.clientY - rect.top) / scale + pageScrollTop),
610
+ viewport: shownViewport
611
+ });
612
+ setIsPlacingPin(false);
613
+ setIsCommenting(true);
614
+ };
615
+ if (error) {
616
+ return /* @__PURE__ */ jsx4(
617
+ StatusCallout,
618
+ {
619
+ tone: "destructive",
620
+ title: "The site could not be loaded",
621
+ description: normalizeDddError3(error, "Request failed").message
622
+ }
623
+ );
624
+ }
625
+ if (isLoading || !canvas) return /* @__PURE__ */ jsx4(Skeleton, { className: "h-[70vh] w-full rounded-2xl" });
626
+ if (currentRoute === null || !board || !viewport) {
627
+ return /* @__PURE__ */ jsx4(
628
+ StatusCallout,
629
+ {
630
+ title: "This canvas has no pages",
631
+ description: 'A board becomes a page with "route": "/path" in canvas.json or <meta name="design-route" content="/path"> in its file.'
632
+ }
633
+ );
634
+ }
635
+ const requestedRoute = route ? route : "/";
636
+ const isRequestedRouteMissing = requestedRoute !== currentRoute && route !== null && route !== "";
637
+ return /* @__PURE__ */ jsxs4("div", { className: "flex h-[calc(100dvh-4rem)] min-h-0 flex-col overflow-hidden rounded-3xl bg-card ring-1 ring-foreground/5", children: [
638
+ /* @__PURE__ */ jsxs4("header", { className: "flex flex-wrap items-center gap-2 border-b border-border px-4 py-2", children: [
639
+ /* @__PURE__ */ jsxs4(Link, { href: paths.canvas(projectKey, canvasKey), className: "flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground", children: [
640
+ /* @__PURE__ */ jsx4(ArrowLeft, { className: "size-4", "aria-hidden": true }),
641
+ " ",
642
+ canvas.label ?? canvasKey
643
+ ] }),
644
+ /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "/" }),
645
+ /* @__PURE__ */ jsx4(
646
+ "select",
647
+ {
648
+ "aria-label": "Page",
649
+ className: "h-8 rounded-lg border border-border bg-card px-2 text-sm",
650
+ value: currentRoute,
651
+ onChange: (event) => goToRoute(event.target.value),
652
+ children: [...pages.entries()].map(([pageRoute, pageBoard]) => /* @__PURE__ */ jsxs4("option", { value: pageRoute, children: [
653
+ pageRoute,
654
+ " \xB7 ",
655
+ pageBoard.title ?? pageBoard.boardKey
656
+ ] }, pageRoute))
657
+ }
658
+ ),
659
+ isRequestedRouteMissing && /* @__PURE__ */ jsx4("span", { className: "text-xs text-warning", children: texts.sitePageMissing(requestedRoute) }),
660
+ /* @__PURE__ */ jsxs4("div", { className: "ml-auto flex items-center gap-2", children: [
661
+ /* @__PURE__ */ jsxs4(
662
+ Button,
663
+ {
664
+ variant: isPlacingPin ? "default" : "outline",
665
+ size: "sm",
666
+ disabled: !writesAllowed,
667
+ "aria-pressed": isPlacingPin,
668
+ onClick: () => setIsPlacingPin((placing) => !placing),
669
+ children: [
670
+ /* @__PURE__ */ jsx4(MapPinPlus, {}),
671
+ " ",
672
+ isPlacingPin ? "Click on the page\u2026" : "Add pin"
673
+ ]
674
+ }
675
+ ),
676
+ /* @__PURE__ */ jsxs4(
677
+ Button,
678
+ {
679
+ variant: isCommenting ? "default" : "outline",
680
+ size: "sm",
681
+ "aria-pressed": isCommenting,
682
+ onClick: () => setIsCommenting((open) => !open),
683
+ children: [
684
+ /* @__PURE__ */ jsx4(MessageSquare2, {}),
685
+ " ",
686
+ threads.filter((thread) => !thread.root.isResolved).length
687
+ ]
688
+ }
689
+ )
690
+ ] })
691
+ ] }),
692
+ /* @__PURE__ */ jsx4(
693
+ ViewportToolbar,
694
+ {
695
+ devices,
696
+ viewport,
697
+ hiddenPinCount: 0,
698
+ showsDeviceFrame,
699
+ onShowsDeviceFrameChange: setShowsDeviceFrame,
700
+ onViewportChange: setChosenViewport
701
+ }
702
+ ),
703
+ /* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1", children: [
704
+ /* @__PURE__ */ jsx4("div", { ref: stageRef, className: "flex min-h-0 flex-1 items-start justify-center overflow-auto bg-tint p-6", children: /* @__PURE__ */ jsx4("div", { style: { width: (width + bezelPadding) * scale, height: (screenHeight + bezelPadding) * scale }, children: /* @__PURE__ */ jsxs4(
705
+ "div",
706
+ {
707
+ className: cx("relative origin-top-left", showsDeviceFrame && "rounded-[28px] bg-foreground p-3 shadow-surface-raised"),
708
+ style: { transform: scale !== 1 ? `scale(${scale})` : void 0, width: width + bezelPadding },
709
+ children: [
710
+ /* @__PURE__ */ jsxs4("div", { className: "relative overflow-hidden bg-card", style: { width, height: screenHeight }, children: [
711
+ htmlUrl && /* @__PURE__ */ jsx4(
712
+ "iframe",
713
+ {
714
+ ref: frameRef,
715
+ src: htmlUrl,
716
+ title: board.title ?? board.boardKey ?? "Page",
717
+ sandbox: "allow-scripts",
718
+ referrerPolicy: "no-referrer",
719
+ width,
720
+ height: screenHeight,
721
+ className: "absolute inset-0 border-0 bg-transparent"
722
+ },
723
+ htmlUrl
724
+ ),
725
+ isPlacingPin && /* @__PURE__ */ jsx4(
726
+ "button",
727
+ {
728
+ type: "button",
729
+ "aria-label": "Place the pin here",
730
+ className: "absolute inset-0 z-10 cursor-crosshair bg-brand/10",
731
+ onClick: placePin
732
+ }
733
+ ),
734
+ pinnedThreads.map((thread) => /* @__PURE__ */ jsx4(
735
+ "button",
736
+ {
737
+ type: "button",
738
+ "aria-label": `Comment ${thread.pinNumber}`,
739
+ onClick: () => {
740
+ setHighlightedCommentId(Number(thread.root.id));
741
+ setIsCommenting(true);
742
+ },
743
+ className: cx(
744
+ "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",
745
+ thread.root.isResolved ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground",
746
+ highlightedCommentId === Number(thread.root.id) && "scale-110 ring-brand"
747
+ ),
748
+ style: { left: thread.root.x ?? 0, top: (thread.root.y ?? 0) - pageScrollTop },
749
+ children: thread.pinNumber
750
+ },
751
+ String(thread.root.id)
752
+ )),
753
+ pendingPin && /* @__PURE__ */ jsx4(
754
+ "span",
755
+ {
756
+ 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",
757
+ style: { left: pendingPin.x, top: pendingPin.y - pageScrollTop },
758
+ "aria-hidden": true,
759
+ children: /* @__PURE__ */ jsx4(MapPin, { className: "size-4" })
760
+ }
761
+ )
762
+ ] }),
763
+ /* @__PURE__ */ jsx4(
764
+ WidthDragHandle,
765
+ {
766
+ scale,
767
+ width,
768
+ onWidthChange: (nextWidth) => setChosenViewport(viewportWithWidth(viewport, nextWidth))
769
+ }
770
+ )
771
+ ]
772
+ }
773
+ ) }) }),
774
+ isCommenting && /* @__PURE__ */ jsxs4("aside", { className: "flex min-h-0 w-full max-w-[400px] flex-col border-l border-border", children: [
775
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-5 pt-4", children: [
776
+ /* @__PURE__ */ jsx4("p", { className: "text-sm font-semibold", children: board.title ?? board.boardKey }),
777
+ /* @__PURE__ */ jsx4(Button, { variant: "ghost", size: "icon", "aria-label": "Close comments", onClick: () => setIsCommenting(false), children: /* @__PURE__ */ jsx4(X, {}) })
778
+ ] }),
779
+ /* @__PURE__ */ jsx4("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4", children: /* @__PURE__ */ jsx4(
780
+ BoardComments,
781
+ {
782
+ projectKey,
783
+ canvasKey,
784
+ board,
785
+ threads,
786
+ pendingPin,
787
+ onClearPendingPin: () => setPendingPin(null),
788
+ highlightedCommentId,
789
+ onHighlightComment: setHighlightedCommentId,
790
+ writesAllowed,
791
+ showResolved,
792
+ onShowResolvedChange: setShowResolved,
793
+ pinHint: "\u201CAdd pin\u201D marks a spot on the page",
794
+ onCopyThreadReference: () => void 0,
795
+ onSelectViewport: isResponsiveBoard(board) ? setChosenViewport : void 0
796
+ }
797
+ ) })
798
+ ] })
799
+ ] })
800
+ ] });
801
+ };
438
802
  export {
439
803
  CODE_PARAM,
440
804
  DEFAULT_DESIGN_STUDIO_TEXTS,
@@ -444,6 +808,7 @@ export {
444
808
  DesignStudioProjectScreen,
445
809
  DesignStudioProvider,
446
810
  DesignStudioReviewsScreen,
811
+ DesignStudioSiteScreen,
447
812
  boardCodeMatches,
448
813
  boardCodeUrlValue,
449
814
  buildBoardCodeLink,