@splendidlabz/utils 1.5.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (472) hide show
  1. package/CHANGELOG.md +13 -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 +206 -0
  49. package/dist/cjs/lib/date/months.cjs +102 -0
  50. package/dist/cjs/lib/date/time.cjs +115 -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 +1141 -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 +146 -0
  68. package/dist/cjs/lib/objects/flatten.cjs +48 -0
  69. package/dist/cjs/lib/objects/index.cjs +375 -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 +112 -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 +171 -0
  146. package/dist/esm/lib/date/months.js +78 -0
  147. package/dist/esm/lib/date/time.js +82 -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 +1023 -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 +120 -0
  165. package/dist/esm/lib/objects/flatten.js +22 -0
  166. package/dist/esm/lib/objects/index.js +321 -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 +87 -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/{lib/checks.js → dist/types/lib/checks.d.cts} +6 -11
  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 +4 -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} +5 -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 +29 -16
  294. package/{dom → src/dom}/cookie.js +8 -7
  295. package/{dom → src/dom}/index.js +1 -0
  296. package/{dom → src/dom}/random-string.js +1 -1
  297. package/src/dom/random-string.test.js +13 -0
  298. package/src/dom/spam-prevention.js +39 -0
  299. package/{dom → src/dom}/ui/aria-current.js +1 -1
  300. package/{lib → src/lib}/arrays/index.js +1 -0
  301. package/{lib → src/lib}/arrays/sort.js +6 -6
  302. package/src/lib/arrays/split-array.js +15 -0
  303. package/{lib → src/lib}/auth/route-manager.js +1 -0
  304. package/src/lib/checks.js +53 -0
  305. package/{lib → src/lib}/date/time.js +36 -5
  306. package/src/lib/hash.js +18 -0
  307. package/src/lib/hash.spec.js +163 -0
  308. package/{lib → src/lib}/index.js +1 -0
  309. package/{lib → src/lib}/objects/mix/mix.js +30 -11
  310. package/{lib → src/lib}/objects/mix/mix.test.js +57 -1
  311. package/{lib → src/lib}/objects/split.js +1 -1
  312. package/{lib → src/lib}/strings/index.js +1 -0
  313. package/src/lib/strings/name.js +24 -0
  314. package/src/lib/strings/name.test.js +67 -0
  315. package/src/lib/strings/pluralize.js +2 -0
  316. package/{lib → src/lib}/style/index.js +2 -0
  317. package/src/node/random-string.js +10 -0
  318. package/src/node/random-string.test.js +15 -0
  319. package/tsconfig.json +6 -6
  320. package/tsup.config.js +38 -0
  321. package/tsup.config.mjs +43 -0
  322. package/dist/dom/actions/index.d.ts +0 -3
  323. package/dist/dom/actions/masonry.d.ts +0 -3
  324. package/dist/dom/actions/prefer-horizontal-scroll.d.ts +0 -3
  325. package/dist/dom/actions/sticky.d.ts +0 -3
  326. package/dist/dom/cookie.d.ts +0 -11
  327. package/dist/dom/css-vars.d.ts +0 -4
  328. package/dist/dom/events.d.ts +0 -18
  329. package/dist/dom/font-size.d.ts +0 -5
  330. package/dist/dom/hash.d.ts +0 -1
  331. package/dist/dom/index.d.ts +0 -22
  332. package/dist/dom/media.d.ts +0 -3
  333. package/dist/dom/observers/index.d.ts +0 -3
  334. package/dist/dom/observers/observer.d.ts +0 -1
  335. package/dist/dom/ui/aria-current.d.ts +0 -5
  336. package/dist/dom/ui/index.d.ts +0 -4
  337. package/dist/dom/ui/scroll-container.d.ts +0 -1
  338. package/dist/lib/arrays/index.d.ts +0 -5
  339. package/dist/lib/arrays/shuffle.d.ts +0 -1
  340. package/dist/lib/arrays/unique.d.ts +0 -1
  341. package/dist/lib/auth/index.d.ts +0 -1
  342. package/dist/lib/checks.d.ts +0 -29
  343. package/dist/lib/date/index.d.ts +0 -3
  344. package/dist/lib/date/time.d.ts +0 -8
  345. package/dist/lib/form/form-data.d.ts +0 -7
  346. package/dist/lib/form/index.d.ts +0 -2
  347. package/dist/lib/functions/debounce.d.ts +0 -1
  348. package/dist/lib/functions/env.d.ts +0 -1
  349. package/dist/lib/functions/functional.d.ts +0 -4
  350. package/dist/lib/functions/index.d.ts +0 -5
  351. package/dist/lib/functions/throttle.d.ts +0 -1
  352. package/dist/lib/functions/timeout.d.ts +0 -3
  353. package/dist/lib/index.d.ts +0 -13
  354. package/dist/lib/numbers/index.d.ts +0 -2
  355. package/dist/lib/numbers/math.d.ts +0 -2
  356. package/dist/lib/objects/camelcase-keys.d.ts +0 -1
  357. package/dist/lib/objects/empty.d.ts +0 -2
  358. package/dist/lib/objects/equal.d.ts +0 -2
  359. package/dist/lib/objects/extend.d.ts +0 -4
  360. package/dist/lib/objects/flatten.d.ts +0 -4
  361. package/dist/lib/objects/index.d.ts +0 -13
  362. package/dist/lib/objects/json.d.ts +0 -1
  363. package/dist/lib/objects/loop.d.ts +0 -2
  364. package/dist/lib/objects/mix/mix.d.ts +0 -1
  365. package/dist/lib/objects/normalize-object.d.ts +0 -1
  366. package/dist/lib/objects/omit-empty.d.ts +0 -1
  367. package/dist/lib/objects/size.d.ts +0 -1
  368. package/dist/lib/promises/index.d.ts +0 -1
  369. package/dist/lib/promises/reject.d.ts +0 -3
  370. package/dist/lib/strings/convert-case/convert-case.d.ts +0 -8
  371. package/dist/lib/strings/index.d.ts +0 -4
  372. package/dist/lib/strings/pluralize.d.ts +0 -1
  373. package/dist/lib/strings/query-string.d.ts +0 -8
  374. package/dist/lib/style/index.d.ts +0 -1
  375. package/dist/lib/symbols/index.d.ts +0 -1
  376. package/dist/lib/symbols/symbols.d.ts +0 -2
  377. package/dist/node/common.d.ts +0 -1
  378. package/dist/node/dirname.d.ts +0 -7
  379. package/dist/node/file.d.ts +0 -2
  380. package/dist/node/hash.d.ts +0 -1
  381. package/dist/node/index.d.ts +0 -7
  382. package/dist/node/random-string.d.ts +0 -2
  383. package/lib/strings/pluralize.js +0 -2
  384. package/node/random-string.js +0 -10
  385. /package/{dom → src/dom}/accessibility.js +0 -0
  386. /package/{dom → src/dom}/actions/index.js +0 -0
  387. /package/{dom → src/dom}/actions/masonry.js +0 -0
  388. /package/{dom → src/dom}/actions/prefer-horizontal-scroll.js +0 -0
  389. /package/{dom → src/dom}/actions/sticky.js +0 -0
  390. /package/{dom → src/dom}/bounding-box.js +0 -0
  391. /package/{dom → src/dom}/clipboard.js +0 -0
  392. /package/{dom → src/dom}/css-vars.js +0 -0
  393. /package/{dom → src/dom}/events.js +0 -0
  394. /package/{dom → src/dom}/events.test.js +0 -0
  395. /package/{dom → src/dom}/focusable.js +0 -0
  396. /package/{dom → src/dom}/font-size.js +0 -0
  397. /package/{dom → src/dom}/get-element.js +0 -0
  398. /package/{dom → src/dom}/hash.js +0 -0
  399. /package/{dom → src/dom}/keyboard.js +0 -0
  400. /package/{dom → src/dom}/local-store.js +0 -0
  401. /package/{dom → src/dom}/media.js +0 -0
  402. /package/{dom → src/dom}/observers/index.js +0 -0
  403. /package/{dom → src/dom}/observers/intersection-observer.js +0 -0
  404. /package/{dom → src/dom}/observers/mutation-observer.js +0 -0
  405. /package/{dom → src/dom}/observers/observer.js +0 -0
  406. /package/{dom → src/dom}/observers/resize-observer.js +0 -0
  407. /package/{dom → src/dom}/pkce.js +0 -0
  408. /package/{dom → src/dom}/query-params.js +0 -0
  409. /package/{dom → src/dom}/sanitize.js +0 -0
  410. /package/{dom → src/dom}/session-store.js +0 -0
  411. /package/{dom → src/dom}/trap-focus.js +0 -0
  412. /package/{dom → src/dom}/ui/inconsistent-button-fix.js +0 -0
  413. /package/{dom → src/dom}/ui/index.js +0 -0
  414. /package/{dom → src/dom}/ui/scroll-container.js +0 -0
  415. /package/{dom → src/dom}/ui/traverse-and-scramble.js +0 -0
  416. /package/{lib → src/lib}/arrays/item-position.js +0 -0
  417. /package/{lib → src/lib}/arrays/join.js +0 -0
  418. /package/{lib → src/lib}/arrays/shuffle.js +0 -0
  419. /package/{lib → src/lib}/arrays/sort.spec.js +0 -0
  420. /package/{lib → src/lib}/arrays/unique.js +0 -0
  421. /package/{lib → src/lib}/auth/index.js +0 -0
  422. /package/{lib → src/lib}/date/days.js +0 -0
  423. /package/{lib → src/lib}/date/index.js +0 -0
  424. /package/{lib → src/lib}/date/months.js +0 -0
  425. /package/{lib → src/lib}/form/form-data.js +0 -0
  426. /package/{lib → src/lib}/form/index.js +0 -0
  427. /package/{lib → src/lib}/form/sanitize.js +0 -0
  428. /package/{lib → src/lib}/form/sanitize.spec.js +0 -0
  429. /package/{lib → src/lib}/functions/debounce.js +0 -0
  430. /package/{lib → src/lib}/functions/env.js +0 -0
  431. /package/{lib → src/lib}/functions/functional.js +0 -0
  432. /package/{lib → src/lib}/functions/index.js +0 -0
  433. /package/{lib → src/lib}/functions/throttle.js +0 -0
  434. /package/{lib → src/lib}/functions/timeout.js +0 -0
  435. /package/{lib → src/lib}/numbers/index.js +0 -0
  436. /package/{lib → src/lib}/numbers/math.js +0 -0
  437. /package/{lib → src/lib}/objects/camelcase-keys.js +0 -0
  438. /package/{lib → src/lib}/objects/camelcase-keys.test.js +0 -0
  439. /package/{lib → src/lib}/objects/empty.js +0 -0
  440. /package/{lib → src/lib}/objects/equal.js +0 -0
  441. /package/{lib → src/lib}/objects/extend.js +0 -0
  442. /package/{lib → src/lib}/objects/extend.test.js +0 -0
  443. /package/{lib → src/lib}/objects/flatten.js +0 -0
  444. /package/{lib → src/lib}/objects/index.js +0 -0
  445. /package/{lib → src/lib}/objects/json.js +0 -0
  446. /package/{lib → src/lib}/objects/loop.js +0 -0
  447. /package/{lib → src/lib}/objects/loop.test.js +0 -0
  448. /package/{lib → src/lib}/objects/mix/mix.md +0 -0
  449. /package/{lib → src/lib}/objects/nested-property.js +0 -0
  450. /package/{lib → src/lib}/objects/normalize-object.js +0 -0
  451. /package/{lib → src/lib}/objects/omit-empty.js +0 -0
  452. /package/{lib → src/lib}/objects/omit-empty.test.js +0 -0
  453. /package/{lib → src/lib}/objects/size.js +0 -0
  454. /package/{lib → src/lib}/promises/index.js +0 -0
  455. /package/{lib → src/lib}/promises/reject.js +0 -0
  456. /package/{lib → src/lib}/sse.js +0 -0
  457. /package/{lib → src/lib}/strings/convert-case/convert-case.js +0 -0
  458. /package/{lib → src/lib}/strings/convert-case/convert-case.md +0 -0
  459. /package/{lib → src/lib}/strings/convert-case/convert-case.test.js +0 -0
  460. /package/{lib → src/lib}/strings/markdown.js +0 -0
  461. /package/{lib → src/lib}/strings/query-string.js +0 -0
  462. /package/{lib → src/lib}/symbols/index.js +0 -0
  463. /package/{lib → src/lib}/symbols/symbols.js +0 -0
  464. /package/{node → src/node}/common.js +0 -0
  465. /package/{node → src/node}/dirname.js +0 -0
  466. /package/{node → src/node}/file-cache.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}/sanitize.js +0 -0
  472. /package/{node → src/node}/sanitize.spec.js +0 -0
@@ -0,0 +1,14 @@
1
+ // src/node/dirname.js
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ function __dirname(url) {
5
+ if (!url) throw Error("Please provide 'import.meta.url' to dirname");
6
+ return path.dirname(fileURLToPath(url));
7
+ }
8
+ function dirname(url) {
9
+ return __dirname(url);
10
+ }
11
+ export {
12
+ __dirname,
13
+ dirname
14
+ };
@@ -0,0 +1,158 @@
1
+ // src/node/file-cache.js
2
+ import fs from "fs/promises";
3
+ import glob from "glob-promise";
4
+ import path from "path";
5
+
6
+ // src/lib/objects/nested-property.js
7
+ function getNestedValue(object, path2) {
8
+ return path2.split(".").reduce((acc, part) => acc?.[part], object);
9
+ }
10
+
11
+ // src/lib/arrays/sort.js
12
+ function sort(array, { props = null, reverse = false } = {}) {
13
+ const clone = array.slice();
14
+ if (props === null) {
15
+ return clone.sort((a, b) => {
16
+ const comparison = compareValues(a, b);
17
+ return reverse ? -comparison : comparison;
18
+ });
19
+ }
20
+ const properties = Array.isArray(props) ? props : [props];
21
+ return clone.sort((a, b) => {
22
+ for (const property of properties) {
23
+ const aValue = getNestedValue(a, property);
24
+ const bValue = getNestedValue(b, property);
25
+ if (aValue === bValue) continue;
26
+ if (aValue == null) return 1;
27
+ if (bValue == null) return -1;
28
+ const comparison = compareValues(aValue, bValue);
29
+ return reverse ? -comparison : comparison;
30
+ }
31
+ return 0;
32
+ });
33
+ }
34
+ function compareValues(a, b) {
35
+ if (typeof a === "number" && typeof b === "number") return a - b;
36
+ if (typeof a === "string" && typeof b === "string") return a.localeCompare(b);
37
+ const aDate = new Date(a);
38
+ const bDate = new Date(b);
39
+ const aTime = aDate.getTime();
40
+ const bTime = bDate.getTime();
41
+ if (!isNaN(aTime) && !isNaN(bTime)) return aTime - bTime;
42
+ return String(a).localeCompare(String(b));
43
+ }
44
+
45
+ // src/node/file-cache.js
46
+ async function createCache(dir) {
47
+ const absDirpath = path.join(process.cwd(), dir);
48
+ await fs.mkdir(absDirpath, { recursive: true });
49
+ return {
50
+ async cacheAt(file) {
51
+ if (file) {
52
+ const absFilepath = path.join(absDirpath, file);
53
+ try {
54
+ const stat = await fs.stat(absFilepath);
55
+ return stat.mtimeMs;
56
+ } catch (error) {
57
+ return 0;
58
+ }
59
+ } else {
60
+ return getLastModifiedTime(dir + "/**/*");
61
+ }
62
+ },
63
+ getAbsPath(file) {
64
+ return path.join(absDirpath, file);
65
+ },
66
+ async hasFile(file) {
67
+ const absFilepath = path.join(absDirpath, file);
68
+ try {
69
+ await fs.stat(absFilepath);
70
+ return true;
71
+ } catch (e) {
72
+ return false;
73
+ }
74
+ },
75
+ async loadFile(file) {
76
+ try {
77
+ const absFilepath = path.join(absDirpath, file);
78
+ return fs.readFile(absFilepath);
79
+ } catch (error) {
80
+ console.warn(`File not found: ${file}`);
81
+ }
82
+ },
83
+ async saveFile(file, data) {
84
+ const absfilepath = path.join(absDirpath, file);
85
+ await fs.writeFile(absfilepath, data);
86
+ },
87
+ async loadJSON(file) {
88
+ const data = await this.loadFile(file);
89
+ try {
90
+ return JSON.parse(data.toString());
91
+ } catch (err) {
92
+ console.warn(`Error parsing JSON: ${file}`);
93
+ return {};
94
+ }
95
+ },
96
+ async saveJSON(file, data) {
97
+ await this.saveFile(file, JSON.stringify(data));
98
+ }
99
+ };
100
+ }
101
+ async function fileCache({ dir, file }) {
102
+ await fs.mkdir(path.join(process.cwd(), dir), { recursive: true });
103
+ const cachePath = path.join(process.cwd(), dir, `${file}`);
104
+ let modifiedAt = 0;
105
+ try {
106
+ const stat = await fs.stat(cachePath);
107
+ modifiedAt = stat.mtimeMs;
108
+ } catch (error) {
109
+ }
110
+ return {
111
+ modifiedAt,
112
+ async load() {
113
+ return fs.readFile(cachePath);
114
+ },
115
+ async save(data) {
116
+ await fs.writeFile(cachePath, data);
117
+ },
118
+ async loadJSON() {
119
+ const data = await fs.readFile(cachePath);
120
+ return JSON.parse(data.toString());
121
+ },
122
+ async saveJSON(data) {
123
+ await fs.writeFile(cachePath, JSON.stringify(data));
124
+ }
125
+ };
126
+ }
127
+ async function getLastModifiedTime(globPath) {
128
+ let files;
129
+ if (typeof globPath === "string") {
130
+ files = await glob(removeFirstSlash(globPath));
131
+ }
132
+ if (Array.isArray(globPath)) {
133
+ const a = await Promise.all(
134
+ globPath.map((path2) => glob(removeFirstSlash(path2)))
135
+ );
136
+ files = a.flat();
137
+ }
138
+ const stats = await Promise.all(files.map((file) => fs.stat(file)));
139
+ const timestamps = stats.map((stat) => Number(stat.mtimeMs));
140
+ const sorted = sort(timestamps, { props: "mtimeMs", reverse: true });
141
+ return sorted[0] || 0;
142
+ }
143
+ async function getLatestModifiedTime(globPath) {
144
+ console.warn(
145
+ "`getLatestModifiedTime` has been renamed to `getLastModifiedTime` and will be deprecated in future versions. Please use `getLastModifiedTime` instead."
146
+ );
147
+ return getLastModifiedTime(globPath);
148
+ }
149
+ function removeFirstSlash(x) {
150
+ return x.startsWith("/") ? x.slice(1) : x;
151
+ }
152
+ export {
153
+ createCache,
154
+ fileCache,
155
+ getLastModifiedTime,
156
+ getLatestModifiedTime,
157
+ removeFirstSlash
158
+ };
@@ -0,0 +1,15 @@
1
+ // src/node/file.js
2
+ import fs from "fs/promises";
3
+ import path from "path";
4
+ async function mkdir(path2) {
5
+ return fs.mkdir(path2, { recursive: true });
6
+ }
7
+ async function copyFile(from, to) {
8
+ const dir = path.dirname(to);
9
+ await mkdir(dir);
10
+ await fs.copyFile(from, to);
11
+ }
12
+ export {
13
+ copyFile,
14
+ mkdir
15
+ };
@@ -0,0 +1,8 @@
1
+ // src/node/hash.js
2
+ import crypto from "crypto";
3
+ function sha256Hash(string) {
4
+ return crypto.createHash("sha256").update(string).digest("hex");
5
+ }
6
+ export {
7
+ sha256Hash
8
+ };
@@ -0,0 +1,243 @@
1
+ // src/node/common.js
2
+ import crypto from "crypto";
3
+ function uuid() {
4
+ return crypto.randomUUID();
5
+ }
6
+
7
+ // src/node/dirname.js
8
+ import path from "path";
9
+ import { fileURLToPath } from "url";
10
+ function __dirname(url) {
11
+ if (!url) throw Error("Please provide 'import.meta.url' to dirname");
12
+ return path.dirname(fileURLToPath(url));
13
+ }
14
+ function dirname(url) {
15
+ return __dirname(url);
16
+ }
17
+
18
+ // src/node/file-cache.js
19
+ import fs from "fs/promises";
20
+ import glob from "glob-promise";
21
+ import path2 from "path";
22
+
23
+ // src/lib/objects/nested-property.js
24
+ function getNestedValue(object, path3) {
25
+ return path3.split(".").reduce((acc, part) => acc?.[part], object);
26
+ }
27
+
28
+ // src/lib/arrays/sort.js
29
+ function sort(array, { props = null, reverse = false } = {}) {
30
+ const clone = array.slice();
31
+ if (props === null) {
32
+ return clone.sort((a, b) => {
33
+ const comparison = compareValues(a, b);
34
+ return reverse ? -comparison : comparison;
35
+ });
36
+ }
37
+ const properties = Array.isArray(props) ? props : [props];
38
+ return clone.sort((a, b) => {
39
+ for (const property of properties) {
40
+ const aValue = getNestedValue(a, property);
41
+ const bValue = getNestedValue(b, property);
42
+ if (aValue === bValue) continue;
43
+ if (aValue == null) return 1;
44
+ if (bValue == null) return -1;
45
+ const comparison = compareValues(aValue, bValue);
46
+ return reverse ? -comparison : comparison;
47
+ }
48
+ return 0;
49
+ });
50
+ }
51
+ function compareValues(a, b) {
52
+ if (typeof a === "number" && typeof b === "number") return a - b;
53
+ if (typeof a === "string" && typeof b === "string") return a.localeCompare(b);
54
+ const aDate = new Date(a);
55
+ const bDate = new Date(b);
56
+ const aTime = aDate.getTime();
57
+ const bTime = bDate.getTime();
58
+ if (!isNaN(aTime) && !isNaN(bTime)) return aTime - bTime;
59
+ return String(a).localeCompare(String(b));
60
+ }
61
+
62
+ // src/node/file-cache.js
63
+ async function createCache(dir) {
64
+ const absDirpath = path2.join(process.cwd(), dir);
65
+ await fs.mkdir(absDirpath, { recursive: true });
66
+ return {
67
+ async cacheAt(file) {
68
+ if (file) {
69
+ const absFilepath = path2.join(absDirpath, file);
70
+ try {
71
+ const stat = await fs.stat(absFilepath);
72
+ return stat.mtimeMs;
73
+ } catch (error) {
74
+ return 0;
75
+ }
76
+ } else {
77
+ return getLastModifiedTime(dir + "/**/*");
78
+ }
79
+ },
80
+ getAbsPath(file) {
81
+ return path2.join(absDirpath, file);
82
+ },
83
+ async hasFile(file) {
84
+ const absFilepath = path2.join(absDirpath, file);
85
+ try {
86
+ await fs.stat(absFilepath);
87
+ return true;
88
+ } catch (e) {
89
+ return false;
90
+ }
91
+ },
92
+ async loadFile(file) {
93
+ try {
94
+ const absFilepath = path2.join(absDirpath, file);
95
+ return fs.readFile(absFilepath);
96
+ } catch (error) {
97
+ console.warn(`File not found: ${file}`);
98
+ }
99
+ },
100
+ async saveFile(file, data) {
101
+ const absfilepath = path2.join(absDirpath, file);
102
+ await fs.writeFile(absfilepath, data);
103
+ },
104
+ async loadJSON(file) {
105
+ const data = await this.loadFile(file);
106
+ try {
107
+ return JSON.parse(data.toString());
108
+ } catch (err) {
109
+ console.warn(`Error parsing JSON: ${file}`);
110
+ return {};
111
+ }
112
+ },
113
+ async saveJSON(file, data) {
114
+ await this.saveFile(file, JSON.stringify(data));
115
+ }
116
+ };
117
+ }
118
+ async function fileCache({ dir, file }) {
119
+ await fs.mkdir(path2.join(process.cwd(), dir), { recursive: true });
120
+ const cachePath = path2.join(process.cwd(), dir, `${file}`);
121
+ let modifiedAt = 0;
122
+ try {
123
+ const stat = await fs.stat(cachePath);
124
+ modifiedAt = stat.mtimeMs;
125
+ } catch (error) {
126
+ }
127
+ return {
128
+ modifiedAt,
129
+ async load() {
130
+ return fs.readFile(cachePath);
131
+ },
132
+ async save(data) {
133
+ await fs.writeFile(cachePath, data);
134
+ },
135
+ async loadJSON() {
136
+ const data = await fs.readFile(cachePath);
137
+ return JSON.parse(data.toString());
138
+ },
139
+ async saveJSON(data) {
140
+ await fs.writeFile(cachePath, JSON.stringify(data));
141
+ }
142
+ };
143
+ }
144
+ async function getLastModifiedTime(globPath) {
145
+ let files;
146
+ if (typeof globPath === "string") {
147
+ files = await glob(removeFirstSlash(globPath));
148
+ }
149
+ if (Array.isArray(globPath)) {
150
+ const a = await Promise.all(
151
+ globPath.map((path3) => glob(removeFirstSlash(path3)))
152
+ );
153
+ files = a.flat();
154
+ }
155
+ const stats = await Promise.all(files.map((file) => fs.stat(file)));
156
+ const timestamps = stats.map((stat) => Number(stat.mtimeMs));
157
+ const sorted = sort(timestamps, { props: "mtimeMs", reverse: true });
158
+ return sorted[0] || 0;
159
+ }
160
+ async function getLatestModifiedTime(globPath) {
161
+ console.warn(
162
+ "`getLatestModifiedTime` has been renamed to `getLastModifiedTime` and will be deprecated in future versions. Please use `getLastModifiedTime` instead."
163
+ );
164
+ return getLastModifiedTime(globPath);
165
+ }
166
+ function removeFirstSlash(x) {
167
+ return x.startsWith("/") ? x.slice(1) : x;
168
+ }
169
+
170
+ // src/node/hash.js
171
+ import crypto2 from "crypto";
172
+ function sha256Hash(string) {
173
+ return crypto2.createHash("sha256").update(string).digest("hex");
174
+ }
175
+
176
+ // src/node/pkce.js
177
+ import crypto4 from "crypto";
178
+
179
+ // src/node/random-string.js
180
+ import crypto3 from "crypto";
181
+ function randomString(length = 32) {
182
+ const bytesNeeded = Math.ceil(length * 3 / 4) + 3;
183
+ return crypto3.randomBytes(bytesNeeded).toString("base64").slice(0, length);
184
+ }
185
+
186
+ // src/node/pkce.js
187
+ async function PKCE() {
188
+ const codeVerifier = await randomString();
189
+ const codeChallenge = await getCodeChallenge(codeVerifier);
190
+ return {
191
+ state: await randomString(),
192
+ code_verifier: codeVerifier,
193
+ code_challenge: codeChallenge,
194
+ code_challenge_method: "S256"
195
+ };
196
+ }
197
+ async function getCodeChallenge(verifier) {
198
+ const hash = crypto4.createHash("sha256").update(verifier).digest();
199
+ return hash.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
200
+ }
201
+
202
+ // src/node/sanitize.js
203
+ import sanitizeHtml from "sanitize-html";
204
+
205
+ // src/lib/form/sanitize.js
206
+ function sanitize(value, options = {}) {
207
+ const { sanitizer, ...rest } = options;
208
+ if (!sanitizer) throw new Error("sanitizer function is required");
209
+ if (typeof value === "string") return sanitizer(value, rest);
210
+ if (Array.isArray(value)) return sanitizeArray(value, { sanitizer, ...rest });
211
+ if (value && typeof value === "object") {
212
+ return Object.fromEntries(
213
+ Object.entries(value).map(([key, val]) => [
214
+ key,
215
+ sanitize(val, { sanitizer, ...rest })
216
+ ])
217
+ );
218
+ }
219
+ return value;
220
+ }
221
+ function sanitizeArray(arr, { sanitizer, ...rest }) {
222
+ if (!sanitizer) throw new Error("sanitizer function is required");
223
+ return arr.map((item) => sanitize(item, { sanitizer, ...rest }));
224
+ }
225
+
226
+ // src/node/sanitize.js
227
+ function sanitize2(value, options = {}) {
228
+ return sanitize(value, { sanitizer: sanitizeHtml, ...options });
229
+ }
230
+ export {
231
+ PKCE,
232
+ __dirname,
233
+ createCache,
234
+ dirname,
235
+ fileCache,
236
+ getLastModifiedTime,
237
+ getLatestModifiedTime,
238
+ randomString,
239
+ removeFirstSlash,
240
+ sanitize2 as sanitize,
241
+ sha256Hash,
242
+ uuid
243
+ };
@@ -0,0 +1,28 @@
1
+ // src/node/pkce.js
2
+ import crypto2 from "crypto";
3
+
4
+ // src/node/random-string.js
5
+ import crypto from "crypto";
6
+ function randomString(length = 32) {
7
+ const bytesNeeded = Math.ceil(length * 3 / 4) + 3;
8
+ return crypto.randomBytes(bytesNeeded).toString("base64").slice(0, length);
9
+ }
10
+
11
+ // src/node/pkce.js
12
+ async function PKCE() {
13
+ const codeVerifier = await randomString();
14
+ const codeChallenge = await getCodeChallenge(codeVerifier);
15
+ return {
16
+ state: await randomString(),
17
+ code_verifier: codeVerifier,
18
+ code_challenge: codeChallenge,
19
+ code_challenge_method: "S256"
20
+ };
21
+ }
22
+ async function getCodeChallenge(verifier) {
23
+ const hash = crypto2.createHash("sha256").update(verifier).digest();
24
+ return hash.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
25
+ }
26
+ export {
27
+ PKCE
28
+ };
@@ -0,0 +1,9 @@
1
+ // src/node/random-string.js
2
+ import crypto from "crypto";
3
+ function randomString(length = 32) {
4
+ const bytesNeeded = Math.ceil(length * 3 / 4) + 3;
5
+ return crypto.randomBytes(bytesNeeded).toString("base64").slice(0, length);
6
+ }
7
+ export {
8
+ randomString
9
+ };
@@ -0,0 +1,31 @@
1
+ // src/node/sanitize.js
2
+ import sanitizeHtml from "sanitize-html";
3
+
4
+ // src/lib/form/sanitize.js
5
+ function sanitize(value, options = {}) {
6
+ const { sanitizer, ...rest } = options;
7
+ if (!sanitizer) throw new Error("sanitizer function is required");
8
+ if (typeof value === "string") return sanitizer(value, rest);
9
+ if (Array.isArray(value)) return sanitizeArray(value, { sanitizer, ...rest });
10
+ if (value && typeof value === "object") {
11
+ return Object.fromEntries(
12
+ Object.entries(value).map(([key, val]) => [
13
+ key,
14
+ sanitize(val, { sanitizer, ...rest })
15
+ ])
16
+ );
17
+ }
18
+ return value;
19
+ }
20
+ function sanitizeArray(arr, { sanitizer, ...rest }) {
21
+ if (!sanitizer) throw new Error("sanitizer function is required");
22
+ return arr.map((item) => sanitize(item, { sanitizer, ...rest }));
23
+ }
24
+
25
+ // src/node/sanitize.js
26
+ function sanitize2(value, options = {}) {
27
+ return sanitize(value, { sanitizer: sanitizeHtml, ...options });
28
+ }
29
+ export {
30
+ sanitize2 as sanitize
31
+ };
@@ -4,7 +4,7 @@
4
4
  * @param {string} [labelledBy] - The aria-labelledby value
5
5
  * @returns {boolean} True if the element has an accessible name
6
6
  */
7
- export function hasAccessibleName(label?: string, labelledBy?: string): boolean;
7
+ declare function hasAccessibleName(label?: string, labelledBy?: string): boolean;
8
8
  /**
9
9
  * Checks if an element has an accessible name and logs a warning/error if it doesn't
10
10
  * @param {Object} [options] - Options for checking accessible name
@@ -14,7 +14,7 @@ export function hasAccessibleName(label?: string, labelledBy?: string): boolean;
14
14
  * @param {'warn'|'error'} [options.severity='warn'] - Severity level for the message
15
15
  * @returns {boolean} True if the element has an accessible name
16
16
  */
17
- export function checkForAccessibleName({ name, ariaLabel, ariaLabelledBy, severity, }?: {
17
+ declare function checkForAccessibleName({ name, ariaLabel, ariaLabelledBy, severity, }?: {
18
18
  name?: string;
19
19
  ariaLabel?: string;
20
20
  ariaLabelledBy?: string;
@@ -25,4 +25,6 @@ export function checkForAccessibleName({ name, ariaLabel, ariaLabelledBy, severi
25
25
  * @param {string} value - The ARIA popup value to check
26
26
  * @returns {boolean} True if the value is invalid
27
27
  */
28
- export function isInvalidAriaPopup(value: string): boolean;
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,7 +15,7 @@
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: HTMLElement, { containsPadding }?: {
18
+ declare function boundingBox(element: HTMLElement, { containsPadding }?: {
19
19
  containsPadding?: boolean;
20
20
  }): any;
21
21
  /**
@@ -33,7 +33,9 @@ export function boundingBox(element: HTMLElement, { containsPadding }?: {
33
33
  * @property {number} xCenter - The horizontal center coordinate relative to ancestor
34
34
  * @property {number} yCenter - The vertical center coordinate relative to ancestor
35
35
  */
36
- export function boundingBoxRelativeToAncestor({ element, ancestorElement }: {
36
+ declare function boundingBoxRelativeToAncestor({ element, ancestorElement }: {
37
37
  element: HTMLElement;
38
38
  ancestorElement?: HTMLElement;
39
39
  }): any;
40
+
41
+ export { boundingBox, boundingBoxRelativeToAncestor };
@@ -2,4 +2,6 @@
2
2
  * Copies rich text from an element to the clipboard
3
3
  * @param HTMLElement element - Element to copy
4
4
  */
5
- export function copyRichText(element: any): void;
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 };
@@ -0,0 +1,20 @@
1
+ declare function addListeners(listeners: any): void;
2
+ declare function removeListeners(listeners: any): void;
3
+ declare function dispatchEvent(node: any, eventName: any, detail: any, options?: {}): void;
4
+ declare function updateEvent(event: any, updates: any): CustomEvent<any>;
5
+ declare function createListeners(listeners: any): {
6
+ readonly list: any;
7
+ add({ node, event, handler }: {
8
+ node: any;
9
+ event: any;
10
+ handler: any;
11
+ }): void;
12
+ remove({ node, event, handler }: {
13
+ node: any;
14
+ event: any;
15
+ handler: any;
16
+ }): void;
17
+ clear(): void;
18
+ };
19
+
20
+ export { addListeners, createListeners, dispatchEvent, removeListeners, updateEvent };
@@ -38,9 +38,9 @@
38
38
  * }
39
39
  * })
40
40
  */
41
- export function getFocusableElements(container?: HTMLElement): Focusables;
42
- export function Focusable(container?: HTMLElement): Focusables;
43
- export type Focusables = {
41
+ declare function getFocusableElements(container?: HTMLElement): Focusables;
42
+ declare function Focusable(container?: HTMLElement): Focusables;
43
+ type Focusables = {
44
44
  /**
45
45
  * - Number of keyboard focusable elements
46
46
  */
@@ -74,3 +74,5 @@ export type Focusables = {
74
74
  */
75
75
  prev: (arg0: number) => HTMLElement | null;
76
76
  };
77
+
78
+ export { Focusable, type Focusables, getFocusableElements };
@@ -0,0 +1,7 @@
1
+ declare function getUnit(value: any): any;
2
+ declare function em(element?: HTMLElement, multiple?: number): number;
3
+ declare function rem(multiple?: number): number;
4
+ declare function lh(element?: HTMLElement, multiple?: number): number;
5
+ declare function toPx(value: any, element?: any): number;
6
+
7
+ export { em, getUnit, lh, rem, toPx };