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,4 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
+ import { createCheckDestroyed } from './utils.mjs';
3
+ const checkDestroy = createCheckDestroyed('TinyAdvancedRaffle');
2
4
  /**
3
5
  * Defines the available normalization strategies for probability weight calculations.
4
6
  * @typedef {'relative' | 'softmax'} Normalization
@@ -185,6 +187,7 @@ class TinyAdvancedRaffle extends EventEmitter {
185
187
  * @returns {Record<string, number>} - Object with item IDs as keys and their respective draw counts.
186
188
  */
187
189
  get freq() {
190
+ checkDestroy(this.#isDestroyed);
188
191
  return Object.fromEntries(this.#freq);
189
192
  }
190
193
  /**
@@ -192,6 +195,7 @@ class TinyAdvancedRaffle extends EventEmitter {
192
195
  * @returns {number} Total count of items.
193
196
  */
194
197
  get size() {
198
+ checkDestroy(this.#isDestroyed);
195
199
  return this.#items.size;
196
200
  }
197
201
  /**
@@ -199,6 +203,7 @@ class TinyAdvancedRaffle extends EventEmitter {
199
203
  * @returns {Normalization} Current normalization mode.
200
204
  */
201
205
  get normalization() {
206
+ checkDestroy(this.#isDestroyed);
202
207
  return this.#normalization;
203
208
  }
204
209
  /**
@@ -207,7 +212,7 @@ class TinyAdvancedRaffle extends EventEmitter {
207
212
  * @throws {TypeError} If value is not a non-empty string.
208
213
  */
209
214
  set normalization(value) {
210
- this._checkDestroyed();
215
+ checkDestroy(this.#isDestroyed);
211
216
  if (typeof value !== 'string' || !value.trim()) {
212
217
  throw new TypeError("normalization must be a non-empty string (e.g., 'relative', 'softmax').");
213
218
  }
@@ -218,6 +223,7 @@ class TinyAdvancedRaffle extends EventEmitter {
218
223
  * @returns {number|null} Current seed or `null` if RNG is not seeded.
219
224
  */
220
225
  get seed() {
226
+ checkDestroy(this.#isDestroyed);
221
227
  return this.#seed;
222
228
  }
223
229
  /**
@@ -226,7 +232,7 @@ class TinyAdvancedRaffle extends EventEmitter {
226
232
  * @throws {TypeError} If not `null` or a finite number.
227
233
  */
228
234
  set seed(value) {
229
- this._checkDestroyed();
235
+ checkDestroy(this.#isDestroyed);
230
236
  if (value !== null && (typeof value !== 'number' || !Number.isFinite(value)))
231
237
  throw new TypeError('seed must be a finite number or null.');
232
238
  this.#seed = value;
@@ -238,6 +244,7 @@ class TinyAdvancedRaffle extends EventEmitter {
238
244
  * @returns {WeightsCallback[]} Array of registered global modifier functions.
239
245
  */
240
246
  get globalModifiers() {
247
+ checkDestroy(this.#isDestroyed);
241
248
  return [...this.#globalModifiers];
242
249
  }
243
250
  /**
@@ -246,7 +253,7 @@ class TinyAdvancedRaffle extends EventEmitter {
246
253
  * @throws {TypeError} If not an array of functions.
247
254
  */
248
255
  set globalModifiers(value) {
249
- this._checkDestroyed();
256
+ checkDestroy(this.#isDestroyed);
250
257
  if (!Array.isArray(value) || !value.every((fn) => typeof fn === 'function'))
251
258
  throw new TypeError('globalModifiers must be an array of functions (WeightsCallback).');
252
259
  this.#globalModifiers = value;
@@ -256,6 +263,7 @@ class TinyAdvancedRaffle extends EventEmitter {
256
263
  * @returns {TempModifier[]} Array of temporary modifier entries.
257
264
  */
258
265
  get temporaryModifiers() {
266
+ checkDestroy(this.#isDestroyed);
259
267
  return [...this.#temporaryModifiers];
260
268
  }
261
269
  /**
@@ -264,7 +272,7 @@ class TinyAdvancedRaffle extends EventEmitter {
264
272
  * @throws {TypeError} If structure is invalid.
265
273
  */
266
274
  set temporaryModifiers(value) {
267
- this._checkDestroyed();
275
+ checkDestroy(this.#isDestroyed);
268
276
  if (!Array.isArray(value) ||
269
277
  !value.every((obj) => obj && typeof obj.fn === 'function' && Number.isInteger(obj.uses) && obj.uses > 0))
270
278
  throw new TypeError('temporaryModifiers must be an array of objects { fn: function, uses: positive integer }.');
@@ -275,6 +283,7 @@ class TinyAdvancedRaffle extends EventEmitter {
275
283
  * @returns {WeightsCallback[]} Array of conditional rule functions.
276
284
  */
277
285
  get conditionalRules() {
286
+ checkDestroy(this.#isDestroyed);
278
287
  return [...this.#conditionalRules];
279
288
  }
280
289
  /**
@@ -283,7 +292,7 @@ class TinyAdvancedRaffle extends EventEmitter {
283
292
  * @throws {TypeError} If not an array of functions.
284
293
  */
285
294
  set conditionalRules(value) {
286
- this._checkDestroyed();
295
+ checkDestroy(this.#isDestroyed);
287
296
  if (!Array.isArray(value) || !value.every((fn) => typeof fn === 'function'))
288
297
  throw new TypeError('conditionalRules must be an array of functions (WeightsCallback).');
289
298
  this.#conditionalRules = value;
@@ -293,6 +302,7 @@ class TinyAdvancedRaffle extends EventEmitter {
293
302
  * @returns {Record<string, Pity>} Object keyed by system name.
294
303
  */
295
304
  get pitySystems() {
305
+ checkDestroy(this.#isDestroyed);
296
306
  return Object.fromEntries(this.#pitySystems);
297
307
  }
298
308
  /**
@@ -301,7 +311,7 @@ class TinyAdvancedRaffle extends EventEmitter {
301
311
  * @throws {TypeError} If structure is invalid.
302
312
  */
303
313
  set pitySystems(value) {
304
- this._checkDestroyed();
314
+ checkDestroy(this.#isDestroyed);
305
315
  if (!(value instanceof Map) ||
306
316
  ![...value.values()].every((p) => p &&
307
317
  typeof p.threshold === 'number' &&
@@ -317,6 +327,7 @@ class TinyAdvancedRaffle extends EventEmitter {
317
327
  * @returns {string[]} Array of item IDs excluded from draws.
318
328
  */
319
329
  get exclusions() {
330
+ checkDestroy(this.#isDestroyed);
320
331
  return Array.from(this.#exclusions);
321
332
  }
322
333
  /**
@@ -325,7 +336,7 @@ class TinyAdvancedRaffle extends EventEmitter {
325
336
  * @throws {TypeError} If not a Set of strings.
326
337
  */
327
338
  set exclusions(value) {
328
- this._checkDestroyed();
339
+ checkDestroy(this.#isDestroyed);
329
340
  if (!(value instanceof Set) || ![...value].every((v) => typeof v === 'string'))
330
341
  throw new TypeError('exclusions must be a Set<string>.');
331
342
  this.#exclusions = value;
@@ -335,6 +346,7 @@ class TinyAdvancedRaffle extends EventEmitter {
335
346
  * @returns {Record<string, string[]>} Object where each key is a group name and value is an array of item IDs.
336
347
  */
337
348
  get groups() {
349
+ checkDestroy(this.#isDestroyed);
338
350
  /** @type {Record<string, string[]>} */
339
351
  const groups = {};
340
352
  this.#groups.forEach((value, key) => (groups[key] = Array.from(value)));
@@ -346,7 +358,7 @@ class TinyAdvancedRaffle extends EventEmitter {
346
358
  * @throws {TypeError} If not a valid Map<string, Set<string>>.
347
359
  */
348
360
  set groups(value) {
349
- this._checkDestroyed();
361
+ checkDestroy(this.#isDestroyed);
350
362
  if (!(value instanceof Map) ||
351
363
  ![...value.values()].every((v) => v instanceof Set && [...v].every((i) => typeof i === 'string')))
352
364
  throw new TypeError('groups must be a Map<string, Set<string>>.');
@@ -357,6 +369,7 @@ class TinyAdvancedRaffle extends EventEmitter {
357
369
  * @returns {RngGenerator} Function returning a floating-point number in [0, 1).
358
370
  */
359
371
  get rng() {
372
+ checkDestroy(this.#isDestroyed);
360
373
  return this.#rng;
361
374
  }
362
375
  /**
@@ -365,7 +378,7 @@ class TinyAdvancedRaffle extends EventEmitter {
365
378
  * @throws {TypeError} If not a valid function.
366
379
  */
367
380
  set rng(value) {
368
- this._checkDestroyed();
381
+ checkDestroy(this.#isDestroyed);
369
382
  if (typeof value !== 'function' || typeof value() !== 'number')
370
383
  throw new TypeError('rng must be a function returning a number (RngGenerator).');
371
384
  this.#rng = value;
@@ -375,6 +388,7 @@ class TinyAdvancedRaffle extends EventEmitter {
375
388
  * @returns {Record<string, ItemDataGetter>} Object keyed by item ID.
376
389
  */
377
390
  get items() {
391
+ checkDestroy(this.#isDestroyed);
378
392
  /** @type {Record<string, ItemDataGetter>} */
379
393
  const items = {};
380
394
  this.#items.forEach((value, key) => {
@@ -388,7 +402,7 @@ class TinyAdvancedRaffle extends EventEmitter {
388
402
  * @throws {TypeError} If structure is invalid.
389
403
  */
390
404
  set items(value) {
391
- this._checkDestroyed();
405
+ checkDestroy(this.#isDestroyed);
392
406
  if (!(value instanceof Map) ||
393
407
  ![...value.values()].every((item) => item &&
394
408
  typeof item.id === 'string' &&
@@ -421,15 +435,6 @@ class TinyAdvancedRaffle extends EventEmitter {
421
435
  this.#rng = Math.random;
422
436
  this.#seed = seed ?? null;
423
437
  }
424
- /**
425
- * Checks if the instance has been destroyed and throws an error if so.
426
- * @private
427
- * @throws {Error} If the instance has already been destroyed.
428
- */
429
- _checkDestroyed() {
430
- if (this.#isDestroyed)
431
- throw new Error('This instance has been destroyed and can no longer be used.');
432
- }
433
438
  /* ===========================
434
439
  Public: Item management
435
440
  =========================== */
@@ -440,6 +445,7 @@ class TinyAdvancedRaffle extends EventEmitter {
440
445
  * @throws {TypeError} If `itemId` is not a string.
441
446
  */
442
447
  hasItem(itemId) {
448
+ checkDestroy(this.#isDestroyed);
443
449
  if (typeof itemId !== 'string')
444
450
  throw new TypeError('itemId must be a string');
445
451
  return this.#items.has(itemId);
@@ -456,7 +462,7 @@ class TinyAdvancedRaffle extends EventEmitter {
456
462
  * @throws {TypeError} If any parameter has an invalid type.
457
463
  */
458
464
  addItem(id, opts = {}) {
459
- this._checkDestroyed();
465
+ checkDestroy(this.#isDestroyed);
460
466
  if (typeof id !== 'string' || !id.trim())
461
467
  throw new TypeError('id must be a non-empty string');
462
468
  if (typeof opts !== 'object' || opts === null)
@@ -499,7 +505,7 @@ class TinyAdvancedRaffle extends EventEmitter {
499
505
  * @throws {TypeError} If id is not a string.
500
506
  */
501
507
  removeItem(id) {
502
- this._checkDestroyed();
508
+ checkDestroy(this.#isDestroyed);
503
509
  if (typeof id !== 'string' || !id.trim())
504
510
  throw new TypeError('id must be a non-empty string');
505
511
  const it = this.#items.get(id);
@@ -524,7 +530,7 @@ class TinyAdvancedRaffle extends EventEmitter {
524
530
  * @throws {TypeError} If weight is invalid.
525
531
  */
526
532
  setBaseWeight(id, weight) {
527
- this._checkDestroyed();
533
+ checkDestroy(this.#isDestroyed);
528
534
  if (typeof id !== 'string' || !id.trim())
529
535
  throw new TypeError('id must be a non-empty string');
530
536
  if (typeof weight !== 'number' || !Number.isFinite(weight) || weight < 0)
@@ -542,6 +548,7 @@ class TinyAdvancedRaffle extends EventEmitter {
542
548
  * @throws {TypeError} If id is not a string.
543
549
  */
544
550
  getItem(id) {
551
+ checkDestroy(this.#isDestroyed);
545
552
  if (typeof id !== 'string' || !id.trim())
546
553
  throw new TypeError('id must be a non-empty string');
547
554
  return this.#items.get(id) ?? null;
@@ -551,13 +558,14 @@ class TinyAdvancedRaffle extends EventEmitter {
551
558
  * @returns {ItemData[]} Array of cloned item objects.
552
559
  */
553
560
  listItems() {
561
+ checkDestroy(this.#isDestroyed);
554
562
  return Array.from(this.#items.values()).map((i) => ({ ...i }));
555
563
  }
556
564
  /**
557
565
  * Clear all items from the system.
558
566
  */
559
567
  clearList() {
560
- this._checkDestroyed();
568
+ checkDestroy(this.#isDestroyed);
561
569
  this.#items.clear();
562
570
  this.clearFreqs();
563
571
  this.clearPities();
@@ -572,6 +580,7 @@ class TinyAdvancedRaffle extends EventEmitter {
572
580
  * @throws {TypeError} If `fn` is not a function.
573
581
  */
574
582
  hasGlobalModifier(fn) {
583
+ checkDestroy(this.#isDestroyed);
575
584
  if (typeof fn !== 'function')
576
585
  throw new TypeError('fn must be a function');
577
586
  return this.#globalModifiers.includes(fn);
@@ -583,7 +592,7 @@ class TinyAdvancedRaffle extends EventEmitter {
583
592
  * @throws {TypeError} If `fn` is not a function.
584
593
  */
585
594
  addGlobalModifier(fn) {
586
- this._checkDestroyed();
595
+ checkDestroy(this.#isDestroyed);
587
596
  if (typeof fn !== 'function')
588
597
  throw new TypeError('fn must be a function');
589
598
  this.#globalModifiers.push(fn);
@@ -594,7 +603,7 @@ class TinyAdvancedRaffle extends EventEmitter {
594
603
  * @throws {TypeError} If `fn` is not a function.
595
604
  */
596
605
  removeGlobalModifier(fn) {
597
- this._checkDestroyed();
606
+ checkDestroy(this.#isDestroyed);
598
607
  if (typeof fn !== 'function')
599
608
  throw new TypeError('fn must be a function');
600
609
  this.#globalModifiers = this.#globalModifiers.filter((x) => x !== fn);
@@ -606,6 +615,7 @@ class TinyAdvancedRaffle extends EventEmitter {
606
615
  * @throws {TypeError} If `fn` is not a function.
607
616
  */
608
617
  hasTemporaryModifier(fn) {
618
+ checkDestroy(this.#isDestroyed);
609
619
  if (typeof fn !== 'function')
610
620
  throw new TypeError('fn must be a function');
611
621
  return this.#temporaryModifiers.some((mod) => mod.fn === fn);
@@ -619,7 +629,7 @@ class TinyAdvancedRaffle extends EventEmitter {
619
629
  * @throws {TypeError} If `uses` is not a number.
620
630
  */
621
631
  addTemporaryModifier(fn, uses = 1) {
622
- this._checkDestroyed();
632
+ checkDestroy(this.#isDestroyed);
623
633
  if (typeof fn !== 'function')
624
634
  throw new TypeError('fn must be a function');
625
635
  if (typeof uses !== 'number' || Number.isNaN(uses))
@@ -634,7 +644,7 @@ class TinyAdvancedRaffle extends EventEmitter {
634
644
  * @throws {TypeError} If `fn` is not a function.
635
645
  */
636
646
  removeTemporaryModifier(fn) {
637
- this._checkDestroyed();
647
+ checkDestroy(this.#isDestroyed);
638
648
  if (typeof fn !== 'function')
639
649
  throw new TypeError('fn must be a function');
640
650
  const originalLength = this.#temporaryModifiers.length;
@@ -648,6 +658,7 @@ class TinyAdvancedRaffle extends EventEmitter {
648
658
  * @throws {TypeError} If `ruleFn` is not a function.
649
659
  */
650
660
  hasConditionalRule(ruleFn) {
661
+ checkDestroy(this.#isDestroyed);
651
662
  if (typeof ruleFn !== 'function')
652
663
  throw new TypeError('ruleFn must be a function');
653
664
  return this.#conditionalRules.includes(ruleFn);
@@ -660,7 +671,7 @@ class TinyAdvancedRaffle extends EventEmitter {
660
671
  * @throws {TypeError} If `ruleFn` is not a function.
661
672
  */
662
673
  addConditionalRule(ruleFn) {
663
- this._checkDestroyed();
674
+ checkDestroy(this.#isDestroyed);
664
675
  if (typeof ruleFn !== 'function')
665
676
  throw new TypeError('ruleFn must be a function');
666
677
  this.#conditionalRules.push(ruleFn);
@@ -673,7 +684,7 @@ class TinyAdvancedRaffle extends EventEmitter {
673
684
  * @throws {TypeError} If `ruleFn` is not a function.
674
685
  */
675
686
  removeConditionalRule(ruleFn) {
676
- this._checkDestroyed();
687
+ checkDestroy(this.#isDestroyed);
677
688
  if (typeof ruleFn !== 'function')
678
689
  throw new TypeError('ruleFn must be a function');
679
690
  const originalLength = this.#conditionalRules.length;
@@ -690,6 +701,7 @@ class TinyAdvancedRaffle extends EventEmitter {
690
701
  * @throws {TypeError} If `itemId` is not a string.
691
702
  */
692
703
  hasPity(itemId) {
704
+ checkDestroy(this.#isDestroyed);
693
705
  if (typeof itemId !== 'string')
694
706
  throw new TypeError('itemId must be a string');
695
707
  return this.#pitySystems.has(itemId);
@@ -706,7 +718,7 @@ class TinyAdvancedRaffle extends EventEmitter {
706
718
  * @throws {TypeError} If parameters are invalid.
707
719
  */
708
720
  configurePity(itemId, cfg) {
709
- this._checkDestroyed();
721
+ checkDestroy(this.#isDestroyed);
710
722
  if (!this.#items.has(itemId))
711
723
  throw new Error('Item not found');
712
724
  if (typeof cfg !== 'object' || cfg === null)
@@ -732,7 +744,7 @@ class TinyAdvancedRaffle extends EventEmitter {
732
744
  * @throws {TypeError} If itemId is not a string.
733
745
  */
734
746
  resetPity(itemId) {
735
- this._checkDestroyed();
747
+ checkDestroy(this.#isDestroyed);
736
748
  if (typeof itemId !== 'string' || !itemId.trim())
737
749
  throw new TypeError('itemId must be a non-empty string');
738
750
  const p = this.#pitySystems.get(itemId);
@@ -745,7 +757,7 @@ class TinyAdvancedRaffle extends EventEmitter {
745
757
  * Remove all pity configurations.
746
758
  */
747
759
  clearPities() {
748
- this._checkDestroyed();
760
+ checkDestroy(this.#isDestroyed);
749
761
  this.#pitySystems.clear();
750
762
  }
751
763
  /* ===========================
@@ -758,6 +770,7 @@ class TinyAdvancedRaffle extends EventEmitter {
758
770
  * @throws {TypeError} If `itemId` is not a string.
759
771
  */
760
772
  hasExclusion(itemId) {
773
+ checkDestroy(this.#isDestroyed);
761
774
  if (typeof itemId !== 'string')
762
775
  throw new TypeError('itemId must be a string');
763
776
  return this.#exclusions.has(itemId);
@@ -768,7 +781,7 @@ class TinyAdvancedRaffle extends EventEmitter {
768
781
  * @throws {TypeError} If `itemId` is not a string.
769
782
  */
770
783
  excludeItem(itemId) {
771
- this._checkDestroyed();
784
+ checkDestroy(this.#isDestroyed);
772
785
  if (typeof itemId !== 'string')
773
786
  throw new TypeError('itemId must be a string');
774
787
  this.#exclusions.add(itemId);
@@ -779,7 +792,7 @@ class TinyAdvancedRaffle extends EventEmitter {
779
792
  * @throws {TypeError} If `itemId` is not a string.
780
793
  */
781
794
  includeItem(itemId) {
782
- this._checkDestroyed();
795
+ checkDestroy(this.#isDestroyed);
783
796
  if (typeof itemId !== 'string')
784
797
  throw new TypeError('itemId must be a string');
785
798
  this.#exclusions.delete(itemId);
@@ -792,7 +805,7 @@ class TinyAdvancedRaffle extends EventEmitter {
792
805
  * @private
793
806
  */
794
807
  _ensureGroup(name) {
795
- this._checkDestroyed();
808
+ checkDestroy(this.#isDestroyed);
796
809
  if (typeof name !== 'string')
797
810
  throw new TypeError('name must be a string');
798
811
  let group = this.#groups.get(name);
@@ -810,6 +823,7 @@ class TinyAdvancedRaffle extends EventEmitter {
810
823
  * @throws {TypeError} If parameters are not strings.
811
824
  */
812
825
  hasInGroup(itemId, groupName) {
826
+ checkDestroy(this.#isDestroyed);
813
827
  if (typeof itemId !== 'string' || typeof groupName !== 'string')
814
828
  throw new TypeError('itemId and groupName must be strings');
815
829
  const group = this.#groups.get(groupName);
@@ -823,7 +837,7 @@ class TinyAdvancedRaffle extends EventEmitter {
823
837
  * @throws {TypeError} If parameters are not strings.
824
838
  */
825
839
  addToGroup(itemId, groupName) {
826
- this._checkDestroyed();
840
+ checkDestroy(this.#isDestroyed);
827
841
  if (typeof itemId !== 'string' || typeof groupName !== 'string')
828
842
  throw new TypeError('itemId and groupName must be strings');
829
843
  const it = this.#items.get(itemId);
@@ -839,7 +853,7 @@ class TinyAdvancedRaffle extends EventEmitter {
839
853
  * @throws {TypeError} If parameters are not strings.
840
854
  */
841
855
  removeFromGroup(itemId, groupName) {
842
- this._checkDestroyed();
856
+ checkDestroy(this.#isDestroyed);
843
857
  if (typeof itemId !== 'string' || typeof groupName !== 'string')
844
858
  throw new TypeError('itemId and groupName must be strings');
845
859
  const g = this.#groups.get(groupName);
@@ -857,7 +871,7 @@ class TinyAdvancedRaffle extends EventEmitter {
857
871
  * Effectively resets the internal frequency map to an empty state.
858
872
  */
859
873
  clearFreqs() {
860
- this._checkDestroyed();
874
+ checkDestroy(this.#isDestroyed);
861
875
  this.#freq.clear();
862
876
  }
863
877
  /**
@@ -868,7 +882,7 @@ class TinyAdvancedRaffle extends EventEmitter {
868
882
  * @throws {TypeError} If `itemId` is not a string.
869
883
  */
870
884
  resetFreq(itemId) {
871
- this._checkDestroyed();
885
+ checkDestroy(this.#isDestroyed);
872
886
  if (typeof itemId !== 'string')
873
887
  throw new TypeError('itemId must be a string');
874
888
  this.#freq.delete(itemId);
@@ -883,7 +897,7 @@ class TinyAdvancedRaffle extends EventEmitter {
883
897
  * @throws {TypeError} If `context` is provided but is not an object.
884
898
  */
885
899
  computeEffectiveWeights(context = {}) {
886
- this._checkDestroyed();
900
+ checkDestroy(this.#isDestroyed);
887
901
  if (typeof context !== 'object' || context === null)
888
902
  throw new TypeError(`computeEffectiveWeights: parameter 'context' must be a non-null object, got ${typeof context}`);
889
903
  if ('previousDraws' in context && !Array.isArray(context.previousDraws))
@@ -959,9 +973,9 @@ class TinyAdvancedRaffle extends EventEmitter {
959
973
  * @param {Map<string, number>} weights - Map of item IDs to their weights.
960
974
  * @returns {Array<{id: string, weight: number, p: number, cumulative: number}>} Distribution array.
961
975
  * @throws {TypeError} If `weights` is not a Map.
976
+ * @private
962
977
  */
963
978
  _weightsToDistribution(weights) {
964
- this._checkDestroyed();
965
979
  if (!(weights instanceof Map))
966
980
  throw new TypeError(`_weightsToDistribution: parameter 'weights' must be a Map, got ${typeof weights}`);
967
981
  for (const [key, val] of weights) {
@@ -1007,7 +1021,7 @@ class TinyAdvancedRaffle extends EventEmitter {
1007
1021
  * @throws {TypeError} If `opts` is not an object.
1008
1022
  */
1009
1023
  drawOne(opts = {}) {
1010
- this._checkDestroyed();
1024
+ checkDestroy(this.#isDestroyed);
1011
1025
  if (typeof opts !== 'object' || opts === null)
1012
1026
  throw new TypeError(`drawOne: parameter 'opts' must be a non-null object, got ${typeof opts}`);
1013
1027
  if ('previousDraws' in opts && !Array.isArray(opts.previousDraws))
@@ -1057,7 +1071,6 @@ class TinyAdvancedRaffle extends EventEmitter {
1057
1071
  * @private
1058
1072
  */
1059
1073
  _consumeTemporaryModifiers() {
1060
- this._checkDestroyed();
1061
1074
  for (let i = this.#temporaryModifiers.length - 1; i >= 0; --i) {
1062
1075
  const t = this.#temporaryModifiers[i];
1063
1076
  t.uses -= 1;
@@ -1079,7 +1092,7 @@ class TinyAdvancedRaffle extends EventEmitter {
1079
1092
  * @throws {TypeError} If `opts` is not an object.
1080
1093
  */
1081
1094
  drawMany(count = 1, opts = {}) {
1082
- this._checkDestroyed();
1095
+ checkDestroy(this.#isDestroyed);
1083
1096
  if (!Number.isInteger(count) || count <= 0)
1084
1097
  throw new TypeError(`drawMany: parameter 'count' must be a positive integer, got ${count}`);
1085
1098
  if (typeof opts !== 'object' || opts === null)
@@ -1147,7 +1160,7 @@ class TinyAdvancedRaffle extends EventEmitter {
1147
1160
  * @returns {ExportedJson} Exported configuration object.
1148
1161
  */
1149
1162
  exportToJson() {
1150
- this._checkDestroyed();
1163
+ checkDestroy(this.#isDestroyed);
1151
1164
  const data = {
1152
1165
  items: Array.from(this.#items.values()).map((it) => ({
1153
1166
  id: it.id,
@@ -1173,7 +1186,7 @@ class TinyAdvancedRaffle extends EventEmitter {
1173
1186
  * @throws {TypeError} If `data.seed` is not a number, null, or undefined.
1174
1187
  */
1175
1188
  loadFromJson(data) {
1176
- this._checkDestroyed();
1189
+ checkDestroy(this.#isDestroyed);
1177
1190
  if (typeof data !== 'object' || data === null)
1178
1191
  throw new TypeError('data must be a non-null object');
1179
1192
  if (!Array.isArray(data.items) || !Array.isArray(data.pity) || !Array.isArray(data.exclusions))
@@ -1222,7 +1235,7 @@ class TinyAdvancedRaffle extends EventEmitter {
1222
1235
  * @returns {TinyAdvancedRaffle} A new cloned instance, fully independent from the original.
1223
1236
  */
1224
1237
  clone() {
1225
- this._checkDestroyed();
1238
+ checkDestroy(this.#isDestroyed);
1226
1239
  const cloneInstance = new TinyAdvancedRaffle();
1227
1240
  // Primitive values
1228
1241
  cloneInstance.#normalization = this.#normalization;
@@ -1265,9 +1278,9 @@ class TinyAdvancedRaffle extends EventEmitter {
1265
1278
  * @param {number} seed - Seed value for PRNG (integer).
1266
1279
  * @returns {RngGenerator} A function that returns a pseudo-random number in [0, 1).
1267
1280
  * @throws {TypeError} If `seed` is not a finite number.
1281
+ * @private
1268
1282
  */
1269
1283
  _makeSeededRng(seed) {
1270
- this._checkDestroyed();
1271
1284
  if (typeof seed !== 'number' || !Number.isFinite(seed))
1272
1285
  throw new TypeError('seed must be a finite number');
1273
1286
  // mulberry32
@@ -1287,7 +1300,6 @@ class TinyAdvancedRaffle extends EventEmitter {
1287
1300
  destroy() {
1288
1301
  if (this.#isDestroyed)
1289
1302
  return;
1290
- this.#isDestroyed = true;
1291
1303
  // Clear all Maps and Sets
1292
1304
  this.#pitySystems.clear();
1293
1305
  this.#exclusions.clear();
@@ -1300,6 +1312,7 @@ class TinyAdvancedRaffle extends EventEmitter {
1300
1312
  this.#conditionalRules = [];
1301
1313
  // Nullify core references
1302
1314
  this.#seed = null;
1315
+ this.#isDestroyed = true;
1303
1316
  }
1304
1317
  }
1305
1318
  export default TinyAdvancedRaffle;
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var utils = require('./utils.cjs');
4
+
5
+ const checkDestroy = utils.createCheckDestroyed('TinyAfterScrollWatcher');
6
+
3
7
  /**
4
8
  * @typedef {(() => void)} FnData - Function with no arguments and no return value
5
9
  */
@@ -21,6 +25,7 @@ class TinyAfterScrollWatcher {
21
25
  #scrollTarget;
22
26
 
23
27
  get scrollTarget() {
28
+ checkDestroy(this.#destroyed);
24
29
  return this.#scrollTarget;
25
30
  }
26
31
 
@@ -31,6 +36,7 @@ class TinyAfterScrollWatcher {
31
36
  #afterScrollQueue = [];
32
37
 
33
38
  get afterScrollQueueSize() {
39
+ checkDestroy(this.#destroyed);
34
40
  return this.#afterScrollQueue.length;
35
41
  }
36
42
 
@@ -66,6 +72,9 @@ class TinyAfterScrollWatcher {
66
72
  this.#inactivityTime = inactivityTime;
67
73
  }
68
74
 
75
+ /**
76
+ * @private
77
+ */
69
78
  _checkTimer = () => {
70
79
  if (this.#lastScrollTime) clearTimeout(this.#lastScrollTime);
71
80
  this.#lastScrollTime = setTimeout(() => {
@@ -79,6 +88,7 @@ class TinyAfterScrollWatcher {
79
88
  * @returns {number}
80
89
  */
81
90
  get inactivityTime() {
91
+ checkDestroy(this.#destroyed);
82
92
  return this.#inactivityTime;
83
93
  }
84
94
 
@@ -89,6 +99,7 @@ class TinyAfterScrollWatcher {
89
99
  * @throws {Error} If value is not a positive number
90
100
  */
91
101
  set inactivityTime(value) {
102
+ checkDestroy(this.#destroyed);
92
103
  if (typeof value !== 'number' || value <= 0 || !Number.isFinite(value))
93
104
  throw new Error('inactivityTime must be a positive number in milliseconds.');
94
105
  this.#inactivityTime = value;
@@ -120,6 +131,7 @@ class TinyAfterScrollWatcher {
120
131
  * @throws {TypeError} If the argument is not a function.
121
132
  */
122
133
  doAfterScroll(fn) {
134
+ checkDestroy(this.#destroyed);
123
135
  if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
124
136
  this.lastScrollTime = Date.now();
125
137
  this.#afterScrollQueue.push(fn);
@@ -133,6 +145,7 @@ class TinyAfterScrollWatcher {
133
145
  * @throws {TypeError} If the argument is not a function.
134
146
  */
135
147
  onStop(fn) {
148
+ checkDestroy(this.#destroyed);
136
149
  if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
137
150
  this.#onStopListeners.add(fn);
138
151
  }
@@ -144,6 +157,7 @@ class TinyAfterScrollWatcher {
144
157
  * @throws {TypeError} If the argument is not a function.
145
158
  */
146
159
  offStop(fn) {
160
+ checkDestroy(this.#destroyed);
147
161
  if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
148
162
  this.#onStopListeners.delete(fn);
149
163
  }
@@ -155,6 +169,7 @@ class TinyAfterScrollWatcher {
155
169
  * @throws {TypeError} If the argument is not a function.
156
170
  */
157
171
  onScroll(fn) {
172
+ checkDestroy(this.#destroyed);
158
173
  if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
159
174
  this.#scrollTarget.addEventListener('scroll', fn);
160
175
  this.#externalScrollListeners.add(fn);
@@ -167,6 +182,7 @@ class TinyAfterScrollWatcher {
167
182
  * @throws {TypeError} If the argument is not a function.
168
183
  */
169
184
  offScroll(fn) {
185
+ checkDestroy(this.#destroyed);
170
186
  if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
171
187
  if (this.#externalScrollListeners.has(fn)) {
172
188
  this.#scrollTarget.removeEventListener('scroll', fn);
@@ -179,7 +195,6 @@ class TinyAfterScrollWatcher {
179
195
  */
180
196
  destroy() {
181
197
  if (this.#destroyed) return;
182
- this.#destroyed = true;
183
198
 
184
199
  this.#scrollTarget.removeEventListener('scroll', this._checkTimer);
185
200
  for (const fn of this.#externalScrollListeners)
@@ -187,6 +202,7 @@ class TinyAfterScrollWatcher {
187
202
 
188
203
  this.#externalScrollListeners.clear();
189
204
  this.#onStopListeners.clear();
205
+ this.#destroyed = true;
190
206
  }
191
207
  }
192
208