keyborg 2.325.0-canary.0 → 3.0.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 +347 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +62 -0
- package/dist/index.d.ts +38 -106
- package/dist/index.js +325 -491
- package/dist/index.js.map +1 -1
- package/package.json +44 -33
- package/dist/esm/index.js +0 -474
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -130
- package/dist/ts3.9/index.d.ts +0 -123
package/dist/ts3.9/index.d.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Allows disposable instances to be used
|
|
3
|
-
*/
|
|
4
|
-
interface Disposable {
|
|
5
|
-
isDisposed?(): boolean;
|
|
6
|
-
}
|
|
7
|
-
/*!
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License.
|
|
10
|
-
*/
|
|
11
|
-
interface WindowWithKeyborg extends Window {
|
|
12
|
-
__keyborg?: {
|
|
13
|
-
core: KeyborgCore;
|
|
14
|
-
refs: {
|
|
15
|
-
[id: string]: Keyborg;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
interface KeyborgProps {
|
|
20
|
-
triggerKeys?: number[];
|
|
21
|
-
dismissKeys?: number[];
|
|
22
|
-
}
|
|
23
|
-
type KeyborgCallback = (isNavigatingWithKeyboard: boolean) => void;
|
|
24
|
-
/**
|
|
25
|
-
* Manages a collection of Keyborg instances in a window/document and updates keyborg state
|
|
26
|
-
*/
|
|
27
|
-
declare class KeyborgCore implements Disposable {
|
|
28
|
-
readonly id: string;
|
|
29
|
-
private _win?;
|
|
30
|
-
private _isMouseOrTouchUsedTimer;
|
|
31
|
-
private _dismissTimer;
|
|
32
|
-
private _triggerKeys?;
|
|
33
|
-
private _dismissKeys?;
|
|
34
|
-
private _isNavigatingWithKeyboard_DO_NOT_USE;
|
|
35
|
-
constructor(win: WindowWithKeyborg, props?: KeyborgProps);
|
|
36
|
-
isNavigatingWithKeyboard: boolean;
|
|
37
|
-
dispose(): void;
|
|
38
|
-
isDisposed(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Updates all keyborg instances with the keyboard navigation state
|
|
41
|
-
*/
|
|
42
|
-
update(): void;
|
|
43
|
-
private _onFocusIn;
|
|
44
|
-
private _onMouseDown;
|
|
45
|
-
private _onMouseOrTouch;
|
|
46
|
-
private _onKeyDown;
|
|
47
|
-
/**
|
|
48
|
-
* @returns whether the keyboard event should trigger keyboard navigation mode
|
|
49
|
-
*/
|
|
50
|
-
private _shouldTriggerKeyboardNavigation;
|
|
51
|
-
/**
|
|
52
|
-
* @returns whether the keyboard event should dismiss keyboard navigation mode
|
|
53
|
-
*/
|
|
54
|
-
private _shouldDismissKeyboardNavigation;
|
|
55
|
-
private _scheduleDismiss;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Used to determine the keyboard navigation state
|
|
59
|
-
*/
|
|
60
|
-
declare class Keyborg {
|
|
61
|
-
private _id;
|
|
62
|
-
private _win?;
|
|
63
|
-
private _core?;
|
|
64
|
-
private _cb;
|
|
65
|
-
static create(win: WindowWithKeyborg, props?: KeyborgProps): Keyborg;
|
|
66
|
-
static dispose(instance: Keyborg): void;
|
|
67
|
-
/**
|
|
68
|
-
* Updates all subscribed callbacks with the keyboard navigation state
|
|
69
|
-
*/
|
|
70
|
-
static update(instance: Keyborg, isNavigatingWithKeyboard: boolean): void;
|
|
71
|
-
private constructor();
|
|
72
|
-
private dispose;
|
|
73
|
-
/**
|
|
74
|
-
* @returns Whether the user is navigating with keyboard
|
|
75
|
-
*/
|
|
76
|
-
isNavigatingWithKeyboard(): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* @param callback - Called when the keyboard navigation state changes
|
|
79
|
-
*/
|
|
80
|
-
subscribe(callback: KeyborgCallback): void;
|
|
81
|
-
/**
|
|
82
|
-
* @param callback - Registered with subscribe
|
|
83
|
-
*/
|
|
84
|
-
unsubscribe(callback: KeyborgCallback): void;
|
|
85
|
-
/**
|
|
86
|
-
* Manually set the keyboard navigtion state
|
|
87
|
-
*/
|
|
88
|
-
setVal(isNavigatingWithKeyboard: boolean): void;
|
|
89
|
-
}
|
|
90
|
-
declare function createKeyborg(win: Window, props?: KeyborgProps): Keyborg;
|
|
91
|
-
declare function disposeKeyborg(instance: Keyborg): void;
|
|
92
|
-
declare const KEYBORG_FOCUSIN = "keyborg:focusin";
|
|
93
|
-
declare const KEYBORG_FOCUSOUT = "keyborg:focusout";
|
|
94
|
-
interface KeyborgFocusInEventDetails {
|
|
95
|
-
relatedTarget?: HTMLElement;
|
|
96
|
-
isFocusedProgrammatically?: boolean;
|
|
97
|
-
originalEvent?: FocusEvent;
|
|
98
|
-
}
|
|
99
|
-
interface KeyborgFocusInEvent extends CustomEvent<KeyborgFocusInEventDetails> {
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated - used `event.detail`
|
|
102
|
-
*/
|
|
103
|
-
details?: KeyborgFocusInEventDetails;
|
|
104
|
-
}
|
|
105
|
-
interface KeyborgFocusOutEventDetails {
|
|
106
|
-
originalEvent: FocusEvent;
|
|
107
|
-
}
|
|
108
|
-
type KeyborgFocusOutEvent = CustomEvent<KeyborgFocusOutEventDetails>;
|
|
109
|
-
/**
|
|
110
|
-
* Guarantees that the native `focus` will be used
|
|
111
|
-
*/
|
|
112
|
-
declare function nativeFocus(element: HTMLElement): void;
|
|
113
|
-
/**
|
|
114
|
-
* @param win The window that stores keyborg focus events
|
|
115
|
-
* @returns The last element focused with element.focus()
|
|
116
|
-
*/
|
|
117
|
-
declare function getLastFocusedProgrammatically(win: Window): HTMLElement | null | undefined;
|
|
118
|
-
/*!
|
|
119
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
120
|
-
* Licensed under the MIT License.
|
|
121
|
-
*/
|
|
122
|
-
declare const version: string | undefined;
|
|
123
|
-
export { KEYBORG_FOCUSIN, KEYBORG_FOCUSOUT, Keyborg, KeyborgCallback, KeyborgFocusInEvent, KeyborgFocusInEventDetails, KeyborgFocusOutEvent, KeyborgFocusOutEventDetails, createKeyborg, disposeKeyborg, getLastFocusedProgrammatically, nativeFocus, version };
|