@constela/runtime 0.3.1 → 0.3.2
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 +13 -2
- package/package.json +13 -12
- package/LICENSE +0 -21
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, {
|
|
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.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Runtime DOM renderer for Constela UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,9 +14,17 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
19
|
+
"type-check": "tsc --noEmit",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"prepublishOnly": "pnpm run build"
|
|
24
|
+
},
|
|
17
25
|
"dependencies": {
|
|
18
|
-
"@constela/core": "
|
|
19
|
-
"@constela/compiler": "
|
|
26
|
+
"@constela/core": "workspace:*",
|
|
27
|
+
"@constela/compiler": "workspace:*"
|
|
20
28
|
},
|
|
21
29
|
"devDependencies": {
|
|
22
30
|
"@types/node": "^20.10.0",
|
|
@@ -29,12 +37,5 @@
|
|
|
29
37
|
"engines": {
|
|
30
38
|
"node": ">=20.0.0"
|
|
31
39
|
},
|
|
32
|
-
"license": "MIT"
|
|
33
|
-
|
|
34
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
35
|
-
"type-check": "tsc --noEmit",
|
|
36
|
-
"test": "vitest run",
|
|
37
|
-
"test:watch": "vitest",
|
|
38
|
-
"clean": "rm -rf dist"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
40
|
+
"license": "MIT"
|
|
41
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Constela Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|