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,6 +1,8 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import TinyHtml from './TinyHtml.mjs';
3
3
  import * as TinyCollision from '../basics/collision.mjs';
4
+ import { createCheckDestroyed } from './utils.mjs';
5
+ const checkDestroy = createCheckDestroyed('TinySmartScroller');
4
6
  /**
5
7
  * Represents the dimensions of a DOM element.
6
8
  *
@@ -172,6 +174,7 @@ class TinySmartScroller extends EventEmitter {
172
174
  * @returns {NodeSizesEvent} A function that compares previous and current height, returning height delta.
173
175
  */
174
176
  getSimpleOnHeight(filter = []) {
177
+ checkDestroy(this.#destroyed);
175
178
  if (!Array.isArray(filter))
176
179
  throw new TypeError('getSimpleOnHeight(filter): filter must be an array of tag names');
177
180
  return (elem, sizes, amounts) => {
@@ -190,6 +193,7 @@ class TinySmartScroller extends EventEmitter {
190
193
  * @returns {NodeSizesEvent} The added size difference callback.
191
194
  */
192
195
  addSimpleOnHeight(filter) {
196
+ checkDestroy(this.#destroyed);
193
197
  if (!Array.isArray(filter))
194
198
  throw new TypeError('addSimpleOnHeight(filter): filter must be an array of tag names');
195
199
  const result = this.getSimpleOnHeight(filter);
@@ -202,6 +206,7 @@ class TinySmartScroller extends EventEmitter {
202
206
  * @returns {string[]} Array of tag names.
203
207
  */
204
208
  getLoadTags() {
209
+ checkDestroy(this.#destroyed);
205
210
  return Array.from(this.#loadTags);
206
211
  }
207
212
  /**
@@ -210,6 +215,7 @@ class TinySmartScroller extends EventEmitter {
210
215
  * @param {string} tag - The tag name to add (e.g., 'IMG').
211
216
  */
212
217
  addLoadTag(tag) {
218
+ checkDestroy(this.#destroyed);
213
219
  if (typeof tag !== 'string')
214
220
  throw new TypeError('addLoadTag(tag): tag must be a string');
215
221
  this.#loadTags.add(tag.toUpperCase());
@@ -220,6 +226,7 @@ class TinySmartScroller extends EventEmitter {
220
226
  * @param {string} tag - The tag name to remove.
221
227
  */
222
228
  removeLoadTag(tag) {
229
+ checkDestroy(this.#destroyed);
223
230
  if (typeof tag !== 'string')
224
231
  throw new TypeError('removeLoadTag(tag): tag must be a string');
225
232
  this.#loadTags.delete(tag.toUpperCase());
@@ -231,6 +238,7 @@ class TinySmartScroller extends EventEmitter {
231
238
  * @returns {boolean} True if the tag is being tracked.
232
239
  */
233
240
  hasLoadTag(tag) {
241
+ checkDestroy(this.#destroyed);
234
242
  if (typeof tag !== 'string')
235
243
  throw new TypeError('hasLoadTag(tag): tag must be a string');
236
244
  return this.#loadTags.has(tag.toUpperCase());
@@ -242,6 +250,7 @@ class TinySmartScroller extends EventEmitter {
242
250
  * @throws {TypeError} If `addDefault` is not a boolean.
243
251
  */
244
252
  resetLoadTags(addDefault = false) {
253
+ checkDestroy(this.#destroyed);
245
254
  if (typeof addDefault !== 'boolean')
246
255
  throw new TypeError('resetLoadTags(addDefault): addDefault must be a boolean');
247
256
  this.#loadTags.clear();
@@ -257,6 +266,7 @@ class TinySmartScroller extends EventEmitter {
257
266
  * @returns {string[]} Array of attribute names.
258
267
  */
259
268
  getAttributeFilters() {
269
+ checkDestroy(this.#destroyed);
260
270
  return Array.from(this.#attributeFilter);
261
271
  }
262
272
  /**
@@ -265,6 +275,7 @@ class TinySmartScroller extends EventEmitter {
265
275
  * @param {string} attr - The attribute name to add.
266
276
  */
267
277
  addAttributeFilter(attr) {
278
+ checkDestroy(this.#destroyed);
268
279
  if (typeof attr !== 'string')
269
280
  throw new TypeError('addAttributeFilter(attr): attr must be a string');
270
281
  this.#attributeFilter.add(attr);
@@ -275,6 +286,7 @@ class TinySmartScroller extends EventEmitter {
275
286
  * @param {string} attr - The attribute name to remove.
276
287
  */
277
288
  removeAttributeFilter(attr) {
289
+ checkDestroy(this.#destroyed);
278
290
  if (typeof attr !== 'string')
279
291
  throw new TypeError('removeAttributeFilter(attr): attr must be a string');
280
292
  this.#attributeFilter.delete(attr);
@@ -286,6 +298,7 @@ class TinySmartScroller extends EventEmitter {
286
298
  * @returns {boolean} True if the attribute is being filtered.
287
299
  */
288
300
  hasAttributeFilter(attr) {
301
+ checkDestroy(this.#destroyed);
289
302
  if (typeof attr !== 'string')
290
303
  throw new TypeError('hasAttributeFilter(attr): attr must be a string');
291
304
  return this.#attributeFilter.has(attr);
@@ -298,6 +311,7 @@ class TinySmartScroller extends EventEmitter {
298
311
  * @throws {TypeError} If `addDefault` is not a boolean.
299
312
  */
300
313
  resetAttributeFilters(addDefault = false) {
314
+ checkDestroy(this.#destroyed);
301
315
  if (typeof addDefault !== 'boolean')
302
316
  throw new TypeError('resetAttributeFilters(addDefault): addDefault must be a boolean');
303
317
  this.#attributeFilter.clear();
@@ -311,8 +325,7 @@ class TinySmartScroller extends EventEmitter {
311
325
  * @param {NodeSizesEvent} handler - Function that compares old and new sizes.
312
326
  */
313
327
  onSize(handler) {
314
- if (this.#destroyed)
315
- return;
328
+ checkDestroy(this.#destroyed);
316
329
  if (typeof handler !== 'function')
317
330
  throw new TypeError('onSize(handler): handler must be a function');
318
331
  this.#sizeFilter.add(handler);
@@ -323,8 +336,7 @@ class TinySmartScroller extends EventEmitter {
323
336
  * @param {NodeSizesEvent} handler - The handler function to remove.
324
337
  */
325
338
  offSize(handler) {
326
- if (this.#destroyed)
327
- return;
339
+ checkDestroy(this.#destroyed);
328
340
  if (typeof handler !== 'function')
329
341
  throw new TypeError('offSize(handler): handler must be a function');
330
342
  this.#sizeFilter.delete(handler);
@@ -333,6 +345,7 @@ class TinySmartScroller extends EventEmitter {
333
345
  * Checks which elements inside the target are currently visible and updates internal maps.
334
346
  *
335
347
  * @returns {Map<Element, { oldIsVisible: boolean; isVisible: boolean }>} Visibility comparison results.
348
+ * @private
336
349
  */
337
350
  _scrollDataUpdater() {
338
351
  const results = new Map();
@@ -347,6 +360,7 @@ class TinySmartScroller extends EventEmitter {
347
360
  }
348
361
  /**
349
362
  * Handles scroll events, calculates position-related statuses, and emits appropriate events.
363
+ * @private
350
364
  */
351
365
  _onScroll() {
352
366
  if (this.#destroyed)
@@ -402,6 +416,7 @@ class TinySmartScroller extends EventEmitter {
402
416
  * Attempts to correct the scroll position when layout shifts happen, preserving the user position if needed.
403
417
  *
404
418
  * @param {Element[]} [targets=[]] - List of elements involved in the size change.
419
+ * @private
405
420
  */
406
421
  _fixScroll(targets = []) {
407
422
  if (this.#destroyed)
@@ -478,6 +493,7 @@ class TinySmartScroller extends EventEmitter {
478
493
  }
479
494
  /**
480
495
  * Sets up a MutationObserver to watch for DOM changes and react accordingly to maintain scroll consistency.
496
+ * @private
481
497
  */
482
498
  _observeMutations() {
483
499
  this.#mutationObserver = new MutationObserver((mutations) => {
@@ -513,6 +529,7 @@ class TinySmartScroller extends EventEmitter {
513
529
  * Adds a ResizeObserver to monitor elements' size changes and trigger layout adjustments.
514
530
  *
515
531
  * @param {NodeListOf<Element>|Element[]|HTMLCollection} elements - Elements to observe.
532
+ * @private
516
533
  */
517
534
  _observeResizes(elements) {
518
535
  // Add resize observer
@@ -550,6 +567,7 @@ class TinySmartScroller extends EventEmitter {
550
567
  * Listens for media/content load events (e.g., images, iframes, videos) to trigger scroll updates.
551
568
  *
552
569
  * @param {NodeListOf<Element>|Element} elements - Target element(s) to listen on.
570
+ * @private
553
571
  */
554
572
  _listenLoadEvents(elements) {
555
573
  if (this.#destroyed)
@@ -585,6 +603,7 @@ class TinySmartScroller extends EventEmitter {
585
603
  * @returns {NodeSizes|null} The old size, or undefined.
586
604
  */
587
605
  getOldSize(el) {
606
+ checkDestroy(this.#destroyed);
588
607
  return this.#oldSizes.get(el) ?? null;
589
608
  }
590
609
  /**
@@ -594,6 +613,7 @@ class TinySmartScroller extends EventEmitter {
594
613
  * @returns {NodeSizes|null} The new size, or undefined.
595
614
  */
596
615
  getNewSize(el) {
616
+ checkDestroy(this.#destroyed);
597
617
  return this.#newSizes.get(el) ?? null;
598
618
  }
599
619
  /**
@@ -603,6 +623,7 @@ class TinySmartScroller extends EventEmitter {
603
623
  * @returns {boolean} True if visible, false if not, or undefined if not tracked.
604
624
  */
605
625
  wasVisible(el) {
626
+ checkDestroy(this.#destroyed);
606
627
  return this.#oldVisibles.get(el) ?? false;
607
628
  }
608
629
  /**
@@ -612,6 +633,7 @@ class TinySmartScroller extends EventEmitter {
612
633
  * @returns {boolean} True if visible, false if not, or undefined if not tracked.
613
634
  */
614
635
  isVisible(el) {
636
+ checkDestroy(this.#destroyed);
615
637
  return this.#newVisibles.get(el) ?? false;
616
638
  }
617
639
  /**
@@ -621,6 +643,7 @@ class TinySmartScroller extends EventEmitter {
621
643
  * @returns {boolean} Visibility state from the previous timed check.
622
644
  */
623
645
  wasTimedVisible(el) {
646
+ checkDestroy(this.#destroyed);
624
647
  return this.#oldVisiblesByTime.get(el) ?? false;
625
648
  }
626
649
  /**
@@ -630,6 +653,7 @@ class TinySmartScroller extends EventEmitter {
630
653
  * @returns {boolean} Visibility state from the current timed check.
631
654
  */
632
655
  isTimedVisible(el) {
656
+ checkDestroy(this.#destroyed);
633
657
  return this.#newVisiblesByTime.get(el) ?? false;
634
658
  }
635
659
  /**
@@ -638,6 +662,7 @@ class TinySmartScroller extends EventEmitter {
638
662
  * @param {number} value - Pixels of additional margin to use.
639
663
  */
640
664
  setExtraScrollBoundary(value) {
665
+ checkDestroy(this.#destroyed);
641
666
  if (typeof value !== 'number' || Number.isNaN(value))
642
667
  throw new TypeError('setExtraScrollBoundary(value): value must be a valid number');
643
668
  this.#extraScrollBoundary = value;
@@ -648,6 +673,7 @@ class TinySmartScroller extends EventEmitter {
648
673
  * @returns {number}
649
674
  */
650
675
  getExtraScrollBoundary() {
676
+ checkDestroy(this.#destroyed);
651
677
  return this.#extraScrollBoundary;
652
678
  }
653
679
  /**
@@ -656,18 +682,21 @@ class TinySmartScroller extends EventEmitter {
656
682
  * @returns {number}
657
683
  */
658
684
  getLastKnownScrollBottomOffset() {
685
+ checkDestroy(this.#destroyed);
659
686
  return this.#lastKnownScrollBottomOffset;
660
687
  }
661
688
  /**
662
689
  * Forces the scroll position to move to the very bottom of the target.
663
690
  */
664
691
  scrollToBottom() {
692
+ checkDestroy(this.#destroyed);
665
693
  this.#targetElement.scrollTop = this.#targetElement.scrollHeight;
666
694
  }
667
695
  /**
668
696
  * Forces the scroll position to move to the very top of the target.
669
697
  */
670
698
  scrollToTop() {
699
+ checkDestroy(this.#destroyed);
671
700
  this.#targetElement.scrollTop = 0;
672
701
  }
673
702
  /**
@@ -676,6 +705,7 @@ class TinySmartScroller extends EventEmitter {
676
705
  * @returns {boolean}
677
706
  */
678
707
  isAtCustomBottom() {
708
+ checkDestroy(this.#destroyed);
679
709
  return this.#isAtCustomBottom;
680
710
  }
681
711
  /**
@@ -684,6 +714,7 @@ class TinySmartScroller extends EventEmitter {
684
714
  * @returns {boolean}
685
715
  */
686
716
  isAtCustomTop() {
717
+ checkDestroy(this.#destroyed);
687
718
  return this.#isAtCustomTop;
688
719
  }
689
720
  /**
@@ -692,6 +723,7 @@ class TinySmartScroller extends EventEmitter {
692
723
  * @returns {boolean}
693
724
  */
694
725
  isAtBottom() {
726
+ checkDestroy(this.#destroyed);
695
727
  return this.#isAtBottom;
696
728
  }
697
729
  /**
@@ -700,6 +732,7 @@ class TinySmartScroller extends EventEmitter {
700
732
  * @returns {boolean}
701
733
  */
702
734
  isAtTop() {
735
+ checkDestroy(this.#destroyed);
703
736
  return this.#isAtTop;
704
737
  }
705
738
  /**
@@ -708,6 +741,7 @@ class TinySmartScroller extends EventEmitter {
708
741
  * @returns {boolean}
709
742
  */
710
743
  isPastAtBottom() {
744
+ checkDestroy(this.#destroyed);
711
745
  return this.#isPastAtBottom;
712
746
  }
713
747
  /**
@@ -716,6 +750,7 @@ class TinySmartScroller extends EventEmitter {
716
750
  * @returns {boolean}
717
751
  */
718
752
  isPastAtTop() {
753
+ checkDestroy(this.#destroyed);
719
754
  return this.#isPastAtTop;
720
755
  }
721
756
  /**
@@ -724,6 +759,7 @@ class TinySmartScroller extends EventEmitter {
724
759
  * @returns {boolean}
725
760
  */
726
761
  isPastAtCustomTop() {
762
+ checkDestroy(this.#destroyed);
727
763
  return this.#isPastAtCustomTop;
728
764
  }
729
765
  /**
@@ -732,6 +768,7 @@ class TinySmartScroller extends EventEmitter {
732
768
  * @returns {boolean}
733
769
  */
734
770
  isPastAtCustomBottom() {
771
+ checkDestroy(this.#destroyed);
735
772
  return this.#isPastAtCustomBottom;
736
773
  }
737
774
  /**
@@ -740,6 +777,7 @@ class TinySmartScroller extends EventEmitter {
740
777
  * @returns {boolean}
741
778
  */
742
779
  isScrollPaused() {
780
+ checkDestroy(this.#destroyed);
743
781
  return this.#scrollPaused;
744
782
  }
745
783
  /**
@@ -748,6 +786,7 @@ class TinySmartScroller extends EventEmitter {
748
786
  * @returns {boolean} True if the scroll target is window, false otherwise.
749
787
  */
750
788
  isWindow() {
789
+ checkDestroy(this.#destroyed);
751
790
  return this.#useWindow;
752
791
  }
753
792
  /**
@@ -764,6 +803,7 @@ class TinySmartScroller extends EventEmitter {
764
803
  * @returns {boolean} True if auto-scroll is active, false otherwise.
765
804
  */
766
805
  getAutoScrollBottom() {
806
+ checkDestroy(this.#destroyed);
767
807
  return this.#autoScrollBottom;
768
808
  }
769
809
  /**
@@ -772,6 +812,7 @@ class TinySmartScroller extends EventEmitter {
772
812
  * @returns {boolean} True if mutation observation is active, false otherwise.
773
813
  */
774
814
  getObserveMutations() {
815
+ checkDestroy(this.#destroyed);
775
816
  return this.#observeMutations;
776
817
  }
777
818
  /**
@@ -780,6 +821,7 @@ class TinySmartScroller extends EventEmitter {
780
821
  * @returns {boolean} True if scroll preservation is active, false otherwise.
781
822
  */
782
823
  getPreserveScrollOnLayoutShift() {
824
+ checkDestroy(this.#destroyed);
783
825
  return this.#preserveScrollOnLayoutShift;
784
826
  }
785
827
  /**
@@ -788,6 +830,7 @@ class TinySmartScroller extends EventEmitter {
788
830
  * @returns {number} Debounce delay time.
789
831
  */
790
832
  getDebounceTime() {
833
+ checkDestroy(this.#destroyed);
791
834
  return this.#debounceTime;
792
835
  }
793
836
  /**
@@ -796,6 +839,7 @@ class TinySmartScroller extends EventEmitter {
796
839
  * @returns {number} Current count of matching elements.
797
840
  */
798
841
  getElemAmount() {
842
+ checkDestroy(this.#destroyed);
799
843
  return this.#elemAmount;
800
844
  }
801
845
  /**
@@ -804,6 +848,7 @@ class TinySmartScroller extends EventEmitter {
804
848
  * @returns {number} Previous count of matching elements.
805
849
  */
806
850
  getPrevElemAmount() {
851
+ checkDestroy(this.#destroyed);
807
852
  return this.#elemOldAmount;
808
853
  }
809
854
  /**
@@ -812,6 +857,7 @@ class TinySmartScroller extends EventEmitter {
812
857
  * @returns {string} The CSS selector string, or an empty string if none was provided.
813
858
  */
814
859
  getQuerySelector() {
860
+ checkDestroy(this.#destroyed);
815
861
  return this.#querySelector;
816
862
  }
817
863
  /**
@@ -821,7 +867,6 @@ class TinySmartScroller extends EventEmitter {
821
867
  destroy() {
822
868
  if (this.#destroyed)
823
869
  return;
824
- this.#destroyed = true;
825
870
  // Disconnects MutationObserver
826
871
  if (this.#mutationObserver) {
827
872
  this.#mutationObserver.disconnect();
@@ -847,6 +892,7 @@ class TinySmartScroller extends EventEmitter {
847
892
  this.removeAllListeners();
848
893
  this.#sizeFilter.clear();
849
894
  this.#loadTags.clear();
895
+ this.#destroyed = true;
850
896
  }
851
897
  }
852
898
  export default TinySmartScroller;
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var utils = require('./utils.cjs');
4
+
5
+ const checkDestroy = utils.createCheckDestroyed('TinyTextDiffer');
6
+
3
7
  /**
4
8
  * Represents the result of a single text segment comparison.
5
9
  * @typedef {Object} DiffResult
@@ -18,11 +22,16 @@ class TinyTextDiffer {
18
22
  /** @type {boolean} */
19
23
  #destroyed = false;
20
24
 
25
+ get destroyed() {
26
+ return this.#destroyed;
27
+ }
28
+
21
29
  /**
22
30
  * Retrieves a shallow copy of the current history array.
23
31
  * @returns {string[]}
24
32
  */
25
33
  get history() {
34
+ checkDestroy(this.#destroyed);
26
35
  return [...this.#history];
27
36
  }
28
37
 
@@ -31,6 +40,7 @@ class TinyTextDiffer {
31
40
  * @param {string[]} history
32
41
  */
33
42
  set history(history) {
43
+ checkDestroy(this.#destroyed);
34
44
  if (!Array.isArray(history)) {
35
45
  throw new TypeError('History data must be provided as an array.');
36
46
  }
@@ -46,6 +56,7 @@ class TinyTextDiffer {
46
56
  * @returns {number}
47
57
  */
48
58
  get size() {
59
+ checkDestroy(this.#destroyed);
49
60
  return this.#history.length;
50
61
  }
51
62
 
@@ -57,16 +68,6 @@ class TinyTextDiffer {
57
68
  this.history = history;
58
69
  }
59
70
 
60
- /**
61
- * @throws {Error}
62
- * @returns {void}
63
- */
64
- #checkDestroyed() {
65
- if (this.#destroyed) {
66
- throw new Error('Cannot perform operations on a destroyed TinyTextDiffer instance.');
67
- }
68
- }
69
-
70
71
  /**
71
72
  * @param {any} index
72
73
  * @throws {TypeError}
@@ -95,7 +96,7 @@ class TinyTextDiffer {
95
96
  * @returns {string}
96
97
  */
97
98
  get(index) {
98
- this.#checkDestroyed();
99
+ checkDestroy(this.#destroyed);
99
100
  this.#checkIndex(index);
100
101
  if (typeof this.#history[index] === 'undefined') {
101
102
  throw new Error(`No text version found at index ${index}.`);
@@ -109,7 +110,7 @@ class TinyTextDiffer {
109
110
  * @returns {boolean}
110
111
  */
111
112
  has(index) {
112
- this.#checkDestroyed();
113
+ checkDestroy(this.#destroyed);
113
114
  this.#checkIndex(index);
114
115
  return typeof this.#history[index] !== 'undefined';
115
116
  }
@@ -120,7 +121,7 @@ class TinyTextDiffer {
120
121
  * @returns {void}
121
122
  */
122
123
  add(text) {
123
- this.#checkDestroyed();
124
+ checkDestroy(this.#destroyed);
124
125
  this.#checkText(text);
125
126
  this.#history.push(text);
126
127
  }
@@ -130,7 +131,7 @@ class TinyTextDiffer {
130
131
  * @returns {string | undefined}
131
132
  */
132
133
  remove() {
133
- this.#checkDestroyed();
134
+ checkDestroy(this.#destroyed);
134
135
  return this.#history.pop();
135
136
  }
136
137
 
@@ -141,7 +142,7 @@ class TinyTextDiffer {
141
142
  * @returns {void}
142
143
  */
143
144
  addAt(index, text) {
144
- this.#checkDestroyed();
145
+ checkDestroy(this.#destroyed);
145
146
  this.#checkIndex(index);
146
147
  this.#checkText(text);
147
148
  this.#history.splice(index, 0, text);
@@ -153,7 +154,7 @@ class TinyTextDiffer {
153
154
  * @returns {boolean}
154
155
  */
155
156
  removeAt(index) {
156
- this.#checkDestroyed();
157
+ checkDestroy(this.#destroyed);
157
158
  this.#checkIndex(index);
158
159
  const oldSize = this.#history.length;
159
160
  this.#history.splice(index, 1);
@@ -166,7 +167,7 @@ class TinyTextDiffer {
166
167
  * @returns {void}
167
168
  */
168
169
  clear() {
169
- this.#checkDestroyed();
170
+ checkDestroy(this.#destroyed);
170
171
  this.#history = [];
171
172
  }
172
173
 
@@ -177,7 +178,7 @@ class TinyTextDiffer {
177
178
  * @returns {(DiffResult[])[]} An array of DiffResult arrays for each compared pair.
178
179
  */
179
180
  compare(...indexes) {
180
- this.#checkDestroyed();
181
+ checkDestroy(this.#destroyed);
181
182
 
182
183
  /** @type {number} */
183
184
  const totalIndexes = indexes.length;
@@ -1,7 +1,3 @@
1
- export default TinyTextDiffer;
2
- /**
3
- * Represents the result of a single text segment comparison.
4
- */
5
1
  export type DiffResult = {
6
2
  /**
7
3
  * - The actual string content of the segment.
@@ -23,26 +19,28 @@ export type DiffResult = {
23
19
  * between any two versions, generating a detailed diff output.
24
20
  */
25
21
  declare class TinyTextDiffer {
22
+ #private;
23
+ get destroyed(): boolean;
26
24
  /**
27
- * Initializes a new instance of TinyTextDiffer.
28
- * @param {string[]} [history=[]]
25
+ * Retrieves a shallow copy of the current history array.
26
+ * @returns {string[]}
29
27
  */
30
- constructor(history?: string[]);
28
+ get history(): string[];
31
29
  /**
32
30
  * Overwrites the current history array, ensuring all elements are valid strings.
33
31
  * @param {string[]} history
34
32
  */
35
33
  set history(history: string[]);
36
- /**
37
- * Retrieves a shallow copy of the current history array.
38
- * @returns {string[]}
39
- */
40
- get history(): string[];
41
34
  /**
42
35
  * Gets the total number of versions currently stored in the history.
43
36
  * @returns {number}
44
37
  */
45
38
  get size(): number;
39
+ /**
40
+ * Initializes a new instance of TinyTextDiffer.
41
+ * @param {string[]} [history=[]]
42
+ */
43
+ constructor(history?: string[]);
46
44
  /**
47
45
  * Retrieves the text string at the specified index.
48
46
  * @param {number} index
@@ -104,6 +102,6 @@ declare class TinyTextDiffer {
104
102
  * @returns {void}
105
103
  */
106
104
  destroy(): void;
107
- #private;
108
105
  }
106
+ export default TinyTextDiffer;
109
107
  //# sourceMappingURL=TinyTextDiffer.d.mts.map
@@ -1,3 +1,5 @@
1
+ import { createCheckDestroyed } from './utils.mjs';
2
+ const checkDestroy = createCheckDestroyed('TinyTextDiffer');
1
3
  /**
2
4
  * Represents the result of a single text segment comparison.
3
5
  * @typedef {Object} DiffResult
@@ -13,11 +15,15 @@ class TinyTextDiffer {
13
15
  #history = [];
14
16
  /** @type {boolean} */
15
17
  #destroyed = false;
18
+ get destroyed() {
19
+ return this.#destroyed;
20
+ }
16
21
  /**
17
22
  * Retrieves a shallow copy of the current history array.
18
23
  * @returns {string[]}
19
24
  */
20
25
  get history() {
26
+ checkDestroy(this.#destroyed);
21
27
  return [...this.#history];
22
28
  }
23
29
  /**
@@ -25,6 +31,7 @@ class TinyTextDiffer {
25
31
  * @param {string[]} history
26
32
  */
27
33
  set history(history) {
34
+ checkDestroy(this.#destroyed);
28
35
  if (!Array.isArray(history)) {
29
36
  throw new TypeError('History data must be provided as an array.');
30
37
  }
@@ -39,6 +46,7 @@ class TinyTextDiffer {
39
46
  * @returns {number}
40
47
  */
41
48
  get size() {
49
+ checkDestroy(this.#destroyed);
42
50
  return this.#history.length;
43
51
  }
44
52
  /**
@@ -48,15 +56,6 @@ class TinyTextDiffer {
48
56
  constructor(history = []) {
49
57
  this.history = history;
50
58
  }
51
- /**
52
- * @throws {Error}
53
- * @returns {void}
54
- */
55
- #checkDestroyed() {
56
- if (this.#destroyed) {
57
- throw new Error('Cannot perform operations on a destroyed TinyTextDiffer instance.');
58
- }
59
- }
60
59
  /**
61
60
  * @param {any} index
62
61
  * @throws {TypeError}
@@ -83,7 +82,7 @@ class TinyTextDiffer {
83
82
  * @returns {string}
84
83
  */
85
84
  get(index) {
86
- this.#checkDestroyed();
85
+ checkDestroy(this.#destroyed);
87
86
  this.#checkIndex(index);
88
87
  if (typeof this.#history[index] === 'undefined') {
89
88
  throw new Error(`No text version found at index ${index}.`);
@@ -96,7 +95,7 @@ class TinyTextDiffer {
96
95
  * @returns {boolean}
97
96
  */
98
97
  has(index) {
99
- this.#checkDestroyed();
98
+ checkDestroy(this.#destroyed);
100
99
  this.#checkIndex(index);
101
100
  return typeof this.#history[index] !== 'undefined';
102
101
  }
@@ -106,7 +105,7 @@ class TinyTextDiffer {
106
105
  * @returns {void}
107
106
  */
108
107
  add(text) {
109
- this.#checkDestroyed();
108
+ checkDestroy(this.#destroyed);
110
109
  this.#checkText(text);
111
110
  this.#history.push(text);
112
111
  }
@@ -115,7 +114,7 @@ class TinyTextDiffer {
115
114
  * @returns {string | undefined}
116
115
  */
117
116
  remove() {
118
- this.#checkDestroyed();
117
+ checkDestroy(this.#destroyed);
119
118
  return this.#history.pop();
120
119
  }
121
120
  /**
@@ -125,7 +124,7 @@ class TinyTextDiffer {
125
124
  * @returns {void}
126
125
  */
127
126
  addAt(index, text) {
128
- this.#checkDestroyed();
127
+ checkDestroy(this.#destroyed);
129
128
  this.#checkIndex(index);
130
129
  this.#checkText(text);
131
130
  this.#history.splice(index, 0, text);
@@ -136,7 +135,7 @@ class TinyTextDiffer {
136
135
  * @returns {boolean}
137
136
  */
138
137
  removeAt(index) {
139
- this.#checkDestroyed();
138
+ checkDestroy(this.#destroyed);
140
139
  this.#checkIndex(index);
141
140
  const oldSize = this.#history.length;
142
141
  this.#history.splice(index, 1);
@@ -148,7 +147,7 @@ class TinyTextDiffer {
148
147
  * @returns {void}
149
148
  */
150
149
  clear() {
151
- this.#checkDestroyed();
150
+ checkDestroy(this.#destroyed);
152
151
  this.#history = [];
153
152
  }
154
153
  /**
@@ -158,7 +157,7 @@ class TinyTextDiffer {
158
157
  * @returns {(DiffResult[])[]} An array of DiffResult arrays for each compared pair.
159
158
  */
160
159
  compare(...indexes) {
161
- this.#checkDestroyed();
160
+ checkDestroy(this.#destroyed);
162
161
  /** @type {number} */
163
162
  const totalIndexes = indexes.length;
164
163
  if (totalIndexes === 0 || totalIndexes % 2 !== 0) {