dragselect 2.7.4 → 3.0.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.
- package/CHANGELOG.md +97 -23
- package/LICENSE +690 -0
- package/README.md +2 -1
- package/jest-puppeteer.config.js +13 -3
- package/jest.config.js +5 -0
- package/package.json +40 -46
- package/rollup.config.mjs +82 -0
- package/src/DragSelect.ts +425 -0
- package/src/methods/addModificationObservers.ts +51 -0
- package/src/methods/canScroll.ts +19 -0
- package/src/methods/{createSelectorAreaElement.js → createSelectorAreaElement.ts} +1 -8
- package/src/methods/{createSelectorElement.js → createSelectorElement.ts} +1 -9
- package/src/methods/{debounce.js → debounce.ts} +5 -11
- package/src/methods/ensureArray.ts +13 -0
- package/src/methods/getAllParentNodes.ts +15 -0
- package/src/methods/{getAreaRect.js → getAreaRect.ts} +2 -6
- package/src/methods/getCurrentScroll.ts +14 -0
- package/src/methods/{documentScroll.js → getDocumentScroll.ts} +2 -2
- package/src/methods/{getOverflowEdges.js → getOverflowEdges.ts} +11 -11
- package/src/methods/getPointerPos.ts +9 -0
- package/src/methods/getSelectionRect.ts +29 -0
- package/src/methods/{getSelectorPosition.js → getSelectorPosition.ts} +11 -9
- package/src/methods/{getStylePosition.spec.js → getStylePosition.spec.ts} +9 -9
- package/src/methods/{getStylePosition.js → getStylePosition.ts} +5 -21
- package/src/methods/handleElementPositionAttribute.ts +15 -0
- package/src/methods/handleKeyboardDragPosDifference.ts +35 -0
- package/src/methods/handleSelection.ts +26 -0
- package/src/methods/{handleUnSelection.js → handleUnSelection.ts} +14 -14
- package/src/methods/{hydrateSettings.js → hydrateSettings.ts} +15 -26
- package/src/methods/isCollision.ts +66 -0
- package/src/methods/limitDirection.ts +36 -0
- package/src/methods/moveElement.ts +18 -0
- package/src/methods/{scrollElement.js → scrollElement.ts} +4 -10
- package/src/methods/{setStylePosition.js → setStylePosition.ts} +3 -11
- package/src/methods/subscriberAliases.ts +240 -0
- package/src/methods/updateElementStylePos.ts +7 -0
- package/src/methods/vect2.ts +34 -0
- package/src/modules/Area.ts +169 -0
- package/src/modules/Drag.ts +236 -0
- package/src/modules/{DropZone.js → DropZone.ts} +80 -119
- package/src/modules/DropZones.ts +151 -0
- package/src/modules/Interaction.ts +251 -0
- package/src/modules/PubSub.ts +111 -0
- package/src/modules/SelectableSet.ts +146 -0
- package/src/modules/SelectedSet.ts +92 -0
- package/src/modules/{Selection.js → Selection.ts} +59 -44
- package/src/modules/Selector.ts +81 -0
- package/src/modules/{SelectorArea.js → SelectorArea.ts} +58 -71
- package/src/stores/KeyStore.ts +92 -0
- package/src/stores/PointerStore.ts +194 -0
- package/src/stores/ScrollStore.ts +87 -0
- package/src/stores/SettingsStore.ts +88 -0
- package/src/types.ts +158 -0
- package/tsconfig.json +105 -0
- package/bower.json +0 -24
- package/dist/DragSelect.d.ts +0 -200
- package/dist/DragSelect.es6m.js +0 -3886
- package/dist/DragSelect.js +0 -3894
- package/dist/ds.es6m.min.js +0 -1
- package/dist/ds.min.js +0 -1
- package/dist/methods/addModificationObservers.d.ts +0 -11
- package/dist/methods/canScroll.d.ts +0 -3
- package/dist/methods/createSelectorAreaElement.d.ts +0 -3
- package/dist/methods/createSelectorElement.d.ts +0 -3
- package/dist/methods/debounce.d.ts +0 -3
- package/dist/methods/documentScroll.d.ts +0 -6
- package/dist/methods/getAllParentNodes.d.ts +0 -3
- package/dist/methods/getAreaRect.d.ts +0 -3
- package/dist/methods/getBoundingClientRect.d.ts +0 -4
- package/dist/methods/getCurrentScroll.d.ts +0 -3
- package/dist/methods/getOverflowEdges.d.ts +0 -7
- package/dist/methods/getPointerPos.d.ts +0 -5
- package/dist/methods/getSelectorPosition.d.ts +0 -12
- package/dist/methods/getStylePosition.d.ts +0 -3
- package/dist/methods/handleElementOverflow.d.ts +0 -10
- package/dist/methods/handleElementPositionAttribute.d.ts +0 -6
- package/dist/methods/handleKeyboardDragPosDifference.d.ts +0 -13
- package/dist/methods/handleSelection.d.ts +0 -9
- package/dist/methods/handleUnSelection.d.ts +0 -9
- package/dist/methods/hydrateSettings.d.ts +0 -3
- package/dist/methods/index.d.ts +0 -30
- package/dist/methods/isCollision.d.ts +0 -13
- package/dist/methods/moveElement.d.ts +0 -8
- package/dist/methods/removeModificationObservers.d.ts +0 -3
- package/dist/methods/scrollElement.d.ts +0 -3
- package/dist/methods/setStylePosition.d.ts +0 -3
- package/dist/methods/subscriberAliases.d.ts +0 -14
- package/dist/methods/toArray.d.ts +0 -3
- package/dist/methods/updateElementStylePos.d.ts +0 -8
- package/dist/methods/vect2.d.ts +0 -8
- package/dist/modules/Area.d.ts +0 -80
- package/dist/modules/Drag.d.ts +0 -71
- package/dist/modules/DropZone.d.ts +0 -90
- package/dist/modules/DropZones.d.ts +0 -73
- package/dist/modules/Interaction.d.ts +0 -51
- package/dist/modules/PubSub.d.ts +0 -37
- package/dist/modules/SelectableSet.d.ts +0 -43
- package/dist/modules/SelectedSet.d.ts +0 -32
- package/dist/modules/Selection.d.ts +0 -54
- package/dist/modules/Selector.d.ts +0 -29
- package/dist/modules/SelectorArea.d.ts +0 -58
- package/dist/modules/index.d.ts +0 -11
- package/dist/stores/KeyStore.d.ts +0 -34
- package/dist/stores/PointerStore.d.ts +0 -83
- package/dist/stores/ScrollStore.d.ts +0 -38
- package/dist/stores/SettingsStore.d.ts +0 -39
- package/dist/stores/index.d.ts +0 -5
- package/dist/types.d.ts +0 -276
- package/jsconfig.json +0 -13
- package/rollup.config.js +0 -101
- package/src/DragSelect.js +0 -384
- package/src/methods/addModificationObservers.js +0 -38
- package/src/methods/canScroll.js +0 -20
- package/src/methods/getAllParentNodes.js +0 -17
- package/src/methods/getBoundingClientRect.js +0 -33
- package/src/methods/getCurrentScroll.js +0 -15
- package/src/methods/getPointerPos.js +0 -13
- package/src/methods/handleElementOverflow.js +0 -65
- package/src/methods/handleElementPositionAttribute.js +0 -16
- package/src/methods/handleKeyboardDragPosDifference.js +0 -57
- package/src/methods/handleSelection.js +0 -26
- package/src/methods/index.js +0 -29
- package/src/methods/isCollision.js +0 -58
- package/src/methods/moveElement.js +0 -39
- package/src/methods/removeModificationObservers.js +0 -13
- package/src/methods/subscriberAliases.js +0 -72
- package/src/methods/toArray.js +0 -18
- package/src/methods/updateElementStylePos.js +0 -15
- package/src/methods/vect2.js +0 -54
- package/src/modules/Area.js +0 -183
- package/src/modules/Drag.js +0 -257
- package/src/modules/DropZones.js +0 -161
- package/src/modules/Interaction.js +0 -208
- package/src/modules/PubSub.js +0 -78
- package/src/modules/SelectableSet.js +0 -149
- package/src/modules/SelectedSet.js +0 -72
- package/src/modules/Selector.js +0 -90
- package/src/modules/index.js +0 -10
- package/src/stores/KeyStore.js +0 -83
- package/src/stores/PointerStore.js +0 -218
- package/src/stores/ScrollStore.js +0 -92
- package/src/stores/SettingsStore.js +0 -66
- package/src/stores/index.js +0 -4
- package/src/types.js +0 -100
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import '../types'
|
|
3
|
-
import DragSelect from '../DragSelect'
|
|
4
|
-
import { getCurrentScroll, vect2, canScroll } from '../methods'
|
|
5
|
-
|
|
6
|
-
export default class ScrollStore {
|
|
7
|
-
/**
|
|
8
|
-
* @type {Vect2}
|
|
9
|
-
* @private */
|
|
10
|
-
_initialVal
|
|
11
|
-
/**
|
|
12
|
-
* @type {Vect2}
|
|
13
|
-
* @private */
|
|
14
|
-
_currentVal
|
|
15
|
-
/**
|
|
16
|
-
* @type {boolean}
|
|
17
|
-
* @private */
|
|
18
|
-
_canScroll
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @class ScrollStore
|
|
22
|
-
* @constructor ScrollStore
|
|
23
|
-
* @param {{ DS:DragSelect }} p
|
|
24
|
-
* @ignore
|
|
25
|
-
*/
|
|
26
|
-
constructor({ DS }) {
|
|
27
|
-
this.DS = DS
|
|
28
|
-
this.DS.subscribe('Interaction:init', this.init)
|
|
29
|
-
this.DS.subscribe('Interaction:start', () => this.start())
|
|
30
|
-
this.DS.subscribe('Interaction:end', () => this.reset())
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
init = () =>
|
|
34
|
-
this.DS.stores.SettingsStore.s.area.addEventListener('scroll', this.update)
|
|
35
|
-
|
|
36
|
-
start = () => {
|
|
37
|
-
this._currentVal = this._initialVal = getCurrentScroll(
|
|
38
|
-
this.DS.stores.SettingsStore.s.area
|
|
39
|
-
)
|
|
40
|
-
this.DS.stores.SettingsStore.s.area.addEventListener('scroll', this.update)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
update = () =>
|
|
44
|
-
(this._currentVal = getCurrentScroll(this.DS.stores.SettingsStore.s.area))
|
|
45
|
-
|
|
46
|
-
stop = () => {
|
|
47
|
-
this.DS.stores.SettingsStore.s.area.removeEventListener(
|
|
48
|
-
'scroll',
|
|
49
|
-
this.update
|
|
50
|
-
)
|
|
51
|
-
this._initialVal = { x: 0, y: 0 }
|
|
52
|
-
this._canScroll = null
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
reset = () => {
|
|
56
|
-
this.stop()
|
|
57
|
-
this.start()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
get canScroll() {
|
|
61
|
-
if (typeof this._canScroll === 'boolean') return this._canScroll
|
|
62
|
-
return (this._canScroll = canScroll(this.DS.stores.SettingsStore.s.area))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get scrollAmount() {
|
|
66
|
-
const scrollDiff = vect2.calc(this.currentVal, '-', this.initialVal)
|
|
67
|
-
|
|
68
|
-
// if area is zoomed, the scroll values are skewed, we need to fix that manually :(
|
|
69
|
-
const zoom = vect2.num2vect(this.DS.stores.SettingsStore.s.zoom)
|
|
70
|
-
const zoomScroll = vect2.calc(
|
|
71
|
-
vect2.calc(scrollDiff, '*', zoom),
|
|
72
|
-
'-',
|
|
73
|
-
scrollDiff
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
x: scrollDiff.x + zoomScroll.x,
|
|
78
|
-
y: scrollDiff.y + zoomScroll.y,
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get initialVal() {
|
|
83
|
-
if (!this._initialVal) return { x: 0, y: 0 }
|
|
84
|
-
return this._initialVal
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get currentVal() {
|
|
88
|
-
if (!this._currentVal)
|
|
89
|
-
this._currentVal = getCurrentScroll(this.DS.stores.SettingsStore.s.area)
|
|
90
|
-
return this._currentVal
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import '../types'
|
|
3
|
-
import DragSelect from '../DragSelect'
|
|
4
|
-
|
|
5
|
-
import { hydrateSettings } from '../methods'
|
|
6
|
-
|
|
7
|
-
export default class SettingsStore {
|
|
8
|
-
/**
|
|
9
|
-
* @type {Settings}
|
|
10
|
-
* @private
|
|
11
|
-
* */
|
|
12
|
-
_settings = {}
|
|
13
|
-
/**
|
|
14
|
-
* Holds the settings and their previous value `:pre`
|
|
15
|
-
* @example {
|
|
16
|
-
* autoScrollSpeed: 3,
|
|
17
|
-
* 'autoScrollSpeed:pre': 5
|
|
18
|
-
* }
|
|
19
|
-
* @type {Settings}
|
|
20
|
-
* */
|
|
21
|
-
s = {}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @class ScrollStore
|
|
25
|
-
* @constructor ScrollStore
|
|
26
|
-
* @param {{ DS:DragSelect, settings:Settings }} p
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
constructor({
|
|
30
|
-
DS,
|
|
31
|
-
settings
|
|
32
|
-
}) {
|
|
33
|
-
this.DS = DS
|
|
34
|
-
this.DS.subscribe('Settings:updated:pre', this._update)
|
|
35
|
-
this.update({ settings, init: true })
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** @param {{settings: Settings, init?: boolean}} props */
|
|
39
|
-
update = ({ settings, init }) =>
|
|
40
|
-
this.DS.publish('Settings:updated:pre', { settings, ...init ? { init } : {} })
|
|
41
|
-
/** @param {{settings: Settings, init: boolean}} props */
|
|
42
|
-
_update = ({ settings, init }) => {
|
|
43
|
-
const _settings = hydrateSettings(settings, init)
|
|
44
|
-
for (const [key, value] of Object.entries(_settings)) {
|
|
45
|
-
if (!(key in this._settings)) {
|
|
46
|
-
Object.defineProperty(this.s, key, {
|
|
47
|
-
get: () => this._settings[key],
|
|
48
|
-
set: (newValue) => this.update({ settings: { [key]: newValue } }),
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this._settings[`${key}:pre`] = this._settings[key]
|
|
53
|
-
this._settings[key] = value
|
|
54
|
-
|
|
55
|
-
const update = {
|
|
56
|
-
settings: {
|
|
57
|
-
[key]: this._settings[key],
|
|
58
|
-
[`${key}:pre`]: this._settings[`${key}:pre`],
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
this.DS.publish('Settings:updated', update)
|
|
62
|
-
// @ts-ignore: @todo: update to typescript
|
|
63
|
-
this.DS.publish(`Settings:updated:${key}`, update)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
package/src/stores/index.js
DELETED
package/src/types.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Settings to be passed to the Class
|
|
3
|
-
* @typedef {Object} Settings
|
|
4
|
-
* @property {HTMLElement|SVGElement|Document} [area=document] area in which you can drag. If not provided it will be the whole document
|
|
5
|
-
* @property {DSInputElements} [selectables=[]] the elements that can be selected
|
|
6
|
-
* @property {number} [autoScrollSpeed=5] Speed in which the area scrolls while selecting (if available). Unit is pixel per movement.
|
|
7
|
-
* @property {Vect2} [overflowTolerance={x:25,y:25}] Tolerance for autoScroll (how close one has to be near an edges for autoScroll to start)
|
|
8
|
-
* @property {number} [zoom=1] Zoom scale factor (in case of using CSS style transform: scale() which messes with real positions). Unit scale zoom.
|
|
9
|
-
* @property {boolean} [customStyles=false] if set to true, no styles (except for position absolute) will be applied by default
|
|
10
|
-
* @property {boolean} [multiSelectMode=false] Add newly selected elements to the selection instead of replacing them
|
|
11
|
-
* @property {boolean} [multiSelectToggling=true] Whether or not to toggle already active elements while multi-selecting
|
|
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
|
-
* @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)
|
|
15
|
-
* @property {boolean} [draggability=true] When a user is dragging on an already selected element, the selection is dragged.
|
|
16
|
-
* @property {boolean} [immediateDrag=true] Whether an element is draggable from the start or needs to be selected first
|
|
17
|
-
* @property {boolean} [keyboardDrag=true] Whether or not the user can drag with the keyboard (we don't recommend disabling it)
|
|
18
|
-
* @property {DSDragKeys} [dragKeys={up:['ArrowUp'],down:['ArrowDown'],left:['ArrowLeft'],righ:['ArrowRight']}] The keys available to drag element using the keyboard.
|
|
19
|
-
* @property {number} [keyboardDragSpeed=10] The speed at which elements are dragged using the keyboard. In pixels per keydown.
|
|
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.
|
|
26
|
-
* @property {string} [hoverClass=ds-hover] the class assigned to the mouse hovered items
|
|
27
|
-
* @property {string} [selectableClass=ds-selectable] the class assigned to the elements that can be selected
|
|
28
|
-
* @property {string} [selectedClass=ds-selected] the class assigned to the selected items
|
|
29
|
-
* @property {string} [selectorClass=ds-selector] the class assigned to the square selector helper
|
|
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
|
|
38
|
-
* @property {boolean} [dragAsBlock=false] whether to drag multiple elements as a single block or as individual items
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The Object that is passed back to any callback method
|
|
43
|
-
* @typedef {Object} CallbackObject
|
|
44
|
-
* @property {Array<HTMLElement|SVGElement|any>} [items] The items currently selected
|
|
45
|
-
* @property {MouseEvent|TouchEvent|PointerEvent|KeyboardEvent|Event} [event] The respective event object
|
|
46
|
-
* @property {HTMLElement|SVGElement|any} [item] The single item currently interacted with
|
|
47
|
-
* @property {boolean} [isDragging] Whether the interaction is a drag or a select
|
|
48
|
-
* @property {boolean} [isDraggingKeyboard] Whether or not the drag interaction is via keyboard
|
|
49
|
-
* @property {string} [key] Pressed key (lowercase)
|
|
50
|
-
* @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' } }
|
|
51
|
-
* @property {Array.<'top'|'bottom'|'left'|'right'|undefined>} [scroll_directions]
|
|
52
|
-
* @property {number} [scroll_multiplier]
|
|
53
|
-
* @property {DSDropZone} [dropTarget] The dropZone element that the element was dropped into (or the mouse is currently hovering over)
|
|
54
|
-
*/
|
|
55
|
-
/**
|
|
56
|
-
* @typedef {function} DSCallback
|
|
57
|
-
* @param {CallbackObject} data
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @typedef {Object} DSInputDropZone
|
|
62
|
-
* @property {string} id can be any unique identifier of type string
|
|
63
|
-
* @property {DSElement} element is the dropzone itself
|
|
64
|
-
* @property {DSInputElements} [droppables] the elements that can be dropped into that zone. This is optional, by default it will be all selectables
|
|
65
|
-
*/
|
|
66
|
-
/**
|
|
67
|
-
* @typedef {Object} DSDropZone
|
|
68
|
-
* @property {string} id
|
|
69
|
-
* @property {DSElement} element
|
|
70
|
-
* @property {DSElements} droppables
|
|
71
|
-
* @property {DSElements} [itemsDropped] the items related to the target zone
|
|
72
|
-
* @property {DSElements} [itemsInside] the items that are within the targets bounds
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
/** @typedef {{x: number, y: number}} Vect2 */
|
|
76
|
-
/** @typedef {{x:number,y:number,w:number,h:number,r:number,b:number}} DSElementPos */
|
|
77
|
-
/** @typedef {Array.<'top'|'bottom'|'left'|'right'|undefined>} DSEdges */
|
|
78
|
-
|
|
79
|
-
/** @typedef {HTMLElement|SVGElement|Document} DSArea area within which you can drag */
|
|
80
|
-
/** @typedef {HTMLElement} DSSelectorArea area in which you can drag */
|
|
81
|
-
/** @typedef {Array.<HTMLElement|SVGElement> | HTMLElement | SVGElement} DSInputElements the elements that can be selected */
|
|
82
|
-
/** @typedef {Array.<HTMLElement|SVGElement>} DSElements the elements that can be selected */
|
|
83
|
-
/** @typedef {HTMLElement|SVGElement} DSElement a single element that can be selected */
|
|
84
|
-
/** @typedef {MouseEvent|TouchEvent|PointerEvent} DSEvent en event from a touch or mouse interaction */
|
|
85
|
-
/** @typedef {Array.<'Shift'|'Control'|'Meta'|string>} DSMultiSelectKeys An array of keys that allows switching to the multi-select mode */
|
|
86
|
-
|
|
87
|
-
/** @typedef {'dragmove'|'autoscroll'|'dragstart'|'elementselect'|'elementunselect'|'callback'} DSEventNames */
|
|
88
|
-
/** @typedef {'Interaction:init'|'Interaction:start'|'Interaction:end'|'Interaction:update'|'Area:modified'|'Area:scroll'|'PointerStore:updated'|'Selected:added'|'Selected:removed'|'Selectable:click'|'Selectable:added'|'Selectable:removed'|'Selectable:pointer'|'KeyStore:down'|'KeyStore:up'} DSInternalEventNames */
|
|
89
|
-
/** @typedef {'Interaction:init:pre'|'Interaction:start:pre'|'Interaction:end:pre'|'Interaction:update:pre'|'Area:modified:pre'|'Area:scroll:pre'|'PointerStore:updated:pre'|'Selected:added:pre'|'Selected:removed:pre'|'Selectable:click:pre'|'Selectable:added:pre'|'Selectable:removed:pre'|'Selectable:pointer:pre'|'KeyStore:down:pre'|'KeyStore:up:pre'} DSInternalEventNamesPre */
|
|
90
|
-
// @todo: update to typescript for complex defs like `Settings:updated:${string}` | `Settings:updated:${string}:pre`
|
|
91
|
-
/** @typedef {'Settings:updated'|'Settings:updated:pre'|'Settings:updated:*'|'Settings:updated:*:pre'} DSInternalSettingEvents */
|
|
92
|
-
/** @typedef {DSEventNames|DSInternalEventNames|DSInternalEventNamesPre|DSInternalSettingEvents} DSCallbackNames the name of the callback */
|
|
93
|
-
|
|
94
|
-
/** @typedef {{top:number,left:number,bottom:number,right:number,width:number,height:number}} DSBoundingRect */
|
|
95
|
-
/** @typedef {{up:string[],down:string[],left:string[],right:string[]}} DSDragKeys */
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @callback DSModificationCallback
|
|
99
|
-
* @param {*} event
|
|
100
|
-
*/
|