@constela/runtime 0.3.1 → 0.3.3

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 +13 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -409,14 +409,25 @@ function renderElement(node, ctx) {
409
409
  el.addEventListener(eventName, async (event) => {
410
410
  const action = ctx.actions[handler.action];
411
411
  if (action) {
412
+ const eventLocals = {};
413
+ const target = event.target;
414
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) {
415
+ eventLocals["value"] = target.value;
416
+ if (target instanceof HTMLInputElement && target.type === "checkbox") {
417
+ eventLocals["checked"] = target.checked;
418
+ }
419
+ }
412
420
  let payload = void 0;
413
421
  if (handler.payload) {
414
- payload = evaluate(handler.payload, { state: ctx.state, locals: ctx.locals });
422
+ payload = evaluate(handler.payload, {
423
+ state: ctx.state,
424
+ locals: { ...ctx.locals, ...eventLocals }
425
+ });
415
426
  }
416
427
  const actionCtx = {
417
428
  state: ctx.state,
418
429
  actions: ctx.actions,
419
- locals: { ...ctx.locals, payload },
430
+ locals: { ...ctx.locals, ...eventLocals, payload },
420
431
  eventPayload: payload
421
432
  };
422
433
  await executeAction(action, actionCtx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/runtime",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Runtime DOM renderer for Constela UI framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,8 +15,8 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@constela/core": "0.3.1",
19
- "@constela/compiler": "0.3.1"
18
+ "@constela/compiler": "0.3.1",
19
+ "@constela/core": "0.3.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^20.10.0",