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,4 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
+
import { createCheckDestroyed } from './utils.mjs';
|
|
3
|
+
const checkDestroy = createCheckDestroyed('TinyNewWinEvents');
|
|
2
4
|
/**
|
|
3
5
|
* Stores polling intervals associated with window references.
|
|
4
6
|
* Used to detect when the window is closed.
|
|
@@ -38,11 +40,25 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
38
40
|
#readyEventName = '__TNE_READY__';
|
|
39
41
|
/** @type {string} Internal message type for routed communication */
|
|
40
42
|
#routeEventName = '__TNE_ROUTE__';
|
|
43
|
+
/**
|
|
44
|
+
* Tracks whether the instance has been destroyed.
|
|
45
|
+
* @type {boolean}
|
|
46
|
+
*/
|
|
47
|
+
#destroyed = false;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the current destruction status of the instance.
|
|
50
|
+
*
|
|
51
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
get destroyed() {
|
|
54
|
+
return this.#destroyed;
|
|
55
|
+
}
|
|
41
56
|
/**
|
|
42
57
|
* Gets the internal handshake event name.
|
|
43
58
|
* @returns {string}
|
|
44
59
|
*/
|
|
45
60
|
get readyEventName() {
|
|
61
|
+
checkDestroy(this.#destroyed);
|
|
46
62
|
return this.#readyEventName;
|
|
47
63
|
}
|
|
48
64
|
/**
|
|
@@ -51,6 +67,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
51
67
|
* @throws {TypeError} If the value is not a string.
|
|
52
68
|
*/
|
|
53
69
|
set readyEventName(name) {
|
|
70
|
+
checkDestroy(this.#destroyed);
|
|
54
71
|
if (typeof name !== 'string')
|
|
55
72
|
throw new TypeError('TinyNewWinEvents: readyEventName must be a string.');
|
|
56
73
|
this.#readyEventName = name;
|
|
@@ -60,6 +77,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
60
77
|
* @returns {string}
|
|
61
78
|
*/
|
|
62
79
|
get routeEventName() {
|
|
80
|
+
checkDestroy(this.#destroyed);
|
|
63
81
|
return this.#routeEventName;
|
|
64
82
|
}
|
|
65
83
|
/**
|
|
@@ -68,6 +86,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
68
86
|
* @throws {TypeError} If the value is not a string.
|
|
69
87
|
*/
|
|
70
88
|
set routeEventName(name) {
|
|
89
|
+
checkDestroy(this.#destroyed);
|
|
71
90
|
if (typeof name !== 'string')
|
|
72
91
|
throw new TypeError('TinyNewWinEvents: routeEventName must be a string.');
|
|
73
92
|
this.#routeEventName = name;
|
|
@@ -120,6 +139,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
120
139
|
* @returns {Window|null}
|
|
121
140
|
*/
|
|
122
141
|
getWin() {
|
|
142
|
+
checkDestroy(this.#destroyed);
|
|
123
143
|
return this.#windowRef;
|
|
124
144
|
}
|
|
125
145
|
/**
|
|
@@ -176,6 +196,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
176
196
|
* @returns {void}
|
|
177
197
|
*/
|
|
178
198
|
close() {
|
|
199
|
+
checkDestroy(this.#destroyed);
|
|
179
200
|
if (!this.#isHost)
|
|
180
201
|
throw new Error('Only host can close the window.');
|
|
181
202
|
if (this.#windowRef && !this.#windowRef.closed)
|
|
@@ -192,6 +213,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
192
213
|
* @returns {void}
|
|
193
214
|
*/
|
|
194
215
|
winEmit(route, payload) {
|
|
216
|
+
checkDestroy(this.#destroyed);
|
|
195
217
|
if (typeof route !== 'string')
|
|
196
218
|
throw new TypeError('Event name must be a string.');
|
|
197
219
|
if (this.isDestroyed())
|
|
@@ -208,6 +230,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
208
230
|
* @returns {boolean}
|
|
209
231
|
*/
|
|
210
232
|
isConnected() {
|
|
233
|
+
checkDestroy(this.#destroyed);
|
|
211
234
|
return this.#ready && this.#windowRef && !this.#windowRef.closed ? true : false;
|
|
212
235
|
}
|
|
213
236
|
/**
|
|
@@ -233,6 +256,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
233
256
|
* @returns {void}
|
|
234
257
|
*/
|
|
235
258
|
onClose(callback) {
|
|
259
|
+
checkDestroy(this.#destroyed);
|
|
236
260
|
this.on('WINDOW_REF_CLOSED', callback);
|
|
237
261
|
}
|
|
238
262
|
/**
|
|
@@ -242,6 +266,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
242
266
|
* @returns {void}
|
|
243
267
|
*/
|
|
244
268
|
offClose(callback) {
|
|
269
|
+
checkDestroy(this.#destroyed);
|
|
245
270
|
this.off('WINDOW_REF_CLOSED', callback);
|
|
246
271
|
}
|
|
247
272
|
/**
|
|
@@ -270,6 +295,7 @@ class TinyNewWinEvents extends EventEmitter {
|
|
|
270
295
|
this.#ready = false;
|
|
271
296
|
this.#windowRef = null;
|
|
272
297
|
this.removeAllListeners();
|
|
298
|
+
this.#destroyed = true;
|
|
273
299
|
}
|
|
274
300
|
}
|
|
275
301
|
export default TinyNewWinEvents;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export default TinyNotifications;
|
|
2
1
|
/**
|
|
3
2
|
* A utility class to manage browser notifications with sound and custom behavior.
|
|
4
3
|
* Useful for triggering system notifications with optional sound, avatar icon, body truncation, and click actions.
|
|
@@ -6,6 +5,7 @@ export default TinyNotifications;
|
|
|
6
5
|
* @class
|
|
7
6
|
*/
|
|
8
7
|
declare class TinyNotifications {
|
|
8
|
+
#private;
|
|
9
9
|
/**
|
|
10
10
|
* Constructs a new instance of TinyNotifications.
|
|
11
11
|
*
|
|
@@ -17,10 +17,10 @@ declare class TinyNotifications {
|
|
|
17
17
|
* @throws {TypeError} If any of the parameters are of an invalid type.
|
|
18
18
|
*/
|
|
19
19
|
constructor({ audio, defaultIcon, bodyLimit, defaultOnClick, }?: {
|
|
20
|
-
audio?: string | HTMLAudioElement | null
|
|
21
|
-
defaultIcon?: string | null
|
|
22
|
-
bodyLimit?: number
|
|
23
|
-
defaultOnClick?: (
|
|
20
|
+
audio?: string | HTMLAudioElement | null;
|
|
21
|
+
defaultIcon?: string | null;
|
|
22
|
+
bodyLimit?: number;
|
|
23
|
+
defaultOnClick?: (this: Notification, evt: Event) => any;
|
|
24
24
|
});
|
|
25
25
|
/**
|
|
26
26
|
* Requests permission from the user to show notifications.
|
|
@@ -101,6 +101,6 @@ declare class TinyNotifications {
|
|
|
101
101
|
* @throws {TypeError} If the value is not a function.
|
|
102
102
|
*/
|
|
103
103
|
setDefaultOnClick(value: (this: Notification, evt: Event) => any): void;
|
|
104
|
-
#private;
|
|
105
104
|
}
|
|
105
|
+
export default TinyNotifications;
|
|
106
106
|
//# sourceMappingURL=TinyNotifications.d.mts.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var utils = require('./utils.cjs');
|
|
4
|
+
|
|
5
|
+
const checkDestroy = utils.createCheckDestroyed('TinyNotifyCenter');
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* Represents a single notification entry.
|
|
5
9
|
*
|
|
@@ -109,6 +113,21 @@ class TinyNotifyCenter {
|
|
|
109
113
|
document.body.insertAdjacentHTML(where, TinyNotifyCenter.getTemplate());
|
|
110
114
|
}
|
|
111
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Tracks whether the instance has been destroyed.
|
|
118
|
+
* @type {boolean}
|
|
119
|
+
*/
|
|
120
|
+
#destroyed = false;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Gets the current destruction status of the instance.
|
|
124
|
+
*
|
|
125
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
126
|
+
*/
|
|
127
|
+
get destroyed() {
|
|
128
|
+
return this.#destroyed;
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
/** @type {HTMLElement} */
|
|
113
132
|
#center;
|
|
114
133
|
/** @type {HTMLElement} */
|
|
@@ -206,6 +225,7 @@ class TinyNotifyCenter {
|
|
|
206
225
|
* @param {boolean} value
|
|
207
226
|
*/
|
|
208
227
|
setMarkAllAsReadOnClose(value) {
|
|
228
|
+
checkDestroy(this.#destroyed);
|
|
209
229
|
if (typeof value !== 'boolean')
|
|
210
230
|
throw new TypeError(`Expected boolean for markAllAsReadOnClose, got ${typeof value}`);
|
|
211
231
|
this.#markAllAsReadOnClose = value;
|
|
@@ -216,6 +236,7 @@ class TinyNotifyCenter {
|
|
|
216
236
|
* @param {number} ms
|
|
217
237
|
*/
|
|
218
238
|
setRemoveDelay(ms) {
|
|
239
|
+
checkDestroy(this.#destroyed);
|
|
219
240
|
if (typeof ms !== 'number') throw new Error(`NotificationCenter: "ms" must be an number.`);
|
|
220
241
|
this.#removeDelay = ms;
|
|
221
242
|
}
|
|
@@ -226,6 +247,7 @@ class TinyNotifyCenter {
|
|
|
226
247
|
* @returns {'text' | 'html' | null}
|
|
227
248
|
*/
|
|
228
249
|
getItemMode(index) {
|
|
250
|
+
checkDestroy(this.#destroyed);
|
|
229
251
|
const item = this.getItem(index);
|
|
230
252
|
return item ? this.#modes.get(item) : null;
|
|
231
253
|
}
|
|
@@ -236,6 +258,7 @@ class TinyNotifyCenter {
|
|
|
236
258
|
* @returns {HTMLElement}
|
|
237
259
|
*/
|
|
238
260
|
getItem(index) {
|
|
261
|
+
checkDestroy(this.#destroyed);
|
|
239
262
|
const element = this.#list.children.item(index);
|
|
240
263
|
if (!(element instanceof HTMLElement))
|
|
241
264
|
throw new Error(`NotificationCenter: "item" must be an HTMLElement. Got: ${element}`);
|
|
@@ -248,6 +271,7 @@ class TinyNotifyCenter {
|
|
|
248
271
|
* @returns {boolean}
|
|
249
272
|
*/
|
|
250
273
|
hasItem(index) {
|
|
274
|
+
checkDestroy(this.#destroyed);
|
|
251
275
|
return index >= 0 && index < this.#list.children.length;
|
|
252
276
|
}
|
|
253
277
|
|
|
@@ -256,6 +280,7 @@ class TinyNotifyCenter {
|
|
|
256
280
|
* @param {number|HTMLElement} index
|
|
257
281
|
*/
|
|
258
282
|
markAsRead(index) {
|
|
283
|
+
checkDestroy(this.#destroyed);
|
|
259
284
|
const item = index instanceof HTMLElement ? index : this.getItem(index);
|
|
260
285
|
if (item.classList.contains('unread')) {
|
|
261
286
|
item.classList.remove('unread');
|
|
@@ -270,6 +295,7 @@ class TinyNotifyCenter {
|
|
|
270
295
|
* @param {'text'|'html'} [mode='text'] - How to treat the message content.
|
|
271
296
|
*/
|
|
272
297
|
add(message, mode = 'text') {
|
|
298
|
+
checkDestroy(this.#destroyed);
|
|
273
299
|
const item = document.createElement('div');
|
|
274
300
|
item.className = 'item unread';
|
|
275
301
|
|
|
@@ -351,6 +377,7 @@ class TinyNotifyCenter {
|
|
|
351
377
|
* @param {number} index
|
|
352
378
|
*/
|
|
353
379
|
remove(index) {
|
|
380
|
+
checkDestroy(this.#destroyed);
|
|
354
381
|
const item = this.getItem(index);
|
|
355
382
|
this.#removeItem(item);
|
|
356
383
|
}
|
|
@@ -359,6 +386,7 @@ class TinyNotifyCenter {
|
|
|
359
386
|
* Clear all notifications safely.
|
|
360
387
|
*/
|
|
361
388
|
clear() {
|
|
389
|
+
checkDestroy(this.#destroyed);
|
|
362
390
|
let needAgain = true;
|
|
363
391
|
while (needAgain) {
|
|
364
392
|
needAgain = false;
|
|
@@ -376,6 +404,7 @@ class TinyNotifyCenter {
|
|
|
376
404
|
* Open the notify center.
|
|
377
405
|
*/
|
|
378
406
|
open() {
|
|
407
|
+
checkDestroy(this.#destroyed);
|
|
379
408
|
this.#overlay.classList.remove('hidden');
|
|
380
409
|
this.#center.classList.add('open');
|
|
381
410
|
}
|
|
@@ -384,6 +413,7 @@ class TinyNotifyCenter {
|
|
|
384
413
|
* Close the notify center.
|
|
385
414
|
*/
|
|
386
415
|
close() {
|
|
416
|
+
checkDestroy(this.#destroyed);
|
|
387
417
|
this.#overlay.classList.add('hidden');
|
|
388
418
|
this.#center.classList.remove('open');
|
|
389
419
|
if (this.#markAllAsReadOnClose) {
|
|
@@ -398,6 +428,7 @@ class TinyNotifyCenter {
|
|
|
398
428
|
* Toggle open/close state.
|
|
399
429
|
*/
|
|
400
430
|
toggle() {
|
|
431
|
+
checkDestroy(this.#destroyed);
|
|
401
432
|
if (this.#center.classList.contains('open')) this.close();
|
|
402
433
|
else this.open();
|
|
403
434
|
}
|
|
@@ -406,6 +437,7 @@ class TinyNotifyCenter {
|
|
|
406
437
|
* Recalculate the number of notifications based on the actual DOM list.
|
|
407
438
|
*/
|
|
408
439
|
recount() {
|
|
440
|
+
checkDestroy(this.#destroyed);
|
|
409
441
|
const count = this.#list.querySelectorAll('.item.unread').length;
|
|
410
442
|
this.#updateCount(count);
|
|
411
443
|
}
|
|
@@ -427,6 +459,7 @@ class TinyNotifyCenter {
|
|
|
427
459
|
* @returns {void}
|
|
428
460
|
*/
|
|
429
461
|
destroy() {
|
|
462
|
+
if (this.#destroyed) return;
|
|
430
463
|
// Remove event listeners
|
|
431
464
|
this.#button?.removeEventListener('click', this.toggle);
|
|
432
465
|
this.#center?.querySelector('.close')?.removeEventListener('click', this.close);
|
|
@@ -448,6 +481,9 @@ class TinyNotifyCenter {
|
|
|
448
481
|
// this.#overlay = null;
|
|
449
482
|
this.#count = 0;
|
|
450
483
|
this.#modes = new WeakMap();
|
|
484
|
+
|
|
485
|
+
// Lock the instance
|
|
486
|
+
this.#destroyed = true;
|
|
451
487
|
}
|
|
452
488
|
}
|
|
453
489
|
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export default TinyNotifyCenter;
|
|
2
|
-
/**
|
|
3
|
-
* Represents a single notification entry.
|
|
4
|
-
*
|
|
5
|
-
* A notification can be provided as a simple string (treated as a plain message),
|
|
6
|
-
* or as an object with additional data such as a title, an avatar image, and a click handler.
|
|
7
|
-
*/
|
|
8
1
|
export type NotifyData = string | {
|
|
9
2
|
title?: string;
|
|
10
3
|
message: string;
|
|
@@ -42,6 +35,7 @@ export type NotifyData = string | {
|
|
|
42
35
|
* @class
|
|
43
36
|
*/
|
|
44
37
|
declare class TinyNotifyCenter {
|
|
38
|
+
#private;
|
|
45
39
|
/**
|
|
46
40
|
* Returns the full HTML structure for the notification system as a string.
|
|
47
41
|
*
|
|
@@ -72,7 +66,13 @@ declare class TinyNotifyCenter {
|
|
|
72
66
|
* @param {'beforebegin'|'afterbegin'|'beforeend'|'afterend'} [where='afterbegin']
|
|
73
67
|
* The position relative to `document.body` where the HTML should be inserted.
|
|
74
68
|
*/
|
|
75
|
-
static insertTemplate(where?:
|
|
69
|
+
static insertTemplate(where?: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend'): void;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the current destruction status of the instance.
|
|
72
|
+
*
|
|
73
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
74
|
+
*/
|
|
75
|
+
get destroyed(): boolean;
|
|
76
76
|
/**
|
|
77
77
|
* Options for configuring the NotificationCenter instance.
|
|
78
78
|
*
|
|
@@ -86,10 +86,10 @@ declare class TinyNotifyCenter {
|
|
|
86
86
|
* @param {HTMLElement} [options.overlay=document.querySelector('.notify-overlay')] - The overlay element that covers the screen when the center is visible.
|
|
87
87
|
*/
|
|
88
88
|
constructor(options?: {
|
|
89
|
-
center?: HTMLElement
|
|
90
|
-
badge?: HTMLElement
|
|
91
|
-
button?: HTMLElement
|
|
92
|
-
overlay?: HTMLElement
|
|
89
|
+
center?: HTMLElement;
|
|
90
|
+
badge?: HTMLElement;
|
|
91
|
+
button?: HTMLElement;
|
|
92
|
+
overlay?: HTMLElement;
|
|
93
93
|
});
|
|
94
94
|
/**
|
|
95
95
|
* Enable or disable automatic mark-as-read on close.
|
|
@@ -106,7 +106,7 @@ declare class TinyNotifyCenter {
|
|
|
106
106
|
* @param {number} index
|
|
107
107
|
* @returns {'text' | 'html' | null}
|
|
108
108
|
*/
|
|
109
|
-
getItemMode(index: number):
|
|
109
|
+
getItemMode(index: number): 'text' | 'html' | null;
|
|
110
110
|
/**
|
|
111
111
|
* Get a notify element by index.
|
|
112
112
|
* @param {number} index
|
|
@@ -130,7 +130,7 @@ declare class TinyNotifyCenter {
|
|
|
130
130
|
* @param {NotifyData} message - Notification content or a full object with title, avatar, and callback.
|
|
131
131
|
* @param {'text'|'html'} [mode='text'] - How to treat the message content.
|
|
132
132
|
*/
|
|
133
|
-
add(message: NotifyData, mode?:
|
|
133
|
+
add(message: NotifyData, mode?: 'text' | 'html'): void;
|
|
134
134
|
/**
|
|
135
135
|
* Remove a notify by index.
|
|
136
136
|
* @param {number} index
|
|
@@ -170,6 +170,6 @@ declare class TinyNotifyCenter {
|
|
|
170
170
|
* @returns {void}
|
|
171
171
|
*/
|
|
172
172
|
destroy(): void;
|
|
173
|
-
#private;
|
|
174
173
|
}
|
|
174
|
+
export default TinyNotifyCenter;
|
|
175
175
|
//# sourceMappingURL=TinyNotifyCenter.d.mts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createCheckDestroyed } from './utils.mjs';
|
|
2
|
+
const checkDestroy = createCheckDestroyed('TinyNotifyCenter');
|
|
1
3
|
/**
|
|
2
4
|
* Represents a single notification entry.
|
|
3
5
|
*
|
|
@@ -104,6 +106,19 @@ class TinyNotifyCenter {
|
|
|
104
106
|
static insertTemplate(where = 'afterbegin') {
|
|
105
107
|
document.body.insertAdjacentHTML(where, TinyNotifyCenter.getTemplate());
|
|
106
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Tracks whether the instance has been destroyed.
|
|
111
|
+
* @type {boolean}
|
|
112
|
+
*/
|
|
113
|
+
#destroyed = false;
|
|
114
|
+
/**
|
|
115
|
+
* Gets the current destruction status of the instance.
|
|
116
|
+
*
|
|
117
|
+
* @returns {boolean} True if the instance is destroyed, false otherwise.
|
|
118
|
+
*/
|
|
119
|
+
get destroyed() {
|
|
120
|
+
return this.#destroyed;
|
|
121
|
+
}
|
|
107
122
|
/** @type {HTMLElement} */
|
|
108
123
|
#center;
|
|
109
124
|
/** @type {HTMLElement} */
|
|
@@ -188,6 +203,7 @@ class TinyNotifyCenter {
|
|
|
188
203
|
* @param {boolean} value
|
|
189
204
|
*/
|
|
190
205
|
setMarkAllAsReadOnClose(value) {
|
|
206
|
+
checkDestroy(this.#destroyed);
|
|
191
207
|
if (typeof value !== 'boolean')
|
|
192
208
|
throw new TypeError(`Expected boolean for markAllAsReadOnClose, got ${typeof value}`);
|
|
193
209
|
this.#markAllAsReadOnClose = value;
|
|
@@ -197,6 +213,7 @@ class TinyNotifyCenter {
|
|
|
197
213
|
* @param {number} ms
|
|
198
214
|
*/
|
|
199
215
|
setRemoveDelay(ms) {
|
|
216
|
+
checkDestroy(this.#destroyed);
|
|
200
217
|
if (typeof ms !== 'number')
|
|
201
218
|
throw new Error(`NotificationCenter: "ms" must be an number.`);
|
|
202
219
|
this.#removeDelay = ms;
|
|
@@ -207,6 +224,7 @@ class TinyNotifyCenter {
|
|
|
207
224
|
* @returns {'text' | 'html' | null}
|
|
208
225
|
*/
|
|
209
226
|
getItemMode(index) {
|
|
227
|
+
checkDestroy(this.#destroyed);
|
|
210
228
|
const item = this.getItem(index);
|
|
211
229
|
return item ? this.#modes.get(item) : null;
|
|
212
230
|
}
|
|
@@ -216,6 +234,7 @@ class TinyNotifyCenter {
|
|
|
216
234
|
* @returns {HTMLElement}
|
|
217
235
|
*/
|
|
218
236
|
getItem(index) {
|
|
237
|
+
checkDestroy(this.#destroyed);
|
|
219
238
|
const element = this.#list.children.item(index);
|
|
220
239
|
if (!(element instanceof HTMLElement))
|
|
221
240
|
throw new Error(`NotificationCenter: "item" must be an HTMLElement. Got: ${element}`);
|
|
@@ -227,6 +246,7 @@ class TinyNotifyCenter {
|
|
|
227
246
|
* @returns {boolean}
|
|
228
247
|
*/
|
|
229
248
|
hasItem(index) {
|
|
249
|
+
checkDestroy(this.#destroyed);
|
|
230
250
|
return index >= 0 && index < this.#list.children.length;
|
|
231
251
|
}
|
|
232
252
|
/**
|
|
@@ -234,6 +254,7 @@ class TinyNotifyCenter {
|
|
|
234
254
|
* @param {number|HTMLElement} index
|
|
235
255
|
*/
|
|
236
256
|
markAsRead(index) {
|
|
257
|
+
checkDestroy(this.#destroyed);
|
|
237
258
|
const item = index instanceof HTMLElement ? index : this.getItem(index);
|
|
238
259
|
if (item.classList.contains('unread')) {
|
|
239
260
|
item.classList.remove('unread');
|
|
@@ -247,6 +268,7 @@ class TinyNotifyCenter {
|
|
|
247
268
|
* @param {'text'|'html'} [mode='text'] - How to treat the message content.
|
|
248
269
|
*/
|
|
249
270
|
add(message, mode = 'text') {
|
|
271
|
+
checkDestroy(this.#destroyed);
|
|
250
272
|
const item = document.createElement('div');
|
|
251
273
|
item.className = 'item unread';
|
|
252
274
|
let titleText = null;
|
|
@@ -318,6 +340,7 @@ class TinyNotifyCenter {
|
|
|
318
340
|
* @param {number} index
|
|
319
341
|
*/
|
|
320
342
|
remove(index) {
|
|
343
|
+
checkDestroy(this.#destroyed);
|
|
321
344
|
const item = this.getItem(index);
|
|
322
345
|
this.#removeItem(item);
|
|
323
346
|
}
|
|
@@ -325,6 +348,7 @@ class TinyNotifyCenter {
|
|
|
325
348
|
* Clear all notifications safely.
|
|
326
349
|
*/
|
|
327
350
|
clear() {
|
|
351
|
+
checkDestroy(this.#destroyed);
|
|
328
352
|
let needAgain = true;
|
|
329
353
|
while (needAgain) {
|
|
330
354
|
needAgain = false;
|
|
@@ -341,6 +365,7 @@ class TinyNotifyCenter {
|
|
|
341
365
|
* Open the notify center.
|
|
342
366
|
*/
|
|
343
367
|
open() {
|
|
368
|
+
checkDestroy(this.#destroyed);
|
|
344
369
|
this.#overlay.classList.remove('hidden');
|
|
345
370
|
this.#center.classList.add('open');
|
|
346
371
|
}
|
|
@@ -348,6 +373,7 @@ class TinyNotifyCenter {
|
|
|
348
373
|
* Close the notify center.
|
|
349
374
|
*/
|
|
350
375
|
close() {
|
|
376
|
+
checkDestroy(this.#destroyed);
|
|
351
377
|
this.#overlay.classList.add('hidden');
|
|
352
378
|
this.#center.classList.remove('open');
|
|
353
379
|
if (this.#markAllAsReadOnClose) {
|
|
@@ -362,6 +388,7 @@ class TinyNotifyCenter {
|
|
|
362
388
|
* Toggle open/close state.
|
|
363
389
|
*/
|
|
364
390
|
toggle() {
|
|
391
|
+
checkDestroy(this.#destroyed);
|
|
365
392
|
if (this.#center.classList.contains('open'))
|
|
366
393
|
this.close();
|
|
367
394
|
else
|
|
@@ -371,6 +398,7 @@ class TinyNotifyCenter {
|
|
|
371
398
|
* Recalculate the number of notifications based on the actual DOM list.
|
|
372
399
|
*/
|
|
373
400
|
recount() {
|
|
401
|
+
checkDestroy(this.#destroyed);
|
|
374
402
|
const count = this.#list.querySelectorAll('.item.unread').length;
|
|
375
403
|
this.#updateCount(count);
|
|
376
404
|
}
|
|
@@ -390,6 +418,8 @@ class TinyNotifyCenter {
|
|
|
390
418
|
* @returns {void}
|
|
391
419
|
*/
|
|
392
420
|
destroy() {
|
|
421
|
+
if (this.#destroyed)
|
|
422
|
+
return;
|
|
393
423
|
// Remove event listeners
|
|
394
424
|
this.#button?.removeEventListener('click', this.toggle);
|
|
395
425
|
this.#center?.querySelector('.close')?.removeEventListener('click', this.close);
|
|
@@ -408,6 +438,8 @@ class TinyNotifyCenter {
|
|
|
408
438
|
// this.#overlay = null;
|
|
409
439
|
this.#count = 0;
|
|
410
440
|
this.#modes = new WeakMap();
|
|
441
|
+
// Lock the instance
|
|
442
|
+
this.#destroyed = true;
|
|
411
443
|
}
|
|
412
444
|
}
|
|
413
445
|
export default TinyNotifyCenter;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} QueuedTask
|
|
3
|
+
* @property {(...args: any[]) => Promise<any>|Promise<any>} task - The async task to execute.
|
|
4
|
+
* @property {(value: any) => any} resolve - The resolve function from the Promise.
|
|
5
|
+
* @property {(reason?: any) => any} reject - The reject function from the Promise.
|
|
6
|
+
* @property {string|undefined} [id] - Optional identifier for the task.
|
|
7
|
+
* @property {string|null|undefined} [marker] - Optional marker for the task.
|
|
8
|
+
* @property {number|null|undefined} [delay] - Optional delay (in ms) before the task is executed.
|
|
9
|
+
*/
|
|
2
10
|
export type QueuedTask = {
|
|
3
11
|
/**
|
|
4
12
|
* - The async task to execute.
|
|
@@ -25,15 +33,6 @@ export type QueuedTask = {
|
|
|
25
33
|
*/
|
|
26
34
|
delay?: number | null | undefined;
|
|
27
35
|
};
|
|
28
|
-
/**
|
|
29
|
-
* @typedef {Object} QueuedTask
|
|
30
|
-
* @property {(...args: any[]) => Promise<any>|Promise<any>} task - The async task to execute.
|
|
31
|
-
* @property {(value: any) => any} resolve - The resolve function from the Promise.
|
|
32
|
-
* @property {(reason?: any) => any} reject - The reject function from the Promise.
|
|
33
|
-
* @property {string|undefined} [id] - Optional identifier for the task.
|
|
34
|
-
* @property {string|null|undefined} [marker] - Optional marker for the task.
|
|
35
|
-
* @property {number|null|undefined} [delay] - Optional delay (in ms) before the task is executed.
|
|
36
|
-
*/
|
|
37
36
|
/**
|
|
38
37
|
* A queue system for managing and executing asynchronous tasks sequentially, one at a time.
|
|
39
38
|
*
|
|
@@ -43,6 +42,7 @@ export type QueuedTask = {
|
|
|
43
42
|
* @class
|
|
44
43
|
*/
|
|
45
44
|
declare class TinyPromiseQueue {
|
|
45
|
+
#private;
|
|
46
46
|
/**
|
|
47
47
|
* Returns whether the queue is currently processing a task.
|
|
48
48
|
*
|
|
@@ -105,6 +105,6 @@ declare class TinyPromiseQueue {
|
|
|
105
105
|
* @throws {Error} Throws if `id` is not a string.
|
|
106
106
|
*/
|
|
107
107
|
cancelTask(id: string): boolean;
|
|
108
|
-
#private;
|
|
109
108
|
}
|
|
109
|
+
export default TinyPromiseQueue;
|
|
110
110
|
//# sourceMappingURL=TinyPromiseQueue.d.mts.map
|