@jay-framework/runtime 0.17.3 → 0.17.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 +6 -1
- package/docs/refs.md +3 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -975,7 +975,10 @@ class HTMLElementRefsImpl extends PrivateRefs {
|
|
|
975
975
|
return newHTMLElementPublicApiProxy(this);
|
|
976
976
|
}
|
|
977
977
|
exec$(handler) {
|
|
978
|
-
|
|
978
|
+
const first = [...this.elements][0];
|
|
979
|
+
if (!first)
|
|
980
|
+
return Promise.resolve(void 0);
|
|
981
|
+
return first.exec$(handler);
|
|
979
982
|
}
|
|
980
983
|
}
|
|
981
984
|
class ComponentRefsImpl extends PrivateRefs {
|
|
@@ -1058,6 +1061,8 @@ class HTMLElementRefImpl extends RefImpl {
|
|
|
1058
1061
|
return newHTMLElementPublicApiProxy(this);
|
|
1059
1062
|
}
|
|
1060
1063
|
exec$(handler) {
|
|
1064
|
+
if (!this.element)
|
|
1065
|
+
return Promise.resolve(void 0);
|
|
1061
1066
|
return new Promise((resolve, reject) => {
|
|
1062
1067
|
try {
|
|
1063
1068
|
resolve(handler(this.element, this.viewState));
|
package/docs/refs.md
CHANGED
|
@@ -101,7 +101,9 @@ interface HTMLElementProxy<ViewState, ElementType extends HTMLElement>
|
|
|
101
101
|
- `addEventListener`: registers a new event handlers.
|
|
102
102
|
- `removeEventListener`: registers a new event handlers.
|
|
103
103
|
- `exec$`: runs a code function against the DOM element. The function must match compiler patterns (see the compiler security section)
|
|
104
|
-
to be
|
|
104
|
+
to be properly run in secure applications. In non-secure applications, the function just runs with the DOM element.
|
|
105
|
+
**Important:** `exec$` must only be used inside event handlers — never at top-level component creation or in effects,
|
|
106
|
+
because elements don't exist yet at that point. Top-level `exec$` calls silently resolve to `undefined`.
|
|
105
107
|
|
|
106
108
|
## HTMLElementCollectionProxy
|
|
107
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/runtime",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"test:watch": "vitest"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@jay-framework/list-compare": "^0.17.
|
|
27
|
-
"@jay-framework/reactive": "^0.17.
|
|
26
|
+
"@jay-framework/list-compare": "^0.17.4",
|
|
27
|
+
"@jay-framework/reactive": "^0.17.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@jay-framework/dev-environment": "^0.17.
|
|
30
|
+
"@jay-framework/dev-environment": "^0.17.4",
|
|
31
31
|
"@testing-library/jest-dom": "^6.2.0",
|
|
32
32
|
"@types/jsdom": "^21.1.6",
|
|
33
33
|
"@types/node": "^20.11.5",
|