claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
108 lines • 3.88 kB
TypeScript
/**
* Hook to handle window resize events
*/
export declare function useResize(callback: (width: number, height: number) => void, options?: {
debounceTime?: number;
throttleTime?: number;
}): {
observe: (node: HTMLElement) => {
destroy(): void;
};
};
/**
* Hook to handle mouse move events with throttling
*/
export declare function useMouseMove(callback: (event: MouseEvent) => void, options?: {
throttleTime?: number;
}): void;
/**
* Hook to handle mouse leave events
*/
export declare function useMouseLeave(element: HTMLElement | Window | null, callback: (event: MouseEvent) => void): void;
/**
* Hook to handle click outside an element
*/
export declare function useClickOutside(element: HTMLElement | null, callback: (event: MouseEvent) => void): void;
/**
* Hook to handle keyboard events
*/
export declare function useKeyPress(targetKey: string, callback: (event: KeyboardEvent) => void, options?: {
target?: HTMLElement | Window;
}): void;
/**
* Hook to manage tooltip state
*/
export declare function useTooltip(): {
isOpen: {
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
content: {
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
position: {
subscribe: (this: void, run: import("svelte/store").Subscriber<{
x: number;
y: number;
}>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
targetElement: {
subscribe: (this: void, run: import("svelte/store").Subscriber<HTMLElement | null>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
show: (event: MouseEvent, tooltipContent: string, target?: HTMLElement) => void;
hide: () => void;
updatePosition: (event: MouseEvent) => void;
};
/**
* Hook to manage chart hover state
*/
export declare function useHoverState(): {
hoveredIndex: {
subscribe: (this: void, run: import("svelte/store").Subscriber<number | null>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
hoveredPoint: {
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
isHovering: {
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
handleMouseEnter: (index: number, point: any) => void;
handleMouseLeave: () => void;
};
/**
* Hook to manage chart zoom state
*/
export declare function useZoom(initialScale?: number, options?: {
minScale?: number;
maxScale?: number;
}): {
scale: {
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
position: {
subscribe: (this: void, run: import("svelte/store").Subscriber<{
x: number;
y: number;
}>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
zoomIn: (factor?: number, focalPoint?: {
x: number;
y: number;
}) => void;
zoomOut: (factor?: number, focalPoint?: {
x: number;
y: number;
}) => void;
reset: () => void;
pan: (dx: number, dy: number) => void;
};
/**
* Hook to manage chart tooltip visibility with a delay
*/
export declare function useDelayedTooltip(delay?: number): {
isVisible: {
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
};
show: () => void;
hide: (immediate?: boolean) => void;
};
//# sourceMappingURL=hooks.d.ts.map