@dnd-kit/abstract 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/index.cjs +928 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +429 -0
- package/index.js +913 -0
- package/index.js.map +1 -0
- package/modifiers.cjs +57 -0
- package/modifiers.cjs.map +1 -0
- package/modifiers.d.ts +22 -0
- package/modifiers.js +52 -0
- package/modifiers.js.map +1 -0
- package/package.json +60 -0
package/index.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["src/core/collision/observer.ts","src/core/plugins/plugin.ts","src/core/plugins/utilities.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/notifier.ts","src/core/manager/events.ts","src/core/collision/types.ts","src/core/entities/entity/entity.ts","src/core/entities/entity/registry.ts","src/core/entities/draggable/draggable.ts","src/core/entities/droppable/droppable.ts","src/core/sensors/sensor.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/dragOperation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["untracked","effect","CollisionPriority","reactive","signal","derived","batch","computed","Status","transform","operation"],"mappings":";;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAA;AAAA,EAEA;AAAA,OACK;;;ACRP,SAAQ,UAAU,iBAAgB;;;ACO3B,SAAS,UAGd,QAAW,SAA2C;AACtD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,aACd,QACA;AACA,SAAO,CAAC,YAAkE;AACxE,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AAEO,SAAS,WACd,QAC+B;AAC/B,MAAI,OAAO,WAAW,YAAY;AAChC,WAAO;AAAA,MACL;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AACT;;;AD1BO,IAAe,SA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B,UAAM,EAAC,SAAS,UAAS,IAAI,qBAA8B,IAAI;AAE/D,SAAK,UAAU;AACf,SAAK,gBAAgB;AACrB,SAAK,oBAAoB,IAAI,kBAA2B,IAAI;AAC5D,SAAK,UAAU,CAAC,mBAAmB,GAAG,OAAO;AAC7C,SAAK,YAAY;AACjB,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEA,IAAI,YAA6B;AAC/B,WAAO,KAAK,SAAS,UAAU;AAAA,EACjC;AAAA,EAEA,IAAI,UAAU,WAA2B;AACvC,SAAK,SAAS,UAAU,SAAS;AAAA,EACnC;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEO,UAAU;AACf,SAAK,SAAS,QAAQ;AACtB,SAAK,kBAAkB,QAAQ;AAAA,EACjC;AACF","sourcesContent":["import {\n batch,\n computed,\n deepEqual,\n signal,\n untracked,\n type ReadonlySignal,\n effect,\n} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.js';\nimport type {Draggable, Droppable} from '../entities/index.js';\nimport {Plugin} from '../plugins/index.js';\nimport type {Collision, CollisionDetector, Collisions} from './types.js';\nimport {sortCollisions} from './utilities.js';\n\nconst DEFAULT_VALUE: Collisions = [];\n\nexport class CollisionObserver<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> extends Plugin<V> {\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = computed(this.computeCollisions, deepEqual);\n\n this.destroy = effect(() => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n });\n }\n\n forceUpdateCount = signal(0);\n\n public forceUpdate(refresh = true) {\n untracked(() => {\n const {source} = this.manager.dragOperation;\n\n batch(() => {\n if (refresh) {\n for (const droppable of this.manager.registry.droppables) {\n if (source && !droppable.accepts(source)) {\n continue;\n }\n\n droppable.refreshShape();\n }\n }\n\n this.forceUpdateCount.value++;\n });\n });\n }\n\n public computeCollisions(\n entries?: Droppable[],\n collisionDetector?: CollisionDetector\n ) {\n const {registry, dragOperation} = this.manager;\n const {source, shape, status} = dragOperation;\n\n if (!status.initialized || !shape) {\n return DEFAULT_VALUE;\n }\n\n const collisions: Collision[] = [];\n\n this.forceUpdateCount.value;\n\n for (const entry of entries ?? registry.droppables) {\n if (entry.disabled) {\n continue;\n }\n\n if (source && !entry.accepts(source)) {\n continue;\n }\n\n const detectCollision = collisionDetector ?? entry.collisionDetector;\n\n if (!detectCollision) {\n continue;\n }\n\n const collision = untracked(() =>\n detectCollision({\n droppable: entry,\n dragOperation,\n })\n );\n\n if (collision) {\n if (entry.collisionPriority != null) {\n collision.priority = entry.collisionPriority;\n }\n\n collisions.push(collision);\n }\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: ReadonlySignal<Collisions>;\n}\n","import {reactive, untracked} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.js';\nimport type {PluginOptions} from './types.js';\nimport {configure} from './utilities.js';\n\n/**\n * An abstract plugin class that can be extended to implement custom\n * functionality that augments the `DragDropManager`'s core capabilities.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n * Triggers effects when accessed.\n */\n @reactive\n public disabled: boolean = false;\n\n /**\n * Enable a disabled plugin instance.\n * Triggers effects.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disable an enabled plugin instance.\n * Triggers effects.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Whether the plugin instance is disabled.\n * Does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configure a plugin instance with new options.\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n /**\n * Destroy a plugin instance.\n */\n public destroy() {\n /*\n * Each plugin is responsible for implementing its own\n * destroy method to clean up effects and listeners\n */\n }\n\n /**\n * Configure a plugin constructor with options.\n * This method is used to configure the options that the\n * plugin constructor will use to create plugin instances.\n */\n static configure(options: PluginOptions) {\n return configure(this as any, options);\n }\n}\n\nexport class CorePlugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> extends Plugin<T, U> {}\n","import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.js';\n\nexport function configure<\n T extends PluginConstructor<any, any, any>,\n V extends PluginOptions = InferPluginOptions<T>,\n>(plugin: T, options: V): PluginDescriptor<any, any, T> {\n return {\n plugin,\n options,\n };\n}\n\nexport function configurator<T extends PluginConstructor<any, any, any>>(\n plugin: T\n) {\n return (options: InferPluginOptions<T>): PluginDescriptor<any, any, T> => {\n return configure(plugin, options);\n };\n}\n\nexport function descriptor<T extends PluginConstructor<any, any, any>>(\n plugin: T | PluginDescriptor<any, any, T>\n): PluginDescriptor<any, any, T> {\n if (typeof plugin === 'function') {\n return {\n plugin,\n options: undefined,\n };\n }\n\n return plugin;\n}\n","import {DragDropManager} from '../manager/index.js';\nimport {CorePlugin, type Plugin} from './plugin.js';\nimport type {InferPluginOptions, PluginConstructor, Plugins} from './types.js';\nimport {descriptor} from './utilities.js';\n\nexport class PluginRegistry<\n T extends DragDropManager<any, any>,\n W extends PluginConstructor<T> = PluginConstructor<T>,\n U extends Plugin<T> = InstanceType<W>,\n> {\n private instances: Map<W, U> = new Map();\n\n constructor(private manager: T) {}\n\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n public set values(entries: Plugins<T>) {\n const descriptos = entries.map(descriptor);\n const constructors = descriptos.map(({plugin}) => plugin);\n\n for (const plugin of this.#previousValues) {\n if (!constructors.includes(plugin)) {\n if (plugin.prototype instanceof CorePlugin) {\n continue;\n }\n\n this.unregister(plugin as W);\n }\n }\n\n for (const {plugin, options} of descriptos) {\n this.register(plugin as W, options as InferPluginOptions<W>);\n }\n\n this.#previousValues = constructors;\n }\n\n public get<X extends W>(plugin: X): InstanceType<X> | undefined {\n const instance = this.instances.get(plugin);\n\n return instance as any;\n }\n\n public register<X extends W>(\n plugin: X,\n options?: InferPluginOptions<X>\n ): InstanceType<X> {\n const existingInstance = this.instances.get(plugin);\n\n if (existingInstance) {\n return existingInstance as InstanceType<X>;\n }\n\n const instance = new plugin(this.manager, options) as U;\n\n this.instances.set(plugin, instance);\n\n return instance as InstanceType<X>;\n }\n\n public unregister<X extends W>(plugin: X) {\n const instance = this.instances.get(plugin);\n\n if (instance) {\n instance.destroy();\n this.instances.delete(plugin);\n }\n }\n\n public destroy() {\n for (const plugin of this.instances.values()) {\n plugin.destroy();\n }\n\n this.instances.clear();\n }\n}\n","import {Collision} from './types.js';\n\n/**\n * Sort collisions from greatest to smallest priority\n * Collisions of equal priority are sorted from greatest to smallest value\n */\nexport function sortCollisions(a: Collision, b: Collision) {\n if (a.priority === b.priority) {\n return b.value - a.value;\n }\n\n return b.priority - a.priority;\n}\n","import {effect, untracked} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../manager/index.js';\nimport {CorePlugin} from '../plugins/index.js';\nimport {defaultPreventable} from '../manager/events.js';\n\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager) {\n super(manager);\n\n this.destroy = effect(() => {\n const {collisionObserver, monitor} = manager;\n const {collisions} = collisionObserver;\n\n if (collisionObserver.isDisabled()) {\n return;\n }\n\n const event = defaultPreventable({\n collisions,\n });\n\n monitor.dispatch('collision', event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const [firstCollision] = collisions;\n\n untracked(() => {\n if (firstCollision?.id !== manager.dragOperation.target?.id) {\n collisionObserver.disable();\n\n manager.actions.setDropTarget(firstCollision?.id).then(() => {\n collisionObserver.enable();\n });\n }\n });\n });\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.js';\nimport type {Collisions} from '../collision/index.js';\nimport type {DragDropManager} from './manager.js';\nimport type {DragOperation} from './dragOperation.js';\n\nexport type Events = Record<string, (...args: any[]) => void>;\n\nexport type Preventable<T> = T & {\n cancelable: boolean;\n defaultPrevented: boolean;\n preventDefault(): void;\n};\n\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n public addEventListener<U extends keyof T>(name: U, handler: T[U]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.add(handler);\n registry.set(name, listeners);\n\n return () => this.removeEventListener(name, handler);\n }\n\n public removeEventListener(name: keyof T, handler: T[keyof T]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.delete(handler);\n registry.set(name, listeners);\n }\n\n protected dispatch<U extends keyof T>(name: U, ...args: any[]) {\n const {registry} = this;\n const listeners = registry.get(name);\n\n if (!listeners) {\n return;\n }\n\n for (const listener of listeners) {\n listener(...args);\n }\n }\n}\n\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n beforedragstart(\n event: Preventable<{operation: DragOperation<T, U>}>,\n manager: V\n ): void;\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperation<T, U>;\n },\n manager: V\n ): void;\n dragmove(\n event: Preventable<{\n operation: DragOperation<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n }>,\n manager: V\n ): void;\n dragover(\n event: Preventable<{\n operation: DragOperation<T, U>;\n }>,\n manager: V\n ): void;\n dragend(\n event: {\n operation: DragOperation<T, U>;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport class DragDropMonitor<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> extends Monitor<DragDropEvents<T, U, V>> {\n constructor(private manager: V) {\n super();\n }\n\n public dispatch<Key extends keyof DragDropEvents<T, U, V>>(\n type: Key,\n event: Parameters<DragDropEvents<T, U, V>[Key]>[0]\n ) {\n const args = [event, this.manager] as any;\n\n super.dispatch(type, ...args);\n }\n}\n\nexport function defaultPreventable<T>(\n event: T,\n cancelable = true\n): Preventable<T> {\n let defaultPrevented = false;\n\n return {\n ...event,\n cancelable,\n get defaultPrevented() {\n return defaultPrevented;\n },\n preventDefault() {\n if (!cancelable) {\n return;\n }\n\n defaultPrevented = true;\n },\n };\n}\n","import type {DragOperation} from '../manager/index.js';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.js';\n\nexport enum CollisionPriority {\n Lowest,\n Low,\n Normal,\n High,\n Highest,\n}\n\nexport interface Collision {\n id: UniqueIdentifier;\n priority: CollisionPriority | number;\n value: number;\n}\n\nexport type Collisions = Collision[];\n\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n droppable: U;\n dragOperation: DragOperation<T, U>;\n}\n\nexport type CollisionDetector = <\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n>(\n input: CollisionDetectorInput<T, U>\n) => Collision | null;\n","import {effects, reactive, type Effect} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../../manager/index.js';\nimport type {Data, UniqueIdentifier} from './types.js';\n\nexport interface Input<T extends Data = Data, U extends Entity<T> = Entity<T>> {\n id: UniqueIdentifier;\n data?: T | null;\n disabled?: boolean;\n effects?: <Instance extends U>(instance: Instance) => Effect[];\n}\n\n/**\n * The `Entity` class is an abstract representation of a distinct unit in the drag and drop system.\n * It is a base class that other concrete classes like `Draggable` and `Droppable` can extend.\n *\n * @template T - The type of data associated with the entity.\n */\nexport class Entity<T extends Data = Data> {\n /**\n * Creates a new instance of the `Entity` class.\n *\n * @param input - An object containing the initial properties of the entity.\n * @param manager - The manager that controls the drag and drop operations.\n */\n constructor(\n input: Input<T>,\n public manager: DragDropManager\n ) {\n const {effects: getInputEffects, id, data = null, disabled = false} = input;\n\n this.id = id;\n this.data = data;\n this.disabled = disabled;\n\n queueMicrotask(() => {\n const inputEffects = getInputEffects?.(this) ?? [];\n\n this.destroy = effects(\n () => {\n // Re-run this effect whenever the `id` changes\n const {id: _} = this;\n manager.registry.register(this);\n\n return () => manager.registry.unregister(this);\n },\n ...inputEffects\n );\n });\n }\n\n /**\n * The unique identifier of the entity.\n */\n @reactive\n public id: UniqueIdentifier;\n\n /**\n * The data associated with the entity.\n */\n @reactive\n public data: Data | null;\n\n /**\n * A boolean indicating whether the entity is disabled.\n */\n @reactive\n public disabled: boolean;\n\n /**\n * A method that cleans up the entity when it is no longer needed.\n * @returns void\n */\n public destroy(): void {}\n}\n","import {signal} from '@dnd-kit/state';\n\nimport type {Entity} from './entity.js';\nimport type {UniqueIdentifier} from './types.js';\n\n/**\n * Reactive class representing a registry for entities.\n * @template T - The type of entries that the registry manages,\n * for example, `Draggable` or `Droppable` entities.\n */\nexport class EntityRegistry<T extends Entity> {\n private map = signal<Map<UniqueIdentifier, T>>(new Map());\n\n /**\n * Iterator for the EntityRegistry class.\n * @returns An iterator for the values in the map.\n */\n public [Symbol.iterator]() {\n return this.map.peek().values();\n }\n\n public get value() {\n return this.map.value.values();\n }\n\n /**\n * Checks if a entity with the given identifier exists in the registry.\n * @param identifier - The unique identifier of the entity.\n * @returns True if the entity exists, false otherwise.\n */\n public has(identifier: UniqueIdentifier): boolean {\n return this.map.value.has(identifier);\n }\n\n /**\n * Retrieves a entity from the registry using its identifier.\n * @param identifier - The unique identifier of the entity.\n * @returns The entity if it exists, undefined otherwise.\n */\n public get(identifier: UniqueIdentifier): T | undefined {\n return this.map.value.get(identifier);\n }\n\n /**\n * Registers a entity in the registry.\n * @param key - The unique identifier of the entity.\n * @param value - The entity to register.\n * @returns A function that unregisters the entity.\n */\n public register = (key: UniqueIdentifier, value: T) => {\n const current = this.map.peek();\n\n if (current.get(key) === value) {\n return;\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n return () => this.unregister(key, value);\n };\n\n /**\n * Unregisters an entity from the registry.\n * @param key - The unique identifier of the entity.\n * @param value - The entity instance to unregister.\n */\n public unregister = (key: UniqueIdentifier, value: T) => {\n const current = this.map.peek();\n\n if (current.get(key) !== value) {\n return;\n }\n\n const updatedMap = new Map(current);\n updatedMap.delete(key);\n\n this.map.value = updatedMap;\n };\n\n /**\n * Destroys all entries in the registry and clears the registry.\n */\n public destroy() {\n for (const entry of this) {\n entry.destroy();\n }\n\n this.map.value = new Map();\n }\n}\n","import {derived, reactive} from '@dnd-kit/state';\n\nimport {Entity} from '../entity/index.js';\nimport type {EntityInput, Data, Type} from '../entity/index.js';\nimport {Modifier} from '../../modifiers/index.js';\nimport type {Modifiers} from '../../modifiers/index.js';\nimport type {DragDropManager} from '../../manager/index.js';\nimport {descriptor} from '../../plugins/index.js';\n\nexport interface Input<\n T extends Data = Data,\n U extends Draggable<T> = Draggable<T>,\n> extends EntityInput<T, U> {\n type?: Type;\n modifiers?: Modifiers;\n}\n\nexport class Draggable<T extends Data = Data> extends Entity<T> {\n constructor(\n {modifiers, type, ...input}: Input<T>,\n public manager: DragDropManager\n ) {\n super(input, manager);\n\n this.type = type;\n\n if (modifiers?.length) {\n this.modifiers = modifiers.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n\n return new plugin(manager, options);\n });\n }\n }\n\n public modifiers: Modifier[] | undefined;\n\n @reactive\n public type: Type | undefined;\n\n /**\n * A boolean indicating whether the draggable item is the source of a drag operation.\n */\n @derived\n public get isDragSource() {\n const {dragOperation} = this.manager;\n\n return dragOperation.source?.id === this.id;\n }\n}\n","import {derived, effects, reactive, type Effect} from '@dnd-kit/state';\nimport type {Shape} from '@dnd-kit/geometry';\n\nimport {Entity} from '../entity/index.js';\nimport type {EntityInput, Data, Type} from '../entity/index.js';\nimport {\n CollisionPriority,\n type CollisionDetector,\n} from '../../collision/index.js';\nimport type {DragDropManager} from '../../manager/index.js';\nimport {Draggable} from '../draggable/draggable.js';\n\nexport interface Input<\n T extends Data = Data,\n U extends Droppable<T> = Droppable<T>,\n> extends EntityInput<T, U> {\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n collisionPriority?: CollisionPriority | number;\n collisionDetector: CollisionDetector;\n type?: Type;\n}\n\nexport class Droppable<T extends Data = Data> extends Entity<T> {\n constructor(\n {\n accept,\n collisionDetector,\n collisionPriority = CollisionPriority.Normal,\n type,\n ...input\n }: Input<T>,\n public manager: DragDropManager\n ) {\n super(input, manager);\n\n this.accept = accept;\n this.collisionDetector = collisionDetector;\n this.collisionPriority = collisionPriority;\n this.type = type;\n }\n\n /**\n * An array of types that are compatible with the droppable.\n */\n @reactive\n public accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /**\n * The type of the droppable.\n */\n @reactive\n public type: Type | undefined;\n\n /**\n * Checks whether or not the droppable accepts a given draggable.\n *\n * @param {Draggable} draggable\n * @returns {boolean}\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (!draggable.type) {\n return false;\n }\n\n if (Array.isArray(accept)) {\n return accept.includes(draggable.type);\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\n }\n\n return draggable.type === accept;\n }\n\n @reactive\n public collisionDetector: CollisionDetector;\n\n @reactive\n public collisionPriority: number;\n\n @reactive\n public shape: Shape | undefined;\n\n @derived\n public get isDropTarget() {\n return this.manager.dragOperation.target?.id === this.id;\n }\n\n public refreshShape() {\n // To be implemented by subclasses\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.js';\nimport type {Draggable} from '../entities/index.js';\nimport {\n Plugin,\n type PluginConstructor,\n type PluginDescriptor,\n type PluginOptions,\n} from '../plugins/index.js';\n\nexport type SensorOptions = PluginOptions;\n\nexport abstract class Sensor<\n T extends DragDropManager<any, any> = DragDropManager,\n U extends SensorOptions = SensorOptions,\n> extends Plugin<T, U> {\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Bind the sensor to a draggable source, and optionally pass\n * in sensor options to override the default sensor options\n * for this draggable source only.\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport {\n Plugin,\n type PluginOptions,\n type PluginConstructor,\n type PluginDescriptor,\n} from '../plugins/index.js';\nimport type {DragDropManager} from '../manager/index.js';\n\nexport type ModifierOptions = PluginOptions;\n\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n public apply(operation: T['dragOperation']): Coordinates {\n return operation.transform;\n }\n}\n\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\nexport type Modifiers<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (ModifierConstructor<T> | ModifierDescriptor<T>)[];\n","import type {CleanupFunction} from '@dnd-kit/state';\n\nimport {\n Draggable,\n Droppable,\n Entity,\n EntityRegistry,\n} from '../entities/index.js';\nimport {\n PluginRegistry,\n Plugin,\n type PluginConstructor,\n PluginOptions,\n} from '../plugins/index.js';\nimport {\n Sensor,\n SensorOptions,\n type SensorConstructor,\n} from '../sensors/index.js';\nimport {Modifier, type ModifierConstructor} from '../modifiers/index.js';\nimport type {DragDropManager} from './manager.js';\n\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n constructor(manager: V) {\n this.plugins = new PluginRegistry<V, PluginConstructor<V>>(manager);\n this.sensors = new PluginRegistry<V, SensorConstructor<V>>(manager);\n this.modifiers = new PluginRegistry<V, ModifierConstructor<V>>(manager);\n }\n\n public draggables = new EntityRegistry<T>();\n public droppables = new EntityRegistry<U>();\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n public register(input: Entity): Entity;\n public register(input: Draggable): Draggable;\n public register(input: Droppable): Droppable;\n public register(input: SensorConstructor, options?: SensorOptions): Sensor;\n public register(input: ModifierConstructor): Modifier;\n public register(input: PluginConstructor, options?: PluginOptions): Plugin;\n public register(input: any, options?: Record<string, any>) {\n if (input instanceof Draggable) {\n return this.draggables.register(input.id, input as T);\n }\n\n if (input instanceof Droppable) {\n return this.droppables.register(input.id, input as U);\n }\n\n if (input.prototype instanceof Modifier) {\n return this.modifiers.register(input, options);\n }\n\n if (input.prototype instanceof Sensor) {\n return this.sensors.register(input, options);\n }\n\n if (input.prototype instanceof Plugin) {\n return this.plugins.register(input, options);\n }\n\n throw new Error('Invalid instance type');\n }\n\n public unregister(input: Entity): CleanupFunction;\n public unregister(input: Draggable): CleanupFunction;\n public unregister(input: Droppable): CleanupFunction;\n public unregister(input: SensorConstructor): CleanupFunction;\n public unregister(input: ModifierConstructor): CleanupFunction;\n public unregister(input: PluginConstructor): CleanupFunction;\n public unregister(input: any) {\n if (input instanceof Entity) {\n if (input instanceof Draggable) {\n return this.draggables.unregister(input.id, input as T);\n }\n\n if (input instanceof Droppable) {\n return this.droppables.unregister(input.id, input as U);\n }\n\n // no-op\n return () => {};\n }\n\n if (input.prototype instanceof Modifier) {\n return this.modifiers.unregister(input);\n }\n\n if (input.prototype instanceof Sensor) {\n return this.sensors.unregister(input);\n }\n\n if (input.prototype instanceof Plugin) {\n return this.plugins.unregister(input);\n }\n\n throw new Error('Invalid instance type');\n }\n\n destroy() {\n this.draggables.destroy();\n this.droppables.destroy();\n this.plugins.destroy();\n this.sensors.destroy();\n this.modifiers.destroy();\n }\n}\n","import {Position, type Shape} from '@dnd-kit/geometry';\nimport type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, computed, signal} from '@dnd-kit/state';\n\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.js';\n\nimport type {DragDropManager} from './manager.js';\nimport {defaultPreventable} from './events.js';\n\nexport enum Status {\n Idle = 'idle',\n Initializing = 'initializing',\n Dragging = 'dragging',\n Dropping = 'dropping',\n}\n\nexport type Serializable = {\n [key: string]: string | number | null | Serializable | Serializable[];\n};\n\nexport interface DragOperation<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n activatorEvent: Event | null;\n canceled: boolean;\n position: Position;\n transform: Coordinates;\n status: {\n current: Status;\n initialized: boolean;\n initializing: boolean;\n dragging: boolean;\n dropping: boolean;\n idle: boolean;\n };\n get shape(): {\n initial: Shape;\n current: Shape;\n } | null;\n set shape(value: Shape | null);\n source: T | null;\n target: U | null;\n data?: Serializable;\n}\n\nexport type DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = ReturnType<typeof DragOperationManager<T, U, V>>['actions'];\n\nexport function DragOperationManager<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n>(manager: V) {\n const {\n registry: {draggables, droppables},\n monitor,\n } = manager;\n const status = signal<Status>(Status.Idle);\n const shape = {\n initial: signal<Shape | null>(null),\n current: signal<Shape | null>(null),\n };\n const canceled = signal<boolean>(false);\n const position = new Position({x: 0, y: 0});\n const activatorEvent = signal<Event | null>(null);\n const sourceIdentifier = signal<UniqueIdentifier | null>(null);\n const targetIdentifier = signal<UniqueIdentifier | null>(null);\n const dragging = computed(() => status.value === Status.Dragging);\n const initialized = computed(() => status.value !== Status.Idle);\n const initializing = computed(() => status.value === Status.Initializing);\n const idle = computed(() => status.value === Status.Idle);\n const dropping = computed(() => status.value === Status.Dropping);\n let previousSource: T | undefined;\n const source = computed<T | null>(() => {\n const identifier = sourceIdentifier.value;\n\n if (identifier == null) return null;\n\n const value = draggables.get(identifier);\n\n if (value) {\n // It's possible for the source to unmount during the drag operation\n previousSource = value;\n }\n\n return value ?? previousSource ?? null;\n });\n const target = computed<U | null>(() => {\n const identifier = targetIdentifier.value;\n return identifier != null ? droppables.get(identifier) ?? null : null;\n });\n\n const transform = computed(() => {\n const {x, y} = position.delta;\n const modifiers = source?.value?.modifiers ?? manager.modifiers;\n\n let transform = {x, y};\n const initialShape = shape.initial.peek();\n const currentShape = shape.current.peek();\n const operation: Omit<DragOperation<T, U>, 'transform'> = {\n activatorEvent: activatorEvent.peek(),\n canceled: canceled.peek(),\n source: source.peek(),\n target: target.peek(),\n status: {\n current: status.peek(),\n idle: idle.peek(),\n initializing: initializing.peek(),\n initialized: initialized.peek(),\n dragging: dragging.peek(),\n dropping: dropping.peek(),\n },\n shape:\n initialShape && currentShape\n ? {initial: initialShape, current: currentShape}\n : null,\n position,\n };\n\n for (const modifier of modifiers) {\n transform = modifier.apply({...operation, transform});\n }\n\n return transform;\n });\n\n const operation: DragOperation<T, U> = {\n get activatorEvent() {\n return activatorEvent.value;\n },\n get canceled() {\n return canceled.value;\n },\n get source() {\n return source.value;\n },\n get target() {\n return target.value;\n },\n status: {\n get current() {\n return status.value;\n },\n get idle() {\n return idle.value;\n },\n get initializing() {\n return initializing.value;\n },\n get initialized() {\n return initialized.value;\n },\n get dragging() {\n return dragging.value;\n },\n get dropping() {\n return dropping.value;\n },\n },\n get shape(): DragOperation['shape'] {\n const initial = shape.initial.value;\n const current = shape.current.value;\n\n return initial && current ? {initial, current} : null;\n },\n set shape(value: Shape | null) {\n if (value && shape.current.peek()?.equals(value)) {\n return;\n }\n\n const initial = shape.initial.peek();\n\n if (!initial) {\n shape.initial.value = value;\n }\n\n shape.current.value = value;\n },\n get transform() {\n return transform.value;\n },\n position,\n };\n\n const reset = () => {\n batch(() => {\n status.value = Status.Idle;\n sourceIdentifier.value = null;\n targetIdentifier.value = null;\n shape.current.value = null;\n shape.initial.value = null;\n position.reset({x: 0, y: 0});\n });\n };\n\n return {\n operation,\n actions: {\n setDragSource(identifier: UniqueIdentifier) {\n sourceIdentifier.value = identifier;\n },\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<void> {\n const id = identifier ?? null;\n\n if (targetIdentifier.peek() === id) {\n return Promise.resolve();\n }\n\n targetIdentifier.value = id;\n\n monitor.dispatch(\n 'dragover',\n defaultPreventable({\n operation: snapshot(operation),\n })\n );\n\n return manager.renderer.rendering;\n },\n start({event, coordinates}: {event: Event; coordinates: Coordinates}) {\n batch(() => {\n canceled.value = false;\n activatorEvent.value = event;\n position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: snapshot(operation),\n });\n\n monitor.dispatch('beforedragstart', beforeStartEvent);\n\n manager.renderer.rendering.then(() => {\n if (beforeStartEvent.defaultPrevented) {\n reset();\n return;\n }\n\n status.value = Status.Initializing;\n\n requestAnimationFrame(() => {\n status.value = Status.Dragging;\n\n monitor.dispatch('dragstart', {\n operation: snapshot(operation),\n cancelable: false,\n });\n });\n });\n },\n move({\n by,\n to,\n cancelable = true,\n }:\n | {by: Coordinates; to?: undefined; cancelable?: boolean}\n | {by?: undefined; to: Coordinates; cancelable?: boolean}) {\n if (!dragging.peek()) {\n return;\n }\n\n const event = defaultPreventable(\n {\n operation: snapshot(operation),\n by,\n to,\n },\n cancelable\n );\n\n monitor.dispatch('dragmove', event);\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = to ?? {\n x: position.current.x + by.x,\n y: position.current.y + by.y,\n };\n\n position.update(coordinates);\n });\n },\n stop({canceled: eventCanceled = false}: {canceled?: boolean} = {}) {\n let promise: Promise<void> | undefined;\n const suspend = () => {\n const output = {\n resume: () => {},\n abort: () => {},\n };\n\n promise = new Promise<void>((resolve, reject) => {\n output.resume = resolve;\n output.abort = reject;\n });\n\n return output;\n };\n const end = () => {\n manager.renderer.rendering.then(() => {\n status.value = Status.Dropping;\n\n manager.renderer.rendering.then(reset);\n });\n };\n\n canceled.value = eventCanceled;\n\n monitor.dispatch('dragend', {\n operation: snapshot(operation),\n canceled: eventCanceled,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(reset);\n } else {\n end();\n }\n },\n },\n };\n}\n\nfunction snapshot<T extends Record<string, any>>(obj: T): T {\n return {\n ...obj,\n };\n}\n","export interface Renderer {\n get rendering(): Promise<void>;\n}\n\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import type {Draggable, Droppable} from '../entities/index.js';\nimport {CollisionObserver, CollisionNotifier} from '../collision/index.js';\nimport type {Plugins, Plugin} from '../plugins/index.js';\nimport type {Sensor, Sensors} from '../sensors/index.js';\nimport type {Modifier, Modifiers} from '../modifiers/index.js';\n\nimport {DragDropRegistry} from './registry.js';\nimport {\n DragOperationManager,\n type DragOperation,\n type DragActions,\n} from './dragOperation.js';\nimport {DragDropMonitor} from './events.js';\nimport {defaultRenderer, type Renderer} from './renderer.js';\n\nexport interface DragDropConfiguration<T extends DragDropManager> {\n core?: {\n plugins: Plugins<T>;\n };\n plugins: Plugins<T>;\n sensors: Sensors<T>;\n modifiers: Modifiers<T>;\n renderer: Renderer;\n}\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = Partial<\n DragDropConfiguration<T>\n>;\n\nexport class DragDropManager<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n public collisionObserver: CollisionObserver<T, U>;\n public dragOperation: DragOperation<T, U>;\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n public renderer: Renderer;\n\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const {\n plugins = [],\n sensors = [],\n modifiers = [],\n renderer = defaultRenderer,\n } = config ?? {};\n const monitor = new DragDropMonitor<T, U, V>(this);\n const registry = new DragDropRegistry<T, U, V>(this);\n\n this.registry = registry;\n this.monitor = monitor;\n this.renderer = renderer;\n\n const {actions, operation} = DragOperationManager<T, U, V>(this);\n\n this.actions = actions;\n this.dragOperation = operation;\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n }\n\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n public destroy() {\n this.registry.destroy();\n this.collisionObserver.destroy();\n }\n}\n"]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import * as _preact_signals_core from '@preact/signals-core';
|
|
2
|
+
import { Effect, CleanupFunction } from '@dnd-kit/state';
|
|
3
|
+
import { Coordinates, Shape, Position } from '@dnd-kit/geometry';
|
|
4
|
+
|
|
5
|
+
type Data = Record<string, any>;
|
|
6
|
+
type UniqueIdentifier = string | number;
|
|
7
|
+
type Type = Symbol | string | number;
|
|
8
|
+
|
|
9
|
+
interface Input$2<T extends Data = Data, U extends Entity<T> = Entity<T>> {
|
|
10
|
+
id: UniqueIdentifier;
|
|
11
|
+
data?: T | null;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
effects?: <Instance extends U>(instance: Instance) => Effect[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The `Entity` class is an abstract representation of a distinct unit in the drag and drop system.
|
|
17
|
+
* It is a base class that other concrete classes like `Draggable` and `Droppable` can extend.
|
|
18
|
+
*
|
|
19
|
+
* @template T - The type of data associated with the entity.
|
|
20
|
+
*/
|
|
21
|
+
declare class Entity<T extends Data = Data> {
|
|
22
|
+
manager: DragDropManager;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new instance of the `Entity` class.
|
|
25
|
+
*
|
|
26
|
+
* @param input - An object containing the initial properties of the entity.
|
|
27
|
+
* @param manager - The manager that controls the drag and drop operations.
|
|
28
|
+
*/
|
|
29
|
+
constructor(input: Input$2<T>, manager: DragDropManager);
|
|
30
|
+
/**
|
|
31
|
+
* The unique identifier of the entity.
|
|
32
|
+
*/
|
|
33
|
+
id: UniqueIdentifier;
|
|
34
|
+
/**
|
|
35
|
+
* The data associated with the entity.
|
|
36
|
+
*/
|
|
37
|
+
data: Data | null;
|
|
38
|
+
/**
|
|
39
|
+
* A boolean indicating whether the entity is disabled.
|
|
40
|
+
*/
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* A method that cleans up the entity when it is no longer needed.
|
|
44
|
+
* @returns void
|
|
45
|
+
*/
|
|
46
|
+
destroy(): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Reactive class representing a registry for entities.
|
|
51
|
+
* @template T - The type of entries that the registry manages,
|
|
52
|
+
* for example, `Draggable` or `Droppable` entities.
|
|
53
|
+
*/
|
|
54
|
+
declare class EntityRegistry<T extends Entity> {
|
|
55
|
+
private map;
|
|
56
|
+
/**
|
|
57
|
+
* Iterator for the EntityRegistry class.
|
|
58
|
+
* @returns An iterator for the values in the map.
|
|
59
|
+
*/
|
|
60
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
61
|
+
get value(): IterableIterator<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Checks if a entity with the given identifier exists in the registry.
|
|
64
|
+
* @param identifier - The unique identifier of the entity.
|
|
65
|
+
* @returns True if the entity exists, false otherwise.
|
|
66
|
+
*/
|
|
67
|
+
has(identifier: UniqueIdentifier): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves a entity from the registry using its identifier.
|
|
70
|
+
* @param identifier - The unique identifier of the entity.
|
|
71
|
+
* @returns The entity if it exists, undefined otherwise.
|
|
72
|
+
*/
|
|
73
|
+
get(identifier: UniqueIdentifier): T | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Registers a entity in the registry.
|
|
76
|
+
* @param key - The unique identifier of the entity.
|
|
77
|
+
* @param value - The entity to register.
|
|
78
|
+
* @returns A function that unregisters the entity.
|
|
79
|
+
*/
|
|
80
|
+
register: (key: UniqueIdentifier, value: T) => (() => void) | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Unregisters an entity from the registry.
|
|
83
|
+
* @param key - The unique identifier of the entity.
|
|
84
|
+
* @param value - The entity instance to unregister.
|
|
85
|
+
*/
|
|
86
|
+
unregister: (key: UniqueIdentifier, value: T) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Destroys all entries in the registry and clears the registry.
|
|
89
|
+
*/
|
|
90
|
+
destroy(): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type PluginOptions = Record<string, any>;
|
|
94
|
+
interface PluginConstructor<T extends DragDropManager<any, any> = DragDropManager<any, any>, U extends Plugin<T> = Plugin<T>, V extends PluginOptions = InferPluginOptions<U>> {
|
|
95
|
+
new (manager: T, options?: V): U;
|
|
96
|
+
}
|
|
97
|
+
type PluginDescriptor<T extends DragDropManager<any, any> = DragDropManager<any, any>, U extends Plugin<T> = Plugin<T>, V extends PluginConstructor<T, U> = PluginConstructor<T, U>> = {
|
|
98
|
+
plugin: V;
|
|
99
|
+
options?: InferPluginOptions<U>;
|
|
100
|
+
};
|
|
101
|
+
type Plugins<T extends DragDropManager<any, any> = DragDropManager<any, any>> = (PluginConstructor<T> | PluginDescriptor<T>)[];
|
|
102
|
+
type InferPluginOptions<P> = P extends PluginConstructor<any, any, infer T> ? T : P extends Plugin<any, infer T> ? T : never;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* An abstract plugin class that can be extended to implement custom
|
|
106
|
+
* functionality that augments the `DragDropManager`'s core capabilities.
|
|
107
|
+
*/
|
|
108
|
+
declare abstract class Plugin<T extends DragDropManager<any, any> = DragDropManager<any, any>, U extends PluginOptions = PluginOptions> {
|
|
109
|
+
manager: T;
|
|
110
|
+
options?: U | undefined;
|
|
111
|
+
constructor(manager: T, options?: U | undefined);
|
|
112
|
+
/**
|
|
113
|
+
* Whether the plugin instance is disabled.
|
|
114
|
+
* Triggers effects when accessed.
|
|
115
|
+
*/
|
|
116
|
+
disabled: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Enable a disabled plugin instance.
|
|
119
|
+
* Triggers effects.
|
|
120
|
+
*/
|
|
121
|
+
enable(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Disable an enabled plugin instance.
|
|
124
|
+
* Triggers effects.
|
|
125
|
+
*/
|
|
126
|
+
disable(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the plugin instance is disabled.
|
|
129
|
+
* Does not trigger effects when accessed.
|
|
130
|
+
*/
|
|
131
|
+
isDisabled(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Configure a plugin instance with new options.
|
|
134
|
+
*/
|
|
135
|
+
configure(options?: U): void;
|
|
136
|
+
/**
|
|
137
|
+
* Destroy a plugin instance.
|
|
138
|
+
*/
|
|
139
|
+
destroy(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Configure a plugin constructor with options.
|
|
142
|
+
* This method is used to configure the options that the
|
|
143
|
+
* plugin constructor will use to create plugin instances.
|
|
144
|
+
*/
|
|
145
|
+
static configure(options: PluginOptions): PluginDescriptor<any, any, any>;
|
|
146
|
+
}
|
|
147
|
+
declare class CorePlugin<T extends DragDropManager<any, any> = DragDropManager<any, any>, U extends PluginOptions = PluginOptions> extends Plugin<T, U> {
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare class PluginRegistry<T extends DragDropManager<any, any>, W extends PluginConstructor<T> = PluginConstructor<T>, U extends Plugin<T> = InstanceType<W>> {
|
|
151
|
+
#private;
|
|
152
|
+
private manager;
|
|
153
|
+
private instances;
|
|
154
|
+
constructor(manager: T);
|
|
155
|
+
get values(): U[];
|
|
156
|
+
set values(entries: Plugins<T>);
|
|
157
|
+
get<X extends W>(plugin: X): InstanceType<X> | undefined;
|
|
158
|
+
register<X extends W>(plugin: X, options?: InferPluginOptions<X>): InstanceType<X>;
|
|
159
|
+
unregister<X extends W>(plugin: X): void;
|
|
160
|
+
destroy(): void;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
declare function configure<T extends PluginConstructor<any, any, any>, V extends PluginOptions = InferPluginOptions<T>>(plugin: T, options: V): PluginDescriptor<any, any, T>;
|
|
164
|
+
declare function configurator<T extends PluginConstructor<any, any, any>>(plugin: T): (options: InferPluginOptions<T>) => PluginDescriptor<any, any, T>;
|
|
165
|
+
declare function descriptor<T extends PluginConstructor<any, any, any>>(plugin: T | PluginDescriptor<any, any, T>): PluginDescriptor<any, any, T>;
|
|
166
|
+
|
|
167
|
+
type ModifierOptions = PluginOptions;
|
|
168
|
+
declare class Modifier<T extends DragDropManager<any, any> = DragDropManager, U extends ModifierOptions = ModifierOptions> extends Plugin<T, U> {
|
|
169
|
+
manager: T;
|
|
170
|
+
options?: U | undefined;
|
|
171
|
+
constructor(manager: T, options?: U | undefined);
|
|
172
|
+
apply(operation: T['dragOperation']): Coordinates;
|
|
173
|
+
}
|
|
174
|
+
type ModifierConstructor<T extends DragDropManager<any, any> = DragDropManager<any, any>> = PluginConstructor<T, Modifier<T, any>>;
|
|
175
|
+
type ModifierDescriptor<T extends DragDropManager<any, any> = DragDropManager<any, any>> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;
|
|
176
|
+
type Modifiers<T extends DragDropManager<any, any> = DragDropManager<any, any>> = (ModifierConstructor<T> | ModifierDescriptor<T>)[];
|
|
177
|
+
|
|
178
|
+
interface Input$1<T extends Data = Data, U extends Draggable<T> = Draggable<T>> extends Input$2<T, U> {
|
|
179
|
+
type?: Type;
|
|
180
|
+
modifiers?: Modifiers;
|
|
181
|
+
}
|
|
182
|
+
declare class Draggable<T extends Data = Data> extends Entity<T> {
|
|
183
|
+
manager: DragDropManager;
|
|
184
|
+
constructor({ modifiers, type, ...input }: Input$1<T>, manager: DragDropManager);
|
|
185
|
+
modifiers: Modifier[] | undefined;
|
|
186
|
+
type: Type | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* A boolean indicating whether the draggable item is the source of a drag operation.
|
|
189
|
+
*/
|
|
190
|
+
get isDragSource(): boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare enum CollisionPriority {
|
|
194
|
+
Lowest = 0,
|
|
195
|
+
Low = 1,
|
|
196
|
+
Normal = 2,
|
|
197
|
+
High = 3,
|
|
198
|
+
Highest = 4
|
|
199
|
+
}
|
|
200
|
+
interface Collision {
|
|
201
|
+
id: UniqueIdentifier;
|
|
202
|
+
priority: CollisionPriority | number;
|
|
203
|
+
value: number;
|
|
204
|
+
}
|
|
205
|
+
type Collisions = Collision[];
|
|
206
|
+
interface CollisionDetectorInput<T extends Draggable = Draggable, U extends Droppable = Droppable> {
|
|
207
|
+
droppable: U;
|
|
208
|
+
dragOperation: DragOperation<T, U>;
|
|
209
|
+
}
|
|
210
|
+
type CollisionDetector = <T extends Draggable = Draggable, U extends Droppable = Droppable>(input: CollisionDetectorInput<T, U>) => Collision | null;
|
|
211
|
+
|
|
212
|
+
declare class CollisionObserver<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> extends Plugin<V> {
|
|
213
|
+
#private;
|
|
214
|
+
constructor(manager: V);
|
|
215
|
+
forceUpdateCount: _preact_signals_core.Signal<number>;
|
|
216
|
+
forceUpdate(refresh?: boolean): void;
|
|
217
|
+
computeCollisions(entries?: Droppable[], collisionDetector?: CollisionDetector): Collisions;
|
|
218
|
+
get collisions(): Collisions;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Sort collisions from greatest to smallest priority
|
|
223
|
+
* Collisions of equal priority are sorted from greatest to smallest value
|
|
224
|
+
*/
|
|
225
|
+
declare function sortCollisions(a: Collision, b: Collision): number;
|
|
226
|
+
|
|
227
|
+
interface Input<T extends Data = Data, U extends Droppable<T> = Droppable<T>> extends Input$2<T, U> {
|
|
228
|
+
accept?: Type | Type[] | ((source: Draggable) => boolean);
|
|
229
|
+
collisionPriority?: CollisionPriority | number;
|
|
230
|
+
collisionDetector: CollisionDetector;
|
|
231
|
+
type?: Type;
|
|
232
|
+
}
|
|
233
|
+
declare class Droppable<T extends Data = Data> extends Entity<T> {
|
|
234
|
+
manager: DragDropManager;
|
|
235
|
+
constructor({ accept, collisionDetector, collisionPriority, type, ...input }: Input<T>, manager: DragDropManager);
|
|
236
|
+
/**
|
|
237
|
+
* An array of types that are compatible with the droppable.
|
|
238
|
+
*/
|
|
239
|
+
accept: Type | Type[] | ((draggable: Draggable) => boolean) | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* The type of the droppable.
|
|
242
|
+
*/
|
|
243
|
+
type: Type | undefined;
|
|
244
|
+
/**
|
|
245
|
+
* Checks whether or not the droppable accepts a given draggable.
|
|
246
|
+
*
|
|
247
|
+
* @param {Draggable} draggable
|
|
248
|
+
* @returns {boolean}
|
|
249
|
+
*/
|
|
250
|
+
accepts(draggable: Draggable): boolean;
|
|
251
|
+
collisionDetector: CollisionDetector;
|
|
252
|
+
collisionPriority: number;
|
|
253
|
+
shape: Shape | undefined;
|
|
254
|
+
get isDropTarget(): boolean;
|
|
255
|
+
refreshShape(): void;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
type SensorOptions = PluginOptions;
|
|
259
|
+
declare abstract class Sensor<T extends DragDropManager<any, any> = DragDropManager, U extends SensorOptions = SensorOptions> extends Plugin<T, U> {
|
|
260
|
+
manager: T;
|
|
261
|
+
options?: U | undefined;
|
|
262
|
+
constructor(manager: T, options?: U | undefined);
|
|
263
|
+
/**
|
|
264
|
+
* Bind the sensor to a draggable source, and optionally pass
|
|
265
|
+
* in sensor options to override the default sensor options
|
|
266
|
+
* for this draggable source only.
|
|
267
|
+
*/
|
|
268
|
+
abstract bind(source: Draggable, options?: U): CleanupFunction;
|
|
269
|
+
}
|
|
270
|
+
type SensorConstructor<T extends DragDropManager<any, any> = DragDropManager<any, any>> = PluginConstructor<T, Sensor<T>>;
|
|
271
|
+
type SensorDescriptor<T extends DragDropManager<any, any> = DragDropManager<any, any>> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;
|
|
272
|
+
type Sensors<T extends DragDropManager<any, any> = DragDropManager<any, any>> = (SensorConstructor<T> | SensorDescriptor<T>)[];
|
|
273
|
+
|
|
274
|
+
declare class DragDropRegistry<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> {
|
|
275
|
+
constructor(manager: V);
|
|
276
|
+
draggables: EntityRegistry<T>;
|
|
277
|
+
droppables: EntityRegistry<U>;
|
|
278
|
+
plugins: PluginRegistry<V, PluginConstructor<V>>;
|
|
279
|
+
sensors: PluginRegistry<V, SensorConstructor<V>>;
|
|
280
|
+
modifiers: PluginRegistry<V, ModifierConstructor<V>>;
|
|
281
|
+
register(input: Entity): Entity;
|
|
282
|
+
register(input: Draggable): Draggable;
|
|
283
|
+
register(input: Droppable): Droppable;
|
|
284
|
+
register(input: SensorConstructor, options?: SensorOptions): Sensor;
|
|
285
|
+
register(input: ModifierConstructor): Modifier;
|
|
286
|
+
register(input: PluginConstructor, options?: PluginOptions): Plugin;
|
|
287
|
+
unregister(input: Entity): CleanupFunction;
|
|
288
|
+
unregister(input: Draggable): CleanupFunction;
|
|
289
|
+
unregister(input: Droppable): CleanupFunction;
|
|
290
|
+
unregister(input: SensorConstructor): CleanupFunction;
|
|
291
|
+
unregister(input: ModifierConstructor): CleanupFunction;
|
|
292
|
+
unregister(input: PluginConstructor): CleanupFunction;
|
|
293
|
+
destroy(): void;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
declare enum Status {
|
|
297
|
+
Idle = "idle",
|
|
298
|
+
Initializing = "initializing",
|
|
299
|
+
Dragging = "dragging",
|
|
300
|
+
Dropping = "dropping"
|
|
301
|
+
}
|
|
302
|
+
type Serializable = {
|
|
303
|
+
[key: string]: string | number | null | Serializable | Serializable[];
|
|
304
|
+
};
|
|
305
|
+
interface DragOperation<T extends Draggable = Draggable, U extends Droppable = Droppable> {
|
|
306
|
+
activatorEvent: Event | null;
|
|
307
|
+
canceled: boolean;
|
|
308
|
+
position: Position;
|
|
309
|
+
transform: Coordinates;
|
|
310
|
+
status: {
|
|
311
|
+
current: Status;
|
|
312
|
+
initialized: boolean;
|
|
313
|
+
initializing: boolean;
|
|
314
|
+
dragging: boolean;
|
|
315
|
+
dropping: boolean;
|
|
316
|
+
idle: boolean;
|
|
317
|
+
};
|
|
318
|
+
get shape(): {
|
|
319
|
+
initial: Shape;
|
|
320
|
+
current: Shape;
|
|
321
|
+
} | null;
|
|
322
|
+
set shape(value: Shape | null);
|
|
323
|
+
source: T | null;
|
|
324
|
+
target: U | null;
|
|
325
|
+
data?: Serializable;
|
|
326
|
+
}
|
|
327
|
+
type DragActions<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> = ReturnType<typeof DragOperationManager<T, U, V>>['actions'];
|
|
328
|
+
declare function DragOperationManager<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>>(manager: V): {
|
|
329
|
+
operation: DragOperation<T, U>;
|
|
330
|
+
actions: {
|
|
331
|
+
setDragSource(identifier: UniqueIdentifier): void;
|
|
332
|
+
setDropTarget(identifier: UniqueIdentifier | null | undefined): Promise<void>;
|
|
333
|
+
start({ event, coordinates }: {
|
|
334
|
+
event: Event;
|
|
335
|
+
coordinates: Coordinates;
|
|
336
|
+
}): void;
|
|
337
|
+
move({ by, to, cancelable, }: {
|
|
338
|
+
by: Coordinates;
|
|
339
|
+
to?: undefined;
|
|
340
|
+
cancelable?: boolean;
|
|
341
|
+
} | {
|
|
342
|
+
by?: undefined;
|
|
343
|
+
to: Coordinates;
|
|
344
|
+
cancelable?: boolean;
|
|
345
|
+
}): void;
|
|
346
|
+
stop({ canceled: eventCanceled }?: {
|
|
347
|
+
canceled?: boolean;
|
|
348
|
+
}): void;
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
type Events = Record<string, (...args: any[]) => void>;
|
|
353
|
+
type Preventable<T> = T & {
|
|
354
|
+
cancelable: boolean;
|
|
355
|
+
defaultPrevented: boolean;
|
|
356
|
+
preventDefault(): void;
|
|
357
|
+
};
|
|
358
|
+
declare class Monitor<T extends Events> {
|
|
359
|
+
private registry;
|
|
360
|
+
addEventListener<U extends keyof T>(name: U, handler: T[U]): () => void;
|
|
361
|
+
removeEventListener(name: keyof T, handler: T[keyof T]): void;
|
|
362
|
+
protected dispatch<U extends keyof T>(name: U, ...args: any[]): void;
|
|
363
|
+
}
|
|
364
|
+
type DragDropEvents<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> = {
|
|
365
|
+
collision(event: Preventable<{
|
|
366
|
+
collisions: Collisions;
|
|
367
|
+
}>, manager: V): void;
|
|
368
|
+
beforedragstart(event: Preventable<{
|
|
369
|
+
operation: DragOperation<T, U>;
|
|
370
|
+
}>, manager: V): void;
|
|
371
|
+
dragstart(event: {
|
|
372
|
+
cancelable: false;
|
|
373
|
+
operation: DragOperation<T, U>;
|
|
374
|
+
}, manager: V): void;
|
|
375
|
+
dragmove(event: Preventable<{
|
|
376
|
+
operation: DragOperation<T, U>;
|
|
377
|
+
to?: Coordinates;
|
|
378
|
+
by?: Coordinates;
|
|
379
|
+
}>, manager: V): void;
|
|
380
|
+
dragover(event: Preventable<{
|
|
381
|
+
operation: DragOperation<T, U>;
|
|
382
|
+
}>, manager: V): void;
|
|
383
|
+
dragend(event: {
|
|
384
|
+
operation: DragOperation<T, U>;
|
|
385
|
+
canceled: boolean;
|
|
386
|
+
suspend(): {
|
|
387
|
+
resume(): void;
|
|
388
|
+
abort(): void;
|
|
389
|
+
};
|
|
390
|
+
}, manager: V): void;
|
|
391
|
+
};
|
|
392
|
+
declare class DragDropMonitor<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> extends Monitor<DragDropEvents<T, U, V>> {
|
|
393
|
+
private manager;
|
|
394
|
+
constructor(manager: V);
|
|
395
|
+
dispatch<Key extends keyof DragDropEvents<T, U, V>>(type: Key, event: Parameters<DragDropEvents<T, U, V>[Key]>[0]): void;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
interface Renderer {
|
|
399
|
+
get rendering(): Promise<void>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
interface DragDropConfiguration<T extends DragDropManager> {
|
|
403
|
+
core?: {
|
|
404
|
+
plugins: Plugins<T>;
|
|
405
|
+
};
|
|
406
|
+
plugins: Plugins<T>;
|
|
407
|
+
sensors: Sensors<T>;
|
|
408
|
+
modifiers: Modifiers<T>;
|
|
409
|
+
renderer: Renderer;
|
|
410
|
+
}
|
|
411
|
+
type DragDropManagerInput<T extends DragDropManager<any, any>> = Partial<DragDropConfiguration<T>>;
|
|
412
|
+
declare class DragDropManager<T extends Draggable = Draggable, U extends Droppable = Droppable> {
|
|
413
|
+
actions: DragActions<T, U, DragDropManager<T, U>>;
|
|
414
|
+
collisionObserver: CollisionObserver<T, U>;
|
|
415
|
+
dragOperation: DragOperation<T, U>;
|
|
416
|
+
monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;
|
|
417
|
+
registry: DragDropRegistry<T, U, DragDropManager<T, U>>;
|
|
418
|
+
renderer: Renderer;
|
|
419
|
+
constructor(config?: DragDropManagerInput<any>);
|
|
420
|
+
get plugins(): Plugin<any>[];
|
|
421
|
+
set plugins(plugins: Plugins<any>);
|
|
422
|
+
get modifiers(): Modifier<any>[];
|
|
423
|
+
set modifiers(modifiers: Modifiers<any>);
|
|
424
|
+
get sensors(): Sensor<any>[];
|
|
425
|
+
set sensors(sensors: Sensors<any>);
|
|
426
|
+
destroy(): void;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export { Collision, CollisionDetector, CollisionPriority, CorePlugin, Data, DragDropConfiguration, DragDropEvents, DragDropManager, DragDropManagerInput, DragOperation, DragOperationManager, Status as DragOperationStatus, Draggable, Input$1 as DraggableInput, Droppable, Input as DroppableInput, Entity, Modifier, ModifierConstructor, Modifiers, Plugin, PluginConstructor, PluginDescriptor, PluginOptions, PluginRegistry, Plugins, Renderer, Sensor, SensorConstructor, SensorDescriptor, SensorOptions, Sensors, Type, UniqueIdentifier, configurator, configure, descriptor, sortCollisions };
|