@dnd-kit/abstract 0.3.0 → 0.3.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/index.js CHANGED
@@ -1462,8 +1462,10 @@ var DragDropManager = class {
1462
1462
  var _a2, _b, _c3;
1463
1463
  const currentModifiers = untracked(() => this.dragOperation.modifiers);
1464
1464
  const managerModifiers = this.modifiers;
1465
- if (currentModifiers !== managerModifiers) {
1466
- currentModifiers.forEach((modifier) => modifier.destroy());
1465
+ for (const modifier of currentModifiers) {
1466
+ if (!managerModifiers.includes(modifier)) {
1467
+ modifier.destroy();
1468
+ }
1467
1469
  }
1468
1470
  this.dragOperation.modifiers = (_c3 = (_b = (_a2 = this.dragOperation.source) == null ? void 0 : _a2.modifiers) == null ? void 0 : _b.map((modifier) => {
1469
1471
  const { plugin, options } = descriptor(modifier);
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["src/core/plugins/utilities.ts","src/core/plugins/plugin.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/observer.ts","src/core/manager/events.ts","src/core/collision/notifier.ts","src/core/collision/types.ts","src/core/manager/status.ts","src/core/manager/actions.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/sensors/activation.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/operation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["descriptor","untracked","effects","CollisionPriority","CollisionType","_init","reactive","_a","_b","_c","effect","_disabled_dec","_disabled","id","manager","signal","cleanup","derived","_type_dec","_type","_modifiers_dec","_shape_dec","_manager","_shape","_modifiers","batch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,SAAA,CAGd,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EAAM,OAAO,CAAA;AAAA,OACjC,CAAA,KAHA,OAAAE,GAGM,GAAA,gBAAA;AAAA,KACT,CAAA;AAED,IAAA,IAAA,CAAK,UAAU,MAAM;AACnB,MAAQ,OAAA,EAAA;AACR,MAAQ,OAAA,EAAA;AAAA,KACV;AAAA;AACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAyB,GAAA;AAC3B,IAAO,OAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,MAAA;AAAA;AAC/B;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,QAAQ,OAAuB,EAAA;AACjC,IAAK,IAAA,CAAA,QAAA,CAAS,QAAQ,MAAS,GAAA,OAAA;AAAA;AACjC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,SAA6B,GAAA;AAC/B,IAAO,OAAA,IAAA,CAAK,SAAS,SAAU,CAAA,MAAA;AAAA;AACjC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,UAAU,SAA2B,EAAA;AACvC,IAAK,IAAA,CAAA,QAAA,CAAS,UAAU,MAAS,GAAA,SAAA;AAAA;AACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAyB,GAAA;AAC3B,IAAO,OAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,MAAA;AAAA;AAC/B;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,QAAQ,OAAuB,EAAA;AACjC,IAAK,IAAA,CAAA,QAAA,CAAS,QAAQ,MAAS,GAAA,OAAA;AAAA;AAgBnC","file":"index.js","sourcesContent":["import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.ts';\n\n/**\n * Creates a plugin descriptor with the given plugin constructor and options.\n *\n * @template T - The plugin constructor type\n * @template V - The plugin options type\n * @param plugin - The plugin constructor\n * @param options - The plugin configuration options\n * @returns A plugin descriptor containing the constructor and options\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\n/**\n * Creates a configurator function for a specific plugin constructor.\n *\n * @template T - The plugin constructor type\n * @param plugin - The plugin constructor to configure\n * @returns A function that takes options and returns a plugin descriptor\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\n/**\n * Normalizes a plugin constructor or descriptor into a descriptor.\n *\n * @template T - The plugin constructor type\n * @param plugin - Either a plugin constructor or a plugin descriptor\n * @returns A plugin descriptor\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 {\n type CleanupFunction,\n effect,\n reactive,\n untracked,\n} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {PluginOptions} from './types.ts';\nimport {configure} from './utilities.ts';\n\n/**\n * Base class for plugins that extend drag and drop functionality.\n *\n * @template T - The type of drag and drop manager\n * @template U - The type of plugin options\n *\n * @remarks\n * Plugins can add new features and behaviors to the drag and drop system\n * by extending this class and implementing custom functionality.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n /**\n * Creates a new plugin instance.\n *\n * @param manager - The drag and drop manager that owns this plugin\n * @param options - Optional configuration for the plugin\n */\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n *\n * @remarks\n * This property is reactive and triggers effects when accessed.\n */\n @reactive\n public accessor disabled: boolean = false;\n\n /**\n * Enables a disabled plugin instance.\n *\n * @remarks\n * This method triggers effects when called.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disables an enabled plugin instance.\n *\n * @remarks\n * This method triggers effects when called.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Checks if the plugin instance is disabled.\n *\n * @returns true if the plugin is disabled\n * @remarks\n * This method does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configures a plugin instance with new options.\n *\n * @param options - The new options to apply\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n #cleanupFunctions = new Set<CleanupFunction>();\n\n /**\n * Registers an effect that will be cleaned up when the plugin is destroyed.\n *\n * @param callback - The effect callback to register\n * @returns A function to dispose of the effect\n */\n protected registerEffect(callback: () => void) {\n const dispose = effect(callback.bind(this));\n\n this.#cleanupFunctions.add(dispose);\n\n return dispose;\n }\n\n /**\n * Destroys a plugin instance and cleans up its resources.\n *\n * @remarks\n * This method:\n * - Calls all registered cleanup functions\n * - Should be overridden by subclasses to clean up additional resources\n */\n public destroy() {\n this.#cleanupFunctions.forEach((cleanup) => cleanup());\n }\n\n /**\n * Configures a plugin constructor with options.\n *\n * @param options - The options to configure the constructor with\n * @returns The configured plugin constructor\n *\n * @remarks\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\n/**\n * Base class for core plugins that ship with the library.\n *\n * @template T - The type of drag and drop manager\n * @template U - The type of plugin options\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 {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin, type Plugin} from './plugin.ts';\nimport type {\n InferPluginOptions,\n PluginDescriptor,\n PluginConstructor,\n Plugins,\n} from './types.ts';\nimport {descriptor} from './utilities.ts';\n\n/**\n * Manages the registration and lifecycle of plugin instances.\n *\n * @template T - The type of drag and drop manager\n * @template W - The type of plugin constructor\n * @template U - The type of plugin instance\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 /**\n * Creates a new plugin registry.\n *\n * @param manager - The drag and drop manager that owns this registry\n */\n constructor(private manager: T) {}\n\n /**\n * Gets all registered plugin instances.\n *\n * @returns An array of all active plugin instances\n */\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n /**\n * Sets the list of plugins to be used by the registry.\n *\n * @param entries - Array of plugin constructors or descriptors\n * @remarks\n * This method:\n * - Filters out duplicate plugins\n * - Unregisters plugins that are no longer in use\n * - Registers new plugins with their options\n */\n public set values(entries: Plugins<T>) {\n const descriptors = entries\n .map(descriptor)\n .reduceRight<PluginDescriptor<T>[]>((acc, descriptor) => {\n if (acc.some(({plugin}) => plugin === descriptor.plugin)) {\n // Filter out duplicate plugins\n return acc;\n }\n\n return [descriptor, ...acc];\n }, []);\n const constructors = descriptors.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 descriptors) {\n this.register(plugin as W, options as InferPluginOptions<W>);\n }\n\n this.#previousValues = constructors;\n }\n\n /**\n * Gets a plugin instance by its constructor.\n *\n * @param plugin - The plugin constructor to look up\n * @returns The plugin instance or undefined if not found\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 /**\n * Registers a new plugin instance.\n *\n * @param plugin - The plugin constructor to register\n * @param options - Optional configuration for the plugin\n * @returns The registered plugin instance\n * @remarks\n * If the plugin is already registered, its options will be updated\n * and the existing instance will be returned.\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 if (existingInstance.options !== options) {\n existingInstance.options = options;\n }\n\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 /**\n * Unregisters a plugin instance.\n *\n * @param plugin - The plugin constructor to unregister\n * @remarks\n * This method:\n * - Destroys the plugin instance\n * - Removes it from the registry\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 /**\n * Destroys all registered plugin instances.\n *\n * @remarks\n * This method:\n * - Calls destroy() on all plugin instances\n * - Clears the registry\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.ts';\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 if (a.type === b.type) {\n return b.value - a.value;\n }\n\n return b.type - a.type;\n }\n\n return b.priority - a.priority;\n}\n","import {signal, untracked, type Signal, effects} from '@dnd-kit/state';\nimport type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport {Plugin} from '../plugins/index.ts';\nimport type {Collision, CollisionDetector, Collisions} from './types.ts';\nimport {sortCollisions} from './utilities.ts';\n\nconst DEFAULT_VALUE: Collisions = [];\n\n/**\n * Observes and manages collision detection between draggable and droppable elements.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag drop manager\n *\n * @remarks\n * The CollisionObserver is responsible for:\n * - Computing collisions between draggable and droppable elements\n * - Maintaining a signal of current collisions\n * - Updating collision state based on drag operation changes\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 /**\n * Creates a new CollisionObserver instance.\n *\n * @param manager - The drag drop manager instance\n */\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = signal(DEFAULT_VALUE);\n\n this.destroy = effects(\n () => {\n const collisions = this.computeCollisions();\n const coordinates = untracked(\n () => this.manager.dragOperation.position.current\n );\n\n if (collisions !== DEFAULT_VALUE) {\n const previousCoordinates = this.#previousCoordinates;\n this.#previousCoordinates = coordinates;\n\n if (\n previousCoordinates &&\n coordinates.x == previousCoordinates.x &&\n coordinates.y == previousCoordinates.y\n ) {\n return;\n }\n } else {\n this.#previousCoordinates = undefined;\n }\n\n this.#collisions.value = collisions;\n },\n () => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n }\n );\n }\n\n #previousCoordinates: Coordinates | undefined;\n\n /**\n * Forces an immediate update of collision detection.\n *\n * @param immediate - If true, updates collisions immediately. If false, resets previous coordinates.\n */\n public forceUpdate(immediate = true) {\n untracked(() => {\n if (immediate) {\n this.#collisions.value = this.computeCollisions();\n } else {\n this.#previousCoordinates = undefined;\n }\n });\n }\n\n /**\n * Computes collisions between draggable and droppable elements.\n *\n * @param entries - Optional array of droppable elements to check. If not provided, uses all registered droppables.\n * @param collisionDetector - Optional custom collision detector function\n * @returns Array of detected collisions, sorted by priority\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 const potentialTargets = [];\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 potentialTargets.push(entry);\n\n // Force collisions to be recomputed when the shape changes\n void entry.shape;\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 if (potentialTargets.length === 0) {\n return DEFAULT_VALUE;\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n /**\n * Gets the current collisions signal value.\n */\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: Signal<Collisions>;\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport type {Collisions} from '../collision/index.ts';\nimport type {DragDropManager} from './manager.ts';\nimport type {DragOperationSnapshot} from './operation.ts';\n\n/** Base type for event handler functions */\nexport type Events = Record<string, (...args: any[]) => void>;\n\n/**\n * Extends an event type with preventable functionality.\n *\n * @template T - The base event type\n */\nexport type Preventable<T> = T & {\n /** Whether the event can be canceled */\n cancelable: boolean;\n /** Whether the default action was prevented */\n defaultPrevented: boolean;\n /** Prevents the default action of the event */\n preventDefault(): void;\n};\n\n/**\n * Base class for event monitoring and dispatching.\n *\n * @template T - The type of events to monitor\n */\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n /**\n * Adds an event listener for the specified event type.\n *\n * @param name - The name of the event to listen for\n * @param handler - The function to call when the event occurs\n * @returns A function to remove the event listener\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 /**\n * Removes an event listener for the specified event type.\n *\n * @param name - The name of the event\n * @param handler - The function to remove\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 /**\n * Dispatches an event to all registered listeners.\n *\n * @param name - The name of the event to dispatch\n * @param args - Arguments to pass to the event handlers\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\n/**\n * Type definition for drag and drop events.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\n */\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n /** Event fired when collisions are detected */\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n /** Event fired before a drag operation starts */\n beforedragstart(\n event: Preventable<{\n operation: DragOperationSnapshot<T, U>;\n nativeEvent?: Event;\n }>,\n manager: V\n ): void;\n /** Event fired when a drag operation starts */\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperationSnapshot<T, U>;\n nativeEvent?: Event;\n },\n manager: V\n ): void;\n /** Event fired when a drag operation moves */\n dragmove(\n event: Preventable<{\n operation: DragOperationSnapshot<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n nativeEvent?: Event;\n }>,\n manager: V\n ): void;\n /** Event fired when a drag operation hovers over a droppable */\n dragover(\n event: Preventable<{\n operation: DragOperationSnapshot<T, U>;\n }>,\n manager: V\n ): void;\n /** Event fired when a drag operation ends */\n dragend(\n event: {\n operation: DragOperationSnapshot<T, U>;\n nativeEvent?: Event;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport type CollisionEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['collision'];\n\nexport type BeforeDragStartEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['beforedragstart'];\n\nexport type DragStartEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragstart'];\n\nexport type DragMoveEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragmove'];\n\nexport type DragOverEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragover'];\n\nexport type DragEndEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragend'];\n\n/**\n * Monitors and dispatches drag and drop events.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\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 /**\n * Creates a new drag and drop monitor.\n *\n * @param manager - The drag and drop manager to monitor\n */\n constructor(private manager: V) {\n super();\n }\n\n /**\n * Dispatches a drag and drop event.\n *\n * @param type - The type of event to dispatch\n * @param event - The event data to dispatch\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\n/**\n * Creates a preventable event object.\n *\n * @param event - The base event object\n * @param cancelable - Whether the event can be canceled\n * @returns A preventable event object\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 {effect, effects, untracked} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin} from '../plugins/index.ts';\nimport {defaultPreventable} from '../manager/events.ts';\n\nimport type {Collision} from './types.ts';\n\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager<any, any>) {\n super(manager);\n\n const isEqual = (a: Collision[], b: Collision[]) =>\n a.map(({id}) => id).join('') === b.map(({id}) => id).join('');\n\n let previousCollisions: Collision[] = [];\n\n this.destroy = effects(\n () => {\n const {dragOperation, collisionObserver} = manager;\n\n if (dragOperation.status.initializing) {\n previousCollisions = [];\n collisionObserver.enable();\n }\n },\n () => {\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 if (isEqual(collisions, previousCollisions)) {\n return;\n } else {\n previousCollisions = collisions;\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}\n","import type {DragOperation} from '../manager/index.ts';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\n/**\n * Priority levels for collision detection.\n *\n * @remarks\n * Higher priority collisions take precedence over lower priority ones.\n * Custom numeric priorities can also be used for fine-grained control.\n */\nexport enum CollisionPriority {\n /** Lowest priority level */\n Lowest,\n /** Low priority level */\n Low,\n /** Normal priority level */\n Normal,\n /** High priority level */\n High,\n /** Highest priority level */\n Highest,\n}\n\n/**\n * Types of collision detection.\n *\n * @remarks\n * Different collision types can be used to implement various\n * drag and drop behaviors and visual feedback.\n */\nexport enum CollisionType {\n /** Basic collision detection */\n Collision,\n /** Shape-based intersection detection */\n ShapeIntersection,\n /** Pointer-based intersection detection */\n PointerIntersection,\n}\n\n/**\n * Represents a detected collision between a draggable and droppable.\n *\n * @remarks\n * Contains information about the collision type, priority, and\n * additional data that can be used for custom behaviors.\n */\nexport interface Collision {\n /** Unique identifier of the droppable involved in the collision */\n id: UniqueIdentifier;\n /** Priority of the collision */\n priority: CollisionPriority | number;\n /** Type of collision detected */\n type: CollisionType;\n /** Numeric value representing the collision strength or overlap */\n value: number;\n /** Additional data associated with the collision */\n data?: Record<string, any>;\n}\n\n/** Array of detected collisions */\nexport type Collisions = Collision[];\n\n/**\n * Input for collision detection functions.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n */\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n /** The droppable to check for collisions */\n droppable: U;\n /** The current drag operation state */\n dragOperation: DragOperation<T, U>;\n}\n\n/**\n * Function type for detecting collisions between draggables and droppables.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @param input - The collision detection input\n * @returns A collision object if detected, null otherwise\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 {derived, reactive} from '@dnd-kit/state';\n\n/**\n * Enum representing the possible states of a drag operation.\n */\nexport enum StatusValue {\n /** No drag operation is in progress */\n Idle = 'idle',\n /** A drag operation is about to start */\n InitializationPending = 'initialization-pending',\n /** A drag operation is being initialized */\n Initializing = 'initializing',\n /** A drag operation is in progress */\n Dragging = 'dragging',\n /** A drag operation has completed */\n Dropped = 'dropped',\n}\n\n/**\n * Manages the status of a drag operation.\n *\n * @remarks\n * This class provides reactive accessors for checking the current state\n * of a drag operation and methods for updating it.\n */\nexport class Status {\n /** The current status value */\n @reactive\n private accessor value: StatusValue = StatusValue.Idle;\n\n /**\n * Gets the current status value.\n *\n * @returns The current status value\n */\n @derived\n public get current(): StatusValue {\n return this.value;\n }\n\n /**\n * Checks if the status is idle.\n *\n * @returns true if no drag operation is in progress\n */\n @derived\n public get idle(): boolean {\n return this.value === StatusValue.Idle;\n }\n\n /**\n * Checks if the status is initializing.\n *\n * @returns true if a drag operation is being initialized\n */\n @derived\n public get initializing(): boolean {\n return this.value === StatusValue.Initializing;\n }\n\n /**\n * Checks if the status is initialized.\n *\n * @returns true if a drag operation has started initialization\n */\n @derived\n public get initialized(): boolean {\n const {value} = this;\n\n return (\n value !== StatusValue.Idle && value !== StatusValue.InitializationPending\n );\n }\n\n /**\n * Checks if the status is dragging.\n *\n * @returns true if a drag operation is in progress\n */\n @derived\n public get dragging(): boolean {\n return this.value === StatusValue.Dragging;\n }\n\n /**\n * Checks if the status is dropped.\n *\n * @returns true if a drag operation has completed\n */\n @derived\n public get dropped(): boolean {\n return this.value === StatusValue.Dropped;\n }\n\n /**\n * Sets the current status value.\n *\n * @param value - The new status value\n */\n public set(value: StatusValue) {\n this.value = value;\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, effect, untracked} from '@dnd-kit/state';\n\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {defaultPreventable} from './events.ts';\nimport {StatusValue} from './status.ts';\n\n/**\n * Provides actions for controlling drag and drop operations.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\n */\nexport class DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n /**\n * Creates a new instance of drag actions.\n *\n * @param manager - The drag and drop manager instance\n */\n constructor(private readonly manager: V) {}\n\n /**\n * Sets the source of the drag operation.\n *\n * @param source - The draggable entity or its unique identifier\n */\n setDragSource(source: T | UniqueIdentifier) {\n const {dragOperation} = this.manager;\n dragOperation.sourceIdentifier =\n typeof source === 'string' || typeof source === 'number'\n ? source\n : source.id;\n }\n\n /**\n * Sets the target of the drop operation.\n *\n * @param identifier - The unique identifier of the droppable entity or null/undefined\n * @returns A promise that resolves to true if the drop was prevented\n */\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<boolean> {\n return untracked(() => {\n const {dragOperation} = this.manager;\n const id = identifier ?? null;\n\n if (dragOperation.targetIdentifier === id) {\n return Promise.resolve(false);\n }\n\n dragOperation.targetIdentifier = id;\n\n const event = defaultPreventable({\n operation: dragOperation.snapshot(),\n });\n\n if (dragOperation.status.dragging) {\n this.manager.monitor.dispatch('dragover', event);\n }\n\n return this.manager.renderer.rendering.then(() => event.defaultPrevented);\n });\n }\n\n /**\n * Starts a new drag operation.\n *\n * @param args - Configuration for the drag operation\n * @param args.event - The event that initiated the drag\n * @param args.source - The source draggable entity or its identifier\n * @param args.coordinates - The initial coordinates of the drag\n * @returns true if the drag operation started successfully\n * @throws {Error} If there is no drag source or another operation is active\n */\n start(args: {\n /** The event that initiated the drag. */\n event?: Event;\n /** The source draggable entity or its identifier. */\n source?: T | UniqueIdentifier;\n /** The initial coordinates of the drag. */\n coordinates: Coordinates;\n }): AbortController {\n return untracked(() => {\n const {dragOperation} = this.manager;\n\n if (args.source != null) {\n this.setDragSource(args.source);\n }\n\n const sourceInstance = dragOperation.source;\n\n if (!sourceInstance) {\n throw new Error('Cannot start a drag operation without a drag source');\n }\n\n if (!dragOperation.status.idle) {\n throw new Error(\n 'Cannot start a drag operation while another is active'\n );\n }\n\n const controller = new AbortController();\n\n const {event: nativeEvent, coordinates} = args;\n\n batch(() => {\n dragOperation.status.set(StatusValue.InitializationPending);\n dragOperation.shape = null;\n dragOperation.canceled = false;\n dragOperation.activatorEvent = nativeEvent ?? null;\n dragOperation.position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: dragOperation.snapshot(),\n });\n\n this.manager.monitor.dispatch('beforedragstart', beforeStartEvent);\n\n if (beforeStartEvent.defaultPrevented) {\n dragOperation.reset();\n controller.abort();\n return controller;\n }\n\n dragOperation.status.set(StatusValue.Initializing);\n dragOperation.controller = controller;\n\n this.manager.renderer.rendering.then(() => {\n if (controller.signal.aborted) return;\n\n const {status} = dragOperation;\n if (status.current !== StatusValue.Initializing) return;\n\n dragOperation.status.set(StatusValue.Dragging);\n\n this.manager.monitor.dispatch('dragstart', {\n nativeEvent,\n operation: dragOperation.snapshot(),\n cancelable: false,\n });\n });\n\n return controller;\n });\n }\n\n /**\n * Moves the dragged entity to a new position.\n *\n * @param args - Configuration for the move operation\n * @param args.by - Relative coordinates to move by\n * @param args.to - Absolute coordinates to move to\n * @param args.event - The event that triggered the move\n * @param args.cancelable - Whether the move can be canceled\n * @param args.propagate - Whether to dispatch dragmove events\n */\n move(args: {\n /** The relative coordinates to move by. */\n by?: Coordinates;\n /** The absolute coordinates to move to. */\n to?: Coordinates;\n /** The event that triggered the move. */\n event?: Event;\n /** Whether the move can be canceled. */\n cancelable?: boolean;\n /** Whether to propagate the dragmove event to the manager. */\n propagate?: boolean;\n }): void {\n return untracked(() => {\n const {dragOperation} = this.manager;\n const {status, controller} = dragOperation;\n\n if (!status.dragging || !controller || controller.signal.aborted) {\n return;\n }\n\n const event = defaultPreventable(\n {\n nativeEvent: args.event,\n operation: dragOperation.snapshot(),\n by: args.by,\n to: args.to,\n },\n args.cancelable ?? true\n );\n\n if (args.propagate ?? true) {\n this.manager.monitor.dispatch('dragmove', event);\n }\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = args.to ?? {\n x: dragOperation.position.current.x + (args.by?.x ?? 0),\n y: dragOperation.position.current.y + (args.by?.y ?? 0),\n };\n\n dragOperation.position.current = coordinates;\n });\n });\n }\n\n /**\n * Stops the current drag operation.\n *\n * @param args - Configuration for stopping the operation\n * @param args.event - The event that triggered the stop\n * @param args.canceled - Whether the operation was canceled\n * @remarks\n * This method:\n * - Dispatches a dragend event\n * - Allows suspension of the operation\n * - Handles cleanup of the operation state\n */\n stop(\n args: {\n /**\n * The event that triggered the stop.\n */\n event?: Event;\n /**\n * Whether the operation was canceled.\n *\n * @default false\n */\n canceled?: boolean;\n } = {}\n ): void {\n return untracked(() => {\n const {dragOperation} = this.manager;\n const {controller} = dragOperation;\n\n if (!controller || controller.signal.aborted) return;\n\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\n controller.abort();\n\n const end = () => {\n this.manager.renderer.rendering.then(() => {\n dragOperation.status.set(StatusValue.Dropped);\n\n const dropping = untracked(\n () => dragOperation.source?.status === 'dropping'\n );\n\n const cleanup = () => {\n if (dragOperation.controller === controller) {\n dragOperation.controller = undefined;\n }\n dragOperation.reset();\n };\n\n if (dropping) {\n const {source} = dragOperation;\n\n // Wait until the source has finished dropping before resetting the operation\n const dispose = effect(() => {\n if (source?.status === 'idle') {\n dispose();\n cleanup();\n }\n });\n } else {\n this.manager.renderer.rendering.then(cleanup);\n }\n });\n };\n\n dragOperation.canceled = args.canceled ?? false;\n\n this.manager.monitor.dispatch('dragend', {\n nativeEvent: args.event,\n operation: dragOperation.snapshot(),\n canceled: args.canceled ?? false,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(() => dragOperation.reset());\n } else {\n end();\n }\n });\n }\n}\n","import {CleanupFunction, reactive, type Effect} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../../manager/index.ts';\nimport type {Data, UniqueIdentifier} from './types.ts';\n\nexport interface Input<T extends Data = Data> {\n /**\n * The unique identifier of the entity.\n */\n id: UniqueIdentifier;\n /**\n * Optional data associated with the entity.\n */\n data?: T;\n /**\n * Whether the entity should initially be disabled.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the entity should be automatically registered with the manager when it is created.\n * @default true\n */\n register?: boolean;\n /**\n * An array of effects that are set up when the entity is registered and cleaned up when it is unregistered.\n */\n effects?(): 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<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> {\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(input: Input<T>, manager: U | undefined) {\n const {effects, id, data = {}, disabled = false, register = true} = input;\n\n let previousId = id;\n\n this.manager = manager;\n this.id = id;\n this.data = data;\n this.disabled = disabled;\n this.effects = () => [\n () => {\n // Re-run this effect whenever the `id` changes\n const {id, manager} = this;\n\n if (id === previousId) {\n return;\n }\n\n manager?.registry.register(this);\n\n return () => manager?.registry.unregister(this);\n },\n ...(effects?.() ?? []),\n ];\n\n this.register = this.register.bind(this);\n this.unregister = this.unregister.bind(this);\n this.destroy = this.destroy.bind(this);\n\n if (manager && register) {\n queueMicrotask(this.register);\n }\n }\n\n /**\n * The manager that controls the drag and drop operations.\n */\n @reactive\n public accessor manager: U | undefined;\n\n /**\n * The unique identifier of the entity.\n */\n @reactive\n public accessor id: UniqueIdentifier;\n\n /**\n * The data associated with the entity.\n */\n @reactive\n public accessor data: Data;\n\n /**\n * A boolean indicating whether the entity is disabled.\n */\n @reactive\n public accessor disabled: boolean;\n\n /**\n * An array of effects that are applied to the entity.\n */\n public effects: () => Effect[];\n\n /**\n * A method that registers the entity with the manager.\n * @returns CleanupFunction | void\n */\n public register(): CleanupFunction | void {\n return this.manager?.registry.register(this);\n }\n\n /**\n * A method that unregisters the entity from the manager.\n * @returns void\n */\n public unregister(): void {\n this.manager?.registry.unregister(this);\n }\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 this.manager?.registry.unregister(this);\n }\n}\n","import {effects, signal} from '@dnd-kit/state';\n\nimport type {Entity} from './entity.ts';\nimport type {UniqueIdentifier} from './types.ts';\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 private cleanupFunctions = new WeakMap<T, () => void>();\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 const currentValue = current.get(key);\n const unregister = () => this.unregister(key, value);\n\n if (currentValue === value) return unregister;\n\n if (currentValue) {\n const cleanup = this.cleanupFunctions.get(currentValue);\n cleanup?.();\n this.cleanupFunctions.delete(currentValue);\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n const cleanup = effects(...value.effects());\n this.cleanupFunctions.set(value, cleanup);\n\n return unregister;\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 cleanup = this.cleanupFunctions.get(value);\n cleanup?.();\n this.cleanupFunctions.delete(value);\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 const cleanup = this.cleanupFunctions.get(entry);\n cleanup?.();\n entry.destroy();\n }\n\n this.map.value = new Map();\n }\n}\n","import {derived, reactive} from '@dnd-kit/state';\nimport type {Alignment} from '@dnd-kit/geometry';\n\nimport {Entity} from '../entity/index.ts';\nimport type {EntityInput, Data, Type} from '../entity/index.ts';\nimport type {Modifiers} from '../../modifiers/index.ts';\nimport type {DragDropManager} from '../../manager/index.ts';\nimport type {Sensors} from '../../sensors/sensor.ts';\n\n/**\n * Input configuration for creating a draggable entity.\n *\n * @template T - The type of data associated with the draggable\n *\n * @remarks\n * Extends the base entity input with draggable-specific configuration:\n * - Type for categorization\n * - Sensors for handling drag interactions\n * - Modifiers for transforming drag behavior\n * - Alignment for positioning\n */\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n type?: Type;\n sensors?: Sensors;\n modifiers?: Modifiers;\n alignment?: Alignment;\n}\n\n/**\n * Possible status values for a draggable entity.\n *\n * @remarks\n * - idle: Not being dragged\n * - dragging: Currently being dragged\n * - dropping: Currently being dropped\n */\nexport type DraggableStatus = 'idle' | 'dragging' | 'dropping';\n\n/**\n * Represents an entity that can be dragged in a drag and drop operation.\n *\n * @template T - The type of data associated with the draggable\n * @template U - The type of drag and drop manager\n *\n * @remarks\n * This class extends the base Entity class with draggable-specific functionality:\n * - Type-based categorization\n * - Sensor-based interaction handling\n * - Modifier-based behavior transformation\n * - Status tracking during drag operations\n */\nexport class Draggable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T, U> {\n constructor(\n {modifiers, type, sensors, ...input}: Input<T>,\n manager: U | undefined\n ) {\n super(input, manager);\n\n this.type = type;\n this.sensors = sensors;\n this.modifiers = modifiers;\n this.alignment = input.alignment;\n }\n\n /** The type of the draggable entity */\n @reactive\n public accessor type: Type | undefined;\n\n /** The sensors associated with the draggable entity */\n public sensors: Sensors | undefined;\n\n /** The modifiers associated with the draggable entity */\n @reactive\n public accessor modifiers: Modifiers | undefined;\n\n /** The alignment of the draggable entity */\n public alignment: Alignment | undefined;\n\n /** The current status of the draggable entity */\n @reactive\n public accessor status: DraggableStatus = this.isDragSource\n ? 'dragging'\n : 'idle';\n\n /**\n * Checks if the draggable entity is currently being dropped.\n *\n * @returns true if the entity is being dropped and is the drag source\n */\n @derived\n public get isDropping() {\n return this.status === 'dropping' && this.isDragSource;\n }\n\n /**\n * Checks if the draggable entity is currently being dragged.\n *\n * @returns true if the entity is being dragged and is the drag source\n */\n @derived\n public get isDragging() {\n return this.status === 'dragging' && this.isDragSource;\n }\n\n /**\n * Checks if the draggable entity is the source of the current drag operation.\n *\n * @returns true if the entity's ID matches the current drag operation's source ID\n */\n @derived\n public get isDragSource() {\n return this.manager?.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.ts';\nimport type {EntityInput, Data, Type} from '../entity/index.ts';\nimport {\n CollisionPriority,\n type CollisionDetector,\n} from '../../collision/index.ts';\nimport type {DragDropManager} from '../../manager/index.ts';\nimport {Draggable} from '../draggable/draggable.ts';\n\n/**\n * Input configuration for creating a droppable entity.\n *\n * @template T - The type of data associated with the droppable\n *\n * @remarks\n * Extends the base entity input with droppable-specific configuration:\n * - Accept rules for determining compatible draggables\n * - Collision detection configuration\n * - Type for categorization\n */\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n /** Types of draggables that can be dropped here, or a function to determine compatibility */\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n /** Priority for collision detection */\n collisionPriority?: CollisionPriority | number;\n /** Detector for determining collisions with draggables */\n collisionDetector: CollisionDetector;\n /** Type for categorization */\n type?: Type;\n}\n\n/**\n * Represents an entity that can receive draggable items in a drag and drop operation.\n *\n * @template T - The type of data associated with the droppable\n * @template U - The type of drag and drop manager\n *\n * @remarks\n * This class extends the base Entity class with droppable-specific functionality:\n * - Type-based acceptance rules\n * - Collision detection\n * - Shape tracking\n * - Target status tracking\n */\nexport class Droppable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T, U> {\n constructor(\n {accept, collisionDetector, collisionPriority, type, ...input}: Input<T>,\n manager: U | undefined\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 * Types of draggables that can be dropped here, or a function to determine compatibility.\n *\n * @remarks\n * If undefined, all draggables are accepted.\n * If a function, it determines compatibility based on the draggable.\n * If a type or array of types, only draggables of matching types are accepted.\n */\n @reactive\n public accessor accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /** The type of the droppable entity */\n @reactive\n public accessor type: Type | undefined;\n\n /**\n * Checks whether or not the droppable accepts a given draggable.\n *\n * @param draggable - The draggable to check\n * @returns true if the draggable can be dropped here\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\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 return draggable.type === accept;\n }\n\n /** The collision detector for this droppable */\n @reactive\n public accessor collisionDetector: CollisionDetector;\n\n /** The collision priority for this droppable */\n @reactive\n public accessor collisionPriority: CollisionPriority | number | undefined;\n\n /** The current shape of this droppable */\n @reactive\n public accessor shape: Shape | undefined;\n\n /**\n * Checks if this droppable is the current drop target.\n *\n * @returns true if this droppable's ID matches the current drag operation's target ID\n */\n @derived\n public get isDropTarget() {\n return this.manager?.dragOperation.target?.id === this.id;\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport {\n Plugin,\n type PluginConstructor,\n type PluginDescriptor,\n type PluginOptions,\n} from '../plugins/index.ts';\n\n/**\n * Options that can be passed to a sensor.\n * Extends the base PluginOptions type.\n */\nexport type SensorOptions = PluginOptions;\n\n/**\n * Abstract base class for all sensor implementations.\n *\n * @template T - The type of drag drop manager\n * @template U - The type of sensor options\n *\n * @remarks\n * Sensors are responsible for detecting and initiating drag operations.\n * They handle the actual user interaction (mouse, touch, keyboard, etc.)\n * and translate those interactions into drag operations.\n */\nexport abstract class Sensor<\n T extends DragDropManager<any, any> = DragDropManager<Draggable, Droppable>,\n U extends SensorOptions = SensorOptions,\n> extends Plugin<T, U> {\n /**\n * Creates a new sensor instance.\n *\n * @param manager - The drag drop manager instance\n * @param options - Optional sensor configuration\n */\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Binds the sensor to a draggable source.\n *\n * @param source - The draggable element to bind to\n * @param options - Optional sensor options specific to this draggable\n * @returns A cleanup function to unbind the sensor\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\n/**\n * Constructor type for creating sensor instances.\n *\n * @template T - The type of drag drop manager\n */\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\n/**\n * Descriptor type for configuring sensors.\n *\n * @template T - The type of drag drop manager\n */\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\n/**\n * Array type for multiple sensor configurations.\n *\n * @template T - The type of drag drop manager\n */\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","export class ActivationController<E extends Event> extends AbortController {\n public activated = false;\n\n constructor(\n private constraints: ActivationConstraints<E> | undefined,\n private onActivate: (event: E) => void\n ) {\n super();\n\n for (const constraint of constraints ?? []) {\n constraint.controller = this;\n }\n }\n\n onEvent(event: E) {\n if (this.activated) return;\n\n if (this.constraints?.length) {\n for (const constraint of this.constraints) {\n constraint.onEvent(event);\n }\n } else {\n this.activate(event);\n }\n }\n\n activate(event: E) {\n if (this.activated) return;\n this.activated = true;\n this.onActivate(event);\n }\n\n abort(event?: E) {\n this.activated = false;\n\n super.abort(event);\n }\n}\n\nexport interface ActivationConstraintOptions {}\n\nexport abstract class ActivationConstraint<\n E extends Event = Event,\n O extends ActivationConstraintOptions = ActivationConstraintOptions,\n> {\n #controller: ActivationController<E> | undefined;\n\n set controller(controller: ActivationController<E>) {\n this.#controller = controller;\n\n controller.signal.addEventListener('abort', () => this.abort());\n }\n\n constructor(protected options: O) {}\n\n /**\n * Called when the activation is triggered.\n */\n public activate(event: E): void {\n this.#controller?.activate(event);\n }\n\n /**\n * Called when the activation is aborted.\n */\n public abstract abort(event?: E): void;\n\n /**\n * Called when an input event is received by the sensor.\n * Returns `true` if this event triggers activation immediately.\n */\n public abstract onEvent(event: E): void;\n}\n\nexport type ActivationConstraints<E extends Event> = ActivationConstraint<E>[];\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.ts';\nimport type {DragDropManager} from '../manager/manager.ts';\nimport type {DragOperationSnapshot} from '../manager/operation.ts';\n\n/** Options that can be passed to a modifier */\nexport type ModifierOptions = PluginOptions;\n\n/**\n * Base class for drag operation modifiers.\n *\n * @template T - The type of drag and drop manager\n * @template U - The type of modifier options\n *\n * @remarks\n * Modifiers can transform the coordinates of a drag operation,\n * enabling features like snapping, constraints, and custom behaviors.\n */\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n /**\n * Creates a new modifier instance.\n *\n * @param manager - The drag and drop manager that owns this modifier\n * @param options - Optional configuration for the modifier\n */\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Applies the modifier to the current drag operation.\n *\n * @param operation - The current state of the drag operation\n * @returns The transformed coordinates\n *\n * @remarks\n * Override this method to implement custom transformation logic.\n * The default implementation returns the original transform unchanged.\n */\n public apply(operation: DragOperationSnapshot<any, any>): Coordinates {\n return operation.transform;\n }\n}\n\n/**\n * Constructor type for modifiers.\n *\n * @template T - The type of drag and drop manager\n */\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\n/**\n * Descriptor type for modifiers.\n *\n * @template T - The type of drag and drop manager\n */\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\n/**\n * Array type for modifier constructors or descriptors.\n *\n * @template T - The type of drag and drop manager\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.ts';\nimport {\n PluginRegistry,\n Plugin,\n type PluginConstructor,\n PluginOptions,\n} from '../plugins/index.ts';\nimport {\n Sensor,\n SensorOptions,\n type SensorConstructor,\n} from '../sensors/index.ts';\nimport {Modifier, type ModifierConstructor} from '../modifiers/index.ts';\nimport type {DragDropManager} from './manager.ts';\n\n/**\n * Manages the registration and lifecycle of draggable and droppable entities,\n * as well as plugins, sensors, and modifiers.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\n */\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n /**\n * Creates a new registry instance.\n *\n * @param manager - The drag and drop manager that owns this registry\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 /** Registry for draggable entities */\n public draggables = new EntityRegistry<T>();\n\n /** Registry for droppable entities */\n public droppables = new EntityRegistry<U>();\n\n /** Registry for plugins */\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n\n /** Registry for sensors */\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n\n /** Registry for modifiers */\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n /**\n * Registers a new entity, plugin, sensor, or modifier.\n *\n * @param input - The entity, plugin constructor, sensor constructor, or modifier constructor to register\n * @param options - Optional configuration for plugins and sensors\n * @returns A cleanup function or the registered instance\n * @throws {Error} If the input type is invalid\n */\n public register(input: Entity): () => void;\n public register(input: Draggable): () => void;\n public register(input: Droppable): () => void;\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 /**\n * Unregisters an entity, plugin, sensor, or modifier.\n *\n * @param input - The entity, plugin constructor, sensor constructor, or modifier constructor to unregister\n * @returns A cleanup function\n * @throws {Error} If the input type is invalid\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 /**\n * Destroys all registered entities and cleans up resources.\n *\n * @remarks\n * This method:\n * - Destroys all draggable and droppable entities\n * - Destroys all plugins, sensors, and modifiers\n * - Cleans up any associated resources\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 {\n batch,\n derived,\n reactive,\n snapshot,\n untracked,\n ValueHistory,\n type WithHistory,\n} from '@dnd-kit/state';\n\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\nimport type {Modifier} from '../modifiers/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {Status, StatusValue} from './status.ts';\n\nexport interface DragOperationSnapshot<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n readonly activatorEvent: Event | null;\n readonly canceled: boolean;\n readonly position: Position;\n readonly transform: Coordinates;\n readonly status: Status;\n get shape(): WithHistory<Shape> | null;\n set shape(value: Shape | null);\n readonly source: T | null;\n readonly target: U | null;\n}\n\n/**\n * Represents the current state of a drag operation.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n */\nexport class DragOperation<T extends Draggable, U extends Droppable>\n implements DragOperationSnapshot<T, U>\n{\n /**\n * Creates a new drag operation instance.\n *\n * @param manager - The drag and drop manager that owns this operation\n */\n constructor(manager: DragDropManager<T, U>) {\n this.#manager = manager;\n }\n\n #manager: DragDropManager<T, U>;\n\n #previousSource?: T;\n\n #shape = new ValueHistory<Shape | undefined>(undefined, (a, b) =>\n a && b ? a.equals(b) : a === b\n );\n\n /** Current status of the drag operation */\n public readonly status = new Status();\n\n /** The controller for the currentdrag operation */\n public controller: AbortController | undefined;\n\n /**\n * Gets the current shape of the dragged entity with history.\n *\n * @returns The shape history or null if no shape is set\n */\n @derived\n public get shape(): WithHistory<Shape> | null {\n const {current, initial, previous} = this.#shape;\n\n if (!current || !initial) {\n return null;\n }\n\n return {current, initial, previous};\n }\n\n /**\n * Sets the shape of the dragged entity.\n *\n * @param value - The new shape or null to reset\n */\n public set shape(value: Shape | null) {\n if (!value) {\n this.#shape.reset();\n } else {\n this.#shape.current = value;\n }\n }\n\n /** Whether the drag operation was canceled */\n @reactive\n public accessor canceled = false;\n\n /** The event that initiated the drag operation */\n @reactive\n public accessor activatorEvent: Event | null = null;\n\n /** Unique identifier of the source draggable entity */\n @reactive\n public accessor sourceIdentifier: UniqueIdentifier | null = null;\n\n /** Unique identifier of the target droppable entity */\n @reactive\n public accessor targetIdentifier: UniqueIdentifier | null = null;\n\n /** List of modifiers applied to the drag operation */\n @reactive\n public accessor modifiers: Modifier[] = [];\n\n /** Current position of the dragged entity */\n public position = new Position({x: 0, y: 0});\n\n /**\n * Gets the source draggable entity.\n *\n * @returns The current draggable entity or the previous one if the current is not found\n */\n @derived\n public get source(): T | null {\n const identifier = this.sourceIdentifier;\n if (identifier == null) return null;\n\n const value = this.#manager.registry.draggables.get(identifier);\n\n if (value) {\n this.#previousSource = value;\n }\n\n return value ?? this.#previousSource ?? null;\n }\n\n /**\n * Gets the target droppable entity.\n *\n * @returns The current droppable entity or null if not found\n */\n @derived\n public get target(): U | null {\n const identifier = this.targetIdentifier;\n return identifier != null\n ? (this.#manager.registry.droppables.get(identifier) ?? null)\n : null;\n }\n\n #transform = {x: 0, y: 0};\n\n /**\n * Gets the current transform after applying all modifiers.\n *\n * @returns The transformed coordinates\n */\n @derived\n public get transform() {\n const {x, y} = this.position.delta;\n let transform = {x, y};\n\n for (const modifier of this.modifiers) {\n transform = modifier.apply({\n ...this.snapshot(),\n transform,\n });\n }\n\n this.#transform = transform;\n\n return transform;\n }\n\n /**\n * Creates a snapshot of the current drag operation state.\n *\n * @returns An immutable snapshot of the current operation state\n */\n public snapshot(): DragOperationSnapshot<T, U> {\n return untracked(() => ({\n source: this.source,\n target: this.target,\n activatorEvent: this.activatorEvent,\n transform: this.#transform,\n shape: this.shape ? snapshot(this.shape) : null,\n position: snapshot(this.position),\n status: snapshot(this.status),\n canceled: this.canceled,\n }));\n }\n\n /**\n * Resets the drag operation to its initial state.\n *\n * @remarks\n * This method:\n * - Sets status to idle\n * - Clears source and target identifiers\n * - Resets shape history\n * - Resets position and transform\n * - Clears modifiers\n */\n public reset() {\n batch(() => {\n this.status.set(StatusValue.Idle);\n this.sourceIdentifier = null;\n this.targetIdentifier = null;\n this.#shape.reset();\n this.position.reset({x: 0, y: 0});\n this.#transform = {x: 0, y: 0};\n this.modifiers = [];\n });\n }\n}\n","/**\n * Interface for handling visual feedback during drag operations.\n *\n * @remarks\n * Implementations of this interface are responsible for managing\n * the visual state of dragged elements and ensuring smooth animations.\n */\nexport interface Renderer {\n /**\n * Gets a promise that resolves when the current rendering operation is complete.\n *\n * @returns A promise that resolves when rendering is finished\n */\n get rendering(): Promise<void>;\n}\n\n/**\n * Default renderer implementation.\n *\n * @remarks\n * This implementation immediately resolves rendering promises,\n * making it suitable for environments where custom rendering\n * is not required or handled externally.\n */\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import {effects, untracked} from '@dnd-kit/state';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport {CollisionObserver, CollisionNotifier} from '../collision/index.ts';\nimport type {Plugins, Plugin} from '../plugins/index.ts';\nimport type {Sensor, Sensors} from '../sensors/index.ts';\nimport type {Modifier, Modifiers} from '../modifiers/index.ts';\nimport {descriptor} from '../plugins/utilities.ts';\n\nimport {DragActions} from './actions.ts';\nimport {DragDropRegistry} from './registry.ts';\nimport {DragOperation} from './operation.ts';\nimport {DragDropMonitor} from './events.ts';\nimport {defaultRenderer, type Renderer} from './renderer.ts';\n\n/**\n * A value that can be provided as-is or as a function that receives defaults.\n *\n * @example\n * // As a plain array (replaces defaults)\n * plugins: [MyPlugin]\n *\n * // As a function (receives defaults)\n * plugins: (defaults) => [...defaults, MyPlugin]\n */\nexport type Customizable<T> = T | ((defaults: T) => T);\n\n/**\n * Resolves a customizable value by applying it to defaults.\n *\n * @param value - A value or function that receives defaults\n * @param defaults - The default value to use when undefined, or to pass to a function\n * @returns The resolved value\n */\nexport function resolveCustomizable<T>(\n value: Customizable<T> | undefined,\n defaults: T\n): T {\n if (typeof value === 'function') {\n return (value as (defaults: T) => T)(defaults);\n }\n\n return value ?? defaults;\n}\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = {\n plugins?: Customizable<Plugins<T>>;\n sensors?: Customizable<Sensors<T>>;\n modifiers?: Customizable<Modifiers<T>>;\n renderer?: Renderer;\n};\n\n/**\n * Central manager class that orchestrates drag and drop operations.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n */\nexport class DragDropManager<T extends Draggable, U extends Droppable> {\n /** Actions that can be performed during drag operations */\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n\n /** Observes and manages collision detection between draggable and droppable entities */\n public collisionObserver: CollisionObserver<T, U>;\n\n /** Tracks the current drag operation state and metadata */\n public dragOperation: DragOperation<T, U>;\n\n /** Monitors and emits drag and drop events */\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n\n /** Registry that manages draggable and droppable entities */\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n\n /** Handles rendering of drag and drop visual feedback */\n public renderer: Renderer;\n\n /**\n * Creates a new drag and drop manager instance.\n *\n * @param config - Optional configuration for plugins, sensors, modifiers, and renderer\n */\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const raw = config ?? {};\n const plugins = resolveCustomizable(raw.plugins, []);\n const sensors = resolveCustomizable(raw.sensors, []);\n const modifiers = resolveCustomizable(raw.modifiers, []);\n const renderer = raw.renderer ?? defaultRenderer;\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 this.actions = new DragActions<T, U, V>(this);\n this.dragOperation = new DragOperation<T, U>(this);\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n\n const {destroy} = this;\n\n const cleanup = effects(() => {\n const currentModifiers = untracked(() => this.dragOperation.modifiers);\n const managerModifiers = this.modifiers;\n\n if (currentModifiers !== managerModifiers) {\n currentModifiers.forEach((modifier) => modifier.destroy());\n }\n\n this.dragOperation.modifiers =\n this.dragOperation.source?.modifiers?.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n return new plugin(this, options);\n }) ?? managerModifiers;\n });\n\n this.destroy = () => {\n cleanup();\n destroy();\n };\n }\n\n /**\n * Gets the list of active plugins.\n *\n * @returns Array of active plugin instances\n */\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n /**\n * Sets the list of plugins to be used by the manager.\n *\n * @param plugins - Array of plugin constructors or instances\n */\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n /**\n * Gets the list of active modifiers.\n *\n * @returns Array of active modifier instances\n */\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n /**\n * Sets the list of modifiers to be used by the manager.\n *\n * @param modifiers - Array of modifier constructors or instances\n */\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n /**\n * Gets the list of active sensors.\n *\n * @returns Array of active sensor instances\n */\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n /**\n * Sets the list of sensors to be used by the manager.\n *\n * @param sensors - Array of sensor constructors or instances\n */\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n /**\n * Cleans up resources and stops any active drag operations.\n */\n public destroy = () => {\n if (!this.dragOperation.status.idle) {\n this.actions.stop({canceled: true});\n }\n\n this.dragOperation.modifiers.forEach((modifier) => modifier.destroy());\n\n this.registry.destroy();\n this.collisionObserver.destroy();\n };\n}\n"]}
1
+ {"version":3,"sources":["src/core/plugins/utilities.ts","src/core/plugins/plugin.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/observer.ts","src/core/manager/events.ts","src/core/collision/notifier.ts","src/core/collision/types.ts","src/core/manager/status.ts","src/core/manager/actions.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/sensors/activation.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/operation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["descriptor","untracked","effects","CollisionPriority","CollisionType","_init","reactive","_a","_b","_c","effect","_disabled_dec","_disabled","id","manager","signal","cleanup","derived","_type_dec","_type","_modifiers_dec","_shape_dec","_manager","_shape","_modifiers","batch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,SAAA,CAGd,QAAW,OAA2C,EAAA;AACtD,EAAO,OAAA;AAAA,IACL,MAAA;AAAA,IACA;AAAA,GACF;AACF;AASO,SAAS,aACd,MACA,EAAA;AACA,EAAA,OAAO,CAAC,OAAkE,KAAA;AACxE,IAAO,OAAA,SAAA,CAAU,QAAQ,OAAO,CAAA;AAAA,GAClC;AACF;AASO,SAAS,WACd,MAC+B,EAAA;AAC/B,EAAI,IAAA,OAAO,WAAW,UAAY,EAAA;AAChC,IAAO,OAAA;AAAA,MACL,MAAA;AAAA,MACA,OAAS,EAAA;AAAA,KACX;AAAA;AAGF,EAAO,OAAA,MAAA;AACT;;;AC3DA,IAAA,aAAA,EAAA,KAAA,EAAA,SAAA,EAAA,iBAAA;AA0CE,aAAC,GAAA,CAAA,QAAA,CAAA;AArBI,IAAe,SAAf,MAGL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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B,IAAO,OAAA,IAAA,CAAK,SAAS,SAAU,CAAA,MAAA;AAAA;AACjC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,UAAU,SAA2B,EAAA;AACvC,IAAK,IAAA,CAAA,QAAA,CAAS,UAAU,MAAS,GAAA,SAAA;AAAA;AACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAyB,GAAA;AAC3B,IAAO,OAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,MAAA;AAAA;AAC/B;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,QAAQ,OAAuB,EAAA;AACjC,IAAK,IAAA,CAAA,QAAA,CAAS,QAAQ,MAAS,GAAA,OAAA;AAAA;AAgBnC","file":"index.js","sourcesContent":["import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.ts';\n\n/**\n * Creates a plugin descriptor with the given plugin constructor and options.\n *\n * @template T - The plugin constructor type\n * @template V - The plugin options type\n * @param plugin - The plugin constructor\n * @param options - The plugin configuration options\n * @returns A plugin descriptor containing the constructor and options\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\n/**\n * Creates a configurator function for a specific plugin constructor.\n *\n * @template T - The plugin constructor type\n * @param plugin - The plugin constructor to configure\n * @returns A function that takes options and returns a plugin descriptor\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\n/**\n * Normalizes a plugin constructor or descriptor into a descriptor.\n *\n * @template T - The plugin constructor type\n * @param plugin - Either a plugin constructor or a plugin descriptor\n * @returns A plugin descriptor\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 {\n type CleanupFunction,\n effect,\n reactive,\n untracked,\n} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {PluginOptions} from './types.ts';\nimport {configure} from './utilities.ts';\n\n/**\n * Base class for plugins that extend drag and drop functionality.\n *\n * @template T - The type of drag and drop manager\n * @template U - The type of plugin options\n *\n * @remarks\n * Plugins can add new features and behaviors to the drag and drop system\n * by extending this class and implementing custom functionality.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n /**\n * Creates a new plugin instance.\n *\n * @param manager - The drag and drop manager that owns this plugin\n * @param options - Optional configuration for the plugin\n */\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n *\n * @remarks\n * This property is reactive and triggers effects when accessed.\n */\n @reactive\n public accessor disabled: boolean = false;\n\n /**\n * Enables a disabled plugin instance.\n *\n * @remarks\n * This method triggers effects when called.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disables an enabled plugin instance.\n *\n * @remarks\n * This method triggers effects when called.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Checks if the plugin instance is disabled.\n *\n * @returns true if the plugin is disabled\n * @remarks\n * This method does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configures a plugin instance with new options.\n *\n * @param options - The new options to apply\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n #cleanupFunctions = new Set<CleanupFunction>();\n\n /**\n * Registers an effect that will be cleaned up when the plugin is destroyed.\n *\n * @param callback - The effect callback to register\n * @returns A function to dispose of the effect\n */\n protected registerEffect(callback: () => void) {\n const dispose = effect(callback.bind(this));\n\n this.#cleanupFunctions.add(dispose);\n\n return dispose;\n }\n\n /**\n * Destroys a plugin instance and cleans up its resources.\n *\n * @remarks\n * This method:\n * - Calls all registered cleanup functions\n * - Should be overridden by subclasses to clean up additional resources\n */\n public destroy() {\n this.#cleanupFunctions.forEach((cleanup) => cleanup());\n }\n\n /**\n * Configures a plugin constructor with options.\n *\n * @param options - The options to configure the constructor with\n * @returns The configured plugin constructor\n *\n * @remarks\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\n/**\n * Base class for core plugins that ship with the library.\n *\n * @template T - The type of drag and drop manager\n * @template U - The type of plugin options\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 {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin, type Plugin} from './plugin.ts';\nimport type {\n InferPluginOptions,\n PluginDescriptor,\n PluginConstructor,\n Plugins,\n} from './types.ts';\nimport {descriptor} from './utilities.ts';\n\n/**\n * Manages the registration and lifecycle of plugin instances.\n *\n * @template T - The type of drag and drop manager\n * @template W - The type of plugin constructor\n * @template U - The type of plugin instance\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 /**\n * Creates a new plugin registry.\n *\n * @param manager - The drag and drop manager that owns this registry\n */\n constructor(private manager: T) {}\n\n /**\n * Gets all registered plugin instances.\n *\n * @returns An array of all active plugin instances\n */\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n /**\n * Sets the list of plugins to be used by the registry.\n *\n * @param entries - Array of plugin constructors or descriptors\n * @remarks\n * This method:\n * - Filters out duplicate plugins\n * - Unregisters plugins that are no longer in use\n * - Registers new plugins with their options\n */\n public set values(entries: Plugins<T>) {\n const descriptors = entries\n .map(descriptor)\n .reduceRight<PluginDescriptor<T>[]>((acc, descriptor) => {\n if (acc.some(({plugin}) => plugin === descriptor.plugin)) {\n // Filter out duplicate plugins\n return acc;\n }\n\n return [descriptor, ...acc];\n }, []);\n const constructors = descriptors.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 descriptors) {\n this.register(plugin as W, options as InferPluginOptions<W>);\n }\n\n this.#previousValues = constructors;\n }\n\n /**\n * Gets a plugin instance by its constructor.\n *\n * @param plugin - The plugin constructor to look up\n * @returns The plugin instance or undefined if not found\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 /**\n * Registers a new plugin instance.\n *\n * @param plugin - The plugin constructor to register\n * @param options - Optional configuration for the plugin\n * @returns The registered plugin instance\n * @remarks\n * If the plugin is already registered, its options will be updated\n * and the existing instance will be returned.\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 if (existingInstance.options !== options) {\n existingInstance.options = options;\n }\n\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 /**\n * Unregisters a plugin instance.\n *\n * @param plugin - The plugin constructor to unregister\n * @remarks\n * This method:\n * - Destroys the plugin instance\n * - Removes it from the registry\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 /**\n * Destroys all registered plugin instances.\n *\n * @remarks\n * This method:\n * - Calls destroy() on all plugin instances\n * - Clears the registry\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.ts';\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 if (a.type === b.type) {\n return b.value - a.value;\n }\n\n return b.type - a.type;\n }\n\n return b.priority - a.priority;\n}\n","import {signal, untracked, type Signal, effects} from '@dnd-kit/state';\nimport type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport {Plugin} from '../plugins/index.ts';\nimport type {Collision, CollisionDetector, Collisions} from './types.ts';\nimport {sortCollisions} from './utilities.ts';\n\nconst DEFAULT_VALUE: Collisions = [];\n\n/**\n * Observes and manages collision detection between draggable and droppable elements.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag drop manager\n *\n * @remarks\n * The CollisionObserver is responsible for:\n * - Computing collisions between draggable and droppable elements\n * - Maintaining a signal of current collisions\n * - Updating collision state based on drag operation changes\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 /**\n * Creates a new CollisionObserver instance.\n *\n * @param manager - The drag drop manager instance\n */\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = signal(DEFAULT_VALUE);\n\n this.destroy = effects(\n () => {\n const collisions = this.computeCollisions();\n const coordinates = untracked(\n () => this.manager.dragOperation.position.current\n );\n\n if (collisions !== DEFAULT_VALUE) {\n const previousCoordinates = this.#previousCoordinates;\n this.#previousCoordinates = coordinates;\n\n if (\n previousCoordinates &&\n coordinates.x == previousCoordinates.x &&\n coordinates.y == previousCoordinates.y\n ) {\n return;\n }\n } else {\n this.#previousCoordinates = undefined;\n }\n\n this.#collisions.value = collisions;\n },\n () => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n }\n );\n }\n\n #previousCoordinates: Coordinates | undefined;\n\n /**\n * Forces an immediate update of collision detection.\n *\n * @param immediate - If true, updates collisions immediately. If false, resets previous coordinates.\n */\n public forceUpdate(immediate = true) {\n untracked(() => {\n if (immediate) {\n this.#collisions.value = this.computeCollisions();\n } else {\n this.#previousCoordinates = undefined;\n }\n });\n }\n\n /**\n * Computes collisions between draggable and droppable elements.\n *\n * @param entries - Optional array of droppable elements to check. If not provided, uses all registered droppables.\n * @param collisionDetector - Optional custom collision detector function\n * @returns Array of detected collisions, sorted by priority\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 const potentialTargets = [];\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 potentialTargets.push(entry);\n\n // Force collisions to be recomputed when the shape changes\n void entry.shape;\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 if (potentialTargets.length === 0) {\n return DEFAULT_VALUE;\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n /**\n * Gets the current collisions signal value.\n */\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: Signal<Collisions>;\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport type {Collisions} from '../collision/index.ts';\nimport type {DragDropManager} from './manager.ts';\nimport type {DragOperationSnapshot} from './operation.ts';\n\n/** Base type for event handler functions */\nexport type Events = Record<string, (...args: any[]) => void>;\n\n/**\n * Extends an event type with preventable functionality.\n *\n * @template T - The base event type\n */\nexport type Preventable<T> = T & {\n /** Whether the event can be canceled */\n cancelable: boolean;\n /** Whether the default action was prevented */\n defaultPrevented: boolean;\n /** Prevents the default action of the event */\n preventDefault(): void;\n};\n\n/**\n * Base class for event monitoring and dispatching.\n *\n * @template T - The type of events to monitor\n */\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n /**\n * Adds an event listener for the specified event type.\n *\n * @param name - The name of the event to listen for\n * @param handler - The function to call when the event occurs\n * @returns A function to remove the event listener\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 /**\n * Removes an event listener for the specified event type.\n *\n * @param name - The name of the event\n * @param handler - The function to remove\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 /**\n * Dispatches an event to all registered listeners.\n *\n * @param name - The name of the event to dispatch\n * @param args - Arguments to pass to the event handlers\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\n/**\n * Type definition for drag and drop events.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\n */\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n /** Event fired when collisions are detected */\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n /** Event fired before a drag operation starts */\n beforedragstart(\n event: Preventable<{\n operation: DragOperationSnapshot<T, U>;\n nativeEvent?: Event;\n }>,\n manager: V\n ): void;\n /** Event fired when a drag operation starts */\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperationSnapshot<T, U>;\n nativeEvent?: Event;\n },\n manager: V\n ): void;\n /** Event fired when a drag operation moves */\n dragmove(\n event: Preventable<{\n operation: DragOperationSnapshot<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n nativeEvent?: Event;\n }>,\n manager: V\n ): void;\n /** Event fired when a drag operation hovers over a droppable */\n dragover(\n event: Preventable<{\n operation: DragOperationSnapshot<T, U>;\n }>,\n manager: V\n ): void;\n /** Event fired when a drag operation ends */\n dragend(\n event: {\n operation: DragOperationSnapshot<T, U>;\n nativeEvent?: Event;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport type CollisionEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['collision'];\n\nexport type BeforeDragStartEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['beforedragstart'];\n\nexport type DragStartEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragstart'];\n\nexport type DragMoveEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragmove'];\n\nexport type DragOverEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragover'];\n\nexport type DragEndEvent<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> = DragDropEvents<T, U, V>['dragend'];\n\n/**\n * Monitors and dispatches drag and drop events.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\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 /**\n * Creates a new drag and drop monitor.\n *\n * @param manager - The drag and drop manager to monitor\n */\n constructor(private manager: V) {\n super();\n }\n\n /**\n * Dispatches a drag and drop event.\n *\n * @param type - The type of event to dispatch\n * @param event - The event data to dispatch\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\n/**\n * Creates a preventable event object.\n *\n * @param event - The base event object\n * @param cancelable - Whether the event can be canceled\n * @returns A preventable event object\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 {effect, effects, untracked} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin} from '../plugins/index.ts';\nimport {defaultPreventable} from '../manager/events.ts';\n\nimport type {Collision} from './types.ts';\n\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager<any, any>) {\n super(manager);\n\n const isEqual = (a: Collision[], b: Collision[]) =>\n a.map(({id}) => id).join('') === b.map(({id}) => id).join('');\n\n let previousCollisions: Collision[] = [];\n\n this.destroy = effects(\n () => {\n const {dragOperation, collisionObserver} = manager;\n\n if (dragOperation.status.initializing) {\n previousCollisions = [];\n collisionObserver.enable();\n }\n },\n () => {\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 if (isEqual(collisions, previousCollisions)) {\n return;\n } else {\n previousCollisions = collisions;\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}\n","import type {DragOperation} from '../manager/index.ts';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\n/**\n * Priority levels for collision detection.\n *\n * @remarks\n * Higher priority collisions take precedence over lower priority ones.\n * Custom numeric priorities can also be used for fine-grained control.\n */\nexport enum CollisionPriority {\n /** Lowest priority level */\n Lowest,\n /** Low priority level */\n Low,\n /** Normal priority level */\n Normal,\n /** High priority level */\n High,\n /** Highest priority level */\n Highest,\n}\n\n/**\n * Types of collision detection.\n *\n * @remarks\n * Different collision types can be used to implement various\n * drag and drop behaviors and visual feedback.\n */\nexport enum CollisionType {\n /** Basic collision detection */\n Collision,\n /** Shape-based intersection detection */\n ShapeIntersection,\n /** Pointer-based intersection detection */\n PointerIntersection,\n}\n\n/**\n * Represents a detected collision between a draggable and droppable.\n *\n * @remarks\n * Contains information about the collision type, priority, and\n * additional data that can be used for custom behaviors.\n */\nexport interface Collision {\n /** Unique identifier of the droppable involved in the collision */\n id: UniqueIdentifier;\n /** Priority of the collision */\n priority: CollisionPriority | number;\n /** Type of collision detected */\n type: CollisionType;\n /** Numeric value representing the collision strength or overlap */\n value: number;\n /** Additional data associated with the collision */\n data?: Record<string, any>;\n}\n\n/** Array of detected collisions */\nexport type Collisions = Collision[];\n\n/**\n * Input for collision detection functions.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n */\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n /** The droppable to check for collisions */\n droppable: U;\n /** The current drag operation state */\n dragOperation: DragOperation<T, U>;\n}\n\n/**\n * Function type for detecting collisions between draggables and droppables.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @param input - The collision detection input\n * @returns A collision object if detected, null otherwise\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 {derived, reactive} from '@dnd-kit/state';\n\n/**\n * Enum representing the possible states of a drag operation.\n */\nexport enum StatusValue {\n /** No drag operation is in progress */\n Idle = 'idle',\n /** A drag operation is about to start */\n InitializationPending = 'initialization-pending',\n /** A drag operation is being initialized */\n Initializing = 'initializing',\n /** A drag operation is in progress */\n Dragging = 'dragging',\n /** A drag operation has completed */\n Dropped = 'dropped',\n}\n\n/**\n * Manages the status of a drag operation.\n *\n * @remarks\n * This class provides reactive accessors for checking the current state\n * of a drag operation and methods for updating it.\n */\nexport class Status {\n /** The current status value */\n @reactive\n private accessor value: StatusValue = StatusValue.Idle;\n\n /**\n * Gets the current status value.\n *\n * @returns The current status value\n */\n @derived\n public get current(): StatusValue {\n return this.value;\n }\n\n /**\n * Checks if the status is idle.\n *\n * @returns true if no drag operation is in progress\n */\n @derived\n public get idle(): boolean {\n return this.value === StatusValue.Idle;\n }\n\n /**\n * Checks if the status is initializing.\n *\n * @returns true if a drag operation is being initialized\n */\n @derived\n public get initializing(): boolean {\n return this.value === StatusValue.Initializing;\n }\n\n /**\n * Checks if the status is initialized.\n *\n * @returns true if a drag operation has started initialization\n */\n @derived\n public get initialized(): boolean {\n const {value} = this;\n\n return (\n value !== StatusValue.Idle && value !== StatusValue.InitializationPending\n );\n }\n\n /**\n * Checks if the status is dragging.\n *\n * @returns true if a drag operation is in progress\n */\n @derived\n public get dragging(): boolean {\n return this.value === StatusValue.Dragging;\n }\n\n /**\n * Checks if the status is dropped.\n *\n * @returns true if a drag operation has completed\n */\n @derived\n public get dropped(): boolean {\n return this.value === StatusValue.Dropped;\n }\n\n /**\n * Sets the current status value.\n *\n * @param value - The new status value\n */\n public set(value: StatusValue) {\n this.value = value;\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, effect, untracked} from '@dnd-kit/state';\n\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {defaultPreventable} from './events.ts';\nimport {StatusValue} from './status.ts';\n\n/**\n * Provides actions for controlling drag and drop operations.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\n */\nexport class DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n /**\n * Creates a new instance of drag actions.\n *\n * @param manager - The drag and drop manager instance\n */\n constructor(private readonly manager: V) {}\n\n /**\n * Sets the source of the drag operation.\n *\n * @param source - The draggable entity or its unique identifier\n */\n setDragSource(source: T | UniqueIdentifier) {\n const {dragOperation} = this.manager;\n dragOperation.sourceIdentifier =\n typeof source === 'string' || typeof source === 'number'\n ? source\n : source.id;\n }\n\n /**\n * Sets the target of the drop operation.\n *\n * @param identifier - The unique identifier of the droppable entity or null/undefined\n * @returns A promise that resolves to true if the drop was prevented\n */\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<boolean> {\n return untracked(() => {\n const {dragOperation} = this.manager;\n const id = identifier ?? null;\n\n if (dragOperation.targetIdentifier === id) {\n return Promise.resolve(false);\n }\n\n dragOperation.targetIdentifier = id;\n\n const event = defaultPreventable({\n operation: dragOperation.snapshot(),\n });\n\n if (dragOperation.status.dragging) {\n this.manager.monitor.dispatch('dragover', event);\n }\n\n return this.manager.renderer.rendering.then(() => event.defaultPrevented);\n });\n }\n\n /**\n * Starts a new drag operation.\n *\n * @param args - Configuration for the drag operation\n * @param args.event - The event that initiated the drag\n * @param args.source - The source draggable entity or its identifier\n * @param args.coordinates - The initial coordinates of the drag\n * @returns true if the drag operation started successfully\n * @throws {Error} If there is no drag source or another operation is active\n */\n start(args: {\n /** The event that initiated the drag. */\n event?: Event;\n /** The source draggable entity or its identifier. */\n source?: T | UniqueIdentifier;\n /** The initial coordinates of the drag. */\n coordinates: Coordinates;\n }): AbortController {\n return untracked(() => {\n const {dragOperation} = this.manager;\n\n if (args.source != null) {\n this.setDragSource(args.source);\n }\n\n const sourceInstance = dragOperation.source;\n\n if (!sourceInstance) {\n throw new Error('Cannot start a drag operation without a drag source');\n }\n\n if (!dragOperation.status.idle) {\n throw new Error(\n 'Cannot start a drag operation while another is active'\n );\n }\n\n const controller = new AbortController();\n\n const {event: nativeEvent, coordinates} = args;\n\n batch(() => {\n dragOperation.status.set(StatusValue.InitializationPending);\n dragOperation.shape = null;\n dragOperation.canceled = false;\n dragOperation.activatorEvent = nativeEvent ?? null;\n dragOperation.position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: dragOperation.snapshot(),\n });\n\n this.manager.monitor.dispatch('beforedragstart', beforeStartEvent);\n\n if (beforeStartEvent.defaultPrevented) {\n dragOperation.reset();\n controller.abort();\n return controller;\n }\n\n dragOperation.status.set(StatusValue.Initializing);\n dragOperation.controller = controller;\n\n this.manager.renderer.rendering.then(() => {\n if (controller.signal.aborted) return;\n\n const {status} = dragOperation;\n if (status.current !== StatusValue.Initializing) return;\n\n dragOperation.status.set(StatusValue.Dragging);\n\n this.manager.monitor.dispatch('dragstart', {\n nativeEvent,\n operation: dragOperation.snapshot(),\n cancelable: false,\n });\n });\n\n return controller;\n });\n }\n\n /**\n * Moves the dragged entity to a new position.\n *\n * @param args - Configuration for the move operation\n * @param args.by - Relative coordinates to move by\n * @param args.to - Absolute coordinates to move to\n * @param args.event - The event that triggered the move\n * @param args.cancelable - Whether the move can be canceled\n * @param args.propagate - Whether to dispatch dragmove events\n */\n move(args: {\n /** The relative coordinates to move by. */\n by?: Coordinates;\n /** The absolute coordinates to move to. */\n to?: Coordinates;\n /** The event that triggered the move. */\n event?: Event;\n /** Whether the move can be canceled. */\n cancelable?: boolean;\n /** Whether to propagate the dragmove event to the manager. */\n propagate?: boolean;\n }): void {\n return untracked(() => {\n const {dragOperation} = this.manager;\n const {status, controller} = dragOperation;\n\n if (!status.dragging || !controller || controller.signal.aborted) {\n return;\n }\n\n const event = defaultPreventable(\n {\n nativeEvent: args.event,\n operation: dragOperation.snapshot(),\n by: args.by,\n to: args.to,\n },\n args.cancelable ?? true\n );\n\n if (args.propagate ?? true) {\n this.manager.monitor.dispatch('dragmove', event);\n }\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = args.to ?? {\n x: dragOperation.position.current.x + (args.by?.x ?? 0),\n y: dragOperation.position.current.y + (args.by?.y ?? 0),\n };\n\n dragOperation.position.current = coordinates;\n });\n });\n }\n\n /**\n * Stops the current drag operation.\n *\n * @param args - Configuration for stopping the operation\n * @param args.event - The event that triggered the stop\n * @param args.canceled - Whether the operation was canceled\n * @remarks\n * This method:\n * - Dispatches a dragend event\n * - Allows suspension of the operation\n * - Handles cleanup of the operation state\n */\n stop(\n args: {\n /**\n * The event that triggered the stop.\n */\n event?: Event;\n /**\n * Whether the operation was canceled.\n *\n * @default false\n */\n canceled?: boolean;\n } = {}\n ): void {\n return untracked(() => {\n const {dragOperation} = this.manager;\n const {controller} = dragOperation;\n\n if (!controller || controller.signal.aborted) return;\n\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\n controller.abort();\n\n const end = () => {\n this.manager.renderer.rendering.then(() => {\n dragOperation.status.set(StatusValue.Dropped);\n\n const dropping = untracked(\n () => dragOperation.source?.status === 'dropping'\n );\n\n const cleanup = () => {\n if (dragOperation.controller === controller) {\n dragOperation.controller = undefined;\n }\n dragOperation.reset();\n };\n\n if (dropping) {\n const {source} = dragOperation;\n\n // Wait until the source has finished dropping before resetting the operation\n const dispose = effect(() => {\n if (source?.status === 'idle') {\n dispose();\n cleanup();\n }\n });\n } else {\n this.manager.renderer.rendering.then(cleanup);\n }\n });\n };\n\n dragOperation.canceled = args.canceled ?? false;\n\n this.manager.monitor.dispatch('dragend', {\n nativeEvent: args.event,\n operation: dragOperation.snapshot(),\n canceled: args.canceled ?? false,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(() => dragOperation.reset());\n } else {\n end();\n }\n });\n }\n}\n","import {CleanupFunction, reactive, type Effect} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../../manager/index.ts';\nimport type {Data, UniqueIdentifier} from './types.ts';\n\nexport interface Input<T extends Data = Data> {\n /**\n * The unique identifier of the entity.\n */\n id: UniqueIdentifier;\n /**\n * Optional data associated with the entity.\n */\n data?: T;\n /**\n * Whether the entity should initially be disabled.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the entity should be automatically registered with the manager when it is created.\n * @default true\n */\n register?: boolean;\n /**\n * An array of effects that are set up when the entity is registered and cleaned up when it is unregistered.\n */\n effects?(): 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<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> {\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(input: Input<T>, manager: U | undefined) {\n const {effects, id, data = {}, disabled = false, register = true} = input;\n\n let previousId = id;\n\n this.manager = manager;\n this.id = id;\n this.data = data;\n this.disabled = disabled;\n this.effects = () => [\n () => {\n // Re-run this effect whenever the `id` changes\n const {id, manager} = this;\n\n if (id === previousId) {\n return;\n }\n\n manager?.registry.register(this);\n\n return () => manager?.registry.unregister(this);\n },\n ...(effects?.() ?? []),\n ];\n\n this.register = this.register.bind(this);\n this.unregister = this.unregister.bind(this);\n this.destroy = this.destroy.bind(this);\n\n if (manager && register) {\n queueMicrotask(this.register);\n }\n }\n\n /**\n * The manager that controls the drag and drop operations.\n */\n @reactive\n public accessor manager: U | undefined;\n\n /**\n * The unique identifier of the entity.\n */\n @reactive\n public accessor id: UniqueIdentifier;\n\n /**\n * The data associated with the entity.\n */\n @reactive\n public accessor data: Data;\n\n /**\n * A boolean indicating whether the entity is disabled.\n */\n @reactive\n public accessor disabled: boolean;\n\n /**\n * An array of effects that are applied to the entity.\n */\n public effects: () => Effect[];\n\n /**\n * A method that registers the entity with the manager.\n * @returns CleanupFunction | void\n */\n public register(): CleanupFunction | void {\n return this.manager?.registry.register(this);\n }\n\n /**\n * A method that unregisters the entity from the manager.\n * @returns void\n */\n public unregister(): void {\n this.manager?.registry.unregister(this);\n }\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 this.manager?.registry.unregister(this);\n }\n}\n","import {effects, signal} from '@dnd-kit/state';\n\nimport type {Entity} from './entity.ts';\nimport type {UniqueIdentifier} from './types.ts';\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 private cleanupFunctions = new WeakMap<T, () => void>();\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 const currentValue = current.get(key);\n const unregister = () => this.unregister(key, value);\n\n if (currentValue === value) return unregister;\n\n if (currentValue) {\n const cleanup = this.cleanupFunctions.get(currentValue);\n cleanup?.();\n this.cleanupFunctions.delete(currentValue);\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n const cleanup = effects(...value.effects());\n this.cleanupFunctions.set(value, cleanup);\n\n return unregister;\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 cleanup = this.cleanupFunctions.get(value);\n cleanup?.();\n this.cleanupFunctions.delete(value);\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 const cleanup = this.cleanupFunctions.get(entry);\n cleanup?.();\n entry.destroy();\n }\n\n this.map.value = new Map();\n }\n}\n","import {derived, reactive} from '@dnd-kit/state';\nimport type {Alignment} from '@dnd-kit/geometry';\n\nimport {Entity} from '../entity/index.ts';\nimport type {EntityInput, Data, Type} from '../entity/index.ts';\nimport type {Modifiers} from '../../modifiers/index.ts';\nimport type {DragDropManager} from '../../manager/index.ts';\nimport type {Sensors} from '../../sensors/sensor.ts';\n\n/**\n * Input configuration for creating a draggable entity.\n *\n * @template T - The type of data associated with the draggable\n *\n * @remarks\n * Extends the base entity input with draggable-specific configuration:\n * - Type for categorization\n * - Sensors for handling drag interactions\n * - Modifiers for transforming drag behavior\n * - Alignment for positioning\n */\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n type?: Type;\n sensors?: Sensors;\n modifiers?: Modifiers;\n alignment?: Alignment;\n}\n\n/**\n * Possible status values for a draggable entity.\n *\n * @remarks\n * - idle: Not being dragged\n * - dragging: Currently being dragged\n * - dropping: Currently being dropped\n */\nexport type DraggableStatus = 'idle' | 'dragging' | 'dropping';\n\n/**\n * Represents an entity that can be dragged in a drag and drop operation.\n *\n * @template T - The type of data associated with the draggable\n * @template U - The type of drag and drop manager\n *\n * @remarks\n * This class extends the base Entity class with draggable-specific functionality:\n * - Type-based categorization\n * - Sensor-based interaction handling\n * - Modifier-based behavior transformation\n * - Status tracking during drag operations\n */\nexport class Draggable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T, U> {\n constructor(\n {modifiers, type, sensors, ...input}: Input<T>,\n manager: U | undefined\n ) {\n super(input, manager);\n\n this.type = type;\n this.sensors = sensors;\n this.modifiers = modifiers;\n this.alignment = input.alignment;\n }\n\n /** The type of the draggable entity */\n @reactive\n public accessor type: Type | undefined;\n\n /** The sensors associated with the draggable entity */\n public sensors: Sensors | undefined;\n\n /** The modifiers associated with the draggable entity */\n @reactive\n public accessor modifiers: Modifiers | undefined;\n\n /** The alignment of the draggable entity */\n public alignment: Alignment | undefined;\n\n /** The current status of the draggable entity */\n @reactive\n public accessor status: DraggableStatus = this.isDragSource\n ? 'dragging'\n : 'idle';\n\n /**\n * Checks if the draggable entity is currently being dropped.\n *\n * @returns true if the entity is being dropped and is the drag source\n */\n @derived\n public get isDropping() {\n return this.status === 'dropping' && this.isDragSource;\n }\n\n /**\n * Checks if the draggable entity is currently being dragged.\n *\n * @returns true if the entity is being dragged and is the drag source\n */\n @derived\n public get isDragging() {\n return this.status === 'dragging' && this.isDragSource;\n }\n\n /**\n * Checks if the draggable entity is the source of the current drag operation.\n *\n * @returns true if the entity's ID matches the current drag operation's source ID\n */\n @derived\n public get isDragSource() {\n return this.manager?.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.ts';\nimport type {EntityInput, Data, Type} from '../entity/index.ts';\nimport {\n CollisionPriority,\n type CollisionDetector,\n} from '../../collision/index.ts';\nimport type {DragDropManager} from '../../manager/index.ts';\nimport {Draggable} from '../draggable/draggable.ts';\n\n/**\n * Input configuration for creating a droppable entity.\n *\n * @template T - The type of data associated with the droppable\n *\n * @remarks\n * Extends the base entity input with droppable-specific configuration:\n * - Accept rules for determining compatible draggables\n * - Collision detection configuration\n * - Type for categorization\n */\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n /** Types of draggables that can be dropped here, or a function to determine compatibility */\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n /** Priority for collision detection */\n collisionPriority?: CollisionPriority | number;\n /** Detector for determining collisions with draggables */\n collisionDetector: CollisionDetector;\n /** Type for categorization */\n type?: Type;\n}\n\n/**\n * Represents an entity that can receive draggable items in a drag and drop operation.\n *\n * @template T - The type of data associated with the droppable\n * @template U - The type of drag and drop manager\n *\n * @remarks\n * This class extends the base Entity class with droppable-specific functionality:\n * - Type-based acceptance rules\n * - Collision detection\n * - Shape tracking\n * - Target status tracking\n */\nexport class Droppable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T, U> {\n constructor(\n {accept, collisionDetector, collisionPriority, type, ...input}: Input<T>,\n manager: U | undefined\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 * Types of draggables that can be dropped here, or a function to determine compatibility.\n *\n * @remarks\n * If undefined, all draggables are accepted.\n * If a function, it determines compatibility based on the draggable.\n * If a type or array of types, only draggables of matching types are accepted.\n */\n @reactive\n public accessor accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /** The type of the droppable entity */\n @reactive\n public accessor type: Type | undefined;\n\n /**\n * Checks whether or not the droppable accepts a given draggable.\n *\n * @param draggable - The draggable to check\n * @returns true if the draggable can be dropped here\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\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 return draggable.type === accept;\n }\n\n /** The collision detector for this droppable */\n @reactive\n public accessor collisionDetector: CollisionDetector;\n\n /** The collision priority for this droppable */\n @reactive\n public accessor collisionPriority: CollisionPriority | number | undefined;\n\n /** The current shape of this droppable */\n @reactive\n public accessor shape: Shape | undefined;\n\n /**\n * Checks if this droppable is the current drop target.\n *\n * @returns true if this droppable's ID matches the current drag operation's target ID\n */\n @derived\n public get isDropTarget() {\n return this.manager?.dragOperation.target?.id === this.id;\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport {\n Plugin,\n type PluginConstructor,\n type PluginDescriptor,\n type PluginOptions,\n} from '../plugins/index.ts';\n\n/**\n * Options that can be passed to a sensor.\n * Extends the base PluginOptions type.\n */\nexport type SensorOptions = PluginOptions;\n\n/**\n * Abstract base class for all sensor implementations.\n *\n * @template T - The type of drag drop manager\n * @template U - The type of sensor options\n *\n * @remarks\n * Sensors are responsible for detecting and initiating drag operations.\n * They handle the actual user interaction (mouse, touch, keyboard, etc.)\n * and translate those interactions into drag operations.\n */\nexport abstract class Sensor<\n T extends DragDropManager<any, any> = DragDropManager<Draggable, Droppable>,\n U extends SensorOptions = SensorOptions,\n> extends Plugin<T, U> {\n /**\n * Creates a new sensor instance.\n *\n * @param manager - The drag drop manager instance\n * @param options - Optional sensor configuration\n */\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Binds the sensor to a draggable source.\n *\n * @param source - The draggable element to bind to\n * @param options - Optional sensor options specific to this draggable\n * @returns A cleanup function to unbind the sensor\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\n/**\n * Constructor type for creating sensor instances.\n *\n * @template T - The type of drag drop manager\n */\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\n/**\n * Descriptor type for configuring sensors.\n *\n * @template T - The type of drag drop manager\n */\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\n/**\n * Array type for multiple sensor configurations.\n *\n * @template T - The type of drag drop manager\n */\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","export class ActivationController<E extends Event> extends AbortController {\n public activated = false;\n\n constructor(\n private constraints: ActivationConstraints<E> | undefined,\n private onActivate: (event: E) => void\n ) {\n super();\n\n for (const constraint of constraints ?? []) {\n constraint.controller = this;\n }\n }\n\n onEvent(event: E) {\n if (this.activated) return;\n\n if (this.constraints?.length) {\n for (const constraint of this.constraints) {\n constraint.onEvent(event);\n }\n } else {\n this.activate(event);\n }\n }\n\n activate(event: E) {\n if (this.activated) return;\n this.activated = true;\n this.onActivate(event);\n }\n\n abort(event?: E) {\n this.activated = false;\n\n super.abort(event);\n }\n}\n\nexport interface ActivationConstraintOptions {}\n\nexport abstract class ActivationConstraint<\n E extends Event = Event,\n O extends ActivationConstraintOptions = ActivationConstraintOptions,\n> {\n #controller: ActivationController<E> | undefined;\n\n set controller(controller: ActivationController<E>) {\n this.#controller = controller;\n\n controller.signal.addEventListener('abort', () => this.abort());\n }\n\n constructor(protected options: O) {}\n\n /**\n * Called when the activation is triggered.\n */\n public activate(event: E): void {\n this.#controller?.activate(event);\n }\n\n /**\n * Called when the activation is aborted.\n */\n public abstract abort(event?: E): void;\n\n /**\n * Called when an input event is received by the sensor.\n * Returns `true` if this event triggers activation immediately.\n */\n public abstract onEvent(event: E): void;\n}\n\nexport type ActivationConstraints<E extends Event> = ActivationConstraint<E>[];\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.ts';\nimport type {DragDropManager} from '../manager/manager.ts';\nimport type {DragOperationSnapshot} from '../manager/operation.ts';\n\n/** Options that can be passed to a modifier */\nexport type ModifierOptions = PluginOptions;\n\n/**\n * Base class for drag operation modifiers.\n *\n * @template T - The type of drag and drop manager\n * @template U - The type of modifier options\n *\n * @remarks\n * Modifiers can transform the coordinates of a drag operation,\n * enabling features like snapping, constraints, and custom behaviors.\n */\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n /**\n * Creates a new modifier instance.\n *\n * @param manager - The drag and drop manager that owns this modifier\n * @param options - Optional configuration for the modifier\n */\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Applies the modifier to the current drag operation.\n *\n * @param operation - The current state of the drag operation\n * @returns The transformed coordinates\n *\n * @remarks\n * Override this method to implement custom transformation logic.\n * The default implementation returns the original transform unchanged.\n */\n public apply(operation: DragOperationSnapshot<any, any>): Coordinates {\n return operation.transform;\n }\n}\n\n/**\n * Constructor type for modifiers.\n *\n * @template T - The type of drag and drop manager\n */\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\n/**\n * Descriptor type for modifiers.\n *\n * @template T - The type of drag and drop manager\n */\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\n/**\n * Array type for modifier constructors or descriptors.\n *\n * @template T - The type of drag and drop manager\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.ts';\nimport {\n PluginRegistry,\n Plugin,\n type PluginConstructor,\n PluginOptions,\n} from '../plugins/index.ts';\nimport {\n Sensor,\n SensorOptions,\n type SensorConstructor,\n} from '../sensors/index.ts';\nimport {Modifier, type ModifierConstructor} from '../modifiers/index.ts';\nimport type {DragDropManager} from './manager.ts';\n\n/**\n * Manages the registration and lifecycle of draggable and droppable entities,\n * as well as plugins, sensors, and modifiers.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n * @template V - The type of drag and drop manager\n */\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n /**\n * Creates a new registry instance.\n *\n * @param manager - The drag and drop manager that owns this registry\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 /** Registry for draggable entities */\n public draggables = new EntityRegistry<T>();\n\n /** Registry for droppable entities */\n public droppables = new EntityRegistry<U>();\n\n /** Registry for plugins */\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n\n /** Registry for sensors */\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n\n /** Registry for modifiers */\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n /**\n * Registers a new entity, plugin, sensor, or modifier.\n *\n * @param input - The entity, plugin constructor, sensor constructor, or modifier constructor to register\n * @param options - Optional configuration for plugins and sensors\n * @returns A cleanup function or the registered instance\n * @throws {Error} If the input type is invalid\n */\n public register(input: Entity): () => void;\n public register(input: Draggable): () => void;\n public register(input: Droppable): () => void;\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 /**\n * Unregisters an entity, plugin, sensor, or modifier.\n *\n * @param input - The entity, plugin constructor, sensor constructor, or modifier constructor to unregister\n * @returns A cleanup function\n * @throws {Error} If the input type is invalid\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 /**\n * Destroys all registered entities and cleans up resources.\n *\n * @remarks\n * This method:\n * - Destroys all draggable and droppable entities\n * - Destroys all plugins, sensors, and modifiers\n * - Cleans up any associated resources\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 {\n batch,\n derived,\n reactive,\n snapshot,\n untracked,\n ValueHistory,\n type WithHistory,\n} from '@dnd-kit/state';\n\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\nimport type {Modifier} from '../modifiers/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {Status, StatusValue} from './status.ts';\n\nexport interface DragOperationSnapshot<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n readonly activatorEvent: Event | null;\n readonly canceled: boolean;\n readonly position: Position;\n readonly transform: Coordinates;\n readonly status: Status;\n get shape(): WithHistory<Shape> | null;\n set shape(value: Shape | null);\n readonly source: T | null;\n readonly target: U | null;\n}\n\n/**\n * Represents the current state of a drag operation.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n */\nexport class DragOperation<T extends Draggable, U extends Droppable>\n implements DragOperationSnapshot<T, U>\n{\n /**\n * Creates a new drag operation instance.\n *\n * @param manager - The drag and drop manager that owns this operation\n */\n constructor(manager: DragDropManager<T, U>) {\n this.#manager = manager;\n }\n\n #manager: DragDropManager<T, U>;\n\n #previousSource?: T;\n\n #shape = new ValueHistory<Shape | undefined>(undefined, (a, b) =>\n a && b ? a.equals(b) : a === b\n );\n\n /** Current status of the drag operation */\n public readonly status = new Status();\n\n /** The controller for the currentdrag operation */\n public controller: AbortController | undefined;\n\n /**\n * Gets the current shape of the dragged entity with history.\n *\n * @returns The shape history or null if no shape is set\n */\n @derived\n public get shape(): WithHistory<Shape> | null {\n const {current, initial, previous} = this.#shape;\n\n if (!current || !initial) {\n return null;\n }\n\n return {current, initial, previous};\n }\n\n /**\n * Sets the shape of the dragged entity.\n *\n * @param value - The new shape or null to reset\n */\n public set shape(value: Shape | null) {\n if (!value) {\n this.#shape.reset();\n } else {\n this.#shape.current = value;\n }\n }\n\n /** Whether the drag operation was canceled */\n @reactive\n public accessor canceled = false;\n\n /** The event that initiated the drag operation */\n @reactive\n public accessor activatorEvent: Event | null = null;\n\n /** Unique identifier of the source draggable entity */\n @reactive\n public accessor sourceIdentifier: UniqueIdentifier | null = null;\n\n /** Unique identifier of the target droppable entity */\n @reactive\n public accessor targetIdentifier: UniqueIdentifier | null = null;\n\n /** List of modifiers applied to the drag operation */\n @reactive\n public accessor modifiers: Modifier[] = [];\n\n /** Current position of the dragged entity */\n public position = new Position({x: 0, y: 0});\n\n /**\n * Gets the source draggable entity.\n *\n * @returns The current draggable entity or the previous one if the current is not found\n */\n @derived\n public get source(): T | null {\n const identifier = this.sourceIdentifier;\n if (identifier == null) return null;\n\n const value = this.#manager.registry.draggables.get(identifier);\n\n if (value) {\n this.#previousSource = value;\n }\n\n return value ?? this.#previousSource ?? null;\n }\n\n /**\n * Gets the target droppable entity.\n *\n * @returns The current droppable entity or null if not found\n */\n @derived\n public get target(): U | null {\n const identifier = this.targetIdentifier;\n return identifier != null\n ? (this.#manager.registry.droppables.get(identifier) ?? null)\n : null;\n }\n\n #transform = {x: 0, y: 0};\n\n /**\n * Gets the current transform after applying all modifiers.\n *\n * @returns The transformed coordinates\n */\n @derived\n public get transform() {\n const {x, y} = this.position.delta;\n let transform = {x, y};\n\n for (const modifier of this.modifiers) {\n transform = modifier.apply({\n ...this.snapshot(),\n transform,\n });\n }\n\n this.#transform = transform;\n\n return transform;\n }\n\n /**\n * Creates a snapshot of the current drag operation state.\n *\n * @returns An immutable snapshot of the current operation state\n */\n public snapshot(): DragOperationSnapshot<T, U> {\n return untracked(() => ({\n source: this.source,\n target: this.target,\n activatorEvent: this.activatorEvent,\n transform: this.#transform,\n shape: this.shape ? snapshot(this.shape) : null,\n position: snapshot(this.position),\n status: snapshot(this.status),\n canceled: this.canceled,\n }));\n }\n\n /**\n * Resets the drag operation to its initial state.\n *\n * @remarks\n * This method:\n * - Sets status to idle\n * - Clears source and target identifiers\n * - Resets shape history\n * - Resets position and transform\n * - Clears modifiers\n */\n public reset() {\n batch(() => {\n this.status.set(StatusValue.Idle);\n this.sourceIdentifier = null;\n this.targetIdentifier = null;\n this.#shape.reset();\n this.position.reset({x: 0, y: 0});\n this.#transform = {x: 0, y: 0};\n this.modifiers = [];\n });\n }\n}\n","/**\n * Interface for handling visual feedback during drag operations.\n *\n * @remarks\n * Implementations of this interface are responsible for managing\n * the visual state of dragged elements and ensuring smooth animations.\n */\nexport interface Renderer {\n /**\n * Gets a promise that resolves when the current rendering operation is complete.\n *\n * @returns A promise that resolves when rendering is finished\n */\n get rendering(): Promise<void>;\n}\n\n/**\n * Default renderer implementation.\n *\n * @remarks\n * This implementation immediately resolves rendering promises,\n * making it suitable for environments where custom rendering\n * is not required or handled externally.\n */\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import {effects, untracked} from '@dnd-kit/state';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport {CollisionObserver, CollisionNotifier} from '../collision/index.ts';\nimport type {Plugins, Plugin} from '../plugins/index.ts';\nimport type {Sensor, Sensors} from '../sensors/index.ts';\nimport type {Modifier, Modifiers} from '../modifiers/index.ts';\nimport {descriptor} from '../plugins/utilities.ts';\n\nimport {DragActions} from './actions.ts';\nimport {DragDropRegistry} from './registry.ts';\nimport {DragOperation} from './operation.ts';\nimport {DragDropMonitor} from './events.ts';\nimport {defaultRenderer, type Renderer} from './renderer.ts';\n\n/**\n * A value that can be provided as-is or as a function that receives defaults.\n *\n * @example\n * // As a plain array (replaces defaults)\n * plugins: [MyPlugin]\n *\n * // As a function (receives defaults)\n * plugins: (defaults) => [...defaults, MyPlugin]\n */\nexport type Customizable<T> = T | ((defaults: T) => T);\n\n/**\n * Resolves a customizable value by applying it to defaults.\n *\n * @param value - A value or function that receives defaults\n * @param defaults - The default value to use when undefined, or to pass to a function\n * @returns The resolved value\n */\nexport function resolveCustomizable<T>(\n value: Customizable<T> | undefined,\n defaults: T\n): T {\n if (typeof value === 'function') {\n return (value as (defaults: T) => T)(defaults);\n }\n\n return value ?? defaults;\n}\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = {\n plugins?: Customizable<Plugins<T>>;\n sensors?: Customizable<Sensors<T>>;\n modifiers?: Customizable<Modifiers<T>>;\n renderer?: Renderer;\n};\n\n/**\n * Central manager class that orchestrates drag and drop operations.\n *\n * @template T - The type of draggable entities\n * @template U - The type of droppable entities\n */\nexport class DragDropManager<T extends Draggable, U extends Droppable> {\n /** Actions that can be performed during drag operations */\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n\n /** Observes and manages collision detection between draggable and droppable entities */\n public collisionObserver: CollisionObserver<T, U>;\n\n /** Tracks the current drag operation state and metadata */\n public dragOperation: DragOperation<T, U>;\n\n /** Monitors and emits drag and drop events */\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n\n /** Registry that manages draggable and droppable entities */\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n\n /** Handles rendering of drag and drop visual feedback */\n public renderer: Renderer;\n\n /**\n * Creates a new drag and drop manager instance.\n *\n * @param config - Optional configuration for plugins, sensors, modifiers, and renderer\n */\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const raw = config ?? {};\n const plugins = resolveCustomizable(raw.plugins, []);\n const sensors = resolveCustomizable(raw.sensors, []);\n const modifiers = resolveCustomizable(raw.modifiers, []);\n const renderer = raw.renderer ?? defaultRenderer;\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 this.actions = new DragActions<T, U, V>(this);\n this.dragOperation = new DragOperation<T, U>(this);\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n\n const {destroy} = this;\n\n const cleanup = effects(() => {\n const currentModifiers = untracked(() => this.dragOperation.modifiers);\n const managerModifiers = this.modifiers;\n\n for (const modifier of currentModifiers) {\n if (!managerModifiers.includes(modifier)) {\n modifier.destroy();\n }\n }\n\n this.dragOperation.modifiers =\n this.dragOperation.source?.modifiers?.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n return new plugin(this, options);\n }) ?? managerModifiers;\n });\n\n this.destroy = () => {\n cleanup();\n destroy();\n };\n }\n\n /**\n * Gets the list of active plugins.\n *\n * @returns Array of active plugin instances\n */\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n /**\n * Sets the list of plugins to be used by the manager.\n *\n * @param plugins - Array of plugin constructors or instances\n */\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n /**\n * Gets the list of active modifiers.\n *\n * @returns Array of active modifier instances\n */\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n /**\n * Sets the list of modifiers to be used by the manager.\n *\n * @param modifiers - Array of modifier constructors or instances\n */\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n /**\n * Gets the list of active sensors.\n *\n * @returns Array of active sensor instances\n */\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n /**\n * Sets the list of sensors to be used by the manager.\n *\n * @param sensors - Array of sensor constructors or instances\n */\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n /**\n * Cleans up resources and stops any active drag operations.\n */\n public destroy = () => {\n if (!this.dragOperation.status.idle) {\n this.actions.stop({canceled: true});\n }\n\n this.dragOperation.modifiers.forEach((modifier) => modifier.destroy());\n\n this.registry.destroy();\n this.collisionObserver.destroy();\n };\n}\n"]}