svelte-multiselect
Version:
Svelte multi-select component
74 lines (73 loc) • 2.57 kB
TypeScript
import type { Attachment } from 'svelte/attachments';
declare global {
interface CSS {
highlights: HighlightRegistry;
}
interface HighlightRegistry extends Map<string, Highlight> {
clear(): void;
delete(key: string): boolean;
set(key: string, value: Highlight): this;
}
}
export interface DraggableOptions {
handle_selector?: string;
disabled?: boolean;
on_drag_start?: (event: MouseEvent) => void;
on_drag?: (event: MouseEvent) => void;
on_drag_end?: (event: MouseEvent) => void;
}
export type Dimensions = {
width: number;
height: number;
};
export type ResizeCallback = (event: MouseEvent, dimensions: Dimensions) => void;
export interface ResizableOptions {
edges?: (`top` | `right` | `bottom` | `left`)[];
min_width?: number;
min_height?: number;
max_width?: number;
max_height?: number;
handle_size?: number;
disabled?: boolean;
on_resize_start?: ResizeCallback;
on_resize?: ResizeCallback;
on_resize_end?: ResizeCallback;
}
export declare const draggable: (options?: DraggableOptions) => Attachment;
export declare const resizable: (options?: ResizableOptions) => Attachment;
export declare function get_html_sort_value(element: HTMLElement): string;
export interface SortableOptions {
header_selector?: string;
asc_class?: string;
desc_class?: string;
sorted_style?: Partial<CSSStyleDeclaration>;
disabled?: boolean;
}
export declare const sortable: (options?: SortableOptions) => (node: HTMLElement) => (() => void) | undefined;
export type HighlightOptions = {
query?: string;
disabled?: boolean;
fuzzy?: boolean;
node_filter?: (node: Node) => number;
css_class?: string;
};
export declare const highlight_matches: (ops: HighlightOptions) => (node: HTMLElement) => (() => void) | undefined;
export interface TooltipOptions {
content?: string;
placement?: `top` | `bottom` | `left` | `right`;
delay?: number;
hide_delay?: number;
disabled?: boolean | `touch-devices`;
style?: string;
show_arrow?: boolean;
offset?: number;
allow_html?: boolean;
sanitize_html?: (html: string) => string;
}
export declare const tooltip: (options?: TooltipOptions) => Attachment;
export type ClickOutsideConfig<T extends HTMLElement> = {
enabled?: boolean;
exclude?: string[];
callback?: (node: T, config: ClickOutsideConfig<T>) => void;
};
export declare const click_outside: <T extends HTMLElement>(config?: ClickOutsideConfig<T>) => (node: T) => (() => void) | undefined;