@splendidlabz/utils 1.6.0 → 1.8.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 (474) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/dom/accessibility.cjs +53 -0
  3. package/dist/cjs/dom/actions/index.cjs +407 -0
  4. package/dist/cjs/dom/actions/masonry.cjs +149 -0
  5. package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +157 -0
  6. package/dist/cjs/dom/actions/sticky.cjs +211 -0
  7. package/dist/cjs/dom/bounding-box.cjs +70 -0
  8. package/dist/cjs/dom/clipboard.cjs +37 -0
  9. package/dist/cjs/dom/cookie.cjs +57 -0
  10. package/dist/cjs/dom/css-vars.cjs +57 -0
  11. package/dist/cjs/dom/events.cjs +95 -0
  12. package/dist/cjs/dom/focusable.cjs +143 -0
  13. package/dist/cjs/dom/font-size.cjs +74 -0
  14. package/dist/cjs/dom/get-element.cjs +98 -0
  15. package/dist/cjs/dom/hash.cjs +35 -0
  16. package/dist/cjs/dom/index.cjs +1197 -0
  17. package/dist/cjs/dom/keyboard.cjs +51 -0
  18. package/dist/cjs/dom/local-store.cjs +79 -0
  19. package/dist/cjs/dom/media.cjs +59 -0
  20. package/dist/cjs/dom/observers/index.cjs +156 -0
  21. package/dist/cjs/dom/observers/intersection-observer.cjs +91 -0
  22. package/dist/cjs/dom/observers/mutation-observer.cjs +95 -0
  23. package/dist/cjs/dom/observers/observer.cjs +48 -0
  24. package/dist/cjs/dom/observers/resize-observer.cjs +82 -0
  25. package/dist/cjs/dom/pkce.cjs +53 -0
  26. package/dist/cjs/dom/query-params.cjs +38 -0
  27. package/dist/cjs/dom/random-string.cjs +38 -0
  28. package/dist/cjs/dom/sanitize.cjs +65 -0
  29. package/dist/cjs/dom/session-store.cjs +49 -0
  30. package/dist/cjs/dom/spam-prevention.cjs +50 -0
  31. package/dist/cjs/dom/trap-focus.cjs +197 -0
  32. package/dist/cjs/dom/ui/aria-current.cjs +43 -0
  33. package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +35 -0
  34. package/dist/cjs/dom/ui/index.cjs +105 -0
  35. package/dist/cjs/dom/ui/scroll-container.cjs +47 -0
  36. package/dist/cjs/dom/ui/traverse-and-scramble.cjs +50 -0
  37. package/dist/cjs/lib/arrays/index.cjs +139 -0
  38. package/dist/cjs/lib/arrays/item-position.cjs +42 -0
  39. package/dist/cjs/lib/arrays/join.cjs +43 -0
  40. package/dist/cjs/lib/arrays/shuffle.cjs +42 -0
  41. package/dist/cjs/lib/arrays/sort.cjs +67 -0
  42. package/dist/cjs/lib/arrays/split-array.cjs +41 -0
  43. package/dist/cjs/lib/arrays/unique.cjs +31 -0
  44. package/dist/cjs/lib/auth/index.cjs +53 -0
  45. package/dist/cjs/lib/auth/route-manager.cjs +51 -0
  46. package/dist/cjs/lib/checks.cjs +58 -0
  47. package/dist/cjs/lib/date/days.cjs +37 -0
  48. package/dist/cjs/lib/date/index.cjs +208 -0
  49. package/dist/cjs/lib/date/months.cjs +102 -0
  50. package/dist/cjs/lib/date/time.cjs +117 -0
  51. package/dist/cjs/lib/form/form-data.cjs +83 -0
  52. package/dist/cjs/lib/form/index.cjs +122 -0
  53. package/dist/cjs/lib/form/sanitize.cjs +61 -0
  54. package/dist/cjs/lib/functions/debounce.cjs +43 -0
  55. package/dist/cjs/lib/functions/env.cjs +32 -0
  56. package/dist/cjs/lib/functions/functional.cjs +62 -0
  57. package/dist/cjs/lib/functions/index.cjs +122 -0
  58. package/dist/cjs/lib/functions/throttle.cjs +38 -0
  59. package/dist/cjs/lib/functions/timeout.cjs +41 -0
  60. package/dist/cjs/lib/hash.cjs +43 -0
  61. package/dist/cjs/lib/index.cjs +1146 -0
  62. package/dist/cjs/lib/numbers/index.cjs +49 -0
  63. package/dist/cjs/lib/numbers/math.cjs +36 -0
  64. package/dist/cjs/lib/objects/camelcase-keys.cjs +80 -0
  65. package/dist/cjs/lib/objects/empty.cjs +39 -0
  66. package/dist/cjs/lib/objects/equal.cjs +47 -0
  67. package/dist/cjs/lib/objects/extend.cjs +147 -0
  68. package/dist/cjs/lib/objects/flatten.cjs +48 -0
  69. package/dist/cjs/lib/objects/index.cjs +378 -0
  70. package/dist/cjs/lib/objects/json.cjs +35 -0
  71. package/dist/cjs/lib/objects/loop.cjs +40 -0
  72. package/dist/cjs/lib/objects/mix/mix.cjs +115 -0
  73. package/dist/cjs/lib/objects/nested-property.cjs +45 -0
  74. package/dist/cjs/lib/objects/normalize-object.cjs +106 -0
  75. package/dist/cjs/lib/objects/omit-empty.cjs +40 -0
  76. package/dist/cjs/lib/objects/size.cjs +63 -0
  77. package/dist/cjs/lib/objects/split.cjs +39 -0
  78. package/dist/cjs/lib/promises/index.cjs +69 -0
  79. package/dist/cjs/lib/promises/reject.cjs +67 -0
  80. package/dist/cjs/lib/sse.cjs +99 -0
  81. package/dist/cjs/lib/strings/convert-case/convert-case.cjs +96 -0
  82. package/dist/cjs/lib/strings/index.cjs +190 -0
  83. package/dist/cjs/lib/strings/markdown.cjs +59 -0
  84. package/dist/cjs/lib/strings/name.cjs +46 -0
  85. package/dist/cjs/lib/strings/pluralize.cjs +40 -0
  86. package/dist/cjs/lib/strings/query-string.cjs +43 -0
  87. package/dist/cjs/lib/style/index.cjs +64 -0
  88. package/dist/cjs/lib/symbols/index.cjs +40 -0
  89. package/dist/cjs/lib/symbols/symbols.cjs +38 -0
  90. package/dist/cjs/node/common.cjs +42 -0
  91. package/dist/cjs/node/dirname.cjs +49 -0
  92. package/dist/cjs/node/file-cache.cjs +196 -0
  93. package/dist/cjs/node/file.cjs +50 -0
  94. package/dist/cjs/node/hash.cjs +42 -0
  95. package/dist/cjs/node/index.cjs +290 -0
  96. package/dist/cjs/node/pkce.cjs +62 -0
  97. package/dist/cjs/node/random-string.cjs +43 -0
  98. package/dist/cjs/node/sanitize.cjs +65 -0
  99. package/dist/esm/dom/accessibility.js +27 -0
  100. package/dist/esm/dom/actions/index.js +379 -0
  101. package/dist/esm/dom/actions/masonry.js +123 -0
  102. package/dist/esm/dom/actions/prefer-horizontal-scroll.js +131 -0
  103. package/dist/esm/dom/actions/sticky.js +185 -0
  104. package/dist/esm/dom/bounding-box.js +45 -0
  105. package/dist/esm/dom/clipboard.js +13 -0
  106. package/dist/esm/dom/cookie.js +32 -0
  107. package/dist/esm/dom/css-vars.js +28 -0
  108. package/dist/esm/dom/events.js +67 -0
  109. package/dist/esm/dom/focusable.js +118 -0
  110. package/dist/esm/dom/font-size.js +44 -0
  111. package/dist/esm/dom/get-element.js +67 -0
  112. package/dist/esm/dom/hash.js +11 -0
  113. package/dist/esm/dom/index.js +1100 -0
  114. package/dist/esm/dom/keyboard.js +23 -0
  115. package/dist/esm/dom/local-store.js +55 -0
  116. package/dist/esm/dom/media.js +33 -0
  117. package/dist/esm/dom/observers/index.js +128 -0
  118. package/dist/esm/dom/observers/intersection-observer.js +65 -0
  119. package/dist/esm/dom/observers/mutation-observer.js +69 -0
  120. package/dist/esm/dom/observers/observer.js +22 -0
  121. package/dist/esm/dom/observers/resize-observer.js +56 -0
  122. package/dist/esm/dom/pkce.js +27 -0
  123. package/dist/esm/dom/query-params.js +14 -0
  124. package/dist/esm/dom/random-string.js +13 -0
  125. package/dist/esm/dom/sanitize.js +31 -0
  126. package/dist/esm/dom/session-store.js +25 -0
  127. package/dist/esm/dom/spam-prevention.js +26 -0
  128. package/dist/esm/dom/trap-focus.js +170 -0
  129. package/dist/esm/dom/ui/aria-current.js +18 -0
  130. package/dist/esm/dom/ui/inconsistent-button-fix.js +11 -0
  131. package/dist/esm/dom/ui/index.js +75 -0
  132. package/dist/esm/dom/ui/scroll-container.js +23 -0
  133. package/dist/esm/dom/ui/traverse-and-scramble.js +26 -0
  134. package/dist/esm/lib/arrays/index.js +106 -0
  135. package/dist/esm/lib/arrays/item-position.js +16 -0
  136. package/dist/esm/lib/arrays/join.js +17 -0
  137. package/dist/esm/lib/arrays/shuffle.js +18 -0
  138. package/dist/esm/lib/arrays/sort.js +41 -0
  139. package/dist/esm/lib/arrays/split-array.js +17 -0
  140. package/dist/esm/lib/arrays/unique.js +7 -0
  141. package/dist/esm/lib/auth/index.js +26 -0
  142. package/dist/esm/lib/auth/route-manager.js +26 -0
  143. package/dist/esm/lib/checks.js +31 -0
  144. package/dist/esm/lib/date/days.js +13 -0
  145. package/dist/esm/lib/date/index.js +173 -0
  146. package/dist/esm/lib/date/months.js +78 -0
  147. package/dist/esm/lib/date/time.js +84 -0
  148. package/dist/esm/lib/form/form-data.js +58 -0
  149. package/dist/esm/lib/form/index.js +92 -0
  150. package/dist/esm/lib/form/sanitize.js +35 -0
  151. package/dist/esm/lib/functions/debounce.js +19 -0
  152. package/dist/esm/lib/functions/env.js +8 -0
  153. package/dist/esm/lib/functions/functional.js +35 -0
  154. package/dist/esm/lib/functions/index.js +87 -0
  155. package/dist/esm/lib/functions/throttle.js +14 -0
  156. package/dist/esm/lib/functions/timeout.js +15 -0
  157. package/dist/esm/lib/hash.js +19 -0
  158. package/dist/esm/lib/index.js +1027 -0
  159. package/dist/esm/lib/numbers/index.js +21 -0
  160. package/dist/esm/lib/numbers/math.js +11 -0
  161. package/dist/esm/lib/objects/camelcase-keys.js +54 -0
  162. package/dist/esm/lib/objects/empty.js +14 -0
  163. package/dist/esm/lib/objects/equal.js +12 -0
  164. package/dist/esm/lib/objects/extend.js +121 -0
  165. package/dist/esm/lib/objects/flatten.js +22 -0
  166. package/dist/esm/lib/objects/index.js +323 -0
  167. package/dist/esm/lib/objects/json.js +11 -0
  168. package/dist/esm/lib/objects/loop.js +15 -0
  169. package/dist/esm/lib/objects/mix/mix.js +89 -0
  170. package/dist/esm/lib/objects/nested-property.js +19 -0
  171. package/dist/esm/lib/objects/normalize-object.js +80 -0
  172. package/dist/esm/lib/objects/omit-empty.js +16 -0
  173. package/dist/esm/lib/objects/size.js +39 -0
  174. package/dist/esm/lib/objects/split.js +15 -0
  175. package/dist/esm/lib/promises/index.js +33 -0
  176. package/dist/esm/lib/promises/reject.js +33 -0
  177. package/dist/esm/lib/sse.js +72 -0
  178. package/dist/esm/lib/strings/convert-case/convert-case.js +65 -0
  179. package/dist/esm/lib/strings/index.js +140 -0
  180. package/dist/esm/lib/strings/markdown.js +34 -0
  181. package/dist/esm/lib/strings/name.js +22 -0
  182. package/dist/esm/lib/strings/pluralize.js +6 -0
  183. package/dist/esm/lib/strings/query-string.js +17 -0
  184. package/dist/esm/lib/style/index.js +38 -0
  185. package/dist/esm/lib/symbols/index.js +13 -0
  186. package/dist/esm/lib/symbols/symbols.js +13 -0
  187. package/dist/esm/node/common.js +8 -0
  188. package/dist/esm/node/dirname.js +14 -0
  189. package/dist/esm/node/file-cache.js +158 -0
  190. package/dist/esm/node/file.js +15 -0
  191. package/dist/esm/node/hash.js +8 -0
  192. package/dist/esm/node/index.js +243 -0
  193. package/dist/esm/node/pkce.js +28 -0
  194. package/dist/esm/node/random-string.js +9 -0
  195. package/dist/esm/node/sanitize.js +31 -0
  196. package/dist/{dom/accessibility.d.ts → types/dom/accessibility.d.cts} +5 -3
  197. package/dist/types/dom/actions/index.d.cts +3 -0
  198. package/dist/types/dom/actions/masonry.d.cts +5 -0
  199. package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +5 -0
  200. package/dist/types/dom/actions/sticky.d.cts +5 -0
  201. package/dist/{dom/bounding-box.d.ts → types/dom/bounding-box.d.cts} +4 -2
  202. package/dist/{dom/clipboard.d.ts → types/dom/clipboard.d.cts} +3 -1
  203. package/dist/types/dom/cookie.d.cts +7 -0
  204. package/dist/types/dom/css-vars.d.cts +6 -0
  205. package/dist/types/dom/events.d.cts +20 -0
  206. package/dist/{dom/focusable.d.ts → types/dom/focusable.d.cts} +5 -3
  207. package/dist/types/dom/font-size.d.cts +7 -0
  208. package/dist/{dom/get-element.d.ts → types/dom/get-element.d.cts} +10 -8
  209. package/dist/types/dom/hash.d.cts +3 -0
  210. package/dist/types/dom/index.d.cts +30 -0
  211. package/dist/{dom/keyboard.d.ts → types/dom/keyboard.d.cts} +7 -5
  212. package/dist/{dom/local-store.d.ts → types/dom/local-store.d.cts} +3 -1
  213. package/dist/types/dom/media.d.cts +5 -0
  214. package/dist/types/dom/observers/index.d.cts +3 -0
  215. package/dist/{dom/observers/intersection-observer.d.ts → types/dom/observers/intersection-observer.d.cts} +3 -1
  216. package/dist/{dom/observers/mutation-observer.d.ts → types/dom/observers/mutation-observer.d.cts} +3 -1
  217. package/dist/types/dom/observers/observer.d.cts +3 -0
  218. package/dist/{dom/observers/resize-observer.d.ts → types/dom/observers/resize-observer.d.cts} +3 -1
  219. package/dist/{node/pkce.d.ts → types/dom/pkce.d.cts} +3 -1
  220. package/dist/{dom/query-params.d.ts → types/dom/query-params.d.cts} +3 -1
  221. package/dist/{dom/random-string.d.ts → types/dom/random-string.d.cts} +4 -2
  222. package/dist/{dom/sanitize.d.ts → types/dom/sanitize.d.cts} +3 -1
  223. package/dist/{dom/session-store.d.ts → types/dom/session-store.d.cts} +3 -1
  224. package/dist/types/dom/spam-prevention.d.cts +14 -0
  225. package/dist/{dom/trap-focus.d.ts → types/dom/trap-focus.d.cts} +8 -4
  226. package/dist/types/dom/ui/aria-current.d.cts +7 -0
  227. package/dist/{dom/ui/inconsistent-button-fix.d.ts → types/dom/ui/inconsistent-button-fix.d.cts} +3 -1
  228. package/dist/types/dom/ui/index.d.cts +4 -0
  229. package/dist/types/dom/ui/scroll-container.d.cts +3 -0
  230. package/dist/{dom/ui/traverse-and-scramble.d.ts → types/dom/ui/traverse-and-scramble.d.cts} +3 -1
  231. package/dist/types/lib/arrays/index.d.cts +6 -0
  232. package/dist/{lib/arrays/item-position.d.ts → types/lib/arrays/item-position.d.cts} +5 -3
  233. package/dist/{lib/arrays/join.d.ts → types/lib/arrays/join.d.cts} +3 -1
  234. package/dist/types/lib/arrays/shuffle.d.cts +3 -0
  235. package/dist/{lib/arrays/sort.d.ts → types/lib/arrays/sort.d.cts} +3 -1
  236. package/dist/types/lib/arrays/split-array.d.cts +6 -0
  237. package/dist/types/lib/arrays/unique.d.cts +3 -0
  238. package/dist/types/lib/auth/index.d.cts +1 -0
  239. package/dist/{lib/auth/route-manager.d.ts → types/lib/auth/route-manager.d.cts} +5 -2
  240. package/dist/{lib/checks.d.ts → types/lib/checks.d.cts} +6 -4
  241. package/dist/{lib/date/days.d.ts → types/lib/date/days.d.cts} +3 -1
  242. package/dist/types/lib/date/index.d.cts +3 -0
  243. package/dist/{lib/date/months.d.ts → types/lib/date/months.d.cts} +3 -1
  244. package/dist/types/lib/date/time.d.cts +21 -0
  245. package/dist/types/lib/form/form-data.d.cts +9 -0
  246. package/dist/types/lib/form/index.d.cts +2 -0
  247. package/dist/{lib/form/sanitize.d.ts → types/lib/form/sanitize.d.cts} +6 -4
  248. package/dist/types/lib/functions/debounce.d.cts +3 -0
  249. package/dist/types/lib/functions/env.d.cts +3 -0
  250. package/dist/types/lib/functions/functional.d.cts +6 -0
  251. package/dist/types/lib/functions/index.d.cts +5 -0
  252. package/dist/types/lib/functions/throttle.d.cts +3 -0
  253. package/dist/types/lib/functions/timeout.d.cts +5 -0
  254. package/dist/types/lib/hash.d.cts +3 -0
  255. package/dist/types/lib/index.d.cts +43 -0
  256. package/dist/types/lib/numbers/index.d.cts +5 -0
  257. package/dist/types/lib/numbers/math.d.cts +4 -0
  258. package/dist/types/lib/objects/camelcase-keys.d.cts +3 -0
  259. package/dist/types/lib/objects/empty.d.cts +4 -0
  260. package/dist/types/lib/objects/equal.d.cts +4 -0
  261. package/dist/types/lib/objects/extend.d.cts +6 -0
  262. package/dist/types/lib/objects/flatten.d.cts +6 -0
  263. package/dist/types/lib/objects/index.d.cts +13 -0
  264. package/dist/types/lib/objects/json.d.cts +3 -0
  265. package/dist/types/lib/objects/loop.d.cts +4 -0
  266. package/dist/types/lib/objects/mix/mix.d.cts +44 -0
  267. package/dist/{lib/objects/nested-property.d.ts → types/lib/objects/nested-property.d.cts} +5 -3
  268. package/dist/types/lib/objects/normalize-object.d.cts +3 -0
  269. package/dist/types/lib/objects/omit-empty.d.cts +3 -0
  270. package/dist/types/lib/objects/size.d.cts +3 -0
  271. package/dist/{lib/objects/split.d.ts → types/lib/objects/split.d.cts} +3 -1
  272. package/dist/types/lib/promises/index.d.cts +1 -0
  273. package/dist/types/lib/promises/reject.d.cts +5 -0
  274. package/dist/{lib/sse.d.ts → types/lib/sse.d.cts} +4 -2
  275. package/dist/types/lib/strings/convert-case/convert-case.d.cts +10 -0
  276. package/dist/types/lib/strings/index.d.cts +5 -0
  277. package/dist/{lib/strings/markdown.d.ts → types/lib/strings/markdown.d.cts} +4 -2
  278. package/dist/types/lib/strings/name.d.cts +7 -0
  279. package/dist/types/lib/strings/pluralize.d.cts +3 -0
  280. package/dist/types/lib/strings/query-string.d.cts +10 -0
  281. package/dist/types/lib/style/index.d.cts +3 -0
  282. package/dist/types/lib/symbols/index.d.cts +1 -0
  283. package/dist/types/lib/symbols/symbols.d.cts +4 -0
  284. package/dist/types/node/common.d.cts +3 -0
  285. package/dist/types/node/dirname.d.cts +9 -0
  286. package/dist/{node/file-cache.d.ts → types/node/file-cache.d.cts} +7 -5
  287. package/dist/types/node/file.d.cts +4 -0
  288. package/dist/types/node/hash.d.cts +3 -0
  289. package/dist/types/node/index.d.cts +7 -0
  290. package/dist/{dom/pkce.d.ts → types/node/pkce.d.cts} +3 -1
  291. package/dist/types/node/random-string.d.cts +3 -0
  292. package/dist/{node/sanitize.d.ts → types/node/sanitize.d.cts} +3 -1
  293. package/package.json +28 -16
  294. package/{dom → src/dom}/index.js +1 -0
  295. package/src/dom/spam-prevention.js +39 -0
  296. package/{dom → src/dom}/ui/aria-current.js +1 -1
  297. package/{lib → src/lib}/arrays/index.js +1 -0
  298. package/{lib → src/lib}/arrays/sort.js +6 -6
  299. package/src/lib/arrays/split-array.js +15 -0
  300. package/{lib → src/lib}/auth/route-manager.js +1 -0
  301. package/{lib → src/lib}/date/time.js +38 -5
  302. package/{lib → src/lib}/numbers/index.js +1 -1
  303. package/src/lib/numbers/split-unit.test.js +45 -0
  304. package/src/lib/objects/mix/mix.js +191 -0
  305. package/{lib → src/lib}/objects/mix/mix.test.js +99 -2
  306. package/src/lib/strings/pluralize.js +2 -0
  307. package/{lib → src/lib}/style/index.js +2 -0
  308. package/{node → src/node}/file-cache.js +1 -1
  309. package/tsconfig.json +6 -6
  310. package/tsup.config.js +38 -0
  311. package/tsup.config.mjs +43 -0
  312. package/dist/dom/actions/index.d.ts +0 -3
  313. package/dist/dom/actions/masonry.d.ts +0 -3
  314. package/dist/dom/actions/prefer-horizontal-scroll.d.ts +0 -3
  315. package/dist/dom/actions/sticky.d.ts +0 -3
  316. package/dist/dom/cookie.d.ts +0 -5
  317. package/dist/dom/css-vars.d.ts +0 -4
  318. package/dist/dom/events.d.ts +0 -18
  319. package/dist/dom/font-size.d.ts +0 -5
  320. package/dist/dom/hash.d.ts +0 -1
  321. package/dist/dom/index.d.ts +0 -22
  322. package/dist/dom/media.d.ts +0 -3
  323. package/dist/dom/observers/index.d.ts +0 -3
  324. package/dist/dom/observers/observer.d.ts +0 -1
  325. package/dist/dom/ui/aria-current.d.ts +0 -5
  326. package/dist/dom/ui/index.d.ts +0 -4
  327. package/dist/dom/ui/scroll-container.d.ts +0 -1
  328. package/dist/lib/arrays/index.d.ts +0 -5
  329. package/dist/lib/arrays/shuffle.d.ts +0 -1
  330. package/dist/lib/arrays/unique.d.ts +0 -1
  331. package/dist/lib/auth/index.d.ts +0 -1
  332. package/dist/lib/date/index.d.ts +0 -3
  333. package/dist/lib/date/time.d.ts +0 -8
  334. package/dist/lib/form/form-data.d.ts +0 -7
  335. package/dist/lib/form/index.d.ts +0 -2
  336. package/dist/lib/functions/debounce.d.ts +0 -1
  337. package/dist/lib/functions/env.d.ts +0 -1
  338. package/dist/lib/functions/functional.d.ts +0 -4
  339. package/dist/lib/functions/index.d.ts +0 -5
  340. package/dist/lib/functions/throttle.d.ts +0 -1
  341. package/dist/lib/functions/timeout.d.ts +0 -3
  342. package/dist/lib/hash.d.ts +0 -1
  343. package/dist/lib/index.d.ts +0 -14
  344. package/dist/lib/numbers/index.d.ts +0 -2
  345. package/dist/lib/numbers/math.d.ts +0 -2
  346. package/dist/lib/objects/camelcase-keys.d.ts +0 -1
  347. package/dist/lib/objects/empty.d.ts +0 -2
  348. package/dist/lib/objects/equal.d.ts +0 -2
  349. package/dist/lib/objects/extend.d.ts +0 -4
  350. package/dist/lib/objects/flatten.d.ts +0 -4
  351. package/dist/lib/objects/index.d.ts +0 -13
  352. package/dist/lib/objects/json.d.ts +0 -1
  353. package/dist/lib/objects/loop.d.ts +0 -2
  354. package/dist/lib/objects/mix/mix.d.ts +0 -1
  355. package/dist/lib/objects/normalize-object.d.ts +0 -1
  356. package/dist/lib/objects/omit-empty.d.ts +0 -1
  357. package/dist/lib/objects/size.d.ts +0 -1
  358. package/dist/lib/promises/index.d.ts +0 -1
  359. package/dist/lib/promises/reject.d.ts +0 -3
  360. package/dist/lib/strings/convert-case/convert-case.d.ts +0 -8
  361. package/dist/lib/strings/index.d.ts +0 -5
  362. package/dist/lib/strings/name.d.ts +0 -5
  363. package/dist/lib/strings/pluralize.d.ts +0 -1
  364. package/dist/lib/strings/query-string.d.ts +0 -8
  365. package/dist/lib/style/index.d.ts +0 -1
  366. package/dist/lib/symbols/index.d.ts +0 -1
  367. package/dist/lib/symbols/symbols.d.ts +0 -2
  368. package/dist/node/common.d.ts +0 -1
  369. package/dist/node/dirname.d.ts +0 -7
  370. package/dist/node/file.d.ts +0 -2
  371. package/dist/node/hash.d.ts +0 -1
  372. package/dist/node/index.d.ts +0 -7
  373. package/dist/node/random-string.d.ts +0 -1
  374. package/lib/objects/mix/mix.js +0 -102
  375. package/lib/strings/pluralize.js +0 -2
  376. /package/{dom → src/dom}/accessibility.js +0 -0
  377. /package/{dom → src/dom}/actions/index.js +0 -0
  378. /package/{dom → src/dom}/actions/masonry.js +0 -0
  379. /package/{dom → src/dom}/actions/prefer-horizontal-scroll.js +0 -0
  380. /package/{dom → src/dom}/actions/sticky.js +0 -0
  381. /package/{dom → src/dom}/bounding-box.js +0 -0
  382. /package/{dom → src/dom}/clipboard.js +0 -0
  383. /package/{dom → src/dom}/cookie.js +0 -0
  384. /package/{dom → src/dom}/css-vars.js +0 -0
  385. /package/{dom → src/dom}/events.js +0 -0
  386. /package/{dom → src/dom}/events.test.js +0 -0
  387. /package/{dom → src/dom}/focusable.js +0 -0
  388. /package/{dom → src/dom}/font-size.js +0 -0
  389. /package/{dom → src/dom}/get-element.js +0 -0
  390. /package/{dom → src/dom}/hash.js +0 -0
  391. /package/{dom → src/dom}/keyboard.js +0 -0
  392. /package/{dom → src/dom}/local-store.js +0 -0
  393. /package/{dom → src/dom}/media.js +0 -0
  394. /package/{dom → src/dom}/observers/index.js +0 -0
  395. /package/{dom → src/dom}/observers/intersection-observer.js +0 -0
  396. /package/{dom → src/dom}/observers/mutation-observer.js +0 -0
  397. /package/{dom → src/dom}/observers/observer.js +0 -0
  398. /package/{dom → src/dom}/observers/resize-observer.js +0 -0
  399. /package/{dom → src/dom}/pkce.js +0 -0
  400. /package/{dom → src/dom}/query-params.js +0 -0
  401. /package/{dom → src/dom}/random-string.js +0 -0
  402. /package/{dom → src/dom}/random-string.test.js +0 -0
  403. /package/{dom → src/dom}/sanitize.js +0 -0
  404. /package/{dom → src/dom}/session-store.js +0 -0
  405. /package/{dom → src/dom}/trap-focus.js +0 -0
  406. /package/{dom → src/dom}/ui/inconsistent-button-fix.js +0 -0
  407. /package/{dom → src/dom}/ui/index.js +0 -0
  408. /package/{dom → src/dom}/ui/scroll-container.js +0 -0
  409. /package/{dom → src/dom}/ui/traverse-and-scramble.js +0 -0
  410. /package/{lib → src/lib}/arrays/item-position.js +0 -0
  411. /package/{lib → src/lib}/arrays/join.js +0 -0
  412. /package/{lib → src/lib}/arrays/shuffle.js +0 -0
  413. /package/{lib → src/lib}/arrays/sort.spec.js +0 -0
  414. /package/{lib → src/lib}/arrays/unique.js +0 -0
  415. /package/{lib → src/lib}/auth/index.js +0 -0
  416. /package/{lib → src/lib}/checks.js +0 -0
  417. /package/{lib → src/lib}/date/days.js +0 -0
  418. /package/{lib → src/lib}/date/index.js +0 -0
  419. /package/{lib → src/lib}/date/months.js +0 -0
  420. /package/{lib → src/lib}/form/form-data.js +0 -0
  421. /package/{lib → src/lib}/form/index.js +0 -0
  422. /package/{lib → src/lib}/form/sanitize.js +0 -0
  423. /package/{lib → src/lib}/form/sanitize.spec.js +0 -0
  424. /package/{lib → src/lib}/functions/debounce.js +0 -0
  425. /package/{lib → src/lib}/functions/env.js +0 -0
  426. /package/{lib → src/lib}/functions/functional.js +0 -0
  427. /package/{lib → src/lib}/functions/index.js +0 -0
  428. /package/{lib → src/lib}/functions/throttle.js +0 -0
  429. /package/{lib → src/lib}/functions/timeout.js +0 -0
  430. /package/{lib → src/lib}/hash.js +0 -0
  431. /package/{lib → src/lib}/hash.spec.js +0 -0
  432. /package/{lib → src/lib}/index.js +0 -0
  433. /package/{lib → src/lib}/numbers/math.js +0 -0
  434. /package/{lib → src/lib}/objects/camelcase-keys.js +0 -0
  435. /package/{lib → src/lib}/objects/camelcase-keys.test.js +0 -0
  436. /package/{lib → src/lib}/objects/empty.js +0 -0
  437. /package/{lib → src/lib}/objects/equal.js +0 -0
  438. /package/{lib → src/lib}/objects/extend.js +0 -0
  439. /package/{lib → src/lib}/objects/extend.test.js +0 -0
  440. /package/{lib → src/lib}/objects/flatten.js +0 -0
  441. /package/{lib → src/lib}/objects/index.js +0 -0
  442. /package/{lib → src/lib}/objects/json.js +0 -0
  443. /package/{lib → src/lib}/objects/loop.js +0 -0
  444. /package/{lib → src/lib}/objects/loop.test.js +0 -0
  445. /package/{lib → src/lib}/objects/mix/mix.md +0 -0
  446. /package/{lib → src/lib}/objects/nested-property.js +0 -0
  447. /package/{lib → src/lib}/objects/normalize-object.js +0 -0
  448. /package/{lib → src/lib}/objects/omit-empty.js +0 -0
  449. /package/{lib → src/lib}/objects/omit-empty.test.js +0 -0
  450. /package/{lib → src/lib}/objects/size.js +0 -0
  451. /package/{lib → src/lib}/objects/split.js +0 -0
  452. /package/{lib → src/lib}/promises/index.js +0 -0
  453. /package/{lib → src/lib}/promises/reject.js +0 -0
  454. /package/{lib → src/lib}/sse.js +0 -0
  455. /package/{lib → src/lib}/strings/convert-case/convert-case.js +0 -0
  456. /package/{lib → src/lib}/strings/convert-case/convert-case.md +0 -0
  457. /package/{lib → src/lib}/strings/convert-case/convert-case.test.js +0 -0
  458. /package/{lib → src/lib}/strings/index.js +0 -0
  459. /package/{lib → src/lib}/strings/markdown.js +0 -0
  460. /package/{lib → src/lib}/strings/name.js +0 -0
  461. /package/{lib → src/lib}/strings/name.test.js +0 -0
  462. /package/{lib → src/lib}/strings/query-string.js +0 -0
  463. /package/{lib → src/lib}/symbols/index.js +0 -0
  464. /package/{lib → src/lib}/symbols/symbols.js +0 -0
  465. /package/{node → src/node}/common.js +0 -0
  466. /package/{node → src/node}/dirname.js +0 -0
  467. /package/{node → src/node}/file.js +0 -0
  468. /package/{node → src/node}/hash.js +0 -0
  469. /package/{node → src/node}/index.js +0 -0
  470. /package/{node → src/node}/pkce.js +0 -0
  471. /package/{node → src/node}/random-string.js +0 -0
  472. /package/{node → src/node}/random-string.test.js +0 -0
  473. /package/{node → src/node}/sanitize.js +0 -0
  474. /package/{node → src/node}/sanitize.spec.js +0 -0
@@ -0,0 +1,43 @@
1
+ export { isLastItem, last, lastArrayItem } from './arrays/item-position.cjs';
2
+ export { joinWithConjunction } from './arrays/join.cjs';
3
+ export { shuffle } from './arrays/shuffle.cjs';
4
+ export { sort } from './arrays/sort.cjs';
5
+ export { splitArray } from './arrays/split-array.cjs';
6
+ export { uniqueArray } from './arrays/unique.cjs';
7
+ export { AuthManager, RouteManager } from './auth/route-manager.cjs';
8
+ export { getType, isArray, isObject, notObject } from './checks.cjs';
9
+ export { DAYS } from './date/days.cjs';
10
+ export { MONTHS } from './date/months.cjs';
11
+ export { getTimeInMs, ms, toDays, toHours, toMinutes, toReadableTime, toSeconds, toWeeks } from './date/time.cjs';
12
+ export { flattenArrayFields, formDataToObject } from './form/form-data.cjs';
13
+ export { SanitizeOptions, sanitize, sanitizeArray, sanitizeObject } from './form/sanitize.cjs';
14
+ export { debounce } from './functions/debounce.cjs';
15
+ export { getEnv } from './functions/env.cjs';
16
+ export { compose, curry, pipe, times } from './functions/functional.cjs';
17
+ export { throttle } from './functions/throttle.cjs';
18
+ export { delay, timeout, wait } from './functions/timeout.cjs';
19
+ export { isHashedValue } from './hash.cjs';
20
+ export { splitUnit } from './numbers/index.cjs';
21
+ export { camelCaseKeys } from './objects/camelcase-keys.cjs';
22
+ export { isEmpty, notEmpty } from './objects/empty.cjs';
23
+ export { isEqual, notEqual } from './objects/equal.cjs';
24
+ export { extendObject } from './objects/extend.cjs';
25
+ export { flattenObject } from './objects/flatten.cjs';
26
+ export { parseJSON } from './objects/json.cjs';
27
+ export { objectForEach, objectMap } from './objects/loop.cjs';
28
+ export { concatMix, createMix, mix } from './objects/mix/mix.cjs';
29
+ export { getNestedProperty, getNestedProperty2, getNestedValue } from './objects/nested-property.cjs';
30
+ export { normalizeObject } from './objects/normalize-object.cjs';
31
+ export { omitEmpty } from './objects/omit-empty.cjs';
32
+ export { sizeOf } from './objects/size.cjs';
33
+ export { splitObject } from './objects/split.cjs';
34
+ export { reject } from './promises/reject.cjs';
35
+ export { createSSE, parseSSE } from './sse.cjs';
36
+ export { toCamel, toKebab, toLower, toPascal, toSentence, toSlug, toTitle, toUpper } from './strings/convert-case/convert-case.cjs';
37
+ export { markdown, treatMarkdownWhitespace } from './strings/markdown.cjs';
38
+ export { parseFullName } from './strings/name.cjs';
39
+ export { pluralize } from './strings/pluralize.cjs';
40
+ export { plural, stripNumbers, toQueryString } from './strings/query-string.cjs';
41
+ export { toStyleString } from './style/index.cjs';
42
+ export { getSymbol, getSymbolValue } from './symbols/symbols.cjs';
43
+ export { toDegrees, toRadians } from './numbers/math.cjs';
@@ -0,0 +1,5 @@
1
+ export { toDegrees, toRadians } from './math.cjs';
2
+
3
+ declare function splitUnit(string: any): any[];
4
+
5
+ export { splitUnit };
@@ -0,0 +1,4 @@
1
+ declare function toDegrees(angle: any): number;
2
+ declare function toRadians(angle: any): number;
3
+
4
+ export { toDegrees, toRadians };
@@ -0,0 +1,3 @@
1
+ declare function camelCaseKeys(obj: any): any;
2
+
3
+ export { camelCaseKeys };
@@ -0,0 +1,4 @@
1
+ declare function isEmpty(obj: any): boolean;
2
+ declare function notEmpty(obj: any): boolean;
3
+
4
+ export { isEmpty, notEmpty };
@@ -0,0 +1,4 @@
1
+ declare function isEqual(a: any, b: any): boolean;
2
+ declare function notEqual(a: any, b: any): boolean;
3
+
4
+ export { isEqual, notEqual };
@@ -0,0 +1,6 @@
1
+ declare function extendObject(object: any): {
2
+ orig: any;
3
+ extended: any;
4
+ };
5
+
6
+ export { extendObject };
@@ -0,0 +1,6 @@
1
+ declare function flattenObject(obj: any, { separator, prefix }: {
2
+ separator: any;
3
+ prefix?: string;
4
+ }): {};
5
+
6
+ export { flattenObject };
@@ -0,0 +1,13 @@
1
+ export { camelCaseKeys } from './camelcase-keys.cjs';
2
+ export { isEmpty, notEmpty } from './empty.cjs';
3
+ export { isEqual, notEqual } from './equal.cjs';
4
+ export { extendObject } from './extend.cjs';
5
+ export { flattenObject } from './flatten.cjs';
6
+ export { parseJSON } from './json.cjs';
7
+ export { objectForEach, objectMap } from './loop.cjs';
8
+ export { concatMix, createMix, mix } from './mix/mix.cjs';
9
+ export { getNestedProperty, getNestedProperty2, getNestedValue } from './nested-property.cjs';
10
+ export { normalizeObject } from './normalize-object.cjs';
11
+ export { omitEmpty } from './omit-empty.cjs';
12
+ export { sizeOf } from './size.cjs';
13
+ export { splitObject } from './split.cjs';
@@ -0,0 +1,3 @@
1
+ declare function parseJSON(value: any, defaultValue?: {}): any;
2
+
3
+ export { parseJSON };
@@ -0,0 +1,4 @@
1
+ declare function objectForEach(object: any, callback: any): void;
2
+ declare function objectMap(object: any, callback: any): any[];
3
+
4
+ export { objectForEach, objectMap };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Creates a customized mix function with specific options for array handling.
3
+ *
4
+ * @param {Object} [userOptions={}] - Configuration options for the mix function.
5
+ * @param {('replace'|'concat')} [userOptions.array='replace'] - How to handle array merging:
6
+ * - 'replace': Arrays from later sources completely replace arrays from earlier sources
7
+ * - 'concat': Arrays are concatenated together
8
+ * @return {Function} A mix function configured with the provided options.
9
+ *
10
+ * @example
11
+ * // Create mix function that concatenates arrays
12
+ * const concatMix = createMix({ array: 'concat' })
13
+ * const obj1 = { items: [1, 2] }
14
+ * const obj2 = { items: [3, 4] }
15
+ * const result = concatMix(obj1, obj2)
16
+ * // Returns: { items: [1, 2, 3, 4] }
17
+ *
18
+ * @example
19
+ * // Create mix function that replaces arrays (default behavior)
20
+ * const replaceMix = createMix({ array: 'replace' })
21
+ * const obj1 = { items: [1, 2] }
22
+ * const obj2 = { items: [3, 4] }
23
+ * const result = replaceMix(obj1, obj2)
24
+ * // Returns: { items: [3, 4] }
25
+ */
26
+ declare function createMix(userOptions?: {
27
+ array?: ("replace" | "concat");
28
+ }): Function;
29
+ /**
30
+ * Deep merges multiple objects into a new object with intelligent handling of arrays and nested objects.
31
+ *
32
+ * @param {...Object} sources - Objects to merge. Null and undefined values are skipped.
33
+ * @return {Object} A new object containing the merged properties from all sources.
34
+ *
35
+ * @example
36
+ * const obj1 = { a: 1, b: { x: 10 } }
37
+ * const obj2 = { b: { y: 20 }, c: 3 }
38
+ * const result = mix(obj1, obj2)
39
+ * // Returns: { a: 1, b: { x: 10, y: 20 }, c: 3 }
40
+ */
41
+ declare const mix: Function;
42
+ declare const concatMix: Function;
43
+
44
+ export { concatMix, createMix, mix };
@@ -17,6 +17,8 @@
17
17
  * let path = ['one', 'two', 'three'];
18
18
  * console.log(getNestedProperty(object, path)); // Outputs: "value"
19
19
  */
20
- export function getNestedProperty(object: any, pathArr: any[]): any;
21
- export function getNestedProperty2(object: any, path: any): any;
22
- export function getNestedValue(object: any, path: any): any;
20
+ declare function getNestedProperty(object: any, pathArr: any[]): any;
21
+ declare function getNestedProperty2(object: any, path: any): any;
22
+ declare function getNestedValue(object: any, path: any): any;
23
+
24
+ export { getNestedProperty, getNestedProperty2, getNestedValue };
@@ -0,0 +1,3 @@
1
+ declare function normalizeObject(object: any): any;
2
+
3
+ export { normalizeObject };
@@ -0,0 +1,3 @@
1
+ declare function omitEmpty(obj: any, shallow?: boolean): any;
2
+
3
+ export { omitEmpty };
@@ -0,0 +1,3 @@
1
+ declare function sizeOf(obj: any): string;
2
+
3
+ export { sizeOf };
@@ -4,9 +4,11 @@
4
4
  * @param {Array} keys
5
5
  * @returns
6
6
  */
7
- export function splitObject(obj: any, keys: any[]): {
7
+ declare function splitObject(obj: any, keys: any[]): {
8
8
  picked: {};
9
9
  omitted: any;
10
10
  p: {};
11
11
  o: any;
12
12
  };
13
+
14
+ export { splitObject };
@@ -0,0 +1 @@
1
+ export { reject } from './reject.cjs';
@@ -0,0 +1,5 @@
1
+ declare function reject(props: any, { includeStack }?: {
2
+ includeStack?: boolean;
3
+ }): Promise<never>;
4
+
5
+ export { reject };
@@ -1,4 +1,4 @@
1
- export function createSSE({ event, data, id, retry }: {
1
+ declare function createSSE({ event, data, id, retry }: {
2
2
  event: any;
3
3
  data: any;
4
4
  id: any;
@@ -13,4 +13,6 @@ export function createSSE({ event, data, id, retry }: {
13
13
  * @property {string} [id] - The message ID if specified
14
14
  * @property {number} [retry] - The retry interval if specified
15
15
  */
16
- export function parseSSE(message: string): any | null;
16
+ declare function parseSSE(message: string): any | null;
17
+
18
+ export { createSSE, parseSSE };
@@ -0,0 +1,10 @@
1
+ declare function toKebab(string: any): any;
2
+ declare function toCamel(string: any): any;
3
+ declare function toPascal(string: any): any;
4
+ declare function toTitle(string: any): any;
5
+ declare function toSlug(string: any): any;
6
+ declare function toSentence(string: any): any;
7
+ declare function toUpper(string: any): any;
8
+ declare function toLower(string: any): any;
9
+
10
+ export { toCamel, toKebab, toLower, toPascal, toSentence, toSlug, toTitle, toUpper };
@@ -0,0 +1,5 @@
1
+ export { toCamel, toKebab, toLower, toPascal, toSentence, toSlug, toTitle, toUpper } from './convert-case/convert-case.cjs';
2
+ export { markdown, treatMarkdownWhitespace } from './markdown.cjs';
3
+ export { parseFullName } from './name.cjs';
4
+ export { pluralize } from './pluralize.cjs';
5
+ export { plural, stripNumbers, toQueryString } from './query-string.cjs';
@@ -5,7 +5,7 @@
5
5
  * @param {boolean} [options.inline=false] - Whether content should be treated as inline markdown
6
6
  * @returns {string|Promise<string>} HTML string or Promise that resolves to HTML string
7
7
  */
8
- export function markdown(content: string, options?: {
8
+ declare function markdown(content: string, options?: {
9
9
  inline?: boolean;
10
10
  }): string | Promise<string>;
11
11
  /**
@@ -15,9 +15,11 @@ export function markdown(content: string, options?: {
15
15
  * @param {boolean} [options.inline=false] - Whether content is inline markdown
16
16
  * @returns {{ content: string, inline: boolean }} Processed content and inline status
17
17
  */
18
- export function treatMarkdownWhitespace(content: string, { inline }?: {
18
+ declare function treatMarkdownWhitespace(content: string, { inline }?: {
19
19
  inline?: boolean;
20
20
  }): {
21
21
  content: string;
22
22
  inline: boolean;
23
23
  };
24
+
25
+ export { markdown, treatMarkdownWhitespace };
@@ -0,0 +1,7 @@
1
+ declare function parseFullName(name: any): {
2
+ firstName: any;
3
+ middleName: any;
4
+ lastName: any;
5
+ };
6
+
7
+ export { parseFullName };
@@ -0,0 +1,3 @@
1
+ declare const pluralize: any;
2
+
3
+ export { pluralize };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Converts object into a query string
3
+ * @param {Object} object
4
+ * @returns
5
+ */
6
+ declare function toQueryString(object: any): string;
7
+ declare function plural(count: any, noun: any, suffix?: string): string;
8
+ declare function stripNumbers(string: any): any;
9
+
10
+ export { plural, stripNumbers, toQueryString };
@@ -0,0 +1,3 @@
1
+ declare function toStyleString(style: any): string;
2
+
3
+ export { toStyleString };
@@ -0,0 +1 @@
1
+ export { getSymbol, getSymbolValue } from './symbols.cjs';
@@ -0,0 +1,4 @@
1
+ declare function getSymbol(object: any, description: any): symbol;
2
+ declare function getSymbolValue(object: any, description: any): any;
3
+
4
+ export { getSymbol, getSymbolValue };
@@ -0,0 +1,3 @@
1
+ declare function uuid(): `${string}-${string}-${string}-${string}-${string}`;
2
+
3
+ export { uuid };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns __dirname
3
+ * @param url — import.meta.url
4
+ * @returns
5
+ */
6
+ declare function __dirname(url: any): string;
7
+ declare function dirname(url: any): string;
8
+
9
+ export { __dirname, dirname };
@@ -10,7 +10,7 @@
10
10
  * @property {function(string): Promise<object>} loadJSON - Loads and parses JSON from cache file
11
11
  * @property {function(string, object): Promise<void>} saveJSON - Saves object as JSON to cache file
12
12
  */
13
- export function createCache(dir: string): Promise<object>;
13
+ declare function createCache(dir: string): Promise<object>;
14
14
  /**
15
15
  * Legacy file cache API for managing a single cached file
16
16
  * @param {Object} options
@@ -24,7 +24,7 @@ export function createCache(dir: string): Promise<object>;
24
24
  * saveJSON: (data: object) => Promise<void>
25
25
  * }>}
26
26
  */
27
- export function fileCache({ dir, file }: {
27
+ declare function fileCache({ dir, file }: {
28
28
  dir: string;
29
29
  file: string;
30
30
  }): Promise<{
@@ -39,16 +39,18 @@ export function fileCache({ dir, file }: {
39
39
  * @param {string|string[]} globPath - Glob pattern(s) to match files
40
40
  * @returns {Promise<number>} Timestamp of most recently modified file, or 0 if no files found
41
41
  */
42
- export function getLastModifiedTime(globPath: string | string[]): Promise<number>;
42
+ declare function getLastModifiedTime(globPath: string | string[]): Promise<number>;
43
43
  /**
44
44
  * @deprecated Use getLastModifiedTime instead
45
45
  * @param {string|string[]} globPath - Glob pattern(s) to match files
46
46
  * @returns {Promise<number>} Timestamp of most recently modified file, or 0 if no files found
47
47
  */
48
- export function getLatestModifiedTime(globPath: string | string[]): Promise<number>;
48
+ declare function getLatestModifiedTime(globPath: string | string[]): Promise<number>;
49
49
  /**
50
50
  * Removes leading slash from a path string
51
51
  * @param {string} x - Path string to process
52
52
  * @returns {string} Path without leading slash
53
53
  */
54
- export function removeFirstSlash(x: string): string;
54
+ declare function removeFirstSlash(x: string): string;
55
+
56
+ export { createCache, fileCache, getLastModifiedTime, getLatestModifiedTime, removeFirstSlash };
@@ -0,0 +1,4 @@
1
+ declare function mkdir(path: any): Promise<string>;
2
+ declare function copyFile(from: any, to: any): Promise<void>;
3
+
4
+ export { copyFile, mkdir };
@@ -0,0 +1,3 @@
1
+ declare function sha256Hash(string: any): string;
2
+
3
+ export { sha256Hash };
@@ -0,0 +1,7 @@
1
+ export { uuid } from './common.cjs';
2
+ export { __dirname, dirname } from './dirname.cjs';
3
+ export { createCache, fileCache, getLastModifiedTime, getLatestModifiedTime, removeFirstSlash } from './file-cache.cjs';
4
+ export { sha256Hash } from './hash.cjs';
5
+ export { PKCE } from './pkce.cjs';
6
+ export { randomString } from './random-string.cjs';
7
+ export { sanitize } from './sanitize.cjs';
@@ -1,6 +1,8 @@
1
- export function PKCE(): Promise<{
1
+ declare function PKCE(): Promise<{
2
2
  state: string;
3
3
  code_verifier: string;
4
4
  code_challenge: string;
5
5
  code_challenge_method: string;
6
6
  }>;
7
+
8
+ export { PKCE };
@@ -0,0 +1,3 @@
1
+ declare function randomString(length?: number): string;
2
+
3
+ export { randomString };
@@ -5,4 +5,6 @@
5
5
  * @returns {*} Sanitized value
6
6
  * @throws {Error} If input is a string but sanitize-html fails
7
7
  */
8
- export function sanitize(value: any, options?: any): any;
8
+ declare function sanitize(value: any, options?: any): any;
9
+
10
+ export { sanitize };
package/package.json CHANGED
@@ -1,33 +1,42 @@
1
1
  {
2
2
  "name": "@splendidlabz/utils",
3
- "version": "1.6.0",
3
+ "version": "1.8.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
+ "main": "./dist/cjs/lib/index.cjs",
8
+ "module": "./dist/esm/lib/index.js",
9
+ "types": "./dist/types/lib/index.d.cts",
7
10
  "exports": {
8
11
  ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./lib/index.js"
12
+ "types": "./dist/types/lib/index.d.cts",
13
+ "import": "./dist/esm/lib/index.js",
14
+ "require": "./dist/cjs/lib/index.cjs"
11
15
  },
12
16
  "./lib/*": {
13
- "types": "./dist/lib/*.d.ts",
14
- "import": "./lib/*.js"
17
+ "types": "./dist/types/lib/*.d.cts",
18
+ "import": "./dist/esm/lib/*.js",
19
+ "require": "./dist/cjs/lib/*.cjs"
15
20
  },
16
21
  "./dom": {
17
- "types": "./dist/dom/index.d.ts",
18
- "import": "./dom/index.js"
22
+ "types": "./dist/types/dom/index.d.cts",
23
+ "import": "./dist/esm/dom/index.js",
24
+ "require": "./dist/cjs/dom/index.cjs"
19
25
  },
20
26
  "./dom/*": {
21
- "types": "./dist/dom/*.d.ts",
22
- "import": "./dom/*.js"
27
+ "types": "./dist/types/dom/*.d.cts",
28
+ "import": "./dist/esm/dom/*.js",
29
+ "require": "./dist/cjs/dom/*.cjs"
23
30
  },
24
31
  "./node": {
25
- "types": "./dist/node/index.d.ts",
26
- "import": "./node/index.js"
32
+ "types": "./dist/types/node/index.d.cts",
33
+ "import": "./dist/esm/node/index.js",
34
+ "require": "./dist/cjs/node/index.cjs"
27
35
  },
28
36
  "./node/*": {
29
- "types": "./dist/node/*.d.ts",
30
- "import": "./node/*.js"
37
+ "types": "./dist/types/node/*.d.cts",
38
+ "import": "./dist/esm/node/*.js",
39
+ "require": "./dist/cjs/node/*.cjs"
31
40
  }
32
41
  },
33
42
  "scripts": {
@@ -35,14 +44,16 @@
35
44
  "test": "npm run type-check && vitest run",
36
45
  "test:watch": "vitest",
37
46
  "type-check": "tsc --noEmit",
38
- "build": "tsc",
39
- "prepublishOnly": "npm run build"
47
+ "build": "tsup --config tsup.config.mjs",
48
+ "build:watch": "tsup --config tsup.config.mjs --watch",
49
+ "clean": "rm -rf dist",
50
+ "prepublishOnly": "npm run clean && npm run build"
40
51
  },
41
52
  "author": "Zell Liew <zellwk@gmail.com>",
42
53
  "dependencies": {
43
54
  "deep-eql": "^5.0.2",
44
55
  "dompurify": "^3.2.4",
45
- "glob-promise": "^6.0.7",
56
+ "glob": "^11.0.0",
46
57
  "marked": "^15.0.7",
47
58
  "marked-gfm-heading-id": "^4.1.1",
48
59
  "marked-mangle": "^1.1.10",
@@ -54,6 +65,7 @@
54
65
  "@splendidlabz/eslint-config": "2.1.0",
55
66
  "jsdom": "^26.0.0",
56
67
  "np": "^10.2.0",
68
+ "tsup": "^8.0.0",
57
69
  "typescript": "^5.4.2",
58
70
  "vitest": "^3.1.1"
59
71
  }
@@ -18,5 +18,6 @@ export * from './query-params.js'
18
18
  export * from './random-string.js'
19
19
  export * from './sanitize.js'
20
20
  export * from './session-store.js'
21
+ export * from './spam-prevention.js'
21
22
  export * from './trap-focus.js'
22
23
  export * from './ui/index.js'
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Enhances a form element with spam detection capabilities
3
+ * @param {HTMLFormElement} form - The form element to enhance
4
+ * @param {Object} options - Configuration options
5
+ * @param {string} options.honeypotField - Name of the honeypot field (default: 'hp')
6
+ * @param {number} options.honeypotDuration - Minimum time in ms for legitimate form fill (default: 2000)
7
+ * @returns {Function} Cleanup function to remove listeners and method
8
+ */
9
+ export function preventSpam(
10
+ form,
11
+ { honeypotField = 'hp', honeypotDuration = 2000 } = {},
12
+ ) {
13
+ const startTime = Date.now()
14
+ let hasInteraction = false
15
+
16
+ function checkForInteraction() {
17
+ hasInteraction = true
18
+ }
19
+
20
+ const events = ['keydown', 'mousemove', 'touchstart', 'click']
21
+ events.forEach(event => {
22
+ form.addEventListener(event, checkForInteraction, { once: true })
23
+ })
24
+
25
+ form.containsSpam = function () {
26
+ const fillTime = Date.now() - startTime
27
+ const isTooFast = fillTime < honeypotDuration
28
+ const honeypotInput = form.querySelector(`[name="${honeypotField}"]`)
29
+ const hasHoneypotValue = honeypotInput?.value?.trim()
30
+ const noInteraction = !hasInteraction
31
+
32
+ // Clean up event listeners after use
33
+ events.forEach(event =>
34
+ form.removeEventListener(event, checkForInteraction),
35
+ )
36
+
37
+ return isTooFast || !!hasHoneypotValue || noInteraction
38
+ }
39
+ }
@@ -10,7 +10,7 @@ export function markActiveAnchorIn(container, anchorType = 'page') {
10
10
  return element
11
11
  }
12
12
 
13
- export function goToElement(
13
+ export function scrollToElement(
14
14
  element,
15
15
  { scrollBehaviour = 'instant', scrollMargin = '3rem' } = {},
16
16
  ) {
@@ -2,4 +2,5 @@ export * from './item-position.js'
2
2
  export * from './join.js'
3
3
  export * from './shuffle.js'
4
4
  export * from './sort.js'
5
+ export * from './split-array.js'
5
6
  export * from './unique.js'
@@ -3,7 +3,7 @@ import { getNestedValue } from '../objects/nested-property.js'
3
3
  /**
4
4
  * Sorts an array of objects, numbers, or strings without mutating the original array.
5
5
  * Supports nested properties, multiple sort keys, and various data types.
6
- *
6
+ *
7
7
  * @template T
8
8
  * @param {T[]} array - Array to sort
9
9
  * @param {Object} [options] - Sort options
@@ -13,16 +13,16 @@ import { getNestedValue } from '../objects/nested-property.js'
13
13
  * @example
14
14
  * // Sort simple array
15
15
  * sort([3, 1, 2]) // [1, 2, 3]
16
- *
16
+ *
17
17
  * // Sort objects by single property
18
18
  * sort(users, { props: 'name' })
19
- *
19
+ *
20
20
  * // Sort objects by multiple properties
21
21
  * sort(users, { props: ['age', 'name'] })
22
- *
22
+ *
23
23
  * // Sort in reverse order
24
24
  * sort(users, { props: 'age', reverse: true })
25
- *
25
+ *
26
26
  * // Sort by nested property
27
27
  * sort(users, { props: 'address.city' })
28
28
  */
@@ -63,7 +63,7 @@ export function sort(array, { props = null, reverse = false } = {}) {
63
63
  /**
64
64
  * Compares two values for sorting, handling different data types.
65
65
  * Supports numbers, strings, dates, and falls back to string comparison.
66
- *
66
+ *
67
67
  * @param {*} a - First value to compare
68
68
  * @param {*} b - Second value to compare
69
69
  * @returns {number} -1 if a < b, 0 if a === b, 1 if a > b
@@ -0,0 +1,15 @@
1
+ export function splitArray(array, predicate) {
2
+ const ret = {
3
+ picked: [],
4
+ omitted: [],
5
+ }
6
+
7
+ array.forEach((item, index, arr) => {
8
+ if (predicate(item, index, arr)) ret.picked.push(item)
9
+ else ret.omitted.push(item)
10
+ })
11
+
12
+ ret.p = ret.picked
13
+ ret.o = ret.omitted
14
+ return ret
15
+ }
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  // Usage ... Probably should use either protected or bypass, not both.
3
+ // Maybe ... glob would be a better for this
3
4
  @example
4
5
  const config = {
5
6
  routeConfig: {