@splendidlabz/utils 1.11.1 → 1.11.3

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 (306) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +2 -2
  3. package/src/dom/actions/masonry.js +1 -0
  4. package/src/lib/objects/omit-empty.js +1 -1
  5. package/src/lib/strings/markdown.spec.js +73 -0
  6. package/src/node/context.js +0 -0
  7. package/src/node/file-cache.js +1 -1
  8. package/src/node/pkce.js +1 -1
  9. package/tsup.config.mjs +19 -1
  10. package/dist/cjs/dom/accessibility.cjs +0 -51
  11. package/dist/cjs/dom/actions/index.cjs +0 -25
  12. package/dist/cjs/dom/actions/masonry.cjs +0 -60
  13. package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +0 -113
  14. package/dist/cjs/dom/actions/sticky.cjs +0 -93
  15. package/dist/cjs/dom/bounding-box.cjs +0 -68
  16. package/dist/cjs/dom/clipboard.cjs +0 -35
  17. package/dist/cjs/dom/cookie.cjs +0 -55
  18. package/dist/cjs/dom/css-vars.cjs +0 -47
  19. package/dist/cjs/dom/events.cjs +0 -57
  20. package/dist/cjs/dom/focusable.cjs +0 -141
  21. package/dist/cjs/dom/font-size.cjs +0 -68
  22. package/dist/cjs/dom/get-element.cjs +0 -96
  23. package/dist/cjs/dom/hash.cjs +0 -33
  24. package/dist/cjs/dom/index.cjs +0 -65
  25. package/dist/cjs/dom/keyboard.cjs +0 -49
  26. package/dist/cjs/dom/local-store.cjs +0 -77
  27. package/dist/cjs/dom/media.cjs +0 -57
  28. package/dist/cjs/dom/observers/index.cjs +0 -27
  29. package/dist/cjs/dom/observers/intersection-observer.cjs +0 -59
  30. package/dist/cjs/dom/observers/mutation-observer.cjs +0 -63
  31. package/dist/cjs/dom/observers/observer.cjs +0 -38
  32. package/dist/cjs/dom/observers/resize-observer.cjs +0 -52
  33. package/dist/cjs/dom/observers/scroll-observer.cjs +0 -118
  34. package/dist/cjs/dom/pkce.cjs +0 -43
  35. package/dist/cjs/dom/query-params.cjs +0 -36
  36. package/dist/cjs/dom/random-string.cjs +0 -36
  37. package/dist/cjs/dom/sanitize.cjs +0 -41
  38. package/dist/cjs/dom/session-store.cjs +0 -47
  39. package/dist/cjs/dom/spam-prevention.cjs +0 -48
  40. package/dist/cjs/dom/trap-focus.cjs +0 -75
  41. package/dist/cjs/dom/ui/aria-current.cjs +0 -41
  42. package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +0 -33
  43. package/dist/cjs/dom/ui/index.cjs +0 -27
  44. package/dist/cjs/dom/ui/scroll-container.cjs +0 -45
  45. package/dist/cjs/dom/ui/traverse-and-scramble.cjs +0 -48
  46. package/dist/cjs/lib/arrays/index.cjs +0 -31
  47. package/dist/cjs/lib/arrays/item-position.cjs +0 -40
  48. package/dist/cjs/lib/arrays/join.cjs +0 -35
  49. package/dist/cjs/lib/arrays/shuffle.cjs +0 -40
  50. package/dist/cjs/lib/arrays/sort.cjs +0 -59
  51. package/dist/cjs/lib/arrays/split-array.cjs +0 -39
  52. package/dist/cjs/lib/arrays/unique.cjs +0 -29
  53. package/dist/cjs/lib/auth/index.cjs +0 -21
  54. package/dist/cjs/lib/auth/route-manager.cjs +0 -49
  55. package/dist/cjs/lib/checks.cjs +0 -61
  56. package/dist/cjs/lib/date/days.cjs +0 -35
  57. package/dist/cjs/lib/date/index.cjs +0 -25
  58. package/dist/cjs/lib/date/months.cjs +0 -100
  59. package/dist/cjs/lib/date/time.cjs +0 -105
  60. package/dist/cjs/lib/form/form-data.cjs +0 -81
  61. package/dist/cjs/lib/form/index.cjs +0 -23
  62. package/dist/cjs/lib/form/sanitize.cjs +0 -59
  63. package/dist/cjs/lib/functions/callback.cjs +0 -29
  64. package/dist/cjs/lib/functions/debounce.cjs +0 -41
  65. package/dist/cjs/lib/functions/env.cjs +0 -30
  66. package/dist/cjs/lib/functions/functional.cjs +0 -80
  67. package/dist/cjs/lib/functions/index.cjs +0 -29
  68. package/dist/cjs/lib/functions/throttle.cjs +0 -36
  69. package/dist/cjs/lib/functions/timeout.cjs +0 -39
  70. package/dist/cjs/lib/hash.cjs +0 -41
  71. package/dist/cjs/lib/index.cjs +0 -47
  72. package/dist/cjs/lib/numbers/index.cjs +0 -36
  73. package/dist/cjs/lib/numbers/math.cjs +0 -34
  74. package/dist/cjs/lib/objects/camelcase-keys.cjs +0 -39
  75. package/dist/cjs/lib/objects/empty.cjs +0 -37
  76. package/dist/cjs/lib/objects/equal.cjs +0 -45
  77. package/dist/cjs/lib/objects/extend.cjs +0 -36
  78. package/dist/cjs/lib/objects/flatten.cjs +0 -40
  79. package/dist/cjs/lib/objects/index.cjs +0 -45
  80. package/dist/cjs/lib/objects/json.cjs +0 -33
  81. package/dist/cjs/lib/objects/loop.cjs +0 -38
  82. package/dist/cjs/lib/objects/mix/mix.cjs +0 -113
  83. package/dist/cjs/lib/objects/nested-property.cjs +0 -43
  84. package/dist/cjs/lib/objects/normalize-object.cjs +0 -32
  85. package/dist/cjs/lib/objects/omit-empty.cjs +0 -38
  86. package/dist/cjs/lib/objects/size.cjs +0 -61
  87. package/dist/cjs/lib/objects/split.cjs +0 -37
  88. package/dist/cjs/lib/promises/index.cjs +0 -21
  89. package/dist/cjs/lib/promises/reject.cjs +0 -50
  90. package/dist/cjs/lib/sse.cjs +0 -74
  91. package/dist/cjs/lib/strings/convert-case/convert-case.cjs +0 -94
  92. package/dist/cjs/lib/strings/index.cjs +0 -29
  93. package/dist/cjs/lib/strings/markdown.cjs +0 -74
  94. package/dist/cjs/lib/strings/name.cjs +0 -44
  95. package/dist/cjs/lib/strings/pluralize.cjs +0 -38
  96. package/dist/cjs/lib/strings/query-string.cjs +0 -41
  97. package/dist/cjs/lib/style/index.cjs +0 -35
  98. package/dist/cjs/lib/symbols/index.cjs +0 -21
  99. package/dist/cjs/lib/symbols/symbols.cjs +0 -36
  100. package/dist/cjs/node/dirname.cjs +0 -47
  101. package/dist/cjs/node/file-cache.cjs +0 -158
  102. package/dist/cjs/node/file.cjs +0 -48
  103. package/dist/cjs/node/hash.cjs +0 -40
  104. package/dist/cjs/node/index.cjs +0 -33
  105. package/dist/cjs/node/pkce.cjs +0 -52
  106. package/dist/cjs/node/random-string.cjs +0 -41
  107. package/dist/cjs/node/sanitize.cjs +0 -41
  108. package/dist/cjs/node/uuid.cjs +0 -40
  109. package/dist/esm/dom/accessibility.js +0 -26
  110. package/dist/esm/dom/actions/index.js +0 -3
  111. package/dist/esm/dom/actions/masonry.js +0 -37
  112. package/dist/esm/dom/actions/prefer-horizontal-scroll.js +0 -90
  113. package/dist/esm/dom/actions/sticky.js +0 -70
  114. package/dist/esm/dom/bounding-box.js +0 -44
  115. package/dist/esm/dom/clipboard.js +0 -12
  116. package/dist/esm/dom/cookie.js +0 -31
  117. package/dist/esm/dom/css-vars.js +0 -21
  118. package/dist/esm/dom/events.js +0 -31
  119. package/dist/esm/dom/focusable.js +0 -117
  120. package/dist/esm/dom/font-size.js +0 -40
  121. package/dist/esm/dom/get-element.js +0 -66
  122. package/dist/esm/dom/hash.js +0 -10
  123. package/dist/esm/dom/index.js +0 -23
  124. package/dist/esm/dom/keyboard.js +0 -22
  125. package/dist/esm/dom/local-store.js +0 -54
  126. package/dist/esm/dom/media.js +0 -32
  127. package/dist/esm/dom/observers/index.js +0 -4
  128. package/dist/esm/dom/observers/intersection-observer.js +0 -36
  129. package/dist/esm/dom/observers/mutation-observer.js +0 -40
  130. package/dist/esm/dom/observers/observer.js +0 -15
  131. package/dist/esm/dom/observers/resize-observer.js +0 -29
  132. package/dist/esm/dom/observers/scroll-observer.js +0 -95
  133. package/dist/esm/dom/pkce.js +0 -20
  134. package/dist/esm/dom/query-params.js +0 -13
  135. package/dist/esm/dom/random-string.js +0 -12
  136. package/dist/esm/dom/sanitize.js +0 -8
  137. package/dist/esm/dom/session-store.js +0 -24
  138. package/dist/esm/dom/spam-prevention.js +0 -25
  139. package/dist/esm/dom/trap-focus.js +0 -51
  140. package/dist/esm/dom/ui/aria-current.js +0 -17
  141. package/dist/esm/dom/ui/inconsistent-button-fix.js +0 -10
  142. package/dist/esm/dom/ui/index.js +0 -4
  143. package/dist/esm/dom/ui/scroll-container.js +0 -22
  144. package/dist/esm/dom/ui/traverse-and-scramble.js +0 -25
  145. package/dist/esm/lib/arrays/index.js +0 -6
  146. package/dist/esm/lib/arrays/item-position.js +0 -15
  147. package/dist/esm/lib/arrays/join.js +0 -12
  148. package/dist/esm/lib/arrays/shuffle.js +0 -17
  149. package/dist/esm/lib/arrays/sort.js +0 -36
  150. package/dist/esm/lib/arrays/split-array.js +0 -16
  151. package/dist/esm/lib/arrays/unique.js +0 -6
  152. package/dist/esm/lib/auth/index.js +0 -1
  153. package/dist/esm/lib/auth/route-manager.js +0 -25
  154. package/dist/esm/lib/checks.js +0 -34
  155. package/dist/esm/lib/date/days.js +0 -12
  156. package/dist/esm/lib/date/index.js +0 -3
  157. package/dist/esm/lib/date/months.js +0 -77
  158. package/dist/esm/lib/date/time.js +0 -75
  159. package/dist/esm/lib/form/form-data.js +0 -57
  160. package/dist/esm/lib/form/index.js +0 -2
  161. package/dist/esm/lib/form/sanitize.js +0 -34
  162. package/dist/esm/lib/functions/callback.js +0 -6
  163. package/dist/esm/lib/functions/debounce.js +0 -18
  164. package/dist/esm/lib/functions/env.js +0 -7
  165. package/dist/esm/lib/functions/functional.js +0 -52
  166. package/dist/esm/lib/functions/index.js +0 -5
  167. package/dist/esm/lib/functions/throttle.js +0 -13
  168. package/dist/esm/lib/functions/timeout.js +0 -14
  169. package/dist/esm/lib/hash.js +0 -18
  170. package/dist/esm/lib/index.js +0 -14
  171. package/dist/esm/lib/numbers/index.js +0 -11
  172. package/dist/esm/lib/numbers/math.js +0 -10
  173. package/dist/esm/lib/objects/camelcase-keys.js +0 -16
  174. package/dist/esm/lib/objects/empty.js +0 -13
  175. package/dist/esm/lib/objects/equal.js +0 -11
  176. package/dist/esm/lib/objects/extend.js +0 -13
  177. package/dist/esm/lib/objects/flatten.js +0 -17
  178. package/dist/esm/lib/objects/index.js +0 -13
  179. package/dist/esm/lib/objects/json.js +0 -10
  180. package/dist/esm/lib/objects/loop.js +0 -14
  181. package/dist/esm/lib/objects/mix/mix.js +0 -88
  182. package/dist/esm/lib/objects/nested-property.js +0 -18
  183. package/dist/esm/lib/objects/normalize-object.js +0 -9
  184. package/dist/esm/lib/objects/omit-empty.js +0 -15
  185. package/dist/esm/lib/objects/size.js +0 -38
  186. package/dist/esm/lib/objects/split.js +0 -14
  187. package/dist/esm/lib/promises/index.js +0 -1
  188. package/dist/esm/lib/promises/reject.js +0 -17
  189. package/dist/esm/lib/sse.js +0 -50
  190. package/dist/esm/lib/strings/convert-case/convert-case.js +0 -64
  191. package/dist/esm/lib/strings/index.js +0 -5
  192. package/dist/esm/lib/strings/markdown.js +0 -40
  193. package/dist/esm/lib/strings/name.js +0 -21
  194. package/dist/esm/lib/strings/pluralize.js +0 -5
  195. package/dist/esm/lib/strings/query-string.js +0 -16
  196. package/dist/esm/lib/style/index.js +0 -12
  197. package/dist/esm/lib/symbols/index.js +0 -1
  198. package/dist/esm/lib/symbols/symbols.js +0 -12
  199. package/dist/esm/node/dirname.js +0 -13
  200. package/dist/esm/node/file-cache.js +0 -121
  201. package/dist/esm/node/file.js +0 -14
  202. package/dist/esm/node/hash.js +0 -7
  203. package/dist/esm/node/index.js +0 -7
  204. package/dist/esm/node/pkce.js +0 -19
  205. package/dist/esm/node/random-string.js +0 -8
  206. package/dist/esm/node/sanitize.js +0 -8
  207. package/dist/esm/node/uuid.js +0 -7
  208. package/dist/types/dom/accessibility.d.cts +0 -30
  209. package/dist/types/dom/actions/index.d.cts +0 -3
  210. package/dist/types/dom/actions/masonry.d.cts +0 -5
  211. package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +0 -5
  212. package/dist/types/dom/actions/sticky.d.cts +0 -5
  213. package/dist/types/dom/bounding-box.d.cts +0 -41
  214. package/dist/types/dom/clipboard.d.cts +0 -7
  215. package/dist/types/dom/cookie.d.cts +0 -7
  216. package/dist/types/dom/css-vars.d.cts +0 -6
  217. package/dist/types/dom/events.d.cts +0 -92
  218. package/dist/types/dom/focusable.d.cts +0 -78
  219. package/dist/types/dom/font-size.d.cts +0 -8
  220. package/dist/types/dom/get-element.d.cts +0 -102
  221. package/dist/types/dom/hash.d.cts +0 -3
  222. package/dist/types/dom/index.d.cts +0 -31
  223. package/dist/types/dom/keyboard.d.cts +0 -32
  224. package/dist/types/dom/local-store.d.cts +0 -31
  225. package/dist/types/dom/media.d.cts +0 -5
  226. package/dist/types/dom/observers/index.d.cts +0 -4
  227. package/dist/types/dom/observers/intersection-observer.d.cts +0 -10
  228. package/dist/types/dom/observers/mutation-observer.d.cts +0 -9
  229. package/dist/types/dom/observers/observer.d.cts +0 -3
  230. package/dist/types/dom/observers/resize-observer.d.cts +0 -40
  231. package/dist/types/dom/observers/scroll-observer.d.cts +0 -40
  232. package/dist/types/dom/pkce.d.cts +0 -8
  233. package/dist/types/dom/query-params.d.cts +0 -6
  234. package/dist/types/dom/random-string.d.cts +0 -9
  235. package/dist/types/dom/sanitize.d.cts +0 -10
  236. package/dist/types/dom/session-store.d.cts +0 -7
  237. package/dist/types/dom/spam-prevention.d.cts +0 -14
  238. package/dist/types/dom/trap-focus.d.cts +0 -32
  239. package/dist/types/dom/ui/aria-current.d.cts +0 -7
  240. package/dist/types/dom/ui/inconsistent-button-fix.d.cts +0 -14
  241. package/dist/types/dom/ui/index.d.cts +0 -4
  242. package/dist/types/dom/ui/scroll-container.d.cts +0 -3
  243. package/dist/types/dom/ui/traverse-and-scramble.d.cts +0 -21
  244. package/dist/types/lib/arrays/index.d.cts +0 -6
  245. package/dist/types/lib/arrays/item-position.d.cts +0 -16
  246. package/dist/types/lib/arrays/join.d.cts +0 -15
  247. package/dist/types/lib/arrays/shuffle.d.cts +0 -3
  248. package/dist/types/lib/arrays/sort.d.cts +0 -32
  249. package/dist/types/lib/arrays/split-array.d.cts +0 -6
  250. package/dist/types/lib/arrays/unique.d.cts +0 -3
  251. package/dist/types/lib/auth/index.d.cts +0 -1
  252. package/dist/types/lib/auth/route-manager.d.cts +0 -28
  253. package/dist/types/lib/checks.d.cts +0 -33
  254. package/dist/types/lib/date/days.d.cts +0 -7
  255. package/dist/types/lib/date/index.d.cts +0 -3
  256. package/dist/types/lib/date/months.d.cts +0 -11
  257. package/dist/types/lib/date/time.d.cts +0 -21
  258. package/dist/types/lib/form/form-data.d.cts +0 -9
  259. package/dist/types/lib/form/index.d.cts +0 -2
  260. package/dist/types/lib/form/sanitize.d.cts +0 -60
  261. package/dist/types/lib/functions/callback.d.cts +0 -8
  262. package/dist/types/lib/functions/debounce.d.cts +0 -3
  263. package/dist/types/lib/functions/env.d.cts +0 -3
  264. package/dist/types/lib/functions/functional.d.cts +0 -72
  265. package/dist/types/lib/functions/index.d.cts +0 -5
  266. package/dist/types/lib/functions/throttle.d.cts +0 -3
  267. package/dist/types/lib/functions/timeout.d.cts +0 -5
  268. package/dist/types/lib/hash.d.cts +0 -3
  269. package/dist/types/lib/index.d.cts +0 -43
  270. package/dist/types/lib/numbers/index.d.cts +0 -5
  271. package/dist/types/lib/numbers/math.d.cts +0 -4
  272. package/dist/types/lib/objects/camelcase-keys.d.cts +0 -3
  273. package/dist/types/lib/objects/empty.d.cts +0 -4
  274. package/dist/types/lib/objects/equal.d.cts +0 -4
  275. package/dist/types/lib/objects/extend.d.cts +0 -6
  276. package/dist/types/lib/objects/flatten.d.cts +0 -6
  277. package/dist/types/lib/objects/index.d.cts +0 -13
  278. package/dist/types/lib/objects/json.d.cts +0 -3
  279. package/dist/types/lib/objects/loop.d.cts +0 -4
  280. package/dist/types/lib/objects/mix/mix.d.cts +0 -44
  281. package/dist/types/lib/objects/nested-property.d.cts +0 -24
  282. package/dist/types/lib/objects/normalize-object.d.cts +0 -3
  283. package/dist/types/lib/objects/omit-empty.d.cts +0 -3
  284. package/dist/types/lib/objects/size.d.cts +0 -3
  285. package/dist/types/lib/objects/split.d.cts +0 -14
  286. package/dist/types/lib/promises/index.d.cts +0 -1
  287. package/dist/types/lib/promises/reject.d.cts +0 -5
  288. package/dist/types/lib/sse.d.cts +0 -18
  289. package/dist/types/lib/strings/convert-case/convert-case.d.cts +0 -10
  290. package/dist/types/lib/strings/index.d.cts +0 -5
  291. package/dist/types/lib/strings/markdown.d.cts +0 -25
  292. package/dist/types/lib/strings/name.d.cts +0 -7
  293. package/dist/types/lib/strings/pluralize.d.cts +0 -3
  294. package/dist/types/lib/strings/query-string.d.cts +0 -10
  295. package/dist/types/lib/style/index.d.cts +0 -3
  296. package/dist/types/lib/symbols/index.d.cts +0 -1
  297. package/dist/types/lib/symbols/symbols.d.cts +0 -4
  298. package/dist/types/node/dirname.d.cts +0 -9
  299. package/dist/types/node/file-cache.d.cts +0 -56
  300. package/dist/types/node/file.d.cts +0 -4
  301. package/dist/types/node/hash.d.cts +0 -3
  302. package/dist/types/node/index.d.cts +0 -7
  303. package/dist/types/node/pkce.d.cts +0 -8
  304. package/dist/types/node/random-string.d.cts +0 -3
  305. package/dist/types/node/sanitize.d.cts +0 -10
  306. package/dist/types/node/uuid.d.cts +0 -3
@@ -1,8 +0,0 @@
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
- };
@@ -1,7 +0,0 @@
1
- import crypto from "crypto";
2
- function uuid() {
3
- return crypto.randomUUID();
4
- }
5
- export {
6
- uuid
7
- };
@@ -1,30 +0,0 @@
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 };
@@ -1,3 +0,0 @@
1
- export { masonry } from './masonry.cjs';
2
- export { preferHorizontalScroll } from './prefer-horizontal-scroll.cjs';
3
- export { sticky } from './sticky.cjs';
@@ -1,5 +0,0 @@
1
- declare function masonry(node: any): Promise<{
2
- destroy(): void;
3
- }>;
4
-
5
- export { masonry };
@@ -1,5 +0,0 @@
1
- declare function preferHorizontalScroll(node: any, props?: {}): {
2
- destroy(): void;
3
- };
4
-
5
- export { preferHorizontalScroll };
@@ -1,5 +0,0 @@
1
- declare function sticky(node: any, props?: {}): {
2
- destroy(): void;
3
- };
4
-
5
- export { sticky };
@@ -1,41 +0,0 @@
1
- /**
2
- * Advanced boundingClientRect that contains information vertical and horizontal centers.
3
- * @param {HTMLElement} element - The element to get the bounding box for
4
- * @param {Object} [options] - Options for the bounding box calculation
5
- * @param {boolean} [options.containsPadding=true] - Whether to include padding in the calculations
6
- * @returns {Object} The bounding box object with additional center coordinates
7
- * @property {number} x - The x coordinate
8
- * @property {number} y - The y coordinate
9
- * @property {number} width - The width
10
- * @property {number} height - The height
11
- * @property {number} top - The top coordinate
12
- * @property {number} right - The right coordinate
13
- * @property {number} bottom - The bottom coordinate
14
- * @property {number} left - The left coordinate
15
- * @property {number} xCenter - The horizontal center coordinate
16
- * @property {number} yCenter - The vertical center coordinate
17
- */
18
- declare function boundingBox(element: HTMLElement, { containsPadding }?: {
19
- containsPadding?: boolean;
20
- }): any;
21
- /**
22
- * Gets the bounding box of an element relative to its ancestor
23
- * @param {Object} params - Parameters for the calculation
24
- * @param {HTMLElement} params.element - The element to get the bounding box for
25
- * @param {HTMLElement} [params.ancestorElement] - The ancestor element to calculate position relative to. Defaults to parent element
26
- * @returns {Object} The relative bounding box with center coordinates
27
- * @property {number} top - Distance from ancestor's top
28
- * @property {number} right - Distance from ancestor's right
29
- * @property {number} bottom - Distance from ancestor's bottom
30
- * @property {number} left - Distance from ancestor's left
31
- * @property {number} width - The width
32
- * @property {number} height - The height
33
- * @property {number} xCenter - The horizontal center coordinate relative to ancestor
34
- * @property {number} yCenter - The vertical center coordinate relative to ancestor
35
- */
36
- declare function boundingBoxRelativeToAncestor({ element, ancestorElement }: {
37
- element: HTMLElement;
38
- ancestorElement?: HTMLElement;
39
- }): any;
40
-
41
- export { boundingBox, boundingBoxRelativeToAncestor };
@@ -1,7 +0,0 @@
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 };
@@ -1,7 +0,0 @@
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 };
@@ -1,6 +0,0 @@
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 };
@@ -1,92 +0,0 @@
1
- /**
2
- * @typedef {Object} EventListener
3
- * @property {Element} node - The DOM element to attach the event listener to
4
- * @property {string} event - The event type (e.g., 'click', 'keydown')
5
- * @property {EventListenerOrEventListenerObject} handler - The event handler function
6
- */
7
- /**
8
- * @typedef {Object} ListenerManager
9
- * @property {EventListener[]} list - Array of current event listeners
10
- * @property {function(EventListener): void} add - Add a new event listener
11
- * @property {function(EventListener): void} remove - Remove an event listener
12
- * @property {function(): void} clear - Remove all event listeners
13
- */
14
- /**
15
- * @typedef {Object} CustomEventOptions
16
- * @property {boolean} [bubbles=false] - Whether the event bubbles up through the DOM
17
- * @property {boolean} [cancelable=false] - Whether the event can be canceled
18
- * @property {boolean} [composed=false] - Whether the event will trigger listeners outside of a shadow root
19
- */
20
- /**
21
- * Adds multiple event listeners to their respective DOM elements
22
- * @param {EventListener[]} listeners - Array of listener objects
23
- */
24
- declare function addListeners(listeners: EventListener[]): void;
25
- /**
26
- * Removes multiple event listeners from their respective DOM elements
27
- * @param {EventListener[]} listeners - Array of listener objects
28
- */
29
- declare function removeListeners(listeners: EventListener[]): void;
30
- /**
31
- * Dispatches a custom event from a DOM node
32
- * @param {Element} node - The DOM element to dispatch the event from
33
- * @param {string} eventName - The name of the custom event
34
- * @param {*} detail - The detail data to include with the event
35
- * @param {CustomEventOptions} [options={}] - Additional event options
36
- */
37
- declare function dispatchEvent(node: Element, eventName: string, detail: any, options?: CustomEventOptions): void;
38
- /**
39
- * Creates a new CustomEvent with updated properties from an existing event
40
- * @param {Event} event - The original event object
41
- * @param {Object} updates - Properties to update in the new event
42
- * @return {CustomEvent} A new CustomEvent with updated properties
43
- */
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 };
@@ -1,78 +0,0 @@
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 };
@@ -1,8 +0,0 @@
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 };
@@ -1,102 +0,0 @@
1
- /**
2
- * Gets the type of a DOM node
3
- * @param {Node|NodeList|Array} node - The node to check
4
- * @returns {'element'|'nodelist'|'array'|undefined} The type of the node
5
- */
6
- declare function getNodeType(node: Node | NodeList | any[]): "element" | "nodelist" | "array" | undefined;
7
- /**
8
- * Gets an element from a selector or returns the element if it's already an Element
9
- * @param {string|Element} selector - CSS selector or Element
10
- * @returns {Element|undefined} The matching element or undefined if not found
11
- *
12
- * @example
13
- * // Get element by selector
14
- * const button = getElement('.button')
15
- *
16
- * // Pass through Element
17
- * const element = document.querySelector('.button')
18
- * const sameElement = getElement(element) // Returns element directly
19
- */
20
- declare function getElement(selector: string | Element): Element | undefined;
21
- /**
22
- * Gets all child elements of a node, handling Astro slots
23
- * @param {Element} node - The parent node
24
- * @returns {Element[]} Array of child elements
25
- *
26
- * @example
27
- * // Get children of a div
28
- * const children = getChildrenElements(div)
29
- *
30
- * // Works with Astro slots
31
- * const slotChildren = getChildrenElements(astroSlot)
32
- */
33
- declare function getChildrenElements(node: Element): Element[];
34
- /**
35
- * Gets the parent element, skipping Astro-specific nodes
36
- * @param {Element} element - The element to get the parent of
37
- * @returns {Element|null} The parent element, or null if no parent exists
38
- *
39
- * @example
40
- * // Get parent, skipping Astro slots
41
- * const parent = getParentElement(element)
42
- */
43
- declare function getParentElement(element: Element): Element | null;
44
- /**
45
- * Gets all sibling elements of an element (excluding the element itself)
46
- * @param {Element} element - The element to get siblings of
47
- * @returns {Element[]} Array of sibling elements
48
- *
49
- * @example
50
- * // Get all siblings of an element
51
- * const siblings = getSiblingElements(element)
52
- */
53
- declare function getSiblingElements(element: Element): Element[];
54
- /**
55
- * Gets the index of an element among its siblings
56
- * @param {Element} element - The element to get the index of
57
- * @returns {number} The index of the element (0-based)
58
- *
59
- * @example
60
- * // Get position of element among siblings
61
- * const index = getSelfIndex(element)
62
- */
63
- declare function getSelfIndex(element: Element): number;
64
- /**
65
- * Checks if an element is an ancestor of another element
66
- * @param {Element} ancestor - The potential ancestor element
67
- * @param {Element} element - The element to check
68
- * @param {Object} [options] - Options for the search
69
- * @param {number} [options.searchLevels=0] - Number of levels to search up, 0 for unlimited
70
- * @returns {boolean} True if ancestor is an ancestor of element
71
- *
72
- * @example
73
- * // Check if div is an ancestor of button
74
- * const isParent = isAncestor(div, button)
75
- *
76
- * // Check if div is an ancestor within 2 levels
77
- * const isCloseAncestor = isAncestor(div, button, { searchLevels: 2 })
78
- */
79
- declare function isAncestor(ancestor: Element, element: Element, { searchLevels }?: {
80
- searchLevels?: number;
81
- }): boolean;
82
- /**
83
- * Gets ancestor elements with their siblings, optionally limiting the search depth.
84
- * Useful for finding the nearest ancestor that has siblings.
85
- *
86
- * @param {Element} element - The element to start searching from
87
- * @param {Object} [options] - Options for the search
88
- * @param {number|boolean} [options.limit=false] - Number of levels to search up, or false for unlimited
89
- * @returns {Element[]|null} Array of sibling elements, or null if none found
90
- *
91
- * @example
92
- * // Get siblings of nearest ancestor that has siblings
93
- * const ancestorSiblings = getAncestorWithSiblings(element)
94
- *
95
- * // Search up to 2 levels
96
- * const limitedSiblings = getAncestorWithSiblings(element, { limit: 2 })
97
- */
98
- declare function getAncestorWithSiblings(element: Element, { limit }?: {
99
- limit?: number | boolean;
100
- }): Element[] | null;
101
-
102
- export { getAncestorWithSiblings, getChildrenElements, getElement, getNodeType, getParentElement, getSelfIndex, getSiblingElements, isAncestor };
@@ -1,3 +0,0 @@
1
- declare function sha256Hash(string: any): Promise<string>;
2
-
3
- export { sha256Hash };
@@ -1,31 +0,0 @@
1
- export { checkForAccessibleName, hasAccessibleName, isInvalidAriaPopup } from './accessibility.cjs';
2
- export { masonry } from './actions/masonry.cjs';
3
- export { preferHorizontalScroll } from './actions/prefer-horizontal-scroll.cjs';
4
- export { sticky } from './actions/sticky.cjs';
5
- export { boundingBox, boundingBoxRelativeToAncestor } from './bounding-box.cjs';
6
- export { copyRichText } from './clipboard.cjs';
7
- export { cookies, getCookie } from './cookie.cjs';
8
- export { getCSSValue, getCSSVar, setCSSValue, setCSSVar } from './css-vars.cjs';
9
- export { CustomEventOptions, EventListener, ListenerManager, addListeners, dispatchEvent, removeListeners, updateEvent } from './events.cjs';
10
- export { Focusable, Focusables, getFocusableElements } from './focusable.cjs';
11
- export { em, getUnit, lh, rem, rlh, toPx } from './font-size.cjs';
12
- export { getAncestorWithSiblings, getChildrenElements, getElement, getNodeType, getParentElement, getSelfIndex, getSiblingElements, isAncestor } from './get-element.cjs';
13
- export { sha256Hash } from './hash.cjs';
14
- export { isArrowKey, isEscapeKey, isShiftTab, isTab, isTabKey } from './keyboard.cjs';
15
- export { localStore } from './local-store.cjs';
16
- export { imagesLoaded, mediaLoaded, videosLoaded } from './media.cjs';
17
- export { intersectionObserver } from './observers/intersection-observer.cjs';
18
- export { mutationObserver } from './observers/mutation-observer.cjs';
19
- export { resizeObserver } from './observers/resize-observer.cjs';
20
- export { ScrollObserverOptions, scrollObserver } from './observers/scroll-observer.cjs';
21
- export { PKCE } from './pkce.cjs';
22
- export { queryParams } from './query-params.cjs';
23
- export { randomString, uuid } from './random-string.cjs';
24
- export { sanitize } from './sanitize.cjs';
25
- export { sessionStore } from './session-store.cjs';
26
- export { preventSpam } from './spam-prevention.cjs';
27
- export { manageFocus, trapFocus } from './trap-focus.cjs';
28
- export { markActiveAnchorIn, scrollToElement } from './ui/aria-current.cjs';
29
- export { inconsistentButtonFix } from './ui/inconsistent-button-fix.cjs';
30
- export { findScrollContainer } from './ui/scroll-container.cjs';
31
- export { traverseAndScramble } from './ui/traverse-and-scramble.cjs';
@@ -1,32 +0,0 @@
1
- /**
2
- * Event is Tab (without shift)
3
- * @param {KeyboardEvent} event - The keyboard event object
4
- * @returns {boolean}
5
- */
6
- declare function isTab(event: KeyboardEvent): boolean;
7
- /**
8
- * Event is shift + Tab
9
- * @param {KeyboardEvent} event - The keyboard event object
10
- * @returns {boolean}
11
- */
12
- declare function isShiftTab(event: KeyboardEvent): boolean;
13
- /**
14
- * Matches both Tab and Shift+Tab
15
- * @param {string} key - The keyboard key to check
16
- * @returns {boolean} Whether the key is Tab
17
- */
18
- declare function isTabKey(key: string): boolean;
19
- /**
20
- * Event is an arrow key
21
- * @param {string} key - The keyboard key to check
22
- * @returns {boolean} Whether the key is an arrow key (Up, Down, Left, Right)
23
- */
24
- declare function isArrowKey(key: string): boolean;
25
- /**
26
- * Event is Escape key
27
- * @param {string} key - The keyboard key to check
28
- * @returns {boolean} Whether the key is Escape
29
- */
30
- declare function isEscapeKey(key: string): boolean;
31
-
32
- export { isArrowKey, isEscapeKey, isShiftTab, isTab, isTabKey };
@@ -1,31 +0,0 @@
1
- declare namespace localStore {
2
- /**
3
- * Retrieves a value from localStorage
4
- * @param {string} key - The key to retrieve from localStorage
5
- * @returns {any} The stored value. Returns parsed JSON if the value was stored as JSON. Returns the original string if not JSON, or undefined if key doesn't exist
6
- */
7
- function get(key: string): any;
8
- /**
9
- * Stores a value in localStorage
10
- * @param {string} key - The key to store the value under
11
- * @param {any} value - The value to store. Objects will be stringified to JSON
12
- */
13
- function set(key: string, value: any): void;
14
- /**
15
- * Stores multiple key-value pairs in localStorage
16
- * @param {Object|Map} data - An object or Map containing key-value pairs to store
17
- */
18
- function setMultiple(data: any | Map<any, any>): void;
19
- /**
20
- * Removes a value from localStorage
21
- * @param {string} key - The key to remove from localStorage
22
- */
23
- function remove(key: string): void;
24
- /**
25
- * Removes multiple keys from localStorage
26
- * @param {string[]} keys - Array of keys to remove from localStorage
27
- */
28
- function removeMultiple(keys: string[]): void;
29
- }
30
-
31
- export { localStore };
@@ -1,5 +0,0 @@
1
- declare function imagesLoaded(node: any): Promise<any[]>;
2
- declare function videosLoaded(node: any): Promise<any[]>;
3
- declare function mediaLoaded(node: any): Promise<[any[], any[]]>;
4
-
5
- export { imagesLoaded, mediaLoaded, videosLoaded };
@@ -1,4 +0,0 @@
1
- export { intersectionObserver } from './intersection-observer.cjs';
2
- export { mutationObserver } from './mutation-observer.cjs';
3
- export { resizeObserver } from './resize-observer.cjs';
4
- export { ScrollObserverOptions, scrollObserver } from './scroll-observer.cjs';
@@ -1,10 +0,0 @@
1
- declare function intersectionObserver(target: any, options?: {}): {
2
- observer: IntersectionObserver;
3
- observe(target: any): void;
4
- unobserve(target: any): void;
5
- takeRecords(): IntersectionObserverEntry[];
6
- disconnect(): void;
7
- destroy(): void;
8
- };
9
-
10
- export { intersectionObserver };
@@ -1,9 +0,0 @@
1
- declare function mutationObserver(target: any, options: any): {
2
- observer: MutationObserver;
3
- observe(target: any): void;
4
- takeRecords(): MutationRecord[];
5
- disconnect(): void;
6
- destroy(): void;
7
- };
8
-
9
- export { mutationObserver };
@@ -1,3 +0,0 @@
1
- declare function useObserverMethodOnTarget(target: any, observer: any, method?: string, options?: any): void;
2
-
3
- export { useObserverMethodOnTarget };
@@ -1,40 +0,0 @@
1
- /**
2
- * Creates and manages a ResizeObserver instance to monitor size changes of a target element.
3
- *
4
- * @param {Element|Window|Document|NodeList|Element[]} target - The element(s) to observe.
5
- * - If window or document is provided, document.documentElement will be observed instead.
6
- * - If NodeList or Array of elements is provided, all elements will be observed.
7
- * @param {Object} options - Configuration options for the resize observer
8
- * @param {boolean} [options.observe=true] - Whether to start observing immediately. If false, the observer won't be created.
9
- * @param {Function} [options.callback] - Optional callback function that will be called when resize changes are detected.
10
- * If not provided, a 'resize-obs' event will be dispatched on the target.
11
- * @param {Object} [options.observerOptions] - Additional options to pass to ResizeObserver.observe()
12
- *
13
- * @returns {Object} An object with methods to control the observer:
14
- * - observe(target, options): Start observing a new target element
15
- * - unobserve(target): Stop observing a target element
16
- * - disconnect(): Disconnect the observer and stop all observations
17
- * - destroy(): Alias for disconnect()
18
- *
19
- * @example
20
- * // Basic usage with callback
21
- * resizeObserver(element, {
22
- * callback: ({ entry, entries, observer }) => {
23
- * console.log('Element resized:', entry.contentRect);
24
- * }
25
- * });
26
- *
27
- * @example
28
- * // Usage with event listener
29
- * resizeObserver(element);
30
- * element.addEventListener('resize-obs', ({ detail }) => {
31
- * console.log('Element resized:', detail.entry.contentRect);
32
- * });
33
- */
34
- declare function resizeObserver(target: Element | Window | Document | NodeList | Element[], options: {
35
- observe?: boolean;
36
- callback?: Function;
37
- observerOptions?: any;
38
- }): any;
39
-
40
- export { resizeObserver };
@@ -1,40 +0,0 @@
1
- /**
2
- * Scroll Observer - Optimized for performance
3
- * @param {Element | Document | Window} node - The element to observe scroll events on
4
- * @param {ScrollObserverOptions} [options] - Configuration options
5
- */
6
- declare function scrollObserver(node: Element | Document | Window, options?: ScrollObserverOptions): {
7
- destroy(): void;
8
- };
9
- type ScrollObserverOptions = {
10
- /**
11
- * - Float between 0 to 1. When to trigger callback (0.75 = 75% down page)
12
- */
13
- threshold?: number;
14
- /**
15
- * - Float between 0 to 1. Tolerance zone around threshold
16
- */
17
- tolerance?: number;
18
- /**
19
- * - Only fire threshold callback once (default: false)
20
- */
21
- once?: boolean;
22
- /**
23
- * - Called on every scroll with scrollPercent
24
- */
25
- callback?: Function;
26
- /**
27
- * - Called when scrolling down
28
- */
29
- onScrollDown?: Function;
30
- /**
31
- * - Called when scrolling up
32
- */
33
- onScrollUp?: Function;
34
- /**
35
- * - Called when entering threshold zone
36
- */
37
- onEnterThreshold?: Function;
38
- };
39
-
40
- export { type ScrollObserverOptions, scrollObserver };
@@ -1,8 +0,0 @@
1
- declare function PKCE(): Promise<{
2
- state: string;
3
- code_verifier: string;
4
- code_challenge: string;
5
- code_challenge_method: string;
6
- }>;
7
-
8
- export { PKCE };