@constela/compiler 0.15.6 → 0.15.8
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/dist/index.d.ts +9 -1
- package/dist/index.js +18 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -445,7 +445,7 @@ interface CompiledPortalNode {
|
|
|
445
445
|
target: 'body' | 'head' | string;
|
|
446
446
|
children: CompiledNode[];
|
|
447
447
|
}
|
|
448
|
-
type CompiledExpression = CompiledLitExpr | CompiledStateExpr | CompiledVarExpr | CompiledBinExpr | CompiledNotExpr | CompiledCondExpr | CompiledGetExpr | CompiledRouteExpr | CompiledImportExpr | CompiledDataExpr | CompiledRefExpr | CompiledIndexExpr | CompiledParamExpr | CompiledStyleExpr | CompiledConcatExpr | CompiledValidityExpr | CompiledCallExpr | CompiledLambdaExpr | CompiledArrayExpr;
|
|
448
|
+
type CompiledExpression = CompiledLitExpr | CompiledStateExpr | CompiledLocalExpr | CompiledVarExpr | CompiledBinExpr | CompiledNotExpr | CompiledCondExpr | CompiledGetExpr | CompiledRouteExpr | CompiledImportExpr | CompiledDataExpr | CompiledRefExpr | CompiledIndexExpr | CompiledParamExpr | CompiledStyleExpr | CompiledConcatExpr | CompiledValidityExpr | CompiledCallExpr | CompiledLambdaExpr | CompiledArrayExpr | CompiledObjExpr;
|
|
449
449
|
interface CompiledLitExpr {
|
|
450
450
|
expr: 'lit';
|
|
451
451
|
value: string | number | boolean | null | unknown[];
|
|
@@ -455,6 +455,10 @@ interface CompiledStateExpr {
|
|
|
455
455
|
name: string;
|
|
456
456
|
path?: string;
|
|
457
457
|
}
|
|
458
|
+
interface CompiledLocalExpr {
|
|
459
|
+
expr: 'local';
|
|
460
|
+
name: string;
|
|
461
|
+
}
|
|
458
462
|
interface CompiledVarExpr {
|
|
459
463
|
expr: 'var';
|
|
460
464
|
name: string;
|
|
@@ -536,6 +540,10 @@ interface CompiledArrayExpr {
|
|
|
536
540
|
expr: 'array';
|
|
537
541
|
elements: CompiledExpression[];
|
|
538
542
|
}
|
|
543
|
+
interface CompiledObjExpr {
|
|
544
|
+
expr: 'obj';
|
|
545
|
+
props: Record<string, CompiledExpression>;
|
|
546
|
+
}
|
|
539
547
|
/**
|
|
540
548
|
* Compiled event handler options for special events like intersect
|
|
541
549
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1339,6 +1339,13 @@ function transformExpression(expr, ctx) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
return stateExpr;
|
|
1341
1341
|
}
|
|
1342
|
+
case "local": {
|
|
1343
|
+
const localExpr = {
|
|
1344
|
+
expr: "local",
|
|
1345
|
+
name: expr.name
|
|
1346
|
+
};
|
|
1347
|
+
return localExpr;
|
|
1348
|
+
}
|
|
1342
1349
|
case "var": {
|
|
1343
1350
|
const varExpr = {
|
|
1344
1351
|
expr: "var",
|
|
@@ -1496,6 +1503,17 @@ function transformExpression(expr, ctx) {
|
|
|
1496
1503
|
elements: arrayExpr.elements.map((elem) => transformExpression(elem, ctx))
|
|
1497
1504
|
};
|
|
1498
1505
|
}
|
|
1506
|
+
case "obj": {
|
|
1507
|
+
const objExpr = expr;
|
|
1508
|
+
const props = {};
|
|
1509
|
+
for (const [key, value] of Object.entries(objExpr.props)) {
|
|
1510
|
+
props[key] = transformExpression(value, ctx);
|
|
1511
|
+
}
|
|
1512
|
+
return {
|
|
1513
|
+
expr: "obj",
|
|
1514
|
+
props
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1499
1517
|
}
|
|
1500
1518
|
}
|
|
1501
1519
|
function transformEventHandler(handler, ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/compiler",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.8",
|
|
4
4
|
"description": "Compiler for Constela UI framework - AST to Program transformation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@constela/core": "0.18.
|
|
18
|
+
"@constela/core": "0.18.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.10.0",
|