@splendidlabz/utils 1.11.3 → 1.11.5
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.
- package/dist/cjs/dom/accessibility.cjs +53 -0
- package/dist/cjs/dom/actions/index.cjs +410 -0
- package/dist/cjs/dom/actions/masonry.cjs +152 -0
- package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +157 -0
- package/dist/cjs/dom/actions/sticky.cjs +213 -0
- package/dist/cjs/dom/bounding-box.cjs +70 -0
- package/dist/cjs/dom/clipboard.cjs +37 -0
- package/dist/cjs/dom/cookie.cjs +57 -0
- package/dist/cjs/dom/css-vars.cjs +57 -0
- package/dist/cjs/dom/events.cjs +59 -0
- package/{src/dom/focusable.js → dist/cjs/dom/focusable.cjs} +51 -73
- package/dist/cjs/dom/font-size.cjs +80 -0
- package/dist/cjs/dom/get-element.cjs +98 -0
- package/dist/cjs/dom/hash.cjs +35 -0
- package/dist/cjs/dom/index.cjs +1267 -0
- package/dist/cjs/dom/keyboard.cjs +51 -0
- package/dist/cjs/dom/local-store.cjs +79 -0
- package/dist/cjs/dom/media.cjs +59 -0
- package/dist/cjs/dom/observers/index.cjs +253 -0
- package/dist/cjs/dom/observers/intersection-observer.cjs +91 -0
- package/dist/cjs/dom/observers/mutation-observer.cjs +95 -0
- package/dist/cjs/dom/observers/observer.cjs +48 -0
- package/dist/cjs/dom/observers/resize-observer.cjs +84 -0
- package/dist/cjs/dom/observers/scroll-observer.cjs +177 -0
- package/dist/cjs/dom/pkce.cjs +53 -0
- package/dist/cjs/dom/query-params.cjs +38 -0
- package/dist/cjs/dom/random-string.cjs +38 -0
- package/dist/cjs/dom/sanitize.cjs +65 -0
- package/dist/cjs/dom/session-store.cjs +49 -0
- package/dist/cjs/dom/spam-prevention.cjs +50 -0
- package/dist/cjs/dom/trap-focus.cjs +197 -0
- package/dist/cjs/dom/ui/aria-current.cjs +43 -0
- package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +35 -0
- package/dist/cjs/dom/ui/index.cjs +105 -0
- package/dist/cjs/dom/ui/scroll-container.cjs +47 -0
- package/dist/cjs/dom/ui/traverse-and-scramble.cjs +50 -0
- package/dist/cjs/lib/arrays/index.cjs +139 -0
- package/dist/cjs/lib/arrays/item-position.cjs +42 -0
- package/dist/cjs/lib/arrays/join.cjs +43 -0
- package/dist/cjs/lib/arrays/shuffle.cjs +42 -0
- package/dist/cjs/lib/arrays/sort.cjs +67 -0
- package/dist/cjs/lib/arrays/split-array.cjs +41 -0
- package/dist/cjs/lib/arrays/unique.cjs +31 -0
- package/dist/cjs/lib/auth/index.cjs +53 -0
- package/dist/cjs/lib/auth/route-manager.cjs +51 -0
- package/dist/cjs/lib/checks.cjs +63 -0
- package/dist/cjs/lib/date/days.cjs +37 -0
- package/dist/cjs/lib/date/index.cjs +208 -0
- package/dist/cjs/lib/date/months.cjs +102 -0
- package/dist/cjs/lib/date/time.cjs +117 -0
- package/dist/cjs/lib/form/form-data.cjs +83 -0
- package/dist/cjs/lib/form/index.cjs +122 -0
- package/dist/cjs/lib/form/sanitize.cjs +61 -0
- package/dist/cjs/lib/functions/callback.cjs +31 -0
- package/dist/cjs/lib/functions/debounce.cjs +43 -0
- package/dist/cjs/lib/functions/env.cjs +32 -0
- package/dist/cjs/lib/functions/functional.cjs +82 -0
- package/dist/cjs/lib/functions/index.cjs +142 -0
- package/dist/cjs/lib/functions/throttle.cjs +38 -0
- package/dist/cjs/lib/functions/timeout.cjs +41 -0
- package/dist/cjs/lib/hash.cjs +43 -0
- package/dist/cjs/lib/index.cjs +1178 -0
- package/dist/cjs/lib/numbers/index.cjs +49 -0
- package/dist/cjs/lib/numbers/math.cjs +36 -0
- package/dist/cjs/lib/objects/camelcase-keys.cjs +80 -0
- package/dist/cjs/lib/objects/empty.cjs +39 -0
- package/dist/cjs/lib/objects/equal.cjs +47 -0
- package/dist/cjs/lib/objects/extend.cjs +147 -0
- package/dist/cjs/lib/objects/flatten.cjs +48 -0
- package/dist/cjs/lib/objects/index.cjs +378 -0
- package/dist/cjs/lib/objects/json.cjs +35 -0
- package/dist/cjs/lib/objects/loop.cjs +40 -0
- package/dist/cjs/lib/objects/mix/mix.cjs +115 -0
- package/dist/cjs/lib/objects/nested-property.cjs +45 -0
- package/dist/cjs/lib/objects/normalize-object.cjs +106 -0
- package/dist/cjs/lib/objects/omit-empty.cjs +40 -0
- package/dist/cjs/lib/objects/size.cjs +63 -0
- package/dist/cjs/lib/objects/split.cjs +39 -0
- package/dist/cjs/lib/promises/index.cjs +69 -0
- package/dist/cjs/lib/promises/reject.cjs +67 -0
- package/dist/cjs/lib/sse.cjs +99 -0
- package/dist/cjs/lib/strings/convert-case/convert-case.cjs +96 -0
- package/dist/cjs/lib/strings/index.cjs +197 -0
- package/dist/cjs/lib/strings/markdown.cjs +76 -0
- package/dist/cjs/lib/strings/name.cjs +46 -0
- package/dist/cjs/lib/strings/pluralize.cjs +40 -0
- package/dist/cjs/lib/strings/query-string.cjs +43 -0
- package/dist/cjs/lib/style/index.cjs +64 -0
- package/dist/cjs/lib/symbols/index.cjs +40 -0
- package/dist/cjs/lib/symbols/symbols.cjs +38 -0
- package/dist/cjs/node/dirname.cjs +49 -0
- package/dist/cjs/node/file-cache.cjs +200 -0
- package/dist/cjs/node/file.cjs +50 -0
- package/dist/cjs/node/hash.cjs +42 -0
- package/dist/cjs/node/index.cjs +296 -0
- package/dist/cjs/node/pkce.cjs +64 -0
- package/dist/cjs/node/random-string.cjs +43 -0
- package/dist/cjs/node/sanitize.cjs +65 -0
- package/dist/cjs/node/uuid.cjs +42 -0
- package/dist/esm/dom/accessibility.js +26 -0
- package/dist/esm/dom/actions/index.js +3 -0
- package/dist/esm/dom/actions/masonry.js +38 -0
- package/dist/esm/dom/actions/prefer-horizontal-scroll.js +90 -0
- package/dist/esm/dom/actions/sticky.js +70 -0
- package/dist/esm/dom/bounding-box.js +44 -0
- package/dist/esm/dom/clipboard.js +12 -0
- package/dist/esm/dom/cookie.js +31 -0
- package/dist/esm/dom/css-vars.js +21 -0
- package/dist/esm/dom/events.js +31 -0
- package/dist/esm/dom/focusable.js +117 -0
- package/dist/esm/dom/font-size.js +40 -0
- package/dist/esm/dom/get-element.js +66 -0
- package/dist/esm/dom/hash.js +10 -0
- package/dist/esm/dom/index.js +23 -0
- package/dist/esm/dom/keyboard.js +22 -0
- package/{src → dist/esm}/dom/local-store.js +16 -28
- package/dist/esm/dom/media.js +32 -0
- package/dist/esm/dom/observers/index.js +4 -0
- package/dist/esm/dom/observers/intersection-observer.js +36 -0
- package/dist/esm/dom/observers/mutation-observer.js +40 -0
- package/dist/esm/dom/observers/observer.js +15 -0
- package/dist/esm/dom/observers/resize-observer.js +29 -0
- package/dist/esm/dom/observers/scroll-observer.js +95 -0
- package/dist/esm/dom/pkce.js +20 -0
- package/dist/esm/dom/query-params.js +13 -0
- package/dist/esm/dom/random-string.js +12 -0
- package/dist/esm/dom/sanitize.js +8 -0
- package/dist/esm/dom/session-store.js +24 -0
- package/dist/esm/dom/spam-prevention.js +25 -0
- package/dist/esm/dom/trap-focus.js +51 -0
- package/dist/esm/dom/ui/aria-current.js +17 -0
- package/dist/esm/dom/ui/inconsistent-button-fix.js +10 -0
- package/dist/esm/dom/ui/index.js +4 -0
- package/dist/esm/dom/ui/scroll-container.js +22 -0
- package/dist/esm/dom/ui/traverse-and-scramble.js +25 -0
- package/dist/esm/lib/arrays/index.js +6 -0
- package/dist/esm/lib/arrays/item-position.js +15 -0
- package/dist/esm/lib/arrays/join.js +12 -0
- package/dist/esm/lib/arrays/shuffle.js +17 -0
- package/dist/esm/lib/arrays/sort.js +36 -0
- package/dist/esm/lib/arrays/split-array.js +16 -0
- package/dist/esm/lib/arrays/unique.js +6 -0
- package/dist/esm/lib/auth/index.js +1 -0
- package/dist/esm/lib/auth/route-manager.js +25 -0
- package/dist/esm/lib/checks.js +34 -0
- package/dist/esm/lib/date/days.js +12 -0
- package/dist/esm/lib/date/index.js +3 -0
- package/dist/esm/lib/date/months.js +77 -0
- package/dist/esm/lib/date/time.js +75 -0
- package/dist/esm/lib/form/form-data.js +57 -0
- package/dist/esm/lib/form/index.js +2 -0
- package/dist/esm/lib/form/sanitize.js +34 -0
- package/dist/esm/lib/functions/callback.js +6 -0
- package/dist/esm/lib/functions/debounce.js +18 -0
- package/dist/esm/lib/functions/env.js +7 -0
- package/dist/esm/lib/functions/functional.js +52 -0
- package/dist/esm/lib/functions/index.js +5 -0
- package/dist/esm/lib/functions/throttle.js +13 -0
- package/dist/esm/lib/functions/timeout.js +14 -0
- package/dist/esm/lib/hash.js +18 -0
- package/dist/esm/lib/index.js +14 -0
- package/dist/esm/lib/numbers/index.js +11 -0
- package/dist/esm/lib/numbers/math.js +10 -0
- package/dist/esm/lib/objects/camelcase-keys.js +16 -0
- package/dist/esm/lib/objects/empty.js +13 -0
- package/dist/esm/lib/objects/equal.js +11 -0
- package/dist/esm/lib/objects/extend.js +13 -0
- package/dist/esm/lib/objects/flatten.js +17 -0
- package/dist/esm/lib/objects/index.js +13 -0
- package/dist/esm/lib/objects/json.js +10 -0
- package/dist/esm/lib/objects/loop.js +14 -0
- package/dist/esm/lib/objects/mix/mix.js +88 -0
- package/dist/esm/lib/objects/nested-property.js +18 -0
- package/dist/esm/lib/objects/normalize-object.js +9 -0
- package/dist/esm/lib/objects/omit-empty.js +15 -0
- package/dist/esm/lib/objects/size.js +38 -0
- package/dist/esm/lib/objects/split.js +14 -0
- package/dist/esm/lib/promises/index.js +1 -0
- package/dist/esm/lib/promises/reject.js +17 -0
- package/dist/esm/lib/sse.js +50 -0
- package/dist/esm/lib/strings/convert-case/convert-case.js +64 -0
- package/dist/esm/lib/strings/index.js +5 -0
- package/dist/esm/lib/strings/markdown.js +40 -0
- package/dist/esm/lib/strings/name.js +21 -0
- package/dist/esm/lib/strings/pluralize.js +5 -0
- package/dist/esm/lib/strings/query-string.js +16 -0
- package/dist/esm/lib/style/index.js +12 -0
- package/dist/esm/lib/symbols/index.js +1 -0
- package/dist/esm/lib/symbols/symbols.js +12 -0
- package/dist/esm/node/context.js +0 -0
- package/dist/esm/node/dirname.js +13 -0
- package/dist/esm/node/file-cache.js +121 -0
- package/dist/esm/node/file.js +14 -0
- package/dist/esm/node/hash.js +7 -0
- package/dist/esm/node/index.js +7 -0
- package/dist/esm/node/pkce.js +20 -0
- package/dist/esm/node/random-string.js +8 -0
- package/dist/esm/node/sanitize.js +8 -0
- package/dist/esm/node/uuid.js +7 -0
- package/dist/types/dom/accessibility.d.cts +30 -0
- package/dist/types/dom/actions/index.d.cts +3 -0
- package/dist/types/dom/actions/masonry.d.cts +5 -0
- package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +5 -0
- package/dist/types/dom/actions/sticky.d.cts +5 -0
- package/{src/dom/bounding-box.js → dist/types/dom/bounding-box.d.cts} +8 -49
- package/dist/types/dom/clipboard.d.cts +7 -0
- package/dist/types/dom/cookie.d.cts +7 -0
- package/dist/types/dom/css-vars.d.cts +6 -0
- package/{src/dom/events.js → dist/types/dom/events.d.cts} +52 -31
- package/dist/types/dom/focusable.d.cts +78 -0
- package/dist/types/dom/font-size.d.cts +8 -0
- package/{src/dom/get-element.js → dist/types/dom/get-element.d.cts} +25 -99
- package/dist/types/dom/hash.d.cts +3 -0
- package/dist/types/dom/index.d.cts +31 -0
- package/{src/dom/keyboard.js → dist/types/dom/keyboard.d.cts} +7 -19
- package/dist/types/dom/local-store.d.cts +31 -0
- package/dist/types/dom/media.d.cts +5 -0
- package/dist/types/dom/observers/index.d.cts +4 -0
- package/dist/types/dom/observers/intersection-observer.d.cts +10 -0
- package/dist/types/dom/observers/mutation-observer.d.cts +9 -0
- package/dist/types/dom/observers/observer.d.cts +3 -0
- package/{src/dom/observers/resize-observer.js → dist/types/dom/observers/resize-observer.d.cts} +6 -32
- package/dist/types/dom/observers/scroll-observer.d.cts +40 -0
- package/dist/types/dom/pkce.d.cts +8 -0
- package/dist/types/dom/query-params.d.cts +6 -0
- package/dist/types/dom/random-string.d.cts +9 -0
- package/dist/types/dom/sanitize.d.cts +10 -0
- package/dist/types/dom/session-store.d.cts +7 -0
- package/dist/types/dom/spam-prevention.d.cts +14 -0
- package/dist/types/dom/trap-focus.d.cts +32 -0
- package/dist/types/dom/ui/aria-current.d.cts +7 -0
- package/{src/dom/ui/inconsistent-button-fix.js → dist/types/dom/ui/inconsistent-button-fix.d.cts} +5 -11
- package/dist/types/dom/ui/index.d.cts +4 -0
- package/dist/types/dom/ui/scroll-container.d.cts +3 -0
- package/dist/types/dom/ui/traverse-and-scramble.d.cts +21 -0
- package/dist/types/lib/arrays/index.d.cts +6 -0
- package/{src/lib/arrays/item-position.js → dist/types/lib/arrays/item-position.d.cts} +5 -12
- package/{src/lib/arrays/join.js → dist/types/lib/arrays/join.d.cts} +4 -9
- package/dist/types/lib/arrays/shuffle.d.cts +3 -0
- package/dist/types/lib/arrays/sort.d.cts +32 -0
- package/dist/types/lib/arrays/split-array.d.cts +6 -0
- package/dist/types/lib/arrays/unique.d.cts +3 -0
- package/dist/types/lib/auth/index.d.cts +1 -0
- package/dist/types/lib/auth/route-manager.d.cts +28 -0
- package/dist/types/lib/checks.d.cts +33 -0
- package/dist/types/lib/date/days.d.cts +7 -0
- package/dist/types/lib/date/index.d.cts +3 -0
- package/dist/types/lib/date/months.d.cts +11 -0
- package/dist/types/lib/date/time.d.cts +21 -0
- package/dist/types/lib/form/form-data.d.cts +9 -0
- package/dist/types/lib/form/index.d.cts +2 -0
- package/{src/lib/form/sanitize.js → dist/types/lib/form/sanitize.d.cts} +19 -39
- package/{src/lib/functions/callback.js → dist/types/lib/functions/callback.d.cts} +3 -3
- package/dist/types/lib/functions/debounce.d.cts +3 -0
- package/dist/types/lib/functions/env.d.cts +3 -0
- package/{src/lib/functions/functional.js → dist/types/lib/functions/functional.d.cts} +8 -49
- package/dist/types/lib/functions/index.d.cts +5 -0
- package/dist/types/lib/functions/throttle.d.cts +3 -0
- package/dist/types/lib/functions/timeout.d.cts +5 -0
- package/dist/types/lib/hash.d.cts +3 -0
- package/dist/types/lib/index.d.cts +43 -0
- package/dist/types/lib/numbers/index.d.cts +5 -0
- package/dist/types/lib/numbers/math.d.cts +4 -0
- package/dist/types/lib/objects/camelcase-keys.d.cts +3 -0
- package/dist/types/lib/objects/empty.d.cts +4 -0
- package/dist/types/lib/objects/equal.d.cts +4 -0
- package/dist/types/lib/objects/extend.d.cts +6 -0
- package/dist/types/lib/objects/flatten.d.cts +6 -0
- package/dist/types/lib/objects/index.d.cts +13 -0
- package/dist/types/lib/objects/json.d.cts +3 -0
- package/dist/types/lib/objects/loop.d.cts +4 -0
- package/dist/types/lib/objects/mix/mix.d.cts +44 -0
- package/{src/lib/objects/nested-property.js → dist/types/lib/objects/nested-property.d.cts} +4 -21
- package/dist/types/lib/objects/normalize-object.d.cts +3 -0
- package/dist/types/lib/objects/omit-empty.d.cts +3 -0
- package/dist/types/lib/objects/size.d.cts +3 -0
- package/dist/types/lib/objects/split.d.cts +14 -0
- package/dist/types/lib/promises/index.d.cts +1 -0
- package/dist/types/lib/promises/reject.d.cts +5 -0
- package/dist/types/lib/sse.d.cts +18 -0
- package/dist/types/lib/strings/convert-case/convert-case.d.cts +10 -0
- package/dist/types/lib/strings/index.d.cts +5 -0
- package/dist/types/lib/strings/markdown.d.cts +25 -0
- package/dist/types/lib/strings/name.d.cts +7 -0
- package/dist/types/lib/strings/pluralize.d.cts +3 -0
- package/dist/types/lib/strings/query-string.d.cts +10 -0
- package/dist/types/lib/style/index.d.cts +3 -0
- package/dist/types/lib/symbols/index.d.cts +1 -0
- package/dist/types/lib/symbols/symbols.d.cts +4 -0
- package/dist/types/node/context.d.cts +2 -0
- package/dist/types/node/dirname.d.cts +9 -0
- package/dist/types/node/file-cache.d.cts +56 -0
- package/dist/types/node/file.d.cts +4 -0
- package/dist/types/node/hash.d.cts +3 -0
- package/dist/types/node/index.d.cts +7 -0
- package/dist/types/node/pkce.d.cts +14 -0
- package/dist/types/node/random-string.d.cts +3 -0
- package/{src/node/sanitize.js → dist/types/node/sanitize.d.cts} +3 -6
- package/dist/types/node/uuid.d.cts +3 -0
- package/package.json +18 -15
- package/CHANGELOG.md +0 -237
- package/eslint.config.js +0 -2
- package/src/dom/accessibility.js +0 -58
- package/src/dom/actions/index.js +0 -3
- package/src/dom/actions/masonry.js +0 -43
- package/src/dom/actions/prefer-horizontal-scroll.js +0 -121
- package/src/dom/actions/sticky.js +0 -85
- package/src/dom/clipboard.js +0 -14
- package/src/dom/cookie.js +0 -32
- package/src/dom/css-vars.js +0 -19
- package/src/dom/font-size.js +0 -40
- package/src/dom/hash.js +0 -9
- package/src/dom/index.js +0 -23
- package/src/dom/media.js +0 -30
- package/src/dom/observers/index.js +0 -4
- package/src/dom/observers/intersection-observer.js +0 -43
- package/src/dom/observers/mutation-observer.js +0 -51
- package/src/dom/observers/observer.js +0 -18
- package/src/dom/observers/scroll-observer.js +0 -146
- package/src/dom/pkce.js +0 -34
- package/src/dom/query-params.js +0 -14
- package/src/dom/random-string.js +0 -18
- package/src/dom/random-string.test.js +0 -13
- package/src/dom/sanitize.js +0 -16
- package/src/dom/session-store.js +0 -29
- package/src/dom/spam-prevention.js +0 -40
- package/src/dom/trap-focus.js +0 -70
- package/src/dom/ui/aria-current.js +0 -20
- package/src/dom/ui/index.js +0 -4
- package/src/dom/ui/scroll-container.js +0 -25
- package/src/dom/ui/traverse-and-scramble.js +0 -61
- package/src/lib/arrays/index.js +0 -6
- package/src/lib/arrays/shuffle.js +0 -21
- package/src/lib/arrays/sort.js +0 -88
- package/src/lib/arrays/sort.spec.js +0 -123
- package/src/lib/arrays/split-array.js +0 -15
- package/src/lib/arrays/unique.js +0 -3
- package/src/lib/auth/index.js +0 -1
- package/src/lib/auth/route-manager.js +0 -45
- package/src/lib/checks.js +0 -57
- package/src/lib/date/days.js +0 -9
- package/src/lib/date/index.js +0 -3
- package/src/lib/date/months.js +0 -74
- package/src/lib/date/time.js +0 -83
- package/src/lib/form/form-data.js +0 -73
- package/src/lib/form/index.js +0 -2
- package/src/lib/form/sanitize.spec.js +0 -126
- package/src/lib/functions/debounce.js +0 -18
- package/src/lib/functions/env.js +0 -5
- package/src/lib/functions/functional.test.js +0 -196
- package/src/lib/functions/index.js +0 -5
- package/src/lib/functions/throttle.js +0 -11
- package/src/lib/functions/timeout.js +0 -15
- package/src/lib/hash.js +0 -18
- package/src/lib/hash.spec.js +0 -163
- package/src/lib/index.js +0 -14
- package/src/lib/numbers/index.js +0 -12
- package/src/lib/numbers/math.js +0 -9
- package/src/lib/numbers/split-unit.test.js +0 -45
- package/src/lib/objects/camelcase-keys.js +0 -17
- package/src/lib/objects/camelcase-keys.test.js +0 -72
- package/src/lib/objects/empty.js +0 -10
- package/src/lib/objects/equal.js +0 -9
- package/src/lib/objects/extend.js +0 -16
- package/src/lib/objects/extend.test.js +0 -35
- package/src/lib/objects/flatten.js +0 -19
- package/src/lib/objects/index.js +0 -13
- package/src/lib/objects/json.js +0 -7
- package/src/lib/objects/loop.js +0 -11
- package/src/lib/objects/loop.test.js +0 -31
- package/src/lib/objects/mix/mix.js +0 -191
- package/src/lib/objects/mix/mix.md +0 -78
- package/src/lib/objects/mix/mix.test.js +0 -445
- package/src/lib/objects/normalize-object.js +0 -10
- package/src/lib/objects/omit-empty.js +0 -23
- package/src/lib/objects/omit-empty.test.js +0 -85
- package/src/lib/objects/size.js +0 -41
- package/src/lib/objects/split.js +0 -19
- package/src/lib/promises/index.js +0 -1
- package/src/lib/promises/reject.js +0 -17
- package/src/lib/sse.js +0 -61
- package/src/lib/strings/convert-case/convert-case.js +0 -86
- package/src/lib/strings/convert-case/convert-case.md +0 -44
- package/src/lib/strings/convert-case/convert-case.test.js +0 -50
- package/src/lib/strings/index.js +0 -5
- package/src/lib/strings/markdown.js +0 -71
- package/src/lib/strings/markdown.spec.js +0 -73
- package/src/lib/strings/name.js +0 -24
- package/src/lib/strings/name.test.js +0 -67
- package/src/lib/strings/pluralize.js +0 -2
- package/src/lib/strings/query-string.js +0 -18
- package/src/lib/style/index.js +0 -13
- package/src/lib/symbols/index.js +0 -1
- package/src/lib/symbols/symbols.js +0 -9
- package/src/node/dirname.js +0 -17
- package/src/node/file-cache.js +0 -184
- package/src/node/file.js +0 -13
- package/src/node/hash.js +0 -5
- package/src/node/index.js +0 -7
- package/src/node/pkce.js +0 -33
- package/src/node/random-string.js +0 -10
- package/src/node/random-string.test.js +0 -15
- package/src/node/sanitize.spec.js +0 -142
- package/src/node/uuid.js +0 -5
- package/tsconfig.json +0 -23
- package/tsup.config.js +0 -38
- package/tsup.config.mjs +0 -63
- /package/{src/node/context.js → dist/cjs/node/context.cjs} +0 -0
|
@@ -1,106 +1,66 @@
|
|
|
1
|
-
// Returns the target HTMLElement.
|
|
2
|
-
// If the selector is already an HTMLElement, it will return the selector itself.
|
|
3
|
-
// Otherwise, it will return the first element that matches the selector.
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* List of Astro-specific node names that need special handling
|
|
7
|
-
* @type {string[]}
|
|
8
|
-
*/
|
|
9
|
-
const astroNodes = ['ASTRO-SLOT', 'ASTRO-ISLAND']
|
|
10
|
-
|
|
11
1
|
/**
|
|
12
2
|
* Gets the type of a DOM node
|
|
13
3
|
* @param {Node|NodeList|Array} node - The node to check
|
|
14
4
|
* @returns {'element'|'nodelist'|'array'|undefined} The type of the node
|
|
15
5
|
*/
|
|
16
|
-
|
|
17
|
-
if (node instanceof Element) return 'element'
|
|
18
|
-
if (node instanceof NodeList) return 'nodelist'
|
|
19
|
-
if (Array.isArray(node)) return 'array'
|
|
20
|
-
}
|
|
21
|
-
|
|
6
|
+
declare function getNodeType(node: Node | NodeList | any[]): "element" | "nodelist" | "array" | undefined;
|
|
22
7
|
/**
|
|
23
8
|
* Gets an element from a selector or returns the element if it's already an Element
|
|
24
9
|
* @param {string|Element} selector - CSS selector or Element
|
|
25
10
|
* @returns {Element|undefined} The matching element or undefined if not found
|
|
26
|
-
*
|
|
11
|
+
*
|
|
27
12
|
* @example
|
|
28
13
|
* // Get element by selector
|
|
29
14
|
* const button = getElement('.button')
|
|
30
|
-
*
|
|
15
|
+
*
|
|
31
16
|
* // Pass through Element
|
|
32
17
|
* const element = document.querySelector('.button')
|
|
33
18
|
* const sameElement = getElement(element) // Returns element directly
|
|
34
19
|
*/
|
|
35
|
-
|
|
36
|
-
if (!selector) return
|
|
37
|
-
if (selector instanceof Element) return selector
|
|
38
|
-
return document.querySelector(selector)
|
|
39
|
-
}
|
|
40
|
-
|
|
20
|
+
declare function getElement(selector: string | Element): Element | undefined;
|
|
41
21
|
/**
|
|
42
22
|
* Gets all child elements of a node, handling Astro slots
|
|
43
23
|
* @param {Element} node - The parent node
|
|
44
24
|
* @returns {Element[]} Array of child elements
|
|
45
|
-
*
|
|
25
|
+
*
|
|
46
26
|
* @example
|
|
47
27
|
* // Get children of a div
|
|
48
28
|
* const children = getChildrenElements(div)
|
|
49
|
-
*
|
|
29
|
+
*
|
|
50
30
|
* // Works with Astro slots
|
|
51
31
|
* const slotChildren = getChildrenElements(astroSlot)
|
|
52
32
|
*/
|
|
53
|
-
|
|
54
|
-
let children = node.children
|
|
55
|
-
|
|
56
|
-
// Compensate for Astro Slots
|
|
57
|
-
if (children[0]?.nodeName === 'ASTRO-SLOT') children = children[0].children
|
|
58
|
-
return Array.from(children)
|
|
59
|
-
}
|
|
60
|
-
|
|
33
|
+
declare function getChildrenElements(node: Element): Element[];
|
|
61
34
|
/**
|
|
62
35
|
* Gets the parent element, skipping Astro-specific nodes
|
|
63
36
|
* @param {Element} element - The element to get the parent of
|
|
64
37
|
* @returns {Element|null} The parent element, or null if no parent exists
|
|
65
|
-
*
|
|
38
|
+
*
|
|
66
39
|
* @example
|
|
67
40
|
* // Get parent, skipping Astro slots
|
|
68
41
|
* const parent = getParentElement(element)
|
|
69
42
|
*/
|
|
70
|
-
|
|
71
|
-
const parent = element.parentElement
|
|
72
|
-
if (astroNodes.includes(parent.nodeName)) return getParentElement(parent)
|
|
73
|
-
return parent
|
|
74
|
-
}
|
|
75
|
-
|
|
43
|
+
declare function getParentElement(element: Element): Element | null;
|
|
76
44
|
/**
|
|
77
45
|
* Gets all sibling elements of an element (excluding the element itself)
|
|
78
46
|
* @param {Element} element - The element to get siblings of
|
|
79
47
|
* @returns {Element[]} Array of sibling elements
|
|
80
|
-
*
|
|
48
|
+
*
|
|
81
49
|
* @example
|
|
82
50
|
* // Get all siblings of an element
|
|
83
51
|
* const siblings = getSiblingElements(element)
|
|
84
52
|
*/
|
|
85
|
-
|
|
86
|
-
return Array.from(element.parentElement.children).filter(
|
|
87
|
-
child => child !== element
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
53
|
+
declare function getSiblingElements(element: Element): Element[];
|
|
91
54
|
/**
|
|
92
55
|
* Gets the index of an element among its siblings
|
|
93
56
|
* @param {Element} element - The element to get the index of
|
|
94
57
|
* @returns {number} The index of the element (0-based)
|
|
95
|
-
*
|
|
58
|
+
*
|
|
96
59
|
* @example
|
|
97
60
|
* // Get position of element among siblings
|
|
98
61
|
* const index = getSelfIndex(element)
|
|
99
62
|
*/
|
|
100
|
-
|
|
101
|
-
return Array.from(element.parentElement.children).indexOf(element)
|
|
102
|
-
}
|
|
103
|
-
|
|
63
|
+
declare function getSelfIndex(element: Element): number;
|
|
104
64
|
/**
|
|
105
65
|
* Checks if an element is an ancestor of another element
|
|
106
66
|
* @param {Element} ancestor - The potential ancestor element
|
|
@@ -108,69 +68,35 @@ export function getSelfIndex(element) {
|
|
|
108
68
|
* @param {Object} [options] - Options for the search
|
|
109
69
|
* @param {number} [options.searchLevels=0] - Number of levels to search up, 0 for unlimited
|
|
110
70
|
* @returns {boolean} True if ancestor is an ancestor of element
|
|
111
|
-
*
|
|
71
|
+
*
|
|
112
72
|
* @example
|
|
113
73
|
* // Check if div is an ancestor of button
|
|
114
74
|
* const isParent = isAncestor(div, button)
|
|
115
|
-
*
|
|
75
|
+
*
|
|
116
76
|
* // Check if div is an ancestor within 2 levels
|
|
117
77
|
* const isCloseAncestor = isAncestor(div, button, { searchLevels: 2 })
|
|
118
78
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
let parent = element.parentElement
|
|
123
|
-
// Infinite Search
|
|
124
|
-
if (searchLevels === 0) {
|
|
125
|
-
while (parent) {
|
|
126
|
-
if (ancestor === parent) return true
|
|
127
|
-
parent = parent.parentElement
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
// Search X levels upwards
|
|
131
|
-
for (let i = 0; i < searchLevels; i++) {
|
|
132
|
-
if (ancestor === parent) return true
|
|
133
|
-
parent = parent.parentElement
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return false
|
|
138
|
-
}
|
|
139
|
-
|
|
79
|
+
declare function isAncestor(ancestor: Element, element: Element, { searchLevels }?: {
|
|
80
|
+
searchLevels?: number;
|
|
81
|
+
}): boolean;
|
|
140
82
|
/**
|
|
141
83
|
* Gets ancestor elements with their siblings, optionally limiting the search depth.
|
|
142
84
|
* Useful for finding the nearest ancestor that has siblings.
|
|
143
|
-
*
|
|
85
|
+
*
|
|
144
86
|
* @param {Element} element - The element to start searching from
|
|
145
87
|
* @param {Object} [options] - Options for the search
|
|
146
88
|
* @param {number|boolean} [options.limit=false] - Number of levels to search up, or false for unlimited
|
|
147
89
|
* @returns {Element[]|null} Array of sibling elements, or null if none found
|
|
148
|
-
*
|
|
90
|
+
*
|
|
149
91
|
* @example
|
|
150
92
|
* // Get siblings of nearest ancestor that has siblings
|
|
151
93
|
* const ancestorSiblings = getAncestorWithSiblings(element)
|
|
152
|
-
*
|
|
94
|
+
*
|
|
153
95
|
* // Search up to 2 levels
|
|
154
96
|
* const limitedSiblings = getAncestorWithSiblings(element, { limit: 2 })
|
|
155
97
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// Found
|
|
161
|
-
if (siblings.length) return siblings
|
|
162
|
-
|
|
163
|
-
// No more ancestors
|
|
164
|
-
if (!ancestor) return null
|
|
165
|
-
|
|
166
|
-
// Unlimited upwards search
|
|
167
|
-
if (limit === false) return getAncestorWithSiblings(ancestor)
|
|
168
|
-
|
|
169
|
-
// Limited search
|
|
170
|
-
if (typeof limit === 'number' && limit > 0) {
|
|
171
|
-
return getAncestorWithSiblings(ancestor, { limit: limit - 1 })
|
|
172
|
-
}
|
|
98
|
+
declare function getAncestorWithSiblings(element: Element, { limit }?: {
|
|
99
|
+
limit?: number | boolean;
|
|
100
|
+
}): Element[] | null;
|
|
173
101
|
|
|
174
|
-
|
|
175
|
-
if (limit === 0) return null
|
|
176
|
-
}
|
|
102
|
+
export { getAncestorWithSiblings, getChildrenElements, getElement, getNodeType, getParentElement, getSelfIndex, getSiblingElements, isAncestor };
|
|
@@ -0,0 +1,31 @@
|
|
|
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';
|
|
@@ -3,42 +3,30 @@
|
|
|
3
3
|
* @param {KeyboardEvent} event - The keyboard event object
|
|
4
4
|
* @returns {boolean}
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
return !event.shiftKey && event.key === 'Tab'
|
|
8
|
-
}
|
|
9
|
-
|
|
6
|
+
declare function isTab(event: KeyboardEvent): boolean;
|
|
10
7
|
/**
|
|
11
8
|
* Event is shift + Tab
|
|
12
9
|
* @param {KeyboardEvent} event - The keyboard event object
|
|
13
10
|
* @returns {boolean}
|
|
14
11
|
*/
|
|
15
|
-
|
|
16
|
-
return event.shiftKey && event.key === 'Tab'
|
|
17
|
-
}
|
|
18
|
-
|
|
12
|
+
declare function isShiftTab(event: KeyboardEvent): boolean;
|
|
19
13
|
/**
|
|
20
14
|
* Matches both Tab and Shift+Tab
|
|
21
15
|
* @param {string} key - The keyboard key to check
|
|
22
16
|
* @returns {boolean} Whether the key is Tab
|
|
23
17
|
*/
|
|
24
|
-
|
|
25
|
-
return key === 'Tab'
|
|
26
|
-
}
|
|
27
|
-
|
|
18
|
+
declare function isTabKey(key: string): boolean;
|
|
28
19
|
/**
|
|
29
20
|
* Event is an arrow key
|
|
30
21
|
* @param {string} key - The keyboard key to check
|
|
31
22
|
* @returns {boolean} Whether the key is an arrow key (Up, Down, Left, Right)
|
|
32
23
|
*/
|
|
33
|
-
|
|
34
|
-
return ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)
|
|
35
|
-
}
|
|
36
|
-
|
|
24
|
+
declare function isArrowKey(key: string): boolean;
|
|
37
25
|
/**
|
|
38
26
|
* Event is Escape key
|
|
39
27
|
* @param {string} key - The keyboard key to check
|
|
40
28
|
* @returns {boolean} Whether the key is Escape
|
|
41
29
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
30
|
+
declare function isEscapeKey(key: string): boolean;
|
|
31
|
+
|
|
32
|
+
export { isArrowKey, isEscapeKey, isShiftTab, isTab, isTabKey };
|
|
@@ -0,0 +1,31 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
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 };
|
package/{src/dom/observers/resize-observer.js → dist/types/dom/observers/resize-observer.d.cts}
RENAMED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import { dispatchEvent } from '../events.js'
|
|
3
|
-
import { useObserverMethodOnTarget } from './observer.js'
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
2
|
* Creates and manages a ResizeObserver instance to monitor size changes of a target element.
|
|
7
3
|
*
|
|
@@ -35,32 +31,10 @@ import { useObserverMethodOnTarget } from './observer.js'
|
|
|
35
31
|
* console.log('Element resized:', detail.entry.contentRect);
|
|
36
32
|
* });
|
|
37
33
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
target = document.documentElement
|
|
44
|
-
useObserverMethodOnTarget(target, observer, 'observe', opts)
|
|
45
|
-
|
|
46
|
-
function observerFn(entries) {
|
|
47
|
-
for (const entry of entries) {
|
|
48
|
-
if (callback) callback({ entry, entries, observer })
|
|
49
|
-
else
|
|
50
|
-
dispatchEvent(entry.target, 'resize-obs', { entry, entries, observer })
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
observe(target) {
|
|
56
|
-
useObserverMethodOnTarget(target, observer, 'observe', options)
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
unobserve(target) {
|
|
60
|
-
useObserverMethodOnTarget(target, observer, 'unobserve')
|
|
61
|
-
},
|
|
34
|
+
declare function resizeObserver(target: Element | Window | Document | NodeList | Element[], options: {
|
|
35
|
+
observe?: boolean;
|
|
36
|
+
callback?: Function;
|
|
37
|
+
observerOptions?: any;
|
|
38
|
+
}): any;
|
|
62
39
|
|
|
63
|
-
|
|
64
|
-
destroy: _ => observer.disconnect(),
|
|
65
|
-
}
|
|
66
|
-
}
|
|
40
|
+
export { resizeObserver };
|
|
@@ -0,0 +1,40 @@
|
|
|
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random string.
|
|
3
|
+
* Ensures first character is a letter so it can be used in HTML ids and classes
|
|
4
|
+
* This can actually be used everywhere, not just in the browser.
|
|
5
|
+
*/
|
|
6
|
+
declare function randomString(length?: number): string;
|
|
7
|
+
declare function uuid(): `${string}-${string}-${string}-${string}-${string}`;
|
|
8
|
+
|
|
9
|
+
export { randomString, uuid };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitizes values using DOMPurify
|
|
3
|
+
* @param {*} value - Value to sanitize (string, array, or object)
|
|
4
|
+
* @param {Object} [options={}] - DOMPurify options
|
|
5
|
+
* @returns {*} Sanitized value
|
|
6
|
+
* @throws {Error} If input is a string but DOMPurify fails
|
|
7
|
+
*/
|
|
8
|
+
declare function sanitize(value: any, options?: any): any;
|
|
9
|
+
|
|
10
|
+
export { sanitize };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhances a form element with spam detection capabilities
|
|
3
|
+
* @param {HTMLFormElement} form - The form element to enhance
|
|
4
|
+
* @param {Object} [options] - Configuration options
|
|
5
|
+
* @param {string} [options.honeypotField] - Name of the honeypot field (default: 'hp')
|
|
6
|
+
* @param {number} [options.honeypotDuration] - Minimum time in ms for legitimate form fill (default: 2000)
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
declare function preventSpam(form: HTMLFormElement, { honeypotField, honeypotDuration }?: {
|
|
10
|
+
honeypotField?: string;
|
|
11
|
+
honeypotDuration?: number;
|
|
12
|
+
}): void;
|
|
13
|
+
|
|
14
|
+
export { preventSpam };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Focusables } from './focusable.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Traps focus within a set of focusable elements, creating a circular tab order
|
|
5
|
+
* @param {Object} params
|
|
6
|
+
* @param {KeyboardEvent} params.event - The keyboard event to handle
|
|
7
|
+
* @param {import('./focusable.js').Focusables} params.focusables - Object containing focusable elements
|
|
8
|
+
*/
|
|
9
|
+
declare function trapFocus({ event, focusables }: {
|
|
10
|
+
event: KeyboardEvent;
|
|
11
|
+
focusables: Focusables;
|
|
12
|
+
}): void;
|
|
13
|
+
/**
|
|
14
|
+
* Manages focus behavior when tabbing through content, with options to control focus on exit
|
|
15
|
+
* @param {Object} params
|
|
16
|
+
* @param {KeyboardEvent} params.event - The keyboard event to handle
|
|
17
|
+
* @param {HTMLElement} params.triggerNode - Element that triggered the focus trap
|
|
18
|
+
* @param {HTMLElement} params.contentNode - Container element that holds focusable content
|
|
19
|
+
* @param {import('./focusable.js').Focusables} params.focusables - Object containing focusable elements
|
|
20
|
+
* @param {'next'|'trigger'} [params.tabOutFocus='next'] - Where to focus when tabbing out: 'next' element or back to trigger
|
|
21
|
+
* @param {Function} [params.onLeave=()=>{}] - Callback when focus leaves content, receives 'forward' or 'back' direction
|
|
22
|
+
*/
|
|
23
|
+
declare function manageFocus({ event, triggerNode, contentNode, focusables, tabOutFocus, onLeave, }: {
|
|
24
|
+
event: KeyboardEvent;
|
|
25
|
+
triggerNode: HTMLElement;
|
|
26
|
+
contentNode: HTMLElement;
|
|
27
|
+
focusables: Focusables;
|
|
28
|
+
tabOutFocus?: "next" | "trigger";
|
|
29
|
+
onLeave?: Function;
|
|
30
|
+
}): void;
|
|
31
|
+
|
|
32
|
+
export { manageFocus, trapFocus };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function markActiveAnchorIn(container: any, anchorType?: string): any;
|
|
2
|
+
declare function scrollToElement(element: any, { scrollBehaviour, scrollMargin }?: {
|
|
3
|
+
scrollBehaviour?: string;
|
|
4
|
+
scrollMargin?: string;
|
|
5
|
+
}): void;
|
|
6
|
+
|
|
7
|
+
export { markActiveAnchorIn, scrollToElement };
|
package/{src/dom/ui/inconsistent-button-fix.js → dist/types/dom/ui/inconsistent-button-fix.d.cts}
RENAMED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fixes inconsistent button focus behavior across browsers.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* In some browsers (like Firefox), clicking a button doesn't focus it.
|
|
5
5
|
* This function ensures buttons are focused when clicked, making behavior consistent.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* @see {@link https://zellwk.com/blog/inconsistent-button-behavior/|Source}
|
|
8
8
|
* @example
|
|
9
9
|
* // Add the fix to your app
|
|
10
10
|
* inconsistentButtonFix()
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
document.addEventListener('click', event => {
|
|
16
|
-
if (event.target instanceof HTMLButtonElement) {
|
|
17
|
-
event.target.focus()
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
}
|
|
12
|
+
declare function inconsistentButtonFix(): void;
|
|
13
|
+
|
|
14
|
+
export { inconsistentButtonFix };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { markActiveAnchorIn, scrollToElement } from './aria-current.cjs';
|
|
2
|
+
export { inconsistentButtonFix } from './inconsistent-button-fix.cjs';
|
|
3
|
+
export { findScrollContainer } from './scroll-container.cjs';
|
|
4
|
+
export { traverseAndScramble } from './traverse-and-scramble.cjs';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverses a DOM node and scrambles its text content, excluding specified elements.
|
|
3
|
+
* Useful for creating placeholder/loading states or privacy features.
|
|
4
|
+
*
|
|
5
|
+
* @param {Element|ChildNode} node - The root element or node to start traversal from
|
|
6
|
+
* @param {Object} [options] - Options for traversal
|
|
7
|
+
* @param {string[]} [options.excludes=[]] - Array of CSS selectors to exclude from scrambling
|
|
8
|
+
* @example
|
|
9
|
+
* // Scramble all text in a container
|
|
10
|
+
* traverseAndScramble(document.querySelector('.container'))
|
|
11
|
+
*
|
|
12
|
+
* // Scramble text but exclude certain elements
|
|
13
|
+
* traverseAndScramble(document.body, {
|
|
14
|
+
* excludes: ['.no-scramble', '[data-no-scramble]']
|
|
15
|
+
* })
|
|
16
|
+
*/
|
|
17
|
+
declare function traverseAndScramble(node: Element | ChildNode, { excludes }?: {
|
|
18
|
+
excludes?: string[];
|
|
19
|
+
}): void;
|
|
20
|
+
|
|
21
|
+
export { traverseAndScramble };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { isLastItem, last, lastArrayItem } from './item-position.cjs';
|
|
2
|
+
export { joinWithConjunction } from './join.cjs';
|
|
3
|
+
export { shuffle } from './shuffle.cjs';
|
|
4
|
+
export { sort } from './sort.cjs';
|
|
5
|
+
export { splitArray } from './split-array.cjs';
|
|
6
|
+
export { uniqueArray } from './unique.cjs';
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
console.warn('last is deprecated. Use isLastItem instead.')
|
|
3
|
-
return index === array.length - 1
|
|
4
|
-
}
|
|
5
|
-
|
|
1
|
+
declare function last(array: any, index: any): boolean;
|
|
6
2
|
/**
|
|
7
3
|
* Checks if the given index is the last item in the array
|
|
8
4
|
* @param {Array} array - The array to check
|
|
9
5
|
* @param {number} index - The index to check
|
|
10
6
|
* @returns {boolean} True if the index is the last item, false otherwise
|
|
11
7
|
*/
|
|
12
|
-
|
|
13
|
-
return index === array.length - 1
|
|
14
|
-
}
|
|
15
|
-
|
|
8
|
+
declare function isLastItem(array: any[], index: number): boolean;
|
|
16
9
|
/**
|
|
17
10
|
* Returns the last item in the array
|
|
18
11
|
* @param {Array} array - The array to get the last item from
|
|
19
12
|
* @returns {*} The last item in the array
|
|
20
13
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
14
|
+
declare function lastArrayItem(array: any[]): any;
|
|
15
|
+
|
|
16
|
+
export { isLastItem, last, lastArrayItem };
|