@t007/utils 0.0.32 → 0.0.34
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/{arrowNavigation-VenvPI4H.d.ts → arrowNavigation-DF7ul3A3.d.ts} +1 -1
- package/dist/{arrowNavigation-DK8mqVOk.d.cts → arrowNavigation-IaWiNTa6.d.cts} +1 -1
- package/dist/{chunk-4O76EZJ4.js → chunk-HGUYOV3P.js} +127 -21
- package/dist/{chunk-QJ72EQCJ.js → chunk-ZRCBB5P4.js} +9 -6
- package/dist/components/react.d.cts +1 -1
- package/dist/components/react.d.ts +1 -1
- package/dist/hooks/react.cjs +26 -22
- package/dist/hooks/react.d.cts +4 -4
- package/dist/hooks/react.d.ts +4 -4
- package/dist/hooks/react.js +2 -2
- package/dist/hooks/vanilla.cjs +22 -18
- package/dist/hooks/vanilla.d.cts +10 -10
- package/dist/hooks/vanilla.d.ts +10 -10
- package/dist/hooks/vanilla.js +2 -2
- package/dist/index.cjs +136 -20
- package/dist/index.d.cts +131 -12
- package/dist/index.d.ts +131 -12
- package/dist/index.js +23 -3
- package/dist/{ripple-C5MfEErC.d.cts → ripple-87VO-U7A.d.cts} +25 -24
- package/dist/{ripple-C5MfEErC.d.ts → ripple-87VO-U7A.d.ts} +25 -24
- package/dist/{scrollAssist-y9wFmYgt.d.cts → scrollAssist-l0V2H-jx.d.cts} +20 -20
- package/dist/{scrollAssist-y9wFmYgt.d.ts → scrollAssist-l0V2H-jx.d.ts} +20 -20
- package/dist/{useHighlight-DMpDCILK.d.cts → useHighlight-DYc_GF0R.d.cts} +2 -2
- package/dist/{useHighlight-DMpDCILK.d.ts → useHighlight-DYc_GF0R.d.ts} +2 -2
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { A as ArrowNavigationHandle } from './arrowNavigation-
|
|
2
|
-
import { S as ScrollAssistHandle } from './scrollAssist-
|
|
1
|
+
import { A as ArrowNavigationHandle } from './arrowNavigation-DF7ul3A3.js';
|
|
2
|
+
import { S as ScrollAssistHandle } from './scrollAssist-l0V2H-jx.js';
|
|
3
3
|
export { NIL, NOOP } from 'sia-reactor';
|
|
4
|
-
export { KeyStruct, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getActiveEl, getTermsForKey, guardAllMethods, guardMethod, isObj, keyEventAllowed,
|
|
4
|
+
export { KEYS_BLOCKS, KeyStruct, KeysSettings, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getActiveEl, getTermsForKey, guardAllMethods, guardMethod, isObj, keyEventAllowed, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent } from 'sia-reactor/utils';
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
7
|
interface T007Namespace {
|
|
8
8
|
/** Symbol used to mark virtual resources that should not load a real asset. */
|
|
9
9
|
VIRTUAL_RESOURCE: symbol;
|
|
10
10
|
_resourceCache: Partial<Record<string, Promise<HTMLElement | void>>>;
|
|
11
|
+
_throttlers?: Map<string, number>;
|
|
12
|
+
_debouncers?: Map<string, number>;
|
|
13
|
+
_RAFLoopers?: Map<string, Function>;
|
|
11
14
|
_ftrappers?: WeakMap<HTMLElement, () => void>;
|
|
12
15
|
_outsiders?: WeakMap<HTMLElement, () => void>;
|
|
13
16
|
_arrownavs?: WeakMap<HTMLElement, ArrowNavigationHandle>;
|
|
@@ -37,6 +40,27 @@ declare global {
|
|
|
37
40
|
var t007: T007Namespace;
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
type TitleCase<S extends string> = S extends `${infer First}${infer Rest}`
|
|
44
|
+
? `${Uppercase<First>}${Rest}`
|
|
45
|
+
: S;
|
|
46
|
+
|
|
47
|
+
type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}`
|
|
48
|
+
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
|
|
49
|
+
: S extends `${infer P1}-${infer P2}${infer P3}`
|
|
50
|
+
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
|
|
51
|
+
: S extends `${infer P1} ${infer P2}${infer P3}`
|
|
52
|
+
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
|
|
53
|
+
: Lowercase<S>;
|
|
54
|
+
|
|
55
|
+
type NoCamelCase<
|
|
56
|
+
S extends string,
|
|
57
|
+
Sep extends string = " "
|
|
58
|
+
> = S extends `${infer First}${infer Rest}`
|
|
59
|
+
? First extends Uppercase<First>
|
|
60
|
+
? `${Sep}${Lowercase<First>}${NoCamelCase<Rest, Sep>}`
|
|
61
|
+
: `${First}${NoCamelCase<Rest, Sep>}`
|
|
62
|
+
: S;
|
|
63
|
+
|
|
40
64
|
declare function isDef(val: any): boolean;
|
|
41
65
|
declare function isSym<T extends symbol = symbol>(val: any): val is T;
|
|
42
66
|
declare function isBool<T extends boolean = boolean>(val: any): val is T;
|
|
@@ -49,20 +73,52 @@ declare function isIter<T = unknown>(obj: any): obj is Iterable<T>;
|
|
|
49
73
|
declare function isFunc<T extends Function = Function>(val: any): val is T;
|
|
50
74
|
declare function inBoolArrOpt(opt: any, str: string): boolean;
|
|
51
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Finds the longest increasing subsequence in an array of numbers.
|
|
78
|
+
* @param array The input array of numbers
|
|
79
|
+
* @returns An array of indices representing the longest increasing subsequence
|
|
80
|
+
*/
|
|
81
|
+
declare function longestIncreasingSubsequence(array: number[]): number[];
|
|
82
|
+
|
|
52
83
|
/** Create a short unique string with an optional prefix.
|
|
53
84
|
* @param prefix Prefix added to the generated id.
|
|
54
85
|
* @returns A browser-safe unique id string.
|
|
55
86
|
*/
|
|
56
87
|
declare function uid(prefix?: string): string;
|
|
88
|
+
/** Capitalize the first letter of a string, leaving the rest unchanged.
|
|
89
|
+
* @param word The string to capitalize.
|
|
90
|
+
* @returns The input string with the first letter capitalized.
|
|
91
|
+
*/
|
|
92
|
+
declare function capitalize<T extends string>(word?: T): TitleCase<T>;
|
|
93
|
+
/** Convert a string to camelCase by removing separators and capitalizing subsequent words.
|
|
94
|
+
* @param str The input string to convert.
|
|
95
|
+
* @param options.source A regex or string defining word separators. @default whitespace, underscores, and hyphens (`[\s_-]+`).
|
|
96
|
+
* @param options.preserveInnerCase If true, preserves the original casing of letters; if false, converts the entire string to lowercase before processing. @default `true`.
|
|
97
|
+
* @param options.upperFirst If true, capitalizes the first letter of the resulting string (PascalCase); if false, lowercases the first letter (camelCase). @default `false`.
|
|
98
|
+
* @returns The camelCase version of the input string.
|
|
99
|
+
*/
|
|
100
|
+
declare function camelize<T extends string>(str?: T, { source }?: RegExp, { preserveInnerCase: pIC, upperFirst: uF }?: {
|
|
101
|
+
preserveInnerCase?: boolean | undefined;
|
|
102
|
+
upperFirst?: boolean | undefined;
|
|
103
|
+
}): CamelCase<T>;
|
|
104
|
+
/** Convert a camelCase or PascalCase string to a separator-based format (e.g. "helloWorld" to "hello-world").
|
|
105
|
+
* @param str The camelCase or PascalCase string to convert.
|
|
106
|
+
* @param separator The string to insert between words. @default a hyphen ("-").
|
|
107
|
+
* @returns The uncamelized version of the input string with separators.
|
|
108
|
+
* @example
|
|
109
|
+
* uncamelize("helloWorld") // "hello-world"
|
|
110
|
+
* uncamelize("HelloWorld", "_") // "hello_world"
|
|
111
|
+
*/
|
|
112
|
+
declare function uncamelize<T extends string, S extends string = " ">(str: T, separator?: S): NoCamelCase<T, S>;
|
|
57
113
|
/** Convert a rem value to pixels based on the font size of a given element.
|
|
58
114
|
* @param rem The rem value to convert.
|
|
59
|
-
* @param el The element to use for font size reference.
|
|
115
|
+
* @param el The element to use for font size reference. @default the root element.
|
|
60
116
|
* @returns The equivalent pixel value.
|
|
61
117
|
*/
|
|
62
118
|
declare function remToPx(rem: number, el?: HTMLElement): number;
|
|
63
119
|
/** Convert a pixel value to rem based on the font size of a given element.
|
|
64
120
|
* @param px The pixel value to convert.
|
|
65
|
-
* @param el The element to use for font size reference.
|
|
121
|
+
* @param el The element to use for font size reference. @default the root element.
|
|
66
122
|
* @returns The equivalent rem value.
|
|
67
123
|
*/
|
|
68
124
|
declare function pxToRem(px: number, el?: HTMLElement): number;
|
|
@@ -73,7 +129,7 @@ declare function pxToRem(px: number, el?: HTMLElement): number;
|
|
|
73
129
|
declare function parseCSSTime(time: any): number;
|
|
74
130
|
/** Parse a CSS size value (i.e. "16px" or "1.5rem") into pixels.
|
|
75
131
|
* @param size The CSS size string to parse.
|
|
76
|
-
* @param el The element to use for rem reference if needed.
|
|
132
|
+
* @param el The element to use for rem reference if needed. @default the root element.
|
|
77
133
|
* @returns The equivalent value in pixels.
|
|
78
134
|
*/
|
|
79
135
|
declare function parseCSSSize(size: any, el?: HTMLElement): number;
|
|
@@ -89,6 +145,38 @@ declare function cleanURL(url: string): string;
|
|
|
89
145
|
*/
|
|
90
146
|
declare function isSameURL(url1: unknown, url2: unknown): boolean;
|
|
91
147
|
|
|
148
|
+
/** Throttles a function, ensuring it's only called once within a specified delay period.
|
|
149
|
+
* @param key Unique identifier for the throttled function, used to track its last execution time.
|
|
150
|
+
* @param fn Function to be throttled.
|
|
151
|
+
* @param delay Time in milliseconds to wait before allowing the function to be called again. @default `30ms`.
|
|
152
|
+
* @param strict If `true`, exact timestamp difference between calls will be used else a `setTimeout()` will clear the throttle, allowing for more thread leniency. @default `true`.
|
|
153
|
+
* @param signal Optional `AbortSignal` to automatically clear the throttle when aborted.
|
|
154
|
+
* @param win Optional `Window` object for scheduling the throttle timeout, useful for testing or if running in a non-browser environment.
|
|
155
|
+
*/
|
|
156
|
+
declare function throttle(key: string, fn: Function, delay?: number, strict?: ((fn: Function) => number) | boolean, signal?: AbortSignal, win?: Window): void;
|
|
157
|
+
/** Debounces a function, ensuring it's only called after a quiet period of no further calls.
|
|
158
|
+
* @param key Unique identifier for the debounced function, used to track pending calls.
|
|
159
|
+
* @param fn Function to be debounced.
|
|
160
|
+
* @param delay Time in milliseconds to wait after the latest call before invoking the function. @default `30ms`.
|
|
161
|
+
* @param strict If `true`, exact timestamp difference between calls will be used else pending timeout is reset each call for practical thread leniency. @default `true`.
|
|
162
|
+
* @param signal Optional `AbortSignal` to automatically clear scheduled debounce execution when aborted.
|
|
163
|
+
* @param win Optional `Window` object for scheduling/clearing the debounce timeout, useful for testing or if running in a non-browser environment.
|
|
164
|
+
*/
|
|
165
|
+
declare function debounce(key: string, fn: Function, delay?: number, strict?: boolean, signal?: AbortSignal, win?: Window): void;
|
|
166
|
+
/** Creates a loop using `requestAnimationFrame`, allowing for efficient execution of a function on every frame.
|
|
167
|
+
* @param key Unique identifier for the loop, used to manage its execution and allow for updates or cancellation.
|
|
168
|
+
* @param fn Function to be executed on every frame.
|
|
169
|
+
* @param signal Optional `AbortSignal` to automatically cancel the loop when aborted.
|
|
170
|
+
* @param win Optional `Window` object for scheduling the animation frame, useful for testing or if running in a non-browser environment.
|
|
171
|
+
*
|
|
172
|
+
* Game-like loops will be our lil secret... ~ "The Smoooth Criminal" :)
|
|
173
|
+
*/
|
|
174
|
+
declare function RAFLoop(key: string, fn: Function, signal?: AbortSignal, win?: Window & typeof globalThis): void;
|
|
175
|
+
/** Cancels a loop created by `RAFLoop`.
|
|
176
|
+
* @param key Unique identifier for the loop to be cancelled.
|
|
177
|
+
* @returns True if the loop was successfully cancelled, false if no loop with the given key exists.
|
|
178
|
+
*/
|
|
179
|
+
declare const cancelRAFLoop: (key: string) => boolean;
|
|
92
180
|
interface LimitedOptions {
|
|
93
181
|
/** Storage key used to persist call counts. */
|
|
94
182
|
key?: string;
|
|
@@ -137,7 +225,7 @@ declare const deepBreath: (w?: Window & typeof globalThis) => Promise<unknown>;
|
|
|
137
225
|
declare function bindCleanupToSignal<Cb extends () => any>(cleanup: Cb, signal?: AbortSignal): Cb;
|
|
138
226
|
|
|
139
227
|
/** Exhaustive Selector used for interactive, tabbable UI controls. */
|
|
140
|
-
declare const INTERACTIVE_SELECTOR = ":is(button,[href],input:not([type='hidden']),select,textarea,details>summary,[contenteditable
|
|
228
|
+
declare const INTERACTIVE_SELECTOR = ":is(button,[href],input:not([type='hidden']),select,textarea,details>summary,[contenteditable],iframe,audio[controls],video[controls],[tabindex]):not([disabled],[tabindex='-1'],[data-focus-guard],[inert],[inert] *)";
|
|
141
229
|
/** Check whether an event target points to an interactive element. */
|
|
142
230
|
declare const isInteractive: (target: EventTarget | null) => boolean;
|
|
143
231
|
/** Resource type accepted by loadResource. */
|
|
@@ -169,16 +257,47 @@ declare const VIRTUAL_RESOURCE: symbol;
|
|
|
169
257
|
* @param req Resource URL or virtual resource symbol.
|
|
170
258
|
* @param type Resource type to load.
|
|
171
259
|
* @param options Resource loading options.
|
|
172
|
-
* @param
|
|
260
|
+
* @param win Window-like target used for DOM insertion.
|
|
173
261
|
* @returns Promise resolving to the created element or void.
|
|
174
262
|
*/
|
|
175
|
-
declare function loadResource(req: string | symbol, type?: ResourceType, { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts, retryKey }?: LoadResourceOptions,
|
|
263
|
+
declare function loadResource(req: string | symbol, type?: ResourceType, { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts, retryKey }?: LoadResourceOptions, win?: Window & typeof globalThis): Promise<HTMLElement | void>;
|
|
176
264
|
|
|
177
265
|
/** Get the window object associated with a given element.
|
|
178
266
|
* @param el The element to get the window for, defaults to the main window.
|
|
179
|
-
* @returns The
|
|
267
|
+
* @returns The `Window` object or undefined if none found.
|
|
268
|
+
*/
|
|
269
|
+
declare function getWindow(el?: any): Window & typeof globalThis;
|
|
270
|
+
/** Options for configuring a list renderer */
|
|
271
|
+
type ListRendererOptions<T> = {
|
|
272
|
+
/** The container element to render the list into */
|
|
273
|
+
container: HTMLElement;
|
|
274
|
+
/** Function to extract a unique key from each item.
|
|
275
|
+
* @param item The item to extract the key from
|
|
276
|
+
* @returns A unique string key for the item
|
|
277
|
+
*/
|
|
278
|
+
getKey: (item: T) => string;
|
|
279
|
+
/** Function to create a DOM node for an item.
|
|
280
|
+
* @param item The item to create a node for
|
|
281
|
+
* @returns An HTMLElement representing the item, or null/undefined to skip rendering
|
|
282
|
+
*/
|
|
283
|
+
createNode: (item: T) => HTMLElement | null | undefined;
|
|
284
|
+
/** Optional function to update an existing node with new item data, called when an item is reused.
|
|
285
|
+
* @param node The existing DOM node for the item
|
|
286
|
+
* @param item The new item data to update the node with
|
|
287
|
+
*/
|
|
288
|
+
updateNode?: (node: HTMLElement, item: T) => void;
|
|
289
|
+
/** Optional function to clean up a DOM node when an item is removed, called before the node is removed from the DOM.
|
|
290
|
+
* @param node The DOM node to be removed
|
|
291
|
+
* @param key The unique key of the item associated with the node
|
|
292
|
+
*/
|
|
293
|
+
destroyNode?: (node: HTMLElement, key: string) => void;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Creates a list renderer function for efficiently updating a DOM list based on a new array of items using the L.I.S(Longest Increasing Subsequence) algorithm.
|
|
297
|
+
* @param param0 The options for configuring the list renderer
|
|
298
|
+
* @returns A function that synchronizes the DOM with the new array of items
|
|
180
299
|
*/
|
|
181
|
-
declare function
|
|
300
|
+
declare function createListRenderer<T>({ container, getKey, createNode, updateNode, destroyNode }: ListRendererOptions<T>): (array: T[], strict?: boolean) => void;
|
|
182
301
|
|
|
183
302
|
/** Format a file size for display.
|
|
184
303
|
* @param size Size in bytes.
|
|
@@ -188,4 +307,4 @@ declare function getWindow(el?: any): (Window & typeof globalThis) | undefined;
|
|
|
188
307
|
*/
|
|
189
308
|
declare function formatSize(bytes: number, decimals?: number, base?: number): string;
|
|
190
309
|
|
|
191
|
-
export { INTERACTIVE_SELECTOR, type LimitedHandle, type LimitedOptions, type LoadResourceOptions, type ResourceType, VIRTUAL_RESOURCE, bindCleanupToSignal, breath, cleanURL, deepBreath, formatSize, getWindow, inBoolArrOpt, isArr, isBool, isDef, isFunc, isInteractive, isIter, isNum, isPOJO, isSameURL, isStr, isSym, limited, loadResource, mockAsync, parseCSSSize, parseCSSTime, pxToRem, remToPx, uid };
|
|
310
|
+
export { type CamelCase, INTERACTIVE_SELECTOR, type LimitedHandle, type LimitedOptions, type ListRendererOptions, type LoadResourceOptions, type NoCamelCase, RAFLoop, type ResourceType, type TitleCase, VIRTUAL_RESOURCE, bindCleanupToSignal, breath, camelize, cancelRAFLoop, capitalize, cleanURL, createListRenderer, debounce, deepBreath, formatSize, getWindow, inBoolArrOpt, isArr, isBool, isDef, isFunc, isInteractive, isIter, isNum, isPOJO, isSameURL, isStr, isSym, limited, loadResource, longestIncreasingSubsequence, mockAsync, parseCSSSize, parseCSSTime, pxToRem, remToPx, throttle, uid, uncamelize };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
INTERACTIVE_SELECTOR,
|
|
3
|
+
KEYS_BLOCKS,
|
|
3
4
|
NIL,
|
|
4
5
|
NOOP,
|
|
6
|
+
RAFLoop,
|
|
5
7
|
VIRTUAL_RESOURCE,
|
|
6
8
|
assignEl,
|
|
7
9
|
bindAllMethods,
|
|
8
10
|
bindCleanupToSignal,
|
|
9
11
|
breath,
|
|
12
|
+
camelize,
|
|
13
|
+
cancelRAFLoop,
|
|
14
|
+
capitalize,
|
|
10
15
|
clamp,
|
|
11
16
|
cleanKeyCombo,
|
|
12
17
|
cleanURL,
|
|
13
18
|
createEl,
|
|
19
|
+
createListRenderer,
|
|
20
|
+
debounce,
|
|
14
21
|
deepBreath,
|
|
15
22
|
formatKeyForDisplay,
|
|
16
23
|
formatKeyShortcutsForDisplay,
|
|
@@ -36,6 +43,7 @@ import {
|
|
|
36
43
|
keyEventAllowed,
|
|
37
44
|
limited,
|
|
38
45
|
loadResource,
|
|
46
|
+
longestIncreasingSubsequence,
|
|
39
47
|
matchKeys,
|
|
40
48
|
mockAsync,
|
|
41
49
|
onAllMethods,
|
|
@@ -49,21 +57,30 @@ import {
|
|
|
49
57
|
setInterval,
|
|
50
58
|
setTimeout,
|
|
51
59
|
stringifyKeyEvent,
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
throttle,
|
|
61
|
+
uid,
|
|
62
|
+
uncamelize
|
|
63
|
+
} from "./chunk-HGUYOV3P.js";
|
|
54
64
|
export {
|
|
55
65
|
INTERACTIVE_SELECTOR,
|
|
66
|
+
KEYS_BLOCKS,
|
|
56
67
|
NIL,
|
|
57
68
|
NOOP,
|
|
69
|
+
RAFLoop,
|
|
58
70
|
VIRTUAL_RESOURCE,
|
|
59
71
|
assignEl,
|
|
60
72
|
bindAllMethods,
|
|
61
73
|
bindCleanupToSignal,
|
|
62
74
|
breath,
|
|
75
|
+
camelize,
|
|
76
|
+
cancelRAFLoop,
|
|
77
|
+
capitalize,
|
|
63
78
|
clamp,
|
|
64
79
|
cleanKeyCombo,
|
|
65
80
|
cleanURL,
|
|
66
81
|
createEl,
|
|
82
|
+
createListRenderer,
|
|
83
|
+
debounce,
|
|
67
84
|
deepBreath,
|
|
68
85
|
formatKeyForDisplay,
|
|
69
86
|
formatKeyShortcutsForDisplay,
|
|
@@ -89,6 +106,7 @@ export {
|
|
|
89
106
|
keyEventAllowed,
|
|
90
107
|
limited,
|
|
91
108
|
loadResource,
|
|
109
|
+
longestIncreasingSubsequence,
|
|
92
110
|
matchKeys,
|
|
93
111
|
mockAsync,
|
|
94
112
|
onAllMethods,
|
|
@@ -102,5 +120,7 @@ export {
|
|
|
102
120
|
setInterval,
|
|
103
121
|
setTimeout,
|
|
104
122
|
stringifyKeyEvent,
|
|
105
|
-
|
|
123
|
+
throttle,
|
|
124
|
+
uid,
|
|
125
|
+
uncamelize
|
|
106
126
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
interface OutsideClickConfig {
|
|
2
|
-
/** Enables or disables outside-click handling.
|
|
2
|
+
/** Enables or disables outside-click handling. @default `false`. */
|
|
3
3
|
enabled?: boolean;
|
|
4
|
-
/** Callback invoked when an outside interaction is detected.
|
|
4
|
+
/** Callback invoked when an outside interaction is detected. @default `()=>{}`. */
|
|
5
5
|
onOutside?: (e: MouseEvent | TouchEvent | KeyboardEvent | FocusEvent) => void;
|
|
6
|
-
/** Whether pointer/touch outside interactions should trigger callback.
|
|
6
|
+
/** Whether pointer/touch outside interactions should trigger callback. @default `true`. */
|
|
7
7
|
outOnClick?: boolean;
|
|
8
|
-
/** Whether Escape key should trigger callback.
|
|
8
|
+
/** Whether Escape key should trigger callback. @default `true`. */
|
|
9
9
|
outOnEscape?: boolean;
|
|
10
|
-
/** Whether focus leaving the container should trigger callback.
|
|
10
|
+
/** Whether focus leaving the container should trigger callback. @default `false`. */
|
|
11
11
|
outOnFocusOut?: boolean;
|
|
12
|
-
/** Allow only clicks inside `el` bounding client rectangle to be considered valid, otherwise uses `el.contains(target)`.
|
|
12
|
+
/** Allow only clicks inside `el` bounding client rectangle to be considered valid, otherwise uses `el.contains(target)`. @default `false . */
|
|
13
13
|
allowBounds?: boolean;
|
|
14
|
-
/** Allow interactive elements including outsiders to bypass click callback.
|
|
14
|
+
/** Allow interactive elements including outsiders to bypass click callback. @default `false`. */
|
|
15
15
|
allowInputs?: boolean;
|
|
16
|
-
/** Optional root used to scope focus listeners to an element instead of the window.
|
|
16
|
+
/** Optional root used to scope focus listeners to an element instead of the window. @default `window`. */
|
|
17
17
|
root?: HTMLElement | Document | Window;
|
|
18
|
-
/** Whether the outside click handling is scoped to the root provided it is an HTMLElement.
|
|
18
|
+
/** Whether the outside click handling is scoped to the root provided it is an HTMLElement. @default `true`. */
|
|
19
19
|
scoped?: boolean;
|
|
20
|
-
/** Passed down to all event listeners used.
|
|
20
|
+
/** Passed down to all event listeners used. @default `true`. */
|
|
21
21
|
capture?: boolean;
|
|
22
22
|
}
|
|
23
23
|
/** Hook to attach outside-click, escape, and optional focus-out handling to an element. */
|
|
@@ -26,17 +26,17 @@ declare function initOutsideClick(el: HTMLElement, { enabled, onOutside, outOnCl
|
|
|
26
26
|
declare const removeOutsideClick: (el: HTMLElement) => void | undefined;
|
|
27
27
|
|
|
28
28
|
interface FocusTrapConfig {
|
|
29
|
-
/** Enables or disables the focus trap.
|
|
29
|
+
/** Enables or disables the focus trap. @default `false`. */
|
|
30
30
|
enabled?: boolean;
|
|
31
|
-
/** The preferred initial focus target selector within the element, overrides whatever was focused. Try `autofocus` attribute if working with dialogs before this.
|
|
31
|
+
/** The preferred initial focus target selector within the element, overrides whatever was focused. Try `autofocus` attribute if working with dialogs before this. @default `[data-autofocus]`. */
|
|
32
32
|
initialSelector?: string;
|
|
33
|
-
/** The class name for the initial focus ring since programmatic focus is not always visible, `autofocus` attribute in dialogs might work fine as an alternative.
|
|
33
|
+
/** The class name for the initial focus ring since programmatic focus is not always visible, `autofocus` attribute in dialogs might work fine as an alternative. @default `"focus-outline"`. */
|
|
34
34
|
ringClassName?: string;
|
|
35
|
-
/** Optional root used to scope focus listeners to an element instead of the window.
|
|
35
|
+
/** Optional root used to scope focus listeners to an element instead of the window. @default `window`. */
|
|
36
36
|
root?: HTMLElement | Document | Window;
|
|
37
|
-
/** Whether the focus trap is scoped to the root provided it is an HTMLElement.
|
|
37
|
+
/** Whether the focus trap is scoped to the root provided it is an HTMLElement. @default `true`. */
|
|
38
38
|
scoped?: boolean;
|
|
39
|
-
/** Passed down to all event listeners used.
|
|
39
|
+
/** Passed down to all event listeners used. @default `true`. */
|
|
40
40
|
capture?: boolean;
|
|
41
41
|
}
|
|
42
42
|
/** Hook to keep focus trapped inside an element until disabled. */
|
|
@@ -45,18 +45,20 @@ declare function initFocusTrap(el: HTMLElement, { enabled, initialSelector, ring
|
|
|
45
45
|
declare const removeFocusTrap: (el: HTMLElement) => void | undefined;
|
|
46
46
|
|
|
47
47
|
interface RippleConfig {
|
|
48
|
-
/** Optional explicit ripple host element.
|
|
49
|
-
target?: HTMLElement;
|
|
48
|
+
/** Optional explicit ripple host element. @default event currentTarget. */
|
|
49
|
+
target?: HTMLElement | null;
|
|
50
50
|
/** Forces the ripple origin to the center of the host. By default, the ripple will originate from the pointer event coordinates. */
|
|
51
51
|
forceCenter?: boolean;
|
|
52
|
-
/** CSS class added to the ripple wrapper element.
|
|
52
|
+
/** CSS class added to the ripple wrapper element. @default `"t007-ripple-wrapper"`. */
|
|
53
53
|
wrapperClassName?: string;
|
|
54
|
-
/** CSS general class added to the ripple element.
|
|
54
|
+
/** CSS general class added to the ripple element. @default `"t007-ripple"`. */
|
|
55
55
|
className?: string;
|
|
56
|
-
/** CSS class added to the ripple element while the pointer is held down. Should contain the initial expansion animation.
|
|
56
|
+
/** CSS class added to the ripple element while the pointer is held down. Should contain the initial expansion animation. @default `"t007-ripple-hold"`. */
|
|
57
57
|
holdClassName?: string;
|
|
58
|
-
/** CSS class added to the ripple element when released. Should contain the fade-out animation.
|
|
58
|
+
/** CSS class added to the ripple element when released. Should contain the fade-out animation. @default `"t007-ripple-fade"`. */
|
|
59
59
|
fadeClassName?: string;
|
|
60
|
+
/** Maximum duration for the ripple animation, force-ejects when elapsed. @default 1000ms. */
|
|
61
|
+
maxDuration?: number;
|
|
60
62
|
}
|
|
61
63
|
/** Render and control a material-style ripple animation on an element.
|
|
62
64
|
* @param e Pointer event used to place and gate the ripple.
|
|
@@ -67,7 +69,6 @@ interface RippleConfig {
|
|
|
67
69
|
* The ripple element will receive a hold class until the pointer is released, at which point it will switch to a fade class and be removed after the animation completes.
|
|
68
70
|
* Pointer events that are not left-clicks or that originate from interactive elements other than the currentTarget will be ignored to prevent interference with native behaviors.
|
|
69
71
|
*/
|
|
70
|
-
declare function rippleHandler(e:
|
|
71
|
-
type RipplePointerLikeEvent = Pick<PointerEvent, "target" | "currentTarget" | "pointerType" | "button" | "clientX" | "clientY" | "stopPropagation">;
|
|
72
|
+
declare function rippleHandler(e: Pick<PointerEvent, "target" | "currentTarget" | "button" | "clientX" | "clientY" | "stopPropagation">, { target, forceCenter, wrapperClassName, className, holdClassName, fadeClassName, maxDuration }?: RippleConfig): void;
|
|
72
73
|
|
|
73
74
|
export { type FocusTrapConfig as F, type OutsideClickConfig as O, type RippleConfig as R, initOutsideClick as a, removeOutsideClick as b, rippleHandler as c, initFocusTrap as i, removeFocusTrap as r };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
interface OutsideClickConfig {
|
|
2
|
-
/** Enables or disables outside-click handling.
|
|
2
|
+
/** Enables or disables outside-click handling. @default `false`. */
|
|
3
3
|
enabled?: boolean;
|
|
4
|
-
/** Callback invoked when an outside interaction is detected.
|
|
4
|
+
/** Callback invoked when an outside interaction is detected. @default `()=>{}`. */
|
|
5
5
|
onOutside?: (e: MouseEvent | TouchEvent | KeyboardEvent | FocusEvent) => void;
|
|
6
|
-
/** Whether pointer/touch outside interactions should trigger callback.
|
|
6
|
+
/** Whether pointer/touch outside interactions should trigger callback. @default `true`. */
|
|
7
7
|
outOnClick?: boolean;
|
|
8
|
-
/** Whether Escape key should trigger callback.
|
|
8
|
+
/** Whether Escape key should trigger callback. @default `true`. */
|
|
9
9
|
outOnEscape?: boolean;
|
|
10
|
-
/** Whether focus leaving the container should trigger callback.
|
|
10
|
+
/** Whether focus leaving the container should trigger callback. @default `false`. */
|
|
11
11
|
outOnFocusOut?: boolean;
|
|
12
|
-
/** Allow only clicks inside `el` bounding client rectangle to be considered valid, otherwise uses `el.contains(target)`.
|
|
12
|
+
/** Allow only clicks inside `el` bounding client rectangle to be considered valid, otherwise uses `el.contains(target)`. @default `false . */
|
|
13
13
|
allowBounds?: boolean;
|
|
14
|
-
/** Allow interactive elements including outsiders to bypass click callback.
|
|
14
|
+
/** Allow interactive elements including outsiders to bypass click callback. @default `false`. */
|
|
15
15
|
allowInputs?: boolean;
|
|
16
|
-
/** Optional root used to scope focus listeners to an element instead of the window.
|
|
16
|
+
/** Optional root used to scope focus listeners to an element instead of the window. @default `window`. */
|
|
17
17
|
root?: HTMLElement | Document | Window;
|
|
18
|
-
/** Whether the outside click handling is scoped to the root provided it is an HTMLElement.
|
|
18
|
+
/** Whether the outside click handling is scoped to the root provided it is an HTMLElement. @default `true`. */
|
|
19
19
|
scoped?: boolean;
|
|
20
|
-
/** Passed down to all event listeners used.
|
|
20
|
+
/** Passed down to all event listeners used. @default `true`. */
|
|
21
21
|
capture?: boolean;
|
|
22
22
|
}
|
|
23
23
|
/** Hook to attach outside-click, escape, and optional focus-out handling to an element. */
|
|
@@ -26,17 +26,17 @@ declare function initOutsideClick(el: HTMLElement, { enabled, onOutside, outOnCl
|
|
|
26
26
|
declare const removeOutsideClick: (el: HTMLElement) => void | undefined;
|
|
27
27
|
|
|
28
28
|
interface FocusTrapConfig {
|
|
29
|
-
/** Enables or disables the focus trap.
|
|
29
|
+
/** Enables or disables the focus trap. @default `false`. */
|
|
30
30
|
enabled?: boolean;
|
|
31
|
-
/** The preferred initial focus target selector within the element, overrides whatever was focused. Try `autofocus` attribute if working with dialogs before this.
|
|
31
|
+
/** The preferred initial focus target selector within the element, overrides whatever was focused. Try `autofocus` attribute if working with dialogs before this. @default `[data-autofocus]`. */
|
|
32
32
|
initialSelector?: string;
|
|
33
|
-
/** The class name for the initial focus ring since programmatic focus is not always visible, `autofocus` attribute in dialogs might work fine as an alternative.
|
|
33
|
+
/** The class name for the initial focus ring since programmatic focus is not always visible, `autofocus` attribute in dialogs might work fine as an alternative. @default `"focus-outline"`. */
|
|
34
34
|
ringClassName?: string;
|
|
35
|
-
/** Optional root used to scope focus listeners to an element instead of the window.
|
|
35
|
+
/** Optional root used to scope focus listeners to an element instead of the window. @default `window`. */
|
|
36
36
|
root?: HTMLElement | Document | Window;
|
|
37
|
-
/** Whether the focus trap is scoped to the root provided it is an HTMLElement.
|
|
37
|
+
/** Whether the focus trap is scoped to the root provided it is an HTMLElement. @default `true`. */
|
|
38
38
|
scoped?: boolean;
|
|
39
|
-
/** Passed down to all event listeners used.
|
|
39
|
+
/** Passed down to all event listeners used. @default `true`. */
|
|
40
40
|
capture?: boolean;
|
|
41
41
|
}
|
|
42
42
|
/** Hook to keep focus trapped inside an element until disabled. */
|
|
@@ -45,18 +45,20 @@ declare function initFocusTrap(el: HTMLElement, { enabled, initialSelector, ring
|
|
|
45
45
|
declare const removeFocusTrap: (el: HTMLElement) => void | undefined;
|
|
46
46
|
|
|
47
47
|
interface RippleConfig {
|
|
48
|
-
/** Optional explicit ripple host element.
|
|
49
|
-
target?: HTMLElement;
|
|
48
|
+
/** Optional explicit ripple host element. @default event currentTarget. */
|
|
49
|
+
target?: HTMLElement | null;
|
|
50
50
|
/** Forces the ripple origin to the center of the host. By default, the ripple will originate from the pointer event coordinates. */
|
|
51
51
|
forceCenter?: boolean;
|
|
52
|
-
/** CSS class added to the ripple wrapper element.
|
|
52
|
+
/** CSS class added to the ripple wrapper element. @default `"t007-ripple-wrapper"`. */
|
|
53
53
|
wrapperClassName?: string;
|
|
54
|
-
/** CSS general class added to the ripple element.
|
|
54
|
+
/** CSS general class added to the ripple element. @default `"t007-ripple"`. */
|
|
55
55
|
className?: string;
|
|
56
|
-
/** CSS class added to the ripple element while the pointer is held down. Should contain the initial expansion animation.
|
|
56
|
+
/** CSS class added to the ripple element while the pointer is held down. Should contain the initial expansion animation. @default `"t007-ripple-hold"`. */
|
|
57
57
|
holdClassName?: string;
|
|
58
|
-
/** CSS class added to the ripple element when released. Should contain the fade-out animation.
|
|
58
|
+
/** CSS class added to the ripple element when released. Should contain the fade-out animation. @default `"t007-ripple-fade"`. */
|
|
59
59
|
fadeClassName?: string;
|
|
60
|
+
/** Maximum duration for the ripple animation, force-ejects when elapsed. @default 1000ms. */
|
|
61
|
+
maxDuration?: number;
|
|
60
62
|
}
|
|
61
63
|
/** Render and control a material-style ripple animation on an element.
|
|
62
64
|
* @param e Pointer event used to place and gate the ripple.
|
|
@@ -67,7 +69,6 @@ interface RippleConfig {
|
|
|
67
69
|
* The ripple element will receive a hold class until the pointer is released, at which point it will switch to a fade class and be removed after the animation completes.
|
|
68
70
|
* Pointer events that are not left-clicks or that originate from interactive elements other than the currentTarget will be ignored to prevent interference with native behaviors.
|
|
69
71
|
*/
|
|
70
|
-
declare function rippleHandler(e:
|
|
71
|
-
type RipplePointerLikeEvent = Pick<PointerEvent, "target" | "currentTarget" | "pointerType" | "button" | "clientX" | "clientY" | "stopPropagation">;
|
|
72
|
+
declare function rippleHandler(e: Pick<PointerEvent, "target" | "currentTarget" | "button" | "clientX" | "clientY" | "stopPropagation">, { target, forceCenter, wrapperClassName, className, holdClassName, fadeClassName, maxDuration }?: RippleConfig): void;
|
|
72
73
|
|
|
73
74
|
export { type FocusTrapConfig as F, type OutsideClickConfig as O, type RippleConfig as R, initOutsideClick as a, removeOutsideClick as b, rippleHandler as c, initFocusTrap as i, removeFocusTrap as r };
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
type KeyEvent = Partial<KeyboardEvent> & Pick<KeyboardEvent, "key">;
|
|
2
2
|
type Config = {
|
|
3
|
-
/** Enables or disables navigation logic.
|
|
3
|
+
/** Enables or disables navigation logic. @default `null`. */
|
|
4
4
|
enabled?: boolean | null;
|
|
5
|
-
/** CSS selector used to collect focusable nav items.
|
|
5
|
+
/** CSS selector used to collect focusable nav items. @default `"[data-arrow-item]"` */
|
|
6
6
|
selector?: string;
|
|
7
|
-
/** Whether hover should also move active selection.
|
|
7
|
+
/** Whether hover should also move active selection. @default `true`. */
|
|
8
8
|
focusOnHover?: boolean;
|
|
9
|
-
/** Whether directional movement wraps around edges.
|
|
9
|
+
/** Whether directional movement wraps around edges. @default `true`. */
|
|
10
10
|
loop?: boolean;
|
|
11
|
-
/** Enables virtual focus (aria-activedescendant) mode.
|
|
11
|
+
/** Enables virtual focus (aria-activedescendant) mode. @default `false`. */
|
|
12
12
|
virtual?: boolean;
|
|
13
|
-
/** Enables alphanumeric type-ahead matching.
|
|
13
|
+
/** Enables alphanumeric type-ahead matching. @default `false`. */
|
|
14
14
|
typeahead?: boolean;
|
|
15
|
-
/** Idle timeout before clearing type-ahead buffer (ms).
|
|
15
|
+
/** Idle timeout before clearing type-ahead buffer (ms). @default `500`. */
|
|
16
16
|
resetMs?: number;
|
|
17
|
-
/** Explicit RTL override; null auto-detects from computed style.
|
|
17
|
+
/** Explicit RTL override; null auto-detects from computed style. @default `null`. */
|
|
18
18
|
rtl?: boolean | null;
|
|
19
|
-
/** Enables roving tabindex when not in virtual mode.
|
|
19
|
+
/** Enables roving tabindex when not in virtual mode. @default `null`. */
|
|
20
20
|
rovingTab?: boolean | null;
|
|
21
|
-
/** Default tabbable index when no active item is selected.
|
|
21
|
+
/** Default tabbable index when no active item is selected. @default `null`. */
|
|
22
22
|
defaultTabbableIndex?: number | null;
|
|
23
|
-
/** Base tabindex for non-active items, use `"-1"` to kill virtual list.
|
|
23
|
+
/** Base tabindex for non-active items, use `"-1"` to kill virtual list. @default `"0"`. */
|
|
24
24
|
baseTabIndex?: string;
|
|
25
|
-
/** Class applied to active item in virtual mode.
|
|
25
|
+
/** Class applied to active item in virtual mode. @default `"focus-outlined"`. */
|
|
26
26
|
activeClass?: string;
|
|
27
|
-
/** Selector used for keyboard event source in virtual mode.
|
|
27
|
+
/** Selector used for keyboard event source in virtual mode. @default `"input[value],textarea,[contenteditable]"`. */
|
|
28
28
|
inputSelector?: string;
|
|
29
|
-
/** Scroll behavior options used when moving active item.
|
|
29
|
+
/** Scroll behavior options used when moving active item. @default `{ block: "nearest", inline: "nearest" }`. */
|
|
30
30
|
scrollIntoView?: ScrollIntoViewOptions;
|
|
31
|
-
/** Focus behavior options used in non-virtual mode.
|
|
31
|
+
/** Focus behavior options used in non-virtual mode. @default `{ preventScroll: false }`. */
|
|
32
32
|
focusOptions?: FocusOptions;
|
|
33
|
-
/** Explicit or computed grid dimensions for navigation math.
|
|
33
|
+
/** Explicit or computed grid dimensions for navigation math. @default `{}`. */
|
|
34
34
|
grid?: Partial<Record<"x" | "y" | "vY", number>>;
|
|
35
35
|
/** Callback fired when an item becomes active/selected. */
|
|
36
36
|
onSelect?: (el: HTMLElement, e: KeyEvent) => void;
|
|
@@ -48,13 +48,13 @@ interface ScrollAssistHandle {
|
|
|
48
48
|
}
|
|
49
49
|
/** Configuration for scroll assist overlays. */
|
|
50
50
|
interface ScrollAssistConfig {
|
|
51
|
-
/** Scroll speed in pixels per second.
|
|
51
|
+
/** Scroll speed in pixels per second. @default `80`. */
|
|
52
52
|
pxPerSecond?: number;
|
|
53
|
-
/** Class name applied to assist overlays.
|
|
53
|
+
/** Class name applied to assist overlays. @default `"t007-scroll-assist"`. */
|
|
54
54
|
assistClassName?: string;
|
|
55
|
-
/** Enable vertical assist overlays.
|
|
55
|
+
/** Enable vertical assist overlays. @default `true`. */
|
|
56
56
|
vertical?: boolean;
|
|
57
|
-
/** Enable horizontal assist overlays.
|
|
57
|
+
/** Enable horizontal assist overlays. @default `true`. */
|
|
58
58
|
horizontal?: boolean;
|
|
59
59
|
}
|
|
60
60
|
/** Hook to add edge-scrolling assist to an element. It creates invisible "hot zones" at the edges of the element that, when hovered or dragged into, will scroll the element in that direction.
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
type KeyEvent = Partial<KeyboardEvent> & Pick<KeyboardEvent, "key">;
|
|
2
2
|
type Config = {
|
|
3
|
-
/** Enables or disables navigation logic.
|
|
3
|
+
/** Enables or disables navigation logic. @default `null`. */
|
|
4
4
|
enabled?: boolean | null;
|
|
5
|
-
/** CSS selector used to collect focusable nav items.
|
|
5
|
+
/** CSS selector used to collect focusable nav items. @default `"[data-arrow-item]"` */
|
|
6
6
|
selector?: string;
|
|
7
|
-
/** Whether hover should also move active selection.
|
|
7
|
+
/** Whether hover should also move active selection. @default `true`. */
|
|
8
8
|
focusOnHover?: boolean;
|
|
9
|
-
/** Whether directional movement wraps around edges.
|
|
9
|
+
/** Whether directional movement wraps around edges. @default `true`. */
|
|
10
10
|
loop?: boolean;
|
|
11
|
-
/** Enables virtual focus (aria-activedescendant) mode.
|
|
11
|
+
/** Enables virtual focus (aria-activedescendant) mode. @default `false`. */
|
|
12
12
|
virtual?: boolean;
|
|
13
|
-
/** Enables alphanumeric type-ahead matching.
|
|
13
|
+
/** Enables alphanumeric type-ahead matching. @default `false`. */
|
|
14
14
|
typeahead?: boolean;
|
|
15
|
-
/** Idle timeout before clearing type-ahead buffer (ms).
|
|
15
|
+
/** Idle timeout before clearing type-ahead buffer (ms). @default `500`. */
|
|
16
16
|
resetMs?: number;
|
|
17
|
-
/** Explicit RTL override; null auto-detects from computed style.
|
|
17
|
+
/** Explicit RTL override; null auto-detects from computed style. @default `null`. */
|
|
18
18
|
rtl?: boolean | null;
|
|
19
|
-
/** Enables roving tabindex when not in virtual mode.
|
|
19
|
+
/** Enables roving tabindex when not in virtual mode. @default `null`. */
|
|
20
20
|
rovingTab?: boolean | null;
|
|
21
|
-
/** Default tabbable index when no active item is selected.
|
|
21
|
+
/** Default tabbable index when no active item is selected. @default `null`. */
|
|
22
22
|
defaultTabbableIndex?: number | null;
|
|
23
|
-
/** Base tabindex for non-active items, use `"-1"` to kill virtual list.
|
|
23
|
+
/** Base tabindex for non-active items, use `"-1"` to kill virtual list. @default `"0"`. */
|
|
24
24
|
baseTabIndex?: string;
|
|
25
|
-
/** Class applied to active item in virtual mode.
|
|
25
|
+
/** Class applied to active item in virtual mode. @default `"focus-outlined"`. */
|
|
26
26
|
activeClass?: string;
|
|
27
|
-
/** Selector used for keyboard event source in virtual mode.
|
|
27
|
+
/** Selector used for keyboard event source in virtual mode. @default `"input[value],textarea,[contenteditable]"`. */
|
|
28
28
|
inputSelector?: string;
|
|
29
|
-
/** Scroll behavior options used when moving active item.
|
|
29
|
+
/** Scroll behavior options used when moving active item. @default `{ block: "nearest", inline: "nearest" }`. */
|
|
30
30
|
scrollIntoView?: ScrollIntoViewOptions;
|
|
31
|
-
/** Focus behavior options used in non-virtual mode.
|
|
31
|
+
/** Focus behavior options used in non-virtual mode. @default `{ preventScroll: false }`. */
|
|
32
32
|
focusOptions?: FocusOptions;
|
|
33
|
-
/** Explicit or computed grid dimensions for navigation math.
|
|
33
|
+
/** Explicit or computed grid dimensions for navigation math. @default `{}`. */
|
|
34
34
|
grid?: Partial<Record<"x" | "y" | "vY", number>>;
|
|
35
35
|
/** Callback fired when an item becomes active/selected. */
|
|
36
36
|
onSelect?: (el: HTMLElement, e: KeyEvent) => void;
|
|
@@ -48,13 +48,13 @@ interface ScrollAssistHandle {
|
|
|
48
48
|
}
|
|
49
49
|
/** Configuration for scroll assist overlays. */
|
|
50
50
|
interface ScrollAssistConfig {
|
|
51
|
-
/** Scroll speed in pixels per second.
|
|
51
|
+
/** Scroll speed in pixels per second. @default `80`. */
|
|
52
52
|
pxPerSecond?: number;
|
|
53
|
-
/** Class name applied to assist overlays.
|
|
53
|
+
/** Class name applied to assist overlays. @default `"t007-scroll-assist"`. */
|
|
54
54
|
assistClassName?: string;
|
|
55
|
-
/** Enable vertical assist overlays.
|
|
55
|
+
/** Enable vertical assist overlays. @default `true`. */
|
|
56
56
|
vertical?: boolean;
|
|
57
|
-
/** Enable horizontal assist overlays.
|
|
57
|
+
/** Enable horizontal assist overlays. @default `true`. */
|
|
58
58
|
horizontal?: boolean;
|
|
59
59
|
}
|
|
60
60
|
/** Hook to add edge-scrolling assist to an element. It creates invisible "hot zones" at the edges of the element that, when hovered or dragged into, will scroll the element in that direction.
|