UNPKG

@selenite/commons

Version:

This typescript package provides a set of frequently used utilities, types and svelte actions for building projects with Typescript and Svelte.

25 lines (24 loc) 880 B
/** * Actions that behave like an on click event listener but with additional conditions. * * @see {@link clickIfNoDrag} * @module */ import type { ActionReturn } from 'svelte/action'; /** * Options for the {@link clickIfDrag} and {@link clickIfNoDrag} action. * @see {@link clickIfNoDrag} * @see {@link clickIfDrag} */ export type ClickDragOptions = { onclick?: (e: PointerEvent) => void; threshold?: number; }; /** * Action that triggers a callback if the pointer is not moved after a pointerdown event. */ export declare function clickIfNoDrag<E extends HTMLElement>(node: E, options: ClickDragOptions): ActionReturn<ClickDragOptions>; /** * Action that triggers a callback if the pointer is moved after a pointerdown event. */ export declare function clickIfDrag<E extends HTMLElement>(node: E, options: ClickDragOptions): ActionReturn<ClickDragOptions>;