diff --git a/dist/esm-with-signals.d.ts b/dist/esm-with-signals.d.ts index 15c7398..c421f51 100644 --- a/dist/esm-with-signals.d.ts +++ b/dist/esm-with-signals.d.ts @@ -173,12 +173,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -194,7 +194,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/esm-with-signals.min.d.ts b/dist/esm-with-signals.min.d.ts index 15c7398..c421f51 100644 --- a/dist/esm-with-signals.min.d.ts +++ b/dist/esm-with-signals.min.d.ts @@ -173,12 +173,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -194,7 +194,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/esm.d.ts b/dist/esm.d.ts index 4d57e77..724e170 100644 --- a/dist/esm.d.ts +++ b/dist/esm.d.ts @@ -172,12 +172,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -193,7 +193,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/esm.min.d.ts b/dist/esm.min.d.ts index 4d57e77..724e170 100644 --- a/dist/esm.min.d.ts +++ b/dist/esm.min.d.ts @@ -172,12 +172,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -193,7 +193,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/iife-with-signals.d.ts b/dist/iife-with-signals.d.ts index ad522de..775c91b 100644 --- a/dist/iife-with-signals.d.ts +++ b/dist/iife-with-signals.d.ts @@ -173,12 +173,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -194,7 +194,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/iife-with-signals.min.d.ts b/dist/iife-with-signals.min.d.ts index ad522de..775c91b 100644 --- a/dist/iife-with-signals.min.d.ts +++ b/dist/iife-with-signals.min.d.ts @@ -173,12 +173,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -194,7 +194,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/iife.d.ts b/dist/iife.d.ts index 5a650a7..d3688f5 100644 --- a/dist/iife.d.ts +++ b/dist/iife.d.ts @@ -172,12 +172,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -193,7 +193,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/dist/iife.min.d.ts b/dist/iife.min.d.ts index 5a650a7..d3688f5 100644 --- a/dist/iife.min.d.ts +++ b/dist/iife.min.d.ts @@ -172,12 +172,12 @@ declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options? declare function dispatchEvent$1(name: keyof DocumentEventMap | string, options: EventInit | null, host: Host): (data?: any) => void; export interface On { /** Listens to the DOM event. See {@link Document.addEventListener} */ - = ddeElementAddon>(type: Event, listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): EE; + (type: Event, listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions): ddeElementAddon; = ddeElementAddon>(type: string, listener: (this: EE extends ddeElementAddon ? El : never, ev: Event | CustomEvent) => any, options?: AddEventListenerOptions): EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - connected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + connected(listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions): ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */ // editorconfig-checker-disable-line - disconnected, El extends (EE extends ddeElementAddon ? El : never)>(listener: (this: El, event: CustomEvent) => any, options?: AddEventListenerOptions): EE; + disconnected(listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions): ddeElementAddon; /** * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. * This is handy to apply some property depending on full template such as: @@ -193,7 +193,7 @@ export interface On { * ); * ``` * */ - host, El extends (EE extends ddeElementAddon ? El : never)>(listener: (element: El) => any, host?: Host): EE; + host(listener: (element: EL) => any, host?: Host): ddeElementAddon; } export const on: On; export type Scope = { diff --git a/index.d.ts b/index.d.ts index c602b27..6e57de3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -184,12 +184,12 @@ interface On{ /** Listens to the DOM event. See {@link Document.addEventListener} */ < Event extends keyof DocumentEventMap, - EE extends ddeElementAddon= ddeElementAddon, + EL extends SupportedElement >( type: Event, - listener: (this: EE extends ddeElementAddon ? El : never, ev: DocumentEventMap[Event]) => any, + listener: (this: EL, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions - ) : EE; + ) : ddeElementAddon; < EE extends ddeElementAddon= ddeElementAddon, >( @@ -199,28 +199,39 @@ interface On{ ) : EE; /** Listens to the element is connected to the live DOM. In case of custom elements uses [`connectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */// editorconfig-checker-disable-line connected< - EE extends ddeElementAddon, - El extends ( EE extends ddeElementAddon ? El : never ) + EL extends SupportedElement >( - listener: (this: El, event: CustomEvent) => any, + listener: (this: EL, event: CustomEvent>) => any, options?: AddEventListenerOptions - ) : EE; + ) : ddeElementAddon; /** Listens to the element is disconnected from the live DOM. In case of custom elements uses [`disconnectedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */// editorconfig-checker-disable-line disconnected< - EE extends ddeElementAddon, - El extends ( EE extends ddeElementAddon ? El : never ) + EL extends SupportedElement >( - listener: (this: El, event: CustomEvent) => any, + listener: (this: EL, event: CustomEvent) => any, options?: AddEventListenerOptions - ) : EE; - /** Listens to the element attribute changes. In case of custom elements uses [`attributeChangedCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks), or {@link MutationObserver} else where */// editorconfig-checker-disable-line - attributeChanged< - EE extends ddeElementAddon, - El extends ( EE extends ddeElementAddon ? El : never ) - >( - listener: (this: El, event: CustomEvent<[ string, string ]>) => any, - options?: AddEventListenerOptions - ) : EE; + ) : ddeElementAddon; + /** + * Fires when the host element is "ready", for host element itsel, it is just an alias for `scope.host(listener)`. + * This is handy to apply some property depending on full template such as: + * ```js + * const selected= "Z"; + * //... + * return el("form").append( + * el("select", null, on.host(e=> e.value=selected)).append( + * el("option", { value: "A", textContent: "A" }), + * //... + * el("option", { value: "Z", textContent: "Z" }), + * ), + * ); + * ``` + * */ + host< + EL extends SupportedElement + >( + listener: (element: EL) => any, + host?: Host + ) : ddeElementAddon; } export const on: On;