@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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/createDesignStudioApi.ts","../src/screens/DesignStudioOverviewScreen.tsx","../src/screens/DesignStudioProjectScreen.tsx","../src/screens/DesignStudioReviewsScreen.tsx"],"sourcesContent":["import type {\n Api,\n BaseQueryFn,\n coreModuleName,\n FetchArgs,\n FetchBaseQueryError,\n FetchBaseQueryMeta,\n} from '@reduxjs/toolkit/query';\nimport type { reactHooksModuleName, TypedUseMutation, TypedUseQuery } from '@reduxjs/toolkit/query/react';\n\nimport type {\n DesignStudioBoardStatusPatchArg,\n DesignStudioBoardStatusResponse,\n DesignStudioCanvasArg,\n DesignStudioCanvasCommentsArg,\n DesignStudioCanvasResponse,\n DesignStudioCanvasRevisionResponse,\n DesignStudioCommentArg,\n DesignStudioCommentCreateArg,\n DesignStudioCommentPatchArg,\n DesignStudioCommentReplyArg,\n DesignStudioCommentResolveArg,\n DesignStudioCommentResponse,\n DesignStudioCommentsResponse,\n DesignStudioDeleteResponse,\n DesignStudioOverviewResponse,\n DesignStudioThemesArg,\n DesignStudioThemesResponse,\n DesignStudioThumbnailRenderRequestArg,\n} from './types';\n\n/** The one cache tag of the studio: every query provides it, every mutation invalidates it. */\nexport const DESIGN_STUDIO_TAG = 'DesignStudio';\n\n/** The base query the studio's endpoints run on: a fetch-style one (`createDddBaseQuery` of `@mgamadeus/ddd-web/api`). */\nexport type DesignStudioBaseQuery = BaseQueryFn<\n string | FetchArgs,\n unknown,\n FetchBaseQueryError,\n object,\n FetchBaseQueryMeta\n>;\n\n/** The application's RTK Query api (`createApi` from `@reduxjs/toolkit/query/react`) the endpoints are injected into. */\nexport type DesignStudioBaseApi<ReducerPath extends string = string, TagTypes extends string = string> = Api<\n DesignStudioBaseQuery,\n // biome-ignore lint/complexity/noBannedTypes: RTK Query's own type of \"no endpoints yet\" (`createApi({ endpoints: () => ({}) })`)\n {},\n ReducerPath,\n TagTypes,\n typeof coreModuleName | typeof reactHooksModuleName\n>;\n\nexport interface CreateDesignStudioApiOptions<ReducerPath extends string, TagTypes extends string> {\n /** The application's api; its base query carries the origin, the session and the refresh. */\n baseApi: DesignStudioBaseApi<ReducerPath, TagTypes>;\n /** Path prefix of the studio's routes, without a trailing slash (e.g. `/api/admin/designStudio`). */\n apiPrefix: string;\n}\n\ntype DesignStudioQueryHook<ResultType, QueryArg> = TypedUseQuery<ResultType, QueryArg, DesignStudioBaseQuery>;\ntype DesignStudioMutationHook<ResultType, QueryArg> = TypedUseMutation<ResultType, QueryArg, DesignStudioBaseQuery>;\n\n/** The hooks `createDesignStudioApi` returns (`environment.api`). */\nexport interface DesignStudioApi {\n useOverviewQuery: DesignStudioQueryHook<DesignStudioOverviewResponse, void>;\n useThemesQuery: DesignStudioQueryHook<DesignStudioThemesResponse, DesignStudioThemesArg>;\n useCanvasQuery: DesignStudioQueryHook<DesignStudioCanvasResponse, DesignStudioCanvasArg>;\n useCanvasRevisionQuery: DesignStudioQueryHook<DesignStudioCanvasRevisionResponse, DesignStudioCanvasArg>;\n useCanvasCommentsQuery: DesignStudioQueryHook<DesignStudioCommentsResponse, DesignStudioCanvasCommentsArg>;\n useExpiringCommentsQuery: DesignStudioQueryHook<DesignStudioCommentsResponse, void>;\n useRequestThumbnailRenderingMutation: DesignStudioMutationHook<\n DesignStudioCanvasResponse,\n DesignStudioThumbnailRenderRequestArg\n >;\n useSetBoardStatusMutation: DesignStudioMutationHook<DesignStudioBoardStatusResponse, DesignStudioBoardStatusPatchArg>;\n useCreateCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentCreateArg>;\n useReplyToCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentReplyArg>;\n usePatchCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentPatchArg>;\n useDeleteCommentMutation: DesignStudioMutationHook<DesignStudioDeleteResponse, DesignStudioCommentArg>;\n useResolveCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentResolveArg>;\n useReopenCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentArg>;\n useKeepCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentArg>;\n}\n\nconst PROVIDED = [{ type: DESIGN_STUDIO_TAG, id: 'LIST' }] as const;\nconst INVALIDATED = [{ type: DESIGN_STUDIO_TAG, id: 'LIST' }, { type: DESIGN_STUDIO_TAG }] as const;\n\n/**\n * Injects the studio's 15 operations into the application's RTK Query api and returns their hooks. Call it once (module\n * scope) and hand the result to `DesignStudioProvider` as `environment.api`.\n *\n * Cache: one tag (`DesignStudio`). Every query provides it and every mutation invalidates it, so a write refetches\n * whatever the studio has on screen (the canvas, its comments, the overview).\n */\nexport const createDesignStudioApi = <ReducerPath extends string, TagTypes extends string>({\n baseApi,\n apiPrefix,\n}: CreateDesignStudioApiOptions<ReducerPath, TagTypes>): DesignStudioApi => {\n const canvasUrl = (arg: { projectKey: string; canvasKey: string }) =>\n `${apiPrefix}/canvases/${arg.projectKey}/${arg.canvasKey}`;\n const commentUrl = (arg: DesignStudioCommentArg) => `${apiPrefix}/comments/${arg.designStudioCommentId}`;\n\n // Widened to plain strings: the returned hooks do not depend on the application's reducer path and tag names. An api\n // is invariant in both, hence the cast; it also keeps the hook types nameable in the package's declaration files.\n const widenedBaseApi = baseApi as unknown as DesignStudioBaseApi;\n const api = widenedBaseApi.enhanceEndpoints({ addTagTypes: [DESIGN_STUDIO_TAG] }).injectEndpoints({\n endpoints: build => ({\n designStudioOverview: build.query<DesignStudioOverviewResponse, void>({\n query: () => ({ url: `${apiPrefix}/overview` }),\n providesTags: PROVIDED,\n }),\n designStudioThemes: build.query<DesignStudioThemesResponse, DesignStudioThemesArg>({\n query: arg => ({\n url: `${apiPrefix}/themes`,\n params: { search: arg.search, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n providesTags: PROVIDED,\n }),\n designStudioCanvas: build.query<DesignStudioCanvasResponse, DesignStudioCanvasArg>({\n query: arg => ({\n url: canvasUrl(arg),\n params: { theme: arg.theme, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n providesTags: PROVIDED,\n }),\n designStudioCanvasRevision: build.query<DesignStudioCanvasRevisionResponse, DesignStudioCanvasArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/revision`,\n params: { theme: arg.theme, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n providesTags: PROVIDED,\n }),\n designStudioCanvasComments: build.query<DesignStudioCommentsResponse, DesignStudioCanvasCommentsArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/comments`,\n params: {\n theme: arg.theme,\n noCache: arg.noCache,\n outputFormat: arg.outputFormat,\n onlyOpenThreads: arg.onlyOpenThreads,\n sinceId: arg.sinceId,\n },\n }),\n providesTags: PROVIDED,\n }),\n designStudioExpiringComments: build.query<DesignStudioCommentsResponse, void>({\n query: () => ({ url: `${apiPrefix}/comments/expiring` }),\n providesTags: PROVIDED,\n }),\n designStudioRequestThumbnailRendering: build.mutation<\n DesignStudioCanvasResponse,\n DesignStudioThumbnailRenderRequestArg\n >({\n query: arg => ({\n url: `${canvasUrl(arg)}/thumbnailRenderRequests`,\n method: 'POST',\n body: arg.body,\n params: { theme: arg.theme, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioSetBoardStatus: build.mutation<DesignStudioBoardStatusResponse, DesignStudioBoardStatusPatchArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/boards/${arg.boardKey}/status`,\n method: 'PATCH',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioCreateComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentCreateArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/boards/${arg.boardKey}/comments`,\n method: 'POST',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioReplyToComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentReplyArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/replies`,\n method: 'POST',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioPatchComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentPatchArg>({\n query: arg => ({\n url: commentUrl(arg),\n method: 'PATCH',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioDeleteComment: build.mutation<DesignStudioDeleteResponse, DesignStudioCommentArg>({\n query: arg => ({\n url: commentUrl(arg),\n method: 'DELETE',\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioResolveComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentResolveArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/resolve`,\n method: 'POST',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioReopenComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/reopen`,\n method: 'POST',\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioKeepComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/keep`,\n method: 'POST',\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n }),\n overrideExisting: false,\n });\n\n return {\n useOverviewQuery: api.useDesignStudioOverviewQuery,\n useThemesQuery: api.useDesignStudioThemesQuery,\n useCanvasQuery: api.useDesignStudioCanvasQuery,\n useCanvasRevisionQuery: api.useDesignStudioCanvasRevisionQuery,\n useCanvasCommentsQuery: api.useDesignStudioCanvasCommentsQuery,\n useExpiringCommentsQuery: api.useDesignStudioExpiringCommentsQuery,\n useRequestThumbnailRenderingMutation: api.useDesignStudioRequestThumbnailRenderingMutation,\n useSetBoardStatusMutation: api.useDesignStudioSetBoardStatusMutation,\n useCreateCommentMutation: api.useDesignStudioCreateCommentMutation,\n useReplyToCommentMutation: api.useDesignStudioReplyToCommentMutation,\n usePatchCommentMutation: api.useDesignStudioPatchCommentMutation,\n useDeleteCommentMutation: api.useDesignStudioDeleteCommentMutation,\n useResolveCommentMutation: api.useDesignStudioResolveCommentMutation,\n useReopenCommentMutation: api.useDesignStudioReopenCommentMutation,\n useKeepCommentMutation: api.useDesignStudioKeepCommentMutation,\n };\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/api';\nimport { Hourglass, LayoutGrid, Palette } from 'lucide-react';\nimport { type FormEvent, type ReactNode, useEffect, useMemo, useRef, useState } from 'react';\n\nimport type { DesignStudioProjectSummary } from '../api/types';\nimport { boardCodeUrlValue, CODE_PARAM, codeBelongsToCanvas } from '../canvas/boardCode';\nimport { useDesignStudio, useDesignStudioTexts } from '../provider/DesignStudioProvider';\nimport type { DesignStudioPaths } from '../provider/types';\n\n/** Without the application's `useNavigate` the overview shows a link to the board instead of navigating. */\nconst useNoNavigate = (): ((href: string) => void) | null => null;\n\nexport interface DesignStudioOverviewScreenProps {\n /** Page title (a two-tone title wraps its accent part in `<em>`). */\n title?: ReactNode;\n /** One line under the title. */\n description?: ReactNode;\n}\n\n/**\n * The canvas page that opens a board code (`APP ONB-W2`, `ONB-W2`): the path of the one canvas whose code the\n * typed code starts with, with `?code=`; null when no canvas or more than one matches.\n */\nconst codeTarget = (\n projects: readonly DesignStudioProjectSummary[],\n typedCode: string,\n paths: DesignStudioPaths\n): string | null => {\n const targets = projects.flatMap(project =>\n (project.canvases?.elements ?? [])\n .filter(canvas => codeBelongsToCanvas(typedCode, canvas.code))\n .map(canvas => `${paths.canvas(project.projectKey ?? '', canvas.canvasKey ?? '')}?${CODE_PARAM}=${encodeURIComponent(boardCodeUrlValue(typedCode))}`)\n );\n return targets.length === 1 ? targets[0] : null;\n};\n\n/**\n * Overview: every design project with its canvases (boards, open threads, decisions per canvas), and a field that\n * opens a board by its code. `?code=<board code>` on this page opens it directly (a short link that needs no canvas\n * path).\n */\nexport const DesignStudioOverviewScreen = ({\n title = (\n <>\n Design <em>Studio</em>\n </>\n ),\n description = 'Design projects and their canvases — review, comment, decide.',\n}: DesignStudioOverviewScreenProps) => {\n const { api, components, paths, router } = useDesignStudio();\n const texts = useDesignStudioTexts();\n const {\n Badge,\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n CardGrid,\n PageHeader,\n PageSections,\n SearchField,\n Skeleton,\n StatusCallout,\n } = components;\n const { Link } = router;\n const navigate = (router.useNavigate ?? useNoNavigate)();\n const { data, isLoading, error } = api.useOverviewQuery();\n const overview = data?.designStudioOverview;\n const projects = useMemo(() => overview?.projects?.elements ?? [], [overview]);\n const expiringThreadCount = overview?.expiringThreadCount ?? 0;\n const hasCodes = projects.some(project => (project.canvases?.elements ?? []).some(canvas => canvas.code));\n\n // Open a board by its code: typed into the field, or `?code=` on this page.\n const codeParam = router.useSearchParams().get(CODE_PARAM);\n const [typedCode, setTypedCode] = useState('');\n const [pendingCode, setPendingCode] = useState<{ code: string; href: string | null } | null>(null);\n const openCode = (code: string) => {\n if (!code.trim()) return;\n const href = codeTarget(projects, code, paths);\n setPendingCode({ code: code.trim(), href });\n if (href && navigate) navigate(href);\n };\n const openCodeRef = useRef(openCode);\n openCodeRef.current = openCode;\n const handledCodeParamRef = useRef<string | null>(null);\n useEffect(() => {\n if (!codeParam || !overview || handledCodeParamRef.current === codeParam) return;\n handledCodeParamRef.current = codeParam;\n openCodeRef.current(codeParam);\n }, [codeParam, overview]);\n const submitCode = (event: FormEvent) => {\n event.preventDefault();\n openCode(typedCode);\n };\n\n return (\n <>\n <PageHeader\n title={title}\n description={description}\n leading={<Palette className=\"size-7 text-brand-emphasis\" aria-hidden />}\n />\n {error && (\n <StatusCallout\n tone=\"destructive\"\n title=\"The overview could not be loaded\"\n description={normalizeDddError(error, 'Request failed').message}\n className=\"mb-6\"\n />\n )}\n <PageSections>\n {hasCodes && (\n <form onSubmit={submitCode} className=\"flex max-w-md items-center gap-2\">\n <SearchField\n value={typedCode}\n onChange={setTypedCode}\n placeholder=\"Open a board by its code, e.g. APP ONB-W2\"\n aria-label=\"Board code\"\n className=\"flex-1\"\n clearable\n />\n <Button type=\"submit\" variant=\"outline\" disabled={!typedCode.trim()}>\n Open\n </Button>\n </form>\n )}\n {pendingCode && !pendingCode.href && (\n <StatusCallout tone=\"destructive\" title={texts.boardCodeNotFound(pendingCode.code)} />\n )}\n {pendingCode?.href && !navigate && (\n <StatusCallout\n title={`Board ${pendingCode.code}`}\n description={<Link href={pendingCode.href}>Open it on its canvas</Link>}\n />\n )}\n {isLoading && <Skeleton className=\"h-40 w-full rounded-2xl\" />}\n {!isLoading && !error && projects.length === 0 && (\n <StatusCallout\n title=\"No design projects configured\"\n description=\"Projects and canvases are configured in the backend; their boards are read from the canvas folders in the checkout.\"\n />\n )}\n {projects.length > 0 && (\n <CardGrid>\n {projects.map(project => {\n const projectKey = project.projectKey ?? '';\n const canvases = project.canvases?.elements ?? [];\n return (\n <Card key={projectKey}>\n <CardHeader>\n <CardTitle className=\"flex items-center justify-between gap-2 text-title-card\">\n <Link href={paths.project(projectKey)} className=\"hover:underline\">\n {project.label ?? projectKey}\n </Link>\n <Badge variant=\"outline\">\n {canvases.length} {canvases.length === 1 ? 'canvas' : 'canvases'}\n </Badge>\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-2\">\n {canvases.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">No canvas configured for this project yet.</p>\n )}\n {canvases.map(canvas => (\n <Link\n key={canvas.canvasKey}\n href={paths.canvas(projectKey, canvas.canvasKey ?? '')}\n className=\"flex items-center justify-between gap-3 rounded-xl bg-tint px-3 py-2 text-sm transition-colors hover:bg-tint-strong\"\n >\n <span className=\"flex min-w-0 items-center gap-2 font-medium\">\n <LayoutGrid className=\"size-4 shrink-0 text-brand-emphasis\" aria-hidden />\n <span className=\"truncate\">{canvas.label ?? canvas.canvasKey}</span>\n {canvas.code && (\n <span className=\"shrink-0 text-xs font-semibold text-muted-foreground tabular-nums\">{canvas.code}</span>\n )}\n </span>\n <span className=\"shrink-0 text-muted-foreground\">\n {canvas.boardCount ?? 0} boards · {canvas.openThreadCount ?? 0} open ·{' '}\n {canvas.decisionCount ?? 0} decisions\n </span>\n </Link>\n ))}\n </CardContent>\n </Card>\n );\n })}\n </CardGrid>\n )}\n {overview && (\n <p className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground\">\n <span>Boards are read from the canvas folders in the checkout; open threads and decisions are counted per canvas.</span>\n {expiringThreadCount > 0 && (\n <span className=\"inline-flex items-center gap-1 font-medium text-foreground\">\n <Hourglass className=\"size-3.5\" aria-hidden />\n {expiringThreadCount} {expiringThreadCount === 1 ? 'thread expires' : 'threads expire'} soon (threads idle\n for {overview.threadIdleDays ?? 0} days are deleted) — open the board and choose “Keep”.\n </span>\n )}\n </p>\n )}\n </PageSections>\n </>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/api';\nimport { Flag, LayoutGrid, MessageSquare } from 'lucide-react';\n\nimport { useDesignStudio } from '../provider/DesignStudioProvider';\n\nexport interface DesignStudioProjectScreenProps {\n projectKey: string;\n}\n\n/** One design project: its canvases as cards (projects and canvases come from the studio's overview). */\nexport const DesignStudioProjectScreen = ({ projectKey }: DesignStudioProjectScreenProps) => {\n const { api, components, paths, router } = useDesignStudio();\n const { Card, CardContent, PageHeader, Skeleton, StatusCallout } = components;\n const { Link } = router;\n const { data, isLoading, error } = api.useOverviewQuery();\n const project = data?.designStudioOverview.projects?.elements?.find(item => item.projectKey === projectKey);\n const canvases = project?.canvases?.elements ?? [];\n const isLoaded = !isLoading && !error;\n\n return (\n <>\n <PageHeader\n title={project?.label ?? projectKey}\n description={project ? 'The canvases of this design project.' : undefined}\n />\n {error && (\n <StatusCallout\n tone=\"destructive\"\n title=\"The canvases could not be loaded\"\n description={normalizeDddError(error, 'Request failed').message}\n />\n )}\n {isLoading && <Skeleton className=\"h-32 w-full rounded-2xl\" />}\n {isLoaded && !project && (\n <StatusCallout\n title=\"No design project with this key is configured\"\n description={\n <>\n The design studio knows no project <code className=\"font-mono text-xs\">{projectKey}</code>. Projects and\n their canvases are configured in the backend and read from the checkout folder.\n </>\n }\n />\n )}\n {isLoaded && project && canvases.length === 0 && (\n <StatusCallout\n title=\"No canvases yet\"\n description=\"Canvases are configured per project and their boards are read from the canvas folder in the checkout; a configured canvas appears here.\"\n />\n )}\n {canvases.length > 0 && (\n <div className=\"grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(320px,1fr))]\">\n {canvases.map(canvas => (\n <Link key={canvas.canvasKey} href={paths.canvas(projectKey, canvas.canvasKey ?? '')} className=\"group\">\n <Card className=\"h-full gap-0 py-0 transition-shadow group-hover:shadow-md\">\n <CardContent className=\"flex h-full flex-col gap-2 p-4\">\n <span className=\"flex items-center gap-2 font-semibold\">\n <LayoutGrid className=\"size-4 shrink-0 text-brand-emphasis\" aria-hidden />\n <span className=\"truncate\">{canvas.label ?? canvas.canvasKey}</span>\n </span>\n <p className=\"text-sm text-muted-foreground\">\n {canvas.boardCount ?? 0} boards\n <span className=\"inline-flex items-center gap-1 pl-3\">\n <MessageSquare className=\"size-3.5\" aria-hidden /> {canvas.openThreadCount ?? 0} open\n </span>\n <span className=\"inline-flex items-center gap-1 pl-3\">\n <Flag className=\"size-3.5\" aria-hidden /> {canvas.decisionCount ?? 0} decisions\n </span>\n </p>\n <p className=\"mt-auto text-xs text-muted-foreground\">{canvas.canvasKey}</p>\n </CardContent>\n </Card>\n </Link>\n ))}\n </div>\n )}\n </>\n );\n};\n","'use client';\n\nimport { ClipboardCheck } from 'lucide-react';\nimport type { ReactNode } from 'react';\n\nimport { useDesignStudioComponents } from '../provider/DesignStudioProvider';\n\nexport interface DesignStudioReviewsScreenProps {\n /** One line under the title. */\n description?: ReactNode;\n /** Text of the empty state. */\n emptyDescription?: ReactNode;\n}\n\n/** Reviews linked to boards (empty for now: review documents come with a later step of the studio). */\nexport const DesignStudioReviewsScreen = ({\n description = 'Reviews with scores, linked to the boards.',\n emptyDescription = 'Review documents (scores, findings linked to boards, verified / adopted / rejected) come with a later step of the design studio.',\n}: DesignStudioReviewsScreenProps) => {\n const { PageHeader, StatusCallout } = useDesignStudioComponents();\n return (\n <>\n <PageHeader title=\"Reviews\" description={description} />\n <StatusCallout icon={ClipboardCheck} title=\"No reviews imported yet\" description={emptyDescription} />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,IAAM,oBAAoB;AAqDjC,IAAM,WAAW,CAAC,EAAE,MAAM,mBAAmB,IAAI,OAAO,CAAC;AACzD,IAAM,cAAc,CAAC,EAAE,MAAM,mBAAmB,IAAI,OAAO,GAAG,EAAE,MAAM,kBAAkB,CAAC;AASlF,IAAM,wBAAwB,CAAsD;AAAA,EACzF;AAAA,EACA;AACF,MAA4E;AAC1E,QAAM,YAAY,CAAC,QACjB,GAAG,SAAS,aAAa,IAAI,UAAU,IAAI,IAAI,SAAS;AAC1D,QAAM,aAAa,CAAC,QAAgC,GAAG,SAAS,aAAa,IAAI,qBAAqB;AAItG,QAAM,iBAAiB;AACvB,QAAM,MAAM,eAAe,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,EAAE,CAAC,EAAE,gBAAgB;AAAA,IAChG,WAAW,YAAU;AAAA,MACnB,sBAAsB,MAAM,MAA0C;AAAA,QACpE,OAAO,OAAO,EAAE,KAAK,GA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AAA,QACxE,gBAAAH,KAAC,UAAK,WAAU,YAAY,iBAAO,SAAS,OAAO,WAAU;AAAA,SAC/D;AAAA,MACA,gBAAAC,MAAC,OAAE,WAAU,iCACV;AAAA,eAAO,cAAc;AAAA,QAAE;AAAA,QACxB,gBAAAA,MAAC,UAAK,WAAU,uCACd;AAAA,0BAAAD,KAAC,iBAAc,WAAU,YAAW,eAAW,MAAC;AAAA,UAAE;AAAA,UAAE,OAAO,mBAAmB;AAAA,UAAE;AAAA,WAClF;AAAA,QACA,gBAAAC,MAAC,UAAK,WAAU,uCACd;AAAA,0BAAAD,KAAC,QAAK,WAAU,YAAW,eAAW,MAAC;AAAA,UAAE;AAAA,UAAE,OAAO,iBAAiB;AAAA,UAAE;AAAA,WACvE;AAAA,SACF;AAAA,MACA,gBAAAA,KAAC,OAAE,WAAU,yCAAyC,iBAAO,WAAU;AAAA,OACzE,GACF,KAlBS,OAAO,SAmBlB,CACD,GACH;AAAA,KAEJ;AAEJ;;;AC9EA,SAAS,sBAAsB;AAmB3B,qBAAAI,WACE,OAAAC,MADF,QAAAC,aAAA;AANG,IAAM,4BAA4B,CAAC;AAAA,EACxC,cAAc;AAAA,EACd,mBAAmB;AACrB,MAAsC;AACpC,QAAM,EAAE,YAAY,cAAc,IAAI,0BAA0B;AAChE,SACE,gBAAAA,MAAAF,WAAA,EACE;AAAA,oBAAAC,KAAC,cAAW,OAAM,WAAU,aAA0B;AAAA,IACtD,gBAAAA,KAAC,iBAAc,MAAM,gBAAgB,OAAM,2BAA0B,aAAa,kBAAkB;AAAA,KACtG;AAEJ;","names":["normalizeDddError","LayoutGrid","Fragment","jsx","jsxs","normalizeDddError","LayoutGrid","Fragment","jsx","jsxs"]}
1
+ {"version":3,"sources":["../src/api/createDesignStudioApi.ts","../src/screens/DesignStudioOverviewScreen.tsx","../src/screens/DesignStudioProjectScreen.tsx","../src/screens/DesignStudioReviewsScreen.tsx","../src/screens/DesignStudioSiteScreen.tsx","../src/site/siteNavigation.ts"],"sourcesContent":["import type {\n Api,\n BaseQueryFn,\n coreModuleName,\n FetchArgs,\n FetchBaseQueryError,\n FetchBaseQueryMeta,\n} from '@reduxjs/toolkit/query';\nimport type { reactHooksModuleName, TypedUseMutation, TypedUseQuery } from '@reduxjs/toolkit/query/react';\n\nimport type {\n DesignStudioBoardStatusPatchArg,\n DesignStudioBoardStatusResponse,\n DesignStudioCanvasArg,\n DesignStudioCanvasCommentsArg,\n DesignStudioCanvasResponse,\n DesignStudioCanvasRevisionResponse,\n DesignStudioCommentArg,\n DesignStudioCommentCreateArg,\n DesignStudioCommentPatchArg,\n DesignStudioCommentReplyArg,\n DesignStudioCommentResolveArg,\n DesignStudioCommentResponse,\n DesignStudioCommentsResponse,\n DesignStudioDeleteResponse,\n DesignStudioOverviewResponse,\n DesignStudioThemesArg,\n DesignStudioThemesResponse,\n DesignStudioThumbnailRenderRequestArg,\n} from './types';\n\n/** The one cache tag of the studio: every query provides it, every mutation invalidates it. */\nexport const DESIGN_STUDIO_TAG = 'DesignStudio';\n\n/** The base query the studio's endpoints run on: a fetch-style one (`createDddBaseQuery` of `@mgamadeus/ddd-web/api`). */\nexport type DesignStudioBaseQuery = BaseQueryFn<\n string | FetchArgs,\n unknown,\n FetchBaseQueryError,\n object,\n FetchBaseQueryMeta\n>;\n\n/** The application's RTK Query api (`createApi` from `@reduxjs/toolkit/query/react`) the endpoints are injected into. */\nexport type DesignStudioBaseApi<ReducerPath extends string = string, TagTypes extends string = string> = Api<\n DesignStudioBaseQuery,\n // biome-ignore lint/complexity/noBannedTypes: RTK Query's own type of \"no endpoints yet\" (`createApi({ endpoints: () => ({}) })`)\n {},\n ReducerPath,\n TagTypes,\n typeof coreModuleName | typeof reactHooksModuleName\n>;\n\nexport interface CreateDesignStudioApiOptions<ReducerPath extends string, TagTypes extends string> {\n /** The application's api; its base query carries the origin, the session and the refresh. */\n baseApi: DesignStudioBaseApi<ReducerPath, TagTypes>;\n /** Path prefix of the studio's routes, without a trailing slash (e.g. `/api/admin/designStudio`). */\n apiPrefix: string;\n}\n\ntype DesignStudioQueryHook<ResultType, QueryArg> = TypedUseQuery<ResultType, QueryArg, DesignStudioBaseQuery>;\ntype DesignStudioMutationHook<ResultType, QueryArg> = TypedUseMutation<ResultType, QueryArg, DesignStudioBaseQuery>;\n\n/** The hooks `createDesignStudioApi` returns (`environment.api`). */\nexport interface DesignStudioApi {\n useOverviewQuery: DesignStudioQueryHook<DesignStudioOverviewResponse, void>;\n useThemesQuery: DesignStudioQueryHook<DesignStudioThemesResponse, DesignStudioThemesArg>;\n useCanvasQuery: DesignStudioQueryHook<DesignStudioCanvasResponse, DesignStudioCanvasArg>;\n useCanvasRevisionQuery: DesignStudioQueryHook<DesignStudioCanvasRevisionResponse, DesignStudioCanvasArg>;\n useCanvasCommentsQuery: DesignStudioQueryHook<DesignStudioCommentsResponse, DesignStudioCanvasCommentsArg>;\n useExpiringCommentsQuery: DesignStudioQueryHook<DesignStudioCommentsResponse, void>;\n useRequestThumbnailRenderingMutation: DesignStudioMutationHook<\n DesignStudioCanvasResponse,\n DesignStudioThumbnailRenderRequestArg\n >;\n useSetBoardStatusMutation: DesignStudioMutationHook<DesignStudioBoardStatusResponse, DesignStudioBoardStatusPatchArg>;\n useCreateCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentCreateArg>;\n useReplyToCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentReplyArg>;\n usePatchCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentPatchArg>;\n useDeleteCommentMutation: DesignStudioMutationHook<DesignStudioDeleteResponse, DesignStudioCommentArg>;\n useResolveCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentResolveArg>;\n useReopenCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentArg>;\n useKeepCommentMutation: DesignStudioMutationHook<DesignStudioCommentResponse, DesignStudioCommentArg>;\n}\n\nconst PROVIDED = [{ type: DESIGN_STUDIO_TAG, id: 'LIST' }] as const;\nconst INVALIDATED = [{ type: DESIGN_STUDIO_TAG, id: 'LIST' }, { type: DESIGN_STUDIO_TAG }] as const;\n\n/**\n * Injects the studio's 15 operations into the application's RTK Query api and returns their hooks. Call it once (module\n * scope) and hand the result to `DesignStudioProvider` as `environment.api`.\n *\n * Cache: one tag (`DesignStudio`). Every query provides it and every mutation invalidates it, so a write refetches\n * whatever the studio has on screen (the canvas, its comments, the overview).\n */\nexport const createDesignStudioApi = <ReducerPath extends string, TagTypes extends string>({\n baseApi,\n apiPrefix,\n}: CreateDesignStudioApiOptions<ReducerPath, TagTypes>): DesignStudioApi => {\n const canvasUrl = (arg: { projectKey: string; canvasKey: string }) =>\n `${apiPrefix}/canvases/${arg.projectKey}/${arg.canvasKey}`;\n const commentUrl = (arg: DesignStudioCommentArg) => `${apiPrefix}/comments/${arg.designStudioCommentId}`;\n\n // Widened to plain strings: the returned hooks do not depend on the application's reducer path and tag names. An api\n // is invariant in both, hence the cast; it also keeps the hook types nameable in the package's declaration files.\n const widenedBaseApi = baseApi as unknown as DesignStudioBaseApi;\n const api = widenedBaseApi.enhanceEndpoints({ addTagTypes: [DESIGN_STUDIO_TAG] }).injectEndpoints({\n endpoints: build => ({\n designStudioOverview: build.query<DesignStudioOverviewResponse, void>({\n query: () => ({ url: `${apiPrefix}/overview` }),\n providesTags: PROVIDED,\n }),\n designStudioThemes: build.query<DesignStudioThemesResponse, DesignStudioThemesArg>({\n query: arg => ({\n url: `${apiPrefix}/themes`,\n params: { search: arg.search, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n providesTags: PROVIDED,\n }),\n designStudioCanvas: build.query<DesignStudioCanvasResponse, DesignStudioCanvasArg>({\n query: arg => ({\n url: canvasUrl(arg),\n params: { theme: arg.theme, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n providesTags: PROVIDED,\n }),\n designStudioCanvasRevision: build.query<DesignStudioCanvasRevisionResponse, DesignStudioCanvasArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/revision`,\n params: { theme: arg.theme, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n providesTags: PROVIDED,\n }),\n designStudioCanvasComments: build.query<DesignStudioCommentsResponse, DesignStudioCanvasCommentsArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/comments`,\n params: {\n theme: arg.theme,\n noCache: arg.noCache,\n outputFormat: arg.outputFormat,\n onlyOpenThreads: arg.onlyOpenThreads,\n sinceId: arg.sinceId,\n },\n }),\n providesTags: PROVIDED,\n }),\n designStudioExpiringComments: build.query<DesignStudioCommentsResponse, void>({\n query: () => ({ url: `${apiPrefix}/comments/expiring` }),\n providesTags: PROVIDED,\n }),\n designStudioRequestThumbnailRendering: build.mutation<\n DesignStudioCanvasResponse,\n DesignStudioThumbnailRenderRequestArg\n >({\n query: arg => ({\n url: `${canvasUrl(arg)}/thumbnailRenderRequests`,\n method: 'POST',\n body: arg.body,\n params: { theme: arg.theme, noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioSetBoardStatus: build.mutation<DesignStudioBoardStatusResponse, DesignStudioBoardStatusPatchArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/boards/${arg.boardKey}/status`,\n method: 'PATCH',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioCreateComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentCreateArg>({\n query: arg => ({\n url: `${canvasUrl(arg)}/boards/${arg.boardKey}/comments`,\n method: 'POST',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioReplyToComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentReplyArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/replies`,\n method: 'POST',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioPatchComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentPatchArg>({\n query: arg => ({\n url: commentUrl(arg),\n method: 'PATCH',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioDeleteComment: build.mutation<DesignStudioDeleteResponse, DesignStudioCommentArg>({\n query: arg => ({\n url: commentUrl(arg),\n method: 'DELETE',\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioResolveComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentResolveArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/resolve`,\n method: 'POST',\n body: arg.body,\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioReopenComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/reopen`,\n method: 'POST',\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n designStudioKeepComment: build.mutation<DesignStudioCommentResponse, DesignStudioCommentArg>({\n query: arg => ({\n url: `${commentUrl(arg)}/keep`,\n method: 'POST',\n params: { noCache: arg.noCache, outputFormat: arg.outputFormat },\n }),\n invalidatesTags: INVALIDATED,\n }),\n }),\n overrideExisting: false,\n });\n\n return {\n useOverviewQuery: api.useDesignStudioOverviewQuery,\n useThemesQuery: api.useDesignStudioThemesQuery,\n useCanvasQuery: api.useDesignStudioCanvasQuery,\n useCanvasRevisionQuery: api.useDesignStudioCanvasRevisionQuery,\n useCanvasCommentsQuery: api.useDesignStudioCanvasCommentsQuery,\n useExpiringCommentsQuery: api.useDesignStudioExpiringCommentsQuery,\n useRequestThumbnailRenderingMutation: api.useDesignStudioRequestThumbnailRenderingMutation,\n useSetBoardStatusMutation: api.useDesignStudioSetBoardStatusMutation,\n useCreateCommentMutation: api.useDesignStudioCreateCommentMutation,\n useReplyToCommentMutation: api.useDesignStudioReplyToCommentMutation,\n usePatchCommentMutation: api.useDesignStudioPatchCommentMutation,\n useDeleteCommentMutation: api.useDesignStudioDeleteCommentMutation,\n useResolveCommentMutation: api.useDesignStudioResolveCommentMutation,\n useReopenCommentMutation: api.useDesignStudioReopenCommentMutation,\n useKeepCommentMutation: api.useDesignStudioKeepCommentMutation,\n };\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/api';\nimport { Hourglass, LayoutGrid, Palette } from 'lucide-react';\nimport { type FormEvent, type ReactNode, useEffect, useMemo, useRef, useState } from 'react';\n\nimport type { DesignStudioProjectSummary } from '../api/types';\nimport { boardCodeUrlValue, CODE_PARAM, codeBelongsToCanvas } from '../canvas/boardCode';\nimport { useDesignStudio, useDesignStudioTexts } from '../provider/DesignStudioProvider';\nimport type { DesignStudioPaths } from '../provider/types';\n\n/** Without the application's `useNavigate` the overview shows a link to the board instead of navigating. */\nconst useNoNavigate = (): ((href: string) => void) | null => null;\n\nexport interface DesignStudioOverviewScreenProps {\n /** Page title (a two-tone title wraps its accent part in `<em>`). */\n title?: ReactNode;\n /** One line under the title. */\n description?: ReactNode;\n}\n\n/**\n * The canvas page that opens a board code (`APP ONB-W2`, `ONB-W2`): the path of the one canvas whose code the\n * typed code starts with, with `?code=`; null when no canvas or more than one matches.\n */\nconst codeTarget = (\n projects: readonly DesignStudioProjectSummary[],\n typedCode: string,\n paths: DesignStudioPaths\n): string | null => {\n const targets = projects.flatMap(project =>\n (project.canvases?.elements ?? [])\n .filter(canvas => codeBelongsToCanvas(typedCode, canvas.code))\n .map(canvas => `${paths.canvas(project.projectKey ?? '', canvas.canvasKey ?? '')}?${CODE_PARAM}=${encodeURIComponent(boardCodeUrlValue(typedCode))}`)\n );\n return targets.length === 1 ? targets[0] : null;\n};\n\n/**\n * Overview: every design project with its canvases (boards, open threads, decisions per canvas), and a field that\n * opens a board by its code. `?code=<board code>` on this page opens it directly (a short link that needs no canvas\n * path).\n */\nexport const DesignStudioOverviewScreen = ({\n title = (\n <>\n Design <em>Studio</em>\n </>\n ),\n description = 'Design projects and their canvases — review, comment, decide.',\n}: DesignStudioOverviewScreenProps) => {\n const { api, components, paths, router } = useDesignStudio();\n const texts = useDesignStudioTexts();\n const {\n Badge,\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n CardGrid,\n PageHeader,\n PageSections,\n SearchField,\n Skeleton,\n StatusCallout,\n } = components;\n const { Link } = router;\n const navigate = (router.useNavigate ?? useNoNavigate)();\n const { data, isLoading, error } = api.useOverviewQuery();\n const overview = data?.designStudioOverview;\n const projects = useMemo(() => overview?.projects?.elements ?? [], [overview]);\n const expiringThreadCount = overview?.expiringThreadCount ?? 0;\n const hasCodes = projects.some(project => (project.canvases?.elements ?? []).some(canvas => canvas.code));\n\n // Open a board by its code: typed into the field, or `?code=` on this page.\n const codeParam = router.useSearchParams().get(CODE_PARAM);\n const [typedCode, setTypedCode] = useState('');\n const [pendingCode, setPendingCode] = useState<{ code: string; href: string | null } | null>(null);\n const openCode = (code: string) => {\n if (!code.trim()) return;\n const href = codeTarget(projects, code, paths);\n setPendingCode({ code: code.trim(), href });\n if (href && navigate) navigate(href);\n };\n const openCodeRef = useRef(openCode);\n openCodeRef.current = openCode;\n const handledCodeParamRef = useRef<string | null>(null);\n useEffect(() => {\n if (!codeParam || !overview || handledCodeParamRef.current === codeParam) return;\n handledCodeParamRef.current = codeParam;\n openCodeRef.current(codeParam);\n }, [codeParam, overview]);\n const submitCode = (event: FormEvent) => {\n event.preventDefault();\n openCode(typedCode);\n };\n\n return (\n <>\n <PageHeader\n title={title}\n description={description}\n leading={<Palette className=\"size-7 text-brand-emphasis\" aria-hidden />}\n />\n {error && (\n <StatusCallout\n tone=\"destructive\"\n title=\"The overview could not be loaded\"\n description={normalizeDddError(error, 'Request failed').message}\n className=\"mb-6\"\n />\n )}\n <PageSections>\n {hasCodes && (\n <form onSubmit={submitCode} className=\"flex max-w-md items-center gap-2\">\n <SearchField\n value={typedCode}\n onChange={setTypedCode}\n placeholder=\"Open a board by its code, e.g. APP ONB-W2\"\n aria-label=\"Board code\"\n className=\"flex-1\"\n clearable\n />\n <Button type=\"submit\" variant=\"outline\" disabled={!typedCode.trim()}>\n Open\n </Button>\n </form>\n )}\n {pendingCode && !pendingCode.href && (\n <StatusCallout tone=\"destructive\" title={texts.boardCodeNotFound(pendingCode.code)} />\n )}\n {pendingCode?.href && !navigate && (\n <StatusCallout\n title={`Board ${pendingCode.code}`}\n description={<Link href={pendingCode.href}>Open it on its canvas</Link>}\n />\n )}\n {isLoading && <Skeleton className=\"h-40 w-full rounded-2xl\" />}\n {!isLoading && !error && projects.length === 0 && (\n <StatusCallout\n title=\"No design projects configured\"\n description=\"Projects and canvases are configured in the backend; their boards are read from the canvas folders in the checkout.\"\n />\n )}\n {projects.length > 0 && (\n <CardGrid>\n {projects.map(project => {\n const projectKey = project.projectKey ?? '';\n const canvases = project.canvases?.elements ?? [];\n return (\n <Card key={projectKey}>\n <CardHeader>\n <CardTitle className=\"flex items-center justify-between gap-2 text-title-card\">\n <Link href={paths.project(projectKey)} className=\"hover:underline\">\n {project.label ?? projectKey}\n </Link>\n <Badge variant=\"outline\">\n {canvases.length} {canvases.length === 1 ? 'canvas' : 'canvases'}\n </Badge>\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-2\">\n {canvases.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">No canvas configured for this project yet.</p>\n )}\n {canvases.map(canvas => (\n <Link\n key={canvas.canvasKey}\n href={paths.canvas(projectKey, canvas.canvasKey ?? '')}\n className=\"flex items-center justify-between gap-3 rounded-xl bg-tint px-3 py-2 text-sm transition-colors hover:bg-tint-strong\"\n >\n <span className=\"flex min-w-0 items-center gap-2 font-medium\">\n <LayoutGrid className=\"size-4 shrink-0 text-brand-emphasis\" aria-hidden />\n <span className=\"truncate\">{canvas.label ?? canvas.canvasKey}</span>\n {canvas.code && (\n <span className=\"shrink-0 text-xs font-semibold text-muted-foreground tabular-nums\">{canvas.code}</span>\n )}\n </span>\n <span className=\"shrink-0 text-muted-foreground\">\n {canvas.boardCount ?? 0} boards · {canvas.openThreadCount ?? 0} open ·{' '}\n {canvas.decisionCount ?? 0} decisions\n </span>\n </Link>\n ))}\n </CardContent>\n </Card>\n );\n })}\n </CardGrid>\n )}\n {overview && (\n <p className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground\">\n <span>Boards are read from the canvas folders in the checkout; open threads and decisions are counted per canvas.</span>\n {expiringThreadCount > 0 && (\n <span className=\"inline-flex items-center gap-1 font-medium text-foreground\">\n <Hourglass className=\"size-3.5\" aria-hidden />\n {expiringThreadCount} {expiringThreadCount === 1 ? 'thread expires' : 'threads expire'} soon (threads idle\n for {overview.threadIdleDays ?? 0} days are deleted) — open the board and choose “Keep”.\n </span>\n )}\n </p>\n )}\n </PageSections>\n </>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/api';\nimport { Flag, LayoutGrid, MessageSquare } from 'lucide-react';\n\nimport { useDesignStudio } from '../provider/DesignStudioProvider';\n\nexport interface DesignStudioProjectScreenProps {\n projectKey: string;\n}\n\n/** One design project: its canvases as cards (projects and canvases come from the studio's overview). */\nexport const DesignStudioProjectScreen = ({ projectKey }: DesignStudioProjectScreenProps) => {\n const { api, components, paths, router } = useDesignStudio();\n const { Card, CardContent, PageHeader, Skeleton, StatusCallout } = components;\n const { Link } = router;\n const { data, isLoading, error } = api.useOverviewQuery();\n const project = data?.designStudioOverview.projects?.elements?.find(item => item.projectKey === projectKey);\n const canvases = project?.canvases?.elements ?? [];\n const isLoaded = !isLoading && !error;\n\n return (\n <>\n <PageHeader\n title={project?.label ?? projectKey}\n description={project ? 'The canvases of this design project.' : undefined}\n />\n {error && (\n <StatusCallout\n tone=\"destructive\"\n title=\"The canvases could not be loaded\"\n description={normalizeDddError(error, 'Request failed').message}\n />\n )}\n {isLoading && <Skeleton className=\"h-32 w-full rounded-2xl\" />}\n {isLoaded && !project && (\n <StatusCallout\n title=\"No design project with this key is configured\"\n description={\n <>\n The design studio knows no project <code className=\"font-mono text-xs\">{projectKey}</code>. Projects and\n their canvases are configured in the backend and read from the checkout folder.\n </>\n }\n />\n )}\n {isLoaded && project && canvases.length === 0 && (\n <StatusCallout\n title=\"No canvases yet\"\n description=\"Canvases are configured per project and their boards are read from the canvas folder in the checkout; a configured canvas appears here.\"\n />\n )}\n {canvases.length > 0 && (\n <div className=\"grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(320px,1fr))]\">\n {canvases.map(canvas => (\n <Link key={canvas.canvasKey} href={paths.canvas(projectKey, canvas.canvasKey ?? '')} className=\"group\">\n <Card className=\"h-full gap-0 py-0 transition-shadow group-hover:shadow-md\">\n <CardContent className=\"flex h-full flex-col gap-2 p-4\">\n <span className=\"flex items-center gap-2 font-semibold\">\n <LayoutGrid className=\"size-4 shrink-0 text-brand-emphasis\" aria-hidden />\n <span className=\"truncate\">{canvas.label ?? canvas.canvasKey}</span>\n </span>\n <p className=\"text-sm text-muted-foreground\">\n {canvas.boardCount ?? 0} boards\n <span className=\"inline-flex items-center gap-1 pl-3\">\n <MessageSquare className=\"size-3.5\" aria-hidden /> {canvas.openThreadCount ?? 0} open\n </span>\n <span className=\"inline-flex items-center gap-1 pl-3\">\n <Flag className=\"size-3.5\" aria-hidden /> {canvas.decisionCount ?? 0} decisions\n </span>\n </p>\n <p className=\"mt-auto text-xs text-muted-foreground\">{canvas.canvasKey}</p>\n </CardContent>\n </Card>\n </Link>\n ))}\n </div>\n )}\n </>\n );\n};\n","'use client';\n\nimport { ClipboardCheck } from 'lucide-react';\nimport type { ReactNode } from 'react';\n\nimport { useDesignStudioComponents } from '../provider/DesignStudioProvider';\n\nexport interface DesignStudioReviewsScreenProps {\n /** One line under the title. */\n description?: ReactNode;\n /** Text of the empty state. */\n emptyDescription?: ReactNode;\n}\n\n/** Reviews linked to boards (empty for now: review documents come with a later step of the studio). */\nexport const DesignStudioReviewsScreen = ({\n description = 'Reviews with scores, linked to the boards.',\n emptyDescription = 'Review documents (scores, findings linked to boards, verified / adopted / rejected) come with a later step of the design studio.',\n}: DesignStudioReviewsScreenProps) => {\n const { PageHeader, StatusCallout } = useDesignStudioComponents();\n return (\n <>\n <PageHeader title=\"Reviews\" description={description} />\n <StatusCallout icon={ClipboardCheck} title=\"No reviews imported yet\" description={emptyDescription} />\n </>\n );\n};\n","'use client';\n\nimport { normalizeDddError } from '@mgamadeus/ddd-web/api';\nimport { ArrowLeft, MapPin, MapPinPlus, MessageSquare, X } from 'lucide-react';\nimport { type MouseEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { BoardComments, type BoardPin, buildCommentThreads } from '../canvas/BoardComments';\nimport { buildThemeReference, type ThemeMode } from '../canvas/designTheme';\nimport {\n type DeviceViewport,\n initialViewportForBoard,\n isPinInViewport,\n isResponsiveBoard,\n viewportWithWidth,\n} from '../canvas/deviceViewport';\nimport { ViewportToolbar, WidthDragHandle } from '../canvas/ViewportControls';\nimport { useCheckedContentUrl } from '../canvas/useCheckedContentUrl';\nimport { useDesignStudio, useDesignStudioTexts } from '../provider/DesignStudioProvider';\nimport { parseSiteFrameMessage, resolveSiteHref, sitePagesOf, startRouteOf } from '../site/siteNavigation';\nimport { cx } from '../utils/cx';\n\nexport interface DesignStudioSiteScreenProps {\n projectKey: string;\n canvasKey: string;\n /** The page's path (`/`, `/pricing`) from the application's route; null / empty = the start page. */\n route: string | null;\n}\n\n/**\n * A canvas as a clickable website: the boards with a `route` are its pages, one at a time, full width in the chosen\n * device: the page keeps the device's viewport height and scrolls itself (`vh` units as on the device). Links inside a\n * page open the mapped page (a history entry per page: back / forward work), `#anchors` scroll, external links are\n * not followed, a link without a page says so. Comments are placed on the page as on the canvas (page positions in the\n * viewport they were placed in, the pins move with the page's scroll position; same threads). The look comes from the `theme` / `mode` query\n * parameters, as on the canvas. The page runs the studio's navigation script only (opaque origin, the board's own\n * scripts removed).\n */\nexport const DesignStudioSiteScreen = ({ projectKey, canvasKey, route }: DesignStudioSiteScreenProps) => {\n const { api, apiBaseUrl, components, notify, paths, router, useCanWrite } = useDesignStudio();\n const texts = useDesignStudioTexts();\n const { Button, Skeleton, StatusCallout } = components;\n const { Link } = router;\n const navigate = router.useNavigate?.();\n const searchParams = router.useSearchParams();\n const writesAllowed = useCanWrite();\n const themeId = searchParams.get('theme');\n const mode: ThemeMode = searchParams.get('mode') === 'dark' ? 'dark' : 'light';\n const themeArgument = themeId ? buildThemeReference(themeId, mode) : undefined;\n const { data, isLoading, error } = api.useCanvasQuery({\n projectKey,\n canvasKey,\n ...(themeArgument ? { theme: themeArgument } : {}),\n });\n const { data: commentsData } = api.useCanvasCommentsQuery({ projectKey, canvasKey });\n const canvas = data?.designStudioCanvasView;\n const boards = useMemo(() => canvas?.boards?.elements ?? [], [canvas]);\n const devices = useMemo(() => canvas?.devices?.elements ?? [], [canvas]);\n const pages = useMemo(() => sitePagesOf(boards), [boards]);\n const currentRoute = startRouteOf(pages, route);\n const board = currentRoute !== null ? (pages.get(currentRoute) ?? null) : null;\n\n // the viewport: the device picked here (kept while navigating), else the page's first frame, else its own width\n const [chosenViewport, setChosenViewport] = useState<DeviceViewport | null>(null);\n const viewport: DeviceViewport | null =\n initialViewportForBoard(board, chosenViewport) ??\n (board ? chosenViewport ?? { width: board.width ?? 390, height: board.height ?? 844, deviceKey: null } : null);\n const [pageScrollTop, setPageScrollTop] = useState(0);\n const [showsDeviceFrame, setShowsDeviceFrame] = useState(false);\n const [isCommenting, setIsCommenting] = useState(false);\n const [isPlacingPin, setIsPlacingPin] = useState(false);\n const [pendingPin, setPendingPin] = useState<BoardPin | null>(null);\n const [highlightedCommentId, setHighlightedCommentId] = useState<number | null>(null);\n const [showResolved, setShowResolved] = useState(false);\n const frameRef = useRef<HTMLIFrameElement | null>(null);\n const stageRef = useRef<HTMLDivElement | null>(null);\n const [stageWidth, setStageWidth] = useState(0);\n\n const boardKey = board?.boardKey ?? null;\n // a new page starts at its top, without a pending pin\n useEffect(() => {\n if (boardKey === null) return;\n setPageScrollTop(0);\n setPendingPin(null);\n setIsPlacingPin(false);\n }, [boardKey]);\n\n useEffect(() => {\n const stage = stageRef.current;\n if (!stage || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => setStageWidth(stage.clientWidth));\n observer.observe(stage);\n setStageWidth(stage.clientWidth);\n return () => observer.disconnect();\n }, []);\n\n const goToRoute = useCallback(\n (nextRoute: string) => {\n if (!paths.site) return;\n const query = themeId ? `?theme=${encodeURIComponent(themeId)}&mode=${mode}` : '';\n const href = `${paths.site(projectKey, canvasKey, nextRoute)}${query}`;\n if (navigate) navigate(href);\n else if (typeof window !== 'undefined') window.location.assign(href);\n },\n [paths, projectKey, canvasKey, themeId, mode, navigate]\n );\n\n // the page's navigation script: link clicks, anchors and the page height\n useEffect(() => {\n const onMessage = (event: MessageEvent) => {\n if (!frameRef.current || event.source !== frameRef.current.contentWindow) return;\n const message = parseSiteFrameMessage(event.data);\n if (!message || currentRoute === null) return;\n if (message.type === 'scroll') {\n setPageScrollTop(message.top);\n return;\n }\n if (message.type === 'height') return;\n const target = resolveSiteHref(message.href, currentRoute, boards);\n if (target.kind === 'page') {\n if (target.route !== currentRoute) goToRoute(target.route);\n } else if (target.kind === 'external') {\n notify.info(texts.siteExternalLink(target.href));\n } else if (target.kind === 'missing') {\n notify.info(texts.sitePageMissing(target.path));\n }\n };\n window.addEventListener('message', onMessage);\n return () => window.removeEventListener('message', onMessage);\n });\n\n const width = viewport?.width ?? 390;\n const screenHeight = viewport?.height ?? 844;\n const bezelPadding = showsDeviceFrame ? 24 : 0;\n const scale = stageWidth > 0 ? Math.min(1, (stageWidth - 48) / (width + bezelPadding)) : 1;\n const siteHtmlUrl = board?.htmlUrl ? `${board.htmlUrl}&site=1` : null;\n const htmlUrl = useCheckedContentUrl(siteHtmlUrl ? `${apiBaseUrl}${siteHtmlUrl}` : undefined);\n\n const threads = useMemo(\n () =>\n buildCommentThreads(\n (commentsData?.designStudioComments.elements ?? []).filter(comment => comment.boardKey === boardKey)\n ),\n [commentsData, boardKey]\n );\n const shownViewport = board && isResponsiveBoard(board) ? viewport : null;\n const pinnedThreads = threads.filter(\n thread =>\n thread.pinNumber !== null &&\n (showResolved || !thread.root.isResolved) &&\n isPinInViewport(thread.root, shownViewport)\n );\n const placePin = (event: MouseEvent<HTMLButtonElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n setPendingPin({\n x: Math.round((event.clientX - rect.left) / scale),\n y: Math.round((event.clientY - rect.top) / scale + pageScrollTop),\n viewport: shownViewport,\n });\n setIsPlacingPin(false);\n setIsCommenting(true);\n };\n\n if (error) {\n return (\n <StatusCallout\n tone=\"destructive\"\n title=\"The site could not be loaded\"\n description={normalizeDddError(error, 'Request failed').message}\n />\n );\n }\n if (isLoading || !canvas) return <Skeleton className=\"h-[70vh] w-full rounded-2xl\" />;\n if (currentRoute === null || !board || !viewport) {\n return (\n <StatusCallout\n title=\"This canvas has no pages\"\n description={'A board becomes a page with \"route\": \"/path\" in canvas.json or <meta name=\"design-route\" content=\"/path\"> in its file.'}\n />\n );\n }\n const requestedRoute = route ? route : '/';\n const isRequestedRouteMissing = requestedRoute !== currentRoute && route !== null && route !== '';\n\n return (\n <div className=\"flex h-[calc(100dvh-4rem)] min-h-0 flex-col overflow-hidden rounded-3xl bg-card ring-1 ring-foreground/5\">\n <header className=\"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2\">\n <Link href={paths.canvas(projectKey, canvasKey)} className=\"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground\">\n <ArrowLeft className=\"size-4\" aria-hidden /> {canvas.label ?? canvasKey}\n </Link>\n <span className=\"text-muted-foreground\">/</span>\n <select\n aria-label=\"Page\"\n className=\"h-8 rounded-lg border border-border bg-card px-2 text-sm\"\n value={currentRoute}\n onChange={event => goToRoute(event.target.value)}\n >\n {[...pages.entries()].map(([pageRoute, pageBoard]) => (\n <option key={pageRoute} value={pageRoute}>\n {pageRoute} · {pageBoard.title ?? pageBoard.boardKey}\n </option>\n ))}\n </select>\n {isRequestedRouteMissing && (\n <span className=\"text-xs text-warning\">{texts.sitePageMissing(requestedRoute)}</span>\n )}\n <div className=\"ml-auto flex items-center gap-2\">\n <Button\n variant={isPlacingPin ? 'default' : 'outline'}\n size=\"sm\"\n disabled={!writesAllowed}\n aria-pressed={isPlacingPin}\n onClick={() => setIsPlacingPin(placing => !placing)}\n >\n <MapPinPlus /> {isPlacingPin ? 'Click on the page…' : 'Add pin'}\n </Button>\n <Button\n variant={isCommenting ? 'default' : 'outline'}\n size=\"sm\"\n aria-pressed={isCommenting}\n onClick={() => setIsCommenting(open => !open)}\n >\n <MessageSquare /> {threads.filter(thread => !thread.root.isResolved).length}\n </Button>\n </div>\n </header>\n <ViewportToolbar\n devices={devices}\n viewport={viewport}\n hiddenPinCount={0}\n showsDeviceFrame={showsDeviceFrame}\n onShowsDeviceFrameChange={setShowsDeviceFrame}\n onViewportChange={setChosenViewport}\n />\n <div className=\"flex min-h-0 flex-1\">\n <div ref={stageRef} className=\"flex min-h-0 flex-1 items-start justify-center overflow-auto bg-tint p-6\">\n <div style={{ width: (width + bezelPadding) * scale, height: (screenHeight + bezelPadding) * scale }}>\n <div\n className={cx('relative origin-top-left', showsDeviceFrame && 'rounded-[28px] bg-foreground p-3 shadow-surface-raised')}\n style={{ transform: scale !== 1 ? `scale(${scale})` : undefined, width: width + bezelPadding }}\n >\n <div className=\"relative overflow-hidden bg-card\" style={{ width, height: screenHeight }}>\n {htmlUrl && (\n <iframe\n key={htmlUrl}\n ref={frameRef}\n src={htmlUrl}\n title={board.title ?? board.boardKey ?? 'Page'}\n sandbox=\"allow-scripts\"\n referrerPolicy=\"no-referrer\"\n width={width}\n height={screenHeight}\n className=\"absolute inset-0 border-0 bg-transparent\"\n />\n )}\n {isPlacingPin && (\n <button\n type=\"button\"\n aria-label=\"Place the pin here\"\n className=\"absolute inset-0 z-10 cursor-crosshair bg-brand/10\"\n onClick={placePin}\n />\n )}\n {pinnedThreads.map(thread => (\n <button\n key={String(thread.root.id)}\n type=\"button\"\n aria-label={`Comment ${thread.pinNumber}`}\n onClick={() => {\n setHighlightedCommentId(Number(thread.root.id));\n setIsCommenting(true);\n }}\n className={cx(\n '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',\n thread.root.isResolved ? 'bg-muted text-muted-foreground' : 'bg-primary text-primary-foreground',\n highlightedCommentId === Number(thread.root.id) && 'scale-110 ring-brand'\n )}\n style={{ left: thread.root.x ?? 0, top: (thread.root.y ?? 0) - pageScrollTop }}\n >\n {thread.pinNumber}\n </button>\n ))}\n {pendingPin && (\n <span\n 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\"\n style={{ left: pendingPin.x, top: pendingPin.y - pageScrollTop }}\n aria-hidden\n >\n <MapPin className=\"size-4\" />\n </span>\n )}\n </div>\n <WidthDragHandle\n scale={scale}\n width={width}\n onWidthChange={nextWidth => setChosenViewport(viewportWithWidth(viewport, nextWidth))}\n />\n </div>\n </div>\n </div>\n {isCommenting && (\n <aside className=\"flex min-h-0 w-full max-w-[400px] flex-col border-l border-border\">\n <div className=\"flex items-center justify-between px-5 pt-4\">\n <p className=\"text-sm font-semibold\">{board.title ?? board.boardKey}</p>\n <Button variant=\"ghost\" size=\"icon\" aria-label=\"Close comments\" onClick={() => setIsCommenting(false)}>\n <X />\n </Button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto px-5 py-4\">\n <BoardComments\n projectKey={projectKey}\n canvasKey={canvasKey}\n board={board}\n threads={threads}\n pendingPin={pendingPin}\n onClearPendingPin={() => setPendingPin(null)}\n highlightedCommentId={highlightedCommentId}\n onHighlightComment={setHighlightedCommentId}\n writesAllowed={writesAllowed}\n showResolved={showResolved}\n onShowResolvedChange={setShowResolved}\n pinHint=\"“Add pin” marks a spot on the page\"\n onCopyThreadReference={() => undefined}\n onSelectViewport={isResponsiveBoard(board) ? setChosenViewport : undefined}\n />\n </div>\n </aside>\n )}\n </div>\n </div>\n );\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,IAAM,oBAAoB;AAqDjC,IAAM,WAAW,CAAC,EAAE,MAAM,mBAAmB,IAAI,OAAO,CAAC;AACzD,IAAM,cAAc,CAAC,EAAE,MAAM,mBAAmB,IAAI,OAAO,GAAG,EAAE,MAAM,kBAAkB,CAAC;AASlF,IAAM,wBAAwB,CAAsD;AAAA,EACzF;AAAA,EACA;AACF,MAA4E;AAC1E,QAAM,YAAY,CAAC,QACjB,GAAG,SAAS,aAAa,IAAI,UAAU,IAAI,IAAI,SAAS;AAC1D,QAAM,aAAa,CAAC,QAAgC,GAAG,SAAS,aAAa,IAAI,qBAAqB;AAItG,QAAM,iBAAiB;AACvB,QAAM,MAAM,eAAe,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,EAAE,CAAC,EAAE,gBAAgB;AAAA,IAChG,WAAW,YAAU;AAAA,MACnB,sBAAsB,MAAM,MAA0C;AAAA,QACpE,OAAO,OAAO,EAAE,KAAK,GAAG,SAAS,YAAY;AAAA,QAC7C,cAAc;AAAA,MAChB,CAAC;AAAA,MACD,oBAAoB,MAAM,MAAyD;AAAA,QACjF,OAAO,UAAQ;AAAA,UACb,KAAK,GAAG,SAAS;AAAA,UACjB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,SAAS,IAAI,SAAS,cAAc,IAAI,aAAa;AAAA,QACrF;AAAA,QACA,cAAc;AAAA,MAChB,CAAC;AAAA,MACD,oBAAoB,MAAM,MAAyD;AAAA,QACjF,OAAO,UAAQ;AAAA,UACb,KAAK,UAAU,GAAG;AAAA,UAClB,QAAQ,EAAE,OAAO,IAAI,OAAO,SAAS,IAAI,SAAS,cAAc,IAAI,aAAa;AAAA,QACnF;AAAA,QACA,cAAc;AAAA,MAChB,CAAC;AAAA,MACD,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A,gBACA;AAAA,gBACA,eAAe,eAAa,kBAAkB,kBAAkB,UAAU,SAAS,CAAC;AAAA;AAAA,YACtF;AAAA;AAAA;AAAA,MACF,GACF,GACF;AAAA,MACC,gBACC,gBAAAC,MAAC,WAAM,WAAU,qEACf;AAAA,wBAAAA,MAAC,SAAI,WAAU,+CACb;AAAA,0BAAAD,KAAC,OAAE,WAAU,yBAAyB,gBAAM,SAAS,MAAM,UAAS;AAAA,UACpE,gBAAAA,KAAC,UAAO,SAAQ,SAAQ,MAAK,QAAO,cAAW,kBAAiB,SAAS,MAAM,gBAAgB,KAAK,GAClG,0BAAAA,KAAC,KAAE,GACL;AAAA,WACF;AAAA,QACA,gBAAAA,KAAC,SAAI,WAAU,4CACb,0BAAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,mBAAmB,MAAM,cAAc,IAAI;AAAA,YAC3C;AAAA,YACA,oBAAoB;AAAA,YACpB;AAAA,YACA;AAAA,YACA,sBAAsB;AAAA,YACtB,SAAQ;AAAA,YACR,uBAAuB,MAAM;AAAA,YAC7B,kBAAkB,kBAAkB,KAAK,IAAI,oBAAoB;AAAA;AAAA,QACnE,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":["normalizeDddError","LayoutGrid","Fragment","jsx","jsxs","normalizeDddError","LayoutGrid","Fragment","jsx","jsxs","normalizeDddError","MessageSquare","useEffect","useMemo","useRef","useState","board","jsx","jsxs","useMemo","useState","useRef","useEffect","normalizeDddError","MessageSquare"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgamadeus/ddd-design-studio",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "React frontend of the design review studio for backends built with mgamadeus/ddd (Composer package mgamadeus/ddd-design-studio): project overview, a canvas of HTML design boards with live sandboxed previews and thumbnails, comment threads with pins, review statuses and plain-text design references for agents.",
5
5
  "keywords": [
6
6
  "ddd",
@@ -1,276 +0,0 @@
1
- 'use client';
2
-
3
- // src/canvas/deviceViewport.ts
4
- var FRAME_GAP = 48;
5
- var FRAME_LABEL_HEIGHT = 40;
6
- var MINIMUM_VIEWPORT_WIDTH = 240;
7
- var MAXIMUM_VIEWPORT_WIDTH = 3840;
8
- var MAX_PAGE_CANVAS_HEIGHT = 8e3;
9
- var isResponsiveBoard = (board) => Boolean(board?.isResponsive && (board.frames?.elements?.length ?? 0) > 0);
10
- var framesOf = (board) => board?.frames?.elements ?? [];
11
- var viewportOfDevice = (device) => ({
12
- width: device.width ?? 0,
13
- height: device.height ?? 0,
14
- deviceKey: device.deviceKey ?? null
15
- });
16
- var initialViewportForBoard = (board, current) => {
17
- if (!isResponsiveBoard(board)) return null;
18
- if (current) return current;
19
- const firstFrame = framesOf(board)[0];
20
- return { width: firstFrame.width ?? 0, height: firstFrame.height ?? 0, deviceKey: firstFrame.deviceKey ?? null };
21
- };
22
- var rotateViewport = (viewport, devices) => {
23
- const rotated = { width: viewport.height, height: viewport.width };
24
- const matchingDevice = devices.find((device) => device.width === rotated.width && device.height === rotated.height);
25
- return { ...rotated, deviceKey: matchingDevice?.deviceKey ?? null };
26
- };
27
- var viewportWithWidth = (viewport, width) => ({
28
- width: Math.round(Math.max(MINIMUM_VIEWPORT_WIDTH, Math.min(MAXIMUM_VIEWPORT_WIDTH, width))),
29
- height: viewport.height,
30
- deviceKey: null
31
- });
32
- var viewportLabel = (viewport, devices) => {
33
- const device = viewport.deviceKey ? devices.find((candidate) => candidate.deviceKey === viewport.deviceKey) : void 0;
34
- return `${device?.label ?? (viewport.deviceKey ?? "Free width")} \xB7 ${viewport.width} \xD7 ${viewport.height}`;
35
- };
36
- var pageHeightAtWidth = (board, width, viewportHeight) => {
37
- const frames = framesOf(board).filter((frame) => (frame.pageHeight ?? 0) > 0 && (frame.width ?? 0) > 0);
38
- const exactFrame = frames.find((frame) => frame.width === width);
39
- if (exactFrame) return Math.max(viewportHeight, exactFrame.pageHeight ?? 0);
40
- if (frames.length === 0) return viewportHeight * 3;
41
- const nearestFrame = frames.reduce(
42
- (nearest, frame) => Math.abs((frame.width ?? 0) - width) < Math.abs((nearest.width ?? 0) - width) ? frame : nearest
43
- );
44
- return Math.max(viewportHeight, Math.round((nearestFrame.pageHeight ?? 0) * (nearestFrame.width ?? 1) / Math.max(1, width)));
45
- };
46
- var frameCanvasHeight = (frame, mode) => {
47
- const viewportHeight = frame.height ?? 0;
48
- if (mode === "viewport") return viewportHeight;
49
- return Math.min(MAX_PAGE_CANVAS_HEIGHT, Math.max(viewportHeight, frame.pageHeight ?? viewportHeight));
50
- };
51
- var boardCanvasSize = (board, mode) => {
52
- if (!isResponsiveBoard(board)) return { width: board.width ?? 390, height: board.height ?? 844 };
53
- const frames = framesOf(board);
54
- const width = frames.reduce((sum, frame) => sum + (frame.width ?? 0), 0) + FRAME_GAP * (frames.length - 1);
55
- const height = FRAME_LABEL_HEIGHT + Math.max(...frames.map((frame) => frameCanvasHeight(frame, mode)));
56
- return { width, height };
57
- };
58
- var viewportOfComment = (comment) => comment.viewportWidth ? { width: comment.viewportWidth, height: comment.viewportHeight ?? comment.viewportWidth, deviceKey: comment.deviceKey ?? null } : null;
59
- var isPinInViewport = (comment, viewport) => {
60
- const commentViewport = viewportOfComment(comment);
61
- if (!viewport) return commentViewport === null;
62
- return commentViewport !== null && commentViewport.width === viewport.width;
63
- };
64
- var viewportReferenceText = (viewport) => `${viewport.width}x${viewport.height}${viewport.deviceKey ? ` ${viewport.deviceKey}` : ""}`;
65
-
66
- // src/canvas/designReference.ts
67
- var DESIGN_REFERENCE_PREFIX = "[design-ref]";
68
- var oneLine = (text) => text.replace(/\s+/g, " ").trim();
69
- var buildDesignReference = (input) => {
70
- const fields = [
71
- `${DESIGN_REFERENCE_PREFIX} ${oneLine(input.projectName)} \u203A ${oneLine(input.canvasName)} \u203A ${oneLine(input.boardTitle)}`,
72
- ...input.boardCode ? [`code ${oneLine(input.boardCode)}`] : [],
73
- `file ${input.boardKey}`,
74
- `canvas ${input.projectKey}/${input.canvasKey}`,
75
- `v${input.contentHash ? input.contentHash.slice(0, 7) : "?"}`,
76
- `theme ${input.themeReference || "none"}`,
77
- ...input.viewport ? [`viewport ${viewportReferenceText(input.viewport)}`] : []
78
- ];
79
- if (input.region) {
80
- const { x, y, width, height } = input.region;
81
- fields.push(`region ${Math.round(x)},${Math.round(y)},${Math.round(width)},${Math.round(height)}`);
82
- }
83
- if (input.comment) {
84
- const position = input.comment.x != null && input.comment.y != null ? ` at ${Math.round(input.comment.x)},${Math.round(input.comment.y)}` : "";
85
- fields.push(`comment ${input.comment.id}${position}`);
86
- }
87
- fields.push(input.url);
88
- const lines = [fields.join(" \xB7 ")];
89
- for (const commentLine of input.comment?.lines ?? []) {
90
- if (commentLine.trim()) lines.push(`comment: ${oneLine(commentLine)}`);
91
- }
92
- if (input.note?.trim()) lines.push(`note: ${oneLine(input.note)}`);
93
- return lines.join("\n");
94
- };
95
- var buildBoardDeepLink = (pageUrl, boardKey, themeId, mode, viewport) => {
96
- const url = new URL(pageUrl);
97
- url.search = "";
98
- url.hash = "";
99
- url.searchParams.set("board", boardKey);
100
- if (themeId) {
101
- url.searchParams.set("theme", themeId);
102
- url.searchParams.set("mode", mode);
103
- }
104
- if (viewport) url.searchParams.set("vp", viewport);
105
- return url.toString().replace(/%2C/gi, ",").replace(/%3A/gi, ":");
106
- };
107
- var copyTextToClipboard = async (text) => {
108
- if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
109
- try {
110
- await navigator.clipboard.writeText(text);
111
- return true;
112
- } catch {
113
- }
114
- }
115
- if (typeof document === "undefined") return false;
116
- const textarea = document.createElement("textarea");
117
- textarea.value = text;
118
- textarea.setAttribute("readonly", "");
119
- textarea.style.position = "fixed";
120
- textarea.style.opacity = "0";
121
- document.body.appendChild(textarea);
122
- textarea.select();
123
- const isCopied = document.execCommand("copy");
124
- textarea.remove();
125
- return isCopied;
126
- };
127
-
128
- // src/canvas/boardKey.ts
129
- var boardCodeOf = (boardKey) => boardKey.replace(/(?:\.dc)?\.html$/, "");
130
-
131
- // src/canvas/boardCode.ts
132
- var CODE_PARAM = "code";
133
- var normalizeBoardCode = (code) => code.toUpperCase().replace(/[^A-Z0-9]/g, "");
134
- var codeParts = (code) => code.trim().toUpperCase().split(/[\s-]+/).filter(Boolean);
135
- var boardCodeMatches = (typedCode, boardCode) => {
136
- const typed = normalizeBoardCode(typedCode);
137
- if (!typed || !boardCode) return false;
138
- const parts = codeParts(boardCode);
139
- return parts.some((_, index) => parts.slice(index).join("") === typed);
140
- };
141
- var codeBelongsToCanvas = (typedCode, canvasCode) => {
142
- const typed = normalizeBoardCode(typedCode);
143
- if (!typed || !canvasCode) return false;
144
- const parts = codeParts(canvasCode);
145
- return parts.some((_, index) => {
146
- const prefix = parts.slice(index).join("");
147
- return typed.length > prefix.length && typed.startsWith(prefix);
148
- });
149
- };
150
- var boardCodeUrlValue = (code) => codeParts(code).join("-");
151
- var buildBoardCodeLink = (canvasPageUrl, code, themeId, mode) => {
152
- const url = new URL(canvasPageUrl);
153
- url.search = "";
154
- url.hash = "";
155
- url.searchParams.set(CODE_PARAM, boardCodeUrlValue(code));
156
- if (themeId) {
157
- url.searchParams.set("theme", themeId);
158
- url.searchParams.set("mode", mode);
159
- }
160
- return url.toString().replace(/%3A/gi, ":");
161
- };
162
- var findBoardForCode = (boards, typedCode) => {
163
- const byCode = boards.filter((board) => boardCodeMatches(typedCode, board.code));
164
- if (byCode.length > 0) return byCode.length === 1 ? byCode[0] : null;
165
- const typed = typedCode.trim().toLowerCase();
166
- const byName = boards.filter((board) => board.boardKey && boardCodeOf(board.boardKey).toLowerCase() === typed);
167
- return byName.length === 1 ? byName[0] : null;
168
- };
169
-
170
- // src/canvas/designTheme.ts
171
- var splitThemeReference = (themeReference) => {
172
- const reference = (themeReference ?? "").trim();
173
- if (!reference) return null;
174
- for (const mode of ["light", "dark"]) {
175
- if (reference.endsWith(`:${mode}`)) return { themeId: reference.slice(0, -(mode.length + 1)), mode };
176
- }
177
- return { themeId: reference, mode: "light" };
178
- };
179
- var buildThemeReference = (themeId, mode) => mode === "dark" ? `${themeId}:dark` : themeId;
180
-
181
- // src/provider/texts.ts
182
- var DEFAULT_DESIGN_STUDIO_TEXTS = {
183
- referencesCopied: (count) => count > 1 ? `References copied (${count})` : "Reference copied",
184
- boardsUpdated: (count) => count === 1 ? "1 board updated" : `${count} boards updated`,
185
- showUpdatedBoard: "Show",
186
- canvasUpToDate: "Canvas is up to date",
187
- reload: "Reload (R)",
188
- thumbnailsFailed: "Thumbnails failed \xB7 try again",
189
- thumbnailsWaitingForRenderer: (themeLabel) => `Thumbnails for ${themeLabel} are waiting for the renderer`,
190
- thumbnailsRendering: (themeLabel) => `Thumbnails for ${themeLabel} are being rendered`,
191
- thumbnailsFallbackThemeLabel: "this look",
192
- thumbnailsMissing: (count) => count === 1 ? "1 board has no thumbnail in this look yet; it appears as soon as it is rendered." : `${count} boards have no thumbnail in this look yet; they appear as soon as they are rendered.`,
193
- thumbnailsLastError: (error) => `Last error: ${error}`,
194
- themeWithoutDarkMode: "This theme has no dark mode",
195
- thumbnailMissing: "No thumbnail yet",
196
- thumbnailLoading: "Loading\u2026",
197
- referenceNotePlaceholder: "What should change? (optional, goes into the reference)",
198
- boardCodeNotFound: (code) => `No board has the code ${code}`,
199
- boardLinkCopied: (code) => `Link to ${code} copied`,
200
- copyBoardLink: "Copy link"
201
- };
202
- var resolveDesignStudioTexts = (texts) => {
203
- if (!texts) return DEFAULT_DESIGN_STUDIO_TEXTS;
204
- const defined = Object.fromEntries(Object.entries(texts).filter(([, value]) => value !== void 0));
205
- return { ...DEFAULT_DESIGN_STUDIO_TEXTS, ...defined };
206
- };
207
-
208
- // src/provider/DesignStudioProvider.tsx
209
- import { createContext, useContext, useMemo } from "react";
210
- import { jsx } from "react/jsx-runtime";
211
- var DesignStudioContext = createContext(null);
212
- var DesignStudioProvider = ({ environment, children }) => /* @__PURE__ */ jsx(DesignStudioContext.Provider, { value: environment, children });
213
- var useDesignStudio = () => {
214
- const environment = useContext(DesignStudioContext);
215
- if (!environment) {
216
- throw new Error("The design studio needs a DesignStudioProvider above it");
217
- }
218
- return environment;
219
- };
220
- var useDesignStudioApi = () => useDesignStudio().api;
221
- var useDesignStudioComponents = () => useDesignStudio().components;
222
- var useDesignStudioRouter = () => useDesignStudio().router;
223
- var useDesignStudioPaths = () => useDesignStudio().paths;
224
- var useDesignStudioNotify = () => useDesignStudio().notify;
225
- var useDesignStudioTexts = () => {
226
- const { texts } = useDesignStudio();
227
- return useMemo(() => resolveDesignStudioTexts(texts), [texts]);
228
- };
229
-
230
- // src/utils/cx.ts
231
- import { clsx } from "clsx";
232
- import { twMerge } from "tailwind-merge";
233
- var cx = (...inputs) => twMerge(clsx(inputs));
234
-
235
- export {
236
- FRAME_GAP,
237
- FRAME_LABEL_HEIGHT,
238
- isResponsiveBoard,
239
- framesOf,
240
- viewportOfDevice,
241
- initialViewportForBoard,
242
- rotateViewport,
243
- viewportWithWidth,
244
- viewportLabel,
245
- pageHeightAtWidth,
246
- frameCanvasHeight,
247
- boardCanvasSize,
248
- viewportOfComment,
249
- isPinInViewport,
250
- DESIGN_REFERENCE_PREFIX,
251
- buildDesignReference,
252
- buildBoardDeepLink,
253
- copyTextToClipboard,
254
- boardCodeOf,
255
- CODE_PARAM,
256
- normalizeBoardCode,
257
- boardCodeMatches,
258
- codeBelongsToCanvas,
259
- boardCodeUrlValue,
260
- buildBoardCodeLink,
261
- findBoardForCode,
262
- splitThemeReference,
263
- buildThemeReference,
264
- DEFAULT_DESIGN_STUDIO_TEXTS,
265
- resolveDesignStudioTexts,
266
- DesignStudioProvider,
267
- useDesignStudio,
268
- useDesignStudioApi,
269
- useDesignStudioComponents,
270
- useDesignStudioRouter,
271
- useDesignStudioPaths,
272
- useDesignStudioNotify,
273
- useDesignStudioTexts,
274
- cx
275
- };
276
- //# sourceMappingURL=chunk-D2DS4FPR.js.map
@@ -1 +0,0 @@
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"],"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 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"],"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,OAAO,QAAQ,YAAY,CAAC;AAEvB,IAAM,mBAAmB,CAAC,YAA0C;AAAA,EACzE,OAAO,OAAO,SAAS;AAAA,EACvB,QAAQ,OAAO,UAAU;AAAA,EACzB,WAAW,OAAO,aAAa;AACjC;AAMO,IAAM,0BAA0B,CACrC,OACA,YAC0B;AAC1B,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,MAAI,QAAS,QAAO;AACpB,QAAM,aAAa,SAAS,KAAK,EAAE,CAAC;AACpC,SAAO,EAAE,OAAO,WAAW,SAAS,GAAG,QAAQ,WAAW,UAAU,GAAG,WAAW,WAAW,aAAa,KAAK;AACjH;AAGO,IAAM,iBAAiB,CAAC,UAA0B,YAAqD;AAC5G,QAAM,UAAU,EAAE,OAAO,SAAS,QAAQ,QAAQ,SAAS,MAAM;AAC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