@uibot/registry 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "description": "Right-click record actions (expand, duplicate, copy cells, delete) for renderRecordContextMenu.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/renderer-react@^0.15.0"
8
+ "@uibot/renderer-react@^0.16.0"
9
9
  ],
10
10
  "registryDependencies": [
11
11
  "context-menu",
@@ -5,7 +5,7 @@
5
5
  "description": "Copy (zh/en), editor prop types and Tab-commit helper shared by the UIBot collection blocks.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/renderer-react@^0.15.0"
8
+ "@uibot/renderer-react@^0.16.0"
9
9
  ],
10
10
  "registryDependencies": [],
11
11
  "files": [
@@ -5,8 +5,8 @@
5
5
  "description": "Generate a new HTML artifact or rewrite the current revision, with at-most-once dispatch and reconcile from @uibot/creation-kit.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/contracts@^0.15.0",
9
- "@uibot/creation-kit@^0.15.0"
8
+ "@uibot/contracts@^0.16.0",
9
+ "@uibot/creation-kit@^0.16.0"
10
10
  ],
11
11
  "registryDependencies": [
12
12
  "button",
@@ -5,8 +5,8 @@
5
5
  "description": "Generate a presentation from an explicitly chosen saved HTML revision.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/contracts@^0.15.0",
9
- "@uibot/creation-kit@^0.15.0"
8
+ "@uibot/contracts@^0.16.0",
9
+ "@uibot/creation-kit@^0.16.0"
10
10
  ],
11
11
  "registryDependencies": [
12
12
  "button",
@@ -5,8 +5,8 @@
5
5
  "description": "Download a saved HTML revision (PPTX for presentations) once no model request is open; the host supplies the export transport.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/contracts@^0.15.0",
9
- "@uibot/creation-kit@^0.15.0"
8
+ "@uibot/contracts@^0.16.0",
9
+ "@uibot/creation-kit@^0.16.0"
10
10
  ],
11
11
  "registryDependencies": [
12
12
  "button",
@@ -5,15 +5,15 @@
5
5
  "description": "Copy (zh/en), domain filters and run checks shared by the UIBot creation blocks.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/contracts@^0.15.0",
9
- "@uibot/creation-kit@^0.15.0"
8
+ "@uibot/contracts@^0.16.0",
9
+ "@uibot/creation-kit@^0.16.0"
10
10
  ],
11
11
  "registryDependencies": [],
12
12
  "files": [
13
13
  {
14
14
  "path": "components/uibot/creation/creation-shared.ts",
15
15
  "target": "components/uibot/creation/creation-shared.ts",
16
- "content": "import type { CreationDomain, CreationProject } from \"@uibot/contracts\";\nimport { type CreationLocale, unresolvedCreationRuns } from \"@uibot/creation-kit\";\n\n/** What the generation blocks need from the creation configuration endpoint. */\nexport interface CreationGenerationCapabilities {\n domains: CreationDomain[];\n generation?: { ready: boolean };\n}\n\nconst MESSAGES = {\n zh: {\n htmlTitle: \"HTML 生成\",\n generationUnavailable: \"当前模型生成不可用,仍可手工编辑 HTML。\",\n saveBeforeGenerate: \"请先保存或放弃草稿,再生成。\",\n kindLabel: \"生成类型\",\n kindPlaceholder: \"请选择可用类型\",\n intentLabel: \"生成描述\",\n generateNew: \"生成新 HTML 工件\",\n rewriteCurrent: \"重写当前 HTML 修订\",\n reconcile: \"核对生成状态\",\n referenceTitle: \"从已保存修订生成演示文稿\",\n presentationUnavailable: \"当前演示文稿生成不可用。\",\n saveBeforeReference: \"请先保存或放弃草稿,再引用已保存修订。\",\n referenceArtifactLabel: \"参考作品\",\n referenceArtifactPlaceholder: \"选择已保存 HTML 工件\",\n referenceRevisionLabel: \"参考修订\",\n referenceRevisionPlaceholder: \"明确选择已保存修订\",\n revisionOption: (number: number) => `修订 ${number}`,\n presentationIntentLabel: \"演示文稿描述\",\n generatePresentation: \"生成演示文稿\",\n exportTitle: \"导出已保存修订\",\n exporting: \"正在导出…\",\n exportHtml: (number: number) => `导出 HTML 修订 ${number}`,\n exportPptx: (number: number) => `导出 PPTX 修订 ${number}`,\n saveBeforeExport: \"请先保存或放弃草稿,再导出已保存修订。\",\n exportBlocked: \"原模型请求待核对期间不可导出。\",\n refreshingStatus: \"正在读取生成状态…\",\n refreshStatus: \"刷新生成状态\",\n exportFailed: \"导出失败,请稍后重试。\",\n refreshFailed: \"无法读取最新生成状态。\",\n workspaceLabel: \"作品工作区\",\n workspaceEyebrow: \"手工 HTML 工作区\",\n workspaceLoading: \"正在读取作品…\",\n workspaceLoadFailed: \"无法读取作品能力,请稍后重试。\",\n newProject: \"新建作品\",\n conflict: \"版本已更新。你的草稿仍保留;重新读取后再编辑。\",\n reread: \"重新读取\",\n projectTitleLabel: \"作品名称\",\n createProject: \"创建作品\",\n cancel: \"取消\",\n selectProjectLabel: \"选择作品\",\n artifactTitleLabel: \"工件标题\",\n artifactKindLabel: \"工件类型\",\n unavailableKindOption: (kind: string) => `${kind}(已不可用)`,\n refreshingCapabilities: \"正在刷新能力…\",\n refreshCapabilities: \"刷新工件能力\",\n appendArtifact: \"添加 HTML 工件\",\n kindUnavailable: (kind: string) => `所选工件类型“${kind}”已不可用,请重新选择或刷新能力。`,\n noHtmlDomains: \"当前没有启用的 HTML 工件类型\",\n htmlContentLabel: \"HTML 内容\",\n saveRevision: \"保存版本\",\n savedRevisionsLabel: \"已保存版本\",\n historyRevision: (number: number) => `历史版本 ${number}`,\n variantsTitle: \"多方案对比\",\n variantDirectionLabel: (index: number) => `方案 ${index} 的方向`,\n variantProjectDesign: \"按项目设计\",\n variantCustomDirection: \"自定义文字\",\n variantDirectionText: (index: number) => `方案 ${index} 的方向描述`,\n addVariant: \"增加一个方案\",\n removeVariant: (index: number) => `移除方案 ${index}`,\n generateVariants: (count: number) => `生成 ${count} 个方案`,\n variantColumn: (index: number) => `方案 ${index}`,\n variantPreview: (index: number) => `方案 ${index} 预览`,\n variantStatus: {\n sending: \"正在提交…\",\n unknown: \"提交结果未知\",\n queued: \"排队中…\",\n running: \"生成中…\",\n interrupted: \"已中断\",\n held: \"可采用\",\n completed: \"已采用\",\n failed: \"生成失败\",\n cancelled: \"已作废\",\n conflict: \"版本冲突\",\n } as Record<string, string>,\n adoptVariant: (index: number) => `采用方案 ${index}`,\n discardVariants: \"全部放弃\",\n retryVariants: \"重试提交\",\n variantsAdopted: \"已采用所选方案,作品已保存为新修订。\",\n variantsDiscarded: \"这一组方案已放弃,作品未改变。\",\n newVariantSet: \"开始新一组\",\n },\n en: {\n htmlTitle: \"HTML generation\",\n generationUnavailable: \"Model generation is unavailable; you can still edit HTML by hand.\",\n saveBeforeGenerate: \"Save or discard the draft before generating.\",\n kindLabel: \"Generation type\",\n kindPlaceholder: \"Choose an available type\",\n intentLabel: \"Generation brief\",\n generateNew: \"Generate new HTML artifact\",\n rewriteCurrent: \"Rewrite current HTML revision\",\n reconcile: \"Check generation status\",\n referenceTitle: \"Generate a presentation from a saved revision\",\n presentationUnavailable: \"Presentation generation is unavailable.\",\n saveBeforeReference: \"Save or discard the draft before referencing a saved revision.\",\n referenceArtifactLabel: \"Reference artifact\",\n referenceArtifactPlaceholder: \"Choose a saved HTML artifact\",\n referenceRevisionLabel: \"Reference revision\",\n referenceRevisionPlaceholder: \"Choose a saved revision\",\n revisionOption: (number: number) => `Revision ${number}`,\n presentationIntentLabel: \"Presentation brief\",\n generatePresentation: \"Generate presentation\",\n exportTitle: \"Export saved revision\",\n exporting: \"Exporting…\",\n exportHtml: (number: number) => `Export HTML revision ${number}`,\n exportPptx: (number: number) => `Export PPTX revision ${number}`,\n saveBeforeExport: \"Save or discard the draft before exporting a saved revision.\",\n exportBlocked: \"Export is unavailable while the original model request is being checked.\",\n refreshingStatus: \"Reading generation status…\",\n refreshStatus: \"Refresh generation status\",\n exportFailed: \"Export failed. Try again later.\",\n refreshFailed: \"Could not read the latest generation status.\",\n workspaceLabel: \"Creation workspace\",\n workspaceEyebrow: \"Manual HTML workspace\",\n workspaceLoading: \"Loading projects…\",\n workspaceLoadFailed: \"Could not read creation capabilities. Try again later.\",\n newProject: \"New project\",\n conflict: \"This revision changed. Your draft is kept; reread before editing again.\",\n reread: \"Reread\",\n projectTitleLabel: \"Project name\",\n createProject: \"Create project\",\n cancel: \"Cancel\",\n selectProjectLabel: \"Select project\",\n artifactTitleLabel: \"Artifact title\",\n artifactKindLabel: \"Artifact type\",\n unavailableKindOption: (kind: string) => `${kind} (unavailable)`,\n refreshingCapabilities: \"Refreshing capabilities…\",\n refreshCapabilities: \"Refresh artifact capabilities\",\n appendArtifact: \"Add HTML artifact\",\n kindUnavailable: (kind: string) =>\n `The selected artifact type \"${kind}\" is unavailable; choose another or refresh capabilities.`,\n noHtmlDomains: \"No HTML artifact types are enabled\",\n htmlContentLabel: \"HTML content\",\n saveRevision: \"Save revision\",\n savedRevisionsLabel: \"Saved revisions\",\n historyRevision: (number: number) => `Revision ${number}`,\n variantsTitle: \"Compare variants\",\n variantDirectionLabel: (index: number) => `Direction for variant ${index}`,\n variantProjectDesign: \"Project design\",\n variantCustomDirection: \"Custom text\",\n variantDirectionText: (index: number) => `Direction text for variant ${index}`,\n addVariant: \"Add a variant\",\n removeVariant: (index: number) => `Remove variant ${index}`,\n generateVariants: (count: number) => `Generate ${count} variants`,\n variantColumn: (index: number) => `Variant ${index}`,\n variantPreview: (index: number) => `Variant ${index} preview`,\n variantStatus: {\n sending: \"Sending…\",\n unknown: \"Send result unknown\",\n queued: \"Queued…\",\n running: \"Generating…\",\n interrupted: \"Interrupted\",\n held: \"Ready\",\n completed: \"Adopted\",\n failed: \"Failed\",\n cancelled: \"Discarded\",\n conflict: \"Revision conflict\",\n } as Record<string, string>,\n adoptVariant: (index: number) => `Adopt variant ${index}`,\n discardVariants: \"Discard all\",\n retryVariants: \"Retry sending\",\n variantsAdopted: \"The chosen variant is saved as the artifact's new revision.\",\n variantsDiscarded: \"This variant set was discarded; the artifact is unchanged.\",\n newVariantSet: \"Start a new set\",\n },\n} satisfies Record<CreationLocale, unknown>;\n\nexport type CreationBlockMessages = (typeof MESSAGES)[\"en\"];\n\nexport function creationBlockMessages(locale: CreationLocale = \"en\"): CreationBlockMessages {\n return MESSAGES[locale];\n}\n\n/** A domain that can produce HTML (directly or through HTML generation instructions). */\nexport function generatesHtml(domain: CreationDomain): boolean {\n return (\n domain.enabled &&\n domain.formats.includes(\"html\") &&\n (domain.outputFormat === \"html\" || !!domain.generationInstructions?.html)\n );\n}\n\n/** HTML-capable domains, first one per artifact kind. */\nexport function htmlGenerationDomains(domains: CreationDomain[]): CreationDomain[] {\n return domains.filter(\n (domain, index, all) =>\n generatesHtml(domain) &&\n all.findIndex((candidate) => candidate.artifactKind === domain.artifactKind) === index,\n );\n}\n\n/** True while any run may still produce a result; a malformed `runs` field fails closed. */\nexport function hasUnresolvedRun(project: CreationProject): boolean {\n const runs: unknown = project.runs;\n if (!Array.isArray(runs)) return true;\n // Checked here too: `@uibot/creation-kit` before 0.4 throws on non-object entries.\n if (runs.some((run) => !run || typeof run !== \"object\" || Array.isArray(run))) return true;\n return unresolvedCreationRuns(runs).length > 0;\n}\n\n/** Artifact kinds whose saved HTML revisions can be exported or referenced. */\nexport const HTML_DOCUMENT_KINDS = [\"web\", \"presentation\"];\n\n/** Shared field styling for the native controls the blocks use. */\nexport const FIELD_CLASS =\n \"flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n",
16
+ "content": "import type { CreationDomain, CreationProject } from \"@uibot/contracts\";\nimport { type CreationLocale, unresolvedCreationRuns } from \"@uibot/creation-kit\";\n\n/** What the generation blocks need from the creation configuration endpoint. */\nexport interface CreationGenerationCapabilities {\n domains: CreationDomain[];\n generation?: { ready: boolean };\n}\n\nconst MESSAGES = {\n zh: {\n htmlTitle: \"HTML 生成\",\n generationUnavailable: \"当前模型生成不可用,仍可手工编辑 HTML。\",\n saveBeforeGenerate: \"请先保存或放弃草稿,再生成。\",\n kindLabel: \"生成类型\",\n kindPlaceholder: \"请选择可用类型\",\n intentLabel: \"生成描述\",\n generateNew: \"生成新 HTML 工件\",\n rewriteCurrent: \"重写当前 HTML 修订\",\n reconcile: \"核对生成状态\",\n referenceTitle: \"从已保存修订生成演示文稿\",\n presentationUnavailable: \"当前演示文稿生成不可用。\",\n saveBeforeReference: \"请先保存或放弃草稿,再引用已保存修订。\",\n referenceArtifactLabel: \"参考作品\",\n referenceArtifactPlaceholder: \"选择已保存 HTML 工件\",\n referenceRevisionLabel: \"参考修订\",\n referenceRevisionPlaceholder: \"明确选择已保存修订\",\n revisionOption: (number: number) => `修订 ${number}`,\n presentationIntentLabel: \"演示文稿描述\",\n generatePresentation: \"生成演示文稿\",\n exportTitle: \"导出已保存修订\",\n exporting: \"正在导出…\",\n exportHtml: (number: number) => `导出 HTML 修订 ${number}`,\n exportPptx: (number: number) => `导出 PPTX 修订 ${number}`,\n saveBeforeExport: \"请先保存或放弃草稿,再导出已保存修订。\",\n exportBlocked: \"原模型请求待核对期间不可导出。\",\n refreshingStatus: \"正在读取生成状态…\",\n refreshStatus: \"刷新生成状态\",\n exportFailed: \"导出失败,请稍后重试。\",\n refreshFailed: \"无法读取最新生成状态。\",\n workspaceLabel: \"作品工作区\",\n workspaceEyebrow: \"手工 HTML 工作区\",\n workspaceLoading: \"正在读取作品…\",\n workspaceLoadFailed: \"无法读取作品能力,请稍后重试。\",\n newProject: \"新建作品\",\n conflict: \"版本已更新。你的草稿仍保留;重新读取后再编辑。\",\n reread: \"重新读取\",\n projectTitleLabel: \"作品名称\",\n createProject: \"创建作品\",\n cancel: \"取消\",\n selectProjectLabel: \"选择作品\",\n artifactTitleLabel: \"工件标题\",\n artifactKindLabel: \"工件类型\",\n unavailableKindOption: (kind: string) => `${kind}(已不可用)`,\n refreshingCapabilities: \"正在刷新能力…\",\n refreshCapabilities: \"刷新工件能力\",\n appendArtifact: \"添加 HTML 工件\",\n kindUnavailable: (kind: string) => `所选工件类型“${kind}”已不可用,请重新选择或刷新能力。`,\n noHtmlDomains: \"当前没有启用的 HTML 工件类型\",\n htmlContentLabel: \"HTML 内容\",\n saveRevision: \"保存版本\",\n savedRevisionsLabel: \"已保存版本\",\n historyRevision: (number: number) => `历史版本 ${number}`,\n variantsTitle: \"多方案对比\",\n variantsIntentLabel: \"多方案描述\",\n variantDirectionLabel: (index: number) => `方案 ${index} 的方向`,\n variantProjectDesign: \"按项目设计\",\n variantCustomDirection: \"自定义文字\",\n variantDirectionText: (index: number) => `方案 ${index} 的方向描述`,\n addVariant: \"增加一个方案\",\n removeVariant: (index: number) => `移除方案 ${index}`,\n generateVariants: (count: number) => `生成 ${count} 个方案`,\n variantColumn: (index: number) => `方案 ${index}`,\n variantPreview: (index: number) => `方案 ${index} 预览`,\n variantStatus: {\n sending: \"正在提交…\",\n unknown: \"提交结果未知\",\n queued: \"排队中…\",\n running: \"生成中…\",\n interrupted: \"已中断\",\n held: \"可采用\",\n completed: \"已采用\",\n failed: \"生成失败\",\n cancelled: \"已作废\",\n conflict: \"版本冲突\",\n } as Record<string, string>,\n adoptVariant: (index: number) => `采用方案 ${index}`,\n discardVariants: \"全部放弃\",\n retryVariants: \"重试提交\",\n variantsAdopted: \"已采用所选方案,作品已保存为新修订。\",\n variantsDiscarded: \"这一组方案已放弃,作品未改变。\",\n newVariantSet: \"开始新一组\",\n },\n en: {\n htmlTitle: \"HTML generation\",\n generationUnavailable: \"Model generation is unavailable; you can still edit HTML by hand.\",\n saveBeforeGenerate: \"Save or discard the draft before generating.\",\n kindLabel: \"Generation type\",\n kindPlaceholder: \"Choose an available type\",\n intentLabel: \"Generation brief\",\n generateNew: \"Generate new HTML artifact\",\n rewriteCurrent: \"Rewrite current HTML revision\",\n reconcile: \"Check generation status\",\n referenceTitle: \"Generate a presentation from a saved revision\",\n presentationUnavailable: \"Presentation generation is unavailable.\",\n saveBeforeReference: \"Save or discard the draft before referencing a saved revision.\",\n referenceArtifactLabel: \"Reference artifact\",\n referenceArtifactPlaceholder: \"Choose a saved HTML artifact\",\n referenceRevisionLabel: \"Reference revision\",\n referenceRevisionPlaceholder: \"Choose a saved revision\",\n revisionOption: (number: number) => `Revision ${number}`,\n presentationIntentLabel: \"Presentation brief\",\n generatePresentation: \"Generate presentation\",\n exportTitle: \"Export saved revision\",\n exporting: \"Exporting…\",\n exportHtml: (number: number) => `Export HTML revision ${number}`,\n exportPptx: (number: number) => `Export PPTX revision ${number}`,\n saveBeforeExport: \"Save or discard the draft before exporting a saved revision.\",\n exportBlocked: \"Export is unavailable while the original model request is being checked.\",\n refreshingStatus: \"Reading generation status…\",\n refreshStatus: \"Refresh generation status\",\n exportFailed: \"Export failed. Try again later.\",\n refreshFailed: \"Could not read the latest generation status.\",\n workspaceLabel: \"Creation workspace\",\n workspaceEyebrow: \"Manual HTML workspace\",\n workspaceLoading: \"Loading projects…\",\n workspaceLoadFailed: \"Could not read creation capabilities. Try again later.\",\n newProject: \"New project\",\n conflict: \"This revision changed. Your draft is kept; reread before editing again.\",\n reread: \"Reread\",\n projectTitleLabel: \"Project name\",\n createProject: \"Create project\",\n cancel: \"Cancel\",\n selectProjectLabel: \"Select project\",\n artifactTitleLabel: \"Artifact title\",\n artifactKindLabel: \"Artifact type\",\n unavailableKindOption: (kind: string) => `${kind} (unavailable)`,\n refreshingCapabilities: \"Refreshing capabilities…\",\n refreshCapabilities: \"Refresh artifact capabilities\",\n appendArtifact: \"Add HTML artifact\",\n kindUnavailable: (kind: string) =>\n `The selected artifact type \"${kind}\" is unavailable; choose another or refresh capabilities.`,\n noHtmlDomains: \"No HTML artifact types are enabled\",\n htmlContentLabel: \"HTML content\",\n saveRevision: \"Save revision\",\n savedRevisionsLabel: \"Saved revisions\",\n historyRevision: (number: number) => `Revision ${number}`,\n variantsTitle: \"Compare variants\",\n variantsIntentLabel: \"Variants description\",\n variantDirectionLabel: (index: number) => `Direction for variant ${index}`,\n variantProjectDesign: \"Project design\",\n variantCustomDirection: \"Custom text\",\n variantDirectionText: (index: number) => `Direction text for variant ${index}`,\n addVariant: \"Add a variant\",\n removeVariant: (index: number) => `Remove variant ${index}`,\n generateVariants: (count: number) => `Generate ${count} variants`,\n variantColumn: (index: number) => `Variant ${index}`,\n variantPreview: (index: number) => `Variant ${index} preview`,\n variantStatus: {\n sending: \"Sending…\",\n unknown: \"Send result unknown\",\n queued: \"Queued…\",\n running: \"Generating…\",\n interrupted: \"Interrupted\",\n held: \"Ready\",\n completed: \"Adopted\",\n failed: \"Failed\",\n cancelled: \"Discarded\",\n conflict: \"Revision conflict\",\n } as Record<string, string>,\n adoptVariant: (index: number) => `Adopt variant ${index}`,\n discardVariants: \"Discard all\",\n retryVariants: \"Retry sending\",\n variantsAdopted: \"The chosen variant is saved as the artifact's new revision.\",\n variantsDiscarded: \"This variant set was discarded; the artifact is unchanged.\",\n newVariantSet: \"Start a new set\",\n },\n} satisfies Record<CreationLocale, unknown>;\n\nexport type CreationBlockMessages = (typeof MESSAGES)[\"en\"];\n\nexport function creationBlockMessages(locale: CreationLocale = \"en\"): CreationBlockMessages {\n return MESSAGES[locale];\n}\n\n/** A domain that can produce HTML (directly or through HTML generation instructions). */\nexport function generatesHtml(domain: CreationDomain): boolean {\n return (\n domain.enabled &&\n domain.formats.includes(\"html\") &&\n (domain.outputFormat === \"html\" || !!domain.generationInstructions?.html)\n );\n}\n\n/** HTML-capable domains, first one per artifact kind. */\nexport function htmlGenerationDomains(domains: CreationDomain[]): CreationDomain[] {\n return domains.filter(\n (domain, index, all) =>\n generatesHtml(domain) &&\n all.findIndex((candidate) => candidate.artifactKind === domain.artifactKind) === index,\n );\n}\n\n/** True while any run may still produce a result; a malformed `runs` field fails closed. */\nexport function hasUnresolvedRun(project: CreationProject): boolean {\n const runs: unknown = project.runs;\n if (!Array.isArray(runs)) return true;\n // Checked here too: `@uibot/creation-kit` before 0.4 throws on non-object entries.\n if (runs.some((run) => !run || typeof run !== \"object\" || Array.isArray(run))) return true;\n return unresolvedCreationRuns(runs).length > 0;\n}\n\n/** Artifact kinds whose saved HTML revisions can be exported or referenced. */\nexport const HTML_DOCUMENT_KINDS = [\"web\", \"presentation\"];\n\n/** Shared field styling for the native controls the blocks use. */\nexport const FIELD_CLASS =\n \"flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n",
17
17
  "type": "registry:lib"
18
18
  }
19
19
  ],
@@ -5,9 +5,9 @@
5
5
  "description": "Generate two or three HTML candidates side by side (project design, design guides or custom directions) and adopt one as the next revision, over useCreationVariants.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/contracts@^0.15.0",
9
- "@uibot/creation-kit@^0.15.0",
10
- "@uibot/web-preview@^0.15.0"
8
+ "@uibot/contracts@^0.16.0",
9
+ "@uibot/creation-kit@^0.16.0",
10
+ "@uibot/web-preview@^0.16.0"
11
11
  ],
12
12
  "registryDependencies": [
13
13
  "button",
@@ -20,7 +20,7 @@
20
20
  {
21
21
  "path": "components/uibot/creation/creation-variant-compare.tsx",
22
22
  "target": "components/uibot/creation/creation-variant-compare.tsx",
23
- "content": "import { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport {\n type CreationLocale,\n type CreationRunStorage,\n type CreationVariantDirection,\n type CreationVariantsClient,\n defaultVariantDirections,\n useCreationVariants,\n} from \"@uibot/creation-kit\";\nimport {\n APP_SRCDOC_CSP,\n buildErrorBridgeScript,\n cspMetaTag,\n SANDBOX_STORAGE_SHIM_SCRIPT,\n} from \"@uibot/web-preview\";\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { creationBlockMessages, FIELD_CLASS } from \"./creation-shared\";\n\nexport interface CreationVariantCompareProps {\n client: CreationVariantsClient;\n projectId: string;\n /** Artifact kind generated (an HTML domain, e.g. `web`). */\n kind: string;\n /** Update this artifact; omit to create a new one from the adopted candidate. */\n artifactId?: string;\n expectedRevisionId?: string | null;\n /** Set reservation key; scope it to the signed-in identity and project. */\n storageKey: string;\n storage?: CreationRunStorage;\n locale?: CreationLocale;\n initialIntent?: string;\n /** Called after a candidate is adopted, with the committed revision. */\n onAdopted?: (revisionId: string) => void;\n /** Poll interval while candidates generate (default 1500 ms). */\n pollMs?: number;\n /** Blocks starting and adopting (e.g. while the host has an unsaved draft). */\n disabled?: boolean;\n}\n\nconst CUSTOM = \"__custom__\";\nconst PROJECT = \"__project__\";\n\n/** Candidate HTML in a sandboxed frame, with the same shims and CSP as the preview. */\nfunction previewDocument(html: string): string {\n const shims = `${cspMetaTag(APP_SRCDOC_CSP)}${SANDBOX_STORAGE_SHIM_SCRIPT}${buildErrorBridgeScript()}`;\n const head = /<head\\b[^>]*>/i.exec(html);\n return head ? html.replace(head[0], (tag) => `${tag}${shims}`) : `${shims}${html}`;\n}\n\n/**\n * Generate two or three HTML candidates side by side and adopt one (the rest are cancelled) or\n * discard the set. Logic lives in `useCreationVariants`; the host passes transport and storage.\n * Key the component by identity, project and artifact so a switch starts fresh.\n */\nexport function CreationVariantCompare({\n client,\n projectId,\n kind,\n artifactId,\n expectedRevisionId,\n storageKey,\n storage,\n locale,\n initialIntent = \"\",\n onAdopted,\n pollMs,\n disabled = false,\n}: CreationVariantCompareProps) {\n const t = creationBlockMessages(locale);\n const id = useId();\n const variants = useCreationVariants({\n client,\n projectId,\n storageKey,\n ...(storage ? { storage } : {}),\n ...(locale ? { locale } : {}),\n ...(pollMs ? { pollMs } : {}),\n });\n const [intent, setIntent] = useState(initialIntent);\n // Rows keep a stable key so removing one does not remount the others.\n const [rows, setRows] = useState<{ key: number; direction: CreationVariantDirection }[] | null>(\n null,\n );\n const nextKey = useRef(3);\n const shownRows =\n rows ??\n defaultVariantDirections(variants.designs).map((direction, key) => ({ key, direction }));\n const shown = shownRows.map((row) => row.direction);\n const update = (index: number, direction: CreationVariantDirection) =>\n setRows(shownRows.map((row, position) => (position === index ? { ...row, direction } : row)));\n\n const adoptedRevisionId = variants.adoptedRevisionId;\n useEffect(() => {\n if (adoptedRevisionId) onAdopted?.(adoptedRevisionId);\n }, [adoptedRevisionId, onAdopted]);\n\n const selection = (direction: CreationVariantDirection) =>\n direction.designMdId ?? (direction.text !== undefined ? CUSTOM : PROJECT);\n\n return (\n <section aria-label={t.variantsTitle} className=\"flex flex-col gap-3 rounded-lg border p-4\">\n <h2 className=\"text-sm font-semibold\">{t.variantsTitle}</h2>\n {variants.message && (\n <p role=\"status\" className=\"text-sm\">\n {variants.message}\n </p>\n )}\n {variants.phase === \"idle\" && (\n <form\n className=\"flex flex-col gap-3\"\n onSubmit={(event) => {\n event.preventDefault();\n void variants.start({\n kind,\n intent,\n ...(artifactId ? { artifactId } : {}),\n ...(expectedRevisionId !== undefined ? { expectedRevisionId } : {}),\n directions: shown,\n });\n }}\n >\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-intent`}>{t.intentLabel}</Label>\n <Textarea\n id={`${id}-intent`}\n value={intent}\n onChange={(event) => setIntent(event.target.value)}\n />\n </div>\n {shownRows.map(({ key, direction }, index) => (\n <div key={key} className=\"flex flex-wrap items-end gap-2\">\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-direction-${index}`}>\n {t.variantDirectionLabel(index + 1)}\n </Label>\n <select\n id={`${id}-direction-${index}`}\n className={FIELD_CLASS}\n value={selection(direction)}\n onChange={(event) => {\n const value = event.target.value;\n update(\n index,\n value === PROJECT\n ? {}\n : value === CUSTOM\n ? { text: \"\" }\n : { designMdId: value },\n );\n }}\n >\n <option value={PROJECT}>{t.variantProjectDesign}</option>\n {variants.designs.map((design) => (\n <option key={design.id} value={design.id}>\n {design.title}\n </option>\n ))}\n <option value={CUSTOM}>{t.variantCustomDirection}</option>\n </select>\n </div>\n {direction.text !== undefined && (\n <Input\n aria-label={t.variantDirectionText(index + 1)}\n value={direction.text}\n onChange={(event) => update(index, { text: event.target.value })}\n />\n )}\n {shown.length > 2 && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setRows(shownRows.filter((_, position) => position !== index))}\n >\n {t.removeVariant(index + 1)}\n </Button>\n )}\n </div>\n ))}\n <div className=\"flex flex-wrap gap-2\">\n {shown.length < 3 && (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setRows([...shownRows, { key: nextKey.current++, direction: {} }])}\n >\n {t.addVariant}\n </Button>\n )}\n <Button\n type=\"submit\"\n disabled={\n disabled ||\n variants.busy ||\n !intent.trim() ||\n shown.some((direction) => direction.text !== undefined && !direction.text.trim())\n }\n >\n {t.generateVariants(shown.length)}\n </Button>\n </div>\n </form>\n )}\n {(variants.phase === \"generating\" || variants.phase === \"choosing\") && (\n <>\n <div\n className=\"grid gap-3\"\n style={{ gridTemplateColumns: `repeat(${variants.candidates.length}, minmax(0, 1fr))` }}\n >\n {variants.candidates.map((candidate) => (\n <article\n key={candidate.requestId}\n aria-label={t.variantColumn(candidate.index + 1)}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <header className=\"flex items-center justify-between gap-2 text-sm\">\n <span className=\"font-medium\">{t.variantColumn(candidate.index + 1)}</span>\n <span className=\"text-muted-foreground\">\n {t.variantStatus[candidate.status] ?? candidate.status}\n </span>\n </header>\n {candidate.html ? (\n <iframe\n title={t.variantPreview(candidate.index + 1)}\n sandbox=\"allow-scripts\"\n srcDoc={previewDocument(candidate.html)}\n className=\"h-80 w-full rounded-md border bg-background\"\n />\n ) : (\n <div className=\"flex h-80 items-center justify-center rounded-md border text-sm text-muted-foreground\">\n {candidate.error ?? \"\"}\n </div>\n )}\n {candidate.status === \"held\" && candidate.runId && (\n <Button\n type=\"button\"\n disabled={disabled || variants.busy}\n onClick={() => candidate.runId && void variants.adopt(candidate.runId)}\n >\n {t.adoptVariant(candidate.index + 1)}\n </Button>\n )}\n </article>\n ))}\n </div>\n <div className=\"flex flex-wrap gap-2\">\n {variants.candidates.some((candidate) => candidate.status === \"unknown\") && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={variants.busy}\n onClick={() => void variants.retrySend()}\n >\n {t.retryVariants}\n </Button>\n )}\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={variants.busy}\n onClick={() => void variants.discard()}\n >\n {t.discardVariants}\n </Button>\n </div>\n </>\n )}\n {(variants.phase === \"adopted\" || variants.phase === \"discarded\") && (\n <div className=\"flex flex-wrap items-center gap-3 text-sm\">\n <p role=\"status\">\n {variants.phase === \"adopted\" ? t.variantsAdopted : t.variantsDiscarded}\n </p>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n setRows(null);\n variants.reset();\n }}\n >\n {t.newVariantSet}\n </Button>\n </div>\n )}\n </section>\n );\n}\n",
23
+ "content": "import { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport {\n type CreationLocale,\n type CreationRunStorage,\n type CreationVariantDirection,\n type CreationVariantsClient,\n defaultVariantDirections,\n useCreationVariants,\n} from \"@uibot/creation-kit\";\nimport {\n APP_SRCDOC_CSP,\n buildErrorBridgeScript,\n cspMetaTag,\n SANDBOX_STORAGE_SHIM_SCRIPT,\n} from \"@uibot/web-preview\";\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { creationBlockMessages, FIELD_CLASS } from \"./creation-shared\";\n\nexport interface CreationVariantCompareProps {\n client: CreationVariantsClient;\n projectId: string;\n /** Artifact kind generated (an HTML domain, e.g. `web`). */\n kind: string;\n /** Update this artifact; omit to create a new one from the adopted candidate. */\n artifactId?: string;\n expectedRevisionId?: string | null;\n /** Set reservation key; scope it to the signed-in identity and project. */\n storageKey: string;\n storage?: CreationRunStorage;\n locale?: CreationLocale;\n initialIntent?: string;\n /** Called after a candidate is adopted, with the committed revision. */\n onAdopted?: (revisionId: string) => void;\n /** Poll interval while candidates generate (default 1500 ms). */\n pollMs?: number;\n /** Blocks starting and adopting (e.g. while the host has an unsaved draft). */\n disabled?: boolean;\n}\n\nconst CUSTOM = \"__custom__\";\nconst PROJECT = \"__project__\";\n\n/** Candidate HTML in a sandboxed frame, with the same shims and CSP as the preview. */\nfunction previewDocument(html: string): string {\n const shims = `${cspMetaTag(APP_SRCDOC_CSP)}${SANDBOX_STORAGE_SHIM_SCRIPT}${buildErrorBridgeScript()}`;\n const head = /<head\\b[^>]*>/i.exec(html);\n return head ? html.replace(head[0], (tag) => `${tag}${shims}`) : `${shims}${html}`;\n}\n\n/**\n * Generate two or three HTML candidates side by side and adopt one (the rest are cancelled) or\n * discard the set. Logic lives in `useCreationVariants`; the host passes transport and storage.\n * Key the component by identity, project and artifact so a switch starts fresh.\n */\nexport function CreationVariantCompare({\n client,\n projectId,\n kind,\n artifactId,\n expectedRevisionId,\n storageKey,\n storage,\n locale,\n initialIntent = \"\",\n onAdopted,\n pollMs,\n disabled = false,\n}: CreationVariantCompareProps) {\n const t = creationBlockMessages(locale);\n const id = useId();\n const variants = useCreationVariants({\n client,\n projectId,\n storageKey,\n ...(storage ? { storage } : {}),\n ...(locale ? { locale } : {}),\n ...(pollMs ? { pollMs } : {}),\n });\n const [intent, setIntent] = useState(initialIntent);\n // Rows keep a stable key so removing one does not remount the others.\n const [rows, setRows] = useState<{ key: number; direction: CreationVariantDirection }[] | null>(\n null,\n );\n const nextKey = useRef(3);\n const shownRows =\n rows ??\n defaultVariantDirections(variants.designs).map((direction, key) => ({ key, direction }));\n const shown = shownRows.map((row) => row.direction);\n const update = (index: number, direction: CreationVariantDirection) =>\n setRows(shownRows.map((row, position) => (position === index ? { ...row, direction } : row)));\n\n const adoptedRevisionId = variants.adoptedRevisionId;\n useEffect(() => {\n if (adoptedRevisionId) onAdopted?.(adoptedRevisionId);\n }, [adoptedRevisionId, onAdopted]);\n\n const selection = (direction: CreationVariantDirection) =>\n direction.designMdId ?? (direction.text !== undefined ? CUSTOM : PROJECT);\n\n return (\n <section aria-label={t.variantsTitle} className=\"flex flex-col gap-3 rounded-lg border p-4\">\n <h2 className=\"text-sm font-semibold\">{t.variantsTitle}</h2>\n {variants.message && (\n <p role=\"status\" className=\"text-sm\">\n {variants.message}\n </p>\n )}\n {variants.phase === \"idle\" && (\n <form\n className=\"flex flex-col gap-3\"\n onSubmit={(event) => {\n event.preventDefault();\n void variants.start({\n kind,\n intent,\n ...(artifactId ? { artifactId } : {}),\n ...(expectedRevisionId !== undefined ? { expectedRevisionId } : {}),\n directions: shown,\n });\n }}\n >\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-intent`}>{t.variantsIntentLabel}</Label>\n <Textarea\n id={`${id}-intent`}\n value={intent}\n onChange={(event) => setIntent(event.target.value)}\n />\n </div>\n {shownRows.map(({ key, direction }, index) => (\n <div key={key} className=\"flex flex-wrap items-end gap-2\">\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-direction-${index}`}>\n {t.variantDirectionLabel(index + 1)}\n </Label>\n <select\n id={`${id}-direction-${index}`}\n className={FIELD_CLASS}\n value={selection(direction)}\n onChange={(event) => {\n const value = event.target.value;\n update(\n index,\n value === PROJECT\n ? {}\n : value === CUSTOM\n ? { text: \"\" }\n : { designMdId: value },\n );\n }}\n >\n <option value={PROJECT}>{t.variantProjectDesign}</option>\n {variants.designs.map((design) => (\n <option key={design.id} value={design.id}>\n {design.title}\n </option>\n ))}\n <option value={CUSTOM}>{t.variantCustomDirection}</option>\n </select>\n </div>\n {direction.text !== undefined && (\n <Input\n aria-label={t.variantDirectionText(index + 1)}\n value={direction.text}\n onChange={(event) => update(index, { text: event.target.value })}\n />\n )}\n {shown.length > 2 && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setRows(shownRows.filter((_, position) => position !== index))}\n >\n {t.removeVariant(index + 1)}\n </Button>\n )}\n </div>\n ))}\n <div className=\"flex flex-wrap gap-2\">\n {shown.length < 3 && (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setRows([...shownRows, { key: nextKey.current++, direction: {} }])}\n >\n {t.addVariant}\n </Button>\n )}\n <Button\n type=\"submit\"\n disabled={\n disabled ||\n variants.busy ||\n !intent.trim() ||\n shown.some((direction) => direction.text !== undefined && !direction.text.trim())\n }\n >\n {t.generateVariants(shown.length)}\n </Button>\n </div>\n </form>\n )}\n {(variants.phase === \"generating\" || variants.phase === \"choosing\") && (\n <>\n <div\n className=\"grid gap-3\"\n style={{ gridTemplateColumns: `repeat(${variants.candidates.length}, minmax(0, 1fr))` }}\n >\n {variants.candidates.map((candidate) => (\n <article\n key={candidate.requestId}\n aria-label={t.variantColumn(candidate.index + 1)}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <header className=\"flex items-center justify-between gap-2 text-sm\">\n <span className=\"font-medium\">{t.variantColumn(candidate.index + 1)}</span>\n <span className=\"text-muted-foreground\">\n {t.variantStatus[candidate.status] ?? candidate.status}\n </span>\n </header>\n {candidate.html ? (\n <iframe\n title={t.variantPreview(candidate.index + 1)}\n sandbox=\"allow-scripts\"\n srcDoc={previewDocument(candidate.html)}\n className=\"h-80 w-full rounded-md border bg-background\"\n />\n ) : (\n <div className=\"flex h-80 items-center justify-center rounded-md border text-sm text-muted-foreground\">\n {candidate.error ?? \"\"}\n </div>\n )}\n {candidate.status === \"held\" && candidate.runId && (\n <Button\n type=\"button\"\n disabled={disabled || variants.busy}\n onClick={() => candidate.runId && void variants.adopt(candidate.runId)}\n >\n {t.adoptVariant(candidate.index + 1)}\n </Button>\n )}\n </article>\n ))}\n </div>\n <div className=\"flex flex-wrap gap-2\">\n {variants.candidates.some((candidate) => candidate.status === \"unknown\") && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={variants.busy}\n onClick={() => void variants.retrySend()}\n >\n {t.retryVariants}\n </Button>\n )}\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={variants.busy}\n onClick={() => void variants.discard()}\n >\n {t.discardVariants}\n </Button>\n </div>\n </>\n )}\n {(variants.phase === \"adopted\" || variants.phase === \"discarded\") && (\n <div className=\"flex flex-wrap items-center gap-3 text-sm\">\n <p role=\"status\">\n {variants.phase === \"adopted\" ? t.variantsAdopted : t.variantsDiscarded}\n </p>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n setRows(null);\n variants.reset();\n }}\n >\n {t.newVariantSet}\n </Button>\n </div>\n )}\n </section>\n );\n}\n",
24
24
  "type": "registry:component"
25
25
  }
26
26
  ],
@@ -5,9 +5,9 @@
5
5
  "description": "Manual HTML creation workspace (projects, artifacts, CAS saves with a conflict step, generation, export) over useCreationWorkspace; the host renders the editor.",
6
6
  "dependencies": [
7
7
  "react",
8
- "@uibot/contracts@^0.15.0",
9
- "@uibot/creation-kit@^0.15.0",
10
- "@uibot/web-preview@^0.15.0"
8
+ "@uibot/contracts@^0.16.0",
9
+ "@uibot/creation-kit@^0.16.0",
10
+ "@uibot/web-preview@^0.16.0"
11
11
  ],
12
12
  "registryDependencies": [
13
13
  "button",
@@ -13,13 +13,13 @@
13
13
  {
14
14
  "path": "components/uibot/data.tsx",
15
15
  "target": "components/uibot/data.tsx",
16
- "content": "import type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Repeated list of items */\nexport const List: RendererComponent = (props, ctx) => {\n const divided = props[\"divided\"] === true;\n const compact = props[\"compact\"] === true;\n\n return (\n <ul\n className={cn(\n \"uibot-list\",\n divided ? \"divide-y divide-border\" : compact ? \"space-y-1\" : \"space-y-2\",\n )}\n data-uibot-type=\"List\"\n aria-label={typeof props[\"label\"] === \"string\" ? props[\"label\"] : undefined}\n >\n {ctx.children as ReactNode[]}\n </ul>\n );\n};\n\n/** Data table with columns and rows */\nexport const Table: RendererComponent = (props) => {\n const columns = Array.isArray(props[\"columns\"])\n ? (props[\"columns\"] as Array<{ key: string; label: string; align?: string }>)\n : [];\n const rows = Array.isArray(props[\"rows\"])\n ? (props[\"rows\"] as Array<Record<string, unknown>>)\n : [];\n const striped = props[\"striped\"] !== false;\n const caption = typeof props[\"caption\"] === \"string\" ? props[\"caption\"] : null;\n\n return (\n <div className=\"uibot-table w-full overflow-auto rounded-lg border\" data-uibot-type=\"Table\">\n <table className=\"w-full text-sm\">\n {caption && (\n <caption className=\"mb-1 py-2 text-sm text-muted-foreground\">{caption}</caption>\n )}\n <thead>\n <tr className=\"border-b bg-muted/50\">\n {columns.map((col) => (\n <th\n key={col.key}\n scope=\"col\"\n className={cn(\n \"px-4 py-3 text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n )}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b transition-colors last:border-0 hover:bg-muted/30\",\n striped && i % 2 === 1 ? \"bg-muted/10\" : \"\",\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n \"px-4 py-3 text-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"\",\n )}\n >\n {String(row[col.key] ?? \"\")}\n </td>\n ))}\n </tr>\n ))}\n {rows.length === 0 && (\n <tr>\n <td\n colSpan={columns.length || 1}\n className=\"px-4 py-10 text-center text-sm text-muted-foreground\"\n >\n {typeof props[\"emptyText\"] === \"string\" ? props[\"emptyText\"] : \"No data\"}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n );\n};\n\nconst TREND_UP = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 10 7 4 12 10\" />\n </svg>\n);\nconst TREND_DOWN = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 4 7 10 12 4\" />\n </svg>\n);\n\n/** Single statistic display (number + label) */\nexport const Stat: RendererComponent = (props) => {\n const trend = props[\"trend\"] as \"up\" | \"down\" | undefined;\n const change =\n typeof props[\"change\"] === \"string\" || typeof props[\"change\"] === \"number\"\n ? String(props[\"change\"])\n : null;\n\n return (\n <div\n className=\"uibot-stat bg-card text-card-foreground rounded-xl border p-5 shadow-sm\"\n data-uibot-type=\"Stat\"\n >\n <p className=\"text-sm font-medium text-muted-foreground\">\n {typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"Stat\"}\n </p>\n <p className=\"mt-1.5 text-3xl font-bold tracking-tight\">\n {props[\"value\"] !== undefined ? String(props[\"value\"]) : \"—\"}\n </p>\n {(change !== null || typeof props[\"description\"] === \"string\") && (\n <div className=\"mt-1.5 flex items-center gap-1.5\">\n {trend && (\n <span\n className={cn(\n \"flex items-center\",\n trend === \"up\" ? \"text-green-600\" : \"text-destructive\",\n )}\n >\n {trend === \"up\" ? TREND_UP : TREND_DOWN}\n </span>\n )}\n {change !== null && (\n <span\n className={cn(\n \"text-xs font-medium\",\n trend === \"up\"\n ? \"text-green-600\"\n : trend === \"down\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {change}\n </span>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <span className=\"text-xs text-muted-foreground\">{props[\"description\"]}</span>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** Simple inline Markdown renderer */\nfunction renderMarkdown(text: string): ReactNode[] {\n const lines = text.split(\"\\n\");\n const nodes: ReactNode[] = [];\n let listItems: ReactNode[] = [];\n\n const flushList = () => {\n if (listItems.length > 0) {\n nodes.push(\n <ul key={`ul-${nodes.length}`} className=\"my-2 ml-4 list-disc space-y-1 text-sm\">\n {listItems}\n </ul>,\n );\n listItems = [];\n }\n };\n\n const inlineFormat = (raw: string, key: string): ReactNode => {\n // Very small inline parser: **bold**, *italic*, `code`\n const parts = raw.split(/(\\*\\*[^*]+\\*\\*|\\*[^*]+\\*|`[^`]+`)/g);\n if (parts.length === 1) return raw;\n return (\n <span key={key}>\n {parts.map((p, i) => {\n if (p.startsWith(\"**\") && p.endsWith(\"**\"))\n return (\n <strong key={i} className=\"font-semibold\">\n {p.slice(2, -2)}\n </strong>\n );\n if (p.startsWith(\"*\") && p.endsWith(\"*\")) return <em key={i}>{p.slice(1, -1)}</em>;\n if (p.startsWith(\"`\") && p.endsWith(\"`\"))\n return (\n <code key={i} className=\"rounded bg-muted px-1 py-0.5 font-mono text-[0.8em]\">\n {p.slice(1, -1)}\n </code>\n );\n return p;\n })}\n </span>\n );\n };\n\n lines.forEach((line, i) => {\n const hm = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (hm) {\n flushList();\n const level = hm[1]!.length;\n const sizeMap = [\"text-2xl\", \"text-xl\", \"text-lg\", \"text-base\", \"text-sm\", \"text-xs\"];\n const cls = cn(\"font-semibold leading-tight my-2\", sizeMap[level - 1] ?? \"text-base\");\n const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n nodes.push(\n <Tag key={i} className={cls}>\n {inlineFormat(hm[2]!, `h-${i}`)}\n </Tag>,\n );\n return;\n }\n\n const lm = /^[-*]\\s+(.+)$/.exec(line);\n if (lm) {\n listItems.push(<li key={i}>{inlineFormat(lm[1]!, `li-${i}`)}</li>);\n return;\n }\n\n flushList();\n if (line.trim() === \"\") {\n nodes.push(<br key={i} />);\n } else {\n nodes.push(\n <p key={i} className=\"my-1 text-sm leading-relaxed\">\n {inlineFormat(line, `p-${i}`)}\n </p>,\n );\n }\n });\n\n flushList();\n return nodes;\n}\n\n/** Markdown text content renderer */\nexport const Markdown: RendererComponent = (props) => {\n const content = typeof props[\"content\"] === \"string\" ? props[\"content\"] : \"\";\n return (\n <div className=\"uibot-markdown text-foreground\" data-uibot-type=\"Markdown\">\n {renderMarkdown(content)}\n </div>\n );\n};\n\nconst HEADING_SIZE: Record<number, string> = {\n 1: \"text-4xl\",\n 2: \"text-3xl\",\n 3: \"text-2xl\",\n 4: \"text-xl\",\n 5: \"text-lg\",\n 6: \"text-base\",\n};\n\n/** Section heading (h1–h6) */\nexport const Heading: RendererComponent = (props) => {\n const lvl = typeof props[\"level\"] === \"number\" ? Math.min(6, Math.max(1, props[\"level\"])) : 2;\n const size = HEADING_SIZE[lvl] ?? \"text-3xl\";\n const weight = lvl <= 2 ? \"font-bold\" : \"font-semibold\";\n const text = typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\";\n const muted = props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\";\n const cls = cn(\n \"uibot-heading tracking-tight leading-tight\",\n size,\n weight,\n muted,\n typeof props.className === \"string\" ? props.className : \"\",\n );\n const Tag = `h${lvl}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <Tag className={cls} data-uibot-type=\"Heading\">\n {text}\n </Tag>\n );\n};\n\n/** Body paragraph text */\nexport const Paragraph: RendererComponent = (props) => (\n <p\n className={cn(\n \"uibot-paragraph leading-relaxed\",\n props[\"size\"] === \"sm\" ? \"text-sm\" : props[\"size\"] === \"lg\" ? \"text-lg\" : \"text-sm\",\n props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\",\n )}\n data-uibot-type=\"Paragraph\"\n >\n {typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\"}\n </p>\n);\n",
16
+ "content": "import type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Repeated list of items */\nexport const List: RendererComponent = (props, ctx) => {\n const divided = props[\"divided\"] === true;\n const compact = props[\"compact\"] === true;\n\n return (\n <ul\n className={cn(\n \"uibot-list\",\n divided ? \"divide-y divide-border\" : compact ? \"space-y-1\" : \"space-y-2\",\n )}\n data-uibot-type=\"List\"\n aria-label={typeof props[\"label\"] === \"string\" ? props[\"label\"] : undefined}\n >\n {ctx.children as ReactNode[]}\n </ul>\n );\n};\n\n/** Data table with columns and rows */\nexport const Table: RendererComponent = (props) => {\n const columns = Array.isArray(props[\"columns\"])\n ? (props[\"columns\"] as Array<{ key: string; label: string; align?: string }>)\n : [];\n const rows = Array.isArray(props[\"rows\"])\n ? (props[\"rows\"] as Array<Record<string, unknown>>)\n : [];\n const striped = props[\"striped\"] !== false;\n const caption = typeof props[\"caption\"] === \"string\" ? props[\"caption\"] : null;\n\n return (\n <div className=\"uibot-table w-full overflow-auto rounded-lg border\" data-uibot-type=\"Table\">\n <table className=\"w-full text-sm\">\n {caption && (\n <caption className=\"mb-1 py-2 text-sm text-muted-foreground\">{caption}</caption>\n )}\n <thead>\n <tr className=\"border-b bg-muted/50\">\n {columns.map((col) => (\n <th\n key={col.key}\n scope=\"col\"\n className={cn(\n \"px-4 py-3 text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n )}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b transition-colors last:border-0 hover:bg-muted/30\",\n striped && i % 2 === 1 ? \"bg-muted/10\" : \"\",\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n \"px-4 py-3 text-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"\",\n )}\n >\n {String(row[col.key] ?? \"\")}\n </td>\n ))}\n </tr>\n ))}\n {rows.length === 0 && (\n <tr>\n <td\n colSpan={columns.length || 1}\n className=\"px-4 py-10 text-center text-sm text-muted-foreground\"\n >\n {typeof props[\"emptyText\"] === \"string\" ? props[\"emptyText\"] : \"No data\"}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n );\n};\n\nconst TREND_UP = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 10 7 4 12 10\" />\n </svg>\n);\nconst TREND_DOWN = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 4 7 10 12 4\" />\n </svg>\n);\n\n/** Single statistic display (number + label) */\nexport const Stat: RendererComponent = (props) => {\n const trend = props[\"trend\"] as \"up\" | \"down\" | undefined;\n const change =\n typeof props[\"change\"] === \"string\" || typeof props[\"change\"] === \"number\"\n ? String(props[\"change\"])\n : null;\n\n return (\n <div\n className=\"uibot-stat bg-card text-card-foreground rounded-xl border p-5 shadow-sm\"\n data-uibot-type=\"Stat\"\n >\n <p className=\"text-sm font-medium text-muted-foreground\">\n {typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"Stat\"}\n </p>\n <p className=\"mt-1.5 text-3xl font-bold tracking-tight\">\n {props[\"value\"] !== undefined ? String(props[\"value\"]) : \"—\"}\n </p>\n {(change !== null || typeof props[\"description\"] === \"string\") && (\n <div className=\"mt-1.5 flex items-center gap-1.5\">\n {trend && (\n <span\n className={cn(\n \"flex items-center\",\n trend === \"up\" ? \"text-green-600\" : \"text-destructive\",\n )}\n >\n {trend === \"up\" ? TREND_UP : TREND_DOWN}\n </span>\n )}\n {change !== null && (\n <span\n className={cn(\n \"text-xs font-medium\",\n trend === \"up\"\n ? \"text-green-600\"\n : trend === \"down\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {change}\n </span>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <span className=\"text-xs text-muted-foreground\">{props[\"description\"]}</span>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** Simple inline Markdown renderer */\nfunction renderMarkdown(text: string): ReactNode[] {\n const lines = text.split(\"\\n\");\n const nodes: ReactNode[] = [];\n let listItems: ReactNode[] = [];\n\n const flushList = () => {\n if (listItems.length > 0) {\n nodes.push(\n <ul key={`ul-${nodes.length}`} className=\"my-2 ml-4 list-disc space-y-1 text-sm\">\n {listItems}\n </ul>,\n );\n listItems = [];\n }\n };\n\n const inlineFormat = (raw: string, key: string): ReactNode => {\n // Very small inline parser: **bold**, *italic*, `code`\n const parts = raw.split(/(\\*\\*[^*]+\\*\\*|\\*[^*]+\\*|`[^`]+`)/g);\n if (parts.length === 1) return raw;\n return (\n <span key={key}>\n {parts.map((p, i) => {\n if (p.startsWith(\"**\") && p.endsWith(\"**\"))\n return (\n <strong key={i} className=\"font-semibold\">\n {p.slice(2, -2)}\n </strong>\n );\n if (p.startsWith(\"*\") && p.endsWith(\"*\")) return <em key={i}>{p.slice(1, -1)}</em>;\n if (p.startsWith(\"`\") && p.endsWith(\"`\"))\n return (\n <code key={i} className=\"rounded bg-muted px-1 py-0.5 font-mono text-[0.8em]\">\n {p.slice(1, -1)}\n </code>\n );\n return p;\n })}\n </span>\n );\n };\n\n lines.forEach((line, i) => {\n const hm = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (hm) {\n flushList();\n const level = hm[1]!.length;\n const sizeMap = [\"text-2xl\", \"text-xl\", \"text-lg\", \"text-base\", \"text-sm\", \"text-xs\"];\n const cls = cn(\"font-semibold leading-tight my-2\", sizeMap[level - 1] ?? \"text-base\");\n const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n nodes.push(\n <Tag key={i} className={cls}>\n {inlineFormat(hm[2]!, `h-${i}`)}\n </Tag>,\n );\n return;\n }\n\n const lm = /^[-*]\\s+(.+)$/.exec(line);\n if (lm) {\n listItems.push(<li key={i}>{inlineFormat(lm[1]!, `li-${i}`)}</li>);\n return;\n }\n\n flushList();\n if (line.trim() === \"\") {\n nodes.push(<br key={i} />);\n } else {\n nodes.push(\n <p key={i} className=\"my-1 text-sm leading-relaxed\">\n {inlineFormat(line, `p-${i}`)}\n </p>,\n );\n }\n });\n\n flushList();\n return nodes;\n}\n\n/** Markdown text content renderer */\nexport const Markdown: RendererComponent = (props) => {\n const content = typeof props[\"content\"] === \"string\" ? props[\"content\"] : \"\";\n return (\n <div className=\"uibot-markdown text-foreground\" data-uibot-type=\"Markdown\">\n {renderMarkdown(content)}\n </div>\n );\n};\n\nconst HEADING_SIZE: Record<number, string> = {\n 1: \"text-4xl\",\n 2: \"text-3xl\",\n 3: \"text-2xl\",\n 4: \"text-xl\",\n 5: \"text-lg\",\n 6: \"text-base\",\n};\n\n/** Section heading (h1–h6) */\nexport const Heading: RendererComponent = (props) => {\n const lvl = typeof props[\"level\"] === \"number\" ? Math.min(6, Math.max(1, props[\"level\"])) : 2;\n const size = HEADING_SIZE[lvl] ?? \"text-3xl\";\n const weight = lvl <= 2 ? \"font-bold\" : \"font-semibold\";\n const text = typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\";\n const muted = props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\";\n const cls = cn(\n \"uibot-heading tracking-tight leading-tight\",\n size,\n weight,\n muted,\n typeof props.className === \"string\" ? props.className : \"\",\n );\n const Tag = `h${lvl}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <Tag className={cls} data-uibot-type=\"Heading\">\n {text}\n </Tag>\n );\n};\n\n/** Body paragraph text */\nexport const Paragraph: RendererComponent = (props) => (\n <p\n className={cn(\n \"uibot-paragraph leading-relaxed\",\n props[\"size\"] === \"sm\" ? \"text-sm\" : props[\"size\"] === \"lg\" ? \"text-lg\" : \"text-sm\",\n props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\",\n typeof props.className === \"string\" ? props.className : \"\",\n )}\n data-uibot-type=\"Paragraph\"\n >\n {typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\"}\n </p>\n);\n",
17
17
  "type": "registry:ui"
18
18
  },
19
19
  {
20
20
  "path": "components/uibot/data.uibot.json",
21
21
  "target": "components/uibot/data.uibot.json",
22
- "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"data\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Heading\",\n \"export\": \"Heading\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Heading\",\n \"description\": \"Semantic heading tag h1–h6 with size automatically mapped to the level.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"heading\",\n \"typography\"\n ],\n \"props\": {\n \"text\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"integer\",\n \"default\": 2,\n \"description\": \"1=largest, 6=smallest\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Render in muted-foreground\"\n }\n },\n \"usageScenarios\": [\n \"Section title above a Table or Card\",\n \"Hero headline on a landing page\"\n ],\n \"constraints\": [\n \"Use only one h1 per page\"\n ]\n }\n },\n {\n \"name\": \"List\",\n \"export\": \"List\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"List\",\n \"description\": \"Unordered list of child blocks. Use with divided or compact for different visual densities.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"list\"\n ],\n \"props\": {\n \"divided\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Add hairline dividers between items\"\n },\n \"compact\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"label\": {\n \"type\": \"string\",\n \"description\": \"ARIA label\"\n }\n },\n \"usageScenarios\": [\n \"Recent activity feed\",\n \"Search result list\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Markdown\",\n \"export\": \"Markdown\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Markdown\",\n \"description\": \"Renders Markdown source into HTML. Supports # headings, **bold**, *italic*, `code`, and - lists.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"markdown\",\n \"content\"\n ],\n \"props\": {\n \"content\": {\n \"type\": \"string\",\n \"description\": \"Markdown source text\"\n }\n },\n \"usageScenarios\": [\n \"Documentation sections\",\n \"Feature descriptions on a landing page\",\n \"Release notes\"\n ],\n \"constraints\": [\n \"No HTML injection; only Markdown syntax is parsed\"\n ]\n }\n },\n {\n \"name\": \"Paragraph\",\n \"export\": \"Paragraph\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Paragraph\",\n \"description\": \"Body text block. Use size='lg' for lead copy, size='sm' for captions.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"typography\"\n ],\n \"props\": {\n \"text\": {\n \"type\": \"string\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"sm\",\n \"md\",\n \"lg\"\n ],\n \"default\": \"md\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"usageScenarios\": [\n \"Feature description below a Heading\",\n \"Helper caption below a form field\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Stat\",\n \"export\": \"Stat\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Stat\",\n \"description\": \"KPI metric card: large value, label, optional trend arrow, and change string.\",\n \"category\": \"primitive\",\n \"level\": \"L2\",\n \"tags\": [\n \"stat\",\n \"kpi\",\n \"metric\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Main metric value, e.g. 1,234 or $12k\"\n },\n \"change\": {\n \"type\": \"string\",\n \"description\": \"Change label, e.g. \\\"+12% vs last month\\\"\"\n },\n \"trend\": {\n \"type\": \"string\",\n \"enum\": [\n \"up\",\n \"down\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Secondary helper text\"\n }\n },\n \"usageScenarios\": [\n \"Dashboard KPI row (4 Stat blocks side-by-side in a Box[direction=row])\",\n \"Single revenue metric in a Card\"\n ],\n \"constraints\": [\n \"Do not put detailed charts inside a Stat; use Stat only for a single number + context\"\n ]\n }\n },\n {\n \"name\": \"Table\",\n \"export\": \"Table\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Table\",\n \"description\": \"Data grid with typed columns and row data. Columns define keys and display labels.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"table\",\n \"grid\",\n \"data\"\n ],\n \"props\": {\n \"columns\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"align\": {\n \"type\": \"string\",\n \"enum\": [\n \"left\",\n \"center\",\n \"right\"\n ]\n }\n }\n },\n \"description\": \"[{key, label, align?}]\"\n },\n \"rows\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n },\n \"description\": \"Array of data objects keyed to column.key\"\n },\n \"emptyText\": {\n \"type\": \"string\",\n \"default\": \"No data\"\n },\n \"striped\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"caption\": {\n \"type\": \"string\"\n }\n },\n \"usageScenarios\": [\n \"User management list\",\n \"Order history table\",\n \"API endpoint catalog\"\n ],\n \"constraints\": [\n \"rows entries must have keys matching column.key; missing keys render empty string\",\n \"Avoid more than 8 columns\"\n ]\n }\n }\n ]\n}\n",
22
+ "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"data\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Heading\",\n \"export\": \"Heading\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Heading\",\n \"description\": \"Semantic heading tag h1–h6 with size automatically mapped to the level.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"heading\",\n \"typography\"\n ],\n \"props\": {\n \"className\": {\n \"type\": \"string\",\n \"description\": \"Additional Tailwind utility classes\"\n },\n \"text\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"integer\",\n \"default\": 2,\n \"description\": \"1=largest, 6=smallest\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Render in muted-foreground\"\n }\n },\n \"usageScenarios\": [\n \"Section title above a Table or Card\",\n \"Hero headline on a landing page\"\n ],\n \"constraints\": [\n \"Use only one h1 per page\"\n ]\n }\n },\n {\n \"name\": \"List\",\n \"export\": \"List\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"List\",\n \"description\": \"Unordered list of child blocks. Use with divided or compact for different visual densities.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"list\"\n ],\n \"props\": {\n \"divided\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Add hairline dividers between items\"\n },\n \"compact\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"label\": {\n \"type\": \"string\",\n \"description\": \"ARIA label\"\n }\n },\n \"usageScenarios\": [\n \"Recent activity feed\",\n \"Search result list\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Markdown\",\n \"export\": \"Markdown\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Markdown\",\n \"description\": \"Renders Markdown source into HTML. Supports # headings, **bold**, *italic*, `code`, and - lists.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"markdown\",\n \"content\"\n ],\n \"props\": {\n \"content\": {\n \"type\": \"string\",\n \"description\": \"Markdown source text\"\n }\n },\n \"usageScenarios\": [\n \"Documentation sections\",\n \"Feature descriptions on a landing page\",\n \"Release notes\"\n ],\n \"constraints\": [\n \"No HTML injection; only Markdown syntax is parsed\"\n ]\n }\n },\n {\n \"name\": \"Paragraph\",\n \"export\": \"Paragraph\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Paragraph\",\n \"description\": \"Body text block. Use size='lg' for lead copy, size='sm' for captions.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"typography\"\n ],\n \"props\": {\n \"className\": {\n \"type\": \"string\",\n \"description\": \"Additional Tailwind utility classes\"\n },\n \"text\": {\n \"type\": \"string\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"sm\",\n \"md\",\n \"lg\"\n ],\n \"default\": \"md\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"usageScenarios\": [\n \"Feature description below a Heading\",\n \"Helper caption below a form field\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Stat\",\n \"export\": \"Stat\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Stat\",\n \"description\": \"KPI metric card: large value, label, optional trend arrow, and change string.\",\n \"category\": \"primitive\",\n \"level\": \"L2\",\n \"tags\": [\n \"stat\",\n \"kpi\",\n \"metric\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Main metric value, e.g. 1,234 or $12k\"\n },\n \"change\": {\n \"type\": \"string\",\n \"description\": \"Change label, e.g. \\\"+12% vs last month\\\"\"\n },\n \"trend\": {\n \"type\": \"string\",\n \"enum\": [\n \"up\",\n \"down\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Secondary helper text\"\n }\n },\n \"usageScenarios\": [\n \"Dashboard KPI row (4 Stat blocks side-by-side in a Box[direction=row])\",\n \"Single revenue metric in a Card\"\n ],\n \"constraints\": [\n \"Do not put detailed charts inside a Stat; use Stat only for a single number + context\"\n ]\n }\n },\n {\n \"name\": \"Table\",\n \"export\": \"Table\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Table\",\n \"description\": \"Data grid with typed columns and row data. Columns define keys and display labels.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"table\",\n \"grid\",\n \"data\"\n ],\n \"props\": {\n \"columns\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"align\": {\n \"type\": \"string\",\n \"enum\": [\n \"left\",\n \"center\",\n \"right\"\n ]\n }\n }\n },\n \"description\": \"[{key, label, align?}]\"\n },\n \"rows\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n },\n \"description\": \"Array of data objects keyed to column.key\"\n },\n \"emptyText\": {\n \"type\": \"string\",\n \"default\": \"No data\"\n },\n \"striped\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"caption\": {\n \"type\": \"string\"\n }\n },\n \"usageScenarios\": [\n \"User management list\",\n \"Order history table\",\n \"API endpoint catalog\"\n ],\n \"constraints\": [\n \"rows entries must have keys matching column.key; missing keys render empty string\",\n \"Avoid more than 8 columns\"\n ]\n }\n }\n ]\n}\n",
23
23
  "type": "registry:ui"
24
24
  }
25
25
  ],
@@ -74,6 +74,10 @@
74
74
  "typography"
75
75
  ],
76
76
  "props": {
77
+ "className": {
78
+ "type": "string",
79
+ "description": "Additional Tailwind utility classes"
80
+ },
77
81
  "text": {
78
82
  "type": "string"
79
83
  },
@@ -175,6 +179,10 @@
175
179
  "typography"
176
180
  ],
177
181
  "props": {
182
+ "className": {
183
+ "type": "string",
184
+ "description": "Additional Tailwind utility classes"
185
+ },
178
186
  "text": {
179
187
  "type": "string"
180
188
  },
@@ -13,13 +13,25 @@
13
13
  {
14
14
  "path": "components/uibot/feedback.tsx",
15
15
  "target": "components/uibot/feedback.tsx",
16
- "content": "import { useCallback, useEffect, useId, useState, useSyncExternalStore } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\n\nconst BTN_BASE =\n \"uibot-button inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\";\n\nconst BTN_VARIANTS: Record<string, string> = {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-white shadow hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-muted text-foreground shadow-sm hover:bg-muted/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n};\n\nconst BTN_SIZES: Record<string, string> = {\n xs: \"h-6 px-2 text-xs rounded\",\n sm: \"h-8 px-3\",\n default: \"h-9 px-4 py-2\",\n lg: \"h-10 px-6 text-base\",\n icon: \"size-9\",\n};\n\n/** Action button */\nexport const Button: RendererComponent = (props, ctx) => {\n const variant = typeof props[\"variant\"] === \"string\" ? props[\"variant\"] : \"default\";\n const size = typeof props[\"size\"] === \"string\" ? props[\"size\"] : \"default\";\n const full = props[\"full\"] === true ? \"w-full\" : \"\";\n const children = ctx.children as ReactNode[];\n type ActionChain = Parameters<NonNullable<typeof ctx.dispatch>>[0];\n const onClick =\n (ctx.element as { events?: Record<string, ActionChain> }).events?.[\"onClick\"] ?? [];\n\n return (\n <button\n type={props[\"type\"] === \"submit\" ? \"submit\" : \"button\"}\n disabled={props[\"disabled\"] === true}\n aria-label={typeof props[\"ariaLabel\"] === \"string\" ? props[\"ariaLabel\"] : undefined}\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[variant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[size] ?? BTN_SIZES[\"default\"]!,\n full,\n )}\n data-uibot-type=\"Button\"\n data-variant={variant}\n onClick={\n onClick.length > 0\n ? (event) =>\n void ctx.dispatch?.(onClick, {\n event: {\n type: \"click\",\n ...(event.currentTarget.name ? { name: event.currentTarget.name } : {}),\n },\n })\n : undefined\n }\n >\n {children.length > 0 ? children : typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"\"}\n </button>\n );\n};\n\nconst TOAST_VARIANTS: Record<string, { bar: string; icon: string; label: string }> = {\n info: { bar: \"bg-blue-500\", icon: \"ℹ\", label: \"Info\" },\n success: { bar: \"bg-green-500\", icon: \"✓\", label: \"Success\" },\n warning: { bar: \"bg-yellow-500\", icon: \"⚠\", label: \"Warning\" },\n error: { bar: \"bg-destructive\", icon: \"✕\", label: \"Error\" },\n};\n\n/** Floating toasts share the top-right corner; each takes the next slot below the previous one. */\nconst floatingToasts = { ids: [] as string[], listeners: new Set<() => void>() };\n\nfunction notifyFloatingToasts() {\n for (const listener of floatingToasts.listeners) listener();\n}\n\nfunction useFloatingSlot(id: string, active: boolean): number {\n useEffect(() => {\n if (!active) return;\n floatingToasts.ids.push(id);\n notifyFloatingToasts();\n return () => {\n floatingToasts.ids = floatingToasts.ids.filter((candidate) => candidate !== id);\n notifyFloatingToasts();\n };\n }, [id, active]);\n const subscribe = useCallback((listener: () => void) => {\n floatingToasts.listeners.add(listener);\n return () => {\n floatingToasts.listeners.delete(listener);\n };\n }, []);\n return useSyncExternalStore(\n subscribe,\n () => Math.max(0, floatingToasts.ids.indexOf(id)),\n () => 0,\n );\n}\n\n/** Slot height for stacked floating toasts: a short notice (title plus up to two lines). */\nconst FLOATING_SLOT_REM = 5.5;\n\nfunction ToastView({ props }: { props: Record<string, unknown> }) {\n const level = typeof props[\"level\"] === \"string\" ? props[\"level\"] : \"info\";\n const v = TOAST_VARIANTS[level] ?? TOAST_VARIANTS[\"info\"]!;\n const title = typeof props[\"title\"] === \"string\" ? props[\"title\"] : v.label;\n const message = typeof props[\"message\"] === \"string\" ? props[\"message\"] : \"\";\n const closeable = props[\"closeable\"] !== false;\n const floating = props[\"placement\"] === \"top-right\";\n const duration =\n typeof props[\"duration\"] === \"number\" && props[\"duration\"] > 0 ? props[\"duration\"] : 0;\n const [open, setOpen] = useState(true);\n const id = useId();\n const slot = useFloatingSlot(id, floating && open);\n\n useEffect(() => {\n if (!open || duration === 0) return;\n const timer = setTimeout(() => setOpen(false), duration);\n return () => clearTimeout(timer);\n }, [open, duration]);\n\n if (!open) return null;\n return (\n <div\n role={floating && level !== \"error\" ? \"status\" : \"alert\"}\n aria-live={floating && level === \"error\" ? \"assertive\" : \"polite\"}\n className={cn(\n \"uibot-toast flex items-start gap-3 overflow-hidden rounded-lg border bg-background p-4\",\n floating\n ? \"uibot-toast-floating fixed right-4 z-50 w-[min(24rem,calc(100vw-2rem))] shadow-lg\"\n : \"relative shadow-sm\",\n )}\n style={floating ? { top: `${1 + slot * FLOATING_SLOT_REM}rem` } : undefined}\n data-uibot-type=\"Toast\"\n data-placement={floating ? \"top-right\" : \"inline\"}\n >\n <div className={cn(\"absolute left-0 top-0 h-full w-1\", v.bar)} aria-hidden=\"true\" />\n <span className=\"mt-0.5 shrink-0 text-sm leading-none\" aria-hidden=\"true\">\n {v.icon}\n </span>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold\">{title}</p>\n {message && (\n <p className={cn(\"text-sm text-muted-foreground\", floating && \"line-clamp-2\")}>\n {message}\n </p>\n )}\n </div>\n {closeable && (\n <button\n type=\"button\"\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n aria-label=\"Dismiss\"\n onClick={() => setOpen(false)}\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"2\" y1=\"2\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"2\" x2=\"2\" y2=\"12\" />\n </svg>\n </button>\n )}\n </div>\n );\n}\n\n/**\n * Alert banner. `placement: \"top-right\"` makes it a floating, dismissible notice (optionally\n * auto-dismissed after `duration` ms) instead of an inline banner.\n */\nexport const Toast: RendererComponent = (props) => <ToastView props={props} />;\n\n/** Confirmation dialog — rendered inline in preview */\nexport const Dialog: RendererComponent = (props, ctx) => {\n const confirmVariant =\n typeof props[\"confirmVariant\"] === \"string\" ? props[\"confirmVariant\"] : \"default\";\n\n return (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={typeof props[\"title\"] === \"string\" ? props[\"title\"] : \"Dialog\"}\n className=\"uibot-dialog\"\n data-uibot-type=\"Dialog\"\n >\n <div className=\"bg-background text-foreground mx-auto w-full max-w-sm rounded-xl border p-6 shadow-xl\">\n {typeof props[\"title\"] === \"string\" && (\n <h2 className=\"text-lg font-semibold tracking-tight\">{props[\"title\"]}</h2>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{props[\"description\"]}</p>\n )}\n {ctx.children && (ctx.children as ReactNode[]).length > 0 && (\n <div className=\"mt-4\">{ctx.children as ReactNode[]}</div>\n )}\n {(typeof props[\"cancelLabel\"] === \"string\" ||\n typeof props[\"confirmLabel\"] === \"string\") && (\n <div className=\"mt-5 flex items-center justify-end gap-2\">\n {typeof props[\"cancelLabel\"] === \"string\" && (\n <button\n type=\"button\"\n className={cn(BTN_BASE, BTN_VARIANTS[\"outline\"]!, BTN_SIZES[\"sm\"]!)}\n >\n {props[\"cancelLabel\"]}\n </button>\n )}\n {typeof props[\"confirmLabel\"] === \"string\" && (\n <button\n type=\"button\"\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[confirmVariant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[\"sm\"]!,\n )}\n >\n {props[\"confirmLabel\"]}\n </button>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\n/** Loading skeleton placeholder */\nexport const Skeleton: RendererComponent = (props) => {\n const lines = typeof props[\"lines\"] === \"number\" ? Math.max(1, props[\"lines\"]) : 3;\n const type = typeof props[\"type\"] === \"string\" ? props[\"type\"] : \"lines\";\n\n if (type === \"card\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-xl border bg-card p-5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"flex items-center gap-3\">\n <div className=\"h-10 w-10 rounded-full bg-muted\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-3.5 w-2/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/2 rounded bg-muted\" />\n </div>\n </div>\n <div className=\"mt-4 space-y-2\">\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-3/4 rounded bg-muted\" />\n </div>\n </div>\n );\n }\n\n if (type === \"table\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-lg border\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"border-b bg-muted/50 px-4 py-3\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n </div>\n {Array.from({ length: lines }, (_, i) => (\n <div key={i} className=\"flex gap-4 border-b px-4 py-3 last:border-0\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n <div className=\"h-3 w-1/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/5 rounded bg-muted\" />\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div\n className=\"uibot-skeleton animate-pulse space-y-2.5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n {Array.from({ length: lines }, (_, i) => (\n <div\n key={i}\n className={cn(\n \"h-3.5 rounded-md bg-muted\",\n i === lines - 1 ? \"w-3/4\" : i % 3 === 1 ? \"w-5/6\" : \"w-full\",\n )}\n />\n ))}\n </div>\n );\n};\n",
16
+ "content": "import { useCallback, useEffect, useId, useState, useSyncExternalStore } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { emit } from \"./interaction\";\nimport { LiveConfirmationDialog } from \"./overlay\";\n\nconst BTN_BASE =\n \"uibot-button inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\";\n\nconst BTN_VARIANTS: Record<string, string> = {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-white shadow hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-muted text-foreground shadow-sm hover:bg-muted/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n};\n\nconst BTN_SIZES: Record<string, string> = {\n xs: \"h-6 px-2 text-xs rounded\",\n sm: \"h-8 px-3\",\n default: \"h-9 px-4 py-2\",\n lg: \"h-10 px-6 text-base\",\n icon: \"size-9\",\n};\n\n/** Action button */\nexport const Button: RendererComponent = (props, ctx) => {\n const variant = typeof props[\"variant\"] === \"string\" ? props[\"variant\"] : \"default\";\n const size = typeof props[\"size\"] === \"string\" ? props[\"size\"] : \"default\";\n const full = props[\"full\"] === true ? \"w-full\" : \"\";\n const children = ctx.children as ReactNode[];\n type ActionChain = Parameters<NonNullable<typeof ctx.dispatch>>[0];\n const onClick =\n (ctx.element as { events?: Record<string, ActionChain> }).events?.[\"onClick\"] ?? [];\n\n return (\n <button\n type={props[\"type\"] === \"submit\" ? \"submit\" : \"button\"}\n disabled={props[\"disabled\"] === true}\n aria-label={typeof props[\"ariaLabel\"] === \"string\" ? props[\"ariaLabel\"] : undefined}\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[variant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[size] ?? BTN_SIZES[\"default\"]!,\n full,\n )}\n data-uibot-type=\"Button\"\n data-variant={variant}\n onClick={\n onClick.length > 0\n ? (event) =>\n void ctx.dispatch?.(onClick, {\n event: {\n type: \"click\",\n ...(event.currentTarget.name ? { name: event.currentTarget.name } : {}),\n },\n })\n : undefined\n }\n >\n {children.length > 0 ? children : typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"\"}\n </button>\n );\n};\n\nconst TOAST_VARIANTS: Record<string, { bar: string; icon: string; label: string }> = {\n info: { bar: \"bg-blue-500\", icon: \"ℹ\", label: \"Info\" },\n success: { bar: \"bg-green-500\", icon: \"✓\", label: \"Success\" },\n warning: { bar: \"bg-yellow-500\", icon: \"⚠\", label: \"Warning\" },\n error: { bar: \"bg-destructive\", icon: \"✕\", label: \"Error\" },\n};\n\n/** Floating toasts share the top-right corner; each takes the next slot below the previous one. */\nconst floatingToasts = { ids: [] as string[], listeners: new Set<() => void>() };\n\nfunction notifyFloatingToasts() {\n for (const listener of floatingToasts.listeners) listener();\n}\n\nfunction useFloatingSlot(id: string, active: boolean): number {\n useEffect(() => {\n if (!active) return;\n floatingToasts.ids.push(id);\n notifyFloatingToasts();\n return () => {\n floatingToasts.ids = floatingToasts.ids.filter((candidate) => candidate !== id);\n notifyFloatingToasts();\n };\n }, [id, active]);\n const subscribe = useCallback((listener: () => void) => {\n floatingToasts.listeners.add(listener);\n return () => {\n floatingToasts.listeners.delete(listener);\n };\n }, []);\n return useSyncExternalStore(\n subscribe,\n () => Math.max(0, floatingToasts.ids.indexOf(id)),\n () => 0,\n );\n}\n\n/** Slot height for stacked floating toasts: a short notice (title plus up to two lines). */\nconst FLOATING_SLOT_REM = 5.5;\n\nfunction ToastView({ props }: { props: Record<string, unknown> }) {\n const level = typeof props[\"level\"] === \"string\" ? props[\"level\"] : \"info\";\n const v = TOAST_VARIANTS[level] ?? TOAST_VARIANTS[\"info\"]!;\n const title = typeof props[\"title\"] === \"string\" ? props[\"title\"] : v.label;\n const message = typeof props[\"message\"] === \"string\" ? props[\"message\"] : \"\";\n const closeable = props[\"closeable\"] !== false;\n const floating = props[\"placement\"] === \"top-right\";\n const duration =\n typeof props[\"duration\"] === \"number\" && props[\"duration\"] > 0 ? props[\"duration\"] : 0;\n const [open, setOpen] = useState(true);\n const id = useId();\n const slot = useFloatingSlot(id, floating && open);\n\n useEffect(() => {\n if (!open || duration === 0) return;\n const timer = setTimeout(() => setOpen(false), duration);\n return () => clearTimeout(timer);\n }, [open, duration]);\n\n if (!open) return null;\n return (\n <div\n role={floating && level !== \"error\" ? \"status\" : \"alert\"}\n aria-live={floating && level === \"error\" ? \"assertive\" : \"polite\"}\n className={cn(\n \"uibot-toast flex items-start gap-3 overflow-hidden rounded-lg border bg-background p-4\",\n floating\n ? \"uibot-toast-floating fixed right-4 z-50 w-[min(24rem,calc(100vw-2rem))] shadow-lg\"\n : \"relative shadow-sm\",\n )}\n style={floating ? { top: `${1 + slot * FLOATING_SLOT_REM}rem` } : undefined}\n data-uibot-type=\"Toast\"\n data-placement={floating ? \"top-right\" : \"inline\"}\n >\n <div className={cn(\"absolute left-0 top-0 h-full w-1\", v.bar)} aria-hidden=\"true\" />\n <span className=\"mt-0.5 shrink-0 text-sm leading-none\" aria-hidden=\"true\">\n {v.icon}\n </span>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold\">{title}</p>\n {message && (\n <p className={cn(\"text-sm text-muted-foreground\", floating && \"line-clamp-2\")}>\n {message}\n </p>\n )}\n </div>\n {closeable && (\n <button\n type=\"button\"\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n aria-label=\"Dismiss\"\n onClick={() => setOpen(false)}\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"2\" y1=\"2\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"2\" x2=\"2\" y2=\"12\" />\n </svg>\n </button>\n )}\n </div>\n );\n}\n\n/**\n * Alert banner. `placement: \"top-right\"` makes it a floating, dismissible notice (optionally\n * auto-dismissed after `duration` ms) instead of an inline banner.\n */\nexport const Toast: RendererComponent = (props) => <ToastView props={props} />;\n\n/** Controlled confirmation intent; omitted open retains the inline composition. */\nexport const Dialog: RendererComponent = (props, ctx) => {\n const confirmVariant =\n typeof props[\"confirmVariant\"] === \"string\" ? props[\"confirmVariant\"] : \"default\";\n\n const pending = props[\"pending\"] === true;\n const actions = (\n <div className=\"flex items-center justify-end gap-2\">\n {typeof props[\"cancelLabel\"] === \"string\" && (\n <button\n type=\"button\"\n disabled={pending}\n className={cn(BTN_BASE, BTN_VARIANTS[\"outline\"]!, BTN_SIZES[\"sm\"]!)}\n onClick={() => {\n if (!pending) emit(ctx, \"onCancel\", { action: \"cancel\" }, \"cancel\");\n }}\n >\n {props[\"cancelLabel\"]}\n </button>\n )}\n {typeof props[\"confirmLabel\"] === \"string\" && (\n <button\n type=\"button\"\n disabled={pending}\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[confirmVariant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[\"sm\"]!,\n )}\n onClick={() => {\n if (!pending) emit(ctx, \"onConfirm\", { action: \"confirm\" }, \"confirm\");\n }}\n >\n {props[\"confirmLabel\"]}\n </button>\n )}\n </div>\n );\n const hasActions =\n typeof props[\"cancelLabel\"] === \"string\" || typeof props[\"confirmLabel\"] === \"string\";\n if (typeof props[\"open\"] === \"boolean\")\n return LiveConfirmationDialog(props, {\n ...ctx,\n slots: { ...ctx.slots, ...(hasActions ? { footer: [actions] } : {}) },\n });\n return (\n <div\n role=\"group\"\n aria-busy={pending || undefined}\n aria-label={typeof props[\"title\"] === \"string\" ? props[\"title\"] : \"Dialog\"}\n className=\"uibot-dialog\"\n data-uibot-type=\"Dialog\"\n >\n <div className=\"bg-background text-foreground mx-auto w-full max-w-sm rounded-xl border p-6 shadow-xl\">\n {typeof props[\"title\"] === \"string\" && (\n <h2 className=\"text-lg font-semibold tracking-tight\">{props[\"title\"]}</h2>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{props[\"description\"]}</p>\n )}\n {ctx.children && (ctx.children as ReactNode[]).length > 0 && (\n <div className=\"mt-4\">{ctx.children as ReactNode[]}</div>\n )}\n {hasActions && <div className=\"mt-5\">{actions}</div>}\n </div>\n </div>\n );\n};\n\n/** Loading skeleton placeholder */\nexport const Skeleton: RendererComponent = (props) => {\n const lines = typeof props[\"lines\"] === \"number\" ? Math.max(1, props[\"lines\"]) : 3;\n const type = typeof props[\"type\"] === \"string\" ? props[\"type\"] : \"lines\";\n\n if (type === \"card\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-xl border bg-card p-5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"flex items-center gap-3\">\n <div className=\"h-10 w-10 rounded-full bg-muted\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-3.5 w-2/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/2 rounded bg-muted\" />\n </div>\n </div>\n <div className=\"mt-4 space-y-2\">\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-3/4 rounded bg-muted\" />\n </div>\n </div>\n );\n }\n\n if (type === \"table\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-lg border\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"border-b bg-muted/50 px-4 py-3\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n </div>\n {Array.from({ length: lines }, (_, i) => (\n <div key={i} className=\"flex gap-4 border-b px-4 py-3 last:border-0\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n <div className=\"h-3 w-1/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/5 rounded bg-muted\" />\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div\n className=\"uibot-skeleton animate-pulse space-y-2.5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n {Array.from({ length: lines }, (_, i) => (\n <div\n key={i}\n className={cn(\n \"h-3.5 rounded-md bg-muted\",\n i === lines - 1 ? \"w-3/4\" : i % 3 === 1 ? \"w-5/6\" : \"w-full\",\n )}\n />\n ))}\n </div>\n );\n};\n",
17
+ "type": "registry:ui"
18
+ },
19
+ {
20
+ "path": "components/uibot/interaction.ts",
21
+ "target": "components/uibot/interaction.ts",
22
+ "content": "import type { RendererComponent } from \"@/lib/uibot-renderer\";\nexport type BlockContext = Parameters<RendererComponent>[1];\nexport type Chain = Parameters<NonNullable<BlockContext[\"dispatch\"]>>[0];\nexport type EventValue = string | number | boolean | null;\nexport function emit(\n ctx: BlockContext,\n name: string,\n values: Record<string, EventValue | EventValue[]> = {},\n value?: EventValue,\n): void {\n const element = ctx.element as { events?: Record<string, Chain> };\n const chain = element.events?.[name];\n if (chain?.length)\n void ctx.dispatch?.(chain, {\n event: { type: name, values, ...(value !== undefined ? { value } : {}) },\n });\n}\nexport function text(value: unknown, fallback = \"\"): string {\n return value == null ? fallback : String(value);\n}\nexport function records(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value)\n ? value.filter(\n (v): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v),\n )\n : [];\n}\n\nconst submissions = new WeakMap<object, { payload: string; key: string }>();\n/** A new owner represents a new user intent; an unchanged failed submission keeps its key. */\nexport function submissionKey(owner: object, values: unknown): string {\n const payload = JSON.stringify(values);\n const previous = submissions.get(owner);\n if (previous?.payload === payload) return previous.key;\n const key = crypto.randomUUID();\n submissions.set(owner, { payload, key });\n return key;\n}\n",
23
+ "type": "registry:ui"
24
+ },
25
+ {
26
+ "path": "components/uibot/overlay.tsx",
27
+ "target": "components/uibot/overlay.tsx",
28
+ "content": "import { useEffect, useId, useRef, type ReactNode } from \"react\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { emit, text, type BlockContext } from \"./interaction\";\n\nfunction useNativeDialogLifecycle(\n ref: { current: HTMLDialogElement | null },\n open: boolean,\n triggerRef?: { current: HTMLElement | null },\n) {\n useEffect(() => {\n const dialog = ref.current;\n if (!dialog || !open) return;\n const trigger = triggerRef\n ? triggerRef.current\n : document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n dialog.showModal();\n return () => {\n if (dialog.open) dialog.close();\n if (trigger?.isConnected) trigger.focus();\n };\n }, [open, ref, triggerRef]);\n}\n\nfunction Overlay({\n props,\n ctx,\n drawer,\n blockType,\n}: {\n props: Record<string, unknown>;\n ctx: BlockContext;\n drawer: boolean;\n blockType?: \"Dialog\";\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n const titleId = useId(),\n descriptionId = useId();\n const open = props.open === true;\n const close = () => emit(ctx, \"onClose\", { open: false }, false);\n useNativeDialogLifecycle(ref, open);\n if (!open) return null;\n return (\n <dialog\n ref={ref}\n aria-labelledby={titleId}\n aria-describedby={props.description ? descriptionId : undefined}\n aria-busy={props.pending === true || undefined}\n data-uibot-type={blockType ?? (drawer ? \"Drawer\" : \"Modal\")}\n className={`uibot-overlay bg-background text-foreground p-0 shadow-xl backdrop:bg-black/50 ${drawer ? \"fixed inset-y-0 start-auto end-0 m-0 h-dvh max-h-dvh w-full max-w-md border-s\" : \"m-auto w-[calc(100%-2rem)] max-w-lg rounded-xl border\"}`}\n onCancel={(e) => {\n e.preventDefault();\n if (props.pending !== true) close();\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget && props.pending !== true) {\n const r = e.currentTarget.getBoundingClientRect();\n if (\n e.clientX < r.left ||\n e.clientX > r.right ||\n e.clientY < r.top ||\n e.clientY > r.bottom\n )\n close();\n }\n }}\n >\n <div className=\"flex h-full max-h-dvh flex-col\">\n <header className=\"flex items-start justify-between gap-4 border-b p-6\">\n <div>\n <h2 id={titleId} className=\"text-lg font-semibold\">\n {text(props.title, drawer ? \"Edit record\" : \"Confirm\")}\n </h2>\n {Boolean(props.description) && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {text(props.description)}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n disabled={props.pending === true}\n className=\"rounded px-2 py-1 text-sm hover:bg-muted focus-visible:ring-2\"\n aria-label=\"Close dialog\"\n onClick={close}\n >\n Close\n </button>\n </header>\n <div className=\"min-h-0 flex-1 overflow-auto p-6\">{ctx.children as ReactNode[]}</div>\n {ctx.slots.footer && (\n <footer className=\"flex justify-end gap-2 border-t p-6\">\n {ctx.slots.footer as ReactNode[]}\n </footer>\n )}\n </div>\n </dialog>\n );\n}\nexport const LiveDrawer: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer />\n);\nexport const LiveModal: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer={false} />\n);\nexport const LiveConfirmationDialog: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer={false} blockType=\"Dialog\" />\n);\n\n/** Internal mobile navigation drawer shared by renderer blocks, not a Spec component. */\nexport function SidebarDrawer({\n id,\n open,\n onClose,\n triggerRef,\n children,\n}: {\n id: string;\n open: boolean;\n onClose: () => void;\n triggerRef: { current: HTMLButtonElement | null };\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n useNativeDialogLifecycle(ref, open, triggerRef);\n\n if (!open) return null;\n return (\n <dialog\n id={id}\n ref={ref}\n aria-label=\"Navigation\"\n className=\"fixed inset-y-0 start-0 z-50 m-0 h-dvh max-h-dvh w-72 max-w-[85vw] border-r bg-background p-0 text-foreground shadow-xl backdrop:bg-black/50\"\n onCancel={(event) => {\n event.preventDefault();\n onClose();\n }}\n onClick={(event) => {\n if (event.target === event.currentTarget) {\n const bounds = event.currentTarget.getBoundingClientRect();\n if (\n event.clientX < bounds.left ||\n event.clientX > bounds.right ||\n event.clientY < bounds.top ||\n event.clientY > bounds.bottom\n )\n onClose();\n }\n if (event.target instanceof Element && event.target.closest(\"a\")) onClose();\n }}\n >\n <button\n type=\"button\"\n className=\"m-3 rounded border px-3 py-2 text-sm focus-visible:ring-2\"\n aria-label=\"Close navigation\"\n onClick={onClose}\n >\n Close\n </button>\n <div className=\"max-h-[calc(100dvh-4rem)] overflow-y-auto\">{children}</div>\n </dialog>\n );\n}\n",
17
29
  "type": "registry:ui"
18
30
  },
19
31
  {
20
32
  "path": "components/uibot/feedback.uibot.json",
21
33
  "target": "components/uibot/feedback.uibot.json",
22
- "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"feedback\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Button\",\n \"export\": \"Button\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Button\",\n \"description\": \"Standalone action button. Six visual variants and five sizes. Does not submit forms — use Form.Submit for that.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"button\",\n \"action\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\",\n \"secondary\",\n \"ghost\",\n \"link\"\n ],\n \"default\": \"default\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"xs\",\n \"sm\",\n \"default\",\n \"lg\",\n \"icon\"\n ],\n \"default\": \"default\"\n },\n \"full\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"events\": {\n \"onClick\": {\n \"description\": \"Runs with a plain click payload.\"\n }\n },\n \"usageScenarios\": [\n \"Primary CTA on a hero section\",\n \"Row of outline action buttons in a Card actions slot\",\n \"Ghost icon button in a toolbar\"\n ],\n \"constraints\": [\n \"Use Form.Submit, not Button[type=submit], inside a Form\",\n \"Do not place more than 3 primary (default) buttons on the same view\"\n ]\n }\n },\n {\n \"name\": \"Dialog\",\n \"export\": \"Dialog\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Dialog\",\n \"description\": \"Confirmation dialog with title, description, and optional cancel/confirm buttons. Rendered inline in preview.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"dialog\",\n \"modal\",\n \"confirm\"\n ],\n \"props\": {\n \"title\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"cancelLabel\": {\n \"type\": \"string\"\n },\n \"confirmLabel\": {\n \"type\": \"string\"\n },\n \"confirmVariant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\"\n ],\n \"default\": \"default\"\n }\n },\n \"usageScenarios\": [\n \"Delete confirmation prompt\",\n \"Unsaved changes warning before navigation\"\n ],\n \"constraints\": [\n \"Dialog is always visible in static preview — drive open/close state via actions in production\"\n ]\n }\n },\n {\n \"name\": \"Skeleton\",\n \"export\": \"Skeleton\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Skeleton\",\n \"description\": \"Animated loading placeholder. Three presets: lines (text), card (avatar + lines), table (header + rows).\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"skeleton\",\n \"loading\",\n \"placeholder\"\n ],\n \"props\": {\n \"lines\": {\n \"type\": \"integer\",\n \"default\": 3,\n \"description\": \"Number of skeleton rows (for lines and table types)\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"lines\",\n \"card\",\n \"table\"\n ],\n \"default\": \"lines\"\n }\n },\n \"usageScenarios\": [\n \"Loading state while fetching table data\",\n \"Card placeholder during profile load\"\n ],\n \"constraints\": [\n \"Replace with real content once data loads; do not keep Skeleton visible indefinitely\"\n ]\n }\n },\n {\n \"name\": \"Toast\",\n \"export\": \"Toast\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Toast\",\n \"description\": \"Alert banner (info, success, warning, error); placement top-right floats it as a dismissible corner notice.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"toast\",\n \"alert\",\n \"notification\"\n ],\n \"props\": {\n \"message\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"string\",\n \"enum\": [\n \"info\",\n \"success\",\n \"warning\",\n \"error\"\n ],\n \"default\": \"info\"\n },\n \"closeable\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placement\": {\n \"type\": \"string\",\n \"enum\": [\n \"inline\",\n \"top-right\"\n ],\n \"default\": \"inline\"\n },\n \"duration\": {\n \"type\": \"number\",\n \"description\": \"Auto-dismiss after ms\"\n }\n },\n \"usageScenarios\": [\n \"Success message after form submit\",\n \"Sample-data notice (top-right)\"\n ],\n \"constraints\": [\n \"Keep floating notices to a title and one or two short lines\"\n ]\n }\n }\n ]\n}\n",
34
+ "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"feedback\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Button\",\n \"export\": \"Button\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Button\",\n \"description\": \"Standalone action button. Six visual variants and five sizes. Does not submit forms — use Form.Submit for that.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"button\",\n \"action\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\",\n \"secondary\",\n \"ghost\",\n \"link\"\n ],\n \"default\": \"default\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"xs\",\n \"sm\",\n \"default\",\n \"lg\",\n \"icon\"\n ],\n \"default\": \"default\"\n },\n \"full\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"events\": {\n \"onClick\": {\n \"description\": \"Runs with a plain click payload.\"\n }\n },\n \"usageScenarios\": [\n \"Primary CTA on a hero section\",\n \"Row of outline action buttons in a Card actions slot\",\n \"Ghost icon button in a toolbar\"\n ],\n \"constraints\": [\n \"Use Form.Submit, not Button[type=submit], inside a Form\",\n \"Do not place more than 3 primary (default) buttons on the same view\"\n ]\n }\n },\n {\n \"name\": \"Dialog\",\n \"export\": \"Dialog\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Dialog\",\n \"description\": \"Confirmation with explicit action intents. Boolean open uses a native modal; omitted open keeps an inline composition.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"dialog\",\n \"modal\",\n \"confirm\"\n ],\n \"props\": {\n \"open\": {\n \"type\": \"boolean\",\n \"description\": \"Omit for inline.\"\n },\n \"pending\": {\n \"type\": \"boolean\",\n \"description\": \"Lock actions/dismissal.\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"cancelLabel\": {\n \"type\": \"string\"\n },\n \"confirmLabel\": {\n \"type\": \"string\"\n },\n \"confirmVariant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\"\n ],\n \"default\": \"default\"\n }\n },\n \"events\": {\n \"onConfirm\": {\n \"description\": \"value=values.action=confirm.\"\n },\n \"onCancel\": {\n \"description\": \"value=values.action=cancel.\"\n },\n \"onClose\": {\n \"description\": \"Dismiss: value=values.open=false.\"\n }\n },\n \"usageScenarios\": [\n \"Delete confirmation prompt\",\n \"Unsaved changes warning before navigation\"\n ],\n \"constraints\": [\n \"Host owns open/pending and persistence; no automatic close/write/retry.\"\n ]\n }\n },\n {\n \"name\": \"Skeleton\",\n \"export\": \"Skeleton\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Skeleton\",\n \"description\": \"Animated loading placeholder. Three presets: lines (text), card (avatar + lines), table (header + rows).\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"skeleton\",\n \"loading\",\n \"placeholder\"\n ],\n \"props\": {\n \"lines\": {\n \"type\": \"integer\",\n \"default\": 3,\n \"description\": \"Number of skeleton rows (for lines and table types)\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"lines\",\n \"card\",\n \"table\"\n ],\n \"default\": \"lines\"\n }\n },\n \"usageScenarios\": [\n \"Loading state while fetching table data\",\n \"Card placeholder during profile load\"\n ],\n \"constraints\": [\n \"Replace with real content once data loads; do not keep Skeleton visible indefinitely\"\n ]\n }\n },\n {\n \"name\": \"Toast\",\n \"export\": \"Toast\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Toast\",\n \"description\": \"Alert banner (info, success, warning, error); placement top-right floats it as a dismissible corner notice.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"toast\",\n \"alert\",\n \"notification\"\n ],\n \"props\": {\n \"message\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"string\",\n \"enum\": [\n \"info\",\n \"success\",\n \"warning\",\n \"error\"\n ],\n \"default\": \"info\"\n },\n \"closeable\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placement\": {\n \"type\": \"string\",\n \"enum\": [\n \"inline\",\n \"top-right\"\n ],\n \"default\": \"inline\"\n },\n \"duration\": {\n \"type\": \"number\",\n \"description\": \"Auto-dismiss after ms\"\n }\n },\n \"usageScenarios\": [\n \"Success message after form submit\",\n \"Sample-data notice (top-right)\"\n ],\n \"constraints\": [\n \"Keep floating notices to a title and one or two short lines\"\n ]\n }\n }\n ]\n}\n",
23
35
  "type": "registry:ui"
24
36
  }
25
37
  ],
@@ -158,7 +170,7 @@
158
170
  "module": "feedback.tsx",
159
171
  "catalog": {
160
172
  "name": "Dialog",
161
- "description": "Confirmation dialog with title, description, and optional cancel/confirm buttons. Rendered inline in preview.",
173
+ "description": "Confirmation with explicit action intents. Boolean open uses a native modal; omitted open keeps an inline composition.",
162
174
  "category": "composite",
163
175
  "level": "L2",
164
176
  "tags": [
@@ -167,6 +179,14 @@
167
179
  "confirm"
168
180
  ],
169
181
  "props": {
182
+ "open": {
183
+ "type": "boolean",
184
+ "description": "Omit for inline."
185
+ },
186
+ "pending": {
187
+ "type": "boolean",
188
+ "description": "Lock actions/dismissal."
189
+ },
170
190
  "title": {
171
191
  "type": "string"
172
192
  },
@@ -189,12 +209,23 @@
189
209
  "default": "default"
190
210
  }
191
211
  },
212
+ "events": {
213
+ "onConfirm": {
214
+ "description": "value=values.action=confirm."
215
+ },
216
+ "onCancel": {
217
+ "description": "value=values.action=cancel."
218
+ },
219
+ "onClose": {
220
+ "description": "Dismiss: value=values.open=false."
221
+ }
222
+ },
192
223
  "usageScenarios": [
193
224
  "Delete confirmation prompt",
194
225
  "Unsaved changes warning before navigation"
195
226
  ],
196
227
  "constraints": [
197
- "Dialog is always visible in static preview — drive open/close state via actions in production"
228
+ "Host owns open/pending and persistence; no automatic close/write/retry."
198
229
  ]
199
230
  }
200
231
  },