cotomy 0.2.0 → 0.2.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/README.md +2 -2
- package/dist/browser/cotomy.js +2 -2
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/view.js +2 -2
- package/dist/esm/view.js.map +1 -1
- package/dist/types/view.d.ts +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ The View layer provides thin wrappers around DOM elements and window events.
|
|
|
92
92
|
- `innerRect()` — Subtracts padding
|
|
93
93
|
- Events
|
|
94
94
|
- Generic: `on(event, handler, options?)`, `off(event, handler?, options?)`, `once(event, handler, options?)`, `trigger(event[, Event])`
|
|
95
|
-
- Delegation: `
|
|
95
|
+
- Delegation: `onSubTree(event, selector, handler, options?)`
|
|
96
96
|
- Mouse: `click`, `dblclick`, `mouseover`, `mouseout`, `mousedown`, `mouseup`, `mousemove`, `mouseenter`, `mouseleave`
|
|
97
97
|
- Keyboard: `keydown`, `keyup`, `keypress`
|
|
98
98
|
- Inputs: `change`, `input`
|
|
@@ -114,7 +114,7 @@ const panel = new CotomyElement({
|
|
|
114
114
|
`,
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
panel.
|
|
117
|
+
panel.onSubTree("click", ".ok", () => console.log("clicked!"));
|
|
118
118
|
document.body.appendChild(panel.element);
|
|
119
119
|
```
|
|
120
120
|
|
package/dist/browser/cotomy.js
CHANGED
|
@@ -1429,7 +1429,7 @@ class CotomyElement {
|
|
|
1429
1429
|
EventRegistry.instance.on(event, this, entry);
|
|
1430
1430
|
return this;
|
|
1431
1431
|
}
|
|
1432
|
-
|
|
1432
|
+
onSubTree(event, selector, handle, options) {
|
|
1433
1433
|
const delegate = (e) => {
|
|
1434
1434
|
const target = e.target;
|
|
1435
1435
|
if (target && target.closest(selector)) {
|
|
@@ -1743,7 +1743,7 @@ class CotomyElement {
|
|
|
1743
1743
|
}
|
|
1744
1744
|
return this;
|
|
1745
1745
|
}
|
|
1746
|
-
|
|
1746
|
+
changeLayout(handle) {
|
|
1747
1747
|
this.listenLayoutEvents();
|
|
1748
1748
|
if (handle) {
|
|
1749
1749
|
this.element.addEventListener("cotomy:changelayout", async (e) => await handle(e));
|