pyro
Version:
Pyro custom elements
57 lines (56 loc) • 1.66 kB
TypeScript
import { DefineComponent } from 'vue';
import { HTMLAttributes } from 'svelte/elements';
export interface ToastProps {
/** Message to display */
message?: string;
/** Duration in ms */
duration?: number;
/** Toast severity, determines colors */
severity?: 'info' | 'success' | 'warning' | 'error' | '';
/** Vertical position on top, default false */
top?: boolean;
/** Vertical position on left, default false */
left?: boolean;
/** Horizontal position in center, default false */
center?: boolean;
}
/**
* Shows a toast, recommended use with <pyro-toast> in document
*
* @param message message to show
* @param options.duration duration in ms
* @param options.selector selector of element where to append pyro-toast, if none found, default `body`
*/
export declare function showToast(message: string, options?: {
duration?: number;
selector: string;
}): void;
declare module 'vue' {
interface GlobalComponents {
'pyro-toast': DefineComponent<ToastProps>;
}
}
interface PyroToastPreact extends Omit<JSX.HTMLAttributes, keyof ToastProps>, ToastProps {
}
declare module 'preact/jsx-runtime' {
namespace JSX {
interface IntrinsicElements {
'pyro-toast': PyroToastPreact;
}
}
}
interface PyroToastSvelte extends Omit<HTMLAttributes<any>, keyof ToastProps>, ToastProps {
}
declare module 'svelte/elements' {
interface SvelteHTMLElements {
'pyro-toast': PyroToastSvelte;
}
}
declare module 'solid-js' {
namespace JSX {
interface IntrinsicElements {
'pyro-toast': PyroToastPreact;
}
}
}
export {};