@allternit/ix 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/adapters/json-render.d.ts +5 -5
- package/dist/adapters/json-render.js +12 -12
- package/dist/collab/visual-editor.d.ts +1 -1
- package/dist/collab/visual-editor.js +4 -4
- package/dist/collab/visual-editor.js.map +1 -1
- package/dist/collab/yjs-adapter.d.ts +1 -1
- package/dist/collab/yjs-adapter.js +2 -2
- package/dist/collab/yjs-adapter.js.map +1 -1
- package/dist/collab/yjs-client.js +1 -1
- package/dist/collab/yjs-client.js.map +1 -1
- package/dist/collab/yjs-types.js +1 -1
- package/dist/collab/yjs-types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pipeline/llm-to-ix.d.ts +5 -5
- package/dist/pipeline/llm-to-ix.d.ts.map +1 -1
- package/dist/pipeline/llm-to-ix.js +6 -6
- package/dist/react/renderer.d.ts +2 -2
- package/dist/react/renderer.js +3 -3
- package/dist/react/renderer.js.map +1 -1
- package/dist/renderer/renderer.d.ts +1 -1
- package/dist/renderer/renderer.js +1 -1
- package/dist/runtime/capsule-runtime.d.ts +1 -1
- package/dist/runtime/capsule-runtime.js +1 -1
- package/dist/sdk/api.d.ts +3 -3
- package/dist/sdk/api.js +3 -3
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +2 -2
- package/dist/sdk/react.d.ts +2 -2
- package/dist/sdk/react.js +2 -2
- package/dist/state/index.d.ts +1 -1
- package/dist/state/index.js +1 -1
- package/dist/state/store.d.ts +1 -1
- package/dist/state/store.js +3 -3
- package/dist/state/store.js.map +1 -1
- package/dist/svelte/index.d.ts +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/svelte/renderer.d.ts +3 -3
- package/dist/svelte/renderer.js +4 -4
- package/dist/svelte/renderer.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/vue/renderer.d.ts +3 -3
- package/dist/vue/renderer.js +5 -5
- package/dist/vue/renderer.js.map +1 -1
- package/package.json +8 -8
- package/dist/adapters/json-render.d.ts.bak +0 -211
- package/dist/adapters/json-render.js.bak +0 -576
- package/dist/catalog/registry.d.ts.bak +0 -65
- package/dist/catalog/registry.js.bak +0 -388
- package/dist/collab/capsule-registry.d.ts.bak +0 -114
- package/dist/collab/capsule-registry.js.bak +0 -271
- package/dist/collab/index.d.ts.bak +0 -21
- package/dist/collab/index.js.bak +0 -32
- package/dist/collab/visual-editor.d.ts.bak +0 -199
- package/dist/collab/visual-editor.js.bak +0 -259
- package/dist/collab/yjs-adapter.d.ts.bak +0 -95
- package/dist/collab/yjs-adapter.js.bak +0 -282
- package/dist/collab/yjs-client.d.ts.bak +0 -101
- package/dist/collab/yjs-client.js.bak +0 -193
- package/dist/collab/yjs-protocols.d.ts.bak +0 -128
- package/dist/collab/yjs-protocols.js.bak +0 -245
- package/dist/collab/yjs-types.d.ts.bak +0 -201
- package/dist/collab/yjs-types.js.bak +0 -45
- package/dist/index.d.ts.bak +0 -38
- package/dist/index.js.bak +0 -48
- package/dist/pipeline/llm-to-ix.d.ts.bak +0 -249
- package/dist/pipeline/llm-to-ix.js.bak +0 -992
- package/dist/react/index.d.ts.bak +0 -18
- package/dist/react/index.js.bak +0 -18
- package/dist/react/renderer.d.ts.bak +0 -47
- package/dist/react/renderer.js.bak +0 -420
- package/dist/renderer/renderer.d.ts.bak +0 -55
- package/dist/renderer/renderer.js.bak +0 -232
- package/dist/runtime/capsule-runtime.d.ts.bak +0 -227
- package/dist/runtime/capsule-runtime.js.bak +0 -563
- package/dist/runtime/policy-gates.d.ts.bak +0 -116
- package/dist/runtime/policy-gates.js.bak +0 -317
- package/dist/schema/ui-ir.d.ts.bak +0 -26
- package/dist/schema/ui-ir.js.bak +0 -51
- package/dist/sdk/api.d.ts.bak +0 -101
- package/dist/sdk/api.js.bak +0 -177
- package/dist/sdk/index.d.ts.bak +0 -9
- package/dist/sdk/index.js.bak +0 -10
- package/dist/sdk/react.d.ts.bak +0 -63
- package/dist/sdk/react.js.bak +0 -161
- package/dist/state/index.d.ts.bak +0 -8
- package/dist/state/index.js.bak +0 -8
- package/dist/state/patch.d.ts.bak +0 -73
- package/dist/state/patch.js.bak +0 -437
- package/dist/state/store.d.ts.bak +0 -50
- package/dist/state/store.js.bak +0 -246
- package/dist/svelte/index.d.ts.bak +0 -15
- package/dist/svelte/index.js.bak +0 -15
- package/dist/svelte/renderer.d.ts.bak +0 -35
- package/dist/svelte/renderer.js.bak +0 -317
- package/dist/types/index.d.ts.bak +0 -349
- package/dist/types/index.js.bak +0 -152
- package/dist/vue/index.d.ts.bak +0 -18
- package/dist/vue/index.js.bak +0 -18
- package/dist/vue/renderer.d.ts.bak +0 -46
- package/dist/vue/renderer.js.bak +0 -302
|
@@ -1,349 +0,0 @@
|
|
|
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
|
package/dist/types/index.js.bak
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2R-IX (A2R Interface) Types
|
|
3
|
-
*
|
|
4
|
-
* Declarative UI Intermediate Representation
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Evaluate expression
|
|
8
|
-
*/
|
|
9
|
-
export function evaluateExpression(expr, context) {
|
|
10
|
-
// String path reference
|
|
11
|
-
if (typeof expr === 'string') {
|
|
12
|
-
return getValueByPath(context, expr) ?? expr;
|
|
13
|
-
}
|
|
14
|
-
// Number literal
|
|
15
|
-
if (typeof expr === 'number') {
|
|
16
|
-
return expr;
|
|
17
|
-
}
|
|
18
|
-
// Boolean literal
|
|
19
|
-
if (typeof expr === 'boolean') {
|
|
20
|
-
return expr;
|
|
21
|
-
}
|
|
22
|
-
// Null literal
|
|
23
|
-
if (expr === null) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
// Object expressions
|
|
27
|
-
if (typeof expr === 'object') {
|
|
28
|
-
// State path reference
|
|
29
|
-
if ('$path' in expr) {
|
|
30
|
-
return getValueByPath(context, expr.$path);
|
|
31
|
-
}
|
|
32
|
-
// Expression
|
|
33
|
-
if ('$expr' in expr) {
|
|
34
|
-
// Simple expression evaluation (would use proper parser in production)
|
|
35
|
-
return evaluateSimpleExpr(expr.$expr, context);
|
|
36
|
-
}
|
|
37
|
-
// Function call
|
|
38
|
-
if ('$fn' in expr) {
|
|
39
|
-
const fn = context[expr.$fn];
|
|
40
|
-
if (typeof fn === 'function') {
|
|
41
|
-
const args = expr.$args.map((arg) => evaluateExpression(arg, context));
|
|
42
|
-
return fn(...args);
|
|
43
|
-
}
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
// Ternary
|
|
47
|
-
if ('$cond' in expr) {
|
|
48
|
-
const [condition, trueValue, falseValue] = expr.$cond;
|
|
49
|
-
return evaluateExpression(condition, context)
|
|
50
|
-
? evaluateExpression(trueValue, context)
|
|
51
|
-
: evaluateExpression(falseValue, context);
|
|
52
|
-
}
|
|
53
|
-
// Logical AND
|
|
54
|
-
if ('$and' in expr) {
|
|
55
|
-
return expr.$and.every((e) => evaluateExpression(e, context));
|
|
56
|
-
}
|
|
57
|
-
// Logical OR
|
|
58
|
-
if ('$or' in expr) {
|
|
59
|
-
return expr.$or.some((e) => evaluateExpression(e, context));
|
|
60
|
-
}
|
|
61
|
-
// Logical NOT
|
|
62
|
-
if ('$not' in expr) {
|
|
63
|
-
return !evaluateExpression(expr.$not, context);
|
|
64
|
-
}
|
|
65
|
-
// Equality
|
|
66
|
-
if ('$eq' in expr) {
|
|
67
|
-
const [a, b] = expr.$eq;
|
|
68
|
-
return evaluateExpression(a, context) === evaluateExpression(b, context);
|
|
69
|
-
}
|
|
70
|
-
// Greater than
|
|
71
|
-
if ('$gt' in expr) {
|
|
72
|
-
const [a, b] = expr.$gt;
|
|
73
|
-
return evaluateExpression(a, context) > evaluateExpression(b, context);
|
|
74
|
-
}
|
|
75
|
-
// Less than
|
|
76
|
-
if ('$lt' in expr) {
|
|
77
|
-
const [a, b] = expr.$lt;
|
|
78
|
-
return evaluateExpression(a, context) < evaluateExpression(b, context);
|
|
79
|
-
}
|
|
80
|
-
// Addition
|
|
81
|
-
if ('$add' in expr) {
|
|
82
|
-
const [a, b] = expr.$add;
|
|
83
|
-
return evaluateExpression(a, context) + evaluateExpression(b, context);
|
|
84
|
-
}
|
|
85
|
-
// Concatenation
|
|
86
|
-
if ('$concat' in expr) {
|
|
87
|
-
return expr.$concat.map((e) => String(evaluateExpression(e, context))).join('');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Get value by path
|
|
94
|
-
*/
|
|
95
|
-
function getValueByPath(obj, path) {
|
|
96
|
-
return path.split('.').reduce((acc, key) => {
|
|
97
|
-
if (acc && typeof acc === 'object') {
|
|
98
|
-
return acc[key];
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
101
|
-
}, obj);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Evaluate simple expression
|
|
105
|
-
*/
|
|
106
|
-
function evaluateSimpleExpr(expr, context) {
|
|
107
|
-
// Replace state paths with values
|
|
108
|
-
const processed = expr.replace(/\{\{([^}]+)\}\}/g, (match, path) => {
|
|
109
|
-
const value = getValueByPath(context, path.trim());
|
|
110
|
-
return value !== undefined ? JSON.stringify(value) : match;
|
|
111
|
-
});
|
|
112
|
-
try {
|
|
113
|
-
// eslint-disable-next-line no-new-func
|
|
114
|
-
return new Function('context', `return ${processed}`)(context);
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
return processed;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/** Schema version */
|
|
121
|
-
export const UI_IR_VERSION = '1.0.0';
|
|
122
|
-
/**
|
|
123
|
-
* Validate UIRoot structure
|
|
124
|
-
*/
|
|
125
|
-
export function validateUIRoot(root) {
|
|
126
|
-
if (!root || typeof root !== 'object')
|
|
127
|
-
return false;
|
|
128
|
-
const r = root;
|
|
129
|
-
if (typeof r.version !== 'string')
|
|
130
|
-
return false;
|
|
131
|
-
if (!Array.isArray(r.components))
|
|
132
|
-
return false;
|
|
133
|
-
if (!r.state || typeof r.state !== 'object')
|
|
134
|
-
return false;
|
|
135
|
-
if (!Array.isArray(r.actions))
|
|
136
|
-
return false;
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Create empty UI root
|
|
141
|
-
*/
|
|
142
|
-
export function createEmptyRoot() {
|
|
143
|
-
return {
|
|
144
|
-
version: UI_IR_VERSION,
|
|
145
|
-
components: [],
|
|
146
|
-
state: {
|
|
147
|
-
variables: [],
|
|
148
|
-
},
|
|
149
|
-
actions: [],
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=index.js.map
|
package/dist/vue/index.d.ts.bak
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Renderer
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import { createVueRenderer } from '@allternit/ix/vue';
|
|
7
|
-
* import { createApp, h } from 'vue';
|
|
8
|
-
*
|
|
9
|
-
* const renderer = createVueRenderer({
|
|
10
|
-
* stateStore: createStateStore(),
|
|
11
|
-
* });
|
|
12
|
-
*
|
|
13
|
-
* const App = renderer.render(uiDefinition);
|
|
14
|
-
* createApp(App).mount('#app');
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export { createVueRenderer, type VueRenderer, type VueRendererConfig, } from './renderer';
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/vue/index.js.bak
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Renderer
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import { createVueRenderer } from '@allternit/ix/vue';
|
|
7
|
-
* import { createApp, h } from 'vue';
|
|
8
|
-
*
|
|
9
|
-
* const renderer = createVueRenderer({
|
|
10
|
-
* stateStore: createStateStore(),
|
|
11
|
-
* });
|
|
12
|
-
*
|
|
13
|
-
* const App = renderer.render(uiDefinition);
|
|
14
|
-
* createApp(App).mount('#app');
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export { createVueRenderer, } from './renderer';
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Renderer for A2R-IX
|
|
3
|
-
*
|
|
4
|
-
* Renders A2R-IX UI IR to Vue 3 components.
|
|
5
|
-
*/
|
|
6
|
-
import type { UIRoot } from '../types';
|
|
7
|
-
import type { StateStore } from '../state/store';
|
|
8
|
-
import type { ComponentCatalog } from '../catalog/registry';
|
|
9
|
-
import type { DefineComponent } from 'vue';
|
|
10
|
-
export interface VueRendererConfig {
|
|
11
|
-
/** Component catalog */
|
|
12
|
-
catalog?: ComponentCatalog;
|
|
13
|
-
/** Initial state store */
|
|
14
|
-
stateStore?: StateStore;
|
|
15
|
-
/** Component mapping (type -> Vue component) */
|
|
16
|
-
components?: Record<string, DefineComponent>;
|
|
17
|
-
/** Event handler */
|
|
18
|
-
onEvent?: (name: string, payload: unknown) => void;
|
|
19
|
-
/** Error handler */
|
|
20
|
-
onError?: (error: Error, componentId?: string) => void;
|
|
21
|
-
}
|
|
22
|
-
export interface VueRenderer {
|
|
23
|
-
/** Generate component definition for Vue */
|
|
24
|
-
generateComponent(root: UIRoot): VueComponentDefinition;
|
|
25
|
-
}
|
|
26
|
-
export interface VueComponentDefinition {
|
|
27
|
-
/** Component name */
|
|
28
|
-
name: string;
|
|
29
|
-
/** Props definition */
|
|
30
|
-
props: Record<string, unknown>;
|
|
31
|
-
/** Setup function code */
|
|
32
|
-
setup: string;
|
|
33
|
-
/** Template */
|
|
34
|
-
template: string;
|
|
35
|
-
/** Styles */
|
|
36
|
-
styles?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create Vue renderer
|
|
40
|
-
*/
|
|
41
|
-
export declare function createVueRenderer(config: VueRendererConfig): VueRenderer;
|
|
42
|
-
/**
|
|
43
|
-
* Compile A2R-IX UI to Vue component definition
|
|
44
|
-
*/
|
|
45
|
-
export declare function compileToVue(root: UIRoot, config?: VueRendererConfig): VueComponentDefinition;
|
|
46
|
-
//# sourceMappingURL=renderer.d.ts.map
|