svelte-multiselect
Version:
Svelte multi-select component
58 lines (57 loc) • 2.15 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 declare const draggable: (options?: DraggableOptions) => 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) => (() => boolean) | undefined;
/**
* Options for the tooltip attachment.
*
* @security Tooltip content is rendered as HTML. If you allow user-provided content
* to be set via `title`, `aria-label`, or `data-title` attributes, you MUST sanitize
* it first to prevent XSS attacks. This attachment does not perform any sanitization.
*/
export interface TooltipOptions {
content?: string;
placement?: `top` | `bottom` | `left` | `right`;
delay?: number;
disabled?: boolean;
style?: 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;