keyborg 2.13.0-canary.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +394 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +71 -0
- package/dist/index.d.ts +40 -99
- package/dist/index.js +366 -486
- package/dist/index.js.map +1 -1
- package/dist/ts3.9/index.d.ts +14 -66
- package/package.json +34 -21
- package/dist/esm/index.js +0 -474
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -130
package/dist/index.d.ts
CHANGED
|
@@ -1,113 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
* Allows disposable instances to be used
|
|
3
|
-
*/
|
|
4
|
-
interface Disposable {
|
|
5
|
-
isDisposed?(): boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
//#region src/Keyborg.d.mts
|
|
8
2
|
/*!
|
|
9
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
4
|
* Licensed under the MIT License.
|
|
11
5
|
*/
|
|
12
|
-
|
|
13
|
-
interface WindowWithKeyborg extends Window {
|
|
14
|
-
__keyborg?: {
|
|
15
|
-
core: KeyborgCore;
|
|
16
|
-
refs: {
|
|
17
|
-
[id: string]: Keyborg;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
6
|
interface KeyborgProps {
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
triggerKeys?: number[];
|
|
8
|
+
dismissKeys?: number[];
|
|
24
9
|
}
|
|
25
10
|
type KeyborgCallback = (isNavigatingWithKeyboard: boolean) => void;
|
|
26
11
|
/**
|
|
27
|
-
*
|
|
12
|
+
* Used to determine the keyboard navigation state.
|
|
28
13
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
private _onFocusIn;
|
|
47
|
-
private _onMouseDown;
|
|
48
|
-
private _onMouseOrTouch;
|
|
49
|
-
private _onKeyDown;
|
|
50
|
-
/**
|
|
51
|
-
* @returns whether the keyboard event should trigger keyboard navigation mode
|
|
52
|
-
*/
|
|
53
|
-
private _shouldTriggerKeyboardNavigation;
|
|
54
|
-
/**
|
|
55
|
-
* @returns whether the keyboard event should dismiss keyboard navigation mode
|
|
56
|
-
*/
|
|
57
|
-
private _shouldDismissKeyboardNavigation;
|
|
58
|
-
private _scheduleDismiss;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Used to determine the keyboard navigation state
|
|
62
|
-
*/
|
|
63
|
-
declare class Keyborg {
|
|
64
|
-
private _id;
|
|
65
|
-
private _win?;
|
|
66
|
-
private _core?;
|
|
67
|
-
private _cb;
|
|
68
|
-
static create(win: WindowWithKeyborg, props?: KeyborgProps): Keyborg;
|
|
69
|
-
static dispose(instance: Keyborg): void;
|
|
70
|
-
/**
|
|
71
|
-
* Updates all subscribed callbacks with the keyboard navigation state
|
|
72
|
-
*/
|
|
73
|
-
static update(instance: Keyborg, isNavigatingWithKeyboard: boolean): void;
|
|
74
|
-
private constructor();
|
|
75
|
-
private dispose;
|
|
76
|
-
/**
|
|
77
|
-
* @returns Whether the user is navigating with keyboard
|
|
78
|
-
*/
|
|
79
|
-
isNavigatingWithKeyboard(): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* @param callback - Called when the keyboard navigation state changes
|
|
82
|
-
*/
|
|
83
|
-
subscribe(callback: KeyborgCallback): void;
|
|
84
|
-
/**
|
|
85
|
-
* @param callback - Registered with subscribe
|
|
86
|
-
*/
|
|
87
|
-
unsubscribe(callback: KeyborgCallback): void;
|
|
88
|
-
/**
|
|
89
|
-
* Manually set the keyboard navigtion state
|
|
90
|
-
*/
|
|
91
|
-
setVal(isNavigatingWithKeyboard: boolean): void;
|
|
14
|
+
interface Keyborg {
|
|
15
|
+
/**
|
|
16
|
+
* @returns Whether the user is navigating with keyboard
|
|
17
|
+
*/
|
|
18
|
+
isNavigatingWithKeyboard(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @param callback - Called when the keyboard navigation state changes
|
|
21
|
+
*/
|
|
22
|
+
subscribe(callback: KeyborgCallback): void;
|
|
23
|
+
/**
|
|
24
|
+
* @param callback - Registered with subscribe
|
|
25
|
+
*/
|
|
26
|
+
unsubscribe(callback: KeyborgCallback): void;
|
|
27
|
+
/**
|
|
28
|
+
* Manually set the keyboard navigation state
|
|
29
|
+
*/
|
|
30
|
+
setVal(isNavigatingWithKeyboard: boolean): void;
|
|
92
31
|
}
|
|
93
32
|
declare function createKeyborg(win: Window, props?: KeyborgProps): Keyborg;
|
|
94
33
|
declare function disposeKeyborg(instance: Keyborg): void;
|
|
95
|
-
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/FocusEvent.d.mts
|
|
36
|
+
/*!
|
|
37
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
38
|
+
* Licensed under the MIT License.
|
|
39
|
+
*/
|
|
96
40
|
declare const KEYBORG_FOCUSIN = "keyborg:focusin";
|
|
97
41
|
declare const KEYBORG_FOCUSOUT = "keyborg:focusout";
|
|
98
42
|
interface KeyborgFocusInEventDetails {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
43
|
+
relatedTarget?: HTMLElement;
|
|
44
|
+
isFocusedProgrammatically?: boolean;
|
|
45
|
+
originalEvent?: FocusEvent;
|
|
102
46
|
}
|
|
103
47
|
interface KeyborgFocusInEvent extends CustomEvent<KeyborgFocusInEventDetails> {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated - used `event.detail`
|
|
50
|
+
*/
|
|
51
|
+
details?: KeyborgFocusInEventDetails;
|
|
108
52
|
}
|
|
109
53
|
interface KeyborgFocusOutEventDetails {
|
|
110
|
-
|
|
54
|
+
originalEvent: FocusEvent;
|
|
111
55
|
}
|
|
112
56
|
type KeyborgFocusOutEvent = CustomEvent<KeyborgFocusOutEventDetails>;
|
|
113
57
|
/**
|
|
@@ -119,12 +63,9 @@ declare function nativeFocus(element: HTMLElement): void;
|
|
|
119
63
|
* @returns The last element focused with element.focus()
|
|
120
64
|
*/
|
|
121
65
|
declare function getLastFocusedProgrammatically(win: Window): HTMLElement | null | undefined;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
125
|
-
* Licensed under the MIT License.
|
|
126
|
-
*/
|
|
127
|
-
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/index.d.mts
|
|
128
68
|
declare const version: string | undefined;
|
|
129
|
-
|
|
130
|
-
export { KEYBORG_FOCUSIN, KEYBORG_FOCUSOUT, Keyborg, type KeyborgCallback, type KeyborgFocusInEvent, type KeyborgFocusInEventDetails, type KeyborgFocusOutEvent, type KeyborgFocusOutEventDetails, createKeyborg, disposeKeyborg, getLastFocusedProgrammatically, nativeFocus, version };
|
|
69
|
+
//#endregion
|
|
70
|
+
export { KEYBORG_FOCUSIN, KEYBORG_FOCUSOUT, type Keyborg, type KeyborgCallback, type KeyborgFocusInEvent, type KeyborgFocusInEventDetails, type KeyborgFocusOutEvent, type KeyborgFocusOutEventDetails, createKeyborg, disposeKeyborg, getLastFocusedProgrammatically, nativeFocus, version };
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|