@vuu-ui/vuu-utils 0.13.11 → 0.13.13
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/cjs/node_modules/@dnd-kit/abstract/index.js +863 -0
- package/cjs/node_modules/@dnd-kit/abstract/index.js.map +1 -1
- package/cjs/node_modules/@dnd-kit/dom/index.js +329 -0
- package/cjs/node_modules/@dnd-kit/dom/index.js.map +1 -1
- package/cjs/node_modules/@dnd-kit/react/hooks.js +49 -1
- package/cjs/node_modules/@dnd-kit/react/hooks.js.map +1 -1
- package/cjs/node_modules/@dnd-kit/react/index.js +398 -0
- package/cjs/node_modules/@dnd-kit/react/index.js.map +1 -0
- package/cjs/node_modules/@dnd-kit/react/sortable.js +10 -10
- package/cjs/node_modules/@dnd-kit/state/dist/index.js +5 -0
- package/cjs/node_modules/@dnd-kit/state/dist/index.js.map +1 -1
- package/cjs/packages/vuu-utils/src/Clock.js +51 -0
- package/cjs/packages/vuu-utils/src/Clock.js.map +1 -0
- package/cjs/packages/vuu-utils/src/date/formatter.js +8 -0
- package/cjs/packages/vuu-utils/src/date/formatter.js.map +1 -1
- package/cjs/packages/vuu-utils/src/date/types.js +5 -1
- package/cjs/packages/vuu-utils/src/date/types.js.map +1 -1
- package/cjs/packages/vuu-utils/src/index.js +11 -14
- package/cjs/packages/vuu-utils/src/index.js.map +1 -1
- package/esm/node_modules/@dnd-kit/abstract/index.js +863 -3
- package/esm/node_modules/@dnd-kit/abstract/index.js.map +1 -1
- package/esm/node_modules/@dnd-kit/dom/index.js +326 -4
- package/esm/node_modules/@dnd-kit/dom/index.js.map +1 -1
- package/esm/node_modules/@dnd-kit/react/hooks.js +48 -2
- package/esm/node_modules/@dnd-kit/react/hooks.js.map +1 -1
- package/esm/node_modules/@dnd-kit/react/index.js +392 -0
- package/esm/node_modules/@dnd-kit/react/index.js.map +1 -0
- package/esm/node_modules/@dnd-kit/react/sortable.js +1 -1
- package/esm/node_modules/@dnd-kit/state/dist/index.js +7 -3
- package/esm/node_modules/@dnd-kit/state/dist/index.js.map +1 -1
- package/esm/packages/vuu-utils/src/Clock.js +49 -0
- package/esm/packages/vuu-utils/src/Clock.js.map +1 -0
- package/esm/packages/vuu-utils/src/date/formatter.js +8 -0
- package/esm/packages/vuu-utils/src/date/formatter.js.map +1 -1
- package/esm/packages/vuu-utils/src/date/types.js +5 -1
- package/esm/packages/vuu-utils/src/date/types.js.map +1 -1
- package/esm/packages/vuu-utils/src/index.js +2 -1
- package/esm/packages/vuu-utils/src/index.js.map +1 -1
- package/package.json +6 -9
- package/types/Clock.d.ts +18 -0
- package/types/date/types.d.ts +2 -2
- package/types/index.d.ts +3 -1
|
@@ -205,6 +205,377 @@ __decoratorMetadata(_init, Plugin);
|
|
|
205
205
|
var CorePlugin = class extends Plugin {
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
+
// src/core/plugins/registry.ts
|
|
209
|
+
var _previousValues;
|
|
210
|
+
var PluginRegistry = class {
|
|
211
|
+
/**
|
|
212
|
+
* Creates a new plugin registry.
|
|
213
|
+
*
|
|
214
|
+
* @param manager - The drag and drop manager that owns this registry
|
|
215
|
+
*/
|
|
216
|
+
constructor(manager) {
|
|
217
|
+
this.manager = manager;
|
|
218
|
+
this.instances = /* @__PURE__ */ new Map();
|
|
219
|
+
__privateAdd(this, _previousValues, []);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Gets all registered plugin instances.
|
|
223
|
+
*
|
|
224
|
+
* @returns An array of all active plugin instances
|
|
225
|
+
*/
|
|
226
|
+
get values() {
|
|
227
|
+
return Array.from(this.instances.values());
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Sets the list of plugins to be used by the registry.
|
|
231
|
+
*
|
|
232
|
+
* @param entries - Array of plugin constructors or descriptors
|
|
233
|
+
* @remarks
|
|
234
|
+
* This method:
|
|
235
|
+
* - Filters out duplicate plugins
|
|
236
|
+
* - Unregisters plugins that are no longer in use
|
|
237
|
+
* - Registers new plugins with their options
|
|
238
|
+
*/
|
|
239
|
+
set values(entries) {
|
|
240
|
+
const descriptors = entries.map(descriptor).reduceRight((acc, descriptor2) => {
|
|
241
|
+
if (acc.some(({ plugin }) => plugin === descriptor2.plugin)) {
|
|
242
|
+
return acc;
|
|
243
|
+
}
|
|
244
|
+
return [descriptor2, ...acc];
|
|
245
|
+
}, []);
|
|
246
|
+
const constructors = descriptors.map(({ plugin }) => plugin);
|
|
247
|
+
for (const plugin of __privateGet(this, _previousValues)) {
|
|
248
|
+
if (!constructors.includes(plugin)) {
|
|
249
|
+
if (plugin.prototype instanceof CorePlugin) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
this.unregister(plugin);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
for (const { plugin, options } of descriptors) {
|
|
256
|
+
this.register(plugin, options);
|
|
257
|
+
}
|
|
258
|
+
__privateSet(this, _previousValues, constructors);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Gets a plugin instance by its constructor.
|
|
262
|
+
*
|
|
263
|
+
* @param plugin - The plugin constructor to look up
|
|
264
|
+
* @returns The plugin instance or undefined if not found
|
|
265
|
+
*/
|
|
266
|
+
get(plugin) {
|
|
267
|
+
const instance = this.instances.get(plugin);
|
|
268
|
+
return instance;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Registers a new plugin instance.
|
|
272
|
+
*
|
|
273
|
+
* @param plugin - The plugin constructor to register
|
|
274
|
+
* @param options - Optional configuration for the plugin
|
|
275
|
+
* @returns The registered plugin instance
|
|
276
|
+
* @remarks
|
|
277
|
+
* If the plugin is already registered, its options will be updated
|
|
278
|
+
* and the existing instance will be returned.
|
|
279
|
+
*/
|
|
280
|
+
register(plugin, options) {
|
|
281
|
+
const existingInstance = this.instances.get(plugin);
|
|
282
|
+
if (existingInstance) {
|
|
283
|
+
if (existingInstance.options !== options) {
|
|
284
|
+
existingInstance.options = options;
|
|
285
|
+
}
|
|
286
|
+
return existingInstance;
|
|
287
|
+
}
|
|
288
|
+
const instance = new plugin(this.manager, options);
|
|
289
|
+
this.instances.set(plugin, instance);
|
|
290
|
+
return instance;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Unregisters a plugin instance.
|
|
294
|
+
*
|
|
295
|
+
* @param plugin - The plugin constructor to unregister
|
|
296
|
+
* @remarks
|
|
297
|
+
* This method:
|
|
298
|
+
* - Destroys the plugin instance
|
|
299
|
+
* - Removes it from the registry
|
|
300
|
+
*/
|
|
301
|
+
unregister(plugin) {
|
|
302
|
+
const instance = this.instances.get(plugin);
|
|
303
|
+
if (instance) {
|
|
304
|
+
instance.destroy();
|
|
305
|
+
this.instances.delete(plugin);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Destroys all registered plugin instances.
|
|
310
|
+
*
|
|
311
|
+
* @remarks
|
|
312
|
+
* This method:
|
|
313
|
+
* - Calls destroy() on all plugin instances
|
|
314
|
+
* - Clears the registry
|
|
315
|
+
*/
|
|
316
|
+
destroy() {
|
|
317
|
+
for (const plugin of this.instances.values()) {
|
|
318
|
+
plugin.destroy();
|
|
319
|
+
}
|
|
320
|
+
this.instances.clear();
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
_previousValues = new WeakMap();
|
|
324
|
+
|
|
325
|
+
// src/core/collision/utilities.ts
|
|
326
|
+
function sortCollisions(a, b) {
|
|
327
|
+
if (a.priority === b.priority) {
|
|
328
|
+
if (a.type === b.type) {
|
|
329
|
+
return b.value - a.value;
|
|
330
|
+
}
|
|
331
|
+
return b.type - a.type;
|
|
332
|
+
}
|
|
333
|
+
return b.priority - a.priority;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// src/core/collision/observer.ts
|
|
337
|
+
var DEFAULT_VALUE = [];
|
|
338
|
+
var _previousCoordinates, _collisions;
|
|
339
|
+
var CollisionObserver = class extends Plugin {
|
|
340
|
+
/**
|
|
341
|
+
* Creates a new CollisionObserver instance.
|
|
342
|
+
*
|
|
343
|
+
* @param manager - The drag drop manager instance
|
|
344
|
+
*/
|
|
345
|
+
constructor(manager) {
|
|
346
|
+
super(manager);
|
|
347
|
+
__privateAdd(this, _previousCoordinates);
|
|
348
|
+
__privateAdd(this, _collisions);
|
|
349
|
+
this.computeCollisions = this.computeCollisions.bind(this);
|
|
350
|
+
__privateSet(this, _collisions, signalsCore.signal(DEFAULT_VALUE));
|
|
351
|
+
this.destroy = index.effects(
|
|
352
|
+
() => {
|
|
353
|
+
const collisions = this.computeCollisions();
|
|
354
|
+
const coordinates = signalsCore.untracked(
|
|
355
|
+
() => this.manager.dragOperation.position.current
|
|
356
|
+
);
|
|
357
|
+
if (collisions !== DEFAULT_VALUE) {
|
|
358
|
+
const previousCoordinates = __privateGet(this, _previousCoordinates);
|
|
359
|
+
__privateSet(this, _previousCoordinates, coordinates);
|
|
360
|
+
if (previousCoordinates && coordinates.x == previousCoordinates.x && coordinates.y == previousCoordinates.y) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
__privateSet(this, _previousCoordinates, void 0);
|
|
365
|
+
}
|
|
366
|
+
__privateGet(this, _collisions).value = collisions;
|
|
367
|
+
},
|
|
368
|
+
() => {
|
|
369
|
+
const { dragOperation } = this.manager;
|
|
370
|
+
if (dragOperation.status.initialized) {
|
|
371
|
+
this.forceUpdate();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Forces an immediate update of collision detection.
|
|
378
|
+
*
|
|
379
|
+
* @param immediate - If true, updates collisions immediately. If false, resets previous coordinates.
|
|
380
|
+
*/
|
|
381
|
+
forceUpdate(immediate = true) {
|
|
382
|
+
signalsCore.untracked(() => {
|
|
383
|
+
if (immediate) {
|
|
384
|
+
__privateGet(this, _collisions).value = this.computeCollisions();
|
|
385
|
+
} else {
|
|
386
|
+
__privateSet(this, _previousCoordinates, void 0);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Computes collisions between draggable and droppable elements.
|
|
392
|
+
*
|
|
393
|
+
* @param entries - Optional array of droppable elements to check. If not provided, uses all registered droppables.
|
|
394
|
+
* @param collisionDetector - Optional custom collision detector function
|
|
395
|
+
* @returns Array of detected collisions, sorted by priority
|
|
396
|
+
*/
|
|
397
|
+
computeCollisions(entries, collisionDetector) {
|
|
398
|
+
const { registry, dragOperation } = this.manager;
|
|
399
|
+
const { source, shape, status } = dragOperation;
|
|
400
|
+
if (!status.initialized || !shape) {
|
|
401
|
+
return DEFAULT_VALUE;
|
|
402
|
+
}
|
|
403
|
+
const collisions = [];
|
|
404
|
+
const potentialTargets = [];
|
|
405
|
+
for (const entry of entries != null ? entries : registry.droppables) {
|
|
406
|
+
if (entry.disabled) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (source && !entry.accepts(source)) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
const detectCollision = collisionDetector != null ? collisionDetector : entry.collisionDetector;
|
|
413
|
+
if (!detectCollision) {
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
potentialTargets.push(entry);
|
|
417
|
+
void entry.shape;
|
|
418
|
+
const collision = signalsCore.untracked(
|
|
419
|
+
() => detectCollision({
|
|
420
|
+
droppable: entry,
|
|
421
|
+
dragOperation
|
|
422
|
+
})
|
|
423
|
+
);
|
|
424
|
+
if (collision) {
|
|
425
|
+
if (entry.collisionPriority != null) {
|
|
426
|
+
collision.priority = entry.collisionPriority;
|
|
427
|
+
}
|
|
428
|
+
collisions.push(collision);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (potentialTargets.length === 0) {
|
|
432
|
+
return DEFAULT_VALUE;
|
|
433
|
+
}
|
|
434
|
+
collisions.sort(sortCollisions);
|
|
435
|
+
return collisions;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Gets the current collisions signal value.
|
|
439
|
+
*/
|
|
440
|
+
get collisions() {
|
|
441
|
+
return __privateGet(this, _collisions).value;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
_previousCoordinates = new WeakMap();
|
|
445
|
+
_collisions = new WeakMap();
|
|
446
|
+
|
|
447
|
+
// src/core/manager/events.ts
|
|
448
|
+
var Monitor = class {
|
|
449
|
+
constructor() {
|
|
450
|
+
this.registry = /* @__PURE__ */ new Map();
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Adds an event listener for the specified event type.
|
|
454
|
+
*
|
|
455
|
+
* @param name - The name of the event to listen for
|
|
456
|
+
* @param handler - The function to call when the event occurs
|
|
457
|
+
* @returns A function to remove the event listener
|
|
458
|
+
*/
|
|
459
|
+
addEventListener(name, handler) {
|
|
460
|
+
const { registry } = this;
|
|
461
|
+
const listeners = new Set(registry.get(name));
|
|
462
|
+
listeners.add(handler);
|
|
463
|
+
registry.set(name, listeners);
|
|
464
|
+
return () => this.removeEventListener(name, handler);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Removes an event listener for the specified event type.
|
|
468
|
+
*
|
|
469
|
+
* @param name - The name of the event
|
|
470
|
+
* @param handler - The function to remove
|
|
471
|
+
*/
|
|
472
|
+
removeEventListener(name, handler) {
|
|
473
|
+
const { registry } = this;
|
|
474
|
+
const listeners = new Set(registry.get(name));
|
|
475
|
+
listeners.delete(handler);
|
|
476
|
+
registry.set(name, listeners);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Dispatches an event to all registered listeners.
|
|
480
|
+
*
|
|
481
|
+
* @param name - The name of the event to dispatch
|
|
482
|
+
* @param args - Arguments to pass to the event handlers
|
|
483
|
+
*/
|
|
484
|
+
dispatch(name, ...args) {
|
|
485
|
+
const { registry } = this;
|
|
486
|
+
const listeners = registry.get(name);
|
|
487
|
+
if (!listeners) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
for (const listener of listeners) {
|
|
491
|
+
listener(...args);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
var DragDropMonitor = class extends Monitor {
|
|
496
|
+
/**
|
|
497
|
+
* Creates a new drag and drop monitor.
|
|
498
|
+
*
|
|
499
|
+
* @param manager - The drag and drop manager to monitor
|
|
500
|
+
*/
|
|
501
|
+
constructor(manager) {
|
|
502
|
+
super();
|
|
503
|
+
this.manager = manager;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Dispatches a drag and drop event.
|
|
507
|
+
*
|
|
508
|
+
* @param type - The type of event to dispatch
|
|
509
|
+
* @param event - The event data to dispatch
|
|
510
|
+
*/
|
|
511
|
+
dispatch(type, event) {
|
|
512
|
+
const args = [event, this.manager];
|
|
513
|
+
super.dispatch(type, ...args);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
function defaultPreventable(event, cancelable = true) {
|
|
517
|
+
let defaultPrevented = false;
|
|
518
|
+
return __spreadProps(__spreadValues({}, event), {
|
|
519
|
+
cancelable,
|
|
520
|
+
get defaultPrevented() {
|
|
521
|
+
return defaultPrevented;
|
|
522
|
+
},
|
|
523
|
+
preventDefault() {
|
|
524
|
+
if (!cancelable) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
defaultPrevented = true;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// src/core/collision/notifier.ts
|
|
533
|
+
var CollisionNotifier = class extends CorePlugin {
|
|
534
|
+
constructor(manager) {
|
|
535
|
+
super(manager);
|
|
536
|
+
const isEqual = (a, b) => a.map(({ id }) => id).join("") === b.map(({ id }) => id).join("");
|
|
537
|
+
let previousCollisions = [];
|
|
538
|
+
this.destroy = index.effects(
|
|
539
|
+
() => {
|
|
540
|
+
const { dragOperation, collisionObserver } = manager;
|
|
541
|
+
if (dragOperation.status.initializing) {
|
|
542
|
+
previousCollisions = [];
|
|
543
|
+
collisionObserver.enable();
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
() => {
|
|
547
|
+
const { collisionObserver, monitor } = manager;
|
|
548
|
+
const { collisions } = collisionObserver;
|
|
549
|
+
if (collisionObserver.isDisabled()) {
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
const event = defaultPreventable({
|
|
553
|
+
collisions
|
|
554
|
+
});
|
|
555
|
+
monitor.dispatch("collision", event);
|
|
556
|
+
if (event.defaultPrevented) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (isEqual(collisions, previousCollisions)) {
|
|
560
|
+
return;
|
|
561
|
+
} else {
|
|
562
|
+
previousCollisions = collisions;
|
|
563
|
+
}
|
|
564
|
+
const [firstCollision] = collisions;
|
|
565
|
+
signalsCore.untracked(() => {
|
|
566
|
+
var _a;
|
|
567
|
+
if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a = manager.dragOperation.target) == null ? void 0 : _a.id)) {
|
|
568
|
+
collisionObserver.disable();
|
|
569
|
+
manager.actions.setDropTarget(firstCollision == null ? void 0 : firstCollision.id).then(() => {
|
|
570
|
+
collisionObserver.enable();
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
|
|
208
579
|
// src/core/collision/types.ts
|
|
209
580
|
var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
|
210
581
|
CollisionPriority2[CollisionPriority2["Lowest"] = 0] = "Lowest";
|
|
@@ -265,6 +636,227 @@ __decorateElement(_init2, 2, "initialized", _initialized_dec, Status);
|
|
|
265
636
|
__decorateElement(_init2, 2, "dragging", _dragging_dec, Status);
|
|
266
637
|
__decorateElement(_init2, 2, "dropped", _dropped_dec, Status);
|
|
267
638
|
__decoratorMetadata(_init2, Status);
|
|
639
|
+
|
|
640
|
+
// src/core/manager/actions.ts
|
|
641
|
+
var DragActions = class {
|
|
642
|
+
/**
|
|
643
|
+
* Creates a new instance of drag actions.
|
|
644
|
+
*
|
|
645
|
+
* @param manager - The drag and drop manager instance
|
|
646
|
+
*/
|
|
647
|
+
constructor(manager) {
|
|
648
|
+
this.manager = manager;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Sets the source of the drag operation.
|
|
652
|
+
*
|
|
653
|
+
* @param source - The draggable entity or its unique identifier
|
|
654
|
+
*/
|
|
655
|
+
setDragSource(source) {
|
|
656
|
+
const { dragOperation } = this.manager;
|
|
657
|
+
dragOperation.sourceIdentifier = typeof source === "string" || typeof source === "number" ? source : source.id;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Sets the target of the drop operation.
|
|
661
|
+
*
|
|
662
|
+
* @param identifier - The unique identifier of the droppable entity or null/undefined
|
|
663
|
+
* @returns A promise that resolves to true if the drop was prevented
|
|
664
|
+
*/
|
|
665
|
+
setDropTarget(identifier) {
|
|
666
|
+
return signalsCore.untracked(() => {
|
|
667
|
+
const { dragOperation } = this.manager;
|
|
668
|
+
const id = identifier != null ? identifier : null;
|
|
669
|
+
if (dragOperation.targetIdentifier === id) {
|
|
670
|
+
return Promise.resolve(false);
|
|
671
|
+
}
|
|
672
|
+
dragOperation.targetIdentifier = id;
|
|
673
|
+
const event = defaultPreventable({
|
|
674
|
+
operation: dragOperation.snapshot()
|
|
675
|
+
});
|
|
676
|
+
if (dragOperation.status.dragging) {
|
|
677
|
+
this.manager.monitor.dispatch("dragover", event);
|
|
678
|
+
}
|
|
679
|
+
return this.manager.renderer.rendering.then(() => event.defaultPrevented);
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Starts a new drag operation.
|
|
684
|
+
*
|
|
685
|
+
* @param args - Configuration for the drag operation
|
|
686
|
+
* @param args.event - The event that initiated the drag
|
|
687
|
+
* @param args.source - The source draggable entity or its identifier
|
|
688
|
+
* @param args.coordinates - The initial coordinates of the drag
|
|
689
|
+
* @returns true if the drag operation started successfully
|
|
690
|
+
* @throws {Error} If there is no drag source or another operation is active
|
|
691
|
+
*/
|
|
692
|
+
start(args) {
|
|
693
|
+
return signalsCore.untracked(() => {
|
|
694
|
+
const { dragOperation } = this.manager;
|
|
695
|
+
if (args.source != null) {
|
|
696
|
+
this.setDragSource(args.source);
|
|
697
|
+
}
|
|
698
|
+
const sourceInstance = dragOperation.source;
|
|
699
|
+
if (!sourceInstance) {
|
|
700
|
+
throw new Error("Cannot start a drag operation without a drag source");
|
|
701
|
+
}
|
|
702
|
+
if (!dragOperation.status.idle) {
|
|
703
|
+
throw new Error(
|
|
704
|
+
"Cannot start a drag operation while another is active"
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
const controller = new AbortController();
|
|
708
|
+
const { event: nativeEvent, coordinates } = args;
|
|
709
|
+
signalsCore.batch(() => {
|
|
710
|
+
dragOperation.status.set("initialization-pending" /* InitializationPending */);
|
|
711
|
+
dragOperation.shape = null;
|
|
712
|
+
dragOperation.canceled = false;
|
|
713
|
+
dragOperation.activatorEvent = nativeEvent != null ? nativeEvent : null;
|
|
714
|
+
dragOperation.position.reset(coordinates);
|
|
715
|
+
});
|
|
716
|
+
const beforeStartEvent = defaultPreventable({
|
|
717
|
+
operation: dragOperation.snapshot()
|
|
718
|
+
});
|
|
719
|
+
this.manager.monitor.dispatch("beforedragstart", beforeStartEvent);
|
|
720
|
+
if (beforeStartEvent.defaultPrevented) {
|
|
721
|
+
dragOperation.reset();
|
|
722
|
+
controller.abort();
|
|
723
|
+
return controller;
|
|
724
|
+
}
|
|
725
|
+
dragOperation.status.set("initializing" /* Initializing */);
|
|
726
|
+
dragOperation.controller = controller;
|
|
727
|
+
this.manager.renderer.rendering.then(() => {
|
|
728
|
+
if (controller.signal.aborted) return;
|
|
729
|
+
const { status } = dragOperation;
|
|
730
|
+
if (status.current !== "initializing" /* Initializing */) return;
|
|
731
|
+
dragOperation.status.set("dragging" /* Dragging */);
|
|
732
|
+
this.manager.monitor.dispatch("dragstart", {
|
|
733
|
+
nativeEvent,
|
|
734
|
+
operation: dragOperation.snapshot(),
|
|
735
|
+
cancelable: false
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
return controller;
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Moves the dragged entity to a new position.
|
|
743
|
+
*
|
|
744
|
+
* @param args - Configuration for the move operation
|
|
745
|
+
* @param args.by - Relative coordinates to move by
|
|
746
|
+
* @param args.to - Absolute coordinates to move to
|
|
747
|
+
* @param args.event - The event that triggered the move
|
|
748
|
+
* @param args.cancelable - Whether the move can be canceled
|
|
749
|
+
* @param args.propagate - Whether to dispatch dragmove events
|
|
750
|
+
*/
|
|
751
|
+
move(args) {
|
|
752
|
+
return signalsCore.untracked(() => {
|
|
753
|
+
var _a, _b;
|
|
754
|
+
const { dragOperation } = this.manager;
|
|
755
|
+
const { status, controller } = dragOperation;
|
|
756
|
+
if (!status.dragging || !controller || controller.signal.aborted) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
const event = defaultPreventable(
|
|
760
|
+
{
|
|
761
|
+
nativeEvent: args.event,
|
|
762
|
+
operation: dragOperation.snapshot(),
|
|
763
|
+
by: args.by,
|
|
764
|
+
to: args.to
|
|
765
|
+
},
|
|
766
|
+
(_a = args.cancelable) != null ? _a : true
|
|
767
|
+
);
|
|
768
|
+
if ((_b = args.propagate) != null ? _b : true) {
|
|
769
|
+
this.manager.monitor.dispatch("dragmove", event);
|
|
770
|
+
}
|
|
771
|
+
queueMicrotask(() => {
|
|
772
|
+
var _a2, _b2, _c3, _d, _e;
|
|
773
|
+
if (event.defaultPrevented) {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
const coordinates = (_e = args.to) != null ? _e : {
|
|
777
|
+
x: dragOperation.position.current.x + ((_b2 = (_a2 = args.by) == null ? void 0 : _a2.x) != null ? _b2 : 0),
|
|
778
|
+
y: dragOperation.position.current.y + ((_d = (_c3 = args.by) == null ? void 0 : _c3.y) != null ? _d : 0)
|
|
779
|
+
};
|
|
780
|
+
dragOperation.position.current = coordinates;
|
|
781
|
+
});
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Stops the current drag operation.
|
|
786
|
+
*
|
|
787
|
+
* @param args - Configuration for stopping the operation
|
|
788
|
+
* @param args.event - The event that triggered the stop
|
|
789
|
+
* @param args.canceled - Whether the operation was canceled
|
|
790
|
+
* @remarks
|
|
791
|
+
* This method:
|
|
792
|
+
* - Dispatches a dragend event
|
|
793
|
+
* - Allows suspension of the operation
|
|
794
|
+
* - Handles cleanup of the operation state
|
|
795
|
+
*/
|
|
796
|
+
stop(args = {}) {
|
|
797
|
+
return signalsCore.untracked(() => {
|
|
798
|
+
var _a, _b;
|
|
799
|
+
const { dragOperation } = this.manager;
|
|
800
|
+
const { controller } = dragOperation;
|
|
801
|
+
if (!controller || controller.signal.aborted) return;
|
|
802
|
+
let promise;
|
|
803
|
+
const suspend = () => {
|
|
804
|
+
const output = {
|
|
805
|
+
resume: () => {
|
|
806
|
+
},
|
|
807
|
+
abort: () => {
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
promise = new Promise((resolve, reject) => {
|
|
811
|
+
output.resume = resolve;
|
|
812
|
+
output.abort = reject;
|
|
813
|
+
});
|
|
814
|
+
return output;
|
|
815
|
+
};
|
|
816
|
+
controller.abort();
|
|
817
|
+
const end = () => {
|
|
818
|
+
this.manager.renderer.rendering.then(() => {
|
|
819
|
+
dragOperation.status.set("dropped" /* Dropped */);
|
|
820
|
+
const dropping = signalsCore.untracked(
|
|
821
|
+
() => {
|
|
822
|
+
var _a2;
|
|
823
|
+
return ((_a2 = dragOperation.source) == null ? void 0 : _a2.status) === "dropping";
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
const cleanup = () => {
|
|
827
|
+
if (dragOperation.controller === controller) {
|
|
828
|
+
dragOperation.controller = void 0;
|
|
829
|
+
}
|
|
830
|
+
dragOperation.reset();
|
|
831
|
+
};
|
|
832
|
+
if (dropping) {
|
|
833
|
+
const { source } = dragOperation;
|
|
834
|
+
const dispose = signalsCore.effect(() => {
|
|
835
|
+
if ((source == null ? void 0 : source.status) === "idle") {
|
|
836
|
+
dispose();
|
|
837
|
+
cleanup();
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
} else {
|
|
841
|
+
this.manager.renderer.rendering.then(cleanup);
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
dragOperation.canceled = (_a = args.canceled) != null ? _a : false;
|
|
846
|
+
this.manager.monitor.dispatch("dragend", {
|
|
847
|
+
nativeEvent: args.event,
|
|
848
|
+
operation: dragOperation.snapshot(),
|
|
849
|
+
canceled: (_b = args.canceled) != null ? _b : false,
|
|
850
|
+
suspend
|
|
851
|
+
});
|
|
852
|
+
if (promise) {
|
|
853
|
+
promise.then(end).catch(() => dragOperation.reset());
|
|
854
|
+
} else {
|
|
855
|
+
end();
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
};
|
|
268
860
|
var _disabled_dec2, _data_dec, _id_dec, _manager_dec, _init3, _manager, _id, _data, _disabled2;
|
|
269
861
|
_manager_dec = [index.reactive], _id_dec = [index.reactive], _data_dec = [index.reactive], _disabled_dec2 = [index.reactive];
|
|
270
862
|
var Entity = class {
|
|
@@ -341,6 +933,89 @@ __decorateElement(_init3, 4, "id", _id_dec, Entity, _id);
|
|
|
341
933
|
__decorateElement(_init3, 4, "data", _data_dec, Entity, _data);
|
|
342
934
|
__decorateElement(_init3, 4, "disabled", _disabled_dec2, Entity, _disabled2);
|
|
343
935
|
__decoratorMetadata(_init3, Entity);
|
|
936
|
+
var EntityRegistry = class {
|
|
937
|
+
constructor() {
|
|
938
|
+
this.map = signalsCore.signal(/* @__PURE__ */ new Map());
|
|
939
|
+
this.cleanupFunctions = /* @__PURE__ */ new WeakMap();
|
|
940
|
+
/**
|
|
941
|
+
* Registers a entity in the registry.
|
|
942
|
+
* @param key - The unique identifier of the entity.
|
|
943
|
+
* @param value - The entity to register.
|
|
944
|
+
* @returns A function that unregisters the entity.
|
|
945
|
+
*/
|
|
946
|
+
this.register = (key, value) => {
|
|
947
|
+
const current = this.map.peek();
|
|
948
|
+
const currentValue = current.get(key);
|
|
949
|
+
const unregister = () => this.unregister(key, value);
|
|
950
|
+
if (currentValue === value) return unregister;
|
|
951
|
+
if (currentValue) {
|
|
952
|
+
const cleanup2 = this.cleanupFunctions.get(currentValue);
|
|
953
|
+
cleanup2 == null ? void 0 : cleanup2();
|
|
954
|
+
this.cleanupFunctions.delete(currentValue);
|
|
955
|
+
}
|
|
956
|
+
const updatedMap = new Map(current);
|
|
957
|
+
updatedMap.set(key, value);
|
|
958
|
+
this.map.value = updatedMap;
|
|
959
|
+
const cleanup = index.effects(...value.effects());
|
|
960
|
+
this.cleanupFunctions.set(value, cleanup);
|
|
961
|
+
return unregister;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* Unregisters an entity from the registry.
|
|
965
|
+
* @param key - The unique identifier of the entity.
|
|
966
|
+
* @param value - The entity instance to unregister.
|
|
967
|
+
*/
|
|
968
|
+
this.unregister = (key, value) => {
|
|
969
|
+
const current = this.map.peek();
|
|
970
|
+
if (current.get(key) !== value) {
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
const cleanup = this.cleanupFunctions.get(value);
|
|
974
|
+
cleanup == null ? void 0 : cleanup();
|
|
975
|
+
this.cleanupFunctions.delete(value);
|
|
976
|
+
const updatedMap = new Map(current);
|
|
977
|
+
updatedMap.delete(key);
|
|
978
|
+
this.map.value = updatedMap;
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Iterator for the EntityRegistry class.
|
|
983
|
+
* @returns An iterator for the values in the map.
|
|
984
|
+
*/
|
|
985
|
+
[Symbol.iterator]() {
|
|
986
|
+
return this.map.peek().values();
|
|
987
|
+
}
|
|
988
|
+
get value() {
|
|
989
|
+
return this.map.value.values();
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Checks if a entity with the given identifier exists in the registry.
|
|
993
|
+
* @param identifier - The unique identifier of the entity.
|
|
994
|
+
* @returns True if the entity exists, false otherwise.
|
|
995
|
+
*/
|
|
996
|
+
has(identifier) {
|
|
997
|
+
return this.map.value.has(identifier);
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Retrieves a entity from the registry using its identifier.
|
|
1001
|
+
* @param identifier - The unique identifier of the entity.
|
|
1002
|
+
* @returns The entity if it exists, undefined otherwise.
|
|
1003
|
+
*/
|
|
1004
|
+
get(identifier) {
|
|
1005
|
+
return this.map.value.get(identifier);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Destroys all entries in the registry and clears the registry.
|
|
1009
|
+
*/
|
|
1010
|
+
destroy() {
|
|
1011
|
+
for (const entry of this) {
|
|
1012
|
+
const cleanup = this.cleanupFunctions.get(entry);
|
|
1013
|
+
cleanup == null ? void 0 : cleanup();
|
|
1014
|
+
entry.destroy();
|
|
1015
|
+
}
|
|
1016
|
+
this.map.value = /* @__PURE__ */ new Map();
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
344
1019
|
var _isDragSource_dec, _isDragging_dec, _isDropping_dec, _status_dec, _modifiers_dec, _type_dec, _c, _init4, _type, _modifiers, _status;
|
|
345
1020
|
var Draggable$1 = class Draggable extends (_c = Entity, _type_dec = [index.reactive], _modifiers_dec = [index.reactive], _status_dec = [index.reactive], _isDropping_dec = [index.derived], _isDragging_dec = [index.derived], _isDragSource_dec = [index.derived], _c) {
|
|
346
1021
|
constructor(_a, manager) {
|
|
@@ -476,6 +1151,80 @@ var Modifier = class extends Plugin {
|
|
|
476
1151
|
return operation.transform;
|
|
477
1152
|
}
|
|
478
1153
|
};
|
|
1154
|
+
|
|
1155
|
+
// src/core/manager/registry.ts
|
|
1156
|
+
var DragDropRegistry = class {
|
|
1157
|
+
/**
|
|
1158
|
+
* Creates a new registry instance.
|
|
1159
|
+
*
|
|
1160
|
+
* @param manager - The drag and drop manager that owns this registry
|
|
1161
|
+
*/
|
|
1162
|
+
constructor(manager) {
|
|
1163
|
+
/** Registry for draggable entities */
|
|
1164
|
+
this.draggables = new EntityRegistry();
|
|
1165
|
+
/** Registry for droppable entities */
|
|
1166
|
+
this.droppables = new EntityRegistry();
|
|
1167
|
+
this.plugins = new PluginRegistry(manager);
|
|
1168
|
+
this.sensors = new PluginRegistry(manager);
|
|
1169
|
+
this.modifiers = new PluginRegistry(manager);
|
|
1170
|
+
}
|
|
1171
|
+
register(input, options) {
|
|
1172
|
+
if (input instanceof Draggable$1) {
|
|
1173
|
+
return this.draggables.register(input.id, input);
|
|
1174
|
+
}
|
|
1175
|
+
if (input instanceof Droppable$1) {
|
|
1176
|
+
return this.droppables.register(input.id, input);
|
|
1177
|
+
}
|
|
1178
|
+
if (input.prototype instanceof Modifier) {
|
|
1179
|
+
return this.modifiers.register(input, options);
|
|
1180
|
+
}
|
|
1181
|
+
if (input.prototype instanceof Sensor) {
|
|
1182
|
+
return this.sensors.register(input, options);
|
|
1183
|
+
}
|
|
1184
|
+
if (input.prototype instanceof Plugin) {
|
|
1185
|
+
return this.plugins.register(input, options);
|
|
1186
|
+
}
|
|
1187
|
+
throw new Error("Invalid instance type");
|
|
1188
|
+
}
|
|
1189
|
+
unregister(input) {
|
|
1190
|
+
if (input instanceof Entity) {
|
|
1191
|
+
if (input instanceof Draggable$1) {
|
|
1192
|
+
return this.draggables.unregister(input.id, input);
|
|
1193
|
+
}
|
|
1194
|
+
if (input instanceof Droppable$1) {
|
|
1195
|
+
return this.droppables.unregister(input.id, input);
|
|
1196
|
+
}
|
|
1197
|
+
return () => {
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
if (input.prototype instanceof Modifier) {
|
|
1201
|
+
return this.modifiers.unregister(input);
|
|
1202
|
+
}
|
|
1203
|
+
if (input.prototype instanceof Sensor) {
|
|
1204
|
+
return this.sensors.unregister(input);
|
|
1205
|
+
}
|
|
1206
|
+
if (input.prototype instanceof Plugin) {
|
|
1207
|
+
return this.plugins.unregister(input);
|
|
1208
|
+
}
|
|
1209
|
+
throw new Error("Invalid instance type");
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Destroys all registered entities and cleans up resources.
|
|
1213
|
+
*
|
|
1214
|
+
* @remarks
|
|
1215
|
+
* This method:
|
|
1216
|
+
* - Destroys all draggable and droppable entities
|
|
1217
|
+
* - Destroys all plugins, sensors, and modifiers
|
|
1218
|
+
* - Cleans up any associated resources
|
|
1219
|
+
*/
|
|
1220
|
+
destroy() {
|
|
1221
|
+
this.draggables.destroy();
|
|
1222
|
+
this.droppables.destroy();
|
|
1223
|
+
this.plugins.destroy();
|
|
1224
|
+
this.sensors.destroy();
|
|
1225
|
+
this.modifiers.destroy();
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
479
1228
|
var _transform_dec, _target_dec, _source_dec, _modifiers_dec2, _targetIdentifier_dec, _sourceIdentifier_dec, _activatorEvent_dec, _canceled_dec, _shape_dec2, _manager2, _previousSource, _shape2, _init6, _canceled, _activatorEvent, _sourceIdentifier, _targetIdentifier, _modifiers2, _transform;
|
|
480
1229
|
_shape_dec2 = [index.derived], _canceled_dec = [index.reactive], _activatorEvent_dec = [index.reactive], _sourceIdentifier_dec = [index.reactive], _targetIdentifier_dec = [index.reactive], _modifiers_dec2 = [index.reactive], _source_dec = [index.derived], _target_dec = [index.derived], _transform_dec = [index.derived];
|
|
481
1230
|
var DragOperation = class {
|
|
@@ -610,16 +1359,130 @@ __decorateElement(_init6, 2, "target", _target_dec, DragOperation);
|
|
|
610
1359
|
__decorateElement(_init6, 2, "transform", _transform_dec, DragOperation);
|
|
611
1360
|
__decoratorMetadata(_init6, DragOperation);
|
|
612
1361
|
|
|
1362
|
+
// src/core/manager/renderer.ts
|
|
1363
|
+
var defaultRenderer = {
|
|
1364
|
+
get rendering() {
|
|
1365
|
+
return Promise.resolve();
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
|
|
1369
|
+
// src/core/manager/manager.ts
|
|
1370
|
+
var DragDropManager$1 = class DragDropManager {
|
|
1371
|
+
/**
|
|
1372
|
+
* Creates a new drag and drop manager instance.
|
|
1373
|
+
*
|
|
1374
|
+
* @param config - Optional configuration for plugins, sensors, modifiers, and renderer
|
|
1375
|
+
*/
|
|
1376
|
+
constructor(config) {
|
|
1377
|
+
/**
|
|
1378
|
+
* Cleans up resources and stops any active drag operations.
|
|
1379
|
+
*/
|
|
1380
|
+
this.destroy = () => {
|
|
1381
|
+
if (!this.dragOperation.status.idle) {
|
|
1382
|
+
this.actions.stop({ canceled: true });
|
|
1383
|
+
}
|
|
1384
|
+
this.dragOperation.modifiers.forEach((modifier) => modifier.destroy());
|
|
1385
|
+
this.registry.destroy();
|
|
1386
|
+
this.collisionObserver.destroy();
|
|
1387
|
+
};
|
|
1388
|
+
const {
|
|
1389
|
+
plugins = [],
|
|
1390
|
+
sensors = [],
|
|
1391
|
+
modifiers = [],
|
|
1392
|
+
renderer = defaultRenderer
|
|
1393
|
+
} = config != null ? config : {};
|
|
1394
|
+
const monitor = new DragDropMonitor(this);
|
|
1395
|
+
const registry = new DragDropRegistry(this);
|
|
1396
|
+
this.registry = registry;
|
|
1397
|
+
this.monitor = monitor;
|
|
1398
|
+
this.renderer = renderer;
|
|
1399
|
+
this.actions = new DragActions(this);
|
|
1400
|
+
this.dragOperation = new DragOperation(this);
|
|
1401
|
+
this.collisionObserver = new CollisionObserver(this);
|
|
1402
|
+
this.plugins = [CollisionNotifier, ...plugins];
|
|
1403
|
+
this.modifiers = modifiers;
|
|
1404
|
+
this.sensors = sensors;
|
|
1405
|
+
const { destroy } = this;
|
|
1406
|
+
const cleanup = index.effects(() => {
|
|
1407
|
+
var _a, _b, _c3;
|
|
1408
|
+
const currentModifiers = signalsCore.untracked(() => this.dragOperation.modifiers);
|
|
1409
|
+
const managerModifiers = this.modifiers;
|
|
1410
|
+
if (currentModifiers !== managerModifiers) {
|
|
1411
|
+
currentModifiers.forEach((modifier) => modifier.destroy());
|
|
1412
|
+
}
|
|
1413
|
+
this.dragOperation.modifiers = (_c3 = (_b = (_a = this.dragOperation.source) == null ? void 0 : _a.modifiers) == null ? void 0 : _b.map((modifier) => {
|
|
1414
|
+
const { plugin, options } = descriptor(modifier);
|
|
1415
|
+
return new plugin(this, options);
|
|
1416
|
+
})) != null ? _c3 : managerModifiers;
|
|
1417
|
+
});
|
|
1418
|
+
this.destroy = () => {
|
|
1419
|
+
cleanup();
|
|
1420
|
+
destroy();
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Gets the list of active plugins.
|
|
1425
|
+
*
|
|
1426
|
+
* @returns Array of active plugin instances
|
|
1427
|
+
*/
|
|
1428
|
+
get plugins() {
|
|
1429
|
+
return this.registry.plugins.values;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Sets the list of plugins to be used by the manager.
|
|
1433
|
+
*
|
|
1434
|
+
* @param plugins - Array of plugin constructors or instances
|
|
1435
|
+
*/
|
|
1436
|
+
set plugins(plugins) {
|
|
1437
|
+
this.registry.plugins.values = plugins;
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Gets the list of active modifiers.
|
|
1441
|
+
*
|
|
1442
|
+
* @returns Array of active modifier instances
|
|
1443
|
+
*/
|
|
1444
|
+
get modifiers() {
|
|
1445
|
+
return this.registry.modifiers.values;
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Sets the list of modifiers to be used by the manager.
|
|
1449
|
+
*
|
|
1450
|
+
* @param modifiers - Array of modifier constructors or instances
|
|
1451
|
+
*/
|
|
1452
|
+
set modifiers(modifiers) {
|
|
1453
|
+
this.registry.modifiers.values = modifiers;
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Gets the list of active sensors.
|
|
1457
|
+
*
|
|
1458
|
+
* @returns Array of active sensor instances
|
|
1459
|
+
*/
|
|
1460
|
+
get sensors() {
|
|
1461
|
+
return this.registry.sensors.values;
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Sets the list of sensors to be used by the manager.
|
|
1465
|
+
*
|
|
1466
|
+
* @param sensors - Array of sensor constructors or instances
|
|
1467
|
+
*/
|
|
1468
|
+
set sensors(sensors) {
|
|
1469
|
+
this.registry.sensors.values = sensors;
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
|
|
613
1473
|
exports.CollisionPriority = CollisionPriority;
|
|
614
1474
|
exports.CollisionType = CollisionType;
|
|
615
1475
|
exports.CorePlugin = CorePlugin;
|
|
1476
|
+
exports.DragDropManager = DragDropManager$1;
|
|
616
1477
|
exports.DragOperationStatus = Status;
|
|
617
1478
|
exports.Draggable = Draggable$1;
|
|
618
1479
|
exports.Droppable = Droppable$1;
|
|
619
1480
|
exports.Modifier = Modifier;
|
|
620
1481
|
exports.Plugin = Plugin;
|
|
1482
|
+
exports.PluginRegistry = PluginRegistry;
|
|
621
1483
|
exports.Sensor = Sensor;
|
|
622
1484
|
exports.configurator = configurator;
|
|
623
1485
|
exports.configure = configure;
|
|
624
1486
|
exports.descriptor = descriptor;
|
|
1487
|
+
exports.sortCollisions = sortCollisions;
|
|
625
1488
|
//# sourceMappingURL=index.js.map
|