@seed-ship/mcp-ui-solid 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/components/ActionRenderer.cjs +34 -0
- package/dist/components/ActionRenderer.cjs.map +1 -0
- package/dist/components/ActionRenderer.js +34 -0
- package/dist/components/ActionRenderer.js.map +1 -0
- package/dist/components/ArtifactRenderer.cjs +37 -0
- package/dist/components/ArtifactRenderer.cjs.map +1 -0
- package/dist/components/ArtifactRenderer.js +37 -0
- package/dist/components/ArtifactRenderer.js.map +1 -0
- package/dist/components/CarouselRenderer.cjs +58 -0
- package/dist/components/CarouselRenderer.cjs.map +1 -0
- package/dist/components/CarouselRenderer.js +58 -0
- package/dist/components/CarouselRenderer.js.map +1 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components.cjs +10 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +10 -0
- package/dist/components.js +10 -0
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/services/component-registry.cjs +211 -1
- package/dist/services/component-registry.cjs.map +1 -1
- package/dist/services/component-registry.d.ts +25 -0
- package/dist/services/component-registry.d.ts.map +1 -1
- package/dist/services/component-registry.js +211 -1
- package/dist/services/component-registry.js.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +16 -0
- package/src/services/component-registry.ts +239 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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 * 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])\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[] } {\n const entry = getComponentEntry(componentType)\n if (!entry) {\n return { valid: false, errors: [`Unknown component 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;AAA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AAA;AAAA,MAEf,UAAU;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,WAAW;AAAA,QACT,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,IAEF,UAAU,CAAC,SAAS;AAAA,EAAA;AAAA,EAEtB,UAAU;AAAA,IACR;AAAA,MACE,OAAO;AAAA,MACP,WAAW;AAAA,QACT,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,UAAU,EAAE,UAAU,GAAG,SAAS,GAAA;AAAA,QAClC,QAAQ;AAAA,UACN,SACE;AAAA,QAAA;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAAA,EAEF,QAAQ;AAAA,IACN,eAAe;AAAA,IACf,cAAc;AAAA,IACd,gBAAgB,KAAK;AAAA;AAAA,IACrB,eAAe;AAAA;AAAA,EAAA;AAEnB;AAKO,MAAM,wCAAoE,IAAI;AAAA,EACnF,CAAC,SAAS,kBAAkB;AAAA,EAC5B,CAAC,SAAS,aAAa;AAAA,EACvB,CAAC,UAAU,cAAc;AAAA,EACzB,CAAC,QAAQ,YAAY;AACvB,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 * 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[] } {\n const entry = getComponentEntry(componentType)\n if (!entry) {\n return { valid: false, errors: [`Unknown component 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,Q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U;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,UAAU;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,aAAa;AAAA,QACX,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,IAEF,UAAU,CAAC,OAAO,YAAY,UAAU;AAAA,EAAA;AAAA,EAE1C,UAAU,CAAA;AAAA,EACV,QAAQ;AAAA,IACN,eAAe;AAAA,IACf,cAAc;AAAA,IACd,gBAAgB,IAAI;AAAA,IACpB,eAAe;AAAA,EAAA;AAEnB;AAKO,MAAM,wCAAoE,IAAI;AAAA,EACnF,CAAC,SAAS,kBAAkB;AAAA,EAC5B,CAAC,SAAS,aAAa;AAAA,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;"}
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -13,5 +13,21 @@ export type { StreamingUIRendererProps } from './StreamingUIRenderer'
|
|
|
13
13
|
export { GenerativeUIErrorBoundary } from './GenerativeUIErrorBoundary'
|
|
14
14
|
export type { GenerativeUIErrorBoundaryProps } from './GenerativeUIErrorBoundary'
|
|
15
15
|
|
|
16
|
+
// Sprint 4: Export additional renderers
|
|
17
|
+
export { FooterRenderer } from './FooterRenderer'
|
|
18
|
+
export type { FooterComponentParams } from './FooterRenderer'
|
|
19
|
+
|
|
20
|
+
export { ActionRenderer } from './ActionRenderer'
|
|
21
|
+
export type { ActionRendererProps } from './ActionRenderer'
|
|
22
|
+
|
|
23
|
+
export { ArtifactRenderer } from './ArtifactRenderer'
|
|
24
|
+
export type { ArtifactComponentParams } from './ArtifactRenderer'
|
|
25
|
+
|
|
26
|
+
export { CarouselRenderer } from './CarouselRenderer'
|
|
27
|
+
export type { CarouselRendererProps } from './CarouselRenderer'
|
|
28
|
+
|
|
29
|
+
export { GridRenderer } from './GridRenderer'
|
|
30
|
+
export type { GridRendererProps, GridComponentParams } from './GridRenderer'
|
|
31
|
+
|
|
16
32
|
// Default exports for lazy loading compatibility
|
|
17
33
|
export { UIResourceRenderer as default } from './UIResourceRenderer'
|
|
@@ -307,6 +307,239 @@ export const TextRegistry: ComponentRegistryEntry = {
|
|
|
307
307
|
},
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
// ============================================================================
|
|
311
|
+
// Sprint 4: Additional Component Registry Entries
|
|
312
|
+
// ============================================================================
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Grid Component Registry Entry
|
|
316
|
+
* Nested CSS Grid layout for organizing multiple components
|
|
317
|
+
*/
|
|
318
|
+
export const GridRegistry: ComponentRegistryEntry = {
|
|
319
|
+
type: 'grid',
|
|
320
|
+
name: 'GridLayout',
|
|
321
|
+
description:
|
|
322
|
+
'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.',
|
|
323
|
+
schema: {
|
|
324
|
+
type: 'object',
|
|
325
|
+
properties: {
|
|
326
|
+
columns: {
|
|
327
|
+
type: 'number',
|
|
328
|
+
description: 'Number of columns (default: 12)',
|
|
329
|
+
},
|
|
330
|
+
gap: {
|
|
331
|
+
type: 'string',
|
|
332
|
+
description: 'Gap between items (e.g., "1rem")',
|
|
333
|
+
},
|
|
334
|
+
minRowHeight: {
|
|
335
|
+
type: 'string',
|
|
336
|
+
description: 'Minimum row height (optional)',
|
|
337
|
+
},
|
|
338
|
+
areas: {
|
|
339
|
+
type: 'array',
|
|
340
|
+
items: {
|
|
341
|
+
type: 'array',
|
|
342
|
+
items: { type: 'string' },
|
|
343
|
+
},
|
|
344
|
+
description: 'CSS Grid template areas for named regions',
|
|
345
|
+
},
|
|
346
|
+
children: {
|
|
347
|
+
type: 'array',
|
|
348
|
+
items: { type: 'object' },
|
|
349
|
+
description: 'Child UIComponents to render within the grid',
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
required: ['children'],
|
|
353
|
+
},
|
|
354
|
+
examples: [],
|
|
355
|
+
limits: DEFAULT_RESOURCE_LIMITS,
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Action Component Registry Entry
|
|
360
|
+
* Interactive button or link that triggers tool calls
|
|
361
|
+
*/
|
|
362
|
+
export const ActionRegistry: ComponentRegistryEntry = {
|
|
363
|
+
type: 'action',
|
|
364
|
+
name: 'ActionButton',
|
|
365
|
+
description:
|
|
366
|
+
'Interactive button or link that triggers tool calls or navigation. Best for user interactions, form submissions, and workflow triggers.',
|
|
367
|
+
schema: {
|
|
368
|
+
type: 'object',
|
|
369
|
+
properties: {
|
|
370
|
+
label: {
|
|
371
|
+
type: 'string',
|
|
372
|
+
description: 'Button text',
|
|
373
|
+
},
|
|
374
|
+
type: {
|
|
375
|
+
type: 'string',
|
|
376
|
+
enum: ['button', 'link'],
|
|
377
|
+
description: 'Render as button or link',
|
|
378
|
+
},
|
|
379
|
+
action: {
|
|
380
|
+
type: 'string',
|
|
381
|
+
enum: ['tool-call', 'link', 'submit'],
|
|
382
|
+
description: 'Action type to perform',
|
|
383
|
+
},
|
|
384
|
+
toolName: {
|
|
385
|
+
type: 'string',
|
|
386
|
+
description: 'Tool name to call (for tool-call action)',
|
|
387
|
+
},
|
|
388
|
+
params: {
|
|
389
|
+
type: 'object',
|
|
390
|
+
description: 'Parameters to pass to the tool',
|
|
391
|
+
},
|
|
392
|
+
url: {
|
|
393
|
+
type: 'string',
|
|
394
|
+
description: 'URL for link action',
|
|
395
|
+
},
|
|
396
|
+
variant: {
|
|
397
|
+
type: 'string',
|
|
398
|
+
enum: ['primary', 'secondary', 'outline', 'ghost', 'danger'],
|
|
399
|
+
description: 'Visual style variant',
|
|
400
|
+
},
|
|
401
|
+
size: {
|
|
402
|
+
type: 'string',
|
|
403
|
+
enum: ['sm', 'md', 'lg'],
|
|
404
|
+
description: 'Button size',
|
|
405
|
+
},
|
|
406
|
+
disabled: {
|
|
407
|
+
type: 'boolean',
|
|
408
|
+
description: 'Whether the action is disabled',
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
required: ['label', 'type', 'action'],
|
|
412
|
+
},
|
|
413
|
+
examples: [],
|
|
414
|
+
limits: DEFAULT_RESOURCE_LIMITS,
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Footer Component Registry Entry
|
|
419
|
+
* Display execution metadata like timing and source count
|
|
420
|
+
*/
|
|
421
|
+
export const FooterRegistry: ComponentRegistryEntry = {
|
|
422
|
+
type: 'footer',
|
|
423
|
+
name: 'FooterSection',
|
|
424
|
+
description:
|
|
425
|
+
'Footer section displaying execution metadata. Best for showing timing, model info, and source counts. Auto-injected by layouts when metadata is provided.',
|
|
426
|
+
schema: {
|
|
427
|
+
type: 'object',
|
|
428
|
+
properties: {
|
|
429
|
+
poweredBy: {
|
|
430
|
+
type: 'string',
|
|
431
|
+
description: 'Powered by text (optional)',
|
|
432
|
+
},
|
|
433
|
+
executionTime: {
|
|
434
|
+
type: 'number',
|
|
435
|
+
description: 'Execution time in milliseconds',
|
|
436
|
+
},
|
|
437
|
+
model: {
|
|
438
|
+
type: 'string',
|
|
439
|
+
description: 'LLM model used',
|
|
440
|
+
},
|
|
441
|
+
sourceCount: {
|
|
442
|
+
type: 'number',
|
|
443
|
+
description: 'Number of sources used',
|
|
444
|
+
},
|
|
445
|
+
customText: {
|
|
446
|
+
type: 'string',
|
|
447
|
+
description: 'Custom footer text',
|
|
448
|
+
},
|
|
449
|
+
links: {
|
|
450
|
+
type: 'array',
|
|
451
|
+
items: {
|
|
452
|
+
type: 'object',
|
|
453
|
+
properties: {
|
|
454
|
+
label: { type: 'string' },
|
|
455
|
+
url: { type: 'string' },
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
description: 'Footer links',
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
examples: [],
|
|
463
|
+
limits: {
|
|
464
|
+
maxDataPoints: 1,
|
|
465
|
+
maxTableRows: 1,
|
|
466
|
+
maxPayloadSize: 5 * 1024,
|
|
467
|
+
renderTimeout: 1000,
|
|
468
|
+
},
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Carousel Component Registry Entry
|
|
473
|
+
* Display multiple items with horizontal scrolling
|
|
474
|
+
*/
|
|
475
|
+
export const CarouselRegistry: ComponentRegistryEntry = {
|
|
476
|
+
type: 'carousel',
|
|
477
|
+
name: 'Carousel',
|
|
478
|
+
description:
|
|
479
|
+
'Horizontal carousel for displaying multiple items with snap scrolling and navigation buttons. Best for showcasing related content, image galleries, or card collections.',
|
|
480
|
+
schema: {
|
|
481
|
+
type: 'object',
|
|
482
|
+
properties: {
|
|
483
|
+
items: {
|
|
484
|
+
type: 'array',
|
|
485
|
+
items: { type: 'object' },
|
|
486
|
+
description: 'Array of UIComponents to display in carousel',
|
|
487
|
+
},
|
|
488
|
+
height: {
|
|
489
|
+
type: 'string',
|
|
490
|
+
description: 'Carousel height (optional)',
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
required: ['items'],
|
|
494
|
+
},
|
|
495
|
+
examples: [],
|
|
496
|
+
limits: DEFAULT_RESOURCE_LIMITS,
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Artifact Component Registry Entry
|
|
501
|
+
* Display downloadable artifacts like generated files
|
|
502
|
+
*/
|
|
503
|
+
export const ArtifactRegistry: ComponentRegistryEntry = {
|
|
504
|
+
type: 'artifact',
|
|
505
|
+
name: 'Artifact',
|
|
506
|
+
description:
|
|
507
|
+
'Display downloadable artifacts like generated files or exports. Shows filename, size, and download button. Best for CSV exports, PDF reports, and generated documents.',
|
|
508
|
+
schema: {
|
|
509
|
+
type: 'object',
|
|
510
|
+
properties: {
|
|
511
|
+
url: {
|
|
512
|
+
type: 'string',
|
|
513
|
+
description: 'Download URL for the artifact',
|
|
514
|
+
},
|
|
515
|
+
filename: {
|
|
516
|
+
type: 'string',
|
|
517
|
+
description: 'Display filename',
|
|
518
|
+
},
|
|
519
|
+
mimeType: {
|
|
520
|
+
type: 'string',
|
|
521
|
+
description: 'MIME type (e.g., "text/csv", "application/pdf")',
|
|
522
|
+
},
|
|
523
|
+
size: {
|
|
524
|
+
type: 'number',
|
|
525
|
+
description: 'File size in bytes',
|
|
526
|
+
},
|
|
527
|
+
description: {
|
|
528
|
+
type: 'string',
|
|
529
|
+
description: 'Description of the artifact',
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
required: ['url', 'filename', 'mimeType'],
|
|
533
|
+
},
|
|
534
|
+
examples: [],
|
|
535
|
+
limits: {
|
|
536
|
+
maxDataPoints: 1,
|
|
537
|
+
maxTableRows: 1,
|
|
538
|
+
maxPayloadSize: 5 * 1024,
|
|
539
|
+
renderTimeout: 1000,
|
|
540
|
+
},
|
|
541
|
+
}
|
|
542
|
+
|
|
310
543
|
/**
|
|
311
544
|
* Component Registry - All components indexed by type
|
|
312
545
|
*/
|
|
@@ -315,6 +548,12 @@ export const ComponentRegistry: Map<ComponentType, ComponentRegistryEntry> = new
|
|
|
315
548
|
['table', TableRegistry],
|
|
316
549
|
['metric', MetricRegistry],
|
|
317
550
|
['text', TextRegistry],
|
|
551
|
+
// Sprint 4 additions
|
|
552
|
+
['grid', GridRegistry],
|
|
553
|
+
['action', ActionRegistry],
|
|
554
|
+
['footer', FooterRegistry],
|
|
555
|
+
['carousel', CarouselRegistry],
|
|
556
|
+
['artifact', ArtifactRegistry],
|
|
318
557
|
])
|
|
319
558
|
|
|
320
559
|
/**
|