@constela/start 1.9.18 → 1.9.19
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.
|
@@ -2042,6 +2042,39 @@ function substituteParamExpr(expr, props) {
|
|
|
2042
2042
|
key: substituteParamExpr(expr.key, props)
|
|
2043
2043
|
};
|
|
2044
2044
|
}
|
|
2045
|
+
if (expr.expr === "call") {
|
|
2046
|
+
return {
|
|
2047
|
+
...expr,
|
|
2048
|
+
target: expr.target ? substituteParamExpr(expr.target, props) : null,
|
|
2049
|
+
args: expr.args?.map((arg) => substituteParamExpr(arg, props))
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2052
|
+
if (expr.expr === "lambda") {
|
|
2053
|
+
return {
|
|
2054
|
+
...expr,
|
|
2055
|
+
body: substituteParamExpr(expr.body, props)
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
if (expr.expr === "array") {
|
|
2059
|
+
return {
|
|
2060
|
+
...expr,
|
|
2061
|
+
elements: expr.elements.map((el) => substituteParamExpr(el, props))
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
if (expr.expr === "obj") {
|
|
2065
|
+
return {
|
|
2066
|
+
...expr,
|
|
2067
|
+
props: Object.fromEntries(
|
|
2068
|
+
Object.entries(expr.props).map(([key, val]) => [key, substituteParamExpr(val, props)])
|
|
2069
|
+
)
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
if (expr.expr === "concat") {
|
|
2073
|
+
return {
|
|
2074
|
+
...expr,
|
|
2075
|
+
items: expr.items.map((item) => substituteParamExpr(item, props))
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2045
2078
|
return expr;
|
|
2046
2079
|
}
|
|
2047
2080
|
function substituteParamsInNode(node, props, components) {
|
|
@@ -2144,7 +2177,7 @@ function convertViewNode(node, components = {}) {
|
|
|
2144
2177
|
if (componentDef?.localState && Object.keys(componentDef.localState).length > 0) {
|
|
2145
2178
|
return {
|
|
2146
2179
|
kind: "localState",
|
|
2147
|
-
state: convertLocalState(componentDef.localState),
|
|
2180
|
+
state: convertLocalState(componentDef.localState, componentNode.props ?? {}),
|
|
2148
2181
|
actions: convertLocalActions(componentDef.localActions ?? []),
|
|
2149
2182
|
child: expandedView
|
|
2150
2183
|
};
|
|
@@ -2223,10 +2256,14 @@ function convertState(state) {
|
|
|
2223
2256
|
}
|
|
2224
2257
|
return result;
|
|
2225
2258
|
}
|
|
2226
|
-
function convertLocalState(localState) {
|
|
2259
|
+
function convertLocalState(localState, props) {
|
|
2227
2260
|
const result = {};
|
|
2228
2261
|
for (const [name, field] of Object.entries(localState)) {
|
|
2229
|
-
|
|
2262
|
+
let initial = field.initial;
|
|
2263
|
+
if (props && initial && typeof initial === "object" && "expr" in initial) {
|
|
2264
|
+
initial = substituteParamExpr(initial, props);
|
|
2265
|
+
}
|
|
2266
|
+
result[name] = { type: field.type, initial };
|
|
2230
2267
|
}
|
|
2231
2268
|
return result;
|
|
2232
2269
|
}
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/start",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.19",
|
|
4
4
|
"description": "Meta-framework for Constela applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@tailwindcss/postcss": "^4.0.0",
|
|
45
45
|
"tailwindcss": "^4.0.0",
|
|
46
46
|
"ws": "^8.18.0",
|
|
47
|
+
"@constela/runtime": "3.0.1",
|
|
47
48
|
"@constela/ai": "4.0.0",
|
|
48
|
-
"@constela/core": "0.19.0",
|
|
49
49
|
"@constela/router": "21.0.0",
|
|
50
|
-
"@constela/
|
|
51
|
-
"@constela/
|
|
50
|
+
"@constela/compiler": "0.15.14",
|
|
51
|
+
"@constela/core": "0.19.0",
|
|
52
52
|
"@constela/server": "15.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|