@rzl-zone/utils-js 3.13.1 → 3.14.0-beta.0

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 (281) hide show
  1. package/README.md +7 -6
  2. package/dist/.references/index.d.cts +2 -1
  3. package/dist/.references/index.d.ts +2 -1
  4. package/dist/AbortError-DK6kpzbu.cjs +26 -0
  5. package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
  6. package/dist/AbortError-DVT8lAKn.js +20 -0
  7. package/dist/AbortError-DVT8lAKn.js.map +1 -0
  8. package/dist/{assertIsArray-HgzPQIAM.js → assertIsArray-CG7L7vlt.js} +3 -3
  9. package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
  10. package/dist/{assertIsArray-CeXL4xv5.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
  11. package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
  12. package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
  13. package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
  14. package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
  15. package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
  16. package/dist/{assertIsString-CY_WkCLr.js → assertIsString-CHIwE12y.js} +4 -4
  17. package/dist/assertIsString-CHIwE12y.js.map +1 -0
  18. package/dist/{assertIsString-DUrVt82d.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
  19. package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
  20. package/dist/assertions/index.cjs +14 -12
  21. package/dist/assertions/index.cjs.map +1 -1
  22. package/dist/assertions/index.d.cts +2 -2
  23. package/dist/assertions/index.d.ts +2 -2
  24. package/dist/assertions/index.js +10 -8
  25. package/dist/assertions/index.js.map +1 -1
  26. package/dist/conversions/index.cjs +6 -6
  27. package/dist/conversions/index.d.cts +2 -2
  28. package/dist/conversions/index.d.ts +2 -2
  29. package/dist/conversions/index.js +6 -6
  30. package/dist/conversions-BFz6MKaV.cjs +449 -0
  31. package/dist/conversions-BFz6MKaV.cjs.map +1 -0
  32. package/dist/{conversions-1s7xMBe_.js → conversions-Ben5p5Ts.js} +43 -40
  33. package/dist/conversions-Ben5p5Ts.js.map +1 -0
  34. package/dist/errors/index.cjs +13 -0
  35. package/dist/errors/index.d.cts +180 -0
  36. package/dist/errors/index.d.ts +180 -0
  37. package/dist/errors/index.js +11 -0
  38. package/dist/events/index.cjs +10 -9
  39. package/dist/events/index.cjs.map +1 -1
  40. package/dist/events/index.d.cts +185 -100
  41. package/dist/events/index.d.ts +185 -100
  42. package/dist/events/index.js +9 -8
  43. package/dist/events/index.js.map +1 -1
  44. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
  45. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
  46. package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
  47. package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
  48. package/dist/formatters/index.cjs +2 -2
  49. package/dist/formatters/index.d.cts +2 -2
  50. package/dist/formatters/index.d.ts +2 -2
  51. package/dist/formatters/index.js +2 -2
  52. package/dist/{formatters-C6cVZBbG.js → formatters-BAbGsnYA.js} +78 -71
  53. package/dist/formatters-BAbGsnYA.js.map +1 -0
  54. package/dist/formatters-zd0Gs4Cs.cjs +436 -0
  55. package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
  56. package/dist/generators/index.cjs +37 -31
  57. package/dist/generators/index.cjs.map +1 -1
  58. package/dist/generators/index.d.cts +2 -2
  59. package/dist/generators/index.d.ts +2 -2
  60. package/dist/generators/index.js +29 -23
  61. package/dist/generators/index.js.map +1 -1
  62. package/dist/hasOwnProp-CVIhlD1i.js +47 -0
  63. package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
  64. package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
  65. package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
  66. package/dist/{index-RNQBTK8A.d.cts → index-9JsU_wMu.d.ts} +1375 -937
  67. package/dist/{index-ORbo-7zA.d.cts → index-BP3sUrAx.d.ts} +242 -133
  68. package/dist/{index-BG8wdusZ.d.cts → index-BVovC-yK.d.cts} +229 -200
  69. package/dist/index-C1X6ha9s.d.cts +1041 -0
  70. package/dist/index-CcPQZ41G.d.cts +1103 -0
  71. package/dist/index-CjpbuJF4.d.ts +2424 -0
  72. package/dist/index-CssrQyHh.d.cts +2424 -0
  73. package/dist/index-DZHiYYR7.d.cts +2179 -0
  74. package/dist/index-DZHiYYR7.d.ts +2179 -0
  75. package/dist/index-DlyDmXUo.d.ts +1103 -0
  76. package/dist/index-Dm4a___O.d.ts +1041 -0
  77. package/dist/{index-CRz9rSZL.d.ts → index-Dwduk7ez.d.cts} +1375 -937
  78. package/dist/{index-DPJ-e2JZ.d.ts → index-I5V6RbZM.d.cts} +1592 -790
  79. package/dist/{index-B5EBAgmC.d.cts → index-hOqBIL7F.d.ts} +1592 -790
  80. package/dist/{index-B1VQ6USF.d.ts → index-jyuOZMX7.d.ts} +229 -200
  81. package/dist/{index-ORbo-7zA.d.ts → index-lI0b7iUz.d.cts} +242 -133
  82. package/dist/{isBigInt-y7s3rsKc.js → isBigInt-Cez32M69.js} +2 -2
  83. package/dist/isBigInt-Cez32M69.js.map +1 -0
  84. package/dist/{isBigInt-BVj0M5pq.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
  85. package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
  86. package/dist/{isEmptyString-BYMz_wt9.js → isEmptyString-C9QLWjx2.js} +4 -4
  87. package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
  88. package/dist/{isEmptyString-C8PYNPgw.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
  89. package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
  90. package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
  91. package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
  92. package/dist/isEmptyValue-kCjnLjbN.js +36 -0
  93. package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
  94. package/dist/{isFinite-DeDaBDr2.cjs → isFinite-B_hHbDpa.cjs} +6 -6
  95. package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
  96. package/dist/{isFinite-BEJFOv6B.js → isFinite-ZvNhyHlF.js} +5 -5
  97. package/dist/isFinite-ZvNhyHlF.js.map +1 -0
  98. package/dist/{isInteger-DEDbBGez.js → isInteger-aZgzTTZG.js} +4 -4
  99. package/dist/isInteger-aZgzTTZG.js.map +1 -0
  100. package/dist/{isInteger-CQLThJOR.cjs → isInteger-dnc6W63Z.cjs} +4 -4
  101. package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
  102. package/dist/isNumber-BCWD4dW0.js +20 -0
  103. package/dist/isNumber-BCWD4dW0.js.map +1 -0
  104. package/dist/isNumber-BkzwAe50.cjs +26 -0
  105. package/dist/isNumber-BkzwAe50.cjs.map +1 -0
  106. package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
  107. package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
  108. package/dist/{isServer-q3o6cSwD.js → isServer-CQzrX5e0.js} +2 -2
  109. package/dist/isServer-CQzrX5e0.js.map +1 -0
  110. package/dist/{isServer-DmycqWsF.cjs → isServer-DhFaedeT.cjs} +2 -2
  111. package/dist/isServer-DhFaedeT.cjs.map +1 -0
  112. package/dist/{isEqual-DaPDxMyw.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
  113. package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
  114. package/dist/{isEqual-DM4S_kWh.js → isTypedArray-DxsPKrLh.js} +29 -9
  115. package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
  116. package/dist/{isValidDomain-B8Nukgw0.js → isValidDomain-CDtNOhMc.js} +13 -54
  117. package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
  118. package/dist/{isValidDomain-ZbyeGOO9.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
  119. package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
  120. package/dist/{assertIsBoolean-CWUs-I5l.js → logger-CLWnKRKE.js} +657 -587
  121. package/dist/logger-CLWnKRKE.js.map +1 -0
  122. package/dist/{assertIsBoolean-D41HrTB_.cjs → logger-CUacYy3D.cjs} +658 -612
  123. package/dist/logger-CUacYy3D.cjs.map +1 -0
  124. package/dist/{noop-BY43WaoU.cjs → noop-CjEbNsJL.cjs} +2 -2
  125. package/dist/noop-CjEbNsJL.cjs.map +1 -0
  126. package/dist/{noop-CjY8xVHv.js → noop-qxrcogt5.js} +2 -2
  127. package/dist/noop-qxrcogt5.js.map +1 -0
  128. package/dist/{normalizeSpaces-BhZp0U_6.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
  129. package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
  130. package/dist/{normalizeSpaces-BoUDtq5P.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
  131. package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
  132. package/dist/operations/index.cjs +152 -22
  133. package/dist/operations/index.cjs.map +1 -1
  134. package/dist/operations/index.d.cts +257 -35
  135. package/dist/operations/index.d.ts +257 -35
  136. package/dist/operations/index.js +142 -13
  137. package/dist/operations/index.js.map +1 -1
  138. package/dist/parsers/index.cjs +2 -2
  139. package/dist/parsers/index.d.cts +238 -180
  140. package/dist/parsers/index.d.ts +238 -180
  141. package/dist/parsers/index.js +2 -2
  142. package/dist/{parsers-B8KYXIjE.js → parsers-BBAE_xVM.js} +9 -8
  143. package/dist/parsers-BBAE_xVM.js.map +1 -0
  144. package/dist/{parsers-B_FPX35n.cjs → parsers-i8WEeMJl.cjs} +10 -9
  145. package/dist/parsers-i8WEeMJl.cjs.map +1 -0
  146. package/dist/{parsing-Bfaw85Hd.js → parsing-D9tbKQ0v.js} +3 -3
  147. package/dist/parsing-D9tbKQ0v.js.map +1 -0
  148. package/dist/{parsing-BCZGco7n.cjs → parsing-DGjB8cwr.cjs} +4 -4
  149. package/dist/parsing-DGjB8cwr.cjs.map +1 -0
  150. package/dist/predicates/index.cjs +43 -43
  151. package/dist/predicates/index.d.cts +3 -3
  152. package/dist/predicates/index.d.ts +3 -3
  153. package/dist/predicates/index.js +14 -14
  154. package/dist/{predicates-KlyOvBSC.js → predicates-C0dova7l.js} +45 -40
  155. package/dist/predicates-C0dova7l.js.map +1 -0
  156. package/dist/{predicates-8y28VrbT.cjs → predicates-Dd7To7B4.cjs} +89 -84
  157. package/dist/predicates-Dd7To7B4.cjs.map +1 -0
  158. package/dist/promises/index.cjs +27 -26
  159. package/dist/promises/index.cjs.map +1 -1
  160. package/dist/promises/index.d.cts +227 -75
  161. package/dist/promises/index.d.ts +227 -75
  162. package/dist/promises/index.js +27 -26
  163. package/dist/promises/index.js.map +1 -1
  164. package/dist/{punyCode-DnKi0qjS.cjs → punyCode-DHTLhGdD.cjs} +12 -12
  165. package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
  166. package/dist/{punyCode-Dwto1RpA.js → punyCode-Deb1Mrkc.js} +12 -12
  167. package/dist/punyCode-Deb1Mrkc.js.map +1 -0
  168. package/dist/{removeSpaces--8NW-HSx.js → removeSpaces-BPnsdRN0.js} +4 -4
  169. package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
  170. package/dist/{removeSpaces-CmrrkeXz.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
  171. package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
  172. package/dist/rzl-utils.global.js +13 -13
  173. package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
  174. package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
  175. package/dist/{safeJsonParse-OnUwG2El.js → safeJsonParse-DEVKNDSn.js} +29 -28
  176. package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
  177. package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
  178. package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
  179. package/dist/{safeStableStringify-B2KTTS3r.js → safeStableStringify-DfwxmiWn.js} +20 -13
  180. package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
  181. package/dist/strings/index.cjs +26 -30
  182. package/dist/strings/index.cjs.map +1 -1
  183. package/dist/strings/index.d.cts +2 -2
  184. package/dist/strings/index.d.ts +2 -2
  185. package/dist/strings/index.js +13 -17
  186. package/dist/strings/index.js.map +1 -1
  187. package/dist/tailwind/index.cjs +3 -3
  188. package/dist/tailwind/index.d.cts +3 -3
  189. package/dist/tailwind/index.d.ts +3 -3
  190. package/dist/tailwind/index.js +3 -3
  191. package/dist/{tailwind-DUuboq52.cjs → tailwind-BG7B0cDs.cjs} +59 -53
  192. package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
  193. package/dist/{tailwind-CUdmv-oO.js → tailwind-tJNnFPsF.js} +38 -32
  194. package/dist/tailwind-tJNnFPsF.js.map +1 -0
  195. package/dist/{toStringArrayUnRecursive-OOHGazks.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
  196. package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
  197. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
  198. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
  199. package/dist/urls/index.cjs +3 -3
  200. package/dist/urls/index.d.cts +635 -443
  201. package/dist/urls/index.d.ts +635 -443
  202. package/dist/urls/index.js +3 -3
  203. package/dist/{urls-BXT4Krsq.js → urls-EoWslGgg.js} +50 -41
  204. package/dist/urls-EoWslGgg.js.map +1 -0
  205. package/dist/urls-NCzPepe2.cjs +308 -0
  206. package/dist/urls-NCzPepe2.cjs.map +1 -0
  207. package/package.json +6 -6
  208. package/dist/assertIsArray-CeXL4xv5.cjs.map +0 -1
  209. package/dist/assertIsArray-HgzPQIAM.js.map +0 -1
  210. package/dist/assertIsBoolean-CWUs-I5l.js.map +0 -1
  211. package/dist/assertIsBoolean-D41HrTB_.cjs.map +0 -1
  212. package/dist/assertIsString-CY_WkCLr.js.map +0 -1
  213. package/dist/assertIsString-DUrVt82d.cjs.map +0 -1
  214. package/dist/conversions-1s7xMBe_.js.map +0 -1
  215. package/dist/conversions-B3Rf8uId.cjs +0 -446
  216. package/dist/conversions-B3Rf8uId.cjs.map +0 -1
  217. package/dist/formatters-C6cVZBbG.js.map +0 -1
  218. package/dist/formatters-aEAAuzjx.cjs +0 -429
  219. package/dist/formatters-aEAAuzjx.cjs.map +0 -1
  220. package/dist/index-CPCt6_Wq.d.cts +0 -765
  221. package/dist/index-CPCt6_Wq.d.ts +0 -765
  222. package/dist/index-DBwNa1iO.d.ts +0 -947
  223. package/dist/index-DPTYOQkn.d.cts +0 -947
  224. package/dist/index-Dig1fIhZ.d.cts +0 -1716
  225. package/dist/index-Dig1fIhZ.d.ts +0 -1716
  226. package/dist/isBigInt-BVj0M5pq.cjs.map +0 -1
  227. package/dist/isBigInt-y7s3rsKc.js.map +0 -1
  228. package/dist/isEmptyObject-BsHngDz4.cjs +0 -37
  229. package/dist/isEmptyObject-BsHngDz4.cjs.map +0 -1
  230. package/dist/isEmptyObject-DPGR9iPj.js +0 -25
  231. package/dist/isEmptyObject-DPGR9iPj.js.map +0 -1
  232. package/dist/isEmptyString-BYMz_wt9.js.map +0 -1
  233. package/dist/isEmptyString-C8PYNPgw.cjs.map +0 -1
  234. package/dist/isEmptyValue-BXf7f1jz.cjs +0 -30
  235. package/dist/isEmptyValue-BXf7f1jz.cjs.map +0 -1
  236. package/dist/isEmptyValue-D4OHTB3u.js +0 -24
  237. package/dist/isEmptyValue-D4OHTB3u.js.map +0 -1
  238. package/dist/isEqual-DM4S_kWh.js.map +0 -1
  239. package/dist/isEqual-DaPDxMyw.cjs.map +0 -1
  240. package/dist/isFinite-BEJFOv6B.js.map +0 -1
  241. package/dist/isFinite-DeDaBDr2.cjs.map +0 -1
  242. package/dist/isInteger-CQLThJOR.cjs.map +0 -1
  243. package/dist/isInteger-DEDbBGez.js.map +0 -1
  244. package/dist/isPlainObject-BwTkj3G0.d.cts +0 -339
  245. package/dist/isPlainObject-BwTkj3G0.d.ts +0 -339
  246. package/dist/isServer-DmycqWsF.cjs.map +0 -1
  247. package/dist/isServer-q3o6cSwD.js.map +0 -1
  248. package/dist/isTypedArray-BQLbLXsU.cjs +0 -43
  249. package/dist/isTypedArray-BQLbLXsU.cjs.map +0 -1
  250. package/dist/isTypedArray-XiBnifLN.js +0 -31
  251. package/dist/isTypedArray-XiBnifLN.js.map +0 -1
  252. package/dist/isValidDomain-B8Nukgw0.js.map +0 -1
  253. package/dist/isValidDomain-ZbyeGOO9.cjs.map +0 -1
  254. package/dist/noop-BY43WaoU.cjs.map +0 -1
  255. package/dist/noop-CjY8xVHv.js.map +0 -1
  256. package/dist/normalizeSpaces-BhZp0U_6.cjs.map +0 -1
  257. package/dist/normalizeSpaces-BoUDtq5P.js.map +0 -1
  258. package/dist/parsers-B8KYXIjE.js.map +0 -1
  259. package/dist/parsers-B_FPX35n.cjs.map +0 -1
  260. package/dist/parsing-BCZGco7n.cjs.map +0 -1
  261. package/dist/parsing-Bfaw85Hd.js.map +0 -1
  262. package/dist/predicates-8y28VrbT.cjs.map +0 -1
  263. package/dist/predicates-KlyOvBSC.js.map +0 -1
  264. package/dist/punyCode-DnKi0qjS.cjs.map +0 -1
  265. package/dist/punyCode-Dwto1RpA.js.map +0 -1
  266. package/dist/removeSpaces--8NW-HSx.js.map +0 -1
  267. package/dist/removeSpaces-CmrrkeXz.cjs.map +0 -1
  268. package/dist/safeJsonParse-OnUwG2El.js.map +0 -1
  269. package/dist/safeJsonParse-sFqVXf-e.cjs +0 -208
  270. package/dist/safeJsonParse-sFqVXf-e.cjs.map +0 -1
  271. package/dist/safeStableStringify-B2KTTS3r.js.map +0 -1
  272. package/dist/safeStableStringify-Cmi6GyWj.cjs +0 -106
  273. package/dist/safeStableStringify-Cmi6GyWj.cjs.map +0 -1
  274. package/dist/tailwind-CUdmv-oO.js.map +0 -1
  275. package/dist/tailwind-DUuboq52.cjs.map +0 -1
  276. package/dist/toStringArrayUnRecursive-OOHGazks.js.map +0 -1
  277. package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs +0 -51
  278. package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs.map +0 -1
  279. package/dist/urls-BL9C_yU3.cjs +0 -299
  280. package/dist/urls-BL9C_yU3.cjs.map +0 -1
  281. package/dist/urls-BXT4Krsq.js.map +0 -1
@@ -2,20 +2,21 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.13.1`
5
+ * Version: `3.14.0-beta.0`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
8
  * ========================================================================
9
9
  */
10
10
  "use strict";
11
11
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
12
- const require_assertIsBoolean = require('../assertIsBoolean-D41HrTB_.cjs');
13
- const require_assertIsString = require('../assertIsString-DUrVt82d.cjs');
14
- const require_isServer = require('../isServer-DmycqWsF.cjs');
12
+ const require_logger = require('../logger-CUacYy3D.cjs');
13
+ const require_isNumber = require('../isNumber-BkzwAe50.cjs');
14
+ const require_assertIsString = require('../assertIsString-CjE9kbQ_.cjs');
15
+ const require_isServer = require('../isServer-DhFaedeT.cjs');
15
16
  const disableUserInteraction = (className = "on_processing") => {
16
17
  if (require_isServer.isServer()) return;
17
18
  require_assertIsString.assertIsString(className, { message({ validType, currentType }) {
18
- return `First parameter \`className\` must be of type \`${validType}\`, but received: \`${currentType}\`.`;
19
+ return require_logger.createMessage("disableUserInteraction", `First parameter \`className\` must be of type \`${validType}\`, but received: \`${currentType}\`.`);
19
20
  } });
20
21
  const { documentElement } = document;
21
22
  if (documentElement && !documentElement.classList.contains(className)) documentElement.classList.add(className);
@@ -23,7 +24,7 @@ const disableUserInteraction = (className = "on_processing") => {
23
24
  const enableUserInteraction = (className = "on_processing") => {
24
25
  if (require_isServer.isServer()) return;
25
26
  require_assertIsString.assertIsString(className, { message({ validType, currentType }) {
26
- return `First parameter \`className\` must be of type \`${validType}\`, but received: \`${currentType}\`.`;
27
+ return require_logger.createMessage("enableUserInteraction", `First parameter \`className\` must be of type \`${validType}\`, but received: \`${currentType}\`.`);
27
28
  } });
28
29
  const { documentElement } = document;
29
30
  if (documentElement && documentElement.classList.contains(className)) documentElement.classList.remove(className);
@@ -35,13 +36,13 @@ const removeElementFocus = () => {
35
36
  };
36
37
  const scrollToTop = (options) => {
37
38
  if (require_isServer.isServer()) return;
38
- if (!require_assertIsBoolean.isPlainObject(options)) options = {};
39
- const behavior = require_assertIsBoolean.hasOwnProp(options, "behavior") && require_assertIsBoolean.isNonEmptyString(options.behavior) && [
39
+ if (!require_logger.isPlainObject(options)) options = {};
40
+ const behavior = options.behavior && require_logger.isNonEmptyString(options.behavior) && [
40
41
  "auto",
41
42
  "instant",
42
43
  "smooth"
43
44
  ].includes(options.behavior) ? options.behavior : "smooth";
44
- let timeout = require_assertIsBoolean.hasOwnProp(options, "timeout") && require_assertIsBoolean.isNumber(options.timeout) && options.timeout >= 1 ? options.timeout : 1;
45
+ let timeout = options.timeout && require_isNumber.isNumber(options.timeout) && options.timeout >= 1 ? options.timeout : 1;
45
46
  timeout = timeout > 2147483647 ? 2147483647 : timeout;
46
47
  setTimeout(() => window.scrollTo({
47
48
  top: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["isServer","isServer","isServer","isServer","isPlainObject","hasOwnProp","isNonEmptyString","isNumber"],"sources":["../../src/events/actions/disableUserInteraction.ts","../../src/events/actions/enableUserInteraction.ts","../../src/events/actions/removeElementFocus.ts","../../src/events/actions/scrollToTop.ts"],"sourcesContent":["import { isServer } from \"@/predicates/is/isServer\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `disableUserInteraction`.***\n * ----------------------------------------------------------\n * **Disables user interaction by adding a CSS class to the `<html>` element.**\n * - **Key points**:\n * - Works **only in browser environments**.\n * - Safely adds the specified CSS class to `<html>`.\n * - Prevents multiple additions of the same class.\n * - Useful to indicate that a process is ongoing\n * (e.g., loading or processing state).\n * - **Using custom CSS classes:**\n * - You can pass any class name that exists in your CSS.\n * - Example: if you have `.loading` in your styles, passing `\"loading\"`\n * will add it and disable interactions accordingly.\n * - **Validation:**\n * - Throws `TypeError` if the `className` parameter is not a string.\n * @defaultValue `\"on_processing\"`\n * @param {string} [className=\"on_processing\"] - The CSS class to add, defaults to `\"on_processing\"`.\n * @returns {void} Does not return anything (void).\n * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.\n * @example\n * * ***Example in your code:***\n * ```ts\n * disableUserInteraction(); // ➔ Adds \"on_processing\" class\n * disableUserInteraction(\"loading\"); // ➔ Adds \"loading\" class\n * // ❌ Invalid value:\n * disableUserInteraction(123); // ➔ Throws TypeError\n * ```\n * * ***Example in your css file (with defaultValue `className` props [on_processing]):***\n * ```css\n * .on_processing {\n * cursor: wait;\n * touch-action: none;\n * user-select: none;\n * }\n *\n * .on_processing > * {\n * pointer-events: none;\n * touch-action: none;\n * user-select: none;\n * }\n * ```\n */\nexport const disableUserInteraction = (\n className: string = \"on_processing\"\n): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n assertIsString(className, {\n message({ validType, currentType }) {\n return `First parameter \\`className\\` must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n const { documentElement } = document;\n\n if (documentElement && !documentElement.classList.contains(className)) {\n documentElement.classList.add(className);\n }\n};\n","import { isServer } from \"@/predicates/is/isServer\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `enableUserInteraction`.***\n * ----------------------------------------------------------\n * **Enables user interaction by removing a CSS class from the `<html>` element.**\n * - **Key points**:\n * - Works **only in browser environments**.\n * - Safely removes the specified CSS class from `<html>`.\n * - Does nothing if the class is not present.\n * - Useful to re-enable user interactions after a process\n * (e.g., loading or processing) completes.\n * - **Using custom CSS classes:**\n * - You can pass any class name that exists in your CSS.\n * - Example: if you have `.loading` in your styles, passing `\"loading\"`\n * will remove it and re-enable interactions.\n * - **Validation:**\n * - Throws `TypeError` if the `className` parameter is not a string.\n * @defaultValue `\"on_processing\"`\n * @param {string} [className=\"on_processing\"] - The CSS class to remove, defaults to `\"on_processing\"`.\n * @returns {void} Does not return anything (void).\n * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.\n * @example\n * * ***Example in your code:***\n * ```ts\n * enableUserInteraction(); // ➔ Removes \"on_processing\" class\n * enableUserInteraction(\"loading\"); // ➔ Removes \"loading\" class\n * // ❌ Invalid value:\n * enableUserInteraction(123); // ➔ Throws TypeError\n * ```\n * * ***Example in your css file (with defaultValue `className` props [on_processing]):***\n * ```css\n * .on_processing {\n * cursor: wait;\n * touch-action: none;\n * user-select: none;\n * }\n *\n * .on_processing > * {\n * pointer-events: none;\n * touch-action: none;\n * user-select: none;\n * }\n * ```\n */\nexport const enableUserInteraction = (\n className: string = \"on_processing\"\n): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n assertIsString(className, {\n message({ validType, currentType }) {\n return `First parameter \\`className\\` must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n const { documentElement } = document;\n\n if (documentElement && documentElement.classList.contains(className)) {\n documentElement.classList.remove(className);\n }\n};\n","import { isServer } from \"@/predicates/is/isServer\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `removeElementFocus`.***\n * ----------------------------------------------------------\n * **Removes focus from the currently active element in the document.**\n * - **Features**:\n * - This function works **only in browser environments** ***(safely no-ops in server environments)***.\n * - If an element is focused, it will lose focus by calling `HTMLElement.blur()`.\n * - If no element is focused or the active element is not an `HTMLElement`, nothing happens.\n * @returns {void} Does not return anything (void).\n * @example\n * removeElementFocus(); // ➔ Removes focus from the currently active element\n */\nexport const removeElementFocus = (): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n const activeElement = document.activeElement;\n\n if (activeElement instanceof HTMLElement) {\n activeElement.blur();\n } else {\n // not-support, currently we nothing to do...\n // console.warn(\"removeElementFocus: No active element to blur or unsupported element type.\");\n }\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { isServer } from \"@/predicates/is/isServer\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/**\n * ***Types options for {@link scrollToTop | `scrollToTop`}.***\n */\ntype ScrollToTopOptions = {\n /** ----------------------------------------------------------\n * * ***Scroll animation type.***\n * ----------------------------------------------------------\n * - ***Behavior:***\n * - Valid values: `\"auto\"`, `\"instant\"`, `\"smooth\"`.\n * - Default force to `\"smooth\"` if missing or invalid.\n *\n * @default \"smooth\"\n */\n behavior?: ScrollBehavior | undefined;\n /** ----------------------------------------------------------\n * * ***Delay before scrolling (in milliseconds).***\n * ----------------------------------------------------------\n * - ***Behavior:***\n * - Default value is `1`.\n * - Valid values: any number `≥` `1`.\n * - Non-integer number are truncated to an integer.\n * - Force to `2147483647` if number is larger than `2147483647`.\n * - Default force to `1` if `missing`, `NaN`, `invalid-type`, or `less-than` `1`.\n *\n * @default 1\n */\n timeout?: number | undefined;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `scrollToTop`.***\n * ----------------------------------------------------------\n * **Scrolls the page to the top with optional smooth animation and delay.**\n * - **Features**:\n * - This function works **only in browser environments** (no effect on server-side).\n * - It leverages the native `window.scrollTo()` API with support for smooth scrolling\n * and an optional timeout delay before executing the scroll.\n * - Each option has strict valid values.\n * - If an invalid value is provided, the function **automatically falls back to its default**.\n * @param {ScrollToTopOptions} [options] - Optional settings for scroll behavior.\n * @param {ScrollToTopOptions[\"behavior\"]} [options.behavior=\"smooth\"] - Scroll animation type.\n * - Valid values: `\"auto\"`, `\"instant\"`, `\"smooth\"`.\n * - Default force to `\"smooth\"` if missing or invalid.\n * @param {ScrollToTopOptions[\"timeout\"]} [options.timeout=1] - Delay before scrolling (in milliseconds).\n * - Default value is `1`.\n * - Valid values: any number `≥` `1`.\n * - Non-integer number are truncated to an integer.\n * - Force to `2147483647` if number is larger than `2147483647`.\n * - Default force to `1` if `missing`, `NaN`, `invalid`, or `less-than` `1`.\n * @returns {void} Does not return anything, only scrolling to top (void).\n * @example\n * // ✅ Valid options value:\n * scrollToTop();\n * // ➔ Scroll smoothly to the top after 1ms delay\n * scrollToTop({ behavior: \"instant\" });\n * // ➔ Jump instantly to the top\n * scrollToTop({ timeout: 500 });\n * // ➔ Scroll smoothly to the top after 500ms\n *\n * // ❌ Invalid options value:\n * scrollToTop({ behavior: \"fly\", timeout: -100 });\n * // ➔ Fallback: behavior=\"smooth\", timeout=1\n * scrollToTop({ behavior: \"fly\", timeout: 123.55 });\n * // ➔ Fallback: behavior=\"smooth\", timeout=123\n */\nexport const scrollToTop = (options?: ScrollToTopOptions): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n // Ensure options is an object and Defensive options check\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const behavior: ScrollBehavior =\n hasOwnProp(options, \"behavior\") &&\n isNonEmptyString(options.behavior) &&\n [\"auto\", \"instant\", \"smooth\"].includes(options.behavior)\n ? options.behavior\n : \"smooth\";\n let timeout =\n hasOwnProp(options, \"timeout\") &&\n isNumber(options.timeout) &&\n options.timeout >= 1\n ? options.timeout\n : 1;\n\n timeout = timeout > 2147483647 ? 2147483647 : timeout;\n\n setTimeout(() => window.scrollTo({ top: 0, left: 0, behavior }), timeout);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,0BACX,YAAoB,oBACX;CAET,IAAIA,0BAAS,GAAG;CAEhB,sCAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAO,mDAAmD,UAAU,sBAAsB,YAAY;CACxG,EACF,CAAC;CAED,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,CAAC,gBAAgB,UAAU,SAAS,SAAS,GAClE,gBAAgB,UAAU,IAAI,SAAS;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjBA,MAAa,yBACX,YAAoB,oBACX;CAET,IAAIC,0BAAS,GAAG;CAEhB,sCAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAO,mDAAmD,UAAU,sBAAsB,YAAY;CACxG,EACF,CAAC;CAED,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,gBAAgB,UAAU,SAAS,SAAS,GACjE,gBAAgB,UAAU,OAAO,SAAS;AAE9C;;;;;;;;;;;;;;;;ACjDA,MAAa,2BAAiC;CAE5C,IAAIC,0BAAS,GAAG;CAEhB,MAAM,gBAAgB,SAAS;CAE/B,IAAI,yBAAyB,aAC3B,cAAc,KAAK;AAKvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6CA,MAAa,eAAe,YAAuC;CAEjE,IAAIC,0BAAS,GAAG;CAGhB,IAAI,CAACC,sCAAc,OAAO,GACxB,UAAU,CAAC;CAGb,MAAM,WACJC,mCAAW,SAAS,UAAU,KAC9BC,yCAAiB,QAAQ,QAAQ,KACjC;EAAC;EAAQ;EAAW;CAAQ,EAAE,SAAS,QAAQ,QAAQ,IACnD,QAAQ,WACR;CACN,IAAI,UACFD,mCAAW,SAAS,SAAS,KAC7BE,iCAAS,QAAQ,OAAO,KACxB,QAAQ,WAAW,IACf,QAAQ,UACR;CAEN,UAAU,UAAU,aAAa,aAAa;CAE9C,iBAAiB,OAAO,SAAS;EAAE,KAAK;EAAG,MAAM;EAAG;CAAS,CAAC,GAAG,OAAO;AAC1E"}
1
+ {"version":3,"file":"index.cjs","names":["isServer","createMessage","isServer","createMessage","isServer","isServer","isPlainObject","isNonEmptyString","isNumber"],"sources":["../../src/events/actions/disableUserInteraction.ts","../../src/events/actions/enableUserInteraction.ts","../../src/events/actions/removeElementFocus.ts","../../src/events/actions/scrollToTop.ts"],"sourcesContent":["import { createMessage } from \"@/_private/logger\";\n\nimport { isServer } from \"@/predicates/is/isServer\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `disableUserInteraction`.***\n * -----------------------------------------------------------\n * **Disables user interaction by adding a CSS class to the `<html>` element.**\n *\n * ---\n * - **Key points**:\n * - Works **only in browser environments**.\n * - Safely adds the specified CSS class to `<html>`.\n * - Prevents multiple additions of the same class.\n * - Useful to indicate that a process is ongoing\n * (e.g., loading or processing state).\n * - **Using custom CSS classes:**\n * - You can pass any class name that exists in your CSS.\n * - Example: if you have `.loading` in your styles, passing `\"loading\"`\n * will add it and disable interactions accordingly.\n * - **Validation:**\n * - Throws `TypeError` if the `className` parameter is not a string.\n *\n * ---\n * @default\n * ```ts\n * \"on_processing\"\n * ```\n *\n * ---\n * @param {string} [className=\"on_processing\"] - The CSS class to add, defaults to `\"on_processing\"`.\n *\n * ---\n * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.\n *\n * ---\n * @returns {void} Does not return anything (void).\n *\n * ---\n * @example\n * - ***Example in your code:***\n * ```ts\n * disableUserInteraction();\n * // ➔ Adds \"on_processing\" class\n * disableUserInteraction(\"loading\");\n * // ➔ Adds \"loading\" class\n *\n * // ❌ Invalid value:\n * disableUserInteraction(123);\n * // ➔ Throws TypeError\n * ```\n * - ***Example in your css file (with defaultValue `className` props [on_processing]):***\n * ```css\n * .on_processing {\n * cursor: wait;\n * touch-action: none;\n * user-select: none;\n * }\n *\n * .on_processing > * {\n * pointer-events: none;\n * touch-action: none;\n * user-select: none;\n * }\n * ```\n */\nexport const disableUserInteraction = (\n className: string = \"on_processing\"\n): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n assertIsString(className, {\n message({ validType, currentType }) {\n return createMessage(\n \"disableUserInteraction\",\n `First parameter \\`className\\` must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n\n const { documentElement } = document;\n\n if (documentElement && !documentElement.classList.contains(className)) {\n documentElement.classList.add(className);\n }\n};\n","import { createMessage } from \"@/_private/logger\";\n\nimport { isServer } from \"@/predicates/is/isServer\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `enableUserInteraction`.***\n * -----------------------------------------------------------\n * **Enables user interaction by removing a CSS class from the `<html>` element.**\n *\n * ---\n * - **Key points**:\n * - Works **only in browser environments**.\n * - Safely removes the specified CSS class from `<html>`.\n * - Does nothing if the class is not present.\n * - Useful to re-enable user interactions after a process\n * (e.g., loading or processing) completes.\n * - **Using custom CSS classes:**\n * - You can pass any class name that exists in your CSS.\n * - Example: if you have `.loading` in your styles, passing `\"loading\"`\n * will remove it and re-enable interactions.\n * - **Validation:**\n * - Throws `TypeError` if the `className` parameter is not a string.\n *\n * ---\n * @default\n * ```ts\n * \"on_processing\"\n * ```\n *\n * ---\n * @param {string} [className=\"on_processing\"] - The CSS class to remove, defaults to `\"on_processing\"`.\n *\n * ---\n * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.\n *\n * ---\n * @returns {void} Does not return anything (void).\n *\n * ---\n * @example\n * - ***Example in your code:***\n * ```ts\n * enableUserInteraction();\n * // ➔ Removes \"on_processing\" class\n * enableUserInteraction(\"loading\");\n * // ➔ Removes \"loading\" class\n *\n * // ❌ Invalid value:\n * enableUserInteraction(123);\n * // ➔ Throws TypeError\n * ```\n *\n * - ***Example in your css file (with defaultValue `className` props [on_processing]):***\n * ```css\n * .on_processing {\n * cursor: wait;\n * touch-action: none;\n * user-select: none;\n * }\n *\n * .on_processing > * {\n * pointer-events: none;\n * touch-action: none;\n * user-select: none;\n * }\n * ```\n */\nexport const enableUserInteraction = (\n className: string = \"on_processing\"\n): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n assertIsString(className, {\n message({ validType, currentType }) {\n return createMessage(\n \"enableUserInteraction\",\n `First parameter \\`className\\` must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n\n const { documentElement } = document;\n\n if (documentElement && documentElement.classList.contains(className)) {\n documentElement.classList.remove(className);\n }\n};\n","import { isServer } from \"@/predicates/is/isServer\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `removeElementFocus`.***\n * -----------------------------------------------------------\n * **Removes focus from the currently active element in the document.**\n *\n * ---\n * - **Features**:\n * - This function works **only in browser environments** ***(safely no-ops in server environments)***.\n * - If an element is focused, it will lose focus by calling `HTMLElement.blur()`.\n * - If no element is focused or the active element is not an `HTMLElement`, nothing happens.\n *\n * ---\n * @returns {void} Does not return anything (void).\n *\n * ---\n * @example\n * ```ts\n * removeElementFocus();\n * // ➔ Removes focus from the currently active element\n * ```\n */\nexport const removeElementFocus = (): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n const activeElement = document.activeElement;\n\n if (activeElement instanceof HTMLElement) {\n activeElement.blur();\n } else {\n // not-support, currently we nothing to do...\n // console.warn(\"removeElementFocus: No active element to blur or unsupported element type.\");\n }\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { isServer } from \"@/predicates/is/isServer\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/**\n * ***Types options for {@link scrollToTop | `scrollToTop`}.***\n */\ntype ScrollToTopOptions = {\n /** ----------------------------------------------------------\n * * ***Scroll animation type.***\n * -----------------------------------------------------------\n * - ***Behavior:***\n * - Valid values: `\"auto\"`, `\"instant\"`, `\"smooth\"`.\n * - Default force to `\"smooth\"` if missing or invalid.\n *\n * ---\n * @default \"smooth\"\n */\n behavior?: ScrollBehavior | undefined;\n\n /** ----------------------------------------------------------\n * * ***Delay before scrolling (in milliseconds).***\n * -----------------------------------------------------------\n * - ***Behavior:***\n * - Default value is `1`.\n * - Valid values: any number `≥` `1`.\n * - Non-integer number are truncated to an integer.\n * - Force to `2147483647` if number is larger than `2147483647`.\n * - Default force to `1` if `missing`, `NaN`, `invalid-type`, or `less-than` `1`.\n *\n * ---\n * @default 1\n */\n timeout?: number | undefined;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `scrollToTop`.***\n * -----------------------------------------------------------\n * **Scrolls the page to the top with optional smooth animation and delay.**\n *\n * ---\n * - **Features**:\n * - This function works **only in browser environments** (no effect on server-side).\n * - It leverages the native `window.scrollTo()` API with support for smooth scrolling\n * and an optional timeout delay before executing the scroll.\n * - Each option has strict valid values:\n * - If an invalid value is provided, the function **automatically falls back to its default**.\n *\n * ---\n * @param {ScrollToTopOptions} [options] - Optional settings for scroll behavior.\n * @param {ScrollToTopOptions[\"behavior\"]} [options.behavior=\"smooth\"] - Scroll animation type.\n * - Valid values: `\"auto\"`, `\"instant\"`, `\"smooth\"`.\n * - Default force to `\"smooth\"` if missing or invalid.\n * @param {ScrollToTopOptions[\"timeout\"]} [options.timeout=1] - Delay before scrolling (in milliseconds).\n * - Default value is `1`.\n * - Valid values: any number `≥` `1`.\n * - Non-integer number are truncated to an integer.\n * - Force to `2147483647` if number is larger than `2147483647`.\n * - Default force to `1` if `missing`, `NaN`, `invalid`, or `less-than` `1`.\n *\n * ---\n * @returns {void} Does not return anything, only scrolling to top (void).\n *\n * ---\n * @example\n *\n * 1. #### Default behavior:\n * ```ts\n * scrollToTop();\n * // ➔ Scroll smoothly to the top after 1ms delay\n * ```\n * ---\n * 2. #### Instant scroll:\n * ```ts\n * scrollToTop({\n * behavior: \"instant\"\n * });\n * // ➔ Jump instantly to the top\n * ```\n * ---\n * 3. #### Custom timeout:\n * ```ts\n * scrollToTop({\n * timeout: 500\n * });\n * // ➔ Scroll smoothly to the top after 500ms\n * ```\n * ---\n * 4. #### Invalid options with fallback values:\n * ```ts\n * scrollToTop({\n * behavior: \"fly\",\n * timeout: -100\n * });\n * // ➔ Fallback: behavior=\"smooth\", timeout=1\n * ```\n * ---\n * 5. #### Invalid behavior with decimal timeout:\n * ```ts\n * scrollToTop({\n * behavior: \"fly\",\n * timeout: 123.55\n * });\n * // ➔ Fallback: behavior=\"smooth\", timeout=123\n * ```\n */\nexport const scrollToTop = (options?: ScrollToTopOptions): void => {\n // Ensure function runs only in the browser\n if (isServer()) return;\n\n // Ensure options is an object and Defensive options check\n if (!isPlainObject(options)) options = {};\n\n const behavior: ScrollBehavior =\n options.behavior &&\n isNonEmptyString(options.behavior) &&\n [\"auto\", \"instant\", \"smooth\"].includes(options.behavior)\n ? options.behavior\n : \"smooth\";\n let timeout =\n options.timeout && isNumber(options.timeout) && options.timeout >= 1\n ? options.timeout\n : 1;\n\n timeout = timeout > 2147483647 ? 2147483647 : timeout;\n\n setTimeout(() => window.scrollTo({ top: 0, left: 0, behavior }), timeout);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAa,0BACX,YAAoB,oBACX;CAET,IAAIA,0BAAS,GAAG;CAEhB,sCAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAOC,6BACL,0BACA,mDAAmD,UAAU,sBAAsB,YAAY,IACjG;CACF,EACF,CAAC;CAED,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,CAAC,gBAAgB,UAAU,SAAS,SAAS,GAClE,gBAAgB,UAAU,IAAI,SAAS;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnBA,MAAa,yBACX,YAAoB,oBACX;CAET,IAAIC,0BAAS,GAAG;CAEhB,sCAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAOC,6BACL,yBACA,mDAAmD,UAAU,sBAAsB,YAAY,IACjG;CACF,EACF,CAAC;CAED,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,gBAAgB,UAAU,SAAS,SAAS,GACjE,gBAAgB,UAAU,OAAO,SAAS;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;ACjEA,MAAa,2BAAiC;CAE5C,IAAIC,0BAAS,GAAG;CAEhB,MAAM,gBAAgB,SAAS;CAE/B,IAAI,yBAAyB,aAC3B,cAAc,KAAK;AAKvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACyEA,MAAa,eAAe,YAAuC;CAEjE,IAAIC,0BAAS,GAAG;CAGhB,IAAI,CAACC,6BAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,WACJ,QAAQ,YACRC,gCAAiB,QAAQ,QAAQ,KACjC;EAAC;EAAQ;EAAW;CAAQ,EAAE,SAAS,QAAQ,QAAQ,IACnD,QAAQ,WACR;CACN,IAAI,UACF,QAAQ,WAAWC,0BAAS,QAAQ,OAAO,KAAK,QAAQ,WAAW,IAC/D,QAAQ,UACR;CAEN,UAAU,UAAU,aAAa,aAAa;CAE9C,iBAAiB,OAAO,SAAS;EAAE,KAAK;EAAG,MAAM;EAAG;CAAS,CAAC,GAAG,OAAO;AAC1E"}
@@ -2,110 +2,158 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.13.1`
5
+ * Version: `3.14.0-beta.0`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
8
  * ========================================================================
9
9
  */
10
10
  /** ----------------------------------------------------------
11
11
  * * ***Utility: `disableUserInteraction`.***
12
- * ----------------------------------------------------------
12
+ * -----------------------------------------------------------
13
13
  * **Disables user interaction by adding a CSS class to the `<html>` element.**
14
+ *
15
+ * ---
14
16
  * - **Key points**:
15
- * - Works **only in browser environments**.
16
- * - Safely adds the specified CSS class to `<html>`.
17
- * - Prevents multiple additions of the same class.
18
- * - Useful to indicate that a process is ongoing
19
- * (e.g., loading or processing state).
17
+ * - Works **only in browser environments**.
18
+ * - Safely adds the specified CSS class to `<html>`.
19
+ * - Prevents multiple additions of the same class.
20
+ * - Useful to indicate that a process is ongoing
21
+ * (e.g., loading or processing state).
20
22
  * - **Using custom CSS classes:**
21
- * - You can pass any class name that exists in your CSS.
22
- * - Example: if you have `.loading` in your styles, passing `"loading"`
23
- * will add it and disable interactions accordingly.
23
+ * - You can pass any class name that exists in your CSS.
24
+ * - Example: if you have `.loading` in your styles, passing `"loading"`
25
+ * will add it and disable interactions accordingly.
24
26
  * - **Validation:**
25
- * - Throws `TypeError` if the `className` parameter is not a string.
26
- * @defaultValue `"on_processing"`
27
+ * - Throws `TypeError` if the `className` parameter is not a string.
28
+ *
29
+ * ---
30
+ * @default
31
+ * ```ts
32
+ * "on_processing"
33
+ * ```
34
+ *
35
+ * ---
27
36
  * @param {string} [className="on_processing"] - The CSS class to add, defaults to `"on_processing"`.
28
- * @returns {void} Does not return anything (void).
37
+ *
38
+ * ---
29
39
  * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.
40
+ *
41
+ * ---
42
+ * @returns {void} Does not return anything (void).
43
+ *
44
+ * ---
30
45
  * @example
31
- * * ***Example in your code:***
32
- * ```ts
33
- * disableUserInteraction(); // ➔ Adds "on_processing" class
34
- * disableUserInteraction("loading"); // ➔ Adds "loading" class
35
- * // ❌ Invalid value:
36
- * disableUserInteraction(123); // ➔ Throws TypeError
37
- * ```
38
- * * ***Example in your css file (with defaultValue `className` props [on_processing]):***
39
- * ```css
40
- * .on_processing {
41
- * cursor: wait;
42
- * touch-action: none;
43
- * user-select: none;
44
- * }
45
- *
46
- * .on_processing > * {
47
- * pointer-events: none;
48
- * touch-action: none;
49
- * user-select: none;
50
- * }
51
- * ```
46
+ * - ***Example in your code:***
47
+ * ```ts
48
+ * disableUserInteraction();
49
+ * // ➔ Adds "on_processing" class
50
+ * disableUserInteraction("loading");
51
+ * // ➔ Adds "loading" class
52
+ *
53
+ * // Invalid value:
54
+ * disableUserInteraction(123);
55
+ * // Throws TypeError
56
+ * ```
57
+ * - ***Example in your css file (with defaultValue `className` props [on_processing]):***
58
+ * ```css
59
+ * .on_processing {
60
+ * cursor: wait;
61
+ * touch-action: none;
62
+ * user-select: none;
63
+ * }
64
+ *
65
+ * .on_processing > * {
66
+ * pointer-events: none;
67
+ * touch-action: none;
68
+ * user-select: none;
69
+ * }
70
+ * ```
52
71
  */
53
72
  declare const disableUserInteraction: (className?: string) => void;
54
73
  /** ----------------------------------------------------------
55
74
  * * ***Utility: `enableUserInteraction`.***
56
- * ----------------------------------------------------------
75
+ * -----------------------------------------------------------
57
76
  * **Enables user interaction by removing a CSS class from the `<html>` element.**
77
+ *
78
+ * ---
58
79
  * - **Key points**:
59
- * - Works **only in browser environments**.
60
- * - Safely removes the specified CSS class from `<html>`.
61
- * - Does nothing if the class is not present.
62
- * - Useful to re-enable user interactions after a process
63
- * (e.g., loading or processing) completes.
80
+ * - Works **only in browser environments**.
81
+ * - Safely removes the specified CSS class from `<html>`.
82
+ * - Does nothing if the class is not present.
83
+ * - Useful to re-enable user interactions after a process
84
+ * (e.g., loading or processing) completes.
64
85
  * - **Using custom CSS classes:**
65
- * - You can pass any class name that exists in your CSS.
66
- * - Example: if you have `.loading` in your styles, passing `"loading"`
67
- * will remove it and re-enable interactions.
86
+ * - You can pass any class name that exists in your CSS.
87
+ * - Example: if you have `.loading` in your styles, passing `"loading"`
88
+ * will remove it and re-enable interactions.
68
89
  * - **Validation:**
69
- * - Throws `TypeError` if the `className` parameter is not a string.
70
- * @defaultValue `"on_processing"`
90
+ * - Throws `TypeError` if the `className` parameter is not a string.
91
+ *
92
+ * ---
93
+ * @default
94
+ * ```ts
95
+ * "on_processing"
96
+ * ```
97
+ *
98
+ * ---
71
99
  * @param {string} [className="on_processing"] - The CSS class to remove, defaults to `"on_processing"`.
72
- * @returns {void} Does not return anything (void).
100
+ *
101
+ * ---
73
102
  * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.
103
+ *
104
+ * ---
105
+ * @returns {void} Does not return anything (void).
106
+ *
107
+ * ---
74
108
  * @example
75
- * * ***Example in your code:***
76
- * ```ts
77
- * enableUserInteraction(); // ➔ Removes "on_processing" class
78
- * enableUserInteraction("loading"); // ➔ Removes "loading" class
79
- * // ❌ Invalid value:
80
- * enableUserInteraction(123); // ➔ Throws TypeError
81
- * ```
82
- * * ***Example in your css file (with defaultValue `className` props [on_processing]):***
83
- * ```css
84
- * .on_processing {
85
- * cursor: wait;
86
- * touch-action: none;
87
- * user-select: none;
88
- * }
89
- *
90
- * .on_processing > * {
91
- * pointer-events: none;
92
- * touch-action: none;
93
- * user-select: none;
94
- * }
95
- * ```
109
+ * - ***Example in your code:***
110
+ * ```ts
111
+ * enableUserInteraction();
112
+ * // ➔ Removes "on_processing" class
113
+ * enableUserInteraction("loading");
114
+ * // ➔ Removes "loading" class
115
+ *
116
+ * // Invalid value:
117
+ * enableUserInteraction(123);
118
+ * // Throws TypeError
119
+ * ```
120
+ *
121
+ * - ***Example in your css file (with defaultValue `className` props [on_processing]):***
122
+ * ```css
123
+ * .on_processing {
124
+ * cursor: wait;
125
+ * touch-action: none;
126
+ * user-select: none;
127
+ * }
128
+ *
129
+ * .on_processing > * {
130
+ * pointer-events: none;
131
+ * touch-action: none;
132
+ * user-select: none;
133
+ * }
134
+ * ```
96
135
  */
97
136
  declare const enableUserInteraction: (className?: string) => void;
98
137
  /** ----------------------------------------------------------
99
138
  * * ***Utility: `removeElementFocus`.***
100
- * ----------------------------------------------------------
139
+ * -----------------------------------------------------------
101
140
  * **Removes focus from the currently active element in the document.**
141
+ *
142
+ * ---
102
143
  * - **Features**:
103
- * - This function works **only in browser environments** ***(safely no-ops in server environments)***.
104
- * - If an element is focused, it will lose focus by calling `HTMLElement.blur()`.
105
- * - If no element is focused or the active element is not an `HTMLElement`, nothing happens.
144
+ * - This function works **only in browser environments** ***(safely no-ops in server environments)***.
145
+ * - If an element is focused, it will lose focus by calling `HTMLElement.blur()`.
146
+ * - If no element is focused or the active element is not an `HTMLElement`, nothing happens.
147
+ *
148
+ * ---
106
149
  * @returns {void} Does not return anything (void).
150
+ *
151
+ * ---
107
152
  * @example
108
- * removeElementFocus(); // ➔ Removes focus from the currently active element
153
+ * ```ts
154
+ * removeElementFocus();
155
+ * // ➔ Removes focus from the currently active element
156
+ * ```
109
157
  */
110
158
  declare const removeElementFocus: () => void;
111
159
  /**
@@ -114,38 +162,44 @@ declare const removeElementFocus: () => void;
114
162
  type ScrollToTopOptions = {
115
163
  /** ----------------------------------------------------------
116
164
  * * ***Scroll animation type.***
117
- * ----------------------------------------------------------
165
+ * -----------------------------------------------------------
118
166
  * - ***Behavior:***
119
- * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
120
- * - Default force to `"smooth"` if missing or invalid.
167
+ * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
168
+ * - Default force to `"smooth"` if missing or invalid.
121
169
  *
170
+ * ---
122
171
  * @default "smooth"
123
172
  */
124
173
  behavior?: ScrollBehavior | undefined;
125
174
  /** ----------------------------------------------------------
126
175
  * * ***Delay before scrolling (in milliseconds).***
127
- * ----------------------------------------------------------
176
+ * -----------------------------------------------------------
128
177
  * - ***Behavior:***
129
- * - Default value is `1`.
130
- * - Valid values: any number `≥` `1`.
131
- * - Non-integer number are truncated to an integer.
132
- * - Force to `2147483647` if number is larger than `2147483647`.
133
- * - Default force to `1` if `missing`, `NaN`, `invalid-type`, or `less-than` `1`.
178
+ * - Default value is `1`.
179
+ * - Valid values: any number `≥` `1`.
180
+ * - Non-integer number are truncated to an integer.
181
+ * - Force to `2147483647` if number is larger than `2147483647`.
182
+ * - Default force to `1` if `missing`, `NaN`, `invalid-type`, or `less-than` `1`.
134
183
  *
184
+ * ---
135
185
  * @default 1
136
186
  */
137
187
  timeout?: number | undefined;
138
188
  };
139
189
  /** ----------------------------------------------------------
140
190
  * * ***Utility: `scrollToTop`.***
141
- * ----------------------------------------------------------
191
+ * -----------------------------------------------------------
142
192
  * **Scrolls the page to the top with optional smooth animation and delay.**
193
+ *
194
+ * ---
143
195
  * - **Features**:
144
- * - This function works **only in browser environments** (no effect on server-side).
145
- * - It leverages the native `window.scrollTo()` API with support for smooth scrolling
146
- * and an optional timeout delay before executing the scroll.
147
- * - Each option has strict valid values.
148
- * - If an invalid value is provided, the function **automatically falls back to its default**.
196
+ * - This function works **only in browser environments** (no effect on server-side).
197
+ * - It leverages the native `window.scrollTo()` API with support for smooth scrolling
198
+ * and an optional timeout delay before executing the scroll.
199
+ * - Each option has strict valid values:
200
+ * - If an invalid value is provided, the function **automatically falls back to its default**.
201
+ *
202
+ * ---
149
203
  * @param {ScrollToTopOptions} [options] - Optional settings for scroll behavior.
150
204
  * @param {ScrollToTopOptions["behavior"]} [options.behavior="smooth"] - Scroll animation type.
151
205
  * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
@@ -156,21 +210,52 @@ type ScrollToTopOptions = {
156
210
  * - Non-integer number are truncated to an integer.
157
211
  * - Force to `2147483647` if number is larger than `2147483647`.
158
212
  * - Default force to `1` if `missing`, `NaN`, `invalid`, or `less-than` `1`.
213
+ *
214
+ * ---
159
215
  * @returns {void} Does not return anything, only scrolling to top (void).
216
+ *
217
+ * ---
160
218
  * @example
161
- * // ✅ Valid options value:
162
- * scrollToTop();
163
- * // ➔ Scroll smoothly to the top after 1ms delay
164
- * scrollToTop({ behavior: "instant" });
165
- * // ➔ Jump instantly to the top
166
- * scrollToTop({ timeout: 500 });
167
- * // ➔ Scroll smoothly to the top after 500ms
168
- *
169
- * // ❌ Invalid options value:
170
- * scrollToTop({ behavior: "fly", timeout: -100 });
171
- * // ➔ Fallback: behavior="smooth", timeout=1
172
- * scrollToTop({ behavior: "fly", timeout: 123.55 });
173
- * // ➔ Fallback: behavior="smooth", timeout=123
219
+ *
220
+ * 1. #### Default behavior:
221
+ * ```ts
222
+ * scrollToTop();
223
+ * // ➔ Scroll smoothly to the top after 1ms delay
224
+ * ```
225
+ * ---
226
+ * 2. #### Instant scroll:
227
+ * ```ts
228
+ * scrollToTop({
229
+ * behavior: "instant"
230
+ * });
231
+ * // ➔ Jump instantly to the top
232
+ * ```
233
+ * ---
234
+ * 3. #### Custom timeout:
235
+ * ```ts
236
+ * scrollToTop({
237
+ * timeout: 500
238
+ * });
239
+ * // ➔ Scroll smoothly to the top after 500ms
240
+ * ```
241
+ * ---
242
+ * 4. #### Invalid options with fallback values:
243
+ * ```ts
244
+ * scrollToTop({
245
+ * behavior: "fly",
246
+ * timeout: -100
247
+ * });
248
+ * // ➔ Fallback: behavior="smooth", timeout=1
249
+ * ```
250
+ * ---
251
+ * 5. #### Invalid behavior with decimal timeout:
252
+ * ```ts
253
+ * scrollToTop({
254
+ * behavior: "fly",
255
+ * timeout: 123.55
256
+ * });
257
+ * // ➔ Fallback: behavior="smooth", timeout=123
258
+ * ```
174
259
  */
175
260
  declare const scrollToTop: (options?: ScrollToTopOptions) => void;
176
261
  export { disableUserInteraction, enableUserInteraction, removeElementFocus, scrollToTop };