@splendidlabz/utils 1.11.3 → 1.11.4

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 (408) hide show
  1. package/dist/cjs/dom/accessibility.cjs +53 -0
  2. package/dist/cjs/dom/actions/index.cjs +410 -0
  3. package/dist/cjs/dom/actions/masonry.cjs +152 -0
  4. package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +157 -0
  5. package/dist/cjs/dom/actions/sticky.cjs +213 -0
  6. package/dist/cjs/dom/bounding-box.cjs +70 -0
  7. package/dist/cjs/dom/clipboard.cjs +37 -0
  8. package/dist/cjs/dom/cookie.cjs +57 -0
  9. package/dist/cjs/dom/css-vars.cjs +57 -0
  10. package/dist/cjs/dom/events.cjs +59 -0
  11. package/{src/dom/focusable.js → dist/cjs/dom/focusable.cjs} +51 -73
  12. package/dist/cjs/dom/font-size.cjs +80 -0
  13. package/dist/cjs/dom/get-element.cjs +98 -0
  14. package/dist/cjs/dom/hash.cjs +35 -0
  15. package/dist/cjs/dom/index.cjs +1267 -0
  16. package/dist/cjs/dom/keyboard.cjs +51 -0
  17. package/dist/cjs/dom/local-store.cjs +79 -0
  18. package/dist/cjs/dom/media.cjs +59 -0
  19. package/dist/cjs/dom/observers/index.cjs +253 -0
  20. package/dist/cjs/dom/observers/intersection-observer.cjs +91 -0
  21. package/dist/cjs/dom/observers/mutation-observer.cjs +95 -0
  22. package/dist/cjs/dom/observers/observer.cjs +48 -0
  23. package/dist/cjs/dom/observers/resize-observer.cjs +84 -0
  24. package/dist/cjs/dom/observers/scroll-observer.cjs +177 -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 +63 -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/callback.cjs +31 -0
  55. package/dist/cjs/lib/functions/debounce.cjs +43 -0
  56. package/dist/cjs/lib/functions/env.cjs +32 -0
  57. package/dist/cjs/lib/functions/functional.cjs +82 -0
  58. package/dist/cjs/lib/functions/index.cjs +142 -0
  59. package/dist/cjs/lib/functions/throttle.cjs +38 -0
  60. package/dist/cjs/lib/functions/timeout.cjs +41 -0
  61. package/dist/cjs/lib/hash.cjs +43 -0
  62. package/dist/cjs/lib/index.cjs +1178 -0
  63. package/dist/cjs/lib/numbers/index.cjs +49 -0
  64. package/dist/cjs/lib/numbers/math.cjs +36 -0
  65. package/dist/cjs/lib/objects/camelcase-keys.cjs +80 -0
  66. package/dist/cjs/lib/objects/empty.cjs +39 -0
  67. package/dist/cjs/lib/objects/equal.cjs +47 -0
  68. package/dist/cjs/lib/objects/extend.cjs +147 -0
  69. package/dist/cjs/lib/objects/flatten.cjs +48 -0
  70. package/dist/cjs/lib/objects/index.cjs +378 -0
  71. package/dist/cjs/lib/objects/json.cjs +35 -0
  72. package/dist/cjs/lib/objects/loop.cjs +40 -0
  73. package/dist/cjs/lib/objects/mix/mix.cjs +115 -0
  74. package/dist/cjs/lib/objects/nested-property.cjs +45 -0
  75. package/dist/cjs/lib/objects/normalize-object.cjs +106 -0
  76. package/dist/cjs/lib/objects/omit-empty.cjs +40 -0
  77. package/dist/cjs/lib/objects/size.cjs +63 -0
  78. package/dist/cjs/lib/objects/split.cjs +39 -0
  79. package/dist/cjs/lib/promises/index.cjs +69 -0
  80. package/dist/cjs/lib/promises/reject.cjs +67 -0
  81. package/dist/cjs/lib/sse.cjs +99 -0
  82. package/dist/cjs/lib/strings/convert-case/convert-case.cjs +96 -0
  83. package/dist/cjs/lib/strings/index.cjs +197 -0
  84. package/dist/cjs/lib/strings/markdown.cjs +76 -0
  85. package/dist/cjs/lib/strings/name.cjs +46 -0
  86. package/dist/cjs/lib/strings/pluralize.cjs +40 -0
  87. package/dist/cjs/lib/strings/query-string.cjs +43 -0
  88. package/dist/cjs/lib/style/index.cjs +64 -0
  89. package/dist/cjs/lib/symbols/index.cjs +40 -0
  90. package/dist/cjs/lib/symbols/symbols.cjs +38 -0
  91. package/dist/cjs/node/dirname.cjs +49 -0
  92. package/dist/cjs/node/file-cache.cjs +200 -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 +296 -0
  96. package/dist/cjs/node/pkce.cjs +64 -0
  97. package/dist/cjs/node/random-string.cjs +43 -0
  98. package/dist/cjs/node/sanitize.cjs +65 -0
  99. package/dist/cjs/node/uuid.cjs +42 -0
  100. package/dist/esm/dom/accessibility.js +26 -0
  101. package/dist/esm/dom/actions/index.js +3 -0
  102. package/dist/esm/dom/actions/masonry.js +38 -0
  103. package/dist/esm/dom/actions/prefer-horizontal-scroll.js +90 -0
  104. package/dist/esm/dom/actions/sticky.js +70 -0
  105. package/dist/esm/dom/bounding-box.js +44 -0
  106. package/dist/esm/dom/clipboard.js +12 -0
  107. package/dist/esm/dom/cookie.js +31 -0
  108. package/dist/esm/dom/css-vars.js +21 -0
  109. package/dist/esm/dom/events.js +31 -0
  110. package/dist/esm/dom/focusable.js +117 -0
  111. package/dist/esm/dom/font-size.js +40 -0
  112. package/dist/esm/dom/get-element.js +66 -0
  113. package/dist/esm/dom/hash.js +10 -0
  114. package/dist/esm/dom/index.js +23 -0
  115. package/dist/esm/dom/keyboard.js +22 -0
  116. package/{src → dist/esm}/dom/local-store.js +16 -28
  117. package/dist/esm/dom/media.js +32 -0
  118. package/dist/esm/dom/observers/index.js +4 -0
  119. package/dist/esm/dom/observers/intersection-observer.js +36 -0
  120. package/dist/esm/dom/observers/mutation-observer.js +40 -0
  121. package/dist/esm/dom/observers/observer.js +15 -0
  122. package/dist/esm/dom/observers/resize-observer.js +29 -0
  123. package/dist/esm/dom/observers/scroll-observer.js +95 -0
  124. package/dist/esm/dom/pkce.js +20 -0
  125. package/dist/esm/dom/query-params.js +13 -0
  126. package/dist/esm/dom/random-string.js +12 -0
  127. package/dist/esm/dom/sanitize.js +8 -0
  128. package/dist/esm/dom/session-store.js +24 -0
  129. package/dist/esm/dom/spam-prevention.js +25 -0
  130. package/dist/esm/dom/trap-focus.js +51 -0
  131. package/dist/esm/dom/ui/aria-current.js +17 -0
  132. package/dist/esm/dom/ui/inconsistent-button-fix.js +10 -0
  133. package/dist/esm/dom/ui/index.js +4 -0
  134. package/dist/esm/dom/ui/scroll-container.js +22 -0
  135. package/dist/esm/dom/ui/traverse-and-scramble.js +25 -0
  136. package/dist/esm/lib/arrays/index.js +6 -0
  137. package/dist/esm/lib/arrays/item-position.js +15 -0
  138. package/dist/esm/lib/arrays/join.js +12 -0
  139. package/dist/esm/lib/arrays/shuffle.js +17 -0
  140. package/dist/esm/lib/arrays/sort.js +36 -0
  141. package/dist/esm/lib/arrays/split-array.js +16 -0
  142. package/dist/esm/lib/arrays/unique.js +6 -0
  143. package/dist/esm/lib/auth/index.js +1 -0
  144. package/dist/esm/lib/auth/route-manager.js +25 -0
  145. package/dist/esm/lib/checks.js +34 -0
  146. package/dist/esm/lib/date/days.js +12 -0
  147. package/dist/esm/lib/date/index.js +3 -0
  148. package/dist/esm/lib/date/months.js +77 -0
  149. package/dist/esm/lib/date/time.js +75 -0
  150. package/dist/esm/lib/form/form-data.js +57 -0
  151. package/dist/esm/lib/form/index.js +2 -0
  152. package/dist/esm/lib/form/sanitize.js +34 -0
  153. package/dist/esm/lib/functions/callback.js +6 -0
  154. package/dist/esm/lib/functions/debounce.js +18 -0
  155. package/dist/esm/lib/functions/env.js +7 -0
  156. package/dist/esm/lib/functions/functional.js +52 -0
  157. package/dist/esm/lib/functions/index.js +5 -0
  158. package/dist/esm/lib/functions/throttle.js +13 -0
  159. package/dist/esm/lib/functions/timeout.js +14 -0
  160. package/dist/esm/lib/hash.js +18 -0
  161. package/dist/esm/lib/index.js +14 -0
  162. package/dist/esm/lib/numbers/index.js +11 -0
  163. package/dist/esm/lib/numbers/math.js +10 -0
  164. package/dist/esm/lib/objects/camelcase-keys.js +16 -0
  165. package/dist/esm/lib/objects/empty.js +13 -0
  166. package/dist/esm/lib/objects/equal.js +11 -0
  167. package/dist/esm/lib/objects/extend.js +13 -0
  168. package/dist/esm/lib/objects/flatten.js +17 -0
  169. package/dist/esm/lib/objects/index.js +13 -0
  170. package/dist/esm/lib/objects/json.js +10 -0
  171. package/dist/esm/lib/objects/loop.js +14 -0
  172. package/dist/esm/lib/objects/mix/mix.js +88 -0
  173. package/dist/esm/lib/objects/nested-property.js +18 -0
  174. package/dist/esm/lib/objects/normalize-object.js +9 -0
  175. package/dist/esm/lib/objects/omit-empty.js +15 -0
  176. package/dist/esm/lib/objects/size.js +38 -0
  177. package/dist/esm/lib/objects/split.js +14 -0
  178. package/dist/esm/lib/promises/index.js +1 -0
  179. package/dist/esm/lib/promises/reject.js +17 -0
  180. package/dist/esm/lib/sse.js +50 -0
  181. package/dist/esm/lib/strings/convert-case/convert-case.js +64 -0
  182. package/dist/esm/lib/strings/index.js +5 -0
  183. package/dist/esm/lib/strings/markdown.js +40 -0
  184. package/dist/esm/lib/strings/name.js +21 -0
  185. package/dist/esm/lib/strings/pluralize.js +5 -0
  186. package/dist/esm/lib/strings/query-string.js +16 -0
  187. package/dist/esm/lib/style/index.js +12 -0
  188. package/dist/esm/lib/symbols/index.js +1 -0
  189. package/dist/esm/lib/symbols/symbols.js +12 -0
  190. package/dist/esm/node/context.js +0 -0
  191. package/dist/esm/node/dirname.js +13 -0
  192. package/dist/esm/node/file-cache.js +121 -0
  193. package/dist/esm/node/file.js +14 -0
  194. package/dist/esm/node/hash.js +7 -0
  195. package/dist/esm/node/index.js +7 -0
  196. package/dist/esm/node/pkce.js +20 -0
  197. package/dist/esm/node/random-string.js +8 -0
  198. package/dist/esm/node/sanitize.js +8 -0
  199. package/dist/esm/node/uuid.js +7 -0
  200. package/dist/types/dom/accessibility.d.cts +30 -0
  201. package/dist/types/dom/actions/index.d.cts +3 -0
  202. package/dist/types/dom/actions/masonry.d.cts +5 -0
  203. package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +5 -0
  204. package/dist/types/dom/actions/sticky.d.cts +5 -0
  205. package/{src/dom/bounding-box.js → dist/types/dom/bounding-box.d.cts} +8 -49
  206. package/dist/types/dom/clipboard.d.cts +7 -0
  207. package/dist/types/dom/cookie.d.cts +7 -0
  208. package/dist/types/dom/css-vars.d.cts +6 -0
  209. package/{src/dom/events.js → dist/types/dom/events.d.cts} +52 -31
  210. package/dist/types/dom/focusable.d.cts +78 -0
  211. package/dist/types/dom/font-size.d.cts +8 -0
  212. package/{src/dom/get-element.js → dist/types/dom/get-element.d.cts} +25 -99
  213. package/dist/types/dom/hash.d.cts +3 -0
  214. package/dist/types/dom/index.d.cts +31 -0
  215. package/{src/dom/keyboard.js → dist/types/dom/keyboard.d.cts} +7 -19
  216. package/dist/types/dom/local-store.d.cts +31 -0
  217. package/dist/types/dom/media.d.cts +5 -0
  218. package/dist/types/dom/observers/index.d.cts +4 -0
  219. package/dist/types/dom/observers/intersection-observer.d.cts +10 -0
  220. package/dist/types/dom/observers/mutation-observer.d.cts +9 -0
  221. package/dist/types/dom/observers/observer.d.cts +3 -0
  222. package/{src/dom/observers/resize-observer.js → dist/types/dom/observers/resize-observer.d.cts} +6 -32
  223. package/dist/types/dom/observers/scroll-observer.d.cts +40 -0
  224. package/dist/types/dom/pkce.d.cts +8 -0
  225. package/dist/types/dom/query-params.d.cts +6 -0
  226. package/dist/types/dom/random-string.d.cts +9 -0
  227. package/dist/types/dom/sanitize.d.cts +10 -0
  228. package/dist/types/dom/session-store.d.cts +7 -0
  229. package/dist/types/dom/spam-prevention.d.cts +14 -0
  230. package/dist/types/dom/trap-focus.d.cts +32 -0
  231. package/dist/types/dom/ui/aria-current.d.cts +7 -0
  232. package/{src/dom/ui/inconsistent-button-fix.js → dist/types/dom/ui/inconsistent-button-fix.d.cts} +5 -11
  233. package/dist/types/dom/ui/index.d.cts +4 -0
  234. package/dist/types/dom/ui/scroll-container.d.cts +3 -0
  235. package/dist/types/dom/ui/traverse-and-scramble.d.cts +21 -0
  236. package/dist/types/lib/arrays/index.d.cts +6 -0
  237. package/{src/lib/arrays/item-position.js → dist/types/lib/arrays/item-position.d.cts} +5 -12
  238. package/{src/lib/arrays/join.js → dist/types/lib/arrays/join.d.cts} +4 -9
  239. package/dist/types/lib/arrays/shuffle.d.cts +3 -0
  240. package/dist/types/lib/arrays/sort.d.cts +32 -0
  241. package/dist/types/lib/arrays/split-array.d.cts +6 -0
  242. package/dist/types/lib/arrays/unique.d.cts +3 -0
  243. package/dist/types/lib/auth/index.d.cts +1 -0
  244. package/dist/types/lib/auth/route-manager.d.cts +28 -0
  245. package/dist/types/lib/checks.d.cts +33 -0
  246. package/dist/types/lib/date/days.d.cts +7 -0
  247. package/dist/types/lib/date/index.d.cts +3 -0
  248. package/dist/types/lib/date/months.d.cts +11 -0
  249. package/dist/types/lib/date/time.d.cts +21 -0
  250. package/dist/types/lib/form/form-data.d.cts +9 -0
  251. package/dist/types/lib/form/index.d.cts +2 -0
  252. package/{src/lib/form/sanitize.js → dist/types/lib/form/sanitize.d.cts} +19 -39
  253. package/{src/lib/functions/callback.js → dist/types/lib/functions/callback.d.cts} +3 -3
  254. package/dist/types/lib/functions/debounce.d.cts +3 -0
  255. package/dist/types/lib/functions/env.d.cts +3 -0
  256. package/{src/lib/functions/functional.js → dist/types/lib/functions/functional.d.cts} +8 -49
  257. package/dist/types/lib/functions/index.d.cts +5 -0
  258. package/dist/types/lib/functions/throttle.d.cts +3 -0
  259. package/dist/types/lib/functions/timeout.d.cts +5 -0
  260. package/dist/types/lib/hash.d.cts +3 -0
  261. package/dist/types/lib/index.d.cts +43 -0
  262. package/dist/types/lib/numbers/index.d.cts +5 -0
  263. package/dist/types/lib/numbers/math.d.cts +4 -0
  264. package/dist/types/lib/objects/camelcase-keys.d.cts +3 -0
  265. package/dist/types/lib/objects/empty.d.cts +4 -0
  266. package/dist/types/lib/objects/equal.d.cts +4 -0
  267. package/dist/types/lib/objects/extend.d.cts +6 -0
  268. package/dist/types/lib/objects/flatten.d.cts +6 -0
  269. package/dist/types/lib/objects/index.d.cts +13 -0
  270. package/dist/types/lib/objects/json.d.cts +3 -0
  271. package/dist/types/lib/objects/loop.d.cts +4 -0
  272. package/dist/types/lib/objects/mix/mix.d.cts +44 -0
  273. package/{src/lib/objects/nested-property.js → dist/types/lib/objects/nested-property.d.cts} +4 -21
  274. package/dist/types/lib/objects/normalize-object.d.cts +3 -0
  275. package/dist/types/lib/objects/omit-empty.d.cts +3 -0
  276. package/dist/types/lib/objects/size.d.cts +3 -0
  277. package/dist/types/lib/objects/split.d.cts +14 -0
  278. package/dist/types/lib/promises/index.d.cts +1 -0
  279. package/dist/types/lib/promises/reject.d.cts +5 -0
  280. package/dist/types/lib/sse.d.cts +18 -0
  281. package/dist/types/lib/strings/convert-case/convert-case.d.cts +10 -0
  282. package/dist/types/lib/strings/index.d.cts +5 -0
  283. package/dist/types/lib/strings/markdown.d.cts +25 -0
  284. package/dist/types/lib/strings/name.d.cts +7 -0
  285. package/dist/types/lib/strings/pluralize.d.cts +3 -0
  286. package/dist/types/lib/strings/query-string.d.cts +10 -0
  287. package/dist/types/lib/style/index.d.cts +3 -0
  288. package/dist/types/lib/symbols/index.d.cts +1 -0
  289. package/dist/types/lib/symbols/symbols.d.cts +4 -0
  290. package/dist/types/node/context.d.cts +2 -0
  291. package/dist/types/node/dirname.d.cts +9 -0
  292. package/dist/types/node/file-cache.d.cts +56 -0
  293. package/dist/types/node/file.d.cts +4 -0
  294. package/dist/types/node/hash.d.cts +3 -0
  295. package/dist/types/node/index.d.cts +7 -0
  296. package/dist/types/node/pkce.d.cts +14 -0
  297. package/dist/types/node/random-string.d.cts +3 -0
  298. package/{src/node/sanitize.js → dist/types/node/sanitize.d.cts} +3 -6
  299. package/dist/types/node/uuid.d.cts +3 -0
  300. package/package.json +4 -1
  301. package/CHANGELOG.md +0 -237
  302. package/eslint.config.js +0 -2
  303. package/src/dom/accessibility.js +0 -58
  304. package/src/dom/actions/index.js +0 -3
  305. package/src/dom/actions/masonry.js +0 -43
  306. package/src/dom/actions/prefer-horizontal-scroll.js +0 -121
  307. package/src/dom/actions/sticky.js +0 -85
  308. package/src/dom/clipboard.js +0 -14
  309. package/src/dom/cookie.js +0 -32
  310. package/src/dom/css-vars.js +0 -19
  311. package/src/dom/font-size.js +0 -40
  312. package/src/dom/hash.js +0 -9
  313. package/src/dom/index.js +0 -23
  314. package/src/dom/media.js +0 -30
  315. package/src/dom/observers/index.js +0 -4
  316. package/src/dom/observers/intersection-observer.js +0 -43
  317. package/src/dom/observers/mutation-observer.js +0 -51
  318. package/src/dom/observers/observer.js +0 -18
  319. package/src/dom/observers/scroll-observer.js +0 -146
  320. package/src/dom/pkce.js +0 -34
  321. package/src/dom/query-params.js +0 -14
  322. package/src/dom/random-string.js +0 -18
  323. package/src/dom/random-string.test.js +0 -13
  324. package/src/dom/sanitize.js +0 -16
  325. package/src/dom/session-store.js +0 -29
  326. package/src/dom/spam-prevention.js +0 -40
  327. package/src/dom/trap-focus.js +0 -70
  328. package/src/dom/ui/aria-current.js +0 -20
  329. package/src/dom/ui/index.js +0 -4
  330. package/src/dom/ui/scroll-container.js +0 -25
  331. package/src/dom/ui/traverse-and-scramble.js +0 -61
  332. package/src/lib/arrays/index.js +0 -6
  333. package/src/lib/arrays/shuffle.js +0 -21
  334. package/src/lib/arrays/sort.js +0 -88
  335. package/src/lib/arrays/sort.spec.js +0 -123
  336. package/src/lib/arrays/split-array.js +0 -15
  337. package/src/lib/arrays/unique.js +0 -3
  338. package/src/lib/auth/index.js +0 -1
  339. package/src/lib/auth/route-manager.js +0 -45
  340. package/src/lib/checks.js +0 -57
  341. package/src/lib/date/days.js +0 -9
  342. package/src/lib/date/index.js +0 -3
  343. package/src/lib/date/months.js +0 -74
  344. package/src/lib/date/time.js +0 -83
  345. package/src/lib/form/form-data.js +0 -73
  346. package/src/lib/form/index.js +0 -2
  347. package/src/lib/form/sanitize.spec.js +0 -126
  348. package/src/lib/functions/debounce.js +0 -18
  349. package/src/lib/functions/env.js +0 -5
  350. package/src/lib/functions/functional.test.js +0 -196
  351. package/src/lib/functions/index.js +0 -5
  352. package/src/lib/functions/throttle.js +0 -11
  353. package/src/lib/functions/timeout.js +0 -15
  354. package/src/lib/hash.js +0 -18
  355. package/src/lib/hash.spec.js +0 -163
  356. package/src/lib/index.js +0 -14
  357. package/src/lib/numbers/index.js +0 -12
  358. package/src/lib/numbers/math.js +0 -9
  359. package/src/lib/numbers/split-unit.test.js +0 -45
  360. package/src/lib/objects/camelcase-keys.js +0 -17
  361. package/src/lib/objects/camelcase-keys.test.js +0 -72
  362. package/src/lib/objects/empty.js +0 -10
  363. package/src/lib/objects/equal.js +0 -9
  364. package/src/lib/objects/extend.js +0 -16
  365. package/src/lib/objects/extend.test.js +0 -35
  366. package/src/lib/objects/flatten.js +0 -19
  367. package/src/lib/objects/index.js +0 -13
  368. package/src/lib/objects/json.js +0 -7
  369. package/src/lib/objects/loop.js +0 -11
  370. package/src/lib/objects/loop.test.js +0 -31
  371. package/src/lib/objects/mix/mix.js +0 -191
  372. package/src/lib/objects/mix/mix.md +0 -78
  373. package/src/lib/objects/mix/mix.test.js +0 -445
  374. package/src/lib/objects/normalize-object.js +0 -10
  375. package/src/lib/objects/omit-empty.js +0 -23
  376. package/src/lib/objects/omit-empty.test.js +0 -85
  377. package/src/lib/objects/size.js +0 -41
  378. package/src/lib/objects/split.js +0 -19
  379. package/src/lib/promises/index.js +0 -1
  380. package/src/lib/promises/reject.js +0 -17
  381. package/src/lib/sse.js +0 -61
  382. package/src/lib/strings/convert-case/convert-case.js +0 -86
  383. package/src/lib/strings/convert-case/convert-case.md +0 -44
  384. package/src/lib/strings/convert-case/convert-case.test.js +0 -50
  385. package/src/lib/strings/index.js +0 -5
  386. package/src/lib/strings/markdown.js +0 -71
  387. package/src/lib/strings/markdown.spec.js +0 -73
  388. package/src/lib/strings/name.js +0 -24
  389. package/src/lib/strings/name.test.js +0 -67
  390. package/src/lib/strings/pluralize.js +0 -2
  391. package/src/lib/strings/query-string.js +0 -18
  392. package/src/lib/style/index.js +0 -13
  393. package/src/lib/symbols/index.js +0 -1
  394. package/src/lib/symbols/symbols.js +0 -9
  395. package/src/node/dirname.js +0 -17
  396. package/src/node/file-cache.js +0 -184
  397. package/src/node/file.js +0 -13
  398. package/src/node/hash.js +0 -5
  399. package/src/node/index.js +0 -7
  400. package/src/node/pkce.js +0 -33
  401. package/src/node/random-string.js +0 -10
  402. package/src/node/random-string.test.js +0 -15
  403. package/src/node/sanitize.spec.js +0 -142
  404. package/src/node/uuid.js +0 -5
  405. package/tsconfig.json +0 -23
  406. package/tsup.config.js +0 -38
  407. package/tsup.config.mjs +0 -63
  408. /package/{src/node/context.js → dist/cjs/node/context.cjs} +0 -0
@@ -0,0 +1,121 @@
1
+ import fs from "fs/promises";
2
+ import { glob } from "glob";
3
+ import path from "node:path";
4
+ import { sort } from "../lib/arrays/sort.js";
5
+ function resolveDirPath(dirPath) {
6
+ return path.isAbsolute(dirPath) ? dirPath : path.join(process.cwd(), dirPath);
7
+ }
8
+ async function createCache(dir) {
9
+ const absDirpath = resolveDirPath(dir);
10
+ await fs.mkdir(absDirpath, { recursive: true });
11
+ return {
12
+ async cacheAt(file) {
13
+ if (file) {
14
+ const absFilepath = path.join(absDirpath, file);
15
+ try {
16
+ const stat = await fs.stat(absFilepath);
17
+ return stat.mtimeMs;
18
+ } catch (error) {
19
+ return 0;
20
+ }
21
+ } else {
22
+ return getLastModifiedTime(absDirpath + "/**/*");
23
+ }
24
+ },
25
+ getAbsPath(file) {
26
+ return path.join(absDirpath, file);
27
+ },
28
+ async hasFile(file) {
29
+ const absFilepath = path.join(absDirpath, file);
30
+ try {
31
+ await fs.stat(absFilepath);
32
+ return true;
33
+ } catch (e) {
34
+ return false;
35
+ }
36
+ },
37
+ async loadFile(file) {
38
+ try {
39
+ const absFilepath = path.join(absDirpath, file);
40
+ return fs.readFile(absFilepath);
41
+ } catch (error) {
42
+ console.warn(`File not found: ${file}`);
43
+ }
44
+ },
45
+ async saveFile(file, data) {
46
+ const absfilepath = path.join(absDirpath, file);
47
+ await fs.writeFile(absfilepath, data);
48
+ },
49
+ async loadJSON(file) {
50
+ const data = await this.loadFile(file);
51
+ try {
52
+ return JSON.parse(data.toString());
53
+ } catch (err) {
54
+ console.warn(`Error parsing JSON: ${file}`);
55
+ return {};
56
+ }
57
+ },
58
+ async saveJSON(file, data) {
59
+ await this.saveFile(file, JSON.stringify(data));
60
+ }
61
+ };
62
+ }
63
+ async function fileCache({ dir, file }) {
64
+ const absDirpath = resolveDirPath(dir);
65
+ await fs.mkdir(absDirpath, { recursive: true });
66
+ const cachePath = path.join(absDirpath, `${file}`);
67
+ let modifiedAt = 0;
68
+ try {
69
+ const stat = await fs.stat(cachePath);
70
+ modifiedAt = stat.mtimeMs;
71
+ } catch (error) {
72
+ }
73
+ return {
74
+ modifiedAt,
75
+ async load() {
76
+ return fs.readFile(cachePath);
77
+ },
78
+ async save(data) {
79
+ await fs.writeFile(cachePath, data);
80
+ },
81
+ async loadJSON() {
82
+ const data = await fs.readFile(cachePath);
83
+ return JSON.parse(data.toString());
84
+ },
85
+ async saveJSON(data) {
86
+ await fs.writeFile(cachePath, JSON.stringify(data));
87
+ }
88
+ };
89
+ }
90
+ async function getLastModifiedTime(globPath) {
91
+ let files;
92
+ if (typeof globPath === "string") {
93
+ files = await glob(removeFirstSlash(globPath));
94
+ }
95
+ if (Array.isArray(globPath)) {
96
+ const a = await Promise.all(
97
+ globPath.map((path2) => glob(removeFirstSlash(path2)))
98
+ );
99
+ files = a.flat();
100
+ }
101
+ const stats = await Promise.all(files.map((file) => fs.stat(file)));
102
+ const timestamps = stats.map((stat) => Number(stat.mtimeMs));
103
+ const sorted = sort(timestamps, { props: "mtimeMs", reverse: true });
104
+ return sorted[0] || 0;
105
+ }
106
+ async function getLatestModifiedTime(globPath) {
107
+ console.warn(
108
+ "`getLatestModifiedTime` has been renamed to `getLastModifiedTime` and will be deprecated in future versions. Please use `getLastModifiedTime` instead."
109
+ );
110
+ return getLastModifiedTime(globPath);
111
+ }
112
+ function removeFirstSlash(x) {
113
+ return x.startsWith("/") ? x.slice(1) : x;
114
+ }
115
+ export {
116
+ createCache,
117
+ fileCache,
118
+ getLastModifiedTime,
119
+ getLatestModifiedTime,
120
+ removeFirstSlash
121
+ };
@@ -0,0 +1,14 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ async function mkdir(path2) {
4
+ return fs.mkdir(path2, { recursive: true });
5
+ }
6
+ async function copyFile(from, to) {
7
+ const dir = path.dirname(to);
8
+ await mkdir(dir);
9
+ await fs.copyFile(from, to);
10
+ }
11
+ export {
12
+ copyFile,
13
+ mkdir
14
+ };
@@ -0,0 +1,7 @@
1
+ import crypto from "node:crypto";
2
+ function sha256Hash(string) {
3
+ return crypto.createHash("sha256").update(string).digest("hex");
4
+ }
5
+ export {
6
+ sha256Hash
7
+ };
@@ -0,0 +1,7 @@
1
+ export * from "./dirname.js";
2
+ export * from "./file-cache.js";
3
+ export * from "./hash.js";
4
+ export * from "./pkce.js";
5
+ export * from "./random-string.js";
6
+ export * from "./sanitize.js";
7
+ export * from "./uuid.js";
@@ -0,0 +1,20 @@
1
+ import crypto from "node:crypto";
2
+ import { randomString } from "./random-string.js";
3
+ async function PKCE() {
4
+ const codeVerifier = await randomString();
5
+ const codeChallenge = await getCodeChallenge(codeVerifier);
6
+ return {
7
+ state: await randomString(),
8
+ code_verifier: codeVerifier,
9
+ code_challenge: codeChallenge,
10
+ code_challenge_method: "S256"
11
+ };
12
+ }
13
+ function getCodeChallenge(verifier) {
14
+ const hash = crypto.createHash("sha256").update(verifier).digest();
15
+ return hash.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
16
+ }
17
+ export {
18
+ PKCE,
19
+ getCodeChallenge
20
+ };
@@ -0,0 +1,8 @@
1
+ import crypto from "node:crypto";
2
+ function randomString(length = 32) {
3
+ const bytesNeeded = Math.ceil(length * 3 / 4) + 3;
4
+ return crypto.randomBytes(bytesNeeded).toString("base64").slice(0, length);
5
+ }
6
+ export {
7
+ randomString
8
+ };
@@ -0,0 +1,8 @@
1
+ import sanitizeHtml from "sanitize-html";
2
+ import { sanitize as sanitizeLib } from "../lib/form/sanitize.js";
3
+ function sanitize(value, options = {}) {
4
+ return sanitizeLib(value, { sanitizer: sanitizeHtml, ...options });
5
+ }
6
+ export {
7
+ sanitize
8
+ };
@@ -0,0 +1,7 @@
1
+ import crypto from "crypto";
2
+ function uuid() {
3
+ return crypto.randomUUID();
4
+ }
5
+ export {
6
+ uuid
7
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Checks if an element has an accessible name through label or aria-labelledby
3
+ * @param {string} [label] - The label text
4
+ * @param {string} [labelledBy] - The aria-labelledby value
5
+ * @returns {boolean} True if the element has an accessible name
6
+ */
7
+ declare function hasAccessibleName(label?: string, labelledBy?: string): boolean;
8
+ /**
9
+ * Checks if an element has an accessible name and logs a warning/error if it doesn't
10
+ * @param {Object} [options] - Options for checking accessible name
11
+ * @param {string} [options.name] - The name of the element being checked
12
+ * @param {string} [options.ariaLabel] - The aria-label value
13
+ * @param {string} [options.ariaLabelledBy] - The aria-labelledby value
14
+ * @param {'warn'|'error'} [options.severity='warn'] - Severity level for the message
15
+ * @returns {boolean} True if the element has an accessible name
16
+ */
17
+ declare function checkForAccessibleName({ name, ariaLabel, ariaLabelledBy, severity, }?: {
18
+ name?: string;
19
+ ariaLabel?: string;
20
+ ariaLabelledBy?: string;
21
+ severity?: "warn" | "error";
22
+ }): boolean;
23
+ /**
24
+ * Checks if an ARIA popup value is valid
25
+ * @param {string} value - The ARIA popup value to check
26
+ * @returns {boolean} True if the value is invalid
27
+ */
28
+ declare function isInvalidAriaPopup(value: string): boolean;
29
+
30
+ export { checkForAccessibleName, hasAccessibleName, isInvalidAriaPopup };
@@ -0,0 +1,3 @@
1
+ export { masonry } from './masonry.cjs';
2
+ export { preferHorizontalScroll } from './prefer-horizontal-scroll.cjs';
3
+ export { sticky } from './sticky.cjs';
@@ -0,0 +1,5 @@
1
+ declare function masonry(node: any): Promise<{
2
+ destroy(): void;
3
+ }>;
4
+
5
+ export { masonry };
@@ -0,0 +1,5 @@
1
+ declare function preferHorizontalScroll(node: any, props?: {}): {
2
+ destroy(): void;
3
+ };
4
+
5
+ export { preferHorizontalScroll };
@@ -0,0 +1,5 @@
1
+ declare function sticky(node: any, props?: {}): {
2
+ destroy(): void;
3
+ };
4
+
5
+ export { sticky };
@@ -15,37 +15,9 @@
15
15
  * @property {number} xCenter - The horizontal center coordinate
16
16
  * @property {number} yCenter - The vertical center coordinate
17
17
  */
18
- export function boundingBox(element, { containsPadding = true } = {}) {
19
- const box = element.getBoundingClientRect()
20
-
21
- // Spread original properties into the return object
22
- const ret = {}
23
- for (const prop in box) ret[prop] = box[prop]
24
-
25
- // Gets boundingClientRect value without padding
26
- if (!containsPadding) {
27
- const style = getComputedStyle(element)
28
- // Parse padding values immediately to numbers
29
- const paddingTop = parseFloat(style.paddingTop)
30
- const paddingRight = parseFloat(style.paddingRight)
31
- const paddingBottom = parseFloat(style.paddingBottom)
32
- const paddingLeft = parseFloat(style.paddingLeft)
33
-
34
- ret.x = ret.x + paddingLeft
35
- ret.y = ret.y + paddingTop
36
- ret.width = ret.width - paddingLeft - paddingRight
37
- ret.height = ret.height - paddingTop - paddingBottom
38
- ret.top = ret.top + paddingTop
39
- ret.bottom = ret.bottom - paddingBottom
40
- ret.right = ret.right - paddingRight
41
- ret.left = ret.left + paddingLeft
42
- }
43
-
44
- ret.xCenter = (ret.left + ret.right) / 2
45
- ret.yCenter = (ret.top + ret.bottom) / 2
46
- return ret
47
- }
48
-
18
+ declare function boundingBox(element: HTMLElement, { containsPadding }?: {
19
+ containsPadding?: boolean;
20
+ }): any;
49
21
  /**
50
22
  * Gets the bounding box of an element relative to its ancestor
51
23
  * @param {Object} params - Parameters for the calculation
@@ -61,22 +33,9 @@ export function boundingBox(element, { containsPadding = true } = {}) {
61
33
  * @property {number} xCenter - The horizontal center coordinate relative to ancestor
62
34
  * @property {number} yCenter - The vertical center coordinate relative to ancestor
63
35
  */
64
- export function boundingBoxRelativeToAncestor({ element, ancestorElement }) {
65
- ancestorElement = ancestorElement || element.parentElement
66
-
67
- const box = boundingBox(element)
68
- const ancestorBox = boundingBox(ancestorElement, {
69
- containsPadding: false,
70
- })
36
+ declare function boundingBoxRelativeToAncestor({ element, ancestorElement }: {
37
+ element: HTMLElement;
38
+ ancestorElement?: HTMLElement;
39
+ }): any;
71
40
 
72
- return {
73
- top: box.top - ancestorBox.top,
74
- right: box.right - ancestorBox.right,
75
- bottom: box.bottom - ancestorBox.bottom,
76
- left: box.left - ancestorBox.left,
77
- width: box.width,
78
- height: box.height,
79
- xCenter: (box.left + box.right) / 2 - ancestorBox.left,
80
- yCenter: (box.top + box.bottom) / 2 - ancestorBox.top,
81
- }
82
- }
41
+ export { boundingBox, boundingBoxRelativeToAncestor };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copies rich text from an element to the clipboard
3
+ * @param HTMLElement element - Element to copy
4
+ */
5
+ declare function copyRichText(element: any): void;
6
+
7
+ export { copyRichText };
@@ -0,0 +1,7 @@
1
+ declare function getCookie(name: any): any;
2
+ declare namespace cookies {
3
+ function get(name: any): any;
4
+ function set(name: any, value: any, days: any): void;
5
+ }
6
+
7
+ export { cookies, getCookie };
@@ -0,0 +1,6 @@
1
+ declare function getCSSValue(element: any, prop: any): string;
2
+ declare function setCSSValue(element: any, prop: any, value: any): void;
3
+ declare function getCSSVar(element: any, prop: any): string;
4
+ declare function setCSSVar(element: any, prop: any, value: any): void;
5
+
6
+ export { getCSSValue, getCSSVar, setCSSValue, setCSSVar };
@@ -4,7 +4,6 @@
4
4
  * @property {string} event - The event type (e.g., 'click', 'keydown')
5
5
  * @property {EventListenerOrEventListenerObject} handler - The event handler function
6
6
  */
7
-
8
7
  /**
9
8
  * @typedef {Object} ListenerManager
10
9
  * @property {EventListener[]} list - Array of current event listeners
@@ -12,34 +11,22 @@
12
11
  * @property {function(EventListener): void} remove - Remove an event listener
13
12
  * @property {function(): void} clear - Remove all event listeners
14
13
  */
15
-
16
14
  /**
17
15
  * @typedef {Object} CustomEventOptions
18
16
  * @property {boolean} [bubbles=false] - Whether the event bubbles up through the DOM
19
17
  * @property {boolean} [cancelable=false] - Whether the event can be canceled
20
18
  * @property {boolean} [composed=false] - Whether the event will trigger listeners outside of a shadow root
21
19
  */
22
-
23
20
  /**
24
21
  * Adds multiple event listeners to their respective DOM elements
25
22
  * @param {EventListener[]} listeners - Array of listener objects
26
23
  */
27
- export function addListeners(listeners) {
28
- listeners.forEach(({ node, event, handler }) => {
29
- node.addEventListener(event, handler)
30
- })
31
- }
32
-
24
+ declare function addListeners(listeners: EventListener[]): void;
33
25
  /**
34
26
  * Removes multiple event listeners from their respective DOM elements
35
27
  * @param {EventListener[]} listeners - Array of listener objects
36
28
  */
37
- export function removeListeners(listeners) {
38
- listeners.forEach(({ node, event, handler }) => {
39
- node.removeEventListener(event, handler)
40
- })
41
- }
42
-
29
+ declare function removeListeners(listeners: EventListener[]): void;
43
30
  /**
44
31
  * Dispatches a custom event from a DOM node
45
32
  * @param {Element} node - The DOM element to dispatch the event from
@@ -47,25 +34,59 @@ export function removeListeners(listeners) {
47
34
  * @param {*} detail - The detail data to include with the event
48
35
  * @param {CustomEventOptions} [options={}] - Additional event options
49
36
  */
50
- export function dispatchEvent(node, eventName, detail, options = {}) {
51
- node.dispatchEvent(
52
- new CustomEvent(eventName, {
53
- ...options,
54
- detail,
55
- }),
56
- )
57
- }
58
-
37
+ declare function dispatchEvent(node: Element, eventName: string, detail: any, options?: CustomEventOptions): void;
59
38
  /**
60
39
  * Creates a new CustomEvent with updated properties from an existing event
61
40
  * @param {Event} event - The original event object
62
41
  * @param {Object} updates - Properties to update in the new event
63
42
  * @return {CustomEvent} A new CustomEvent with updated properties
64
43
  */
65
- export function updateEvent(event, updates) {
66
- const { type, ...rest } = event
67
- return new CustomEvent(event.type, {
68
- ...rest,
69
- ...updates,
70
- })
71
- }
44
+ declare function updateEvent(event: Event, updates: any): CustomEvent;
45
+ type EventListener = {
46
+ /**
47
+ * - The DOM element to attach the event listener to
48
+ */
49
+ node: Element;
50
+ /**
51
+ * - The event type (e.g., 'click', 'keydown')
52
+ */
53
+ event: string;
54
+ /**
55
+ * - The event handler function
56
+ */
57
+ handler: EventListenerOrEventListenerObject;
58
+ };
59
+ type ListenerManager = {
60
+ /**
61
+ * - Array of current event listeners
62
+ */
63
+ list: EventListener[];
64
+ /**
65
+ * - Add a new event listener
66
+ */
67
+ add: (arg0: EventListener) => void;
68
+ /**
69
+ * - Remove an event listener
70
+ */
71
+ remove: (arg0: EventListener) => void;
72
+ /**
73
+ * - Remove all event listeners
74
+ */
75
+ clear: () => void;
76
+ };
77
+ type CustomEventOptions = {
78
+ /**
79
+ * - Whether the event bubbles up through the DOM
80
+ */
81
+ bubbles?: boolean;
82
+ /**
83
+ * - Whether the event can be canceled
84
+ */
85
+ cancelable?: boolean;
86
+ /**
87
+ * - Whether the event will trigger listeners outside of a shadow root
88
+ */
89
+ composed?: boolean;
90
+ };
91
+
92
+ export { type CustomEventOptions, type EventListener, type ListenerManager, addListeners, dispatchEvent, removeListeners, updateEvent };
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @typedef {Object} Focusables
3
+ * @property {number} length - Number of keyboard focusable elements
4
+ * @property {Array} all - All focusable elements that are visible and enabled
5
+ * @property {Array} keyboard - Elements that can be focused via keyboard (tabIndex > -1)
6
+ * @property {Array} keyboardOnly - Alias for keyboard focusable elements
7
+ * @property {HTMLElement|null} first - First keyboard focusable element
8
+ * @property {HTMLElement|null} last - Last keyboard focusable element
9
+ * @property {function(number): HTMLElement|null} next - Get next focusable element after the given index
10
+ * @property {function(number): HTMLElement|null} prev - Get previous focusable element before the given index
11
+ */
12
+ /**
13
+ * Gets all focusable elements within a container and provides methods to navigate between them.
14
+ * This is useful for implementing keyboard navigation, focus trapping, and accessibility features.
15
+ *
16
+ * @param {HTMLElement} [container=document.body] - The container element to search within. Only elements inside this container will be included.
17
+ * @returns {Focusables} Object containing focusable elements and navigation methods
18
+ * @example
19
+ * // Get focusable elements in a modal
20
+ * const modal = document.querySelector('.modal')
21
+ * const focusable = getFocusableElements(modal)
22
+ *
23
+ * // Get all focusable elements in document
24
+ * const allFocusable = getFocusableElements()
25
+ *
26
+ * // Focus the first element when modal opens
27
+ * focusable.first?.focus()
28
+ *
29
+ * // Handle tab key to trap focus
30
+ * modal.addEventListener('keydown', e => {
31
+ * if (e.key === 'Tab') {
32
+ * e.preventDefault()
33
+ * const currentIndex = focusable.keyboard.indexOf(document.activeElement)
34
+ * const nextElement = e.shiftKey
35
+ * ? focusable.prev(currentIndex)
36
+ * : focusable.next(currentIndex)
37
+ * nextElement?.focus()
38
+ * }
39
+ * })
40
+ */
41
+ declare function getFocusableElements(container?: HTMLElement): Focusables;
42
+ declare function Focusable(container?: HTMLElement): Focusables;
43
+ type Focusables = {
44
+ /**
45
+ * - Number of keyboard focusable elements
46
+ */
47
+ length: number;
48
+ /**
49
+ * - All focusable elements that are visible and enabled
50
+ */
51
+ all: any[];
52
+ /**
53
+ * - Elements that can be focused via keyboard (tabIndex > -1)
54
+ */
55
+ keyboard: any[];
56
+ /**
57
+ * - Alias for keyboard focusable elements
58
+ */
59
+ keyboardOnly: any[];
60
+ /**
61
+ * - First keyboard focusable element
62
+ */
63
+ first: HTMLElement | null;
64
+ /**
65
+ * - Last keyboard focusable element
66
+ */
67
+ last: HTMLElement | null;
68
+ /**
69
+ * - Get next focusable element after the given index
70
+ */
71
+ next: (arg0: number) => HTMLElement | null;
72
+ /**
73
+ * - Get previous focusable element before the given index
74
+ */
75
+ prev: (arg0: number) => HTMLElement | null;
76
+ };
77
+
78
+ export { Focusable, type Focusables, getFocusableElements };
@@ -0,0 +1,8 @@
1
+ declare function getUnit(value: any): any;
2
+ declare function rem(multiple?: number): number;
3
+ declare function em(element?: HTMLElement, multiple?: number): number;
4
+ declare function rlh(multiple?: number): number;
5
+ declare function lh(element?: HTMLElement, multiple?: number): number;
6
+ declare function toPx(value: any, element?: any): number;
7
+
8
+ export { em, getUnit, lh, rem, rlh, toPx };