@kurot/ui-document 0.1.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/LICENSE +21 -0
- package/README.md +152 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/kurot/catalog/index.d.ts +2 -0
- package/dist/kurot/catalog/index.d.ts.map +1 -0
- package/dist/kurot/catalog/index.js +2 -0
- package/dist/kurot/catalog/index.js.map +1 -0
- package/dist/kurot/catalog/kurot-ui-foundation.d.ts +10 -0
- package/dist/kurot/catalog/kurot-ui-foundation.d.ts.map +1 -0
- package/dist/kurot/catalog/kurot-ui-foundation.js +91 -0
- package/dist/kurot/catalog/kurot-ui-foundation.js.map +1 -0
- package/dist/kurot/catalog/properties/basic-component-properties.d.ts +22 -0
- package/dist/kurot/catalog/properties/basic-component-properties.d.ts.map +1 -0
- package/dist/kurot/catalog/properties/basic-component-properties.js +171 -0
- package/dist/kurot/catalog/properties/basic-component-properties.js.map +1 -0
- package/dist/kurot/catalog/properties/foundation-properties.d.ts +14 -0
- package/dist/kurot/catalog/properties/foundation-properties.d.ts.map +1 -0
- package/dist/kurot/catalog/properties/foundation-properties.js +215 -0
- package/dist/kurot/catalog/properties/foundation-properties.js.map +1 -0
- package/dist/kurot/document/create.d.ts +46 -0
- package/dist/kurot/document/create.d.ts.map +1 -0
- package/dist/kurot/document/create.js +33 -0
- package/dist/kurot/document/create.js.map +1 -0
- package/dist/kurot/document/index.d.ts +4 -0
- package/dist/kurot/document/index.d.ts.map +1 -0
- package/dist/kurot/document/index.js +3 -0
- package/dist/kurot/document/index.js.map +1 -0
- package/dist/kurot/document/query.d.ts +10 -0
- package/dist/kurot/document/query.d.ts.map +1 -0
- package/dist/kurot/document/query.js +23 -0
- package/dist/kurot/document/query.js.map +1 -0
- package/dist/kurot/model/UIDocument.d.ts +27 -0
- package/dist/kurot/model/UIDocument.d.ts.map +1 -0
- package/dist/kurot/model/UIDocument.js +5 -0
- package/dist/kurot/model/UIDocument.js.map +1 -0
- package/dist/kurot/model/UINode.d.ts +23 -0
- package/dist/kurot/model/UINode.d.ts.map +1 -0
- package/dist/kurot/model/UINode.js +2 -0
- package/dist/kurot/model/UINode.js.map +1 -0
- package/dist/kurot/model/UIPropertyValue.d.ts +16 -0
- package/dist/kurot/model/UIPropertyValue.d.ts.map +1 -0
- package/dist/kurot/model/UIPropertyValue.js +2 -0
- package/dist/kurot/model/UIPropertyValue.js.map +1 -0
- package/dist/kurot/model/index.d.ts +5 -0
- package/dist/kurot/model/index.d.ts.map +1 -0
- package/dist/kurot/model/index.js +2 -0
- package/dist/kurot/model/index.js.map +1 -0
- package/dist/kurot/schema/UIComponentDefinition.d.ts +130 -0
- package/dist/kurot/schema/UIComponentDefinition.d.ts.map +1 -0
- package/dist/kurot/schema/UIComponentDefinition.js +2 -0
- package/dist/kurot/schema/UIComponentDefinition.js.map +1 -0
- package/dist/kurot/schema/UIComponentRegistry.d.ts +33 -0
- package/dist/kurot/schema/UIComponentRegistry.d.ts.map +1 -0
- package/dist/kurot/schema/UIComponentRegistry.js +127 -0
- package/dist/kurot/schema/UIComponentRegistry.js.map +1 -0
- package/dist/kurot/schema/UIComponentResolutionError.d.ts +19 -0
- package/dist/kurot/schema/UIComponentResolutionError.d.ts.map +1 -0
- package/dist/kurot/schema/UIComponentResolutionError.js +20 -0
- package/dist/kurot/schema/UIComponentResolutionError.js.map +1 -0
- package/dist/kurot/schema/index.d.ts +6 -0
- package/dist/kurot/schema/index.d.ts.map +1 -0
- package/dist/kurot/schema/index.js +4 -0
- package/dist/kurot/schema/index.js.map +1 -0
- package/dist/kurot/schema/validateComponentDefinition.d.ts +6 -0
- package/dist/kurot/schema/validateComponentDefinition.d.ts.map +1 -0
- package/dist/kurot/schema/validateComponentDefinition.js +145 -0
- package/dist/kurot/schema/validateComponentDefinition.js.map +1 -0
- package/dist/kurot/schema/validateUIDocumentComponents.d.ts +9 -0
- package/dist/kurot/schema/validateUIDocumentComponents.d.ts.map +1 -0
- package/dist/kurot/schema/validateUIDocumentComponents.js +135 -0
- package/dist/kurot/schema/validateUIDocumentComponents.js.map +1 -0
- package/dist/kurot/serialization/UIDocumentParseError.d.ts +12 -0
- package/dist/kurot/serialization/UIDocumentParseError.d.ts.map +1 -0
- package/dist/kurot/serialization/UIDocumentParseError.js +16 -0
- package/dist/kurot/serialization/UIDocumentParseError.js.map +1 -0
- package/dist/kurot/serialization/UIDocumentValidationError.d.ts +12 -0
- package/dist/kurot/serialization/UIDocumentValidationError.d.ts.map +1 -0
- package/dist/kurot/serialization/UIDocumentValidationError.js +16 -0
- package/dist/kurot/serialization/UIDocumentValidationError.js.map +1 -0
- package/dist/kurot/serialization/index.d.ts +4 -0
- package/dist/kurot/serialization/index.d.ts.map +1 -0
- package/dist/kurot/serialization/index.js +4 -0
- package/dist/kurot/serialization/index.js.map +1 -0
- package/dist/kurot/serialization/json.d.ts +10 -0
- package/dist/kurot/serialization/json.d.ts.map +1 -0
- package/dist/kurot/serialization/json.js +78 -0
- package/dist/kurot/serialization/json.js.map +1 -0
- package/dist/kurot/validation/UIDiagnostic.d.ts +30 -0
- package/dist/kurot/validation/UIDiagnostic.d.ts.map +1 -0
- package/dist/kurot/validation/UIDiagnostic.js +2 -0
- package/dist/kurot/validation/UIDiagnostic.js.map +1 -0
- package/dist/kurot/validation/index.d.ts +3 -0
- package/dist/kurot/validation/index.d.ts.map +1 -0
- package/dist/kurot/validation/index.js +2 -0
- package/dist/kurot/validation/index.js.map +1 -0
- package/dist/kurot/validation/validateUIDocument.d.ts +11 -0
- package/dist/kurot/validation/validateUIDocument.d.ts.map +1 -0
- package/dist/kurot/validation/validateUIDocument.js +143 -0
- package/dist/kurot/validation/validateUIDocument.js.map +1 -0
- package/dist/kurot/version.d.ts +5 -0
- package/dist/kurot/version.d.ts.map +1 -0
- package/dist/kurot/version.js +5 -0
- package/dist/kurot/version.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { UIComponentDefinition, UIResolvedComponentDefinition } from './UIComponentDefinition.js';
|
|
2
|
+
/**
|
|
3
|
+
* Isolated component catalog used by validators, editors, and Agent adapters.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UIComponentRegistry {
|
|
6
|
+
private readonly _definitions;
|
|
7
|
+
private readonly _resolvedDefinitions;
|
|
8
|
+
/**
|
|
9
|
+
* Adds a definition and rejects accidental replacement of an existing type.
|
|
10
|
+
*/
|
|
11
|
+
register(definition: UIComponentDefinition): void;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the registered definition for an exact component type key.
|
|
14
|
+
*/
|
|
15
|
+
get(type: string): UIComponentDefinition | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Returns whether an exact component type key is registered.
|
|
18
|
+
*/
|
|
19
|
+
has(type: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Returns all definitions sorted by type for deterministic tools and prompts.
|
|
22
|
+
*/
|
|
23
|
+
list(): readonly UIComponentDefinition[];
|
|
24
|
+
/**
|
|
25
|
+
* Resolves inherited properties and policies for one exact component type.
|
|
26
|
+
*/
|
|
27
|
+
resolve(type: string): UIResolvedComponentDefinition | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Resolves every definition in deterministic type order, including abstract bases.
|
|
30
|
+
*/
|
|
31
|
+
resolveAll(): readonly UIResolvedComponentDefinition[];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=UIComponentRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIComponentRegistry.d.ts","sourceRoot":"","sources":["../../../src/kurot/schema/UIComponentRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,qBAAqB,EAErB,6BAA6B,EAC7B,MAAM,4BAA4B,CAAC;AAIpC;;GAEG;AACH,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4C;IACzE,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAoD;IAEzF;;OAEG;IACI,QAAQ,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI;IASxD;;OAEG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAI3D;;OAEG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACI,IAAI,IAAI,SAAS,qBAAqB,EAAE;IAM/C;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,6BAA6B,GAAG,SAAS;IASvE;;OAEG;IACI,UAAU,IAAI,SAAS,6BAA6B,EAAE;CAQ7D"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { UIComponentResolutionError } from './UIComponentResolutionError.js';
|
|
2
|
+
import { validateComponentDefinition } from './validateComponentDefinition.js';
|
|
3
|
+
/**
|
|
4
|
+
* Isolated component catalog used by validators, editors, and Agent adapters.
|
|
5
|
+
*/
|
|
6
|
+
export class UIComponentRegistry {
|
|
7
|
+
_definitions = new Map();
|
|
8
|
+
_resolvedDefinitions = new Map();
|
|
9
|
+
/**
|
|
10
|
+
* Adds a definition and rejects accidental replacement of an existing type.
|
|
11
|
+
*/
|
|
12
|
+
register(definition) {
|
|
13
|
+
validateComponentDefinition(definition);
|
|
14
|
+
if (this._definitions.has(definition.type)) {
|
|
15
|
+
throw new Error(`Component type "${definition.type}" is already registered.`);
|
|
16
|
+
}
|
|
17
|
+
this._definitions.set(definition.type, normalizeDefinition(definition));
|
|
18
|
+
this._resolvedDefinitions.clear();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the registered definition for an exact component type key.
|
|
22
|
+
*/
|
|
23
|
+
get(type) {
|
|
24
|
+
return this._definitions.get(type);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns whether an exact component type key is registered.
|
|
28
|
+
*/
|
|
29
|
+
has(type) {
|
|
30
|
+
return this._definitions.has(type);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns all definitions sorted by type for deterministic tools and prompts.
|
|
34
|
+
*/
|
|
35
|
+
list() {
|
|
36
|
+
return Object.freeze([...this._definitions.values()].sort(compareDefinitions));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves inherited properties and policies for one exact component type.
|
|
40
|
+
*/
|
|
41
|
+
resolve(type) {
|
|
42
|
+
return resolveDefinition(type, this._definitions, this._resolvedDefinitions, []);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolves every definition in deterministic type order, including abstract bases.
|
|
46
|
+
*/
|
|
47
|
+
resolveAll() {
|
|
48
|
+
const resolved = [];
|
|
49
|
+
for (const definition of this.list()) {
|
|
50
|
+
const result = this.resolve(definition.type);
|
|
51
|
+
if (result)
|
|
52
|
+
resolved.push(result);
|
|
53
|
+
}
|
|
54
|
+
return Object.freeze(resolved);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function resolveDefinition(type, definitions, cache, chain) {
|
|
58
|
+
const cached = cache.get(type);
|
|
59
|
+
if (cached)
|
|
60
|
+
return cached;
|
|
61
|
+
const definition = definitions.get(type);
|
|
62
|
+
if (!definition)
|
|
63
|
+
return undefined;
|
|
64
|
+
const cycleStart = chain.indexOf(type);
|
|
65
|
+
if (cycleStart >= 0) {
|
|
66
|
+
const cycle = [...chain.slice(cycleStart), type];
|
|
67
|
+
throw new UIComponentResolutionError('circular-component-inheritance', `Circular component inheritance detected: ${cycle.join(' -> ')}.`, cycle);
|
|
68
|
+
}
|
|
69
|
+
const nextChain = [...chain, type];
|
|
70
|
+
let base;
|
|
71
|
+
if (definition.extends) {
|
|
72
|
+
base = resolveDefinition(definition.extends, definitions, cache, nextChain);
|
|
73
|
+
if (!base) {
|
|
74
|
+
throw new UIComponentResolutionError('missing-component-base', `Base component type "${definition.extends}" required by "${type}" is not registered.`, [...nextChain, definition.extends]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const resolved = Object.freeze({
|
|
78
|
+
type: definition.type,
|
|
79
|
+
baseTypes: Object.freeze(base ? [...base.baseTypes, base.type] : []),
|
|
80
|
+
abstract: definition.abstract ?? false,
|
|
81
|
+
displayName: definition.displayName,
|
|
82
|
+
description: definition.description,
|
|
83
|
+
children: definition.children ?? base?.children,
|
|
84
|
+
properties: mergeProperties(base?.properties, definition.properties),
|
|
85
|
+
allowUnknownProperties: definition.allowUnknownProperties ?? base?.allowUnknownProperties ?? false,
|
|
86
|
+
});
|
|
87
|
+
cache.set(type, resolved);
|
|
88
|
+
return resolved;
|
|
89
|
+
}
|
|
90
|
+
function compareDefinitions(a, b) {
|
|
91
|
+
return compareStrings(a.type, b.type);
|
|
92
|
+
}
|
|
93
|
+
function normalizeDefinition(definition) {
|
|
94
|
+
const properties = normalizeProperties(definition.properties ?? {});
|
|
95
|
+
return Object.freeze({ ...definition, properties });
|
|
96
|
+
}
|
|
97
|
+
function mergeProperties(base, derived) {
|
|
98
|
+
const merged = new Map(Object.entries(base ?? {}));
|
|
99
|
+
for (const [name, property] of Object.entries(derived ?? {})) {
|
|
100
|
+
merged.set(name, property);
|
|
101
|
+
}
|
|
102
|
+
const entries = [...merged.entries()].sort(([a], [b]) => compareStrings(a, b));
|
|
103
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
104
|
+
}
|
|
105
|
+
function compareStrings(a, b) {
|
|
106
|
+
if (a < b)
|
|
107
|
+
return -1;
|
|
108
|
+
if (a > b)
|
|
109
|
+
return 1;
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
function normalizeProperties(properties) {
|
|
113
|
+
const entries = Object.entries(properties).map(([name, property]) => [
|
|
114
|
+
name,
|
|
115
|
+
Object.freeze({
|
|
116
|
+
...property,
|
|
117
|
+
valueType: Array.isArray(property.valueType)
|
|
118
|
+
? Object.freeze([...property.valueType])
|
|
119
|
+
: property.valueType,
|
|
120
|
+
...(property.enumValues
|
|
121
|
+
? { enumValues: Object.freeze([...property.enumValues]) }
|
|
122
|
+
: {}),
|
|
123
|
+
}),
|
|
124
|
+
]);
|
|
125
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=UIComponentRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIComponentRegistry.js","sourceRoot":"","sources":["../../../src/kurot/schema/UIComponentRegistry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACd,YAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;IACxD,oBAAoB,GAAG,IAAI,GAAG,EAAyC,CAAC;IAEzF;;OAEG;IACI,QAAQ,CAAC,UAAiC;QAChD,2BAA2B,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,CAAC,IAAI,0BAA0B,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,IAAI;QACV,OAAO,MAAM,CAAC,M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G,CAC7C,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAkC,EAAE,CAAC;QACrD,IAAI;QACJ,MAAM,CAAC,MAAM,CAAC;YACb,GAAG,QAAQ;YACX,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAC3C,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;gBACxC,CAAC,CAAC,QAAQ,CAAC,SAAS;YACrB,GAAG,CAAC,QAAQ,CAAC,UAAU;gBACtB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE;gBACzD,CAAC,CAAC,EAAE,CAAC;SACN,CAAC;KACF,CACD,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable failure categories produced while resolving component inheritance.
|
|
3
|
+
*/
|
|
4
|
+
export type UIComponentResolutionErrorCode = 'circular-component-inheritance' | 'missing-component-base';
|
|
5
|
+
/**
|
|
6
|
+
* Error raised when registered component definitions cannot be resolved.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UIComponentResolutionError extends Error {
|
|
9
|
+
/**
|
|
10
|
+
* Stable category suitable for diagnostics and Agent feedback.
|
|
11
|
+
*/
|
|
12
|
+
readonly code: UIComponentResolutionErrorCode;
|
|
13
|
+
/**
|
|
14
|
+
* Resolution chain ending at the failing or repeated type.
|
|
15
|
+
*/
|
|
16
|
+
readonly chain: readonly string[];
|
|
17
|
+
constructor(code: UIComponentResolutionErrorCode, message: string, chain: readonly string[]);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=UIComponentResolutionError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIComponentResolutionError.d.ts","sourceRoot":"","sources":["../../../src/kurot/schema/UIComponentResolutionError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACvC,gCAAgC,GAChC,wBAAwB,CAAC;AAE5B;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACpD;;OAEG;IACH,SAAgB,IAAI,EAAE,8BAA8B,CAAC;IAErD;;OAEG;IACH,SAAgB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;gBAGxC,IAAI,EAAE,8BAA8B,EACpC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,MAAM,EAAE;CAOzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error raised when registered component definitions cannot be resolved.
|
|
3
|
+
*/
|
|
4
|
+
export class UIComponentResolutionError extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Stable category suitable for diagnostics and Agent feedback.
|
|
7
|
+
*/
|
|
8
|
+
code;
|
|
9
|
+
/**
|
|
10
|
+
* Resolution chain ending at the failing or repeated type.
|
|
11
|
+
*/
|
|
12
|
+
chain;
|
|
13
|
+
constructor(code, message, chain) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'UIComponentResolutionError';
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.chain = Object.freeze([...chain]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=UIComponentResolutionError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIComponentResolutionError.js","sourceRoot":"","sources":["../../../src/kurot/schema/UIComponentResolutionError.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACpD;;OAEG;IACa,IAAI,CAAiC;IAErD;;OAEG;IACa,KAAK,CAAoB;IAEzC,YACC,IAAoC,EACpC,OAAe,EACf,KAAwB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC;CACD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { UIChildrenPolicy, UIComponentDefinition, UIPropertyFormat, UIPropertyDefinition, UIPropertyValueType, UIResolvedComponentDefinition, } from './UIComponentDefinition.js';
|
|
2
|
+
export { UIComponentRegistry } from './UIComponentRegistry.js';
|
|
3
|
+
export { UIComponentResolutionError } from './UIComponentResolutionError.js';
|
|
4
|
+
export type { UIComponentResolutionErrorCode } from './UIComponentResolutionError.js';
|
|
5
|
+
export { validateUIDocumentComponents } from './validateUIDocumentComponents.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kurot/schema/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/kurot/schema/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UIComponentDefinition } from './UIComponentDefinition.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rejects malformed component metadata before it enters a registry.
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateComponentDefinition(definition: UIComponentDefinition): void;
|
|
6
|
+
//# sourceMappingURL=validateComponentDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateComponentDefinition.d.ts","sourceRoot":"","sources":["../../../src/kurot/schema/validateComponentDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,qBAAqB,EAIrB,MAAM,4BAA4B,CAAC;AAmBpC;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,CA4BnF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const CHILDREN_POLICIES = new Set(['multiple', 'none', 'single']);
|
|
2
|
+
const PROPERTY_VALUE_TYPES = new Set([
|
|
3
|
+
'array',
|
|
4
|
+
'boolean',
|
|
5
|
+
'number',
|
|
6
|
+
'object',
|
|
7
|
+
'string',
|
|
8
|
+
'value',
|
|
9
|
+
]);
|
|
10
|
+
const PROPERTY_FORMATS = new Set([
|
|
11
|
+
'color',
|
|
12
|
+
'layout',
|
|
13
|
+
'rectangle',
|
|
14
|
+
'resource',
|
|
15
|
+
'skin',
|
|
16
|
+
]);
|
|
17
|
+
/**
|
|
18
|
+
* Rejects malformed component metadata before it enters a registry.
|
|
19
|
+
*/
|
|
20
|
+
export function validateComponentDefinition(definition) {
|
|
21
|
+
assertNonEmpty(definition.type, 'Component type');
|
|
22
|
+
if (definition.extends !== undefined) {
|
|
23
|
+
assertNonEmpty(definition.extends, 'Base component type');
|
|
24
|
+
}
|
|
25
|
+
if (definition.abstract !== undefined && typeof definition.abstract !== 'boolean') {
|
|
26
|
+
throw new Error('Component abstract flag must be a boolean.');
|
|
27
|
+
}
|
|
28
|
+
if (definition.displayName !== undefined) {
|
|
29
|
+
assertNonEmpty(definition.displayName, 'Component display name');
|
|
30
|
+
}
|
|
31
|
+
if (definition.description !== undefined) {
|
|
32
|
+
assertNonEmpty(definition.description, 'Component description');
|
|
33
|
+
}
|
|
34
|
+
if (definition.children !== undefined && !CHILDREN_POLICIES.has(definition.children)) {
|
|
35
|
+
throw new Error(`Unsupported child policy "${String(definition.children)}".`);
|
|
36
|
+
}
|
|
37
|
+
if (definition.allowUnknownProperties !== undefined &&
|
|
38
|
+
typeof definition.allowUnknownProperties !== 'boolean') {
|
|
39
|
+
throw new Error('allowUnknownProperties must be a boolean.');
|
|
40
|
+
}
|
|
41
|
+
for (const [name, property] of Object.entries(definition.properties ?? {})) {
|
|
42
|
+
assertNonEmpty(name, 'Component property name');
|
|
43
|
+
validatePropertyDefinition(name, property);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function validatePropertyDefinition(name, definition) {
|
|
47
|
+
const valueTypes = Array.isArray(definition.valueType)
|
|
48
|
+
? definition.valueType
|
|
49
|
+
: [definition.valueType];
|
|
50
|
+
if (valueTypes.length === 0) {
|
|
51
|
+
throw new Error(`Property "${name}" must accept at least one value type.`);
|
|
52
|
+
}
|
|
53
|
+
const uniqueValueTypes = new Set();
|
|
54
|
+
for (const valueType of valueTypes) {
|
|
55
|
+
if (!PROPERTY_VALUE_TYPES.has(valueType)) {
|
|
56
|
+
throw new Error(`Unsupported value type "${String(valueType)}" for property "${name}".`);
|
|
57
|
+
}
|
|
58
|
+
if (uniqueValueTypes.has(valueType)) {
|
|
59
|
+
throw new Error(`Property "${name}" contains duplicate value type "${valueType}".`);
|
|
60
|
+
}
|
|
61
|
+
uniqueValueTypes.add(valueType);
|
|
62
|
+
}
|
|
63
|
+
if (definition.format !== undefined && !PROPERTY_FORMATS.has(definition.format)) {
|
|
64
|
+
throw new Error(`Unsupported format "${String(definition.format)}" for property "${name}".`);
|
|
65
|
+
}
|
|
66
|
+
if (definition.required !== undefined && typeof definition.required !== 'boolean') {
|
|
67
|
+
throw new Error(`Property "${name}" required flag must be a boolean.`);
|
|
68
|
+
}
|
|
69
|
+
if (definition.description !== undefined) {
|
|
70
|
+
assertNonEmpty(definition.description, `Property "${name}" description`);
|
|
71
|
+
}
|
|
72
|
+
if (definition.integer !== undefined && typeof definition.integer !== 'boolean') {
|
|
73
|
+
throw new Error(`Property "${name}" integer flag must be a boolean.`);
|
|
74
|
+
}
|
|
75
|
+
if (definition.integer &&
|
|
76
|
+
!uniqueValueTypes.has('number') &&
|
|
77
|
+
!uniqueValueTypes.has('value')) {
|
|
78
|
+
throw new Error(`Property "${name}" integer flag requires a numeric value type.`);
|
|
79
|
+
}
|
|
80
|
+
validateNumericConstraint(name, 'minimum', definition.minimum, uniqueValueTypes);
|
|
81
|
+
validateNumericConstraint(name, 'maximum', definition.maximum, uniqueValueTypes);
|
|
82
|
+
if (definition.minimum !== undefined &&
|
|
83
|
+
definition.maximum !== undefined &&
|
|
84
|
+
definition.minimum > definition.maximum) {
|
|
85
|
+
throw new Error(`Property "${name}" minimum cannot exceed its maximum.`);
|
|
86
|
+
}
|
|
87
|
+
validateEnumValues(name, definition, uniqueValueTypes);
|
|
88
|
+
if (definition.defaultValue !== undefined &&
|
|
89
|
+
!matchesPropertyConstraints(definition.defaultValue, definition, uniqueValueTypes)) {
|
|
90
|
+
throw new Error(`Property "${name}" default value does not satisfy its schema.`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function validateEnumValues(name, definition, valueTypes) {
|
|
94
|
+
const enumValues = definition.enumValues;
|
|
95
|
+
if (enumValues === undefined)
|
|
96
|
+
return;
|
|
97
|
+
if (!Array.isArray(enumValues) || enumValues.length === 0) {
|
|
98
|
+
throw new Error(`Property "${name}" enumValues must be a non-empty array.`);
|
|
99
|
+
}
|
|
100
|
+
for (const value of enumValues) {
|
|
101
|
+
if (!matchesPrimitiveType(value, valueTypes)) {
|
|
102
|
+
throw new Error(`Property "${name}" has an enum value outside its accepted types.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (let index = 0; index < enumValues.length; index++) {
|
|
106
|
+
if (enumValues.slice(0, index).some(value => Object.is(value, enumValues[index]))) {
|
|
107
|
+
throw new Error(`Property "${name}" contains duplicate enum values.`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function validateNumericConstraint(name, label, value, valueTypes) {
|
|
112
|
+
if (value === undefined)
|
|
113
|
+
return;
|
|
114
|
+
if (!Number.isFinite(value)) {
|
|
115
|
+
throw new Error(`Property "${name}" ${label} must be a finite number.`);
|
|
116
|
+
}
|
|
117
|
+
if (!valueTypes.has('number') && !valueTypes.has('value')) {
|
|
118
|
+
throw new Error(`Property "${name}" ${label} requires a numeric value type.`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function matchesPropertyConstraints(value, definition, valueTypes) {
|
|
122
|
+
if (!matchesPrimitiveType(value, valueTypes))
|
|
123
|
+
return false;
|
|
124
|
+
if (definition.enumValues && !definition.enumValues.some(item => Object.is(item, value))) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
if (typeof value !== 'number')
|
|
128
|
+
return true;
|
|
129
|
+
if (definition.minimum !== undefined && value < definition.minimum)
|
|
130
|
+
return false;
|
|
131
|
+
if (definition.maximum !== undefined && value > definition.maximum)
|
|
132
|
+
return false;
|
|
133
|
+
return !definition.integer || Number.isInteger(value);
|
|
134
|
+
}
|
|
135
|
+
function matchesPrimitiveType(value, valueTypes) {
|
|
136
|
+
if (typeof value === 'number' && !Number.isFinite(value))
|
|
137
|
+
return false;
|
|
138
|
+
return valueTypes.has('value') || valueTypes.has(typeof value);
|
|
139
|
+
}
|
|
140
|
+
function assertNonEmpty(value, label) {
|
|
141
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
142
|
+
throw new Error(`${label} must be a non-empty string.`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=validateComponentDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateComponentDefinition.js","sourceRoot":"","sources":["../../../src/kurot/schema/validateComponentDefinition.ts"],"names":[],"mappings":"AAQA,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpF,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAsB;IACzD,OAAO;IACP,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;CACP,CAAC,CAAC;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAmB;IAClD,OAAO;IACP,QAAQ;IACR,WAAW;IACX,UAAU;IACV,MAAM;CACN,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAAiC;IAC5E,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAClD,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACtC,cAAc,CAAC,UAAU,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QAC1C,cAAc,CAAC,UAAU,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QAC1C,cAAc,CAAC,UAAU,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,UAAU,C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AAO;QAAE,OAAO,KAAK,CAAC;IACjF,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,GAAG,UAAU,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACjF,OAAO,CAAC,UAAU,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,oBAAoB,CAC5B,KAAgC,EAChC,UAA4C;IAE5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvE,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,OAAO,KAA4B,CAAC,CAAC;AACvF,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,8BAA8B,CAAC,CAAC;IACzD,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UIDocument } from '../model/UIDocument.js';
|
|
2
|
+
import type { UIDiagnostic } from '../validation/UIDiagnostic.js';
|
|
3
|
+
import type { UIComponentRegistry } from './UIComponentRegistry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Validates component types, known properties, and child policies against a registry.
|
|
6
|
+
* The document must first pass validateUIDocument.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateUIDocumentComponents(document: UIDocument, registry: UIComponentRegistry): UIDiagnostic[];
|
|
9
|
+
//# sourceMappingURL=validateUIDocumentComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateUIDocumentComponents.d.ts","sourceRoot":"","sources":["../../../src/kurot/schema/validateUIDocumentComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAMlE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,mBAAmB,GAC3B,YAAY,EAAE,CAIhB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { UIComponentResolutionError } from './UIComponentResolutionError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates component types, known properties, and child policies against a registry.
|
|
4
|
+
* The document must first pass validateUIDocument.
|
|
5
|
+
*/
|
|
6
|
+
export function validateUIDocumentComponents(document, registry) {
|
|
7
|
+
const diagnostics = [];
|
|
8
|
+
validateNode(document.root, '$.root', registry, diagnostics);
|
|
9
|
+
return diagnostics;
|
|
10
|
+
}
|
|
11
|
+
function validateNode(node, path, registry, diagnostics) {
|
|
12
|
+
let definition;
|
|
13
|
+
try {
|
|
14
|
+
definition = registry.resolve(node.type);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (!(error instanceof UIComponentResolutionError))
|
|
18
|
+
throw error;
|
|
19
|
+
diagnostics.push({
|
|
20
|
+
code: error.code,
|
|
21
|
+
severity: 'error',
|
|
22
|
+
path: `${path}.type`,
|
|
23
|
+
message: error.message,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (!definition) {
|
|
27
|
+
if (!registry.has(node.type)) {
|
|
28
|
+
diagnostics.push({
|
|
29
|
+
code: 'unknown-component-type',
|
|
30
|
+
severity: 'error',
|
|
31
|
+
path: `${path}.type`,
|
|
32
|
+
message: `Component type "${node.type}" is not registered.`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (definition.abstract) {
|
|
38
|
+
diagnostics.push({
|
|
39
|
+
code: 'abstract-component-type',
|
|
40
|
+
severity: 'error',
|
|
41
|
+
path: `${path}.type`,
|
|
42
|
+
message: `Abstract component type "${node.type}" cannot be instantiated.`,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const properties = definition.properties;
|
|
46
|
+
for (const [name, property] of Object.entries(properties)) {
|
|
47
|
+
if (property.required && !Object.hasOwn(node.properties, name)) {
|
|
48
|
+
diagnostics.push({
|
|
49
|
+
code: 'missing-component-property',
|
|
50
|
+
severity: 'error',
|
|
51
|
+
path: `${path}.properties.${name}`,
|
|
52
|
+
message: `Required property "${name}" is missing from ${node.type}.`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (const [name, value] of Object.entries(node.properties)) {
|
|
57
|
+
const property = properties[name];
|
|
58
|
+
if (!property) {
|
|
59
|
+
if (!definition.allowUnknownProperties) {
|
|
60
|
+
diagnostics.push({
|
|
61
|
+
code: 'unknown-component-property',
|
|
62
|
+
severity: 'error',
|
|
63
|
+
path: `${path}.properties.${name}`,
|
|
64
|
+
message: `Property "${name}" is not defined for ${node.type}.`,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (!matchesProperty(value, property)) {
|
|
70
|
+
diagnostics.push({
|
|
71
|
+
code: 'invalid-component-property',
|
|
72
|
+
severity: 'error',
|
|
73
|
+
path: `${path}.properties.${name}`,
|
|
74
|
+
message: `Property "${name}" on ${node.type} does not satisfy its schema.`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
validateChildren(node, path, diagnostics, definition.children);
|
|
79
|
+
}
|
|
80
|
+
for (let index = 0; index < node.children.length; index++) {
|
|
81
|
+
validateNode(node.children[index], `${path}.children[${index}]`, registry, diagnostics);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function validateChildren(node, path, diagnostics, policy) {
|
|
85
|
+
const invalid = (policy === 'none' && node.children.length !== 0) ||
|
|
86
|
+
(policy === 'single' && node.children.length > 1);
|
|
87
|
+
if (!invalid)
|
|
88
|
+
return;
|
|
89
|
+
diagnostics.push({
|
|
90
|
+
code: 'invalid-component-children',
|
|
91
|
+
severity: 'error',
|
|
92
|
+
path: `${path}.children`,
|
|
93
|
+
message: policy === 'none'
|
|
94
|
+
? `Component ${node.type} does not accept children.`
|
|
95
|
+
: `Component ${node.type} accepts at most one child.`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function matchesProperty(value, property) {
|
|
99
|
+
const valueTypes = Array.isArray(property.valueType)
|
|
100
|
+
? property.valueType
|
|
101
|
+
: [property.valueType];
|
|
102
|
+
if (!valueTypes.some(valueType => matchesValueType(value, valueType)))
|
|
103
|
+
return false;
|
|
104
|
+
if (property.enumValues && !property.enumValues.some(item => Object.is(item, value))) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (typeof value === 'number') {
|
|
108
|
+
if (property.minimum !== undefined && value < property.minimum)
|
|
109
|
+
return false;
|
|
110
|
+
if (property.maximum !== undefined && value > property.maximum)
|
|
111
|
+
return false;
|
|
112
|
+
if (property.integer && !Number.isInteger(value))
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
function matchesValueType(value, valueType) {
|
|
118
|
+
switch (valueType) {
|
|
119
|
+
case 'array':
|
|
120
|
+
return Array.isArray(value);
|
|
121
|
+
case 'boolean':
|
|
122
|
+
return typeof value === 'boolean';
|
|
123
|
+
case 'number':
|
|
124
|
+
return typeof value === 'number';
|
|
125
|
+
case 'object':
|
|
126
|
+
return typeof value === 'object' && !Array.isArray(value);
|
|
127
|
+
case 'string':
|
|
128
|
+
return typeof value === 'string';
|
|
129
|
+
case 'value':
|
|
130
|
+
return true;
|
|
131
|
+
default:
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=validateUIDocumentComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateUIDocumentComponents.js","sourceRoot":"","sources":["../../../src/kurot/schema/validateUIDocumentComponents.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAC3C,QAAoB,EACpB,QAA6B;IAE7B,MAAM,WAAW,GAAmB,EAAE,CAAC;IACvC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC7D,OAAO,WAAW,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CACpB,IAAY,EACZ,IAAY,EACZ,QAA6B,EAC7B,WAA2B;IAE3B,IAAI,UAAqD,CAAC;IAC1D,IAAI,CAAC;QACJ,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,CAAC,KAAK,YAAY,0BAA0B,CAAC;YAAE,MAAM,KAAK,CAAC;QAChE,WAAW,CAAC,IAAI,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,GAAG,IAAI,OAAO;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;SACtB,CAAC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,WAAW,CAAC,IAAI,CAAC;gBAChB,IAAI,EAAE,wBAAwB;gBAC9B,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,GAAG,IAAI,OAAO;gBACpB,OAAO,EAAE,mBAAmB,IAAI,CAAC,IAAI,sBAAsB;aAC3D,CA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7B,KAAK,SAAS;YACb,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;QACnC,KAAK,QAAQ;YACZ,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;QAClC,KAAK,QAAQ;YACZ,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3D,KAAK,QAAQ;YACZ,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;QAClC,KAAK,OAAO;YACX,OAAO,IAAI,CAAC;QACb;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UIDiagnostic } from '../validation/UIDiagnostic.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error raised when JSON cannot be decoded as a current-format UI document.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UIDocumentParseError extends Error {
|
|
6
|
+
/**
|
|
7
|
+
* Structured failures suitable for editor and Agent feedback.
|
|
8
|
+
*/
|
|
9
|
+
readonly diagnostics: readonly UIDiagnostic[];
|
|
10
|
+
constructor(diagnostics: readonly UIDiagnostic[], cause?: Error);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=UIDocumentParseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIDocumentParseError.d.ts","sourceRoot":"","sources":["../../../src/kurot/serialization/UIDocumentParseError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C;;OAEG;IACH,SAAgB,WAAW,EAAE,SAAS,YAAY,EAAE,CAAC;gBAElC,WAAW,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,CAAC,EAAE,KAAK;CAMtE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error raised when JSON cannot be decoded as a current-format UI document.
|
|
3
|
+
*/
|
|
4
|
+
export class UIDocumentParseError extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Structured failures suitable for editor and Agent feedback.
|
|
7
|
+
*/
|
|
8
|
+
diagnostics;
|
|
9
|
+
constructor(diagnostics, cause) {
|
|
10
|
+
const detail = diagnostics[0]?.message ?? 'Unknown document error.';
|
|
11
|
+
super(`Unable to parse UI document: ${detail}`, { cause });
|
|
12
|
+
this.name = 'UIDocumentParseError';
|
|
13
|
+
this.diagnostics = diagnostics;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=UIDocumentParseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIDocumentParseError.js","sourceRoot":"","sources":["../../../src/kurot/serialization/UIDocumentParseError.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC9C;;OAEG;IACa,WAAW,CAA0B;IAErD,YAAmB,WAAoC,EAAE,KAAa;QACrE,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,yBAAyB,CAAC;QACpE,KAAK,CAAC,gCAAgC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UIDiagnostic } from '../validation/UIDiagnostic.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error raised when an in-memory document cannot be safely serialized.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UIDocumentValidationError extends Error {
|
|
6
|
+
/**
|
|
7
|
+
* Structured failures suitable for editor and Agent feedback.
|
|
8
|
+
*/
|
|
9
|
+
readonly diagnostics: readonly UIDiagnostic[];
|
|
10
|
+
constructor(diagnostics: readonly UIDiagnostic[]);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=UIDocumentValidationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIDocumentValidationError.d.ts","sourceRoot":"","sources":["../../../src/kurot/serialization/UIDocumentValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IACnD;;OAEG;IACH,SAAgB,WAAW,EAAE,SAAS,YAAY,EAAE,CAAC;gBAElC,WAAW,EAAE,SAAS,YAAY,EAAE;CAMvD"}
|