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,66 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { areElsCollBottom } from './collision.mjs';
|
|
13
|
-
import { areElsCollLeft } from './collision.mjs';
|
|
14
|
-
import { areElsCollRight } from './collision.mjs';
|
|
15
|
-
import { areElsCollPerfTop } from './collision.mjs';
|
|
16
|
-
import { areElsCollPerfBottom } from './collision.mjs';
|
|
17
|
-
import { areElsCollPerfLeft } from './collision.mjs';
|
|
18
|
-
import { areElsCollPerfRight } from './collision.mjs';
|
|
19
|
-
import { areElsColliding } from './collision.mjs';
|
|
20
|
-
import { areElsPerfColliding } from './collision.mjs';
|
|
21
|
-
import { getElsColliding } from './collision.mjs';
|
|
22
|
-
import { getElsPerfColliding } from './collision.mjs';
|
|
23
|
-
import { getElsCollOverlap } from './collision.mjs';
|
|
24
|
-
import { getElsCollOverlapPos } from './collision.mjs';
|
|
25
|
-
import { getRectCenter } from './collision.mjs';
|
|
26
|
-
import { getElsRelativeCenterOffset } from './collision.mjs';
|
|
27
|
-
import { getElsCollDirDepth } from './collision.mjs';
|
|
28
|
-
import { getElsCollDetails } from './collision.mjs';
|
|
29
|
-
import { safeTextTrim } from './text.mjs';
|
|
30
|
-
import { installWindowHiddenScript } from './html.mjs';
|
|
31
|
-
import { genFibonacciSeq } from './simpleMath.mjs';
|
|
32
|
-
import { fetchJson } from './html.mjs';
|
|
33
|
-
import { fetchText } from './html.mjs';
|
|
34
|
-
import { readJsonBlob } from './html.mjs';
|
|
35
|
-
import { readFileBlob } from './html.mjs';
|
|
36
|
-
import { readBase64Blob } from './html.mjs';
|
|
37
|
-
import { saveJsonFile } from './html.mjs';
|
|
38
|
-
import { documentIsFullScreen } from './fullScreen.mjs';
|
|
39
|
-
import { isScreenFilled } from './fullScreen.mjs';
|
|
40
|
-
import { requestFullScreen } from './fullScreen.mjs';
|
|
41
|
-
import { exitFullScreen } from './fullScreen.mjs';
|
|
42
|
-
import { isFullScreenMode } from './fullScreen.mjs';
|
|
43
|
-
import { onFullScreenChange } from './fullScreen.mjs';
|
|
44
|
-
import { offFullScreenChange } from './fullScreen.mjs';
|
|
45
|
-
import { isJsonObject } from './objChecker.mjs';
|
|
46
|
-
import { arraySortPositions } from './array.mjs';
|
|
47
|
-
import { formatBytes } from './simpleMath.mjs';
|
|
48
|
-
import { addAiMarkerShortcut } from './text.mjs';
|
|
49
|
-
import { extendObjType } from './objFilter.mjs';
|
|
50
|
-
import { reorderObjTypeOrder } from './objFilter.mjs';
|
|
51
|
-
import { cloneObjTypeOrder } from './objFilter.mjs';
|
|
52
|
-
import { countObj } from './objChecker.mjs';
|
|
53
|
-
import { objType } from './objFilter.mjs';
|
|
54
|
-
import { ruleOfThree } from './simpleMath.mjs';
|
|
55
|
-
import { getSimplePerc } from './simpleMath.mjs';
|
|
56
|
-
import { asyncReplace } from './text.mjs';
|
|
57
|
-
import { getAge } from './simpleMath.mjs';
|
|
58
|
-
import { formatCustomTimer } from './clock.mjs';
|
|
59
|
-
import { formatDayTimer } from './clock.mjs';
|
|
60
|
-
import { formatTimer } from './clock.mjs';
|
|
61
|
-
import { getTimeDuration } from './clock.mjs';
|
|
62
|
-
import { shuffleArray } from './array.mjs';
|
|
63
|
-
import { toTitleCase } from './text.mjs';
|
|
64
|
-
import { toTitleCaseLowerFirst } from './text.mjs';
|
|
65
|
-
export { valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
1
|
+
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
|
+
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration } from './clock.mjs';
|
|
3
|
+
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText } from './html.mjs';
|
|
4
|
+
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
|
|
5
|
+
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
6
|
+
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange } from './fullScreen.mjs';
|
|
7
|
+
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree } from './simpleMath.mjs';
|
|
8
|
+
import { addAiMarkerShortcut, diffStrings, diffObjList, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace } from './text.mjs';
|
|
9
|
+
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails } from './collision.mjs';
|
|
10
|
+
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial } from './mediaContent.mjs';
|
|
11
|
+
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
66
12
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/basics/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { diffArrayList, shuffleArray, arraySortPositions } from './array.mjs';
|
|
1
|
+
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
2
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './clock.mjs';
|
|
3
3
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './html.mjs';
|
|
4
4
|
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './fullScreen.mjs';
|
|
7
7
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './simpleMath.mjs';
|
|
8
|
-
import { addAiMarkerShortcut, diffStrings, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace, } from './text.mjs';
|
|
8
|
+
import { addAiMarkerShortcut, diffStrings, diffObjList, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace, } from './text.mjs';
|
|
9
9
|
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, } from './collision.mjs';
|
|
10
10
|
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial, } from './mediaContent.mjs';
|
|
11
|
-
export { valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
11
|
+
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* A type representing either a static string or a function that returns a string, used to resolve an unknown artist's name.
|
|
4
5
|
* @typedef {string|(() => string)} UnknownArtistGetter
|
|
5
6
|
*/
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Represents the data type for images, which can be raw binary (Uint8Array) or a string (such as a Blob URL or Data URL).
|
|
10
|
+
* @typedef {Uint8Array|string} PictureDataType
|
|
11
|
+
*/
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
14
|
* Represents an image attachment template.
|
|
9
|
-
* @template {
|
|
15
|
+
* @template {PictureDataType} PictureData
|
|
10
16
|
* @typedef {Object} IPictureTemplate
|
|
11
17
|
* @property {string} format - The MIME type of the image (e.g., 'image/jpeg').
|
|
12
18
|
* @property {PictureData} data - The raw binary data of the image.
|
|
@@ -28,7 +34,7 @@
|
|
|
28
34
|
/**
|
|
29
35
|
* This metadata structure is modeled template.
|
|
30
36
|
*
|
|
31
|
-
* @template {IPictureTemplate<
|
|
37
|
+
* @template {IPictureTemplate<PictureDataType>} IPictureContent
|
|
32
38
|
* @typedef {Object} ContentMetadataTemplate
|
|
33
39
|
* @property {string|null} title - The title of the track.
|
|
34
40
|
* @property {string|null} album - The name of the album.
|
|
@@ -49,7 +55,8 @@
|
|
|
49
55
|
* This metadata structure is modeled after the standard output of the
|
|
50
56
|
* `music-metadata@11.13.0` npm package.
|
|
51
57
|
*
|
|
52
|
-
* @
|
|
58
|
+
* @template {PictureDataType} PictureData
|
|
59
|
+
* @typedef {ContentMetadataTemplate<IPictureTemplate<PictureData>>} MediaContentMetadata
|
|
53
60
|
*/
|
|
54
61
|
|
|
55
62
|
/**
|
|
@@ -67,7 +74,8 @@
|
|
|
67
74
|
* The final content object used within the media, combining
|
|
68
75
|
* core playback properties with rich metadata.
|
|
69
76
|
*
|
|
70
|
-
* @
|
|
77
|
+
* @template {PictureDataType} PictureData
|
|
78
|
+
* @typedef {MediaContentBase & MediaContentMetadata<PictureData>} MediaContent
|
|
71
79
|
*/
|
|
72
80
|
|
|
73
81
|
//////////////////////////////////////////////////////////////////
|
|
@@ -76,11 +84,11 @@
|
|
|
76
84
|
* A promise that resolves to an object containing the extracted metadata.
|
|
77
85
|
* @callback ParseMediaContentMetadata
|
|
78
86
|
* @param {Blob} data - The raw file blob.
|
|
79
|
-
* @returns {Promise<{ common: Partial<ContentMetadataTemplate<IPictureTemplate<
|
|
87
|
+
* @returns {Promise<{ common: Partial<ContentMetadataTemplate<IPictureTemplate<PictureDataType>>> }>} A promise resolving to the common metadata properties.
|
|
80
88
|
*/
|
|
81
89
|
|
|
82
90
|
/**
|
|
83
|
-
* @typedef {Object} LoadingMediaProgress
|
|
91
|
+
* @typedef {Object} LoadingMediaProgress Represents the current state of a media loading operation, including its status, execution stage, and the URL being processed.
|
|
84
92
|
* @property {'loading'|'success'} status - The current status of the operation.
|
|
85
93
|
* @property {LoadingProgressStage} stage - The current execution stage.
|
|
86
94
|
* @property {ProgressEvent<EventTarget>} [event] - The current loading event.
|
|
@@ -88,14 +96,17 @@
|
|
|
88
96
|
*/
|
|
89
97
|
|
|
90
98
|
/**
|
|
99
|
+
* Defines the specific execution stages of a successful loading process.
|
|
91
100
|
* @typedef {'INITIALIZING'|'DOWNLOADING'|'METADATA_LOADED'|'EXTRACTING_ID3'|'COMPLETE'} LoadingProgressStage
|
|
92
101
|
*/
|
|
93
102
|
|
|
94
103
|
/**
|
|
104
|
+
* Defines the specific stages where a loading error might occur.
|
|
95
105
|
* @typedef {'INITIALIZING'|'DOWNLOADING'|'METADATA'|'ID3'|'UNKNOWN'} LoadingErrorStage
|
|
96
106
|
*/
|
|
97
107
|
|
|
98
108
|
/**
|
|
109
|
+
* A data structure containing details about a media loading error.
|
|
99
110
|
* @typedef {Object} MediaLoadingErrorData
|
|
100
111
|
* @property {Error} error - The original error object.
|
|
101
112
|
* @property {string} url - The URL that failed.
|
|
@@ -104,10 +115,34 @@
|
|
|
104
115
|
|
|
105
116
|
//////////////////////////////////////////////////////////////////
|
|
106
117
|
|
|
118
|
+
const checkString = (/** @type {string} */ val, /** @type {string} */ name) => {
|
|
119
|
+
if (typeof name !== 'string') throw new TypeError('Expected "name" to be a string.');
|
|
120
|
+
if (typeof val !== 'string')
|
|
121
|
+
throw new TypeError(`Expected "${name}" to be a string, but received ${typeof val}.`);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const checkFunction = (/** @type {Function} */ val, /** @type {string} */ name) => {
|
|
125
|
+
if (typeof name !== 'string') throw new TypeError('Expected "name" to be a string.');
|
|
126
|
+
if (typeof val !== 'function')
|
|
127
|
+
throw new TypeError(`Expected "${name}" to be a function, but received ${typeof val}.`);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const checkObject = (/** @type {Object<string, any> | null} */ val, /** @type {string} */ name) => {
|
|
131
|
+
if (typeof name !== 'string') throw new TypeError('Expected "name" to be a string.');
|
|
132
|
+
if (typeof val !== 'object' || val === null || Array.isArray(val)) {
|
|
133
|
+
throw new TypeError(
|
|
134
|
+
`Expected "${name}" to be a plain object, but received ${val === null ? 'null' : Array.isArray(val) ? 'array' : typeof val}.`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
107
139
|
/** @type {Map<string, number>} */
|
|
108
140
|
const _blobCounter = new Map();
|
|
109
141
|
|
|
110
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Returns a new object initialized with the default values for the core media content properties.
|
|
144
|
+
* @returns {MediaContentBase}
|
|
145
|
+
*/
|
|
111
146
|
const getMediaContentBase = () => ({
|
|
112
147
|
id: '',
|
|
113
148
|
title: '',
|
|
@@ -117,7 +152,10 @@ const getMediaContentBase = () => ({
|
|
|
117
152
|
weight: 1,
|
|
118
153
|
});
|
|
119
154
|
|
|
120
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* Returns a new object initialized with the default values for the media content metadata properties.
|
|
157
|
+
* @returns {MediaContentMetadata<PictureDataType>}
|
|
158
|
+
*/
|
|
121
159
|
const getMediaContentMetadata = () => ({
|
|
122
160
|
title: null,
|
|
123
161
|
album: null,
|
|
@@ -145,6 +183,11 @@ class MediaLoadingError extends Error {
|
|
|
145
183
|
* @param {LoadingErrorStage} stage - The stage where the error occurred.
|
|
146
184
|
*/
|
|
147
185
|
constructor(message, url, stage) {
|
|
186
|
+
checkString(message, 'message');
|
|
187
|
+
checkString(url, 'url');
|
|
188
|
+
if (typeof stage !== 'string')
|
|
189
|
+
throw new TypeError(`Expected "stage" to be a string, but received ${typeof stage}.`);
|
|
190
|
+
|
|
148
191
|
super(message);
|
|
149
192
|
this.name = 'MediaLoadingError';
|
|
150
193
|
this.url = url;
|
|
@@ -159,6 +202,8 @@ class MediaLoadingError extends Error {
|
|
|
159
202
|
* @private
|
|
160
203
|
*/
|
|
161
204
|
const generateSimpleHash = async (str) => {
|
|
205
|
+
checkString(str, 'str');
|
|
206
|
+
|
|
162
207
|
const msgUint8 = new TextEncoder().encode(str);
|
|
163
208
|
const hashBuffer = await crypto.subtle.digest('SHA-1', msgUint8);
|
|
164
209
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
@@ -171,12 +216,18 @@ const generateSimpleHash = async (str) => {
|
|
|
171
216
|
|
|
172
217
|
/**
|
|
173
218
|
* Helper to convert Uint8Array or Base64 string directly into a high performance Blob URL.
|
|
174
|
-
* @param {
|
|
219
|
+
* @param {PictureDataType} data
|
|
175
220
|
* @param {string} format
|
|
176
221
|
* @returns {string} The generated Blob URL or original string if already valid.
|
|
177
|
-
* @private
|
|
178
222
|
*/
|
|
179
223
|
const convertToBlobUrl = (data, format = 'image/jpeg') => {
|
|
224
|
+
if (!(data instanceof Uint8Array) && typeof data !== 'string') {
|
|
225
|
+
throw new TypeError(
|
|
226
|
+
`Expected "data" to be an instance of Uint8Array or a string, but received ${typeof data}.`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
checkString(format, 'format');
|
|
230
|
+
|
|
180
231
|
const createBlobCounter = (/** @type {Blob} */ blob) => {
|
|
181
232
|
const url = URL.createObjectURL(blob);
|
|
182
233
|
const blobUrlUsage = _blobCounter.get(url);
|
|
@@ -205,10 +256,11 @@ const convertToBlobUrl = (data, format = 'image/jpeg') => {
|
|
|
205
256
|
* Asynchronous helper to convert a Blob URL back to Base64 (Date URL) at export time.
|
|
206
257
|
* @param {string} url
|
|
207
258
|
* @returns {Promise<string>}
|
|
208
|
-
* @private
|
|
209
259
|
*/
|
|
210
260
|
const blobUrlToBase64 = async (url) => {
|
|
211
|
-
|
|
261
|
+
checkString(url, 'url');
|
|
262
|
+
|
|
263
|
+
if (!url.startsWith('blob:')) return url;
|
|
212
264
|
try {
|
|
213
265
|
const response = await fetch(url);
|
|
214
266
|
const blob = await response.blob();
|
|
@@ -226,10 +278,12 @@ const blobUrlToBase64 = async (url) => {
|
|
|
226
278
|
|
|
227
279
|
/**
|
|
228
280
|
* Safely revokes Blob URLs to prevent memory leaks from createObjectURL.
|
|
229
|
-
* @
|
|
230
|
-
* @
|
|
281
|
+
* @template {PictureDataType} PictureData
|
|
282
|
+
* @param {MediaContent<PictureData>} content
|
|
231
283
|
*/
|
|
232
284
|
const revokeContentUrls = (content) => {
|
|
285
|
+
checkObject(content, 'content');
|
|
286
|
+
|
|
233
287
|
if (content && Array.isArray(content.picture)) {
|
|
234
288
|
content.picture.forEach((pic) => {
|
|
235
289
|
if (typeof pic.data === 'string' && pic.data.startsWith('blob:')) {
|
|
@@ -248,7 +302,9 @@ const revokeContentUrls = (content) => {
|
|
|
248
302
|
* @param {boolean} isPartial - If true, properties can be undefined.
|
|
249
303
|
*/
|
|
250
304
|
const validateMediaContent = (common, isPartial) => {
|
|
251
|
-
|
|
305
|
+
checkObject(common, 'common');
|
|
306
|
+
if (typeof isPartial !== 'boolean') throw new TypeError('Expected "isPartial" to be a boolean.');
|
|
307
|
+
|
|
252
308
|
const isUndefinedAllowed = (/** @type {any} */ v) => isPartial && typeof v === 'undefined';
|
|
253
309
|
|
|
254
310
|
const isString = (/** @type {string | null | undefined} */ v) =>
|
|
@@ -261,6 +317,7 @@ const validateMediaContent = (common, isPartial) => {
|
|
|
261
317
|
/** @type {string[] | IPictureTemplate<string|Uint8Array>[] | undefined} */ v,
|
|
262
318
|
/** @type {(value: any, index: number, array: any[]) => any} */ valueValidator,
|
|
263
319
|
) => {
|
|
320
|
+
checkFunction(valueValidator, 'valueValidator');
|
|
264
321
|
if (isUndefinedAllowed(v)) return true;
|
|
265
322
|
if (Array.isArray(v) && v.every(valueValidator)) return true;
|
|
266
323
|
return false;
|
|
@@ -293,6 +350,8 @@ const validateMediaContent = (common, isPartial) => {
|
|
|
293
350
|
!isArray(
|
|
294
351
|
common.picture,
|
|
295
352
|
(value) =>
|
|
353
|
+
value &&
|
|
354
|
+
typeof value === 'object' &&
|
|
296
355
|
(typeof value.description === 'undefined' || typeof value.description === 'string') &&
|
|
297
356
|
(typeof value.name === 'undefined' || typeof value.name === 'string') &&
|
|
298
357
|
(typeof value.type === 'undefined' || typeof value.type === 'string') &&
|
|
@@ -304,10 +363,11 @@ const validateMediaContent = (common, isPartial) => {
|
|
|
304
363
|
|
|
305
364
|
/**
|
|
306
365
|
* Validate Nested Objects (Disk and Track)
|
|
366
|
+
* @param {string} name
|
|
307
367
|
* @param {MediaNumber|null} [info]
|
|
308
|
-
* @param {string} [name]
|
|
309
368
|
*/
|
|
310
|
-
const validateTrackInfo = (
|
|
369
|
+
const validateTrackInfo = (name, info) => {
|
|
370
|
+
checkString(name, 'name');
|
|
311
371
|
if (isUndefinedAllowed(info)) return; // Ignores if partial
|
|
312
372
|
|
|
313
373
|
if (info === undefined || info === null) {
|
|
@@ -322,8 +382,8 @@ const validateMediaContent = (common, isPartial) => {
|
|
|
322
382
|
throw new TypeError(`Invalid metadata: "${name}.of" must be a number or null.`);
|
|
323
383
|
};
|
|
324
384
|
|
|
325
|
-
validateTrackInfo(
|
|
326
|
-
validateTrackInfo(
|
|
385
|
+
validateTrackInfo('disk', common.disk);
|
|
386
|
+
validateTrackInfo('track', common.track);
|
|
327
387
|
};
|
|
328
388
|
|
|
329
389
|
/**
|
|
@@ -331,30 +391,34 @@ const validateMediaContent = (common, isPartial) => {
|
|
|
331
391
|
* This ensures that if a property is present, it matches the expected type.
|
|
332
392
|
* @param {ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>} common
|
|
333
393
|
*/
|
|
334
|
-
const valMediaContentMetadata = (common) =>
|
|
394
|
+
const valMediaContentMetadata = (common) => {
|
|
395
|
+
checkObject(common, 'common');
|
|
396
|
+
return validateMediaContent(common, false);
|
|
397
|
+
};
|
|
335
398
|
|
|
336
399
|
/**
|
|
337
400
|
* Helper to validate types within the media content metadata object.
|
|
338
401
|
* Allows the absence of properties (useful for updates/patch).
|
|
339
402
|
* @param {Partial<ContentMetadataTemplate<IPictureTemplate<string | Uint8Array<ArrayBufferLike>>>>} common
|
|
340
403
|
*/
|
|
341
|
-
const valMediaContentMetadataPartial = (common) =>
|
|
404
|
+
const valMediaContentMetadataPartial = (common) => {
|
|
405
|
+
checkObject(common, 'common');
|
|
406
|
+
return validateMediaContent(common, true);
|
|
407
|
+
};
|
|
342
408
|
|
|
343
409
|
/**
|
|
344
410
|
* Downloads an audio file from a URL and extracts its ID3/metadata tags.
|
|
345
411
|
*
|
|
346
412
|
* @param {string} url - The full URL of the audio file to be downloaded.
|
|
347
413
|
* @param {ParseMediaContentMetadata} parseFile - The function used to parse the file data.
|
|
348
|
-
* @returns {Promise<MediaContentMetadata
|
|
414
|
+
* @returns {Promise<MediaContentMetadata<string>>} A promise that resolves to an object containing the extracted metadata.
|
|
349
415
|
* @throws {TypeError} If the provided `url` is not a string or `parseFile` is not a function.
|
|
350
416
|
* @throws {Error} If the network request fails or the parsing process encounters an error.
|
|
351
417
|
*/
|
|
352
418
|
const extractMediaId3Tags = async (url, parseFile) => {
|
|
353
419
|
// Argument Validation
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if (typeof parseFile !== 'function')
|
|
357
|
-
throw new TypeError(`Expected parseFile to be a function, but received ${typeof parseFile}.`);
|
|
420
|
+
checkString(url, 'url');
|
|
421
|
+
checkFunction(parseFile, 'parseFile');
|
|
358
422
|
|
|
359
423
|
try {
|
|
360
424
|
// 1. Download the file from the provided URL
|
|
@@ -407,15 +471,16 @@ const extractMediaId3Tags = async (url, parseFile) => {
|
|
|
407
471
|
* A Static Factory Method that prepares a MediaContent object by
|
|
408
472
|
* extracting metadata from an audio source.
|
|
409
473
|
*
|
|
474
|
+
* @template {PictureDataType} PictureData
|
|
410
475
|
* @param {string | HTMLMediaElement} source - A URL string or an existing Audio object.
|
|
411
|
-
* @param {Partial<MediaContentBase & MediaContentMetadata
|
|
412
|
-
* @param {Partial<MediaContentBase & MediaContentMetadata
|
|
476
|
+
* @param {Partial<MediaContentBase & MediaContentMetadata<PictureData>> & { id?: string; weight?: number }} [defaultMetadata={}] - Optional default metadata that overrides automatic extraction.
|
|
477
|
+
* @param {Partial<MediaContentBase & MediaContentMetadata<PictureData>> & { id?: string; weight?: number }} [metadata={}] - Optional manual metadata that overrides automatic extraction.
|
|
413
478
|
* @param {ParseMediaContentMetadata} [parseFile] - Private helper to interface with parseFile.
|
|
414
479
|
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
415
480
|
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
416
481
|
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
417
482
|
* @param {UnknownArtistGetter} unknownArtist
|
|
418
|
-
* @returns {Promise<MediaContent
|
|
483
|
+
* @returns {Promise<MediaContent<PictureData>>} A promise that resolves to a valid MediaContent object.
|
|
419
484
|
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
420
485
|
*
|
|
421
486
|
* @example
|
|
@@ -449,7 +514,8 @@ const parseMediaMetadata = async (
|
|
|
449
514
|
source,
|
|
450
515
|
defaultMetadata = {},
|
|
451
516
|
metadata = {},
|
|
452
|
-
parseFile = (
|
|
517
|
+
parseFile = (data) => {
|
|
518
|
+
if (!(data instanceof Blob)) throw new TypeError('Expected "data" to be a Blob.');
|
|
453
519
|
return new Promise((resolve, reject) => reject(new TypeError('parseFile library not found.')));
|
|
454
520
|
},
|
|
455
521
|
callbacks = {},
|
|
@@ -459,11 +525,20 @@ const parseMediaMetadata = async (
|
|
|
459
525
|
if (typeof source !== 'string' && !(source instanceof HTMLMediaElement))
|
|
460
526
|
throw new TypeError('Source must be a string or an HTMLMediaElement.');
|
|
461
527
|
|
|
528
|
+
checkObject(defaultMetadata, 'defaultMetadata');
|
|
529
|
+
checkObject(metadata, 'metadata');
|
|
530
|
+
checkFunction(parseFile, 'parseFile');
|
|
531
|
+
checkObject(callbacks, 'callbacks');
|
|
532
|
+
|
|
462
533
|
if (callbacks.onProgress && typeof callbacks.onProgress !== 'function')
|
|
463
534
|
throw new TypeError('callbacks.onProgress must be a function.');
|
|
464
535
|
if (callbacks.onError && typeof callbacks.onError !== 'function')
|
|
465
536
|
throw new TypeError('callbacks.onError must be a function.');
|
|
466
537
|
|
|
538
|
+
if (typeof unknownArtist !== 'string' && typeof unknownArtist !== 'function') {
|
|
539
|
+
throw new TypeError('unknownArtist must be a string or a function returning a string.');
|
|
540
|
+
}
|
|
541
|
+
|
|
467
542
|
/** @type {HTMLMediaElement} */
|
|
468
543
|
let audio;
|
|
469
544
|
/** @type {string} */
|
|
@@ -474,6 +549,11 @@ const parseMediaMetadata = async (
|
|
|
474
549
|
* @param {ProgressEvent<EventTarget>} [event]
|
|
475
550
|
*/
|
|
476
551
|
const notifyProgress = (stage, event) => {
|
|
552
|
+
checkString(stage, 'stage');
|
|
553
|
+
if (event !== undefined && !(event instanceof Event)) {
|
|
554
|
+
throw new TypeError('Expected "event" to be an Event or undefined.');
|
|
555
|
+
}
|
|
556
|
+
|
|
477
557
|
if (callbacks.onProgress) {
|
|
478
558
|
callbacks.onProgress({
|
|
479
559
|
event,
|
|
@@ -485,6 +565,9 @@ const parseMediaMetadata = async (
|
|
|
485
565
|
};
|
|
486
566
|
|
|
487
567
|
const notifyError = (/** @type {Error} */ error, /** @type {LoadingErrorStage} */ stage) => {
|
|
568
|
+
if (!(error instanceof Error)) throw new TypeError('Expected "error" to be an Error.');
|
|
569
|
+
checkString(stage, 'stage'); // Adicionado
|
|
570
|
+
|
|
488
571
|
if (callbacks.onError) {
|
|
489
572
|
callbacks.onError({
|
|
490
573
|
error,
|
|
@@ -561,7 +644,7 @@ const parseMediaMetadata = async (
|
|
|
561
644
|
};
|
|
562
645
|
|
|
563
646
|
// 4. Automatic Metadata Extraction (ID3 Tags)
|
|
564
|
-
/** @type {Partial<MediaContentMetadata
|
|
647
|
+
/** @type {Partial<MediaContentMetadata<string>>} */
|
|
565
648
|
let extractedMetadata = {};
|
|
566
649
|
notifyProgress('EXTRACTING_ID3');
|
|
567
650
|
try {
|
|
@@ -579,6 +662,7 @@ const parseMediaMetadata = async (
|
|
|
579
662
|
* @returns {string}
|
|
580
663
|
*/
|
|
581
664
|
const getFallbackTitleFromUrl = (url) => {
|
|
665
|
+
checkString(url, 'url');
|
|
582
666
|
try {
|
|
583
667
|
// Remove query params or hashes, get the last segment, and strip extension
|
|
584
668
|
const filename = url.split(/[?#]/)[0].split('/').pop();
|
|
@@ -612,7 +696,7 @@ const parseMediaMetadata = async (
|
|
|
612
696
|
});
|
|
613
697
|
}
|
|
614
698
|
|
|
615
|
-
return /** @type {MediaContent} */ (finalContent);
|
|
699
|
+
return /** @type {MediaContent<PictureData>} */ (finalContent);
|
|
616
700
|
} catch (err) {
|
|
617
701
|
// If it's already a MediaLoadingError, re-throw it.
|
|
618
702
|
// Otherwise, wrap it.
|