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
@@ -2,6 +2,9 @@
2
2
 
3
3
  var events = require('events');
4
4
  var objChecker = require('../basics/objChecker.cjs');
5
+ var utils = require('./utils.cjs');
6
+
7
+ const checkDestroy = utils.createCheckDestroyed('TinyLocalStorage');
5
8
 
6
9
  /** @type {Map<any, EncodeFn>} */
7
10
  const customEncoders = new Map();
@@ -216,6 +219,21 @@ class TinyLocalStorage extends events.EventEmitter {
216
219
 
217
220
  //////////////////////////////////////////////////////
218
221
 
222
+ /**
223
+ * Tracks whether the instance has been destroyed.
224
+ * @type {boolean}
225
+ */
226
+ #destroyed = false;
227
+
228
+ /**
229
+ * Gets the current destruction status of the instance.
230
+ *
231
+ * @returns {boolean} True if the instance is destroyed, false otherwise.
232
+ */
233
+ get destroyed() {
234
+ return this.#destroyed;
235
+ }
236
+
219
237
  /** @type {Storage} */
220
238
  #localStorage = window.localStorage;
221
239
 
@@ -267,6 +285,7 @@ class TinyLocalStorage extends events.EventEmitter {
267
285
  * @throws {TypeError} If `onUpgrade` is not a function.
268
286
  */
269
287
  updateStorageVersion(version, onUpgrade) {
288
+ checkDestroy(this.#destroyed);
270
289
  if (typeof this.#dbKey !== 'string')
271
290
  throw new Error(
272
291
  'TinyLocalStorage: Database key is not initialized. Set a valid dbName in the constructor.',
@@ -299,6 +318,7 @@ class TinyLocalStorage extends events.EventEmitter {
299
318
  * @returns {string|null} The database key, or null if not set.
300
319
  */
301
320
  getDbKey() {
321
+ checkDestroy(this.#destroyed);
302
322
  return this.#dbKey;
303
323
  }
304
324
 
@@ -308,6 +328,7 @@ class TinyLocalStorage extends events.EventEmitter {
308
328
  * @returns {number} The current version number.
309
329
  */
310
330
  getVersion() {
331
+ checkDestroy(this.#destroyed);
311
332
  return this.#version;
312
333
  }
313
334
 
@@ -317,6 +338,7 @@ class TinyLocalStorage extends events.EventEmitter {
317
338
  * @param {Storage} localstorage - A valid Storage object (localStorage or sessionStorage).
318
339
  */
319
340
  setLocalStorage(localstorage) {
341
+ checkDestroy(this.#destroyed);
320
342
  if (!(localstorage instanceof Storage))
321
343
  throw new TypeError('Argument must be a valid instance of Storage.');
322
344
  this.#localStorage = localstorage;
@@ -328,6 +350,7 @@ class TinyLocalStorage extends events.EventEmitter {
328
350
  * @returns {boolean} True if `localStorage` exists, false otherwise.
329
351
  */
330
352
  localStorageExists() {
353
+ checkDestroy(this.#destroyed);
331
354
  return this.#localStorage instanceof Storage;
332
355
  }
333
356
 
@@ -353,6 +376,7 @@ class TinyLocalStorage extends events.EventEmitter {
353
376
  * @param {LocalStorageJsonValue} data - The data to be serialized and stored.
354
377
  */
355
378
  setJson(name, data) {
379
+ checkDestroy(this.#destroyed);
356
380
  this.#isProtectedDbKey(name);
357
381
  if (
358
382
  !objChecker.isJsonObject(data) &&
@@ -415,6 +439,7 @@ class TinyLocalStorage extends events.EventEmitter {
415
439
  * @returns {LocalStorageJsonValue|null} The parsed object or fallback.
416
440
  */
417
441
  getJson(name, defaultData) {
442
+ checkDestroy(this.#destroyed);
418
443
  const { decoded, fallback } = this.#getJson(name, defaultData);
419
444
  if (
420
445
  decoded instanceof Map ||
@@ -432,6 +457,7 @@ class TinyLocalStorage extends events.EventEmitter {
432
457
  * @param {Date} data
433
458
  */
434
459
  setDate(name, data) {
460
+ checkDestroy(this.#destroyed);
435
461
  this.#isProtectedDbKey(name);
436
462
  if (!(data instanceof Date)) throw new TypeError('Value must be a Date.');
437
463
  const encoded = this.#setJson(name, data);
@@ -445,6 +471,7 @@ class TinyLocalStorage extends events.EventEmitter {
445
471
  * @returns {Date|null}
446
472
  */
447
473
  getDate(name) {
474
+ checkDestroy(this.#destroyed);
448
475
  const value = this.#getJson(name).decoded;
449
476
  return value instanceof Date ? value : null;
450
477
  }
@@ -455,6 +482,7 @@ class TinyLocalStorage extends events.EventEmitter {
455
482
  * @param {RegExp} data
456
483
  */
457
484
  setRegExp(name, data) {
485
+ checkDestroy(this.#destroyed);
458
486
  this.#isProtectedDbKey(name);
459
487
  if (!(data instanceof RegExp)) throw new TypeError('Value must be a RegExp.');
460
488
  const encoded = this.#setJson(name, data);
@@ -468,6 +496,7 @@ class TinyLocalStorage extends events.EventEmitter {
468
496
  * @returns {RegExp|null}
469
497
  */
470
498
  getRegExp(name) {
499
+ checkDestroy(this.#destroyed);
471
500
  const value = this.#getJson(name).decoded;
472
501
  return value instanceof RegExp ? value : null;
473
502
  }
@@ -478,6 +507,7 @@ class TinyLocalStorage extends events.EventEmitter {
478
507
  * @param {bigint} data
479
508
  */
480
509
  setBigInt(name, data) {
510
+ checkDestroy(this.#destroyed);
481
511
  this.#isProtectedDbKey(name);
482
512
  if (typeof data !== 'bigint') throw new TypeError('Value must be a BigInt.');
483
513
  const encoded = this.#setJson(name, data);
@@ -491,6 +521,7 @@ class TinyLocalStorage extends events.EventEmitter {
491
521
  * @returns {bigint|null}
492
522
  */
493
523
  getBigInt(name) {
524
+ checkDestroy(this.#destroyed);
494
525
  const value = this.#getJson(name).decoded;
495
526
  return typeof value === 'bigint' ? value : null;
496
527
  }
@@ -502,6 +533,7 @@ class TinyLocalStorage extends events.EventEmitter {
502
533
  * @param {symbol} data
503
534
  */
504
535
  setSymbol(name, data) {
536
+ checkDestroy(this.#destroyed);
505
537
  this.#isProtectedDbKey(name);
506
538
  if (typeof data !== 'symbol') throw new TypeError('Value must be a Symbol.');
507
539
  const encoded = this.#setJson(name, data);
@@ -515,6 +547,7 @@ class TinyLocalStorage extends events.EventEmitter {
515
547
  * @returns {symbol|null}
516
548
  */
517
549
  getSymbol(name) {
550
+ checkDestroy(this.#destroyed);
518
551
  const value = this.#getJson(name).decoded;
519
552
  return typeof value === 'symbol' ? value : null;
520
553
  }
@@ -526,6 +559,7 @@ class TinyLocalStorage extends events.EventEmitter {
526
559
  * @returns {any} The stored value or null if not found.
527
560
  */
528
561
  getValue(name) {
562
+ checkDestroy(this.#destroyed);
529
563
  return this.#getJson(name).decoded ?? null;
530
564
  }
531
565
 
@@ -536,6 +570,7 @@ class TinyLocalStorage extends events.EventEmitter {
536
570
  * @param {any} data - The data to store.
537
571
  */
538
572
  setItem(name, data) {
573
+ checkDestroy(this.#destroyed);
539
574
  this.#isProtectedDbKey(name);
540
575
  if (typeof name !== 'string' || !name.length)
541
576
  throw new TypeError('Key must be a non-empty string.');
@@ -550,6 +585,7 @@ class TinyLocalStorage extends events.EventEmitter {
550
585
  * @returns {string|null} The stored value or null if not found.
551
586
  */
552
587
  getItem(name) {
588
+ checkDestroy(this.#destroyed);
553
589
  if (typeof name !== 'string' || !name.length)
554
590
  throw new TypeError('Key must be a non-empty string.');
555
591
  return this.#localStorage.getItem(name);
@@ -562,6 +598,7 @@ class TinyLocalStorage extends events.EventEmitter {
562
598
  * @param {string} data - The string to store.
563
599
  */
564
600
  setString(name, data) {
601
+ checkDestroy(this.#destroyed);
565
602
  this.#isProtectedDbKey(name);
566
603
  if (typeof name !== 'string' || !name.length)
567
604
  throw new TypeError('Key must be a non-empty string.');
@@ -584,6 +621,7 @@ class TinyLocalStorage extends events.EventEmitter {
584
621
  * @returns {string|null} The string if valid, or null.
585
622
  */
586
623
  getString(name) {
624
+ checkDestroy(this.#destroyed);
587
625
  if (typeof name !== 'string' || !name.length)
588
626
  throw new TypeError('Key must be a non-empty string.');
589
627
  let value = this.#localStorage.getItem(name);
@@ -607,6 +645,7 @@ class TinyLocalStorage extends events.EventEmitter {
607
645
  * @param {number} data - The number to store.
608
646
  */
609
647
  setNumber(name, data) {
648
+ checkDestroy(this.#destroyed);
610
649
  this.#isProtectedDbKey(name);
611
650
  if (typeof name !== 'string' || !name.length)
612
651
  throw new TypeError('Key must be a non-empty string.');
@@ -622,6 +661,7 @@ class TinyLocalStorage extends events.EventEmitter {
622
661
  * @returns {number|null} The number or null if invalid.
623
662
  */
624
663
  getNumber(name) {
664
+ checkDestroy(this.#destroyed);
625
665
  if (typeof name !== 'string' || !name.length)
626
666
  throw new TypeError('Key must be a non-empty string.');
627
667
 
@@ -642,6 +682,7 @@ class TinyLocalStorage extends events.EventEmitter {
642
682
  * @param {boolean} data - The boolean value to store.
643
683
  */
644
684
  setBool(name, data) {
685
+ checkDestroy(this.#destroyed);
645
686
  this.#isProtectedDbKey(name);
646
687
  if (typeof name !== 'string' || !name.length)
647
688
  throw new TypeError('Key must be a non-empty string.');
@@ -657,6 +698,7 @@ class TinyLocalStorage extends events.EventEmitter {
657
698
  * @returns {boolean|null} The boolean or null if invalid.
658
699
  */
659
700
  getBool(name) {
701
+ checkDestroy(this.#destroyed);
660
702
  if (typeof name !== 'string' || !name.length)
661
703
  throw new TypeError('Key must be a non-empty string.');
662
704
 
@@ -676,6 +718,7 @@ class TinyLocalStorage extends events.EventEmitter {
676
718
  * @param {string} name - The key to remove.
677
719
  */
678
720
  removeItem(name) {
721
+ checkDestroy(this.#destroyed);
679
722
  if (typeof name !== 'string' || !name.length)
680
723
  throw new TypeError('Key must be a non-empty string.');
681
724
 
@@ -687,6 +730,7 @@ class TinyLocalStorage extends events.EventEmitter {
687
730
  * Clears all data from `localStorage`.
688
731
  */
689
732
  clearLocalStorage() {
733
+ checkDestroy(this.#destroyed);
690
734
  return this.#localStorage.clear();
691
735
  }
692
736
 
@@ -694,8 +738,12 @@ class TinyLocalStorage extends events.EventEmitter {
694
738
  * Destroys the storage instance by removing the storage event listener.
695
739
  */
696
740
  destroy() {
741
+ if (this.#destroyed) return;
697
742
  window.removeEventListener('storage', this.#storageEvent);
698
743
  this.removeAllListeners();
744
+
745
+ // Lock the instance
746
+ this.#destroyed = true;
699
747
  }
700
748
  }
701
749
 
@@ -1,11 +1,5 @@
1
- export default TinyLocalStorage;
2
- /**
3
- * A function that encodes a value into a serializable JSON-compatible format.
4
- */
1
+ import { EventEmitter } from 'events';
5
2
  export type EncodeFn = (value: any, encodeSpecialJson: encodeSpecialJson) => any;
6
- /**
7
- * An object that defines how to check and decode a specific serialized type.
8
- */
9
3
  export type DecodeFn = {
10
4
  /**
11
5
  * - Checks if the value matches the custom encoded structure.
@@ -16,25 +10,8 @@ export type DecodeFn = {
16
10
  */
17
11
  decode: (value: any, decodeSpecialJson: decodeSpecialJson) => any;
18
12
  };
19
- /**
20
- * Encodes extended JSON-compatible structures recursively.
21
- */
22
13
  export type encodeSpecialJson = (value: any) => any;
23
- /**
24
- * Decodes extended JSON-compatible structures recursively.
25
- */
26
14
  export type decodeSpecialJson = (value: any) => any;
27
- /**
28
- * Represents a value that can be safely stored and restored using JSON in `localStorage`,
29
- * including structures like arrays, plain objects, Map and Set.
30
- *
31
- * - `Record<string|number|symbol, any>` → plain object (e.g., `{ key: value }`)
32
- * - `any[]` → array of any JSON-serializable values
33
- * - `Map<string|number|symbol, any>` → converted to `{ __map__: true, data: [[k, v], ...] }`
34
- * - `Set<any>` → converted to `{ __set__: true, data: [v1, v2, ...] }`
35
- *
36
- * These conversions allow complex structures to be restored after JSON serialization.
37
- */
38
15
  export type LocalStorageJsonValue = (Record<string | number | symbol, any> | any[] | Map<string | number | symbol, any> | Set<any>);
39
16
  /**
40
17
  * A function that encodes a value into a serializable JSON-compatible format.
@@ -100,7 +77,8 @@ export type LocalStorageJsonValue = (Record<string | number | symbol, any> | any
100
77
  *
101
78
  * This class is suitable for applications that require structured persistence in the browser.
102
79
  */
103
- declare class TinyLocalStorage extends EventEmitter<any> {
80
+ declare class TinyLocalStorage extends EventEmitter {
81
+ #private;
104
82
  /**
105
83
  * Checks whether a JSON-serializable type is already registered.
106
84
  *
@@ -128,8 +106,12 @@ declare class TinyLocalStorage extends EventEmitter<any> {
128
106
  * @throws {Error} Throws an error if the type is frozen and cannot be unregistered.
129
107
  */
130
108
  static deleteJsonType(type: any): boolean;
131
- static encodeSpecialJson(value: any): any;
132
- static decodeSpecialJson(value: any): any;
109
+ /**
110
+ * Gets the current destruction status of the instance.
111
+ *
112
+ * @returns {boolean} True if the instance is destroyed, false otherwise.
113
+ */
114
+ get destroyed(): boolean;
133
115
  /**
134
116
  * Initializes the TinyLocalStorage instance and sets up cross-tab sync.
135
117
  *
@@ -189,7 +171,7 @@ declare class TinyLocalStorage extends EventEmitter<any> {
189
171
  * @param {'array'|'obj'|'map'|'set'|'null'} [defaultData] - Default fallback format if value is invalid.
190
172
  * @returns {LocalStorageJsonValue|null} The parsed object or fallback.
191
173
  */
192
- getJson(name: string, defaultData?: "array" | "obj" | "map" | "set" | "null"): LocalStorageJsonValue | null;
174
+ getJson(name: string, defaultData?: 'array' | 'obj' | 'map' | 'set' | 'null'): LocalStorageJsonValue | null;
193
175
  /**
194
176
  * Stores a Date in localStorage.
195
177
  * @param {string} name
@@ -316,7 +298,6 @@ declare class TinyLocalStorage extends EventEmitter<any> {
316
298
  * Destroys the storage instance by removing the storage event listener.
317
299
  */
318
300
  destroy(): void;
319
- #private;
320
301
  }
321
- import { EventEmitter } from 'events';
302
+ export default TinyLocalStorage;
322
303
  //# sourceMappingURL=TinyLocalStorage.d.mts.map
@@ -1,5 +1,7 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { isJsonObject } from '../basics/objChecker.mjs';
3
+ import { createCheckDestroyed } from './utils.mjs';
4
+ const checkDestroy = createCheckDestroyed('TinyLocalStorage');
3
5
  /** @type {Map<any, EncodeFn>} */
4
6
  const customEncoders = new Map();
5
7
  /** @type {Map<any, DecodeFn>} */
@@ -198,6 +200,19 @@ class TinyLocalStorage extends EventEmitter {
198
200
  return value;
199
201
  }
200
202
  //////////////////////////////////////////////////////
203
+ /**
204
+ * Tracks whether the instance has been destroyed.
205
+ * @type {boolean}
206
+ */
207
+ #destroyed = false;
208
+ /**
209
+ * Gets the current destruction status of the instance.
210
+ *
211
+ * @returns {boolean} True if the instance is destroyed, false otherwise.
212
+ */
213
+ get destroyed() {
214
+ return this.#destroyed;
215
+ }
201
216
  /** @type {Storage} */
202
217
  #localStorage = window.localStorage;
203
218
  /** @type {string|null} */
@@ -244,6 +259,7 @@ class TinyLocalStorage extends EventEmitter {
244
259
  * @throws {TypeError} If `onUpgrade` is not a function.
245
260
  */
246
261
  updateStorageVersion(version, onUpgrade) {
262
+ checkDestroy(this.#destroyed);
247
263
  if (typeof this.#dbKey !== 'string')
248
264
  throw new Error('TinyLocalStorage: Database key is not initialized. Set a valid dbName in the constructor.');
249
265
  if (typeof version !== 'number' || Number.isNaN(version) || version < 1)
@@ -268,6 +284,7 @@ class TinyLocalStorage extends EventEmitter {
268
284
  * @returns {string|null} The database key, or null if not set.
269
285
  */
270
286
  getDbKey() {
287
+ checkDestroy(this.#destroyed);
271
288
  return this.#dbKey;
272
289
  }
273
290
  /**
@@ -276,6 +293,7 @@ class TinyLocalStorage extends EventEmitter {
276
293
  * @returns {number} The current version number.
277
294
  */
278
295
  getVersion() {
296
+ checkDestroy(this.#destroyed);
279
297
  return this.#version;
280
298
  }
281
299
  /**
@@ -284,6 +302,7 @@ class TinyLocalStorage extends EventEmitter {
284
302
  * @param {Storage} localstorage - A valid Storage object (localStorage or sessionStorage).
285
303
  */
286
304
  setLocalStorage(localstorage) {
305
+ checkDestroy(this.#destroyed);
287
306
  if (!(localstorage instanceof Storage))
288
307
  throw new TypeError('Argument must be a valid instance of Storage.');
289
308
  this.#localStorage = localstorage;
@@ -294,6 +313,7 @@ class TinyLocalStorage extends EventEmitter {
294
313
  * @returns {boolean} True if `localStorage` exists, false otherwise.
295
314
  */
296
315
  localStorageExists() {
316
+ checkDestroy(this.#destroyed);
297
317
  return this.#localStorage instanceof Storage;
298
318
  }
299
319
  /**
@@ -317,6 +337,7 @@ class TinyLocalStorage extends EventEmitter {
317
337
  * @param {LocalStorageJsonValue} data - The data to be serialized and stored.
318
338
  */
319
339
  setJson(name, data) {
340
+ checkDestroy(this.#destroyed);
320
341
  this.#isProtectedDbKey(name);
321
342
  if (!isJsonObject(data) &&
322
343
  !Array.isArray(data) &&
@@ -371,6 +392,7 @@ class TinyLocalStorage extends EventEmitter {
371
392
  * @returns {LocalStorageJsonValue|null} The parsed object or fallback.
372
393
  */
373
394
  getJson(name, defaultData) {
395
+ checkDestroy(this.#destroyed);
374
396
  const { decoded, fallback } = this.#getJson(name, defaultData);
375
397
  if (decoded instanceof Map ||
376
398
  decoded instanceof Set ||
@@ -385,6 +407,7 @@ class TinyLocalStorage extends EventEmitter {
385
407
  * @param {Date} data
386
408
  */
387
409
  setDate(name, data) {
410
+ checkDestroy(this.#destroyed);
388
411
  this.#isProtectedDbKey(name);
389
412
  if (!(data instanceof Date))
390
413
  throw new TypeError('Value must be a Date.');
@@ -398,6 +421,7 @@ class TinyLocalStorage extends EventEmitter {
398
421
  * @returns {Date|null}
399
422
  */
400
423
  getDate(name) {
424
+ checkDestroy(this.#destroyed);
401
425
  const value = this.#getJson(name).decoded;
402
426
  return value instanceof Date ? value : null;
403
427
  }
@@ -407,6 +431,7 @@ class TinyLocalStorage extends EventEmitter {
407
431
  * @param {RegExp} data
408
432
  */
409
433
  setRegExp(name, data) {
434
+ checkDestroy(this.#destroyed);
410
435
  this.#isProtectedDbKey(name);
411
436
  if (!(data instanceof RegExp))
412
437
  throw new TypeError('Value must be a RegExp.');
@@ -420,6 +445,7 @@ class TinyLocalStorage extends EventEmitter {
420
445
  * @returns {RegExp|null}
421
446
  */
422
447
  getRegExp(name) {
448
+ checkDestroy(this.#destroyed);
423
449
  const value = this.#getJson(name).decoded;
424
450
  return value instanceof RegExp ? value : null;
425
451
  }
@@ -429,6 +455,7 @@ class TinyLocalStorage extends EventEmitter {
429
455
  * @param {bigint} data
430
456
  */
431
457
  setBigInt(name, data) {
458
+ checkDestroy(this.#destroyed);
432
459
  this.#isProtectedDbKey(name);
433
460
  if (typeof data !== 'bigint')
434
461
  throw new TypeError('Value must be a BigInt.');
@@ -442,6 +469,7 @@ class TinyLocalStorage extends EventEmitter {
442
469
  * @returns {bigint|null}
443
470
  */
444
471
  getBigInt(name) {
472
+ checkDestroy(this.#destroyed);
445
473
  const value = this.#getJson(name).decoded;
446
474
  return typeof value === 'bigint' ? value : null;
447
475
  }
@@ -452,6 +480,7 @@ class TinyLocalStorage extends EventEmitter {
452
480
  * @param {symbol} data
453
481
  */
454
482
  setSymbol(name, data) {
483
+ checkDestroy(this.#destroyed);
455
484
  this.#isProtectedDbKey(name);
456
485
  if (typeof data !== 'symbol')
457
486
  throw new TypeError('Value must be a Symbol.');
@@ -465,6 +494,7 @@ class TinyLocalStorage extends EventEmitter {
465
494
  * @returns {symbol|null}
466
495
  */
467
496
  getSymbol(name) {
497
+ checkDestroy(this.#destroyed);
468
498
  const value = this.#getJson(name).decoded;
469
499
  return typeof value === 'symbol' ? value : null;
470
500
  }
@@ -475,6 +505,7 @@ class TinyLocalStorage extends EventEmitter {
475
505
  * @returns {any} The stored value or null if not found.
476
506
  */
477
507
  getValue(name) {
508
+ checkDestroy(this.#destroyed);
478
509
  return this.#getJson(name).decoded ?? null;
479
510
  }
480
511
  /**
@@ -484,6 +515,7 @@ class TinyLocalStorage extends EventEmitter {
484
515
  * @param {any} data - The data to store.
485
516
  */
486
517
  setItem(name, data) {
518
+ checkDestroy(this.#destroyed);
487
519
  this.#isProtectedDbKey(name);
488
520
  if (typeof name !== 'string' || !name.length)
489
521
  throw new TypeError('Key must be a non-empty string.');
@@ -497,6 +529,7 @@ class TinyLocalStorage extends EventEmitter {
497
529
  * @returns {string|null} The stored value or null if not found.
498
530
  */
499
531
  getItem(name) {
532
+ checkDestroy(this.#destroyed);
500
533
  if (typeof name !== 'string' || !name.length)
501
534
  throw new TypeError('Key must be a non-empty string.');
502
535
  return this.#localStorage.getItem(name);
@@ -508,6 +541,7 @@ class TinyLocalStorage extends EventEmitter {
508
541
  * @param {string} data - The string to store.
509
542
  */
510
543
  setString(name, data) {
544
+ checkDestroy(this.#destroyed);
511
545
  this.#isProtectedDbKey(name);
512
546
  if (typeof name !== 'string' || !name.length)
513
547
  throw new TypeError('Key must be a non-empty string.');
@@ -526,6 +560,7 @@ class TinyLocalStorage extends EventEmitter {
526
560
  * @returns {string|null} The string if valid, or null.
527
561
  */
528
562
  getString(name) {
563
+ checkDestroy(this.#destroyed);
529
564
  if (typeof name !== 'string' || !name.length)
530
565
  throw new TypeError('Key must be a non-empty string.');
531
566
  let value = this.#localStorage.getItem(name);
@@ -551,6 +586,7 @@ class TinyLocalStorage extends EventEmitter {
551
586
  * @param {number} data - The number to store.
552
587
  */
553
588
  setNumber(name, data) {
589
+ checkDestroy(this.#destroyed);
554
590
  this.#isProtectedDbKey(name);
555
591
  if (typeof name !== 'string' || !name.length)
556
592
  throw new TypeError('Key must be a non-empty string.');
@@ -566,6 +602,7 @@ class TinyLocalStorage extends EventEmitter {
566
602
  * @returns {number|null} The number or null if invalid.
567
603
  */
568
604
  getNumber(name) {
605
+ checkDestroy(this.#destroyed);
569
606
  if (typeof name !== 'string' || !name.length)
570
607
  throw new TypeError('Key must be a non-empty string.');
571
608
  /** @type {number|string|null} */
@@ -586,6 +623,7 @@ class TinyLocalStorage extends EventEmitter {
586
623
  * @param {boolean} data - The boolean value to store.
587
624
  */
588
625
  setBool(name, data) {
626
+ checkDestroy(this.#destroyed);
589
627
  this.#isProtectedDbKey(name);
590
628
  if (typeof name !== 'string' || !name.length)
591
629
  throw new TypeError('Key must be a non-empty string.');
@@ -601,6 +639,7 @@ class TinyLocalStorage extends EventEmitter {
601
639
  * @returns {boolean|null} The boolean or null if invalid.
602
640
  */
603
641
  getBool(name) {
642
+ checkDestroy(this.#destroyed);
604
643
  if (typeof name !== 'string' || !name.length)
605
644
  throw new TypeError('Key must be a non-empty string.');
606
645
  const value = this.#localStorage.getItem(name);
@@ -620,6 +659,7 @@ class TinyLocalStorage extends EventEmitter {
620
659
  * @param {string} name - The key to remove.
621
660
  */
622
661
  removeItem(name) {
662
+ checkDestroy(this.#destroyed);
623
663
  if (typeof name !== 'string' || !name.length)
624
664
  throw new TypeError('Key must be a non-empty string.');
625
665
  this.emit('removeItem', name);
@@ -629,14 +669,19 @@ class TinyLocalStorage extends EventEmitter {
629
669
  * Clears all data from `localStorage`.
630
670
  */
631
671
  clearLocalStorage() {
672
+ checkDestroy(this.#destroyed);
632
673
  return this.#localStorage.clear();
633
674
  }
634
675
  /**
635
676
  * Destroys the storage instance by removing the storage event listener.
636
677
  */
637
678
  destroy() {
679
+ if (this.#destroyed)
680
+ return;
638
681
  window.removeEventListener('storage', this.#storageEvent);
639
682
  this.removeAllListeners();
683
+ // Lock the instance
684
+ this.#destroyed = true;
640
685
  }
641
686
  }
642
687
  // First registers
@@ -1,11 +1,27 @@
1
- export function defuzzifyCentroid(fuzzyOutput: {
2
- [x: string]: number;
3
- }, outputSets: FuzzySet[], step?: number): number;
4
- export function trapezoid(value: number, a: number, b: number, c: number, d: number, optimize?: boolean): number;
1
+ /**
2
+ * Performs defuzzification using the Centroid (Center of Gravity) method.
3
+ * @param {Object.<string, number>} fuzzyOutput - Results from rule evaluation.
4
+ * @param {FuzzySet[]} outputSets - The sets defining the output range.
5
+ * @param {number} [step=0.5] - Resolution of the integral approximation.
6
+ * @returns {number} The crisp output value.
7
+ */
8
+ export declare const defuzzifyCentroid: (fuzzyOutput: Record<string, number>, outputSets: FuzzySet[], step?: number) => number;
9
+ /**
10
+ * Utility to calculate fuzzy membership using a trapezoidal shape safely.
11
+ * @param {number} value - The input value to check.
12
+ * @param {number} a - Start of the rise.
13
+ * @param {number} b - End of the rise (start of plateau).
14
+ * @param {number} c - Start of the fall (end of plateau).
15
+ * @param {number} d - End of the fall.
16
+ * @param {boolean} [optimize=false] - Optimizes performance by skipping math for absolute bounds.
17
+ * @returns {number} Degree of membership [0, 1].
18
+ */
19
+ export declare const trapezoid: (value: number, a: number, b: number, c: number, d: number, optimize?: boolean) => number;
5
20
  /**
6
21
  * Represents a single Membership Function (Trapezoidal).
7
22
  */
8
- export class FuzzySet {
23
+ declare class FuzzySet {
24
+ #private;
9
25
  /**
10
26
  * Utility to calculate fuzzy membership using a trapezoidal shape.
11
27
  * @param {number} value - The input value to check.
@@ -17,6 +33,18 @@ export class FuzzySet {
17
33
  * @returns {number} Degree of membership [0, 1].
18
34
  */
19
35
  static trapezoid(value: number, a: number, b: number, c: number, d: number, optimize?: boolean): number;
36
+ get name(): string;
37
+ set name(value: string);
38
+ get a(): number;
39
+ set a(value: number);
40
+ get b(): number;
41
+ set b(value: number);
42
+ get c(): number;
43
+ set c(value: number);
44
+ get d(): number;
45
+ set d(value: number);
46
+ get optimize(): boolean;
47
+ set optimize(value: boolean);
20
48
  /**
21
49
  * @param {string} name - Name of the set (e.g., "Hot").
22
50
  * @param {number} a - Left foot.
@@ -26,30 +54,18 @@ export class FuzzySet {
26
54
  * @param {boolean} [optimize=false] - Enables performance optimization.
27
55
  */
28
56
  constructor(name: string, a: number, b: number, c: number, d: number, optimize?: boolean);
29
- set name(value: string);
30
- get name(): string;
31
- set a(value: number);
32
- get a(): number;
33
- set b(value: number);
34
- get b(): number;
35
- set c(value: number);
36
- get c(): number;
37
- set d(value: number);
38
- get d(): number;
39
- set optimize(value: boolean);
40
- get optimize(): boolean;
41
57
  /**
42
58
  * Calculates the membership degree.
43
59
  * @param {number} x - Crisp input.
44
60
  * @returns {number}
45
61
  */
46
62
  calculate(x: number): number;
47
- #private;
48
63
  }
49
64
  /**
50
65
  * The Inference Engine handles linguistic variables and defuzzification.
51
66
  */
52
- export class MamdaniInferenceSystem {
67
+ declare class MamdaniInferenceSystem {
68
+ #private;
53
69
  /**
54
70
  * Registers a linguistic variable and its sets.
55
71
  * @param {string} name - Variable name (e.g., "temperature").
@@ -80,9 +96,7 @@ export class MamdaniInferenceSystem {
80
96
  * @param {number} value
81
97
  * @returns {Object.<string, number>}
82
98
  */
83
- fuzzify(varName: string, value: number): {
84
- [x: string]: number;
85
- };
86
- #private;
99
+ fuzzify(varName: string, value: number): Record<string, number>;
87
100
  }
101
+ export { FuzzySet, MamdaniInferenceSystem };
88
102
  //# sourceMappingURL=TinyMamdaniInferenceSystem.d.mts.map