dry-ux 1.81.0 → 1.82.0

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.
@@ -92,7 +92,7 @@ export declare class Element {
92
92
  * @param once Whether the event should only fire once.
93
93
  * @returns A function to remove the event listener, or undefined if the element is not suitable for events.
94
94
  */
95
- addEventListener(type: string, handler: (e: Event) => void, once?: boolean): () => void | undefined;
95
+ addEventListener(type: string, handler: (e: any) => void, once?: boolean): () => void | undefined;
96
96
  /**
97
97
  * Adds a change event listener to the element.
98
98
  * @param handler The event handler function.
@@ -106,21 +106,21 @@ export declare class Element {
106
106
  * @param once Whether the event should only fire once.
107
107
  * @returns A function to remove the event listener.
108
108
  */
109
- click(handler: (e: Event) => void, once?: boolean): () => void | undefined;
109
+ click(handler: (e: MouseEvent) => void, once?: boolean): () => void | undefined;
110
110
  /**
111
111
  * Adds a focus event listener to the element.
112
112
  * @param handler The event handler function.
113
113
  * @param once Whether the event should only fire once.
114
114
  * @returns A function to remove the event listener.
115
115
  */
116
- focus(handler: (e: Event) => void, once?: boolean): () => void | undefined;
116
+ focus(handler: (e: FocusEvent) => void, once?: boolean): () => void | undefined;
117
117
  /**
118
118
  * Adds a blur event listener to the element.
119
119
  * @param handler The event handler function.
120
120
  * @param once Whether the event should only fire once.
121
121
  * @returns A function to remove the event listener.
122
122
  */
123
- blur(handler: (e: Event) => void, once?: boolean): () => void | undefined;
123
+ blur(handler: (e: FocusEvent) => void, once?: boolean): () => void | undefined;
124
124
  /**
125
125
  * Adds a keydown event listener to the element.
126
126
  * @param handler The keyboard event handler function.
@@ -124,14 +124,11 @@ class Element {
124
124
  * @returns A function to remove the event listener, or undefined if the element is not suitable for events.
125
125
  */
126
126
  addEventListener(type, handler, once) {
127
- if ((this.nativeInput instanceof HTMLInputElement ||
128
- this.nativeInput instanceof HTMLSelectElement ||
129
- this.nativeInput instanceof HTMLTextAreaElement) &&
130
- !!type) {
131
- const abortController = new AbortController();
132
- this.nativeInput.addEventListener("change", handler, { once, signal: abortController.signal });
133
- return abortController.abort;
134
- }
127
+ if (!type)
128
+ return;
129
+ const abortController = new AbortController();
130
+ this.native.addEventListener(type, handler, { once, signal: abortController.signal });
131
+ return () => abortController.abort();
135
132
  }
136
133
  /**
137
134
  * Adds a change event listener to the element.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.81.0",
3
+ "version": "1.82.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {