@constela/compiler 0.15.13 → 0.15.15
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.js +15 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1979,7 +1979,7 @@ function transformViewNode(node, ctx) {
|
|
|
1979
1979
|
if (def.localState && Object.keys(def.localState).length > 0) {
|
|
1980
1980
|
return {
|
|
1981
1981
|
kind: "localState",
|
|
1982
|
-
state: transformLocalState(def.localState),
|
|
1982
|
+
state: transformLocalState(def.localState, newCtx),
|
|
1983
1983
|
actions: transformLocalActions(def.localActions ?? []),
|
|
1984
1984
|
child: expandedView
|
|
1985
1985
|
};
|
|
@@ -2075,10 +2075,14 @@ function transformState(state) {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
return compiledState;
|
|
2077
2077
|
}
|
|
2078
|
-
function transformLocalState(localState) {
|
|
2078
|
+
function transformLocalState(localState, ctx) {
|
|
2079
2079
|
const result = {};
|
|
2080
2080
|
for (const [name, field] of Object.entries(localState)) {
|
|
2081
|
-
|
|
2081
|
+
let initial = field.initial;
|
|
2082
|
+
if (ctx && initial && typeof initial === "object" && "expr" in initial) {
|
|
2083
|
+
initial = transformExpression(initial, ctx);
|
|
2084
|
+
}
|
|
2085
|
+
result[name] = { type: field.type, initial };
|
|
2082
2086
|
}
|
|
2083
2087
|
return result;
|
|
2084
2088
|
}
|
|
@@ -2782,10 +2786,14 @@ function transformActionStep2(step, ctx) {
|
|
|
2782
2786
|
};
|
|
2783
2787
|
}
|
|
2784
2788
|
}
|
|
2785
|
-
function transformLocalState2(localState) {
|
|
2789
|
+
function transformLocalState2(localState, ctx) {
|
|
2786
2790
|
const result = {};
|
|
2787
2791
|
for (const [name, field] of Object.entries(localState)) {
|
|
2788
|
-
|
|
2792
|
+
let initial = field.initial;
|
|
2793
|
+
if (ctx && initial && typeof initial === "object" && "expr" in initial) {
|
|
2794
|
+
initial = transformExpression2(initial, ctx);
|
|
2795
|
+
}
|
|
2796
|
+
result[name] = { type: field.type, initial };
|
|
2789
2797
|
}
|
|
2790
2798
|
return result;
|
|
2791
2799
|
}
|
|
@@ -2888,7 +2896,7 @@ function transformViewNode2(node, ctx) {
|
|
|
2888
2896
|
if (def.localState && Object.keys(def.localState).length > 0) {
|
|
2889
2897
|
return {
|
|
2890
2898
|
kind: "localState",
|
|
2891
|
-
state: transformLocalState2(def.localState),
|
|
2899
|
+
state: transformLocalState2(def.localState, newCtx),
|
|
2892
2900
|
actions: transformLocalActions2(def.localActions ?? [], newCtx),
|
|
2893
2901
|
child: expandedView
|
|
2894
2902
|
};
|
|
@@ -3148,7 +3156,7 @@ function expandComponentNode(node, components, defaultContent, namedContent, par
|
|
|
3148
3156
|
if (def.localState && Object.keys(def.localState).length > 0) {
|
|
3149
3157
|
return {
|
|
3150
3158
|
kind: "localState",
|
|
3151
|
-
state: transformLocalState2(def.localState),
|
|
3159
|
+
state: transformLocalState2(def.localState, newCtx),
|
|
3152
3160
|
actions: transformLocalActions2(def.localActions ?? [], newCtx),
|
|
3153
3161
|
child: processedView
|
|
3154
3162
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/compiler",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.15",
|
|
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
|
+
"@constela/core": "0.20.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.10.0",
|