@dnd-kit/abstract 0.0.5 → 0.0.6-beta-20240714162912
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.cjs +12 -12
- package/index.cjs.map +1 -1
- package/index.d.cts +8 -2
- package/index.d.ts +8 -2
- package/index.js +12 -13
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -224,7 +224,10 @@ _previousValues = new WeakMap();
|
|
|
224
224
|
// src/core/collision/utilities.ts
|
|
225
225
|
function sortCollisions(a, b) {
|
|
226
226
|
if (a.priority === b.priority) {
|
|
227
|
-
|
|
227
|
+
if (a.type === b.type) {
|
|
228
|
+
return b.value - a.value;
|
|
229
|
+
}
|
|
230
|
+
return b.type - a.type;
|
|
228
231
|
}
|
|
229
232
|
return b.priority - a.priority;
|
|
230
233
|
}
|
|
@@ -398,6 +401,12 @@ var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
|
|
398
401
|
CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
|
|
399
402
|
return CollisionPriority2;
|
|
400
403
|
})(CollisionPriority || {});
|
|
404
|
+
var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
|
405
|
+
CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
|
|
406
|
+
CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
|
|
407
|
+
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
|
408
|
+
return CollisionType2;
|
|
409
|
+
})(CollisionType || {});
|
|
401
410
|
var _disabled_dec2, _data_dec, _id_dec, _manager_dec, _init2, _manager, _id, _data, _disabled2;
|
|
402
411
|
_manager_dec = [state.reactive], _id_dec = [state.reactive], _data_dec = [state.reactive], _disabled_dec2 = [state.reactive];
|
|
403
412
|
var Entity = class {
|
|
@@ -583,17 +592,7 @@ __decoratorMetadata(_init3, Draggable);
|
|
|
583
592
|
var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2, _init4, _accept, _type2, _collisionDetector, _collisionPriority, _shape;
|
|
584
593
|
var Droppable = class extends (_c2 = Entity, _accept_dec = [state.reactive], _type_dec2 = [state.reactive], _collisionDetector_dec = [state.reactive], _collisionPriority_dec = [state.reactive], _shape_dec = [state.reactive], _isDropTarget_dec = [state.derived], _c2) {
|
|
585
594
|
constructor(_a, manager) {
|
|
586
|
-
var _b = _a, {
|
|
587
|
-
accept,
|
|
588
|
-
collisionDetector,
|
|
589
|
-
collisionPriority = 2 /* Normal */,
|
|
590
|
-
type
|
|
591
|
-
} = _b, input = __objRest(_b, [
|
|
592
|
-
"accept",
|
|
593
|
-
"collisionDetector",
|
|
594
|
-
"collisionPriority",
|
|
595
|
-
"type"
|
|
596
|
-
]);
|
|
595
|
+
var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
|
597
596
|
super(input, manager);
|
|
598
597
|
__runInitializers(_init4, 5, this);
|
|
599
598
|
__privateAdd(this, _accept, __runInitializers(_init4, 8, this)), __runInitializers(_init4, 11, this);
|
|
@@ -1058,6 +1057,7 @@ var DragDropManager = class {
|
|
|
1058
1057
|
};
|
|
1059
1058
|
|
|
1060
1059
|
exports.CollisionPriority = CollisionPriority;
|
|
1060
|
+
exports.CollisionType = CollisionType;
|
|
1061
1061
|
exports.CorePlugin = CorePlugin;
|
|
1062
1062
|
exports.DragDropManager = DragDropManager;
|
|
1063
1063
|
exports.DragOperationStatus = Status;
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["src/core/collision/observer.ts","src/core/plugins/plugin.ts","src/core/plugins/utilities.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/notifier.ts","src/core/manager/events.ts","src/core/collision/types.ts","src/core/entities/entity/entity.ts","src/core/entities/entity/registry.ts","src/core/entities/draggable/draggable.ts","src/core/entities/droppable/droppable.ts","src/core/sensors/sensor.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/dragOperation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["untracked","effect","CollisionPriority","reactive","_disabled_dec","_init","_disabled","effects","manager","signal","derived","_type_dec","_c","_type","batch","computed","Status","transform","operation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAA;AAAA,EAEA;AAAA,OACK;;;ACRP,SAAQ,UAAU,iBAAgB;;;ACO3B,SAAS,UAGd,QAAW,SAA2C;AACtD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,aACd,QACA;AACA,SAAO,CAAC,YAAkE;AACxE,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AAEO,SAAS,WACd,QAC+B;AAC/B,MAAI,OAAO,WAAW,YAAY;AAChC,WAAO;AAAA,MACL;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AACT;;;ADpCA;AAuBE,iBAAC;AAbI,IAAe,SAAf,MAGL;AAAA,EACA,YACS,SACA,SACP;AAFO;AACA;AAQT,uBAAgB,WAAoB,kBAApC,gBAAoC,SAApC;AAAA,EAPG;AAAA;AAAA;AAAA;AAAA;AAAA,EAaI,SAAS;AACd,SAAK,WAAW;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAU;AACf,SAAK,WAAW;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,aAAa;AAClB,WAAO,UAAU,MAAM;AACrB,aAAO,KAAK;AAAA,IACd,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKO,UAAU,SAAa;AAC5B,SAAK,UAAU;AAAA,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,UAAM,WAAW,IAAI,iBAA0B,IAAI;AAEnD,SAAK,WAAW;AAChB,SAAK,UAAU;AACf,SAAK,WAAW;AAEhB,UAAM,EAAC,SAAS,UAAS,IAAI,qBAA8B,IAAI;AAE/D,SAAK,UAAU;AACf,SAAK,gBAAgB;AACrB,SAAK,oBAAoB,IAAI,kBAA2B,IAAI;AAC5D,SAAK,UAAU,CAAC,mBAAmB,GAAG,OAAO;AAC7C,SAAK,YAAY;AACjB,SAAK,UAAU;AACf,SAAK,UAAU,KAAK,QAAQ,KAAK,IAAI;AAAA,EACvC;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEA,IAAI,YAA6B;AAC/B,WAAO,KAAK,SAAS,UAAU;AAAA,EACjC;AAAA,EAEA,IAAI,UAAU,WAA2B;AACvC,SAAK,SAAS,UAAU,SAAS;AAAA,EACnC;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEO,UAAU;AACf,SAAK,SAAS,QAAQ;AACtB,SAAK,kBAAkB,QAAQ;AAAA,EACjC;AACF","sourcesContent":["import {\n batch,\n computed,\n deepEqual,\n signal,\n untracked,\n type ReadonlySignal,\n effect,\n} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport class CollisionObserver<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> extends Plugin<V> {\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = computed(this.computeCollisions, deepEqual);\n\n this.destroy = effect(() => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n });\n }\n\n forceUpdateCount = signal(0);\n\n public forceUpdate(refresh = true) {\n untracked(() => {\n const {source} = this.manager.dragOperation;\n\n batch(() => {\n if (refresh) {\n for (const droppable of this.manager.registry.droppables) {\n if (source && !droppable.accepts(source)) {\n continue;\n }\n\n droppable.refreshShape();\n }\n }\n\n this.forceUpdateCount.value++;\n });\n });\n }\n\n public computeCollisions(\n entries?: Droppable[],\n collisionDetector?: CollisionDetector\n ) {\n const {registry, dragOperation} = this.manager;\n const {source, shape, status} = dragOperation;\n\n if (!status.initialized || !shape) {\n return DEFAULT_VALUE;\n }\n\n const collisions: Collision[] = [];\n\n this.forceUpdateCount.value;\n\n for (const entry of entries ?? registry.droppables) {\n if (entry.disabled) {\n continue;\n }\n\n if (source && !entry.accepts(source)) {\n continue;\n }\n\n const detectCollision = collisionDetector ?? entry.collisionDetector;\n\n if (!detectCollision) {\n continue;\n }\n\n const collision = untracked(() =>\n detectCollision({\n droppable: entry,\n dragOperation,\n })\n );\n\n if (collision) {\n if (entry.collisionPriority != null) {\n collision.priority = entry.collisionPriority;\n }\n\n collisions.push(collision);\n }\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: ReadonlySignal<Collisions>;\n}\n","import {reactive, untracked} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {PluginOptions} from './types.ts';\nimport {configure} from './utilities.ts';\n\n/**\n * An abstract plugin class that can be extended to implement custom\n * functionality that augments the `DragDropManager`'s core capabilities.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n * Triggers effects when accessed.\n */\n @reactive\n public accessor disabled: boolean = false;\n\n /**\n * Enable a disabled plugin instance.\n * Triggers effects.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disable an enabled plugin instance.\n * Triggers effects.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Whether the plugin instance is disabled.\n * Does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configure a plugin instance with new options.\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n /**\n * Destroy a plugin instance.\n */\n public destroy() {\n /*\n * Each plugin is responsible for implementing its own\n * destroy method to clean up effects and listeners\n */\n }\n\n /**\n * Configure a plugin constructor with options.\n * This method is used to configure the options that the\n * plugin constructor will use to create plugin instances.\n */\n static configure(options: PluginOptions) {\n return configure(this as any, options);\n }\n}\n\nexport class CorePlugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> extends Plugin<T, U> {}\n","import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.ts';\n\nexport function configure<\n T extends PluginConstructor<any, any, any>,\n V extends PluginOptions = InferPluginOptions<T>,\n>(plugin: T, options: V): PluginDescriptor<any, any, T> {\n return {\n plugin,\n options,\n };\n}\n\nexport function configurator<T extends PluginConstructor<any, any, any>>(\n plugin: T\n) {\n return (options: InferPluginOptions<T>): PluginDescriptor<any, any, T> => {\n return configure(plugin, options);\n };\n}\n\nexport function descriptor<T extends PluginConstructor<any, any, any>>(\n plugin: T | PluginDescriptor<any, any, T>\n): PluginDescriptor<any, any, T> {\n if (typeof plugin === 'function') {\n return {\n plugin,\n options: undefined,\n };\n }\n\n return plugin;\n}\n","import {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin, type Plugin} from './plugin.ts';\nimport type {InferPluginOptions, PluginConstructor, Plugins} from './types.ts';\nimport {descriptor} from './utilities.ts';\n\nexport class PluginRegistry<\n T extends DragDropManager<any, any>,\n W extends PluginConstructor<T> = PluginConstructor<T>,\n U extends Plugin<T> = InstanceType<W>,\n> {\n private instances: Map<W, U> = new Map();\n\n constructor(private manager: T) {}\n\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n public set values(entries: Plugins<T>) {\n const descriptors = entries.map(descriptor);\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 public get<X extends W>(plugin: X): InstanceType<X> | undefined {\n const instance = this.instances.get(plugin);\n\n return instance as any;\n }\n\n public register<X extends W>(\n plugin: X,\n options?: InferPluginOptions<X>\n ): InstanceType<X> {\n const existingInstance = this.instances.get(plugin);\n\n if (existingInstance) {\n return existingInstance as InstanceType<X>;\n }\n\n const instance = new plugin(this.manager, options) as U;\n\n this.instances.set(plugin, instance);\n\n return instance as InstanceType<X>;\n }\n\n public unregister<X extends W>(plugin: X) {\n const instance = this.instances.get(plugin);\n\n if (instance) {\n instance.destroy();\n this.instances.delete(plugin);\n }\n }\n\n public destroy() {\n for (const plugin of this.instances.values()) {\n plugin.destroy();\n }\n\n this.instances.clear();\n }\n}\n","import {Collision} from './types.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 return b.value - a.value;\n }\n\n return b.priority - a.priority;\n}\n","import {effect, untracked} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin} from '../plugins/index.ts';\nimport {defaultPreventable} from '../manager/events.ts';\n\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager<any, any>) {\n super(manager);\n\n this.destroy = effect(() => {\n const {collisionObserver, monitor} = manager;\n const {collisions} = collisionObserver;\n\n if (collisionObserver.isDisabled()) {\n return;\n }\n\n const event = defaultPreventable({\n collisions,\n });\n\n monitor.dispatch('collision', event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const [firstCollision] = collisions;\n\n untracked(() => {\n if (firstCollision?.id !== manager.dragOperation.target?.id) {\n collisionObserver.disable();\n\n manager.actions.setDropTarget(firstCollision?.id).then(() => {\n collisionObserver.enable();\n });\n }\n });\n });\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport type {Collisions} from '../collision/index.ts';\nimport type {DragDropManager} from './manager.ts';\nimport type {DragOperation} from './dragOperation.ts';\n\nexport type Events = Record<string, (...args: any[]) => void>;\n\nexport type Preventable<T> = T & {\n cancelable: boolean;\n defaultPrevented: boolean;\n preventDefault(): void;\n};\n\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n public addEventListener<U extends keyof T>(name: U, handler: T[U]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.add(handler);\n registry.set(name, listeners);\n\n return () => this.removeEventListener(name, handler);\n }\n\n public removeEventListener(name: keyof T, handler: T[keyof T]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.delete(handler);\n registry.set(name, listeners);\n }\n\n protected dispatch<U extends keyof T>(name: U, ...args: any[]) {\n const {registry} = this;\n const listeners = registry.get(name);\n\n if (!listeners) {\n return;\n }\n\n for (const listener of listeners) {\n listener(...args);\n }\n }\n}\n\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n beforedragstart(\n event: Preventable<{operation: DragOperation<T, U>}>,\n manager: V\n ): void;\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperation<T, U>;\n },\n manager: V\n ): void;\n dragmove(\n event: Preventable<{\n operation: DragOperation<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n }>,\n manager: V\n ): void;\n dragover(\n event: Preventable<{\n operation: DragOperation<T, U>;\n }>,\n manager: V\n ): void;\n dragend(\n event: {\n operation: DragOperation<T, U>;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport class DragDropMonitor<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> extends Monitor<DragDropEvents<T, U, V>> {\n constructor(private manager: V) {\n super();\n }\n\n public dispatch<Key extends keyof DragDropEvents<T, U, V>>(\n type: Key,\n event: Parameters<DragDropEvents<T, U, V>[Key]>[0]\n ) {\n const args = [event, this.manager] as any;\n\n super.dispatch(type, ...args);\n }\n}\n\nexport function defaultPreventable<T>(\n event: T,\n cancelable = true\n): Preventable<T> {\n let defaultPrevented = false;\n\n return {\n ...event,\n cancelable,\n get defaultPrevented() {\n return defaultPrevented;\n },\n preventDefault() {\n if (!cancelable) {\n return;\n }\n\n defaultPrevented = true;\n },\n };\n}\n","import type {DragOperation} from '../manager/index.ts';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\nexport enum CollisionPriority {\n Lowest,\n Low,\n Normal,\n High,\n Highest,\n}\n\nexport interface Collision {\n id: UniqueIdentifier;\n priority: CollisionPriority | number;\n value: number;\n}\n\nexport type Collisions = Collision[];\n\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n droppable: U;\n dragOperation: DragOperation<T, U>;\n}\n\nexport type CollisionDetector = <\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n>(\n input: CollisionDetectorInput<T, U>\n) => Collision | null;\n","import {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 id: UniqueIdentifier;\n data?: T;\n disabled?: boolean;\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} = 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 this.destroy = this.destroy.bind(this);\n\n if (manager) {\n queueMicrotask(() => {\n this.manager?.registry.register(this);\n });\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\n if (current.get(key) === value) {\n return;\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n const cleanup = effects(...value.effects());\n this.cleanupFunctions.set(value, cleanup);\n\n return () => this.unregister(key, value);\n };\n\n /**\n * Unregisters an entity from the registry.\n * @param key - The unique identifier of the entity.\n * @param value - The entity instance to unregister.\n */\n public unregister = (key: UniqueIdentifier, value: T) => {\n const current = this.map.peek();\n\n if (current.get(key) !== value) {\n return;\n }\n\n const 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';\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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n type?: Type;\n modifiers?: Modifiers;\n sensors?: Sensors;\n}\n\nexport type DraggableStatus = 'idle' | 'dragging' | 'dropping';\n\nexport class Draggable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\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 }\n\n public sensors: Sensors | undefined;\n\n @reactive\n public accessor modifiers: Modifiers | undefined;\n\n @reactive\n public accessor type: Type | undefined;\n\n @reactive\n public accessor status: DraggableStatus = 'idle';\n\n /**\n * A boolean indicating whether the draggable item is the source of a drag operation.\n */\n @derived\n public get isDragSource() {\n 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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n collisionPriority?: CollisionPriority | number;\n collisionDetector: CollisionDetector;\n type?: Type;\n}\n\nexport class Droppable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\n constructor(\n {\n accept,\n collisionDetector,\n collisionPriority = CollisionPriority.Normal,\n type,\n ...input\n }: 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 * An array of types that are compatible with the droppable.\n */\n @reactive\n public accessor accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /**\n * The type of the droppable.\n */\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} draggable\n * @returns {boolean}\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (!draggable.type) {\n return false;\n }\n\n if (Array.isArray(accept)) {\n return accept.includes(draggable.type);\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\n }\n\n return draggable.type === accept;\n }\n\n @reactive\n public accessor collisionDetector: CollisionDetector;\n\n @reactive\n public accessor collisionPriority: number;\n\n @reactive\n public accessor shape: Shape | undefined;\n\n @derived\n public get isDropTarget() {\n return this.manager?.dragOperation.target?.id === this.id;\n }\n\n public refreshShape() {\n // To be implemented by subclasses\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport type SensorOptions = PluginOptions;\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 constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Bind the sensor to a draggable source, and optionally pass\n * in sensor options to override the default sensor options\n * for this draggable source only.\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport {\n Plugin,\n type PluginOptions,\n type PluginConstructor,\n type PluginDescriptor,\n} from '../plugins/index.ts';\nimport type {DragDropManager} from '../manager/index.ts';\n\nexport type ModifierOptions = PluginOptions;\n\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n public apply(operation: T['dragOperation']): Coordinates {\n return operation.transform;\n }\n}\n\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\nexport type Modifiers<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (ModifierConstructor<T> | ModifierDescriptor<T>)[];\n","import type {CleanupFunction} from '@dnd-kit/state';\n\nimport {\n Draggable,\n Droppable,\n Entity,\n EntityRegistry,\n} from '../entities/index.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\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n constructor(manager: V) {\n this.plugins = new PluginRegistry<V, PluginConstructor<V>>(manager);\n this.sensors = new PluginRegistry<V, SensorConstructor<V>>(manager);\n this.modifiers = new PluginRegistry<V, ModifierConstructor<V>>(manager);\n }\n\n public draggables = new EntityRegistry<T>();\n public droppables = new EntityRegistry<U>();\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n public register(input: Entity): () => 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 public unregister(input: Entity): CleanupFunction;\n public unregister(input: Draggable): CleanupFunction;\n public unregister(input: Droppable): CleanupFunction;\n public unregister(input: SensorConstructor): CleanupFunction;\n public unregister(input: ModifierConstructor): CleanupFunction;\n public unregister(input: PluginConstructor): CleanupFunction;\n public unregister(input: any) {\n if (input instanceof Entity) {\n if (input instanceof Draggable) {\n return this.draggables.unregister(input.id, input as T);\n }\n\n if (input instanceof Droppable) {\n return this.droppables.unregister(input.id, input as U);\n }\n\n // no-op\n return () => {};\n }\n\n if (input.prototype instanceof Modifier) {\n return this.modifiers.unregister(input);\n }\n\n if (input.prototype instanceof Sensor) {\n return this.sensors.unregister(input);\n }\n\n if (input.prototype instanceof Plugin) {\n return this.plugins.unregister(input);\n }\n\n throw new Error('Invalid instance type');\n }\n\n destroy() {\n this.draggables.destroy();\n this.droppables.destroy();\n this.plugins.destroy();\n this.sensors.destroy();\n this.modifiers.destroy();\n }\n}\n","import {Position, type Shape} from '@dnd-kit/geometry';\nimport type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, computed, effect, signal} 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';\nimport {descriptor} from '../plugins/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {defaultPreventable} from './events.ts';\n\nexport enum Status {\n Idle = 'idle',\n Initializing = 'initializing',\n Dragging = 'dragging',\n Dropped = 'dropped',\n}\n\nexport type Serializable = {\n [key: string]: string | number | null | Serializable | Serializable[];\n};\n\nexport interface DragOperation<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n activatorEvent: Event | null;\n canceled: boolean;\n position: Position;\n transform: Coordinates;\n status: {\n current: Status;\n initialized: boolean;\n initializing: boolean;\n dragging: boolean;\n dragended: boolean;\n dropped: boolean;\n idle: boolean;\n };\n get shape(): {\n initial: Shape;\n current: Shape;\n } | null;\n set shape(value: Shape | null);\n source: T | null;\n target: U | null;\n data?: Serializable;\n}\n\nexport type DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = ReturnType<typeof DragOperationManager<T, U, V>>['actions'];\n\nexport function DragOperationManager<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n>(manager: V) {\n const {\n registry: {draggables, droppables},\n monitor,\n } = manager;\n const status = signal<Status>(Status.Idle);\n const shape = {\n initial: signal<Shape | null>(null),\n current: signal<Shape | null>(null),\n };\n const canceled = signal<boolean>(false);\n const position = new Position({x: 0, y: 0});\n const activatorEvent = signal<Event | null>(null);\n const sourceIdentifier = signal<UniqueIdentifier | null>(null);\n const targetIdentifier = signal<UniqueIdentifier | null>(null);\n const dragging = computed(() => status.value === Status.Dragging);\n const initialized = computed(() => status.value !== Status.Idle);\n const initializing = computed(() => status.value === Status.Initializing);\n const idle = computed(() => status.value === Status.Idle);\n const dropped = computed(() => status.value === Status.Dropped);\n const dragended = signal<boolean>(true);\n let previousSource: T | undefined;\n const source = computed<T | null>(() => {\n const identifier = sourceIdentifier.value;\n\n if (identifier == null) return null;\n\n const value = draggables.get(identifier);\n\n if (value) {\n // It's possible for the source to unmount during the drag operation\n previousSource = value;\n }\n\n return value ?? previousSource ?? null;\n });\n const target = computed<U | null>(() => {\n const identifier = targetIdentifier.value;\n return identifier != null ? droppables.get(identifier) ?? null : null;\n });\n\n const modifiers = signal<Modifier[]>([]);\n\n effect(() => {\n const currentModifiers = modifiers.peek();\n\n if (currentModifiers !== manager.modifiers) {\n currentModifiers.forEach((modifier) => modifier.destroy());\n }\n\n modifiers.value =\n source.value?.modifiers?.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n return new plugin(manager, options);\n }) ?? manager.modifiers;\n });\n\n const transform = computed(() => {\n const {x, y} = position.delta;\n\n let transform = {x, y};\n const initialShape = shape.initial.peek();\n const currentShape = shape.current.peek();\n const operation: Omit<DragOperation<T, U>, 'transform'> = {\n activatorEvent: activatorEvent.peek(),\n canceled: canceled.peek(),\n source: source.peek(),\n target: target.peek(),\n status: {\n current: status.peek(),\n idle: idle.peek(),\n initializing: initializing.peek(),\n initialized: initialized.peek(),\n dragging: dragging.peek(),\n dragended: dragended.peek(),\n dropped: dropped.peek(),\n },\n shape:\n initialShape && currentShape\n ? {initial: initialShape, current: currentShape}\n : null,\n position,\n };\n\n for (const modifier of modifiers.value) {\n transform = modifier.apply({...operation, transform});\n }\n\n return transform;\n });\n\n const operation: DragOperation<T, U> = {\n get activatorEvent() {\n return activatorEvent.value;\n },\n get canceled() {\n return canceled.value;\n },\n get source() {\n return source.value;\n },\n get target() {\n return target.value;\n },\n status: {\n get current() {\n return status.value;\n },\n get idle() {\n return idle.value;\n },\n get initializing() {\n return initializing.value;\n },\n get initialized() {\n return initialized.value;\n },\n get dragging() {\n return dragging.value;\n },\n get dragended() {\n return dragended.value;\n },\n get dropped() {\n return dropped.value;\n },\n },\n get shape(): DragOperation['shape'] {\n const initial = shape.initial.value;\n const current = shape.current.value;\n\n return initial && current ? {initial, current} : null;\n },\n set shape(value: Shape | null) {\n if (value && shape.current.peek()?.equals(value)) {\n return;\n }\n\n const initial = shape.initial.peek();\n\n if (!initial) {\n shape.initial.value = value;\n }\n\n shape.current.value = value;\n },\n get transform() {\n return transform.value;\n },\n position,\n };\n\n const reset = () => {\n batch(() => {\n status.value = Status.Idle;\n sourceIdentifier.value = null;\n targetIdentifier.value = null;\n shape.current.value = null;\n shape.initial.value = null;\n position.reset({x: 0, y: 0});\n modifiers.value = [];\n });\n };\n\n return {\n operation,\n actions: {\n setDragSource(identifier: UniqueIdentifier) {\n sourceIdentifier.value = identifier;\n },\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<void> {\n const id = identifier ?? null;\n\n if (targetIdentifier.peek() === id) {\n return Promise.resolve();\n }\n\n targetIdentifier.value = id;\n\n if (status.peek() === Status.Dragging) {\n monitor.dispatch(\n 'dragover',\n defaultPreventable({\n operation: snapshot(operation),\n })\n );\n }\n\n return manager.renderer.rendering;\n },\n start({event, coordinates}: {event: Event; coordinates: Coordinates}) {\n const sourceInstance = source.peek();\n\n if (!sourceInstance) {\n throw new Error(\n 'Cannot start a drag operation without a drag source'\n );\n }\n\n batch(() => {\n dragended.value = false;\n canceled.value = false;\n activatorEvent.value = event;\n position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: snapshot(operation),\n });\n\n monitor.dispatch('beforedragstart', beforeStartEvent);\n\n manager.renderer.rendering.then(() => {\n if (beforeStartEvent.defaultPrevented) {\n reset();\n return;\n }\n\n status.value = Status.Initializing;\n\n requestAnimationFrame(() => {\n status.value = Status.Dragging;\n\n monitor.dispatch('dragstart', {\n operation: snapshot(operation),\n cancelable: false,\n });\n });\n });\n },\n move({\n by,\n to,\n cancelable = true,\n }:\n | {by: Coordinates; to?: undefined; cancelable?: boolean}\n | {by?: undefined; to: Coordinates; cancelable?: boolean}) {\n if (!dragging.peek()) {\n return;\n }\n\n const event = defaultPreventable(\n {\n operation: snapshot(operation),\n by,\n to,\n },\n cancelable\n );\n\n monitor.dispatch('dragmove', event);\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = to ?? {\n x: position.current.x + by.x,\n y: position.current.y + by.y,\n };\n\n position.update(coordinates);\n });\n },\n stop({canceled: eventCanceled = false}: {canceled?: boolean} = {}) {\n let promise: Promise<void> | undefined;\n const suspend = () => {\n const output = {\n resume: () => {},\n abort: () => {},\n };\n\n promise = new Promise<void>((resolve, reject) => {\n output.resume = resolve;\n output.abort = reject;\n });\n\n return output;\n };\n const end = () => {\n /* Wait for the renderer to finish rendering before finalizing the drag operation */\n manager.renderer.rendering.then(() => {\n status.value = Status.Dropped;\n manager.renderer.rendering.then(reset);\n });\n };\n\n batch(() => {\n dragended.value = true;\n canceled.value = eventCanceled;\n });\n\n monitor.dispatch('dragend', {\n operation: snapshot(operation),\n canceled: eventCanceled,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(reset);\n } else {\n end();\n }\n },\n },\n };\n}\n\nfunction snapshot<T extends Record<string, any>>(obj: T): T {\n return {\n ...obj,\n };\n}\n","export interface Renderer {\n get rendering(): Promise<void>;\n}\n\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import type {Draggable, Droppable} from '../entities/index.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';\n\nimport {DragDropRegistry} from './registry.ts';\nimport {\n DragOperationManager,\n type DragOperation,\n type DragActions,\n} from './dragOperation.ts';\nimport {DragDropMonitor} from './events.ts';\nimport {defaultRenderer, type Renderer} from './renderer.ts';\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = {\n plugins?: Plugins<T>;\n sensors?: Sensors<T>;\n modifiers?: Modifiers<T>;\n renderer?: Renderer;\n};\n\nexport class DragDropManager<T extends Draggable, U extends Droppable> {\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n public collisionObserver: CollisionObserver<T, U>;\n public dragOperation: DragOperation<T, U>;\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n public renderer: Renderer;\n\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const {\n plugins = [],\n sensors = [],\n modifiers = [],\n renderer = defaultRenderer,\n } = config ?? {};\n const monitor = new DragDropMonitor<T, U, V>(this);\n const registry = new DragDropRegistry<T, U, V>(this);\n\n this.registry = registry;\n this.monitor = monitor;\n this.renderer = renderer;\n\n const {actions, operation} = DragOperationManager<T, U, V>(this);\n\n this.actions = actions;\n this.dragOperation = operation;\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n this.destroy = this.destroy.bind(this);\n }\n\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n public destroy() {\n this.registry.destroy();\n this.collisionObserver.destroy();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["src/core/collision/observer.ts","src/core/plugins/plugin.ts","src/core/plugins/utilities.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/notifier.ts","src/core/manager/events.ts","src/core/collision/types.ts","src/core/entities/entity/entity.ts","src/core/entities/entity/registry.ts","src/core/entities/draggable/draggable.ts","src/core/entities/droppable/droppable.ts","src/core/sensors/sensor.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/dragOperation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["untracked","effect","CollisionPriority","CollisionType","reactive","_disabled_dec","_init","_disabled","effects","manager","signal","derived","_type_dec","_c","_type","batch","computed","Status","transform","operation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAA;AAAA,EAEA;AAAA,OACK;;;ACRP,SAAQ,UAAU,iBAAgB;;;ACO3B,SAAS,UAGd,QAAW,SAA2C;AACtD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,aACd,QACA;AACA,SAAO,CAAC,YAAkE;AACxE,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AAEO,SAAS,WACd,QAC+B;AAC/B,MAAI,OAAO,WAAW,YAAY;AAChC,WAAO;AAAA,MACL;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AACT;;;ADpCA;AAuBE,iBAAC;AAbI,IAAe,SAAf,MAGL;AAAA,EACA,YACS,SACA,SACP;AAFO;AACA;AAQT,uBAAgB,WAAoB,kBAApC,gBAAoC,SAApC;AAAA,EAPG;AAAA;AAAA;AAAA;AAAA;AAAA,EAaI,SAAS;AACd,SAAK,WAAW;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAU;AACf,SAAK,WAAW;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,aAAa;AAClB,WAAO,UAAU,MAAM;AACrB,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';\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\nexport class CollisionObserver<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> extends Plugin<V> {\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = computed(this.computeCollisions, deepEqual);\n\n this.destroy = effect(() => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n });\n }\n\n forceUpdateCount = signal(0);\n\n public forceUpdate(refresh = true) {\n untracked(() => {\n const {source} = this.manager.dragOperation;\n\n batch(() => {\n if (refresh) {\n for (const droppable of this.manager.registry.droppables) {\n if (source && !droppable.accepts(source)) {\n continue;\n }\n\n droppable.refreshShape();\n }\n }\n\n this.forceUpdateCount.value++;\n });\n });\n }\n\n public computeCollisions(\n entries?: Droppable[],\n collisionDetector?: CollisionDetector\n ) {\n const {registry, dragOperation} = this.manager;\n const {source, shape, status} = dragOperation;\n\n if (!status.initialized || !shape) {\n return DEFAULT_VALUE;\n }\n\n const collisions: Collision[] = [];\n\n this.forceUpdateCount.value;\n\n for (const entry of entries ?? registry.droppables) {\n if (entry.disabled) {\n continue;\n }\n\n if (source && !entry.accepts(source)) {\n continue;\n }\n\n const detectCollision = collisionDetector ?? entry.collisionDetector;\n\n if (!detectCollision) {\n continue;\n }\n\n const collision = untracked(() =>\n detectCollision({\n droppable: entry,\n dragOperation,\n })\n );\n\n if (collision) {\n if (entry.collisionPriority != null) {\n collision.priority = entry.collisionPriority;\n }\n\n collisions.push(collision);\n }\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: ReadonlySignal<Collisions>;\n}\n","import {reactive, untracked} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {PluginOptions} from './types.ts';\nimport {configure} from './utilities.ts';\n\n/**\n * An abstract plugin class that can be extended to implement custom\n * functionality that augments the `DragDropManager`'s core capabilities.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n * Triggers effects when accessed.\n */\n @reactive\n public accessor disabled: boolean = false;\n\n /**\n * Enable a disabled plugin instance.\n * Triggers effects.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disable an enabled plugin instance.\n * Triggers effects.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Whether the plugin instance is disabled.\n * Does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configure a plugin instance with new options.\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n /**\n * Destroy a plugin instance.\n */\n public destroy() {\n /*\n * Each plugin is responsible for implementing its own\n * destroy method to clean up effects and listeners\n */\n }\n\n /**\n * Configure a plugin constructor with options.\n * This method is used to configure the options that the\n * plugin constructor will use to create plugin instances.\n */\n static configure(options: PluginOptions) {\n return configure(this as any, options);\n }\n}\n\nexport class CorePlugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> extends Plugin<T, U> {}\n","import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.ts';\n\nexport function configure<\n T extends PluginConstructor<any, any, any>,\n V extends PluginOptions = InferPluginOptions<T>,\n>(plugin: T, options: V): PluginDescriptor<any, any, T> {\n return {\n plugin,\n options,\n };\n}\n\nexport function configurator<T extends PluginConstructor<any, any, any>>(\n plugin: T\n) {\n return (options: InferPluginOptions<T>): PluginDescriptor<any, any, T> => {\n return configure(plugin, options);\n };\n}\n\nexport function descriptor<T extends PluginConstructor<any, any, any>>(\n plugin: T | PluginDescriptor<any, any, T>\n): PluginDescriptor<any, any, T> {\n if (typeof plugin === 'function') {\n return {\n plugin,\n options: undefined,\n };\n }\n\n return plugin;\n}\n","import {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin, type Plugin} from './plugin.ts';\nimport type {InferPluginOptions, PluginConstructor, Plugins} from './types.ts';\nimport {descriptor} from './utilities.ts';\n\nexport class PluginRegistry<\n T extends DragDropManager<any, any>,\n W extends PluginConstructor<T> = PluginConstructor<T>,\n U extends Plugin<T> = InstanceType<W>,\n> {\n private instances: Map<W, U> = new Map();\n\n constructor(private manager: T) {}\n\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n public set values(entries: Plugins<T>) {\n const descriptors = entries.map(descriptor);\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 public get<X extends W>(plugin: X): InstanceType<X> | undefined {\n const instance = this.instances.get(plugin);\n\n return instance as any;\n }\n\n public register<X extends W>(\n plugin: X,\n options?: InferPluginOptions<X>\n ): InstanceType<X> {\n const existingInstance = this.instances.get(plugin);\n\n if (existingInstance) {\n return existingInstance as InstanceType<X>;\n }\n\n const instance = new plugin(this.manager, options) as U;\n\n this.instances.set(plugin, instance);\n\n return instance as InstanceType<X>;\n }\n\n public unregister<X extends W>(plugin: X) {\n const instance = this.instances.get(plugin);\n\n if (instance) {\n instance.destroy();\n this.instances.delete(plugin);\n }\n }\n\n public destroy() {\n for (const plugin of this.instances.values()) {\n plugin.destroy();\n }\n\n this.instances.clear();\n }\n}\n","import {Collision} from './types.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 {effect, 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\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager<any, any>) {\n super(manager);\n\n this.destroy = effect(() => {\n const {collisionObserver, monitor} = manager;\n const {collisions} = collisionObserver;\n\n if (collisionObserver.isDisabled()) {\n return;\n }\n\n const event = defaultPreventable({\n collisions,\n });\n\n monitor.dispatch('collision', event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const [firstCollision] = collisions;\n\n untracked(() => {\n if (firstCollision?.id !== manager.dragOperation.target?.id) {\n collisionObserver.disable();\n\n manager.actions.setDropTarget(firstCollision?.id).then(() => {\n collisionObserver.enable();\n });\n }\n });\n });\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport type {Collisions} from '../collision/index.ts';\nimport type {DragDropManager} from './manager.ts';\nimport type {DragOperation} from './dragOperation.ts';\n\nexport type Events = Record<string, (...args: any[]) => void>;\n\nexport type Preventable<T> = T & {\n cancelable: boolean;\n defaultPrevented: boolean;\n preventDefault(): void;\n};\n\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n public addEventListener<U extends keyof T>(name: U, handler: T[U]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.add(handler);\n registry.set(name, listeners);\n\n return () => this.removeEventListener(name, handler);\n }\n\n public removeEventListener(name: keyof T, handler: T[keyof T]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.delete(handler);\n registry.set(name, listeners);\n }\n\n protected dispatch<U extends keyof T>(name: U, ...args: any[]) {\n const {registry} = this;\n const listeners = registry.get(name);\n\n if (!listeners) {\n return;\n }\n\n for (const listener of listeners) {\n listener(...args);\n }\n }\n}\n\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n beforedragstart(\n event: Preventable<{operation: DragOperation<T, U>}>,\n manager: V\n ): void;\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperation<T, U>;\n },\n manager: V\n ): void;\n dragmove(\n event: Preventable<{\n operation: DragOperation<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n }>,\n manager: V\n ): void;\n dragover(\n event: Preventable<{\n operation: DragOperation<T, U>;\n }>,\n manager: V\n ): void;\n dragend(\n event: {\n operation: DragOperation<T, U>;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport class DragDropMonitor<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> extends Monitor<DragDropEvents<T, U, V>> {\n constructor(private manager: V) {\n super();\n }\n\n public dispatch<Key extends keyof DragDropEvents<T, U, V>>(\n type: Key,\n event: Parameters<DragDropEvents<T, U, V>[Key]>[0]\n ) {\n const args = [event, this.manager] as any;\n\n super.dispatch(type, ...args);\n }\n}\n\nexport function defaultPreventable<T>(\n event: T,\n cancelable = true\n): Preventable<T> {\n let defaultPrevented = false;\n\n return {\n ...event,\n cancelable,\n get defaultPrevented() {\n return defaultPrevented;\n },\n preventDefault() {\n if (!cancelable) {\n return;\n }\n\n defaultPrevented = true;\n },\n };\n}\n","import type {DragOperation} from '../manager/index.ts';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\nexport enum CollisionPriority {\n Lowest,\n Low,\n Normal,\n High,\n Highest,\n}\n\nexport enum CollisionType {\n Collision,\n ShapeIntersection,\n PointerIntersection,\n}\n\nexport interface Collision {\n id: UniqueIdentifier;\n priority: CollisionPriority | number;\n type: CollisionType;\n value: number;\n}\n\nexport type Collisions = Collision[];\n\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n droppable: U;\n dragOperation: DragOperation<T, U>;\n}\n\nexport type CollisionDetector = <\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n>(\n input: CollisionDetectorInput<T, U>\n) => Collision | null;\n","import {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 id: UniqueIdentifier;\n data?: T;\n disabled?: boolean;\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} = 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 this.destroy = this.destroy.bind(this);\n\n if (manager) {\n queueMicrotask(() => {\n this.manager?.registry.register(this);\n });\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\n if (current.get(key) === value) {\n return;\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n const cleanup = effects(...value.effects());\n this.cleanupFunctions.set(value, cleanup);\n\n return () => this.unregister(key, value);\n };\n\n /**\n * Unregisters an entity from the registry.\n * @param key - The unique identifier of the entity.\n * @param value - The entity instance to unregister.\n */\n public unregister = (key: UniqueIdentifier, value: T) => {\n const current = this.map.peek();\n\n if (current.get(key) !== value) {\n return;\n }\n\n const 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';\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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n type?: Type;\n modifiers?: Modifiers;\n sensors?: Sensors;\n}\n\nexport type DraggableStatus = 'idle' | 'dragging' | 'dropping';\n\nexport class Draggable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\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 }\n\n public sensors: Sensors | undefined;\n\n @reactive\n public accessor modifiers: Modifiers | undefined;\n\n @reactive\n public accessor type: Type | undefined;\n\n @reactive\n public accessor status: DraggableStatus = 'idle';\n\n /**\n * A boolean indicating whether the draggable item is the source of a drag operation.\n */\n @derived\n public get isDragSource() {\n 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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n collisionPriority?: CollisionPriority | number;\n collisionDetector: CollisionDetector;\n type?: Type;\n}\n\nexport class Droppable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\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 * An array of types that are compatible with the droppable.\n */\n @reactive\n public accessor accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /**\n * The type of the droppable.\n */\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} draggable\n * @returns {boolean}\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (!draggable.type) {\n return false;\n }\n\n if (Array.isArray(accept)) {\n return accept.includes(draggable.type);\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\n }\n\n return draggable.type === accept;\n }\n\n @reactive\n public accessor collisionDetector: CollisionDetector;\n\n @reactive\n public accessor collisionPriority: CollisionPriority | number | undefined;\n\n @reactive\n public accessor shape: Shape | undefined;\n\n @derived\n public get isDropTarget() {\n return this.manager?.dragOperation.target?.id === this.id;\n }\n\n public refreshShape() {\n // To be implemented by subclasses\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport type SensorOptions = PluginOptions;\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 constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Bind the sensor to a draggable source, and optionally pass\n * in sensor options to override the default sensor options\n * for this draggable source only.\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport {\n Plugin,\n type PluginOptions,\n type PluginConstructor,\n type PluginDescriptor,\n} from '../plugins/index.ts';\nimport type {DragDropManager} from '../manager/index.ts';\n\nexport type ModifierOptions = PluginOptions;\n\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n public apply(operation: T['dragOperation']): Coordinates {\n return operation.transform;\n }\n}\n\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\nexport type Modifiers<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (ModifierConstructor<T> | ModifierDescriptor<T>)[];\n","import type {CleanupFunction} from '@dnd-kit/state';\n\nimport {\n Draggable,\n Droppable,\n Entity,\n EntityRegistry,\n} from '../entities/index.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\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n constructor(manager: V) {\n this.plugins = new PluginRegistry<V, PluginConstructor<V>>(manager);\n this.sensors = new PluginRegistry<V, SensorConstructor<V>>(manager);\n this.modifiers = new PluginRegistry<V, ModifierConstructor<V>>(manager);\n }\n\n public draggables = new EntityRegistry<T>();\n public droppables = new EntityRegistry<U>();\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n public register(input: Entity): () => 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 public unregister(input: Entity): CleanupFunction;\n public unregister(input: Draggable): CleanupFunction;\n public unregister(input: Droppable): CleanupFunction;\n public unregister(input: SensorConstructor): CleanupFunction;\n public unregister(input: ModifierConstructor): CleanupFunction;\n public unregister(input: PluginConstructor): CleanupFunction;\n public unregister(input: any) {\n if (input instanceof Entity) {\n if (input instanceof Draggable) {\n return this.draggables.unregister(input.id, input as T);\n }\n\n if (input instanceof Droppable) {\n return this.droppables.unregister(input.id, input as U);\n }\n\n // no-op\n return () => {};\n }\n\n if (input.prototype instanceof Modifier) {\n return this.modifiers.unregister(input);\n }\n\n if (input.prototype instanceof Sensor) {\n return this.sensors.unregister(input);\n }\n\n if (input.prototype instanceof Plugin) {\n return this.plugins.unregister(input);\n }\n\n throw new Error('Invalid instance type');\n }\n\n destroy() {\n this.draggables.destroy();\n this.droppables.destroy();\n this.plugins.destroy();\n this.sensors.destroy();\n this.modifiers.destroy();\n }\n}\n","import {Position, type Shape} from '@dnd-kit/geometry';\nimport type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, computed, effect, signal} 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';\nimport {descriptor} from '../plugins/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {defaultPreventable} from './events.ts';\n\nexport enum Status {\n Idle = 'idle',\n Initializing = 'initializing',\n Dragging = 'dragging',\n Dropped = 'dropped',\n}\n\nexport type Serializable = {\n [key: string]: string | number | null | Serializable | Serializable[];\n};\n\nexport interface DragOperation<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n activatorEvent: Event | null;\n canceled: boolean;\n position: Position;\n transform: Coordinates;\n status: {\n current: Status;\n initialized: boolean;\n initializing: boolean;\n dragging: boolean;\n dragended: boolean;\n dropped: boolean;\n idle: boolean;\n };\n get shape(): {\n initial: Shape;\n current: Shape;\n } | null;\n set shape(value: Shape | null);\n source: T | null;\n target: U | null;\n data?: Serializable;\n}\n\nexport type DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = ReturnType<typeof DragOperationManager<T, U, V>>['actions'];\n\nexport function DragOperationManager<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n>(manager: V) {\n const {\n registry: {draggables, droppables},\n monitor,\n } = manager;\n const status = signal<Status>(Status.Idle);\n const shape = {\n initial: signal<Shape | null>(null),\n current: signal<Shape | null>(null),\n };\n const canceled = signal<boolean>(false);\n const position = new Position({x: 0, y: 0});\n const activatorEvent = signal<Event | null>(null);\n const sourceIdentifier = signal<UniqueIdentifier | null>(null);\n const targetIdentifier = signal<UniqueIdentifier | null>(null);\n const dragging = computed(() => status.value === Status.Dragging);\n const initialized = computed(() => status.value !== Status.Idle);\n const initializing = computed(() => status.value === Status.Initializing);\n const idle = computed(() => status.value === Status.Idle);\n const dropped = computed(() => status.value === Status.Dropped);\n const dragended = signal<boolean>(true);\n let previousSource: T | undefined;\n const source = computed<T | null>(() => {\n const identifier = sourceIdentifier.value;\n\n if (identifier == null) return null;\n\n const value = draggables.get(identifier);\n\n if (value) {\n // It's possible for the source to unmount during the drag operation\n previousSource = value;\n }\n\n return value ?? previousSource ?? null;\n });\n const target = computed<U | null>(() => {\n const identifier = targetIdentifier.value;\n return identifier != null ? droppables.get(identifier) ?? null : null;\n });\n\n const modifiers = signal<Modifier[]>([]);\n\n effect(() => {\n const currentModifiers = modifiers.peek();\n\n if (currentModifiers !== manager.modifiers) {\n currentModifiers.forEach((modifier) => modifier.destroy());\n }\n\n modifiers.value =\n source.value?.modifiers?.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n return new plugin(manager, options);\n }) ?? manager.modifiers;\n });\n\n const transform = computed(() => {\n const {x, y} = position.delta;\n\n let transform = {x, y};\n const initialShape = shape.initial.peek();\n const currentShape = shape.current.peek();\n const operation: Omit<DragOperation<T, U>, 'transform'> = {\n activatorEvent: activatorEvent.peek(),\n canceled: canceled.peek(),\n source: source.peek(),\n target: target.peek(),\n status: {\n current: status.peek(),\n idle: idle.peek(),\n initializing: initializing.peek(),\n initialized: initialized.peek(),\n dragging: dragging.peek(),\n dragended: dragended.peek(),\n dropped: dropped.peek(),\n },\n shape:\n initialShape && currentShape\n ? {initial: initialShape, current: currentShape}\n : null,\n position,\n };\n\n for (const modifier of modifiers.value) {\n transform = modifier.apply({...operation, transform});\n }\n\n return transform;\n });\n\n const operation: DragOperation<T, U> = {\n get activatorEvent() {\n return activatorEvent.value;\n },\n get canceled() {\n return canceled.value;\n },\n get source() {\n return source.value;\n },\n get target() {\n return target.value;\n },\n status: {\n get current() {\n return status.value;\n },\n get idle() {\n return idle.value;\n },\n get initializing() {\n return initializing.value;\n },\n get initialized() {\n return initialized.value;\n },\n get dragging() {\n return dragging.value;\n },\n get dragended() {\n return dragended.value;\n },\n get dropped() {\n return dropped.value;\n },\n },\n get shape(): DragOperation['shape'] {\n const initial = shape.initial.value;\n const current = shape.current.value;\n\n return initial && current ? {initial, current} : null;\n },\n set shape(value: Shape | null) {\n if (value && shape.current.peek()?.equals(value)) {\n return;\n }\n\n const initial = shape.initial.peek();\n\n if (!initial) {\n shape.initial.value = value;\n }\n\n shape.current.value = value;\n },\n get transform() {\n return transform.value;\n },\n position,\n };\n\n const reset = () => {\n batch(() => {\n status.value = Status.Idle;\n sourceIdentifier.value = null;\n targetIdentifier.value = null;\n shape.current.value = null;\n shape.initial.value = null;\n position.reset({x: 0, y: 0});\n modifiers.value = [];\n });\n };\n\n return {\n operation,\n actions: {\n setDragSource(identifier: UniqueIdentifier) {\n sourceIdentifier.value = identifier;\n },\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<void> {\n const id = identifier ?? null;\n\n if (targetIdentifier.peek() === id) {\n return Promise.resolve();\n }\n\n targetIdentifier.value = id;\n\n if (status.peek() === Status.Dragging) {\n monitor.dispatch(\n 'dragover',\n defaultPreventable({\n operation: snapshot(operation),\n })\n );\n }\n\n return manager.renderer.rendering;\n },\n start({event, coordinates}: {event: Event; coordinates: Coordinates}) {\n const sourceInstance = source.peek();\n\n if (!sourceInstance) {\n throw new Error(\n 'Cannot start a drag operation without a drag source'\n );\n }\n\n batch(() => {\n dragended.value = false;\n canceled.value = false;\n activatorEvent.value = event;\n position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: snapshot(operation),\n });\n\n monitor.dispatch('beforedragstart', beforeStartEvent);\n\n manager.renderer.rendering.then(() => {\n if (beforeStartEvent.defaultPrevented) {\n reset();\n return;\n }\n\n status.value = Status.Initializing;\n\n requestAnimationFrame(() => {\n status.value = Status.Dragging;\n\n monitor.dispatch('dragstart', {\n operation: snapshot(operation),\n cancelable: false,\n });\n });\n });\n },\n move({\n by,\n to,\n cancelable = true,\n }:\n | {by: Coordinates; to?: undefined; cancelable?: boolean}\n | {by?: undefined; to: Coordinates; cancelable?: boolean}) {\n if (!dragging.peek()) {\n return;\n }\n\n const event = defaultPreventable(\n {\n operation: snapshot(operation),\n by,\n to,\n },\n cancelable\n );\n\n monitor.dispatch('dragmove', event);\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = to ?? {\n x: position.current.x + by.x,\n y: position.current.y + by.y,\n };\n\n position.update(coordinates);\n });\n },\n stop({canceled: eventCanceled = false}: {canceled?: boolean} = {}) {\n let promise: Promise<void> | undefined;\n const suspend = () => {\n const output = {\n resume: () => {},\n abort: () => {},\n };\n\n promise = new Promise<void>((resolve, reject) => {\n output.resume = resolve;\n output.abort = reject;\n });\n\n return output;\n };\n const end = () => {\n /* Wait for the renderer to finish rendering before finalizing the drag operation */\n manager.renderer.rendering.then(() => {\n status.value = Status.Dropped;\n manager.renderer.rendering.then(reset);\n });\n };\n\n batch(() => {\n dragended.value = true;\n canceled.value = eventCanceled;\n });\n\n monitor.dispatch('dragend', {\n operation: snapshot(operation),\n canceled: eventCanceled,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(reset);\n } else {\n end();\n }\n },\n },\n };\n}\n\nfunction snapshot<T extends Record<string, any>>(obj: T): T {\n return {\n ...obj,\n };\n}\n","export interface Renderer {\n get rendering(): Promise<void>;\n}\n\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import type {Draggable, Droppable} from '../entities/index.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';\n\nimport {DragDropRegistry} from './registry.ts';\nimport {\n DragOperationManager,\n type DragOperation,\n type DragActions,\n} from './dragOperation.ts';\nimport {DragDropMonitor} from './events.ts';\nimport {defaultRenderer, type Renderer} from './renderer.ts';\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = {\n plugins?: Plugins<T>;\n sensors?: Sensors<T>;\n modifiers?: Modifiers<T>;\n renderer?: Renderer;\n};\n\nexport class DragDropManager<T extends Draggable, U extends Droppable> {\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n public collisionObserver: CollisionObserver<T, U>;\n public dragOperation: DragOperation<T, U>;\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n public renderer: Renderer;\n\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const {\n plugins = [],\n sensors = [],\n modifiers = [],\n renderer = defaultRenderer,\n } = config ?? {};\n const monitor = new DragDropMonitor<T, U, V>(this);\n const registry = new DragDropRegistry<T, U, V>(this);\n\n this.registry = registry;\n this.monitor = monitor;\n this.renderer = renderer;\n\n const {actions, operation} = DragOperationManager<T, U, V>(this);\n\n this.actions = actions;\n this.dragOperation = operation;\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n this.destroy = this.destroy.bind(this);\n }\n\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n public destroy() {\n this.registry.destroy();\n this.collisionObserver.destroy();\n }\n}\n"]}
|
package/index.d.cts
CHANGED
|
@@ -234,9 +234,15 @@ declare enum CollisionPriority {
|
|
|
234
234
|
High = 3,
|
|
235
235
|
Highest = 4
|
|
236
236
|
}
|
|
237
|
+
declare enum CollisionType {
|
|
238
|
+
Collision = 0,
|
|
239
|
+
ShapeIntersection = 1,
|
|
240
|
+
PointerIntersection = 2
|
|
241
|
+
}
|
|
237
242
|
interface Collision {
|
|
238
243
|
id: UniqueIdentifier;
|
|
239
244
|
priority: CollisionPriority | number;
|
|
245
|
+
type: CollisionType;
|
|
240
246
|
value: number;
|
|
241
247
|
}
|
|
242
248
|
type Collisions = Collision[];
|
|
@@ -285,7 +291,7 @@ declare class Droppable<T extends Data = Data, U extends DragDropManager<any, an
|
|
|
285
291
|
*/
|
|
286
292
|
accepts(draggable: Draggable): boolean;
|
|
287
293
|
accessor collisionDetector: CollisionDetector;
|
|
288
|
-
accessor collisionPriority: number;
|
|
294
|
+
accessor collisionPriority: CollisionPriority | number | undefined;
|
|
289
295
|
accessor shape: Shape | undefined;
|
|
290
296
|
get isDropTarget(): boolean;
|
|
291
297
|
refreshShape(): void;
|
|
@@ -443,4 +449,4 @@ declare class DragDropManager<T extends Draggable, U extends Droppable> {
|
|
|
443
449
|
destroy(): void;
|
|
444
450
|
}
|
|
445
451
|
|
|
446
|
-
export { type Collision, type CollisionDetector, CollisionPriority, CorePlugin, type Data, type DragDropEvents, DragDropManager, type DragDropManagerInput, type DragOperation, DragOperationManager, Status as DragOperationStatus, Draggable, type Input$1 as DraggableInput, Droppable, type Input as DroppableInput, Entity, Modifier, type ModifierConstructor, type Modifiers, Plugin, type PluginConstructor, type PluginDescriptor, type PluginOptions, PluginRegistry, type Plugins, type Renderer, Sensor, type SensorConstructor, type SensorDescriptor, type SensorOptions, type Sensors, type Type, type UniqueIdentifier, configurator, configure, descriptor, sortCollisions };
|
|
452
|
+
export { type Collision, type CollisionDetector, CollisionPriority, CollisionType, CorePlugin, type Data, type DragDropEvents, DragDropManager, type DragDropManagerInput, type DragOperation, DragOperationManager, Status as DragOperationStatus, Draggable, type Input$1 as DraggableInput, Droppable, type Input as DroppableInput, Entity, Modifier, type ModifierConstructor, type Modifiers, Plugin, type PluginConstructor, type PluginDescriptor, type PluginOptions, PluginRegistry, type Plugins, type Renderer, Sensor, type SensorConstructor, type SensorDescriptor, type SensorOptions, type Sensors, type Type, type UniqueIdentifier, configurator, configure, descriptor, sortCollisions };
|
package/index.d.ts
CHANGED
|
@@ -234,9 +234,15 @@ declare enum CollisionPriority {
|
|
|
234
234
|
High = 3,
|
|
235
235
|
Highest = 4
|
|
236
236
|
}
|
|
237
|
+
declare enum CollisionType {
|
|
238
|
+
Collision = 0,
|
|
239
|
+
ShapeIntersection = 1,
|
|
240
|
+
PointerIntersection = 2
|
|
241
|
+
}
|
|
237
242
|
interface Collision {
|
|
238
243
|
id: UniqueIdentifier;
|
|
239
244
|
priority: CollisionPriority | number;
|
|
245
|
+
type: CollisionType;
|
|
240
246
|
value: number;
|
|
241
247
|
}
|
|
242
248
|
type Collisions = Collision[];
|
|
@@ -285,7 +291,7 @@ declare class Droppable<T extends Data = Data, U extends DragDropManager<any, an
|
|
|
285
291
|
*/
|
|
286
292
|
accepts(draggable: Draggable): boolean;
|
|
287
293
|
accessor collisionDetector: CollisionDetector;
|
|
288
|
-
accessor collisionPriority: number;
|
|
294
|
+
accessor collisionPriority: CollisionPriority | number | undefined;
|
|
289
295
|
accessor shape: Shape | undefined;
|
|
290
296
|
get isDropTarget(): boolean;
|
|
291
297
|
refreshShape(): void;
|
|
@@ -443,4 +449,4 @@ declare class DragDropManager<T extends Draggable, U extends Droppable> {
|
|
|
443
449
|
destroy(): void;
|
|
444
450
|
}
|
|
445
451
|
|
|
446
|
-
export { type Collision, type CollisionDetector, CollisionPriority, CorePlugin, type Data, type DragDropEvents, DragDropManager, type DragDropManagerInput, type DragOperation, DragOperationManager, Status as DragOperationStatus, Draggable, type Input$1 as DraggableInput, Droppable, type Input as DroppableInput, Entity, Modifier, type ModifierConstructor, type Modifiers, Plugin, type PluginConstructor, type PluginDescriptor, type PluginOptions, PluginRegistry, type Plugins, type Renderer, Sensor, type SensorConstructor, type SensorDescriptor, type SensorOptions, type Sensors, type Type, type UniqueIdentifier, configurator, configure, descriptor, sortCollisions };
|
|
452
|
+
export { type Collision, type CollisionDetector, CollisionPriority, CollisionType, CorePlugin, type Data, type DragDropEvents, DragDropManager, type DragDropManagerInput, type DragOperation, DragOperationManager, Status as DragOperationStatus, Draggable, type Input$1 as DraggableInput, Droppable, type Input as DroppableInput, Entity, Modifier, type ModifierConstructor, type Modifiers, Plugin, type PluginConstructor, type PluginDescriptor, type PluginOptions, PluginRegistry, type Plugins, type Renderer, Sensor, type SensorConstructor, type SensorDescriptor, type SensorOptions, type Sensors, type Type, type UniqueIdentifier, configurator, configure, descriptor, sortCollisions };
|
package/index.js
CHANGED
|
@@ -222,7 +222,10 @@ _previousValues = new WeakMap();
|
|
|
222
222
|
// src/core/collision/utilities.ts
|
|
223
223
|
function sortCollisions(a, b) {
|
|
224
224
|
if (a.priority === b.priority) {
|
|
225
|
-
|
|
225
|
+
if (a.type === b.type) {
|
|
226
|
+
return b.value - a.value;
|
|
227
|
+
}
|
|
228
|
+
return b.type - a.type;
|
|
226
229
|
}
|
|
227
230
|
return b.priority - a.priority;
|
|
228
231
|
}
|
|
@@ -396,6 +399,12 @@ var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
|
|
396
399
|
CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
|
|
397
400
|
return CollisionPriority2;
|
|
398
401
|
})(CollisionPriority || {});
|
|
402
|
+
var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
|
403
|
+
CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
|
|
404
|
+
CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
|
|
405
|
+
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
|
406
|
+
return CollisionType2;
|
|
407
|
+
})(CollisionType || {});
|
|
399
408
|
var _disabled_dec2, _data_dec, _id_dec, _manager_dec, _init2, _manager, _id, _data, _disabled2;
|
|
400
409
|
_manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
|
|
401
410
|
var Entity = class {
|
|
@@ -581,17 +590,7 @@ __decoratorMetadata(_init3, Draggable);
|
|
|
581
590
|
var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2, _init4, _accept, _type2, _collisionDetector, _collisionPriority, _shape;
|
|
582
591
|
var Droppable = class extends (_c2 = Entity, _accept_dec = [reactive], _type_dec2 = [reactive], _collisionDetector_dec = [reactive], _collisionPriority_dec = [reactive], _shape_dec = [reactive], _isDropTarget_dec = [derived], _c2) {
|
|
583
592
|
constructor(_a, manager) {
|
|
584
|
-
var _b = _a, {
|
|
585
|
-
accept,
|
|
586
|
-
collisionDetector,
|
|
587
|
-
collisionPriority = 2 /* Normal */,
|
|
588
|
-
type
|
|
589
|
-
} = _b, input = __objRest(_b, [
|
|
590
|
-
"accept",
|
|
591
|
-
"collisionDetector",
|
|
592
|
-
"collisionPriority",
|
|
593
|
-
"type"
|
|
594
|
-
]);
|
|
593
|
+
var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
|
595
594
|
super(input, manager);
|
|
596
595
|
__runInitializers(_init4, 5, this);
|
|
597
596
|
__privateAdd(this, _accept, __runInitializers(_init4, 8, this)), __runInitializers(_init4, 11, this);
|
|
@@ -1055,6 +1054,6 @@ var DragDropManager = class {
|
|
|
1055
1054
|
}
|
|
1056
1055
|
};
|
|
1057
1056
|
|
|
1058
|
-
export { CollisionPriority, CorePlugin, DragDropManager, Status as DragOperationStatus, Draggable, Droppable, Modifier, Plugin, PluginRegistry, Sensor, configurator, configure, descriptor, sortCollisions };
|
|
1057
|
+
export { CollisionPriority, CollisionType, CorePlugin, DragDropManager, Status as DragOperationStatus, Draggable, Droppable, Modifier, Plugin, PluginRegistry, Sensor, configurator, configure, descriptor, sortCollisions };
|
|
1059
1058
|
//# sourceMappingURL=out.js.map
|
|
1060
1059
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["src/core/collision/observer.ts","src/core/plugins/plugin.ts","src/core/plugins/utilities.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/notifier.ts","src/core/manager/events.ts","src/core/collision/types.ts","src/core/entities/entity/entity.ts","src/core/entities/entity/registry.ts","src/core/entities/draggable/draggable.ts","src/core/entities/droppable/droppable.ts","src/core/sensors/sensor.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/dragOperation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["untracked","effect","CollisionPriority","reactive","_disabled_dec","_init","_disabled","effects","manager","signal","derived","_type_dec","_c","_type","batch","computed","Status","transform","operation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAA;AAAA,EAEA;AAAA,OACK;;;ACRP,SAAQ,UAAU,iBAAgB;;;ACO3B,SAAS,UAGd,QAAW,SAA2C;AACtD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,aACd,QACA;AACA,SAAO,CA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AEA,IAAI,UAAU,WAA2B;AACvC,SAAK,SAAS,UAAU,SAAS;AAAA,EACnC;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEO,UAAU;AACf,SAAK,SAAS,QAAQ;AACtB,SAAK,kBAAkB,QAAQ;AAAA,EACjC;AACF","sourcesContent":["import {\n batch,\n computed,\n deepEqual,\n signal,\n untracked,\n type ReadonlySignal,\n effect,\n} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport class CollisionObserver<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> extends Plugin<V> {\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = computed(this.computeCollisions, deepEqual);\n\n this.destroy = effect(() => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n });\n }\n\n forceUpdateCount = signal(0);\n\n public forceUpdate(refresh = true) {\n untracked(() => {\n const {source} = this.manager.dragOperation;\n\n batch(() => {\n if (refresh) {\n for (const droppable of this.manager.registry.droppables) {\n if (source && !droppable.accepts(source)) {\n continue;\n }\n\n droppable.refreshShape();\n }\n }\n\n this.forceUpdateCount.value++;\n });\n });\n }\n\n public computeCollisions(\n entries?: Droppable[],\n collisionDetector?: CollisionDetector\n ) {\n const {registry, dragOperation} = this.manager;\n const {source, shape, status} = dragOperation;\n\n if (!status.initialized || !shape) {\n return DEFAULT_VALUE;\n }\n\n const collisions: Collision[] = [];\n\n this.forceUpdateCount.value;\n\n for (const entry of entries ?? registry.droppables) {\n if (entry.disabled) {\n continue;\n }\n\n if (source && !entry.accepts(source)) {\n continue;\n }\n\n const detectCollision = collisionDetector ?? entry.collisionDetector;\n\n if (!detectCollision) {\n continue;\n }\n\n const collision = untracked(() =>\n detectCollision({\n droppable: entry,\n dragOperation,\n })\n );\n\n if (collision) {\n if (entry.collisionPriority != null) {\n collision.priority = entry.collisionPriority;\n }\n\n collisions.push(collision);\n }\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: ReadonlySignal<Collisions>;\n}\n","import {reactive, untracked} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {PluginOptions} from './types.ts';\nimport {configure} from './utilities.ts';\n\n/**\n * An abstract plugin class that can be extended to implement custom\n * functionality that augments the `DragDropManager`'s core capabilities.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n * Triggers effects when accessed.\n */\n @reactive\n public accessor disabled: boolean = false;\n\n /**\n * Enable a disabled plugin instance.\n * Triggers effects.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disable an enabled plugin instance.\n * Triggers effects.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Whether the plugin instance is disabled.\n * Does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configure a plugin instance with new options.\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n /**\n * Destroy a plugin instance.\n */\n public destroy() {\n /*\n * Each plugin is responsible for implementing its own\n * destroy method to clean up effects and listeners\n */\n }\n\n /**\n * Configure a plugin constructor with options.\n * This method is used to configure the options that the\n * plugin constructor will use to create plugin instances.\n */\n static configure(options: PluginOptions) {\n return configure(this as any, options);\n }\n}\n\nexport class CorePlugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> extends Plugin<T, U> {}\n","import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.ts';\n\nexport function configure<\n T extends PluginConstructor<any, any, any>,\n V extends PluginOptions = InferPluginOptions<T>,\n>(plugin: T, options: V): PluginDescriptor<any, any, T> {\n return {\n plugin,\n options,\n };\n}\n\nexport function configurator<T extends PluginConstructor<any, any, any>>(\n plugin: T\n) {\n return (options: InferPluginOptions<T>): PluginDescriptor<any, any, T> => {\n return configure(plugin, options);\n };\n}\n\nexport function descriptor<T extends PluginConstructor<any, any, any>>(\n plugin: T | PluginDescriptor<any, any, T>\n): PluginDescriptor<any, any, T> {\n if (typeof plugin === 'function') {\n return {\n plugin,\n options: undefined,\n };\n }\n\n return plugin;\n}\n","import {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin, type Plugin} from './plugin.ts';\nimport type {InferPluginOptions, PluginConstructor, Plugins} from './types.ts';\nimport {descriptor} from './utilities.ts';\n\nexport class PluginRegistry<\n T extends DragDropManager<any, any>,\n W extends PluginConstructor<T> = PluginConstructor<T>,\n U extends Plugin<T> = InstanceType<W>,\n> {\n private instances: Map<W, U> = new Map();\n\n constructor(private manager: T) {}\n\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n public set values(entries: Plugins<T>) {\n const descriptors = entries.map(descriptor);\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 public get<X extends W>(plugin: X): InstanceType<X> | undefined {\n const instance = this.instances.get(plugin);\n\n return instance as any;\n }\n\n public register<X extends W>(\n plugin: X,\n options?: InferPluginOptions<X>\n ): InstanceType<X> {\n const existingInstance = this.instances.get(plugin);\n\n if (existingInstance) {\n return existingInstance as InstanceType<X>;\n }\n\n const instance = new plugin(this.manager, options) as U;\n\n this.instances.set(plugin, instance);\n\n return instance as InstanceType<X>;\n }\n\n public unregister<X extends W>(plugin: X) {\n const instance = this.instances.get(plugin);\n\n if (instance) {\n instance.destroy();\n this.instances.delete(plugin);\n }\n }\n\n public destroy() {\n for (const plugin of this.instances.values()) {\n plugin.destroy();\n }\n\n this.instances.clear();\n }\n}\n","import {Collision} from './types.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 return b.value - a.value;\n }\n\n return b.priority - a.priority;\n}\n","import {effect, untracked} from '@dnd-kit/state';\n\nimport {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin} from '../plugins/index.ts';\nimport {defaultPreventable} from '../manager/events.ts';\n\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager<any, any>) {\n super(manager);\n\n this.destroy = effect(() => {\n const {collisionObserver, monitor} = manager;\n const {collisions} = collisionObserver;\n\n if (collisionObserver.isDisabled()) {\n return;\n }\n\n const event = defaultPreventable({\n collisions,\n });\n\n monitor.dispatch('collision', event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const [firstCollision] = collisions;\n\n untracked(() => {\n if (firstCollision?.id !== manager.dragOperation.target?.id) {\n collisionObserver.disable();\n\n manager.actions.setDropTarget(firstCollision?.id).then(() => {\n collisionObserver.enable();\n });\n }\n });\n });\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport type {Collisions} from '../collision/index.ts';\nimport type {DragDropManager} from './manager.ts';\nimport type {DragOperation} from './dragOperation.ts';\n\nexport type Events = Record<string, (...args: any[]) => void>;\n\nexport type Preventable<T> = T & {\n cancelable: boolean;\n defaultPrevented: boolean;\n preventDefault(): void;\n};\n\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n public addEventListener<U extends keyof T>(name: U, handler: T[U]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.add(handler);\n registry.set(name, listeners);\n\n return () => this.removeEventListener(name, handler);\n }\n\n public removeEventListener(name: keyof T, handler: T[keyof T]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.delete(handler);\n registry.set(name, listeners);\n }\n\n protected dispatch<U extends keyof T>(name: U, ...args: any[]) {\n const {registry} = this;\n const listeners = registry.get(name);\n\n if (!listeners) {\n return;\n }\n\n for (const listener of listeners) {\n listener(...args);\n }\n }\n}\n\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n beforedragstart(\n event: Preventable<{operation: DragOperation<T, U>}>,\n manager: V\n ): void;\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperation<T, U>;\n },\n manager: V\n ): void;\n dragmove(\n event: Preventable<{\n operation: DragOperation<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n }>,\n manager: V\n ): void;\n dragover(\n event: Preventable<{\n operation: DragOperation<T, U>;\n }>,\n manager: V\n ): void;\n dragend(\n event: {\n operation: DragOperation<T, U>;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport class DragDropMonitor<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> extends Monitor<DragDropEvents<T, U, V>> {\n constructor(private manager: V) {\n super();\n }\n\n public dispatch<Key extends keyof DragDropEvents<T, U, V>>(\n type: Key,\n event: Parameters<DragDropEvents<T, U, V>[Key]>[0]\n ) {\n const args = [event, this.manager] as any;\n\n super.dispatch(type, ...args);\n }\n}\n\nexport function defaultPreventable<T>(\n event: T,\n cancelable = true\n): Preventable<T> {\n let defaultPrevented = false;\n\n return {\n ...event,\n cancelable,\n get defaultPrevented() {\n return defaultPrevented;\n },\n preventDefault() {\n if (!cancelable) {\n return;\n }\n\n defaultPrevented = true;\n },\n };\n}\n","import type {DragOperation} from '../manager/index.ts';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\nexport enum CollisionPriority {\n Lowest,\n Low,\n Normal,\n High,\n Highest,\n}\n\nexport interface Collision {\n id: UniqueIdentifier;\n priority: CollisionPriority | number;\n value: number;\n}\n\nexport type Collisions = Collision[];\n\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n droppable: U;\n dragOperation: DragOperation<T, U>;\n}\n\nexport type CollisionDetector = <\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n>(\n input: CollisionDetectorInput<T, U>\n) => Collision | null;\n","import {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 id: UniqueIdentifier;\n data?: T;\n disabled?: boolean;\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} = 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 this.destroy = this.destroy.bind(this);\n\n if (manager) {\n queueMicrotask(() => {\n this.manager?.registry.register(this);\n });\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\n if (current.get(key) === value) {\n return;\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n const cleanup = effects(...value.effects());\n this.cleanupFunctions.set(value, cleanup);\n\n return () => this.unregister(key, value);\n };\n\n /**\n * Unregisters an entity from the registry.\n * @param key - The unique identifier of the entity.\n * @param value - The entity instance to unregister.\n */\n public unregister = (key: UniqueIdentifier, value: T) => {\n const current = this.map.peek();\n\n if (current.get(key) !== value) {\n return;\n }\n\n const 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';\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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n type?: Type;\n modifiers?: Modifiers;\n sensors?: Sensors;\n}\n\nexport type DraggableStatus = 'idle' | 'dragging' | 'dropping';\n\nexport class Draggable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\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 }\n\n public sensors: Sensors | undefined;\n\n @reactive\n public accessor modifiers: Modifiers | undefined;\n\n @reactive\n public accessor type: Type | undefined;\n\n @reactive\n public accessor status: DraggableStatus = 'idle';\n\n /**\n * A boolean indicating whether the draggable item is the source of a drag operation.\n */\n @derived\n public get isDragSource() {\n 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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n collisionPriority?: CollisionPriority | number;\n collisionDetector: CollisionDetector;\n type?: Type;\n}\n\nexport class Droppable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\n constructor(\n {\n accept,\n collisionDetector,\n collisionPriority = CollisionPriority.Normal,\n type,\n ...input\n }: 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 * An array of types that are compatible with the droppable.\n */\n @reactive\n public accessor accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /**\n * The type of the droppable.\n */\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} draggable\n * @returns {boolean}\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (!draggable.type) {\n return false;\n }\n\n if (Array.isArray(accept)) {\n return accept.includes(draggable.type);\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\n }\n\n return draggable.type === accept;\n }\n\n @reactive\n public accessor collisionDetector: CollisionDetector;\n\n @reactive\n public accessor collisionPriority: number;\n\n @reactive\n public accessor shape: Shape | undefined;\n\n @derived\n public get isDropTarget() {\n return this.manager?.dragOperation.target?.id === this.id;\n }\n\n public refreshShape() {\n // To be implemented by subclasses\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport type SensorOptions = PluginOptions;\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 constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Bind the sensor to a draggable source, and optionally pass\n * in sensor options to override the default sensor options\n * for this draggable source only.\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport {\n Plugin,\n type PluginOptions,\n type PluginConstructor,\n type PluginDescriptor,\n} from '../plugins/index.ts';\nimport type {DragDropManager} from '../manager/index.ts';\n\nexport type ModifierOptions = PluginOptions;\n\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n public apply(operation: T['dragOperation']): Coordinates {\n return operation.transform;\n }\n}\n\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\nexport type Modifiers<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (ModifierConstructor<T> | ModifierDescriptor<T>)[];\n","import type {CleanupFunction} from '@dnd-kit/state';\n\nimport {\n Draggable,\n Droppable,\n Entity,\n EntityRegistry,\n} from '../entities/index.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\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n constructor(manager: V) {\n this.plugins = new PluginRegistry<V, PluginConstructor<V>>(manager);\n this.sensors = new PluginRegistry<V, SensorConstructor<V>>(manager);\n this.modifiers = new PluginRegistry<V, ModifierConstructor<V>>(manager);\n }\n\n public draggables = new EntityRegistry<T>();\n public droppables = new EntityRegistry<U>();\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n public register(input: Entity): () => 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 public unregister(input: Entity): CleanupFunction;\n public unregister(input: Draggable): CleanupFunction;\n public unregister(input: Droppable): CleanupFunction;\n public unregister(input: SensorConstructor): CleanupFunction;\n public unregister(input: ModifierConstructor): CleanupFunction;\n public unregister(input: PluginConstructor): CleanupFunction;\n public unregister(input: any) {\n if (input instanceof Entity) {\n if (input instanceof Draggable) {\n return this.draggables.unregister(input.id, input as T);\n }\n\n if (input instanceof Droppable) {\n return this.droppables.unregister(input.id, input as U);\n }\n\n // no-op\n return () => {};\n }\n\n if (input.prototype instanceof Modifier) {\n return this.modifiers.unregister(input);\n }\n\n if (input.prototype instanceof Sensor) {\n return this.sensors.unregister(input);\n }\n\n if (input.prototype instanceof Plugin) {\n return this.plugins.unregister(input);\n }\n\n throw new Error('Invalid instance type');\n }\n\n destroy() {\n this.draggables.destroy();\n this.droppables.destroy();\n this.plugins.destroy();\n this.sensors.destroy();\n this.modifiers.destroy();\n }\n}\n","import {Position, type Shape} from '@dnd-kit/geometry';\nimport type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, computed, effect, signal} 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';\nimport {descriptor} from '../plugins/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {defaultPreventable} from './events.ts';\n\nexport enum Status {\n Idle = 'idle',\n Initializing = 'initializing',\n Dragging = 'dragging',\n Dropped = 'dropped',\n}\n\nexport type Serializable = {\n [key: string]: string | number | null | Serializable | Serializable[];\n};\n\nexport interface DragOperation<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n activatorEvent: Event | null;\n canceled: boolean;\n position: Position;\n transform: Coordinates;\n status: {\n current: Status;\n initialized: boolean;\n initializing: boolean;\n dragging: boolean;\n dragended: boolean;\n dropped: boolean;\n idle: boolean;\n };\n get shape(): {\n initial: Shape;\n current: Shape;\n } | null;\n set shape(value: Shape | null);\n source: T | null;\n target: U | null;\n data?: Serializable;\n}\n\nexport type DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = ReturnType<typeof DragOperationManager<T, U, V>>['actions'];\n\nexport function DragOperationManager<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n>(manager: V) {\n const {\n registry: {draggables, droppables},\n monitor,\n } = manager;\n const status = signal<Status>(Status.Idle);\n const shape = {\n initial: signal<Shape | null>(null),\n current: signal<Shape | null>(null),\n };\n const canceled = signal<boolean>(false);\n const position = new Position({x: 0, y: 0});\n const activatorEvent = signal<Event | null>(null);\n const sourceIdentifier = signal<UniqueIdentifier | null>(null);\n const targetIdentifier = signal<UniqueIdentifier | null>(null);\n const dragging = computed(() => status.value === Status.Dragging);\n const initialized = computed(() => status.value !== Status.Idle);\n const initializing = computed(() => status.value === Status.Initializing);\n const idle = computed(() => status.value === Status.Idle);\n const dropped = computed(() => status.value === Status.Dropped);\n const dragended = signal<boolean>(true);\n let previousSource: T | undefined;\n const source = computed<T | null>(() => {\n const identifier = sourceIdentifier.value;\n\n if (identifier == null) return null;\n\n const value = draggables.get(identifier);\n\n if (value) {\n // It's possible for the source to unmount during the drag operation\n previousSource = value;\n }\n\n return value ?? previousSource ?? null;\n });\n const target = computed<U | null>(() => {\n const identifier = targetIdentifier.value;\n return identifier != null ? droppables.get(identifier) ?? null : null;\n });\n\n const modifiers = signal<Modifier[]>([]);\n\n effect(() => {\n const currentModifiers = modifiers.peek();\n\n if (currentModifiers !== manager.modifiers) {\n currentModifiers.forEach((modifier) => modifier.destroy());\n }\n\n modifiers.value =\n source.value?.modifiers?.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n return new plugin(manager, options);\n }) ?? manager.modifiers;\n });\n\n const transform = computed(() => {\n const {x, y} = position.delta;\n\n let transform = {x, y};\n const initialShape = shape.initial.peek();\n const currentShape = shape.current.peek();\n const operation: Omit<DragOperation<T, U>, 'transform'> = {\n activatorEvent: activatorEvent.peek(),\n canceled: canceled.peek(),\n source: source.peek(),\n target: target.peek(),\n status: {\n current: status.peek(),\n idle: idle.peek(),\n initializing: initializing.peek(),\n initialized: initialized.peek(),\n dragging: dragging.peek(),\n dragended: dragended.peek(),\n dropped: dropped.peek(),\n },\n shape:\n initialShape && currentShape\n ? {initial: initialShape, current: currentShape}\n : null,\n position,\n };\n\n for (const modifier of modifiers.value) {\n transform = modifier.apply({...operation, transform});\n }\n\n return transform;\n });\n\n const operation: DragOperation<T, U> = {\n get activatorEvent() {\n return activatorEvent.value;\n },\n get canceled() {\n return canceled.value;\n },\n get source() {\n return source.value;\n },\n get target() {\n return target.value;\n },\n status: {\n get current() {\n return status.value;\n },\n get idle() {\n return idle.value;\n },\n get initializing() {\n return initializing.value;\n },\n get initialized() {\n return initialized.value;\n },\n get dragging() {\n return dragging.value;\n },\n get dragended() {\n return dragended.value;\n },\n get dropped() {\n return dropped.value;\n },\n },\n get shape(): DragOperation['shape'] {\n const initial = shape.initial.value;\n const current = shape.current.value;\n\n return initial && current ? {initial, current} : null;\n },\n set shape(value: Shape | null) {\n if (value && shape.current.peek()?.equals(value)) {\n return;\n }\n\n const initial = shape.initial.peek();\n\n if (!initial) {\n shape.initial.value = value;\n }\n\n shape.current.value = value;\n },\n get transform() {\n return transform.value;\n },\n position,\n };\n\n const reset = () => {\n batch(() => {\n status.value = Status.Idle;\n sourceIdentifier.value = null;\n targetIdentifier.value = null;\n shape.current.value = null;\n shape.initial.value = null;\n position.reset({x: 0, y: 0});\n modifiers.value = [];\n });\n };\n\n return {\n operation,\n actions: {\n setDragSource(identifier: UniqueIdentifier) {\n sourceIdentifier.value = identifier;\n },\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<void> {\n const id = identifier ?? null;\n\n if (targetIdentifier.peek() === id) {\n return Promise.resolve();\n }\n\n targetIdentifier.value = id;\n\n if (status.peek() === Status.Dragging) {\n monitor.dispatch(\n 'dragover',\n defaultPreventable({\n operation: snapshot(operation),\n })\n );\n }\n\n return manager.renderer.rendering;\n },\n start({event, coordinates}: {event: Event; coordinates: Coordinates}) {\n const sourceInstance = source.peek();\n\n if (!sourceInstance) {\n throw new Error(\n 'Cannot start a drag operation without a drag source'\n );\n }\n\n batch(() => {\n dragended.value = false;\n canceled.value = false;\n activatorEvent.value = event;\n position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: snapshot(operation),\n });\n\n monitor.dispatch('beforedragstart', beforeStartEvent);\n\n manager.renderer.rendering.then(() => {\n if (beforeStartEvent.defaultPrevented) {\n reset();\n return;\n }\n\n status.value = Status.Initializing;\n\n requestAnimationFrame(() => {\n status.value = Status.Dragging;\n\n monitor.dispatch('dragstart', {\n operation: snapshot(operation),\n cancelable: false,\n });\n });\n });\n },\n move({\n by,\n to,\n cancelable = true,\n }:\n | {by: Coordinates; to?: undefined; cancelable?: boolean}\n | {by?: undefined; to: Coordinates; cancelable?: boolean}) {\n if (!dragging.peek()) {\n return;\n }\n\n const event = defaultPreventable(\n {\n operation: snapshot(operation),\n by,\n to,\n },\n cancelable\n );\n\n monitor.dispatch('dragmove', event);\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = to ?? {\n x: position.current.x + by.x,\n y: position.current.y + by.y,\n };\n\n position.update(coordinates);\n });\n },\n stop({canceled: eventCanceled = false}: {canceled?: boolean} = {}) {\n let promise: Promise<void> | undefined;\n const suspend = () => {\n const output = {\n resume: () => {},\n abort: () => {},\n };\n\n promise = new Promise<void>((resolve, reject) => {\n output.resume = resolve;\n output.abort = reject;\n });\n\n return output;\n };\n const end = () => {\n /* Wait for the renderer to finish rendering before finalizing the drag operation */\n manager.renderer.rendering.then(() => {\n status.value = Status.Dropped;\n manager.renderer.rendering.then(reset);\n });\n };\n\n batch(() => {\n dragended.value = true;\n canceled.value = eventCanceled;\n });\n\n monitor.dispatch('dragend', {\n operation: snapshot(operation),\n canceled: eventCanceled,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(reset);\n } else {\n end();\n }\n },\n },\n };\n}\n\nfunction snapshot<T extends Record<string, any>>(obj: T): T {\n return {\n ...obj,\n };\n}\n","export interface Renderer {\n get rendering(): Promise<void>;\n}\n\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import type {Draggable, Droppable} from '../entities/index.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';\n\nimport {DragDropRegistry} from './registry.ts';\nimport {\n DragOperationManager,\n type DragOperation,\n type DragActions,\n} from './dragOperation.ts';\nimport {DragDropMonitor} from './events.ts';\nimport {defaultRenderer, type Renderer} from './renderer.ts';\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = {\n plugins?: Plugins<T>;\n sensors?: Sensors<T>;\n modifiers?: Modifiers<T>;\n renderer?: Renderer;\n};\n\nexport class DragDropManager<T extends Draggable, U extends Droppable> {\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n public collisionObserver: CollisionObserver<T, U>;\n public dragOperation: DragOperation<T, U>;\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n public renderer: Renderer;\n\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const {\n plugins = [],\n sensors = [],\n modifiers = [],\n renderer = defaultRenderer,\n } = config ?? {};\n const monitor = new DragDropMonitor<T, U, V>(this);\n const registry = new DragDropRegistry<T, U, V>(this);\n\n this.registry = registry;\n this.monitor = monitor;\n this.renderer = renderer;\n\n const {actions, operation} = DragOperationManager<T, U, V>(this);\n\n this.actions = actions;\n this.dragOperation = operation;\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n this.destroy = this.destroy.bind(this);\n }\n\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n public destroy() {\n this.registry.destroy();\n this.collisionObserver.destroy();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["src/core/collision/observer.ts","src/core/plugins/plugin.ts","src/core/plugins/utilities.ts","src/core/plugins/registry.ts","src/core/collision/utilities.ts","src/core/collision/notifier.ts","src/core/manager/events.ts","src/core/collision/types.ts","src/core/entities/entity/entity.ts","src/core/entities/entity/registry.ts","src/core/entities/draggable/draggable.ts","src/core/entities/droppable/droppable.ts","src/core/sensors/sensor.ts","src/core/modifiers/modifier.ts","src/core/manager/registry.ts","src/core/manager/dragOperation.ts","src/core/manager/renderer.ts","src/core/manager/manager.ts"],"names":["untracked","effect","CollisionPriority","CollisionType","reactive","_disabled_dec","_init","_disabled","effects","manager","signal","derived","_type_dec","_c","_type","batch","computed","Status","transform","operation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAA;AAAA,EAEA;AAAA,OACK;;;ACRP,SAAQ,UAAU,iBAAgB;;;ACO3B,SA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AK,UAAU,KAAK,QAAQ,KAAK,IAAI;AAAA,EACvC;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEA,IAAI,YAA6B;AAC/B,WAAO,KAAK,SAAS,UAAU;AAAA,EACjC;AAAA,EAEA,IAAI,UAAU,WAA2B;AACvC,SAAK,SAAS,UAAU,SAAS;AAAA,EACnC;AAAA,EAEA,IAAI,UAAyB;AAC3B,WAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B;AAAA,EAEA,IAAI,QAAQ,SAAuB;AACjC,SAAK,SAAS,QAAQ,SAAS;AAAA,EACjC;AAAA,EAEO,UAAU;AACf,SAAK,SAAS,QAAQ;AACtB,SAAK,kBAAkB,QAAQ;AAAA,EACjC;AACF","sourcesContent":["import {\n batch,\n computed,\n deepEqual,\n signal,\n untracked,\n type ReadonlySignal,\n effect,\n} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport class CollisionObserver<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n V extends DragDropManager<T, U> = DragDropManager<T, U>,\n> extends Plugin<V> {\n constructor(manager: V) {\n super(manager);\n\n this.computeCollisions = this.computeCollisions.bind(this);\n this.#collisions = computed(this.computeCollisions, deepEqual);\n\n this.destroy = effect(() => {\n const {dragOperation} = this.manager;\n\n if (dragOperation.status.initialized) {\n this.forceUpdate();\n }\n });\n }\n\n forceUpdateCount = signal(0);\n\n public forceUpdate(refresh = true) {\n untracked(() => {\n const {source} = this.manager.dragOperation;\n\n batch(() => {\n if (refresh) {\n for (const droppable of this.manager.registry.droppables) {\n if (source && !droppable.accepts(source)) {\n continue;\n }\n\n droppable.refreshShape();\n }\n }\n\n this.forceUpdateCount.value++;\n });\n });\n }\n\n public computeCollisions(\n entries?: Droppable[],\n collisionDetector?: CollisionDetector\n ) {\n const {registry, dragOperation} = this.manager;\n const {source, shape, status} = dragOperation;\n\n if (!status.initialized || !shape) {\n return DEFAULT_VALUE;\n }\n\n const collisions: Collision[] = [];\n\n this.forceUpdateCount.value;\n\n for (const entry of entries ?? registry.droppables) {\n if (entry.disabled) {\n continue;\n }\n\n if (source && !entry.accepts(source)) {\n continue;\n }\n\n const detectCollision = collisionDetector ?? entry.collisionDetector;\n\n if (!detectCollision) {\n continue;\n }\n\n const collision = untracked(() =>\n detectCollision({\n droppable: entry,\n dragOperation,\n })\n );\n\n if (collision) {\n if (entry.collisionPriority != null) {\n collision.priority = entry.collisionPriority;\n }\n\n collisions.push(collision);\n }\n }\n\n collisions.sort(sortCollisions);\n\n return collisions;\n }\n\n public get collisions() {\n return this.#collisions.value;\n }\n\n #collisions: ReadonlySignal<Collisions>;\n}\n","import {reactive, untracked} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.ts';\nimport type {PluginOptions} from './types.ts';\nimport {configure} from './utilities.ts';\n\n/**\n * An abstract plugin class that can be extended to implement custom\n * functionality that augments the `DragDropManager`'s core capabilities.\n */\nexport abstract class Plugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> {\n constructor(\n public manager: T,\n public options?: U\n ) {}\n\n /**\n * Whether the plugin instance is disabled.\n * Triggers effects when accessed.\n */\n @reactive\n public accessor disabled: boolean = false;\n\n /**\n * Enable a disabled plugin instance.\n * Triggers effects.\n */\n public enable() {\n this.disabled = false;\n }\n\n /**\n * Disable an enabled plugin instance.\n * Triggers effects.\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Whether the plugin instance is disabled.\n * Does not trigger effects when accessed.\n */\n public isDisabled() {\n return untracked(() => {\n return this.disabled;\n });\n }\n\n /**\n * Configure a plugin instance with new options.\n */\n public configure(options?: U) {\n this.options = options;\n }\n\n /**\n * Destroy a plugin instance.\n */\n public destroy() {\n /*\n * Each plugin is responsible for implementing its own\n * destroy method to clean up effects and listeners\n */\n }\n\n /**\n * Configure a plugin constructor with options.\n * This method is used to configure the options that the\n * plugin constructor will use to create plugin instances.\n */\n static configure(options: PluginOptions) {\n return configure(this as any, options);\n }\n}\n\nexport class CorePlugin<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends PluginOptions = PluginOptions,\n> extends Plugin<T, U> {}\n","import type {\n PluginConstructor,\n PluginOptions,\n PluginDescriptor,\n InferPluginOptions,\n} from './types.ts';\n\nexport function configure<\n T extends PluginConstructor<any, any, any>,\n V extends PluginOptions = InferPluginOptions<T>,\n>(plugin: T, options: V): PluginDescriptor<any, any, T> {\n return {\n plugin,\n options,\n };\n}\n\nexport function configurator<T extends PluginConstructor<any, any, any>>(\n plugin: T\n) {\n return (options: InferPluginOptions<T>): PluginDescriptor<any, any, T> => {\n return configure(plugin, options);\n };\n}\n\nexport function descriptor<T extends PluginConstructor<any, any, any>>(\n plugin: T | PluginDescriptor<any, any, T>\n): PluginDescriptor<any, any, T> {\n if (typeof plugin === 'function') {\n return {\n plugin,\n options: undefined,\n };\n }\n\n return plugin;\n}\n","import {DragDropManager} from '../manager/index.ts';\nimport {CorePlugin, type Plugin} from './plugin.ts';\nimport type {InferPluginOptions, PluginConstructor, Plugins} from './types.ts';\nimport {descriptor} from './utilities.ts';\n\nexport class PluginRegistry<\n T extends DragDropManager<any, any>,\n W extends PluginConstructor<T> = PluginConstructor<T>,\n U extends Plugin<T> = InstanceType<W>,\n> {\n private instances: Map<W, U> = new Map();\n\n constructor(private manager: T) {}\n\n public get values(): U[] {\n return Array.from(this.instances.values());\n }\n\n #previousValues: PluginConstructor<T>[] = [];\n\n public set values(entries: Plugins<T>) {\n const descriptors = entries.map(descriptor);\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 public get<X extends W>(plugin: X): InstanceType<X> | undefined {\n const instance = this.instances.get(plugin);\n\n return instance as any;\n }\n\n public register<X extends W>(\n plugin: X,\n options?: InferPluginOptions<X>\n ): InstanceType<X> {\n const existingInstance = this.instances.get(plugin);\n\n if (existingInstance) {\n return existingInstance as InstanceType<X>;\n }\n\n const instance = new plugin(this.manager, options) as U;\n\n this.instances.set(plugin, instance);\n\n return instance as InstanceType<X>;\n }\n\n public unregister<X extends W>(plugin: X) {\n const instance = this.instances.get(plugin);\n\n if (instance) {\n instance.destroy();\n this.instances.delete(plugin);\n }\n }\n\n public destroy() {\n for (const plugin of this.instances.values()) {\n plugin.destroy();\n }\n\n this.instances.clear();\n }\n}\n","import {Collision} from './types.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 {effect, 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\nexport class CollisionNotifier extends CorePlugin {\n constructor(manager: DragDropManager<any, any>) {\n super(manager);\n\n this.destroy = effect(() => {\n const {collisionObserver, monitor} = manager;\n const {collisions} = collisionObserver;\n\n if (collisionObserver.isDisabled()) {\n return;\n }\n\n const event = defaultPreventable({\n collisions,\n });\n\n monitor.dispatch('collision', event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const [firstCollision] = collisions;\n\n untracked(() => {\n if (firstCollision?.id !== manager.dragOperation.target?.id) {\n collisionObserver.disable();\n\n manager.actions.setDropTarget(firstCollision?.id).then(() => {\n collisionObserver.enable();\n });\n }\n });\n });\n }\n}\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport type {Draggable, Droppable} from '../entities/index.ts';\nimport type {Collisions} from '../collision/index.ts';\nimport type {DragDropManager} from './manager.ts';\nimport type {DragOperation} from './dragOperation.ts';\n\nexport type Events = Record<string, (...args: any[]) => void>;\n\nexport type Preventable<T> = T & {\n cancelable: boolean;\n defaultPrevented: boolean;\n preventDefault(): void;\n};\n\nclass Monitor<T extends Events> {\n private registry = new Map<keyof T, Set<T[keyof T]>>();\n\n public addEventListener<U extends keyof T>(name: U, handler: T[U]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.add(handler);\n registry.set(name, listeners);\n\n return () => this.removeEventListener(name, handler);\n }\n\n public removeEventListener(name: keyof T, handler: T[keyof T]) {\n const {registry} = this;\n const listeners = new Set(registry.get(name));\n\n listeners.delete(handler);\n registry.set(name, listeners);\n }\n\n protected dispatch<U extends keyof T>(name: U, ...args: any[]) {\n const {registry} = this;\n const listeners = registry.get(name);\n\n if (!listeners) {\n return;\n }\n\n for (const listener of listeners) {\n listener(...args);\n }\n }\n}\n\nexport type DragDropEvents<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = {\n collision(\n event: Preventable<{\n collisions: Collisions;\n }>,\n manager: V\n ): void;\n beforedragstart(\n event: Preventable<{operation: DragOperation<T, U>}>,\n manager: V\n ): void;\n dragstart(\n event: {\n cancelable: false;\n operation: DragOperation<T, U>;\n },\n manager: V\n ): void;\n dragmove(\n event: Preventable<{\n operation: DragOperation<T, U>;\n to?: Coordinates;\n by?: Coordinates;\n }>,\n manager: V\n ): void;\n dragover(\n event: Preventable<{\n operation: DragOperation<T, U>;\n }>,\n manager: V\n ): void;\n dragend(\n event: {\n operation: DragOperation<T, U>;\n canceled: boolean;\n suspend(): {resume(): void; abort(): void};\n },\n manager: V\n ): void;\n};\n\nexport class DragDropMonitor<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> extends Monitor<DragDropEvents<T, U, V>> {\n constructor(private manager: V) {\n super();\n }\n\n public dispatch<Key extends keyof DragDropEvents<T, U, V>>(\n type: Key,\n event: Parameters<DragDropEvents<T, U, V>[Key]>[0]\n ) {\n const args = [event, this.manager] as any;\n\n super.dispatch(type, ...args);\n }\n}\n\nexport function defaultPreventable<T>(\n event: T,\n cancelable = true\n): Preventable<T> {\n let defaultPrevented = false;\n\n return {\n ...event,\n cancelable,\n get defaultPrevented() {\n return defaultPrevented;\n },\n preventDefault() {\n if (!cancelable) {\n return;\n }\n\n defaultPrevented = true;\n },\n };\n}\n","import type {DragOperation} from '../manager/index.ts';\nimport type {\n Draggable,\n Droppable,\n UniqueIdentifier,\n} from '../entities/index.ts';\n\nexport enum CollisionPriority {\n Lowest,\n Low,\n Normal,\n High,\n Highest,\n}\n\nexport enum CollisionType {\n Collision,\n ShapeIntersection,\n PointerIntersection,\n}\n\nexport interface Collision {\n id: UniqueIdentifier;\n priority: CollisionPriority | number;\n type: CollisionType;\n value: number;\n}\n\nexport type Collisions = Collision[];\n\nexport interface CollisionDetectorInput<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n droppable: U;\n dragOperation: DragOperation<T, U>;\n}\n\nexport type CollisionDetector = <\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n>(\n input: CollisionDetectorInput<T, U>\n) => Collision | null;\n","import {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 id: UniqueIdentifier;\n data?: T;\n disabled?: boolean;\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} = 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 this.destroy = this.destroy.bind(this);\n\n if (manager) {\n queueMicrotask(() => {\n this.manager?.registry.register(this);\n });\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\n if (current.get(key) === value) {\n return;\n }\n\n const updatedMap = new Map(current);\n updatedMap.set(key, value);\n\n this.map.value = updatedMap;\n\n const cleanup = effects(...value.effects());\n this.cleanupFunctions.set(value, cleanup);\n\n return () => this.unregister(key, value);\n };\n\n /**\n * Unregisters an entity from the registry.\n * @param key - The unique identifier of the entity.\n * @param value - The entity instance to unregister.\n */\n public unregister = (key: UniqueIdentifier, value: T) => {\n const current = this.map.peek();\n\n if (current.get(key) !== value) {\n return;\n }\n\n const 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';\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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n type?: Type;\n modifiers?: Modifiers;\n sensors?: Sensors;\n}\n\nexport type DraggableStatus = 'idle' | 'dragging' | 'dropping';\n\nexport class Draggable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\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 }\n\n public sensors: Sensors | undefined;\n\n @reactive\n public accessor modifiers: Modifiers | undefined;\n\n @reactive\n public accessor type: Type | undefined;\n\n @reactive\n public accessor status: DraggableStatus = 'idle';\n\n /**\n * A boolean indicating whether the draggable item is the source of a drag operation.\n */\n @derived\n public get isDragSource() {\n 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\nexport interface Input<T extends Data = Data> extends EntityInput<T> {\n accept?: Type | Type[] | ((source: Draggable) => boolean);\n collisionPriority?: CollisionPriority | number;\n collisionDetector: CollisionDetector;\n type?: Type;\n}\n\nexport class Droppable<\n T extends Data = Data,\n U extends DragDropManager<any, any> = DragDropManager<any, any>,\n> extends Entity<T> {\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 * An array of types that are compatible with the droppable.\n */\n @reactive\n public accessor accept:\n | Type\n | Type[]\n | ((draggable: Draggable) => boolean)\n | undefined;\n\n /**\n * The type of the droppable.\n */\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} draggable\n * @returns {boolean}\n */\n public accepts(draggable: Draggable): boolean {\n const {accept} = this;\n\n if (!accept) {\n return true;\n }\n\n if (!draggable.type) {\n return false;\n }\n\n if (Array.isArray(accept)) {\n return accept.includes(draggable.type);\n }\n\n if (typeof accept === 'function') {\n return accept(draggable);\n }\n\n return draggable.type === accept;\n }\n\n @reactive\n public accessor collisionDetector: CollisionDetector;\n\n @reactive\n public accessor collisionPriority: CollisionPriority | number | undefined;\n\n @reactive\n public accessor shape: Shape | undefined;\n\n @derived\n public get isDropTarget() {\n return this.manager?.dragOperation.target?.id === this.id;\n }\n\n public refreshShape() {\n // To be implemented by subclasses\n }\n}\n","import {CleanupFunction} from '@dnd-kit/state';\n\nimport type {DragDropManager} from '../manager/index.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\nexport type SensorOptions = PluginOptions;\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 constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n /**\n * Bind the sensor to a draggable source, and optionally pass\n * in sensor options to override the default sensor options\n * for this draggable source only.\n */\n public abstract bind(source: Draggable, options?: U): CleanupFunction;\n}\n\nexport type SensorConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Sensor<T>>;\n\nexport type SensorDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Sensor<T>, SensorConstructor<T>>;\n\nexport type Sensors<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (SensorConstructor<T> | SensorDescriptor<T>)[];\n","import type {Coordinates} from '@dnd-kit/geometry';\n\nimport {\n Plugin,\n type PluginOptions,\n type PluginConstructor,\n type PluginDescriptor,\n} from '../plugins/index.ts';\nimport type {DragDropManager} from '../manager/index.ts';\n\nexport type ModifierOptions = PluginOptions;\n\nexport class Modifier<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n U extends ModifierOptions = ModifierOptions,\n> extends Plugin<T, U> {\n constructor(\n public manager: T,\n public options?: U\n ) {\n super(manager, options);\n }\n\n public apply(operation: T['dragOperation']): Coordinates {\n return operation.transform;\n }\n}\n\nexport type ModifierConstructor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginConstructor<T, Modifier<T, any>>;\n\nexport type ModifierDescriptor<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = PluginDescriptor<T, Modifier<T, any>, ModifierConstructor<T>>;\n\nexport type Modifiers<\n T extends DragDropManager<any, any> = DragDropManager<any, any>,\n> = (ModifierConstructor<T> | ModifierDescriptor<T>)[];\n","import type {CleanupFunction} from '@dnd-kit/state';\n\nimport {\n Draggable,\n Droppable,\n Entity,\n EntityRegistry,\n} from '../entities/index.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\nexport class DragDropRegistry<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> {\n constructor(manager: V) {\n this.plugins = new PluginRegistry<V, PluginConstructor<V>>(manager);\n this.sensors = new PluginRegistry<V, SensorConstructor<V>>(manager);\n this.modifiers = new PluginRegistry<V, ModifierConstructor<V>>(manager);\n }\n\n public draggables = new EntityRegistry<T>();\n public droppables = new EntityRegistry<U>();\n public plugins: PluginRegistry<V, PluginConstructor<V>>;\n public sensors: PluginRegistry<V, SensorConstructor<V>>;\n public modifiers: PluginRegistry<V, ModifierConstructor<V>>;\n\n public register(input: Entity): () => 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 public unregister(input: Entity): CleanupFunction;\n public unregister(input: Draggable): CleanupFunction;\n public unregister(input: Droppable): CleanupFunction;\n public unregister(input: SensorConstructor): CleanupFunction;\n public unregister(input: ModifierConstructor): CleanupFunction;\n public unregister(input: PluginConstructor): CleanupFunction;\n public unregister(input: any) {\n if (input instanceof Entity) {\n if (input instanceof Draggable) {\n return this.draggables.unregister(input.id, input as T);\n }\n\n if (input instanceof Droppable) {\n return this.droppables.unregister(input.id, input as U);\n }\n\n // no-op\n return () => {};\n }\n\n if (input.prototype instanceof Modifier) {\n return this.modifiers.unregister(input);\n }\n\n if (input.prototype instanceof Sensor) {\n return this.sensors.unregister(input);\n }\n\n if (input.prototype instanceof Plugin) {\n return this.plugins.unregister(input);\n }\n\n throw new Error('Invalid instance type');\n }\n\n destroy() {\n this.draggables.destroy();\n this.droppables.destroy();\n this.plugins.destroy();\n this.sensors.destroy();\n this.modifiers.destroy();\n }\n}\n","import {Position, type Shape} from '@dnd-kit/geometry';\nimport type {Coordinates} from '@dnd-kit/geometry';\nimport {batch, computed, effect, signal} 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';\nimport {descriptor} from '../plugins/index.ts';\n\nimport type {DragDropManager} from './manager.ts';\nimport {defaultPreventable} from './events.ts';\n\nexport enum Status {\n Idle = 'idle',\n Initializing = 'initializing',\n Dragging = 'dragging',\n Dropped = 'dropped',\n}\n\nexport type Serializable = {\n [key: string]: string | number | null | Serializable | Serializable[];\n};\n\nexport interface DragOperation<\n T extends Draggable = Draggable,\n U extends Droppable = Droppable,\n> {\n activatorEvent: Event | null;\n canceled: boolean;\n position: Position;\n transform: Coordinates;\n status: {\n current: Status;\n initialized: boolean;\n initializing: boolean;\n dragging: boolean;\n dragended: boolean;\n dropped: boolean;\n idle: boolean;\n };\n get shape(): {\n initial: Shape;\n current: Shape;\n } | null;\n set shape(value: Shape | null);\n source: T | null;\n target: U | null;\n data?: Serializable;\n}\n\nexport type DragActions<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n> = ReturnType<typeof DragOperationManager<T, U, V>>['actions'];\n\nexport function DragOperationManager<\n T extends Draggable,\n U extends Droppable,\n V extends DragDropManager<T, U>,\n>(manager: V) {\n const {\n registry: {draggables, droppables},\n monitor,\n } = manager;\n const status = signal<Status>(Status.Idle);\n const shape = {\n initial: signal<Shape | null>(null),\n current: signal<Shape | null>(null),\n };\n const canceled = signal<boolean>(false);\n const position = new Position({x: 0, y: 0});\n const activatorEvent = signal<Event | null>(null);\n const sourceIdentifier = signal<UniqueIdentifier | null>(null);\n const targetIdentifier = signal<UniqueIdentifier | null>(null);\n const dragging = computed(() => status.value === Status.Dragging);\n const initialized = computed(() => status.value !== Status.Idle);\n const initializing = computed(() => status.value === Status.Initializing);\n const idle = computed(() => status.value === Status.Idle);\n const dropped = computed(() => status.value === Status.Dropped);\n const dragended = signal<boolean>(true);\n let previousSource: T | undefined;\n const source = computed<T | null>(() => {\n const identifier = sourceIdentifier.value;\n\n if (identifier == null) return null;\n\n const value = draggables.get(identifier);\n\n if (value) {\n // It's possible for the source to unmount during the drag operation\n previousSource = value;\n }\n\n return value ?? previousSource ?? null;\n });\n const target = computed<U | null>(() => {\n const identifier = targetIdentifier.value;\n return identifier != null ? droppables.get(identifier) ?? null : null;\n });\n\n const modifiers = signal<Modifier[]>([]);\n\n effect(() => {\n const currentModifiers = modifiers.peek();\n\n if (currentModifiers !== manager.modifiers) {\n currentModifiers.forEach((modifier) => modifier.destroy());\n }\n\n modifiers.value =\n source.value?.modifiers?.map((modifier) => {\n const {plugin, options} = descriptor(modifier);\n return new plugin(manager, options);\n }) ?? manager.modifiers;\n });\n\n const transform = computed(() => {\n const {x, y} = position.delta;\n\n let transform = {x, y};\n const initialShape = shape.initial.peek();\n const currentShape = shape.current.peek();\n const operation: Omit<DragOperation<T, U>, 'transform'> = {\n activatorEvent: activatorEvent.peek(),\n canceled: canceled.peek(),\n source: source.peek(),\n target: target.peek(),\n status: {\n current: status.peek(),\n idle: idle.peek(),\n initializing: initializing.peek(),\n initialized: initialized.peek(),\n dragging: dragging.peek(),\n dragended: dragended.peek(),\n dropped: dropped.peek(),\n },\n shape:\n initialShape && currentShape\n ? {initial: initialShape, current: currentShape}\n : null,\n position,\n };\n\n for (const modifier of modifiers.value) {\n transform = modifier.apply({...operation, transform});\n }\n\n return transform;\n });\n\n const operation: DragOperation<T, U> = {\n get activatorEvent() {\n return activatorEvent.value;\n },\n get canceled() {\n return canceled.value;\n },\n get source() {\n return source.value;\n },\n get target() {\n return target.value;\n },\n status: {\n get current() {\n return status.value;\n },\n get idle() {\n return idle.value;\n },\n get initializing() {\n return initializing.value;\n },\n get initialized() {\n return initialized.value;\n },\n get dragging() {\n return dragging.value;\n },\n get dragended() {\n return dragended.value;\n },\n get dropped() {\n return dropped.value;\n },\n },\n get shape(): DragOperation['shape'] {\n const initial = shape.initial.value;\n const current = shape.current.value;\n\n return initial && current ? {initial, current} : null;\n },\n set shape(value: Shape | null) {\n if (value && shape.current.peek()?.equals(value)) {\n return;\n }\n\n const initial = shape.initial.peek();\n\n if (!initial) {\n shape.initial.value = value;\n }\n\n shape.current.value = value;\n },\n get transform() {\n return transform.value;\n },\n position,\n };\n\n const reset = () => {\n batch(() => {\n status.value = Status.Idle;\n sourceIdentifier.value = null;\n targetIdentifier.value = null;\n shape.current.value = null;\n shape.initial.value = null;\n position.reset({x: 0, y: 0});\n modifiers.value = [];\n });\n };\n\n return {\n operation,\n actions: {\n setDragSource(identifier: UniqueIdentifier) {\n sourceIdentifier.value = identifier;\n },\n setDropTarget(\n identifier: UniqueIdentifier | null | undefined\n ): Promise<void> {\n const id = identifier ?? null;\n\n if (targetIdentifier.peek() === id) {\n return Promise.resolve();\n }\n\n targetIdentifier.value = id;\n\n if (status.peek() === Status.Dragging) {\n monitor.dispatch(\n 'dragover',\n defaultPreventable({\n operation: snapshot(operation),\n })\n );\n }\n\n return manager.renderer.rendering;\n },\n start({event, coordinates}: {event: Event; coordinates: Coordinates}) {\n const sourceInstance = source.peek();\n\n if (!sourceInstance) {\n throw new Error(\n 'Cannot start a drag operation without a drag source'\n );\n }\n\n batch(() => {\n dragended.value = false;\n canceled.value = false;\n activatorEvent.value = event;\n position.reset(coordinates);\n });\n\n const beforeStartEvent = defaultPreventable({\n operation: snapshot(operation),\n });\n\n monitor.dispatch('beforedragstart', beforeStartEvent);\n\n manager.renderer.rendering.then(() => {\n if (beforeStartEvent.defaultPrevented) {\n reset();\n return;\n }\n\n status.value = Status.Initializing;\n\n requestAnimationFrame(() => {\n status.value = Status.Dragging;\n\n monitor.dispatch('dragstart', {\n operation: snapshot(operation),\n cancelable: false,\n });\n });\n });\n },\n move({\n by,\n to,\n cancelable = true,\n }:\n | {by: Coordinates; to?: undefined; cancelable?: boolean}\n | {by?: undefined; to: Coordinates; cancelable?: boolean}) {\n if (!dragging.peek()) {\n return;\n }\n\n const event = defaultPreventable(\n {\n operation: snapshot(operation),\n by,\n to,\n },\n cancelable\n );\n\n monitor.dispatch('dragmove', event);\n\n queueMicrotask(() => {\n if (event.defaultPrevented) {\n return;\n }\n\n const coordinates = to ?? {\n x: position.current.x + by.x,\n y: position.current.y + by.y,\n };\n\n position.update(coordinates);\n });\n },\n stop({canceled: eventCanceled = false}: {canceled?: boolean} = {}) {\n let promise: Promise<void> | undefined;\n const suspend = () => {\n const output = {\n resume: () => {},\n abort: () => {},\n };\n\n promise = new Promise<void>((resolve, reject) => {\n output.resume = resolve;\n output.abort = reject;\n });\n\n return output;\n };\n const end = () => {\n /* Wait for the renderer to finish rendering before finalizing the drag operation */\n manager.renderer.rendering.then(() => {\n status.value = Status.Dropped;\n manager.renderer.rendering.then(reset);\n });\n };\n\n batch(() => {\n dragended.value = true;\n canceled.value = eventCanceled;\n });\n\n monitor.dispatch('dragend', {\n operation: snapshot(operation),\n canceled: eventCanceled,\n suspend,\n });\n\n if (promise) {\n promise.then(end).catch(reset);\n } else {\n end();\n }\n },\n },\n };\n}\n\nfunction snapshot<T extends Record<string, any>>(obj: T): T {\n return {\n ...obj,\n };\n}\n","export interface Renderer {\n get rendering(): Promise<void>;\n}\n\nexport const defaultRenderer: Renderer = {\n get rendering() {\n return Promise.resolve();\n },\n};\n","import type {Draggable, Droppable} from '../entities/index.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';\n\nimport {DragDropRegistry} from './registry.ts';\nimport {\n DragOperationManager,\n type DragOperation,\n type DragActions,\n} from './dragOperation.ts';\nimport {DragDropMonitor} from './events.ts';\nimport {defaultRenderer, type Renderer} from './renderer.ts';\n\nexport type DragDropManagerInput<T extends DragDropManager<any, any>> = {\n plugins?: Plugins<T>;\n sensors?: Sensors<T>;\n modifiers?: Modifiers<T>;\n renderer?: Renderer;\n};\n\nexport class DragDropManager<T extends Draggable, U extends Droppable> {\n public actions: DragActions<T, U, DragDropManager<T, U>>;\n public collisionObserver: CollisionObserver<T, U>;\n public dragOperation: DragOperation<T, U>;\n public monitor: DragDropMonitor<T, U, DragDropManager<T, U>>;\n public registry: DragDropRegistry<T, U, DragDropManager<T, U>>;\n public renderer: Renderer;\n\n constructor(config?: DragDropManagerInput<any>) {\n type V = DragDropManager<T, U>;\n\n const {\n plugins = [],\n sensors = [],\n modifiers = [],\n renderer = defaultRenderer,\n } = config ?? {};\n const monitor = new DragDropMonitor<T, U, V>(this);\n const registry = new DragDropRegistry<T, U, V>(this);\n\n this.registry = registry;\n this.monitor = monitor;\n this.renderer = renderer;\n\n const {actions, operation} = DragOperationManager<T, U, V>(this);\n\n this.actions = actions;\n this.dragOperation = operation;\n this.collisionObserver = new CollisionObserver<T, U, V>(this);\n this.plugins = [CollisionNotifier, ...plugins];\n this.modifiers = modifiers;\n this.sensors = sensors;\n this.destroy = this.destroy.bind(this);\n }\n\n get plugins(): Plugin<any>[] {\n return this.registry.plugins.values;\n }\n\n set plugins(plugins: Plugins<any>) {\n this.registry.plugins.values = plugins;\n }\n\n get modifiers(): Modifier<any>[] {\n return this.registry.modifiers.values;\n }\n\n set modifiers(modifiers: Modifiers<any>) {\n this.registry.modifiers.values = modifiers;\n }\n\n get sensors(): Sensor<any>[] {\n return this.registry.sensors.values;\n }\n\n set sensors(sensors: Sensors<any>) {\n this.registry.sensors.values = sensors;\n }\n\n public destroy() {\n this.registry.destroy();\n this.collisionObserver.destroy();\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnd-kit/abstract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-beta-20240714162912",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@dnd-kit/geometry": "
|
|
48
|
-
"@dnd-kit/state": "
|
|
47
|
+
"@dnd-kit/geometry": "0.0.6-beta-20240714162912",
|
|
48
|
+
"@dnd-kit/state": "0.0.6-beta-20240714162912",
|
|
49
49
|
"tslib": "^2.6.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|