@constela/compiler 0.11.2 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +21 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1253,7 +1253,15 @@ function transformEventHandler(handler, ctx) {
1253
1253
  action: handler.action
1254
1254
  };
1255
1255
  if (handler.payload) {
1256
- result.payload = transformExpression(handler.payload, ctx);
1256
+ if ("expr" in handler.payload) {
1257
+ result.payload = transformExpression(handler.payload, ctx);
1258
+ } else {
1259
+ const objectPayload = {};
1260
+ for (const [key, value] of Object.entries(handler.payload)) {
1261
+ objectPayload[key] = transformExpression(value, ctx);
1262
+ }
1263
+ result.payload = objectPayload;
1264
+ }
1257
1265
  }
1258
1266
  if (handler.debounce !== void 0) {
1259
1267
  result.debounce = handler.debounce;
@@ -1510,6 +1518,18 @@ function transformActionStep(step) {
1510
1518
  }
1511
1519
  return compiledFocusStep;
1512
1520
  }
1521
+ case "if": {
1522
+ const ifStep = step;
1523
+ const compiledIfStep = {
1524
+ do: "if",
1525
+ condition: transformExpression(ifStep.condition, emptyContext),
1526
+ then: ifStep.then.map(transformActionStep)
1527
+ };
1528
+ if (ifStep.else) {
1529
+ compiledIfStep.else = ifStep.else.map(transformActionStep);
1530
+ }
1531
+ return compiledIfStep;
1532
+ }
1513
1533
  }
1514
1534
  }
1515
1535
  function flattenSlotChildren(children, ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/compiler",
3
- "version": "0.11.2",
3
+ "version": "0.11.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.12.1"
18
+ "@constela/core": "0.12.3"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.10.0",