dragselect 2.4.3 → 2.5.0

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +103 -27
  3. package/deploying.md +1 -1
  4. package/dist/DragSelect.d.ts +26 -4
  5. package/dist/DragSelect.es6m.js +882 -792
  6. package/dist/DragSelect.js +882 -792
  7. package/dist/ds.es6m.min.js +1 -1
  8. package/dist/ds.min.js +1 -1
  9. package/dist/methods/addModificationObservers.d.ts +9 -1
  10. package/dist/methods/getAllParentNodes.d.ts +3 -0
  11. package/dist/methods/getPointerPos.d.ts +1 -1
  12. package/dist/methods/index.d.ts +1 -0
  13. package/dist/methods/isCollision.d.ts +1 -1
  14. package/dist/methods/subscriberAliases.d.ts +3 -1
  15. package/dist/modules/Area.d.ts +2 -12
  16. package/dist/modules/DropZone.d.ts +88 -0
  17. package/dist/modules/DropZones.d.ts +76 -0
  18. package/dist/modules/Interaction.d.ts +1 -0
  19. package/dist/modules/SelectableSet.d.ts +12 -0
  20. package/dist/modules/Selection.d.ts +1 -0
  21. package/dist/modules/Selector.d.ts +1 -1
  22. package/dist/modules/SelectorArea.d.ts +1 -1
  23. package/dist/modules/index.d.ts +1 -0
  24. package/dist/stores/KeyStore.d.ts +2 -2
  25. package/dist/stores/PointerStore.d.ts +2 -1
  26. package/dist/types.d.ts +78 -4
  27. package/jest-puppeteer.config.js +1 -0
  28. package/package.json +10 -9
  29. package/rollup.config.js +1 -1
  30. package/src/DragSelect.js +29 -5
  31. package/src/methods/addModificationObservers.js +26 -5
  32. package/src/methods/canScroll.js +1 -1
  33. package/src/methods/getAllParentNodes.js +18 -0
  34. package/src/methods/getPointerPos.js +1 -1
  35. package/src/methods/handleElementPositionAttribute.js +1 -1
  36. package/src/methods/hydrateSettings.js +17 -0
  37. package/src/methods/index.js +1 -0
  38. package/src/methods/isCollision.js +24 -5
  39. package/src/methods/scrollElement.js +1 -1
  40. package/src/methods/subscriberAliases.js +16 -5
  41. package/src/methods/toArray.js +3 -2
  42. package/src/modules/Area.js +12 -44
  43. package/src/modules/DropZone.js +224 -0
  44. package/src/modules/DropZones.js +153 -0
  45. package/src/modules/Interaction.js +32 -7
  46. package/src/modules/SelectableSet.js +45 -8
  47. package/src/modules/Selection.js +9 -11
  48. package/src/modules/index.js +1 -0
  49. package/src/stores/KeyStore.js +1 -1
  50. package/src/stores/PointerStore.js +17 -3
  51. package/src/stores/SettingsStore.js +0 -1
  52. package/src/types.js +33 -4
@@ -15,6 +15,7 @@ export default class Interaction {
15
15
  */
16
16
  constructor({ DS }) {
17
17
  this.DS = DS
18
+ this.Settings = DS.stores.SettingsStore.s
18
19
  // @ts-ignore: @todo: update to typescript
19
20
  this.DS.subscribe('Settings:updated:area', this.init)
20
21
  this.DS.subscribe('PointerStore:updated', this.update)
@@ -31,7 +32,14 @@ export default class Interaction {
31
32
  init = () => this.DS.publish('Interaction:init:pre', {})
32
33
  _init = () => {
33
34
  this.stop()
34
- this.DS.Area.HTMLNode.addEventListener('mousedown', this.start)
35
+
36
+ // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
37
+ if (this.Settings.usePointerEvents)
38
+ this.DS.Area.HTMLNode.addEventListener('pointerdown', this.start, {
39
+ passive: false,
40
+ })
41
+ else this.DS.Area.HTMLNode.addEventListener('mousedown', this.start)
42
+
35
43
  this.DS.Area.HTMLNode.addEventListener('touchstart', this.start, {
36
44
  passive: false,
37
45
  })
@@ -79,7 +87,12 @@ export default class Interaction {
79
87
 
80
88
  this.DS.publish('Interaction:start', { event, isDragging: this.isDragging })
81
89
 
82
- document.addEventListener('mouseup', this.reset)
90
+ // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
91
+ if (this.Settings.usePointerEvents) {
92
+ document.addEventListener('pointerup', this.reset)
93
+ document.addEventListener('pointercancel', this.reset)
94
+ } else document.addEventListener('mouseup', this.reset)
95
+
83
96
  document.addEventListener('touchend', this.reset)
84
97
  }
85
98
 
@@ -90,17 +103,17 @@ export default class Interaction {
90
103
  */
91
104
  isDragEvent = (event) => {
92
105
  const clickedElement = /** @type {Element} */ (event.target).closest(
93
- `.${this.DS.stores.SettingsStore.s.selectableClass}`
106
+ `.${this.Settings.selectableClass}`
94
107
  )
95
108
 
96
109
  if (
97
- !this.DS.stores.SettingsStore.s.draggability ||
110
+ !this.Settings.draggability ||
98
111
  this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) ||
99
112
  !clickedElement
100
113
  )
101
114
  return false
102
115
 
103
- if (this.DS.stores.SettingsStore.s.immediateDrag) {
116
+ if (this.Settings.immediateDrag) {
104
117
  if (!this.DS.SelectedSet.size)
105
118
  this.DS.SelectedSet.add(/** @type {DSElement} */ (clickedElement))
106
119
  else if (!this.DS.SelectedSet.has(clickedElement)) {
@@ -144,12 +157,24 @@ export default class Interaction {
144
157
  stop = () => {
145
158
  this.isInteracting = false
146
159
  this.isDragging = false
147
- this.DS.Area.HTMLNode.removeEventListener('mousedown', this.start)
160
+
161
+ // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
162
+ if (this.Settings.usePointerEvents) {
163
+ this.DS.Area.HTMLNode.removeEventListener('pointerdown', this.start, {
164
+ // @ts-ignore
165
+ passive: false,
166
+ })
167
+ document.removeEventListener('pointerup', this.reset)
168
+ document.removeEventListener('pointercancel', this.reset)
169
+ } else {
170
+ this.DS.Area.HTMLNode.removeEventListener('mousedown', this.start)
171
+ document.removeEventListener('mouseup', this.reset)
172
+ }
173
+
148
174
  this.DS.Area.HTMLNode.removeEventListener('touchstart', this.start, {
149
175
  // @ts-ignore
150
176
  passive: false,
151
177
  })
152
- document.removeEventListener('mouseup', this.reset)
153
178
  document.removeEventListener('touchend', this.reset)
154
179
  }
155
180
 
@@ -5,6 +5,16 @@ import DragSelect from '../DragSelect'
5
5
  import { toArray, handleElementPositionAttribute } from '../methods'
6
6
 
7
7
  export default class SelectableSet extends Set {
8
+ /**
9
+ * @type {Map<DSElement,DSBoundingRect>}
10
+ * @private
11
+ */
12
+ _rects
13
+ /**
14
+ * @type {NodeJS.Timeout}
15
+ * @private
16
+ */
17
+ _timeout
8
18
  /**
9
19
  * @constructor SelectableSet
10
20
  * @param {{DS:DragSelect}} obj
@@ -13,6 +23,7 @@ export default class SelectableSet extends Set {
13
23
  constructor({ DS }) {
14
24
  super()
15
25
  this.DS = DS
26
+ this.Settings = DS.stores.SettingsStore.s
16
27
  this.DS.subscribe('Interaction:init', this.init)
17
28
  // @ts-ignore: @todo: update to typescript
18
29
  this.DS.PubSub.subscribe('Settings:updated:selectables', () => {
@@ -29,7 +40,7 @@ export default class SelectableSet extends Set {
29
40
  }
30
41
 
31
42
  init = () =>
32
- toArray(this.DS.stores.SettingsStore.s.selectables).forEach((el) =>
43
+ toArray(this.Settings.selectables).forEach((el) =>
33
44
  this.add(el)
34
45
  )
35
46
 
@@ -41,17 +52,24 @@ export default class SelectableSet extends Set {
41
52
  item: element,
42
53
  }
43
54
  this.DS.publish('Selectable:added:pre', publishData)
44
- element.classList.add(this.DS.stores.SettingsStore.s.selectableClass)
55
+ element.classList.add(this.Settings.selectableClass)
45
56
  element.addEventListener('click', this._onClick)
46
- element.addEventListener('mousedown', this._onPointer)
57
+
58
+ if (this.Settings.usePointerEvents)
59
+ element.addEventListener('pointerdown', this._onPointer, {
60
+ // @ts-ignore
61
+ passive: false,
62
+ })
63
+ else element.addEventListener('mousedown', this._onPointer)
64
+
47
65
  element.addEventListener('touchstart', this._onPointer, {
48
66
  // @ts-ignore
49
67
  passive: false,
50
68
  })
51
69
 
52
70
  if (
53
- this.DS.stores.SettingsStore.s.draggability &&
54
- !this.DS.stores.SettingsStore.s.useTransform
71
+ this.Settings.draggability &&
72
+ !this.Settings.useTransform
55
73
  )
56
74
  handleElementPositionAttribute({
57
75
  computedStyle: window.getComputedStyle(element),
@@ -70,10 +88,17 @@ export default class SelectableSet extends Set {
70
88
  item: element,
71
89
  }
72
90
  this.DS.publish('Selectable:removed:pre', publishData)
73
- element.classList.remove(this.DS.stores.SettingsStore.s.selectableClass)
74
- element.classList.remove(this.DS.stores.SettingsStore.s.hoverClass)
91
+ element.classList.remove(this.Settings.selectableClass)
92
+ element.classList.remove(this.Settings.hoverClass)
75
93
  element.removeEventListener('click', this._onClick)
76
- element.removeEventListener('mousedown', this._onPointer)
94
+
95
+ if (this.Settings.usePointerEvents)
96
+ element.removeEventListener('pointerdown', this._onPointer, {
97
+ // @ts-ignore
98
+ passive: false,
99
+ })
100
+ else element.removeEventListener('mousedown', this._onPointer)
101
+
77
102
  element.removeEventListener('touchstart', this._onPointer, {
78
103
  // @ts-ignore
79
104
  passive: false,
@@ -97,4 +122,16 @@ export default class SelectableSet extends Set {
97
122
  get elements() {
98
123
  return Array.from(this.values())
99
124
  }
125
+
126
+ get rects() {
127
+ if (this._rects) return this._rects
128
+ this._rects = new Map()
129
+ this.forEach((element) => this._rects.set(element, element.getBoundingClientRect()))
130
+
131
+ // since elements can be moved, we need to update the rects every X ms
132
+ if (this._timeout) clearTimeout(this._timeout)
133
+ this._timeout = setTimeout(() => this._rects = null, this.Settings.refreshMemoryRate)
134
+
135
+ return this._rects
136
+ }
100
137
  }
@@ -18,6 +18,7 @@ export default class Selection {
18
18
  */
19
19
  constructor({ DS }) {
20
20
  this.DS = DS
21
+ this.Settings = this.DS.stores.SettingsStore.s
21
22
  this.DS.subscribe('Interaction:start', this.start)
22
23
  this.DS.subscribe('Interaction:update', this.update)
23
24
  }
@@ -60,23 +61,20 @@ export default class Selection {
60
61
  const { SelectableSet, SelectorArea, Selector } = this.DS
61
62
 
62
63
  /** @type {any} */
63
- const elPosCombo = SelectableSet.elements.map((element) => {
64
- return [element, element.getBoundingClientRect()]
65
- })
64
+ const elRects = SelectableSet.rects
66
65
 
67
66
  const select = []
68
67
  const unselect = []
69
68
 
70
- for (let i = 0, il = elPosCombo.length; i < il; i++) {
71
- if (!SelectorArea.isInside(elPosCombo[i][0], elPosCombo[i][1])) continue
72
- if (isCollision(elPosCombo[i][1], Selector.rect))
73
- select.push(elPosCombo[i][0])
74
- else unselect.push(elPosCombo[i][0])
69
+ for(const [element, rect] of elRects) {
70
+ if (!SelectorArea.isInside(element, rect)) continue
71
+ if (isCollision(rect, Selector.rect, this.Settings.selectionThreshold)) select.push(element)
72
+ else unselect.push(element)
75
73
  }
76
74
 
77
75
  const multiSelectionToggle =
78
76
  (this.DS.stores.KeyStore.isMultiSelectKeyPressed(event)) &&
79
- this.DS.stores.SettingsStore.s.multiSelectToggling
77
+ this.Settings.multiSelectToggling
80
78
 
81
79
  if (this.DS.continue) return
82
80
  select.forEach((element) =>
@@ -85,7 +83,7 @@ export default class Selection {
85
83
  force,
86
84
  multiSelectionToggle,
87
85
  SelectedSet: this.DS.SelectedSet,
88
- hoverClassName: this.DS.stores.SettingsStore.s.hoverClass,
86
+ hoverClassName: this.Settings.hoverClass,
89
87
  })
90
88
  )
91
89
  unselect.forEach((element) =>
@@ -93,7 +91,7 @@ export default class Selection {
93
91
  element,
94
92
  force,
95
93
  SelectedSet: this.DS.SelectedSet,
96
- hoverClassName: this.DS.stores.SettingsStore.s.hoverClass,
94
+ hoverClassName: this.Settings.hoverClass,
97
95
  PrevSelectedSet: this._prevSelectedSet,
98
96
  })
99
97
  )
@@ -1,5 +1,6 @@
1
1
  export { default as Area } from './Area'
2
2
  export { default as Drag } from './Drag'
3
+ export { default as DropZones } from './DropZones'
3
4
  export { default as Interaction } from './Interaction'
4
5
  export { default as PubSub } from './PubSub'
5
6
  export { default as SelectableSet } from './SelectableSet'
@@ -60,7 +60,7 @@ export default class KeyStore {
60
60
 
61
61
  reset = () => this._currentValues.clear()
62
62
 
63
- /** @param {KeyboardEvent|MouseEvent|TouchEvent} [event] */
63
+ /** @param {KeyboardEvent|MouseEvent|PointerEvent|TouchEvent} [event] */
64
64
  isMultiSelectKeyPressed(event) {
65
65
  if(this.DS.stores.SettingsStore.s.multiSelectMode) return true
66
66
  const multiSelectKeys = this.DS.stores.SettingsStore.s.multiSelectKeys.map(
@@ -53,13 +53,20 @@ export default class PointerStore {
53
53
  */
54
54
  constructor({ DS }) {
55
55
  this.DS = DS
56
+ this.Settings = DS.stores.SettingsStore.s
56
57
  this.DS.subscribe('Interaction:init', this.init)
57
58
  this.DS.subscribe('Interaction:start', ({ event }) => this.start(event))
58
59
  this.DS.subscribe('Interaction:end', ({ event }) => this.reset(event))
59
60
  }
60
61
 
61
62
  init = () => {
62
- document.addEventListener('mousemove', this.update)
63
+ if (this.Settings.usePointerEvents)
64
+ document.addEventListener('pointermove', this.update, {
65
+ // @ts-ignore
66
+ passive: false,
67
+ })
68
+ else document.addEventListener('mousemove', this.update)
69
+
63
70
  document.addEventListener('touchmove', this.update, {
64
71
  // @ts-ignore
65
72
  passive: false,
@@ -89,7 +96,14 @@ export default class PointerStore {
89
96
  }
90
97
 
91
98
  stop = () => {
92
- document.removeEventListener('mousemove', this.update)
99
+ // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
100
+ if (this.Settings.usePointerEvents)
101
+ document.removeEventListener('pointermove', this.update, {
102
+ // @ts-ignore
103
+ passive: false,
104
+ })
105
+ else document.removeEventListener('mousemove', this.update)
106
+
93
107
  document.removeEventListener('touchmove', this.update, {
94
108
  // @ts-ignore
95
109
  passive: false,
@@ -110,7 +124,7 @@ export default class PointerStore {
110
124
 
111
125
  /**
112
126
  * @param {DSEvent} event
113
- * @return {MouseEvent|Touch}
127
+ * @return {MouseEvent|PointerEvent|Touch}
114
128
  * @private
115
129
  */
116
130
  _normalizedEvent(event) {
@@ -10,7 +10,6 @@ export default class SettingsStore {
10
10
  * @private
11
11
  * */
12
12
  _settings = {}
13
-
14
13
  /**
15
14
  * Holds the settings and their previous value `:pre`
16
15
  * @example {
package/src/types.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The Settings to be passed to the Class
3
3
  * @typedef {Object} Settings
4
- * @property {HTMLElement|SVGElement|HTMLDocument} [area=document] area in which you can drag. If not provided it will be the whole document
4
+ * @property {HTMLElement|SVGElement|Document} [area=document] area in which you can drag. If not provided it will be the whole document
5
5
  * @property {DSInputElements} [selectables=[]] the elements that can be selected
6
6
  * @property {number} [autoScrollSpeed=5] Speed in which the area scrolls while selecting (if available). Unit is pixel per movement.
7
7
  * @property {Vect2} [overflowTolerance={x:25,y:25}] Tolerance for autoScroll (how close one has to be near an edges for autoScroll to start)
@@ -11,24 +11,37 @@
11
11
  * @property {boolean} [multiSelectToggling=true] Whether or not to toggle already active elements while multi-selecting
12
12
  * @property {DSMultiSelectKeys} [multiSelectKeys=['Control', 'Shift', 'Meta']] Keys that allows switching to the multi-select mode (see the multiSelectMode option). Any key value is possible ([see MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)). Note that the best support is given for <kbd>Control</kbd>, <kbd>Shift</kbd> and <kbd>Meta</kbd>. Provide an empty array `[]` if you want to turn off the functionality.
13
13
  * @property {HTMLElement} [selector=HTMLElement] the square that will draw the selection
14
+ * @property {number} [selectionThreshold=0] how much % of the element has to be selected to be considered selected (0 = just touching, 1 = inside the selection)
14
15
  * @property {boolean} [draggability=true] When a user is dragging on an already selected element, the selection is dragged.
15
16
  * @property {boolean} [immediateDrag=true] Whether an element is draggable from the start or needs to be selected first
16
17
  * @property {boolean} [keyboardDrag=true] Whether or not the user can drag with the keyboard (we don't recommend disabling it)
17
18
  * @property {DSDragKeys} [dragKeys={up:['ArrowUp'],down:['ArrowDown'],left:['ArrowLeft'],righ:['ArrowRight']}] The keys available to drag element using the keyboard.
18
19
  * @property {number} [keyboardDragSpeed=10] The speed at which elements are dragged using the keyboard. In pixels per keydown.
19
20
  * @property {boolean} [useTransform=true] Whether to use hardware accelerated css transforms when dragging or top/left instead
21
+ * @property {number} [refreshMemoryRate=80] Refresh rate on memoization, higher numbers mean better performance but more lag if elements are moving, lower numbers mean less lag but worse performance. If none of your DOMNodes are moving, you can set it to a very high number to increase performance. Value in milliseconds.
22
+ * @property {DSInputDropZone[]} [dropZones=[]] one or more drop-elements: where the selectables can be dropped into
23
+ * @property {number} [dropInsideThreshold=1] how much % of the item has to be inside the dropzone to be considered inside (0 = barely touching, 1 = completely inside)
24
+ * @property {number} [dropTargetThreshold=0] how much % of the zone does the pointer has to be in to be considered a target (0 = anywhere in the zone, max: 0.5 = has to point at the center of the zone)
25
+ * @property {boolean} [usePointerEvents=false] Whether to use Pointer Events to replace traditional Mouse or Touch Events. Useful for tools like Google Blockly.
20
26
  * @property {string} [hoverClass=ds-hover] the class assigned to the mouse hovered items
21
27
  * @property {string} [selectableClass=ds-selectable] the class assigned to the elements that can be selected
22
28
  * @property {string} [selectedClass=ds-selected] the class assigned to the selected items
23
29
  * @property {string} [selectorClass=ds-selector] the class assigned to the square selector helper
24
30
  * @property {string} [selectorAreaClass=ds-selector-area] the class assigned to the square in which the selector resides. By default it's invisible
31
+ * @property {string} [droppedTargetClass=ds-dropped-target] on an item corresponding the target dropzone. This is also the prefix for ds-dropped-target-${zone.id}
32
+ * @property {string} [droppedInsideClass=ds-dropped-inside] on an item that is within its dropzone bounds after a drop. This is also the prefix for ds-dropped-inside-${zone.id}
33
+ * @property {string} [droppableClass=ds-droppable] on element that can be dropped into at least one container. This is also the prefix for ds-droppable-${zone.id}
34
+ * @property {string} [dropZoneClass=ds-dropzone] on each dropZone
35
+ * @property {string} [dropZoneReadyClass=ds-dropzone-ready] on corresponding dropZone when element is dragged
36
+ * @property {string} [dropZoneTargetClass=ds-dropzone-target] on dropZone that has elements from any successful target drop
37
+ * @property {string} [dropZoneInsideClass=ds-dropzone-inside] on dropZone that has elements inside after any drop
25
38
  */
26
39
 
27
40
  /**
28
41
  * The Object that is passed back to any callback method
29
42
  * @typedef {Object} CallbackObject
30
43
  * @property {Array<HTMLElement|SVGElement|any>} [items] The items currently selected
31
- * @property {MouseEvent|TouchEvent|KeyboardEvent|Event} [event] The respective event object
44
+ * @property {MouseEvent|TouchEvent|PointerEvent|KeyboardEvent|Event} [event] The respective event object
32
45
  * @property {HTMLElement|SVGElement|any} [item] The single item currently interacted with
33
46
  * @property {boolean} [isDragging] Whether the interaction is a drag or a select
34
47
  * @property {boolean} [isDraggingKeyboard] Whether or not the drag interaction is via keyboard
@@ -36,22 +49,38 @@
36
49
  * @property {Settings} [settings] the settings being updates/manipulated/passed, also holds the previous value. i.e. updating selectorClass will publish { settings: { selectorClass: 'newVal', 'selectorClass:pre': 'oldVal' } }
37
50
  * @property {Array.<'top'|'bottom'|'left'|'right'|undefined>} [scroll_directions]
38
51
  * @property {number} [scroll_multiplier]
52
+ * @property {DSDropZone} [dropTarget] The dropZone element that the element was dropped into (or the mouse is currently hovering over)
39
53
  */
40
54
  /**
41
55
  * @typedef {function} DSCallback
42
56
  * @param {CallbackObject} data
43
57
  */
44
58
 
59
+ /**
60
+ * @typedef {Object} DSInputDropZone
61
+ * @property {string} id
62
+ * @property {DSElement} element
63
+ * @property {DSInputElements} droppables
64
+ */
65
+ /**
66
+ * @typedef {Object} DSDropZone
67
+ * @property {string} id
68
+ * @property {DSElement} element
69
+ * @property {DSElements} droppables
70
+ * @property {DSElements} [itemsDropped] the items related to the target zone
71
+ * @property {DSElements} [itemsInside] the items that are within the targets bounds
72
+ */
73
+
45
74
  /** @typedef {{x: number, y: number}} Vect2 */
46
75
  /** @typedef {{x:number,y:number,w:number,h:number,r:number,b:number}} DSElementPos */
47
76
  /** @typedef {Array.<'top'|'bottom'|'left'|'right'|undefined>} DSEdges */
48
77
 
49
- /** @typedef {HTMLElement|SVGElement|HTMLDocument} DSArea area within which you can drag */
78
+ /** @typedef {HTMLElement|SVGElement|Document} DSArea area within which you can drag */
50
79
  /** @typedef {HTMLElement} DSSelectorArea area in which you can drag */
51
80
  /** @typedef {Array.<HTMLElement|SVGElement> | HTMLElement | SVGElement} DSInputElements the elements that can be selected */
52
81
  /** @typedef {Array.<HTMLElement|SVGElement>} DSElements the elements that can be selected */
53
82
  /** @typedef {HTMLElement|SVGElement} DSElement a single element that can be selected */
54
- /** @typedef {MouseEvent|TouchEvent} DSEvent en event from a touch or mouse interaction */
83
+ /** @typedef {MouseEvent|TouchEvent|PointerEvent} DSEvent en event from a touch or mouse interaction */
55
84
  /** @typedef {Array.<'Shift'|'Control'|'Meta'|string>} DSMultiSelectKeys An array of keys that allows switching to the multi-select mode */
56
85
 
57
86
  /** @typedef {'dragmove'|'autoscroll'|'dragstart'|'elementselect'|'elementunselect'|'callback'} DSEventNames */