@constela/start 1.8.17 → 1.8.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.
|
@@ -2003,10 +2003,10 @@ function substituteParamsInNode(node, props, components) {
|
|
|
2003
2003
|
substituteParamExpr(value, props)
|
|
2004
2004
|
])
|
|
2005
2005
|
) : {};
|
|
2006
|
-
return
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2006
|
+
return {
|
|
2007
|
+
...componentNode,
|
|
2008
|
+
props: substitutedProps
|
|
2009
|
+
};
|
|
2010
2010
|
}
|
|
2011
2011
|
case "markdown":
|
|
2012
2012
|
return {
|
|
@@ -2036,8 +2036,19 @@ function expandComponent(node, components) {
|
|
|
2036
2036
|
function convertViewNode(node, components = {}) {
|
|
2037
2037
|
switch (node.kind) {
|
|
2038
2038
|
case "component": {
|
|
2039
|
-
const
|
|
2040
|
-
|
|
2039
|
+
const componentNode = node;
|
|
2040
|
+
const componentDef = components[componentNode.name];
|
|
2041
|
+
const expanded = expandComponent(componentNode, components);
|
|
2042
|
+
const expandedView = convertViewNode(expanded, components);
|
|
2043
|
+
if (componentDef?.localState && Object.keys(componentDef.localState).length > 0) {
|
|
2044
|
+
return {
|
|
2045
|
+
kind: "localState",
|
|
2046
|
+
state: convertLocalState(componentDef.localState),
|
|
2047
|
+
actions: convertLocalActions(componentDef.localActions ?? []),
|
|
2048
|
+
child: expandedView
|
|
2049
|
+
};
|
|
2050
|
+
}
|
|
2051
|
+
return expandedView;
|
|
2041
2052
|
}
|
|
2042
2053
|
case "element": {
|
|
2043
2054
|
const elementNode2 = node;
|
|
@@ -2111,6 +2122,51 @@ function convertState(state) {
|
|
|
2111
2122
|
}
|
|
2112
2123
|
return result;
|
|
2113
2124
|
}
|
|
2125
|
+
function convertLocalState(localState) {
|
|
2126
|
+
const result = {};
|
|
2127
|
+
for (const [name, field] of Object.entries(localState)) {
|
|
2128
|
+
result[name] = { type: field.type, initial: field.initial };
|
|
2129
|
+
}
|
|
2130
|
+
return result;
|
|
2131
|
+
}
|
|
2132
|
+
function convertActionStep(step) {
|
|
2133
|
+
switch (step.do) {
|
|
2134
|
+
case "set":
|
|
2135
|
+
return {
|
|
2136
|
+
do: "set",
|
|
2137
|
+
target: step.target,
|
|
2138
|
+
value: step.value
|
|
2139
|
+
};
|
|
2140
|
+
case "update":
|
|
2141
|
+
return {
|
|
2142
|
+
do: "update",
|
|
2143
|
+
target: step.target,
|
|
2144
|
+
operation: step.operation,
|
|
2145
|
+
...step.value && { value: step.value },
|
|
2146
|
+
...step.index && { index: step.index },
|
|
2147
|
+
...step.deleteCount && { deleteCount: step.deleteCount }
|
|
2148
|
+
};
|
|
2149
|
+
case "setPath":
|
|
2150
|
+
return {
|
|
2151
|
+
do: "setPath",
|
|
2152
|
+
target: step.target,
|
|
2153
|
+
path: step.path,
|
|
2154
|
+
value: step.value
|
|
2155
|
+
};
|
|
2156
|
+
default:
|
|
2157
|
+
return step;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
function convertLocalActions(localActions) {
|
|
2161
|
+
const result = {};
|
|
2162
|
+
for (const action of localActions) {
|
|
2163
|
+
result[action.name] = {
|
|
2164
|
+
name: action.name,
|
|
2165
|
+
steps: action.steps.map(convertActionStep)
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
return result;
|
|
2169
|
+
}
|
|
2114
2170
|
async function convertToCompiledProgram(pageInfo) {
|
|
2115
2171
|
const { page, resolvedImports, loadedData } = pageInfo;
|
|
2116
2172
|
const components = page.components || {};
|
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.8.
|
|
3
|
+
"version": "1.8.19",
|
|
4
4
|
"description": "Meta-framework for Constela applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"ws": "^8.18.0",
|
|
47
47
|
"@constela/core": "0.15.2",
|
|
48
48
|
"@constela/compiler": "0.14.2",
|
|
49
|
+
"@constela/router": "18.0.0",
|
|
49
50
|
"@constela/server": "11.0.1",
|
|
50
|
-
"@constela/runtime": "0.
|
|
51
|
-
"@constela/router": "17.0.0"
|
|
51
|
+
"@constela/runtime": "0.19.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/ws": "^8.5.0",
|