@seed-ship/mcp-ui-solid 2.2.3 → 2.2.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.js","sources":["../../src/services/component-registry.ts"],"sourcesContent":["/**\n * Component Registry Service\n * Phase 0: Static registry with Quickchart and Table definitions\n * Phase 1: Dynamic registry populated from /api/mcp/tools/list\n *\n * Provides component schemas for LLM prompt engineering\n */\n\nimport type { ComponentRegistryEntry, ComponentType } from '../types'\nimport { DEFAULT_RESOURCE_LIMITS } from './validation'\n\n/**\n * Quickchart Component Registry Entry\n * Based on Quickchart API documentation\n */\nexport const QuickchartRegistry: ComponentRegistryEntry = {\n type: 'chart',\n name: 'Quickchart',\n description:\n 'Render charts using Quickchart.io API. Supports bar, line, pie, doughnut, radar, and scatter charts. Best for visualizing numerical data with 2-10 data series and up to 1000 data points.',\n schema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['bar', 'line', 'pie', 'doughnut', 'radar', 'scatter'],\n description: 'Chart type',\n },\n title: {\n type: 'string',\n description: 'Chart title (optional)',\n },\n data: {\n type: 'object',\n properties: {\n labels: {\n type: 'array',\n items: { type: 'string' },\n description: 'X-axis labels',\n },\n datasets: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n label: { type: 'string' },\n data: {\n type: 'array',\n items: { type: 'number' },\n },\n backgroundColor: {\n oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],\n },\n borderColor: {\n oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],\n },\n borderWidth: { type: 'number' },\n },\n required: ['label', 'data'],\n },\n },\n },\n required: ['labels', 'datasets'],\n },\n options: {\n type: 'object',\n description: 'Chart.js options for customization',\n },\n },\n required: ['type', 'data'],\n },\n examples: [\n {\n query: 'Show me document types distribution',\n component: {\n id: 'example-bar-1',\n type: 'chart',\n position: { colStart: 1, colSpan: 6 },\n params: {\n type: 'bar',\n title: 'Document Types',\n data: {\n labels: ['PDF', 'DOCX', 'TXT', 'XLSX'],\n datasets: [\n {\n label: 'Count',\n data: [245, 189, 123, 98],\n backgroundColor: ['rgba(59, 130, 246, 0.8)'],\n },\n ],\n },\n },\n },\n },\n {\n query: 'Display upload trends over the last week',\n component: {\n id: 'example-line-1',\n type: 'chart',\n position: { colStart: 1, colSpan: 6 },\n params: {\n type: 'line',\n title: 'Upload Trends',\n data: {\n labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],\n datasets: [\n {\n label: 'Uploads',\n data: [42, 38, 51, 47, 63, 29, 15],\n borderColor: 'rgb(59, 130, 246)',\n },\n ],\n },\n options: {\n tension: 0.4,\n },\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Table Component Registry Entry\n */\nexport const TableRegistry: ComponentRegistryEntry = {\n type: 'table',\n name: 'DataTable',\n description:\n 'Render tabular data with sortable columns and pagination. Best for displaying structured records with up to 100 rows. Supports column width customization and cell formatting.',\n schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n description: 'Table title (optional)',\n },\n columns: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n key: { type: 'string', description: 'Data key for this column' },\n label: { type: 'string', description: 'Column header label' },\n sortable: { type: 'boolean', description: 'Whether column is sortable' },\n width: { type: 'string', description: 'CSS width (e.g., \"30%\")' },\n },\n required: ['key', 'label'],\n },\n minItems: 1,\n },\n rows: {\n type: 'array',\n items: {\n type: 'object',\n description: 'Row data matching column keys',\n },\n maxItems: 100,\n },\n pagination: {\n type: 'object',\n properties: {\n currentPage: { type: 'number' },\n pageSize: { type: 'number' },\n totalRows: { type: 'number' },\n },\n },\n },\n required: ['columns', 'rows'],\n },\n examples: [\n {\n query: 'Show me the most recent documents',\n component: {\n id: 'example-table-1',\n type: 'table',\n position: { colStart: 1, colSpan: 8 },\n params: {\n title: 'Recent Documents',\n columns: [\n { key: 'name', label: 'Name', sortable: true, width: '40%' },\n { key: 'type', label: 'Type', sortable: true, width: '15%' },\n { key: 'size', label: 'Size', width: '15%' },\n { key: 'modified', label: 'Modified', sortable: true, width: '30%' },\n ],\n rows: [\n { name: 'Report.pdf', type: 'PDF', size: '2.4 MB', modified: '2 hours ago' },\n { name: 'Slides.pptx', type: 'PPTX', size: '8.7 MB', modified: '1 day ago' },\n ],\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Metric Card Component Registry Entry\n */\nexport const MetricRegistry: ComponentRegistryEntry = {\n type: 'metric',\n name: 'MetricCard',\n description:\n 'Display a single metric with optional trend indicator. Best for KPIs, statistics, and summary numbers. Supports trend direction (up/down/neutral) and subtitles.',\n schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n description: 'Metric title',\n },\n value: {\n oneOf: [{ type: 'string' }, { type: 'number' }],\n description: 'Metric value',\n },\n unit: {\n type: 'string',\n description: 'Unit of measurement (optional)',\n },\n trend: {\n type: 'object',\n properties: {\n value: { type: 'number', description: 'Percentage change' },\n direction: { type: 'string', enum: ['up', 'down', 'neutral'] },\n },\n },\n subtitle: {\n type: 'string',\n description: 'Additional context (optional)',\n },\n },\n required: ['title', 'value'],\n },\n examples: [\n {\n query: 'Show total document count',\n component: {\n id: 'example-metric-1',\n type: 'metric',\n position: { colStart: 1, colSpan: 3 },\n params: {\n title: 'Total Documents',\n value: '1,247',\n trend: {\n value: 12.5,\n direction: 'up',\n },\n subtitle: '+142 this month',\n },\n },\n },\n ],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 5 * 1024, // 5KB\n renderTimeout: 1000, // 1s\n },\n}\n\n/**\n * Text Component Registry Entry\n */\nexport const TextRegistry: ComponentRegistryEntry = {\n type: 'text',\n name: 'TextBlock',\n description:\n 'Render text content with optional markdown support. Best for explanations, summaries, and context. Supports basic HTML formatting.',\n schema: {\n type: 'object',\n properties: {\n content: {\n type: 'string',\n description: 'Text content (HTML allowed, will be sanitized)',\n },\n markdown: {\n type: 'boolean',\n description: 'Whether content is markdown (not yet implemented)',\n },\n className: {\n type: 'string',\n description: 'Custom CSS classes',\n },\n },\n required: ['content'],\n },\n examples: [\n {\n query: 'Explain the document distribution',\n component: {\n id: 'example-text-1',\n type: 'text',\n position: { colStart: 1, colSpan: 12 },\n params: {\n content:\n '<p>Your document library contains <strong>1,247 files</strong> across 5 different formats. PDFs represent the largest category at 35% of total storage.</p>',\n },\n },\n },\n ],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 10 * 1024, // 10KB\n renderTimeout: 1000, // 1s\n },\n}\n\n// ============================================================================\n// Sprint 4: Additional Component Registry Entries\n// ============================================================================\n\n/**\n * Grid Component Registry Entry\n * Nested CSS Grid layout for organizing multiple components\n */\nexport const GridRegistry: ComponentRegistryEntry = {\n type: 'grid',\n name: 'GridLayout',\n description:\n 'Nested CSS Grid layout for organizing multiple components. Supports named areas, responsive columns (1-12), and custom gap spacing. Best for complex dashboard layouts and template builder.',\n schema: {\n type: 'object',\n properties: {\n columns: {\n type: 'number',\n description: 'Number of columns (default: 12)',\n },\n gap: {\n type: 'string',\n description: 'Gap between items (e.g., \"1rem\")',\n },\n minRowHeight: {\n type: 'string',\n description: 'Minimum row height (optional)',\n },\n areas: {\n type: 'array',\n items: {\n type: 'array',\n items: { type: 'string' },\n },\n description: 'CSS Grid template areas for named regions',\n },\n children: {\n type: 'array',\n items: { type: 'object' },\n description: 'Child UIComponents to render within the grid',\n },\n },\n required: ['children'],\n },\n examples: [],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Action Component Registry Entry\n * Interactive button or link that triggers tool calls\n */\nexport const ActionRegistry: ComponentRegistryEntry = {\n type: 'action',\n name: 'ActionButton',\n description:\n 'Interactive button or link that triggers tool calls or navigation. Best for user interactions, form submissions, and workflow triggers.',\n schema: {\n type: 'object',\n properties: {\n label: {\n type: 'string',\n description: 'Button text',\n },\n type: {\n type: 'string',\n enum: ['button', 'link'],\n description: 'Render as button or link',\n },\n action: {\n type: 'string',\n enum: ['tool-call', 'link', 'submit'],\n description: 'Action type to perform',\n },\n toolName: {\n type: 'string',\n description: 'Tool name to call (for tool-call action)',\n },\n params: {\n type: 'object',\n description: 'Parameters to pass to the tool',\n },\n url: {\n type: 'string',\n description: 'URL for link action',\n },\n variant: {\n type: 'string',\n enum: ['primary', 'secondary', 'outline', 'ghost', 'danger'],\n description: 'Visual style variant',\n },\n size: {\n type: 'string',\n enum: ['sm', 'md', 'lg'],\n description: 'Button size',\n },\n disabled: {\n type: 'boolean',\n description: 'Whether the action is disabled',\n },\n },\n required: ['label', 'type', 'action'],\n },\n examples: [],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Footer Component Registry Entry\n * Display execution metadata like timing and source count\n */\nexport const FooterRegistry: ComponentRegistryEntry = {\n type: 'footer',\n name: 'FooterSection',\n description:\n 'Footer section displaying execution metadata. Best for showing timing, model info, and source counts. Auto-injected by layouts when metadata is provided.',\n schema: {\n type: 'object',\n properties: {\n poweredBy: {\n type: 'string',\n description: 'Powered by text (optional)',\n },\n executionTime: {\n type: 'number',\n description: 'Execution time in milliseconds',\n },\n model: {\n type: 'string',\n description: 'LLM model used',\n },\n sourceCount: {\n type: 'number',\n description: 'Number of sources used',\n },\n customText: {\n type: 'string',\n description: 'Custom footer text',\n },\n links: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n label: { type: 'string' },\n url: { type: 'string' },\n },\n },\n description: 'Footer links',\n },\n },\n },\n examples: [],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 5 * 1024,\n renderTimeout: 1000,\n },\n}\n\n/**\n * Carousel Component Registry Entry\n * Display multiple items with horizontal scrolling\n */\nexport const CarouselRegistry: ComponentRegistryEntry = {\n type: 'carousel',\n name: 'Carousel',\n description:\n 'Horizontal carousel for displaying multiple items with snap scrolling and navigation buttons. Best for showcasing related content, image galleries, or card collections.',\n schema: {\n type: 'object',\n properties: {\n items: {\n type: 'array',\n items: { type: 'object' },\n description: 'Array of UIComponents to display in carousel',\n },\n height: {\n type: 'string',\n description: 'Carousel height (optional)',\n },\n },\n required: ['items'],\n },\n examples: [],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Artifact Component Registry Entry\n * Display downloadable artifacts like generated files\n */\nexport const ArtifactRegistry: ComponentRegistryEntry = {\n type: 'artifact',\n name: 'Artifact',\n description:\n 'Display downloadable artifacts like generated files or exports. Shows filename, size, and download button. Best for CSV exports, PDF reports, and generated documents.',\n schema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'Download URL for the artifact',\n },\n filename: {\n type: 'string',\n description: 'Display filename',\n },\n mimeType: {\n type: 'string',\n description: 'MIME type (e.g., \"text/csv\", \"application/pdf\")',\n },\n size: {\n type: 'number',\n description: 'File size in bytes',\n },\n description: {\n type: 'string',\n description: 'Description of the artifact',\n },\n },\n required: ['url', 'filename', 'mimeType'],\n },\n examples: [],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 5 * 1024,\n renderTimeout: 1000,\n },\n}\n\n/**\n * Component Registry - All components indexed by type\n */\nexport const ComponentRegistry: Map<ComponentType, ComponentRegistryEntry> = new Map([\n ['chart', QuickchartRegistry],\n ['table', TableRegistry],\n ['metric', MetricRegistry],\n ['text', TextRegistry],\n // Sprint 4 additions\n ['grid', GridRegistry],\n ['action', ActionRegistry],\n ['footer', FooterRegistry],\n ['carousel', CarouselRegistry],\n ['artifact', ArtifactRegistry],\n])\n\n/**\n * Get component registry entry by type\n */\nexport function getComponentEntry(type: ComponentType): ComponentRegistryEntry | undefined {\n return ComponentRegistry.get(type)\n}\n\n/**\n * Get all component types\n */\nexport function getAllComponentTypes(): ComponentType[] {\n return Array.from(ComponentRegistry.keys())\n}\n\n/**\n * Get registry as JSON for LLM context\n */\nexport function getRegistryForLLM(): string {\n const entries = Array.from(ComponentRegistry.values()).map((entry) => ({\n type: entry.type,\n name: entry.name,\n description: entry.description,\n schema: entry.schema,\n examples: entry.examples.map((ex) => ({\n query: ex.query,\n component: ex.component,\n })),\n limits: entry.limits,\n }))\n\n return JSON.stringify(entries, null, 2)\n}\n\n/**\n * Validate component against registry schema\n * (Future: Use Zod for runtime validation)\n */\nexport function validateAgainstRegistry(\n componentType: ComponentType,\n params: any\n): { valid: boolean; errors?: string[]; warnings?: string[] } {\n const entry = getComponentEntry(componentType)\n if (!entry) {\n // Warn but don't block — renderer may exist even without registry entry\n return { valid: true, warnings: [`No registry entry for type: ${componentType}`] }\n }\n\n // Basic validation (Phase 1 will add Zod schema validation)\n const required = entry.schema.required || []\n const missing = required.filter((key: string) => !(key in params))\n\n if (missing.length > 0) {\n return {\n valid: false,\n errors: missing.map((key: string) => `Missing required field: ${key}`),\n }\n }\n\n return { valid: true }\n}\n"],"names":[],"mappings":";AAeO,MAAM,qBAA6C;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aACE;AAAA,EACF,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM,CAAC,OAAO,QAAQ,OAAO,YAAY,SAAS,SAAS;AAAA,QAC3D,aAAa;AAAA,MAAA;AAAA,MAEf,OAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,OAAO,EAAE,MAAM,SAAA;AAAA,YACf,aAAa;AAAA,UAAA;AAAA,UAEf,UAAU;AAAA,YACR,MAAM;AAAA,YACN,OAAO;AAAA,cACL,MAAM;AAAA,cACN,YAAY;AAAA,gBACV,OAAO,EAAE,MAAM,SAAA;AAAA,gBACf,MAAM;AAAA,kBACJ,MAAM;AAAA,kBACN,OAAO,EAAE,MAAM,SAAA;AAAA,gBAAS;AAAA,gBAE1B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A,EACvB,CAAC,UAAU,cAAc;AAAA,EACzB,CAAC,QAAQ,YAAY;AAAA;AAAA,EAErB,CAAC,QAAQ,YAAY;AAAA,EACrB,CAAC,UAAU,cAAc;AAAA,EACzB,CAAC,UAAU,cAAc;AAAA,EACzB,CAAC,YAAY,gBAAgB;AAAA,EAC7B,CAAC,YAAY,gBAAgB;AAC/B,CAAC;"}
1
+ {"version":3,"file":"component-registry.js","sources":["../../src/services/component-registry.ts"],"sourcesContent":["/**\n * Component Registry Service\n * Phase 0: Static registry with Quickchart and Table definitions\n * Phase 1: Dynamic registry populated from /api/mcp/tools/list\n *\n * Provides component schemas for LLM prompt engineering\n */\n\nimport type { ComponentRegistryEntry, ComponentType } from '../types'\nimport { DEFAULT_RESOURCE_LIMITS } from './validation'\n\n/**\n * Quickchart Component Registry Entry\n * Based on Quickchart API documentation\n */\nexport const QuickchartRegistry: ComponentRegistryEntry = {\n type: 'chart',\n name: 'Quickchart',\n description:\n 'Render charts using Quickchart.io API. Supports bar, line, pie, doughnut, radar, and scatter charts. Best for visualizing numerical data with 2-10 data series and up to 1000 data points.',\n schema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['bar', 'line', 'pie', 'doughnut', 'radar', 'scatter'],\n description: 'Chart type',\n },\n title: {\n type: 'string',\n description: 'Chart title (optional)',\n },\n data: {\n type: 'object',\n properties: {\n labels: {\n type: 'array',\n items: { type: 'string' },\n description: 'X-axis labels',\n },\n datasets: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n label: { type: 'string' },\n data: {\n type: 'array',\n items: { type: 'number' },\n },\n backgroundColor: {\n oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],\n },\n borderColor: {\n oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],\n },\n borderWidth: { type: 'number' },\n },\n required: ['label', 'data'],\n },\n },\n },\n required: ['labels', 'datasets'],\n },\n options: {\n type: 'object',\n description: 'Chart.js options for customization',\n },\n },\n required: ['type', 'data'],\n },\n examples: [\n {\n query: 'Show me document types distribution',\n component: {\n id: 'example-bar-1',\n type: 'chart',\n position: { colStart: 1, colSpan: 6 },\n params: {\n type: 'bar',\n title: 'Document Types',\n data: {\n labels: ['PDF', 'DOCX', 'TXT', 'XLSX'],\n datasets: [\n {\n label: 'Count',\n data: [245, 189, 123, 98],\n backgroundColor: ['rgba(59, 130, 246, 0.8)'],\n },\n ],\n },\n },\n },\n },\n {\n query: 'Display upload trends over the last week',\n component: {\n id: 'example-line-1',\n type: 'chart',\n position: { colStart: 1, colSpan: 6 },\n params: {\n type: 'line',\n title: 'Upload Trends',\n data: {\n labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],\n datasets: [\n {\n label: 'Uploads',\n data: [42, 38, 51, 47, 63, 29, 15],\n borderColor: 'rgb(59, 130, 246)',\n },\n ],\n },\n options: {\n tension: 0.4,\n },\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Table Component Registry Entry\n */\nexport const TableRegistry: ComponentRegistryEntry = {\n type: 'table',\n name: 'DataTable',\n description:\n 'Render tabular data with sortable columns and pagination. Best for displaying structured records with up to 100 rows. Supports column width customization and cell formatting.',\n schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n description: 'Table title (optional)',\n },\n columns: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n key: { type: 'string', description: 'Data key for this column' },\n label: { type: 'string', description: 'Column header label' },\n sortable: { type: 'boolean', description: 'Whether column is sortable' },\n width: { type: 'string', description: 'CSS width (e.g., \"30%\")' },\n },\n required: ['key', 'label'],\n },\n minItems: 1,\n },\n rows: {\n type: 'array',\n items: {\n type: 'object',\n description: 'Row data matching column keys',\n },\n maxItems: 100,\n },\n pagination: {\n type: 'object',\n properties: {\n currentPage: { type: 'number' },\n pageSize: { type: 'number' },\n totalRows: { type: 'number' },\n },\n },\n },\n required: ['columns', 'rows'],\n },\n examples: [\n {\n query: 'Show me the most recent documents',\n component: {\n id: 'example-table-1',\n type: 'table',\n position: { colStart: 1, colSpan: 8 },\n params: {\n title: 'Recent Documents',\n columns: [\n { key: 'name', label: 'Name', sortable: true, width: '40%' },\n { key: 'type', label: 'Type', sortable: true, width: '15%' },\n { key: 'size', label: 'Size', width: '15%' },\n { key: 'modified', label: 'Modified', sortable: true, width: '30%' },\n ],\n rows: [\n { name: 'Report.pdf', type: 'PDF', size: '2.4 MB', modified: '2 hours ago' },\n { name: 'Slides.pptx', type: 'PPTX', size: '8.7 MB', modified: '1 day ago' },\n ],\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Metric Card Component Registry Entry\n */\nexport const MetricRegistry: ComponentRegistryEntry = {\n type: 'metric',\n name: 'MetricCard',\n description:\n 'Display a single metric with optional trend indicator. Best for KPIs, statistics, and summary numbers. Supports trend direction (up/down/neutral) and subtitles.',\n schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n description: 'Metric title',\n },\n value: {\n oneOf: [{ type: 'string' }, { type: 'number' }],\n description: 'Metric value',\n },\n unit: {\n type: 'string',\n description: 'Unit of measurement (optional)',\n },\n trend: {\n type: 'object',\n properties: {\n value: { type: 'number', description: 'Percentage change' },\n direction: { type: 'string', enum: ['up', 'down', 'neutral'] },\n },\n },\n subtitle: {\n type: 'string',\n description: 'Additional context (optional)',\n },\n },\n required: ['title', 'value'],\n },\n examples: [\n {\n query: 'Show total document count',\n component: {\n id: 'example-metric-1',\n type: 'metric',\n position: { colStart: 1, colSpan: 3 },\n params: {\n title: 'Total Documents',\n value: '1,247',\n trend: {\n value: 12.5,\n direction: 'up',\n },\n subtitle: '+142 this month',\n },\n },\n },\n ],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 5 * 1024, // 5KB\n renderTimeout: 1000, // 1s\n },\n}\n\n/**\n * Text Component Registry Entry\n */\nexport const TextRegistry: ComponentRegistryEntry = {\n type: 'text',\n name: 'TextBlock',\n description:\n 'Render text content with optional markdown support. Best for explanations, summaries, and context. Supports basic HTML formatting.',\n schema: {\n type: 'object',\n properties: {\n content: {\n type: 'string',\n description: 'Text content (HTML allowed, will be sanitized)',\n },\n markdown: {\n type: 'boolean',\n description: 'Whether content is markdown (not yet implemented)',\n },\n className: {\n type: 'string',\n description: 'Custom CSS classes',\n },\n },\n required: ['content'],\n },\n examples: [\n {\n query: 'Explain the document distribution',\n component: {\n id: 'example-text-1',\n type: 'text',\n position: { colStart: 1, colSpan: 12 },\n params: {\n content:\n '<p>Your document library contains <strong>1,247 files</strong> across 5 different formats. PDFs represent the largest category at 35% of total storage.</p>',\n },\n },\n },\n ],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 10 * 1024, // 10KB\n renderTimeout: 1000, // 1s\n },\n}\n\n// ============================================================================\n// Sprint 4: Additional Component Registry Entries\n// ============================================================================\n\n/**\n * Grid Component Registry Entry\n * Nested CSS Grid layout for organizing multiple components\n */\nexport const GridRegistry: ComponentRegistryEntry = {\n type: 'grid',\n name: 'GridLayout',\n description:\n 'Nested CSS Grid layout for organizing multiple components. Supports named areas, responsive columns (1-12), and custom gap spacing. Best for complex dashboard layouts and template builder.',\n schema: {\n type: 'object',\n properties: {\n columns: {\n type: 'number',\n description: 'Number of columns (default: 12)',\n },\n gap: {\n type: 'string',\n description: 'Gap between items (e.g., \"1rem\")',\n },\n minRowHeight: {\n type: 'string',\n description: 'Minimum row height (optional)',\n },\n areas: {\n type: 'array',\n items: {\n type: 'array',\n items: { type: 'string' },\n },\n description: 'CSS Grid template areas for named regions',\n },\n children: {\n type: 'array',\n items: { type: 'object' },\n description: 'Child UIComponents to render within the grid',\n },\n },\n required: ['children'],\n },\n examples: [],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Action Component Registry Entry\n * Interactive button or link that triggers tool calls\n */\nexport const ActionRegistry: ComponentRegistryEntry = {\n type: 'action',\n name: 'ActionButton',\n description:\n 'Interactive button or link that triggers tool calls or navigation. Best for user interactions, form submissions, and workflow triggers.',\n schema: {\n type: 'object',\n properties: {\n label: {\n type: 'string',\n description: 'Button text',\n },\n type: {\n type: 'string',\n enum: ['button', 'link'],\n description: 'Render as button or link',\n },\n action: {\n type: 'string',\n enum: ['tool-call', 'link', 'submit'],\n description: 'Action type to perform',\n },\n toolName: {\n type: 'string',\n description: 'Tool name to call (for tool-call action)',\n },\n params: {\n type: 'object',\n description: 'Parameters to pass to the tool',\n },\n url: {\n type: 'string',\n description: 'URL for link action',\n },\n variant: {\n type: 'string',\n enum: ['primary', 'secondary', 'outline', 'ghost', 'danger'],\n description: 'Visual style variant',\n },\n size: {\n type: 'string',\n enum: ['sm', 'md', 'lg'],\n description: 'Button size',\n },\n disabled: {\n type: 'boolean',\n description: 'Whether the action is disabled',\n },\n },\n required: ['label', 'type', 'action'],\n },\n examples: [],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Footer Component Registry Entry\n * Display execution metadata like timing and source count\n */\nexport const FooterRegistry: ComponentRegistryEntry = {\n type: 'footer',\n name: 'FooterSection',\n description:\n 'Footer section displaying execution metadata. Best for showing timing, model info, and source counts. Auto-injected by layouts when metadata is provided.',\n schema: {\n type: 'object',\n properties: {\n poweredBy: {\n type: 'string',\n description: 'Powered by text (optional)',\n },\n executionTime: {\n type: 'number',\n description: 'Execution time in milliseconds',\n },\n model: {\n type: 'string',\n description: 'LLM model used',\n },\n sourceCount: {\n type: 'number',\n description: 'Number of sources used',\n },\n customText: {\n type: 'string',\n description: 'Custom footer text',\n },\n links: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n label: { type: 'string' },\n url: { type: 'string' },\n },\n },\n description: 'Footer links',\n },\n },\n },\n examples: [],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 5 * 1024,\n renderTimeout: 1000,\n },\n}\n\n/**\n * Carousel Component Registry Entry\n * Display multiple items with horizontal scrolling\n */\nexport const CarouselRegistry: ComponentRegistryEntry = {\n type: 'carousel',\n name: 'Carousel',\n description:\n 'Horizontal carousel for displaying multiple items with snap scrolling and navigation buttons. Best for showcasing related content, image galleries, or card collections.',\n schema: {\n type: 'object',\n properties: {\n items: {\n type: 'array',\n items: { type: 'object' },\n description: 'Array of UIComponents to display in carousel',\n },\n height: {\n type: 'string',\n description: 'Carousel height (optional)',\n },\n },\n required: ['items'],\n },\n examples: [],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Artifact Component Registry Entry\n * Display downloadable artifacts like generated files\n */\nexport const ArtifactRegistry: ComponentRegistryEntry = {\n type: 'artifact',\n name: 'Artifact',\n description:\n 'Display downloadable artifacts like generated files or exports. Shows filename, size, and download button. Best for CSV exports, PDF reports, and generated documents.',\n schema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'Download URL for the artifact',\n },\n filename: {\n type: 'string',\n description: 'Display filename',\n },\n mimeType: {\n type: 'string',\n description: 'MIME type (e.g., \"text/csv\", \"application/pdf\")',\n },\n size: {\n type: 'number',\n description: 'File size in bytes',\n },\n description: {\n type: 'string',\n description: 'Description of the artifact',\n },\n },\n required: ['url', 'filename', 'mimeType'],\n },\n examples: [],\n limits: {\n maxDataPoints: 1,\n maxTableRows: 1,\n maxPayloadSize: 5 * 1024,\n renderTimeout: 1000,\n },\n}\n\n/**\n * Code Block Registry Entry\n */\nexport const CodeRegistry: ComponentRegistryEntry = {\n type: 'code',\n name: 'CodeBlock',\n description:\n 'Render syntax-highlighted code blocks with line numbers, copy button, and word wrap toggle. Supports all languages via highlight.js auto-detection. Best for displaying source code, configuration files, CLI output, or API responses.',\n schema: {\n type: 'object',\n properties: {\n code: { type: 'string', description: 'The code content to display' },\n language: { type: 'string', description: 'Programming language for syntax highlighting (auto-detected if omitted)' },\n filename: { type: 'string', description: 'Filename shown in header bar' },\n showLineNumbers: { type: 'boolean', description: 'Show line numbers (default: true)' },\n startLine: { type: 'number', description: 'Starting line number (default: 1)' },\n maxHeight: { type: 'string', description: 'CSS max-height for scrollable code blocks' },\n theme: { type: 'string', enum: ['light', 'dark'], description: 'Color theme (follows system preference by default)' },\n },\n required: ['code'],\n },\n examples: [\n {\n query: 'Show me how to connect to the API',\n component: {\n id: 'example-code-1',\n type: 'code',\n position: { colStart: 1, colSpan: 8 },\n params: {\n code: 'const client = new MCPClient({ url: \"https://api.example.com\" });\\nawait client.connect();\\nconst result = await client.query(\"SELECT * FROM documents\");',\n language: 'typescript',\n filename: 'example.ts',\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Map Registry Entry\n */\nexport const MapRegistry: ComponentRegistryEntry = {\n type: 'map',\n name: 'InteractiveMap',\n description:\n 'Render interactive maps with markers using Leaflet. Supports marker clustering, custom tile layers, and auto-fitting bounds. Best for displaying geographic data with up to 1000 markers.',\n schema: {\n type: 'object',\n properties: {\n center: { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 2, description: 'Map center [lat, lng]' },\n zoom: { type: 'number', description: 'Zoom level (1-18, default: 13)' },\n markers: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n position: { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 2 },\n title: { type: 'string' },\n popup: { type: 'string' },\n },\n required: ['position'],\n },\n },\n height: { type: 'string', description: 'CSS height (default: 400px)' },\n fitBounds: { type: 'boolean', description: 'Auto-fit to show all markers' },\n clustering: { type: 'boolean', description: 'Enable marker clustering for large datasets' },\n },\n required: [],\n },\n examples: [\n {\n query: 'Show office locations on a map',\n component: {\n id: 'example-map-1',\n type: 'map',\n position: { colStart: 1, colSpan: 12 },\n params: {\n center: [48.8566, 2.3522],\n zoom: 5,\n markers: [\n { position: [48.8566, 2.3522], tooltip: 'Paris', popup: 'HQ — 120 employees' },\n { position: [51.5074, -0.1278], tooltip: 'London', popup: 'UK Office — 45 employees' },\n ],\n fitBounds: true,\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Form Registry Entry\n */\nexport const FormRegistry: ComponentRegistryEntry = {\n type: 'form',\n name: 'Form',\n description:\n 'Render interactive forms with text inputs, selects, checkboxes, date pickers, and conditional fields. Supports persistence, validation, and submit actions that trigger MCP tool calls.',\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Form title' },\n fields: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n label: { type: 'string' },\n type: { type: 'string', enum: ['text', 'number', 'email', 'password', 'textarea', 'select', 'checkbox', 'radio', 'date'] },\n required: { type: 'boolean' },\n placeholder: { type: 'string' },\n options: { type: 'array', items: { type: 'object', properties: { label: { type: 'string' }, value: { type: 'string' } } } },\n },\n required: ['name', 'label', 'type'],\n },\n },\n submitLabel: { type: 'string', description: 'Submit button text (default: \"Submit\")' },\n layout: { type: 'string', enum: ['vertical', 'horizontal', 'inline'] },\n },\n required: ['fields'],\n },\n examples: [\n {\n query: 'Create a document upload form',\n component: {\n id: 'example-form-1',\n type: 'form',\n position: { colStart: 1, colSpan: 6 },\n params: {\n title: 'Upload Document',\n fields: [\n { name: 'title', label: 'Document Title', type: 'text', required: true },\n { name: 'category', label: 'Category', type: 'select', options: [{ label: 'Report', value: 'report' }, { label: 'Invoice', value: 'invoice' }] },\n { name: 'notes', label: 'Notes', type: 'textarea' },\n ],\n submitLabel: 'Upload',\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Modal Registry Entry\n */\nexport const ModalRegistry: ComponentRegistryEntry = {\n type: 'modal',\n name: 'Modal',\n description:\n 'Render a dialog overlay with Portal rendering. Supports sizes from small to fullscreen, close on Escape/backdrop, and nested content. Best for confirmations, detail views, and focused interactions.',\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Modal header title' },\n size: { type: 'string', enum: ['sm', 'md', 'lg', 'xl', 'full'], description: 'Modal width (default: md)' },\n showClose: { type: 'boolean', description: 'Show close button (default: true)' },\n closeOnEscape: { type: 'boolean', description: 'Close on Escape key (default: true)' },\n closeOnBackdrop: { type: 'boolean', description: 'Close on backdrop click (default: true)' },\n maxHeight: { type: 'string', description: 'CSS max-height for scrollable content' },\n },\n required: [],\n },\n examples: [\n {\n query: 'Show document details in a dialog',\n component: {\n id: 'example-modal-1',\n type: 'modal',\n position: { colStart: 1, colSpan: 12 },\n params: {\n title: 'Document Details',\n size: 'lg',\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Action Group Registry Entry\n */\nexport const ActionGroupRegistry: ComponentRegistryEntry = {\n type: 'action-group',\n name: 'ActionGroup',\n description:\n 'Render a group of action buttons in horizontal, vertical, or grid layout. Each action triggers an MCP tool call. Best for presenting multiple related actions like CRUD operations or workflow steps.',\n schema: {\n type: 'object',\n properties: {\n actions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n label: { type: 'string' },\n toolName: { type: 'string' },\n params: { type: 'object' },\n variant: { type: 'string', enum: ['primary', 'secondary', 'danger', 'ghost'] },\n icon: { type: 'string' },\n },\n required: ['label', 'toolName'],\n },\n },\n layout: { type: 'string', enum: ['horizontal', 'vertical', 'grid'], description: 'Button layout' },\n label: { type: 'string', description: 'Group label' },\n },\n required: ['actions'],\n },\n examples: [\n {\n query: 'Show actions for this document',\n component: {\n id: 'example-action-group-1',\n type: 'action-group',\n position: { colStart: 1, colSpan: 6 },\n params: {\n label: 'Document Actions',\n actions: [\n { label: 'Download', type: 'button', action: 'tool-call', toolName: 'document_download', params: { id: '123' }, variant: 'primary' },\n { label: 'Share', type: 'button', action: 'tool-call', toolName: 'document_share', params: { id: '123' }, variant: 'secondary' },\n { label: 'Delete', type: 'button', action: 'tool-call', toolName: 'document_delete', params: { id: '123' }, variant: 'danger' },\n ],\n layout: 'horizontal',\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Image Gallery Registry Entry\n */\nexport const ImageGalleryRegistry: ComponentRegistryEntry = {\n type: 'image-gallery',\n name: 'ImageGallery',\n description:\n 'Render a grid of images with lightbox overlay for fullscreen viewing. Supports captions, configurable columns, aspect ratios, and keyboard navigation in lightbox mode.',\n schema: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Gallery title' },\n images: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'Image URL' },\n alt: { type: 'string', description: 'Alt text' },\n caption: { type: 'string', description: 'Caption text' },\n thumbnail: { type: 'string', description: 'Thumbnail URL (optional, falls back to url)' },\n },\n required: ['url'],\n },\n },\n columns: { type: 'number', enum: [2, 3, 4, 5], description: 'Grid columns (default: 3)' },\n aspectRatio: { type: 'string', enum: ['1:1', '16:9', '4:3', 'auto'] },\n lightbox: { type: 'boolean', description: 'Enable lightbox overlay (default: true)' },\n },\n required: ['images'],\n },\n examples: [\n {\n query: 'Show document thumbnails',\n component: {\n id: 'example-gallery-1',\n type: 'image-gallery',\n position: { colStart: 1, colSpan: 12 },\n params: {\n title: 'Recent Documents',\n images: [\n { url: '/thumbnails/doc1.png', alt: 'Q4 Report', caption: 'Q4 Report — 24 pages' },\n { url: '/thumbnails/doc2.png', alt: 'Invoice #4521', caption: 'Invoice #4521' },\n ],\n columns: 4,\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Video Registry Entry\n */\nexport const VideoRegistry: ComponentRegistryEntry = {\n type: 'video',\n name: 'Video',\n description:\n 'Embed video from YouTube, Vimeo, or direct URLs. Auto-detects provider from URL and renders appropriate embed. Supports aspect ratios, autoplay, and start time.',\n schema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'Video URL (YouTube, Vimeo, or direct)' },\n title: { type: 'string', description: 'Video title' },\n caption: { type: 'string', description: 'Caption below video' },\n aspectRatio: { type: 'string', enum: ['16:9', '4:3', '1:1', '21:9'], description: 'Aspect ratio (default: 16:9)' },\n autoplay: { type: 'boolean', description: 'Auto-play video' },\n startTime: { type: 'number', description: 'Start time in seconds' },\n },\n required: ['url'],\n },\n examples: [\n {\n query: 'Show the product demo video',\n component: {\n id: 'example-video-1',\n type: 'video',\n position: { colStart: 1, colSpan: 8 },\n params: {\n url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',\n title: 'Product Demo',\n aspectRatio: '16:9',\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Iframe Registry Entry\n */\nexport const IframeRegistry: ComponentRegistryEntry = {\n type: 'iframe',\n name: 'Iframe',\n description:\n 'Embed external content via sandboxed iframe. Domain whitelist enforced for security. Supports Mermaid diagrams, Excalidraw, GitHub Gists, Figma, and 60+ whitelisted domains.',\n schema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'URL to embed (must be on whitelist)' },\n title: { type: 'string', description: 'Iframe title for accessibility' },\n height: { type: 'string', description: 'CSS height (default: 400px)' },\n sandbox: { type: 'string', description: 'Sandbox attribute (default: restrictive)' },\n },\n required: ['url'],\n },\n examples: [\n {\n query: 'Show the architecture diagram',\n component: {\n id: 'example-iframe-1',\n type: 'iframe',\n position: { colStart: 1, colSpan: 12 },\n params: {\n url: 'https://mermaid.ink/svg/graph+TD;A-->B;B-->C',\n title: 'Architecture Diagram',\n height: '500px',\n },\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Image Registry Entry\n */\nexport const ImageRegistry: ComponentRegistryEntry = {\n type: 'image',\n name: 'Image',\n description:\n 'Render a single image with optional alt text, caption, and link. Best for logos, screenshots, diagrams, or any standalone visual content.',\n schema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'Image URL' },\n alt: { type: 'string', description: 'Alt text for accessibility' },\n title: { type: 'string', description: 'Image title / heading' },\n width: { type: 'string', description: 'CSS width' },\n height: { type: 'string', description: 'CSS height' },\n },\n required: ['url'],\n },\n examples: [\n {\n query: 'Show the company logo',\n component: {\n id: 'example-image-1',\n type: 'image',\n position: { colStart: 1, colSpan: 4 },\n params: {\n url: '/images/logo.png',\n alt: 'Company Logo',\n } as any,\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Link Registry Entry\n */\nexport const LinkRegistry: ComponentRegistryEntry = {\n type: 'link',\n name: 'Link',\n description:\n 'Render a styled link card with title, description, and URL. Best for navigation, references, and external resource links.',\n schema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'Link destination URL' },\n label: { type: 'string', description: 'Link display text' },\n description: { type: 'string', description: 'Link description' },\n icon: { type: 'string', description: 'Icon identifier' },\n },\n required: ['url', 'label'],\n },\n examples: [\n {\n query: 'Link to the API documentation',\n component: {\n id: 'example-link-1',\n type: 'link',\n position: { colStart: 1, colSpan: 4 },\n params: {\n url: 'https://docs.example.com/api',\n label: 'API Documentation',\n description: 'Full reference for the REST API',\n } as any,\n },\n },\n ],\n limits: DEFAULT_RESOURCE_LIMITS,\n}\n\n/**\n * Component Registry - All components indexed by type\n */\nexport const ComponentRegistry: Map<ComponentType, ComponentRegistryEntry> = new Map([\n ['chart', QuickchartRegistry],\n ['table', TableRegistry],\n ['metric', MetricRegistry],\n ['text', TextRegistry],\n // Sprint 4 additions\n ['grid', GridRegistry],\n ['action', ActionRegistry],\n ['footer', FooterRegistry],\n ['carousel', CarouselRegistry],\n ['artifact', ArtifactRegistry],\n // v2.2.5: Complete registry\n ['code', CodeRegistry],\n ['map', MapRegistry],\n ['form', FormRegistry],\n ['modal', ModalRegistry],\n ['action-group', ActionGroupRegistry],\n ['image-gallery', ImageGalleryRegistry],\n ['video', VideoRegistry],\n ['iframe', IframeRegistry],\n ['image', ImageRegistry],\n ['link', LinkRegistry],\n])\n\n/**\n * Get component registry entry by type\n */\nexport function getComponentEntry(type: ComponentType): ComponentRegistryEntry | undefined {\n return ComponentRegistry.get(type)\n}\n\n/**\n * Get all component types\n */\nexport function getAllComponentTypes(): ComponentType[] {\n return Array.from(ComponentRegistry.keys())\n}\n\n/**\n * Get registry as JSON for LLM context\n */\nexport function getRegistryForLLM(): string {\n const entries = Array.from(ComponentRegistry.values()).map((entry) => ({\n type: entry.type,\n name: entry.name,\n description: entry.description,\n schema: entry.schema,\n examples: entry.examples.map((ex) => ({\n query: ex.query,\n component: ex.component,\n })),\n limits: entry.limits,\n }))\n\n return JSON.stringify(entries, null, 2)\n}\n\n/**\n * Validate component against registry schema\n * (Future: Use Zod for runtime validation)\n */\nexport function validateAgainstRegistry(\n componentType: ComponentType,\n params: any\n): { valid: boolean; errors?: string[]; warnings?: string[] } {\n const entry = getComponentEntry(componentType)\n if (!entry) {\n // Warn but don't block — renderer may exist even without registry entry\n return { valid: true, warnings: [`No registry entry for type: ${componentType}`] }\n }\n\n // Basic validation (Phase 1 will add Zod schema validation)\n const required = entry.schema.required || []\n const missing = required.filter((key: string) => !(key in params))\n\n if (missing.length > 0) {\n return {\n valid: false,\n errors: missing.map((key: string) => `Missing required field: ${key}`),\n }\n }\n\n return { valid: true }\n}\n"],"names":[],"mappings":";AAeO,MAAM,qBAA6C;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aACE;AAAA,EACF,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM,CAAC,OAAO,QAAQ,OAAO,YAAY,SAAS,SAAS;AAAA,QAC3D,aAAa;AAAA,MAAA;AAAA,MAEf,OAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,OAAO,EAAE,MAAM,SAAA;AAAA,YACf,aAAa;AAAA,UAAA;AAAA,UAEf,UAAU;AAAA,YACR,MAAM;AAAA,YACN,OAAO;AAAA,cACL,MAAM;AAAA,cACN,YAAY;AAAA,gBACV,OAAO,EAAE,MAAM,SAAA;AAAA,gBACf,MAAM;AAAA,kBACJ,MAAM;AAAA,kBACN,OAAO,EAAE,MAAM,SAAA;AAAA,gBAAS;AAAA,g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B,CAAC,UAAU,cAAc;AAAA,EACzB,CAAC,YAAY,gBAAgB;AAAA,EAC7B,CAAC,YAAY,gBAAgB;AAAA;AAAA,EAE7B,CAAC,QAAQ,YAAY;AAAA,EACrB,CAAC,OAAO,WAAW;AAAA,EACnB,CAAC,QAAQ,YAAY;AAAA,EACrB,CAAC,SAAS,aAAa;AAAA,EACvB,CAAC,gBAAgB,mBAAmB;AAAA,EACpC,CAAC,iBAAiB,oBAAoB;AAAA,EACtC,CAAC,SAAS,aAAa;AAAA,EACvB,CAAC,UAAU,cAAc;AAAA,EACzB,CAAC,SAAS,aAAa;AAAA,EACvB,CAAC,QAAQ,YAAY;AACvB,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-ship/mcp-ui-solid",
3
- "version": "2.2.3",
3
+ "version": "2.2.6",
4
4
  "description": "SolidJS components for rendering MCP-generated UI resources",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -0,0 +1,101 @@
1
+ /**
2
+ * ComponentToolbar - Unified toolbar for component actions
3
+ * v2.2.5: Consistent icon set, position, and hover behavior across all components
4
+ */
5
+
6
+ import { Component, For, Show, createSignal } from 'solid-js'
7
+
8
+ /** SVG icon paths for toolbar actions */
9
+ const ICONS = {
10
+ copy: 'M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z',
11
+ check: 'M5 13l4 4L19 7',
12
+ download: 'M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z',
13
+ expand: 'M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5',
14
+ wordwrap: 'M3 10h10a4 4 0 010 8H9m4 0l-3-3m3 3l-3 3M3 6h18M3 14h4',
15
+ } as const
16
+
17
+ export type ToolbarIcon = keyof typeof ICONS
18
+
19
+ export interface ToolbarAction {
20
+ /** Icon to display */
21
+ icon: ToolbarIcon
22
+ /** Tooltip label */
23
+ label: string
24
+ /** Click handler */
25
+ onClick: () => void
26
+ /** Whether to show a success state (green check) after click */
27
+ showFeedback?: boolean
28
+ /** Active/toggled state (e.g. word wrap on) */
29
+ active?: boolean
30
+ }
31
+
32
+ export interface ComponentToolbarProps {
33
+ /** Actions to display */
34
+ actions: ToolbarAction[]
35
+ /** Corner position */
36
+ position?: 'top-right' | 'top-left' | 'bottom-right'
37
+ }
38
+
39
+ /**
40
+ * Renders a row of small icon buttons, visible on parent hover (requires parent `group` class).
41
+ *
42
+ * @example
43
+ * <div class="relative group">
44
+ * <MyContent />
45
+ * <ComponentToolbar actions={[
46
+ * { icon: 'copy', label: 'Copy', onClick: handleCopy, showFeedback: true },
47
+ * { icon: 'download', label: 'Download CSV', onClick: handleDownload },
48
+ * ]} />
49
+ * </div>
50
+ */
51
+ export const ComponentToolbar: Component<ComponentToolbarProps> = (props) => {
52
+ const positionClasses = () => {
53
+ switch (props.position) {
54
+ case 'top-left': return 'top-2 left-2'
55
+ case 'bottom-right': return 'bottom-2 right-2'
56
+ default: return 'top-2 right-2'
57
+ }
58
+ }
59
+
60
+ return (
61
+ <div class={`absolute ${positionClasses()} z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`}>
62
+ <For each={props.actions}>
63
+ {(action) => <ToolbarButton action={action} />}
64
+ </For>
65
+ </div>
66
+ )
67
+ }
68
+
69
+ /** Individual toolbar button with optional feedback state */
70
+ const ToolbarButton: Component<{ action: ToolbarAction }> = (props) => {
71
+ const [showCheck, setShowCheck] = createSignal(false)
72
+
73
+ const handleClick = () => {
74
+ props.action.onClick()
75
+ if (props.action.showFeedback) {
76
+ setShowCheck(true)
77
+ setTimeout(() => setShowCheck(false), 2000)
78
+ }
79
+ }
80
+
81
+ const iconPath = () => showCheck() ? ICONS.check : ICONS[props.action.icon]
82
+ const isActive = () => props.action.active
83
+ const colorClass = () => {
84
+ if (showCheck()) return 'text-green-500'
85
+ if (isActive()) return 'text-blue-500 dark:text-blue-400'
86
+ return 'text-gray-500 dark:text-gray-400'
87
+ }
88
+
89
+ return (
90
+ <button
91
+ onClick={handleClick}
92
+ class={`p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-all shadow-sm`}
93
+ title={props.action.label}
94
+ aria-label={props.action.label}
95
+ >
96
+ <svg class={`w-3 h-3 ${colorClass()}`} fill="none" viewBox="0 0 24 24" stroke="currentColor">
97
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d={iconPath()} />
98
+ </svg>
99
+ </button>
100
+ )
101
+ }
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export { DraggableGridItem } from './components/DraggableGridItem'
36
36
  export { ResizeHandle } from './components/ResizeHandle'
37
37
  export { EditableUIResourceRenderer } from './components/EditableUIResourceRenderer'
38
38
  export { ExpandableWrapper } from './components/ExpandableWrapper'
39
+ export { ComponentToolbar } from './components/ComponentToolbar'
39
40
 
40
41
  // Autocomplete Components
41
42
  export { GhostText, GhostTextInput } from './components/GhostText'
@@ -52,6 +53,7 @@ export type { DraggableGridItemProps } from './components/DraggableGridItem'
52
53
  export type { ResizeHandleProps as ResizeHandleComponentProps } from './components/ResizeHandle'
53
54
  export type { EditableUIResourceRendererProps } from './components/EditableUIResourceRenderer'
54
55
  export type { ExpandableWrapperProps } from './components/ExpandableWrapper'
56
+ export type { ComponentToolbarProps, ToolbarAction, ToolbarIcon } from './components/ComponentToolbar'
55
57
  export type { GhostTextProps, GhostTextInputProps } from './components/GhostText'
56
58
  export type { AutocompleteDropdownProps } from './components/AutocompleteDropdown'
57
59
  export type { AutocompleteFormFieldProps, AutocompleteFormFieldParams } from './components/AutocompleteFormField'
@@ -1,35 +1,41 @@
1
1
  /**
2
- * Tests for P0 fix: ComponentRegistry validation leniency
3
- *
4
- * Ensures unregistered component types (code, map, form, modal, etc.)
5
- * pass validation with warnings instead of failing with errors.
2
+ * Tests for ComponentRegistry all 19 component types registered
6
3
  */
7
4
 
8
5
  import { describe, it, expect } from 'vitest'
9
6
  import { validateAgainstRegistry, getComponentEntry, ComponentRegistry } from './component-registry'
10
7
  import type { ComponentType } from '../types'
11
8
 
12
- /** The 9 types currently registered in ComponentRegistry */
13
- const REGISTERED_TYPES: ComponentType[] = [
9
+ /** All 19 component types in the registry */
10
+ const ALL_TYPES: ComponentType[] = [
14
11
  'chart', 'table', 'metric', 'text', 'grid',
15
12
  'action', 'footer', 'carousel', 'artifact',
16
- ]
17
-
18
- /** The 9 types with renderers but NO registry entry */
19
- const UNREGISTERED_TYPES: ComponentType[] = [
20
13
  'code', 'map', 'form', 'modal', 'action-group',
21
14
  'image-gallery', 'video', 'iframe', 'image', 'link',
22
15
  ]
23
16
 
24
- describe('validateAgainstRegistry', () => {
25
- describe('registered types', () => {
26
- it.each(REGISTERED_TYPES)('validates "%s" with valid: true when params are correct', (type) => {
17
+ describe('ComponentRegistry', () => {
18
+ describe('registry completeness', () => {
19
+ it('has exactly 19 registered types', () => {
20
+ expect(ComponentRegistry.size).toBe(19)
21
+ })
22
+
23
+ it.each(ALL_TYPES)('has registry entry for "%s"', (type) => {
27
24
  const entry = getComponentEntry(type)
28
25
  expect(entry).toBeDefined()
26
+ expect(entry!.type).toBe(type)
27
+ expect(entry!.name).toBeTruthy()
28
+ expect(entry!.description).toBeTruthy()
29
+ expect(entry!.schema).toBeDefined()
30
+ expect(entry!.examples).toBeDefined()
31
+ })
32
+ })
29
33
 
30
- // Build minimal valid params from required fields
34
+ describe('validateAgainstRegistry', () => {
35
+ it.each(ALL_TYPES)('validates "%s" with valid: true when params satisfy required fields', (type) => {
36
+ const entry = getComponentEntry(type)!
31
37
  const params: Record<string, any> = {}
32
- const required = entry!.schema.required || []
38
+ const required = entry.schema.required || []
33
39
  for (const key of required) {
34
40
  params[key] = 'test-value'
35
41
  }
@@ -37,45 +43,47 @@ describe('validateAgainstRegistry', () => {
37
43
  const result = validateAgainstRegistry(type, params)
38
44
  expect(result.valid).toBe(true)
39
45
  expect(result.errors).toBeUndefined()
40
- expect(result.warnings).toBeUndefined()
41
46
  })
42
47
 
43
- it.each(REGISTERED_TYPES)('rejects "%s" when required fields are missing', (type) => {
44
- const entry = getComponentEntry(type)
45
- const required = entry!.schema.required || []
46
- if (required.length === 0) return // skip types with no required fields
47
-
48
+ it.each(
49
+ ALL_TYPES.filter((type) => {
50
+ const entry = getComponentEntry(type)
51
+ return entry && (entry.schema.required || []).length > 0
52
+ })
53
+ )('rejects "%s" when required fields are missing', (type) => {
48
54
  const result = validateAgainstRegistry(type, {})
49
55
  expect(result.valid).toBe(false)
50
56
  expect(result.errors).toBeDefined()
51
- expect(result.errors!.length).toBeGreaterThan(0)
52
57
  expect(result.errors![0]).toContain('Missing required field')
53
58
  })
54
59
  })
55
60
 
56
- describe('unregistered types (have renderers, no registry entry)', () => {
57
- it.each(UNREGISTERED_TYPES)('passes "%s" with valid: true and a warning', (type) => {
58
- const result = validateAgainstRegistry(type, { anything: true })
59
- expect(result.valid).toBe(true)
60
- expect(result.errors).toBeUndefined()
61
- expect(result.warnings).toBeDefined()
62
- expect(result.warnings![0]).toContain(`No registry entry for type: ${type}`)
63
- })
64
-
65
- it.each(UNREGISTERED_TYPES)('getComponentEntry returns undefined for "%s"', (type) => {
66
- expect(getComponentEntry(type)).toBeUndefined()
67
- })
61
+ /** Types that have examples defined */
62
+ const TYPES_WITH_EXAMPLES = ALL_TYPES.filter((type) => {
63
+ const entry = getComponentEntry(type)
64
+ return entry && entry.examples.length > 0
68
65
  })
69
66
 
70
- describe('registry consistency', () => {
71
- it('has exactly 9 registered types', () => {
72
- expect(ComponentRegistry.size).toBe(9)
67
+ describe('example components', () => {
68
+ it.each(TYPES_WITH_EXAMPLES)('"%s" examples have valid structure', (type) => {
69
+ const entry = getComponentEntry(type)!
70
+ for (const example of entry.examples) {
71
+ expect(example.query).toBeTruthy()
72
+ expect(example.component).toBeDefined()
73
+ expect(example.component.id).toBeTruthy()
74
+ expect(example.component.type).toBe(type)
75
+ expect(example.component.position).toBeDefined()
76
+ expect(example.component.params).toBeDefined()
77
+ }
73
78
  })
79
+ })
74
80
 
75
- it('all registered types are in REGISTERED_TYPES', () => {
76
- for (const [type] of ComponentRegistry) {
77
- expect(REGISTERED_TYPES).toContain(type)
78
- }
81
+ describe('warns for truly unknown types', () => {
82
+ it('returns warning for unknown type "foobar"', () => {
83
+ const result = validateAgainstRegistry('foobar' as ComponentType, {})
84
+ expect(result.valid).toBe(true)
85
+ expect(result.warnings).toBeDefined()
86
+ expect(result.warnings![0]).toContain('No registry entry for type: foobar')
79
87
  })
80
88
  })
81
89
  })