@mgamadeus/ddd-design-studio 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/canvas/index.js +334 -305
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-YYKTDLFF.js → chunk-D2DS4FPR.js} +2 -1
- package/dist/{chunk-YYKTDLFF.js.map → chunk-D2DS4FPR.js.map} +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -193,6 +193,7 @@ var DEFAULT_DESIGN_STUDIO_TEXTS = {
|
|
|
193
193
|
thumbnailsLastError: (error) => `Last error: ${error}`,
|
|
194
194
|
themeWithoutDarkMode: "This theme has no dark mode",
|
|
195
195
|
thumbnailMissing: "No thumbnail yet",
|
|
196
|
+
thumbnailLoading: "Loading\u2026",
|
|
196
197
|
referenceNotePlaceholder: "What should change? (optional, goes into the reference)",
|
|
197
198
|
boardCodeNotFound: (code) => `No board has the code ${code}`,
|
|
198
199
|
boardLinkCopied: (code) => `Link to ${code} copied`,
|
|
@@ -272,4 +273,4 @@ export {
|
|
|
272
273
|
useDesignStudioTexts,
|
|
273
274
|
cx
|
|
274
275
|
};
|
|
275
|
-
//# sourceMappingURL=chunk-
|
|
276
|
+
//# sourceMappingURL=chunk-D2DS4FPR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/deviceViewport.ts","../src/canvas/designReference.ts","../src/canvas/boardKey.ts","../src/canvas/boardCode.ts","../src/canvas/designTheme.ts","../src/provider/texts.ts","../src/provider/DesignStudioProvider.tsx","../src/utils/cx.ts"],"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 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;AACjE,QAAM,iBAAiB,QAAQ,KAAK,YAAU,OAAO,UAAU,QAAQ,SAAS,OAAO,WAAW,QAAQ,MAAM;AAChH,SAAO,EAAE,GAAG,SAAS,WAAW,gBAAgB,aAAa,KAAK;AACpE;AAGO,IAAM,oBAAoB,CAAC,UAA0B,WAAmC;AAAA,EAC7F,OAAO,KAAK,MAAM,KAAK,IAAI,wBAAwB,KAAK,IAAI,wBAAwB,KAAK,CAAC,CAAC;AAAA,EAC3F,QAAQ,SAAS;AAAA,EACjB,WAAW;AACb;AAGO,IAAM,gBAAgB,CAAC,UAA0B,YAA6C;AAC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uBAAuB,MAAyB,gBAAgB,EAAE;AAExE,IAAM,wBAAwB,MAA0B,gBAAgB,EAAE;AAG1E,IAAM,uBAAuB,MAAyB;AAC3D,QAAM,EAAE,MAAM,IAAI,gBAAgB;AAClC,SAAO,QAAQ,MAAM,yBAAyB,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/D;;;ACnDA,SAA0B,YAAY;AACtC,SAAS,eAAe;AAGjB,IAAM,KAAK,IAAI,WAAiC,QAAQ,KAAK,MAAM,CAAC;","names":[]}
|
|
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,YAC0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AAA,EACxC,eAAe;AACjB;AAGO,IAAM,2BAA2B,CAAC,UAAqE;AAC5G,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,UAAU,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS,CAAC;AACnG,SAAO,EAAE,GAAG,6BAA6B,GAAG,QAAQ;AACtD;;;AC9BA,SAAS,eAA+B,YAAY,eAAe;AAuBjE;AAVF,IAAM,sBAAsB,cAA8C,IAAI;AASvE,IAAM,uBAAuB,CAAC,EAAE,aAAa,SAAS,MAC3D,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,aAAc,UAAS;AAIvD,IAAM,kBAAkB,MAA+B;AAC5D,QAAM,cAAc,WAAW,mBAAmB;AAClD,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;AAEO,IAAM,qBAAqB,MAAuB,gBAAgB,EAAE;AAEpE,IAAM,4BAA4B,MAA8B,gBAAgB,EAAE;AAElF,IAAM,wBAAwB,MAA0B,gBAAgB,EAAE;AAE1E,IAAM,uBAAuB,MAAyB,gBAAgB,EAAE;AAExE,IAAM,wBAAwB,MAA0B,gBAAgB,EAAE;AAG1E,IAAM,uBAAuB,MAAyB;AAC3D,QAAM,EAAE,MAAM,IAAI,gBAAgB;AAClC,SAAO,QAAQ,MAAM,yBAAyB,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/D;;;ACnDA,SAA0B,YAAY;AACtC,SAAS,eAAe;AAGjB,IAAM,KAAK,IAAI,WAAiC,QAAQ,KAAK,MAAM,CAAC;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,8 @@ interface DesignStudioBoardView {
|
|
|
139
139
|
thumbnailUrl?: string | null;
|
|
140
140
|
/** URL of the reduced thumbnail for far zoom levels, null when there is none (yet) */
|
|
141
141
|
thumbnailSmallUrl?: string | null;
|
|
142
|
+
/** URL of the 640 px preview (WebP / JPEG) for middle zoom levels, null when there is no thumbnail (yet) */
|
|
143
|
+
thumbnailPreviewUrl?: string | null;
|
|
142
144
|
/** The layout adapts to the viewport width: the board is shown in device frames */
|
|
143
145
|
isResponsive?: boolean;
|
|
144
146
|
/** Device frames of a responsive board, side by side (width / height of the board = their extent); null for a fixed board */
|
|
@@ -161,6 +163,8 @@ interface DesignStudioBoardFrameView {
|
|
|
161
163
|
thumbnailUrl?: string | null;
|
|
162
164
|
/** Reduced thumbnail, null until rendered */
|
|
163
165
|
thumbnailSmallUrl?: string | null;
|
|
166
|
+
/** 640 px preview (WebP / JPEG) for the canvas, null until rendered */
|
|
167
|
+
thumbnailPreviewUrl?: string | null;
|
|
164
168
|
objectType?: string | null;
|
|
165
169
|
}
|
|
166
170
|
interface DesignStudioBoardFrameViews {
|
|
@@ -849,6 +853,8 @@ interface DesignStudioTexts {
|
|
|
849
853
|
themeWithoutDarkMode: string;
|
|
850
854
|
/** Shown on a board card that has no thumbnail yet. */
|
|
851
855
|
thumbnailMissing: string;
|
|
856
|
+
/** Shown on a board card while its picture loads. */
|
|
857
|
+
thumbnailLoading: string;
|
|
852
858
|
/** Placeholder of the note field in the focus view's reference panel. */
|
|
853
859
|
referenceNotePlaceholder: string;
|
|
854
860
|
/** Toast of a code link (`?code=`) or a pasted code that names no board (`code` = what was given). */
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgamadeus/ddd-design-studio",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|