Skip to content

Commit

Permalink
Merge pull request #135 from m93a/patch
Browse files Browse the repository at this point in the history
Add Type Definitions
  • Loading branch information
romkor authored Jun 2, 2022
2 parents 12d750f + 66defc7 commit a06ecbb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "src/main.cjs.js",
"module": "src/main.es.js",
"svelte": "src/Portal.svelte",
"types": "src/Portal.svelte.d.ts",
"scripts": {
"test": "jest test",
"test:watch": "npm run test -- --watch",
Expand Down
37 changes: 37 additions & 0 deletions src/Portal.svelte.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { SvelteComponentTyped } from "svelte";
/**
* Usage: <div use:portal={'css selector'}> or <div use:portal={document.body}>
*
* @param {HTMLElement} el
* @param {HTMLElement|string} target DOM Element or CSS Selector
*/
export declare function portal(
el: HTMLElement,
target?: HTMLElement | string
): {
update: (newTarget: HTMLElement | string) => Promise<void>;
destroy: () => void;
};
declare const __propDef: {
props: {
/**
* DOM Element or CSS Selector
* @type { HTMLElement|string}
*/ target?: string | HTMLElement | undefined;
};
events: {
[evt: string]: CustomEvent<any>;
};
slots: {
default: {};
};
};
export declare type PortalProps = typeof __propDef.props;
export declare type PortalEvents = typeof __propDef.events;
export declare type PortalSlots = typeof __propDef.slots;
export default class Portal extends SvelteComponentTyped<
PortalProps,
PortalEvents,
PortalSlots
> {}
export {};

0 comments on commit a06ecbb

Please sign in to comment.