tiny-essentials 1.27.1 → 1.28.1
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/README.md +1 -0
- package/changelog/1/28/0.md +16 -0
- package/changelog/1/28/1.md +23 -0
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -2
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -2
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -2
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +57 -9
- package/dist/v1/basics/array.d.mts +27 -11
- package/dist/v1/basics/array.mjs +51 -9
- package/dist/v1/basics/clock.cjs +94 -42
- package/dist/v1/basics/clock.d.mts +10 -10
- package/dist/v1/basics/clock.mjs +91 -54
- package/dist/v1/basics/deprecated/html.cjs +246 -0
- package/dist/v1/basics/deprecated/html.d.mts +63 -0
- package/dist/v1/basics/deprecated/html.mjs +190 -0
- package/dist/v1/basics/extendObjType/Buffer.cjs +13 -0
- package/dist/v1/basics/extendObjType/Buffer.d.mts +4 -0
- package/dist/v1/basics/extendObjType/Buffer.mjs +8 -0
- package/dist/v1/basics/html.cjs +149 -130
- package/dist/v1/basics/html.d.mts +26 -61
- package/dist/v1/basics/html.mjs +113 -105
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +3 -1
- package/dist/v1/basics/index.mjs +3 -3
- package/dist/v1/basics/mediaContent.cjs +51 -9
- package/dist/v1/basics/mediaContent.d.mts +0 -87
- package/dist/v1/basics/mediaContent.mjs +40 -10
- package/dist/v1/basics/objChecker.cjs +7 -5
- package/dist/v1/basics/objChecker.d.mts +3 -2
- package/dist/v1/basics/objChecker.mjs +6 -6
- package/dist/v1/basics/objFilter.cjs +40 -18
- package/dist/v1/basics/objFilter.d.mts +6 -6
- package/dist/v1/basics/objFilter.mjs +32 -17
- package/dist/v1/basics/simpleMath.cjs +81 -25
- package/dist/v1/basics/simpleMath.d.mts +2 -2
- package/dist/v1/basics/simpleMath.mjs +70 -27
- package/dist/v1/basics/text.cjs +76 -31
- package/dist/v1/basics/text.d.mts +69 -7
- package/dist/v1/basics/text.mjs +62 -31
- package/dist/v1/index.cjs +4 -2
- package/dist/v1/index.d.mts +4 -2
- package/dist/v1/index.mjs +4 -4
- package/dist/v1/libs/TinyAdvancedRaffle.cjs +71 -255
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +6 -134
- package/dist/v1/libs/TinyAdvancedRaffle.mjs +69 -228
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +4 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
- package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
- package/dist/v1/libs/TinyAnalogClock.d.mts +6 -0
- package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
- package/dist/v1/libs/TinyClipboard.cjs +2 -0
- package/dist/v1/libs/TinyClipboard.d.mts +4 -2
- package/dist/v1/libs/TinyClipboard.mjs +2 -0
- package/dist/v1/libs/TinyColorConverter.cjs +1 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +2 -1
- package/dist/v1/libs/TinyColorConverter.mjs +1 -0
- package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
- package/dist/v1/libs/TinyDayNightCycle.d.mts +2 -7
- package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
- package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
- package/dist/v1/libs/TinyDragDropDetector.d.mts +6 -0
- package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
- package/dist/v1/libs/TinyDragger.cjs +46 -19
- package/dist/v1/libs/TinyDragger.mjs +45 -18
- package/dist/v1/libs/TinyElementObserver.cjs +39 -0
- package/dist/v1/libs/TinyElementObserver.d.mts +6 -0
- package/dist/v1/libs/TinyElementObserver.mjs +36 -0
- package/dist/v1/libs/TinyGamepad.cjs +131 -1
- package/dist/v1/libs/TinyGamepad.mjs +129 -1
- package/dist/v1/libs/TinyHtml.cjs +1 -1
- package/dist/v1/libs/TinyHtml.mjs +2 -2
- package/dist/v1/libs/TinyI18.cjs +61 -0
- package/dist/v1/libs/TinyI18.d.mts +14 -0
- package/dist/v1/libs/TinyI18.mjs +55 -0
- package/dist/v1/libs/TinyIframeEvents.cjs +26 -196
- package/dist/v1/libs/TinyIframeEvents.d.mts +3 -122
- package/dist/v1/libs/TinyIframeEvents.mjs +26 -171
- package/dist/v1/libs/TinyLocalStorage.cjs +53 -205
- package/dist/v1/libs/TinyLocalStorage.d.mts +6 -127
- package/dist/v1/libs/TinyLocalStorage.mjs +50 -178
- package/dist/v1/libs/TinyMediaPlayer.cjs +74 -2
- package/dist/v1/libs/TinyMediaPlayer.d.mts +12 -2
- package/dist/v1/libs/TinyMediaPlayer.mjs +68 -2
- package/dist/v1/libs/TinyNewWinEvents.cjs +39 -197
- package/dist/v1/libs/TinyNewWinEvents.d.mts +6 -119
- package/dist/v1/libs/TinyNewWinEvents.mjs +36 -172
- package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
- package/dist/v1/libs/TinyNotifyCenter.d.mts +6 -0
- package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
- package/dist/v1/libs/TinyRadioFm.cjs +40 -3
- package/dist/v1/libs/TinyRadioFm.d.mts +3 -3
- package/dist/v1/libs/TinyRadioFm.mjs +37 -3
- package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
- package/dist/v1/libs/TinyRateLimiter.d.mts +6 -0
- package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
- package/dist/v1/libs/TinySmartScroller.cjs +56 -205
- package/dist/v1/libs/TinySmartScroller.d.mts +19 -152
- package/dist/v1/libs/TinySmartScroller.mjs +55 -181
- package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
- package/dist/v1/libs/TinyTextDiffer.d.mts +1 -0
- package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
- package/dist/v1/libs/TinyTextarea.cjs +19 -0
- package/dist/v1/libs/TinyTextarea.d.mts +6 -0
- package/dist/v1/libs/TinyTextarea.mjs +17 -0
- package/dist/v1/libs/TinyTimeout.cjs +11 -1
- package/dist/v1/libs/TinyTimeout.mjs +9 -1
- package/dist/v1/libs/TinyToastNotify.cjs +35 -0
- package/dist/v1/libs/TinyToastNotify.d.mts +6 -0
- package/dist/v1/libs/TinyToastNotify.mjs +31 -0
- package/dist/v1/libs/TinyUploadClicker.cjs +20 -0
- package/dist/v1/libs/TinyUploadClicker.d.mts +6 -0
- package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +17 -3
- package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
- package/dist/v1/libs/utils.cjs +21 -0
- package/dist/v1/libs/utils.d.mts +2 -0
- package/dist/v1/libs/utils.mjs +16 -0
- package/docs/v1/Exports.md +0 -1
- package/docs/v1/README.md +1 -1
- package/docs/v1/basics/array.md +2 -2
- package/docs/v1/basics/deprecated/html.md +17 -0
- package/docs/v1/basics/fullScreen.md +1 -1
- package/docs/v1/basics/html.md +12 -26
- package/docs/v1/basics/mediaContent.md +1 -1
- package/docs/v1/basics/objChecker.md +1 -1
- package/docs/v1/basics/objFilter.md +1 -1
- package/docs/v1/basics/text.md +2 -2
- package/docs/v1/fileManager/main.md +1 -1
- package/docs/v1/libs/ColorSafeStringify.md +1 -1
- package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
- package/docs/v1/libs/TinyAnalogClock.md +1 -1
- package/docs/v1/libs/TinyArrayComparator.md +1 -1
- package/docs/v1/libs/TinyArrayPaginator.md +1 -1
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
- package/docs/v1/libs/TinyClassManager.md +1 -1
- package/docs/v1/libs/TinyClipboard.md +1 -1
- package/docs/v1/libs/TinyCookieConsent.md +1 -1
- package/docs/v1/libs/TinyDomReadyManager.md +1 -1
- package/docs/v1/libs/TinyDragDropDetector.md +1 -1
- package/docs/v1/libs/TinyDragger.md +1 -1
- package/docs/v1/libs/TinyElementObserver.md +1 -1
- package/docs/v1/libs/TinyHtml.md +1 -1
- package/docs/v1/libs/TinyIframeEvents.md +10 -10
- package/docs/v1/libs/TinyLevelUp.md +1 -1
- package/docs/v1/libs/TinyLoadingScreen.md +1 -1
- package/docs/v1/libs/TinyLocalStorage.md +3 -3
- package/docs/v1/libs/TinyNewWinEvents.md +10 -11
- package/docs/v1/libs/TinyNotifications.md +1 -1
- package/docs/v1/libs/TinyPromiseQueue.md +2 -2
- package/docs/v1/libs/TinyTextDiffer.md +1 -1
- package/docs/v1/libs/TinyTextarea.md +1 -1
- package/package.json +15 -5
- package/dist/v1/TinyBasicsEs.min.js.LICENSE.txt +0 -8
- package/dist/v1/TinyEssentials.min.js.LICENSE.txt +0 -8
- package/dist/v1/TinyEvents.min.js +0 -1
- package/dist/v1/TinyUploadClicker.min.js.LICENSE.txt +0 -8
- package/dist/v1/build/TinyEvents.cjs +0 -7
- package/dist/v1/build/TinyEvents.d.mts +0 -3
- package/dist/v1/build/TinyEvents.mjs +0 -2
- package/dist/v1/libs/TinyEvents.cjs +0 -395
- package/dist/v1/libs/TinyEvents.d.mts +0 -164
- package/dist/v1/libs/TinyEvents.mjs +0 -360
- package/docs/v1/libs/TinyEvents.md +0 -187
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
var TinyHtml = require('./TinyHtml.cjs');
|
|
4
4
|
var collision = require('../basics/collision.cjs');
|
|
5
5
|
var objChecker = require('../basics/objChecker.cjs');
|
|
6
|
+
var utils = require('./utils.cjs');
|
|
7
|
+
|
|
8
|
+
const checkDestroy = utils.createCheckDestroyed('TinyDragger');
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* @typedef {Object} VibrationPatterns
|
|
@@ -196,7 +199,7 @@ class TinyDragger {
|
|
|
196
199
|
* Enables the drag functionality.
|
|
197
200
|
*/
|
|
198
201
|
enable() {
|
|
199
|
-
this.#
|
|
202
|
+
checkDestroy(this.#destroyed);
|
|
200
203
|
if (this.#jail) this.#jail.classList.add(this.#classJailDragDisabled);
|
|
201
204
|
this.#enabled = true;
|
|
202
205
|
}
|
|
@@ -205,6 +208,7 @@ class TinyDragger {
|
|
|
205
208
|
* Disables the drag functionality.
|
|
206
209
|
*/
|
|
207
210
|
disable() {
|
|
211
|
+
checkDestroy(this.#destroyed);
|
|
208
212
|
if (this.#jail) this.#jail.classList.remove(this.#classJailDragDisabled);
|
|
209
213
|
this.#enabled = false;
|
|
210
214
|
}
|
|
@@ -215,7 +219,7 @@ class TinyDragger {
|
|
|
215
219
|
* @throws {Error} If the element is not a valid HTMLElement.
|
|
216
220
|
*/
|
|
217
221
|
addCollidable(element) {
|
|
218
|
-
this.#
|
|
222
|
+
checkDestroy(this.#destroyed);
|
|
219
223
|
if (!(element instanceof HTMLElement))
|
|
220
224
|
throw new Error('addCollidable expects an HTMLElement as argument.');
|
|
221
225
|
if (!this.#collidables.includes(element)) this.#collidables.push(element);
|
|
@@ -227,7 +231,7 @@ class TinyDragger {
|
|
|
227
231
|
* @throws {Error} If the element is not a valid HTMLElement.
|
|
228
232
|
*/
|
|
229
233
|
removeCollidable(element) {
|
|
230
|
-
this.#
|
|
234
|
+
checkDestroy(this.#destroyed);
|
|
231
235
|
if (!(element instanceof HTMLElement))
|
|
232
236
|
throw new Error('removeCollidable expects an HTMLElement as argument.');
|
|
233
237
|
this.#collidables = this.#collidables.filter((el) => el !== element);
|
|
@@ -248,7 +252,7 @@ class TinyDragger {
|
|
|
248
252
|
collidePattern = false,
|
|
249
253
|
movePattern = false,
|
|
250
254
|
} = {}) {
|
|
251
|
-
this.#
|
|
255
|
+
checkDestroy(this.#destroyed);
|
|
252
256
|
|
|
253
257
|
/** @param {any} value */
|
|
254
258
|
const isValidPattern = (value) =>
|
|
@@ -275,7 +279,7 @@ class TinyDragger {
|
|
|
275
279
|
* Disables all vibration feedback.
|
|
276
280
|
*/
|
|
277
281
|
disableVibration() {
|
|
278
|
-
this.#
|
|
282
|
+
checkDestroy(this.#destroyed);
|
|
279
283
|
this.#vibration = { start: false, end: false, collide: false, move: false };
|
|
280
284
|
}
|
|
281
285
|
|
|
@@ -286,7 +290,7 @@ class TinyDragger {
|
|
|
286
290
|
* @throws {Error} If event is not a MouseEvent or Touch with clientX/clientY.
|
|
287
291
|
*/
|
|
288
292
|
getOffset(event) {
|
|
289
|
-
this.#
|
|
293
|
+
checkDestroy(this.#destroyed);
|
|
290
294
|
if (
|
|
291
295
|
(!(event instanceof MouseEvent) && !(event instanceof Touch)) ||
|
|
292
296
|
typeof event.clientX !== 'number' ||
|
|
@@ -392,6 +396,7 @@ class TinyDragger {
|
|
|
392
396
|
* @param {MouseEvent|Touch} event - The drag event.
|
|
393
397
|
*/
|
|
394
398
|
checkDragCollision(event) {
|
|
399
|
+
checkDestroy(this.#destroyed);
|
|
395
400
|
const { collidedElements } = this.execCollision(event);
|
|
396
401
|
const first = collidedElements[0] || null;
|
|
397
402
|
|
|
@@ -468,6 +473,7 @@ class TinyDragger {
|
|
|
468
473
|
* @returns {{ inJail: boolean; collidedElements: (HTMLElement | null)[] }}
|
|
469
474
|
*/
|
|
470
475
|
execCollision(event) {
|
|
476
|
+
checkDestroy(this.#destroyed);
|
|
471
477
|
if (this.#destroyed || !this.#dragProxy) return { inJail: false, collidedElements: [] };
|
|
472
478
|
|
|
473
479
|
let collidedElements = [];
|
|
@@ -596,7 +602,7 @@ class TinyDragger {
|
|
|
596
602
|
* @throws {Error} If the input is not a valid DOMRect with numeric bounds.
|
|
597
603
|
*/
|
|
598
604
|
getAllCollidedElementsByRect(rect) {
|
|
599
|
-
this.#
|
|
605
|
+
checkDestroy(this.#destroyed);
|
|
600
606
|
if (
|
|
601
607
|
!(rect instanceof DOMRect) ||
|
|
602
608
|
typeof rect.left !== 'number' ||
|
|
@@ -615,7 +621,7 @@ class TinyDragger {
|
|
|
615
621
|
* @throws {Error} If rect is not a DOMRect with valid numeric properties.
|
|
616
622
|
*/
|
|
617
623
|
getCollidedElementByRect(rect) {
|
|
618
|
-
this.#
|
|
624
|
+
checkDestroy(this.#destroyed);
|
|
619
625
|
if (
|
|
620
626
|
!(rect instanceof DOMRect) ||
|
|
621
627
|
typeof rect.left !== 'number' ||
|
|
@@ -646,7 +652,7 @@ class TinyDragger {
|
|
|
646
652
|
* @returns {HTMLElement[]} The collided element or null.
|
|
647
653
|
*/
|
|
648
654
|
getAllCollidedElements(x, y) {
|
|
649
|
-
this.#
|
|
655
|
+
checkDestroy(this.#destroyed);
|
|
650
656
|
if (typeof x !== 'number' || typeof y !== 'number')
|
|
651
657
|
throw new Error('getCollidedElement expects numeric x and y coordinates.');
|
|
652
658
|
return this.#collidables.filter((el) => this.#getCollidedElement(el, x, y));
|
|
@@ -659,7 +665,7 @@ class TinyDragger {
|
|
|
659
665
|
* @returns {HTMLElement|null} The collided element or null.
|
|
660
666
|
*/
|
|
661
667
|
getCollidedElement(x, y) {
|
|
662
|
-
this.#
|
|
668
|
+
checkDestroy(this.#destroyed);
|
|
663
669
|
if (typeof x !== 'number' || typeof y !== 'number')
|
|
664
670
|
throw new Error('getCollidedElement expects numeric x and y coordinates.');
|
|
665
671
|
return this.#collidables.find((el) => this.#getCollidedElement(el, x, y)) || null;
|
|
@@ -679,6 +685,7 @@ class TinyDragger {
|
|
|
679
685
|
* @returns {boolean}
|
|
680
686
|
*/
|
|
681
687
|
getDragging() {
|
|
688
|
+
checkDestroy(this.#destroyed);
|
|
682
689
|
return this.#dragging;
|
|
683
690
|
}
|
|
684
691
|
|
|
@@ -687,6 +694,7 @@ class TinyDragger {
|
|
|
687
694
|
* @returns {boolean}
|
|
688
695
|
*/
|
|
689
696
|
getLockInsideJail() {
|
|
697
|
+
checkDestroy(this.#destroyed);
|
|
690
698
|
return this.#lockInsideJail;
|
|
691
699
|
}
|
|
692
700
|
|
|
@@ -695,6 +703,7 @@ class TinyDragger {
|
|
|
695
703
|
* @param {boolean} value
|
|
696
704
|
*/
|
|
697
705
|
setLockInsideJail(value) {
|
|
706
|
+
checkDestroy(this.#destroyed);
|
|
698
707
|
if (typeof value !== 'boolean') throw new Error('lockInsideJail must be a boolean.');
|
|
699
708
|
this.#lockInsideJail = value;
|
|
700
709
|
}
|
|
@@ -704,6 +713,7 @@ class TinyDragger {
|
|
|
704
713
|
* @returns {boolean}
|
|
705
714
|
*/
|
|
706
715
|
getRevertOnDrop() {
|
|
716
|
+
checkDestroy(this.#destroyed);
|
|
707
717
|
return this.#revertOnDrop;
|
|
708
718
|
}
|
|
709
719
|
|
|
@@ -712,6 +722,7 @@ class TinyDragger {
|
|
|
712
722
|
* @param {boolean} value
|
|
713
723
|
*/
|
|
714
724
|
setRevertOnDrop(value) {
|
|
725
|
+
checkDestroy(this.#destroyed);
|
|
715
726
|
if (typeof value !== 'boolean') throw new Error('revertOnDrop must be a boolean.');
|
|
716
727
|
this.#revertOnDrop = value;
|
|
717
728
|
}
|
|
@@ -721,6 +732,7 @@ class TinyDragger {
|
|
|
721
732
|
* @returns {boolean}
|
|
722
733
|
*/
|
|
723
734
|
getCollisionByMouse() {
|
|
735
|
+
checkDestroy(this.#destroyed);
|
|
724
736
|
return this.#collisionByMouse;
|
|
725
737
|
}
|
|
726
738
|
|
|
@@ -729,6 +741,7 @@ class TinyDragger {
|
|
|
729
741
|
* @param {boolean} value
|
|
730
742
|
*/
|
|
731
743
|
setCollisionByMouse(value) {
|
|
744
|
+
checkDestroy(this.#destroyed);
|
|
732
745
|
if (typeof value !== 'boolean') throw new Error('collisionByMouse must be a boolean.');
|
|
733
746
|
this.#collisionByMouse = value;
|
|
734
747
|
}
|
|
@@ -738,6 +751,7 @@ class TinyDragger {
|
|
|
738
751
|
* @returns {boolean}
|
|
739
752
|
*/
|
|
740
753
|
getDropInJailOnly() {
|
|
754
|
+
checkDestroy(this.#destroyed);
|
|
741
755
|
return this.#dropInJailOnly;
|
|
742
756
|
}
|
|
743
757
|
|
|
@@ -746,6 +760,7 @@ class TinyDragger {
|
|
|
746
760
|
* @param {boolean} value
|
|
747
761
|
*/
|
|
748
762
|
setDropInJailOnly(value) {
|
|
763
|
+
checkDestroy(this.#destroyed);
|
|
749
764
|
if (typeof value !== 'boolean') throw new Error('dropInJailOnly must be a boolean.');
|
|
750
765
|
this.#dropInJailOnly = value;
|
|
751
766
|
}
|
|
@@ -755,6 +770,7 @@ class TinyDragger {
|
|
|
755
770
|
* @returns {number}
|
|
756
771
|
*/
|
|
757
772
|
getDefaultZIndex() {
|
|
773
|
+
checkDestroy(this.#destroyed);
|
|
758
774
|
return this.#defaultZIndex;
|
|
759
775
|
}
|
|
760
776
|
|
|
@@ -763,6 +779,7 @@ class TinyDragger {
|
|
|
763
779
|
* @param {number} newZIndex
|
|
764
780
|
*/
|
|
765
781
|
setDefaultZIndex(newZIndex) {
|
|
782
|
+
checkDestroy(this.#destroyed);
|
|
766
783
|
if (typeof newZIndex !== 'number' || !Number.isFinite(newZIndex))
|
|
767
784
|
throw new TypeError('Z-index must be a finite number.');
|
|
768
785
|
this.#defaultZIndex = newZIndex;
|
|
@@ -773,6 +790,7 @@ class TinyDragger {
|
|
|
773
790
|
* @returns {boolean}
|
|
774
791
|
*/
|
|
775
792
|
isMirrorEnabled() {
|
|
793
|
+
checkDestroy(this.#destroyed);
|
|
776
794
|
return this.#mirrorElem;
|
|
777
795
|
}
|
|
778
796
|
|
|
@@ -781,6 +799,7 @@ class TinyDragger {
|
|
|
781
799
|
* @param {boolean} useMirror
|
|
782
800
|
*/
|
|
783
801
|
setMirrorEnabled(useMirror) {
|
|
802
|
+
checkDestroy(this.#destroyed);
|
|
784
803
|
if (typeof useMirror !== 'boolean') throw new TypeError('Mirror setting must be a boolean.');
|
|
785
804
|
|
|
786
805
|
this.#mirrorElem = useMirror;
|
|
@@ -791,6 +810,7 @@ class TinyDragger {
|
|
|
791
810
|
* @returns {HTMLElement}
|
|
792
811
|
*/
|
|
793
812
|
getTarget() {
|
|
813
|
+
checkDestroy(this.#destroyed);
|
|
794
814
|
return this.#target;
|
|
795
815
|
}
|
|
796
816
|
|
|
@@ -799,6 +819,7 @@ class TinyDragger {
|
|
|
799
819
|
* @returns {HTMLElement|null}
|
|
800
820
|
*/
|
|
801
821
|
getJail() {
|
|
822
|
+
checkDestroy(this.#destroyed);
|
|
802
823
|
return this.#jail;
|
|
803
824
|
}
|
|
804
825
|
|
|
@@ -807,6 +828,7 @@ class TinyDragger {
|
|
|
807
828
|
* @returns {HTMLElement|null}
|
|
808
829
|
*/
|
|
809
830
|
getDragProxy() {
|
|
831
|
+
checkDestroy(this.#destroyed);
|
|
810
832
|
return this.#dragProxy;
|
|
811
833
|
}
|
|
812
834
|
|
|
@@ -815,6 +837,7 @@ class TinyDragger {
|
|
|
815
837
|
* @returns {HTMLElement|null}
|
|
816
838
|
*/
|
|
817
839
|
getLastCollision() {
|
|
840
|
+
checkDestroy(this.#destroyed);
|
|
818
841
|
return this.#lastCollision;
|
|
819
842
|
}
|
|
820
843
|
|
|
@@ -823,6 +846,7 @@ class TinyDragger {
|
|
|
823
846
|
* @returns {HTMLElement[]}
|
|
824
847
|
*/
|
|
825
848
|
getCollidables() {
|
|
849
|
+
checkDestroy(this.#destroyed);
|
|
826
850
|
return [...this.#collidables];
|
|
827
851
|
}
|
|
828
852
|
|
|
@@ -831,6 +855,7 @@ class TinyDragger {
|
|
|
831
855
|
* @returns {string}
|
|
832
856
|
*/
|
|
833
857
|
getDragHiddenClass() {
|
|
858
|
+
checkDestroy(this.#destroyed);
|
|
834
859
|
return this.#dragHiddenClass;
|
|
835
860
|
}
|
|
836
861
|
|
|
@@ -839,6 +864,7 @@ class TinyDragger {
|
|
|
839
864
|
* @returns {string}
|
|
840
865
|
*/
|
|
841
866
|
getClassDragging() {
|
|
867
|
+
checkDestroy(this.#destroyed);
|
|
842
868
|
return this.#classDragging;
|
|
843
869
|
}
|
|
844
870
|
|
|
@@ -847,6 +873,7 @@ class TinyDragger {
|
|
|
847
873
|
* @returns {string}
|
|
848
874
|
*/
|
|
849
875
|
getClassBodyDragging() {
|
|
876
|
+
checkDestroy(this.#destroyed);
|
|
850
877
|
return this.#classBodyDragging;
|
|
851
878
|
}
|
|
852
879
|
|
|
@@ -855,6 +882,7 @@ class TinyDragger {
|
|
|
855
882
|
* @returns {string}
|
|
856
883
|
*/
|
|
857
884
|
getClassJailDragging() {
|
|
885
|
+
checkDestroy(this.#destroyed);
|
|
858
886
|
return this.#classJailDragging;
|
|
859
887
|
}
|
|
860
888
|
|
|
@@ -863,6 +891,7 @@ class TinyDragger {
|
|
|
863
891
|
* @returns {string}
|
|
864
892
|
*/
|
|
865
893
|
getClassJailDragDisabled() {
|
|
894
|
+
checkDestroy(this.#destroyed);
|
|
866
895
|
return this.#classJailDragDisabled;
|
|
867
896
|
}
|
|
868
897
|
|
|
@@ -871,6 +900,7 @@ class TinyDragger {
|
|
|
871
900
|
* @returns {string}
|
|
872
901
|
*/
|
|
873
902
|
getClassDragCollision() {
|
|
903
|
+
checkDestroy(this.#destroyed);
|
|
874
904
|
return this.#classDragCollision;
|
|
875
905
|
}
|
|
876
906
|
|
|
@@ -879,6 +909,7 @@ class TinyDragger {
|
|
|
879
909
|
* @returns {VibrationPatterns}
|
|
880
910
|
*/
|
|
881
911
|
getVibrations() {
|
|
912
|
+
checkDestroy(this.#destroyed);
|
|
882
913
|
return { ...this.#vibration };
|
|
883
914
|
}
|
|
884
915
|
|
|
@@ -887,6 +918,7 @@ class TinyDragger {
|
|
|
887
918
|
* @returns {number[]|boolean}
|
|
888
919
|
*/
|
|
889
920
|
getStartVibration() {
|
|
921
|
+
checkDestroy(this.#destroyed);
|
|
890
922
|
return this.#vibration.start;
|
|
891
923
|
}
|
|
892
924
|
|
|
@@ -895,6 +927,7 @@ class TinyDragger {
|
|
|
895
927
|
* @returns {number[]|boolean}
|
|
896
928
|
*/
|
|
897
929
|
getEndVibration() {
|
|
930
|
+
checkDestroy(this.#destroyed);
|
|
898
931
|
return this.#vibration.end;
|
|
899
932
|
}
|
|
900
933
|
|
|
@@ -903,6 +936,7 @@ class TinyDragger {
|
|
|
903
936
|
* @returns {number[]|boolean}
|
|
904
937
|
*/
|
|
905
938
|
getCollideVibration() {
|
|
939
|
+
checkDestroy(this.#destroyed);
|
|
906
940
|
return this.#vibration.collide;
|
|
907
941
|
}
|
|
908
942
|
|
|
@@ -911,6 +945,7 @@ class TinyDragger {
|
|
|
911
945
|
* @returns {number[]|boolean}
|
|
912
946
|
*/
|
|
913
947
|
getMoveVibration() {
|
|
948
|
+
checkDestroy(this.#destroyed);
|
|
914
949
|
return this.#vibration.move;
|
|
915
950
|
}
|
|
916
951
|
|
|
@@ -919,18 +954,10 @@ class TinyDragger {
|
|
|
919
954
|
* @returns {boolean}
|
|
920
955
|
*/
|
|
921
956
|
isEnabled() {
|
|
957
|
+
checkDestroy(this.#destroyed);
|
|
922
958
|
return this.#enabled;
|
|
923
959
|
}
|
|
924
960
|
|
|
925
|
-
/**
|
|
926
|
-
* Internal method to verify if the instance has been destroyed.
|
|
927
|
-
* Throws an error if any operation is attempted after destruction.
|
|
928
|
-
*/
|
|
929
|
-
#checkDestroy() {
|
|
930
|
-
if (this.#destroyed)
|
|
931
|
-
throw new Error('This TinyDragger instance has been destroyed and can no longer be used.');
|
|
932
|
-
}
|
|
933
|
-
|
|
934
961
|
/**
|
|
935
962
|
* Completely disables drag-and-drop and cleans up all event listeners.
|
|
936
963
|
* Does NOT remove the original HTML element.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import TinyHtml from './TinyHtml.mjs';
|
|
2
2
|
import * as TinyCollision from '../basics/collision.mjs';
|
|
3
3
|
import { isJsonObject } from '../basics/objChecker.mjs';
|
|
4
|
+
import { createCheckDestroyed } from './utils.mjs';
|
|
5
|
+
const checkDestroy = createCheckDestroyed('TinyDragger');
|
|
4
6
|
/**
|
|
5
7
|
* @typedef {Object} VibrationPatterns
|
|
6
8
|
* @property {number[]|false} start - Pattern to vibrate on start
|
|
@@ -167,7 +169,7 @@ class TinyDragger {
|
|
|
167
169
|
* Enables the drag functionality.
|
|
168
170
|
*/
|
|
169
171
|
enable() {
|
|
170
|
-
this.#
|
|
172
|
+
checkDestroy(this.#destroyed);
|
|
171
173
|
if (this.#jail)
|
|
172
174
|
this.#jail.classList.add(this.#classJailDragDisabled);
|
|
173
175
|
this.#enabled = true;
|
|
@@ -176,6 +178,7 @@ class TinyDragger {
|
|
|
176
178
|
* Disables the drag functionality.
|
|
177
179
|
*/
|
|
178
180
|
disable() {
|
|
181
|
+
checkDestroy(this.#destroyed);
|
|
179
182
|
if (this.#jail)
|
|
180
183
|
this.#jail.classList.remove(this.#classJailDragDisabled);
|
|
181
184
|
this.#enabled = false;
|
|
@@ -186,7 +189,7 @@ class TinyDragger {
|
|
|
186
189
|
* @throws {Error} If the element is not a valid HTMLElement.
|
|
187
190
|
*/
|
|
188
191
|
addCollidable(element) {
|
|
189
|
-
this.#
|
|
192
|
+
checkDestroy(this.#destroyed);
|
|
190
193
|
if (!(element instanceof HTMLElement))
|
|
191
194
|
throw new Error('addCollidable expects an HTMLElement as argument.');
|
|
192
195
|
if (!this.#collidables.includes(element))
|
|
@@ -198,7 +201,7 @@ class TinyDragger {
|
|
|
198
201
|
* @throws {Error} If the element is not a valid HTMLElement.
|
|
199
202
|
*/
|
|
200
203
|
removeCollidable(element) {
|
|
201
|
-
this.#
|
|
204
|
+
checkDestroy(this.#destroyed);
|
|
202
205
|
if (!(element instanceof HTMLElement))
|
|
203
206
|
throw new Error('removeCollidable expects an HTMLElement as argument.');
|
|
204
207
|
this.#collidables = this.#collidables.filter((el) => el !== element);
|
|
@@ -213,7 +216,7 @@ class TinyDragger {
|
|
|
213
216
|
* @throws {Error} If any pattern is not false or an array of numbers.
|
|
214
217
|
*/
|
|
215
218
|
setVibrationPattern({ startPattern = false, endPattern = false, collidePattern = false, movePattern = false, } = {}) {
|
|
216
|
-
this.#
|
|
219
|
+
checkDestroy(this.#destroyed);
|
|
217
220
|
/** @param {any} value */
|
|
218
221
|
const isValidPattern = (value) => value === false || (Array.isArray(value) && value.every((n) => typeof n === 'number'));
|
|
219
222
|
if (!isValidPattern(startPattern))
|
|
@@ -235,7 +238,7 @@ class TinyDragger {
|
|
|
235
238
|
* Disables all vibration feedback.
|
|
236
239
|
*/
|
|
237
240
|
disableVibration() {
|
|
238
|
-
this.#
|
|
241
|
+
checkDestroy(this.#destroyed);
|
|
239
242
|
this.#vibration = { start: false, end: false, collide: false, move: false };
|
|
240
243
|
}
|
|
241
244
|
/**
|
|
@@ -245,7 +248,7 @@ class TinyDragger {
|
|
|
245
248
|
* @throws {Error} If event is not a MouseEvent or Touch with clientX/clientY.
|
|
246
249
|
*/
|
|
247
250
|
getOffset(event) {
|
|
248
|
-
this.#
|
|
251
|
+
checkDestroy(this.#destroyed);
|
|
249
252
|
if ((!(event instanceof MouseEvent) && !(event instanceof Touch)) ||
|
|
250
253
|
typeof event.clientX !== 'number' ||
|
|
251
254
|
typeof event.clientY !== 'number')
|
|
@@ -340,6 +343,7 @@ class TinyDragger {
|
|
|
340
343
|
* @param {MouseEvent|Touch} event - The drag event.
|
|
341
344
|
*/
|
|
342
345
|
checkDragCollision(event) {
|
|
346
|
+
checkDestroy(this.#destroyed);
|
|
343
347
|
const { collidedElements } = this.execCollision(event);
|
|
344
348
|
const first = collidedElements[0] || null;
|
|
345
349
|
// Removes old marking if necessary
|
|
@@ -400,6 +404,7 @@ class TinyDragger {
|
|
|
400
404
|
* @returns {{ inJail: boolean; collidedElements: (HTMLElement | null)[] }}
|
|
401
405
|
*/
|
|
402
406
|
execCollision(event) {
|
|
407
|
+
checkDestroy(this.#destroyed);
|
|
403
408
|
if (this.#destroyed || !this.#dragProxy)
|
|
404
409
|
return { inJail: false, collidedElements: [] };
|
|
405
410
|
let collidedElements = [];
|
|
@@ -515,7 +520,7 @@ class TinyDragger {
|
|
|
515
520
|
* @throws {Error} If the input is not a valid DOMRect with numeric bounds.
|
|
516
521
|
*/
|
|
517
522
|
getAllCollidedElementsByRect(rect) {
|
|
518
|
-
this.#
|
|
523
|
+
checkDestroy(this.#destroyed);
|
|
519
524
|
if (!(rect instanceof DOMRect) ||
|
|
520
525
|
typeof rect.left !== 'number' ||
|
|
521
526
|
typeof rect.right !== 'number' ||
|
|
@@ -531,7 +536,7 @@ class TinyDragger {
|
|
|
531
536
|
* @throws {Error} If rect is not a DOMRect with valid numeric properties.
|
|
532
537
|
*/
|
|
533
538
|
getCollidedElementByRect(rect) {
|
|
534
|
-
this.#
|
|
539
|
+
checkDestroy(this.#destroyed);
|
|
535
540
|
if (!(rect instanceof DOMRect) ||
|
|
536
541
|
typeof rect.left !== 'number' ||
|
|
537
542
|
typeof rect.right !== 'number' ||
|
|
@@ -558,7 +563,7 @@ class TinyDragger {
|
|
|
558
563
|
* @returns {HTMLElement[]} The collided element or null.
|
|
559
564
|
*/
|
|
560
565
|
getAllCollidedElements(x, y) {
|
|
561
|
-
this.#
|
|
566
|
+
checkDestroy(this.#destroyed);
|
|
562
567
|
if (typeof x !== 'number' || typeof y !== 'number')
|
|
563
568
|
throw new Error('getCollidedElement expects numeric x and y coordinates.');
|
|
564
569
|
return this.#collidables.filter((el) => this.#getCollidedElement(el, x, y));
|
|
@@ -570,7 +575,7 @@ class TinyDragger {
|
|
|
570
575
|
* @returns {HTMLElement|null} The collided element or null.
|
|
571
576
|
*/
|
|
572
577
|
getCollidedElement(x, y) {
|
|
573
|
-
this.#
|
|
578
|
+
checkDestroy(this.#destroyed);
|
|
574
579
|
if (typeof x !== 'number' || typeof y !== 'number')
|
|
575
580
|
throw new Error('getCollidedElement expects numeric x and y coordinates.');
|
|
576
581
|
return this.#collidables.find((el) => this.#getCollidedElement(el, x, y)) || null;
|
|
@@ -588,6 +593,7 @@ class TinyDragger {
|
|
|
588
593
|
* @returns {boolean}
|
|
589
594
|
*/
|
|
590
595
|
getDragging() {
|
|
596
|
+
checkDestroy(this.#destroyed);
|
|
591
597
|
return this.#dragging;
|
|
592
598
|
}
|
|
593
599
|
/**
|
|
@@ -595,6 +601,7 @@ class TinyDragger {
|
|
|
595
601
|
* @returns {boolean}
|
|
596
602
|
*/
|
|
597
603
|
getLockInsideJail() {
|
|
604
|
+
checkDestroy(this.#destroyed);
|
|
598
605
|
return this.#lockInsideJail;
|
|
599
606
|
}
|
|
600
607
|
/**
|
|
@@ -602,6 +609,7 @@ class TinyDragger {
|
|
|
602
609
|
* @param {boolean} value
|
|
603
610
|
*/
|
|
604
611
|
setLockInsideJail(value) {
|
|
612
|
+
checkDestroy(this.#destroyed);
|
|
605
613
|
if (typeof value !== 'boolean')
|
|
606
614
|
throw new Error('lockInsideJail must be a boolean.');
|
|
607
615
|
this.#lockInsideJail = value;
|
|
@@ -611,6 +619,7 @@ class TinyDragger {
|
|
|
611
619
|
* @returns {boolean}
|
|
612
620
|
*/
|
|
613
621
|
getRevertOnDrop() {
|
|
622
|
+
checkDestroy(this.#destroyed);
|
|
614
623
|
return this.#revertOnDrop;
|
|
615
624
|
}
|
|
616
625
|
/**
|
|
@@ -618,6 +627,7 @@ class TinyDragger {
|
|
|
618
627
|
* @param {boolean} value
|
|
619
628
|
*/
|
|
620
629
|
setRevertOnDrop(value) {
|
|
630
|
+
checkDestroy(this.#destroyed);
|
|
621
631
|
if (typeof value !== 'boolean')
|
|
622
632
|
throw new Error('revertOnDrop must be a boolean.');
|
|
623
633
|
this.#revertOnDrop = value;
|
|
@@ -627,6 +637,7 @@ class TinyDragger {
|
|
|
627
637
|
* @returns {boolean}
|
|
628
638
|
*/
|
|
629
639
|
getCollisionByMouse() {
|
|
640
|
+
checkDestroy(this.#destroyed);
|
|
630
641
|
return this.#collisionByMouse;
|
|
631
642
|
}
|
|
632
643
|
/**
|
|
@@ -634,6 +645,7 @@ class TinyDragger {
|
|
|
634
645
|
* @param {boolean} value
|
|
635
646
|
*/
|
|
636
647
|
setCollisionByMouse(value) {
|
|
648
|
+
checkDestroy(this.#destroyed);
|
|
637
649
|
if (typeof value !== 'boolean')
|
|
638
650
|
throw new Error('collisionByMouse must be a boolean.');
|
|
639
651
|
this.#collisionByMouse = value;
|
|
@@ -643,6 +655,7 @@ class TinyDragger {
|
|
|
643
655
|
* @returns {boolean}
|
|
644
656
|
*/
|
|
645
657
|
getDropInJailOnly() {
|
|
658
|
+
checkDestroy(this.#destroyed);
|
|
646
659
|
return this.#dropInJailOnly;
|
|
647
660
|
}
|
|
648
661
|
/**
|
|
@@ -650,6 +663,7 @@ class TinyDragger {
|
|
|
650
663
|
* @param {boolean} value
|
|
651
664
|
*/
|
|
652
665
|
setDropInJailOnly(value) {
|
|
666
|
+
checkDestroy(this.#destroyed);
|
|
653
667
|
if (typeof value !== 'boolean')
|
|
654
668
|
throw new Error('dropInJailOnly must be a boolean.');
|
|
655
669
|
this.#dropInJailOnly = value;
|
|
@@ -659,6 +673,7 @@ class TinyDragger {
|
|
|
659
673
|
* @returns {number}
|
|
660
674
|
*/
|
|
661
675
|
getDefaultZIndex() {
|
|
676
|
+
checkDestroy(this.#destroyed);
|
|
662
677
|
return this.#defaultZIndex;
|
|
663
678
|
}
|
|
664
679
|
/**
|
|
@@ -666,6 +681,7 @@ class TinyDragger {
|
|
|
666
681
|
* @param {number} newZIndex
|
|
667
682
|
*/
|
|
668
683
|
setDefaultZIndex(newZIndex) {
|
|
684
|
+
checkDestroy(this.#destroyed);
|
|
669
685
|
if (typeof newZIndex !== 'number' || !Number.isFinite(newZIndex))
|
|
670
686
|
throw new TypeError('Z-index must be a finite number.');
|
|
671
687
|
this.#defaultZIndex = newZIndex;
|
|
@@ -675,6 +691,7 @@ class TinyDragger {
|
|
|
675
691
|
* @returns {boolean}
|
|
676
692
|
*/
|
|
677
693
|
isMirrorEnabled() {
|
|
694
|
+
checkDestroy(this.#destroyed);
|
|
678
695
|
return this.#mirrorElem;
|
|
679
696
|
}
|
|
680
697
|
/**
|
|
@@ -682,6 +699,7 @@ class TinyDragger {
|
|
|
682
699
|
* @param {boolean} useMirror
|
|
683
700
|
*/
|
|
684
701
|
setMirrorEnabled(useMirror) {
|
|
702
|
+
checkDestroy(this.#destroyed);
|
|
685
703
|
if (typeof useMirror !== 'boolean')
|
|
686
704
|
throw new TypeError('Mirror setting must be a boolean.');
|
|
687
705
|
this.#mirrorElem = useMirror;
|
|
@@ -691,6 +709,7 @@ class TinyDragger {
|
|
|
691
709
|
* @returns {HTMLElement}
|
|
692
710
|
*/
|
|
693
711
|
getTarget() {
|
|
712
|
+
checkDestroy(this.#destroyed);
|
|
694
713
|
return this.#target;
|
|
695
714
|
}
|
|
696
715
|
/**
|
|
@@ -698,6 +717,7 @@ class TinyDragger {
|
|
|
698
717
|
* @returns {HTMLElement|null}
|
|
699
718
|
*/
|
|
700
719
|
getJail() {
|
|
720
|
+
checkDestroy(this.#destroyed);
|
|
701
721
|
return this.#jail;
|
|
702
722
|
}
|
|
703
723
|
/**
|
|
@@ -705,6 +725,7 @@ class TinyDragger {
|
|
|
705
725
|
* @returns {HTMLElement|null}
|
|
706
726
|
*/
|
|
707
727
|
getDragProxy() {
|
|
728
|
+
checkDestroy(this.#destroyed);
|
|
708
729
|
return this.#dragProxy;
|
|
709
730
|
}
|
|
710
731
|
/**
|
|
@@ -712,6 +733,7 @@ class TinyDragger {
|
|
|
712
733
|
* @returns {HTMLElement|null}
|
|
713
734
|
*/
|
|
714
735
|
getLastCollision() {
|
|
736
|
+
checkDestroy(this.#destroyed);
|
|
715
737
|
return this.#lastCollision;
|
|
716
738
|
}
|
|
717
739
|
/**
|
|
@@ -719,6 +741,7 @@ class TinyDragger {
|
|
|
719
741
|
* @returns {HTMLElement[]}
|
|
720
742
|
*/
|
|
721
743
|
getCollidables() {
|
|
744
|
+
checkDestroy(this.#destroyed);
|
|
722
745
|
return [...this.#collidables];
|
|
723
746
|
}
|
|
724
747
|
/**
|
|
@@ -726,6 +749,7 @@ class TinyDragger {
|
|
|
726
749
|
* @returns {string}
|
|
727
750
|
*/
|
|
728
751
|
getDragHiddenClass() {
|
|
752
|
+
checkDestroy(this.#destroyed);
|
|
729
753
|
return this.#dragHiddenClass;
|
|
730
754
|
}
|
|
731
755
|
/**
|
|
@@ -733,6 +757,7 @@ class TinyDragger {
|
|
|
733
757
|
* @returns {string}
|
|
734
758
|
*/
|
|
735
759
|
getClassDragging() {
|
|
760
|
+
checkDestroy(this.#destroyed);
|
|
736
761
|
return this.#classDragging;
|
|
737
762
|
}
|
|
738
763
|
/**
|
|
@@ -740,6 +765,7 @@ class TinyDragger {
|
|
|
740
765
|
* @returns {string}
|
|
741
766
|
*/
|
|
742
767
|
getClassBodyDragging() {
|
|
768
|
+
checkDestroy(this.#destroyed);
|
|
743
769
|
return this.#classBodyDragging;
|
|
744
770
|
}
|
|
745
771
|
/**
|
|
@@ -747,6 +773,7 @@ class TinyDragger {
|
|
|
747
773
|
* @returns {string}
|
|
748
774
|
*/
|
|
749
775
|
getClassJailDragging() {
|
|
776
|
+
checkDestroy(this.#destroyed);
|
|
750
777
|
return this.#classJailDragging;
|
|
751
778
|
}
|
|
752
779
|
/**
|
|
@@ -754,6 +781,7 @@ class TinyDragger {
|
|
|
754
781
|
* @returns {string}
|
|
755
782
|
*/
|
|
756
783
|
getClassJailDragDisabled() {
|
|
784
|
+
checkDestroy(this.#destroyed);
|
|
757
785
|
return this.#classJailDragDisabled;
|
|
758
786
|
}
|
|
759
787
|
/**
|
|
@@ -761,6 +789,7 @@ class TinyDragger {
|
|
|
761
789
|
* @returns {string}
|
|
762
790
|
*/
|
|
763
791
|
getClassDragCollision() {
|
|
792
|
+
checkDestroy(this.#destroyed);
|
|
764
793
|
return this.#classDragCollision;
|
|
765
794
|
}
|
|
766
795
|
/**
|
|
@@ -768,6 +797,7 @@ class TinyDragger {
|
|
|
768
797
|
* @returns {VibrationPatterns}
|
|
769
798
|
*/
|
|
770
799
|
getVibrations() {
|
|
800
|
+
checkDestroy(this.#destroyed);
|
|
771
801
|
return { ...this.#vibration };
|
|
772
802
|
}
|
|
773
803
|
/**
|
|
@@ -775,6 +805,7 @@ class TinyDragger {
|
|
|
775
805
|
* @returns {number[]|boolean}
|
|
776
806
|
*/
|
|
777
807
|
getStartVibration() {
|
|
808
|
+
checkDestroy(this.#destroyed);
|
|
778
809
|
return this.#vibration.start;
|
|
779
810
|
}
|
|
780
811
|
/**
|
|
@@ -782,6 +813,7 @@ class TinyDragger {
|
|
|
782
813
|
* @returns {number[]|boolean}
|
|
783
814
|
*/
|
|
784
815
|
getEndVibration() {
|
|
816
|
+
checkDestroy(this.#destroyed);
|
|
785
817
|
return this.#vibration.end;
|
|
786
818
|
}
|
|
787
819
|
/**
|
|
@@ -789,6 +821,7 @@ class TinyDragger {
|
|
|
789
821
|
* @returns {number[]|boolean}
|
|
790
822
|
*/
|
|
791
823
|
getCollideVibration() {
|
|
824
|
+
checkDestroy(this.#destroyed);
|
|
792
825
|
return this.#vibration.collide;
|
|
793
826
|
}
|
|
794
827
|
/**
|
|
@@ -796,6 +829,7 @@ class TinyDragger {
|
|
|
796
829
|
* @returns {number[]|boolean}
|
|
797
830
|
*/
|
|
798
831
|
getMoveVibration() {
|
|
832
|
+
checkDestroy(this.#destroyed);
|
|
799
833
|
return this.#vibration.move;
|
|
800
834
|
}
|
|
801
835
|
/**
|
|
@@ -803,16 +837,9 @@ class TinyDragger {
|
|
|
803
837
|
* @returns {boolean}
|
|
804
838
|
*/
|
|
805
839
|
isEnabled() {
|
|
840
|
+
checkDestroy(this.#destroyed);
|
|
806
841
|
return this.#enabled;
|
|
807
842
|
}
|
|
808
|
-
/**
|
|
809
|
-
* Internal method to verify if the instance has been destroyed.
|
|
810
|
-
* Throws an error if any operation is attempted after destruction.
|
|
811
|
-
*/
|
|
812
|
-
#checkDestroy() {
|
|
813
|
-
if (this.#destroyed)
|
|
814
|
-
throw new Error('This TinyDragger instance has been destroyed and can no longer be used.');
|
|
815
|
-
}
|
|
816
843
|
/**
|
|
817
844
|
* Completely disables drag-and-drop and cleans up all event listeners.
|
|
818
845
|
* Does NOT remove the original HTML element.
|