@jsonschema-editor/ui-schema 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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/dist/attribute-registry.d.ts +13 -0
  4. package/dist/attribute-registry.d.ts.map +1 -0
  5. package/dist/attribute-registry.js +56 -0
  6. package/dist/attribute-registry.js.map +1 -0
  7. package/dist/bridge/form-definition.d.ts +23 -0
  8. package/dist/bridge/form-definition.d.ts.map +1 -0
  9. package/dist/bridge/form-definition.js +39 -0
  10. package/dist/bridge/form-definition.js.map +1 -0
  11. package/dist/bridge/generator.d.ts +15 -0
  12. package/dist/bridge/generator.d.ts.map +1 -0
  13. package/dist/bridge/generator.js +74 -0
  14. package/dist/bridge/generator.js.map +1 -0
  15. package/dist/bridge/index.d.ts +4 -0
  16. package/dist/bridge/index.d.ts.map +1 -0
  17. package/dist/bridge/index.js +4 -0
  18. package/dist/bridge/index.js.map +1 -0
  19. package/dist/bridge/scope-resolution.d.ts +4 -0
  20. package/dist/bridge/scope-resolution.d.ts.map +1 -0
  21. package/dist/bridge/scope-resolution.js +34 -0
  22. package/dist/bridge/scope-resolution.js.map +1 -0
  23. package/dist/index.d.ts +7 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +7 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/model/categorization.d.ts +25 -0
  28. package/dist/model/categorization.d.ts.map +1 -0
  29. package/dist/model/categorization.js +49 -0
  30. package/dist/model/categorization.js.map +1 -0
  31. package/dist/model/control.d.ts +21 -0
  32. package/dist/model/control.d.ts.map +1 -0
  33. package/dist/model/control.js +46 -0
  34. package/dist/model/control.js.map +1 -0
  35. package/dist/model/custom-attributes.d.ts +14 -0
  36. package/dist/model/custom-attributes.d.ts.map +1 -0
  37. package/dist/model/custom-attributes.js +35 -0
  38. package/dist/model/custom-attributes.js.map +1 -0
  39. package/dist/model/document.d.ts +10 -0
  40. package/dist/model/document.d.ts.map +1 -0
  41. package/dist/model/document.js +16 -0
  42. package/dist/model/document.js.map +1 -0
  43. package/dist/model/factory.d.ts +24 -0
  44. package/dist/model/factory.d.ts.map +1 -0
  45. package/dist/model/factory.js +99 -0
  46. package/dist/model/factory.js.map +1 -0
  47. package/dist/model/index.d.ts +13 -0
  48. package/dist/model/index.d.ts.map +1 -0
  49. package/dist/model/index.js +13 -0
  50. package/dist/model/index.js.map +1 -0
  51. package/dist/model/label.d.ts +18 -0
  52. package/dist/model/label.d.ts.map +1 -0
  53. package/dist/model/label.js +35 -0
  54. package/dist/model/label.js.map +1 -0
  55. package/dist/model/layouts.d.ts +31 -0
  56. package/dist/model/layouts.d.ts.map +1 -0
  57. package/dist/model/layouts.js +64 -0
  58. package/dist/model/layouts.js.map +1 -0
  59. package/dist/model/node.d.ts +53 -0
  60. package/dist/model/node.d.ts.map +1 -0
  61. package/dist/model/node.js +154 -0
  62. package/dist/model/node.js.map +1 -0
  63. package/dist/model/simple-layout.d.ts +19 -0
  64. package/dist/model/simple-layout.d.ts.map +1 -0
  65. package/dist/model/simple-layout.js +41 -0
  66. package/dist/model/simple-layout.js.map +1 -0
  67. package/dist/model/stepper.d.ts +25 -0
  68. package/dist/model/stepper.d.ts.map +1 -0
  69. package/dist/model/stepper.js +49 -0
  70. package/dist/model/stepper.js.map +1 -0
  71. package/dist/model/ui-rule.d.ts +13 -0
  72. package/dist/model/ui-rule.d.ts.map +1 -0
  73. package/dist/model/ui-rule.js +26 -0
  74. package/dist/model/ui-rule.js.map +1 -0
  75. package/dist/model/visitor.d.ts +17 -0
  76. package/dist/model/visitor.d.ts.map +1 -0
  77. package/dist/model/visitor.js +2 -0
  78. package/dist/model/visitor.js.map +1 -0
  79. package/dist/parse.d.ts +7 -0
  80. package/dist/parse.d.ts.map +1 -0
  81. package/dist/parse.js +6 -0
  82. package/dist/parse.js.map +1 -0
  83. package/dist/scope.d.ts +3 -0
  84. package/dist/scope.d.ts.map +1 -0
  85. package/dist/scope.js +13 -0
  86. package/dist/scope.js.map +1 -0
  87. package/dist/types.d.ts +27 -0
  88. package/dist/types.d.ts.map +1 -0
  89. package/dist/types.js +2 -0
  90. package/dist/types.js.map +1 -0
  91. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JSON Schema Editor Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @jsonschema-editor/ui-schema
2
+
3
+ Eigenständiges, **streng objektorientiertes** UI-Schema-Datenmodell (JSON Forms-kompatibel).
4
+
5
+ ## Prinzipien
6
+
7
+ - **Vererbung**: `UiElement` → `UiLayout` / `Control` / `Label`
8
+ - **Kapselung**: `UiCustomAttributeCollection`, eigene `UiSchemaAttributeRegistry`
9
+ - **Polymorphie**: `accept(visitor)`, `deepClone()`
10
+ - **Fabrik**: `UiSchemaFactory`
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @jsonschema-editor/ui-schema
16
+ ```
17
+
18
+ Optional für die Bridge:
19
+
20
+ ```bash
21
+ npm install @jsonschema-editor/json-schema
22
+ ```
23
+
24
+ Entwicklung im Monorepo:
25
+
26
+ ```bash
27
+ pnpm install
28
+ pnpm run build
29
+ ```
30
+
31
+ ## Isoliert (ohne JSON Schema)
32
+
33
+ ```ts
34
+ import { UiSchemaFactory } from "@jsonschema-editor/ui-schema";
35
+
36
+ const factory = new UiSchemaFactory();
37
+ const ui = factory.createVerticalLayout([
38
+ factory.createControl("#/properties/name", "Name"),
39
+ ]);
40
+ ```
41
+
42
+ ## Bridge (mit JSON Schema)
43
+
44
+ ```ts
45
+ import { ObjectSchema, StringSchema } from "@jsonschema-editor/json-schema";
46
+ import { UiSchema, FormDefinition } from "@jsonschema-editor/ui-schema/bridge";
47
+
48
+ const schema = new ObjectSchema();
49
+ schema.setProperty("name", new StringSchema(), true);
50
+
51
+ const ui = UiSchema.generateForSchema(schema);
52
+ const doc = FormDefinition.fromJSON(schema.toJSON(), ui.toJSON());
53
+ ```
54
+
55
+ ## Kein JSON-Schema im Kern
56
+
57
+ Der Ordner `src/model/` importiert **nicht** aus `@jsonschema-editor/json-schema`.
58
+ Die Kopplung liegt ausschließlich in `src/bridge/`.
@@ -0,0 +1,13 @@
1
+ import type { UiAttributeDefinition, UiSchemaObject } from "./types.js";
2
+ export declare class UiSchemaAttributeRegistry {
3
+ private definitions;
4
+ register<T>(definition: UiAttributeDefinition<T>): this;
5
+ unregister(name: string): boolean;
6
+ get(name: string): UiAttributeDefinition | undefined;
7
+ list(): UiAttributeDefinition[];
8
+ isReservedKey(key: string): boolean;
9
+ readCustomAttributes(json: UiSchemaObject): Map<string, unknown>;
10
+ writeCustomAttributes(json: UiSchemaObject, values: Map<string, unknown>): void;
11
+ }
12
+ export declare const globalUiSchemaAttributeRegistry: UiSchemaAttributeRegistry;
13
+ //# sourceMappingURL=attribute-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-registry.d.ts","sourceRoot":"","sources":["../src/attribute-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAaxE,qBAAa,yBAAyB;IACpC,OAAO,CAAC,WAAW,CAA4C;IAE/D,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI;IAKvD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAIpD,IAAI,IAAI,qBAAqB,EAAE;IAI/B,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAInC,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAqBhE,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAOhF;AAED,eAAO,MAAM,+BAA+B,2BAAkC,CAAC"}
@@ -0,0 +1,56 @@
1
+ const RESERVED_KEYS = new Set([
2
+ "type",
3
+ "scope",
4
+ "label",
5
+ "text",
6
+ "i18n",
7
+ "elements",
8
+ "options",
9
+ "rule",
10
+ ]);
11
+ export class UiSchemaAttributeRegistry {
12
+ definitions = new Map();
13
+ register(definition) {
14
+ this.definitions.set(definition.name, definition);
15
+ return this;
16
+ }
17
+ unregister(name) {
18
+ return this.definitions.delete(name);
19
+ }
20
+ get(name) {
21
+ return this.definitions.get(name);
22
+ }
23
+ list() {
24
+ return [...this.definitions.values()];
25
+ }
26
+ isReservedKey(key) {
27
+ return RESERVED_KEYS.has(key);
28
+ }
29
+ readCustomAttributes(json) {
30
+ const result = new Map();
31
+ for (const [key, raw] of Object.entries(json)) {
32
+ if (this.isReservedKey(key))
33
+ continue;
34
+ const definition = this.definitions.get(key);
35
+ if (!definition)
36
+ continue;
37
+ const value = definition.deserialize
38
+ ? definition.deserialize(raw)
39
+ : raw ?? definition.defaultValue;
40
+ if (value !== undefined) {
41
+ result.set(key, value);
42
+ }
43
+ }
44
+ return result;
45
+ }
46
+ writeCustomAttributes(json, values) {
47
+ for (const [name, value] of values) {
48
+ const definition = this.definitions.get(name);
49
+ if (!definition)
50
+ continue;
51
+ json[name] = definition.serialize ? definition.serialize(value) : value;
52
+ }
53
+ }
54
+ }
55
+ export const globalUiSchemaAttributeRegistry = new UiSchemaAttributeRegistry();
56
+ //# sourceMappingURL=attribute-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-registry.js","sourceRoot":"","sources":["../src/attribute-registry.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,OAAO,yBAAyB;IAC5B,WAAW,GAAG,IAAI,GAAG,EAAiC,CAAC;IAE/D,QAAQ,CAAI,UAAoC;QAC9C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAmC,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,aAAa,CAAC,GAAW;QACvB,OAAO,aAAa,CAAC,GAAG,CAAC,GAAG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schema-editor/json-schema";
2
+ import type { SchemaDocument } from "@jsonschema-editor/json-schema";
3
+ import type { UiSchemaObject } from "../types.js";
4
+ import type { UiSchemaAttributeRegistry } from "../attribute-registry.js";
5
+ import type { UiElement } from "../model/node.js";
6
+ import { UiSchemaDocument } from "../model/document.js";
7
+ export declare class FormDefinition {
8
+ readonly schema: SchemaDocument;
9
+ readonly uiSchema: UiSchemaDocument;
10
+ constructor(schema: SchemaDocument, uiSchema: UiSchemaDocument);
11
+ static fromJSON(schemaJson: JsonSchemaObject, uiSchemaJson?: UiSchemaObject, schemaRegistry?: JsonSchemaAttributeRegistry, uiRegistry?: UiSchemaAttributeRegistry): FormDefinition;
12
+ toJSON(): {
13
+ schema: JsonSchemaObject;
14
+ uiSchema: UiSchemaObject;
15
+ };
16
+ }
17
+ /** Abwärtskompatibel: UiSchema mit statischen Fabrikmethoden */
18
+ export declare class UiSchema extends UiSchemaDocument {
19
+ constructor(root: UiElement);
20
+ static fromJSON(json: UiSchemaObject, registry?: UiSchemaAttributeRegistry): UiSchema;
21
+ static generateForSchema(schema: import("@jsonschema-editor/json-schema").SchemaNode, baseScope?: string, resolveRef?: import("./generator.js").SchemaRefResolver): UiSchema;
22
+ }
23
+ //# sourceMappingURL=form-definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-definition.d.ts","sourceRoot":"","sources":["../../src/bridge/form-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,qBAAa,cAAc;aAEP,MAAM,EAAE,cAAc;aACtB,QAAQ,EAAE,gBAAgB;gBAD1B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB;IAG5C,MAAM,CAAC,QAAQ,CACb,UAAU,EAAE,gBAAgB,EAC5B,YAAY,CAAC,EAAE,cAAc,EAC7B,cAAc,CAAC,EAAE,2BAA2B,EAC5C,UAAU,CAAC,EAAE,yBAAyB,GACrC,cAAc;IAajB,MAAM,IAAI;QAAE,MAAM,EAAE,gBAAgB,CAAC;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAE;CAMjE;AAED,gEAAgE;AAChE,qBAAa,QAAS,SAAQ,gBAAgB;gBAChC,IAAI,EAAE,SAAS;IAI3B,MAAM,CAAC,QAAQ,CACb,IAAI,EAAE,cAAc,EACpB,QAAQ,CAAC,EAAE,yBAAyB,GACnC,QAAQ;IAIX,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,OAAO,gCAAgC,EAAE,UAAU,EAC3D,SAAS,SAAM,EACf,UAAU,CAAC,EAAE,OAAO,gBAAgB,EAAE,iBAAiB,GACtD,QAAQ;CAIZ"}
@@ -0,0 +1,39 @@
1
+ import { documentFromJSON } from "@jsonschema-editor/json-schema";
2
+ import { uiSchemaFromJSON } from "../parse.js";
3
+ import { UiSchemaDocument } from "../model/document.js";
4
+ import { UiSchemaGenerator } from "./generator.js";
5
+ export class FormDefinition {
6
+ schema;
7
+ uiSchema;
8
+ constructor(schema, uiSchema) {
9
+ this.schema = schema;
10
+ this.uiSchema = uiSchema;
11
+ }
12
+ static fromJSON(schemaJson, uiSchemaJson, schemaRegistry, uiRegistry) {
13
+ const schema = documentFromJSON(schemaJson, schemaRegistry);
14
+ const uiSchema = uiSchemaJson
15
+ ? new UiSchemaDocument(uiSchemaFromJSON(uiSchemaJson, uiRegistry))
16
+ : new UiSchemaGenerator().generateForSchema(schema.root, "#", (ref) => schema.resolveRef(ref));
17
+ return new FormDefinition(schema, uiSchema);
18
+ }
19
+ toJSON() {
20
+ return {
21
+ schema: this.schema.toJSON(),
22
+ uiSchema: this.uiSchema.toJSON(),
23
+ };
24
+ }
25
+ }
26
+ /** Abwärtskompatibel: UiSchema mit statischen Fabrikmethoden */
27
+ export class UiSchema extends UiSchemaDocument {
28
+ constructor(root) {
29
+ super(root);
30
+ }
31
+ static fromJSON(json, registry) {
32
+ return new UiSchema(uiSchemaFromJSON(json, registry));
33
+ }
34
+ static generateForSchema(schema, baseScope = "#", resolveRef) {
35
+ const document = new UiSchemaGenerator().generateForSchema(schema, baseScope, resolveRef);
36
+ return new UiSchema(document.root);
37
+ }
38
+ }
39
+ //# sourceMappingURL=form-definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-definition.js","sourceRoot":"","sources":["../../src/bridge/form-definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,OAAO,cAAc;IAEP;IACA;IAFlB,YACkB,MAAsB,EACtB,QAA0B;QAD1B,WAAM,GAAN,MAAM,CAAgB;QACtB,aAAQ,GAAR,QAAQ,CAAkB;IACzC,CAAC;IAEJ,MAAM,CAAC,QAAQ,CACb,UAA4B,EAC5B,YAA6B,EAC7B,cAA4C,EAC5C,UAAsC;QAEtC,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC5D,MAAM,QAAQ,GAAG,YAAY;YAC3B,CAAC,CAAC,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;YAClE,CAAC,CAAC,IAAI,iBAAiB,EAAE,CAAC,iBAAiB,CACvC,MAAM,CAAC,IAAI,EACX,GAAG,EACH,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAChC,CAAC;QAEN,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM;QACJ,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;SACjC,CAAC;IACJ,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,OAAO,QAAS,SAAQ,gBAAgB;IAC5C,YAAY,IAAe;QACzB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED,MAAM,CAAC,QAAQ,CACb,IAAoB,EACpB,QAAoC;QAEpC,OAAO,IAAI,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,iBAAiB,CACtB,MAA2D,EAC3D,SAAS,GAAG,GAAG,EACf,UAAuD;QAEvD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QAC1F,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import type { SchemaNode } from "@jsonschema-editor/json-schema";
2
+ import { UiSchemaDocument, UiSchemaFactory } from "../model/index.js";
3
+ export type SchemaRefResolver = (ref: string) => SchemaNode | undefined;
4
+ export declare class UiSchemaGenerator {
5
+ private readonly factory;
6
+ constructor(factory?: UiSchemaFactory);
7
+ generateForSchema(schema: SchemaNode, baseScope?: string, resolveRef?: SchemaRefResolver): UiSchemaDocument;
8
+ private resolveSchema;
9
+ private buildControlsForSchema;
10
+ /** Unterobjekte als Group + VerticalLayout, damit das Layout im UI-Editor anpassbar ist. */
11
+ private buildPropertyUi;
12
+ }
13
+ export declare function resolveSchemaAtScope(rootSchema: SchemaNode, scope: string, resolveRef?: (ref: string) => SchemaNode | undefined): SchemaNode | undefined;
14
+ export { Control, VerticalLayout } from "../model/index.js";
15
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bridge/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,UAAU,EACX,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,gBAAgB,EAChB,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;AAExE,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,GAAE,eAAuC;IAE7E,iBAAiB,CACf,MAAM,EAAE,UAAU,EAClB,SAAS,SAAM,EACf,UAAU,CAAC,EAAE,iBAAiB,GAC7B,gBAAgB;IAKnB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,sBAAsB;IAsC9B,4FAA4F;IAC5F,OAAO,CAAC,eAAe;CAuBxB;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,GACnD,UAAU,GAAG,SAAS,CAQxB;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { RefSchema } from "@jsonschema-editor/json-schema";
2
+ import { UiSchemaDocument, UiSchemaFactory, } from "../model/index.js";
3
+ import { buildPropertyScope } from "../scope.js";
4
+ export class UiSchemaGenerator {
5
+ factory;
6
+ constructor(factory = new UiSchemaFactory()) {
7
+ this.factory = factory;
8
+ }
9
+ generateForSchema(schema, baseScope = "#", resolveRef) {
10
+ const elements = this.buildControlsForSchema(schema, baseScope, resolveRef);
11
+ return new UiSchemaDocument(this.factory.createVerticalLayout(elements));
12
+ }
13
+ resolveSchema(schema, resolveRef) {
14
+ if (!(schema instanceof RefSchema) || !resolveRef)
15
+ return schema;
16
+ const resolved = resolveRef(schema.ref);
17
+ return resolved ? this.resolveSchema(resolved, resolveRef) : schema;
18
+ }
19
+ buildControlsForSchema(schema, scope, resolveRef) {
20
+ schema = this.resolveSchema(schema, resolveRef);
21
+ if (schema.kind === "object") {
22
+ const objectSchema = schema;
23
+ const elements = [];
24
+ for (const [name, propSchema] of objectSchema.properties) {
25
+ const propScope = buildPropertyScope(scope, name);
26
+ elements.push(...this.buildPropertyUi(propSchema, propScope, name, resolveRef));
27
+ }
28
+ return elements;
29
+ }
30
+ if (schema.kind === "composition") {
31
+ const comp = schema;
32
+ const elements = [];
33
+ for (const branch of comp.allOf) {
34
+ elements.push(...this.buildControlsForSchema(branch, scope, resolveRef));
35
+ }
36
+ if (comp.oneOf.length > 0 || comp.anyOf.length > 0) {
37
+ elements.push(this.factory.createControl(scope, comp.title ?? "Variante"));
38
+ }
39
+ return elements;
40
+ }
41
+ const label = schema.title ?? scope.split("/").pop() ?? "Feld";
42
+ return [this.factory.createControl(scope, label)];
43
+ }
44
+ /** Unterobjekte als Group + VerticalLayout, damit das Layout im UI-Editor anpassbar ist. */
45
+ buildPropertyUi(schema, scope, name, resolveRef) {
46
+ schema = this.resolveSchema(schema, resolveRef);
47
+ if (schema.kind === "object") {
48
+ const objectSchema = schema;
49
+ const inner = this.buildControlsForSchema(objectSchema, scope, resolveRef);
50
+ const layout = this.factory.createVerticalLayout(inner);
51
+ return [this.factory.createGroup(objectSchema.title ?? name, [layout])];
52
+ }
53
+ if (schema.kind === "composition") {
54
+ const inner = this.buildControlsForSchema(schema, scope, resolveRef);
55
+ if (inner.length === 1)
56
+ return inner;
57
+ return [this.factory.createGroup(schema.title ?? name, inner)];
58
+ }
59
+ return this.buildControlsForSchema(schema, scope, resolveRef);
60
+ }
61
+ }
62
+ export function resolveSchemaAtScope(rootSchema, scope, resolveRef) {
63
+ let node = rootSchema.resolveAtScope(scope);
64
+ if (!node)
65
+ return undefined;
66
+ if (node instanceof RefSchema && resolveRef) {
67
+ const resolved = resolveRef(node.ref);
68
+ if (resolved)
69
+ node = resolved;
70
+ }
71
+ return node;
72
+ }
73
+ export { Control, VerticalLayout } from "../model/index.js";
74
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/bridge/generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,eAAe,GAEhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,UAA2B,IAAI,eAAe,EAAE;QAAhD,YAAO,GAAP,OAAO,CAAyC;IAAG,CAAC;IAEjF,iBAAiB,CACf,MAAkB,EAClB,SAAS,GAAG,GAAG,EACf,UAA8B;QAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QAC5E,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3E,CAAC;IAEO,aAAa,CAAC,MAAkB,EAAE,UAA8B;QACtE,IAAI,CAAC,CAAC,MAAM,YAAY,SAAS,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO,MAAM,CAAC;QACjE,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,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UAAU,oBAAoB,CAClC,UAAsB,EACtB,KAAa,EACb,UAAoD;IAEpD,IAAI,IAAI,GAAG,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,IAAI,IAAI,YAAY,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,QAAQ;YAAE,IAAI,GAAG,QAAQ,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { UiSchemaGenerator, resolveSchemaAtScope, Control, VerticalLayout, } from "./generator.js";
2
+ export { resolveCompositionAtScope } from "./scope-resolution.js";
3
+ export { FormDefinition, UiSchema } from "./form-definition.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { UiSchemaGenerator, resolveSchemaAtScope, Control, VerticalLayout, } from "./generator.js";
2
+ export { resolveCompositionAtScope } from "./scope-resolution.js";
3
+ export { FormDefinition, UiSchema } from "./form-definition.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { CompositionSchema, type SchemaNode } from "@jsonschema-editor/json-schema";
2
+ /** Liefert die oneOf-/anyOf-Komposition am UI-Scope (JSON-Forms-Muster). */
3
+ export declare function resolveCompositionAtScope(rootSchema: SchemaNode, scope: string): CompositionSchema | undefined;
4
+ //# sourceMappingURL=scope-resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-resolution.d.ts","sourceRoot":"","sources":["../../src/bridge/scope-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,KAAK,UAAU,EAChB,MAAM,gCAAgC,CAAC;AAkBxC,4EAA4E;AAC5E,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,GACZ,iBAAiB,GAAG,SAAS,CAmB/B"}
@@ -0,0 +1,34 @@
1
+ import { CompositionSchema, ObjectSchema, } from "@jsonschema-editor/json-schema";
2
+ import { scopeToPath } from "../scope.js";
3
+ function isVariantComposition(node) {
4
+ return (node instanceof CompositionSchema && (node.oneOf.length > 0 || node.anyOf.length > 0));
5
+ }
6
+ function descendForScope(current, segment) {
7
+ if (current instanceof CompositionSchema) {
8
+ const merged = current.mergeToObject();
9
+ if (merged)
10
+ current = merged;
11
+ }
12
+ if (!(current instanceof ObjectSchema))
13
+ return undefined;
14
+ return current.getProperty(segment);
15
+ }
16
+ /** Liefert die oneOf-/anyOf-Komposition am UI-Scope (JSON-Forms-Muster). */
17
+ export function resolveCompositionAtScope(rootSchema, scope) {
18
+ const segments = scopeToPath(scope);
19
+ if (segments.length === 0) {
20
+ return isVariantComposition(rootSchema) ? rootSchema : undefined;
21
+ }
22
+ let current = rootSchema;
23
+ for (let i = 0; i < segments.length; i++) {
24
+ const next = descendForScope(current, segments[i]);
25
+ if (!next)
26
+ return undefined;
27
+ current = next;
28
+ if (i === segments.length - 1 && isVariantComposition(current)) {
29
+ return current;
30
+ }
31
+ }
32
+ return undefined;
33
+ }
34
+ //# sourceMappingURL=scope-resolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-resolution.js","sourceRoot":"","sources":["../../src/bridge/scope-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,GAEb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,SAAS,oBAAoB,CAAC,IAAgB;IAC5C,OAAO,CACL,IAAI,YAAY,iBAAiB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CACtF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,OAAmB,EAAE,OAAe;IAC3D,IAAI,OAAO,YAAY,iBAAiB,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QACvC,IAAI,MAAM;YAAE,OAAO,GAAG,MAAM,CAAC;IAC/B,CAAC;IACD,IAAI,CAAC,CAAC,OAAO,YAAY,YAAY,CAAC;QAAE,OAAO,SAAS,CAAC;IACzD,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,yBAAyB,CACvC,UAAsB,EACtB,KAAa;IAEb,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAEpC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAED,IAAI,OAAO,GAAe,UAAU,CAAC;IAErC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/D,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./types.js";
2
+ export * from "./attribute-registry.js";
3
+ export * from "./scope.js";
4
+ export { UiElement, UiLayout, Control, VerticalLayout, HorizontalLayout, Group, Label, Categorization, Category, Stepper, Step, UiSchemaDocument, UiSchemaFactory, defaultUiSchemaFactory, type UiElementKind, type UiElementVisitor, } from "./model/index.js";
5
+ export { uiSchemaFromJSON } from "./parse.js";
6
+ export { UiRule, type UiRuleEffect, type UiRuleObject } from "./model/ui-rule.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,cAAc,EACd,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./types.js";
2
+ export * from "./attribute-registry.js";
3
+ export * from "./scope.js";
4
+ export { UiElement, UiLayout, Control, VerticalLayout, HorizontalLayout, Group, Label, Categorization, Category, Stepper, Step, UiSchemaDocument, UiSchemaFactory, defaultUiSchemaFactory, } from "./model/index.js";
5
+ export { uiSchemaFromJSON } from "./parse.js";
6
+ export { UiRule } from "./model/ui-rule.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,cAAc,EACd,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,eAAe,EACf,sBAAsB,GAGvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAwC,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { UiSchemaAttributeRegistry } from "../attribute-registry.js";
2
+ import type { UiSchemaObject } from "../types.js";
3
+ import { UiCustomAttributeCollection } from "./custom-attributes.js";
4
+ import type { UiSchemaFactory } from "./factory.js";
5
+ import type { UiElement } from "./node.js";
6
+ import { LabeledLayout, UnlabeledLayout } from "./simple-layout.js";
7
+ import type { UiElementVisitor } from "./visitor.js";
8
+ export declare class Categorization extends UnlabeledLayout {
9
+ readonly elementKind: "Categorization";
10
+ constructor(registry?: UiSchemaAttributeRegistry, customAttributes?: UiCustomAttributeCollection);
11
+ protected validateChild(child: UiElement): void;
12
+ static fromJSON(json: UiSchemaObject, factory: UiSchemaFactory): Categorization;
13
+ accept<T>(visitor: UiElementVisitor<T>): T;
14
+ deepClone(): Categorization;
15
+ protected writeElementDefinition(json: UiSchemaObject): void;
16
+ }
17
+ export declare class Category extends LabeledLayout {
18
+ readonly elementKind: "Category";
19
+ constructor(label?: string, registry?: UiSchemaAttributeRegistry, customAttributes?: UiCustomAttributeCollection);
20
+ static fromJSON(json: UiSchemaObject, factory: UiSchemaFactory): Category;
21
+ accept<T>(visitor: UiElementVisitor<T>): T;
22
+ deepClone(): Category;
23
+ protected writeElementDefinition(json: UiSchemaObject): void;
24
+ }
25
+ //# sourceMappingURL=categorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"categorization.d.ts","sourceRoot":"","sources":["../../src/model/categorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,qBAAa,cAAe,SAAQ,eAAe;IACjD,QAAQ,CAAC,WAAW,EAAG,gBAAgB,CAAU;gBAG/C,QAAQ,CAAC,EAAE,yBAAyB,EACpC,gBAAgB,CAAC,EAAE,2BAA2B;IAKhD,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAM/C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,GAAG,cAAc;IAM/E,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;IAI1C,SAAS,IAAI,cAAc;IAI3B,SAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;CAG7D;AAED,qBAAa,QAAS,SAAQ,aAAa;IACzC,QAAQ,CAAC,WAAW,EAAG,UAAU,CAAU;gBAGzC,KAAK,CAAC,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,yBAAyB,EACpC,gBAAgB,CAAC,EAAE,2BAA2B;IAMhD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,GAAG,QAAQ;IAMzE,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;IAI1C,SAAS,IAAI,QAAQ;IAIrB,SAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;CAG7D"}
@@ -0,0 +1,49 @@
1
+ import { UiCustomAttributeCollection } from "./custom-attributes.js";
2
+ import { LabeledLayout, UnlabeledLayout } from "./simple-layout.js";
3
+ export class Categorization extends UnlabeledLayout {
4
+ elementKind = "Categorization";
5
+ constructor(registry, customAttributes) {
6
+ super(customAttributes ?? new UiCustomAttributeCollection(registry));
7
+ }
8
+ validateChild(child) {
9
+ if (child.elementKind !== "Category") {
10
+ throw new Error("Categorization darf nur Category-Elemente enthalten.");
11
+ }
12
+ }
13
+ static fromJSON(json, factory) {
14
+ const node = new Categorization(factory.attributeRegistry);
15
+ node.populateFromJSON(json, factory);
16
+ return node;
17
+ }
18
+ accept(visitor) {
19
+ return visitor.visitCategorization(this);
20
+ }
21
+ deepClone() {
22
+ return this.finishClone(new Categorization(undefined, this.cloneAttributes()));
23
+ }
24
+ writeElementDefinition(json) {
25
+ this.writeUnlabeledDefinition(json);
26
+ }
27
+ }
28
+ export class Category extends LabeledLayout {
29
+ elementKind = "Category";
30
+ constructor(label, registry, customAttributes) {
31
+ super(customAttributes ?? new UiCustomAttributeCollection(registry));
32
+ this._label = label;
33
+ }
34
+ static fromJSON(json, factory) {
35
+ const node = new Category(json.label, factory.attributeRegistry);
36
+ node.populateFromJSON(json, factory);
37
+ return node;
38
+ }
39
+ accept(visitor) {
40
+ return visitor.visitCategory(this);
41
+ }
42
+ deepClone() {
43
+ return this.finishClone(new Category(this._label, undefined, this.cloneAttributes()));
44
+ }
45
+ writeElementDefinition(json) {
46
+ this.writeLabeledDefinition(json);
47
+ }
48
+ }
49
+ //# sourceMappingURL=categorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"categorization.js","sourceRoot":"","sources":["../../src/model/categorization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,MAAM,OAAO,cAAe,SAAQ,eAAe;IACxC,WAAW,GAAG,gBAAyB,CAAC;IAEjD,YACE,QAAoC,EACpC,gBAA8C;QAE9C,KAAK,CAAC,gBAAgB,IAAI,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,CAAC;IAES,aAAa,CAAC,KAAgB;QACtC,IAAI,KAAK,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAoB,EAAE,OAAwB;QAC5D,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAI,OAA4B;QACpC,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC;IAES,sBAAsB,CAAC,IAAoB;QACnD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,aAAa;IAChC,WAAW,GAAG,UAAmB,CAAC;IAE3C,YACE,KAAc,EACd,QAAoC,EACpC,gBAA8C;QAE9C,KAAK,CAAC,gBAAgB,IAAI,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAoB,EAAE,OAAwB;QAC5D,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACjE,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAI,OAA4B;QACpC,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC;IAES,sBAAsB,CAAC,IAAoB;QACnD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import type { UiSchemaAttributeRegistry } from "../attribute-registry.js";
2
+ import type { UiSchemaObject } from "../types.js";
3
+ import { UiCustomAttributeCollection } from "./custom-attributes.js";
4
+ import type { UiSchemaFactory } from "./factory.js";
5
+ import { UiElement } from "./node.js";
6
+ import type { UiElementVisitor } from "./visitor.js";
7
+ export declare class Control extends UiElement {
8
+ private _scope;
9
+ private _label?;
10
+ readonly elementKind: "Control";
11
+ constructor(_scope: string, _label?: string | undefined, registry?: UiSchemaAttributeRegistry, customAttributes?: UiCustomAttributeCollection);
12
+ get scope(): string;
13
+ set scope(value: string);
14
+ get label(): string | undefined;
15
+ set label(value: string | undefined);
16
+ static fromJSON(json: UiSchemaObject, factory: UiSchemaFactory): Control;
17
+ accept<T>(visitor: UiElementVisitor<T>): T;
18
+ deepClone(): Control;
19
+ protected writeElementDefinition(json: UiSchemaObject): void;
20
+ }
21
+ //# sourceMappingURL=control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/model/control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,qBAAa,OAAQ,SAAQ,SAAS;IAIlC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,MAAM,CAAC;IAJjB,QAAQ,CAAC,WAAW,EAAG,SAAS,CAAU;gBAGhC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,YAAA,EACvB,QAAQ,CAAC,EAAE,yBAAyB,EACpC,gBAAgB,CAAC,EAAE,2BAA2B;IAKhD,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAElC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO;IASxE,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;IAI1C,SAAS,IAAI,OAAO;IAMpB,SAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;CAI7D"}
@@ -0,0 +1,46 @@
1
+ import { UiCustomAttributeCollection } from "./custom-attributes.js";
2
+ import { UiElement } from "./node.js";
3
+ export class Control extends UiElement {
4
+ _scope;
5
+ _label;
6
+ elementKind = "Control";
7
+ constructor(_scope, _label, registry, customAttributes) {
8
+ super(customAttributes ?? new UiCustomAttributeCollection(registry));
9
+ this._scope = _scope;
10
+ this._label = _label;
11
+ }
12
+ get scope() {
13
+ return this._scope;
14
+ }
15
+ set scope(value) {
16
+ this._scope = value;
17
+ }
18
+ get label() {
19
+ return this._label;
20
+ }
21
+ set label(value) {
22
+ this._label = value;
23
+ }
24
+ static fromJSON(json, factory) {
25
+ const control = new Control(json.scope ?? "#", json.label, factory.attributeRegistry);
26
+ control.applyOptionsFrom(json);
27
+ control.applyRuleFrom(json);
28
+ control.applyI18nFrom(json);
29
+ control.applyCustomAttributes(json);
30
+ return control;
31
+ }
32
+ accept(visitor) {
33
+ return visitor.visitControl(this);
34
+ }
35
+ deepClone() {
36
+ const copy = new Control(this._scope, this._label, undefined, this.cloneAttributes());
37
+ this.copyElementStateTo(copy);
38
+ return copy;
39
+ }
40
+ writeElementDefinition(json) {
41
+ json.scope = this._scope;
42
+ if (this._label !== undefined)
43
+ json.label = this._label;
44
+ }
45
+ }
46
+ //# sourceMappingURL=control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.js","sourceRoot":"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AAC;IAED,SAAS;QACP,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAES,sBAAsB,CAAC,IAAoB;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1D,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ import type { UiSchemaAttributeRegistry } from "../attribute-registry.js";
2
+ import type { UiSchemaObject } from "../types.js";
3
+ export declare class UiCustomAttributeCollection {
4
+ private readonly registry;
5
+ private readonly values;
6
+ constructor(registry?: UiSchemaAttributeRegistry);
7
+ get(name: string): unknown;
8
+ set(name: string, value: unknown): this;
9
+ delete(name: string): boolean;
10
+ applyFrom(json: UiSchemaObject): void;
11
+ writeTo(json: UiSchemaObject): void;
12
+ clone(registry?: UiSchemaAttributeRegistry): UiCustomAttributeCollection;
13
+ }
14
+ //# sourceMappingURL=custom-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-attributes.d.ts","sourceRoot":"","sources":["../../src/model/custom-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,qBAAa,2BAA2B;IAIpC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAH3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;gBAGlC,QAAQ,GAAE,yBAA2D;IAGxF,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAKvC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI7B,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAOrC,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAInC,KAAK,CAAC,QAAQ,GAAE,yBAAyC,GAAG,2BAA2B;CAOxF"}