@allternit/ix 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 (170) hide show
  1. package/README.md +320 -0
  2. package/dist/adapters/json-render.d.ts +211 -0
  3. package/dist/adapters/json-render.d.ts.bak +211 -0
  4. package/dist/adapters/json-render.d.ts.map +1 -0
  5. package/dist/adapters/json-render.js +576 -0
  6. package/dist/adapters/json-render.js.bak +576 -0
  7. package/dist/adapters/json-render.js.map +1 -0
  8. package/dist/catalog/registry.d.ts +65 -0
  9. package/dist/catalog/registry.d.ts.bak +65 -0
  10. package/dist/catalog/registry.d.ts.map +1 -0
  11. package/dist/catalog/registry.js +388 -0
  12. package/dist/catalog/registry.js.bak +388 -0
  13. package/dist/catalog/registry.js.map +1 -0
  14. package/dist/collab/capsule-registry.d.ts +114 -0
  15. package/dist/collab/capsule-registry.d.ts.bak +114 -0
  16. package/dist/collab/capsule-registry.d.ts.map +1 -0
  17. package/dist/collab/capsule-registry.js +271 -0
  18. package/dist/collab/capsule-registry.js.bak +271 -0
  19. package/dist/collab/capsule-registry.js.map +1 -0
  20. package/dist/collab/index.d.ts +21 -0
  21. package/dist/collab/index.d.ts.bak +21 -0
  22. package/dist/collab/index.d.ts.map +1 -0
  23. package/dist/collab/index.js +32 -0
  24. package/dist/collab/index.js.bak +32 -0
  25. package/dist/collab/index.js.map +1 -0
  26. package/dist/collab/visual-editor.d.ts +199 -0
  27. package/dist/collab/visual-editor.d.ts.bak +199 -0
  28. package/dist/collab/visual-editor.d.ts.map +1 -0
  29. package/dist/collab/visual-editor.js +259 -0
  30. package/dist/collab/visual-editor.js.bak +259 -0
  31. package/dist/collab/visual-editor.js.map +1 -0
  32. package/dist/collab/yjs-adapter.d.ts +95 -0
  33. package/dist/collab/yjs-adapter.d.ts.bak +95 -0
  34. package/dist/collab/yjs-adapter.d.ts.map +1 -0
  35. package/dist/collab/yjs-adapter.js +282 -0
  36. package/dist/collab/yjs-adapter.js.bak +282 -0
  37. package/dist/collab/yjs-adapter.js.map +1 -0
  38. package/dist/collab/yjs-client.d.ts +101 -0
  39. package/dist/collab/yjs-client.d.ts.bak +101 -0
  40. package/dist/collab/yjs-client.d.ts.map +1 -0
  41. package/dist/collab/yjs-client.js +193 -0
  42. package/dist/collab/yjs-client.js.bak +193 -0
  43. package/dist/collab/yjs-client.js.map +1 -0
  44. package/dist/collab/yjs-protocols.d.ts +128 -0
  45. package/dist/collab/yjs-protocols.d.ts.bak +128 -0
  46. package/dist/collab/yjs-protocols.d.ts.map +1 -0
  47. package/dist/collab/yjs-protocols.js +245 -0
  48. package/dist/collab/yjs-protocols.js.bak +245 -0
  49. package/dist/collab/yjs-protocols.js.map +1 -0
  50. package/dist/collab/yjs-types.d.ts +201 -0
  51. package/dist/collab/yjs-types.d.ts.bak +201 -0
  52. package/dist/collab/yjs-types.d.ts.map +1 -0
  53. package/dist/collab/yjs-types.js +45 -0
  54. package/dist/collab/yjs-types.js.bak +45 -0
  55. package/dist/collab/yjs-types.js.map +1 -0
  56. package/dist/index.d.ts +38 -0
  57. package/dist/index.d.ts.bak +38 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +48 -0
  60. package/dist/index.js.bak +48 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/pipeline/llm-to-ix.d.ts +249 -0
  63. package/dist/pipeline/llm-to-ix.d.ts.bak +249 -0
  64. package/dist/pipeline/llm-to-ix.d.ts.map +1 -0
  65. package/dist/pipeline/llm-to-ix.js +992 -0
  66. package/dist/pipeline/llm-to-ix.js.bak +992 -0
  67. package/dist/pipeline/llm-to-ix.js.map +1 -0
  68. package/dist/react/index.d.ts +18 -0
  69. package/dist/react/index.d.ts.bak +18 -0
  70. package/dist/react/index.d.ts.map +1 -0
  71. package/dist/react/index.js +18 -0
  72. package/dist/react/index.js.bak +18 -0
  73. package/dist/react/index.js.map +1 -0
  74. package/dist/react/renderer.d.ts +47 -0
  75. package/dist/react/renderer.d.ts.bak +47 -0
  76. package/dist/react/renderer.d.ts.map +1 -0
  77. package/dist/react/renderer.js +420 -0
  78. package/dist/react/renderer.js.bak +420 -0
  79. package/dist/react/renderer.js.map +1 -0
  80. package/dist/renderer/renderer.d.ts +55 -0
  81. package/dist/renderer/renderer.d.ts.bak +55 -0
  82. package/dist/renderer/renderer.d.ts.map +1 -0
  83. package/dist/renderer/renderer.js +232 -0
  84. package/dist/renderer/renderer.js.bak +232 -0
  85. package/dist/renderer/renderer.js.map +1 -0
  86. package/dist/runtime/capsule-runtime.d.ts +227 -0
  87. package/dist/runtime/capsule-runtime.d.ts.bak +227 -0
  88. package/dist/runtime/capsule-runtime.d.ts.map +1 -0
  89. package/dist/runtime/capsule-runtime.js +563 -0
  90. package/dist/runtime/capsule-runtime.js.bak +563 -0
  91. package/dist/runtime/capsule-runtime.js.map +1 -0
  92. package/dist/runtime/policy-gates.d.ts +116 -0
  93. package/dist/runtime/policy-gates.d.ts.bak +116 -0
  94. package/dist/runtime/policy-gates.d.ts.map +1 -0
  95. package/dist/runtime/policy-gates.js +317 -0
  96. package/dist/runtime/policy-gates.js.bak +317 -0
  97. package/dist/runtime/policy-gates.js.map +1 -0
  98. package/dist/schema/ui-ir.d.ts +26 -0
  99. package/dist/schema/ui-ir.d.ts.bak +26 -0
  100. package/dist/schema/ui-ir.d.ts.map +1 -0
  101. package/dist/schema/ui-ir.js +51 -0
  102. package/dist/schema/ui-ir.js.bak +51 -0
  103. package/dist/schema/ui-ir.js.map +1 -0
  104. package/dist/sdk/api.d.ts +101 -0
  105. package/dist/sdk/api.d.ts.bak +101 -0
  106. package/dist/sdk/api.d.ts.map +1 -0
  107. package/dist/sdk/api.js +177 -0
  108. package/dist/sdk/api.js.bak +177 -0
  109. package/dist/sdk/api.js.map +1 -0
  110. package/dist/sdk/index.d.ts +9 -0
  111. package/dist/sdk/index.d.ts.bak +9 -0
  112. package/dist/sdk/index.d.ts.map +1 -0
  113. package/dist/sdk/index.js +10 -0
  114. package/dist/sdk/index.js.bak +10 -0
  115. package/dist/sdk/index.js.map +1 -0
  116. package/dist/sdk/react.d.ts +63 -0
  117. package/dist/sdk/react.d.ts.bak +63 -0
  118. package/dist/sdk/react.d.ts.map +1 -0
  119. package/dist/sdk/react.js +161 -0
  120. package/dist/sdk/react.js.bak +161 -0
  121. package/dist/sdk/react.js.map +1 -0
  122. package/dist/state/index.d.ts +8 -0
  123. package/dist/state/index.d.ts.bak +8 -0
  124. package/dist/state/index.d.ts.map +1 -0
  125. package/dist/state/index.js +8 -0
  126. package/dist/state/index.js.bak +8 -0
  127. package/dist/state/index.js.map +1 -0
  128. package/dist/state/patch.d.ts +73 -0
  129. package/dist/state/patch.d.ts.bak +73 -0
  130. package/dist/state/patch.d.ts.map +1 -0
  131. package/dist/state/patch.js +437 -0
  132. package/dist/state/patch.js.bak +437 -0
  133. package/dist/state/patch.js.map +1 -0
  134. package/dist/state/store.d.ts +50 -0
  135. package/dist/state/store.d.ts.bak +50 -0
  136. package/dist/state/store.d.ts.map +1 -0
  137. package/dist/state/store.js +246 -0
  138. package/dist/state/store.js.bak +246 -0
  139. package/dist/state/store.js.map +1 -0
  140. package/dist/svelte/index.d.ts +15 -0
  141. package/dist/svelte/index.d.ts.bak +15 -0
  142. package/dist/svelte/index.d.ts.map +1 -0
  143. package/dist/svelte/index.js +15 -0
  144. package/dist/svelte/index.js.bak +15 -0
  145. package/dist/svelte/index.js.map +1 -0
  146. package/dist/svelte/renderer.d.ts +35 -0
  147. package/dist/svelte/renderer.d.ts.bak +35 -0
  148. package/dist/svelte/renderer.d.ts.map +1 -0
  149. package/dist/svelte/renderer.js +317 -0
  150. package/dist/svelte/renderer.js.bak +317 -0
  151. package/dist/svelte/renderer.js.map +1 -0
  152. package/dist/types/index.d.ts +349 -0
  153. package/dist/types/index.d.ts.bak +349 -0
  154. package/dist/types/index.d.ts.map +1 -0
  155. package/dist/types/index.js +152 -0
  156. package/dist/types/index.js.bak +152 -0
  157. package/dist/types/index.js.map +1 -0
  158. package/dist/vue/index.d.ts +18 -0
  159. package/dist/vue/index.d.ts.bak +18 -0
  160. package/dist/vue/index.d.ts.map +1 -0
  161. package/dist/vue/index.js +18 -0
  162. package/dist/vue/index.js.bak +18 -0
  163. package/dist/vue/index.js.map +1 -0
  164. package/dist/vue/renderer.d.ts +46 -0
  165. package/dist/vue/renderer.d.ts.bak +46 -0
  166. package/dist/vue/renderer.d.ts.map +1 -0
  167. package/dist/vue/renderer.js +302 -0
  168. package/dist/vue/renderer.js.bak +302 -0
  169. package/dist/vue/renderer.js.map +1 -0
  170. package/package.json +72 -0
@@ -0,0 +1,349 @@
1
+ /**
2
+ * A2R-IX (A2R Interface) Types
3
+ *
4
+ * Declarative UI Intermediate Representation
5
+ */
6
+ /**
7
+ * UI Root - Top-level document
8
+ */
9
+ export interface UIRoot {
10
+ /** Schema version */
11
+ version: string;
12
+ /** Component tree */
13
+ components: UIComponent[];
14
+ /** State definitions */
15
+ state: UIState;
16
+ /** Action handlers */
17
+ actions: UIAction[];
18
+ /** Custom CSS */
19
+ css?: string;
20
+ /** Metadata */
21
+ metadata?: UIMetadata;
22
+ }
23
+ /**
24
+ * UI Component
25
+ */
26
+ export interface UIComponent {
27
+ /** Unique component ID */
28
+ id: string;
29
+ /** Component type (from catalog) */
30
+ type: string;
31
+ /** Component properties */
32
+ props: Record<string, unknown>;
33
+ /** Child components */
34
+ children?: UIComponent[];
35
+ /** State bindings */
36
+ bindings?: StateBinding[];
37
+ /** Event handlers */
38
+ events?: EventHandler[];
39
+ /** Conditional render */
40
+ condition?: Expression;
41
+ /** Repeat/for loop */
42
+ repeat?: RepeatBinding;
43
+ /** Style overrides */
44
+ style?: Record<string, string | number>;
45
+ /** CSS class */
46
+ className?: string;
47
+ }
48
+ /**
49
+ * UI State definition
50
+ */
51
+ export interface UIState {
52
+ /** State variables */
53
+ variables: StateVariable[];
54
+ /** Computed values */
55
+ computed?: ComputedValue[];
56
+ /** Initial values */
57
+ initial?: Record<string, unknown>;
58
+ }
59
+ /**
60
+ * State variable
61
+ */
62
+ export interface StateVariable {
63
+ /** Variable name/path */
64
+ path: string;
65
+ /** Variable type */
66
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any';
67
+ /** Default value */
68
+ default?: unknown;
69
+ /** Validation rules */
70
+ validation?: ValidationRule[];
71
+ /** Persistence config */
72
+ persist?: boolean | PersistenceConfig;
73
+ }
74
+ /**
75
+ * Persistence configuration
76
+ */
77
+ export interface PersistenceConfig {
78
+ /** Storage key */
79
+ key: string;
80
+ /** Storage type */
81
+ storage: 'localStorage' | 'sessionStorage' | 'indexedDB';
82
+ /** Encrypt data */
83
+ encrypt?: boolean;
84
+ /** TTL in ms */
85
+ ttl?: number;
86
+ }
87
+ /**
88
+ * Computed value
89
+ */
90
+ export interface ComputedValue {
91
+ /** Computed value name */
92
+ name: string;
93
+ /** Dependencies */
94
+ deps: string[];
95
+ /** Compute expression */
96
+ compute: Expression;
97
+ /** Cache result */
98
+ cache?: boolean;
99
+ }
100
+ /**
101
+ * State binding
102
+ */
103
+ export interface StateBinding {
104
+ /** Property to bind */
105
+ prop: string;
106
+ /** State path */
107
+ statePath: string;
108
+ /** Binding direction */
109
+ direction: 'one-way' | 'two-way';
110
+ /** Transform function */
111
+ transform?: Expression;
112
+ }
113
+ /**
114
+ * Repeat/for binding
115
+ */
116
+ export interface RepeatBinding {
117
+ /** Array state path */
118
+ items: string;
119
+ /** Item variable name */
120
+ as: string;
121
+ /** Index variable name */
122
+ indexAs?: string;
123
+ /** Filter expression */
124
+ filter?: Expression;
125
+ /** Sort expression */
126
+ sort?: Expression;
127
+ }
128
+ /**
129
+ * Event handler
130
+ */
131
+ export interface EventHandler {
132
+ /** Event name (e.g., 'onClick', 'onChange') */
133
+ event: string;
134
+ /** Action to execute */
135
+ action: string;
136
+ /** Action parameters */
137
+ params?: Record<string, unknown>;
138
+ /** Condition to execute */
139
+ condition?: Expression;
140
+ /** Prevent default */
141
+ preventDefault?: boolean;
142
+ /** Stop propagation */
143
+ stopPropagation?: boolean;
144
+ }
145
+ /**
146
+ * UI Action
147
+ */
148
+ export interface UIAction {
149
+ /** Action ID */
150
+ id: string;
151
+ /** Action type */
152
+ type: 'setState' | 'callFunction' | 'emitEvent' | 'navigate' | 'validate' | 'custom';
153
+ /** Handler implementation */
154
+ handler: ActionHandler;
155
+ /** Async action */
156
+ async?: boolean;
157
+ /** Debounce ms */
158
+ debounce?: number;
159
+ /** Throttle ms */
160
+ throttle?: number;
161
+ }
162
+ /**
163
+ * Action handler
164
+ */
165
+ export type ActionHandler = {
166
+ type: 'setState';
167
+ path: string;
168
+ value: Expression;
169
+ } | {
170
+ type: 'callFunction';
171
+ name: string;
172
+ args: Expression[];
173
+ } | {
174
+ type: 'emitEvent';
175
+ name: string;
176
+ payload: Expression;
177
+ } | {
178
+ type: 'navigate';
179
+ to: string;
180
+ params?: Record<string, Expression>;
181
+ } | {
182
+ type: 'validate';
183
+ paths: string[];
184
+ } | {
185
+ type: 'custom';
186
+ fn: string;
187
+ };
188
+ /**
189
+ * Custom handler execution context
190
+ */
191
+ export interface CustomHandlerContext {
192
+ /** Current state */
193
+ state: Record<string, unknown>;
194
+ /** Action parameters */
195
+ params?: Record<string, unknown>;
196
+ /** Original event */
197
+ event?: unknown;
198
+ /** Set state helper */
199
+ setState: (path: string, value: unknown) => void;
200
+ /** Get state helper */
201
+ getState: (path: string) => unknown;
202
+ }
203
+ /**
204
+ * Custom handler function type
205
+ */
206
+ export type CustomHandlerFn = (context: CustomHandlerContext) => void | Promise<void>;
207
+ /**
208
+ * Expression - can be evaluated
209
+ */
210
+ export type Expression = string | number | boolean | null | {
211
+ $expr: string;
212
+ $deps?: string[];
213
+ } | {
214
+ $path: string;
215
+ } | {
216
+ $fn: string;
217
+ $args: Expression[];
218
+ } | {
219
+ $cond: [Expression, Expression, Expression];
220
+ } | {
221
+ $and: Expression[];
222
+ } | {
223
+ $or: Expression[];
224
+ } | {
225
+ $not: Expression;
226
+ } | {
227
+ $eq: [Expression, Expression];
228
+ } | {
229
+ $gt: [Expression, Expression];
230
+ } | {
231
+ $lt: [Expression, Expression];
232
+ } | {
233
+ $add: [Expression, Expression];
234
+ } | {
235
+ $concat: Expression[];
236
+ };
237
+ /**
238
+ * Validation rule
239
+ */
240
+ export interface ValidationRule {
241
+ /** Rule type */
242
+ type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'custom';
243
+ /** Rule value */
244
+ value?: unknown;
245
+ /** Error message */
246
+ message: string;
247
+ }
248
+ /**
249
+ * UI Metadata
250
+ */
251
+ export interface UIMetadata {
252
+ /** Document title */
253
+ title?: string;
254
+ /** Document description */
255
+ description?: string;
256
+ /** Author */
257
+ author?: string;
258
+ /** Created timestamp */
259
+ createdAt?: string;
260
+ /** Last updated */
261
+ updatedAt?: string;
262
+ /** Tags */
263
+ tags?: string[];
264
+ }
265
+ /**
266
+ * Component catalog entry
267
+ */
268
+ export interface CatalogEntry {
269
+ /** Component name */
270
+ name: string;
271
+ /** Component version */
272
+ version: string;
273
+ /** Component category */
274
+ category: string;
275
+ /** Prop schema */
276
+ props: PropSchema[];
277
+ /** Description */
278
+ description?: string;
279
+ /** Example usage */
280
+ examples?: UIComponent[];
281
+ /** Icon */
282
+ icon?: string;
283
+ /** Whether component accepts children */
284
+ acceptChildren?: boolean;
285
+ /** Required parent types */
286
+ requiredParent?: string[];
287
+ }
288
+ /**
289
+ * Property schema
290
+ */
291
+ export interface PropSchema {
292
+ /** Property name */
293
+ name: string;
294
+ /** Property type */
295
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'function' | 'any';
296
+ /** Required */
297
+ required?: boolean;
298
+ /** Default value */
299
+ default?: unknown;
300
+ /** Allowed values (for enums) */
301
+ enum?: unknown[];
302
+ /** Property description */
303
+ description?: string;
304
+ /** Validation */
305
+ validation?: ValidationRule[];
306
+ }
307
+ /**
308
+ * JSON Patch operation (RFC 6902)
309
+ */
310
+ export interface JSONPatch {
311
+ /** Operation type */
312
+ op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
313
+ /** Target path */
314
+ path: string;
315
+ /** Value (for add/replace/test) */
316
+ value?: unknown;
317
+ /** Source path (for move/copy) */
318
+ from?: string;
319
+ }
320
+ /**
321
+ * UI Update patch
322
+ */
323
+ export interface UIPatch {
324
+ /** Patch ID */
325
+ id: string;
326
+ /** Timestamp */
327
+ timestamp: number;
328
+ /** Patches to apply */
329
+ patches: JSONPatch[];
330
+ /** Source (who made the change) */
331
+ source?: string;
332
+ /** Change description */
333
+ description?: string;
334
+ }
335
+ /**
336
+ * Evaluate expression
337
+ */
338
+ export declare function evaluateExpression(expr: Expression, context: Record<string, unknown>): unknown;
339
+ /** Schema version */
340
+ export declare const UI_IR_VERSION = "1.0.0";
341
+ /**
342
+ * Validate UIRoot structure
343
+ */
344
+ export declare function validateUIRoot(root: unknown): root is UIRoot;
345
+ /**
346
+ * Create empty UI root
347
+ */
348
+ export declare function createEmptyRoot(): UIRoot;
349
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,349 @@
1
+ /**
2
+ * A2R-IX (A2R Interface) Types
3
+ *
4
+ * Declarative UI Intermediate Representation
5
+ */
6
+ /**
7
+ * UI Root - Top-level document
8
+ */
9
+ export interface UIRoot {
10
+ /** Schema version */
11
+ version: string;
12
+ /** Component tree */
13
+ components: UIComponent[];
14
+ /** State definitions */
15
+ state: UIState;
16
+ /** Action handlers */
17
+ actions: UIAction[];
18
+ /** Custom CSS */
19
+ css?: string;
20
+ /** Metadata */
21
+ metadata?: UIMetadata;
22
+ }
23
+ /**
24
+ * UI Component
25
+ */
26
+ export interface UIComponent {
27
+ /** Unique component ID */
28
+ id: string;
29
+ /** Component type (from catalog) */
30
+ type: string;
31
+ /** Component properties */
32
+ props: Record<string, unknown>;
33
+ /** Child components */
34
+ children?: UIComponent[];
35
+ /** State bindings */
36
+ bindings?: StateBinding[];
37
+ /** Event handlers */
38
+ events?: EventHandler[];
39
+ /** Conditional render */
40
+ condition?: Expression;
41
+ /** Repeat/for loop */
42
+ repeat?: RepeatBinding;
43
+ /** Style overrides */
44
+ style?: Record<string, string | number>;
45
+ /** CSS class */
46
+ className?: string;
47
+ }
48
+ /**
49
+ * UI State definition
50
+ */
51
+ export interface UIState {
52
+ /** State variables */
53
+ variables: StateVariable[];
54
+ /** Computed values */
55
+ computed?: ComputedValue[];
56
+ /** Initial values */
57
+ initial?: Record<string, unknown>;
58
+ }
59
+ /**
60
+ * State variable
61
+ */
62
+ export interface StateVariable {
63
+ /** Variable name/path */
64
+ path: string;
65
+ /** Variable type */
66
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any';
67
+ /** Default value */
68
+ default?: unknown;
69
+ /** Validation rules */
70
+ validation?: ValidationRule[];
71
+ /** Persistence config */
72
+ persist?: boolean | PersistenceConfig;
73
+ }
74
+ /**
75
+ * Persistence configuration
76
+ */
77
+ export interface PersistenceConfig {
78
+ /** Storage key */
79
+ key: string;
80
+ /** Storage type */
81
+ storage: 'localStorage' | 'sessionStorage' | 'indexedDB';
82
+ /** Encrypt data */
83
+ encrypt?: boolean;
84
+ /** TTL in ms */
85
+ ttl?: number;
86
+ }
87
+ /**
88
+ * Computed value
89
+ */
90
+ export interface ComputedValue {
91
+ /** Computed value name */
92
+ name: string;
93
+ /** Dependencies */
94
+ deps: string[];
95
+ /** Compute expression */
96
+ compute: Expression;
97
+ /** Cache result */
98
+ cache?: boolean;
99
+ }
100
+ /**
101
+ * State binding
102
+ */
103
+ export interface StateBinding {
104
+ /** Property to bind */
105
+ prop: string;
106
+ /** State path */
107
+ statePath: string;
108
+ /** Binding direction */
109
+ direction: 'one-way' | 'two-way';
110
+ /** Transform function */
111
+ transform?: Expression;
112
+ }
113
+ /**
114
+ * Repeat/for binding
115
+ */
116
+ export interface RepeatBinding {
117
+ /** Array state path */
118
+ items: string;
119
+ /** Item variable name */
120
+ as: string;
121
+ /** Index variable name */
122
+ indexAs?: string;
123
+ /** Filter expression */
124
+ filter?: Expression;
125
+ /** Sort expression */
126
+ sort?: Expression;
127
+ }
128
+ /**
129
+ * Event handler
130
+ */
131
+ export interface EventHandler {
132
+ /** Event name (e.g., 'onClick', 'onChange') */
133
+ event: string;
134
+ /** Action to execute */
135
+ action: string;
136
+ /** Action parameters */
137
+ params?: Record<string, unknown>;
138
+ /** Condition to execute */
139
+ condition?: Expression;
140
+ /** Prevent default */
141
+ preventDefault?: boolean;
142
+ /** Stop propagation */
143
+ stopPropagation?: boolean;
144
+ }
145
+ /**
146
+ * UI Action
147
+ */
148
+ export interface UIAction {
149
+ /** Action ID */
150
+ id: string;
151
+ /** Action type */
152
+ type: 'setState' | 'callFunction' | 'emitEvent' | 'navigate' | 'validate' | 'custom';
153
+ /** Handler implementation */
154
+ handler: ActionHandler;
155
+ /** Async action */
156
+ async?: boolean;
157
+ /** Debounce ms */
158
+ debounce?: number;
159
+ /** Throttle ms */
160
+ throttle?: number;
161
+ }
162
+ /**
163
+ * Action handler
164
+ */
165
+ export type ActionHandler = {
166
+ type: 'setState';
167
+ path: string;
168
+ value: Expression;
169
+ } | {
170
+ type: 'callFunction';
171
+ name: string;
172
+ args: Expression[];
173
+ } | {
174
+ type: 'emitEvent';
175
+ name: string;
176
+ payload: Expression;
177
+ } | {
178
+ type: 'navigate';
179
+ to: string;
180
+ params?: Record<string, Expression>;
181
+ } | {
182
+ type: 'validate';
183
+ paths: string[];
184
+ } | {
185
+ type: 'custom';
186
+ fn: string;
187
+ };
188
+ /**
189
+ * Custom handler execution context
190
+ */
191
+ export interface CustomHandlerContext {
192
+ /** Current state */
193
+ state: Record<string, unknown>;
194
+ /** Action parameters */
195
+ params?: Record<string, unknown>;
196
+ /** Original event */
197
+ event?: unknown;
198
+ /** Set state helper */
199
+ setState: (path: string, value: unknown) => void;
200
+ /** Get state helper */
201
+ getState: (path: string) => unknown;
202
+ }
203
+ /**
204
+ * Custom handler function type
205
+ */
206
+ export type CustomHandlerFn = (context: CustomHandlerContext) => void | Promise<void>;
207
+ /**
208
+ * Expression - can be evaluated
209
+ */
210
+ export type Expression = string | number | boolean | null | {
211
+ $expr: string;
212
+ $deps?: string[];
213
+ } | {
214
+ $path: string;
215
+ } | {
216
+ $fn: string;
217
+ $args: Expression[];
218
+ } | {
219
+ $cond: [Expression, Expression, Expression];
220
+ } | {
221
+ $and: Expression[];
222
+ } | {
223
+ $or: Expression[];
224
+ } | {
225
+ $not: Expression;
226
+ } | {
227
+ $eq: [Expression, Expression];
228
+ } | {
229
+ $gt: [Expression, Expression];
230
+ } | {
231
+ $lt: [Expression, Expression];
232
+ } | {
233
+ $add: [Expression, Expression];
234
+ } | {
235
+ $concat: Expression[];
236
+ };
237
+ /**
238
+ * Validation rule
239
+ */
240
+ export interface ValidationRule {
241
+ /** Rule type */
242
+ type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'custom';
243
+ /** Rule value */
244
+ value?: unknown;
245
+ /** Error message */
246
+ message: string;
247
+ }
248
+ /**
249
+ * UI Metadata
250
+ */
251
+ export interface UIMetadata {
252
+ /** Document title */
253
+ title?: string;
254
+ /** Document description */
255
+ description?: string;
256
+ /** Author */
257
+ author?: string;
258
+ /** Created timestamp */
259
+ createdAt?: string;
260
+ /** Last updated */
261
+ updatedAt?: string;
262
+ /** Tags */
263
+ tags?: string[];
264
+ }
265
+ /**
266
+ * Component catalog entry
267
+ */
268
+ export interface CatalogEntry {
269
+ /** Component name */
270
+ name: string;
271
+ /** Component version */
272
+ version: string;
273
+ /** Component category */
274
+ category: string;
275
+ /** Prop schema */
276
+ props: PropSchema[];
277
+ /** Description */
278
+ description?: string;
279
+ /** Example usage */
280
+ examples?: UIComponent[];
281
+ /** Icon */
282
+ icon?: string;
283
+ /** Whether component accepts children */
284
+ acceptChildren?: boolean;
285
+ /** Required parent types */
286
+ requiredParent?: string[];
287
+ }
288
+ /**
289
+ * Property schema
290
+ */
291
+ export interface PropSchema {
292
+ /** Property name */
293
+ name: string;
294
+ /** Property type */
295
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'function' | 'any';
296
+ /** Required */
297
+ required?: boolean;
298
+ /** Default value */
299
+ default?: unknown;
300
+ /** Allowed values (for enums) */
301
+ enum?: unknown[];
302
+ /** Property description */
303
+ description?: string;
304
+ /** Validation */
305
+ validation?: ValidationRule[];
306
+ }
307
+ /**
308
+ * JSON Patch operation (RFC 6902)
309
+ */
310
+ export interface JSONPatch {
311
+ /** Operation type */
312
+ op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
313
+ /** Target path */
314
+ path: string;
315
+ /** Value (for add/replace/test) */
316
+ value?: unknown;
317
+ /** Source path (for move/copy) */
318
+ from?: string;
319
+ }
320
+ /**
321
+ * UI Update patch
322
+ */
323
+ export interface UIPatch {
324
+ /** Patch ID */
325
+ id: string;
326
+ /** Timestamp */
327
+ timestamp: number;
328
+ /** Patches to apply */
329
+ patches: JSONPatch[];
330
+ /** Source (who made the change) */
331
+ source?: string;
332
+ /** Change description */
333
+ description?: string;
334
+ }
335
+ /**
336
+ * Evaluate expression
337
+ */
338
+ export declare function evaluateExpression(expr: Expression, context: Record<string, unknown>): unknown;
339
+ /** Schema version */
340
+ export declare const UI_IR_VERSION = "1.0.0";
341
+ /**
342
+ * Validate UIRoot structure
343
+ */
344
+ export declare function validateUIRoot(root: unknown): root is UIRoot;
345
+ /**
346
+ * Create empty UI root
347
+ */
348
+ export declare function createEmptyRoot(): UIRoot;
349
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,wBAAwB;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,sBAAsB;IACtB,OAAO,EAAE,QAAQ,EAAE,CAAC;IACp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