@constela/compiler 0.15.3 → 0.15.4
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 +34 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -980,9 +980,31 @@ function validateComponentProps(node, componentDef, path, context, scope, paramS
|
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
for (const [propName, propValue] of Object.entries(providedProps)) {
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
983
|
+
const propPath = buildPath(path, "props", propName);
|
|
984
|
+
if (isEventHandler(propValue)) {
|
|
985
|
+
const isGlobalAction = context.actionNames.has(propValue.action);
|
|
986
|
+
const isLocalAction = paramScope?.localActionNames?.has(propValue.action) ?? false;
|
|
987
|
+
if (!isGlobalAction && !isLocalAction) {
|
|
988
|
+
const availableNames = /* @__PURE__ */ new Set([
|
|
989
|
+
...context.actionNames,
|
|
990
|
+
...paramScope?.localActionNames ?? []
|
|
991
|
+
]);
|
|
992
|
+
const errorOptions = createErrorOptionsWithSuggestion(propValue.action, availableNames);
|
|
993
|
+
errors.push(createUndefinedActionError(propValue.action, propPath, errorOptions));
|
|
994
|
+
}
|
|
995
|
+
if (propValue.payload) {
|
|
996
|
+
errors.push(
|
|
997
|
+
...validateExpressionInEventPayload(
|
|
998
|
+
propValue.payload,
|
|
999
|
+
buildPath(propPath, "payload"),
|
|
1000
|
+
context,
|
|
1001
|
+
scope
|
|
1002
|
+
)
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
} else {
|
|
1006
|
+
errors.push(...validateExpression(propValue, propPath, context, scope, paramScope));
|
|
1007
|
+
}
|
|
986
1008
|
}
|
|
987
1009
|
return errors;
|
|
988
1010
|
}
|
|
@@ -1306,6 +1328,9 @@ function transformExpression(expr, ctx) {
|
|
|
1306
1328
|
case "param": {
|
|
1307
1329
|
const paramValue = ctx.currentParams?.[expr.name];
|
|
1308
1330
|
if (paramValue !== void 0) {
|
|
1331
|
+
if ("event" in paramValue) {
|
|
1332
|
+
return paramValue;
|
|
1333
|
+
}
|
|
1309
1334
|
if (expr.path) {
|
|
1310
1335
|
if (paramValue.expr === "var") {
|
|
1311
1336
|
const existingPath = paramValue.path;
|
|
@@ -1877,8 +1902,12 @@ function transformViewNode(node, ctx) {
|
|
|
1877
1902
|
}
|
|
1878
1903
|
const params = {};
|
|
1879
1904
|
if (node.props) {
|
|
1880
|
-
for (const [name,
|
|
1881
|
-
|
|
1905
|
+
for (const [name, propValue] of Object.entries(node.props)) {
|
|
1906
|
+
if (isEventHandler2(propValue)) {
|
|
1907
|
+
params[name] = transformEventHandler(propValue, ctx);
|
|
1908
|
+
} else {
|
|
1909
|
+
params[name] = transformExpression(propValue, ctx);
|
|
1910
|
+
}
|
|
1882
1911
|
}
|
|
1883
1912
|
}
|
|
1884
1913
|
const children = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/compiler",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
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.17.
|
|
18
|
+
"@constela/core": "0.17.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.10.0",
|