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.
Files changed (323) hide show
  1. package/changelog/1/28/1.md +23 -0
  2. package/changelog/1/28/2.md +43 -0
  3. package/dist/_/numbers.d.mts +91 -16
  4. package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
  5. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  6. package/dist/v1/TinyAnalogClock.min.js +1 -1
  7. package/dist/v1/TinyBasicsEs.min.js +1 -1
  8. package/dist/v1/TinyDayNightCycle.min.js +1 -1
  9. package/dist/v1/TinyDragDropDetector.min.js +1 -1
  10. package/dist/v1/TinyDragger.min.js +1 -1
  11. package/dist/v1/TinyElementObserver.min.js +1 -1
  12. package/dist/v1/TinyEssentials.min.js +1 -1
  13. package/dist/v1/TinyGamepad.min.js +1 -1
  14. package/dist/v1/TinyHtml.min.js +1 -1
  15. package/dist/v1/TinyI18.min.js +1 -1
  16. package/dist/v1/TinyIframeEvents.min.js +1 -1
  17. package/dist/v1/TinyLocalStorage.min.js +1 -1
  18. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  19. package/dist/v1/TinyNewWinEvents.min.js +1 -1
  20. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  21. package/dist/v1/TinyRadioFm.min.js +1 -1
  22. package/dist/v1/TinyRateLimiter.min.js +1 -1
  23. package/dist/v1/TinySmartScroller.min.js +1 -1
  24. package/dist/v1/TinyTextDiffer.min.js +1 -1
  25. package/dist/v1/TinyTextarea.min.js +1 -1
  26. package/dist/v1/TinyTimeout.min.js +1 -1
  27. package/dist/v1/TinyToastNotify.min.js +1 -1
  28. package/dist/v1/TinyUploadClicker.min.js +1 -1
  29. package/dist/v1/UltraRandomMsgGen.min.js +1 -1
  30. package/dist/v1/basics/array.cjs +57 -9
  31. package/dist/v1/basics/array.d.mts +28 -12
  32. package/dist/v1/basics/array.mjs +51 -9
  33. package/dist/v1/basics/clock.cjs +94 -42
  34. package/dist/v1/basics/clock.d.mts +22 -22
  35. package/dist/v1/basics/clock.mjs +91 -54
  36. package/dist/v1/basics/collision.d.mts +245 -104
  37. package/dist/v1/basics/deprecated/html.cjs +246 -0
  38. package/dist/v1/basics/deprecated/html.d.mts +63 -0
  39. package/dist/v1/basics/deprecated/html.mjs +190 -0
  40. package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
  41. package/dist/v1/basics/fullScreen.d.mts +47 -7
  42. package/dist/v1/basics/html.cjs +149 -130
  43. package/dist/v1/basics/html.d.mts +69 -113
  44. package/dist/v1/basics/html.mjs +113 -105
  45. package/dist/v1/basics/index.cjs +2 -0
  46. package/dist/v1/basics/index.d.mts +11 -65
  47. package/dist/v1/basics/index.mjs +3 -3
  48. package/dist/v1/basics/mediaContent.cjs +116 -32
  49. package/dist/v1/basics/mediaContent.d.mts +143 -159
  50. package/dist/v1/basics/mediaContent.mjs +105 -33
  51. package/dist/v1/basics/objChecker.cjs +7 -5
  52. package/dist/v1/basics/objChecker.d.mts +5 -4
  53. package/dist/v1/basics/objChecker.mjs +6 -6
  54. package/dist/v1/basics/objFilter.cjs +71 -14
  55. package/dist/v1/basics/objFilter.d.mts +16 -19
  56. package/dist/v1/basics/objFilter.mjs +63 -14
  57. package/dist/v1/basics/simpleMath.cjs +81 -25
  58. package/dist/v1/basics/simpleMath.d.mts +22 -22
  59. package/dist/v1/basics/simpleMath.mjs +70 -27
  60. package/dist/v1/basics/text.cjs +76 -31
  61. package/dist/v1/basics/text.d.mts +64 -14
  62. package/dist/v1/basics/text.mjs +62 -31
  63. package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
  64. package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
  65. package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
  66. package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
  67. package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
  68. package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
  69. package/dist/v1/build/TinyClassManager.d.mts +1 -1
  70. package/dist/v1/build/TinyClipboard.d.mts +1 -1
  71. package/dist/v1/build/TinyColorConverter.d.mts +1 -1
  72. package/dist/v1/build/TinyColorValidator.d.mts +1 -1
  73. package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
  74. package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
  75. package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
  76. package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
  77. package/dist/v1/build/TinyDragger.d.mts +1 -1
  78. package/dist/v1/build/TinyElementObserver.d.mts +1 -1
  79. package/dist/v1/build/TinyGamepad.d.mts +1 -1
  80. package/dist/v1/build/TinyHtml.d.mts +1 -1
  81. package/dist/v1/build/TinyI18.d.mts +1 -1
  82. package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
  83. package/dist/v1/build/TinyInventory.d.mts +1 -1
  84. package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
  85. package/dist/v1/build/TinyLevelUp.d.mts +1 -1
  86. package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
  87. package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
  88. package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
  89. package/dist/v1/build/TinyNeedBar.d.mts +1 -1
  90. package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
  91. package/dist/v1/build/TinyNotifications.d.mts +1 -1
  92. package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
  93. package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
  94. package/dist/v1/build/TinyRadioFm.d.mts +1 -1
  95. package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
  96. package/dist/v1/build/TinySimpleDice.d.mts +1 -1
  97. package/dist/v1/build/TinySmartScroller.d.mts +1 -1
  98. package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
  99. package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
  100. package/dist/v1/build/TinyTextarea.d.mts +1 -1
  101. package/dist/v1/build/TinyTimeout.d.mts +1 -1
  102. package/dist/v1/build/TinyToastNotify.d.mts +1 -1
  103. package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
  104. package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
  105. package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
  106. package/dist/v1/fileManager/index.d.mts +3 -29
  107. package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
  108. package/dist/v1/index.cjs +4 -0
  109. package/dist/v1/index.d.mts +54 -137
  110. package/dist/v1/index.mjs +4 -3
  111. package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
  112. package/dist/v1/libs/TinyAdvancedRaffle.cjs +64 -50
  113. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +64 -116
  114. package/dist/v1/libs/TinyAdvancedRaffle.mjs +62 -49
  115. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
  116. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +15 -19
  117. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
  118. package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
  119. package/dist/v1/libs/TinyAnalogClock.d.mts +12 -9
  120. package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
  121. package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
  122. package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
  123. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
  124. package/dist/v1/libs/TinyClassManager.cjs +5 -7
  125. package/dist/v1/libs/TinyClassManager.d.mts +16 -16
  126. package/dist/v1/libs/TinyClassManager.mjs +5 -6
  127. package/dist/v1/libs/TinyClipboard.cjs +2 -0
  128. package/dist/v1/libs/TinyClipboard.d.mts +12 -5
  129. package/dist/v1/libs/TinyClipboard.mjs +2 -0
  130. package/dist/v1/libs/TinyColorConverter.cjs +1 -0
  131. package/dist/v1/libs/TinyColorConverter.d.mts +10 -32
  132. package/dist/v1/libs/TinyColorConverter.mjs +1 -0
  133. package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
  134. package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
  135. package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
  136. package/dist/v1/libs/TinyDayNightCycle.d.mts +87 -117
  137. package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
  138. package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
  139. package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
  140. package/dist/v1/libs/TinyDragDropDetector.d.mts +32 -26
  141. package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
  142. package/dist/v1/libs/TinyDragger.cjs +46 -19
  143. package/dist/v1/libs/TinyDragger.d.mts +82 -81
  144. package/dist/v1/libs/TinyDragger.mjs +45 -18
  145. package/dist/v1/libs/TinyElementObserver.cjs +39 -0
  146. package/dist/v1/libs/TinyElementObserver.d.mts +28 -25
  147. package/dist/v1/libs/TinyElementObserver.mjs +36 -0
  148. package/dist/v1/libs/TinyGamepad.cjs +131 -2
  149. package/dist/v1/libs/TinyGamepad.d.mts +50 -122
  150. package/dist/v1/libs/TinyGamepad.mjs +129 -2
  151. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
  152. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
  153. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
  154. package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
  155. package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
  156. package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
  157. package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
  158. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
  159. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
  160. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
  161. package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
  162. package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
  163. package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
  164. package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
  165. package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
  166. package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
  167. package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
  168. package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
  169. package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
  170. package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
  171. package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
  172. package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
  173. package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
  174. package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
  175. package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
  176. package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
  177. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
  178. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
  179. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
  180. package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
  181. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
  182. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
  183. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
  184. package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
  185. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
  186. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
  187. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
  188. package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
  189. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
  190. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
  191. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
  192. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
  193. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
  194. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
  195. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
  196. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
  197. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
  198. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
  199. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
  200. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
  201. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
  202. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
  203. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
  204. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
  205. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
  206. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
  207. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
  208. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
  209. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
  210. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
  211. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
  212. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
  213. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
  214. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
  215. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
  216. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
  217. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
  218. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
  219. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
  220. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
  221. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
  222. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
  223. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
  224. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
  225. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
  226. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
  227. package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
  228. package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
  229. package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
  230. package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
  231. package/dist/v1/libs/TinyHtml.cjs +4 -5
  232. package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
  233. package/dist/v1/libs/TinyHtml.mjs +5 -6
  234. package/dist/v1/libs/TinyI18.cjs +61 -0
  235. package/dist/v1/libs/TinyI18.d.mts +34 -58
  236. package/dist/v1/libs/TinyI18.mjs +55 -0
  237. package/dist/v1/libs/TinyIframeEvents.cjs +19 -2
  238. package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
  239. package/dist/v1/libs/TinyIframeEvents.mjs +19 -2
  240. package/dist/v1/libs/TinyInventory.d.mts +78 -141
  241. package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
  242. package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
  243. package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
  244. package/dist/v1/libs/TinyLocalStorage.cjs +48 -0
  245. package/dist/v1/libs/TinyLocalStorage.d.mts +11 -30
  246. package/dist/v1/libs/TinyLocalStorage.mjs +45 -0
  247. package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
  248. package/dist/v1/libs/TinyMediaPlayer.cjs +77 -3
  249. package/dist/v1/libs/TinyMediaPlayer.d.mts +109 -106
  250. package/dist/v1/libs/TinyMediaPlayer.mjs +71 -3
  251. package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
  252. package/dist/v1/libs/TinyNewWinEvents.cjs +29 -0
  253. package/dist/v1/libs/TinyNewWinEvents.d.mts +32 -29
  254. package/dist/v1/libs/TinyNewWinEvents.mjs +26 -0
  255. package/dist/v1/libs/TinyNotifications.d.mts +6 -6
  256. package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
  257. package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -15
  258. package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
  259. package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
  260. package/dist/v1/libs/TinyRadioFm.cjs +70 -12
  261. package/dist/v1/libs/TinyRadioFm.d.mts +45 -80
  262. package/dist/v1/libs/TinyRadioFm.mjs +64 -12
  263. package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
  264. package/dist/v1/libs/TinyRateLimiter.d.mts +29 -36
  265. package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
  266. package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
  267. package/dist/v1/libs/TinySmartScroller.cjs +52 -3
  268. package/dist/v1/libs/TinySmartScroller.d.mts +62 -70
  269. package/dist/v1/libs/TinySmartScroller.mjs +51 -5
  270. package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
  271. package/dist/v1/libs/TinyTextDiffer.d.mts +11 -13
  272. package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
  273. package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
  274. package/dist/v1/libs/TinyTextarea.cjs +19 -0
  275. package/dist/v1/libs/TinyTextarea.d.mts +34 -28
  276. package/dist/v1/libs/TinyTextarea.mjs +17 -0
  277. package/dist/v1/libs/TinyTimeout.cjs +11 -1
  278. package/dist/v1/libs/TinyTimeout.d.mts +14 -14
  279. package/dist/v1/libs/TinyTimeout.mjs +9 -1
  280. package/dist/v1/libs/TinyToastNotify.cjs +36 -1
  281. package/dist/v1/libs/TinyToastNotify.d.mts +15 -17
  282. package/dist/v1/libs/TinyToastNotify.mjs +32 -1
  283. package/dist/v1/libs/TinyUploadClicker.cjs +19 -0
  284. package/dist/v1/libs/TinyUploadClicker.d.mts +38 -8
  285. package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
  286. package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
  287. package/dist/v1/libs/UltraRandomMsgGen.d.mts +52 -78
  288. package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
  289. package/dist/v1/libs/utils.cjs +21 -0
  290. package/dist/v1/libs/utils.d.mts +6 -0
  291. package/dist/v1/libs/utils.mjs +16 -0
  292. package/docs/v1/README.md +1 -0
  293. package/docs/v1/basics/array.md +2 -2
  294. package/docs/v1/basics/deprecated/html.md +17 -0
  295. package/docs/v1/basics/fullScreen.md +1 -1
  296. package/docs/v1/basics/html.md +12 -26
  297. package/docs/v1/basics/mediaContent.md +1 -1
  298. package/docs/v1/basics/objChecker.md +1 -1
  299. package/docs/v1/basics/text.md +2 -2
  300. package/docs/v1/fileManager/main.md +1 -1
  301. package/docs/v1/libs/ColorSafeStringify.md +1 -1
  302. package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
  303. package/docs/v1/libs/TinyAnalogClock.md +1 -1
  304. package/docs/v1/libs/TinyArrayComparator.md +1 -1
  305. package/docs/v1/libs/TinyArrayPaginator.md +1 -1
  306. package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
  307. package/docs/v1/libs/TinyClassManager.md +1 -1
  308. package/docs/v1/libs/TinyClipboard.md +1 -1
  309. package/docs/v1/libs/TinyCookieConsent.md +1 -1
  310. package/docs/v1/libs/TinyDomReadyManager.md +1 -1
  311. package/docs/v1/libs/TinyDragDropDetector.md +1 -1
  312. package/docs/v1/libs/TinyDragger.md +1 -1
  313. package/docs/v1/libs/TinyElementObserver.md +1 -1
  314. package/docs/v1/libs/TinyHtml.md +1 -1
  315. package/docs/v1/libs/TinyIframeEvents.md +2 -2
  316. package/docs/v1/libs/TinyLevelUp.md +1 -1
  317. package/docs/v1/libs/TinyLoadingScreen.md +1 -1
  318. package/docs/v1/libs/TinyNewWinEvents.md +2 -2
  319. package/docs/v1/libs/TinyNotifications.md +1 -1
  320. package/docs/v1/libs/TinyPromiseQueue.md +2 -2
  321. package/docs/v1/libs/TinyTextDiffer.md +1 -1
  322. package/docs/v1/libs/TinyTextarea.md +1 -1
  323. package/package.json +11 -2
@@ -1,15 +1,19 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { getMediaContentBase, getMediaContentMetadata, parseMediaMetadata, valMediaContentMetadata, } from '../basics/mediaContent.mjs';
3
+ import { createCheckDestroyed } from './utils.mjs';
4
+ const checkDestroy = createCheckDestroyed('TinyMediaPlayer');
3
5
  /**
4
- * @typedef {import('../basics/mediaContent.mjs').MediaContent} MediaContent
6
+ * @typedef {import('../basics/mediaContent.mjs').PictureDataType} PictureDataType
7
+ * @typedef {import('../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
5
8
  * @typedef {import('../basics/mediaContent.mjs').MediaContentBase} MediaContentBase
6
- * @typedef {import('../basics/mediaContent.mjs').MediaContentMetadata} MediaContentMetadata
9
+ * @typedef {import('../basics/mediaContent.mjs').MediaContentMetadata<PictureDataType>} MediaContentMetadata
7
10
  * @typedef {import('../basics/mediaContent.mjs').ParseMediaContentMetadata} ParseMediaContentMetadata
8
11
  * @typedef {import('../basics/mediaContent.mjs').LoadingMediaProgress} LoadingMediaProgress
9
12
  * @typedef {import('../basics/mediaContent.mjs').MediaLoadingErrorData} MediaLoadingErrorData
10
13
  * @typedef {import('../basics/mediaContent.mjs').UnknownArtistGetter} UnknownArtistGetter
11
14
  */
12
15
  /**
16
+ * The loop configuration modes.
13
17
  * @typedef {'NONE' | 'TRACK' | 'PLAYLIST'} LoopModeType
14
18
  */
15
19
  /**
@@ -133,6 +137,11 @@ class TinyMediaPlayer extends EventEmitter {
133
137
  static async parseContent(source, defaultMetadata, metadata, parseFile, callbacks) {
134
138
  return parseMediaMetadata(source, defaultMetadata, metadata, parseFile, callbacks, TinyMediaPlayer.#unknownArtist);
135
139
  }
140
+ /** @type {boolean} */
141
+ #destroyed = false;
142
+ get destroyed() {
143
+ return this.#destroyed;
144
+ }
136
145
  /** @type {Map<string, BaseMediaAdapter>} */
137
146
  #adapters = new Map();
138
147
  /** @type {MediaContent[]} */
@@ -244,6 +253,7 @@ class TinyMediaPlayer extends EventEmitter {
244
253
  // ==========================================
245
254
  /** @returns {MediaContent[]} A shallow copy of the current playlist. */
246
255
  get playlist() {
256
+ checkDestroy(this.#destroyed);
247
257
  return [...this.#playlist];
248
258
  }
249
259
  /**
@@ -251,6 +261,7 @@ class TinyMediaPlayer extends EventEmitter {
251
261
  * @throws {TypeError} If the value is not an array.
252
262
  */
253
263
  set playlist(value) {
264
+ checkDestroy(this.#destroyed);
254
265
  if (!Array.isArray(value)) {
255
266
  throw new TypeError('Playlist must be an array of MediaContent objects.');
256
267
  }
@@ -296,6 +307,7 @@ class TinyMediaPlayer extends EventEmitter {
296
307
  }
297
308
  /** @returns {number} The current active index in the playlist. */
298
309
  get currentIndex() {
310
+ checkDestroy(this.#destroyed);
299
311
  return this.#currentIndex;
300
312
  }
301
313
  /**
@@ -304,6 +316,7 @@ class TinyMediaPlayer extends EventEmitter {
304
316
  * @throws {RangeError} If the index is out of the playlist bounds (unless -1 for empty).
305
317
  */
306
318
  set currentIndex(value) {
319
+ checkDestroy(this.#destroyed);
307
320
  if (typeof value !== 'number') {
308
321
  throw new TypeError('Current index must be a number.');
309
322
  }
@@ -341,6 +354,7 @@ class TinyMediaPlayer extends EventEmitter {
341
354
  }
342
355
  /** @returns {LoopModeType} The current loop configuration. */
343
356
  get loopMode() {
357
+ checkDestroy(this.#destroyed);
344
358
  return this.#loopMode;
345
359
  }
346
360
  /**
@@ -348,6 +362,7 @@ class TinyMediaPlayer extends EventEmitter {
348
362
  * @throws {TypeError} If the value is not a valid LoopModeType.
349
363
  */
350
364
  set loopMode(value) {
365
+ checkDestroy(this.#destroyed);
351
366
  const validModes = ['NONE', 'TRACK', 'PLAYLIST'];
352
367
  if (!validModes.includes(value)) {
353
368
  throw new TypeError(`Loop mode must be one of: ${validModes.join(', ')}.`);
@@ -357,6 +372,7 @@ class TinyMediaPlayer extends EventEmitter {
357
372
  }
358
373
  /** @returns {boolean} The current random mode status. */
359
374
  get isRandom() {
375
+ checkDestroy(this.#destroyed);
360
376
  return this.#isRandom;
361
377
  }
362
378
  /**
@@ -364,6 +380,7 @@ class TinyMediaPlayer extends EventEmitter {
364
380
  * @throws {TypeError} If the value is not a boolean.
365
381
  */
366
382
  set isRandom(value) {
383
+ checkDestroy(this.#destroyed);
367
384
  if (typeof value !== 'boolean') {
368
385
  throw new TypeError('Random mode state must be a boolean.');
369
386
  }
@@ -372,10 +389,12 @@ class TinyMediaPlayer extends EventEmitter {
372
389
  }
373
390
  /** @returns {boolean} True if media is actively playing. */
374
391
  get isPlaying() {
392
+ checkDestroy(this.#destroyed);
375
393
  return this.#isPlaying;
376
394
  }
377
395
  /** @returns {number} The current volume level (0.0 to 1.0). */
378
396
  get volume() {
397
+ checkDestroy(this.#destroyed);
379
398
  return this.#volume;
380
399
  }
381
400
  /**
@@ -384,6 +403,7 @@ class TinyMediaPlayer extends EventEmitter {
384
403
  * @throws {RangeError} If the value is outside the 0.0 to 1.0 range.
385
404
  */
386
405
  set volume(value) {
406
+ checkDestroy(this.#destroyed);
387
407
  if (typeof value !== 'number')
388
408
  throw new TypeError('Volume must be a number.');
389
409
  if (value < 0 || value > 1)
@@ -405,6 +425,7 @@ class TinyMediaPlayer extends EventEmitter {
405
425
  }
406
426
  /** @returns {boolean} Whether the volume cache is currently enabled. */
407
427
  get persistVolume() {
428
+ checkDestroy(this.#destroyed);
408
429
  return this.#persistVolume;
409
430
  }
410
431
  /**
@@ -412,6 +433,7 @@ class TinyMediaPlayer extends EventEmitter {
412
433
  * @throws {TypeError} If the value is not a boolean.
413
434
  */
414
435
  set persistVolume(value) {
436
+ checkDestroy(this.#destroyed);
415
437
  if (typeof value !== 'boolean') {
416
438
  throw new TypeError('Persist volume parameter must be a boolean.');
417
439
  }
@@ -422,6 +444,7 @@ class TinyMediaPlayer extends EventEmitter {
422
444
  }
423
445
  /** @returns {string} The localStorage key used for volume caching. */
424
446
  get volumeStorageKey() {
447
+ checkDestroy(this.#destroyed);
425
448
  return this.#volumeStorageKey;
426
449
  }
427
450
  /**
@@ -429,6 +452,7 @@ class TinyMediaPlayer extends EventEmitter {
429
452
  * @throws {TypeError} If the value is not a string or is empty.
430
453
  */
431
454
  set volumeStorageKey(value) {
455
+ checkDestroy(this.#destroyed);
432
456
  if (typeof value !== 'string') {
433
457
  throw new TypeError('Volume storage key must be a string.');
434
458
  }
@@ -458,6 +482,7 @@ class TinyMediaPlayer extends EventEmitter {
458
482
  * @throws {TypeError} If id is not a string or adapter is invalid.
459
483
  */
460
484
  registerAdapter(id, adapter) {
485
+ checkDestroy(this.#destroyed);
461
486
  if (typeof id !== 'string') {
462
487
  throw new TypeError('Adapter ID must be a string.');
463
488
  }
@@ -492,6 +517,7 @@ class TinyMediaPlayer extends EventEmitter {
492
517
  * @throws {TypeError} If content is invalid or missing required base properties.
493
518
  */
494
519
  addTrack(content) {
520
+ checkDestroy(this.#destroyed);
495
521
  if (!content || typeof content !== 'object' || typeof content.url !== 'string')
496
522
  throw new TypeError('Track content must be a valid MediaContent object containing a URL.');
497
523
  /** @type {MediaContent} */
@@ -512,6 +538,7 @@ class TinyMediaPlayer extends EventEmitter {
512
538
  * @throws {TypeError} If the index is not a number.
513
539
  */
514
540
  existsTrack(index) {
541
+ checkDestroy(this.#destroyed);
515
542
  if (typeof index !== 'number') {
516
543
  throw new TypeError('Index must be a number.');
517
544
  }
@@ -525,6 +552,7 @@ class TinyMediaPlayer extends EventEmitter {
525
552
  * @throws {RangeError} If the index is out of bounds.
526
553
  */
527
554
  getTrack(index) {
555
+ checkDestroy(this.#destroyed);
528
556
  if (typeof index !== 'number') {
529
557
  throw new TypeError('Index must be a number.');
530
558
  }
@@ -541,6 +569,7 @@ class TinyMediaPlayer extends EventEmitter {
541
569
  * @throws {RangeError} If the index is out of bounds.
542
570
  */
543
571
  async removeTrack(index) {
572
+ checkDestroy(this.#destroyed);
544
573
  if (typeof index !== 'number') {
545
574
  throw new TypeError('Index must be a number.');
546
575
  }
@@ -573,11 +602,12 @@ class TinyMediaPlayer extends EventEmitter {
573
602
  }
574
603
  /**
575
604
  * Searches the playlist for tracks matching a string query or a custom evaluation function.
576
- * @param {string | function(MediaContent): boolean} query - The search string (checked against title, artist, album) or a callback returning a boolean.
605
+ * @param {string | ((content: MediaContent) => boolean)} query - The search string (checked against title, artist, album) or a callback returning a boolean.
577
606
  * @returns {SearchResult[]} An array containing the matched tracks and their corresponding indices.
578
607
  * @throws {TypeError} If the query is neither a string nor a function.
579
608
  */
580
609
  searchTrack(query) {
610
+ checkDestroy(this.#destroyed);
581
611
  if (typeof query !== 'string' && typeof query !== 'function') {
582
612
  throw new TypeError('Search query must be a string or a boolean evaluation function.');
583
613
  }
@@ -605,6 +635,7 @@ class TinyMediaPlayer extends EventEmitter {
605
635
  * Clears the entire playlist and stops playback.
606
636
  */
607
637
  async clearPlaylist() {
638
+ checkDestroy(this.#destroyed);
608
639
  await this.stop();
609
640
  this.#playlist = [];
610
641
  this.#currentIndex = -1;
@@ -619,6 +650,7 @@ class TinyMediaPlayer extends EventEmitter {
619
650
  * @returns {Promise<void>}
620
651
  */
621
652
  async play() {
653
+ checkDestroy(this.#destroyed);
622
654
  const adapter = this.#getActiveAdapter();
623
655
  if (!adapter)
624
656
  return;
@@ -633,6 +665,7 @@ class TinyMediaPlayer extends EventEmitter {
633
665
  * @returns {Promise<void>}
634
666
  */
635
667
  async pause() {
668
+ checkDestroy(this.#destroyed);
636
669
  const adapter = this.#getActiveAdapter();
637
670
  if (!adapter)
638
671
  return;
@@ -645,6 +678,7 @@ class TinyMediaPlayer extends EventEmitter {
645
678
  * @returns {Promise<void>}
646
679
  */
647
680
  async stop() {
681
+ checkDestroy(this.#destroyed);
648
682
  const adapter = this.#getActiveAdapter();
649
683
  if (!adapter)
650
684
  return;
@@ -657,6 +691,7 @@ class TinyMediaPlayer extends EventEmitter {
657
691
  * @returns {Promise<void>}
658
692
  */
659
693
  async next() {
694
+ checkDestroy(this.#destroyed);
660
695
  if (this.#playlist.length === 0)
661
696
  return;
662
697
  await this.stop();
@@ -689,6 +724,7 @@ class TinyMediaPlayer extends EventEmitter {
689
724
  * @returns {Promise<void>}
690
725
  */
691
726
  async prev() {
727
+ checkDestroy(this.#destroyed);
692
728
  if (this.#playlist.length === 0)
693
729
  return;
694
730
  await this.stop();
@@ -719,6 +755,7 @@ class TinyMediaPlayer extends EventEmitter {
719
755
  * @returns {Promise<void>}
720
756
  */
721
757
  async seek(timeMs) {
758
+ checkDestroy(this.#destroyed);
722
759
  if (typeof timeMs !== 'number') {
723
760
  throw new TypeError('Seek time must be a number in milliseconds.');
724
761
  }
@@ -738,6 +775,7 @@ class TinyMediaPlayer extends EventEmitter {
738
775
  * @returns {Promise<void>}
739
776
  */
740
777
  async step(stepMs) {
778
+ checkDestroy(this.#destroyed);
741
779
  if (typeof stepMs !== 'number') {
742
780
  throw new TypeError('Step amount must be a number in milliseconds.');
743
781
  }
@@ -751,5 +789,35 @@ class TinyMediaPlayer extends EventEmitter {
751
789
  targetTime = 0;
752
790
  await this.seek(targetTime);
753
791
  }
792
+ /**
793
+ * Safely destroys the TinyMediaPlayer instance.
794
+ * This method stops active playback, clears the internal playlist,
795
+ * removes all registered media adapters, and detaches all event listeners
796
+ * to ensure proper garbage collection and prevent memory leaks.
797
+ *
798
+ * @returns {Promise<void>} A promise that resolves when the destruction sequence is complete.
799
+ */
800
+ async destroy() {
801
+ if (this.#destroyed)
802
+ return;
803
+ // 1. Stop current playback if active to halt media processes
804
+ try {
805
+ if (this.#isPlaying) {
806
+ await this.stop();
807
+ }
808
+ }
809
+ catch (error) {
810
+ console.warn('[TinyMediaPlayer] Non-fatal error during playback termination:', error);
811
+ }
812
+ // 2. Clear internal state variables
813
+ this.#playlist = [];
814
+ this.#currentIndex = -1;
815
+ this.#isPlaying = false;
816
+ // 3. Clear all registered API adapters
817
+ this.#adapters.clear();
818
+ // 4. Remove all event listeners inherited from EventEmitter
819
+ this.removeAllListeners();
820
+ this.#destroyed = true;
821
+ }
754
822
  }
755
823
  export default TinyMediaPlayer;
@@ -1,4 +1,12 @@
1
- export default TinyNeedBar;
1
+ /**
2
+ * @typedef {Object} TickResult
3
+ * @property {number} prevValue - Infinite value before applying decay.
4
+ * @property {number} removedTotal - Total amount removed this tick.
5
+ * @property {number} removedPercent - Percentage of max removed this tick.
6
+ * @property {number} currentPercent - Current percentage relative to max.
7
+ * @property {number} remainingValue - Current clamped value (≥ 0).
8
+ * @property {number} infiniteRemaining - Current infinite value (can be negative).
9
+ */
2
10
  export type TickResult = {
3
11
  /**
4
12
  * - Infinite value before applying decay.
@@ -25,12 +33,6 @@ export type TickResult = {
25
33
  */
26
34
  infiniteRemaining: number;
27
35
  };
28
- /**
29
- * Represents a decay factor applied to the need bar.
30
- *
31
- * - `amount`: base value reduced per tick.
32
- * - `multiplier`: multiplier applied to the amount.
33
- */
34
36
  export type BarFactor = {
35
37
  /**
36
38
  * - Base reduction value per tick.
@@ -41,12 +43,6 @@ export type BarFactor = {
41
43
  */
42
44
  multiplier: number;
43
45
  };
44
- /**
45
- * Represents the serialized state of a TinyNeedBar instance.
46
- *
47
- * This object is typically produced by {@link TinyNeedBar#toJSON} and
48
- * can be used to recreate an instance via {@link TinyNeedBar.fromJSON}.
49
- */
50
46
  export type SerializedData = {
51
47
  /**
52
48
  * - Maximum value of the bar at the moment of serialization.
@@ -65,15 +61,6 @@ export type SerializedData = {
65
61
  */
66
62
  factors: Record<string, BarFactor>;
67
63
  };
68
- /**
69
- * @typedef {Object} TickResult
70
- * @property {number} prevValue - Infinite value before applying decay.
71
- * @property {number} removedTotal - Total amount removed this tick.
72
- * @property {number} removedPercent - Percentage of max removed this tick.
73
- * @property {number} currentPercent - Current percentage relative to max.
74
- * @property {number} remainingValue - Current clamped value (≥ 0).
75
- * @property {number} infiniteRemaining - Current infinite value (can be negative).
76
- */
77
64
  /**
78
65
  * Represents a decay factor applied to the need bar.
79
66
  *
@@ -108,20 +95,7 @@ export type SerializedData = {
108
95
  * - `infiniteValue` → can decrease infinitely into negative numbers.
109
96
  */
110
97
  declare class TinyNeedBar {
111
- /**
112
- * Restores a need bar from a serialized object.
113
- * @param {SerializedData} data
114
- * @returns {TinyNeedBar}
115
- */
116
- static fromJSON(data: SerializedData): TinyNeedBar;
117
- /**
118
- * Creates a new need bar instance.
119
- *
120
- * @param {number} [maxValue=100] - Maximum value of the bar.
121
- * @param {number} [baseDecay=1] - Base amount reduced each tick.
122
- * @param {number} [baseDecayMulti=1] - Multiplier applied to the base decay.
123
- */
124
- constructor(maxValue?: number, baseDecay?: number, baseDecayMulti?: number);
98
+ #private;
125
99
  /**
126
100
  * Returns a snapshot of all currently active factors.
127
101
  * Each factor is returned as a plain object to prevent direct mutation of the internal map.
@@ -169,6 +143,14 @@ declare class TinyNeedBar {
169
143
  * @returns {number} Current infinite value.
170
144
  */
171
145
  get infiniteValue(): number;
146
+ /**
147
+ * Creates a new need bar instance.
148
+ *
149
+ * @param {number} [maxValue=100] - Maximum value of the bar.
150
+ * @param {number} [baseDecay=1] - Base amount reduced each tick.
151
+ * @param {number} [baseDecayMulti=1] - Multiplier applied to the base decay.
152
+ */
153
+ constructor(maxValue?: number, baseDecay?: number, baseDecayMulti?: number);
172
154
  /**
173
155
  * Retrieves a specific factor by its key.
174
156
  *
@@ -225,6 +207,12 @@ declare class TinyNeedBar {
225
207
  * @returns {SerializedData}
226
208
  */
227
209
  toJSON(): SerializedData;
210
+ /**
211
+ * Restores a need bar from a serialized object.
212
+ * @param {SerializedData} data
213
+ * @returns {TinyNeedBar}
214
+ */
215
+ static fromJSON(data: SerializedData): TinyNeedBar;
228
216
  /**
229
217
  * Creates a deep clone of this need bar.
230
218
  * @returns {TinyNeedBar}
@@ -234,6 +222,6 @@ declare class TinyNeedBar {
234
222
  * Clear the factors map, clearing all factor data.
235
223
  */
236
224
  clearFactors(): void;
237
- #private;
238
225
  }
226
+ export default TinyNeedBar;
239
227
  //# sourceMappingURL=TinyNeedBar.d.mts.map
@@ -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('TinyNewWinEvents');
4
7
 
5
8
  /**
6
9
  * Stores polling intervals associated with window references.
@@ -51,11 +54,27 @@ class TinyNewWinEvents extends events.EventEmitter {
51
54
  /** @type {string} Internal message type for routed communication */
52
55
  #routeEventName = '__TNE_ROUTE__';
53
56
 
57
+ /**
58
+ * Tracks whether the instance has been destroyed.
59
+ * @type {boolean}
60
+ */
61
+ #destroyed = false;
62
+
63
+ /**
64
+ * Gets the current destruction status of the instance.
65
+ *
66
+ * @returns {boolean} True if the instance is destroyed, false otherwise.
67
+ */
68
+ get destroyed() {
69
+ return this.#destroyed;
70
+ }
71
+
54
72
  /**
55
73
  * Gets the internal handshake event name.
56
74
  * @returns {string}
57
75
  */
58
76
  get readyEventName() {
77
+ checkDestroy(this.#destroyed);
59
78
  return this.#readyEventName;
60
79
  }
61
80
 
@@ -65,6 +84,7 @@ class TinyNewWinEvents extends events.EventEmitter {
65
84
  * @throws {TypeError} If the value is not a string.
66
85
  */
67
86
  set readyEventName(name) {
87
+ checkDestroy(this.#destroyed);
68
88
  if (typeof name !== 'string')
69
89
  throw new TypeError('TinyNewWinEvents: readyEventName must be a string.');
70
90
  this.#readyEventName = name;
@@ -75,6 +95,7 @@ class TinyNewWinEvents extends events.EventEmitter {
75
95
  * @returns {string}
76
96
  */
77
97
  get routeEventName() {
98
+ checkDestroy(this.#destroyed);
78
99
  return this.#routeEventName;
79
100
  }
80
101
 
@@ -84,6 +105,7 @@ class TinyNewWinEvents extends events.EventEmitter {
84
105
  * @throws {TypeError} If the value is not a string.
85
106
  */
86
107
  set routeEventName(name) {
108
+ checkDestroy(this.#destroyed);
87
109
  if (typeof name !== 'string')
88
110
  throw new TypeError('TinyNewWinEvents: routeEventName must be a string.');
89
111
  this.#routeEventName = name;
@@ -142,6 +164,7 @@ class TinyNewWinEvents extends events.EventEmitter {
142
164
  * @returns {Window|null}
143
165
  */
144
166
  getWin() {
167
+ checkDestroy(this.#destroyed);
145
168
  return this.#windowRef;
146
169
  }
147
170
 
@@ -200,6 +223,7 @@ class TinyNewWinEvents extends events.EventEmitter {
200
223
  * @returns {void}
201
224
  */
202
225
  close() {
226
+ checkDestroy(this.#destroyed);
203
227
  if (!this.#isHost) throw new Error('Only host can close the window.');
204
228
  if (this.#windowRef && !this.#windowRef.closed) this.#windowRef.close();
205
229
  }
@@ -215,6 +239,7 @@ class TinyNewWinEvents extends events.EventEmitter {
215
239
  * @returns {void}
216
240
  */
217
241
  winEmit(route, payload) {
242
+ checkDestroy(this.#destroyed);
218
243
  if (typeof route !== 'string') throw new TypeError('Event name must be a string.');
219
244
  if (this.isDestroyed()) throw new Error('Cannot emit: instance has been destroyed.');
220
245
  if (!this.#ready) {
@@ -230,6 +255,7 @@ class TinyNewWinEvents extends events.EventEmitter {
230
255
  * @returns {boolean}
231
256
  */
232
257
  isConnected() {
258
+ checkDestroy(this.#destroyed);
233
259
  return this.#ready && this.#windowRef && !this.#windowRef.closed ? true : false;
234
260
  }
235
261
 
@@ -256,6 +282,7 @@ class TinyNewWinEvents extends events.EventEmitter {
256
282
  * @returns {void}
257
283
  */
258
284
  onClose(callback) {
285
+ checkDestroy(this.#destroyed);
259
286
  this.on('WINDOW_REF_CLOSED', callback);
260
287
  }
261
288
 
@@ -266,6 +293,7 @@ class TinyNewWinEvents extends events.EventEmitter {
266
293
  * @returns {void}
267
294
  */
268
295
  offClose(callback) {
296
+ checkDestroy(this.#destroyed);
269
297
  this.off('WINDOW_REF_CLOSED', callback);
270
298
  }
271
299
 
@@ -295,6 +323,7 @@ class TinyNewWinEvents extends events.EventEmitter {
295
323
  this.#ready = false;
296
324
  this.#windowRef = null;
297
325
  this.removeAllListeners();
326
+ this.#destroyed = true;
298
327
  }
299
328
  }
300
329
 
@@ -1,7 +1,4 @@
1
- export default TinyNewWinEvents;
2
- /**
3
- * A function to handle incoming event payloads.
4
- */
1
+ import { EventEmitter } from 'events';
5
2
  export type handler = (payload: any, event: MessageEvent<any>) => any;
6
3
  /**
7
4
  * @callback handler
@@ -18,26 +15,20 @@ export type handler = (payload: any, event: MessageEvent<any>) => any;
18
15
  *
19
16
  * @class
20
17
  */
21
- declare class TinyNewWinEvents extends EventEmitter<any> {
18
+ declare class TinyNewWinEvents extends EventEmitter {
19
+ #private;
20
+ _handleMessage: (event: MessageEvent) => void;
22
21
  /**
23
- * Initializes a TinyNewWinEvents instance for communication.
24
- *
25
- * @param {Object} [settings={}] Configuration object.
26
- * @param {string} [settings.targetOrigin] Origin to enforce in postMessage.
27
- * @param {string} [settings.url] URL string to open.
28
- * @param {string} [settings.name] Window name (required if opening a new window).
29
- * @param {string} [settings.features] Features string for `window.open`.
22
+ * Gets the current destruction status of the instance.
30
23
  *
31
- * @throws {Error} If `name` is "_blank", which is not allowed.
32
- * @throws {TypeError} If `targetOrigin`, `url`, or `features` are not strings (when provided).
33
- * @throws {Error} If the window reference is invalid or already being tracked.
24
+ * @returns {boolean} True if the instance is destroyed, false otherwise.
34
25
  */
35
- constructor({ targetOrigin, url, name, features }?: {
36
- targetOrigin?: string | undefined;
37
- url?: string | undefined;
38
- name?: string | undefined;
39
- features?: string | undefined;
40
- });
26
+ get destroyed(): boolean;
27
+ /**
28
+ * Gets the internal handshake event name.
29
+ * @returns {string}
30
+ */
31
+ get readyEventName(): string;
41
32
  /**
42
33
  * Sets the internal handshake event name.
43
34
  * @param {string} name
@@ -45,10 +36,10 @@ declare class TinyNewWinEvents extends EventEmitter<any> {
45
36
  */
46
37
  set readyEventName(name: string);
47
38
  /**
48
- * Gets the internal handshake event name.
39
+ * Gets the internal route event name.
49
40
  * @returns {string}
50
41
  */
51
- get readyEventName(): string;
42
+ get routeEventName(): string;
52
43
  /**
53
44
  * Sets the internal route event name.
54
45
  * @param {string} name
@@ -56,11 +47,24 @@ declare class TinyNewWinEvents extends EventEmitter<any> {
56
47
  */
57
48
  set routeEventName(name: string);
58
49
  /**
59
- * Gets the internal route event name.
60
- * @returns {string}
50
+ * Initializes a TinyNewWinEvents instance for communication.
51
+ *
52
+ * @param {Object} [settings={}] Configuration object.
53
+ * @param {string} [settings.targetOrigin] Origin to enforce in postMessage.
54
+ * @param {string} [settings.url] URL string to open.
55
+ * @param {string} [settings.name] Window name (required if opening a new window).
56
+ * @param {string} [settings.features] Features string for `window.open`.
57
+ *
58
+ * @throws {Error} If `name` is "_blank", which is not allowed.
59
+ * @throws {TypeError} If `targetOrigin`, `url`, or `features` are not strings (when provided).
60
+ * @throws {Error} If the window reference is invalid or already being tracked.
61
61
  */
62
- get routeEventName(): string;
63
- _handleMessage: (event: MessageEvent) => void;
62
+ constructor({ targetOrigin, url, name, features }?: {
63
+ targetOrigin?: string;
64
+ url?: string;
65
+ name?: string;
66
+ features?: string;
67
+ });
64
68
  /**
65
69
  * Returns the internal window reference.
66
70
  *
@@ -116,7 +120,6 @@ declare class TinyNewWinEvents extends EventEmitter<any> {
116
120
  * @returns {void}
117
121
  */
118
122
  destroy(): void;
119
- #private;
120
123
  }
121
- import { EventEmitter } from 'events';
124
+ export default TinyNewWinEvents;
122
125
  //# sourceMappingURL=TinyNewWinEvents.d.mts.map