@specverse/engines 4.1.28 → 4.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/assets/examples/manifests/frontend-only.yaml +3 -6
- package/assets/examples/manifests/fullstack-app.yaml +5 -7
- package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
- package/dist/inference/comprehensive-engine.d.ts.map +1 -1
- package/dist/inference/comprehensive-engine.js +3 -19
- package/dist/inference/comprehensive-engine.js.map +1 -1
- package/dist/inference/core/rule-engine.d.ts +31 -0
- package/dist/inference/core/rule-engine.d.ts.map +1 -1
- package/dist/inference/core/rule-engine.js +117 -33
- package/dist/inference/core/rule-engine.js.map +1 -1
- package/dist/inference/core/rule-file-types.d.ts +0 -2
- package/dist/inference/core/rule-file-types.d.ts.map +1 -1
- package/dist/inference/core/rule-file-types.js +3 -6
- package/dist/inference/core/rule-file-types.js.map +1 -1
- package/dist/inference/core/rule-loader.d.ts +5 -15
- package/dist/inference/core/rule-loader.d.ts.map +1 -1
- package/dist/inference/core/rule-loader.js +43 -132
- package/dist/inference/core/rule-loader.js.map +1 -1
- package/dist/inference/core/types.d.ts +0 -6
- package/dist/inference/core/types.d.ts.map +1 -1
- package/dist/inference/core/types.js +0 -4
- package/dist/inference/core/types.js.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
- package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.js +0 -19
- package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
- package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
- package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
- package/dist/inference/logical/generators/view-generator.d.ts +4 -14
- package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/view-generator.js +6 -26
- package/dist/inference/logical/generators/view-generator.js.map +1 -1
- package/dist/inference/logical/index.d.ts +2 -2
- package/dist/inference/logical/index.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.js +17 -80
- package/dist/inference/logical/logical-engine.js.map +1 -1
- package/dist/inference/quint-transpiler.d.ts +5 -3
- package/dist/inference/quint-transpiler.d.ts.map +1 -1
- package/dist/inference/quint-transpiler.js +11 -6
- package/dist/inference/quint-transpiler.js.map +1 -1
- package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +3 -3
- package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +16 -6
- package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +121 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +78 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +190 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +45 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +46 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +30 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +56 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +14 -11
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +11 -3
- package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +27 -17
- package/dist/libs/instance-factories/shared/path-resolver.js +1 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +15 -22
- package/dist/realize/index.js.map +1 -1
- package/dist/registry/utils/manifest-adapter.d.ts +8 -1
- package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
- package/dist/registry/utils/manifest-adapter.js +8 -1
- package/dist/registry/utils/manifest-adapter.js.map +1 -1
- package/libs/instance-factories/applications/react-app-starter.yaml +150 -0
- package/libs/instance-factories/applications/templates/generic/main-generator.ts +3 -3
- package/libs/instance-factories/applications/templates/react/api-client-generator.ts +16 -6
- package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +145 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +175 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +163 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
- package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
- package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +174 -0
- package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
- package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +306 -0
- package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +60 -0
- package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
- package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +120 -0
- package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +80 -0
- package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
- package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +47 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +94 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +114 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +72 -0
- package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +151 -0
- package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +14 -11
- package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +11 -3
- package/libs/instance-factories/services/templates/prisma/controller-generator.ts +27 -17
- package/libs/instance-factories/shared/path-resolver.ts +8 -2
- package/package.json +3 -3
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js.bak +0 -244
- package/dist/libs/instance-factories/views/index.js +0 -48
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
- package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
- package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
- package/dist/realize/index.js.bak +0 -758
- package/libs/instance-factories/applications/react-app.yaml +0 -186
- package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
- package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
- package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
- package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
- package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
- package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
- package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
- package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
- package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
- package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
- package/libs/instance-factories/views/README.md +0 -62
- package/libs/instance-factories/views/index.d.ts +0 -13
- package/libs/instance-factories/views/index.d.ts.map +0 -1
- package/libs/instance-factories/views/index.js +0 -18
- package/libs/instance-factories/views/index.js.map +0 -1
- package/libs/instance-factories/views/index.ts +0 -45
- package/libs/instance-factories/views/react-components.yaml +0 -129
- package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
- package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
- package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
- package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
- package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
- package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
- package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
- package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
- package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
- package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
- package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
- package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
- package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
- package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
- package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
- package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
- package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
- package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
- package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
- package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
- package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
- package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
- package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
- package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
- package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
- package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
- package/libs/instance-factories/views/templates/shared/index.ts +0 -68
- package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
- package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
|
@@ -1,803 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component Metadata - Runtime Rendering Hints
|
|
3
|
-
*
|
|
4
|
-
* Provides metadata for runtime interpretation and dynamic rendering.
|
|
5
|
-
* Bridges the static atomic components registry with dynamic runtime engines.
|
|
6
|
-
*
|
|
7
|
-
* Used by:
|
|
8
|
-
* - app-demo runtime engine for dynamic component rendering
|
|
9
|
-
* - Documentation generation for component catalogs
|
|
10
|
-
* - AI-powered component suggestions
|
|
11
|
-
* - IDE tooling and autocomplete
|
|
12
|
-
*
|
|
13
|
-
* Architecture:
|
|
14
|
-
* - Enriches atomic component definitions with runtime hints
|
|
15
|
-
* - Provides property descriptions and validation rules
|
|
16
|
-
* - Includes rendering capabilities and constraints
|
|
17
|
-
* - Supports dynamic component discovery
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { ATOMIC_COMPONENTS_REGISTRY, AtomicComponentDefinition } from './atomic-components-registry.js';
|
|
21
|
-
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// Types
|
|
24
|
-
// ============================================================================
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Property metadata for runtime interpretation
|
|
28
|
-
*/
|
|
29
|
-
export interface PropertyMetadata {
|
|
30
|
-
name: string;
|
|
31
|
-
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'enum';
|
|
32
|
-
required: boolean;
|
|
33
|
-
default?: any;
|
|
34
|
-
description: string;
|
|
35
|
-
enumValues?: string[]; // For enum types
|
|
36
|
-
validation?: {
|
|
37
|
-
min?: number;
|
|
38
|
-
max?: number;
|
|
39
|
-
pattern?: string;
|
|
40
|
-
options?: string[];
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Common property that maps across frameworks
|
|
44
|
-
* (variant, size, color, position, orientation)
|
|
45
|
-
*/
|
|
46
|
-
isCommon?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Property affects layout/rendering significantly
|
|
49
|
-
*/
|
|
50
|
-
affectsLayout?: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Event metadata for runtime interpretation
|
|
55
|
-
*/
|
|
56
|
-
export interface EventMetadata {
|
|
57
|
-
name: string;
|
|
58
|
-
description: string;
|
|
59
|
-
parameters?: {
|
|
60
|
-
name: string;
|
|
61
|
-
type: string;
|
|
62
|
-
description: string;
|
|
63
|
-
}[];
|
|
64
|
-
/**
|
|
65
|
-
* Event bubbles up to parent components
|
|
66
|
-
*/
|
|
67
|
-
bubbles?: boolean;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Rendering capability metadata
|
|
72
|
-
*/
|
|
73
|
-
export interface RenderingCapability {
|
|
74
|
-
/**
|
|
75
|
-
* Component can contain children
|
|
76
|
-
*/
|
|
77
|
-
supportsChildren: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Component supports conditional rendering (v-if, *ngIf, etc.)
|
|
80
|
-
*/
|
|
81
|
-
supportsConditional: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Component supports list rendering (v-for, *ngFor, map, etc.)
|
|
84
|
-
*/
|
|
85
|
-
supportsList: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Component supports slots/content projection
|
|
88
|
-
*/
|
|
89
|
-
supportsSlots: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Maximum recommended nesting depth
|
|
92
|
-
*/
|
|
93
|
-
maxDepth?: number;
|
|
94
|
-
/**
|
|
95
|
-
* Preferred position in component tree
|
|
96
|
-
*/
|
|
97
|
-
preferredPosition?: 'root' | 'container' | 'leaf' | 'any';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Accessibility metadata
|
|
102
|
-
*/
|
|
103
|
-
export interface AccessibilityMetadata {
|
|
104
|
-
/**
|
|
105
|
-
* ARIA role
|
|
106
|
-
*/
|
|
107
|
-
role?: string;
|
|
108
|
-
/**
|
|
109
|
-
* Keyboard navigable
|
|
110
|
-
*/
|
|
111
|
-
keyboardNavigable: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Required ARIA attributes
|
|
114
|
-
*/
|
|
115
|
-
requiredAriaAttrs?: string[];
|
|
116
|
-
/**
|
|
117
|
-
* Screen reader description template
|
|
118
|
-
*/
|
|
119
|
-
screenReaderDescription?: string;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Component state metadata
|
|
124
|
-
*/
|
|
125
|
-
export interface StateMetadata {
|
|
126
|
-
/**
|
|
127
|
-
* Component manages internal state
|
|
128
|
-
*/
|
|
129
|
-
hasInternalState: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* State properties managed by component
|
|
132
|
-
*/
|
|
133
|
-
stateProperties?: {
|
|
134
|
-
name: string;
|
|
135
|
-
type: string;
|
|
136
|
-
description: string;
|
|
137
|
-
defaultValue?: any;
|
|
138
|
-
}[];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Complete component metadata for runtime
|
|
143
|
-
*/
|
|
144
|
-
export interface ComponentMetadata extends AtomicComponentDefinition {
|
|
145
|
-
/**
|
|
146
|
-
* Property definitions with validation
|
|
147
|
-
*/
|
|
148
|
-
propertyMetadata: PropertyMetadata[];
|
|
149
|
-
/**
|
|
150
|
-
* Event definitions
|
|
151
|
-
*/
|
|
152
|
-
eventMetadata?: EventMetadata[];
|
|
153
|
-
/**
|
|
154
|
-
* Rendering capabilities
|
|
155
|
-
*/
|
|
156
|
-
capabilities: RenderingCapability;
|
|
157
|
-
/**
|
|
158
|
-
* Accessibility information
|
|
159
|
-
*/
|
|
160
|
-
accessibility: AccessibilityMetadata;
|
|
161
|
-
/**
|
|
162
|
-
* State management information
|
|
163
|
-
*/
|
|
164
|
-
state: StateMetadata;
|
|
165
|
-
/**
|
|
166
|
-
* Related components (alternatives, compositions)
|
|
167
|
-
*/
|
|
168
|
-
related?: {
|
|
169
|
-
alternatives?: string[]; // Similar components
|
|
170
|
-
compositions?: string[]; // Components often used with this one
|
|
171
|
-
containers?: string[]; // Common parent containers
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Usage examples for runtime
|
|
175
|
-
*/
|
|
176
|
-
usageExamples?: {
|
|
177
|
-
title: string;
|
|
178
|
-
description: string;
|
|
179
|
-
code: string;
|
|
180
|
-
}[];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ============================================================================
|
|
184
|
-
// Common Property Metadata
|
|
185
|
-
// ============================================================================
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Metadata for the 5 universal properties
|
|
189
|
-
*/
|
|
190
|
-
export const COMMON_PROPERTY_METADATA: Record<string, PropertyMetadata> = {
|
|
191
|
-
variant: {
|
|
192
|
-
name: 'variant',
|
|
193
|
-
type: 'enum',
|
|
194
|
-
required: false,
|
|
195
|
-
default: 'primary',
|
|
196
|
-
description: 'Visual style variant for the component',
|
|
197
|
-
enumValues: ['primary', 'secondary', 'destructive', 'ghost', 'outline'],
|
|
198
|
-
isCommon: true,
|
|
199
|
-
affectsLayout: false
|
|
200
|
-
},
|
|
201
|
-
size: {
|
|
202
|
-
name: 'size',
|
|
203
|
-
type: 'enum',
|
|
204
|
-
required: false,
|
|
205
|
-
default: 'medium',
|
|
206
|
-
description: 'Size of the component',
|
|
207
|
-
enumValues: ['small', 'medium', 'large'],
|
|
208
|
-
isCommon: true,
|
|
209
|
-
affectsLayout: true
|
|
210
|
-
},
|
|
211
|
-
color: {
|
|
212
|
-
name: 'color',
|
|
213
|
-
type: 'enum',
|
|
214
|
-
required: false,
|
|
215
|
-
default: 'primary',
|
|
216
|
-
description: 'Color scheme for the component',
|
|
217
|
-
enumValues: ['primary', 'success', 'warning', 'error', 'info'],
|
|
218
|
-
isCommon: true,
|
|
219
|
-
affectsLayout: false
|
|
220
|
-
},
|
|
221
|
-
position: {
|
|
222
|
-
name: 'position',
|
|
223
|
-
type: 'enum',
|
|
224
|
-
required: false,
|
|
225
|
-
default: 'top',
|
|
226
|
-
description: 'Position or alignment of the component',
|
|
227
|
-
enumValues: ['top', 'bottom', 'left', 'right'],
|
|
228
|
-
isCommon: true,
|
|
229
|
-
affectsLayout: true
|
|
230
|
-
},
|
|
231
|
-
orientation: {
|
|
232
|
-
name: 'orientation',
|
|
233
|
-
type: 'enum',
|
|
234
|
-
required: false,
|
|
235
|
-
default: 'horizontal',
|
|
236
|
-
description: 'Layout orientation of the component',
|
|
237
|
-
enumValues: ['horizontal', 'vertical'],
|
|
238
|
-
isCommon: true,
|
|
239
|
-
affectsLayout: true
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
// ============================================================================
|
|
244
|
-
// Component-Specific Metadata Registry
|
|
245
|
-
// ============================================================================
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Enhanced metadata for all atomic components
|
|
249
|
-
*/
|
|
250
|
-
export const COMPONENT_METADATA_REGISTRY: Record<string, ComponentMetadata> = {
|
|
251
|
-
// Data Display Components
|
|
252
|
-
table: {
|
|
253
|
-
...ATOMIC_COMPONENTS_REGISTRY.table,
|
|
254
|
-
propertyMetadata: [
|
|
255
|
-
{
|
|
256
|
-
name: 'columns',
|
|
257
|
-
type: 'array',
|
|
258
|
-
required: true,
|
|
259
|
-
description: 'Column definitions for the table',
|
|
260
|
-
validation: { min: 1 }
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: 'dataSource',
|
|
264
|
-
type: 'string',
|
|
265
|
-
required: true,
|
|
266
|
-
description: 'Model array name for table data'
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
name: 'sortable',
|
|
270
|
-
type: 'boolean',
|
|
271
|
-
required: false,
|
|
272
|
-
default: false,
|
|
273
|
-
description: 'Enable column sorting',
|
|
274
|
-
affectsLayout: false
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
name: 'filterable',
|
|
278
|
-
type: 'boolean',
|
|
279
|
-
required: false,
|
|
280
|
-
default: false,
|
|
281
|
-
description: 'Enable filtering',
|
|
282
|
-
affectsLayout: true
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: 'pagination',
|
|
286
|
-
type: 'boolean',
|
|
287
|
-
required: false,
|
|
288
|
-
default: true,
|
|
289
|
-
description: 'Enable pagination',
|
|
290
|
-
affectsLayout: true
|
|
291
|
-
},
|
|
292
|
-
COMMON_PROPERTY_METADATA.size
|
|
293
|
-
],
|
|
294
|
-
eventMetadata: [
|
|
295
|
-
{
|
|
296
|
-
name: 'onRowClick',
|
|
297
|
-
description: 'Fired when a row is clicked',
|
|
298
|
-
parameters: [
|
|
299
|
-
{ name: 'row', type: 'object', description: 'Clicked row data' },
|
|
300
|
-
{ name: 'index', type: 'number', description: 'Row index' }
|
|
301
|
-
]
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
name: 'onSort',
|
|
305
|
-
description: 'Fired when column sort changes',
|
|
306
|
-
parameters: [
|
|
307
|
-
{ name: 'column', type: 'string', description: 'Column key' },
|
|
308
|
-
{ name: 'direction', type: 'string', description: 'Sort direction (asc/desc)' }
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
],
|
|
312
|
-
capabilities: {
|
|
313
|
-
supportsChildren: false,
|
|
314
|
-
supportsConditional: true,
|
|
315
|
-
supportsList: true,
|
|
316
|
-
supportsSlots: false,
|
|
317
|
-
maxDepth: 1,
|
|
318
|
-
preferredPosition: 'leaf'
|
|
319
|
-
},
|
|
320
|
-
accessibility: {
|
|
321
|
-
role: 'table',
|
|
322
|
-
keyboardNavigable: true,
|
|
323
|
-
requiredAriaAttrs: ['aria-label'],
|
|
324
|
-
screenReaderDescription: 'Data table with {columns.length} columns'
|
|
325
|
-
},
|
|
326
|
-
state: {
|
|
327
|
-
hasInternalState: true,
|
|
328
|
-
stateProperties: [
|
|
329
|
-
{ name: 'sortColumn', type: 'string', description: 'Currently sorted column' },
|
|
330
|
-
{ name: 'sortDirection', type: 'string', description: 'Sort direction (asc/desc)' },
|
|
331
|
-
{ name: 'currentPage', type: 'number', description: 'Current page number', defaultValue: 1 }
|
|
332
|
-
]
|
|
333
|
-
},
|
|
334
|
-
related: {
|
|
335
|
-
alternatives: ['list', 'grid'],
|
|
336
|
-
compositions: ['pagination', 'search'],
|
|
337
|
-
containers: ['card', 'container']
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
button: {
|
|
342
|
-
...ATOMIC_COMPONENTS_REGISTRY.button,
|
|
343
|
-
propertyMetadata: [
|
|
344
|
-
COMMON_PROPERTY_METADATA.variant,
|
|
345
|
-
COMMON_PROPERTY_METADATA.size,
|
|
346
|
-
{
|
|
347
|
-
name: 'disabled',
|
|
348
|
-
type: 'boolean',
|
|
349
|
-
required: false,
|
|
350
|
-
default: false,
|
|
351
|
-
description: 'Disable button interaction'
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
name: 'loading',
|
|
355
|
-
type: 'boolean',
|
|
356
|
-
required: false,
|
|
357
|
-
default: false,
|
|
358
|
-
description: 'Show loading state'
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
name: 'label',
|
|
362
|
-
type: 'string',
|
|
363
|
-
required: false,
|
|
364
|
-
description: 'Button text label'
|
|
365
|
-
}
|
|
366
|
-
],
|
|
367
|
-
eventMetadata: [
|
|
368
|
-
{
|
|
369
|
-
name: 'onClick',
|
|
370
|
-
description: 'Fired when button is clicked',
|
|
371
|
-
parameters: [
|
|
372
|
-
{ name: 'event', type: 'MouseEvent', description: 'Click event' }
|
|
373
|
-
],
|
|
374
|
-
bubbles: true
|
|
375
|
-
}
|
|
376
|
-
],
|
|
377
|
-
capabilities: {
|
|
378
|
-
supportsChildren: true,
|
|
379
|
-
supportsConditional: true,
|
|
380
|
-
supportsList: false,
|
|
381
|
-
supportsSlots: false,
|
|
382
|
-
maxDepth: 1,
|
|
383
|
-
preferredPosition: 'leaf'
|
|
384
|
-
},
|
|
385
|
-
accessibility: {
|
|
386
|
-
role: 'button',
|
|
387
|
-
keyboardNavigable: true,
|
|
388
|
-
requiredAriaAttrs: ['aria-label'],
|
|
389
|
-
screenReaderDescription: '{variant} button: {label}'
|
|
390
|
-
},
|
|
391
|
-
state: {
|
|
392
|
-
hasInternalState: false
|
|
393
|
-
},
|
|
394
|
-
related: {
|
|
395
|
-
alternatives: ['link', 'icon-button'],
|
|
396
|
-
compositions: ['icon', 'badge'],
|
|
397
|
-
containers: ['form', 'card', 'toolbar']
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
|
|
401
|
-
card: {
|
|
402
|
-
...ATOMIC_COMPONENTS_REGISTRY.card,
|
|
403
|
-
propertyMetadata: [
|
|
404
|
-
{
|
|
405
|
-
name: 'title',
|
|
406
|
-
type: 'string',
|
|
407
|
-
required: false,
|
|
408
|
-
description: 'Card title'
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
name: 'elevation',
|
|
412
|
-
type: 'enum',
|
|
413
|
-
required: false,
|
|
414
|
-
default: 'medium',
|
|
415
|
-
description: 'Shadow depth',
|
|
416
|
-
enumValues: ['none', 'low', 'medium', 'high']
|
|
417
|
-
},
|
|
418
|
-
COMMON_PROPERTY_METADATA.size
|
|
419
|
-
],
|
|
420
|
-
capabilities: {
|
|
421
|
-
supportsChildren: true,
|
|
422
|
-
supportsConditional: true,
|
|
423
|
-
supportsList: true,
|
|
424
|
-
supportsSlots: true,
|
|
425
|
-
maxDepth: 3,
|
|
426
|
-
preferredPosition: 'container'
|
|
427
|
-
},
|
|
428
|
-
accessibility: {
|
|
429
|
-
role: 'article',
|
|
430
|
-
keyboardNavigable: false,
|
|
431
|
-
screenReaderDescription: 'Card: {title}'
|
|
432
|
-
},
|
|
433
|
-
state: {
|
|
434
|
-
hasInternalState: false
|
|
435
|
-
},
|
|
436
|
-
related: {
|
|
437
|
-
alternatives: ['panel', 'container'],
|
|
438
|
-
compositions: ['button', 'image', 'text', 'list'],
|
|
439
|
-
containers: ['grid', 'container']
|
|
440
|
-
}
|
|
441
|
-
},
|
|
442
|
-
|
|
443
|
-
input: {
|
|
444
|
-
...ATOMIC_COMPONENTS_REGISTRY.input,
|
|
445
|
-
propertyMetadata: [
|
|
446
|
-
{
|
|
447
|
-
name: 'type',
|
|
448
|
-
type: 'enum',
|
|
449
|
-
required: false,
|
|
450
|
-
default: 'text',
|
|
451
|
-
description: 'Input type',
|
|
452
|
-
enumValues: ['text', 'email', 'password', 'number', 'tel', 'url']
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
name: 'placeholder',
|
|
456
|
-
type: 'string',
|
|
457
|
-
required: false,
|
|
458
|
-
description: 'Placeholder text'
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
name: 'required',
|
|
462
|
-
type: 'boolean',
|
|
463
|
-
required: false,
|
|
464
|
-
default: false,
|
|
465
|
-
description: 'Field is required'
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
name: 'disabled',
|
|
469
|
-
type: 'boolean',
|
|
470
|
-
required: false,
|
|
471
|
-
default: false,
|
|
472
|
-
description: 'Disable input'
|
|
473
|
-
},
|
|
474
|
-
COMMON_PROPERTY_METADATA.size,
|
|
475
|
-
{
|
|
476
|
-
name: 'variant',
|
|
477
|
-
type: 'enum',
|
|
478
|
-
required: false,
|
|
479
|
-
default: 'outlined',
|
|
480
|
-
description: 'Visual style variant',
|
|
481
|
-
enumValues: ['filled', 'outlined', 'standard'],
|
|
482
|
-
isCommon: true
|
|
483
|
-
}
|
|
484
|
-
],
|
|
485
|
-
eventMetadata: [
|
|
486
|
-
{
|
|
487
|
-
name: 'onChange',
|
|
488
|
-
description: 'Fired when input value changes',
|
|
489
|
-
parameters: [
|
|
490
|
-
{ name: 'value', type: 'string', description: 'New value' },
|
|
491
|
-
{ name: 'event', type: 'Event', description: 'Change event' }
|
|
492
|
-
]
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
name: 'onBlur',
|
|
496
|
-
description: 'Fired when input loses focus',
|
|
497
|
-
parameters: [
|
|
498
|
-
{ name: 'event', type: 'FocusEvent', description: 'Blur event' }
|
|
499
|
-
]
|
|
500
|
-
}
|
|
501
|
-
],
|
|
502
|
-
capabilities: {
|
|
503
|
-
supportsChildren: false,
|
|
504
|
-
supportsConditional: true,
|
|
505
|
-
supportsList: false,
|
|
506
|
-
supportsSlots: false,
|
|
507
|
-
maxDepth: 0,
|
|
508
|
-
preferredPosition: 'leaf'
|
|
509
|
-
},
|
|
510
|
-
accessibility: {
|
|
511
|
-
role: 'textbox',
|
|
512
|
-
keyboardNavigable: true,
|
|
513
|
-
requiredAriaAttrs: ['aria-label', 'aria-required'],
|
|
514
|
-
screenReaderDescription: '{type} input: {placeholder}'
|
|
515
|
-
},
|
|
516
|
-
state: {
|
|
517
|
-
hasInternalState: true,
|
|
518
|
-
stateProperties: [
|
|
519
|
-
{ name: 'value', type: 'string', description: 'Current input value', defaultValue: '' },
|
|
520
|
-
{ name: 'isFocused', type: 'boolean', description: 'Input has focus', defaultValue: false }
|
|
521
|
-
]
|
|
522
|
-
},
|
|
523
|
-
related: {
|
|
524
|
-
alternatives: ['textarea', 'select'],
|
|
525
|
-
compositions: ['label', 'validation-message'],
|
|
526
|
-
containers: ['form', 'form-field']
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
|
|
530
|
-
modal: {
|
|
531
|
-
...ATOMIC_COMPONENTS_REGISTRY.modal,
|
|
532
|
-
propertyMetadata: [
|
|
533
|
-
{
|
|
534
|
-
name: 'title',
|
|
535
|
-
type: 'string',
|
|
536
|
-
required: false,
|
|
537
|
-
description: 'Modal title'
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
name: 'open',
|
|
541
|
-
type: 'boolean',
|
|
542
|
-
required: true,
|
|
543
|
-
description: 'Modal visibility state'
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
name: 'closable',
|
|
547
|
-
type: 'boolean',
|
|
548
|
-
required: false,
|
|
549
|
-
default: true,
|
|
550
|
-
description: 'Show close button'
|
|
551
|
-
},
|
|
552
|
-
COMMON_PROPERTY_METADATA.size
|
|
553
|
-
],
|
|
554
|
-
eventMetadata: [
|
|
555
|
-
{
|
|
556
|
-
name: 'onClose',
|
|
557
|
-
description: 'Fired when modal is closed',
|
|
558
|
-
parameters: []
|
|
559
|
-
}
|
|
560
|
-
],
|
|
561
|
-
capabilities: {
|
|
562
|
-
supportsChildren: true,
|
|
563
|
-
supportsConditional: true,
|
|
564
|
-
supportsList: false,
|
|
565
|
-
supportsSlots: true,
|
|
566
|
-
maxDepth: 2,
|
|
567
|
-
preferredPosition: 'root'
|
|
568
|
-
},
|
|
569
|
-
accessibility: {
|
|
570
|
-
role: 'dialog',
|
|
571
|
-
keyboardNavigable: true,
|
|
572
|
-
requiredAriaAttrs: ['aria-modal', 'aria-labelledby'],
|
|
573
|
-
screenReaderDescription: 'Modal dialog: {title}'
|
|
574
|
-
},
|
|
575
|
-
state: {
|
|
576
|
-
hasInternalState: true,
|
|
577
|
-
stateProperties: [
|
|
578
|
-
{ name: 'open', type: 'boolean', description: 'Modal open state', defaultValue: false }
|
|
579
|
-
]
|
|
580
|
-
},
|
|
581
|
-
related: {
|
|
582
|
-
alternatives: ['drawer', 'popover'],
|
|
583
|
-
compositions: ['button', 'form', 'card'],
|
|
584
|
-
containers: ['root']
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
|
|
588
|
-
badge: {
|
|
589
|
-
...ATOMIC_COMPONENTS_REGISTRY.badge,
|
|
590
|
-
propertyMetadata: [
|
|
591
|
-
{
|
|
592
|
-
name: 'content',
|
|
593
|
-
type: 'string',
|
|
594
|
-
required: false,
|
|
595
|
-
description: 'Badge content/label'
|
|
596
|
-
},
|
|
597
|
-
COMMON_PROPERTY_METADATA.variant,
|
|
598
|
-
COMMON_PROPERTY_METADATA.color,
|
|
599
|
-
{
|
|
600
|
-
name: 'variant',
|
|
601
|
-
type: 'enum',
|
|
602
|
-
required: false,
|
|
603
|
-
default: 'standard',
|
|
604
|
-
description: 'Badge style',
|
|
605
|
-
enumValues: ['dot', 'standard'],
|
|
606
|
-
isCommon: true
|
|
607
|
-
}
|
|
608
|
-
],
|
|
609
|
-
capabilities: {
|
|
610
|
-
supportsChildren: false,
|
|
611
|
-
supportsConditional: true,
|
|
612
|
-
supportsList: false,
|
|
613
|
-
supportsSlots: false,
|
|
614
|
-
maxDepth: 0,
|
|
615
|
-
preferredPosition: 'leaf'
|
|
616
|
-
},
|
|
617
|
-
accessibility: {
|
|
618
|
-
role: 'status',
|
|
619
|
-
keyboardNavigable: false,
|
|
620
|
-
screenReaderDescription: 'Badge: {content}'
|
|
621
|
-
},
|
|
622
|
-
state: {
|
|
623
|
-
hasInternalState: false
|
|
624
|
-
},
|
|
625
|
-
related: {
|
|
626
|
-
alternatives: ['chip', 'tag'],
|
|
627
|
-
compositions: ['icon', 'avatar'],
|
|
628
|
-
containers: ['button', 'card']
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
|
|
633
|
-
// ============================================================================
|
|
634
|
-
// Helper Functions
|
|
635
|
-
// ============================================================================
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Get metadata for a component type
|
|
639
|
-
*
|
|
640
|
-
* @param componentType - Component type from atomic registry
|
|
641
|
-
* @returns Component metadata or undefined
|
|
642
|
-
*/
|
|
643
|
-
export function getComponentMetadata(componentType: string): ComponentMetadata | undefined {
|
|
644
|
-
return COMPONENT_METADATA_REGISTRY[componentType];
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* Get all available component types with metadata
|
|
649
|
-
*
|
|
650
|
-
* @returns Array of component type names
|
|
651
|
-
*/
|
|
652
|
-
export function getAllComponentTypes(): string[] {
|
|
653
|
-
return Object.keys(COMPONENT_METADATA_REGISTRY);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* Get components by category
|
|
658
|
-
*
|
|
659
|
-
* @param category - Component category
|
|
660
|
-
* @returns Array of component metadata
|
|
661
|
-
*/
|
|
662
|
-
export function getComponentsByCategory(
|
|
663
|
-
category: ComponentMetadata['category']
|
|
664
|
-
): ComponentMetadata[] {
|
|
665
|
-
return Object.values(COMPONENT_METADATA_REGISTRY).filter(
|
|
666
|
-
comp => comp.category === category
|
|
667
|
-
);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* Get components that can contain children
|
|
672
|
-
*
|
|
673
|
-
* @returns Array of container component metadata
|
|
674
|
-
*/
|
|
675
|
-
export function getContainerComponents(): ComponentMetadata[] {
|
|
676
|
-
return Object.values(COMPONENT_METADATA_REGISTRY).filter(
|
|
677
|
-
comp => comp.capabilities.supportsChildren
|
|
678
|
-
);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* Get leaf components (cannot contain children)
|
|
683
|
-
*
|
|
684
|
-
* @returns Array of leaf component metadata
|
|
685
|
-
*/
|
|
686
|
-
export function getLeafComponents(): ComponentMetadata[] {
|
|
687
|
-
return Object.values(COMPONENT_METADATA_REGISTRY).filter(
|
|
688
|
-
comp => !comp.capabilities.supportsChildren
|
|
689
|
-
);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Check if a component supports a specific property
|
|
694
|
-
*
|
|
695
|
-
* @param componentType - Component type
|
|
696
|
-
* @param propertyName - Property name
|
|
697
|
-
* @returns True if property is supported
|
|
698
|
-
*/
|
|
699
|
-
export function supportsProperty(componentType: string, propertyName: string): boolean {
|
|
700
|
-
const metadata = getComponentMetadata(componentType);
|
|
701
|
-
if (!metadata) return false;
|
|
702
|
-
|
|
703
|
-
return metadata.propertyMetadata.some(prop => prop.name === propertyName);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Get property metadata for a component
|
|
708
|
-
*
|
|
709
|
-
* @param componentType - Component type
|
|
710
|
-
* @param propertyName - Property name
|
|
711
|
-
* @returns Property metadata or undefined
|
|
712
|
-
*/
|
|
713
|
-
export function getPropertyMetadata(
|
|
714
|
-
componentType: string,
|
|
715
|
-
propertyName: string
|
|
716
|
-
): PropertyMetadata | undefined {
|
|
717
|
-
const metadata = getComponentMetadata(componentType);
|
|
718
|
-
if (!metadata) return undefined;
|
|
719
|
-
|
|
720
|
-
return metadata.propertyMetadata.find(prop => prop.name === propertyName);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* Validate property value against metadata
|
|
725
|
-
*
|
|
726
|
-
* @param componentType - Component type
|
|
727
|
-
* @param propertyName - Property name
|
|
728
|
-
* @param value - Property value
|
|
729
|
-
* @returns Validation result with errors
|
|
730
|
-
*/
|
|
731
|
-
export function validatePropertyValue(
|
|
732
|
-
componentType: string,
|
|
733
|
-
propertyName: string,
|
|
734
|
-
value: any
|
|
735
|
-
): { valid: boolean; errors: string[] } {
|
|
736
|
-
const propMeta = getPropertyMetadata(componentType, propertyName);
|
|
737
|
-
if (!propMeta) {
|
|
738
|
-
return { valid: false, errors: [`Unknown property: ${propertyName}`] };
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
const errors: string[] = [];
|
|
742
|
-
|
|
743
|
-
// Type validation
|
|
744
|
-
if (propMeta.type === 'enum' && propMeta.enumValues) {
|
|
745
|
-
if (!propMeta.enumValues.includes(value)) {
|
|
746
|
-
errors.push(`Invalid enum value. Expected one of: ${propMeta.enumValues.join(', ')}`);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
// Validation rules
|
|
751
|
-
if (propMeta.validation) {
|
|
752
|
-
if (propMeta.validation.min !== undefined && value < propMeta.validation.min) {
|
|
753
|
-
errors.push(`Value must be >= ${propMeta.validation.min}`);
|
|
754
|
-
}
|
|
755
|
-
if (propMeta.validation.max !== undefined && value > propMeta.validation.max) {
|
|
756
|
-
errors.push(`Value must be <= ${propMeta.validation.max}`);
|
|
757
|
-
}
|
|
758
|
-
if (propMeta.validation.pattern && typeof value === 'string') {
|
|
759
|
-
const regex = new RegExp(propMeta.validation.pattern);
|
|
760
|
-
if (!regex.test(value)) {
|
|
761
|
-
errors.push(`Value must match pattern: ${propMeta.validation.pattern}`);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
return {
|
|
767
|
-
valid: errors.length === 0,
|
|
768
|
-
errors
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Get recommended components for composition
|
|
774
|
-
*
|
|
775
|
-
* @param componentType - Component type
|
|
776
|
-
* @returns Array of recommended component types
|
|
777
|
-
*/
|
|
778
|
-
export function getRecommendedCompositions(componentType: string): string[] {
|
|
779
|
-
const metadata = getComponentMetadata(componentType);
|
|
780
|
-
return metadata?.related?.compositions || [];
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Check if two components can be nested
|
|
785
|
-
*
|
|
786
|
-
* @param parentType - Parent component type
|
|
787
|
-
* @param childType - Child component type
|
|
788
|
-
* @returns True if nesting is allowed
|
|
789
|
-
*/
|
|
790
|
-
export function canNest(parentType: string, childType: string): boolean {
|
|
791
|
-
const parentMeta = getComponentMetadata(parentType);
|
|
792
|
-
const childMeta = getComponentMetadata(childType);
|
|
793
|
-
|
|
794
|
-
if (!parentMeta || !childMeta) return false;
|
|
795
|
-
|
|
796
|
-
// Parent must support children
|
|
797
|
-
if (!parentMeta.capabilities.supportsChildren) return false;
|
|
798
|
-
|
|
799
|
-
// Check depth constraints
|
|
800
|
-
if (childMeta.capabilities.preferredPosition === 'root') return false;
|
|
801
|
-
|
|
802
|
-
return true;
|
|
803
|
-
}
|