@kurot/ui-document 0.1.0 → 0.3.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 (188) hide show
  1. package/README.md +112 -12
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +2 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/kurot/assets/UIAssetRegistry.d.ts +47 -0
  7. package/dist/kurot/assets/UIAssetRegistry.d.ts.map +1 -0
  8. package/dist/kurot/assets/UIAssetRegistry.js +139 -0
  9. package/dist/kurot/assets/UIAssetRegistry.js.map +1 -0
  10. package/dist/kurot/assets/UIProjectDefinition.d.ts +33 -0
  11. package/dist/kurot/assets/UIProjectDefinition.d.ts.map +1 -0
  12. package/dist/kurot/assets/UIProjectDefinition.js +2 -0
  13. package/dist/kurot/assets/UIProjectDefinition.js.map +1 -0
  14. package/dist/kurot/assets/assetTraversal.d.ts +30 -0
  15. package/dist/kurot/assets/assetTraversal.d.ts.map +1 -0
  16. package/dist/kurot/assets/assetTraversal.js +96 -0
  17. package/dist/kurot/assets/assetTraversal.js.map +1 -0
  18. package/dist/kurot/assets/index.d.ts +4 -0
  19. package/dist/kurot/assets/index.d.ts.map +1 -0
  20. package/dist/kurot/assets/index.js +3 -0
  21. package/dist/kurot/assets/index.js.map +1 -0
  22. package/dist/kurot/assets/validateUIAssetInstances.d.ts +9 -0
  23. package/dist/kurot/assets/validateUIAssetInstances.d.ts.map +1 -0
  24. package/dist/kurot/assets/validateUIAssetInstances.js +114 -0
  25. package/dist/kurot/assets/validateUIAssetInstances.js.map +1 -0
  26. package/dist/kurot/assets/validateUIAssetOverrides.d.ts +8 -0
  27. package/dist/kurot/assets/validateUIAssetOverrides.d.ts.map +1 -0
  28. package/dist/kurot/assets/validateUIAssetOverrides.js +55 -0
  29. package/dist/kurot/assets/validateUIAssetOverrides.js.map +1 -0
  30. package/dist/kurot/assets/validateUIAssetRegistry.d.ts +8 -0
  31. package/dist/kurot/assets/validateUIAssetRegistry.d.ts.map +1 -0
  32. package/dist/kurot/assets/validateUIAssetRegistry.js +79 -0
  33. package/dist/kurot/assets/validateUIAssetRegistry.js.map +1 -0
  34. package/dist/kurot/assets/validateUIProjectReferences.d.ts +8 -0
  35. package/dist/kurot/assets/validateUIProjectReferences.d.ts.map +1 -0
  36. package/dist/kurot/assets/validateUIProjectReferences.js +50 -0
  37. package/dist/kurot/assets/validateUIProjectReferences.js.map +1 -0
  38. package/dist/kurot/catalog/properties/basic-component-properties.d.ts.map +1 -1
  39. package/dist/kurot/catalog/properties/basic-component-properties.js +8 -10
  40. package/dist/kurot/catalog/properties/basic-component-properties.js.map +1 -1
  41. package/dist/kurot/catalog/properties/foundation-properties.d.ts.map +1 -1
  42. package/dist/kurot/catalog/properties/foundation-properties.js +6 -17
  43. package/dist/kurot/catalog/properties/foundation-properties.js.map +1 -1
  44. package/dist/kurot/document/create.d.ts +20 -0
  45. package/dist/kurot/document/create.d.ts.map +1 -1
  46. package/dist/kurot/document/create.js +10 -0
  47. package/dist/kurot/document/create.js.map +1 -1
  48. package/dist/kurot/document/createAssetContract.d.ts +39 -0
  49. package/dist/kurot/document/createAssetContract.d.ts.map +1 -0
  50. package/dist/kurot/document/createAssetContract.js +17 -0
  51. package/dist/kurot/document/createAssetContract.js.map +1 -0
  52. package/dist/kurot/document/createComponentInstance.d.ts +34 -0
  53. package/dist/kurot/document/createComponentInstance.d.ts.map +1 -0
  54. package/dist/kurot/document/createComponentInstance.js +13 -0
  55. package/dist/kurot/document/createComponentInstance.js.map +1 -0
  56. package/dist/kurot/document/createReferences.d.ts +14 -0
  57. package/dist/kurot/document/createReferences.d.ts.map +1 -0
  58. package/dist/kurot/document/createReferences.js +29 -0
  59. package/dist/kurot/document/createReferences.js.map +1 -0
  60. package/dist/kurot/document/index.d.ts +5 -0
  61. package/dist/kurot/document/index.d.ts.map +1 -1
  62. package/dist/kurot/document/index.js +3 -0
  63. package/dist/kurot/document/index.js.map +1 -1
  64. package/dist/kurot/document/query.d.ts.map +1 -1
  65. package/dist/kurot/document/query.js +16 -0
  66. package/dist/kurot/document/query.js.map +1 -1
  67. package/dist/kurot/editing/UIDocumentHistory.d.ts +41 -0
  68. package/dist/kurot/editing/UIDocumentHistory.d.ts.map +1 -0
  69. package/dist/kurot/editing/UIDocumentHistory.js +95 -0
  70. package/dist/kurot/editing/UIDocumentHistory.js.map +1 -0
  71. package/dist/kurot/editing/UIEditError.d.ts +24 -0
  72. package/dist/kurot/editing/UIEditError.d.ts.map +1 -0
  73. package/dist/kurot/editing/UIEditError.js +25 -0
  74. package/dist/kurot/editing/UIEditError.js.map +1 -0
  75. package/dist/kurot/editing/UIOperation.d.ts +134 -0
  76. package/dist/kurot/editing/UIOperation.d.ts.map +1 -0
  77. package/dist/kurot/editing/UIOperation.js +2 -0
  78. package/dist/kurot/editing/UIOperation.js.map +1 -0
  79. package/dist/kurot/editing/UITransaction.d.ts +69 -0
  80. package/dist/kurot/editing/UITransaction.d.ts.map +1 -0
  81. package/dist/kurot/editing/UITransaction.js +2 -0
  82. package/dist/kurot/editing/UITransaction.js.map +1 -0
  83. package/dist/kurot/editing/applyContractOperation.d.ts +11 -0
  84. package/dist/kurot/editing/applyContractOperation.d.ts.map +1 -0
  85. package/dist/kurot/editing/applyContractOperation.js +76 -0
  86. package/dist/kurot/editing/applyContractOperation.js.map +1 -0
  87. package/dist/kurot/editing/applyInstanceOperation.d.ts +11 -0
  88. package/dist/kurot/editing/applyInstanceOperation.d.ts.map +1 -0
  89. package/dist/kurot/editing/applyInstanceOperation.js +150 -0
  90. package/dist/kurot/editing/applyInstanceOperation.js.map +1 -0
  91. package/dist/kurot/editing/applyNodeOperation.d.ts +11 -0
  92. package/dist/kurot/editing/applyNodeOperation.d.ts.map +1 -0
  93. package/dist/kurot/editing/applyNodeOperation.js +133 -0
  94. package/dist/kurot/editing/applyNodeOperation.js.map +1 -0
  95. package/dist/kurot/editing/applyUIOperation.d.ts +11 -0
  96. package/dist/kurot/editing/applyUIOperation.d.ts.map +1 -0
  97. package/dist/kurot/editing/applyUIOperation.js +46 -0
  98. package/dist/kurot/editing/applyUIOperation.js.map +1 -0
  99. package/dist/kurot/editing/applyUITransaction.d.ts +6 -0
  100. package/dist/kurot/editing/applyUITransaction.d.ts.map +1 -0
  101. package/dist/kurot/editing/applyUITransaction.js +64 -0
  102. package/dist/kurot/editing/applyUITransaction.js.map +1 -0
  103. package/dist/kurot/editing/diffUIDocuments.d.ts +35 -0
  104. package/dist/kurot/editing/diffUIDocuments.d.ts.map +1 -0
  105. package/dist/kurot/editing/diffUIDocuments.js +137 -0
  106. package/dist/kurot/editing/diffUIDocuments.js.map +1 -0
  107. package/dist/kurot/editing/editHelpers.d.ts +44 -0
  108. package/dist/kurot/editing/editHelpers.d.ts.map +1 -0
  109. package/dist/kurot/editing/editHelpers.js +90 -0
  110. package/dist/kurot/editing/editHelpers.js.map +1 -0
  111. package/dist/kurot/editing/index.d.ts +10 -0
  112. package/dist/kurot/editing/index.d.ts.map +1 -0
  113. package/dist/kurot/editing/index.js +6 -0
  114. package/dist/kurot/editing/index.js.map +1 -0
  115. package/dist/kurot/editing/nodeTree.d.ts +40 -0
  116. package/dist/kurot/editing/nodeTree.d.ts.map +1 -0
  117. package/dist/kurot/editing/nodeTree.js +156 -0
  118. package/dist/kurot/editing/nodeTree.js.map +1 -0
  119. package/dist/kurot/model/UIAssetContract.d.ts +139 -0
  120. package/dist/kurot/model/UIAssetContract.d.ts.map +1 -0
  121. package/dist/kurot/model/UIAssetContract.js +2 -0
  122. package/dist/kurot/model/UIAssetContract.js.map +1 -0
  123. package/dist/kurot/model/UIAssetKind.d.ts +5 -0
  124. package/dist/kurot/model/UIAssetKind.d.ts.map +1 -0
  125. package/dist/kurot/model/UIAssetKind.js +2 -0
  126. package/dist/kurot/model/UIAssetKind.js.map +1 -0
  127. package/dist/kurot/model/UIComponentInstance.d.ts +46 -0
  128. package/dist/kurot/model/UIComponentInstance.d.ts.map +1 -0
  129. package/dist/kurot/model/UIComponentInstance.js +2 -0
  130. package/dist/kurot/model/UIComponentInstance.js.map +1 -0
  131. package/dist/kurot/model/UIDocument.d.ts +10 -0
  132. package/dist/kurot/model/UIDocument.d.ts.map +1 -1
  133. package/dist/kurot/model/UIDocument.js.map +1 -1
  134. package/dist/kurot/model/UINode.d.ts +10 -0
  135. package/dist/kurot/model/UINode.d.ts.map +1 -1
  136. package/dist/kurot/model/UIReference.d.ts +57 -0
  137. package/dist/kurot/model/UIReference.d.ts.map +1 -0
  138. package/dist/kurot/model/UIReference.js +2 -0
  139. package/dist/kurot/model/UIReference.js.map +1 -0
  140. package/dist/kurot/model/index.d.ts +4 -0
  141. package/dist/kurot/model/index.d.ts.map +1 -1
  142. package/dist/kurot/model/index.js.map +1 -1
  143. package/dist/kurot/schema/UIComponentDefinition.d.ts +11 -2
  144. package/dist/kurot/schema/UIComponentDefinition.d.ts.map +1 -1
  145. package/dist/kurot/schema/UIComponentRegistry.js +6 -0
  146. package/dist/kurot/schema/UIComponentRegistry.js.map +1 -1
  147. package/dist/kurot/schema/index.d.ts +1 -0
  148. package/dist/kurot/schema/index.d.ts.map +1 -1
  149. package/dist/kurot/schema/index.js +1 -0
  150. package/dist/kurot/schema/index.js.map +1 -1
  151. package/dist/kurot/schema/matchesUIPropertyDefinition.d.ts +7 -0
  152. package/dist/kurot/schema/matchesUIPropertyDefinition.d.ts.map +1 -0
  153. package/dist/kurot/schema/matchesUIPropertyDefinition.js +65 -0
  154. package/dist/kurot/schema/matchesUIPropertyDefinition.js.map +1 -0
  155. package/dist/kurot/schema/validateComponentDefinition.d.ts.map +1 -1
  156. package/dist/kurot/schema/validateComponentDefinition.js +40 -1
  157. package/dist/kurot/schema/validateComponentDefinition.js.map +1 -1
  158. package/dist/kurot/schema/validateUIDocumentComponents.d.ts +1 -0
  159. package/dist/kurot/schema/validateUIDocumentComponents.d.ts.map +1 -1
  160. package/dist/kurot/schema/validateUIDocumentComponents.js +12 -39
  161. package/dist/kurot/schema/validateUIDocumentComponents.js.map +1 -1
  162. package/dist/kurot/serialization/json.d.ts.map +1 -1
  163. package/dist/kurot/serialization/json.js +126 -0
  164. package/dist/kurot/serialization/json.js.map +1 -1
  165. package/dist/kurot/validation/UIDiagnostic.d.ts +1 -1
  166. package/dist/kurot/validation/UIDiagnostic.d.ts.map +1 -1
  167. package/dist/kurot/validation/validateUIAssetContract.d.ts +7 -0
  168. package/dist/kurot/validation/validateUIAssetContract.d.ts.map +1 -0
  169. package/dist/kurot/validation/validateUIAssetContract.js +154 -0
  170. package/dist/kurot/validation/validateUIAssetContract.js.map +1 -0
  171. package/dist/kurot/validation/validateUIAssetModes.d.ts +6 -0
  172. package/dist/kurot/validation/validateUIAssetModes.d.ts.map +1 -0
  173. package/dist/kurot/validation/validateUIAssetModes.js +57 -0
  174. package/dist/kurot/validation/validateUIAssetModes.js.map +1 -0
  175. package/dist/kurot/validation/validateUIComponentInstance.d.ts +6 -0
  176. package/dist/kurot/validation/validateUIComponentInstance.d.ts.map +1 -0
  177. package/dist/kurot/validation/validateUIComponentInstance.js +77 -0
  178. package/dist/kurot/validation/validateUIComponentInstance.js.map +1 -0
  179. package/dist/kurot/validation/validateUIDocument.d.ts.map +1 -1
  180. package/dist/kurot/validation/validateUIDocument.js +51 -73
  181. package/dist/kurot/validation/validateUIDocument.js.map +1 -1
  182. package/dist/kurot/validation/validationHelpers.d.ts +26 -0
  183. package/dist/kurot/validation/validationHelpers.d.ts.map +1 -0
  184. package/dist/kurot/validation/validationHelpers.js +120 -0
  185. package/dist/kurot/validation/validationHelpers.js.map +1 -0
  186. package/dist/kurot/version.d.ts +1 -1
  187. package/dist/kurot/version.js +1 -1
  188. package/package.json +2 -2
package/README.md CHANGED
@@ -4,8 +4,9 @@ Headless semantic document foundation for Kurot UI tooling. It is intended to
4
4
  provide one format and one mutation model shared by the future visual UI
5
5
  builder, `@kurot/cli`, and Agent-driven UI generation.
6
6
 
7
- > **Early development (0.1.0).** The first document model, validation, query,
8
- > and deterministic JSON APIs are implemented. The schema is not stable yet.
7
+ > **Early development (0.3.0).** The reusable authoring model and headless
8
+ > editing kernel are implemented, but the schema remains pre-1.0 and is not yet
9
+ > a production file format.
9
10
 
10
11
  ## Installation
11
12
 
@@ -28,6 +29,7 @@ import {
28
29
 
29
30
  const document = createUIDocument({
30
31
  id: 'main-screen',
32
+ assetKind: 'screen',
31
33
  root: createUINode({
32
34
  id: 'root',
33
35
  type: 'kui.Group',
@@ -52,6 +54,14 @@ the corresponding `@kurot/ui` class.
52
54
 
53
55
  ## Current capabilities
54
56
 
57
+ - explicit screen, reusable-component, and appearance assets;
58
+ - public component contracts containing typed parameters, parts, Slots,
59
+ runtime-neutral states, and authoring variants;
60
+ - compact reusable instances containing an asset reference and only their
61
+ parameter values, variant, part overrides, and projected Slot content;
62
+ - typed project resource and design-token references;
63
+ - `UIAssetRegistry` and project-wide validation of asset identities,
64
+ references, type compatibility, public contracts, and dependency cycles;
55
65
  - explicit `UIDocument`, `UINode`, and recursive `UIPropertyValue` types;
56
66
  - constructors that assign the current format discriminator and version;
57
67
  - deterministic pre-order traversal and node lookup;
@@ -64,9 +74,93 @@ the corresponding `@kurot/ui` class.
64
74
  - abstract base definitions, single-parent inheritance, deterministic schema
65
75
  resolution, and derived property overrides;
66
76
  - optional validation of registered component types, known property categories,
67
- required properties, child policies, and abstract types.
77
+ required properties, child policies, and abstract types;
68
78
  - union-valued properties, enum values, numeric ranges, integer constraints,
69
- serializable defaults, and editor-facing semantic formats.
79
+ serializable defaults, editor-facing semantic formats, and accepted resource
80
+ or token categories;
81
+ - immutable semantic operations with exact inverse generation;
82
+ - atomic transactions, monotonic revisions, stale-edit conflict detection,
83
+ deterministic diffs, and in-memory undo/redo history.
84
+
85
+ ## Reusable assets
86
+
87
+ A parent stores a reference to a reusable component, not a copy of its internal
88
+ tree:
89
+
90
+ ```ts
91
+ import {
92
+ createUIAssetReference,
93
+ createUIComponentInstance,
94
+ createUIDocument,
95
+ createUINode,
96
+ UIAssetRegistry,
97
+ validateUIAssetRegistry,
98
+ } from '@kurot/ui-document';
99
+
100
+ const screen = createUIDocument({
101
+ id: 'lobby-screen',
102
+ assetKind: 'screen',
103
+ root: createUINode({
104
+ id: 'root',
105
+ type: 'kui.Group',
106
+ children: [
107
+ createUINode({
108
+ id: 'play-action',
109
+ type: 'game.ActionCard',
110
+ instance: createUIComponentInstance({
111
+ source: createUIAssetReference('action-card'),
112
+ parameters: { label: 'Play' },
113
+ }),
114
+ }),
115
+ ],
116
+ }),
117
+ });
118
+
119
+ const registry = new UIAssetRegistry();
120
+ // actionCardDefinition is a component UIDocument created separately.
121
+ registry.registerAsset(actionCardDefinition);
122
+ registry.registerAsset(screen);
123
+ const diagnostics = validateUIAssetRegistry(registry);
124
+ ```
125
+
126
+ The component definition owns its internal hierarchy and publishes only its
127
+ stable contract. Definition changes can therefore propagate without expanding
128
+ or rewriting every parent asset.
129
+
130
+ Component parameters may declare explicit bindings to internal node properties.
131
+ This keeps parameter behavior deterministic without embedding JavaScript or
132
+ expression strings in the document.
133
+
134
+ ## Editing transactions
135
+
136
+ Editors, Agent tools, and CLI transformations should commit the same semantic
137
+ operations instead of mutating document objects directly:
138
+
139
+ ```ts
140
+ import { UIDocumentHistory } from '@kurot/ui-document';
141
+
142
+ const history = new UIDocumentHistory(document);
143
+ history.commit({
144
+ id: 'widen-spin-button',
145
+ expectedRevision: history.snapshot.revision,
146
+ summary: 'Make the primary action wider',
147
+ operations: [
148
+ {
149
+ kind: 'set-node-property',
150
+ nodeId: 'spin-button',
151
+ property: 'width',
152
+ value: 320,
153
+ },
154
+ ],
155
+ });
156
+
157
+ history.undo();
158
+ history.redo();
159
+ ```
160
+
161
+ Transactions either commit completely or leave the input snapshot untouched.
162
+ Undo and redo create new monotonically increasing revisions, so an older Agent
163
+ response cannot become current again merely because the user navigated history.
70
164
 
71
165
  Component definitions can remain intentionally incomplete while their runtime
72
166
  properties are reviewed:
@@ -117,24 +211,24 @@ from Kurot display objects and UI layout elements, then adds the audited direct
117
211
  properties of all five concrete components. Unknown properties are rejected.
118
212
 
119
213
  Runtime-owned values are deliberately excluded. For example, `Image.source`
120
- stores an asset key or URL rather than a `Texture`, and readonly objects such as
121
- `Image.bitmap` are not document properties. `Group.layout` and
214
+ stores a typed project resource reference rather than a `Texture`, and readonly
215
+ objects such as `Image.bitmap` are not document properties. `Group.layout` and
122
216
  `Image.scale9Grid` currently accept semantic objects; their nested shapes will
123
217
  be tightened when the layout and structured-value catalogs are introduced.
124
- State declarations and bindings are also reserved for their own semantic
125
- layers rather than being accepted as untyped component properties.
218
+ States and variants live in asset contracts rather than untyped component
219
+ properties. Compatibility-shaped `currentState`, `skinName`, and
220
+ `hostComponentKey` are not canonical authoring fields.
126
221
 
127
222
  See [Architecture](./docs/architecture.md) for the current contracts and
128
223
  package boundaries.
129
224
 
130
225
  ## Intended boundary
131
226
 
132
- The package owns the serializable UI document model and its deterministic
227
+ The package owns the serializable UI asset model and its deterministic
133
228
  operations. Planned layers include:
134
229
 
135
- - the remaining component catalog, nested structured-value constraints, states,
136
- bindings, and resource-reference schemas;
137
- - commands, transactions, undo, and redo;
230
+ - the remaining component catalog and nested structured-value constraints;
231
+ - declarative data binding and actions;
138
232
  - document migrations;
139
233
  - adapters for formats such as EXML.
140
234
 
@@ -143,6 +237,12 @@ or network I/O, or model-provider integration. Those concerns belong to
143
237
  `@kurot/ui`, the visual builder, CLI orchestration, and Agent adapters
144
238
  respectively.
145
239
 
240
+ `@kurot/ui-runtime@0.2.x` validates and materializes format-version-2 assets,
241
+ including reusable instances, parameter bindings, Slots, component variants,
242
+ part overrides, design tokens, resource hooks, and native appearance
243
+ skins/states. Incremental reconciliation and the remaining dynamic semantics
244
+ are separate runtime work; they do not belong in this headless package.
245
+
146
246
  ## Development
147
247
 
148
248
  ```bash
package/dist/index.d.ts CHANGED
@@ -4,5 +4,7 @@ export * from './kurot/validation/index.js';
4
4
  export * from './kurot/serialization/index.js';
5
5
  export * from './kurot/schema/index.js';
6
6
  export * from './kurot/catalog/index.js';
7
+ export * from './kurot/assets/index.js';
8
+ export * from './kurot/editing/index.js';
7
9
  export { UI_DOCUMENT_FORMAT_VERSION } from './kurot/version.js';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -4,5 +4,7 @@ export * from './kurot/validation/index.js';
4
4
  export * from './kurot/serialization/index.js';
5
5
  export * from './kurot/schema/index.js';
6
6
  export * from './kurot/catalog/index.js';
7
+ export * from './kurot/assets/index.js';
8
+ export * from './kurot/editing/index.js';
7
9
  export { UI_DOCUMENT_FORMAT_VERSION } from './kurot/version.js';
8
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { UIDocument } from '../model/UIDocument.js';
2
+ import type { UIDesignTokenDefinition, UIResourceDefinition } from './UIProjectDefinition.js';
3
+ /**
4
+ * In-memory project catalog used for deterministic cross-document resolution.
5
+ */
6
+ export declare class UIAssetRegistry {
7
+ private readonly _assets;
8
+ private readonly _resources;
9
+ private readonly _tokens;
10
+ /**
11
+ * Registers one structurally valid asset without replacing an existing identity.
12
+ */
13
+ registerAsset(document: UIDocument): void;
14
+ /**
15
+ * Registers one project resource without replacing an existing key.
16
+ */
17
+ registerResource(definition: UIResourceDefinition): void;
18
+ /**
19
+ * Registers one project design token without replacing an existing key.
20
+ */
21
+ registerToken(definition: UIDesignTokenDefinition): void;
22
+ /**
23
+ * Returns an exact UI asset by project identity.
24
+ */
25
+ getAsset(id: string): UIDocument | undefined;
26
+ /**
27
+ * Returns an exact project resource by key.
28
+ */
29
+ getResource(key: string): UIResourceDefinition | undefined;
30
+ /**
31
+ * Returns an exact project design token by key.
32
+ */
33
+ getToken(key: string): UIDesignTokenDefinition | undefined;
34
+ /**
35
+ * Lists UI assets in stable identifier order.
36
+ */
37
+ listAssets(): readonly UIDocument[];
38
+ /**
39
+ * Lists resources in stable key order.
40
+ */
41
+ listResources(): readonly UIResourceDefinition[];
42
+ /**
43
+ * Lists design tokens in stable key order.
44
+ */
45
+ listTokens(): readonly UIDesignTokenDefinition[];
46
+ }
47
+ //# sourceMappingURL=UIAssetRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UIAssetRegistry.d.ts","sourceRoot":"","sources":["../../../src/kurot/assets/UIAssetRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAUzD,OAAO,KAAK,EACX,uBAAuB,EACvB,oBAAoB,EACpB,MAAM,0BAA0B,CAAC;AAiBlC;;GAEG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2C;IACtE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IAEtE;;OAEG;IACI,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI;IAYhD;;OAEG;IACI,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAW/D;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI;IAmB/D;;OAEG;IACI,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAInD;;OAEG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAIjE;;OAEG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAIjE;;OAEG;IACI,UAAU,IAAI,SAAS,UAAU,EAAE;IAI1C;;OAEG;IACI,aAAa,IAAI,SAAS,oBAAoB,EAAE;IAIvD;;OAEG;IACI,UAAU,IAAI,SAAS,uBAAuB,EAAE;CAGvD"}
@@ -0,0 +1,139 @@
1
+ import { UIDocumentValidationError } from '../serialization/UIDocumentValidationError.js';
2
+ import { validateUIDocument } from '../validation/validateUIDocument.js';
3
+ import { validatePropertyValue } from '../validation/validationHelpers.js';
4
+ const RESOURCE_TYPES = new Set([
5
+ 'animation',
6
+ 'font',
7
+ 'image',
8
+ 'spine',
9
+ 'sprite-frame',
10
+ ]);
11
+ const TOKEN_TYPES = new Set([
12
+ 'color',
13
+ 'number',
14
+ 'spacing',
15
+ 'string',
16
+ 'typography',
17
+ ]);
18
+ /**
19
+ * In-memory project catalog used for deterministic cross-document resolution.
20
+ */
21
+ export class UIAssetRegistry {
22
+ _assets = new Map();
23
+ _resources = new Map();
24
+ _tokens = new Map();
25
+ /**
26
+ * Registers one structurally valid asset without replacing an existing identity.
27
+ */
28
+ registerAsset(document) {
29
+ const diagnostics = validateUIDocument(document);
30
+ if (diagnostics.length > 0) {
31
+ throw new UIDocumentValidationError(diagnostics);
32
+ }
33
+ assertNonEmpty(document.id, 'UI asset id');
34
+ if (this._assets.has(document.id)) {
35
+ throw new Error(`UI asset "${document.id}" is already registered.`);
36
+ }
37
+ this._assets.set(document.id, document);
38
+ }
39
+ /**
40
+ * Registers one project resource without replacing an existing key.
41
+ */
42
+ registerResource(definition) {
43
+ assertNonEmpty(definition.key, 'UI resource key');
44
+ if (!RESOURCE_TYPES.has(definition.resourceType)) {
45
+ throw new Error(`Unsupported UI resource type "${String(definition.resourceType)}".`);
46
+ }
47
+ if (this._resources.has(definition.key)) {
48
+ throw new Error(`UI resource "${definition.key}" is already registered.`);
49
+ }
50
+ this._resources.set(definition.key, Object.freeze({ ...definition }));
51
+ }
52
+ /**
53
+ * Registers one project design token without replacing an existing key.
54
+ */
55
+ registerToken(definition) {
56
+ assertNonEmpty(definition.key, 'UI design token key');
57
+ if (!TOKEN_TYPES.has(definition.tokenType)) {
58
+ throw new Error(`Unsupported UI design token type "${String(definition.tokenType)}".`);
59
+ }
60
+ const diagnostics = [];
61
+ validatePropertyValue(definition.value, '$.value', diagnostics);
62
+ if (diagnostics.length > 0 ||
63
+ !matchesTokenValue(definition.tokenType, definition.value)) {
64
+ throw new Error(`UI design token "${definition.key}" has an invalid value.`);
65
+ }
66
+ if (this._tokens.has(definition.key)) {
67
+ throw new Error(`UI design token "${definition.key}" is already registered.`);
68
+ }
69
+ this._tokens.set(definition.key, Object.freeze({ ...definition }));
70
+ }
71
+ /**
72
+ * Returns an exact UI asset by project identity.
73
+ */
74
+ getAsset(id) {
75
+ return this._assets.get(id);
76
+ }
77
+ /**
78
+ * Returns an exact project resource by key.
79
+ */
80
+ getResource(key) {
81
+ return this._resources.get(key);
82
+ }
83
+ /**
84
+ * Returns an exact project design token by key.
85
+ */
86
+ getToken(key) {
87
+ return this._tokens.get(key);
88
+ }
89
+ /**
90
+ * Lists UI assets in stable identifier order.
91
+ */
92
+ listAssets() {
93
+ return [...this._assets.values()].sort((a, b) => compareStrings(a.id, b.id));
94
+ }
95
+ /**
96
+ * Lists resources in stable key order.
97
+ */
98
+ listResources() {
99
+ return [...this._resources.values()].sort((a, b) => compareStrings(a.key, b.key));
100
+ }
101
+ /**
102
+ * Lists design tokens in stable key order.
103
+ */
104
+ listTokens() {
105
+ return [...this._tokens.values()].sort((a, b) => compareStrings(a.key, b.key));
106
+ }
107
+ }
108
+ function assertNonEmpty(value, label) {
109
+ if (typeof value !== 'string' || value.trim().length === 0) {
110
+ throw new Error(`${label} must be a non-empty string.`);
111
+ }
112
+ }
113
+ function compareStrings(a, b) {
114
+ if (a < b)
115
+ return -1;
116
+ if (a > b)
117
+ return 1;
118
+ return 0;
119
+ }
120
+ function matchesTokenValue(tokenType, value) {
121
+ switch (tokenType) {
122
+ case 'color':
123
+ return (typeof value === 'number' &&
124
+ Number.isInteger(value) &&
125
+ value >= 0 &&
126
+ value <= 0xffffff);
127
+ case 'number':
128
+ return typeof value === 'number';
129
+ case 'spacing':
130
+ return typeof value === 'number' && value >= 0;
131
+ case 'string':
132
+ return typeof value === 'string';
133
+ case 'typography':
134
+ return typeof value === 'object' && !Array.isArray(value);
135
+ default:
136
+ return false;
137
+ }
138
+ }
139
+ //# sourceMappingURL=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Type, UIResourceType } from '../model/UIReference.js';
3
+ /**
4
+ * Project resource identity available to semantic UI assets.
5
+ */
6
+ export interface UIResourceDefinition {
7
+ /**
8
+ * Project-stable key used by resource references.
9
+ */
10
+ readonly key: string;
11
+ /**
12
+ * Resource category exposed to authoring validation.
13
+ */
14
+ readonly resourceType: UIResourceType;
15
+ }
16
+ /**
17
+ * Project design token available to semantic UI assets.
18
+ */
19
+ export interface UIDesignTokenDefinition {
20
+ /**
21
+ * Project-stable key used by token references.
22
+ */
23
+ readonly key: string;
24
+ /**
25
+ * Semantic category used to constrain consumers.
26
+ */
27
+ readonly tokenType: UIDesignTokenType;
28
+ /**
29
+ * Serializable canonical token value.
30
+ */
31
+ readonly value: UIPropertyValue;
32
+ }
33
+ //# sourceMappingURL=UIProjectDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UIProjectDefinition.d.ts","sourceRoot":"","sources":["../../../src/kurot/assets/UIProjectDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EACX,iBAAiB,EACjB,cAAc,EACd,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CAChC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UIProjectDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UIProjectDefinition.js","sourceRoot":"","sources":["../../../src/kurot/assets/UIProjectDefinition.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import type { UIDocument } from '../model/UIDocument.js';
2
+ import type { UINode } from '../model/UINode.js';
3
+ import type { UIPropertyObject, UIPropertyValue } from '../model/UIPropertyValue.js';
4
+ export interface UIAssetDependency {
5
+ /**
6
+ * Stable identifier of the referenced UI asset.
7
+ */
8
+ readonly assetId: string;
9
+ /**
10
+ * Document-local JSON path containing the reference.
11
+ */
12
+ readonly path: string;
13
+ }
14
+ /**
15
+ * Visits ordinary and Slot-projected node trees with deterministic paths.
16
+ */
17
+ export declare function visitUINodesWithPath(node: UINode, path: string, visitor: (node: UINode, path: string) => void): void;
18
+ /**
19
+ * Visits every recursive property value stored by one UI asset.
20
+ */
21
+ export declare function visitUIDocumentPropertyValues(document: UIDocument, visitor: (value: UIPropertyValue, path: string) => void): void;
22
+ /**
23
+ * Collects explicit and property-level UI asset dependencies with source paths.
24
+ */
25
+ export declare function collectUIAssetDependencies(document: UIDocument): readonly UIAssetDependency[];
26
+ /**
27
+ * Narrows a property object by its semantic reference discriminator.
28
+ */
29
+ export declare function isReference(value: UIPropertyValue, kind: 'asset' | 'resource' | 'token'): value is UIPropertyObject;
30
+ //# sourceMappingURL=assetTraversal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetTraversal.d.ts","sourceRoot":"","sources":["../../../src/kurot/assets/assetTraversal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAC3C,IAAI,CAgBN;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GACrD,IAAI,CAmBN;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,UAAU,GAClB,SAAS,iBAAiB,EAAE,CAsB9B;AAED;;GAEG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,GAClC,KAAK,IAAI,gBAAgB,CAO3B"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Visits ordinary and Slot-projected node trees with deterministic paths.
3
+ */
4
+ export function visitUINodesWithPath(node, path, visitor) {
5
+ visitor(node, path);
6
+ for (let index = 0; index < node.children.length; index++) {
7
+ visitUINodesWithPath(node.children[index], `${path}.children[${index}]`, visitor);
8
+ }
9
+ if (!node.instance)
10
+ return;
11
+ for (const slotName of Object.keys(node.instance.slots).sort()) {
12
+ const children = node.instance.slots[slotName];
13
+ for (let index = 0; index < children.length; index++) {
14
+ visitUINodesWithPath(children[index], `${path}.instance.slots.${slotName}[${index}]`, visitor);
15
+ }
16
+ }
17
+ }
18
+ /**
19
+ * Visits every recursive property value stored by one UI asset.
20
+ */
21
+ export function visitUIDocumentPropertyValues(document, visitor) {
22
+ visitUINodesWithPath(document.root, '$.root', (node, path) => {
23
+ for (const [name, value] of Object.entries(node.properties)) {
24
+ visitUIPropertyValue(value, `${path}.properties.${name}`, visitor);
25
+ }
26
+ if (!node.instance)
27
+ return;
28
+ for (const [name, value] of Object.entries(node.instance.parameters)) {
29
+ visitUIPropertyValue(value, `${path}.instance.parameters.${name}`, visitor);
30
+ }
31
+ for (let index = 0; index < node.instance.overrides.length; index++) {
32
+ visitUIPropertyValue(node.instance.overrides[index].value, `${path}.instance.overrides[${index}].value`, visitor);
33
+ }
34
+ });
35
+ visitModeValues(document, 'states', visitor);
36
+ visitModeValues(document, 'variants', visitor);
37
+ }
38
+ /**
39
+ * Collects explicit and property-level UI asset dependencies with source paths.
40
+ */
41
+ export function collectUIAssetDependencies(document) {
42
+ const dependencies = [];
43
+ visitUINodesWithPath(document.root, '$.root', (node, path) => {
44
+ if (node.appearance) {
45
+ dependencies.push({
46
+ assetId: node.appearance.assetId,
47
+ path: `${path}.appearance`,
48
+ });
49
+ }
50
+ if (node.instance) {
51
+ dependencies.push({
52
+ assetId: node.instance.source.assetId,
53
+ path: `${path}.instance.source`,
54
+ });
55
+ }
56
+ });
57
+ visitUIDocumentPropertyValues(document, (value, path) => {
58
+ if (!isReference(value, 'asset') || !('assetId' in value))
59
+ return;
60
+ if (typeof value.assetId !== 'string')
61
+ return;
62
+ dependencies.push({ assetId: value.assetId, path });
63
+ });
64
+ return dependencies;
65
+ }
66
+ /**
67
+ * Narrows a property object by its semantic reference discriminator.
68
+ */
69
+ export function isReference(value, kind) {
70
+ return (typeof value === 'object' &&
71
+ !Array.isArray(value) &&
72
+ 'kind' in value &&
73
+ value.kind === kind);
74
+ }
75
+ function visitUIPropertyValue(value, path, visitor) {
76
+ visitor(value, path);
77
+ if (Array.isArray(value)) {
78
+ for (let index = 0; index < value.length; index++) {
79
+ visitUIPropertyValue(value[index], `${path}[${index}]`, visitor);
80
+ }
81
+ return;
82
+ }
83
+ if (typeof value !== 'object')
84
+ return;
85
+ for (const [name, child] of Object.entries(value)) {
86
+ visitUIPropertyValue(child, `${path}.${name}`, visitor);
87
+ }
88
+ }
89
+ function visitModeValues(document, key, visitor) {
90
+ for (const [name, mode] of Object.entries(document.contract[key])) {
91
+ for (let index = 0; index < mode.overrides.length; index++) {
92
+ visitUIPropertyValue(mode.overrides[index].value, `$.contract.${key}.${name}.overrides[${index}].value`, visitor);
93
+ }
94
+ }
95
+ }
96
+ //# sourceMappingURL=assetTraversal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetTraversal.js","sourceRoot":"","sources":["../../../src/kurot/assets/assetTraversal.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,MAAM,UAAU,oBAAoB,CACnC,IAAY,EACZ,IAAY,EACZ,OAA6C;IAE7C,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3D,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAE,EAAE,GAAG,IAAI,aAAa,KAAK,GAAG,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO;IAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAE,CAAC;QAChD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACtD,oBAAoB,CACnB,QAAQ,CAAC,KAAK,CAAE,EAChB,GAAG,IAAI,mBAAmB,QAAQ,IAAI,KAAK,GAAG,EAC9C,OAAO,CACP,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC5C,QAAoB,EACpB,OAAuD;IAEvD,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,IAA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AAC;YACnD,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAE,EAAE,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,OAAO,CAAC,CAAC;QACnE,CAAC;QACD,OAAO;IACR,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO;IACtC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,oBAAoB,CAAC,KAAK,EAAE,GAAG,IAAI,IAAI,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;AACF,CAAC;AAED,SAAS,eAAe,CACvB,QAAoB,EACpB,GAA0B,EAC1B,OAAuD;IAEvD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACnE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YAC5D,oBAAoB,CACnB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAE,CAAC,KAAK,EAC5B,cAAc,GAAG,IAAI,IAAI,cAAc,KAAK,SAAS,EACrD,OAAO,CACP,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { UIAssetRegistry } from './UIAssetRegistry.js';
2
+ export type { UIDesignTokenDefinition, UIResourceDefinition, } from './UIProjectDefinition.js';
3
+ export { validateUIAssetRegistry } from './validateUIAssetRegistry.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kurot/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACX,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { UIAssetRegistry } from './UIAssetRegistry.js';
2
+ export { validateUIAssetRegistry } from './validateUIAssetRegistry.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/kurot/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { UIDocument } from '../model/UIDocument.js';
2
+ import type { UIComponentRegistry } from '../schema/UIComponentRegistry.js';
3
+ import type { UIDiagnostic } from '../validation/UIDiagnostic.js';
4
+ import type { UIAssetRegistry } from './UIAssetRegistry.js';
5
+ /**
6
+ * Validates component and appearance references against registered UI assets.
7
+ */
8
+ export declare function validateUIAssetInstances(document: UIDocument, registry: UIAssetRegistry, components: UIComponentRegistry): UIDiagnostic[];
9
+ //# sourceMappingURL=validateUIAssetInstances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateUIAssetInstances.d.ts","sourceRoot":"","sources":["../../../src/kurot/assets/validateUIAssetInstances.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,mBAAmB,GAC7B,YAAY,EAAE,CAOhB"}