@agimon-ai/doompi-style-system 0.0.1-alpha.83 → 0.0.1-alpha.85

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.
@@ -754,10 +754,10 @@ var StyleSystem_author_preview_action_web_default = defineFill({
754
754
  });
755
755
  //#endregion
756
756
  //#region generated/web.ts
757
- const via = (identity, value) => ({
757
+ const via = (identity, value) => value === void 0 ? void 0 : {
758
758
  ...identity,
759
759
  ...value
760
- });
760
+ };
761
761
  const webPlugin = defineWebPlugin({
762
762
  id: "style-system",
763
763
  session: { get fills() {
@@ -1 +1 @@
1
- {"version":3,"file":"web.mjs","names":["routes","fillStyleSystem"],"sources":["../../src/types/apiRoutes.ts","../../generated/client.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/previewApi.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/previewFrame.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/StoryPreviewPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/StoryPreviewLauncher.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/StyleSystem.author.preview-action.web.tsx","../../generated/web.ts"],"sourcesContent":["import { apiResponse, defineApiRoutes } from '@agimon-ai/doompi-core/web';\n\nimport type {\n BuildStoryPreviewView,\n DisposeStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataView,\n} from './previewApi';\n\nexport default defineApiRoutes({\n metadata: {\n method: 'POST',\n path: '/metadata',\n response: apiResponse<StoryPreviewMetadataView>(),\n },\n build: {\n method: 'POST',\n path: '/build',\n response: apiResponse<BuildStoryPreviewView>(),\n },\n image: {\n method: 'POST',\n path: '/image',\n response: apiResponse<ExportStoryPreviewImageView>(),\n },\n dispose: {\n method: 'DELETE',\n path: '/artifact',\n response: apiResponse<DisposeStoryPreviewView>(),\n },\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { createApiClient, sessionApiAddress } from '@agimon-ai/doompi-core/web';\nimport { sealedTransport } from '@agimon-ai/doompi-web-security/browser';\n\nimport routes from '../src/types/apiRoutes';\n\n/** Scopes the tree mounts 'style-system-preview' at. */\nexport const apiScopes = ['session'] as const;\n\nexport const api = createApiClient(routes, {\n scopes: apiScopes,\n basePath: 'style-system-preview',\n transport: (input, init) => sealedTransport.fetch(input, init),\n sessionAddress: sessionApiAddress,\n});\n","import { api } from '../../../../../../generated/client';\nimport type {\n BuildStoryPreviewRequest,\n BuildStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataRequest,\n StoryPreviewMetadataView,\n} from '../../../../../types/previewApi';\n\nfunction errorMessage(result: { status: number; error: string }): string {\n if (result.status === 0) return 'The preview service is unreachable.';\n return result.error === '' ? `The preview service answered ${String(result.status)}.` : result.error;\n}\n\nexport async function storyMetadata(\n sessionId: string,\n request: StoryPreviewMetadataRequest,\n): Promise<{ ok: true; metadata: StoryPreviewMetadataView } | { ok: false; error: string }> {\n const result = await api.session(sessionId).metadata({ body: request });\n return result.ok ? { ok: true, metadata: result.data } : { ok: false, error: errorMessage(result) };\n}\n\nexport async function buildPreview(\n sessionId: string,\n request: BuildStoryPreviewRequest,\n): Promise<{ ok: true; preview: BuildStoryPreviewView } | { ok: false; error: string }> {\n const result = await api.session(sessionId).build({ body: request });\n return result.ok ? { ok: true, preview: result.data } : { ok: false, error: errorMessage(result) };\n}\n\nexport async function exportPreviewImage(\n sessionId: string,\n request: BuildStoryPreviewRequest,\n): Promise<{ ok: true; image: ExportStoryPreviewImageView } | { ok: false; error: string }> {\n const result = await api.session(sessionId).image({ body: request });\n return result.ok ? { ok: true, image: result.data } : { ok: false, error: errorMessage(result) };\n}\n\nexport async function disposePreview(sessionId: string, handle: string): Promise<void> {\n await api.session(sessionId).dispose({ body: { handle } });\n}\n","const PREVIEW_CSP =\n \"default-src 'none'; base-uri 'none'; connect-src 'none'; font-src data:; form-action 'none'; frame-src 'none'; img-src data: blob:; media-src data: blob:; object-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'\";\n\nexport interface PreviewPoint {\n x: number;\n y: number;\n}\n\nexport interface PreviewAnnotationRect extends PreviewPoint {\n width: number;\n height: number;\n}\n\nfunction findHeadInsertion(html: string): number | undefined {\n const lower = html.toLowerCase();\n let index = 0;\n while (index < html.length) {\n if (lower.startsWith('<!--', index)) {\n const end = lower.indexOf('-->', index + 4);\n index = end < 0 ? html.length : end + 3;\n continue;\n }\n if (html[index] !== '<') {\n index += 1;\n continue;\n }\n const tag = html.slice(index).match(/^<([a-z][a-z0-9:-]*)(?:\\s[^>]*)?>/i);\n if (tag === null) {\n index += 1;\n continue;\n }\n const name = tag[1]!.toLowerCase();\n const end = index + tag[0].length;\n if (name === 'head') return end;\n if (name === 'script' || name === 'style' || name === 'template' || name === 'textarea' || name === 'title') {\n const closing = lower.indexOf(`</${name}`, end);\n index = closing < 0 ? html.length : closing;\n continue;\n }\n index = end;\n }\n return undefined;\n}\n\nexport function isolatedPreviewHtml(html: string): string {\n const policy = `<meta http-equiv=\"Content-Security-Policy\" content=\"${PREVIEW_CSP}\">`;\n const headInsertion = findHeadInsertion(html);\n if (headInsertion !== undefined) return `${html.slice(0, headInsertion)}${policy}${html.slice(headInsertion)}`;\n const doctype = html.match(/^\\s*<!doctype[^>]*>/i);\n if (doctype !== null) return `${doctype[0]}<head>${policy}</head>${html.slice(doctype[0].length)}`;\n return `<head>${policy}</head>${html}`;\n}\n\nexport function normalizedAnnotationRect(start: PreviewPoint, end: PreviewPoint): PreviewAnnotationRect {\n return {\n x: Math.min(start.x, end.x),\n y: Math.min(start.y, end.y),\n width: Math.abs(end.x - start.x),\n height: Math.abs(end.y - start.y),\n };\n}\n\nexport function previewAnnotationLocation(\n tool: 'mark' | 'comment',\n start: PreviewPoint,\n end: PreviewPoint,\n):\n | { mode: 'region'; point: PreviewPoint; rect: PreviewAnnotationRect }\n | { mode: 'point'; point: PreviewPoint }\n | null {\n if (tool === 'comment') return { mode: 'point', point: end };\n const rect = normalizedAnnotationRect(start, end);\n return rect.width === 0 || rect.height === 0 ? null : { mode: 'region', point: rect, rect };\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/doompi-core/web';\nimport { Button } from '@agimon-ai/doompi-web-components';\nimport { useCallback, useEffect, useMemo, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react';\n\nimport type {\n BuildStoryPreviewRequest,\n BuildStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataView,\n StoryPreviewSeed,\n} from '../../../../../types/previewApi';\nimport { buildPreview, disposePreview, exportPreviewImage, storyMetadata } from '../_lib/previewApi';\nimport {\n isolatedPreviewHtml,\n normalizedAnnotationRect,\n previewAnnotationLocation,\n type PreviewAnnotationRect,\n type PreviewPoint,\n} from '../_lib/previewFrame';\n\nfunction imageDownload(data: string, storyExport: string): void {\n const link = document.createElement('a');\n link.href = `data:image/png;base64,${data}`;\n link.download = `${storyExport.replace(/[^A-Za-z0-9_-]/g, '-')}.png`;\n link.click();\n}\n\nfunction point(event: ReactPointerEvent<HTMLElement>): PreviewPoint {\n const bounds = event.currentTarget.getBoundingClientRect();\n return {\n x: Math.min(1, Math.max(0, (event.clientX - bounds.left) / bounds.width)),\n y: Math.min(1, Math.max(0, (event.clientY - bounds.top) / bounds.height)),\n };\n}\n\ninterface StoryPreviewSource {\n path: string;\n hasUnsavedChanges: boolean;\n kind?: string;\n revision?: number;\n sourceSha256?: string;\n}\n\ninterface StoryPreviewIdentity {\n version: 1;\n provider: string;\n projectPath: string;\n storyPath: string;\n storyExport: string;\n buildRevision: string;\n viewport: { width: number; height: number };\n sources: readonly { path: string; sha256: string }[];\n}\n\ninterface StoryPreviewPanelProps extends WebPluginSlotProps {\n seed?: StoryPreviewSeed;\n source?: StoryPreviewSource;\n activeTool?: 'select' | 'mark' | 'comment';\n displayedAnnotations?: readonly {\n ordinal: number;\n mode: 'region' | 'point';\n point: PreviewPoint;\n rect?: PreviewAnnotationRect;\n }[];\n pendingCandidate?: boolean;\n onAnnotationCandidate?: (candidate: {\n mode: 'region' | 'point';\n point: PreviewPoint;\n rect?: PreviewAnnotationRect;\n preview: StoryPreviewIdentity;\n evidence: Blob;\n thumbnailUrl: string;\n }) => void;\n}\n\nfunction preferredExport(exports: readonly StoryPreviewMetadataView['exports'][number][]): string {\n return exports.find((entry) => entry.exportName === 'Playground')?.exportName ?? exports[0]?.exportName ?? '';\n}\n\nfunction errorText(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason);\n}\n\nexport function StoryPreviewPanel({\n sessionId,\n submitCapture,\n seed,\n source,\n activeTool = 'select',\n displayedAnnotations = [],\n pendingCandidate = false,\n onAnnotationCandidate,\n}: StoryPreviewPanelProps) {\n const contextualSource = source ?? seed?.source;\n const sourcePath = contextualSource?.path ?? '';\n const sourceDirty = contextualSource?.hasUnsavedChanges === true;\n const sourceRevision = contextualSource?.revision ?? 0;\n const sourceSha256 = contextualSource?.sourceSha256 ?? '';\n const contextual = contextualSource !== undefined;\n const [appPath, setAppPath] = useState(contextual ? '' : '.');\n const [storyPath, setStoryPath] = useState(sourcePath);\n const [storyExport, setStoryExport] = useState(contextual ? '' : 'Playground');\n const [storyExports, setStoryExports] = useState<\n readonly StoryPreviewMetadataView['exports'][number][] | undefined\n >();\n const [darkMode, setDarkMode] = useState(false);\n const [preview, setPreview] = useState<BuildStoryPreviewView | undefined>(undefined);\n const [builtRequest, setBuiltRequest] = useState<BuildStoryPreviewRequest | undefined>(undefined);\n const [annotationImage, setAnnotationImage] = useState<ExportStoryPreviewImageView | undefined>(undefined);\n const [annotationStart, setAnnotationStart] = useState<PreviewPoint | undefined>(undefined);\n const [annotationRect, setAnnotationRect] = useState<PreviewAnnotationRect | undefined>(undefined);\n const [feedback, setFeedback] = useState('');\n const [status, setStatus] = useState(\n contextual\n ? sourceDirty\n ? 'Loading story metadata. Preview uses saved source.'\n : 'Loading story metadata…'\n : 'Choose an exact story file and export.',\n );\n const [working, setWorking] = useState(false);\n const generationRef = useRef(0);\n const operationRef = useRef(0);\n const previewRef = useRef<BuildStoryPreviewView | undefined>(undefined);\n const builtRequestRef = useRef<BuildStoryPreviewRequest | undefined>(undefined);\n const workingRef = useRef(false);\n const dirtyRef = useRef(sourceDirty);\n const annotationExportRef = useRef('');\n\n dirtyRef.current = sourceDirty;\n\n const request = useMemo<BuildStoryPreviewRequest>(\n () => ({ appPath, storyPath, storyExport, darkMode }),\n [appPath, storyPath, storyExport, darkMode],\n );\n\n useEffect(() => {\n operationRef.current += 1;\n if (!workingRef.current) return;\n workingRef.current = false;\n setWorking(false);\n }, [request]);\n\n useEffect(() => {\n const generation = generationRef.current + 1;\n generationRef.current = generation;\n operationRef.current += 1;\n workingRef.current = false;\n setWorking(false);\n setStoryExports(undefined);\n setAppPath(contextual ? '' : '.');\n setStoryPath(sourcePath);\n setStoryExport(contextual ? '' : 'Playground');\n builtRequestRef.current = undefined;\n setBuiltRequest(undefined);\n setAnnotationImage(undefined);\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n\n if (sessionId === null || sourcePath === '') {\n setPreview(undefined);\n previewRef.current = undefined;\n return () => {\n if (generationRef.current === generation) generationRef.current += 1;\n };\n }\n\n const previous = previewRef.current;\n previewRef.current = undefined;\n setPreview(undefined);\n if (previous !== undefined) void disposePreview(sessionId, previous.handle);\n\n let current = true;\n setStatus(sourceDirty ? 'Loading story metadata. Preview uses saved source.' : 'Loading story metadata…');\n void storyMetadata(sessionId, { storyPath: sourcePath })\n .then((result) => {\n if (!current || generationRef.current !== generation) return;\n if (!result.ok) {\n setStoryExports(undefined);\n setStatus(result.error);\n return;\n }\n const exports = result.metadata.exports;\n setAppPath(result.metadata.appPath);\n setStoryPath(result.metadata.storyPath);\n setStoryExports(exports);\n setStoryExport(preferredExport(exports));\n if (exports.length === 0) {\n setStatus('No story exports were found in this file.');\n } else if (dirtyRef.current) {\n setStatus('Save changes to preview. Preview uses saved source.');\n } else if (exports.length === 1) {\n setStatus('Story found. Building preview…');\n } else {\n setStatus('Story found. Building the Playground export…');\n }\n })\n .catch((reason: unknown) => {\n if (current && generationRef.current === generation) setStatus(errorText(reason));\n });\n\n return () => {\n current = false;\n if (generationRef.current === generation) generationRef.current += 1;\n operationRef.current += 1;\n const ownedPreview = previewRef.current;\n previewRef.current = undefined;\n if (ownedPreview !== undefined) void disposePreview(sessionId, ownedPreview.handle);\n };\n }, [contextual, sessionId, sourcePath, sourceRevision, sourceSha256]);\n\n useEffect(() => {\n if (!contextual || !sourceDirty) return;\n setStatus('Save changes to preview. Preview uses saved source.');\n }, [contextual, sourceDirty]);\n\n const rebuild = useCallback(async (): Promise<boolean> => {\n if (\n sessionId === null ||\n workingRef.current ||\n request.appPath.trim() === '' ||\n request.storyPath.trim() === '' ||\n request.storyExport.trim() === ''\n )\n return false;\n if (dirtyRef.current) {\n setStatus('Save changes to preview. Preview uses saved source.');\n return false;\n }\n\n const generation = generationRef.current;\n const operation = operationRef.current + 1;\n operationRef.current = operation;\n const requestSessionId = sessionId;\n workingRef.current = true;\n setWorking(true);\n setStatus('Building preview…');\n try {\n const result = await buildPreview(requestSessionId, request);\n if (generationRef.current !== generation || operationRef.current !== operation) {\n if (result.ok) void disposePreview(requestSessionId, result.preview.handle);\n return false;\n }\n if (!result.ok) {\n setStatus(result.error);\n return false;\n }\n const previous = previewRef.current;\n previewRef.current = result.preview;\n builtRequestRef.current = request;\n setPreview(result.preview);\n setBuiltRequest(request);\n setAnnotationImage(undefined);\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n if (previous !== undefined && previous.handle !== result.preview.handle) {\n void disposePreview(requestSessionId, previous.handle);\n }\n setStatus(\n dirtyRef.current\n ? 'Preview ready from saved source. Save changes to refresh.'\n : 'Preview ready. Refresh after source edits.',\n );\n return true;\n } catch (reason: unknown) {\n if (generationRef.current === generation && operationRef.current === operation) setStatus(errorText(reason));\n return false;\n } finally {\n if (generationRef.current === generation && operationRef.current === operation) {\n workingRef.current = false;\n setWorking(false);\n }\n }\n }, [request, sessionId]);\n\n useEffect(() => {\n if (\n !contextual ||\n sessionId === null ||\n sourceDirty ||\n storyExports === undefined ||\n storyExport.trim() === '' ||\n appPath.trim() === '' ||\n storyPath.trim() === ''\n )\n return;\n void rebuild();\n }, [appPath, contextual, rebuild, sessionId, sourceDirty, storyExport, storyExports, storyPath]);\n\n const image = useCallback(async (): Promise<ExportStoryPreviewImageView | undefined> => {\n const currentRequest = builtRequestRef.current;\n if (sessionId === null || workingRef.current || currentRequest === undefined) return undefined;\n const generation = generationRef.current;\n const operation = operationRef.current + 1;\n operationRef.current = operation;\n const requestSessionId = sessionId;\n workingRef.current = true;\n setWorking(true);\n setStatus('Rendering a fresh source-backed image…');\n try {\n const result = await exportPreviewImage(requestSessionId, currentRequest);\n if (generationRef.current !== generation || operationRef.current !== operation) return undefined;\n if (!result.ok) {\n setStatus(result.error);\n return undefined;\n }\n setStatus('Image rendered from the current source. Transient iframe interactions are not included.');\n return result.image;\n } catch (reason: unknown) {\n if (generationRef.current === generation && operationRef.current === operation) setStatus(errorText(reason));\n return undefined;\n } finally {\n if (generationRef.current === generation && operationRef.current === operation) {\n workingRef.current = false;\n setWorking(false);\n }\n }\n }, [sessionId]);\n\n async function prepareAnnotation(): Promise<void> {\n const generation = generationRef.current;\n const result = await image();\n if (result === undefined || generationRef.current !== generation) return;\n setAnnotationImage(result);\n setAnnotationRect(undefined);\n setStatus('Annotation image ready. Drag a region or comment on the whole preview.');\n }\n\n useEffect(() => {\n if (onAnnotationCandidate === undefined) return;\n if (activeTool === 'select') {\n annotationExportRef.current = '';\n setAnnotationImage(undefined);\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n return;\n }\n if (\n preview === undefined ||\n annotationImage !== undefined ||\n working ||\n annotationExportRef.current === preview.handle\n )\n return;\n const generation = generationRef.current;\n void image().then((result) => {\n if (result === undefined || generationRef.current !== generation) return;\n annotationExportRef.current = preview.handle;\n setAnnotationImage(result);\n setStatus('Frozen source-backed image ready for Author annotations.');\n });\n }, [activeTool, annotationImage, image, onAnnotationCandidate, preview, working]);\n\n function updateAnnotation(event: ReactPointerEvent<HTMLDivElement>): void {\n if (annotationStart === undefined) return;\n const end = point(event);\n setAnnotationRect(normalizedAnnotationRect(annotationStart, end));\n }\n\n function authorCandidate(location: PreviewPoint, rect?: PreviewAnnotationRect): void {\n if (annotationImage === undefined || onAnnotationCandidate === undefined || builtRequest === undefined) return;\n const binary = atob(annotationImage.data);\n const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));\n const evidence = new Blob([bytes], { type: annotationImage.mimeType });\n const thumbnailUrl = URL.createObjectURL(evidence);\n try {\n onAnnotationCandidate({\n mode: rect === undefined ? 'point' : 'region',\n point: location,\n ...(rect === undefined ? {} : { rect }),\n preview: {\n version: 1,\n provider: 'style-system',\n projectPath: builtRequest.appPath,\n storyPath: annotationImage.storyPath,\n storyExport: annotationImage.storyExport,\n buildRevision: annotationImage.sourceSha256,\n viewport: { width: annotationImage.width, height: annotationImage.height },\n sources: [{ path: annotationImage.storyPath, sha256: annotationImage.sourceSha256 }],\n },\n evidence,\n thumbnailUrl,\n });\n } catch (reason) {\n URL.revokeObjectURL(thumbnailUrl);\n setStatus(errorText(reason));\n }\n }\n\n const multipleExports = storyExports !== undefined && storyExports.length > 1;\n const previewVisible = preview !== undefined;\n const authorAnnotationActive = onAnnotationCandidate !== undefined && activeTool !== 'select';\n\n return (\n <section className=\"flex h-full min-h-0 min-w-0 flex-1 flex-col gap-3 p-3\" data-testid=\"style-system-preview-panel\">\n {contextual ? (\n <header className=\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-doom-dim\">\n <span>\n Story: <strong className=\"text-doom-text\">{storyPath || sourcePath}</strong>\n </span>\n <span>\n Project: <strong className=\"text-doom-text\">{appPath || 'resolving…'}</strong>\n </span>\n {multipleExports ? (\n <label className=\"flex items-center gap-1\">\n Export\n <select\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={storyExport}\n aria-label=\"story export\"\n onChange={(event) => {\n setStoryExport(event.target.value);\n builtRequestRef.current = undefined;\n setBuiltRequest(undefined);\n setAnnotationImage(undefined);\n setAnnotationRect(undefined);\n }}\n >\n {storyExports.map((entry) => (\n <option key={entry.exportName} value={entry.exportName}>\n {entry.label ?? entry.exportName}\n </option>\n ))}\n </select>\n </label>\n ) : storyExport !== '' ? (\n <span>\n Export: <strong className=\"text-doom-text\">{storyExport}</strong>\n </span>\n ) : null}\n </header>\n ) : (\n <header className=\"grid gap-2 md:grid-cols-3\">\n <label className=\"grid gap-1 text-xs text-doom-dim\">\n Project path\n <input\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={appPath}\n onChange={(event) => setAppPath(event.target.value)}\n />\n </label>\n <label className=\"grid gap-1 text-xs text-doom-dim\">\n Story file\n <input\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n placeholder=\"packages/ui/Button.stories.tsx\"\n value={storyPath}\n onChange={(event) => {\n setStoryPath(event.target.value);\n setStoryExports(undefined);\n }}\n />\n </label>\n <label className=\"grid gap-1 text-xs text-doom-dim\">\n Story export\n {storyExports === undefined ? (\n <input\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={storyExport}\n onChange={(event) => setStoryExport(event.target.value)}\n />\n ) : (\n <select\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={storyExport}\n onChange={(event) => setStoryExport(event.target.value)}\n >\n <option value=\"\">Choose an export</option>\n {storyExports.map((entry) => (\n <option key={entry.exportName} value={entry.exportName}>\n {entry.label ?? entry.exportName}\n </option>\n ))}\n </select>\n )}\n </label>\n </header>\n )}\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button\n disabled={\n sessionId === null ||\n working ||\n sourceDirty ||\n request.storyPath.trim() === '' ||\n request.storyExport.trim() === ''\n }\n onClick={() => void rebuild()}\n >\n {previewVisible ? 'Refresh preview' : 'Build preview'}\n </Button>\n <Button\n variant=\"outline\"\n disabled={preview === undefined || working}\n onClick={() => void image().then((result) => result && imageDownload(result.data, result.storyExport))}\n >\n Export PNG\n </Button>\n {onAnnotationCandidate === undefined ? (\n <Button\n variant=\"outline\"\n disabled={preview === undefined || working}\n onClick={() => void prepareAnnotation()}\n >\n Prepare annotation\n </Button>\n ) : null}\n <label className=\"flex items-center gap-1 text-xs text-doom-dim\">\n <input type=\"checkbox\" checked={darkMode} onChange={(event) => setDarkMode(event.target.checked)} /> Dark mode\n </label>\n <output className=\"text-xs text-doom-dim\" aria-live=\"polite\">\n {status}\n </output>\n </div>\n {sourceDirty ? (\n <p data-testid=\"style-system-preview-dirty\" className=\"text-xs text-doom-yellow\">\n Save changes to preview. Preview uses saved source.\n </p>\n ) : null}\n {preview === undefined ? (\n <div className=\"grid min-h-48 place-items-center rounded border border-dashed border-doom-border text-sm text-doom-faint\">\n No preview built.\n </div>\n ) : authorAnnotationActive && annotationImage !== undefined ? (\n <div className=\"grid min-h-0 flex-1 place-items-center overflow-hidden rounded border border-doom-border bg-doom-deep\">\n <div\n className=\"relative max-h-full w-fit max-w-full touch-none overflow-hidden\"\n aria-label={\n activeTool === 'comment' ? 'Click to place an annotation point' : 'Drag to mark an annotation region'\n }\n data-testid=\"style-system-author-annotation-overlay\"\n onPointerDown={(event) => {\n if (pendingCandidate || (activeTool !== 'mark' && activeTool !== 'comment')) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = point(event);\n setAnnotationStart(start);\n setAnnotationRect(activeTool === 'mark' ? { ...start, width: 0, height: 0 } : undefined);\n }}\n onPointerMove={(event) => {\n if (activeTool === 'mark') updateAnnotation(event);\n }}\n onPointerUp={(event) => {\n const start = annotationStart;\n if (start === undefined) return;\n const end = point(event);\n setAnnotationStart(undefined);\n const location = previewAnnotationLocation(activeTool === 'comment' ? 'comment' : 'mark', start, end);\n if (location === null) return;\n setAnnotationRect(location.mode === 'region' ? location.rect : undefined);\n authorCandidate(location.point, location.mode === 'region' ? location.rect : undefined);\n }}\n onPointerCancel={() => {\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n }}\n >\n <img\n className=\"block max-h-full max-w-full select-none\"\n src={`data:${annotationImage.mimeType};base64,${annotationImage.data}`}\n alt=\"Frozen source-backed story render for Author annotation\"\n draggable={false}\n />\n {displayedAnnotations.map((annotation) =>\n annotation.mode === 'point' || annotation.rect === undefined ? (\n <span\n key={annotation.ordinal}\n data-author-point={annotation.ordinal}\n className=\"pointer-events-none absolute z-10 flex h-5 min-w-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border-2 border-doom-deep bg-doom-yellow px-1 text-2xs font-bold text-doom-deep\"\n style={{\n left: `${String(annotation.point.x * 100)}%`,\n top: `${String(annotation.point.y * 100)}%`,\n }}\n >\n {annotation.ordinal}\n </span>\n ) : (\n <div\n key={annotation.ordinal}\n data-author-region={annotation.ordinal}\n className=\"pointer-events-none absolute border border-doom-yellow bg-doom-yellow/10\"\n style={{\n left: `${String(annotation.rect.x * 100)}%`,\n top: `${String(annotation.rect.y * 100)}%`,\n width: `${String(annotation.rect.width * 100)}%`,\n height: `${String(annotation.rect.height * 100)}%`,\n }}\n >\n <span className=\"bg-doom-yellow text-doom-deep\">{annotation.ordinal}</span>\n </div>\n ),\n )}\n {annotationRect === undefined ? null : (\n <div\n className=\"pointer-events-none absolute border-2 border-red-500 bg-red-500/10\"\n style={{\n left: `${String(annotationRect.x * 100)}%`,\n top: `${String(annotationRect.y * 100)}%`,\n width: `${String(annotationRect.width * 100)}%`,\n height: `${String(annotationRect.height * 100)}%`,\n }}\n />\n )}\n </div>\n </div>\n ) : (\n <iframe\n key={preview.handle}\n title={`${preview.storyExport} story preview`}\n sandbox=\"allow-scripts\"\n referrerPolicy=\"no-referrer\"\n srcDoc={isolatedPreviewHtml(preview.html)}\n className=\"min-h-0 flex-1 rounded border border-doom-border bg-white\"\n />\n )}\n {annotationImage === undefined || onAnnotationCandidate !== undefined ? null : (\n <div className=\"grid gap-2\">\n <div\n className=\"relative max-h-80 w-fit max-w-full touch-none overflow-hidden rounded border border-doom-border\"\n aria-label=\"Drag to mark an annotation region\"\n onPointerDown={(event) => {\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = point(event);\n setAnnotationStart(start);\n setAnnotationRect({ ...start, width: 0, height: 0 });\n }}\n onPointerMove={updateAnnotation}\n onPointerUp={(event) => {\n updateAnnotation(event);\n setAnnotationStart(undefined);\n }}\n >\n <img\n className=\"block max-h-80 max-w-full select-none\"\n src={`data:${annotationImage.mimeType};base64,${annotationImage.data}`}\n alt=\"Fresh source-backed story render for annotation\"\n draggable={false}\n />\n {annotationRect === undefined ? null : (\n <div\n className=\"pointer-events-none absolute border-2 border-red-500 bg-red-500/10\"\n style={{\n left: `${String(annotationRect.x * 100)}%`,\n top: `${String(annotationRect.y * 100)}%`,\n width: `${String(annotationRect.width * 100)}%`,\n height: `${String(annotationRect.height * 100)}%`,\n }}\n />\n )}\n </div>\n <p className=\"text-xs text-doom-faint\">\n This image is rebuilt from source and does not preserve transient iframe interactions.\n </p>\n </div>\n )}\n {preview === undefined || onAnnotationCandidate !== undefined ? null : (\n <div className=\"flex gap-2\">\n <label className=\"grid min-w-0 flex-1 gap-1 text-xs text-doom-dim\">\n AI design feedback\n <textarea\n className=\"min-h-20 rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={feedback}\n onChange={(event) => setFeedback(event.target.value)}\n />\n </label>\n <Button\n className=\"self-end\"\n variant=\"outline\"\n disabled={working || submitCapture === undefined || feedback.trim() === '' || annotationImage === undefined}\n onClick={() => {\n if (submitCapture === undefined || annotationImage === undefined) return;\n const location =\n annotationRect === undefined\n ? 'Whole preview'\n : `Region: x=${annotationRect.x.toFixed(3)}, y=${annotationRect.y.toFixed(3)}, width=${annotationRect.width.toFixed(3)}, height=${annotationRect.height.toFixed(3)}`;\n const generation = generationRef.current;\n void submitCapture({\n ...annotationImage,\n context: {\n kind: 'author-capture',\n source: 'style-system',\n id: crypto.randomUUID(),\n label: `${annotationImage.storyPath}#${annotationImage.storyExport}`,\n content: [\n 'Edit the underlying story or component source, never the generated preview HTML.',\n `Project: ${builtRequest?.appPath ?? appPath}`,\n `Story: ${annotationImage.storyPath}#${annotationImage.storyExport}`,\n `Story source sha256: ${annotationImage.sourceSha256}`,\n `Source-backed image revision: ${annotationImage.sourceSha256}`,\n location,\n `Feedback: ${feedback.trim()}`,\n 'After editing, rebuild this preview before treating it as visually verified.',\n ].join('\\n'),\n },\n })\n .then(() => {\n if (generationRef.current !== generation) return;\n setStatus('Feedback and the frozen source-backed annotation image were submitted to the agent.');\n setFeedback('');\n })\n .catch((reason: unknown) => {\n if (generationRef.current === generation) setStatus(errorText(reason));\n });\n }}\n >\n Send to AI\n </Button>\n </div>\n )}\n </section>\n );\n}\n","import type { TransientTab } from '@agimon-ai/doompi-core/web';\n\nimport type { StoryPreviewSeed } from '../../../../../types/previewApi';\nimport { StoryPreviewPanel } from './StoryPreviewPanel';\n\nfunction sourceKey(path: string): string {\n let hash = 2_166_136_261;\n for (const character of path) hash = Math.imul(hash ^ character.codePointAt(0)!, 16_777_619);\n return (hash >>> 0).toString(36);\n}\n\nexport function storyPreviewTab(seed?: StoryPreviewSeed): TransientTab {\n const sourcePath = seed?.source?.path;\n return {\n id: sourcePath === undefined ? 'style-system-story-preview' : `style-system-story-preview-${sourceKey(sourcePath)}`,\n label: 'Story preview',\n panel: (props) => <StoryPreviewPanel {...props} seed={seed} />,\n retainComposer: true,\n };\n}\n","import { defineFill } from '@agimon-ai/doompi-core/web';\n\nimport { storyPreviewTab } from '../_components/StoryPreviewLauncher';\nimport { StoryPreviewPanel } from '../_components/StoryPreviewPanel';\n\nexport default defineFill({\n slot: 'author.preview-action',\n id: 'style-system',\n data: {\n version: 1 as const,\n label: 'Preview',\n detail: 'Build, inspect, refresh, and send source-targeted visual feedback.',\n supportsSource: (source: { kind?: string }) => source.kind === 'story-preview',\n embeddedPanel: StoryPreviewPanel,\n createTab: ({ source }: { source?: { path: string; hasUnsavedChanges: boolean } }) =>\n storyPreviewTab(source === undefined ? undefined : { source }),\n },\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/doompi-core/web';\n\nimport fillStyleSystem from '../src/extensions/workspaces/sessions/(frontend)/fill/StyleSystem.author.preview-action.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => ({ ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'style-system',\n session: {\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'author.preview-action', id: 'style-system' }, fillStyleSystem)]; },\n },\n});\n"],"mappings":";;;;;;AASA,IAAA,oBAAe,gBAAgB;CAC7B,UAAU;EACR,QAAQ;EACR,MAAM;EACN,UAAU,YAAsC;CAClD;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,UAAU,YAAmC;CAC/C;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,UAAU,YAAyC;CACrD;CACA,SAAS;EACP,QAAQ;EACR,MAAM;EACN,UAAU,YAAqC;CACjD;AACF,CAAC;ACrBD,MAAa,MAAM,gBAAgBA,mBAAQ;CACzC,QAAQ,CAHgB,SAGhB;CACR,UAAU;CACV,YAAY,OAAO,SAAS,gBAAgB,MAAM,OAAO,IAAI;CAC7D,gBAAgB;AAClB,CAAC;;;ACLD,SAAS,aAAa,QAAmD;CACvE,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,OAAO,OAAO,UAAU,KAAK,gCAAgC,OAAO,OAAO,MAAM,EAAE,KAAK,OAAO;AACjG;AAEA,eAAsB,cACpB,WACA,SAC0F;CAC1F,MAAM,SAAS,MAAM,IAAI,QAAQ,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,QAAQ,CAAC;CACtE,OAAO,OAAO,KAAK;EAAE,IAAI;EAAM,UAAU,OAAO;CAAK,IAAI;EAAE,IAAI;EAAO,OAAO,aAAa,MAAM;CAAE;AACpG;AAEA,eAAsB,aACpB,WACA,SACsF;CACtF,MAAM,S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MAAM;CACN,IAAI;CACJ,MAAM;EACJ,SAAS;EACT,OAAO;EACP,QAAQ;EACR,iBAAiB,WAA8B,OAAO,SAAS;EAC/D,eAAe;EACf,YAAY,EAAE,aACZ,gBAAgB,WAAW,KAAA,IAAY,KAAA,IAAY,EAAE,OAAO,CAAC;CACjE;AACF,CAAC;;;ACZD,MAAM,OAAU,UAAmC,WAAuB;CAAE,GAAG;CAAU,GAAI;AAAiB;AAE9G,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,SAAS,EACP,IAAI,QAAyC;EAAE,OAAO,CAAC,IAAI;GAAE,MAAM;GAAyB,IAAI;EAAe,GAAGC,6CAAe,CAAC;CAAG,EACvI;AACF,CAAC"}
1
+ {"version":3,"file":"web.mjs","names":["routes","fillStyleSystem"],"sources":["../../src/types/apiRoutes.ts","../../generated/client.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/previewApi.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/previewFrame.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/StoryPreviewPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/StoryPreviewLauncher.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/StyleSystem.author.preview-action.web.tsx","../../generated/web.ts"],"sourcesContent":["import { apiResponse, defineApiRoutes } from '@agimon-ai/doompi-core/web';\n\nimport type {\n BuildStoryPreviewView,\n DisposeStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataView,\n} from './previewApi';\n\nexport default defineApiRoutes({\n metadata: {\n method: 'POST',\n path: '/metadata',\n response: apiResponse<StoryPreviewMetadataView>(),\n },\n build: {\n method: 'POST',\n path: '/build',\n response: apiResponse<BuildStoryPreviewView>(),\n },\n image: {\n method: 'POST',\n path: '/image',\n response: apiResponse<ExportStoryPreviewImageView>(),\n },\n dispose: {\n method: 'DELETE',\n path: '/artifact',\n response: apiResponse<DisposeStoryPreviewView>(),\n },\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { createApiClient, sessionApiAddress } from '@agimon-ai/doompi-core/web';\nimport { sealedTransport } from '@agimon-ai/doompi-web-security/browser';\n\nimport routes from '../src/types/apiRoutes';\n\n/** Scopes the tree mounts 'style-system-preview' at. */\nexport const apiScopes = ['session'] as const;\n\nexport const api = createApiClient(routes, {\n scopes: apiScopes,\n basePath: 'style-system-preview',\n transport: (input, init) => sealedTransport.fetch(input, init),\n sessionAddress: sessionApiAddress,\n});\n","import { api } from '../../../../../../generated/client';\nimport type {\n BuildStoryPreviewRequest,\n BuildStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataRequest,\n StoryPreviewMetadataView,\n} from '../../../../../types/previewApi';\n\nfunction errorMessage(result: { status: number; error: string }): string {\n if (result.status === 0) return 'The preview service is unreachable.';\n return result.error === '' ? `The preview service answered ${String(result.status)}.` : result.error;\n}\n\nexport async function storyMetadata(\n sessionId: string,\n request: StoryPreviewMetadataRequest,\n): Promise<{ ok: true; metadata: StoryPreviewMetadataView } | { ok: false; error: string }> {\n const result = await api.session(sessionId).metadata({ body: request });\n return result.ok ? { ok: true, metadata: result.data } : { ok: false, error: errorMessage(result) };\n}\n\nexport async function buildPreview(\n sessionId: string,\n request: BuildStoryPreviewRequest,\n): Promise<{ ok: true; preview: BuildStoryPreviewView } | { ok: false; error: string }> {\n const result = await api.session(sessionId).build({ body: request });\n return result.ok ? { ok: true, preview: result.data } : { ok: false, error: errorMessage(result) };\n}\n\nexport async function exportPreviewImage(\n sessionId: string,\n request: BuildStoryPreviewRequest,\n): Promise<{ ok: true; image: ExportStoryPreviewImageView } | { ok: false; error: string }> {\n const result = await api.session(sessionId).image({ body: request });\n return result.ok ? { ok: true, image: result.data } : { ok: false, error: errorMessage(result) };\n}\n\nexport async function disposePreview(sessionId: string, handle: string): Promise<void> {\n await api.session(sessionId).dispose({ body: { handle } });\n}\n","const PREVIEW_CSP =\n \"default-src 'none'; base-uri 'none'; connect-src 'none'; font-src data:; form-action 'none'; frame-src 'none'; img-src data: blob:; media-src data: blob:; object-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'\";\n\nexport interface PreviewPoint {\n x: number;\n y: number;\n}\n\nexport interface PreviewAnnotationRect extends PreviewPoint {\n width: number;\n height: number;\n}\n\nfunction findHeadInsertion(html: string): number | undefined {\n const lower = html.toLowerCase();\n let index = 0;\n while (index < html.length) {\n if (lower.startsWith('<!--', index)) {\n const end = lower.indexOf('-->', index + 4);\n index = end < 0 ? html.length : end + 3;\n continue;\n }\n if (html[index] !== '<') {\n index += 1;\n continue;\n }\n const tag = html.slice(index).match(/^<([a-z][a-z0-9:-]*)(?:\\s[^>]*)?>/i);\n if (tag === null) {\n index += 1;\n continue;\n }\n const name = tag[1]!.toLowerCase();\n const end = index + tag[0].length;\n if (name === 'head') return end;\n if (name === 'script' || name === 'style' || name === 'template' || name === 'textarea' || name === 'title') {\n const closing = lower.indexOf(`</${name}`, end);\n index = closing < 0 ? html.length : closing;\n continue;\n }\n index = end;\n }\n return undefined;\n}\n\nexport function isolatedPreviewHtml(html: string): string {\n const policy = `<meta http-equiv=\"Content-Security-Policy\" content=\"${PREVIEW_CSP}\">`;\n const headInsertion = findHeadInsertion(html);\n if (headInsertion !== undefined) return `${html.slice(0, headInsertion)}${policy}${html.slice(headInsertion)}`;\n const doctype = html.match(/^\\s*<!doctype[^>]*>/i);\n if (doctype !== null) return `${doctype[0]}<head>${policy}</head>${html.slice(doctype[0].length)}`;\n return `<head>${policy}</head>${html}`;\n}\n\nexport function normalizedAnnotationRect(start: PreviewPoint, end: PreviewPoint): PreviewAnnotationRect {\n return {\n x: Math.min(start.x, end.x),\n y: Math.min(start.y, end.y),\n width: Math.abs(end.x - start.x),\n height: Math.abs(end.y - start.y),\n };\n}\n\nexport function previewAnnotationLocation(\n tool: 'mark' | 'comment',\n start: PreviewPoint,\n end: PreviewPoint,\n):\n | { mode: 'region'; point: PreviewPoint; rect: PreviewAnnotationRect }\n | { mode: 'point'; point: PreviewPoint }\n | null {\n if (tool === 'comment') return { mode: 'point', point: end };\n const rect = normalizedAnnotationRect(start, end);\n return rect.width === 0 || rect.height === 0 ? null : { mode: 'region', point: rect, rect };\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/doompi-core/web';\nimport { Button } from '@agimon-ai/doompi-web-components';\nimport { useCallback, useEffect, useMemo, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react';\n\nimport type {\n BuildStoryPreviewRequest,\n BuildStoryPreviewView,\n ExportStoryPreviewImageView,\n StoryPreviewMetadataView,\n StoryPreviewSeed,\n} from '../../../../../types/previewApi';\nimport { buildPreview, disposePreview, exportPreviewImage, storyMetadata } from '../_lib/previewApi';\nimport {\n isolatedPreviewHtml,\n normalizedAnnotationRect,\n previewAnnotationLocation,\n type PreviewAnnotationRect,\n type PreviewPoint,\n} from '../_lib/previewFrame';\n\nfunction imageDownload(data: string, storyExport: string): void {\n const link = document.createElement('a');\n link.href = `data:image/png;base64,${data}`;\n link.download = `${storyExport.replace(/[^A-Za-z0-9_-]/g, '-')}.png`;\n link.click();\n}\n\nfunction point(event: ReactPointerEvent<HTMLElement>): PreviewPoint {\n const bounds = event.currentTarget.getBoundingClientRect();\n return {\n x: Math.min(1, Math.max(0, (event.clientX - bounds.left) / bounds.width)),\n y: Math.min(1, Math.max(0, (event.clientY - bounds.top) / bounds.height)),\n };\n}\n\ninterface StoryPreviewSource {\n path: string;\n hasUnsavedChanges: boolean;\n kind?: string;\n revision?: number;\n sourceSha256?: string;\n}\n\ninterface StoryPreviewIdentity {\n version: 1;\n provider: string;\n projectPath: string;\n storyPath: string;\n storyExport: string;\n buildRevision: string;\n viewport: { width: number; height: number };\n sources: readonly { path: string; sha256: string }[];\n}\n\ninterface StoryPreviewPanelProps extends WebPluginSlotProps {\n seed?: StoryPreviewSeed;\n source?: StoryPreviewSource;\n activeTool?: 'select' | 'mark' | 'comment';\n displayedAnnotations?: readonly {\n ordinal: number;\n mode: 'region' | 'point';\n point: PreviewPoint;\n rect?: PreviewAnnotationRect;\n }[];\n pendingCandidate?: boolean;\n onAnnotationCandidate?: (candidate: {\n mode: 'region' | 'point';\n point: PreviewPoint;\n rect?: PreviewAnnotationRect;\n preview: StoryPreviewIdentity;\n evidence: Blob;\n thumbnailUrl: string;\n }) => void;\n}\n\nfunction preferredExport(exports: readonly StoryPreviewMetadataView['exports'][number][]): string {\n return exports.find((entry) => entry.exportName === 'Playground')?.exportName ?? exports[0]?.exportName ?? '';\n}\n\nfunction errorText(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason);\n}\n\nexport function StoryPreviewPanel({\n sessionId,\n submitCapture,\n seed,\n source,\n activeTool = 'select',\n displayedAnnotations = [],\n pendingCandidate = false,\n onAnnotationCandidate,\n}: StoryPreviewPanelProps) {\n const contextualSource = source ?? seed?.source;\n const sourcePath = contextualSource?.path ?? '';\n const sourceDirty = contextualSource?.hasUnsavedChanges === true;\n const sourceRevision = contextualSource?.revision ?? 0;\n const sourceSha256 = contextualSource?.sourceSha256 ?? '';\n const contextual = contextualSource !== undefined;\n const [appPath, setAppPath] = useState(contextual ? '' : '.');\n const [storyPath, setStoryPath] = useState(sourcePath);\n const [storyExport, setStoryExport] = useState(contextual ? '' : 'Playground');\n const [storyExports, setStoryExports] = useState<\n readonly StoryPreviewMetadataView['exports'][number][] | undefined\n >();\n const [darkMode, setDarkMode] = useState(false);\n const [preview, setPreview] = useState<BuildStoryPreviewView | undefined>(undefined);\n const [builtRequest, setBuiltRequest] = useState<BuildStoryPreviewRequest | undefined>(undefined);\n const [annotationImage, setAnnotationImage] = useState<ExportStoryPreviewImageView | undefined>(undefined);\n const [annotationStart, setAnnotationStart] = useState<PreviewPoint | undefined>(undefined);\n const [annotationRect, setAnnotationRect] = useState<PreviewAnnotationRect | undefined>(undefined);\n const [feedback, setFeedback] = useState('');\n const [status, setStatus] = useState(\n contextual\n ? sourceDirty\n ? 'Loading story metadata. Preview uses saved source.'\n : 'Loading story metadata…'\n : 'Choose an exact story file and export.',\n );\n const [working, setWorking] = useState(false);\n const generationRef = useRef(0);\n const operationRef = useRef(0);\n const previewRef = useRef<BuildStoryPreviewView | undefined>(undefined);\n const builtRequestRef = useRef<BuildStoryPreviewRequest | undefined>(undefined);\n const workingRef = useRef(false);\n const dirtyRef = useRef(sourceDirty);\n const annotationExportRef = useRef('');\n\n dirtyRef.current = sourceDirty;\n\n const request = useMemo<BuildStoryPreviewRequest>(\n () => ({ appPath, storyPath, storyExport, darkMode }),\n [appPath, storyPath, storyExport, darkMode],\n );\n\n useEffect(() => {\n operationRef.current += 1;\n if (!workingRef.current) return;\n workingRef.current = false;\n setWorking(false);\n }, [request]);\n\n useEffect(() => {\n const generation = generationRef.current + 1;\n generationRef.current = generation;\n operationRef.current += 1;\n workingRef.current = false;\n setWorking(false);\n setStoryExports(undefined);\n setAppPath(contextual ? '' : '.');\n setStoryPath(sourcePath);\n setStoryExport(contextual ? '' : 'Playground');\n builtRequestRef.current = undefined;\n setBuiltRequest(undefined);\n setAnnotationImage(undefined);\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n\n if (sessionId === null || sourcePath === '') {\n setPreview(undefined);\n previewRef.current = undefined;\n return () => {\n if (generationRef.current === generation) generationRef.current += 1;\n };\n }\n\n const previous = previewRef.current;\n previewRef.current = undefined;\n setPreview(undefined);\n if (previous !== undefined) void disposePreview(sessionId, previous.handle);\n\n let current = true;\n setStatus(sourceDirty ? 'Loading story metadata. Preview uses saved source.' : 'Loading story metadata…');\n void storyMetadata(sessionId, { storyPath: sourcePath })\n .then((result) => {\n if (!current || generationRef.current !== generation) return;\n if (!result.ok) {\n setStoryExports(undefined);\n setStatus(result.error);\n return;\n }\n const exports = result.metadata.exports;\n setAppPath(result.metadata.appPath);\n setStoryPath(result.metadata.storyPath);\n setStoryExports(exports);\n setStoryExport(preferredExport(exports));\n if (exports.length === 0) {\n setStatus('No story exports were found in this file.');\n } else if (dirtyRef.current) {\n setStatus('Save changes to preview. Preview uses saved source.');\n } else if (exports.length === 1) {\n setStatus('Story found. Building preview…');\n } else {\n setStatus('Story found. Building the Playground export…');\n }\n })\n .catch((reason: unknown) => {\n if (current && generationRef.current === generation) setStatus(errorText(reason));\n });\n\n return () => {\n current = false;\n if (generationRef.current === generation) generationRef.current += 1;\n operationRef.current += 1;\n const ownedPreview = previewRef.current;\n previewRef.current = undefined;\n if (ownedPreview !== undefined) void disposePreview(sessionId, ownedPreview.handle);\n };\n }, [contextual, sessionId, sourcePath, sourceRevision, sourceSha256]);\n\n useEffect(() => {\n if (!contextual || !sourceDirty) return;\n setStatus('Save changes to preview. Preview uses saved source.');\n }, [contextual, sourceDirty]);\n\n const rebuild = useCallback(async (): Promise<boolean> => {\n if (\n sessionId === null ||\n workingRef.current ||\n request.appPath.trim() === '' ||\n request.storyPath.trim() === '' ||\n request.storyExport.trim() === ''\n )\n return false;\n if (dirtyRef.current) {\n setStatus('Save changes to preview. Preview uses saved source.');\n return false;\n }\n\n const generation = generationRef.current;\n const operation = operationRef.current + 1;\n operationRef.current = operation;\n const requestSessionId = sessionId;\n workingRef.current = true;\n setWorking(true);\n setStatus('Building preview…');\n try {\n const result = await buildPreview(requestSessionId, request);\n if (generationRef.current !== generation || operationRef.current !== operation) {\n if (result.ok) void disposePreview(requestSessionId, result.preview.handle);\n return false;\n }\n if (!result.ok) {\n setStatus(result.error);\n return false;\n }\n const previous = previewRef.current;\n previewRef.current = result.preview;\n builtRequestRef.current = request;\n setPreview(result.preview);\n setBuiltRequest(request);\n setAnnotationImage(undefined);\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n if (previous !== undefined && previous.handle !== result.preview.handle) {\n void disposePreview(requestSessionId, previous.handle);\n }\n setStatus(\n dirtyRef.current\n ? 'Preview ready from saved source. Save changes to refresh.'\n : 'Preview ready. Refresh after source edits.',\n );\n return true;\n } catch (reason: unknown) {\n if (generationRef.current === generation && operationRef.current === operation) setStatus(errorText(reason));\n return false;\n } finally {\n if (generationRef.current === generation && operationRef.current === operation) {\n workingRef.current = false;\n setWorking(false);\n }\n }\n }, [request, sessionId]);\n\n useEffect(() => {\n if (\n !contextual ||\n sessionId === null ||\n sourceDirty ||\n storyExports === undefined ||\n storyExport.trim() === '' ||\n appPath.trim() === '' ||\n storyPath.trim() === ''\n )\n return;\n void rebuild();\n }, [appPath, contextual, rebuild, sessionId, sourceDirty, storyExport, storyExports, storyPath]);\n\n const image = useCallback(async (): Promise<ExportStoryPreviewImageView | undefined> => {\n const currentRequest = builtRequestRef.current;\n if (sessionId === null || workingRef.current || currentRequest === undefined) return undefined;\n const generation = generationRef.current;\n const operation = operationRef.current + 1;\n operationRef.current = operation;\n const requestSessionId = sessionId;\n workingRef.current = true;\n setWorking(true);\n setStatus('Rendering a fresh source-backed image…');\n try {\n const result = await exportPreviewImage(requestSessionId, currentRequest);\n if (generationRef.current !== generation || operationRef.current !== operation) return undefined;\n if (!result.ok) {\n setStatus(result.error);\n return undefined;\n }\n setStatus('Image rendered from the current source. Transient iframe interactions are not included.');\n return result.image;\n } catch (reason: unknown) {\n if (generationRef.current === generation && operationRef.current === operation) setStatus(errorText(reason));\n return undefined;\n } finally {\n if (generationRef.current === generation && operationRef.current === operation) {\n workingRef.current = false;\n setWorking(false);\n }\n }\n }, [sessionId]);\n\n async function prepareAnnotation(): Promise<void> {\n const generation = generationRef.current;\n const result = await image();\n if (result === undefined || generationRef.current !== generation) return;\n setAnnotationImage(result);\n setAnnotationRect(undefined);\n setStatus('Annotation image ready. Drag a region or comment on the whole preview.');\n }\n\n useEffect(() => {\n if (onAnnotationCandidate === undefined) return;\n if (activeTool === 'select') {\n annotationExportRef.current = '';\n setAnnotationImage(undefined);\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n return;\n }\n if (\n preview === undefined ||\n annotationImage !== undefined ||\n working ||\n annotationExportRef.current === preview.handle\n )\n return;\n const generation = generationRef.current;\n void image().then((result) => {\n if (result === undefined || generationRef.current !== generation) return;\n annotationExportRef.current = preview.handle;\n setAnnotationImage(result);\n setStatus('Frozen source-backed image ready for Author annotations.');\n });\n }, [activeTool, annotationImage, image, onAnnotationCandidate, preview, working]);\n\n function updateAnnotation(event: ReactPointerEvent<HTMLDivElement>): void {\n if (annotationStart === undefined) return;\n const end = point(event);\n setAnnotationRect(normalizedAnnotationRect(annotationStart, end));\n }\n\n function authorCandidate(location: PreviewPoint, rect?: PreviewAnnotationRect): void {\n if (annotationImage === undefined || onAnnotationCandidate === undefined || builtRequest === undefined) return;\n const binary = atob(annotationImage.data);\n const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));\n const evidence = new Blob([bytes], { type: annotationImage.mimeType });\n const thumbnailUrl = URL.createObjectURL(evidence);\n try {\n onAnnotationCandidate({\n mode: rect === undefined ? 'point' : 'region',\n point: location,\n ...(rect === undefined ? {} : { rect }),\n preview: {\n version: 1,\n provider: 'style-system',\n projectPath: builtRequest.appPath,\n storyPath: annotationImage.storyPath,\n storyExport: annotationImage.storyExport,\n buildRevision: annotationImage.sourceSha256,\n viewport: { width: annotationImage.width, height: annotationImage.height },\n sources: [{ path: annotationImage.storyPath, sha256: annotationImage.sourceSha256 }],\n },\n evidence,\n thumbnailUrl,\n });\n } catch (reason) {\n URL.revokeObjectURL(thumbnailUrl);\n setStatus(errorText(reason));\n }\n }\n\n const multipleExports = storyExports !== undefined && storyExports.length > 1;\n const previewVisible = preview !== undefined;\n const authorAnnotationActive = onAnnotationCandidate !== undefined && activeTool !== 'select';\n\n return (\n <section className=\"flex h-full min-h-0 min-w-0 flex-1 flex-col gap-3 p-3\" data-testid=\"style-system-preview-panel\">\n {contextual ? (\n <header className=\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-doom-dim\">\n <span>\n Story: <strong className=\"text-doom-text\">{storyPath || sourcePath}</strong>\n </span>\n <span>\n Project: <strong className=\"text-doom-text\">{appPath || 'resolving…'}</strong>\n </span>\n {multipleExports ? (\n <label className=\"flex items-center gap-1\">\n Export\n <select\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={storyExport}\n aria-label=\"story export\"\n onChange={(event) => {\n setStoryExport(event.target.value);\n builtRequestRef.current = undefined;\n setBuiltRequest(undefined);\n setAnnotationImage(undefined);\n setAnnotationRect(undefined);\n }}\n >\n {storyExports.map((entry) => (\n <option key={entry.exportName} value={entry.exportName}>\n {entry.label ?? entry.exportName}\n </option>\n ))}\n </select>\n </label>\n ) : storyExport !== '' ? (\n <span>\n Export: <strong className=\"text-doom-text\">{storyExport}</strong>\n </span>\n ) : null}\n </header>\n ) : (\n <header className=\"grid gap-2 md:grid-cols-3\">\n <label className=\"grid gap-1 text-xs text-doom-dim\">\n Project path\n <input\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={appPath}\n onChange={(event) => setAppPath(event.target.value)}\n />\n </label>\n <label className=\"grid gap-1 text-xs text-doom-dim\">\n Story file\n <input\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n placeholder=\"packages/ui/Button.stories.tsx\"\n value={storyPath}\n onChange={(event) => {\n setStoryPath(event.target.value);\n setStoryExports(undefined);\n }}\n />\n </label>\n <label className=\"grid gap-1 text-xs text-doom-dim\">\n Story export\n {storyExports === undefined ? (\n <input\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={storyExport}\n onChange={(event) => setStoryExport(event.target.value)}\n />\n ) : (\n <select\n className=\"rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={storyExport}\n onChange={(event) => setStoryExport(event.target.value)}\n >\n <option value=\"\">Choose an export</option>\n {storyExports.map((entry) => (\n <option key={entry.exportName} value={entry.exportName}>\n {entry.label ?? entry.exportName}\n </option>\n ))}\n </select>\n )}\n </label>\n </header>\n )}\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button\n disabled={\n sessionId === null ||\n working ||\n sourceDirty ||\n request.storyPath.trim() === '' ||\n request.storyExport.trim() === ''\n }\n onClick={() => void rebuild()}\n >\n {previewVisible ? 'Refresh preview' : 'Build preview'}\n </Button>\n <Button\n variant=\"outline\"\n disabled={preview === undefined || working}\n onClick={() => void image().then((result) => result && imageDownload(result.data, result.storyExport))}\n >\n Export PNG\n </Button>\n {onAnnotationCandidate === undefined ? (\n <Button\n variant=\"outline\"\n disabled={preview === undefined || working}\n onClick={() => void prepareAnnotation()}\n >\n Prepare annotation\n </Button>\n ) : null}\n <label className=\"flex items-center gap-1 text-xs text-doom-dim\">\n <input type=\"checkbox\" checked={darkMode} onChange={(event) => setDarkMode(event.target.checked)} /> Dark mode\n </label>\n <output className=\"text-xs text-doom-dim\" aria-live=\"polite\">\n {status}\n </output>\n </div>\n {sourceDirty ? (\n <p data-testid=\"style-system-preview-dirty\" className=\"text-xs text-doom-yellow\">\n Save changes to preview. Preview uses saved source.\n </p>\n ) : null}\n {preview === undefined ? (\n <div className=\"grid min-h-48 place-items-center rounded border border-dashed border-doom-border text-sm text-doom-faint\">\n No preview built.\n </div>\n ) : authorAnnotationActive && annotationImage !== undefined ? (\n <div className=\"grid min-h-0 flex-1 place-items-center overflow-hidden rounded border border-doom-border bg-doom-deep\">\n <div\n className=\"relative max-h-full w-fit max-w-full touch-none overflow-hidden\"\n aria-label={\n activeTool === 'comment' ? 'Click to place an annotation point' : 'Drag to mark an annotation region'\n }\n data-testid=\"style-system-author-annotation-overlay\"\n onPointerDown={(event) => {\n if (pendingCandidate || (activeTool !== 'mark' && activeTool !== 'comment')) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = point(event);\n setAnnotationStart(start);\n setAnnotationRect(activeTool === 'mark' ? { ...start, width: 0, height: 0 } : undefined);\n }}\n onPointerMove={(event) => {\n if (activeTool === 'mark') updateAnnotation(event);\n }}\n onPointerUp={(event) => {\n const start = annotationStart;\n if (start === undefined) return;\n const end = point(event);\n setAnnotationStart(undefined);\n const location = previewAnnotationLocation(activeTool === 'comment' ? 'comment' : 'mark', start, end);\n if (location === null) return;\n setAnnotationRect(location.mode === 'region' ? location.rect : undefined);\n authorCandidate(location.point, location.mode === 'region' ? location.rect : undefined);\n }}\n onPointerCancel={() => {\n setAnnotationStart(undefined);\n setAnnotationRect(undefined);\n }}\n >\n <img\n className=\"block max-h-full max-w-full select-none\"\n src={`data:${annotationImage.mimeType};base64,${annotationImage.data}`}\n alt=\"Frozen source-backed story render for Author annotation\"\n draggable={false}\n />\n {displayedAnnotations.map((annotation) =>\n annotation.mode === 'point' || annotation.rect === undefined ? (\n <span\n key={annotation.ordinal}\n data-author-point={annotation.ordinal}\n className=\"pointer-events-none absolute z-10 flex h-5 min-w-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border-2 border-doom-deep bg-doom-yellow px-1 text-2xs font-bold text-doom-deep\"\n style={{\n left: `${String(annotation.point.x * 100)}%`,\n top: `${String(annotation.point.y * 100)}%`,\n }}\n >\n {annotation.ordinal}\n </span>\n ) : (\n <div\n key={annotation.ordinal}\n data-author-region={annotation.ordinal}\n className=\"pointer-events-none absolute border border-doom-yellow bg-doom-yellow/10\"\n style={{\n left: `${String(annotation.rect.x * 100)}%`,\n top: `${String(annotation.rect.y * 100)}%`,\n width: `${String(annotation.rect.width * 100)}%`,\n height: `${String(annotation.rect.height * 100)}%`,\n }}\n >\n <span className=\"bg-doom-yellow text-doom-deep\">{annotation.ordinal}</span>\n </div>\n ),\n )}\n {annotationRect === undefined ? null : (\n <div\n className=\"pointer-events-none absolute border-2 border-red-500 bg-red-500/10\"\n style={{\n left: `${String(annotationRect.x * 100)}%`,\n top: `${String(annotationRect.y * 100)}%`,\n width: `${String(annotationRect.width * 100)}%`,\n height: `${String(annotationRect.height * 100)}%`,\n }}\n />\n )}\n </div>\n </div>\n ) : (\n <iframe\n key={preview.handle}\n title={`${preview.storyExport} story preview`}\n sandbox=\"allow-scripts\"\n referrerPolicy=\"no-referrer\"\n srcDoc={isolatedPreviewHtml(preview.html)}\n className=\"min-h-0 flex-1 rounded border border-doom-border bg-white\"\n />\n )}\n {annotationImage === undefined || onAnnotationCandidate !== undefined ? null : (\n <div className=\"grid gap-2\">\n <div\n className=\"relative max-h-80 w-fit max-w-full touch-none overflow-hidden rounded border border-doom-border\"\n aria-label=\"Drag to mark an annotation region\"\n onPointerDown={(event) => {\n event.currentTarget.setPointerCapture(event.pointerId);\n const start = point(event);\n setAnnotationStart(start);\n setAnnotationRect({ ...start, width: 0, height: 0 });\n }}\n onPointerMove={updateAnnotation}\n onPointerUp={(event) => {\n updateAnnotation(event);\n setAnnotationStart(undefined);\n }}\n >\n <img\n className=\"block max-h-80 max-w-full select-none\"\n src={`data:${annotationImage.mimeType};base64,${annotationImage.data}`}\n alt=\"Fresh source-backed story render for annotation\"\n draggable={false}\n />\n {annotationRect === undefined ? null : (\n <div\n className=\"pointer-events-none absolute border-2 border-red-500 bg-red-500/10\"\n style={{\n left: `${String(annotationRect.x * 100)}%`,\n top: `${String(annotationRect.y * 100)}%`,\n width: `${String(annotationRect.width * 100)}%`,\n height: `${String(annotationRect.height * 100)}%`,\n }}\n />\n )}\n </div>\n <p className=\"text-xs text-doom-faint\">\n This image is rebuilt from source and does not preserve transient iframe interactions.\n </p>\n </div>\n )}\n {preview === undefined || onAnnotationCandidate !== undefined ? null : (\n <div className=\"flex gap-2\">\n <label className=\"grid min-w-0 flex-1 gap-1 text-xs text-doom-dim\">\n AI design feedback\n <textarea\n className=\"min-h-20 rounded border border-doom-border bg-doom-bg px-2 py-1 text-doom-text\"\n value={feedback}\n onChange={(event) => setFeedback(event.target.value)}\n />\n </label>\n <Button\n className=\"self-end\"\n variant=\"outline\"\n disabled={working || submitCapture === undefined || feedback.trim() === '' || annotationImage === undefined}\n onClick={() => {\n if (submitCapture === undefined || annotationImage === undefined) return;\n const location =\n annotationRect === undefined\n ? 'Whole preview'\n : `Region: x=${annotationRect.x.toFixed(3)}, y=${annotationRect.y.toFixed(3)}, width=${annotationRect.width.toFixed(3)}, height=${annotationRect.height.toFixed(3)}`;\n const generation = generationRef.current;\n void submitCapture({\n ...annotationImage,\n context: {\n kind: 'author-capture',\n source: 'style-system',\n id: crypto.randomUUID(),\n label: `${annotationImage.storyPath}#${annotationImage.storyExport}`,\n content: [\n 'Edit the underlying story or component source, never the generated preview HTML.',\n `Project: ${builtRequest?.appPath ?? appPath}`,\n `Story: ${annotationImage.storyPath}#${annotationImage.storyExport}`,\n `Story source sha256: ${annotationImage.sourceSha256}`,\n `Source-backed image revision: ${annotationImage.sourceSha256}`,\n location,\n `Feedback: ${feedback.trim()}`,\n 'After editing, rebuild this preview before treating it as visually verified.',\n ].join('\\n'),\n },\n })\n .then(() => {\n if (generationRef.current !== generation) return;\n setStatus('Feedback and the frozen source-backed annotation image were submitted to the agent.');\n setFeedback('');\n })\n .catch((reason: unknown) => {\n if (generationRef.current === generation) setStatus(errorText(reason));\n });\n }}\n >\n Send to AI\n </Button>\n </div>\n )}\n </section>\n );\n}\n","import type { TransientTab } from '@agimon-ai/doompi-core/web';\n\nimport type { StoryPreviewSeed } from '../../../../../types/previewApi';\nimport { StoryPreviewPanel } from './StoryPreviewPanel';\n\nfunction sourceKey(path: string): string {\n let hash = 2_166_136_261;\n for (const character of path) hash = Math.imul(hash ^ character.codePointAt(0)!, 16_777_619);\n return (hash >>> 0).toString(36);\n}\n\nexport function storyPreviewTab(seed?: StoryPreviewSeed): TransientTab {\n const sourcePath = seed?.source?.path;\n return {\n id: sourcePath === undefined ? 'style-system-story-preview' : `style-system-story-preview-${sourceKey(sourcePath)}`,\n label: 'Story preview',\n panel: (props) => <StoryPreviewPanel {...props} seed={seed} />,\n retainComposer: true,\n };\n}\n","import { defineFill } from '@agimon-ai/doompi-core/web';\n\nimport { storyPreviewTab } from '../_components/StoryPreviewLauncher';\nimport { StoryPreviewPanel } from '../_components/StoryPreviewPanel';\n\nexport default defineFill({\n slot: 'author.preview-action',\n id: 'style-system',\n data: {\n version: 1 as const,\n label: 'Preview',\n detail: 'Build, inspect, refresh, and send source-targeted visual feedback.',\n supportsSource: (source: { kind?: string }) => source.kind === 'story-preview',\n embeddedPanel: StoryPreviewPanel,\n createTab: ({ source }: { source?: { path: string; hasUnsavedChanges: boolean } }) =>\n storyPreviewTab(source === undefined ? undefined : { source }),\n },\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/doompi-core/web';\n\nimport fillStyleSystem from '../src/extensions/workspaces/sessions/(frontend)/fill/StyleSystem.author.preview-action.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'style-system',\n session: {\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'author.preview-action', id: 'style-system' }, fillStyleSystem)]; },\n },\n});\n"],"mappings":";;;;;;AASA,IAAA,oBAAe,gBAAgB;CAC7B,UAAU;EACR,QAAQ;EACR,MAAM;EACN,UAAU,YAAsC;CAClD;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,UAAU,YAAmC;CAC/C;CACA,OAAO;EACL,QAAQ;EACR,MAAM;EACN,UAAU,YAAyC;CACrD;CACA,SAAS;EACP,QAAQ;EACR,MAAM;EACN,UAAU,YAAqC;CACjD;AACF,CAAC;ACrBD,MAAa,MAAM,gBAAgBA,mBAAQ;CACzC,QAAQ,CAHgB,SAGhB;CACR,UAAU;CACV,YAAY,OAAO,SAAS,gBAAgB,MAAM,OAAO,IAAI;CAC7D,gBAAgB;AAClB,CAAC;;;ACLD,SAAS,aAAa,QAAmD;CACvE,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,OAAO,OAAO,UAAU,KAAK,gCAAgC,OAAO,OAAO,MAAM,EAAE,KAAK,OAAO;AACjG;AAEA,eAAsB,cACpB,WACA,SAC0F;CAC1F,MAAM,SAAS,MAAM,IAAI,QAAQ,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,QAAQ,CAAC;CACtE,OAAO,OAAO,KAAK;EAAE,IAAI;EAAM,UAAU,OAAO;CAAK,IAAI;EAAE,IAAI;EAAO,OA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AAO,CAAA;EAC7D,gBAAgB;CAClB;AACF;;;ACdA,IAAA,gDAAe,WAAW;CACxB,MAAM;CACN,IAAI;CACJ,MAAM;EACJ,SAAS;EACT,OAAO;EACP,QAAQ;EACR,iBAAiB,WAA8B,OAAO,SAAS;EAC/D,eAAe;EACf,YAAY,EAAE,aACZ,gBAAgB,WAAW,KAAA,IAAY,KAAA,IAAY,EAAE,OAAO,CAAC;CACjE;AACF,CAAC;;;ACZD,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,SAAS,EACP,IAAI,QAAyC;EAAE,OAAO,CAAC,IAAI;GAAE,MAAM;GAAyB,IAAI;EAAe,GAAGC,6CAAe,CAAC;CAAG,EACvI;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-style-system",
3
- "version": "0.0.1-alpha.83",
3
+ "version": "0.0.1-alpha.85",
4
4
  "description": "Optional DoomPi story preview integration for the style-system package.",
5
5
  "keywords": [
6
6
  "ai",
@@ -67,15 +67,15 @@
67
67
  "access": "public"
68
68
  },
69
69
  "dependencies": {
70
- "@agimon-ai/doompi-core": "0.0.1-alpha.82",
71
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.40",
72
- "@agimon-ai/doompi-web-security": "0.0.1-alpha.42",
70
+ "@agimon-ai/doompi-core": "0.0.1-alpha.84",
71
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.42",
72
+ "@agimon-ai/doompi-web-security": "0.0.1-alpha.43",
73
73
  "@agimon-ai/style-system": "0.1.5",
74
74
  "hono": "4.13.8",
75
75
  "typebox": "1.3.34"
76
76
  },
77
77
  "devDependencies": {
78
- "@agimon-ai/doompi-build": "0.0.1-alpha.11",
78
+ "@agimon-ai/doompi-build": "0.0.1-alpha.12",
79
79
  "@earendil-works/pi-coding-agent": "0.87.1",
80
80
  "@types/node": "26.6.1",
81
81
  "@types/react": "19.3.0",