@rokkit/actions 1.1.16 → 1.1.18
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.
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @param {HTMLElement} node
|
|
6
|
-
*/
|
|
7
|
-
export function dismissable(node: HTMLElement): void;
|
|
1
|
+
export function dismissable<Node extends HTMLElement>(node: Node, parameter?: undefined): void | import("svelte/action").ActionReturn<undefined, {
|
|
2
|
+
ondismiss?: (event: CustomEvent<HTMLElement | undefined>) => void;
|
|
3
|
+
}>;
|
package/package.json
CHANGED
|
@@ -5,7 +5,10 @@ const KEYCODE_ESC = 27
|
|
|
5
5
|
* A svelte action function that captures clicks outside the element or escape keypress
|
|
6
6
|
* emits a `dismiss` event. This is useful for closing a modal or dropdown.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* The third Action generic declares the `ondismiss` attribute so consumers using
|
|
9
|
+
* `use:dismissable ondismiss={...}` type-check (the event is a CustomEvent).
|
|
10
|
+
*
|
|
11
|
+
* @type {import('svelte/action').Action<HTMLElement, undefined, { ondismiss?: (event: CustomEvent<HTMLElement | undefined>) => void }>}
|
|
9
12
|
*/
|
|
10
13
|
export function dismissable(node) {
|
|
11
14
|
const handleClick = (event) => {
|