feat(types): use the SvelteComponentTyped interface in the TypeScript definitions

This commit is contained in:
Eric Liu 2021-02-06 14:10:18 -08:00
commit a56c954af0
161 changed files with 6379 additions and 6362 deletions

View file

@ -1,11 +1,19 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface InlineNotificationProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
export interface InlineNotificationProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
* Specify the kind of notification
* @default "error"
*/
kind?: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt";
kind?:
| "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt";
/**
* Set to `true` to use the low contrast variant
@ -50,17 +58,14 @@ export interface InlineNotificationProps extends svelte.JSX.HTMLAttributes<HTMLE
iconDescription?: string;
}
export default class InlineNotification {
$$prop_def: InlineNotificationProps;
$$slot_def: {
default: {};
actions: {};
};
$on(eventname: "close", cb: (event: CustomEvent<{ timeout: boolean }>) => void): () => void;
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class InlineNotification extends SvelteComponentTyped<
InlineNotificationProps,
{
close: CustomEvent<{ timeout: boolean }>;
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{ default: {}; actions: {} }
> {}

View file

@ -1,16 +1,15 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface NotificationActionButtonProps {}
export default class NotificationActionButton {
$$prop_def: NotificationActionButtonProps;
$$slot_def: {
default: {};
};
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class NotificationActionButton extends SvelteComponentTyped<
NotificationActionButtonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{ default: {} }
> {}

View file

@ -1,6 +1,8 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface NotificationButtonProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> {
export interface NotificationButtonProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> {
/**
* Set the type of notification
* @default "toast"
@ -24,13 +26,13 @@ export interface NotificationButtonProps extends svelte.JSX.HTMLAttributes<HTMLE
iconDescription?: string;
}
export default class NotificationButton {
$$prop_def: NotificationButtonProps;
$$slot_def: {};
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class NotificationButton extends SvelteComponentTyped<
NotificationButtonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{}
> {}

View file

@ -1,11 +1,18 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface NotificationIconProps {
/**
* Specify the kind of notification icon
* @default "error"
*/
kind?: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt";
kind?:
| "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt";
/**
* Set the type of notification
@ -20,9 +27,8 @@ export interface NotificationIconProps {
iconDescription?: string;
}
export default class NotificationIcon {
$$prop_def: NotificationIconProps;
$$slot_def: {};
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class NotificationIcon extends SvelteComponentTyped<
NotificationIconProps,
{},
{}
> {}

View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface NotificationTextDetailsProps {
/**
@ -26,11 +27,8 @@ export interface NotificationTextDetailsProps {
caption?: string;
}
export default class NotificationTextDetails {
$$prop_def: NotificationTextDetailsProps;
$$slot_def: {
default: {};
};
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class NotificationTextDetails extends SvelteComponentTyped<
NotificationTextDetailsProps,
{},
{ default: {} }
> {}

View file

@ -1,11 +1,19 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface ToastNotificationProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
export interface ToastNotificationProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
* Specify the kind of notification
* @default "error"
*/
kind?: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt";
kind?:
| "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt";
/**
* Set to `true` to use the low contrast variant
@ -56,16 +64,14 @@ export interface ToastNotificationProps extends svelte.JSX.HTMLAttributes<HTMLEl
hideCloseButton?: boolean;
}
export default class ToastNotification {
$$prop_def: ToastNotificationProps;
$$slot_def: {
default: {};
};
$on(eventname: "close", cb: (event: CustomEvent<{ timeout: boolean }>) => void): () => void;
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class ToastNotification extends SvelteComponentTyped<
ToastNotificationProps,
{
close: CustomEvent<{ timeout: boolean }>;
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{ default: {} }
> {}