@seed-ship/mcp-ui-spec 1.0.15 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -12
- package/README.md +237 -21
- package/dist/schemas.cjs +18 -1
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.js +18 -1
- package/dist/schemas.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,122 @@
|
|
|
1
|
-
# @mcp-ui
|
|
1
|
+
# @seed-ship/mcp-ui-spec Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.2.0] - 2025-11-25
|
|
9
|
+
|
|
10
|
+
### Changed - Phase 5.0 Quick Wins
|
|
11
|
+
|
|
12
|
+
#### ComponentType Enum Expansion
|
|
13
|
+
- **Synchronized with mcp-ui-solid v1.2.0**
|
|
14
|
+
- Expanded from 5 types to 13 types:
|
|
15
|
+
- `chart`, `table`, `metric`, `text`, `composite` (existing)
|
|
16
|
+
- `grid` - Nested CSS Grid layouts (NEW)
|
|
17
|
+
- `iframe` - Embedded content
|
|
18
|
+
- `image` - Image display
|
|
19
|
+
- `link` - Clickable links
|
|
20
|
+
- `action` - Tool call buttons (NEW)
|
|
21
|
+
- `footer` - Metadata footer (NEW)
|
|
22
|
+
- `carousel` - Horizontal scrolling
|
|
23
|
+
- `artifact` - Downloadable files
|
|
24
|
+
|
|
25
|
+
### Notes
|
|
26
|
+
- Full backward compatibility with existing registries
|
|
27
|
+
- New types support Phase 5.0 template builder features
|
|
28
|
+
|
|
29
|
+
## [1.1.0] - 2025-11-25
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
- **Comprehensive README Rewrite**: Complete documentation overhaul
|
|
33
|
+
- Fixed npm scope from `@mcp-ui/spec` to `@seed-ship/mcp-ui-spec`
|
|
34
|
+
- Documented all 10 exported Zod schemas
|
|
35
|
+
- Documented all 11 component types with renderer mappings
|
|
36
|
+
- Added full registry format specification
|
|
37
|
+
- Added Grid Positioning, Security Constraints, Performance Constraints docs
|
|
38
|
+
- Added deprecation and versioning documentation
|
|
39
|
+
- Included complete example registry JSON
|
|
40
|
+
|
|
41
|
+
### Notes
|
|
42
|
+
- This minor version bump marks a documentation milestone
|
|
43
|
+
- No schema changes - all validation identical to v1.0.15
|
|
44
|
+
|
|
45
|
+
## [1.0.15] - 2025-11-24
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
- Version bump (synchronized with mcp-ui-solid v1.0.26, mcp-ui-cli v1.0.14)
|
|
49
|
+
|
|
50
|
+
## [1.0.14] - 2025-11-23
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
- Version bump (synchronized with mcp-ui-solid v1.0.25, mcp-ui-cli v1.0.13)
|
|
54
|
+
|
|
55
|
+
## [1.0.12] - 2025-11-23
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
- Version bump for npm publication with updated token
|
|
59
|
+
- Synchronized with mcp-ui-solid v1.0.23, mcp-ui-cli v1.0.11
|
|
60
|
+
|
|
61
|
+
## [1.0.11] - 2025-11-23
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
- Version bump (synchronized with mcp-ui-solid v1.0.22, mcp-ui-cli v1.0.10)
|
|
65
|
+
|
|
66
|
+
## [1.0.10] - 2025-11-23
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
- **Validation Enhancements**: Extended Zod schemas for new component types
|
|
70
|
+
- Action component validation
|
|
71
|
+
- Artifact component validation
|
|
72
|
+
- Carousel component validation
|
|
73
|
+
- Footer component validation
|
|
74
|
+
|
|
75
|
+
### Changed
|
|
76
|
+
- Synchronized with mcp-ui-solid v1.0.21, mcp-ui-cli v1.0.9
|
|
77
|
+
|
|
78
|
+
## [1.0.8] - 2025-11-22
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
- Version bump (synchronized with mcp-ui-solid v1.0.18, mcp-ui-cli v1.0.8)
|
|
82
|
+
|
|
83
|
+
## [1.0.7] - 2025-11-22
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
- Version bump
|
|
87
|
+
|
|
88
|
+
## [1.0.5] - 2025-11-22
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
- **New Component Types**: Added Zod schemas for iframe, image, link components
|
|
92
|
+
- `IframeComponentSchema` with src and sandbox validation
|
|
93
|
+
- `ImageComponentSchema` with src, alt, dimensions
|
|
94
|
+
- `LinkComponentSchema` with href and text
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
- Version bump for npm publication
|
|
98
|
+
|
|
99
|
+
## [1.0.2] - 2025-11-17
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
- Migrate to `@seed-ship` npm scope
|
|
103
|
+
- Updated package name from `@mcp-ui/spec` to `@seed-ship/mcp-ui-spec`
|
|
104
|
+
|
|
105
|
+
## [1.0.1] - 2025-11-16
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
- Add type definitions generation for all packages
|
|
109
|
+
|
|
5
110
|
## [1.0.0] - 2025-01-14
|
|
6
111
|
|
|
7
112
|
### Added
|
|
8
|
-
- Initial release of `@mcp-ui
|
|
113
|
+
- Initial release of `@seed-ship/mcp-ui-spec` package
|
|
9
114
|
- JSON Schema v7 specification for component registries
|
|
10
115
|
- Zod validation schemas with TypeScript types
|
|
11
|
-
- Comprehensive example registry with
|
|
12
|
-
- quickchart-bar (Bar chart visualization)
|
|
13
|
-
- metric-card (KPI metric card)
|
|
14
|
-
- data-table (Tabular data display)
|
|
116
|
+
- Comprehensive example registry with components:
|
|
117
|
+
- `quickchart-bar` (Bar chart visualization)
|
|
118
|
+
- `metric-card` (KPI metric card)
|
|
119
|
+
- `data-table` (Tabular data display)
|
|
15
120
|
- Security constraints specification:
|
|
16
121
|
- Authentication requirements
|
|
17
122
|
- Domain whitelisting
|
|
@@ -29,9 +134,3 @@ All notable changes to this project will be documented in this file.
|
|
|
29
134
|
- **Type Safety**: Complete TypeScript definitions
|
|
30
135
|
- **Examples**: Working examples for each component type
|
|
31
136
|
- **Extensible**: Easy to add new component types
|
|
32
|
-
- **Validation**: Built-in validation for security and performance
|
|
33
|
-
|
|
34
|
-
### Documentation
|
|
35
|
-
- Complete JSON Schema with descriptions
|
|
36
|
-
- Example registry with real-world use cases
|
|
37
|
-
- TypeScript types for all schema entities
|
package/README.md
CHANGED
|
@@ -1,67 +1,283 @@
|
|
|
1
|
-
# @mcp-ui
|
|
1
|
+
# @seed-ship/mcp-ui-spec
|
|
2
2
|
|
|
3
|
-
Component registry specification and
|
|
3
|
+
Component registry specification and validation schemas for MCP UI. Part of the MCP UI ecosystem.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@seed-ship/mcp-ui-spec)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
`@seed-ship/mcp-ui-spec` provides the schema definitions and validation utilities for MCP UI component registries. It includes both Zod schemas for runtime validation and JSON Schema for tooling integration.
|
|
4
11
|
|
|
5
12
|
## Installation
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
|
-
pnpm add @mcp-ui
|
|
15
|
+
pnpm add @seed-ship/mcp-ui-spec
|
|
9
16
|
```
|
|
10
17
|
|
|
11
|
-
##
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Zod Validation (Recommended)
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { ComponentRegistrySchema, ComponentSchema } from '@seed-ship/mcp-ui-spec'
|
|
24
|
+
|
|
25
|
+
// Validate a full registry
|
|
26
|
+
const result = ComponentRegistrySchema.safeParse(myRegistry)
|
|
27
|
+
if (!result.success) {
|
|
28
|
+
console.error('Validation errors:', result.error.issues)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Validate a single component
|
|
32
|
+
const componentResult = ComponentSchema.safeParse(myComponent)
|
|
33
|
+
```
|
|
12
34
|
|
|
13
|
-
###
|
|
35
|
+
### JSON Schema Validation
|
|
14
36
|
|
|
15
37
|
```typescript
|
|
16
|
-
import
|
|
38
|
+
import registrySchema from '@seed-ship/mcp-ui-spec/schemas/component-registry-v1.json'
|
|
17
39
|
import Ajv from 'ajv'
|
|
18
40
|
|
|
19
41
|
const ajv = new Ajv()
|
|
20
42
|
const validate = ajv.compile(registrySchema)
|
|
21
43
|
|
|
22
|
-
|
|
23
|
-
if (!valid) {
|
|
44
|
+
if (!validate(myRegistry)) {
|
|
24
45
|
console.error(validate.errors)
|
|
25
46
|
}
|
|
26
47
|
```
|
|
27
48
|
|
|
28
|
-
|
|
49
|
+
## Exported Schemas
|
|
50
|
+
|
|
51
|
+
### Zod Schemas (10 total)
|
|
52
|
+
|
|
53
|
+
| Schema | Description |
|
|
54
|
+
|--------|-------------|
|
|
55
|
+
| `ComponentRegistrySchema` | Root registry object with version and components |
|
|
56
|
+
| `ComponentSchema` | Individual component definition |
|
|
57
|
+
| `ComponentExampleSchema` | Working example for a component |
|
|
58
|
+
| `GridPositionSchema` | 12-column grid positioning |
|
|
59
|
+
| `SecurityConstraintsSchema` | Security configuration (auth, domains, sandbox) |
|
|
60
|
+
| `PerformanceConstraintsSchema` | Performance limits (render time, data size) |
|
|
61
|
+
| `ComponentTypeSchema` | Enum of supported component types |
|
|
62
|
+
| `SandboxFlagSchema` | Iframe sandbox permissions |
|
|
63
|
+
| `RegistryMetadataSchema` | Optional registry metadata |
|
|
64
|
+
| `ComponentSchemaSchema` | JSON Schema definition for component params |
|
|
65
|
+
|
|
66
|
+
### TypeScript Types
|
|
67
|
+
|
|
68
|
+
All schemas export inferred TypeScript types:
|
|
29
69
|
|
|
30
70
|
```typescript
|
|
31
|
-
import {
|
|
71
|
+
import type {
|
|
72
|
+
ComponentRegistry,
|
|
73
|
+
Component,
|
|
74
|
+
ComponentExample,
|
|
75
|
+
GridPosition,
|
|
76
|
+
SecurityConstraints,
|
|
77
|
+
PerformanceConstraints,
|
|
78
|
+
ComponentType,
|
|
79
|
+
SandboxFlag,
|
|
80
|
+
RegistryMetadata
|
|
81
|
+
} from '@seed-ship/mcp-ui-spec'
|
|
82
|
+
```
|
|
32
83
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
84
|
+
## Component Types
|
|
85
|
+
|
|
86
|
+
The spec supports **11 component types**:
|
|
87
|
+
|
|
88
|
+
| Type | Description | Renderer |
|
|
89
|
+
|------|-------------|----------|
|
|
90
|
+
| `chart` | Data visualizations (bar, line, pie, etc.) | ChartRenderer |
|
|
91
|
+
| `table` | Tabular data display | TableRenderer |
|
|
92
|
+
| `metric` | KPI cards with trends | MetricRenderer |
|
|
93
|
+
| `text` | Markdown text blocks | TextRenderer |
|
|
94
|
+
| `composite` | Nested component layouts | UIResourceRenderer |
|
|
95
|
+
| `image` | Image display with captions | ImageRenderer |
|
|
96
|
+
| `link` | External link cards | LinkRenderer |
|
|
97
|
+
| `iframe` | Sandboxed embedded content | IframeRenderer |
|
|
98
|
+
| `action` | Interactive buttons | ActionRenderer |
|
|
99
|
+
| `artifact` | Downloadable files | ArtifactRenderer |
|
|
100
|
+
| `carousel` | Scrollable component list | CarouselRenderer |
|
|
101
|
+
| `footer` | Metadata display | FooterRenderer |
|
|
102
|
+
|
|
103
|
+
## Registry Format
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
interface ComponentRegistry {
|
|
107
|
+
version: '1.0.0'
|
|
108
|
+
metadata?: {
|
|
109
|
+
name?: string
|
|
110
|
+
description?: string
|
|
111
|
+
author?: string
|
|
112
|
+
repository?: string // URL format
|
|
113
|
+
}
|
|
114
|
+
components: Component[] // At least 1 required
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface Component {
|
|
118
|
+
id: string // kebab-case: /^[a-z0-9-]+$/
|
|
119
|
+
type: ComponentType // One of 11 types
|
|
120
|
+
name: string
|
|
121
|
+
description?: string
|
|
122
|
+
schema: { // JSON Schema for params
|
|
123
|
+
type: 'object'
|
|
124
|
+
required: string[]
|
|
125
|
+
properties: Record<string, unknown>
|
|
126
|
+
additionalProperties?: boolean
|
|
127
|
+
}
|
|
128
|
+
examples: ComponentExample[] // At least 1 required
|
|
129
|
+
security?: SecurityConstraints
|
|
130
|
+
performance?: PerformanceConstraints
|
|
131
|
+
tags?: string[] // kebab-case tags
|
|
132
|
+
version?: string // semver: /^\d+\.\d+\.\d+$/
|
|
133
|
+
deprecated?: boolean
|
|
134
|
+
deprecationMessage?: string
|
|
36
135
|
}
|
|
37
136
|
```
|
|
38
137
|
|
|
39
|
-
##
|
|
138
|
+
## Features
|
|
139
|
+
|
|
140
|
+
### Grid Positioning (12-column)
|
|
141
|
+
|
|
142
|
+
Components support a responsive 12-column grid layout:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
interface GridPosition {
|
|
146
|
+
colStart: number // 1-12: starting column
|
|
147
|
+
colSpan: number // 1-12: columns to span
|
|
148
|
+
rowStart?: number // Row start (optional)
|
|
149
|
+
rowSpan?: number // Rows to span (default: 1)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Example: Full-width component
|
|
153
|
+
{ colStart: 1, colSpan: 12 }
|
|
154
|
+
|
|
155
|
+
// Example: Two-column layout
|
|
156
|
+
{ colStart: 1, colSpan: 6 } // Left half
|
|
157
|
+
{ colStart: 7, colSpan: 6 } // Right half
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Security Constraints
|
|
161
|
+
|
|
162
|
+
Configure security requirements per component:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
interface SecurityConstraints {
|
|
166
|
+
requiresAuth?: boolean // Default: false
|
|
167
|
+
allowedDomains?: string[] // Domain whitelist
|
|
168
|
+
maxIframeDepth?: number // 0-3, default: 1
|
|
169
|
+
sandboxFlags?: SandboxFlag[] // Iframe permissions
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
type SandboxFlag =
|
|
173
|
+
| 'allow-scripts'
|
|
174
|
+
| 'allow-same-origin'
|
|
175
|
+
| 'allow-forms'
|
|
176
|
+
| 'allow-popups'
|
|
177
|
+
| 'allow-modals'
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Performance Constraints
|
|
181
|
+
|
|
182
|
+
Set performance limits per component:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
interface PerformanceConstraints {
|
|
186
|
+
maxRenderTime?: number // Milliseconds, min: 100, default: 5000
|
|
187
|
+
maxDataSize?: number // Bytes, min: 1024, default: 102400 (100KB)
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Component Deprecation
|
|
192
|
+
|
|
193
|
+
Mark components as deprecated with optional migration messages:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
{
|
|
197
|
+
"id": "old-chart",
|
|
198
|
+
"type": "chart",
|
|
199
|
+
"deprecated": true,
|
|
200
|
+
"deprecationMessage": "Use quickchart-bar instead",
|
|
201
|
+
// ...
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Component Versioning
|
|
206
|
+
|
|
207
|
+
Individual components support semantic versioning:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
{
|
|
211
|
+
"id": "quickchart-bar",
|
|
212
|
+
"version": "2.1.0",
|
|
213
|
+
// ...
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Example Registry
|
|
40
218
|
|
|
41
219
|
```json
|
|
42
220
|
{
|
|
43
221
|
"version": "1.0.0",
|
|
222
|
+
"metadata": {
|
|
223
|
+
"name": "My Component Registry",
|
|
224
|
+
"description": "Custom MCP UI components",
|
|
225
|
+
"author": "Your Name"
|
|
226
|
+
},
|
|
44
227
|
"components": [
|
|
45
228
|
{
|
|
46
229
|
"id": "quickchart-bar",
|
|
47
230
|
"type": "chart",
|
|
48
231
|
"name": "Bar Chart",
|
|
49
|
-
"description": "Renders a bar chart",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
232
|
+
"description": "Renders a bar chart via QuickChart.io",
|
|
233
|
+
"version": "1.0.0",
|
|
234
|
+
"schema": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": ["labels", "data"],
|
|
237
|
+
"properties": {
|
|
238
|
+
"labels": { "type": "array", "items": { "type": "string" } },
|
|
239
|
+
"data": { "type": "array", "items": { "type": "number" } },
|
|
240
|
+
"title": { "type": "string" }
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"examples": [
|
|
244
|
+
{
|
|
245
|
+
"name": "Simple Bar Chart",
|
|
246
|
+
"description": "A basic bar chart example",
|
|
247
|
+
"params": {
|
|
248
|
+
"labels": ["Q1", "Q2", "Q3", "Q4"],
|
|
249
|
+
"data": [100, 150, 120, 180],
|
|
250
|
+
"title": "Quarterly Revenue"
|
|
251
|
+
},
|
|
252
|
+
"position": { "colStart": 1, "colSpan": 6 }
|
|
253
|
+
}
|
|
254
|
+
],
|
|
52
255
|
"security": {
|
|
53
|
-
"requiresAuth":
|
|
256
|
+
"requiresAuth": false,
|
|
54
257
|
"allowedDomains": ["quickchart.io"]
|
|
55
258
|
},
|
|
56
|
-
"
|
|
259
|
+
"performance": {
|
|
260
|
+
"maxRenderTime": 3000,
|
|
261
|
+
"maxDataSize": 51200
|
|
262
|
+
},
|
|
263
|
+
"tags": ["chart", "visualization", "quickchart"]
|
|
57
264
|
}
|
|
58
265
|
]
|
|
59
266
|
}
|
|
60
267
|
```
|
|
61
268
|
|
|
62
|
-
##
|
|
269
|
+
## Related Packages
|
|
270
|
+
|
|
271
|
+
| Package | Description |
|
|
272
|
+
|---------|-------------|
|
|
273
|
+
| [`@seed-ship/mcp-ui-solid`](../mcp-ui-solid) | SolidJS UI components |
|
|
274
|
+
| [`@seed-ship/mcp-ui-cli`](../mcp-ui-cli) | CLI for validation and type generation |
|
|
275
|
+
|
|
276
|
+
## Versioning
|
|
277
|
+
|
|
278
|
+
This package follows [Semantic Versioning](https://semver.org/). See [CHANGELOG.md](./CHANGELOG.md) for release notes.
|
|
63
279
|
|
|
64
|
-
|
|
280
|
+
**Current Version:** 1.1.0
|
|
65
281
|
|
|
66
282
|
## License
|
|
67
283
|
|
package/dist/schemas.cjs
CHANGED
|
@@ -7,7 +7,24 @@ const GridPositionSchema = zod.z.object({
|
|
|
7
7
|
rowStart: zod.z.number().int().min(1).optional(),
|
|
8
8
|
rowSpan: zod.z.number().int().min(1).default(1).optional()
|
|
9
9
|
});
|
|
10
|
-
const ComponentTypeSchema = zod.z.enum([
|
|
10
|
+
const ComponentTypeSchema = zod.z.enum([
|
|
11
|
+
"chart",
|
|
12
|
+
"table",
|
|
13
|
+
"metric",
|
|
14
|
+
"text",
|
|
15
|
+
"composite",
|
|
16
|
+
"grid",
|
|
17
|
+
// Phase 5.0: Nested grid layouts
|
|
18
|
+
"iframe",
|
|
19
|
+
"image",
|
|
20
|
+
"link",
|
|
21
|
+
"action",
|
|
22
|
+
// Phase 5.0: Tool call actions
|
|
23
|
+
"footer",
|
|
24
|
+
// Phase 5.0: Metadata footer
|
|
25
|
+
"carousel",
|
|
26
|
+
"artifact"
|
|
27
|
+
]);
|
|
11
28
|
const SandboxFlagSchema = zod.z.enum([
|
|
12
29
|
"allow-scripts",
|
|
13
30
|
"allow-same-origin",
|
package/dist/schemas.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.cjs","sources":["../src/schemas/index.ts"],"sourcesContent":["/**\n * Zod validation schemas for component registry\n */\n\nimport { z } from 'zod'\n\n// Grid position schema\nexport const GridPositionSchema = z.object({\n colStart: z.number().int().min(1).max(12),\n colSpan: z.number().int().min(1).max(12),\n rowStart: z.number().int().min(1).optional(),\n rowSpan: z.number().int().min(1).default(1).optional(),\n})\n\n// Component types\nexport const ComponentTypeSchema = z.enum(['chart'
|
|
1
|
+
{"version":3,"file":"schemas.cjs","sources":["../src/schemas/index.ts"],"sourcesContent":["/**\n * Zod validation schemas for component registry\n */\n\nimport { z } from 'zod'\n\n// Grid position schema\nexport const GridPositionSchema = z.object({\n colStart: z.number().int().min(1).max(12),\n colSpan: z.number().int().min(1).max(12),\n rowStart: z.number().int().min(1).optional(),\n rowSpan: z.number().int().min(1).default(1).optional(),\n})\n\n// Component types (synced with mcp-ui-solid v1.2.0)\nexport const ComponentTypeSchema = z.enum([\n 'chart',\n 'table',\n 'metric',\n 'text',\n 'composite',\n 'grid', // Phase 5.0: Nested grid layouts\n 'iframe',\n 'image',\n 'link',\n 'action', // Phase 5.0: Tool call actions\n 'footer', // Phase 5.0: Metadata footer\n 'carousel',\n 'artifact',\n])\n\n// Sandbox flags\nexport const SandboxFlagSchema = z.enum([\n 'allow-scripts',\n 'allow-same-origin',\n 'allow-forms',\n 'allow-popups',\n 'allow-modals',\n])\n\n// Security constraints\nexport const SecurityConstraintsSchema = z.object({\n requiresAuth: z.boolean().default(false).optional(),\n allowedDomains: z.array(z.string()).optional(),\n maxIframeDepth: z.number().int().min(0).max(3).default(1).optional(),\n sandboxFlags: z.array(SandboxFlagSchema).optional(),\n})\n\n// Performance constraints\nexport const PerformanceConstraintsSchema = z.object({\n maxRenderTime: z.number().int().min(100).default(5000).optional(),\n maxDataSize: z.number().int().min(1024).default(102400).optional(),\n})\n\n// Component schema (JSON Schema definition)\nexport const ComponentSchemaSchema = z.object({\n type: z.literal('object'),\n required: z.array(z.string()).optional(),\n properties: z.record(z.unknown()),\n additionalProperties: z.boolean().optional(),\n})\n\n// Component example\nexport const ComponentExampleSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n params: z.record(z.unknown()),\n position: GridPositionSchema.optional(),\n})\n\n// Component definition\nexport const ComponentSchema = z.object({\n id: z.string().regex(/^[a-z0-9-]+$/),\n type: ComponentTypeSchema,\n name: z.string().min(1),\n description: z.string().optional(),\n schema: ComponentSchemaSchema,\n examples: z.array(ComponentExampleSchema).min(1),\n security: SecurityConstraintsSchema.optional(),\n performance: PerformanceConstraintsSchema.optional(),\n tags: z.array(z.string().regex(/^[a-z0-9-]+$/)).optional(),\n version: z\n .string()\n .regex(/^\\d+\\.\\d+\\.\\d+$/)\n .optional(),\n deprecated: z.boolean().default(false).optional(),\n deprecationMessage: z.string().optional(),\n})\n\n// Registry metadata\nexport const RegistryMetadataSchema = z.object({\n name: z.string().optional(),\n description: z.string().optional(),\n author: z.string().optional(),\n repository: z.string().url().optional(),\n})\n\n// Component registry\nexport const ComponentRegistrySchema = z.object({\n version: z.literal('1.0.0'),\n metadata: RegistryMetadataSchema.optional(),\n components: z.array(ComponentSchema).min(1),\n})\n\n// Export types inferred from schemas\nexport type ComponentRegistry = z.infer<typeof ComponentRegistrySchema>\nexport type Component = z.infer<typeof ComponentSchema>\nexport type ComponentExample = z.infer<typeof ComponentExampleSchema>\nexport type GridPosition = z.infer<typeof GridPositionSchema>\nexport type SecurityConstraints = z.infer<typeof SecurityConstraintsSchema>\nexport type PerformanceConstraints = z.infer<typeof PerformanceConstraintsSchema>\nexport type ComponentType = z.infer<typeof ComponentTypeSchema>\nexport type SandboxFlag = z.infer<typeof SandboxFlagSchema>\n"],"names":["z"],"mappings":";;;AAOO,MAAM,qBAAqBA,IAAAA,EAAE,OAAO;AAAA,EACzC,UAAUA,IAAAA,EAAE,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EACxC,SAASA,IAAAA,EAAE,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EACvC,UAAUA,IAAAA,EAAE,SAAS,MAAM,IAAI,CAAC,EAAE,SAAA;AAAA,EAClC,SAASA,IAAAA,EAAE,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAA;AAC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C9C,SAASA,IAAAA,EAAE,QAAQ,OAAO;AAAA,EAC1B,UAAU,uBAAuB,SAAA;AAAA,EACjC,YAAYA,IAAAA,EAAE,MAAM,eAAe,EAAE,IAAI,CAAC;AAC5C,CAAC;;;;;;;;;;;"}
|
package/dist/schemas.js
CHANGED
|
@@ -5,7 +5,24 @@ const GridPositionSchema = z.object({
|
|
|
5
5
|
rowStart: z.number().int().min(1).optional(),
|
|
6
6
|
rowSpan: z.number().int().min(1).default(1).optional()
|
|
7
7
|
});
|
|
8
|
-
const ComponentTypeSchema = z.enum([
|
|
8
|
+
const ComponentTypeSchema = z.enum([
|
|
9
|
+
"chart",
|
|
10
|
+
"table",
|
|
11
|
+
"metric",
|
|
12
|
+
"text",
|
|
13
|
+
"composite",
|
|
14
|
+
"grid",
|
|
15
|
+
// Phase 5.0: Nested grid layouts
|
|
16
|
+
"iframe",
|
|
17
|
+
"image",
|
|
18
|
+
"link",
|
|
19
|
+
"action",
|
|
20
|
+
// Phase 5.0: Tool call actions
|
|
21
|
+
"footer",
|
|
22
|
+
// Phase 5.0: Metadata footer
|
|
23
|
+
"carousel",
|
|
24
|
+
"artifact"
|
|
25
|
+
]);
|
|
9
26
|
const SandboxFlagSchema = z.enum([
|
|
10
27
|
"allow-scripts",
|
|
11
28
|
"allow-same-origin",
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sources":["../src/schemas/index.ts"],"sourcesContent":["/**\n * Zod validation schemas for component registry\n */\n\nimport { z } from 'zod'\n\n// Grid position schema\nexport const GridPositionSchema = z.object({\n colStart: z.number().int().min(1).max(12),\n colSpan: z.number().int().min(1).max(12),\n rowStart: z.number().int().min(1).optional(),\n rowSpan: z.number().int().min(1).default(1).optional(),\n})\n\n// Component types\nexport const ComponentTypeSchema = z.enum(['chart'
|
|
1
|
+
{"version":3,"file":"schemas.js","sources":["../src/schemas/index.ts"],"sourcesContent":["/**\n * Zod validation schemas for component registry\n */\n\nimport { z } from 'zod'\n\n// Grid position schema\nexport const GridPositionSchema = z.object({\n colStart: z.number().int().min(1).max(12),\n colSpan: z.number().int().min(1).max(12),\n rowStart: z.number().int().min(1).optional(),\n rowSpan: z.number().int().min(1).default(1).optional(),\n})\n\n// Component types (synced with mcp-ui-solid v1.2.0)\nexport const ComponentTypeSchema = z.enum([\n 'chart',\n 'table',\n 'metric',\n 'text',\n 'composite',\n 'grid', // Phase 5.0: Nested grid layouts\n 'iframe',\n 'image',\n 'link',\n 'action', // Phase 5.0: Tool call actions\n 'footer', // Phase 5.0: Metadata footer\n 'carousel',\n 'artifact',\n])\n\n// Sandbox flags\nexport const SandboxFlagSchema = z.enum([\n 'allow-scripts',\n 'allow-same-origin',\n 'allow-forms',\n 'allow-popups',\n 'allow-modals',\n])\n\n// Security constraints\nexport const SecurityConstraintsSchema = z.object({\n requiresAuth: z.boolean().default(false).optional(),\n allowedDomains: z.array(z.string()).optional(),\n maxIframeDepth: z.number().int().min(0).max(3).default(1).optional(),\n sandboxFlags: z.array(SandboxFlagSchema).optional(),\n})\n\n// Performance constraints\nexport const PerformanceConstraintsSchema = z.object({\n maxRenderTime: z.number().int().min(100).default(5000).optional(),\n maxDataSize: z.number().int().min(1024).default(102400).optional(),\n})\n\n// Component schema (JSON Schema definition)\nexport const ComponentSchemaSchema = z.object({\n type: z.literal('object'),\n required: z.array(z.string()).optional(),\n properties: z.record(z.unknown()),\n additionalProperties: z.boolean().optional(),\n})\n\n// Component example\nexport const ComponentExampleSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n params: z.record(z.unknown()),\n position: GridPositionSchema.optional(),\n})\n\n// Component definition\nexport const ComponentSchema = z.object({\n id: z.string().regex(/^[a-z0-9-]+$/),\n type: ComponentTypeSchema,\n name: z.string().min(1),\n description: z.string().optional(),\n schema: ComponentSchemaSchema,\n examples: z.array(ComponentExampleSchema).min(1),\n security: SecurityConstraintsSchema.optional(),\n performance: PerformanceConstraintsSchema.optional(),\n tags: z.array(z.string().regex(/^[a-z0-9-]+$/)).optional(),\n version: z\n .string()\n .regex(/^\\d+\\.\\d+\\.\\d+$/)\n .optional(),\n deprecated: z.boolean().default(false).optional(),\n deprecationMessage: z.string().optional(),\n})\n\n// Registry metadata\nexport const RegistryMetadataSchema = z.object({\n name: z.string().optional(),\n description: z.string().optional(),\n author: z.string().optional(),\n repository: z.string().url().optional(),\n})\n\n// Component registry\nexport const ComponentRegistrySchema = z.object({\n version: z.literal('1.0.0'),\n metadata: RegistryMetadataSchema.optional(),\n components: z.array(ComponentSchema).min(1),\n})\n\n// Export types inferred from schemas\nexport type ComponentRegistry = z.infer<typeof ComponentRegistrySchema>\nexport type Component = z.infer<typeof ComponentSchema>\nexport type ComponentExample = z.infer<typeof ComponentExampleSchema>\nexport type GridPosition = z.infer<typeof GridPositionSchema>\nexport type SecurityConstraints = z.infer<typeof SecurityConstraintsSchema>\nexport type PerformanceConstraints = z.infer<typeof PerformanceConstraintsSchema>\nexport type ComponentType = z.infer<typeof ComponentTypeSchema>\nexport type SandboxFlag = z.infer<typeof SandboxFlagSchema>\n"],"names":[],"mappings":";AAOO,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,UAAU,EAAE,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EACxC,SAAS,EAAE,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EACvC,UAAU,EAAE,SAAS,MAAM,IAAI,CAAC,EAAE,SAAA;AAAA,EAClC,SAAS,EAAE,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAA;AAC9C,CAAC;AAGM,MAAM,sBAAsB,EAAE,KAAK;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AA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