@specverse/runtime 4.1.0 → 4.1.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/README.md +356 -0
- package/dist/runtime/views/core/atomic-components-registry.d.ts +63 -0
- package/dist/runtime/views/core/atomic-components-registry.d.ts.map +1 -0
- package/dist/runtime/views/core/atomic-components-registry.js +822 -0
- package/dist/runtime/views/core/atomic-components-registry.js.map +1 -0
- package/dist/runtime/views/core/composite-pattern-types.d.ts +171 -0
- package/dist/runtime/views/core/composite-pattern-types.d.ts.map +1 -0
- package/dist/runtime/views/core/composite-pattern-types.js +11 -0
- package/dist/runtime/views/core/composite-pattern-types.js.map +1 -0
- package/dist/runtime/views/core/composite-patterns.d.ts +67 -0
- package/dist/runtime/views/core/composite-patterns.d.ts.map +1 -0
- package/dist/runtime/views/core/composite-patterns.js +485 -0
- package/dist/runtime/views/core/composite-patterns.js.map +1 -0
- package/dist/runtime/views/core/entity-display.d.ts +28 -0
- package/dist/runtime/views/core/entity-display.d.ts.map +1 -1
- package/dist/runtime/views/core/entity-display.js +75 -0
- package/dist/runtime/views/core/entity-display.js.map +1 -1
- package/dist/runtime/views/core/index.d.ts +4 -1
- package/dist/runtime/views/core/index.d.ts.map +1 -1
- package/dist/runtime/views/core/index.js +5 -1
- package/dist/runtime/views/core/index.js.map +1 -1
- package/dist/runtime/views/core/pattern-engine.d.ts +2 -2
- package/dist/runtime/views/core/pattern-engine.d.ts.map +1 -1
- package/dist/runtime/views/core/pattern-engine.js.map +1 -1
- package/dist/runtime/views/core/types.d.ts +2 -0
- package/dist/runtime/views/core/types.d.ts.map +1 -1
- package/dist/runtime/views/index.d.ts +5 -2
- package/dist/runtime/views/index.d.ts.map +1 -1
- package/dist/runtime/views/index.js +5 -2
- package/dist/runtime/views/index.js.map +1 -1
- package/dist/runtime/views/react/components/DevShell.d.ts.map +1 -1
- package/dist/runtime/views/react/components/DevShell.js +6 -2
- package/dist/runtime/views/react/components/DevShell.js.map +1 -1
- package/dist/runtime/views/react/components/EntitySelect.d.ts +14 -0
- package/dist/runtime/views/react/components/EntitySelect.d.ts.map +1 -0
- package/dist/runtime/views/react/components/EntitySelect.js +29 -0
- package/dist/runtime/views/react/components/EntitySelect.js.map +1 -0
- package/dist/runtime/views/react/components/EventStream.d.ts +11 -0
- package/dist/runtime/views/react/components/EventStream.d.ts.map +1 -0
- package/dist/runtime/views/react/components/EventStream.js +49 -0
- package/dist/runtime/views/react/components/EventStream.js.map +1 -0
- package/dist/runtime/views/react/components/FieldInput.d.ts +23 -0
- package/dist/runtime/views/react/components/FieldInput.d.ts.map +1 -0
- package/dist/runtime/views/react/components/FieldInput.js +28 -0
- package/dist/runtime/views/react/components/FieldInput.js.map +1 -0
- package/dist/runtime/views/react/components/FormView.d.ts +21 -0
- package/dist/runtime/views/react/components/FormView.d.ts.map +1 -0
- package/dist/runtime/views/react/components/FormView.js +13 -0
- package/dist/runtime/views/react/components/FormView.js.map +1 -0
- package/dist/runtime/views/react/components/ModelManager.d.ts +6 -2
- package/dist/runtime/views/react/components/ModelManager.d.ts.map +1 -1
- package/dist/runtime/views/react/components/ModelManager.js +166 -61
- package/dist/runtime/views/react/components/ModelManager.js.map +1 -1
- package/dist/runtime/views/react/components/ModelSelector.d.ts.map +1 -1
- package/dist/runtime/views/react/components/ModelSelector.js +4 -1
- package/dist/runtime/views/react/components/ModelSelector.js.map +1 -1
- package/dist/runtime/views/react/components/OperationExecutor.d.ts +15 -0
- package/dist/runtime/views/react/components/OperationExecutor.d.ts.map +1 -0
- package/dist/runtime/views/react/components/OperationExecutor.js +86 -0
- package/dist/runtime/views/react/components/OperationExecutor.js.map +1 -0
- package/dist/runtime/views/react/components/OperationResultView.d.ts +10 -0
- package/dist/runtime/views/react/components/OperationResultView.d.ts.map +1 -0
- package/dist/runtime/views/react/components/OperationResultView.js +92 -0
- package/dist/runtime/views/react/components/OperationResultView.js.map +1 -0
- package/dist/runtime/views/react/components/OperationView.d.ts +21 -0
- package/dist/runtime/views/react/components/OperationView.d.ts.map +1 -0
- package/dist/runtime/views/react/components/OperationView.js +7 -0
- package/dist/runtime/views/react/components/OperationView.js.map +1 -0
- package/dist/runtime/views/react/components/RelationshipField.js +4 -4
- package/dist/runtime/views/react/components/RelationshipField.js.map +1 -1
- package/dist/runtime/views/react/components/RuntimeView.d.ts.map +1 -1
- package/dist/runtime/views/react/components/RuntimeView.js +93 -33
- package/dist/runtime/views/react/components/RuntimeView.js.map +1 -1
- package/dist/runtime/views/react/components/ViewRouter.d.ts +7 -1
- package/dist/runtime/views/react/components/ViewRouter.d.ts.map +1 -1
- package/dist/runtime/views/react/components/ViewRouter.js +57 -18
- package/dist/runtime/views/react/components/ViewRouter.js.map +1 -1
- package/dist/runtime/views/react/hooks/useEventStream.d.ts +29 -0
- package/dist/runtime/views/react/hooks/useEventStream.d.ts.map +1 -0
- package/dist/runtime/views/react/hooks/useEventStream.js +114 -0
- package/dist/runtime/views/react/hooks/useEventStream.js.map +1 -0
- package/dist/runtime/views/react/hooks/useResizableSidebar.d.ts.map +1 -1
- package/dist/runtime/views/react/hooks/useResizableSidebar.js +2 -0
- package/dist/runtime/views/react/hooks/useResizableSidebar.js.map +1 -1
- package/dist/runtime/views/react/index.d.ts +10 -1
- package/dist/runtime/views/react/index.d.ts.map +1 -1
- package/dist/runtime/views/react/index.js +11 -1
- package/dist/runtime/views/react/index.js.map +1 -1
- package/dist/runtime/views/react/react-pattern-adapter.d.ts +235 -0
- package/dist/runtime/views/react/react-pattern-adapter.d.ts.map +1 -0
- package/dist/runtime/views/react/react-pattern-adapter.js +1450 -0
- package/dist/runtime/views/react/react-pattern-adapter.js.map +1 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
# @specverse/runtime
|
|
2
|
+
|
|
3
|
+
Runtime view engine for SpecVerse — renders spec-driven and dev views at runtime in the browser.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
@specverse/runtime
|
|
9
|
+
src/runtime/views/
|
|
10
|
+
core/ Framework-agnostic
|
|
11
|
+
├── entity-display.ts Entity name resolution (name > title > label > FK chain > ID)
|
|
12
|
+
├── field-classification.ts Field categorization (business, metadata, auto, relationship)
|
|
13
|
+
├── pattern-engine.ts View type → pattern detection, CURVED protocol mapping
|
|
14
|
+
├── composite-pattern-types.ts 9 interfaces for tech-independent view patterns
|
|
15
|
+
├── composite-patterns.ts 4 pattern definitions (form, list, detail, dashboard)
|
|
16
|
+
├── atomic-components-registry.ts 49 component type definitions
|
|
17
|
+
└── types.ts RuntimeViewProviderValue contract
|
|
18
|
+
|
|
19
|
+
react/ React adapter
|
|
20
|
+
├── context.ts RuntimeViewProvider + useRuntimeContext()
|
|
21
|
+
├── react-pattern-adapter.tsx 1743-line pattern → HTML renderer
|
|
22
|
+
├── hooks/
|
|
23
|
+
│ ├── useTheme.ts Dark/light toggle with localStorage
|
|
24
|
+
│ ├── useResizableSidebar.ts Draggable sidebar width
|
|
25
|
+
│ ├── useEntityHelpers.ts Field separation, relationship resolution
|
|
26
|
+
│ └── useEventStream.ts WebSocket event streaming
|
|
27
|
+
└── components/
|
|
28
|
+
├── DevShell.tsx Main dev GUI (tabs: Views, Models, Events)
|
|
29
|
+
├── ViewRouter.tsx Sidebar + routing (display, forms, operations)
|
|
30
|
+
├── RuntimeView.tsx Pattern-based view renderer
|
|
31
|
+
├── FormView.tsx View-spec adapter → ModelManager
|
|
32
|
+
├── ModelSelector.tsx Model browser sidebar
|
|
33
|
+
├── ModelManager.tsx Full CRUD + lifecycle transitions
|
|
34
|
+
├── ViewSidebar.tsx View selection sidebar
|
|
35
|
+
├── RelationshipField.tsx Smart FK dropdowns (belongsTo/hasMany/hasOne)
|
|
36
|
+
├── FieldInput.tsx Type-aware input (bool, number, datetime, etc.)
|
|
37
|
+
├── EntitySelect.tsx Entity dropdown with cascading filters
|
|
38
|
+
├── OperationView.tsx Service operation header + executor
|
|
39
|
+
├── OperationExecutor.tsx Parameter inputs, execute, result display
|
|
40
|
+
├── OperationResultView.tsx Formatted results with entity name resolution
|
|
41
|
+
├── EventStream.tsx Real-time event log with type filtering
|
|
42
|
+
└── ui/
|
|
43
|
+
└── ResizeHandle.tsx Draggable resize handle
|
|
44
|
+
|
|
45
|
+
tailwind/ Styling
|
|
46
|
+
└── universal-adapter.ts 48 component types → Tailwind HTML markup
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Subpath Exports
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// Core utilities (framework-agnostic)
|
|
53
|
+
import { getEntityDisplayName, classifyFields, detectPattern, COMPOSITE_VIEW_PATTERNS } from '@specverse/runtime/views';
|
|
54
|
+
|
|
55
|
+
// React adapter (hooks, components)
|
|
56
|
+
import { DevShell, RuntimeView, ViewRouter, FormView, ModelManager, useTheme, useEventStream } from '@specverse/runtime/views/react';
|
|
57
|
+
|
|
58
|
+
// Tailwind markup generator
|
|
59
|
+
import { createUniversalTailwindAdapter } from '@specverse/runtime/views/tailwind';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## How It Works
|
|
63
|
+
|
|
64
|
+
### The RuntimeViewProvider Pattern
|
|
65
|
+
|
|
66
|
+
The runtime package's components are decoupled from any specific state management or API client. Instead, they consume data and hooks through a React context:
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
// Generated App.tsx (or app-demo's RuntimeBridge)
|
|
70
|
+
import { RuntimeViewProvider } from '@specverse/runtime/views/react';
|
|
71
|
+
|
|
72
|
+
<RuntimeViewProvider value={{
|
|
73
|
+
// Instance-specific hooks — how to fetch data
|
|
74
|
+
useEntitiesQuery: (controller, model) => useMyApiHook(controller, model),
|
|
75
|
+
useModelSchemaQuery: (model) => useMySchemaHook(model),
|
|
76
|
+
useExecuteOperationMutation: () => useMyMutation(),
|
|
77
|
+
useTransitionStateMutation: () => useMyTransitionMutation(),
|
|
78
|
+
|
|
79
|
+
// Current state
|
|
80
|
+
entities: { Order: [...], Customer: [...] },
|
|
81
|
+
modelSchemas: { Order: { attributes: {...}, relationships: {...} } },
|
|
82
|
+
views: [...],
|
|
83
|
+
spec: parsedSpec,
|
|
84
|
+
apiBaseUrl: '/api',
|
|
85
|
+
}}>
|
|
86
|
+
<DevShell />
|
|
87
|
+
</RuntimeViewProvider>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Components call `useRuntimeContext()` to access this — no direct imports of appStore, API clients, or framework-specific state.
|
|
91
|
+
|
|
92
|
+
### Two Realize Modes
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Runtime mode (default) — slim frontend, views rendered at runtime
|
|
96
|
+
specverse realize all specs/main.specly
|
|
97
|
+
|
|
98
|
+
# Static mode — full frontend, all views pre-generated as code
|
|
99
|
+
specverse realize all specs/main.specly --static
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Runtime mode** generates ~12 frontend files:
|
|
103
|
+
- `App.tsx` — imports DevShell, sets up RuntimeViewProvider
|
|
104
|
+
- `apiClient.ts`, `useApi.ts`, `api.ts` — instance-specific API wiring
|
|
105
|
+
- `dev.specly` — auto-generated dev GUI views
|
|
106
|
+
- Config files (vite, tsconfig, package.json, tailwind, postcss)
|
|
107
|
+
|
|
108
|
+
**Static mode** generates ~185 frontend files:
|
|
109
|
+
- Per-model view components (list, detail, form, dashboard)
|
|
110
|
+
- Per-model hooks, types, forms
|
|
111
|
+
- Full pattern adapter and tailwind adapter bundled
|
|
112
|
+
|
|
113
|
+
### dev.specly — The Dev GUI Specification
|
|
114
|
+
|
|
115
|
+
Inference automatically generates `dev.specly` alongside the inferred spec. It describes the development GUI:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
metadata:
|
|
119
|
+
name: MyApp-dev
|
|
120
|
+
type: development
|
|
121
|
+
generated: true
|
|
122
|
+
|
|
123
|
+
navigation:
|
|
124
|
+
sidebar:
|
|
125
|
+
General:
|
|
126
|
+
- Customer
|
|
127
|
+
- Product
|
|
128
|
+
Customer:
|
|
129
|
+
- Order
|
|
130
|
+
Services:
|
|
131
|
+
- ShippingService
|
|
132
|
+
|
|
133
|
+
views:
|
|
134
|
+
# Standard views for every model
|
|
135
|
+
CustomerList:
|
|
136
|
+
type: list
|
|
137
|
+
model: Customer
|
|
138
|
+
|
|
139
|
+
CustomerDetail:
|
|
140
|
+
type: detail
|
|
141
|
+
model: Customer
|
|
142
|
+
|
|
143
|
+
CustomerForm:
|
|
144
|
+
type: form
|
|
145
|
+
model: Customer
|
|
146
|
+
|
|
147
|
+
# Specialist views (auto-detected from model characteristics)
|
|
148
|
+
OrderBoard: # lifecycle → board view
|
|
149
|
+
type: board
|
|
150
|
+
model: Order
|
|
151
|
+
|
|
152
|
+
OrderTimeline: # date fields → timeline view
|
|
153
|
+
type: timeline
|
|
154
|
+
model: Order
|
|
155
|
+
|
|
156
|
+
ProductDashboard: # numeric fields → dashboard
|
|
157
|
+
type: dashboard
|
|
158
|
+
model: Product
|
|
159
|
+
|
|
160
|
+
# Service operations
|
|
161
|
+
ShippingService_calculateShipping:
|
|
162
|
+
type: operation
|
|
163
|
+
service: ShippingService
|
|
164
|
+
operation: calculateShipping
|
|
165
|
+
parameters:
|
|
166
|
+
orderId: UUID
|
|
167
|
+
weight: Decimal
|
|
168
|
+
returns: Decimal
|
|
169
|
+
source: service
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### View Promotion Path
|
|
173
|
+
|
|
174
|
+
Users can progressively promote dev views to spec views:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
1. Dev view (automatic) — generated in dev.specly, rendered by DevShell
|
|
178
|
+
↓
|
|
179
|
+
2. Named spec view — copy to main.specly, same rendering
|
|
180
|
+
↓
|
|
181
|
+
3. Configured spec view — add columns, sort, filters
|
|
182
|
+
↓
|
|
183
|
+
4. Custom spec view — add full uiComponents, user-owned code
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Each step is additive. The runtime engine handles all levels.
|
|
187
|
+
|
|
188
|
+
## How to Use
|
|
189
|
+
|
|
190
|
+
### In a Generated Project (realize)
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
specverse init my-app --demo
|
|
194
|
+
cd my-app
|
|
195
|
+
specverse realize all specs/main.specly
|
|
196
|
+
cd generated/code
|
|
197
|
+
npm run setup
|
|
198
|
+
npm run dev:backend # Start Fastify + Prisma
|
|
199
|
+
npm run dev:frontend # Start Vite dev server → DevShell
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The frontend opens with three tabs:
|
|
203
|
+
- **Views** — browse all spec and dev views
|
|
204
|
+
- **Models** — CRUD any model, manage lifecycle states
|
|
205
|
+
- **Events** — real-time event stream from the backend
|
|
206
|
+
|
|
207
|
+
### In app-demo (RuntimeBridge)
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
// main.tsx
|
|
211
|
+
import { RuntimeBridge } from './providers/RuntimeBridge';
|
|
212
|
+
|
|
213
|
+
<QueryProvider>
|
|
214
|
+
<ApiInitializer>
|
|
215
|
+
<RuntimeBridge>
|
|
216
|
+
<App />
|
|
217
|
+
</RuntimeBridge>
|
|
218
|
+
</ApiInitializer>
|
|
219
|
+
</QueryProvider>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Then import components from the runtime package:
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { ViewRouter, FormView, OperationView, usePatternAdapter } from '@specverse/runtime/views/react';
|
|
226
|
+
import { ModelSelector } from '@specverse/runtime/views/react';
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Standalone Usage
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
import { RuntimeViewProvider, DevShell } from '@specverse/runtime/views/react';
|
|
233
|
+
|
|
234
|
+
function App() {
|
|
235
|
+
return (
|
|
236
|
+
<RuntimeViewProvider value={myRuntimeConfig}>
|
|
237
|
+
<DevShell
|
|
238
|
+
devSpec={parsedDevSpec}
|
|
239
|
+
appSpec={parsedAppSpec}
|
|
240
|
+
title="My App"
|
|
241
|
+
/>
|
|
242
|
+
</RuntimeViewProvider>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## How to Extend
|
|
248
|
+
|
|
249
|
+
### Add a New View Type
|
|
250
|
+
|
|
251
|
+
1. Add pattern detection in `core/pattern-engine.ts`:
|
|
252
|
+
```ts
|
|
253
|
+
const VIEW_TYPE_TO_PATTERN = {
|
|
254
|
+
// ... existing
|
|
255
|
+
'kanban': { patternId: 'kanban-view', category: 'data-display' },
|
|
256
|
+
};
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
2. Add rendering in `react/react-pattern-adapter.tsx` (or the built-in renderer in `RuntimeView.tsx`):
|
|
260
|
+
```ts
|
|
261
|
+
if (pattern.patternId === 'kanban-view') {
|
|
262
|
+
return this.renderKanbanView(context);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
3. Add to dev.specly generator in `engines/src/inference/dev-specly-generator.ts`:
|
|
267
|
+
```ts
|
|
268
|
+
if (someModelCharacteristic) {
|
|
269
|
+
views[`${modelName}Kanban`] = { type: 'kanban', model: modelName };
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Add a New DevShell Tab
|
|
274
|
+
|
|
275
|
+
Edit `runtime/src/runtime/views/react/components/DevShell.tsx`:
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
type TabId = 'views' | 'models' | 'events' | 'mytab';
|
|
279
|
+
|
|
280
|
+
const TABS: Tab[] = [
|
|
281
|
+
// ... existing
|
|
282
|
+
{ id: 'mytab', label: 'My Tab' },
|
|
283
|
+
];
|
|
284
|
+
|
|
285
|
+
// In render:
|
|
286
|
+
{activeTab === 'mytab' && <MyComponent />}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Or pass a custom tab via props (not yet implemented — would need a `tabs` prop on DevShell).
|
|
290
|
+
|
|
291
|
+
### Add a New Tailwind Component
|
|
292
|
+
|
|
293
|
+
Edit `runtime/src/runtime/views/tailwind/universal-adapter.ts`:
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
case 'kanban-column':
|
|
297
|
+
return `
|
|
298
|
+
<div class="bg-gray-100 dark:bg-gray-800 rounded-lg p-4 min-w-[280px]">
|
|
299
|
+
<h3 class="font-semibold text-sm mb-3">${properties.title}</h3>
|
|
300
|
+
<div class="space-y-2">${children}</div>
|
|
301
|
+
</div>
|
|
302
|
+
`;
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Create a Framework Adapter (Vue, Svelte, etc.)
|
|
306
|
+
|
|
307
|
+
The core layer (`@specverse/runtime/views`) is framework-agnostic. To create a Vue adapter:
|
|
308
|
+
|
|
309
|
+
1. Create `runtime/src/runtime/views/vue/` directory
|
|
310
|
+
2. Implement the same component set (DevShell, ViewRouter, etc.) using Vue
|
|
311
|
+
3. Use the same core utilities (entity-display, field-classification, pattern-engine)
|
|
312
|
+
4. Add a subpath export: `@specverse/runtime/views/vue`
|
|
313
|
+
|
|
314
|
+
The core does the thinking (pattern detection, field classification, entity resolution). The adapter does the rendering.
|
|
315
|
+
|
|
316
|
+
### Bridge to a Custom State Manager
|
|
317
|
+
|
|
318
|
+
The `RuntimeViewProviderValue` interface is the only contract. Implement it with any state manager:
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
// Redux
|
|
322
|
+
const value: RuntimeViewProviderValue = {
|
|
323
|
+
useEntitiesQuery: (ctrl, model) => useSelector(state => state.entities[model]),
|
|
324
|
+
entities: store.getState().entities,
|
|
325
|
+
// ...
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// MobX
|
|
329
|
+
const value: RuntimeViewProviderValue = {
|
|
330
|
+
useEntitiesQuery: (ctrl, model) => ({ data: entityStore.get(model), isLoading: false, error: null }),
|
|
331
|
+
entities: entityStore.all,
|
|
332
|
+
// ...
|
|
333
|
+
};
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Package Dependencies
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
@specverse/runtime
|
|
340
|
+
├── @specverse/types (workspace dependency)
|
|
341
|
+
├── react (peer dependency, ^18.0.0 || ^19.0.0)
|
|
342
|
+
└── react-dom (peer dependency, ^18.0.0 || ^19.0.0)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
No other runtime dependencies. The tailwind adapter generates HTML strings — Tailwind CSS is a dev dependency of the consuming project, not of the runtime package.
|
|
346
|
+
|
|
347
|
+
## Relationship to Other Packages
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
@specverse/types Contracts (both build-time and runtime)
|
|
351
|
+
@specverse/entities Language definition (build-time only)
|
|
352
|
+
@specverse/engines Toolchain — parser, inference, realize (build-time only)
|
|
353
|
+
@specverse/runtime View engine (runtime, browser) ← this package
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
The engines package knows about runtime (the slim factory generates code that imports it). The runtime package does not know about engines — it only depends on types.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomic Components Registry
|
|
3
|
+
*
|
|
4
|
+
* Defines all 49 atomic component types.
|
|
5
|
+
* Each type has metadata about its purpose, properties, and usage patterns.
|
|
6
|
+
*
|
|
7
|
+
* This registry is framework-agnostic. UI library adapters (shadcn, MUI, etc.)
|
|
8
|
+
* implement these types using their specific components.
|
|
9
|
+
*/
|
|
10
|
+
export interface AtomicComponentDefinition {
|
|
11
|
+
/** Component type identifier (matches schema enum) */
|
|
12
|
+
type: string;
|
|
13
|
+
/** Human-readable name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Category from v3.4 schema */
|
|
16
|
+
category: 'data-display' | 'forms-inputs' | 'actions' | 'overlays-feedback' | 'navigation' | 'layout' | 'progress' | 'specialized';
|
|
17
|
+
/** Description of component purpose */
|
|
18
|
+
description: string;
|
|
19
|
+
/** Common SpecVerse properties this component accepts */
|
|
20
|
+
properties: string[];
|
|
21
|
+
/** Whether this component can contain child components */
|
|
22
|
+
canHaveChildren: boolean;
|
|
23
|
+
/** Example usage in SpecVerse spec */
|
|
24
|
+
example: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Complete registry of all 49 atomic component types
|
|
28
|
+
*/
|
|
29
|
+
export declare const ATOMIC_COMPONENTS_REGISTRY: Record<string, AtomicComponentDefinition>;
|
|
30
|
+
/**
|
|
31
|
+
* Get component definition by type
|
|
32
|
+
*/
|
|
33
|
+
export declare function getComponentDefinition(type: string): AtomicComponentDefinition | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get all components in a category
|
|
36
|
+
*/
|
|
37
|
+
export declare function getComponentsByCategory(category: string): AtomicComponentDefinition[];
|
|
38
|
+
/**
|
|
39
|
+
* Validate if a component type exists
|
|
40
|
+
*/
|
|
41
|
+
export declare function isValidComponentType(type: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Get all component types as array
|
|
44
|
+
*/
|
|
45
|
+
export declare function getAllComponentTypes(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Component categories summary
|
|
48
|
+
*/
|
|
49
|
+
export declare const COMPONENT_CATEGORIES: {
|
|
50
|
+
readonly 'data-display': 9;
|
|
51
|
+
readonly 'forms-inputs': 11;
|
|
52
|
+
readonly actions: 5;
|
|
53
|
+
readonly 'overlays-feedback': 9;
|
|
54
|
+
readonly navigation: 5;
|
|
55
|
+
readonly layout: 6;
|
|
56
|
+
readonly progress: 2;
|
|
57
|
+
readonly specialized: 2;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Total count: 49 atomic components
|
|
61
|
+
*/
|
|
62
|
+
export declare const TOTAL_COMPONENT_COUNT = 49;
|
|
63
|
+
//# sourceMappingURL=atomic-components-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-components-registry.d.ts","sourceRoot":"","sources":["../../../../src/runtime/views/core/atomic-components-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,yBAAyB;IACxC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IAEb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IAEb,gCAAgC;IAChC,QAAQ,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,GAAG,mBAAmB,GACjE,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;IAE/D,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IAEpB,yDAAyD;IACzD,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB,0DAA0D;IAC1D,eAAe,EAAE,OAAO,CAAC;IAEzB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAuzBhF,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAE1F;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,yBAAyB,EAAE,CAErF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;CASvB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC"}
|