dragselect 3.0.2 → 3.0.4

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 (53) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +1 -1
  3. package/dist/{DragSelect.es6m.js → DragSelect.esm.js} +11 -4
  4. package/dist/DragSelect.js +11 -4
  5. package/dist/{ds.es6m.min.js → ds.esm.min.js} +1 -1
  6. package/dist/ds.min.js +1 -1
  7. package/package.json +3 -3
  8. package/src/DragSelect.ts +0 -425
  9. package/src/methods/addModificationObservers.ts +0 -51
  10. package/src/methods/canScroll.ts +0 -19
  11. package/src/methods/createSelectorAreaElement.ts +0 -8
  12. package/src/methods/createSelectorElement.ts +0 -13
  13. package/src/methods/debounce.ts +0 -31
  14. package/src/methods/ensureArray.ts +0 -13
  15. package/src/methods/getAllParentNodes.ts +0 -15
  16. package/src/methods/getAreaRect.ts +0 -27
  17. package/src/methods/getCurrentScroll.ts +0 -14
  18. package/src/methods/getDocumentScroll.ts +0 -5
  19. package/src/methods/getOverflowEdges.ts +0 -27
  20. package/src/methods/getPointerPos.ts +0 -9
  21. package/src/methods/getSelectionRect.ts +0 -29
  22. package/src/methods/getSelectorPosition.ts +0 -74
  23. package/src/methods/getStylePosition.spec.ts +0 -114
  24. package/src/methods/getStylePosition.ts +0 -83
  25. package/src/methods/handleElementPositionAttribute.ts +0 -15
  26. package/src/methods/handleKeyboardDragPosDifference.ts +0 -35
  27. package/src/methods/handleSelection.ts +0 -26
  28. package/src/methods/handleUnSelection.ts +0 -36
  29. package/src/methods/hydrateSettings.ts +0 -245
  30. package/src/methods/isCollision.ts +0 -66
  31. package/src/methods/limitDirection.ts +0 -36
  32. package/src/methods/moveElement.ts +0 -18
  33. package/src/methods/scrollElement.ts +0 -26
  34. package/src/methods/setStylePosition.ts +0 -16
  35. package/src/methods/subscriberAliases.ts +0 -240
  36. package/src/methods/updateElementStylePos.ts +0 -7
  37. package/src/methods/vect2.ts +0 -34
  38. package/src/modules/Area.ts +0 -169
  39. package/src/modules/Drag.ts +0 -236
  40. package/src/modules/DropZone.ts +0 -223
  41. package/src/modules/DropZones.ts +0 -151
  42. package/src/modules/Interaction.ts +0 -251
  43. package/src/modules/PubSub.ts +0 -111
  44. package/src/modules/SelectableSet.ts +0 -146
  45. package/src/modules/SelectedSet.ts +0 -92
  46. package/src/modules/Selection.ts +0 -133
  47. package/src/modules/Selector.ts +0 -81
  48. package/src/modules/SelectorArea.ts +0 -161
  49. package/src/stores/KeyStore.ts +0 -92
  50. package/src/stores/PointerStore.ts +0 -194
  51. package/src/stores/ScrollStore.ts +0 -87
  52. package/src/stores/SettingsStore.ts +0 -88
  53. package/src/types.ts +0 -158
@@ -1,29 +0,0 @@
1
- import SelectableSet from '../modules/SelectableSet'
2
- import SelectedSet from '../modules/SelectedSet'
3
- import { DSBoundingRect, DSInputElement } from '../types'
4
-
5
- // @TODO: calculate the difference in all directions based on the mouse position! (since the selection square ratio won’t change we don’t have to re-calculate and re-fetch the position of every element in the square during drag)
6
-
7
- /** Returns the compound bounding rect of multiple elements */
8
- export const getSelectionRect = <E extends DSInputElement>(SelectedSet: SelectedSet<E>): DSBoundingRect => {
9
- const rect = {
10
- top: Number.POSITIVE_INFINITY,
11
- left: Number.POSITIVE_INFINITY,
12
- bottom: Number.NEGATIVE_INFINITY,
13
- right: Number.NEGATIVE_INFINITY,
14
- width: Number.NEGATIVE_INFINITY,
15
- height: Number.NEGATIVE_INFINITY,
16
- }
17
-
18
- SelectedSet.rects.forEach(elementRect => {
19
- rect.top = Math.min(rect.top, elementRect.top || rect.top)
20
- rect.left = Math.min(rect.left, elementRect.left || rect.left)
21
- rect.bottom = Math.max(rect.bottom, elementRect.bottom || rect.bottom)
22
- rect.right = Math.max(rect.right, elementRect.right || rect.right)
23
- })
24
-
25
- rect.height = rect.bottom - rect.top
26
- rect.width = rect.right - rect.left
27
-
28
- return rect
29
- }
@@ -1,74 +0,0 @@
1
- import { DSBoundingRect, Vect2 } from "../types"
2
-
3
- type Params = {
4
- scrollAmount: Vect2
5
- initialPointerPos: Vect2
6
- pointerPos: Vect2
7
- }
8
-
9
- /** Reliably returns the exact x,y,w,h positions of the selector element */
10
- export const getSelectorPosition = ({ scrollAmount, initialPointerPos, pointerPos }: Params) => {
11
- /** check for direction
12
- *
13
- * This is quite complicated, so also quite complicated to explain. Lemme’ try:
14
- *
15
- * Problem #1:
16
- * Sadly in HTML we can not have negative sizes.
17
- * so if we want to scale our element 10px to the right then it is easy,
18
- * we just have to add +10px to the width. But if we want to scale the element
19
- * -10px to the left then things become more complicated, we have to move
20
- * the element -10px to the left on the x axis and also scale the element
21
- * by +10px width to fake a negative sizing.
22
- *
23
- * One solution to this problem is using css-transforms scale() with
24
- * transform-origin of top left. BUT we can’t use this since it will size
25
- * everything, then when your element has a border for example, the border will
26
- * get inanely huge. Also transforms are not widely supported in IE.
27
- *
28
- * Example #1:
29
- * Unfortunately, things get even more complicated when we are inside a scroll-able
30
- * DIV. Then, let’s say we scroll to the right by 10px and move the cursor right by 5px in our
31
- * checks we have to subtract 10px from the initialcursor position in our check
32
- * (since the initial position is moved to the left by 10px) so in our example:
33
- * 1. pointerPos.x (5) > initialPointerPos.x (0) - scrollAmount.x (10) === 5 > -10 === true
34
- * then set the x position to the cursors start position
35
- * selectorPos.x = initialPointerPos.x (0) - scrollAmount.x (10) === 10 // 2.
36
- * then we can calculate the elements width, which is
37
- * the new cursor position minus the initial one plus the scroll amount, so in our example:
38
- * 3. selectorPos.w = pointerPos.x (5) - initialPointerPos.x (0) + scrollAmount.x (10) === 15;
39
- *
40
- * let’s say after that movement we now scroll 20px to the left and move our cursor by 30px to the left:
41
- * 1b. pointerPos.x (-30) > initialPointerPos.x (0) - scrollAmount.x (-20) === -30 < --20 === -30 < +20 === false;
42
- * 2b. selectorPos.x = pointerPos.x (-30) === -30; move left position to cursor (for more info see Problem #1)
43
- * 3b. selectorPos.w = initialPointerPos.x (0) - pointerPos.x (-30) - scrollAmount.x (-20) === 0--30--20 === 0+30+20 === 50; // scale width to original left position (for more info see Problem #1)
44
- *
45
- * same thing has to be done for top/bottom
46
- *
47
- * I hope that makes sense. Try stuff out and play around with variables to get a hang of it.
48
- */
49
- const selectorPos: Partial<DSBoundingRect> = {}
50
-
51
- // right
52
- if (pointerPos.x > initialPointerPos.x - scrollAmount.x) {
53
- // 1.
54
- selectorPos.left = initialPointerPos.x - scrollAmount.x // 2.
55
- selectorPos.width = pointerPos.x - initialPointerPos.x + scrollAmount.x // 3.
56
- // left
57
- } else {
58
- // 1b.
59
- selectorPos.left = pointerPos.x // 2b.
60
- selectorPos.width = initialPointerPos.x - pointerPos.x - scrollAmount.x // 3b.
61
- }
62
-
63
- // bottom
64
- if (pointerPos.y > initialPointerPos.y - scrollAmount.y) {
65
- selectorPos.top = initialPointerPos.y - scrollAmount.y
66
- selectorPos.height = pointerPos.y - initialPointerPos.y + scrollAmount.y
67
- // top
68
- } else {
69
- selectorPos.top = pointerPos.y
70
- selectorPos.height = initialPointerPos.y - pointerPos.y - scrollAmount.y
71
- }
72
-
73
- return selectorPos
74
- }
@@ -1,114 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
-
5
- import { getStylePosition } from './getStylePosition'
6
-
7
- describe('getStylePosition', () => {
8
- describe('top/left', () => {
9
- it('returns the simple styles', async () => {
10
- document.body.innerHTML = /*html*/ `
11
- <div id="test" style="top:1px; left:2px"></div>
12
- `
13
- const element = document.getElementById('test') as HTMLElement
14
- const position = getStylePosition(element)
15
-
16
- expect(position).toMatchObject({
17
- x: 2,
18
- y: 1,
19
- })
20
- })
21
-
22
- it('falls back to computed styles when set but not defined', async () => {
23
- document.body.innerHTML = /*html*/ `
24
- <style>#test { top: 3px; left: 4px }</style>
25
- <div id="test"></div>
26
- `
27
- const element = document.getElementById('test') as HTMLElement
28
- const position = getStylePosition(element)
29
-
30
- expect(position).toMatchObject({
31
- x: 4,
32
- y: 3,
33
- })
34
- })
35
-
36
- it('falls back to computed styles when not set', async () => {
37
- document.body.innerHTML = /*html*/ `<div id="test"></div>`
38
- const element = document.getElementById('test') as HTMLElement
39
- const position = getStylePosition(element)
40
- expect(position).toMatchObject({
41
- x: 0,
42
- y: 0,
43
- })
44
- })
45
- })
46
-
47
- describe('translate/3d', () => {
48
- it('gets the simple styles', async () => {
49
- document.body.innerHTML = /*html*/ `
50
- <div id="test" style="transform: translate(5px, 6px) rotate(45deg)"></div>
51
- `
52
- const element = document.getElementById('test') as HTMLElement
53
- const position = getStylePosition(element, true)
54
-
55
- expect(position).toMatchObject({
56
- x: 5,
57
- y: 6,
58
- })
59
- })
60
-
61
- it('gets the simple 3d styles', async () => {
62
- document.body.innerHTML = /*html*/ `
63
- <div id="test" style="transform: translate3d(7px, 8px, 0) scale(1.5)"></div>
64
- `
65
- const element = document.getElementById('test') as HTMLElement
66
- const position = getStylePosition(element, true)
67
-
68
- expect(position).toMatchObject({
69
- x: 7,
70
- y: 8,
71
- })
72
- })
73
-
74
- it('falls back to computed styles', async () => {
75
- // computed transforms are translated to a matrix. Jest Dom does not do that conversion, so we do it manually here
76
- document.body.innerHTML = /*html*/ `
77
- <style>#test { transform: matrix(1, 0.267949, 0.267949, 1, 9, 10) }</style>
78
- <div id="test"></div>
79
- `
80
- const element = document.getElementById('test') as HTMLElement
81
- const position = getStylePosition(element, true)
82
-
83
- expect(position).toMatchObject({
84
- x: 9,
85
- y: 10,
86
- })
87
- })
88
-
89
- it('falls back to computed 3d styles', async () => {
90
- // computed transforms are translated to a matrix. Jest Dom does not do that conversion, so we do it manually here
91
- document.body.innerHTML = /*html*/ `
92
- <style>#test { transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 11, 12, 1, 1) }</style>
93
- <div id="test"></div>
94
- `
95
- const element = document.getElementById('test') as HTMLElement
96
- const position = getStylePosition(element, true)
97
-
98
- expect(position).toMatchObject({
99
- x: 11,
100
- y: 12,
101
- })
102
- })
103
-
104
- it('falls back to computed styles when not set', async () => {
105
- document.body.innerHTML = /*html*/ `<div id="test"></div>`
106
- const element = document.getElementById('test') as HTMLElement
107
- const position = getStylePosition(element, true)
108
- expect(position).toMatchObject({
109
- x: 0,
110
- y: 0,
111
- })
112
- })
113
- })
114
- })
@@ -1,83 +0,0 @@
1
- import { DSInputElement, Vect2 } from "../types"
2
-
3
- const getComputedTranslatePositions = <E extends DSInputElement>(element: E) => {
4
- const position = {
5
- x: 0,
6
- y: 0,
7
- }
8
-
9
- const computed = window.getComputedStyle(element)
10
- if (!computed.transform || computed.transform === 'none') return position
11
-
12
- if (computed.transform.indexOf('3d') >= 0) {
13
- const match = computed.transform.trim().match(/matrix3d\((.*?)\)/)
14
- if (match && match.length) {
15
- const values = match[1]?.split(',')
16
- position.x = parseInt(values[12]) || 0
17
- position.y = parseInt(values[13]) || 0
18
- }
19
- return position
20
- }
21
- const match = computed.transform.trim().match(/matrix\((.*?)\)/)
22
- if (match && match.length) {
23
- const values = match[1]?.split(',')
24
- position.x = parseInt(values[4]) || 0
25
- position.y = parseInt(values[5]) || 0
26
- }
27
- return position
28
- }
29
-
30
- const getTranslatedPositions = <E extends DSInputElement>(element: E) => {
31
- const { transform } = element.style
32
-
33
- if (!transform || transform.indexOf('translate') < 0)
34
- return getComputedTranslatePositions(element)
35
-
36
- const position = {
37
- x: 0,
38
- y: 0,
39
- }
40
-
41
- const match = transform.trim().match(/translate[3dD]*?\(.*?\)/)
42
- if (match) {
43
- const split = match[0]?.split('(')
44
- if (split) {
45
- const values = split[1]?.split(',')
46
- position.x = parseInt(values[0]) || 0
47
- position.y = parseInt(values[1]) || 0
48
- }
49
- }
50
-
51
- if (!position.x && !position.x) return getComputedTranslatePositions(element)
52
-
53
- return position
54
- }
55
-
56
- const getTopLeftPosition = <E extends DSInputElement>(element: E) => {
57
- const { style } = element
58
-
59
- const position = {
60
- x: parseInt(style.left) || 0,
61
- y: parseInt(style.top) || 0,
62
- }
63
-
64
- // initial positions
65
- if (!position.x && !position.x) {
66
- const computed = window.getComputedStyle(element)
67
- return {
68
- x: parseInt(computed.left) || 0,
69
- y: parseInt(computed.top) || 0,
70
- }
71
- }
72
-
73
- return position
74
- }
75
-
76
- /**
77
- * Returns the X and Y coordinates based on styles
78
- * Can handle translate and top/left
79
- */
80
- export const getStylePosition = <E extends DSInputElement>(element: E, useTranslate?: boolean): Vect2 => {
81
- if (useTranslate) return getTranslatedPositions(element)
82
- return getTopLeftPosition(element)
83
- }
@@ -1,15 +0,0 @@
1
- import { DSArea } from "../types"
2
-
3
- type Props = {
4
- computedStyle: CSSStyleDeclaration
5
- node: DSArea
6
- }
7
-
8
- /** Fix: some elements have to have a special position attribute for calculations */
9
- export const handleElementPositionAttribute = ({ computedStyle, node }: Props) => {
10
- const { position } = computedStyle
11
- const isPositioned =
12
- position === 'absolute' || position === 'relative' || position === 'fixed'
13
- if (!(node instanceof Document) && !isPositioned)
14
- node.style.position = 'relative'
15
- }
@@ -1,35 +0,0 @@
1
- import { DSDragKeys, DSEdges, Vect2 } from "../types"
2
-
3
- type Props = {
4
- /** The keyboard key that was pressed */
5
- key: string
6
- shiftKey: boolean
7
- keyboardDragSpeed: number
8
- zoom: number
9
- scrollDiff: Vect2
10
- dragKeys?: DSDragKeys
11
- }
12
- export const handleKeyboardDragPosDifference = ({
13
- shiftKey,
14
- keyboardDragSpeed,
15
- zoom,
16
- key,
17
- dragKeys,
18
- scrollDiff,
19
- }: Props): Vect2 => {
20
- const posDirection = { x: 0, y: 0 }
21
- const increase = shiftKey
22
- ? keyboardDragSpeed * 4 * zoom
23
- : keyboardDragSpeed * zoom
24
-
25
- if (dragKeys?.left.includes(key))
26
- posDirection.x = scrollDiff.x || -increase
27
- if (dragKeys?.right.includes(key))
28
- posDirection.x = scrollDiff.x || increase
29
- if (dragKeys?.up.includes(key))
30
- posDirection.y = scrollDiff.y || -increase
31
- if (dragKeys?.down.includes(key))
32
- posDirection.y = scrollDiff.y || increase
33
-
34
- return posDirection
35
- }
@@ -1,26 +0,0 @@
1
- import SelectedSet from "../modules/SelectedSet"
2
- import { DSInputElement } from "../types"
3
-
4
- type Props<E extends DSInputElement> = {
5
- element: E
6
- force?: boolean
7
- multiSelectionToggle: boolean
8
- SelectedSet: SelectedSet<E>
9
- hoverClassName: string
10
- }
11
-
12
- /** Logic when an element is selected */
13
- export const handleSelection = <E extends DSInputElement>({
14
- element,
15
- force,
16
- multiSelectionToggle,
17
- SelectedSet,
18
- hoverClassName,
19
- }: Props<E>) => {
20
- if (element.classList.contains(hoverClassName) && !force) return
21
-
22
- if (!SelectedSet.has(element)) SelectedSet.add(element)
23
- else if (multiSelectionToggle) SelectedSet.delete(element)
24
-
25
- element.classList.add(hoverClassName)
26
- }
@@ -1,36 +0,0 @@
1
- import SelectedSet from "../modules/SelectedSet"
2
- import { DSInputElement } from "../types"
3
-
4
- type Props<E extends DSInputElement> = {
5
- element: E
6
- force?: boolean
7
- SelectedSet: SelectedSet<E>
8
- PrevSelectedSet: Set<E>
9
- hoverClassName: string
10
- }
11
-
12
- /** Logic when an element is de-selected */
13
- export const handleUnSelection = <E extends DSInputElement>({
14
- element,
15
- force,
16
- SelectedSet,
17
- PrevSelectedSet,
18
- hoverClassName,
19
- }: Props<E>) => {
20
- if (!element.classList.contains(hoverClassName) && !force) return
21
-
22
- const inSelection = SelectedSet.has(element)
23
- const inPrevSelection = PrevSelectedSet.has(element)
24
-
25
- /**
26
- * Special for issue #9.
27
- * if a multi-select-key is pressed, ds 'remembers' the last selection and reverts
28
- * to that state if the selection is not kept, to mimic the natural OS behaviour
29
- * = if item was selected and is not in selection anymore, reselect it
30
- * = if item was not selected and is not in selection anymore, unselect it
31
- */
32
- if (inSelection && !inPrevSelection) SelectedSet.delete(element)
33
- else if (!inSelection && inPrevSelection) SelectedSet.add(element)
34
-
35
- element.classList.remove(hoverClassName)
36
- }
@@ -1,245 +0,0 @@
1
- import { DSInputElement, Settings } from "../types"
2
-
3
- const wrongTypeWarn = (key: string, type: string) =>
4
- console.warn(
5
- `[DragSelect] TypeIssue: setting "${key}" is not of type "${type}".`
6
- )
7
-
8
- const hydrateHelper = <K extends string, V>(key: K, value: V, withFallback?: boolean, fallback?: V): {
9
- [key in K]: V;
10
- } | {} => {
11
- // no value available
12
- if (value === undefined) return withFallback ? { [key]: fallback } : {}
13
- // force unsetting of a value
14
- if (value === null) return { [key]: null }
15
-
16
- // TypeCheck [GENERIC]
17
- let isAvailable = true // if it’s not undefined, it was set voluntarily
18
- let forceFallback = false
19
-
20
- // TypeCheck [String]
21
- const expectedString = typeof fallback === 'string'
22
- if (expectedString)
23
- isAvailable = typeof value === 'string' || value instanceof String
24
- if (expectedString && !isAvailable) {
25
- forceFallback = true
26
- wrongTypeWarn(key, 'string')
27
- }
28
-
29
- // TypeCheck [Number]
30
- const expectedNumber = !Number.isNaN(fallback) && typeof fallback === 'number'
31
- if (expectedNumber)
32
- isAvailable = !Number.isNaN(value) && typeof value === 'number'
33
- if (expectedNumber && !isAvailable) {
34
- forceFallback = true
35
- wrongTypeWarn(key, 'number')
36
- }
37
-
38
- // TypeCheck [Object]
39
- const expectedObject =
40
- Object.prototype.toString.call(fallback) === '[object Object]'
41
- if (expectedObject)
42
- isAvailable = Object.prototype.toString.call(value) === '[object Object]'
43
- if (expectedObject && !isAvailable) {
44
- forceFallback = true
45
- wrongTypeWarn(key, 'object')
46
- }
47
-
48
- // TypeCheck [Boolean]
49
- const expectedBoolean = typeof fallback === 'boolean'
50
- if (expectedBoolean) isAvailable = typeof value === 'boolean'
51
- if (expectedBoolean && !isAvailable) {
52
- forceFallback = true
53
- wrongTypeWarn(key, 'boolean')
54
- }
55
-
56
- // TypeCheck [Array]
57
- const expectedArray = Array.isArray(fallback)
58
- if (expectedArray) isAvailable = Array.isArray(value)
59
- if (expectedArray && !isAvailable) {
60
- forceFallback = true
61
- wrongTypeWarn(key, 'array')
62
- }
63
-
64
- const isFallback = forceFallback || withFallback
65
-
66
- // Special rule for [dragKeys]
67
- if (key === 'dragKeys' && isAvailable)
68
- return { [key]: Object.assign(fallback as {}, value) }
69
- if (key === 'dragKeys' && !isAvailable)
70
- return isFallback ? { [key]: fallback } : {}
71
-
72
- // Special rule for [dropZones]
73
- if (
74
- key === 'dropZones' &&
75
- isAvailable &&
76
- Array.isArray(value) &&
77
- new Set(value.map((v) => v.id)).size !== value.length
78
- )
79
- console.warn(
80
- `[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.`
81
- )
82
-
83
- if (isAvailable) return { [key]: value }
84
- if (isFallback) return { [key]: fallback }
85
- return {}
86
- }
87
-
88
- /**
89
- * This helper method creates the setting object,
90
- * - if the settings provided are of wrong type, the fallback value will be used
91
- * - - except for if settings are undefined or explicitly marked as "null"
92
- * - if "withfallback" is true, it will return the object with all settings:
93
- * - - if not provided from the settings object (or wrong type), the fallback will be used
94
- * (the fallback value for each setting is the last prop of the hydrateHelper)
95
- */
96
- export const hydrateSettings = <E extends DSInputElement>(settings: Settings<E>, withFallback: boolean): Required<Settings<E>> => ({
97
- ...hydrateHelper('area', settings.area, withFallback, document),
98
- ...hydrateHelper('selectables', settings.selectables, withFallback, null),
99
- ...hydrateHelper(
100
- 'autoScrollSpeed',
101
- settings.autoScrollSpeed,
102
- withFallback,
103
- 5
104
- ),
105
- ...hydrateHelper(
106
- 'overflowTolerance',
107
- settings.overflowTolerance,
108
- withFallback,
109
- { x: 25, y: 25 }
110
- ),
111
- ...hydrateHelper('zoom', settings.zoom, withFallback, 1),
112
- ...hydrateHelper('customStyles', settings.customStyles, withFallback, false),
113
- ...hydrateHelper(
114
- 'multiSelectMode',
115
- settings.multiSelectMode,
116
- withFallback,
117
- false
118
- ),
119
- ...hydrateHelper(
120
- 'multiSelectToggling',
121
- settings.multiSelectToggling,
122
- withFallback,
123
- true
124
- ),
125
- ...hydrateHelper('multiSelectKeys', settings.multiSelectKeys, withFallback, [
126
- 'Control',
127
- 'Shift',
128
- 'Meta',
129
- ]),
130
- ...hydrateHelper('selector', settings.selector, withFallback, null),
131
- ...hydrateHelper(
132
- 'selectionThreshold',
133
- settings.selectionThreshold,
134
- withFallback,
135
- 0
136
- ),
137
- ...hydrateHelper('draggability', settings.draggability, withFallback, true),
138
- ...hydrateHelper('immediateDrag', settings.immediateDrag, withFallback, true),
139
- ...hydrateHelper('keyboardDrag', settings.keyboardDrag, withFallback, true),
140
- ...hydrateHelper('dragKeys', settings.dragKeys, withFallback, {
141
- up: ['ArrowUp'],
142
- down: ['ArrowDown'],
143
- left: ['ArrowLeft'],
144
- right: ['ArrowRight'],
145
- }),
146
- ...hydrateHelper(
147
- 'keyboardDragSpeed',
148
- settings.keyboardDragSpeed,
149
- withFallback,
150
- 10
151
- ),
152
- ...hydrateHelper('useTransform', settings.useTransform, withFallback, true),
153
- ...hydrateHelper(
154
- 'refreshMemoryRate',
155
- settings.refreshMemoryRate,
156
- withFallback,
157
- 80
158
- ),
159
- ...hydrateHelper('dropZones', settings.dropZones, withFallback, []),
160
- ...hydrateHelper(
161
- 'dropInsideThreshold',
162
- settings.dropInsideThreshold,
163
- withFallback,
164
- 1
165
- ),
166
- ...hydrateHelper(
167
- 'dropTargetThreshold',
168
- settings.dropTargetThreshold,
169
- withFallback,
170
- 0
171
- ),
172
- ...hydrateHelper(
173
- 'usePointerEvents',
174
- settings.usePointerEvents,
175
- withFallback,
176
- false
177
- ),
178
- ...hydrateHelper('hoverClass', settings.hoverClass, withFallback, 'ds-hover'),
179
- ...hydrateHelper(
180
- 'selectableClass',
181
- settings.selectableClass,
182
- withFallback,
183
- 'ds-selectable'
184
- ),
185
- ...hydrateHelper(
186
- 'selectedClass',
187
- settings.selectedClass,
188
- withFallback,
189
- 'ds-selected'
190
- ),
191
- ...hydrateHelper(
192
- 'selectorClass',
193
- settings.selectorClass,
194
- withFallback,
195
- 'ds-selector'
196
- ),
197
- ...hydrateHelper(
198
- 'selectorAreaClass',
199
- settings.selectorAreaClass,
200
- withFallback,
201
- 'ds-selector-area'
202
- ),
203
- ...hydrateHelper(
204
- 'droppedTargetClass',
205
- settings.droppedTargetClass,
206
- withFallback,
207
- 'ds-dropped-target'
208
- ),
209
- ...hydrateHelper(
210
- 'droppedInsideClass',
211
- settings.droppedInsideClass,
212
- withFallback,
213
- 'ds-dropped-inside'
214
- ),
215
- ...hydrateHelper(
216
- 'droppableClass',
217
- settings.droppableClass,
218
- withFallback,
219
- 'ds-droppable'
220
- ),
221
- ...hydrateHelper(
222
- 'dropZoneClass',
223
- settings.dropZoneClass,
224
- withFallback,
225
- 'ds-dropzone'
226
- ),
227
- ...hydrateHelper(
228
- 'dropZoneReadyClass',
229
- settings.dropZoneReadyClass,
230
- withFallback,
231
- 'ds-dropzone-ready'
232
- ),
233
- ...hydrateHelper(
234
- 'dropZoneTargetClass',
235
- settings.dropZoneTargetClass,
236
- withFallback,
237
- 'ds-dropzone-target'
238
- ),
239
- ...hydrateHelper(
240
- 'dropZoneInsideClass',
241
- settings.dropZoneInsideClass,
242
- withFallback,
243
- 'ds-dropzone-inside'
244
- ),
245
- } as Required<Settings<E>>)