dragselect 3.0.2 → 3.0.3

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 (51) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/{DragSelect.es6m.js → DragSelect.esm.js} +1 -1
  3. package/dist/DragSelect.js +1 -1
  4. package/package.json +2 -2
  5. package/src/DragSelect.ts +0 -425
  6. package/src/methods/addModificationObservers.ts +0 -51
  7. package/src/methods/canScroll.ts +0 -19
  8. package/src/methods/createSelectorAreaElement.ts +0 -8
  9. package/src/methods/createSelectorElement.ts +0 -13
  10. package/src/methods/debounce.ts +0 -31
  11. package/src/methods/ensureArray.ts +0 -13
  12. package/src/methods/getAllParentNodes.ts +0 -15
  13. package/src/methods/getAreaRect.ts +0 -27
  14. package/src/methods/getCurrentScroll.ts +0 -14
  15. package/src/methods/getDocumentScroll.ts +0 -5
  16. package/src/methods/getOverflowEdges.ts +0 -27
  17. package/src/methods/getPointerPos.ts +0 -9
  18. package/src/methods/getSelectionRect.ts +0 -29
  19. package/src/methods/getSelectorPosition.ts +0 -74
  20. package/src/methods/getStylePosition.spec.ts +0 -114
  21. package/src/methods/getStylePosition.ts +0 -83
  22. package/src/methods/handleElementPositionAttribute.ts +0 -15
  23. package/src/methods/handleKeyboardDragPosDifference.ts +0 -35
  24. package/src/methods/handleSelection.ts +0 -26
  25. package/src/methods/handleUnSelection.ts +0 -36
  26. package/src/methods/hydrateSettings.ts +0 -245
  27. package/src/methods/isCollision.ts +0 -66
  28. package/src/methods/limitDirection.ts +0 -36
  29. package/src/methods/moveElement.ts +0 -18
  30. package/src/methods/scrollElement.ts +0 -26
  31. package/src/methods/setStylePosition.ts +0 -16
  32. package/src/methods/subscriberAliases.ts +0 -240
  33. package/src/methods/updateElementStylePos.ts +0 -7
  34. package/src/methods/vect2.ts +0 -34
  35. package/src/modules/Area.ts +0 -169
  36. package/src/modules/Drag.ts +0 -236
  37. package/src/modules/DropZone.ts +0 -223
  38. package/src/modules/DropZones.ts +0 -151
  39. package/src/modules/Interaction.ts +0 -251
  40. package/src/modules/PubSub.ts +0 -111
  41. package/src/modules/SelectableSet.ts +0 -146
  42. package/src/modules/SelectedSet.ts +0 -92
  43. package/src/modules/Selection.ts +0 -133
  44. package/src/modules/Selector.ts +0 -81
  45. package/src/modules/SelectorArea.ts +0 -161
  46. package/src/stores/KeyStore.ts +0 -92
  47. package/src/stores/PointerStore.ts +0 -194
  48. package/src/stores/ScrollStore.ts +0 -87
  49. package/src/stores/SettingsStore.ts +0 -88
  50. package/src/types.ts +0 -158
  51. /package/dist/{ds.es6m.min.js → ds.esm.min.js} +0 -0
@@ -1,194 +0,0 @@
1
- import DragSelect from '../DragSelect'
2
- import PubSub from '../modules/PubSub'
3
- import { DSEvent, DSInputElement, Settings, Vect2 } from '../types'
4
- import { getPointerPos } from '../methods/getPointerPos'
5
- import { rect2vect, calcVect } from '../methods/vect2'
6
- import { InteractionEvent } from '../modules/Interaction'
7
-
8
- export type DSPointerStorePublishEventNames =
9
- | 'PointerStore:updated:pre'
10
- | 'PointerStore:updated'
11
-
12
- export type DSPointerStorePublishEventData = {
13
- event: PointerEvent | MouseEvent | TouchEvent
14
- }
15
-
16
- export type DSPointerStorePublish = {
17
- [K in DSPointerStorePublishEventNames]: DSPointerStorePublishEventData
18
- }
19
-
20
- export default class PointerStore<E extends DSInputElement> {
21
- private _isMouseInteraction = false
22
- // Position relative to area
23
- private _initialValArea: Vect2 = { x: 0, y: 0 }
24
- private _currentValArea: Vect2 = { x: 0, y: 0 }
25
- private _lastValArea: Vect2 = { x: 0, y: 0 }
26
- // General Pointer Position
27
- private _initialVal: Vect2 = { x: 0, y: 0 }
28
- private _currentVal: Vect2 = { x: 0, y: 0 }
29
- private _lastVal: Vect2 = { x: 0, y: 0 }
30
- private _lastTouch?: TouchEvent
31
-
32
- private DS: DragSelect<E>
33
- private PS: PubSub<E>
34
- private settings: Required<Settings<E>>
35
-
36
- constructor({ DS, PS }: { DS: DragSelect<E>; PS: PubSub<E> }) {
37
- this.DS = DS
38
- this.PS = PS
39
- this.settings = this.DS.stores.SettingsStore.s
40
- this.PS.subscribe('Interaction:init', this.init)
41
- this.PS.subscribe('Interaction:start', ({ event }) => this.start(event))
42
- this.PS.subscribe('Interaction:end', ({ event }) => this.reset(event))
43
- }
44
-
45
- private init = () => {
46
- if (this.settings.usePointerEvents)
47
- document.addEventListener('pointermove', this.update, { passive: false })
48
- else document.addEventListener('mousemove', this.update)
49
-
50
- document.addEventListener('touchmove', this.update, { passive: false })
51
- }
52
-
53
- public start(event?: DSEvent) {
54
- if (!event) return
55
- this._isMouseInteraction = true
56
- this.currentVal = this.initialVal = this.getPointerPosition(event)
57
- }
58
-
59
- public getPointerPosition = (event?: DSEvent) =>
60
- getPointerPos({
61
- event: this._normalizedEvent(event),
62
- })
63
-
64
- private update = (event: Event) => {
65
- // type Event to satisfy event listeners, but we know type is : event as InteractionEvent
66
- if (!event) return
67
- this.PS.publish('PointerStore:updated:pre', {
68
- event: event as InteractionEvent,
69
- })
70
- this.currentVal = this.getPointerPosition(event as InteractionEvent)
71
- if (!this._isMouseInteraction) return
72
- this.PS.publish('PointerStore:updated', {
73
- event: event as InteractionEvent,
74
- })
75
- }
76
-
77
- public stop = () => {
78
- // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
79
- if (this.settings.usePointerEvents)
80
- document.removeEventListener('pointermove', this.update, {
81
- // @ts-ignore
82
- passive: false,
83
- })
84
- else document.removeEventListener('mousemove', this.update)
85
-
86
- document.removeEventListener('touchmove', this.update, {
87
- // @ts-ignore
88
- passive: false,
89
- })
90
-
91
- this.reset()
92
- }
93
-
94
- private reset = (event?: DSEvent) => {
95
- this.currentVal = this.lastVal = this.getPointerPosition(event)
96
- // debounce in order "onClick" to work
97
- setTimeout(() => (this._isMouseInteraction = false), 100)
98
- }
99
-
100
- private _normalizedEvent(event?: DSEvent): MouseEvent | PointerEvent | Touch {
101
- // null KeyboardEvents
102
- if (!event || event instanceof KeyboardEvent)
103
- return { clientX: 0, clientY: 0 } as MouseEvent
104
- // touchend has not touches. so we take the last touch if a touchevent, we need to store the positions
105
- if ('touches' in event) {
106
- if (event.type !== 'touchend') this._lastTouch = event
107
- // if a touchevent, return the last touch rather than the regular event
108
- // as we need .touches[0] from that event
109
- return this._lastTouch?.touches[0] || event.touches[0]
110
- }
111
- return event
112
- }
113
-
114
- /** First recorded pointer position within the area */
115
- public get initialValArea() {
116
- if (!this._initialValArea) return { x: 0, y: 0 }
117
- return this._initialValArea
118
- }
119
-
120
- /** Current pointer position within the area */
121
- public get currentValArea() {
122
- if (!this._currentValArea) return { x: 0, y: 0 }
123
- return this._currentValArea
124
- }
125
-
126
- /** Last recorded pointer position within the area */
127
- public get lastValArea() {
128
- if (!this._lastValArea) return { x: 0, y: 0 }
129
- return this._lastValArea
130
- }
131
-
132
- /** First recorded pointer position */
133
- public get initialVal() {
134
- if (!this._initialVal) return { x: 0, y: 0 }
135
- return this._initialVal
136
- }
137
-
138
- /** Current pointer position */
139
- public get currentVal() {
140
- if (!this._currentVal) return { x: 0, y: 0 }
141
- return this._currentVal
142
- }
143
-
144
- /** Last recorded pointer position */
145
- public get lastVal() {
146
- if (!this._lastVal) return { x: 0, y: 0 }
147
- return this._lastVal
148
- }
149
-
150
- public set initialVal(value) {
151
- this._initialVal = value
152
- this._initialValArea =
153
- value &&
154
- calcVect(
155
- value,
156
- '-',
157
- calcVect(
158
- rect2vect(this.DS.Area.rect),
159
- '+',
160
- rect2vect(this.DS.Area.computedBorder)
161
- )
162
- )
163
- }
164
-
165
- public set currentVal(value) {
166
- this._currentVal = value
167
- this._currentValArea =
168
- value &&
169
- calcVect(
170
- value,
171
- '-',
172
- calcVect(
173
- rect2vect(this.DS.Area.rect),
174
- '+',
175
- rect2vect(this.DS.Area.computedBorder)
176
- )
177
- )
178
- }
179
-
180
- public set lastVal(value) {
181
- this._lastVal = value
182
- this._lastValArea =
183
- value &&
184
- calcVect(
185
- value,
186
- '-',
187
- calcVect(
188
- rect2vect(this.DS.Area.rect),
189
- '+',
190
- rect2vect(this.DS.Area.computedBorder)
191
- )
192
- )
193
- }
194
- }
@@ -1,87 +0,0 @@
1
- import DragSelect from '../DragSelect'
2
- import PubSub from '../modules/PubSub'
3
- import { DSInputElement, Settings, Vect2 } from '../types'
4
- import { calcVect, num2vect } from '../methods/vect2'
5
- import { canScroll } from '../methods/canScroll'
6
- import { getCurrentScroll } from '../methods/getCurrentScroll'
7
-
8
- export default class ScrollStore<E extends DSInputElement> {
9
- private _initialVal: Vect2 = { x: 0, y: 0 }
10
- private _currentVal: Vect2 = { x: 0, y: 0 }
11
- private _canScroll?: boolean
12
- private DS: DragSelect<E>
13
- private PS: PubSub<E>
14
- private Settings: Required<Settings<E>>
15
-
16
- constructor({ DS, PS }: { DS: DragSelect<E>; PS: PubSub<E> }) {
17
- this.DS = DS
18
- this.PS = PS
19
- this.Settings = this.DS.stores.SettingsStore.s
20
- this.PS.subscribe('Area:modified', () => {
21
- this.stop()
22
- this.init()
23
- })
24
- this.PS.subscribe('Interaction:init', this.init)
25
- this.PS.subscribe('Interaction:start', () => this.start())
26
- this.PS.subscribe('Interaction:end', () => this.reset())
27
- }
28
-
29
- private init = () => this.addListeners()
30
-
31
- private addListeners = () =>
32
- this.DS.Area.HTMLNode.addEventListener('scroll', this.update)
33
- private removeListeners = () =>
34
- this.DS.Area.HTMLNode.removeEventListener('scroll', this.update)
35
-
36
- private start = () => {
37
- this._currentVal = this._initialVal = getCurrentScroll(
38
- this.DS.Area.HTMLNode
39
- )
40
- }
41
-
42
- private update = () =>
43
- (this._currentVal = getCurrentScroll(this.DS.Area.HTMLNode))
44
-
45
- public stop = () => {
46
- this.reset()
47
- this.removeListeners()
48
- }
49
-
50
- private reset = () => {
51
- this._initialVal = { x: 0, y: 0 }
52
- this._canScroll = undefined
53
- }
54
-
55
- public get canScroll() {
56
- if (typeof this._canScroll === 'boolean') return this._canScroll
57
- return (this._canScroll = canScroll(this.DS.Area.HTMLNode))
58
- }
59
-
60
- public get scrollAmount() {
61
- const scrollDiff = calcVect(this.currentVal, '-', this.initialVal)
62
-
63
- // if area is zoomed, the scroll values are skewed, we need to fix that manually :(
64
- const zoom = num2vect(this.Settings.zoom)
65
- const zoomScroll = calcVect(
66
- calcVect(scrollDiff, '*', zoom),
67
- '-',
68
- scrollDiff
69
- )
70
-
71
- return {
72
- x: scrollDiff.x + zoomScroll.x,
73
- y: scrollDiff.y + zoomScroll.y,
74
- }
75
- }
76
-
77
- private get initialVal() {
78
- if (!this._initialVal) return { x: 0, y: 0 }
79
- return this._initialVal
80
- }
81
-
82
- public get currentVal() {
83
- if (!this._currentVal)
84
- this._currentVal = getCurrentScroll(this.DS.Area.HTMLNode)
85
- return this._currentVal
86
- }
87
- }
@@ -1,88 +0,0 @@
1
- import { DSInputElement, Settings } from '../types'
2
- import DragSelect from '../DragSelect'
3
-
4
- import { hydrateSettings } from '../methods/hydrateSettings'
5
- import PubSub from '../modules/PubSub'
6
-
7
- type WithPostfix<T, Postfix extends string> = {
8
- [K in keyof T as K | `${string & K}${Postfix}`]: T[K];
9
- }
10
-
11
- export type DSSettings<E extends DSInputElement> = WithPostfix<Required<Settings<E>>, ':pre'>
12
-
13
- export type DSSettingsPublishEventNames = "Settings:updated:pre"|"Settings:updated"|`Settings:updated:${string}:pre`|`Settings:updated:${string}`
14
-
15
- export type DSSettingsPublishEventData<E extends DSInputElement> = {
16
- /** whether this is the initial settings call */
17
- 'settings:init': boolean;
18
- /** the settings being updates/manipulated/passed, holds all settings including the previous value. i.e. updating selectorClass will publish { settings: { ...settings, selectorClass: 'newVal', 'selectorClass:pre': 'oldVal' } } this is a deep cloned copy so manipulating it will have no effect */
19
- settings: DSSettings<E>;
20
- /** the new settings that are passed, not available on the initial settings call */
21
- 'settings:new'?: Settings<E>;
22
- };
23
-
24
- export type DSSettingsPublish<E extends DSInputElement> = {
25
- [K in DSSettingsPublishEventNames]: DSSettingsPublishEventData<E>;
26
- }
27
-
28
- export default class SettingsStore<E extends DSInputElement> {
29
- private _settings: DSSettings<E> = {} as DSSettings<E>
30
- /**
31
- * Holds the settings and their previous value `:pre`
32
- * @example {
33
- * autoScrollSpeed: 3,
34
- * 'autoScrollSpeed:pre': 5
35
- * }
36
- **/
37
- s: DSSettings<E> = {} as DSSettings<E>
38
- private PS: PubSub<E>
39
-
40
- /**
41
- * @class ScrollStore
42
- * @constructor ScrollStore
43
- * @param {{ DS:DragSelect, settings:Settings }} p
44
- * @ignore
45
- */
46
- constructor({
47
- PS,
48
- settings
49
- }: { PS: PubSub<E>, settings: Settings<E> }) {
50
- this.PS = PS
51
- this.update({ settings, init: true })
52
- }
53
-
54
- update = ({ settings, init }: { settings: Settings<E>, init?: boolean }) => {
55
- this.PS.publish('Settings:updated:pre', {
56
- settings: this._settings,
57
- 'settings:init': Boolean(init),
58
- 'settings:new': settings
59
- })
60
- this._update({ settings, init })
61
- }
62
-
63
- private _update = ({ settings = {}, init = false }: { settings?: Settings<E>, init?: boolean }) => {
64
- const _settings = hydrateSettings(settings, init)
65
-
66
- for (const [key, value] of Object.entries(_settings) as [keyof Settings<E>, DSSettings<E>[keyof Settings<E>]][]) {
67
- (<K extends keyof Settings<E>>(key: K, value: DSSettings<E>[K]) => {
68
- if (!(key in this._settings)) {
69
- Object.defineProperty(this.s, key, {
70
- get: () => this._settings[key],
71
- set: (newValue) => this.update({ settings: { [key]: newValue } }),
72
- })
73
- }
74
-
75
- this._settings[`${key}:pre` as K] = this._settings[key] // need to cast as K, see https://stackoverflow.com/a/76070928/3712591
76
- this._settings[key] = value
77
-
78
- const update = {
79
- settings: this._settings,
80
- 'settings:init': init,
81
- 'settings:new': settings
82
- }
83
- this.PS.publish('Settings:updated', update)
84
- this.PS.publish(`Settings:updated:${key}`, update)
85
- })(key, value); // method used for typecasting, see https://stackoverflow.com/q/76036535/3712591
86
- }
87
- }
88
- }
package/src/types.ts DELETED
@@ -1,158 +0,0 @@
1
- import { DSPublicPublishAdditionalEventData, DSPublicPublishEventNames } from "./methods/subscriberAliases"
2
- import { DSAreaPublishEventData, DSAreaPublishEventNames } from "./modules/Area"
3
- import { DSInteractionPublishEventData, DSInteractionPublishEventNames } from "./modules/Interaction"
4
- import { DSSelectablePublishEventData, DSSelectablePublishEventNames } from "./modules/SelectableSet"
5
- import { DSSelectedPublishEventData, DSSelectedPublishEventNames } from "./modules/SelectedSet"
6
- import { DSKeyStorePublishEventData, DSKeyStorePublishEventNames } from "./stores/KeyStore"
7
- import { DSPointerStorePublishEventData, DSPointerStorePublishEventNames } from "./stores/PointerStore"
8
- import { DSSettingsPublishEventData, DSSettingsPublishEventNames } from "./stores/SettingsStore"
9
-
10
- export type Vect2 = {
11
- x: number,
12
- y: number
13
- }
14
-
15
- export type Settings<E extends DSInputElement> = {
16
- /** area in which you can drag. If not provided it will be the whole document. Default Document */
17
- area?: HTMLElement | SVGElement | Document
18
- /** [=[]] the elements that can be selected. */
19
- selectables?: E | E[]
20
- /** [=5] Speed in which the area scrolls while selecting (if available). Unit is pixel per movement. */
21
- autoScrollSpeed?: number
22
- /** [={x:25,y:25}] Tolerance for autoScroll (how close one has to be near an edges for autoScroll to start). */
23
- overflowTolerance?: Vect2
24
- /** [=1] Zoom scale factor (in case of using CSS style transform: scale() which messes with real positions). Unit scale zoom. */
25
- zoom?: number
26
- /** [=false] if set to true, no styles (except for position absolute) will be applied by default */
27
- customStyles?: boolean
28
- /** [=false] Add newly selected elements to the selection instead of replacing them */
29
- multiSelectMode?: boolean
30
- /** [=true] Whether or not to toggle already active elements while multi-selecting */
31
- multiSelectToggling?: boolean
32
- /** [=['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. */
33
- multiSelectKeys?: DSMultiSelectKeys
34
- /** [=HTMLElement] the square that will draw the selection */
35
- selector?: HTMLElement
36
- /** [=0] how much % of the element has to be selected to be considered selected (0 = just touching, 1 = inside the selection) */
37
- selectionThreshold?: number
38
- /** [=true] When a user is dragging on an already selected element, the selection is dragged. */
39
- draggability?: boolean
40
- /** [=true] Whether an element is draggable from the start or needs to be selected first */
41
- immediateDrag?: boolean
42
- /** [=true] Whether or not the user can drag with the keyboard (we don't recommend disabling it) */
43
- keyboardDrag?: boolean
44
- /** [={up:['ArrowUp'],down:['ArrowDown'],left:['ArrowLeft'],righ:['ArrowRight']}] The keys available to drag element using the keyboard. */
45
- dragKeys?: DSDragKeys
46
- /** [=10] The speed at which elements are dragged using the keyboard. In pixels per keydown. */
47
- keyboardDragSpeed?: number
48
- /** [=true] Whether to use hardware accelerated css transforms when dragging or top/left instead */
49
- useTransform?: boolean
50
- /** [=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. */
51
- refreshMemoryRate?: number
52
- /** [=[]] one or more drop-elements: where the selectables can be dropped into */
53
- dropZones?: DSInputDropZone<E>[]
54
- /** [=1] how much % of the item has to be inside the dropzone to be considered inside (0 = barely touching, 1 = completely inside) */
55
- dropInsideThreshold?: number
56
- /** [=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) */
57
- dropTargetThreshold?: number
58
- /** [=false] Whether to use Pointer Events to replace traditional Mouse or Touch Events. Useful for tools like Google Blockly. */
59
- usePointerEvents?: boolean
60
- /** [=ds-hover] the class assigned to the mouse hovered items */
61
- hoverClass?: string
62
- /** [=ds-selectable] the class assigned to the elements that can be selected */
63
- selectableClass?: string
64
- /** [=ds-selected] the class assigned to the selected items */
65
- selectedClass?: string
66
- /** [=ds-selector] the class assigned to the square selector helper */
67
- selectorClass?: string
68
- /** [=ds-selector-area] the class assigned to the square in which the selector resides. By default it's invisible */
69
- selectorAreaClass?: string
70
- /** [=ds-dropped-target] on an item corresponding the target dropzone. This is also the prefix for ds-dropped-target-${zone.id} */
71
- droppedTargetClass?: string
72
- /** [=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} */
73
- droppedInsideClass?: string
74
- /** [=ds-droppable] on element that can be dropped into at least one container. This is also the prefix for ds-droppable-${zone.id} */
75
- droppableClass?: string
76
- /** [=ds-dropzone] on each dropZone */
77
- dropZoneClass?: string
78
- /** [=ds-dropzone-ready] on corresponding dropZone when element is dragged */
79
- dropZoneReadyClass?: string
80
- /** [=ds-dropzone-target] on dropZone that has elements from any successful target drop */
81
- dropZoneTargetClass?: string
82
- /** [=ds-dropzone-inside] on dropZone that has elements inside after any drop */
83
- dropZoneInsideClass?: string
84
- }
85
-
86
- export type DSCallbackObject<E extends DSInputElement> =
87
- Readonly<
88
- Partial<
89
- & DSSettingsPublishEventData<E>
90
- & DSAreaPublishEventData<E>
91
- & DSKeyStorePublishEventData
92
- & DSPointerStorePublishEventData
93
- & DSInteractionPublishEventData
94
- & DSSelectablePublishEventData<E>
95
- & DSSelectedPublishEventData<E>
96
- & DSPublicPublishAdditionalEventData<E>
97
- >
98
- >
99
-
100
- export type DSInputDropZone<E extends DSInputElement> = {
101
- /** can be any unique identifier of type string */
102
- id: string
103
- /** the dropzone itself */
104
- element: E // @TODO this would not be of type InputElement!
105
- /** elements that can be dropped into that zone. This is optional, by default it will be all selectables */
106
- droppables?: E[]
107
- }
108
-
109
- export type DSElementPos = {
110
- x: number,
111
- y: number,
112
- w: number,
113
- h: number,
114
- r: number,
115
- b: number
116
- }
117
-
118
- export type DSEdges = Array<'top'|'bottom'|'left'|'right'|undefined>
119
- export type DSEdgesObj = {top:number,bottom:number,left:number,right:number}
120
-
121
- /** area within which you can drag */
122
- export type DSArea = HTMLElement|SVGElement|Document
123
-
124
- /** area in which you can drag */
125
- export type DSSelectorArea = HTMLElement
126
-
127
- /** elements that can be selected */
128
- export type DSInputElement = HTMLElement | SVGElement
129
-
130
- /** element that can be selected */
131
- // export type DSElement = HTMLElement|SVGElement
132
-
133
- /** An array of keys that allows switching to the multi-select mode */
134
- export type DSMultiSelectKeys = Array<'Shift'|'Control'|'Meta'|string>
135
-
136
- export type DSEvent = KeyboardEvent|MouseEvent|PointerEvent|TouchEvent
137
-
138
- export type DSInternalEventName = DSSettingsPublishEventNames|DSAreaPublishEventNames|DSKeyStorePublishEventNames|DSPointerStorePublishEventNames|DSInteractionPublishEventNames|DSSelectablePublishEventNames|DSSelectedPublishEventNames
139
- export type DSCallbackName<E extends DSInputElement> = DSPublicPublishEventNames<E>|DSInternalEventName
140
-
141
- export type DSBoundingRectBase = {
142
- top: number,
143
- left: number,
144
- bottom: number,
145
- right: number,
146
- }
147
-
148
- export interface DSBoundingRect extends DSBoundingRectBase {
149
- width: number,
150
- height: number
151
- }
152
-
153
- export type DSDragKeys = {
154
- up: Array<string>,
155
- down: Array<string>,
156
- left: Array<string>,
157
- right: Array<string>
158
- }
File without changes