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.
Files changed (144) hide show
  1. package/CHANGELOG.md +97 -23
  2. package/LICENSE +690 -0
  3. package/README.md +2 -1
  4. package/jest-puppeteer.config.js +13 -3
  5. package/jest.config.js +5 -0
  6. package/package.json +40 -46
  7. package/rollup.config.mjs +82 -0
  8. package/src/DragSelect.ts +425 -0
  9. package/src/methods/addModificationObservers.ts +51 -0
  10. package/src/methods/canScroll.ts +19 -0
  11. package/src/methods/{createSelectorAreaElement.js → createSelectorAreaElement.ts} +1 -8
  12. package/src/methods/{createSelectorElement.js → createSelectorElement.ts} +1 -9
  13. package/src/methods/{debounce.js → debounce.ts} +5 -11
  14. package/src/methods/ensureArray.ts +13 -0
  15. package/src/methods/getAllParentNodes.ts +15 -0
  16. package/src/methods/{getAreaRect.js → getAreaRect.ts} +2 -6
  17. package/src/methods/getCurrentScroll.ts +14 -0
  18. package/src/methods/{documentScroll.js → getDocumentScroll.ts} +2 -2
  19. package/src/methods/{getOverflowEdges.js → getOverflowEdges.ts} +11 -11
  20. package/src/methods/getPointerPos.ts +9 -0
  21. package/src/methods/getSelectionRect.ts +29 -0
  22. package/src/methods/{getSelectorPosition.js → getSelectorPosition.ts} +11 -9
  23. package/src/methods/{getStylePosition.spec.js → getStylePosition.spec.ts} +9 -9
  24. package/src/methods/{getStylePosition.js → getStylePosition.ts} +5 -21
  25. package/src/methods/handleElementPositionAttribute.ts +15 -0
  26. package/src/methods/handleKeyboardDragPosDifference.ts +35 -0
  27. package/src/methods/handleSelection.ts +26 -0
  28. package/src/methods/{handleUnSelection.js → handleUnSelection.ts} +14 -14
  29. package/src/methods/{hydrateSettings.js → hydrateSettings.ts} +15 -26
  30. package/src/methods/isCollision.ts +66 -0
  31. package/src/methods/limitDirection.ts +36 -0
  32. package/src/methods/moveElement.ts +18 -0
  33. package/src/methods/{scrollElement.js → scrollElement.ts} +4 -10
  34. package/src/methods/{setStylePosition.js → setStylePosition.ts} +3 -11
  35. package/src/methods/subscriberAliases.ts +240 -0
  36. package/src/methods/updateElementStylePos.ts +7 -0
  37. package/src/methods/vect2.ts +34 -0
  38. package/src/modules/Area.ts +169 -0
  39. package/src/modules/Drag.ts +236 -0
  40. package/src/modules/{DropZone.js → DropZone.ts} +80 -119
  41. package/src/modules/DropZones.ts +151 -0
  42. package/src/modules/Interaction.ts +251 -0
  43. package/src/modules/PubSub.ts +111 -0
  44. package/src/modules/SelectableSet.ts +146 -0
  45. package/src/modules/SelectedSet.ts +92 -0
  46. package/src/modules/{Selection.js → Selection.ts} +59 -44
  47. package/src/modules/Selector.ts +81 -0
  48. package/src/modules/{SelectorArea.js → SelectorArea.ts} +58 -71
  49. package/src/stores/KeyStore.ts +92 -0
  50. package/src/stores/PointerStore.ts +194 -0
  51. package/src/stores/ScrollStore.ts +87 -0
  52. package/src/stores/SettingsStore.ts +88 -0
  53. package/src/types.ts +158 -0
  54. package/tsconfig.json +105 -0
  55. package/bower.json +0 -24
  56. package/dist/DragSelect.d.ts +0 -200
  57. package/dist/DragSelect.es6m.js +0 -3886
  58. package/dist/DragSelect.js +0 -3894
  59. package/dist/ds.es6m.min.js +0 -1
  60. package/dist/ds.min.js +0 -1
  61. package/dist/methods/addModificationObservers.d.ts +0 -11
  62. package/dist/methods/canScroll.d.ts +0 -3
  63. package/dist/methods/createSelectorAreaElement.d.ts +0 -3
  64. package/dist/methods/createSelectorElement.d.ts +0 -3
  65. package/dist/methods/debounce.d.ts +0 -3
  66. package/dist/methods/documentScroll.d.ts +0 -6
  67. package/dist/methods/getAllParentNodes.d.ts +0 -3
  68. package/dist/methods/getAreaRect.d.ts +0 -3
  69. package/dist/methods/getBoundingClientRect.d.ts +0 -4
  70. package/dist/methods/getCurrentScroll.d.ts +0 -3
  71. package/dist/methods/getOverflowEdges.d.ts +0 -7
  72. package/dist/methods/getPointerPos.d.ts +0 -5
  73. package/dist/methods/getSelectorPosition.d.ts +0 -12
  74. package/dist/methods/getStylePosition.d.ts +0 -3
  75. package/dist/methods/handleElementOverflow.d.ts +0 -10
  76. package/dist/methods/handleElementPositionAttribute.d.ts +0 -6
  77. package/dist/methods/handleKeyboardDragPosDifference.d.ts +0 -13
  78. package/dist/methods/handleSelection.d.ts +0 -9
  79. package/dist/methods/handleUnSelection.d.ts +0 -9
  80. package/dist/methods/hydrateSettings.d.ts +0 -3
  81. package/dist/methods/index.d.ts +0 -30
  82. package/dist/methods/isCollision.d.ts +0 -13
  83. package/dist/methods/moveElement.d.ts +0 -8
  84. package/dist/methods/removeModificationObservers.d.ts +0 -3
  85. package/dist/methods/scrollElement.d.ts +0 -3
  86. package/dist/methods/setStylePosition.d.ts +0 -3
  87. package/dist/methods/subscriberAliases.d.ts +0 -14
  88. package/dist/methods/toArray.d.ts +0 -3
  89. package/dist/methods/updateElementStylePos.d.ts +0 -8
  90. package/dist/methods/vect2.d.ts +0 -8
  91. package/dist/modules/Area.d.ts +0 -80
  92. package/dist/modules/Drag.d.ts +0 -71
  93. package/dist/modules/DropZone.d.ts +0 -90
  94. package/dist/modules/DropZones.d.ts +0 -73
  95. package/dist/modules/Interaction.d.ts +0 -51
  96. package/dist/modules/PubSub.d.ts +0 -37
  97. package/dist/modules/SelectableSet.d.ts +0 -43
  98. package/dist/modules/SelectedSet.d.ts +0 -32
  99. package/dist/modules/Selection.d.ts +0 -54
  100. package/dist/modules/Selector.d.ts +0 -29
  101. package/dist/modules/SelectorArea.d.ts +0 -58
  102. package/dist/modules/index.d.ts +0 -11
  103. package/dist/stores/KeyStore.d.ts +0 -34
  104. package/dist/stores/PointerStore.d.ts +0 -83
  105. package/dist/stores/ScrollStore.d.ts +0 -38
  106. package/dist/stores/SettingsStore.d.ts +0 -39
  107. package/dist/stores/index.d.ts +0 -5
  108. package/dist/types.d.ts +0 -276
  109. package/jsconfig.json +0 -13
  110. package/rollup.config.js +0 -101
  111. package/src/DragSelect.js +0 -384
  112. package/src/methods/addModificationObservers.js +0 -38
  113. package/src/methods/canScroll.js +0 -20
  114. package/src/methods/getAllParentNodes.js +0 -17
  115. package/src/methods/getBoundingClientRect.js +0 -33
  116. package/src/methods/getCurrentScroll.js +0 -15
  117. package/src/methods/getPointerPos.js +0 -13
  118. package/src/methods/handleElementOverflow.js +0 -65
  119. package/src/methods/handleElementPositionAttribute.js +0 -16
  120. package/src/methods/handleKeyboardDragPosDifference.js +0 -57
  121. package/src/methods/handleSelection.js +0 -26
  122. package/src/methods/index.js +0 -29
  123. package/src/methods/isCollision.js +0 -58
  124. package/src/methods/moveElement.js +0 -39
  125. package/src/methods/removeModificationObservers.js +0 -13
  126. package/src/methods/subscriberAliases.js +0 -72
  127. package/src/methods/toArray.js +0 -18
  128. package/src/methods/updateElementStylePos.js +0 -15
  129. package/src/methods/vect2.js +0 -54
  130. package/src/modules/Area.js +0 -183
  131. package/src/modules/Drag.js +0 -257
  132. package/src/modules/DropZones.js +0 -161
  133. package/src/modules/Interaction.js +0 -208
  134. package/src/modules/PubSub.js +0 -78
  135. package/src/modules/SelectableSet.js +0 -149
  136. package/src/modules/SelectedSet.js +0 -72
  137. package/src/modules/Selector.js +0 -90
  138. package/src/modules/index.js +0 -10
  139. package/src/stores/KeyStore.js +0 -83
  140. package/src/stores/PointerStore.js +0 -218
  141. package/src/stores/ScrollStore.js +0 -92
  142. package/src/stores/SettingsStore.js +0 -66
  143. package/src/stores/index.js +0 -4
  144. package/src/types.js +0 -100
@@ -1,83 +0,0 @@
1
- export default class PointerStore {
2
- /**
3
- * @class PointerStore
4
- * @constructor PointerStore
5
- * @param {{DS:DragSelect}} p
6
- * @ignore
7
- */
8
- constructor({ DS }: {
9
- DS: DragSelect;
10
- });
11
- /** @type {boolean} */
12
- _isMouseInteraction: boolean;
13
- /**
14
- * @type {Vect2}
15
- * @private
16
- * */
17
- private _initialValArea;
18
- /**
19
- * @type {Vect2}
20
- * @private
21
- * */
22
- private _currentValArea;
23
- /**
24
- * @type {Vect2}
25
- * @private
26
- * */
27
- private _lastValArea;
28
- /**
29
- * @type {Vect2}
30
- * @private
31
- * */
32
- private _initialVal;
33
- /**
34
- * @type {Vect2}
35
- * @private
36
- * */
37
- private _currentVal;
38
- /**
39
- * @type {Vect2}
40
- * @private
41
- * */
42
- private _lastVal;
43
- /**
44
- * @type {TouchEvent}
45
- * @private
46
- * */
47
- private _lastTouch;
48
- DS: DragSelect;
49
- Settings: Settings;
50
- init: () => void;
51
- /** @param {DSEvent} [event] */
52
- start(event?: DSEvent): void;
53
- set currentVal(arg: Vect2);
54
- /** Current pointer position */
55
- get currentVal(): Vect2;
56
- set initialVal(arg: Vect2);
57
- /** First recorded pointer position */
58
- get initialVal(): Vect2;
59
- /** @param {DSEvent} event */
60
- getPointerPosition: (event: DSEvent) => Vect2;
61
- /** @param {DSEvent} [event] */
62
- update: (event?: DSEvent) => void;
63
- stop: () => void;
64
- /** @param {DSEvent} [event] */
65
- reset: (event?: DSEvent) => void;
66
- set lastVal(arg: Vect2);
67
- /** Last recorded pointer position */
68
- get lastVal(): Vect2;
69
- /**
70
- * @param {DSEvent} event
71
- * @return {MouseEvent|PointerEvent|Touch}
72
- * @private
73
- */
74
- private _normalizedEvent;
75
- /** First recorded pointer position within the area */
76
- get initialValArea(): Vect2;
77
- /** Current pointer position within the area */
78
- get currentValArea(): Vect2;
79
- /** Last recorded pointer position within the area */
80
- get lastValArea(): Vect2;
81
- }
82
- import DragSelect from "../DragSelect";
83
- import "../types"
@@ -1,38 +0,0 @@
1
- export default class ScrollStore {
2
- /**
3
- * @class ScrollStore
4
- * @constructor ScrollStore
5
- * @param {{ DS:DragSelect }} p
6
- * @ignore
7
- */
8
- constructor({ DS }: {
9
- DS: DragSelect;
10
- });
11
- /**
12
- * @type {Vect2}
13
- * @private */
14
- private _initialVal;
15
- /**
16
- * @type {Vect2}
17
- * @private */
18
- private _currentVal;
19
- /**
20
- * @type {boolean}
21
- * @private */
22
- private _canScroll;
23
- DS: DragSelect;
24
- init: () => void;
25
- start: () => void;
26
- update: () => Vect2;
27
- stop: () => void;
28
- reset: () => void;
29
- get canScroll(): boolean;
30
- get scrollAmount(): {
31
- x: number;
32
- y: number;
33
- };
34
- get initialVal(): Vect2;
35
- get currentVal(): Vect2;
36
- }
37
- import DragSelect from "../DragSelect";
38
- import "../types"
@@ -1,39 +0,0 @@
1
- export default class SettingsStore {
2
- /**
3
- * @class ScrollStore
4
- * @constructor ScrollStore
5
- * @param {{ DS:DragSelect, settings:Settings }} p
6
- * @ignore
7
- */
8
- constructor({ DS, settings }: {
9
- DS: DragSelect;
10
- settings: Settings;
11
- });
12
- /**
13
- * @type {Settings}
14
- * @private
15
- * */
16
- private _settings;
17
- /**
18
- * Holds the settings and their previous value `:pre`
19
- * @example {
20
- * autoScrollSpeed: 3,
21
- * 'autoScrollSpeed:pre': 5
22
- * }
23
- * @type {Settings}
24
- * */
25
- s: Settings;
26
- DS: DragSelect;
27
- /** @param {{settings: Settings, init?: boolean}} props */
28
- update: ({ settings, init }: {
29
- settings: Settings;
30
- init?: boolean;
31
- }) => void;
32
- /** @param {{settings: Settings, init: boolean}} props */
33
- _update: ({ settings, init }: {
34
- settings: Settings;
35
- init: boolean;
36
- }) => void;
37
- }
38
- import DragSelect from "../DragSelect";
39
- import "../types"
@@ -1,5 +0,0 @@
1
- export { default as KeyStore } from "./KeyStore";
2
- export { default as PointerStore } from "./PointerStore";
3
- export { default as ScrollStore } from "./ScrollStore";
4
- export { default as SettingsStore } from "./SettingsStore";
5
- import "../types"
package/dist/types.d.ts DELETED
@@ -1,276 +0,0 @@
1
- /**
2
- * The Settings to be passed to the Class
3
- */
4
- type Settings = {
5
- /**
6
- * area in which you can drag. If not provided it will be the whole document
7
- */
8
- area?: HTMLElement | SVGElement | Document;
9
- /**
10
- * the elements that can be selected
11
- */
12
- selectables?: DSInputElements;
13
- /**
14
- * Speed in which the area scrolls while selecting (if available). Unit is pixel per movement.
15
- */
16
- autoScrollSpeed?: number;
17
- /**
18
- * Tolerance for autoScroll (how close one has to be near an edges for autoScroll to start)
19
- */
20
- overflowTolerance?: Vect2;
21
- /**
22
- * Zoom scale factor (in case of using CSS style transform: scale() which messes with real positions). Unit scale zoom.
23
- */
24
- zoom?: number;
25
- /**
26
- * if set to true, no styles (except for position absolute) will be applied by default
27
- */
28
- customStyles?: boolean;
29
- /**
30
- * Add newly selected elements to the selection instead of replacing them
31
- */
32
- multiSelectMode?: boolean;
33
- /**
34
- * Whether or not to toggle already active elements while multi-selecting
35
- */
36
- multiSelectToggling?: boolean;
37
- /**
38
- * 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.
39
- */
40
- multiSelectKeys?: DSMultiSelectKeys;
41
- /**
42
- * the square that will draw the selection
43
- */
44
- selector?: HTMLElement;
45
- /**
46
- * how much % of the element has to be selected to be considered selected (0 = just touching, 1 = inside the selection)
47
- */
48
- selectionThreshold?: number;
49
- /**
50
- * When a user is dragging on an already selected element, the selection is dragged.
51
- */
52
- draggability?: boolean;
53
- /**
54
- * Whether an element is draggable from the start or needs to be selected first
55
- */
56
- immediateDrag?: boolean;
57
- /**
58
- * Whether or not the user can drag with the keyboard (we don't recommend disabling it)
59
- */
60
- keyboardDrag?: boolean;
61
- /**
62
- * The keys available to drag element using the keyboard.
63
- */
64
- dragKeys?: DSDragKeys;
65
- /**
66
- * The speed at which elements are dragged using the keyboard. In pixels per keydown.
67
- */
68
- keyboardDragSpeed?: number;
69
- /**
70
- * Whether to use hardware accelerated css transforms when dragging or top/left instead
71
- */
72
- useTransform?: boolean;
73
- /**
74
- * 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.
75
- */
76
- refreshMemoryRate?: number;
77
- /**
78
- * one or more drop-elements: where the selectables can be dropped into
79
- */
80
- dropZones?: DSInputDropZone[];
81
- /**
82
- * how much % of the item has to be inside the dropzone to be considered inside (0 = barely touching, 1 = completely inside)
83
- */
84
- dropInsideThreshold?: number;
85
- /**
86
- * 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)
87
- */
88
- dropTargetThreshold?: number;
89
- /**
90
- * Whether to use Pointer Events to replace traditional Mouse or Touch Events. Useful for tools like Google Blockly.
91
- */
92
- usePointerEvents?: boolean;
93
- /**
94
- * the class assigned to the mouse hovered items
95
- */
96
- hoverClass?: string;
97
- /**
98
- * the class assigned to the elements that can be selected
99
- */
100
- selectableClass?: string;
101
- /**
102
- * the class assigned to the selected items
103
- */
104
- selectedClass?: string;
105
- /**
106
- * the class assigned to the square selector helper
107
- */
108
- selectorClass?: string;
109
- /**
110
- * the class assigned to the square in which the selector resides. By default it's invisible
111
- */
112
- selectorAreaClass?: string;
113
- /**
114
- * on an item corresponding the target dropzone. This is also the prefix for ds-dropped-target-${zone.id}
115
- */
116
- droppedTargetClass?: string;
117
- /**
118
- * on an item that is within its dropzone bounds after a drop. This is also the prefix for ds-dropped-inside-${zone.id}
119
- */
120
- droppedInsideClass?: string;
121
- /**
122
- * on element that can be dropped into at least one container. This is also the prefix for ds-droppable-${zone.id}
123
- */
124
- droppableClass?: string;
125
- /**
126
- * on each dropZone
127
- */
128
- dropZoneClass?: string;
129
- /**
130
- * on corresponding dropZone when element is dragged
131
- */
132
- dropZoneReadyClass?: string;
133
- /**
134
- * on dropZone that has elements from any successful target drop
135
- */
136
- dropZoneTargetClass?: string;
137
- /**
138
- * on dropZone that has elements inside after any drop
139
- */
140
- dropZoneInsideClass?: string;
141
- /**
142
- * whether to drag multiple elements as a single block or as individual items
143
- */
144
- dragAsBlock?: boolean;
145
- };
146
- /**
147
- * The Object that is passed back to any callback method
148
- */
149
- type CallbackObject = {
150
- /**
151
- * The items currently selected
152
- */
153
- items?: Array<HTMLElement | SVGElement | any>;
154
- /**
155
- * The respective event object
156
- */
157
- event?: MouseEvent | TouchEvent | PointerEvent | KeyboardEvent | Event;
158
- /**
159
- * The single item currently interacted with
160
- */
161
- item?: HTMLElement | SVGElement | any;
162
- /**
163
- * Whether the interaction is a drag or a select
164
- */
165
- isDragging?: boolean;
166
- /**
167
- * Whether or not the drag interaction is via keyboard
168
- */
169
- isDraggingKeyboard?: boolean;
170
- /**
171
- * Pressed key (lowercase)
172
- */
173
- key?: string;
174
- /**
175
- * the settings being updates/manipulated/passed, also holds the previous value. i.e. updating selectorClass will publish { settings: { selectorClass: 'newVal', 'selectorClass:pre': 'oldVal' } }
176
- */
177
- settings?: Settings;
178
- scroll_directions?: Array<'top' | 'bottom' | 'left' | 'right' | undefined>;
179
- scroll_multiplier?: number;
180
- /**
181
- * The dropZone element that the element was dropped into (or the mouse is currently hovering over)
182
- */
183
- dropTarget?: DSDropZone;
184
- };
185
- type DSCallback = Function;
186
- type DSInputDropZone = {
187
- /**
188
- * can be any unique identifier of type string
189
- */
190
- id: string;
191
- /**
192
- * is the dropzone itself
193
- */
194
- element: DSElement;
195
- /**
196
- * the elements that can be dropped into that zone. This is optional, by default it will be all selectables
197
- */
198
- droppables?: DSInputElements;
199
- };
200
- type DSDropZone = {
201
- id: string;
202
- element: DSElement;
203
- droppables: DSElements;
204
- /**
205
- * the items related to the target zone
206
- */
207
- itemsDropped?: DSElements;
208
- /**
209
- * the items that are within the targets bounds
210
- */
211
- itemsInside?: DSElements;
212
- };
213
- type Vect2 = {
214
- x: number;
215
- y: number;
216
- };
217
- type DSElementPos = {
218
- x: number;
219
- y: number;
220
- w: number;
221
- h: number;
222
- r: number;
223
- b: number;
224
- };
225
- type DSEdges = Array<'top' | 'bottom' | 'left' | 'right' | undefined>;
226
- /**
227
- * area within which you can drag
228
- */
229
- type DSArea = HTMLElement | SVGElement | Document;
230
- /**
231
- * area in which you can drag
232
- */
233
- type DSSelectorArea = HTMLElement;
234
- /**
235
- * the elements that can be selected
236
- */
237
- type DSInputElements = Array<HTMLElement | SVGElement> | HTMLElement | SVGElement;
238
- /**
239
- * the elements that can be selected
240
- */
241
- type DSElements = Array<HTMLElement | SVGElement>;
242
- /**
243
- * a single element that can be selected
244
- */
245
- type DSElement = HTMLElement | SVGElement;
246
- /**
247
- * en event from a touch or mouse interaction
248
- */
249
- type DSEvent = MouseEvent | TouchEvent | PointerEvent;
250
- /**
251
- * An array of keys that allows switching to the multi-select mode
252
- */
253
- type DSMultiSelectKeys = Array<'Shift' | 'Control' | 'Meta' | string>;
254
- type DSEventNames = 'dragmove' | 'autoscroll' | 'dragstart' | 'elementselect' | 'elementunselect' | 'callback';
255
- type DSInternalEventNames = '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';
256
- type DSInternalEventNamesPre = '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';
257
- type DSInternalSettingEvents = 'Settings:updated' | 'Settings:updated:pre' | 'Settings:updated:*' | 'Settings:updated:*:pre';
258
- /**
259
- * the name of the callback
260
- */
261
- type DSCallbackNames = DSEventNames | DSInternalEventNames | DSInternalEventNamesPre | DSInternalSettingEvents;
262
- type DSBoundingRect = {
263
- top: number;
264
- left: number;
265
- bottom: number;
266
- right: number;
267
- width: number;
268
- height: number;
269
- };
270
- type DSDragKeys = {
271
- up: string[];
272
- down: string[];
273
- left: string[];
274
- right: string[];
275
- };
276
- type DSModificationCallback = (event: any) => any;
package/jsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "checkJs": true,
4
- "target": "es5"
5
- },
6
- "exclude": [
7
- "node_modules",
8
- "**/node_modules/*",
9
- "__tests__/**/*",
10
- "dist/**/*",
11
- "docs/**/*",
12
- ]
13
- }
package/rollup.config.js DELETED
@@ -1,101 +0,0 @@
1
- import babel from '@rollup/plugin-babel'
2
- import fs from 'fs'
3
- import glob from 'glob'
4
- import resolve from '@rollup/plugin-node-resolve'
5
- import { terser } from 'rollup-plugin-terser'
6
-
7
- let typesDone = false
8
- const banner = `/***
9
-
10
- ~~~ Version ${process.env.npm_package_version} ~~~
11
-
12
- ******************************************
13
-
14
- ____ _____ __ __
15
- / __ \\_________ _____ _/ ___/___ / /__ _____/ /_
16
- / / / / ___/ __ \`/ __ \`/\\__ \\/ _ \\/ / _ \\/ ___/ __/
17
- / /_/ / / / /_/ / /_/ /___/ / __/ / __/ /__/ /_
18
- /_____/_/ \\__,_/\\__, //____/\\___/_/\\___/\\___/\\__/
19
- /____/
20
-
21
- ******************************************
22
-
23
- {*} {*} STAR THIS PLUGIN ON GITHUB {*} {*}
24
-
25
- https://github.com/ThibaultJanBeyer/DragSelect
26
- Please give it a like, this is what makes me happy :-)
27
- Thank You
28
-
29
- {*} {*} STAR THIS PLUGIN ON GITHUB {*} {*}
30
-
31
- ******************************************
32
- ********* The MIT License (MIT) **********
33
- ******************************************
34
- Created 2017 by ThibaultJanBeyer
35
- web: http://www.DragSelect.com/
36
- github: https://github.com/ThibaultJanBeyer/DragSelect
37
-
38
- */`
39
-
40
- export default {
41
- input: 'src/DragSelect.js',
42
- output: [
43
- {
44
- file: 'dist/DragSelect.es6m.js',
45
- format: 'es',
46
- name: 'DragSelect',
47
- banner,
48
- },
49
- {
50
- file: 'dist/DragSelect.js',
51
- format: 'umd',
52
- name: 'DragSelect',
53
- banner,
54
- },
55
- {
56
- file: 'dist/ds.es6m.min.js',
57
- format: 'es',
58
- name: 'DragSelect',
59
- compact: true,
60
- plugins: [terser()],
61
- },
62
- {
63
- file: 'dist/ds.min.js',
64
- format: 'umd',
65
- name: 'DragSelect',
66
- compact: true,
67
- plugins: [terser()],
68
- },
69
- ],
70
- plugins: [
71
- resolve(),
72
- babel({ babelHelpers: 'bundled' }),
73
- {
74
- name: 'add-types', // solves build issue caused by types (#100)
75
- writeBundle() {
76
- if (typesDone) return
77
- typesDone = true
78
- console.info(`Adding types to all ts files`)
79
- glob('dist/**/*.d.ts', (er, files) => {
80
- if (er) throw er
81
- files.forEach((fileName) => {
82
- if (fileName.includes('types.d.ts')) return
83
- const depth = fileName.match(/\//g).length
84
- const relativeDir = depth === 1 ? './' : '../'.repeat(depth - 1)
85
- fs.appendFile(fileName, `import "${relativeDir}types"\n`, (err) => {
86
- if (err) throw err
87
- })
88
- })
89
- })
90
- },
91
- },
92
- {
93
- name: 'disable-treeshaking',
94
- transform(code, id) {
95
- if (id.endsWith('types.js')) {
96
- return { moduleSideEffects: 'no-treeshake' }
97
- }
98
- },
99
- },
100
- ],
101
- }