tiny-essentials 1.28.0 → 1.28.2
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/1/28/1.md +23 -0
- package/changelog/1/28/2.md +43 -0
- package/dist/_/numbers.d.mts +91 -16
- 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 -1
- 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 -1
- 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 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +57 -9
- package/dist/v1/basics/array.d.mts +28 -12
- package/dist/v1/basics/array.mjs +51 -9
- package/dist/v1/basics/clock.cjs +94 -42
- package/dist/v1/basics/clock.d.mts +22 -22
- package/dist/v1/basics/clock.mjs +91 -54
- package/dist/v1/basics/collision.d.mts +245 -104
- 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.d.mts +1 -1
- package/dist/v1/basics/fullScreen.d.mts +47 -7
- package/dist/v1/basics/html.cjs +149 -130
- package/dist/v1/basics/html.d.mts +69 -113
- package/dist/v1/basics/html.mjs +113 -105
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +11 -65
- package/dist/v1/basics/index.mjs +3 -3
- package/dist/v1/basics/mediaContent.cjs +116 -32
- package/dist/v1/basics/mediaContent.d.mts +143 -159
- package/dist/v1/basics/mediaContent.mjs +105 -33
- package/dist/v1/basics/objChecker.cjs +7 -5
- package/dist/v1/basics/objChecker.d.mts +5 -4
- package/dist/v1/basics/objChecker.mjs +6 -6
- package/dist/v1/basics/objFilter.cjs +71 -14
- package/dist/v1/basics/objFilter.d.mts +16 -19
- package/dist/v1/basics/objFilter.mjs +63 -14
- package/dist/v1/basics/simpleMath.cjs +81 -25
- package/dist/v1/basics/simpleMath.d.mts +22 -22
- package/dist/v1/basics/simpleMath.mjs +70 -27
- package/dist/v1/basics/text.cjs +76 -31
- package/dist/v1/basics/text.d.mts +64 -14
- package/dist/v1/basics/text.mjs +62 -31
- package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
- package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
- package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
- package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
- package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
- package/dist/v1/build/TinyClassManager.d.mts +1 -1
- package/dist/v1/build/TinyClipboard.d.mts +1 -1
- package/dist/v1/build/TinyColorConverter.d.mts +1 -1
- package/dist/v1/build/TinyColorValidator.d.mts +1 -1
- package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
- package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
- package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
- package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
- package/dist/v1/build/TinyDragger.d.mts +1 -1
- package/dist/v1/build/TinyElementObserver.d.mts +1 -1
- package/dist/v1/build/TinyGamepad.d.mts +1 -1
- package/dist/v1/build/TinyHtml.d.mts +1 -1
- package/dist/v1/build/TinyI18.d.mts +1 -1
- package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
- package/dist/v1/build/TinyInventory.d.mts +1 -1
- package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
- package/dist/v1/build/TinyLevelUp.d.mts +1 -1
- package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
- package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
- package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
- package/dist/v1/build/TinyNeedBar.d.mts +1 -1
- package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
- package/dist/v1/build/TinyNotifications.d.mts +1 -1
- package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
- package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
- package/dist/v1/build/TinyRadioFm.d.mts +1 -1
- package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
- package/dist/v1/build/TinySimpleDice.d.mts +1 -1
- package/dist/v1/build/TinySmartScroller.d.mts +1 -1
- package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
- package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
- package/dist/v1/build/TinyTextarea.d.mts +1 -1
- package/dist/v1/build/TinyTimeout.d.mts +1 -1
- package/dist/v1/build/TinyToastNotify.d.mts +1 -1
- package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
- package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
- package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
- package/dist/v1/fileManager/index.d.mts +3 -29
- package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +54 -137
- package/dist/v1/index.mjs +4 -3
- package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
- package/dist/v1/libs/TinyAdvancedRaffle.cjs +64 -50
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +64 -116
- package/dist/v1/libs/TinyAdvancedRaffle.mjs +62 -49
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +15 -19
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
- package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
- package/dist/v1/libs/TinyAnalogClock.d.mts +12 -9
- package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
- package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
- package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
- package/dist/v1/libs/TinyClassManager.cjs +5 -7
- package/dist/v1/libs/TinyClassManager.d.mts +16 -16
- package/dist/v1/libs/TinyClassManager.mjs +5 -6
- package/dist/v1/libs/TinyClipboard.cjs +2 -0
- package/dist/v1/libs/TinyClipboard.d.mts +12 -5
- package/dist/v1/libs/TinyClipboard.mjs +2 -0
- package/dist/v1/libs/TinyColorConverter.cjs +1 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +10 -32
- package/dist/v1/libs/TinyColorConverter.mjs +1 -0
- package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
- package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
- package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
- package/dist/v1/libs/TinyDayNightCycle.d.mts +87 -117
- package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
- package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
- package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
- package/dist/v1/libs/TinyDragDropDetector.d.mts +32 -26
- package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
- package/dist/v1/libs/TinyDragger.cjs +46 -19
- package/dist/v1/libs/TinyDragger.d.mts +82 -81
- package/dist/v1/libs/TinyDragger.mjs +45 -18
- package/dist/v1/libs/TinyElementObserver.cjs +39 -0
- package/dist/v1/libs/TinyElementObserver.d.mts +28 -25
- package/dist/v1/libs/TinyElementObserver.mjs +36 -0
- package/dist/v1/libs/TinyGamepad.cjs +131 -2
- package/dist/v1/libs/TinyGamepad.d.mts +50 -122
- package/dist/v1/libs/TinyGamepad.mjs +129 -2
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
- package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
- package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
- package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
- package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
- package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
- package/dist/v1/libs/TinyHtml.cjs +4 -5
- package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
- package/dist/v1/libs/TinyHtml.mjs +5 -6
- package/dist/v1/libs/TinyI18.cjs +61 -0
- package/dist/v1/libs/TinyI18.d.mts +34 -58
- package/dist/v1/libs/TinyI18.mjs +55 -0
- package/dist/v1/libs/TinyIframeEvents.cjs +19 -2
- package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
- package/dist/v1/libs/TinyIframeEvents.mjs +19 -2
- package/dist/v1/libs/TinyInventory.d.mts +78 -141
- package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
- package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
- package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
- package/dist/v1/libs/TinyLocalStorage.cjs +48 -0
- package/dist/v1/libs/TinyLocalStorage.d.mts +11 -30
- package/dist/v1/libs/TinyLocalStorage.mjs +45 -0
- package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
- package/dist/v1/libs/TinyMediaPlayer.cjs +77 -3
- package/dist/v1/libs/TinyMediaPlayer.d.mts +109 -106
- package/dist/v1/libs/TinyMediaPlayer.mjs +71 -3
- package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
- package/dist/v1/libs/TinyNewWinEvents.cjs +29 -0
- package/dist/v1/libs/TinyNewWinEvents.d.mts +32 -29
- package/dist/v1/libs/TinyNewWinEvents.mjs +26 -0
- package/dist/v1/libs/TinyNotifications.d.mts +6 -6
- package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
- package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -15
- package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
- package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
- package/dist/v1/libs/TinyRadioFm.cjs +70 -12
- package/dist/v1/libs/TinyRadioFm.d.mts +45 -80
- package/dist/v1/libs/TinyRadioFm.mjs +64 -12
- package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
- package/dist/v1/libs/TinyRateLimiter.d.mts +29 -36
- package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
- package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
- package/dist/v1/libs/TinySmartScroller.cjs +52 -3
- package/dist/v1/libs/TinySmartScroller.d.mts +62 -70
- package/dist/v1/libs/TinySmartScroller.mjs +51 -5
- package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
- package/dist/v1/libs/TinyTextDiffer.d.mts +11 -13
- package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
- package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
- package/dist/v1/libs/TinyTextarea.cjs +19 -0
- package/dist/v1/libs/TinyTextarea.d.mts +34 -28
- package/dist/v1/libs/TinyTextarea.mjs +17 -0
- package/dist/v1/libs/TinyTimeout.cjs +11 -1
- package/dist/v1/libs/TinyTimeout.d.mts +14 -14
- package/dist/v1/libs/TinyTimeout.mjs +9 -1
- package/dist/v1/libs/TinyToastNotify.cjs +36 -1
- package/dist/v1/libs/TinyToastNotify.d.mts +15 -17
- package/dist/v1/libs/TinyToastNotify.mjs +32 -1
- package/dist/v1/libs/TinyUploadClicker.cjs +19 -0
- package/dist/v1/libs/TinyUploadClicker.d.mts +38 -8
- package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +52 -78
- package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
- package/dist/v1/libs/utils.cjs +21 -0
- package/dist/v1/libs/utils.d.mts +6 -0
- package/dist/v1/libs/utils.mjs +16 -0
- package/docs/v1/README.md +1 -0
- 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/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 +2 -2
- package/docs/v1/libs/TinyLevelUp.md +1 -1
- package/docs/v1/libs/TinyLoadingScreen.md +1 -1
- package/docs/v1/libs/TinyNewWinEvents.md +2 -2
- 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 +11 -2
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var events = require('events');
|
|
4
|
+
var utils = require('./utils.cjs');
|
|
5
|
+
|
|
6
|
+
const checkDestroy = utils.createCheckDestroyed('TinyAdvancedRaffle');
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Defines the available normalization strategies for probability weight calculations.
|
|
@@ -216,6 +219,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
216
219
|
* @returns {Record<string, number>} - Object with item IDs as keys and their respective draw counts.
|
|
217
220
|
*/
|
|
218
221
|
get freq() {
|
|
222
|
+
checkDestroy(this.#isDestroyed);
|
|
219
223
|
return Object.fromEntries(this.#freq);
|
|
220
224
|
}
|
|
221
225
|
|
|
@@ -224,6 +228,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
224
228
|
* @returns {number} Total count of items.
|
|
225
229
|
*/
|
|
226
230
|
get size() {
|
|
231
|
+
checkDestroy(this.#isDestroyed);
|
|
227
232
|
return this.#items.size;
|
|
228
233
|
}
|
|
229
234
|
|
|
@@ -232,6 +237,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
232
237
|
* @returns {Normalization} Current normalization mode.
|
|
233
238
|
*/
|
|
234
239
|
get normalization() {
|
|
240
|
+
checkDestroy(this.#isDestroyed);
|
|
235
241
|
return this.#normalization;
|
|
236
242
|
}
|
|
237
243
|
|
|
@@ -241,7 +247,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
241
247
|
* @throws {TypeError} If value is not a non-empty string.
|
|
242
248
|
*/
|
|
243
249
|
set normalization(value) {
|
|
244
|
-
this
|
|
250
|
+
checkDestroy(this.#isDestroyed);
|
|
245
251
|
if (typeof value !== 'string' || !value.trim()) {
|
|
246
252
|
throw new TypeError(
|
|
247
253
|
"normalization must be a non-empty string (e.g., 'relative', 'softmax').",
|
|
@@ -255,6 +261,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
255
261
|
* @returns {number|null} Current seed or `null` if RNG is not seeded.
|
|
256
262
|
*/
|
|
257
263
|
get seed() {
|
|
264
|
+
checkDestroy(this.#isDestroyed);
|
|
258
265
|
return this.#seed;
|
|
259
266
|
}
|
|
260
267
|
|
|
@@ -264,7 +271,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
264
271
|
* @throws {TypeError} If not `null` or a finite number.
|
|
265
272
|
*/
|
|
266
273
|
set seed(value) {
|
|
267
|
-
this
|
|
274
|
+
checkDestroy(this.#isDestroyed);
|
|
268
275
|
if (value !== null && (typeof value !== 'number' || !Number.isFinite(value)))
|
|
269
276
|
throw new TypeError('seed must be a finite number or null.');
|
|
270
277
|
this.#seed = value;
|
|
@@ -276,6 +283,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
276
283
|
* @returns {WeightsCallback[]} Array of registered global modifier functions.
|
|
277
284
|
*/
|
|
278
285
|
get globalModifiers() {
|
|
286
|
+
checkDestroy(this.#isDestroyed);
|
|
279
287
|
return [...this.#globalModifiers];
|
|
280
288
|
}
|
|
281
289
|
|
|
@@ -285,7 +293,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
285
293
|
* @throws {TypeError} If not an array of functions.
|
|
286
294
|
*/
|
|
287
295
|
set globalModifiers(value) {
|
|
288
|
-
this
|
|
296
|
+
checkDestroy(this.#isDestroyed);
|
|
289
297
|
if (!Array.isArray(value) || !value.every((fn) => typeof fn === 'function'))
|
|
290
298
|
throw new TypeError('globalModifiers must be an array of functions (WeightsCallback).');
|
|
291
299
|
this.#globalModifiers = value;
|
|
@@ -296,6 +304,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
296
304
|
* @returns {TempModifier[]} Array of temporary modifier entries.
|
|
297
305
|
*/
|
|
298
306
|
get temporaryModifiers() {
|
|
307
|
+
checkDestroy(this.#isDestroyed);
|
|
299
308
|
return [...this.#temporaryModifiers];
|
|
300
309
|
}
|
|
301
310
|
|
|
@@ -305,7 +314,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
305
314
|
* @throws {TypeError} If structure is invalid.
|
|
306
315
|
*/
|
|
307
316
|
set temporaryModifiers(value) {
|
|
308
|
-
this
|
|
317
|
+
checkDestroy(this.#isDestroyed);
|
|
309
318
|
if (
|
|
310
319
|
!Array.isArray(value) ||
|
|
311
320
|
!value.every(
|
|
@@ -323,6 +332,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
323
332
|
* @returns {WeightsCallback[]} Array of conditional rule functions.
|
|
324
333
|
*/
|
|
325
334
|
get conditionalRules() {
|
|
335
|
+
checkDestroy(this.#isDestroyed);
|
|
326
336
|
return [...this.#conditionalRules];
|
|
327
337
|
}
|
|
328
338
|
|
|
@@ -332,7 +342,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
332
342
|
* @throws {TypeError} If not an array of functions.
|
|
333
343
|
*/
|
|
334
344
|
set conditionalRules(value) {
|
|
335
|
-
this
|
|
345
|
+
checkDestroy(this.#isDestroyed);
|
|
336
346
|
if (!Array.isArray(value) || !value.every((fn) => typeof fn === 'function'))
|
|
337
347
|
throw new TypeError('conditionalRules must be an array of functions (WeightsCallback).');
|
|
338
348
|
this.#conditionalRules = value;
|
|
@@ -343,6 +353,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
343
353
|
* @returns {Record<string, Pity>} Object keyed by system name.
|
|
344
354
|
*/
|
|
345
355
|
get pitySystems() {
|
|
356
|
+
checkDestroy(this.#isDestroyed);
|
|
346
357
|
return Object.fromEntries(this.#pitySystems);
|
|
347
358
|
}
|
|
348
359
|
|
|
@@ -352,7 +363,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
352
363
|
* @throws {TypeError} If structure is invalid.
|
|
353
364
|
*/
|
|
354
365
|
set pitySystems(value) {
|
|
355
|
-
this
|
|
366
|
+
checkDestroy(this.#isDestroyed);
|
|
356
367
|
if (
|
|
357
368
|
!(value instanceof Map) ||
|
|
358
369
|
![...value.values()].every(
|
|
@@ -374,6 +385,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
374
385
|
* @returns {string[]} Array of item IDs excluded from draws.
|
|
375
386
|
*/
|
|
376
387
|
get exclusions() {
|
|
388
|
+
checkDestroy(this.#isDestroyed);
|
|
377
389
|
return Array.from(this.#exclusions);
|
|
378
390
|
}
|
|
379
391
|
|
|
@@ -383,7 +395,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
383
395
|
* @throws {TypeError} If not a Set of strings.
|
|
384
396
|
*/
|
|
385
397
|
set exclusions(value) {
|
|
386
|
-
this
|
|
398
|
+
checkDestroy(this.#isDestroyed);
|
|
387
399
|
if (!(value instanceof Set) || ![...value].every((v) => typeof v === 'string'))
|
|
388
400
|
throw new TypeError('exclusions must be a Set<string>.');
|
|
389
401
|
this.#exclusions = value;
|
|
@@ -394,6 +406,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
394
406
|
* @returns {Record<string, string[]>} Object where each key is a group name and value is an array of item IDs.
|
|
395
407
|
*/
|
|
396
408
|
get groups() {
|
|
409
|
+
checkDestroy(this.#isDestroyed);
|
|
397
410
|
/** @type {Record<string, string[]>} */
|
|
398
411
|
const groups = {};
|
|
399
412
|
this.#groups.forEach((value, key) => (groups[key] = Array.from(value)));
|
|
@@ -406,7 +419,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
406
419
|
* @throws {TypeError} If not a valid Map<string, Set<string>>.
|
|
407
420
|
*/
|
|
408
421
|
set groups(value) {
|
|
409
|
-
this
|
|
422
|
+
checkDestroy(this.#isDestroyed);
|
|
410
423
|
if (
|
|
411
424
|
!(value instanceof Map) ||
|
|
412
425
|
![...value.values()].every(
|
|
@@ -422,6 +435,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
422
435
|
* @returns {RngGenerator} Function returning a floating-point number in [0, 1).
|
|
423
436
|
*/
|
|
424
437
|
get rng() {
|
|
438
|
+
checkDestroy(this.#isDestroyed);
|
|
425
439
|
return this.#rng;
|
|
426
440
|
}
|
|
427
441
|
|
|
@@ -431,7 +445,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
431
445
|
* @throws {TypeError} If not a valid function.
|
|
432
446
|
*/
|
|
433
447
|
set rng(value) {
|
|
434
|
-
this
|
|
448
|
+
checkDestroy(this.#isDestroyed);
|
|
435
449
|
if (typeof value !== 'function' || typeof value() !== 'number')
|
|
436
450
|
throw new TypeError('rng must be a function returning a number (RngGenerator).');
|
|
437
451
|
this.#rng = value;
|
|
@@ -442,6 +456,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
442
456
|
* @returns {Record<string, ItemDataGetter>} Object keyed by item ID.
|
|
443
457
|
*/
|
|
444
458
|
get items() {
|
|
459
|
+
checkDestroy(this.#isDestroyed);
|
|
445
460
|
/** @type {Record<string, ItemDataGetter>} */
|
|
446
461
|
const items = {};
|
|
447
462
|
this.#items.forEach((value, key) => {
|
|
@@ -456,7 +471,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
456
471
|
* @throws {TypeError} If structure is invalid.
|
|
457
472
|
*/
|
|
458
473
|
set items(value) {
|
|
459
|
-
this
|
|
474
|
+
checkDestroy(this.#isDestroyed);
|
|
460
475
|
if (
|
|
461
476
|
!(value instanceof Map) ||
|
|
462
477
|
![...value.values()].every(
|
|
@@ -493,16 +508,6 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
493
508
|
this.#seed = seed ?? null;
|
|
494
509
|
}
|
|
495
510
|
|
|
496
|
-
/**
|
|
497
|
-
* Checks if the instance has been destroyed and throws an error if so.
|
|
498
|
-
* @private
|
|
499
|
-
* @throws {Error} If the instance has already been destroyed.
|
|
500
|
-
*/
|
|
501
|
-
_checkDestroyed() {
|
|
502
|
-
if (this.#isDestroyed)
|
|
503
|
-
throw new Error('This instance has been destroyed and can no longer be used.');
|
|
504
|
-
}
|
|
505
|
-
|
|
506
511
|
/* ===========================
|
|
507
512
|
Public: Item management
|
|
508
513
|
=========================== */
|
|
@@ -514,6 +519,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
514
519
|
* @throws {TypeError} If `itemId` is not a string.
|
|
515
520
|
*/
|
|
516
521
|
hasItem(itemId) {
|
|
522
|
+
checkDestroy(this.#isDestroyed);
|
|
517
523
|
if (typeof itemId !== 'string') throw new TypeError('itemId must be a string');
|
|
518
524
|
return this.#items.has(itemId);
|
|
519
525
|
}
|
|
@@ -530,7 +536,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
530
536
|
* @throws {TypeError} If any parameter has an invalid type.
|
|
531
537
|
*/
|
|
532
538
|
addItem(id, opts = {}) {
|
|
533
|
-
this
|
|
539
|
+
checkDestroy(this.#isDestroyed);
|
|
534
540
|
if (typeof id !== 'string' || !id.trim()) throw new TypeError('id must be a non-empty string');
|
|
535
541
|
if (typeof opts !== 'object' || opts === null) throw new TypeError('opts must be an object');
|
|
536
542
|
let { weight = 1, label = id, meta = {}, groups = [] } = opts;
|
|
@@ -571,7 +577,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
571
577
|
* @throws {TypeError} If id is not a string.
|
|
572
578
|
*/
|
|
573
579
|
removeItem(id) {
|
|
574
|
-
this
|
|
580
|
+
checkDestroy(this.#isDestroyed);
|
|
575
581
|
if (typeof id !== 'string' || !id.trim()) throw new TypeError('id must be a non-empty string');
|
|
576
582
|
const it = this.#items.get(id);
|
|
577
583
|
if (!it) return false;
|
|
@@ -594,7 +600,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
594
600
|
* @throws {TypeError} If weight is invalid.
|
|
595
601
|
*/
|
|
596
602
|
setBaseWeight(id, weight) {
|
|
597
|
-
this
|
|
603
|
+
checkDestroy(this.#isDestroyed);
|
|
598
604
|
if (typeof id !== 'string' || !id.trim()) throw new TypeError('id must be a non-empty string');
|
|
599
605
|
if (typeof weight !== 'number' || !Number.isFinite(weight) || weight < 0)
|
|
600
606
|
throw new TypeError('weight must be a non-negative number');
|
|
@@ -611,6 +617,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
611
617
|
* @throws {TypeError} If id is not a string.
|
|
612
618
|
*/
|
|
613
619
|
getItem(id) {
|
|
620
|
+
checkDestroy(this.#isDestroyed);
|
|
614
621
|
if (typeof id !== 'string' || !id.trim()) throw new TypeError('id must be a non-empty string');
|
|
615
622
|
return this.#items.get(id) ?? null;
|
|
616
623
|
}
|
|
@@ -620,6 +627,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
620
627
|
* @returns {ItemData[]} Array of cloned item objects.
|
|
621
628
|
*/
|
|
622
629
|
listItems() {
|
|
630
|
+
checkDestroy(this.#isDestroyed);
|
|
623
631
|
return Array.from(this.#items.values()).map((i) => ({ ...i }));
|
|
624
632
|
}
|
|
625
633
|
|
|
@@ -627,7 +635,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
627
635
|
* Clear all items from the system.
|
|
628
636
|
*/
|
|
629
637
|
clearList() {
|
|
630
|
-
this
|
|
638
|
+
checkDestroy(this.#isDestroyed);
|
|
631
639
|
this.#items.clear();
|
|
632
640
|
this.clearFreqs();
|
|
633
641
|
this.clearPities();
|
|
@@ -644,6 +652,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
644
652
|
* @throws {TypeError} If `fn` is not a function.
|
|
645
653
|
*/
|
|
646
654
|
hasGlobalModifier(fn) {
|
|
655
|
+
checkDestroy(this.#isDestroyed);
|
|
647
656
|
if (typeof fn !== 'function') throw new TypeError('fn must be a function');
|
|
648
657
|
return this.#globalModifiers.includes(fn);
|
|
649
658
|
}
|
|
@@ -655,7 +664,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
655
664
|
* @throws {TypeError} If `fn` is not a function.
|
|
656
665
|
*/
|
|
657
666
|
addGlobalModifier(fn) {
|
|
658
|
-
this
|
|
667
|
+
checkDestroy(this.#isDestroyed);
|
|
659
668
|
if (typeof fn !== 'function') throw new TypeError('fn must be a function');
|
|
660
669
|
this.#globalModifiers.push(fn);
|
|
661
670
|
}
|
|
@@ -666,7 +675,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
666
675
|
* @throws {TypeError} If `fn` is not a function.
|
|
667
676
|
*/
|
|
668
677
|
removeGlobalModifier(fn) {
|
|
669
|
-
this
|
|
678
|
+
checkDestroy(this.#isDestroyed);
|
|
670
679
|
if (typeof fn !== 'function') throw new TypeError('fn must be a function');
|
|
671
680
|
this.#globalModifiers = this.#globalModifiers.filter((x) => x !== fn);
|
|
672
681
|
}
|
|
@@ -678,6 +687,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
678
687
|
* @throws {TypeError} If `fn` is not a function.
|
|
679
688
|
*/
|
|
680
689
|
hasTemporaryModifier(fn) {
|
|
690
|
+
checkDestroy(this.#isDestroyed);
|
|
681
691
|
if (typeof fn !== 'function') throw new TypeError('fn must be a function');
|
|
682
692
|
return this.#temporaryModifiers.some((mod) => mod.fn === fn);
|
|
683
693
|
}
|
|
@@ -691,7 +701,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
691
701
|
* @throws {TypeError} If `uses` is not a number.
|
|
692
702
|
*/
|
|
693
703
|
addTemporaryModifier(fn, uses = 1) {
|
|
694
|
-
this
|
|
704
|
+
checkDestroy(this.#isDestroyed);
|
|
695
705
|
if (typeof fn !== 'function') throw new TypeError('fn must be a function');
|
|
696
706
|
if (typeof uses !== 'number' || Number.isNaN(uses))
|
|
697
707
|
throw new TypeError('uses must be a number');
|
|
@@ -706,7 +716,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
706
716
|
* @throws {TypeError} If `fn` is not a function.
|
|
707
717
|
*/
|
|
708
718
|
removeTemporaryModifier(fn) {
|
|
709
|
-
this
|
|
719
|
+
checkDestroy(this.#isDestroyed);
|
|
710
720
|
if (typeof fn !== 'function') throw new TypeError('fn must be a function');
|
|
711
721
|
const originalLength = this.#temporaryModifiers.length;
|
|
712
722
|
this.#temporaryModifiers = this.#temporaryModifiers.filter((mod) => mod.fn !== fn);
|
|
@@ -720,6 +730,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
720
730
|
* @throws {TypeError} If `ruleFn` is not a function.
|
|
721
731
|
*/
|
|
722
732
|
hasConditionalRule(ruleFn) {
|
|
733
|
+
checkDestroy(this.#isDestroyed);
|
|
723
734
|
if (typeof ruleFn !== 'function') throw new TypeError('ruleFn must be a function');
|
|
724
735
|
return this.#conditionalRules.includes(ruleFn);
|
|
725
736
|
}
|
|
@@ -732,7 +743,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
732
743
|
* @throws {TypeError} If `ruleFn` is not a function.
|
|
733
744
|
*/
|
|
734
745
|
addConditionalRule(ruleFn) {
|
|
735
|
-
this
|
|
746
|
+
checkDestroy(this.#isDestroyed);
|
|
736
747
|
if (typeof ruleFn !== 'function') throw new TypeError('ruleFn must be a function');
|
|
737
748
|
this.#conditionalRules.push(ruleFn);
|
|
738
749
|
}
|
|
@@ -745,7 +756,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
745
756
|
* @throws {TypeError} If `ruleFn` is not a function.
|
|
746
757
|
*/
|
|
747
758
|
removeConditionalRule(ruleFn) {
|
|
748
|
-
this
|
|
759
|
+
checkDestroy(this.#isDestroyed);
|
|
749
760
|
if (typeof ruleFn !== 'function') throw new TypeError('ruleFn must be a function');
|
|
750
761
|
const originalLength = this.#conditionalRules.length;
|
|
751
762
|
this.#conditionalRules = this.#conditionalRules.filter((fn) => fn !== ruleFn);
|
|
@@ -763,6 +774,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
763
774
|
* @throws {TypeError} If `itemId` is not a string.
|
|
764
775
|
*/
|
|
765
776
|
hasPity(itemId) {
|
|
777
|
+
checkDestroy(this.#isDestroyed);
|
|
766
778
|
if (typeof itemId !== 'string') throw new TypeError('itemId must be a string');
|
|
767
779
|
return this.#pitySystems.has(itemId);
|
|
768
780
|
}
|
|
@@ -779,7 +791,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
779
791
|
* @throws {TypeError} If parameters are invalid.
|
|
780
792
|
*/
|
|
781
793
|
configurePity(itemId, cfg) {
|
|
782
|
-
this
|
|
794
|
+
checkDestroy(this.#isDestroyed);
|
|
783
795
|
if (!this.#items.has(itemId)) throw new Error('Item not found');
|
|
784
796
|
if (typeof cfg !== 'object' || cfg === null) throw new TypeError('cfg must be an object');
|
|
785
797
|
const { threshold, increment, cap = Infinity } = cfg;
|
|
@@ -803,7 +815,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
803
815
|
* @throws {TypeError} If itemId is not a string.
|
|
804
816
|
*/
|
|
805
817
|
resetPity(itemId) {
|
|
806
|
-
this
|
|
818
|
+
checkDestroy(this.#isDestroyed);
|
|
807
819
|
if (typeof itemId !== 'string' || !itemId.trim())
|
|
808
820
|
throw new TypeError('itemId must be a non-empty string');
|
|
809
821
|
const p = this.#pitySystems.get(itemId);
|
|
@@ -817,7 +829,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
817
829
|
* Remove all pity configurations.
|
|
818
830
|
*/
|
|
819
831
|
clearPities() {
|
|
820
|
-
this
|
|
832
|
+
checkDestroy(this.#isDestroyed);
|
|
821
833
|
this.#pitySystems.clear();
|
|
822
834
|
}
|
|
823
835
|
|
|
@@ -832,6 +844,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
832
844
|
* @throws {TypeError} If `itemId` is not a string.
|
|
833
845
|
*/
|
|
834
846
|
hasExclusion(itemId) {
|
|
847
|
+
checkDestroy(this.#isDestroyed);
|
|
835
848
|
if (typeof itemId !== 'string') throw new TypeError('itemId must be a string');
|
|
836
849
|
return this.#exclusions.has(itemId);
|
|
837
850
|
}
|
|
@@ -842,7 +855,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
842
855
|
* @throws {TypeError} If `itemId` is not a string.
|
|
843
856
|
*/
|
|
844
857
|
excludeItem(itemId) {
|
|
845
|
-
this
|
|
858
|
+
checkDestroy(this.#isDestroyed);
|
|
846
859
|
if (typeof itemId !== 'string') throw new TypeError('itemId must be a string');
|
|
847
860
|
this.#exclusions.add(itemId);
|
|
848
861
|
}
|
|
@@ -853,7 +866,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
853
866
|
* @throws {TypeError} If `itemId` is not a string.
|
|
854
867
|
*/
|
|
855
868
|
includeItem(itemId) {
|
|
856
|
-
this
|
|
869
|
+
checkDestroy(this.#isDestroyed);
|
|
857
870
|
if (typeof itemId !== 'string') throw new TypeError('itemId must be a string');
|
|
858
871
|
this.#exclusions.delete(itemId);
|
|
859
872
|
}
|
|
@@ -866,7 +879,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
866
879
|
* @private
|
|
867
880
|
*/
|
|
868
881
|
_ensureGroup(name) {
|
|
869
|
-
this
|
|
882
|
+
checkDestroy(this.#isDestroyed);
|
|
870
883
|
if (typeof name !== 'string') throw new TypeError('name must be a string');
|
|
871
884
|
let group = this.#groups.get(name);
|
|
872
885
|
if (!group) {
|
|
@@ -884,6 +897,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
884
897
|
* @throws {TypeError} If parameters are not strings.
|
|
885
898
|
*/
|
|
886
899
|
hasInGroup(itemId, groupName) {
|
|
900
|
+
checkDestroy(this.#isDestroyed);
|
|
887
901
|
if (typeof itemId !== 'string' || typeof groupName !== 'string')
|
|
888
902
|
throw new TypeError('itemId and groupName must be strings');
|
|
889
903
|
const group = this.#groups.get(groupName);
|
|
@@ -898,7 +912,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
898
912
|
* @throws {TypeError} If parameters are not strings.
|
|
899
913
|
*/
|
|
900
914
|
addToGroup(itemId, groupName) {
|
|
901
|
-
this
|
|
915
|
+
checkDestroy(this.#isDestroyed);
|
|
902
916
|
if (typeof itemId !== 'string' || typeof groupName !== 'string')
|
|
903
917
|
throw new TypeError('itemId and groupName must be strings');
|
|
904
918
|
const it = this.#items.get(itemId);
|
|
@@ -914,7 +928,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
914
928
|
* @throws {TypeError} If parameters are not strings.
|
|
915
929
|
*/
|
|
916
930
|
removeFromGroup(itemId, groupName) {
|
|
917
|
-
this
|
|
931
|
+
checkDestroy(this.#isDestroyed);
|
|
918
932
|
if (typeof itemId !== 'string' || typeof groupName !== 'string')
|
|
919
933
|
throw new TypeError('itemId and groupName must be strings');
|
|
920
934
|
const g = this.#groups.get(groupName);
|
|
@@ -932,7 +946,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
932
946
|
* Effectively resets the internal frequency map to an empty state.
|
|
933
947
|
*/
|
|
934
948
|
clearFreqs() {
|
|
935
|
-
this
|
|
949
|
+
checkDestroy(this.#isDestroyed);
|
|
936
950
|
this.#freq.clear();
|
|
937
951
|
}
|
|
938
952
|
|
|
@@ -944,7 +958,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
944
958
|
* @throws {TypeError} If `itemId` is not a string.
|
|
945
959
|
*/
|
|
946
960
|
resetFreq(itemId) {
|
|
947
|
-
this
|
|
961
|
+
checkDestroy(this.#isDestroyed);
|
|
948
962
|
if (typeof itemId !== 'string') throw new TypeError('itemId must be a string');
|
|
949
963
|
this.#freq.delete(itemId);
|
|
950
964
|
}
|
|
@@ -959,7 +973,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
959
973
|
* @throws {TypeError} If `context` is provided but is not an object.
|
|
960
974
|
*/
|
|
961
975
|
computeEffectiveWeights(context = {}) {
|
|
962
|
-
this
|
|
976
|
+
checkDestroy(this.#isDestroyed);
|
|
963
977
|
if (typeof context !== 'object' || context === null)
|
|
964
978
|
throw new TypeError(
|
|
965
979
|
`computeEffectiveWeights: parameter 'context' must be a non-null object, got ${typeof context}`,
|
|
@@ -1048,9 +1062,9 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1048
1062
|
* @param {Map<string, number>} weights - Map of item IDs to their weights.
|
|
1049
1063
|
* @returns {Array<{id: string, weight: number, p: number, cumulative: number}>} Distribution array.
|
|
1050
1064
|
* @throws {TypeError} If `weights` is not a Map.
|
|
1065
|
+
* @private
|
|
1051
1066
|
*/
|
|
1052
1067
|
_weightsToDistribution(weights) {
|
|
1053
|
-
this._checkDestroyed();
|
|
1054
1068
|
if (!(weights instanceof Map))
|
|
1055
1069
|
throw new TypeError(
|
|
1056
1070
|
`_weightsToDistribution: parameter 'weights' must be a Map, got ${typeof weights}`,
|
|
@@ -1104,7 +1118,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1104
1118
|
* @throws {TypeError} If `opts` is not an object.
|
|
1105
1119
|
*/
|
|
1106
1120
|
drawOne(opts = {}) {
|
|
1107
|
-
this
|
|
1121
|
+
checkDestroy(this.#isDestroyed);
|
|
1108
1122
|
if (typeof opts !== 'object' || opts === null)
|
|
1109
1123
|
throw new TypeError(
|
|
1110
1124
|
`drawOne: parameter 'opts' must be a non-null object, got ${typeof opts}`,
|
|
@@ -1166,7 +1180,6 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1166
1180
|
* @private
|
|
1167
1181
|
*/
|
|
1168
1182
|
_consumeTemporaryModifiers() {
|
|
1169
|
-
this._checkDestroyed();
|
|
1170
1183
|
for (let i = this.#temporaryModifiers.length - 1; i >= 0; --i) {
|
|
1171
1184
|
const t = this.#temporaryModifiers[i];
|
|
1172
1185
|
t.uses -= 1;
|
|
@@ -1188,7 +1201,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1188
1201
|
* @throws {TypeError} If `opts` is not an object.
|
|
1189
1202
|
*/
|
|
1190
1203
|
drawMany(count = 1, opts = {}) {
|
|
1191
|
-
this
|
|
1204
|
+
checkDestroy(this.#isDestroyed);
|
|
1192
1205
|
if (!Number.isInteger(count) || count <= 0)
|
|
1193
1206
|
throw new TypeError(`drawMany: parameter 'count' must be a positive integer, got ${count}`);
|
|
1194
1207
|
if (typeof opts !== 'object' || opts === null)
|
|
@@ -1271,7 +1284,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1271
1284
|
* @returns {ExportedJson} Exported configuration object.
|
|
1272
1285
|
*/
|
|
1273
1286
|
exportToJson() {
|
|
1274
|
-
this
|
|
1287
|
+
checkDestroy(this.#isDestroyed);
|
|
1275
1288
|
const data = {
|
|
1276
1289
|
items: Array.from(this.#items.values()).map((it) => ({
|
|
1277
1290
|
id: it.id,
|
|
@@ -1298,7 +1311,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1298
1311
|
* @throws {TypeError} If `data.seed` is not a number, null, or undefined.
|
|
1299
1312
|
*/
|
|
1300
1313
|
loadFromJson(data) {
|
|
1301
|
-
this
|
|
1314
|
+
checkDestroy(this.#isDestroyed);
|
|
1302
1315
|
if (typeof data !== 'object' || data === null)
|
|
1303
1316
|
throw new TypeError('data must be a non-null object');
|
|
1304
1317
|
if (!Array.isArray(data.items) || !Array.isArray(data.pity) || !Array.isArray(data.exclusions))
|
|
@@ -1352,7 +1365,7 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1352
1365
|
* @returns {TinyAdvancedRaffle} A new cloned instance, fully independent from the original.
|
|
1353
1366
|
*/
|
|
1354
1367
|
clone() {
|
|
1355
|
-
this
|
|
1368
|
+
checkDestroy(this.#isDestroyed);
|
|
1356
1369
|
const cloneInstance = new TinyAdvancedRaffle();
|
|
1357
1370
|
|
|
1358
1371
|
// Primitive values
|
|
@@ -1412,9 +1425,9 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1412
1425
|
* @param {number} seed - Seed value for PRNG (integer).
|
|
1413
1426
|
* @returns {RngGenerator} A function that returns a pseudo-random number in [0, 1).
|
|
1414
1427
|
* @throws {TypeError} If `seed` is not a finite number.
|
|
1428
|
+
* @private
|
|
1415
1429
|
*/
|
|
1416
1430
|
_makeSeededRng(seed) {
|
|
1417
|
-
this._checkDestroyed();
|
|
1418
1431
|
if (typeof seed !== 'number' || !Number.isFinite(seed))
|
|
1419
1432
|
throw new TypeError('seed must be a finite number');
|
|
1420
1433
|
// mulberry32
|
|
@@ -1434,7 +1447,6 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1434
1447
|
*/
|
|
1435
1448
|
destroy() {
|
|
1436
1449
|
if (this.#isDestroyed) return;
|
|
1437
|
-
this.#isDestroyed = true;
|
|
1438
1450
|
|
|
1439
1451
|
// Clear all Maps and Sets
|
|
1440
1452
|
this.#pitySystems.clear();
|
|
@@ -1450,6 +1462,8 @@ class TinyAdvancedRaffle extends events.EventEmitter {
|
|
|
1450
1462
|
|
|
1451
1463
|
// Nullify core references
|
|
1452
1464
|
this.#seed = null;
|
|
1465
|
+
|
|
1466
|
+
this.#isDestroyed = true;
|
|
1453
1467
|
}
|
|
1454
1468
|
}
|
|
1455
1469
|
|