@rzl-zone/utils-js 3.12.1-beta.0 → 3.12.1-beta.1

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 (239) hide show
  1. package/README.md +7 -7
  2. package/dist/.references/index.d.cts +1 -1
  3. package/dist/.references/index.d.ts +1 -1
  4. package/dist/{assertIsArray-BChqwPiP.cjs → assertIsArray-DJXkjHZs.cjs} +3 -3
  5. package/dist/{assertIsArray-BChqwPiP.cjs.map → assertIsArray-DJXkjHZs.cjs.map} +1 -1
  6. package/dist/{assertIsArray-BfAbIUfa.js → assertIsArray-bTA3XLjq.js} +3 -3
  7. package/dist/{assertIsArray-BfAbIUfa.js.map → assertIsArray-bTA3XLjq.js.map} +1 -1
  8. package/dist/{assertIsBoolean-DozdtbNi.cjs → assertIsBoolean-C8WEXVr2.cjs} +8 -8
  9. package/dist/assertIsBoolean-C8WEXVr2.cjs.map +1 -0
  10. package/dist/{assertIsBoolean-BlBct0Fc.js → assertIsBoolean-DR1SaXPD.js} +8 -8
  11. package/dist/assertIsBoolean-DR1SaXPD.js.map +1 -0
  12. package/dist/{assertIsString-Bvk7bUL7.cjs → assertIsString-BiHQSrB2.cjs} +3 -3
  13. package/dist/{assertIsString-Bvk7bUL7.cjs.map → assertIsString-BiHQSrB2.cjs.map} +1 -1
  14. package/dist/{assertIsString-DqV9NwbI.js → assertIsString-CEB07_83.js} +3 -3
  15. package/dist/{assertIsString-DqV9NwbI.js.map → assertIsString-CEB07_83.js.map} +1 -1
  16. package/dist/assertions/index.cjs +5 -5
  17. package/dist/assertions/index.d.cts +2 -2
  18. package/dist/assertions/index.d.ts +2 -2
  19. package/dist/assertions/index.js +5 -5
  20. package/dist/conversions/index.cjs +6 -6
  21. package/dist/conversions/index.d.cts +2 -2
  22. package/dist/conversions/index.d.ts +2 -2
  23. package/dist/conversions/index.js +6 -6
  24. package/dist/{conversions-EMJa3g-D.js → conversions-BNIh_tCH.js} +16 -18
  25. package/dist/conversions-BNIh_tCH.js.map +1 -0
  26. package/dist/{conversions-CBs8-REq.cjs → conversions-D_Kh0a_C.cjs} +16 -18
  27. package/dist/conversions-D_Kh0a_C.cjs.map +1 -0
  28. package/dist/events/index.cjs +4 -4
  29. package/dist/events/index.cjs.map +1 -1
  30. package/dist/events/index.d.cts +153 -151
  31. package/dist/events/index.d.ts +153 -151
  32. package/dist/events/index.js +4 -4
  33. package/dist/events/index.js.map +1 -1
  34. package/dist/{formatEnvPort-hHNvOim-.cjs → formatEnvPort-B3OLxQk9.cjs} +9 -9
  35. package/dist/formatEnvPort-B3OLxQk9.cjs.map +1 -0
  36. package/dist/{formatEnvPort-DpIXzPAZ.js → formatEnvPort-ByFVLjSV.js} +9 -9
  37. package/dist/formatEnvPort-ByFVLjSV.js.map +1 -0
  38. package/dist/formatters/index.cjs +2 -2
  39. package/dist/formatters/index.d.cts +2 -2
  40. package/dist/formatters/index.d.ts +2 -2
  41. package/dist/formatters/index.js +2 -2
  42. package/dist/{formatters-QcZO_Cpx.js → formatters--1m_vpE8.js} +17 -15
  43. package/dist/formatters--1m_vpE8.js.map +1 -0
  44. package/dist/{formatters-lAYgA11L.cjs → formatters-Cbij0XLU.cjs} +17 -15
  45. package/dist/formatters-Cbij0XLU.cjs.map +1 -0
  46. package/dist/generators/index.cjs +12 -8
  47. package/dist/generators/index.cjs.map +1 -1
  48. package/dist/generators/index.d.cts +2 -2
  49. package/dist/generators/index.d.ts +2 -2
  50. package/dist/generators/index.js +12 -8
  51. package/dist/generators/index.js.map +1 -1
  52. package/dist/index-59zbLcPr.d.ts +340 -0
  53. package/dist/index-B6tawc8L.d.cts +1716 -0
  54. package/dist/index-C267akkJ.d.ts +2158 -0
  55. package/dist/index-CeBC2Vvl.d.cts +2361 -0
  56. package/dist/index-CgRDTI6f.d.ts +822 -0
  57. package/dist/index-CoiUBVmr.d.ts +720 -0
  58. package/dist/index-D4fcasfZ.d.cts +720 -0
  59. package/dist/index-DDrSQKIc.d.ts +1716 -0
  60. package/dist/index-DsGxO31H.d.cts +765 -0
  61. package/dist/index-Hg1qJkjl.d.ts +765 -0
  62. package/dist/index-Qm3iFwd0.d.cts +2158 -0
  63. package/dist/index-UPp94Agr.d.ts +2361 -0
  64. package/dist/index-gBA_8SuF.d.cts +340 -0
  65. package/dist/index-jyDqzicx.d.cts +822 -0
  66. package/dist/{isBigInt-B1cijjqm.cjs → isBigInt-C4krUeAw.cjs} +2 -2
  67. package/dist/{isBigInt-B1cijjqm.cjs.map → isBigInt-C4krUeAw.cjs.map} +1 -1
  68. package/dist/{isBigInt-C0bN0Rhu.js → isBigInt-DKe0M6hp.js} +2 -2
  69. package/dist/{isBigInt-C0bN0Rhu.js.map → isBigInt-DKe0M6hp.js.map} +1 -1
  70. package/dist/{isEmptyObject-DeLVIJpl.js → isEmptyObject-DCipFwxJ.js} +3 -3
  71. package/dist/{isEmptyObject-DeLVIJpl.js.map → isEmptyObject-DCipFwxJ.js.map} +1 -1
  72. package/dist/{isEmptyObject-DI42NEo0.cjs → isEmptyObject-ZkSwRC_D.cjs} +3 -3
  73. package/dist/{isEmptyObject-DI42NEo0.cjs.map → isEmptyObject-ZkSwRC_D.cjs.map} +1 -1
  74. package/dist/{isEmptyString-BTUWYTbw.js → isEmptyString-BXzKAC2j.js} +3 -3
  75. package/dist/{isEmptyString-BTUWYTbw.js.map → isEmptyString-BXzKAC2j.js.map} +1 -1
  76. package/dist/{isEmptyString-CCK3bP74.cjs → isEmptyString-UiiUsSQj.cjs} +3 -3
  77. package/dist/{isEmptyString-CCK3bP74.cjs.map → isEmptyString-UiiUsSQj.cjs.map} +1 -1
  78. package/dist/{isEmptyValue-DMSMFTU8.cjs → isEmptyValue-BQzcjVaL.cjs} +5 -5
  79. package/dist/{isEmptyValue-DMSMFTU8.cjs.map → isEmptyValue-BQzcjVaL.cjs.map} +1 -1
  80. package/dist/{isEmptyValue-fjnfQnt5.js → isEmptyValue-jqOr7OHD.js} +5 -5
  81. package/dist/{isEmptyValue-fjnfQnt5.js.map → isEmptyValue-jqOr7OHD.js.map} +1 -1
  82. package/dist/{isEqual-DhyP8fB_.js → isEqual-BX49cF9m.js} +4 -4
  83. package/dist/{isEqual-DhyP8fB_.js.map → isEqual-BX49cF9m.js.map} +1 -1
  84. package/dist/{isEqual-B1fRgEuU.cjs → isEqual-BvumA3RA.cjs} +4 -4
  85. package/dist/{isEqual-B1fRgEuU.cjs.map → isEqual-BvumA3RA.cjs.map} +1 -1
  86. package/dist/{isFinite-BYMOo0os.js → isFinite-BCnaDpod.js} +3 -3
  87. package/dist/{isFinite-BYMOo0os.js.map → isFinite-BCnaDpod.js.map} +1 -1
  88. package/dist/{isFinite-sFkps2TY.cjs → isFinite-D24ZaE6c.cjs} +3 -3
  89. package/dist/{isFinite-sFkps2TY.cjs.map → isFinite-D24ZaE6c.cjs.map} +1 -1
  90. package/dist/{isInteger-FTCthMre.cjs → isInteger-Caeuz0rB.cjs} +2 -2
  91. package/dist/{isInteger-FTCthMre.cjs.map → isInteger-Caeuz0rB.cjs.map} +1 -1
  92. package/dist/{isInteger-DS9V7l_f.js → isInteger-naMbJsxJ.js} +2 -2
  93. package/dist/{isInteger-DS9V7l_f.js.map → isInteger-naMbJsxJ.js.map} +1 -1
  94. package/dist/isPlainObject-BF-2-phb.d.cts +339 -0
  95. package/dist/isPlainObject-DxNDL8XU.d.ts +339 -0
  96. package/dist/{isServer-q-QLFCqE.cjs → isServer-BJHVnixd.cjs} +2 -2
  97. package/dist/{isServer-q-QLFCqE.cjs.map → isServer-BJHVnixd.cjs.map} +1 -1
  98. package/dist/{isServer-D1TXfOs3.js → isServer-Da3o3XSs.js} +2 -2
  99. package/dist/{isServer-D1TXfOs3.js.map → isServer-Da3o3XSs.js.map} +1 -1
  100. package/dist/{isTypedArray-47R0wdrc.js → isTypedArray-DuNA8tK6.js} +3 -3
  101. package/dist/{isTypedArray-47R0wdrc.js.map → isTypedArray-DuNA8tK6.js.map} +1 -1
  102. package/dist/{isTypedArray-DiCoqffZ.cjs → isTypedArray-TJptiw2b.cjs} +3 -3
  103. package/dist/{isTypedArray-DiCoqffZ.cjs.map → isTypedArray-TJptiw2b.cjs.map} +1 -1
  104. package/dist/{isURL-CQiowFq2.js → isURL-C-kSk6KJ.js} +2 -2
  105. package/dist/{isURL-CQiowFq2.js.map → isURL-C-kSk6KJ.js.map} +1 -1
  106. package/dist/{isURL-WZypXsax.cjs → isURL-DeUPO_oR.cjs} +2 -2
  107. package/dist/{isURL-WZypXsax.cjs.map → isURL-DeUPO_oR.cjs.map} +1 -1
  108. package/dist/{isValidDomain-BSXshgkC.cjs → isValidDomain-BB9IGhJs.cjs} +65 -8
  109. package/dist/isValidDomain-BB9IGhJs.cjs.map +1 -0
  110. package/dist/{isValidDomain-DwA2EN79.js → isValidDomain-DoE98yhJ.js} +54 -9
  111. package/dist/isValidDomain-DoE98yhJ.js.map +1 -0
  112. package/dist/next/index.cjs +7 -7
  113. package/dist/next/index.cjs.map +1 -1
  114. package/dist/next/index.d.cts +185 -191
  115. package/dist/next/index.d.ts +185 -191
  116. package/dist/next/index.js +7 -7
  117. package/dist/next/index.js.map +1 -1
  118. package/dist/next/server/index.cjs +2 -2
  119. package/dist/next/server/index.d.cts +26 -26
  120. package/dist/next/server/index.d.ts +26 -26
  121. package/dist/next/server/index.js +2 -2
  122. package/dist/{noop-B2mTBhW-.cjs → noop-B13_ii35.cjs} +2 -2
  123. package/dist/{noop-B2mTBhW-.cjs.map → noop-B13_ii35.cjs.map} +1 -1
  124. package/dist/{noop-BzktGBVz.js → noop-ubqAIbHD.js} +2 -2
  125. package/dist/{noop-BzktGBVz.js.map → noop-ubqAIbHD.js.map} +1 -1
  126. package/dist/{normalizeSpaces-WS_iERJk.js → normalizeSpaces-Bg2IZW7W.js} +3 -3
  127. package/dist/{normalizeSpaces-WS_iERJk.js.map → normalizeSpaces-Bg2IZW7W.js.map} +1 -1
  128. package/dist/{normalizeSpaces-DQHR3Tlr.cjs → normalizeSpaces-ZXnR4Qzp.cjs} +3 -3
  129. package/dist/{normalizeSpaces-DQHR3Tlr.cjs.map → normalizeSpaces-ZXnR4Qzp.cjs.map} +1 -1
  130. package/dist/{normalizeString-2WLth_Gj.js → normalizeString-BDdkaXui.js} +3 -3
  131. package/dist/{normalizeString-2WLth_Gj.js.map → normalizeString-BDdkaXui.js.map} +1 -1
  132. package/dist/{normalizeString-D8euBcRD.cjs → normalizeString-BE6ELqEb.cjs} +3 -3
  133. package/dist/{normalizeString-D8euBcRD.cjs.map → normalizeString-BE6ELqEb.cjs.map} +1 -1
  134. package/dist/operations/index.cjs +10 -10
  135. package/dist/operations/index.cjs.map +1 -1
  136. package/dist/operations/index.d.cts +120 -120
  137. package/dist/operations/index.d.ts +120 -120
  138. package/dist/operations/index.js +10 -10
  139. package/dist/operations/index.js.map +1 -1
  140. package/dist/parsers/index.cjs +2 -2
  141. package/dist/parsers/index.d.cts +222 -222
  142. package/dist/parsers/index.d.ts +222 -222
  143. package/dist/parsers/index.js +2 -2
  144. package/dist/{parsers-Dpuq-V4u.js → parsers-BSBPgvsq.js} +4 -4
  145. package/dist/{parsers-Dpuq-V4u.js.map → parsers-BSBPgvsq.js.map} +1 -1
  146. package/dist/{parsers-DXtpsDyj.cjs → parsers-OqDeffqc.cjs} +4 -4
  147. package/dist/{parsers-DXtpsDyj.cjs.map → parsers-OqDeffqc.cjs.map} +1 -1
  148. package/dist/{parsing-B43x1sxn.js → parsing-Cao8b358.js} +3 -3
  149. package/dist/{parsing-B43x1sxn.js.map → parsing-Cao8b358.js.map} +1 -1
  150. package/dist/{parsing-lRoxn1Nz.cjs → parsing-DOGSCH6N.cjs} +3 -3
  151. package/dist/{parsing-lRoxn1Nz.cjs.map → parsing-DOGSCH6N.cjs.map} +1 -1
  152. package/dist/predicates/index.cjs +15 -15
  153. package/dist/predicates/index.d.cts +3 -3
  154. package/dist/predicates/index.d.ts +3 -3
  155. package/dist/predicates/index.js +15 -15
  156. package/dist/{predicates-gNepszvo.js → predicates-Bj6meyXV.js} +13 -14
  157. package/dist/{predicates-gNepszvo.js.map → predicates-Bj6meyXV.js.map} +1 -1
  158. package/dist/{predicates-DiaYA7Ps.cjs → predicates-D0ubqgqy.cjs} +13 -14
  159. package/dist/{predicates-DiaYA7Ps.cjs.map → predicates-D0ubqgqy.cjs.map} +1 -1
  160. package/dist/promises/index.cjs +4 -4
  161. package/dist/promises/index.d.cts +101 -101
  162. package/dist/promises/index.d.ts +101 -101
  163. package/dist/promises/index.js +4 -4
  164. package/dist/{punyCode-hmiFzLWT.js → punyCode-8SrbMWfM.js} +6 -6
  165. package/dist/punyCode-8SrbMWfM.js.map +1 -0
  166. package/dist/{punyCode-CTWXVVFo.cjs → punyCode-D-Qu6nj6.cjs} +6 -6
  167. package/dist/punyCode-D-Qu6nj6.cjs.map +1 -0
  168. package/dist/{removeSpaces-BE8lfh-4.js → removeSpaces-Bmc5DX4F.js} +3 -3
  169. package/dist/removeSpaces-Bmc5DX4F.js.map +1 -0
  170. package/dist/{removeSpaces-DRRxNWlb.cjs → removeSpaces-CWIvhZHg.cjs} +3 -3
  171. package/dist/removeSpaces-CWIvhZHg.cjs.map +1 -0
  172. package/dist/rzl-utils.global.js +21 -0
  173. package/dist/{safeJsonParse-CXruaP0p.js → safeJsonParse-BP38mwlj.js} +9 -9
  174. package/dist/safeJsonParse-BP38mwlj.js.map +1 -0
  175. package/dist/{safeJsonParse-BBnQElk8.cjs → safeJsonParse-Sms2CJf4.cjs} +9 -9
  176. package/dist/safeJsonParse-Sms2CJf4.cjs.map +1 -0
  177. package/dist/{safeStableStringify-Cc62pfRp.cjs → safeStableStringify-CJtP89qn.cjs} +4 -4
  178. package/dist/{safeStableStringify-Cc62pfRp.cjs.map → safeStableStringify-CJtP89qn.cjs.map} +1 -1
  179. package/dist/{safeStableStringify-BNh3D0K0.js → safeStableStringify-CXOZ9Ub8.js} +4 -4
  180. package/dist/{safeStableStringify-BNh3D0K0.js.map → safeStableStringify-CXOZ9Ub8.js.map} +1 -1
  181. package/dist/strings/index.cjs +12 -9
  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 +12 -9
  186. package/dist/strings/index.js.map +1 -1
  187. package/dist/tailwind/index.cjs +2 -2
  188. package/dist/tailwind/index.d.cts +2 -2
  189. package/dist/tailwind/index.d.ts +2 -2
  190. package/dist/tailwind/index.js +2 -2
  191. package/dist/{tailwind-IJvOdkZp.js → tailwind-B2ssevxq.js} +5 -5
  192. package/dist/tailwind-B2ssevxq.js.map +1 -0
  193. package/dist/{tailwind-DJ4cmLUw.cjs → tailwind-CHIx9uxu.cjs} +5 -5
  194. package/dist/tailwind-CHIx9uxu.cjs.map +1 -0
  195. package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs → toStringArrayUnRecursive-C4zYCja7.cjs} +6 -6
  196. package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs.map → toStringArrayUnRecursive-C4zYCja7.cjs.map} +1 -1
  197. package/dist/{toStringArrayUnRecursive-CFs0jTEg.js → toStringArrayUnRecursive-DJGtPsFb.js} +6 -6
  198. package/dist/{toStringArrayUnRecursive-CFs0jTEg.js.map → toStringArrayUnRecursive-DJGtPsFb.js.map} +1 -1
  199. package/dist/urls/index.cjs +15 -14
  200. package/dist/urls/index.cjs.map +1 -1
  201. package/dist/urls/index.d.cts +656 -659
  202. package/dist/urls/index.d.ts +656 -659
  203. package/dist/urls/index.js +15 -14
  204. package/dist/urls/index.js.map +1 -1
  205. package/package.json +2 -2
  206. package/dist/assertIsBoolean-BlBct0Fc.js.map +0 -1
  207. package/dist/assertIsBoolean-DozdtbNi.cjs.map +0 -1
  208. package/dist/conversions-CBs8-REq.cjs.map +0 -1
  209. package/dist/conversions-EMJa3g-D.js.map +0 -1
  210. package/dist/formatEnvPort-DpIXzPAZ.js.map +0 -1
  211. package/dist/formatEnvPort-hHNvOim-.cjs.map +0 -1
  212. package/dist/formatters-QcZO_Cpx.js.map +0 -1
  213. package/dist/formatters-lAYgA11L.cjs.map +0 -1
  214. package/dist/index-26W7ItWx.d.ts +0 -760
  215. package/dist/index-BPPQjAfs.d.cts +0 -2359
  216. package/dist/index-BXjlgBLz.d.cts +0 -2139
  217. package/dist/index-B_Wwo91H.d.ts +0 -2359
  218. package/dist/index-CpufydcI.d.cts +0 -704
  219. package/dist/index-Czc4O526.d.ts +0 -333
  220. package/dist/index-DPs1_p5G.d.cts +0 -760
  221. package/dist/index-DRpOyBSC.d.ts +0 -1703
  222. package/dist/index-DWWvtHUn.d.cts +0 -822
  223. package/dist/index-DnM0LD0n.d.cts +0 -333
  224. package/dist/index-GUZ9fK6T.d.ts +0 -2139
  225. package/dist/index-I4fAzwXV.d.ts +0 -704
  226. package/dist/index-JDrOl_19.d.ts +0 -822
  227. package/dist/index-b66P49Qe.d.cts +0 -1703
  228. package/dist/isPlainObject-DcFGh3_5.d.ts +0 -530
  229. package/dist/isPlainObject-doTI11Ib.d.cts +0 -530
  230. package/dist/isValidDomain-BSXshgkC.cjs.map +0 -1
  231. package/dist/isValidDomain-DwA2EN79.js.map +0 -1
  232. package/dist/punyCode-CTWXVVFo.cjs.map +0 -1
  233. package/dist/punyCode-hmiFzLWT.js.map +0 -1
  234. package/dist/removeSpaces-BE8lfh-4.js.map +0 -1
  235. package/dist/removeSpaces-DRRxNWlb.cjs.map +0 -1
  236. package/dist/safeJsonParse-BBnQElk8.cjs.map +0 -1
  237. package/dist/safeJsonParse-CXruaP0p.js.map +0 -1
  238. package/dist/tailwind-DJ4cmLUw.cjs.map +0 -1
  239. package/dist/tailwind-IJvOdkZp.js.map +0 -1
@@ -2,173 +2,175 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.12.1-beta.0`
5
+ * Version: `3.12.1-beta.1`
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
- * * ***Utility: `disableUserInteraction`.***
12
- * ----------------------------------------------------------
13
- * **Disables user interaction by adding a CSS class to the `<html>` element.**
14
- * - **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).
20
- * - **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.
24
- * - **Validation:**
25
- * - Throws `TypeError` if the `className` parameter is not a string.
26
- * @defaultValue `"on_processing"`
27
- * @param {string} [className="on_processing"] - The CSS class to add, defaults to `"on_processing"`.
28
- * @returns {void} Does not return anything (void).
29
- * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.
30
- * @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
- * ```
52
- */
11
+ * * ***Utility: `disableUserInteraction`.***
12
+ * ----------------------------------------------------------
13
+ * **Disables user interaction by adding a CSS class to the `<html>` element.**
14
+ * - **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).
20
+ * - **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.
24
+ * - **Validation:**
25
+ * - Throws `TypeError` if the `className` parameter is not a string.
26
+ * @defaultValue `"on_processing"`
27
+ * @param {string} [className="on_processing"] - The CSS class to add, defaults to `"on_processing"`.
28
+ * @returns {void} Does not return anything (void).
29
+ * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.
30
+ * @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
+ * ```
52
+ */
53
53
  declare const disableUserInteraction: (className?: string) => void;
54
54
  /** ----------------------------------------------------------
55
- * * ***Utility: `enableUserInteraction`.***
56
- * ----------------------------------------------------------
57
- * **Enables user interaction by removing a CSS class from the `<html>` element.**
58
- * - **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.
64
- * - **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.
68
- * - **Validation:**
69
- * - Throws `TypeError` if the `className` parameter is not a string.
70
- * @defaultValue `"on_processing"`
71
- * @param {string} [className="on_processing"] - The CSS class to remove, defaults to `"on_processing"`.
72
- * @returns {void} Does not return anything (void).
73
- * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.
74
- * @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
- * ```
96
- */
55
+ * * ***Utility: `enableUserInteraction`.***
56
+ * ----------------------------------------------------------
57
+ * **Enables user interaction by removing a CSS class from the `<html>` element.**
58
+ * - **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.
64
+ * - **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.
68
+ * - **Validation:**
69
+ * - Throws `TypeError` if the `className` parameter is not a string.
70
+ * @defaultValue `"on_processing"`
71
+ * @param {string} [className="on_processing"] - The CSS class to remove, defaults to `"on_processing"`.
72
+ * @returns {void} Does not return anything (void).
73
+ * @throws **{@link TypeError | `TypeError`}** if `className` is not a string.
74
+ * @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
+ * ```
96
+ */
97
97
  declare const enableUserInteraction: (className?: string) => void;
98
98
  /** ----------------------------------------------------------
99
- * * ***Utility: `removeElementFocus`.***
100
- * ----------------------------------------------------------
101
- * **Removes focus from the currently active element in the document.**
102
- * - **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.
106
- * @returns {void} Does not return anything (void).
107
- * @example
108
- * removeElementFocus(); // ➔ Removes focus from the currently active element
109
- */
99
+ * * ***Utility: `removeElementFocus`.***
100
+ * ----------------------------------------------------------
101
+ * **Removes focus from the currently active element in the document.**
102
+ * - **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.
106
+ * @returns {void} Does not return anything (void).
107
+ * @example
108
+ * removeElementFocus(); // ➔ Removes focus from the currently active element
109
+ */
110
110
  declare const removeElementFocus: () => void;
111
- /** @private ***Types options for {@link scrollToTop | `scrollToTop`}.*** */
111
+ /**
112
+ * ***Types options for {@link scrollToTop | `scrollToTop`}.***
113
+ */
112
114
  type ScrollToTopOptions = {
113
115
  /** ----------------------------------------------------------
114
- * * ***Scroll animation type.***
115
- * ----------------------------------------------------------
116
- * - ***Behavior:***
117
- * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
118
- * - Default force to `"smooth"` if missing or invalid.
119
- *
120
- * @default "smooth"
121
- */
116
+ * * ***Scroll animation type.***
117
+ * ----------------------------------------------------------
118
+ * - ***Behavior:***
119
+ * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
120
+ * - Default force to `"smooth"` if missing or invalid.
121
+ *
122
+ * @default "smooth"
123
+ */
122
124
  behavior?: ScrollBehavior | undefined;
123
125
  /** ----------------------------------------------------------
124
- * * ***Delay before scrolling (in milliseconds).***
125
- * ----------------------------------------------------------
126
- * - ***Behavior:***
127
- * - Default value is `1`.
128
- * - Valid values: any number `≥` `1`.
129
- * - Non-integer number are truncated to an integer.
130
- * - Force to `2147483647` if number is larger than `2147483647`.
131
- * - Default force to `1` if `missing`, `NaN`, `invalid-type`, or `less-than` `1`.
132
- *
133
- * @default 1
134
- */
126
+ * * ***Delay before scrolling (in milliseconds).***
127
+ * ----------------------------------------------------------
128
+ * - ***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`.
134
+ *
135
+ * @default 1
136
+ */
135
137
  timeout?: number | undefined;
136
138
  };
137
139
  /** ----------------------------------------------------------
138
- * * ***Utility: `scrollToTop`.***
139
- * ----------------------------------------------------------
140
- * **Scrolls the page to the top with optional smooth animation and delay.**
141
- * - **Features**:
142
- * - This function works **only in browser environments** (no effect on server-side).
143
- * - It leverages the native `window.scrollTo()` API with support for smooth scrolling
144
- * and an optional timeout delay before executing the scroll.
145
- * - Each option has strict valid values.
146
- * - If an invalid value is provided, the function **automatically falls back to its default**.
147
- * @param {ScrollToTopOptions} [options] - Optional settings for scroll behavior.
148
- * @param {ScrollToTopOptions["behavior"]} [options.behavior="smooth"] - Scroll animation type.
149
- * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
150
- * - Default force to `"smooth"` if missing or invalid.
151
- * @param {ScrollToTopOptions["timeout"]} [options.timeout=1] - Delay before scrolling (in milliseconds).
152
- * - Default value is `1`.
153
- * - Valid values: any number `≥` `1`.
154
- * - Non-integer number are truncated to an integer.
155
- * - Force to `2147483647` if number is larger than `2147483647`.
156
- * - Default force to `1` if `missing`, `NaN`, `invalid`, or `less-than` `1`.
157
- * @returns {void} Does not return anything, only scrolling to top (void).
158
- * @example
159
- * // ✅ Valid options value:
160
- * scrollToTop();
161
- * // ➔ Scroll smoothly to the top after 1ms delay
162
- * scrollToTop({ behavior: "instant" });
163
- * // ➔ Jump instantly to the top
164
- * scrollToTop({ timeout: 500 });
165
- * // ➔ Scroll smoothly to the top after 500ms
166
- *
167
- * // ❌ Invalid options value:
168
- * scrollToTop({ behavior: "fly", timeout: -100 });
169
- * // ➔ Fallback: behavior="smooth", timeout=1
170
- * scrollToTop({ behavior: "fly", timeout: 123.55 });
171
- * // ➔ Fallback: behavior="smooth", timeout=123
172
- */
140
+ * * ***Utility: `scrollToTop`.***
141
+ * ----------------------------------------------------------
142
+ * **Scrolls the page to the top with optional smooth animation and delay.**
143
+ * - **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**.
149
+ * @param {ScrollToTopOptions} [options] - Optional settings for scroll behavior.
150
+ * @param {ScrollToTopOptions["behavior"]} [options.behavior="smooth"] - Scroll animation type.
151
+ * - Valid values: `"auto"`, `"instant"`, `"smooth"`.
152
+ * - Default force to `"smooth"` if missing or invalid.
153
+ * @param {ScrollToTopOptions["timeout"]} [options.timeout=1] - Delay before scrolling (in milliseconds).
154
+ * - Default value is `1`.
155
+ * - Valid values: any number `≥` `1`.
156
+ * - Non-integer number are truncated to an integer.
157
+ * - Force to `2147483647` if number is larger than `2147483647`.
158
+ * - Default force to `1` if `missing`, `NaN`, `invalid`, or `less-than` `1`.
159
+ * @returns {void} Does not return anything, only scrolling to top (void).
160
+ * @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
174
+ */
173
175
  declare const scrollToTop: (options?: ScrollToTopOptions) => void;
174
176
  export { disableUserInteraction, enableUserInteraction, removeElementFocus, scrollToTop };
@@ -2,14 +2,14 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.12.1-beta.0`
5
+ * Version: `3.12.1-beta.1`
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
- import { A as isPlainObject, b as hasOwnProp, w as isNumber, y as isNonEmptyString } from "../assertIsBoolean-BlBct0Fc.js";
11
- import { t as assertIsString } from "../assertIsString-DqV9NwbI.js";
12
- import { t as isServer } from "../isServer-D1TXfOs3.js";
10
+ import { A as isPlainObject, b as hasOwnProp, w as isNumber, y as isNonEmptyString } from "../assertIsBoolean-DR1SaXPD.js";
11
+ import { t as assertIsString } from "../assertIsString-CEB07_83.js";
12
+ import { t as isServer } from "../isServer-Da3o3XSs.js";
13
13
  const disableUserInteraction = (className = "on_processing") => {
14
14
  if (isServer()) return;
15
15
  assertIsString(className, { message({ validType, currentType }) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"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/** @private ***Types options for {@link scrollToTop | `scrollToTop`}.*** */\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,IAAI,UAAU,EAAE;CAEhB,eAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAO,mDAAmD,UAAU,sBAAsB,YAAY;IAEzG,CAAC;CAEF,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,CAAC,gBAAgB,UAAU,SAAS,UAAU,EACnE,gBAAgB,UAAU,IAAI,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACf5C,MAAa,yBACX,YAAoB,oBACX;CAET,IAAI,UAAU,EAAE;CAEhB,eAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAO,mDAAmD,UAAU,sBAAsB,YAAY;IAEzG,CAAC;CAEF,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,gBAAgB,UAAU,SAAS,UAAU,EAClE,gBAAgB,UAAU,OAAO,UAAU;;;;;;;;;;;;;;;;;AC/C/C,MAAa,2BAAiC;CAE5C,IAAI,UAAU,EAAE;CAEhB,MAAM,gBAAgB,SAAS;CAE/B,IAAI,yBAAyB,aAC3B,cAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgDxB,MAAa,eAAe,YAAuC;CAEjE,IAAI,UAAU,EAAE;CAGhB,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,WACJ,WAAW,SAAS,WAAW,IAC/B,iBAAiB,QAAQ,SAAS,IAClC;EAAC;EAAQ;EAAW;EAAS,CAAC,SAAS,QAAQ,SAAS,GACpD,QAAQ,WACR;CACN,IAAI,UACF,WAAW,SAAS,UAAU,IAC9B,SAAS,QAAQ,QAAQ,IACzB,QAAQ,WAAW,IACf,QAAQ,UACR;CAEN,UAAU,UAAU,aAAa,aAAa;CAE9C,iBAAiB,OAAO,SAAS;EAAE,KAAK;EAAG,MAAM;EAAG;EAAU,CAAC,EAAE,QAAQ"}
1
+ {"version":3,"file":"index.js","names":[],"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,IAAI,UAAU,EAAE;CAEhB,eAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAO,mDAAmD,UAAU,sBAAsB,YAAY;IAEzG,CAAC;CAEF,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,CAAC,gBAAgB,UAAU,SAAS,UAAU,EACnE,gBAAgB,UAAU,IAAI,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACf5C,MAAa,yBACX,YAAoB,oBACX;CAET,IAAI,UAAU,EAAE;CAEhB,eAAe,WAAW,EACxB,QAAQ,EAAE,WAAW,eAAe;EAClC,OAAO,mDAAmD,UAAU,sBAAsB,YAAY;IAEzG,CAAC;CAEF,MAAM,EAAE,oBAAoB;CAE5B,IAAI,mBAAmB,gBAAgB,UAAU,SAAS,UAAU,EAClE,gBAAgB,UAAU,OAAO,UAAU;;;;;;;;;;;;;;;;;AC/C/C,MAAa,2BAAiC;CAE5C,IAAI,UAAU,EAAE;CAEhB,MAAM,gBAAgB,SAAS;CAE/B,IAAI,yBAAyB,aAC3B,cAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkDxB,MAAa,eAAe,YAAuC;CAEjE,IAAI,UAAU,EAAE;CAGhB,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,WACJ,WAAW,SAAS,WAAW,IAC/B,iBAAiB,QAAQ,SAAS,IAClC;EAAC;EAAQ;EAAW;EAAS,CAAC,SAAS,QAAQ,SAAS,GACpD,QAAQ,WACR;CACN,IAAI,UACF,WAAW,SAAS,UAAU,IAC9B,SAAS,QAAQ,QAAQ,IACzB,QAAQ,WAAW,IACf,QAAQ,UACR;CAEN,UAAU,UAAU,aAAa,aAAa;CAE9C,iBAAiB,OAAO,SAAS;EAAE,KAAK;EAAG,MAAM;EAAG;EAAU,CAAC,EAAE,QAAQ"}
@@ -2,17 +2,17 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.12.1-beta.0`
5
+ * Version: `3.12.1-beta.1`
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
- const require_assertIsBoolean = require('./assertIsBoolean-DozdtbNi.cjs');
12
- const require_safeStableStringify = require('./safeStableStringify-Cc62pfRp.cjs');
13
- const require_isEmptyString = require('./isEmptyString-CCK3bP74.cjs');
14
- const require_isValidDomain = require('./isValidDomain-BSXshgkC.cjs');
15
- const require_removeSpaces = require('./removeSpaces-DRRxNWlb.cjs');
11
+ const require_assertIsBoolean = require('./assertIsBoolean-C8WEXVr2.cjs');
12
+ const require_safeStableStringify = require('./safeStableStringify-CJtP89qn.cjs');
13
+ const require_isEmptyString = require('./isEmptyString-UiiUsSQj.cjs');
14
+ const require_isValidDomain = require('./isValidDomain-BB9IGhJs.cjs');
15
+ const require_removeSpaces = require('./removeSpaces-CWIvhZHg.cjs');
16
16
  var NormalizePathnameError = class NormalizePathnameError extends Error {
17
17
  originalError;
18
18
  constructor(message, originalError) {
@@ -119,7 +119,7 @@ const stripLeadingDomain = (path, options) => {
119
119
  if (currentPath.startsWith("/")) currentPath = currentPath.replace(/\/{2,}/g, "/").slice(1);
120
120
  const segments = currentPath.split("/");
121
121
  const firstPart = segments[0];
122
- const domainPart = firstPart.split(":")[0];
122
+ const domainPart = firstPart?.split(":")[0];
123
123
  const isDomain = require_isValidDomain.isValidDomain(domainPart, {
124
124
  subdomain: true,
125
125
  allowUnicode: true,
@@ -131,7 +131,7 @@ const stripLeadingDomain = (path, options) => {
131
131
  });
132
132
  let hasIgnoredExtension = false;
133
133
  if (ignoreDomainExtensions) {
134
- for (const ext of ignoreDomainExtensions) if (firstPart.endsWith(ext)) {
134
+ for (const ext of ignoreDomainExtensions) if (firstPart?.endsWith(ext)) {
135
135
  hasIgnoredExtension = true;
136
136
  break;
137
137
  }
@@ -168,4 +168,4 @@ Object.defineProperty(exports, 'normalizePathname', {
168
168
  return normalizePathname;
169
169
  }
170
170
  });
171
- //# sourceMappingURL=formatEnvPort-hHNvOim-.cjs.map
171
+ //# sourceMappingURL=formatEnvPort-B3OLxQk9.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatEnvPort-B3OLxQk9.cjs","names":["isFunction","isNonEmptyString","getPreciseType","safeStableStringify","isUndefined","isSet","isArray","isNil","isString","isNull","removeSpaces","isValidDomain","isError","isNonEmptyString","hasOwnProp","isBoolean","getPreciseType","isEmptyString"],"sources":["../src/urls/_private/NormalizePathnameError.ts","../src/urls/pathname/normalizePathname.ts","../src/urls/utils/formatEnvPort.ts"],"sourcesContent":["import { isFunction } from \"@/predicates/is/isFunction\";\n\n/** ---------------------------------\n * * ***Custom Error for Pathname Normalization Failures***\n * ---------------------------------\n */\nexport class NormalizePathnameError extends Error {\n /** ---------------------------------\n * * ***The original error that triggered this normalization failure.***\n * ---------------------------------\n *\n * **Always available for backward compatibility.**\n */\n public readonly originalError: Error;\n\n constructor(message: string, originalError: Error) {\n // Pass a `cause` option if the runtime supports it (ignored by older engines).\n super(message, isFunction(Error) ? { cause: originalError } : undefined);\n\n this.name = \"NormalizePathnameError\";\n this.originalError = originalError;\n\n // Preserve stack trace when available (Node.js & modern browsers).\n if (isFunction(Error.captureStackTrace)) {\n Error.captureStackTrace(this, NormalizePathnameError);\n } else {\n // Fallback for very old environments.\n this.stack = new Error(message).stack;\n }\n }\n\n /** ---------------------------------\n * * ***Safe JSON representation for logging or IPC.***\n * ---------------------------------\n */\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n stack: this.stack,\n originalError: {\n name: this.originalError.name,\n message: this.originalError.message,\n stack: this.originalError.stack\n }\n };\n }\n}\n","import type { OverrideTypes, Prettify } from \"@rzl-zone/ts-types-plus\";\n\nimport { isSet } from \"@/predicates/is/isSet\";\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isError } from \"@/predicates/is/isError\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isValidDomain } from \"@/predicates/is/isValidDomain\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nimport { removeSpaces } from \"@/strings/sanitizations/removeSpaces\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport { NormalizePathnameError } from \"../_private/NormalizePathnameError\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\n\n/** Options when `keepNullable` is false (default).\n *\n * Returns `defaultPath` if `pathname` is empty or invalid.\n */\ntype UnKeepNullableOptions = {\n /** * ***Fallback value returned if `pathname` is empty-string or invalid.***\n *\n * Must be a **`non-empty string`**, defaultValue: `\"/\"`.\n *\n * @default \"/\"\n */\n defaultPath?: string;\n\n /** * ***Whether to preserve `null` or `undefined`, defaultValue: `false`.***\n *\n * @default false\n */\n keepNullable?: false;\n};\n\n/** Options when `keepNullable` is true.\n *\n * Preserves `null` or `undefined` instead of returning `defaultPath`.\n */\ntype KeepNullableOptions = {\n /** * ***Fallback path is ignored when `keepNullable` is true **(except if\n * `pathname` is empty-string or invalid, even this `true`)**,\n * defaultValue: `\"/\"`.***\n *\n * @default \"/\"\n */\n defaultPath?: string;\n\n /** * ***Preserve `null` or `undefined` as-is if `true` (defaultValue: `false`).***\n *\n * - ***⚠️ Notes:***\n * - Keep returning `defaultPath` if `pathname` is empty-string, even this `true`.\n *\n * **Must be `true` in this type.**\n *\n * @default false\n */\n keepNullable?: true;\n};\n\ntype MainNormalizePathnameOptions = {\n /** --------------------------------------------------------\n * * ***Preserve trailing slash at the end of the normalized pathname, defaultValue: `false`.***\n * --------------------------------------------------------\n *\n * @default `false`\n */\n keepTrailingSlash?: boolean;\n\n /** --------------------------------------------------------\n * * ***Allow special localhost domain at the beginning of the pathname.***\n * --------------------------------------------------------\n * @description\n * If `true`, the first segment of the pathname that is `/localhost` or `localhost`\n * (with or without a port, e.g., `localhost:3000`) will be treated as a special domain\n * and **removed** from the normalized pathname.\n *\n * - **Examples (`localhostDomain: true`)**:\n * - `\"/localhost/path\"` ➔ `\"/path\"`\n * - `\"localhost:3000/path\"` ➔ `\"/path\"`\n * - `\"localhost\"` ➔ `\"/\"` (entire path removed)\n *\n * - Only the **first path segment** is affected. Any subsequent occurrences of `\"localhost\"`\n * will remain intact.\n *\n * @default false\n */\n localhostDomain?: boolean;\n\n /**\n * --------------------------------------------------------\n * * ***Custom list of file extensions that prevent the first path segment from being treated as a domain.***\n * --------------------------------------------------------\n *\n * **Description:**\n * - The first segment of a pathname is often interpreted as a domain (e.g., `example.com`).\n * - If this first segment ends with any of the extensions listed here, it will **not** be considered a domain,\n * and will instead be preserved as part of the relative path.\n * - This is useful for cases where filenames appear at the start of a path and you want them treated as relative paths,\n * such as `\"image.png?version=2\"` or `\"archive.tar.gz#download\"`.\n * - Only the **first path segment** is affected; all other segments are processed normally.\n * - **Ignored** if:\n * 1. The pathname starts with a full URL protocol (`http://` or `https://`), e.g., `\"https://example.com/file.png\"`.\n * 2. The first path segment is already a valid domain, e.g., `\"example.com/image.png\"`.\n *\n * **Type & Validation:**\n * - Must be a `Set<string>` or `string[]`.\n * - Each string **must include the leading dot**, e.g., `.png`, `.tar.gz`.\n * - Multi-part extensions (like `.tar.gz`, `.tar.bz`) are supported.\n * - Throws a **TypeError** if:\n * 1. The type is not a `Set<string>` or `string[]`.\n * 2. Any string in the array/set is empty.\n * 3. Any string does not start with a dot (`.`).\n *\n * **Usage Notes:**\n * - Only applied when the first segment is otherwise domain-like **and** pathname is relative or domain-like without protocol.\n * - Query strings (`?x=1`) and hash fragments (`#section`) are preserved.\n *\n * **Examples (relative paths, option active):**\n * ```ts\n * normalizePathname(\"image.png?version=2\", {\n * ignoreDomainExtensions: [\".png\", \".jpg\"]\n * });\n * // ➔ \"/image.png?version=2\"\n *\n * normalizePathname(\"archive.tar.gz#download\", {\n * ignoreDomainExtensions: new Set([\".tar.gz\"])\n * });\n * // ➔ \"/archive.tar.gz#download\"\n *\n * normalizePathname(\"script.js?module=true#top\", {\n * ignoreDomainExtensions: [\".js\"]\n * });\n * // ➔ \"/script.js?module=true#top\"\n * ```\n *\n * **Examples (full URL or explicit domain - option ignored):**\n * ```ts\n * normalizePathname(\"https://example.com/image.png?version=2\", {\n * ignoreDomainExtensions: [\".png\"]\n * });\n * // ➔ \"/image.png?version=2\" // URL is parsed normally; ignoreDomainExtensions has no effect\n *\n * normalizePathname(\"example.com/script.js?module=true#top\", {\n * ignoreDomainExtensions: [\".js\"]\n * });\n * // ➔ \"/script.js?module=true#top\" // domain recognized; option ignored\n * ```\n *\n * **Notes:**\n * - Only the **first path segment** is checked.\n * - Prevents false-positive domain stripping for filenames that look like domains.\n * - Throws **TypeError** if invalid type or invalid string is provided.\n *\n * @default undefined (feature inactive if not provided)\n */\n ignoreDomainExtensions?: Set<string> | string[];\n};\n\n/** Options for main `normalizePathname`.\n *\n * Combines `UnKeepNullableOptions` or `KeepNullableOptions` with trailing slash control.\n */\ntype NormalizePathnameOptions = Prettify<\n MainNormalizePathnameOptions & (UnKeepNullableOptions | KeepNullableOptions)\n>;\n\ntype NormalizePathnameOptionsKeepNullableTrue = MainNormalizePathnameOptions &\n KeepNullableOptions;\ntype NormalizePathnameOptionsKeepNullableFalse = MainNormalizePathnameOptions &\n UnKeepNullableOptions;\n\ntype ResUnKeepNullable<T> = T extends undefined\n ? string\n : T extends null\n ? string\n : T extends null | undefined\n ? string\n : string;\n\ntype ResKeepNullable<T> = T extends string\n ? string\n : T extends undefined\n ? undefined\n : T extends null\n ? null\n : T extends null | undefined\n ? null | undefined\n : string | null | undefined;\n\n/** --------------------------------------------------------\n * * ***Utility: `normalizePathname`.***\n * --------------------------------------------------------\n *\n * - **Description:**\n * Normalizes any pathname or URL string to a clean, predictable format.\n * Useful for routing, file paths, and URL handling.\n * - Handles:\n * - Leading/trailing spaces\n * - Internal spaces in path segments\n * - Redundant slashes (`//`)\n * - Full URLs vs relative paths\n * - Query (`?`) and hash (`#`) preservation\n * - Unicode & emoji characters\n * - Optional nullable preservation (`keepNullable`)\n * - Optional trailing slash preservation (`keepTrailingSlash`)\n * - Optional removal of localhost first segment (`localhostDomain`)\n * - Prevention of false-positive domain stripping (`ignoreDomainExtensions`)\n *\n * - **Key Steps Internally:**\n * 1. Validate `options` (plain object, correct types)\n * 2. Validate `defaultPath` (non-empty string if `keepNullable` is false)\n * 3. Validate `ignoreDomainExtensions` (Set<string> | string[], each starts with `.`)\n * 4. Handle nullable:\n * - Returns `null` / `undefined` if `keepNullable: true`\n * - Otherwise uses `defaultPath`\n * 5. Trim spaces, remove internal spaces\n * 6. If full URL: parse using `URL` constructor\n * 7. If relative path or domain-like:\n * - Remove `localhost`/`localhost:port` if `localhostDomain`\n * - Remove first segment if domain-like and **not** in `ignoreDomainExtensions`\n * 8. Normalize slashes\n * 9. Ensure leading slash\n * 10. Handle trailing slash\n * 11. Decode Unicode safely\n * 12. Return normalized pathname + search + hash\n *\n * - **Error Handling:**\n * - **TypeError**:\n * - `defaultPath` invalid (non-string or empty) when `keepNullable: false`\n * - `keepNullable`, `keepTrailingSlash`, `localhostDomain` not boolean\n * - `ignoreDomainExtensions` invalid\n * - **NormalizePathnameError** (extends ***Error***):\n * - Invalid URL parsing\n * - Unexpected normalization errors\n *\n * - **Options:**\n * ```ts\n * {\n * // fallback if invalid path, default: \"/\"\n * defaultPath?: string;\n * // preserve null/undefined, default: false\n * keepNullable?: boolean;\n * // preserve trailing slash, default: false\n * keepTrailingSlash?: boolean;\n * // remove localhost:port first segment, default: false\n * localhostDomain?: boolean;\n * // prevent domain stripping, default: undefined\n * ignoreDomainExtensions?: Set<string> | string[];\n * }\n * ```\n *\n * @example\n * // Basic path cleaning\n * normalizePathname(\" /foo//bar \");\n * // ➔ \"/foo/bar\"\n *\n * // Trailing slash control\n * normalizePathname(\"/api//v1//user//\", { keepTrailingSlash: true });\n * // ➔ \"/api/v1/user/\"\n * normalizePathname(\"/api//v1//user//\", { keepTrailingSlash: false });\n * // ➔ \"/api/v1/user\"\n *\n * // Full URL normalization\n * normalizePathname(\"https://example.com//path///to/resource?x=1#hash\");\n * // ➔ \"/path/to/resource?x=1#hash\"\n *\n * // Null/undefined preservation\n * normalizePathname(null, { keepNullable: true });\n * // ➔ null\n * normalizePathname(undefined, { keepNullable: true });\n * // ➔ undefined\n *\n * // Default fallback\n * normalizePathname(\"\", { defaultPath: \"/home\" });\n * // ➔ \"/home\"\n *\n * // Localhost removal\n * normalizePathname(\"localhost:3000/path/to/resource\", { localhostDomain: true });\n * // ➔ \"/path/to/resource\"\n *\n * // Prevent false-positive domain stripping\n * normalizePathname(\"archive.tar.gz#download\", { ignoreDomainExtensions: [\".tar.gz\"] });\n * // ➔ \"/archive.tar.gz#download\"\n * normalizePathname(\"image.png?version=2\", { ignoreDomainExtensions: [\".png\"] });\n * // ➔ \"/image.png?version=2\"\n *\n * // Emojis and Unicode\n * normalizePathname(\"🔥//deep//path///🚀\");\n * // ➔ \"/🔥/deep/path/🚀\"\n *\n * // Query-only or hash-only\n * normalizePathname(\"?page=2\");\n * // ➔ \"/?page=2\"\n * normalizePathname(\"#section3\");\n * // ➔ \"/#section3\"\n *\n * // Complex nested paths\n * normalizePathname(\" //nested///folder//file.txt \");\n * // ➔ \"/nested/folder/file.txt\"\n *\n * // Invalid URL triggers error\n * try {\n * normalizePathname(\"http://\");\n * } catch (e) {\n * // console.log(e);\n * }\n *\n * // First segment is domain but ignored due to extension\n * normalizePathname(\"example.tar.bz/file\", { ignoreDomainExtensions: [\".tar.bz\"] });\n * // ➔ \"/example.tar.bz/file\"\n */\nexport function normalizePathname<T>(\n pathname: T,\n options?: NormalizePathnameOptionsKeepNullableFalse\n): ResUnKeepNullable<T>;\nexport function normalizePathname<T>(\n pathname: T,\n options?: NormalizePathnameOptionsKeepNullableTrue\n): ResKeepNullable<T>;\nexport function normalizePathname(\n pathname: unknown,\n options: NormalizePathnameOptions = {\n defaultPath: \"/\",\n keepNullable: false\n }\n): string | null | undefined {\n assertIsPlainObject(options, {\n message({ currentType, validType }) {\n return `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n const {\n defaultPath = \"/\",\n keepNullable = false,\n keepTrailingSlash = false,\n localhostDomain = false,\n ignoreDomainExtensions = undefined\n } = options;\n\n // Validate defaultPath\n if (!isNonEmptyString(defaultPath)) {\n throw new TypeError(\n `Parameter \\`defaultPath\\` property of the \\`options\\` (second parameter) must be of type \\`string\\` and not empty-string, but received: \\`${getPreciseType(\n defaultPath\n )}\\`, with value: \\`${safeStableStringify(defaultPath, {\n keepUndefined: true\n })}\\`.`\n );\n }\n\n assertIsBoolean(keepNullable, {\n message({ currentType, validType }) {\n return `Parameter \\`keepNullable\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n assertIsBoolean(keepTrailingSlash, {\n message({ currentType, validType }) {\n return `Parameter \\`keepTrailingSlash\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n assertIsBoolean(localhostDomain, {\n message({ currentType, validType }) {\n return `Parameter \\`localhostDomain\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n let ignoreDomainExtsSet: Set<string> | undefined;\n\n if (!isUndefined(ignoreDomainExtensions)) {\n if (!isSet(ignoreDomainExtensions) && !isArray(ignoreDomainExtensions)) {\n throw new TypeError(\n `Parameter \\`ignoreDomainExtensions\\` must be of type a \\`Set<string>\\` or \\`string[]\\`, but received: \\`${getPreciseType(\n ignoreDomainExtensions\n )}\\`.`\n );\n }\n\n ignoreDomainExtsSet = isSet(ignoreDomainExtensions)\n ? ignoreDomainExtensions\n : new Set(ignoreDomainExtensions);\n\n // validation every ext\n let idx = 0;\n for (const ext of ignoreDomainExtsSet) {\n if (!isNonEmptyString(ext)) {\n throw new TypeError(\n `Parameter \\`ignoreDomainExtensions[${idx}]\\` must be a \\`string\\` and \\`non-empty string\\`, but received: \\`${safeStableStringify(\n ext,\n { keepUndefined: true }\n )}\\`.`\n );\n }\n if (!ext.startsWith(\".\")) {\n throw new TypeError(\n `Parameter \\`ignoreDomainExtensions[${idx}]\\` must start with a dot (.), but received: ${safeStableStringify(\n ext,\n { keepUndefined: true }\n )}`\n );\n }\n idx++;\n }\n }\n\n try {\n if (keepNullable && (isNil(pathname) || !isString(pathname))) {\n if (isNull(pathname)) return null;\n return undefined;\n }\n\n // If the pathname is invalid (null, undefined, or an empty string), return the default value, only if `keepNullable` is false\n let currentPathName: string = isNonEmptyString(pathname)\n ? pathname\n : defaultPath;\n\n // Trim spaces from the string (only trim leading and trailing spaces)\n currentPathName = removeSpaces(currentPathName, { trimOnly: true }).replace(\n /\\s+/g,\n \"\"\n ); // remove all space\n\n currentPathName = stripLeadingDomain(currentPathName, {\n keepTrailingSlash,\n localhostDomain,\n ignoreDomainExtensions: ignoreDomainExtsSet\n });\n\n let _pathName: string = currentPathName;\n let search = \"\";\n let hash = \"\";\n\n // relative path: extract search/hash manually\n const searchIndex = currentPathName.indexOf(\"?\");\n const hashIndex = currentPathName.indexOf(\"#\");\n\n if (searchIndex !== -1) {\n search = currentPathName.slice(\n searchIndex,\n hashIndex !== -1 ? hashIndex : undefined\n );\n }\n if (hashIndex !== -1) {\n hash = currentPathName.slice(hashIndex);\n }\n\n const endIndex = Math.min(\n searchIndex !== -1 ? searchIndex : currentPathName.length,\n hashIndex !== -1 ? hashIndex : currentPathName.length\n );\n _pathName = currentPathName.slice(0, endIndex);\n\n // Normalize slashes\n _pathName = \"/\" + _pathName.replace(/^\\/+/, \"\").replace(/\\/{2,}/g, \"/\");\n\n // Trailing slash\n if (!keepTrailingSlash && _pathName !== \"/\") {\n _pathName = _pathName.replace(/\\/+$/, \"\");\n }\n\n // Decode Unicode safely\n _pathName = decodeUnicodeSequences(_pathName);\n search = decodeUnicodeSequences(search);\n hash = decodeUnicodeSequences(hash);\n\n return _pathName + search + hash;\n } catch (error) {\n // Handle any errors that occur during processing\n throwError(error);\n }\n}\n\n// --- Internal Helper Utils ----\n\n/**\n * @internal\n */\nconst decodeUnicodeSequences = (str: string): string => {\n return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {\n try {\n const decoded = decodeURIComponent(match);\n // eslint-disable-next-line no-control-regex\n if (/^[\\u0000-\\u007F]+$/.test(decoded)) return match;\n // eslint-enable-next-line no-control-regex\n return decoded;\n } catch {\n return match;\n }\n });\n};\n\n/**\n * @internal\n */\nconst stripLeadingDomain = (\n path: string,\n options: OverrideTypes<\n MainNormalizePathnameOptions,\n { ignoreDomainExtensions?: Set<string> }\n >\n): string => {\n let currentPath = path;\n\n const { ignoreDomainExtensions, localhostDomain } = options;\n\n // Full URL (protocol) -> only normalize path, ignore ignoreDomainExtensions\n if (/^https?:\\/\\//i.test(currentPath)) {\n try {\n const url = new URL(currentPath);\n currentPath =\n url.pathname.replace(/^\\/+/, \"\").replace(/\\/{2,}/g, \"/\") +\n url.search +\n url.hash;\n\n return ensureLeadingSlash(currentPath);\n } catch (error) {\n // fallback: keep as-is\n // Handle any errors that occur during processing\n throwError(error);\n }\n }\n\n // relative path: remove leading slash\n if (currentPath.startsWith(\"/\")) {\n currentPath = currentPath.replace(/\\/{2,}/g, \"/\").slice(1);\n }\n\n // take first segment\n const segments = currentPath.split(\"/\");\n const firstPart = segments[0];\n const domainPart = firstPart?.split(\":\")[0];\n\n const isDomain = isValidDomain(domainPart, {\n subdomain: true,\n allowUnicode: true,\n wildcard: true,\n allowLocalhost: localhostDomain,\n allowPort: true,\n allowProtocol: true,\n topLevel: false\n });\n\n // ignoreDomainExtensions only applies for relative/non-protocol paths\n let hasIgnoredExtension = false;\n if (ignoreDomainExtensions) {\n for (const ext of ignoreDomainExtensions) {\n if (firstPart?.endsWith(ext)) {\n hasIgnoredExtension = true;\n break;\n }\n }\n }\n\n if (isDomain && !hasIgnoredExtension) {\n segments.shift(); // remove first segment\n }\n\n return ensureLeadingSlash(segments.join(\"/\"));\n};\n\n/**\n * @internal\n */\nconst ensureLeadingSlash = (path: string): string => {\n if (!path.startsWith(\"/\")) path = \"/\" + path;\n return path;\n};\n\n/**\n * @internal\n */\nconst throwError = (error: unknown): never => {\n // Handle any errors that occur during processing\n const err = isError(error)\n ? error\n : new Error(\"Unknown error from function `normalizePathname()`.\");\n throw new NormalizePathnameError(\n `Failed to normalize pathname in function \\`normalizePathname()\\`: ${err.message}`,\n err\n );\n};\n","import { isBoolean } from \"@/predicates/is/isBoolean\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype FormatEnvPortOptions = {\n /** Add prefix with a colon, defaultValue: `false`.\n *\n * @default false\n */\n prefixColon?: boolean;\n};\n\n/** -----------------------------------------------\n * * ***Utility: `formatEnvPort`.***\n * -----------------------------------------------\n * **Retrieves and formats an environment port variable.**\n * - **Behavior:**\n * - Extracts only digits from the input.\n * - If no digits found, returns an empty string.\n * - By default does NOT prefix with a colon.\n * - Use `{ prefixColon: true }` to prefix with a colon.\n * @param {string | null | undefined} envVar The environment variable string.\n * @param {FormatEnvPortOptions} [options] Optional object: `{ prefixColon?: boolean }`.\n * @returns {string} A string like `\":8080\"` or `\"8080\"`, or `\"\"` if no digits.\n * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or `prefixColon` is not boolean.\n * @example\n * formatEnvPort(\"port:8080\");\n * // ➔ \"8080\"\n * formatEnvPort(\"port:8080\", { prefixColon: true });\n * // ➔ \":8080\"\n */\nexport const formatEnvPort = (\n envVar: string | null | undefined,\n options: FormatEnvPortOptions = {}\n): string => {\n if (!isNonEmptyString(envVar)) return \"\"; // Handle empty string case\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const prefixColon = hasOwnProp(options, \"prefixColon\")\n ? options.prefixColon\n : false;\n\n if (!isBoolean(prefixColon)) {\n throw new TypeError(\n `Parameter \\`prefixColon\\` property of the \\`options\\` (second parameter) must be of type \\`boolean\\`, but received: \\`${getPreciseType(\n prefixColon\n )}\\`.`\n );\n }\n\n const digitsOnly = envVar.replace(/\\D+/g, \"\");\n if (isEmptyString(digitsOnly)) return \"\";\n\n return prefixColon ? `:${digitsOnly}` : digitsOnly;\n};\n"],"mappings":"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"}
@@ -2,16 +2,16 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.12.1-beta.0`
5
+ * Version: `3.12.1-beta.1`
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
- import { E as isNull, F as isBoolean, M as isArray, N as isNil, P as isFunction, S as isUndefined, T as assertIsPlainObject, b as hasOwnProp, f as isSet, k as isString, r as getPreciseType, t as assertIsBoolean, v as isError, y as isNonEmptyString } from "./assertIsBoolean-BlBct0Fc.js";
11
- import { t as safeStableStringify } from "./safeStableStringify-BNh3D0K0.js";
12
- import { t as isEmptyString } from "./isEmptyString-BTUWYTbw.js";
13
- import { t as isValidDomain } from "./isValidDomain-DwA2EN79.js";
14
- import { t as removeSpaces } from "./removeSpaces-BE8lfh-4.js";
10
+ import { E as isNull, F as isBoolean, M as isArray, N as isNil, P as isFunction, S as isUndefined, T as assertIsPlainObject, b as hasOwnProp, f as isSet, k as isString, r as getPreciseType, t as assertIsBoolean, v as isError, y as isNonEmptyString } from "./assertIsBoolean-DR1SaXPD.js";
11
+ import { t as safeStableStringify } from "./safeStableStringify-CXOZ9Ub8.js";
12
+ import { t as isEmptyString } from "./isEmptyString-BXzKAC2j.js";
13
+ import { t as isValidDomain } from "./isValidDomain-DoE98yhJ.js";
14
+ import { t as removeSpaces } from "./removeSpaces-Bmc5DX4F.js";
15
15
  var NormalizePathnameError = class NormalizePathnameError extends Error {
16
16
  originalError;
17
17
  constructor(message, originalError) {
@@ -118,7 +118,7 @@ const stripLeadingDomain = (path, options) => {
118
118
  if (currentPath.startsWith("/")) currentPath = currentPath.replace(/\/{2,}/g, "/").slice(1);
119
119
  const segments = currentPath.split("/");
120
120
  const firstPart = segments[0];
121
- const domainPart = firstPart.split(":")[0];
121
+ const domainPart = firstPart?.split(":")[0];
122
122
  const isDomain = isValidDomain(domainPart, {
123
123
  subdomain: true,
124
124
  allowUnicode: true,
@@ -130,7 +130,7 @@ const stripLeadingDomain = (path, options) => {
130
130
  });
131
131
  let hasIgnoredExtension = false;
132
132
  if (ignoreDomainExtensions) {
133
- for (const ext of ignoreDomainExtensions) if (firstPart.endsWith(ext)) {
133
+ for (const ext of ignoreDomainExtensions) if (firstPart?.endsWith(ext)) {
134
134
  hasIgnoredExtension = true;
135
135
  break;
136
136
  }
@@ -156,4 +156,4 @@ const formatEnvPort = (envVar, options = {}) => {
156
156
  return prefixColon ? `:${digitsOnly}` : digitsOnly;
157
157
  };
158
158
  export { normalizePathname as n, formatEnvPort as t };
159
- //# sourceMappingURL=formatEnvPort-DpIXzPAZ.js.map
159
+ //# sourceMappingURL=formatEnvPort-ByFVLjSV.js.map