@selenite/commons
Version:
This typescript package provides a set of frequently used utilities, types and svelte actions for building projects with Typescript and Svelte.
30 lines (29 loc) • 961 B
TypeScript
import { type DragOptions } from '@neodrag/svelte';
import type { Action } from 'svelte/action';
/**
* Options of a draggable item action.
*
* Extends neodrag options.
* @see [Neodrag documentation](https://www.neodrag.dev/docs/svelte#options)
*/
export type DragItemOptions = Omit<DragOptions, 'bounds' | 'transform' | 'recomputeBounds'> & {
/** Array of draggable items. */
items: unknown[];
/** Duration of flip animation. */
flipDuration: number;
/**
* Min distance between items swaps.
*
* After doing an item swap, the next swap will be ignored if the distance
* between the last swap and the current position is less than this value.
*/
minSwapDistance?: number;
};
/**
* Action to make an item in an array of items draggable.
*
* The array will be mutated to update the order.
*
* Options : {@link DragItemOptions}.
*/
export declare const draggableItem: Action<HTMLElement, DragItemOptions>;