@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.
- package/CHANGELOG.md +12 -0
- package/package.json +2 -2
- package/src/dom/actions/masonry.js +1 -0
- package/src/lib/objects/omit-empty.js +1 -1
- package/src/lib/strings/markdown.spec.js +73 -0
- package/src/node/context.js +0 -0
- package/src/node/file-cache.js +1 -1
- package/src/node/pkce.js +1 -1
- package/tsup.config.mjs +19 -1
- package/dist/cjs/dom/accessibility.cjs +0 -51
- package/dist/cjs/dom/actions/index.cjs +0 -25
- package/dist/cjs/dom/actions/masonry.cjs +0 -60
- package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +0 -113
- package/dist/cjs/dom/actions/sticky.cjs +0 -93
- package/dist/cjs/dom/bounding-box.cjs +0 -68
- package/dist/cjs/dom/clipboard.cjs +0 -35
- package/dist/cjs/dom/cookie.cjs +0 -55
- package/dist/cjs/dom/css-vars.cjs +0 -47
- package/dist/cjs/dom/events.cjs +0 -57
- package/dist/cjs/dom/focusable.cjs +0 -141
- package/dist/cjs/dom/font-size.cjs +0 -68
- package/dist/cjs/dom/get-element.cjs +0 -96
- package/dist/cjs/dom/hash.cjs +0 -33
- package/dist/cjs/dom/index.cjs +0 -65
- package/dist/cjs/dom/keyboard.cjs +0 -49
- package/dist/cjs/dom/local-store.cjs +0 -77
- package/dist/cjs/dom/media.cjs +0 -57
- package/dist/cjs/dom/observers/index.cjs +0 -27
- package/dist/cjs/dom/observers/intersection-observer.cjs +0 -59
- package/dist/cjs/dom/observers/mutation-observer.cjs +0 -63
- package/dist/cjs/dom/observers/observer.cjs +0 -38
- package/dist/cjs/dom/observers/resize-observer.cjs +0 -52
- package/dist/cjs/dom/observers/scroll-observer.cjs +0 -118
- package/dist/cjs/dom/pkce.cjs +0 -43
- package/dist/cjs/dom/query-params.cjs +0 -36
- package/dist/cjs/dom/random-string.cjs +0 -36
- package/dist/cjs/dom/sanitize.cjs +0 -41
- package/dist/cjs/dom/session-store.cjs +0 -47
- package/dist/cjs/dom/spam-prevention.cjs +0 -48
- package/dist/cjs/dom/trap-focus.cjs +0 -75
- package/dist/cjs/dom/ui/aria-current.cjs +0 -41
- package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +0 -33
- package/dist/cjs/dom/ui/index.cjs +0 -27
- package/dist/cjs/dom/ui/scroll-container.cjs +0 -45
- package/dist/cjs/dom/ui/traverse-and-scramble.cjs +0 -48
- package/dist/cjs/lib/arrays/index.cjs +0 -31
- package/dist/cjs/lib/arrays/item-position.cjs +0 -40
- package/dist/cjs/lib/arrays/join.cjs +0 -35
- package/dist/cjs/lib/arrays/shuffle.cjs +0 -40
- package/dist/cjs/lib/arrays/sort.cjs +0 -59
- package/dist/cjs/lib/arrays/split-array.cjs +0 -39
- package/dist/cjs/lib/arrays/unique.cjs +0 -29
- package/dist/cjs/lib/auth/index.cjs +0 -21
- package/dist/cjs/lib/auth/route-manager.cjs +0 -49
- package/dist/cjs/lib/checks.cjs +0 -61
- package/dist/cjs/lib/date/days.cjs +0 -35
- package/dist/cjs/lib/date/index.cjs +0 -25
- package/dist/cjs/lib/date/months.cjs +0 -100
- package/dist/cjs/lib/date/time.cjs +0 -105
- package/dist/cjs/lib/form/form-data.cjs +0 -81
- package/dist/cjs/lib/form/index.cjs +0 -23
- package/dist/cjs/lib/form/sanitize.cjs +0 -59
- package/dist/cjs/lib/functions/callback.cjs +0 -29
- package/dist/cjs/lib/functions/debounce.cjs +0 -41
- package/dist/cjs/lib/functions/env.cjs +0 -30
- package/dist/cjs/lib/functions/functional.cjs +0 -80
- package/dist/cjs/lib/functions/index.cjs +0 -29
- package/dist/cjs/lib/functions/throttle.cjs +0 -36
- package/dist/cjs/lib/functions/timeout.cjs +0 -39
- package/dist/cjs/lib/hash.cjs +0 -41
- package/dist/cjs/lib/index.cjs +0 -47
- package/dist/cjs/lib/numbers/index.cjs +0 -36
- package/dist/cjs/lib/numbers/math.cjs +0 -34
- package/dist/cjs/lib/objects/camelcase-keys.cjs +0 -39
- package/dist/cjs/lib/objects/empty.cjs +0 -37
- package/dist/cjs/lib/objects/equal.cjs +0 -45
- package/dist/cjs/lib/objects/extend.cjs +0 -36
- package/dist/cjs/lib/objects/flatten.cjs +0 -40
- package/dist/cjs/lib/objects/index.cjs +0 -45
- package/dist/cjs/lib/objects/json.cjs +0 -33
- package/dist/cjs/lib/objects/loop.cjs +0 -38
- package/dist/cjs/lib/objects/mix/mix.cjs +0 -113
- package/dist/cjs/lib/objects/nested-property.cjs +0 -43
- package/dist/cjs/lib/objects/normalize-object.cjs +0 -32
- package/dist/cjs/lib/objects/omit-empty.cjs +0 -38
- package/dist/cjs/lib/objects/size.cjs +0 -61
- package/dist/cjs/lib/objects/split.cjs +0 -37
- package/dist/cjs/lib/promises/index.cjs +0 -21
- package/dist/cjs/lib/promises/reject.cjs +0 -50
- package/dist/cjs/lib/sse.cjs +0 -74
- package/dist/cjs/lib/strings/convert-case/convert-case.cjs +0 -94
- package/dist/cjs/lib/strings/index.cjs +0 -29
- package/dist/cjs/lib/strings/markdown.cjs +0 -74
- package/dist/cjs/lib/strings/name.cjs +0 -44
- package/dist/cjs/lib/strings/pluralize.cjs +0 -38
- package/dist/cjs/lib/strings/query-string.cjs +0 -41
- package/dist/cjs/lib/style/index.cjs +0 -35
- package/dist/cjs/lib/symbols/index.cjs +0 -21
- package/dist/cjs/lib/symbols/symbols.cjs +0 -36
- package/dist/cjs/node/dirname.cjs +0 -47
- package/dist/cjs/node/file-cache.cjs +0 -158
- package/dist/cjs/node/file.cjs +0 -48
- package/dist/cjs/node/hash.cjs +0 -40
- package/dist/cjs/node/index.cjs +0 -33
- package/dist/cjs/node/pkce.cjs +0 -52
- package/dist/cjs/node/random-string.cjs +0 -41
- package/dist/cjs/node/sanitize.cjs +0 -41
- package/dist/cjs/node/uuid.cjs +0 -40
- package/dist/esm/dom/accessibility.js +0 -26
- package/dist/esm/dom/actions/index.js +0 -3
- package/dist/esm/dom/actions/masonry.js +0 -37
- package/dist/esm/dom/actions/prefer-horizontal-scroll.js +0 -90
- package/dist/esm/dom/actions/sticky.js +0 -70
- package/dist/esm/dom/bounding-box.js +0 -44
- package/dist/esm/dom/clipboard.js +0 -12
- package/dist/esm/dom/cookie.js +0 -31
- package/dist/esm/dom/css-vars.js +0 -21
- package/dist/esm/dom/events.js +0 -31
- package/dist/esm/dom/focusable.js +0 -117
- package/dist/esm/dom/font-size.js +0 -40
- package/dist/esm/dom/get-element.js +0 -66
- package/dist/esm/dom/hash.js +0 -10
- package/dist/esm/dom/index.js +0 -23
- package/dist/esm/dom/keyboard.js +0 -22
- package/dist/esm/dom/local-store.js +0 -54
- package/dist/esm/dom/media.js +0 -32
- package/dist/esm/dom/observers/index.js +0 -4
- package/dist/esm/dom/observers/intersection-observer.js +0 -36
- package/dist/esm/dom/observers/mutation-observer.js +0 -40
- package/dist/esm/dom/observers/observer.js +0 -15
- package/dist/esm/dom/observers/resize-observer.js +0 -29
- package/dist/esm/dom/observers/scroll-observer.js +0 -95
- package/dist/esm/dom/pkce.js +0 -20
- package/dist/esm/dom/query-params.js +0 -13
- package/dist/esm/dom/random-string.js +0 -12
- package/dist/esm/dom/sanitize.js +0 -8
- package/dist/esm/dom/session-store.js +0 -24
- package/dist/esm/dom/spam-prevention.js +0 -25
- package/dist/esm/dom/trap-focus.js +0 -51
- package/dist/esm/dom/ui/aria-current.js +0 -17
- package/dist/esm/dom/ui/inconsistent-button-fix.js +0 -10
- package/dist/esm/dom/ui/index.js +0 -4
- package/dist/esm/dom/ui/scroll-container.js +0 -22
- package/dist/esm/dom/ui/traverse-and-scramble.js +0 -25
- package/dist/esm/lib/arrays/index.js +0 -6
- package/dist/esm/lib/arrays/item-position.js +0 -15
- package/dist/esm/lib/arrays/join.js +0 -12
- package/dist/esm/lib/arrays/shuffle.js +0 -17
- package/dist/esm/lib/arrays/sort.js +0 -36
- package/dist/esm/lib/arrays/split-array.js +0 -16
- package/dist/esm/lib/arrays/unique.js +0 -6
- package/dist/esm/lib/auth/index.js +0 -1
- package/dist/esm/lib/auth/route-manager.js +0 -25
- package/dist/esm/lib/checks.js +0 -34
- package/dist/esm/lib/date/days.js +0 -12
- package/dist/esm/lib/date/index.js +0 -3
- package/dist/esm/lib/date/months.js +0 -77
- package/dist/esm/lib/date/time.js +0 -75
- package/dist/esm/lib/form/form-data.js +0 -57
- package/dist/esm/lib/form/index.js +0 -2
- package/dist/esm/lib/form/sanitize.js +0 -34
- package/dist/esm/lib/functions/callback.js +0 -6
- package/dist/esm/lib/functions/debounce.js +0 -18
- package/dist/esm/lib/functions/env.js +0 -7
- package/dist/esm/lib/functions/functional.js +0 -52
- package/dist/esm/lib/functions/index.js +0 -5
- package/dist/esm/lib/functions/throttle.js +0 -13
- package/dist/esm/lib/functions/timeout.js +0 -14
- package/dist/esm/lib/hash.js +0 -18
- package/dist/esm/lib/index.js +0 -14
- package/dist/esm/lib/numbers/index.js +0 -11
- package/dist/esm/lib/numbers/math.js +0 -10
- package/dist/esm/lib/objects/camelcase-keys.js +0 -16
- package/dist/esm/lib/objects/empty.js +0 -13
- package/dist/esm/lib/objects/equal.js +0 -11
- package/dist/esm/lib/objects/extend.js +0 -13
- package/dist/esm/lib/objects/flatten.js +0 -17
- package/dist/esm/lib/objects/index.js +0 -13
- package/dist/esm/lib/objects/json.js +0 -10
- package/dist/esm/lib/objects/loop.js +0 -14
- package/dist/esm/lib/objects/mix/mix.js +0 -88
- package/dist/esm/lib/objects/nested-property.js +0 -18
- package/dist/esm/lib/objects/normalize-object.js +0 -9
- package/dist/esm/lib/objects/omit-empty.js +0 -15
- package/dist/esm/lib/objects/size.js +0 -38
- package/dist/esm/lib/objects/split.js +0 -14
- package/dist/esm/lib/promises/index.js +0 -1
- package/dist/esm/lib/promises/reject.js +0 -17
- package/dist/esm/lib/sse.js +0 -50
- package/dist/esm/lib/strings/convert-case/convert-case.js +0 -64
- package/dist/esm/lib/strings/index.js +0 -5
- package/dist/esm/lib/strings/markdown.js +0 -40
- package/dist/esm/lib/strings/name.js +0 -21
- package/dist/esm/lib/strings/pluralize.js +0 -5
- package/dist/esm/lib/strings/query-string.js +0 -16
- package/dist/esm/lib/style/index.js +0 -12
- package/dist/esm/lib/symbols/index.js +0 -1
- package/dist/esm/lib/symbols/symbols.js +0 -12
- package/dist/esm/node/dirname.js +0 -13
- package/dist/esm/node/file-cache.js +0 -121
- package/dist/esm/node/file.js +0 -14
- package/dist/esm/node/hash.js +0 -7
- package/dist/esm/node/index.js +0 -7
- package/dist/esm/node/pkce.js +0 -19
- package/dist/esm/node/random-string.js +0 -8
- package/dist/esm/node/sanitize.js +0 -8
- package/dist/esm/node/uuid.js +0 -7
- package/dist/types/dom/accessibility.d.cts +0 -30
- package/dist/types/dom/actions/index.d.cts +0 -3
- package/dist/types/dom/actions/masonry.d.cts +0 -5
- package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +0 -5
- package/dist/types/dom/actions/sticky.d.cts +0 -5
- package/dist/types/dom/bounding-box.d.cts +0 -41
- package/dist/types/dom/clipboard.d.cts +0 -7
- package/dist/types/dom/cookie.d.cts +0 -7
- package/dist/types/dom/css-vars.d.cts +0 -6
- package/dist/types/dom/events.d.cts +0 -92
- package/dist/types/dom/focusable.d.cts +0 -78
- package/dist/types/dom/font-size.d.cts +0 -8
- package/dist/types/dom/get-element.d.cts +0 -102
- package/dist/types/dom/hash.d.cts +0 -3
- package/dist/types/dom/index.d.cts +0 -31
- package/dist/types/dom/keyboard.d.cts +0 -32
- package/dist/types/dom/local-store.d.cts +0 -31
- package/dist/types/dom/media.d.cts +0 -5
- package/dist/types/dom/observers/index.d.cts +0 -4
- package/dist/types/dom/observers/intersection-observer.d.cts +0 -10
- package/dist/types/dom/observers/mutation-observer.d.cts +0 -9
- package/dist/types/dom/observers/observer.d.cts +0 -3
- package/dist/types/dom/observers/resize-observer.d.cts +0 -40
- package/dist/types/dom/observers/scroll-observer.d.cts +0 -40
- package/dist/types/dom/pkce.d.cts +0 -8
- package/dist/types/dom/query-params.d.cts +0 -6
- package/dist/types/dom/random-string.d.cts +0 -9
- package/dist/types/dom/sanitize.d.cts +0 -10
- package/dist/types/dom/session-store.d.cts +0 -7
- package/dist/types/dom/spam-prevention.d.cts +0 -14
- package/dist/types/dom/trap-focus.d.cts +0 -32
- package/dist/types/dom/ui/aria-current.d.cts +0 -7
- package/dist/types/dom/ui/inconsistent-button-fix.d.cts +0 -14
- package/dist/types/dom/ui/index.d.cts +0 -4
- package/dist/types/dom/ui/scroll-container.d.cts +0 -3
- package/dist/types/dom/ui/traverse-and-scramble.d.cts +0 -21
- package/dist/types/lib/arrays/index.d.cts +0 -6
- package/dist/types/lib/arrays/item-position.d.cts +0 -16
- package/dist/types/lib/arrays/join.d.cts +0 -15
- package/dist/types/lib/arrays/shuffle.d.cts +0 -3
- package/dist/types/lib/arrays/sort.d.cts +0 -32
- package/dist/types/lib/arrays/split-array.d.cts +0 -6
- package/dist/types/lib/arrays/unique.d.cts +0 -3
- package/dist/types/lib/auth/index.d.cts +0 -1
- package/dist/types/lib/auth/route-manager.d.cts +0 -28
- package/dist/types/lib/checks.d.cts +0 -33
- package/dist/types/lib/date/days.d.cts +0 -7
- package/dist/types/lib/date/index.d.cts +0 -3
- package/dist/types/lib/date/months.d.cts +0 -11
- package/dist/types/lib/date/time.d.cts +0 -21
- package/dist/types/lib/form/form-data.d.cts +0 -9
- package/dist/types/lib/form/index.d.cts +0 -2
- package/dist/types/lib/form/sanitize.d.cts +0 -60
- package/dist/types/lib/functions/callback.d.cts +0 -8
- package/dist/types/lib/functions/debounce.d.cts +0 -3
- package/dist/types/lib/functions/env.d.cts +0 -3
- package/dist/types/lib/functions/functional.d.cts +0 -72
- package/dist/types/lib/functions/index.d.cts +0 -5
- package/dist/types/lib/functions/throttle.d.cts +0 -3
- package/dist/types/lib/functions/timeout.d.cts +0 -5
- package/dist/types/lib/hash.d.cts +0 -3
- package/dist/types/lib/index.d.cts +0 -43
- package/dist/types/lib/numbers/index.d.cts +0 -5
- package/dist/types/lib/numbers/math.d.cts +0 -4
- package/dist/types/lib/objects/camelcase-keys.d.cts +0 -3
- package/dist/types/lib/objects/empty.d.cts +0 -4
- package/dist/types/lib/objects/equal.d.cts +0 -4
- package/dist/types/lib/objects/extend.d.cts +0 -6
- package/dist/types/lib/objects/flatten.d.cts +0 -6
- package/dist/types/lib/objects/index.d.cts +0 -13
- package/dist/types/lib/objects/json.d.cts +0 -3
- package/dist/types/lib/objects/loop.d.cts +0 -4
- package/dist/types/lib/objects/mix/mix.d.cts +0 -44
- package/dist/types/lib/objects/nested-property.d.cts +0 -24
- package/dist/types/lib/objects/normalize-object.d.cts +0 -3
- package/dist/types/lib/objects/omit-empty.d.cts +0 -3
- package/dist/types/lib/objects/size.d.cts +0 -3
- package/dist/types/lib/objects/split.d.cts +0 -14
- package/dist/types/lib/promises/index.d.cts +0 -1
- package/dist/types/lib/promises/reject.d.cts +0 -5
- package/dist/types/lib/sse.d.cts +0 -18
- package/dist/types/lib/strings/convert-case/convert-case.d.cts +0 -10
- package/dist/types/lib/strings/index.d.cts +0 -5
- package/dist/types/lib/strings/markdown.d.cts +0 -25
- package/dist/types/lib/strings/name.d.cts +0 -7
- package/dist/types/lib/strings/pluralize.d.cts +0 -3
- package/dist/types/lib/strings/query-string.d.cts +0 -10
- package/dist/types/lib/style/index.d.cts +0 -3
- package/dist/types/lib/symbols/index.d.cts +0 -1
- package/dist/types/lib/symbols/symbols.d.cts +0 -4
- package/dist/types/node/dirname.d.cts +0 -9
- package/dist/types/node/file-cache.d.cts +0 -56
- package/dist/types/node/file.d.cts +0 -4
- package/dist/types/node/hash.d.cts +0 -3
- package/dist/types/node/index.d.cts +0 -7
- package/dist/types/node/pkce.d.cts +0 -8
- package/dist/types/node/random-string.d.cts +0 -3
- package/dist/types/node/sanitize.d.cts +0 -10
- package/dist/types/node/uuid.d.cts +0 -3
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|
|
@@ -1,10 +0,0 @@
|
|
|
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 };
|
|
@@ -1,14 +0,0 @@
|
|
|
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 };
|
|
@@ -1,32 +0,0 @@
|
|
|
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 };
|
|
@@ -1,7 +0,0 @@
|
|
|
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 };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fixes inconsistent button focus behavior across browsers.
|
|
3
|
-
*
|
|
4
|
-
* In some browsers (like Firefox), clicking a button doesn't focus it.
|
|
5
|
-
* This function ensures buttons are focused when clicked, making behavior consistent.
|
|
6
|
-
*
|
|
7
|
-
* @see {@link https://zellwk.com/blog/inconsistent-button-behavior/|Source}
|
|
8
|
-
* @example
|
|
9
|
-
* // Add the fix to your app
|
|
10
|
-
* inconsistentButtonFix()
|
|
11
|
-
*/
|
|
12
|
-
declare function inconsistentButtonFix(): void;
|
|
13
|
-
|
|
14
|
-
export { inconsistentButtonFix };
|
|
@@ -1,4 +0,0 @@
|
|
|
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';
|
|
@@ -1,21 +0,0 @@
|
|
|
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 };
|
|
@@ -1,6 +0,0 @@
|
|
|
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,16 +0,0 @@
|
|
|
1
|
-
declare function last(array: any, index: any): boolean;
|
|
2
|
-
/**
|
|
3
|
-
* Checks if the given index is the last item in the array
|
|
4
|
-
* @param {Array} array - The array to check
|
|
5
|
-
* @param {number} index - The index to check
|
|
6
|
-
* @returns {boolean} True if the index is the last item, false otherwise
|
|
7
|
-
*/
|
|
8
|
-
declare function isLastItem(array: any[], index: number): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Returns the last item in the array
|
|
11
|
-
* @param {Array} array - The array to get the last item from
|
|
12
|
-
* @returns {*} The last item in the array
|
|
13
|
-
*/
|
|
14
|
-
declare function lastArrayItem(array: any[]): any;
|
|
15
|
-
|
|
16
|
-
export { isLastItem, last, lastArrayItem };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Joins an array with a conjunction (and/or)
|
|
3
|
-
* @param {Array<string>} array - Array of strings to join
|
|
4
|
-
* @param {Object} [options] - Options for joining
|
|
5
|
-
* @param {string} [options.conjunction='and'] - Conjunction to use ('and' or 'or')
|
|
6
|
-
* @returns {string} Joined string
|
|
7
|
-
* @example
|
|
8
|
-
* joinWithConjunction(['a', 'b', 'c']) // 'a, b, and c'
|
|
9
|
-
* joinWithConjunction(['a', 'b'], { conjunction: 'or' }) // 'a or b'
|
|
10
|
-
*/
|
|
11
|
-
declare function joinWithConjunction(array: Array<string>, { conjunction }?: {
|
|
12
|
-
conjunction?: string;
|
|
13
|
-
}): string;
|
|
14
|
-
|
|
15
|
-
export { joinWithConjunction };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sorts an array of objects, numbers, or strings without mutating the original array.
|
|
3
|
-
* Supports nested properties, multiple sort keys, and various data types.
|
|
4
|
-
*
|
|
5
|
-
* @template T
|
|
6
|
-
* @param {T[]} array - Array to sort
|
|
7
|
-
* @param {Object} [options] - Sort options
|
|
8
|
-
* @param {string|string[]|null} [options.props=null] - Property or array of properties to sort by. If null, sorts simple arrays
|
|
9
|
-
* @param {boolean} [options.reverse=false] - Whether to sort in reverse order
|
|
10
|
-
* @returns {T[]} New sorted array
|
|
11
|
-
* @example
|
|
12
|
-
* // Sort simple array
|
|
13
|
-
* sort([3, 1, 2]) // [1, 2, 3]
|
|
14
|
-
*
|
|
15
|
-
* // Sort objects by single property
|
|
16
|
-
* sort(users, { props: 'name' })
|
|
17
|
-
*
|
|
18
|
-
* // Sort objects by multiple properties
|
|
19
|
-
* sort(users, { props: ['age', 'name'] })
|
|
20
|
-
*
|
|
21
|
-
* // Sort in reverse order
|
|
22
|
-
* sort(users, { props: 'age', reverse: true })
|
|
23
|
-
*
|
|
24
|
-
* // Sort by nested property
|
|
25
|
-
* sort(users, { props: 'address.city' })
|
|
26
|
-
*/
|
|
27
|
-
declare function sort<T>(array: T[], { props, reverse }?: {
|
|
28
|
-
props?: string | string[] | null;
|
|
29
|
-
reverse?: boolean;
|
|
30
|
-
}): T[];
|
|
31
|
-
|
|
32
|
-
export { sort };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AuthManager, RouteManager } from './route-manager.cjs';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
// Usage ... Probably should use either protected or bypass, not both.
|
|
3
|
-
// Maybe ... glob would be a better for this
|
|
4
|
-
@example
|
|
5
|
-
const config = {
|
|
6
|
-
routeConfig: {
|
|
7
|
-
startsWith: ['/dashboard']
|
|
8
|
-
}
|
|
9
|
-
bypassRoutes: {
|
|
10
|
-
is: ['/'],
|
|
11
|
-
startsWith: ['/fonts', '/auth', '/favicon', '/images'],
|
|
12
|
-
includes: ['/meh'],
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const {isProtectedRoute, isBypassRoute} = AuthManager(config)
|
|
16
|
-
if (!isProtectedRoute(context.url.pathname)) return next() // Handle only protected routes
|
|
17
|
-
if (isBypassRoute(context.url.pathname)) return next() // Bypass all non protected routes
|
|
18
|
-
*/
|
|
19
|
-
declare function RouteManager(config: any): {
|
|
20
|
-
isProtectedRoute(pathname: any): any;
|
|
21
|
-
isBypassRoute(pathname: any): any;
|
|
22
|
-
};
|
|
23
|
-
declare function AuthManager(config: any): {
|
|
24
|
-
isProtectedRoute(pathname: any): any;
|
|
25
|
-
isBypassRoute(pathname: any): any;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { AuthManager, RouteManager };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if a value is a plain object (not an array or null)
|
|
3
|
-
* @param {unknown} x - The value to check
|
|
4
|
-
* @returns {boolean} True if the value is a plain object
|
|
5
|
-
* @example
|
|
6
|
-
* isObject({}) // true
|
|
7
|
-
* isObject([]) // false
|
|
8
|
-
* isObject(null) // false
|
|
9
|
-
*/
|
|
10
|
-
declare function isObject(x: unknown): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Checks if a value is an array
|
|
13
|
-
* @param {unknown} x - The value to check
|
|
14
|
-
* @returns {boolean} True if the value is an array
|
|
15
|
-
* @example
|
|
16
|
-
* isArray([]) // true
|
|
17
|
-
* isArray({}) // false
|
|
18
|
-
*/
|
|
19
|
-
declare function isArray(x: unknown): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Checks if a value is not a plain object
|
|
22
|
-
* @param {unknown} x - The value to check
|
|
23
|
-
* @returns {boolean} True if the value is not a plain object
|
|
24
|
-
* @example
|
|
25
|
-
* notObject([]) // true
|
|
26
|
-
* notObject(null) // true
|
|
27
|
-
* notObject({}) // false
|
|
28
|
-
*/
|
|
29
|
-
declare function notObject(x: unknown): boolean;
|
|
30
|
-
declare function getType(x: any): "string" | "integer" | "float" | "boolean" | "function" | "undefined" | "symbol" | "bigint" | "array" | "object" | "unknown";
|
|
31
|
-
declare function isFunction(x: any): boolean;
|
|
32
|
-
|
|
33
|
-
export { getType, isArray, isFunction, isObject, notObject };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a time string to milliseconds
|
|
3
|
-
* @param {string} arg - The time string to convert
|
|
4
|
-
* @returns {number}
|
|
5
|
-
*/
|
|
6
|
-
declare function ms(arg: string): number;
|
|
7
|
-
declare function getTimeInMs(value: any, unit?: string): any;
|
|
8
|
-
declare function toWeeks(ms: any): number;
|
|
9
|
-
declare function toDays(ms: any): number;
|
|
10
|
-
declare function toHours(ms: any): number;
|
|
11
|
-
declare function toMinutes(ms: any): number;
|
|
12
|
-
declare function toSeconds(ms: any): number;
|
|
13
|
-
declare function toReadableTime(ms: any): {
|
|
14
|
-
weeks: number;
|
|
15
|
-
days: number;
|
|
16
|
-
hours: number;
|
|
17
|
-
minutes: number;
|
|
18
|
-
seconds: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { getTimeInMs, ms, toDays, toHours, toMinutes, toReadableTime, toSeconds, toWeeks };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts Form Data into an object
|
|
3
|
-
* @param {FormData} formData
|
|
4
|
-
* @returns Object
|
|
5
|
-
*/
|
|
6
|
-
declare function formDataToObject(formData: FormData): {};
|
|
7
|
-
declare function flattenArrayFields(inputObject: any): {};
|
|
8
|
-
|
|
9
|
-
export { flattenArrayFields, formDataToObject };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} SanitizeOptions
|
|
3
|
-
* @property {Function} [sanitizer] - Function to sanitize strings
|
|
4
|
-
* @property {*} [additional] - Any additional properties are passed through to the sanitizer function
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Core sanitization function that handles different value types.
|
|
8
|
-
* Throws if no sanitizer function is provided.
|
|
9
|
-
* Any additional properties in options are passed through to the sanitizer function.
|
|
10
|
-
*
|
|
11
|
-
* @param {*} value - The value to sanitize
|
|
12
|
-
* @param {SanitizeOptions} [options={}] - Sanitization options
|
|
13
|
-
* @throws {Error} If sanitizer function is not provided
|
|
14
|
-
* @returns {*} Sanitized value
|
|
15
|
-
* @example
|
|
16
|
-
* // Basic sanitization
|
|
17
|
-
* sanitize('hello', { sanitizer: str => str.trim() })
|
|
18
|
-
*
|
|
19
|
-
* // With additional options passed to sanitizer
|
|
20
|
-
* sanitize('hello', {
|
|
21
|
-
* sanitizer: (str, length, char) => str.padEnd(length, char),
|
|
22
|
-
* length: 10,
|
|
23
|
-
* char: '-'
|
|
24
|
-
* })
|
|
25
|
-
*/
|
|
26
|
-
declare function sanitize(value: any, options?: SanitizeOptions): any;
|
|
27
|
-
type SanitizeOptions = {
|
|
28
|
-
/**
|
|
29
|
-
* - Function to sanitize strings
|
|
30
|
-
*/
|
|
31
|
-
sanitizer?: Function;
|
|
32
|
-
/**
|
|
33
|
-
* - Any additional properties are passed through to the sanitizer function
|
|
34
|
-
*/
|
|
35
|
-
additional?: any;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Sanitizes an array by recursively sanitizing each element.
|
|
39
|
-
* Throws if no sanitizer function is provided.
|
|
40
|
-
* Any additional properties in options are passed through to the sanitizer function.
|
|
41
|
-
*
|
|
42
|
-
* @param {Array} arr - Array to sanitize
|
|
43
|
-
* @param {SanitizeOptions} options - Sanitization options
|
|
44
|
-
* @throws {Error} If sanitizer function is not provided
|
|
45
|
-
* @returns {Array} New array with sanitized values
|
|
46
|
-
*/
|
|
47
|
-
declare function sanitizeArray(arr: any[], { sanitizer, ...rest }: SanitizeOptions): any[];
|
|
48
|
-
/**
|
|
49
|
-
* Sanitizes all string values in an object recursively.
|
|
50
|
-
* Throws if no sanitizer function is not provided.
|
|
51
|
-
* Any additional properties in options are passed through to the sanitizer function.
|
|
52
|
-
*
|
|
53
|
-
* @param {Object} obj - Object to sanitize
|
|
54
|
-
* @param {SanitizeOptions} [options={}] - Sanitization options
|
|
55
|
-
* @throws {Error} If sanitizer function is not provided
|
|
56
|
-
* @returns {Object} New object with sanitized values
|
|
57
|
-
*/
|
|
58
|
-
declare function sanitizeObject(obj: any, { sanitizer, ...options }?: SanitizeOptions): any;
|
|
59
|
-
|
|
60
|
-
export { type SanitizeOptions, sanitize, sanitizeArray, sanitizeObject };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safely executes a callback function if it's a function
|
|
3
|
-
* @param {Function|*} fn - The potential callback function
|
|
4
|
-
* @param {...*} data - Data arguments to pass to the callback
|
|
5
|
-
*/
|
|
6
|
-
declare function runCallback(fn: Function | any, ...data: any[]): void;
|
|
7
|
-
|
|
8
|
-
export { runCallback };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a curried version of a function that can be called with partial arguments
|
|
3
|
-
* @param {Function} fn - The function to curry
|
|
4
|
-
* @return {Function} The curried function
|
|
5
|
-
* @property {any} return - The result of calling the original function when all arguments are provided
|
|
6
|
-
* @example
|
|
7
|
-
* const add = (a, b, c) => a + b + c
|
|
8
|
-
* const curriedAdd = curry(add)
|
|
9
|
-
* curriedAdd(1)(2)(3) // 6
|
|
10
|
-
* curriedAdd(1, 2)(3) // 6
|
|
11
|
-
* curriedAdd(1)(2, 3) // 6
|
|
12
|
-
*/
|
|
13
|
-
declare function curry(fn: Function): Function;
|
|
14
|
-
/**
|
|
15
|
-
* Composes functions from right to left (synchronous)
|
|
16
|
-
* @param {...Function} fns - Functions to compose
|
|
17
|
-
* @return {Function} The composed function
|
|
18
|
-
* @property {any} return - The result of applying all functions in sequence
|
|
19
|
-
* @example
|
|
20
|
-
* const add1 = x => x + 1
|
|
21
|
-
* const multiply2 = x => x * 2
|
|
22
|
-
* const composed = compose(add1, multiply2)
|
|
23
|
-
* composed(3) // 7 (3 * 2 + 1)
|
|
24
|
-
*/
|
|
25
|
-
declare function compose(...fns: Function[]): Function;
|
|
26
|
-
/**
|
|
27
|
-
* Composes functions from right to left (asynchronous)
|
|
28
|
-
* @param {...Function} fns - Functions to compose (can be sync or async)
|
|
29
|
-
* @return {Function} The composed async function
|
|
30
|
-
* @property {Promise<any>} return - A Promise that resolves to the result of applying all functions
|
|
31
|
-
* @example
|
|
32
|
-
* const add1 = x => x + 1
|
|
33
|
-
* const multiplyAsync = async x => x * 2
|
|
34
|
-
* await composeAsync(add1, multiplyAsync)(3) // 7 (3 * 2 + 1)
|
|
35
|
-
*/
|
|
36
|
-
declare function composeAsync(...fns: Function[]): Function;
|
|
37
|
-
/**
|
|
38
|
-
* Pipes functions from left to right (synchronous)
|
|
39
|
-
* @param {...Function} fns - Functions to pipe
|
|
40
|
-
* @return {Function} The piped function
|
|
41
|
-
* @property {any} return - The result of applying all functions in sequence
|
|
42
|
-
* @example
|
|
43
|
-
* const add1 = x => x + 1
|
|
44
|
-
* const multiply2 = x => x * 2
|
|
45
|
-
* const piped = pipe(add1, multiply2)
|
|
46
|
-
* piped(3) // 8 (3 + 1) * 2
|
|
47
|
-
*/
|
|
48
|
-
declare function pipe(...fns: Function[]): Function;
|
|
49
|
-
/**
|
|
50
|
-
* Pipes functions from left to right (asynchronous)
|
|
51
|
-
* @param {...Function} fns - Functions to pipe (can be sync or async)
|
|
52
|
-
* @return {Function} The piped async function
|
|
53
|
-
* @property {Promise<any>} return - A Promise that resolves to the result of applying all functions
|
|
54
|
-
* @example
|
|
55
|
-
* const add1 = x => x + 1
|
|
56
|
-
* const multiplyAsync = async x => x * 2
|
|
57
|
-
* await pipeAsync(add1, multiplyAsync)(3) // 8 ((3 + 1) * 2)
|
|
58
|
-
*/
|
|
59
|
-
declare function pipeAsync(...fns: Function[]): Function;
|
|
60
|
-
/**
|
|
61
|
-
* Calls a function n times with the current index and returns an array of results
|
|
62
|
-
* @param {Function} fn - Function to call (receives index as argument)
|
|
63
|
-
* @param {number} n - Number of times to call the function
|
|
64
|
-
* @return {any[]} Array of results from calling the function
|
|
65
|
-
* @property {any[]} return - Array containing the results of each function call
|
|
66
|
-
* @example
|
|
67
|
-
* times(i => i * 2, 3) // [0, 2, 4]
|
|
68
|
-
* times(() => Math.random(), 2) // [0.123, 0.456] (random values)
|
|
69
|
-
*/
|
|
70
|
-
declare function times(fn: Function, n: number): any[];
|
|
71
|
-
|
|
72
|
-
export { compose, composeAsync, curry, pipe, pipeAsync, times };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { debounce } from './debounce.cjs';
|
|
2
|
-
export { getEnv } from './env.cjs';
|
|
3
|
-
export { compose, composeAsync, curry, pipe, pipeAsync, times } from './functional.cjs';
|
|
4
|
-
export { throttle } from './throttle.cjs';
|
|
5
|
-
export { delay, timeout, wait } from './timeout.cjs';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export { isLastItem, last, lastArrayItem } from './arrays/item-position.cjs';
|
|
2
|
-
export { joinWithConjunction } from './arrays/join.cjs';
|
|
3
|
-
export { shuffle } from './arrays/shuffle.cjs';
|
|
4
|
-
export { sort } from './arrays/sort.cjs';
|
|
5
|
-
export { splitArray } from './arrays/split-array.cjs';
|
|
6
|
-
export { uniqueArray } from './arrays/unique.cjs';
|
|
7
|
-
export { AuthManager, RouteManager } from './auth/route-manager.cjs';
|
|
8
|
-
export { getType, isArray, isFunction, isObject, notObject } from './checks.cjs';
|
|
9
|
-
export { DAYS } from './date/days.cjs';
|
|
10
|
-
export { MONTHS } from './date/months.cjs';
|
|
11
|
-
export { getTimeInMs, ms, toDays, toHours, toMinutes, toReadableTime, toSeconds, toWeeks } from './date/time.cjs';
|
|
12
|
-
export { flattenArrayFields, formDataToObject } from './form/form-data.cjs';
|
|
13
|
-
export { SanitizeOptions, sanitize, sanitizeArray, sanitizeObject } from './form/sanitize.cjs';
|
|
14
|
-
export { debounce } from './functions/debounce.cjs';
|
|
15
|
-
export { getEnv } from './functions/env.cjs';
|
|
16
|
-
export { compose, composeAsync, curry, pipe, pipeAsync, times } from './functions/functional.cjs';
|
|
17
|
-
export { throttle } from './functions/throttle.cjs';
|
|
18
|
-
export { delay, timeout, wait } from './functions/timeout.cjs';
|
|
19
|
-
export { isHashedValue } from './hash.cjs';
|
|
20
|
-
export { splitUnit } from './numbers/index.cjs';
|
|
21
|
-
export { camelCaseKeys } from './objects/camelcase-keys.cjs';
|
|
22
|
-
export { isEmpty, notEmpty } from './objects/empty.cjs';
|
|
23
|
-
export { isEqual, notEqual } from './objects/equal.cjs';
|
|
24
|
-
export { extendObject } from './objects/extend.cjs';
|
|
25
|
-
export { flattenObject } from './objects/flatten.cjs';
|
|
26
|
-
export { parseJSON } from './objects/json.cjs';
|
|
27
|
-
export { objectForEach, objectMap } from './objects/loop.cjs';
|
|
28
|
-
export { concatMix, createMix, mix } from './objects/mix/mix.cjs';
|
|
29
|
-
export { getNestedProperty, getNestedProperty2, getNestedValue } from './objects/nested-property.cjs';
|
|
30
|
-
export { normalizeObject } from './objects/normalize-object.cjs';
|
|
31
|
-
export { omitEmpty } from './objects/omit-empty.cjs';
|
|
32
|
-
export { sizeOf } from './objects/size.cjs';
|
|
33
|
-
export { splitObject } from './objects/split.cjs';
|
|
34
|
-
export { reject } from './promises/reject.cjs';
|
|
35
|
-
export { createSSE, parseSSE } from './sse.cjs';
|
|
36
|
-
export { toCamel, toKebab, toLower, toPascal, toSentence, toSlug, toTitle, toUpper } from './strings/convert-case/convert-case.cjs';
|
|
37
|
-
export { markdown, treatMarkdownWhitespace } from './strings/markdown.cjs';
|
|
38
|
-
export { parseFullName } from './strings/name.cjs';
|
|
39
|
-
export { pluralize } from './strings/pluralize.cjs';
|
|
40
|
-
export { plural, stripNumbers, toQueryString } from './strings/query-string.cjs';
|
|
41
|
-
export { toStyleString } from './style/index.cjs';
|
|
42
|
-
export { getSymbol, getSymbolValue } from './symbols/symbols.cjs';
|
|
43
|
-
export { toDegrees, toRadians } from './numbers/math.cjs';
|