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
package/dist/DragSelect.d.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
export default DragSelect;
|
|
2
|
-
declare class DragSelect {
|
|
3
|
-
/**
|
|
4
|
-
* @class DragSelect
|
|
5
|
-
* @constructor DragSelect
|
|
6
|
-
* @param {Settings} settings
|
|
7
|
-
*/
|
|
8
|
-
constructor(settings: Settings);
|
|
9
|
-
/**
|
|
10
|
-
* used to skip all current Selection and dragNdrop functionality
|
|
11
|
-
* @type {boolean}
|
|
12
|
-
*/
|
|
13
|
-
continue: boolean;
|
|
14
|
-
PubSub: PubSub;
|
|
15
|
-
subscribe: (eventName: DSCallbackNames, callback: Function) => number;
|
|
16
|
-
unsubscribe: (eventName: DSCallbackNames, callback?: Function, id?: number) => void;
|
|
17
|
-
publish: (eventName: DSCallbackNames | DSCallbackNames[], data: CallbackObject) => void;
|
|
18
|
-
stores: {
|
|
19
|
-
SettingsStore: SettingsStore;
|
|
20
|
-
PointerStore: PointerStore;
|
|
21
|
-
ScrollStore: ScrollStore;
|
|
22
|
-
KeyStore: KeyStore;
|
|
23
|
-
};
|
|
24
|
-
Area: Area;
|
|
25
|
-
Selector: Selector;
|
|
26
|
-
SelectorArea: SelectorArea;
|
|
27
|
-
SelectableSet: SelectableSet;
|
|
28
|
-
SelectedSet: SelectedSet;
|
|
29
|
-
Selection: Selection;
|
|
30
|
-
Drag: Drag;
|
|
31
|
-
DropZones: DropZones;
|
|
32
|
-
Interaction: Interaction;
|
|
33
|
-
/**
|
|
34
|
-
* Initializes the functionality. Automatically triggered when created.
|
|
35
|
-
* Also, reset the functionality after a teardown
|
|
36
|
-
*/
|
|
37
|
-
start: () => void;
|
|
38
|
-
stopped: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Complete function teardown
|
|
41
|
-
* Will teardown/stop the whole functionality
|
|
42
|
-
* @param {boolean} [remove] - if elements should be removed.
|
|
43
|
-
* @param {boolean} [fromSelection] - if elements should also be added/removed to the selection.
|
|
44
|
-
* @param {boolean} [withCallback] - if elements should also be added/removed to the selection.
|
|
45
|
-
*/
|
|
46
|
-
stop(remove?: boolean, fromSelection?: boolean, withCallback?: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* Utility to override DragSelect internal functionality:
|
|
49
|
-
* Break will skip the selection or dragging functionality (until after the callback) but let everything continue to run.
|
|
50
|
-
* Useful utility to write your own functionality/move/dragNdrop based on DragSelect pointer positions.
|
|
51
|
-
*/
|
|
52
|
-
break: () => boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Update any setting dynamically
|
|
55
|
-
* @param {Settings} settings
|
|
56
|
-
* @return {void}
|
|
57
|
-
*/
|
|
58
|
-
setSettings: (settings: Settings) => void;
|
|
59
|
-
/**
|
|
60
|
-
* Returns the current selected nodes
|
|
61
|
-
* @return {DSElements}
|
|
62
|
-
*/
|
|
63
|
-
getSelection: () => DSElements;
|
|
64
|
-
/**
|
|
65
|
-
* Adds several elements to the selection list also adds the specific classes and take into account all calculations.
|
|
66
|
-
* Does not clear the selection, in contrary to .setSelection. Can add multiple elements at once
|
|
67
|
-
* @param {DSInputElements} elements one or multiple elements
|
|
68
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
69
|
-
* @param {boolean} [dontAddToSelectables] - if element should not be added to the list of selectable elements
|
|
70
|
-
* @return {DSElements} all selected elements
|
|
71
|
-
*/
|
|
72
|
-
addSelection(elements: DSInputElements, triggerCallback?: boolean, dontAddToSelectables?: boolean): DSElements;
|
|
73
|
-
/**
|
|
74
|
-
* Removes specific elements from the selection
|
|
75
|
-
* Multiple elements can be given at once, in contrary to unselect
|
|
76
|
-
* @param {DSInputElements} elements one or multiple elements
|
|
77
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
78
|
-
* @param {boolean} [removeFromSelectables] - if element should be removed from the list of selectable elements
|
|
79
|
-
* @return {DSElements} all selected elements
|
|
80
|
-
*/
|
|
81
|
-
removeSelection(elements: DSInputElements, triggerCallback?: boolean, removeFromSelectables?: boolean): DSElements;
|
|
82
|
-
/**
|
|
83
|
-
* Toggles specific elements from the selection:
|
|
84
|
-
* If element is not in selection it will be added, if it is already selected, it will be removed.
|
|
85
|
-
* Multiple elements can be given at once.
|
|
86
|
-
* @param {DSInputElements} elements one or multiple elements
|
|
87
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
88
|
-
* @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
|
|
89
|
-
* @return {DSElements} all selected elements
|
|
90
|
-
*/
|
|
91
|
-
toggleSelection(elements: DSInputElements, triggerCallback?: boolean, removeFromSelectables?: boolean): DSElements;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the current selected elements and optionally run the callback
|
|
94
|
-
* By default, adds new elements also to the list of selectables
|
|
95
|
-
* @param {DSInputElements} elements – dom elements
|
|
96
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
97
|
-
* @param {boolean} [dontAddToSelectables] - if element should not be added to the list of selectable elements
|
|
98
|
-
* @return {DSElements}
|
|
99
|
-
*/
|
|
100
|
-
setSelection(elements: DSInputElements, triggerCallback?: boolean, dontAddToSelectables?: boolean): DSElements;
|
|
101
|
-
/**
|
|
102
|
-
* Unselect / Deselect all current selected Nodes
|
|
103
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
104
|
-
* @return {DSElements} this.selected, should be empty
|
|
105
|
-
*/
|
|
106
|
-
clearSelection(triggerCallback?: boolean): DSElements;
|
|
107
|
-
/**
|
|
108
|
-
* Add elements that can be selected. No node is added twice
|
|
109
|
-
* @param {DSInputElements} elements dom element(s)
|
|
110
|
-
* @param {boolean} [addToSelection] if elements should also be added to current selection
|
|
111
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
112
|
-
* @return {DSInputElements} the added element(s)
|
|
113
|
-
*/
|
|
114
|
-
addSelectables(elements: DSInputElements, addToSelection?: boolean, triggerCallback?: boolean): DSInputElements;
|
|
115
|
-
/**
|
|
116
|
-
* Gets all nodes that can potentially be selected
|
|
117
|
-
* @return {DSElements} this.selectables
|
|
118
|
-
*/
|
|
119
|
-
getSelectables: () => DSElements;
|
|
120
|
-
/**
|
|
121
|
-
* Sets all elements that can be selected.
|
|
122
|
-
* Removes all current selectables (& their respective classes).
|
|
123
|
-
* Adds the new set to the selectables set, thus replacing the original set.
|
|
124
|
-
* @param {DSInputElements} elements – dom element(s)
|
|
125
|
-
* @param {boolean} [removeFromSelection] if elements should also be removed from current selection
|
|
126
|
-
* @param {boolean} [addToSelection] if elements should also be added to current selection
|
|
127
|
-
* @return {DSInputElements} elements – the added element(s)
|
|
128
|
-
*/
|
|
129
|
-
setSelectables(elements: DSInputElements, removeFromSelection?: boolean, addToSelection?: boolean): DSInputElements;
|
|
130
|
-
/**
|
|
131
|
-
* Remove elements from the elements that can be selected.
|
|
132
|
-
* @param {DSInputElements} elements – dom element(s)
|
|
133
|
-
* @param {boolean} [removeFromSelection] if elements should also be removed from current selection
|
|
134
|
-
* @param {boolean} [triggerCallback] - if callback should be called
|
|
135
|
-
* @return {DSInputElements} the removed element(s)
|
|
136
|
-
*/
|
|
137
|
-
removeSelectables(elements: DSInputElements, removeFromSelection?: boolean, triggerCallback?: boolean): DSInputElements;
|
|
138
|
-
/** The starting/initial position of the cursor/selector @return {Vect2} */
|
|
139
|
-
getInitialCursorPosition: () => Vect2;
|
|
140
|
-
/** The last seen position of the cursor/selector @return {Vect2} */
|
|
141
|
-
getCurrentCursorPosition: () => Vect2;
|
|
142
|
-
/** The previous position of the cursor/selector @return {Vect2} */
|
|
143
|
-
getPreviousCursorPosition: () => Vect2;
|
|
144
|
-
/** The starting/initial position of the cursor/selector @return {Vect2} */
|
|
145
|
-
getInitialCursorPositionArea: () => Vect2;
|
|
146
|
-
/** The last seen position of the cursor/selector @return {Vect2} */
|
|
147
|
-
getCurrentCursorPositionArea: () => Vect2;
|
|
148
|
-
/** The previous position of the cursor/selector @return {Vect2} */
|
|
149
|
-
getPreviousCursorPositionArea: () => Vect2;
|
|
150
|
-
/**
|
|
151
|
-
* Whether the multi-selection key was pressed
|
|
152
|
-
* @param {DSEvent|KeyboardEvent} [event]
|
|
153
|
-
* @return {boolean}
|
|
154
|
-
*/
|
|
155
|
-
isMultiSelect: (event?: DSEvent | KeyboardEvent) => boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Whether the user is currently drag n dropping elements (instead of selection)
|
|
158
|
-
* @return {boolean}
|
|
159
|
-
*/
|
|
160
|
-
isDragging: () => boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Returns first DropsZone under coordinates,
|
|
163
|
-
* if no coordinated provided current pointer coordinates are used
|
|
164
|
-
* @param {Vect2} [coordinates]
|
|
165
|
-
* @returns {DSDropZone | undefined}
|
|
166
|
-
*/
|
|
167
|
-
getZoneByCoordinates: (coordinates?: Vect2) => DSDropZone | undefined;
|
|
168
|
-
/**
|
|
169
|
-
* Returns itemsDropped into zone by zone id
|
|
170
|
-
* @param {string} zoneId
|
|
171
|
-
* @returns {DSElements|void}
|
|
172
|
-
*/
|
|
173
|
-
getItemsDroppedByZoneId: (zoneId: string) => DSElements | void;
|
|
174
|
-
/**
|
|
175
|
-
* Returns itemsInside by zone id
|
|
176
|
-
* @param {string} zoneId
|
|
177
|
-
* @param {boolean} addClasses whether or not to add/remove the "inside" classes to the items
|
|
178
|
-
* @returns {DSElements|void}
|
|
179
|
-
*/
|
|
180
|
-
getItemsInsideByZoneId: (zoneId: string, addClasses: boolean) => DSElements | void;
|
|
181
|
-
}
|
|
182
|
-
declare namespace DragSelect {
|
|
183
|
-
export { isCollision };
|
|
184
|
-
}
|
|
185
|
-
import { PubSub } from "./modules";
|
|
186
|
-
import { SettingsStore } from "./stores";
|
|
187
|
-
import { PointerStore } from "./stores";
|
|
188
|
-
import { ScrollStore } from "./stores";
|
|
189
|
-
import { KeyStore } from "./stores";
|
|
190
|
-
import { Area } from "./modules";
|
|
191
|
-
import { Selector } from "./modules";
|
|
192
|
-
import { SelectorArea } from "./modules";
|
|
193
|
-
import { SelectableSet } from "./modules";
|
|
194
|
-
import { SelectedSet } from "./modules";
|
|
195
|
-
import { Selection } from "./modules";
|
|
196
|
-
import { Drag } from "./modules";
|
|
197
|
-
import { DropZones } from "./modules";
|
|
198
|
-
import { Interaction } from "./modules";
|
|
199
|
-
import { isCollision } from "./methods";
|
|
200
|
-
import "./types"
|