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/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 3.0.0
|
|
2
|
+
|
|
3
|
+
## Breaking Updates
|
|
4
|
+
|
|
5
|
+
### Moving the project to typescript
|
|
6
|
+
|
|
7
|
+
- Enable complex typings
|
|
8
|
+
- Removes typing issues from the past
|
|
9
|
+
|
|
10
|
+
### New license model
|
|
11
|
+
|
|
12
|
+
- Free to everything for non-commercial, paid for commercial projects
|
|
13
|
+
- Fees will be split with contributors
|
|
14
|
+
- Enables faster development cycles
|
|
15
|
+
- Keeps the lights on
|
|
16
|
+
- Attract talent to collaborate
|
|
17
|
+
|
|
18
|
+
### Callbacks Refactor
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
"elementselect" => "DS:select",
|
|
22
|
+
"elementunselect" => "DS:unselect",
|
|
23
|
+
"autoscroll" => "DS:scroll",
|
|
24
|
+
"dragstart" => "DS:start",
|
|
25
|
+
"dragmove" => "DS:update",
|
|
26
|
+
"callback" => "DS:end",
|
|
27
|
+
"preelementselect" => "DS:select:pre",
|
|
28
|
+
"preelementunselect" => "DS:unselect:pre",
|
|
29
|
+
"preautoscroll" => "DS:scroll:pre",
|
|
30
|
+
"predragstart" => "DS:start:pre",
|
|
31
|
+
"predragmove" => "DS:update:pre",
|
|
32
|
+
"precallback" => "DS:end:pre",
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- New callbacks:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
"DS:added:pre"
|
|
39
|
+
"DS:added"
|
|
40
|
+
"DS:removed:pre"
|
|
41
|
+
"DS:removed"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Box-Dragging as new default
|
|
45
|
+
|
|
46
|
+
- This is the default expected behaviour, hence if should be the default
|
|
47
|
+
|
|
48
|
+
### Removing self-hosted versions
|
|
49
|
+
|
|
50
|
+
- This was just bad practice from ancient times
|
|
51
|
+
|
|
52
|
+
## Extras (non-breaking)
|
|
53
|
+
|
|
54
|
+
- Previous setting `dragAsBlock` is the default behavior.
|
|
55
|
+
- Add an over-writeable method to filter the elements that are supposed to be dragged `.filterDragElements` [Override](https://www.DragSelect.com/docs/API/Overrides) inspired by [#158](https://github.com/ThibaultJanBeyer/DragSelect/pull/158)
|
|
56
|
+
- Fix persistance of `removeSelectables` as of [148](https://github.com/ThibaultJanBeyer/DragSelect/issues/148) note however, that the items are still in the settings, thus will be re-added when manually running `.start()`
|
|
57
|
+
- Add keyboard drop-zoning solving [149](https://github.com/ThibaultJanBeyer/DragSelect/issues/149)
|
|
58
|
+
- Fix key stroke bug [#181](https://github.com/ThibaultJanBeyer/DragSelect/issues/181)
|
|
59
|
+
|
|
60
|
+
# 2.7.4
|
|
2
61
|
|
|
3
62
|
- Fix typing issues [#175](https://github.com/ThibaultJanBeyer/DragSelect/issues/175) thanks [@Ruslan207](https://github.com/Ruslan207)
|
|
4
63
|
|
|
@@ -9,9 +68,9 @@
|
|
|
9
68
|
|
|
10
69
|
# 2.7.0
|
|
11
70
|
|
|
12
|
-
- Introduce blog-drag as alpha. It is supposed to fix dragging of multiple elements: dragging them as one block keeping aspect ratio positions on drag-scroll. Instead of moving elements individually. This was considered a bug. However as it is not fully tested it comes under a flag, please turn it on by setting `dragAsBlock: true`
|
|
71
|
+
- Introduce blog-drag as alpha. It is supposed to fix dragging of multiple elements: dragging them as one block keeping aspect ratio positions on drag-scroll. Instead of moving elements individually. This was considered a bug. However as it is not fully tested it comes under a flag, please turn it on by setting `dragAsBlock: true` and [report any issue you find here](https://github.com/ThibaultJanBeyer/DragSelect/issues). Thanks to [@rendertom](https://github.com/rendertom) for the addition [#162](https://github.com/ThibaultJanBeyer/DragSelect/pull/162).
|
|
13
72
|
|
|
14
|
-
|
|
73
|
+
_Note: this feature will be turned on by default in a future release once proper testing and all bugs are fixed_
|
|
15
74
|
|
|
16
75
|
# 2.6.1
|
|
17
76
|
|
|
@@ -21,7 +80,7 @@
|
|
|
21
80
|
|
|
22
81
|
- Introducing Overrides as a new concept to help advanced modification use-cases like [#150](https://github.com/ThibaultJanBeyer/DragSelect/issues/150) in collaboration with [@HollowMan6](https://github.com/HollowMan6)
|
|
23
82
|
- - See [Example use-case](https://dragselect.com/docs/guided-examples/Custom-Selection-Filter-Override) & [API for overrides](https://dragselect.com/docs/API/Overrides)
|
|
24
|
-
- Expose `filterSelected` in
|
|
83
|
+
- Expose `filterSelected` in `Selection` module
|
|
25
84
|
- Expose `isCollision` helper method
|
|
26
85
|
|
|
27
86
|
# 2.5.6
|
|
@@ -69,7 +128,7 @@
|
|
|
69
128
|
|
|
70
129
|
# 2.4.0-1
|
|
71
130
|
|
|
72
|
-
- Change all Properties dynamically
|
|
131
|
+
- Change all Properties dynamically _anytime_. Solves #111 and #95. Very helpful for async libraries like react. You can do so using the `setSettings` method, you can pass any settings in the object and they will be updated. Example: update the drag area at any time by running: `ds.setSettings({ area: document.getElementById("new-area") })`.
|
|
73
132
|
- Remove deprecated keys `ctrlKey`, `shiftKey` and `metaKey`. Use `Control`, `Shift` and `Meta` respectively instead.
|
|
74
133
|
- Remove deprecated method `getCursorPositionDifference`. Calculate the difference on your own instead.
|
|
75
134
|
- Remove deprecated setting property callbacks. Use `DragSelect.subscribe("callback", (callbackObject) => {})` instead.
|
|
@@ -84,7 +143,7 @@
|
|
|
84
143
|
- Fix bug with `pre` events not working properly.
|
|
85
144
|
- **Caution**:
|
|
86
145
|
- - This upgrade changes the order in which the callbacks are fired. The normal callbacks are fired in a FIFO order, first in, first out. The `pre` callbacks are fired in a LIFO order, last in first out.
|
|
87
|
-
- - Pre Events are now really triggered
|
|
146
|
+
- - Pre Events are now really triggered _before_ the whole action.
|
|
88
147
|
- Fixes issue [#110](https://github.com/ThibaultJanBeyer/DragSelect/issues/110) where teardown did not work properly
|
|
89
148
|
|
|
90
149
|
# 2.2.2
|
|
@@ -110,7 +169,7 @@ All these changes solve [#80](https://github.com/ThibaultJanBeyer/DragSelect/iss
|
|
|
110
169
|
# 2.1.2
|
|
111
170
|
|
|
112
171
|
- Fixes build error bug introduced by typings. Solves [#100](https://github.com/ThibaultJanBeyer/DragSelect/issues/100)
|
|
113
|
-
Issue: the JS-Docs files types.js was not included in d.ts files. Now rollup builds are force-including it.
|
|
172
|
+
Issue: the JS-Docs files types.js was not included in d.ts files. Now rollup builds are force-including it.
|
|
114
173
|
|
|
115
174
|
# 2.1.0-1
|
|
116
175
|
|
|
@@ -173,26 +232,38 @@ Changed the callbacks to follow a pub/sub pattern. They're not events you can su
|
|
|
173
232
|
Here is an example on what you'll have to change:
|
|
174
233
|
|
|
175
234
|
### Before
|
|
235
|
+
|
|
176
236
|
```javascript
|
|
177
237
|
const ds = new DragSelect({
|
|
178
|
-
callback: (items, event) => console.log(
|
|
179
|
-
onDragMove: (event) => console.log(
|
|
180
|
-
onDragStartBegin: (event) => console.log(
|
|
181
|
-
onDragStart: (event) => console.log(
|
|
182
|
-
onElementSelect: (item) => console.log(
|
|
183
|
-
onElementUnselect:
|
|
238
|
+
callback: (items, event) => console.log('my callback', items, event),
|
|
239
|
+
onDragMove: (event) => console.log('my callback', event),
|
|
240
|
+
onDragStartBegin: (event) => console.log('my callback', event),
|
|
241
|
+
onDragStart: (event) => console.log('my callback', event),
|
|
242
|
+
onElementSelect: (item) => console.log('my callback', item),
|
|
243
|
+
onElementUnselect: (item) => console.log('my callback', item),
|
|
184
244
|
})
|
|
185
245
|
```
|
|
186
246
|
|
|
187
247
|
### Now
|
|
248
|
+
|
|
188
249
|
```javascript
|
|
189
250
|
const ds = new DragSelect({})
|
|
190
|
-
ds.subscribe('callback', ({ items, item, event }) =>
|
|
191
|
-
|
|
251
|
+
ds.subscribe('callback', ({ items, item, event }) =>
|
|
252
|
+
console.log('my callback', items, event)
|
|
253
|
+
)
|
|
254
|
+
ds.subscribe('dragmove', ({ items, item, event }) =>
|
|
255
|
+
console.log('my callback', event)
|
|
256
|
+
)
|
|
192
257
|
// dragstartbegin was removed use dragstart instead
|
|
193
|
-
ds.subscribe('dragstart', ({ items, item, event }) =>
|
|
194
|
-
|
|
195
|
-
|
|
258
|
+
ds.subscribe('dragstart', ({ items, item, event }) =>
|
|
259
|
+
console.log('my callback', event)
|
|
260
|
+
)
|
|
261
|
+
ds.subscribe('elementselect', ({ items, item, event }) =>
|
|
262
|
+
console.log('my callback', item)
|
|
263
|
+
)
|
|
264
|
+
ds.subscribe('elementunselect', ({ items, item, event }) =>
|
|
265
|
+
console.log('my callback', item)
|
|
266
|
+
)
|
|
196
267
|
```
|
|
197
268
|
|
|
198
269
|
## Removed private and public methods (Breaking Change)
|
|
@@ -225,7 +296,7 @@ However, that means that the key names have changes. Following keys should be re
|
|
|
225
296
|
## Dropped IE Support
|
|
226
297
|
|
|
227
298
|
- Internet explorer is no longer supported. Following other big libraries. Dropping IE Support drastically reduces bundle size and improves maintainability of the project. Also following Microsoft itself, which [stopped support for IE all together](https://www.independent.co.uk/life-style/gadgets-and-tech/news/microsoft-internet-explorer-out-use-11-edge-a9676176.html). If you need IE support, please use a build tool that gives you IE Support with necessary polyfills for now and write support request stating your use-case. You can also consider using any versions prior 2.
|
|
228
|
-
We do support Edge and all other major browsers.
|
|
299
|
+
We do support Edge and all other major browsers.
|
|
229
300
|
|
|
230
301
|
## Impressive performance improvements
|
|
231
302
|
|
|
@@ -238,14 +309,16 @@ We compared the accumulated average execution times before and after the changes
|
|
|
238
309
|
- 11.36% faster by using an interaction pub/sub mechanism
|
|
239
310
|
- 15.86% faster by caching element positions (each update) & using more performant css class manipulations
|
|
240
311
|
- 28.36% faster by caching by bundling reflows and repaints
|
|
312
|
+
|
|
241
313
|
---
|
|
314
|
+
|
|
242
315
|
= 59,67% performance increase
|
|
243
316
|
|
|
244
317
|
# 1.15.1
|
|
245
318
|
|
|
246
319
|
- This is a preparation to some code-refactoring and bigger changes aimed for v2
|
|
247
320
|
- Preparation to deprecate `getScroll` and `getAreaRect`. They will both become internal methods. Unless you've valid reasons to keep exposing them.
|
|
248
|
-
- We will soon also prevent you from using most internal methods (those marked with `_` at the start). You'll not be able to extend them, nor override, nor use directly. Also here, unless you've valid reasons to keep them exposed.
|
|
321
|
+
- We will soon also prevent you from using most internal methods (those marked with `_` at the start). You'll not be able to extend them, nor override, nor use directly. Also here, unless you've valid reasons to keep them exposed.
|
|
249
322
|
|
|
250
323
|
# 1.15.0
|
|
251
324
|
|
|
@@ -306,6 +379,7 @@ We compared the accumulated average execution times before and after the changes
|
|
|
306
379
|
# 1.11.1
|
|
307
380
|
|
|
308
381
|
- Add em6 moduled files that have native `module export DragSelect` that can be used in for example:
|
|
382
|
+
|
|
309
383
|
```html
|
|
310
384
|
<script type="module">
|
|
311
385
|
import DragSelect from "path/to/DragSelect.es6m.js"
|
|
@@ -316,16 +390,16 @@ We compared the accumulated average execution times before and after the changes
|
|
|
316
390
|
# 1.11.0
|
|
317
391
|
|
|
318
392
|
- Moved the files from the `dist` folder to the `docs` folder to adhere to github pages standart
|
|
319
|
-
- Improve code stability by enforcing typechecks via JS-Docs, inspired by [truckjs](https://medium.com/@trukrs/type-safe-javascript-with-jsdoc-7a2a63209b76)
|
|
393
|
+
- Improve code stability by enforcing typechecks via JS-Docs, inspired by [truckjs](https://medium.com/@trukrs/type-safe-javascript-with-jsdoc-7a2a63209b76)
|
|
320
394
|
- Partial rewrite using native ES6 classes transpiling down to ES5 using babel.
|
|
321
|
-
|
|
395
|
+
_Note: first I refactored the code to TypeScript but then rolled back because it might limit the ability of external people to contribute due to the new language_
|
|
322
396
|
- Improve documentation by autogenerating it with JS-Docs
|
|
323
397
|
|
|
324
398
|
# 1.10.0
|
|
325
399
|
|
|
326
400
|
- Add touch device support (i.e. Mobile Phones)
|
|
327
401
|
- Preparations for modern code. I.e. ES6:
|
|
328
|
-
Usind Babel to transpile downwards to ES5. This should not result in any changes on your side.
|
|
402
|
+
Usind Babel to transpile downwards to ES5. This should not result in any changes on your side.
|
|
329
403
|
|
|
330
404
|
# 1.9.1
|
|
331
405
|
|