Skip to content

Commit d286d7f

Browse files
committed
added type definitions
1 parent 12d750f commit d286d7f

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "src/main.cjs.js",
66
"module": "src/main.es.js",
77
"svelte": "src/Portal.svelte",
8+
"types": "src/Portal.svelte.d.ts",
89
"scripts": {
910
"test": "jest test",
1011
"test:watch": "npm run test -- --watch",

src/Portal.svelte.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { SvelteComponentTyped } from "svelte";
2+
/**
3+
* Usage: <div use:portal={'css selector'}> or <div use:portal={document.body}>
4+
*
5+
* @param {HTMLElement} el
6+
* @param {HTMLElement|string} target DOM Element or CSS Selector
7+
*/
8+
export declare function portal(el: HTMLElement, target?: HTMLElement | string): {
9+
update: (newTarget: HTMLElement | string) => Promise<void>;
10+
destroy: () => void;
11+
};
12+
declare const __propDef: {
13+
props: {
14+
/**
15+
* DOM Element or CSS Selector
16+
* @type { HTMLElement|string}
17+
*/ target?: string | HTMLElement | undefined;
18+
};
19+
events: {
20+
[evt: string]: CustomEvent<any>;
21+
};
22+
slots: {
23+
default: {};
24+
};
25+
};
26+
export declare type PortalProps = typeof __propDef.props;
27+
export declare type PortalEvents = typeof __propDef.events;
28+
export declare type PortalSlots = typeof __propDef.slots;
29+
export default class Portal extends SvelteComponentTyped<PortalProps, PortalEvents, PortalSlots> {
30+
}
31+
export {};

0 commit comments

Comments
 (0)