keystra 0.0.0-stage → 0.1.1
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 +27 -0
- package/LICENSE +21 -0
- package/README.md +78 -2
- package/dist/chunk-2BLQUBG7.js +816 -0
- package/dist/chunk-77GGU3AX.js +135 -0
- package/dist/chunk-KDOJARJD.js +29 -0
- package/dist/chunk-LYYUOTBP.js +125 -0
- package/dist/chunk-S5YVXIMA.js +61 -0
- package/dist/chunk-SSIKGDD4.js +255 -0
- package/dist/chunk-U7YK6PPT.js +1729 -0
- package/dist/chunk-XFNYIPOW.js +253 -0
- package/dist/chunk-ZOJRXXQN.js +308 -0
- package/dist/core.cjs +2861 -0
- package/dist/core.d.cts +41 -0
- package/dist/core.d.ts +41 -0
- package/dist/core.js +7 -0
- package/dist/engine-COPfXXTp.d.ts +229 -0
- package/dist/engine-DcbkGRgz.d.cts +229 -0
- package/dist/focus.cjs +374 -0
- package/dist/focus.d.cts +74 -0
- package/dist/focus.d.ts +74 -0
- package/dist/focus.js +2 -0
- package/dist/index-IZkcWAXP.d.cts +395 -0
- package/dist/index-IZkcWAXP.d.ts +395 -0
- package/dist/index.cjs +3745 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.global.js +1 -0
- package/dist/index.js +9 -0
- package/dist/layout-C2-n8aUI.d.ts +17 -0
- package/dist/layout-CBzD-87D.d.cts +17 -0
- package/dist/navigation.cjs +293 -0
- package/dist/navigation.d.cts +33 -0
- package/dist/navigation.d.ts +33 -0
- package/dist/navigation.js +2 -0
- package/dist/patterns.cjs +3505 -0
- package/dist/patterns.d.cts +12 -0
- package/dist/patterns.d.ts +12 -0
- package/dist/patterns.js +7 -0
- package/dist/roving-focus-CT7Dm6di.d.ts +63 -0
- package/dist/roving-focus-ZQ0v7hLe.d.cts +63 -0
- package/dist/selection.cjs +266 -0
- package/dist/selection.d.cts +43 -0
- package/dist/selection.d.ts +43 -0
- package/dist/selection.js +2 -0
- package/dist/utils-CkveVeIJ.d.cts +18 -0
- package/dist/utils-JmPZTlys.d.ts +18 -0
- package/dist/utils.cjs +195 -0
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +2 -0
- package/package.json +147 -4
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
type ElementTarget<T extends Element = Element> = T | string | null | undefined | (() => T | string | null | undefined);
|
|
2
|
+
type ItemSelector<T extends Element = Element> = string | ((container: Element) => ArrayLike<T> | Iterable<T>);
|
|
3
|
+
type NavigationMode = "sequential" | "vertical" | "horizontal" | "grid" | "directional" | "custom";
|
|
4
|
+
type Direction = "up" | "down" | "left" | "right";
|
|
5
|
+
type KeyAction = "next" | "previous" | Direction | "first" | "last" | "pageUp" | "pageDown" | "select" | "toggle" | "escape" | "expand" | "collapse" | "typeahead" | (string & {});
|
|
6
|
+
type SelectionMode = "single" | "multiple" | "range" | "none";
|
|
7
|
+
type KeyBinding = string | KeyBindingObject;
|
|
8
|
+
interface KeyBindingObject {
|
|
9
|
+
key?: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
ctrl?: boolean;
|
|
12
|
+
alt?: boolean;
|
|
13
|
+
shift?: boolean;
|
|
14
|
+
meta?: boolean;
|
|
15
|
+
allowWithoutModifiers?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type KeyBindingInput = KeyBinding | readonly KeyBinding[];
|
|
18
|
+
type KeySequenceBinding = readonly KeyBinding[];
|
|
19
|
+
interface KeySequenceOptions {
|
|
20
|
+
readonly binding: KeySequenceBinding;
|
|
21
|
+
readonly action: KeyAction;
|
|
22
|
+
readonly timeout?: number;
|
|
23
|
+
readonly preventDefault?: boolean;
|
|
24
|
+
}
|
|
25
|
+
type KeySequenceInput = KeySequenceOptions;
|
|
26
|
+
interface DefaultKeyMap {
|
|
27
|
+
readonly next: KeyBindingInput;
|
|
28
|
+
readonly previous: KeyBindingInput;
|
|
29
|
+
readonly up: KeyBindingInput;
|
|
30
|
+
readonly down: KeyBindingInput;
|
|
31
|
+
readonly left: KeyBindingInput;
|
|
32
|
+
readonly right: KeyBindingInput;
|
|
33
|
+
readonly first: KeyBindingInput;
|
|
34
|
+
readonly last: KeyBindingInput;
|
|
35
|
+
readonly pageUp: KeyBindingInput;
|
|
36
|
+
readonly pageDown: KeyBindingInput;
|
|
37
|
+
readonly select: KeyBindingInput;
|
|
38
|
+
readonly toggle: KeyBindingInput;
|
|
39
|
+
readonly escape: KeyBindingInput;
|
|
40
|
+
readonly expand: KeyBindingInput;
|
|
41
|
+
readonly collapse: KeyBindingInput;
|
|
42
|
+
readonly selectAll: KeyBindingInput;
|
|
43
|
+
}
|
|
44
|
+
type KeyMap = {
|
|
45
|
+
readonly [K in keyof DefaultKeyMap]?: KeyBindingInput | false | null;
|
|
46
|
+
} & {
|
|
47
|
+
readonly [action: string]: KeyBindingInput | false | null | undefined;
|
|
48
|
+
};
|
|
49
|
+
interface ParsedKeyBinding {
|
|
50
|
+
readonly key: string | null;
|
|
51
|
+
readonly code: string | null;
|
|
52
|
+
readonly ctrl: boolean;
|
|
53
|
+
readonly alt: boolean;
|
|
54
|
+
readonly shift: boolean;
|
|
55
|
+
readonly meta: boolean;
|
|
56
|
+
readonly allowWithoutModifiers: boolean;
|
|
57
|
+
readonly id: string;
|
|
58
|
+
}
|
|
59
|
+
interface NormalizedKeyEvent {
|
|
60
|
+
readonly key: string;
|
|
61
|
+
readonly code: string;
|
|
62
|
+
readonly ctrl: boolean;
|
|
63
|
+
readonly alt: boolean;
|
|
64
|
+
readonly shift: boolean;
|
|
65
|
+
readonly meta: boolean;
|
|
66
|
+
readonly isPlain: boolean;
|
|
67
|
+
readonly isPrintable: boolean;
|
|
68
|
+
readonly repeat: boolean;
|
|
69
|
+
readonly shiftKey: boolean;
|
|
70
|
+
readonly originalEvent: KeyboardEvent;
|
|
71
|
+
}
|
|
72
|
+
interface KeystraEventMap<T extends Element = HTMLElement> {
|
|
73
|
+
focus: {
|
|
74
|
+
readonly element: T;
|
|
75
|
+
readonly index: number;
|
|
76
|
+
readonly action: KeyAction | null;
|
|
77
|
+
};
|
|
78
|
+
blur: {
|
|
79
|
+
readonly element: T;
|
|
80
|
+
readonly index: number;
|
|
81
|
+
};
|
|
82
|
+
select: {
|
|
83
|
+
readonly element: T;
|
|
84
|
+
readonly index: number;
|
|
85
|
+
};
|
|
86
|
+
action: {
|
|
87
|
+
readonly action: KeyAction;
|
|
88
|
+
readonly event: KeyboardEvent | null;
|
|
89
|
+
readonly element: T | null;
|
|
90
|
+
readonly index: number;
|
|
91
|
+
readonly fromSequence: boolean;
|
|
92
|
+
};
|
|
93
|
+
keydown: {
|
|
94
|
+
readonly event: KeyboardEvent;
|
|
95
|
+
readonly handled: boolean;
|
|
96
|
+
};
|
|
97
|
+
selectionchange: {
|
|
98
|
+
readonly selected: readonly T[];
|
|
99
|
+
readonly added: readonly T[];
|
|
100
|
+
readonly removed: readonly T[];
|
|
101
|
+
};
|
|
102
|
+
refresh: {
|
|
103
|
+
readonly items: readonly T[];
|
|
104
|
+
};
|
|
105
|
+
destroy: Record<string, never>;
|
|
106
|
+
}
|
|
107
|
+
type EventName = keyof KeystraEventMap;
|
|
108
|
+
type EventPayload<E extends EventName, T extends Element = HTMLElement> = KeystraEventMap<T>[E];
|
|
109
|
+
type EventHandler<E extends EventName, T extends Element = HTMLElement> = (payload: EventPayload<E, T>) => void;
|
|
110
|
+
type Unsubscribe = () => void;
|
|
111
|
+
interface TypeaheadOptions<T extends Element = HTMLElement> {
|
|
112
|
+
readonly enabled?: boolean;
|
|
113
|
+
readonly resetDelay?: number;
|
|
114
|
+
readonly getText?: (element: T) => string;
|
|
115
|
+
readonly onMatch?: (element: T | null, query: string) => void;
|
|
116
|
+
}
|
|
117
|
+
interface RovingOptions {
|
|
118
|
+
readonly enabled?: boolean;
|
|
119
|
+
readonly force?: boolean;
|
|
120
|
+
}
|
|
121
|
+
interface AutoFocusOptions<T extends Element = HTMLElement> {
|
|
122
|
+
readonly enabled?: boolean;
|
|
123
|
+
readonly target?: "first" | "last" | ((items: readonly T[]) => number);
|
|
124
|
+
}
|
|
125
|
+
interface SelectionOptions<T extends Element = HTMLElement> {
|
|
126
|
+
readonly enabled?: boolean;
|
|
127
|
+
readonly mode?: SelectionMode;
|
|
128
|
+
readonly initial?: readonly T[] | T | number | null;
|
|
129
|
+
readonly followFocus?: boolean;
|
|
130
|
+
readonly selectOnActivate?: boolean;
|
|
131
|
+
readonly shiftExtendsRange?: boolean;
|
|
132
|
+
readonly aria?: boolean;
|
|
133
|
+
readonly attribute?: string;
|
|
134
|
+
readonly selectedClass?: string;
|
|
135
|
+
readonly onChange?: (selected: readonly T[]) => void;
|
|
136
|
+
}
|
|
137
|
+
interface NavigationStrategyContext<T extends Element = HTMLElement> {
|
|
138
|
+
readonly items: readonly T[];
|
|
139
|
+
readonly container: Element | null;
|
|
140
|
+
readonly index: number;
|
|
141
|
+
readonly direction: Direction | null;
|
|
142
|
+
readonly action: KeyAction;
|
|
143
|
+
readonly event: KeyboardEvent | null;
|
|
144
|
+
readonly shiftKey: boolean;
|
|
145
|
+
readonly altKey: boolean;
|
|
146
|
+
readonly ctrlKey: boolean;
|
|
147
|
+
readonly metaKey: boolean;
|
|
148
|
+
readonly columns: number;
|
|
149
|
+
readonly loop: boolean;
|
|
150
|
+
readonly version: number;
|
|
151
|
+
readonly rectOf: (element: T) => DOMRect;
|
|
152
|
+
}
|
|
153
|
+
type NavigationStrategy<T extends Element = HTMLElement> = (context: NavigationStrategyContext<T>) => number | null | undefined;
|
|
154
|
+
interface BaseOptions<T extends Element = HTMLElement> {
|
|
155
|
+
readonly container?: ElementTarget<Element>;
|
|
156
|
+
readonly items?: ItemSelector<T>;
|
|
157
|
+
readonly elements?: readonly T[];
|
|
158
|
+
readonly itemSelector?: string;
|
|
159
|
+
readonly disabledSelector?: string | false | null;
|
|
160
|
+
readonly filter?: (element: T, index: number) => boolean;
|
|
161
|
+
readonly skipHidden?: boolean;
|
|
162
|
+
readonly mode?: NavigationMode;
|
|
163
|
+
readonly loop?: boolean;
|
|
164
|
+
readonly columns?: number;
|
|
165
|
+
readonly pageSize?: number;
|
|
166
|
+
readonly strategy?: NavigationStrategy<T> | null;
|
|
167
|
+
readonly onBeforeNavigate?: NavigationStrategy<T>;
|
|
168
|
+
readonly keys?: KeyMap;
|
|
169
|
+
readonly useDefaultKeys?: boolean;
|
|
170
|
+
readonly sequences?: readonly KeySequenceInput[];
|
|
171
|
+
readonly typeahead?: boolean | TypeaheadOptions<T>;
|
|
172
|
+
readonly roving?: boolean | RovingOptions;
|
|
173
|
+
readonly activeDescendant?: boolean | ElementTarget<HTMLElement>;
|
|
174
|
+
readonly autoFocus?: boolean | AutoFocusOptions<T>;
|
|
175
|
+
readonly selection?: boolean | SelectionOptions<T>;
|
|
176
|
+
readonly observe?: boolean | MutationObserverInit;
|
|
177
|
+
readonly onlyWhenFocusedInside?: boolean;
|
|
178
|
+
readonly when?: () => boolean;
|
|
179
|
+
readonly ignoreEditable?: boolean;
|
|
180
|
+
readonly editableSelector?: string;
|
|
181
|
+
readonly stopPropagation?: boolean;
|
|
182
|
+
readonly preventDefault?: boolean;
|
|
183
|
+
readonly capture?: boolean;
|
|
184
|
+
readonly target?: EventTarget | string | null | (() => EventTarget | string | null | undefined);
|
|
185
|
+
readonly enabled?: boolean;
|
|
186
|
+
readonly pointerSync?: boolean;
|
|
187
|
+
readonly onFocus?: (element: T, index: number) => void;
|
|
188
|
+
readonly onBlur?: (element: T, index: number) => void;
|
|
189
|
+
readonly onSelect?: (element: T, index: number) => void;
|
|
190
|
+
readonly onAction?: (action: KeyAction, event: KeyboardEvent | null, element: T | null, index: number) => void;
|
|
191
|
+
readonly onEscape?: (event: KeyboardEvent | null) => void;
|
|
192
|
+
readonly onRefresh?: (items: readonly T[]) => void;
|
|
193
|
+
}
|
|
194
|
+
interface KeystraOptions<T extends Element = HTMLElement> extends BaseOptions<T> {
|
|
195
|
+
}
|
|
196
|
+
interface SelectionController<T extends Element = HTMLElement> {
|
|
197
|
+
readonly mode: SelectionMode;
|
|
198
|
+
readonly selected: readonly T[];
|
|
199
|
+
readonly selectedIndexes: readonly number[];
|
|
200
|
+
readonly anchor: T | null;
|
|
201
|
+
readonly items: readonly T[];
|
|
202
|
+
select(elementOrIndex: T | number | undefined, extend?: boolean): void;
|
|
203
|
+
toggle(elementOrIndex: T | number | undefined): void;
|
|
204
|
+
deselect(elementOrIndex: T | number | undefined): void;
|
|
205
|
+
selectRange(from: T | number | undefined, to: T | number | undefined): void;
|
|
206
|
+
selectAll(): void;
|
|
207
|
+
clear(): void;
|
|
208
|
+
isSelected(elementOrIndex: T | number | undefined): boolean;
|
|
209
|
+
indexOfSelected(element: T): number;
|
|
210
|
+
setMode(mode: SelectionMode): void;
|
|
211
|
+
}
|
|
212
|
+
interface KeystraInstance<T extends Element = HTMLElement> {
|
|
213
|
+
readonly items: readonly T[];
|
|
214
|
+
readonly container: Element | null;
|
|
215
|
+
readonly activeElement: T | null;
|
|
216
|
+
readonly activeIndex: number;
|
|
217
|
+
readonly currentIndex: number;
|
|
218
|
+
readonly mode: NavigationMode;
|
|
219
|
+
readonly loop: boolean;
|
|
220
|
+
readonly selection: SelectionController<T> | null;
|
|
221
|
+
next(count?: number): T | null;
|
|
222
|
+
previous(count?: number): T | null;
|
|
223
|
+
up(): T | null;
|
|
224
|
+
down(): T | null;
|
|
225
|
+
left(): T | null;
|
|
226
|
+
right(): T | null;
|
|
227
|
+
move(direction: Direction): T | null;
|
|
228
|
+
first(): T | null;
|
|
229
|
+
last(): T | null;
|
|
230
|
+
focusFirst(): T | null;
|
|
231
|
+
focusLast(): T | null;
|
|
232
|
+
pageUp(): T | null;
|
|
233
|
+
pageDown(): T | null;
|
|
234
|
+
focusIndex(index: number): T | null;
|
|
235
|
+
setActiveIndex(index: number, options?: {
|
|
236
|
+
focus?: boolean;
|
|
237
|
+
}): T | null;
|
|
238
|
+
focusElement(element: T | null | undefined): boolean;
|
|
239
|
+
select(elementOrIndex?: T | number): void;
|
|
240
|
+
perform(action: KeyAction, event?: KeyboardEvent | null): boolean;
|
|
241
|
+
restoreFocus(): boolean;
|
|
242
|
+
refresh(): readonly T[];
|
|
243
|
+
add(element: T | readonly T[]): void;
|
|
244
|
+
remove(element: T | readonly T[]): void;
|
|
245
|
+
setItems(elements: readonly T[] | null): void;
|
|
246
|
+
readonly enabled: boolean;
|
|
247
|
+
enable(): void;
|
|
248
|
+
disable(): void;
|
|
249
|
+
update(options: Partial<Pick<KeystraOptions<T>, "keys" | "loop" | "mode" | "columns" | "enabled" | "pageSize" | "container">>): void;
|
|
250
|
+
on<E extends EventName>(event: E, handler: EventHandler<E, T>): Unsubscribe;
|
|
251
|
+
off<E extends EventName>(event: E, handler?: EventHandler<E, T>): void;
|
|
252
|
+
destroy(): void;
|
|
253
|
+
}
|
|
254
|
+
interface TabsOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
255
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
256
|
+
readonly activation?: "automatic" | "manual";
|
|
257
|
+
readonly activeAttribute?: string;
|
|
258
|
+
readonly aria?: boolean;
|
|
259
|
+
readonly panels?: ItemSelector<Element>;
|
|
260
|
+
readonly panelActiveAttribute?: string;
|
|
261
|
+
readonly onActivate?: (tab: T, index: number) => void;
|
|
262
|
+
}
|
|
263
|
+
interface TabsInstance<T extends HTMLElement = HTMLElement> extends KeystraInstance<T> {
|
|
264
|
+
readonly activeTab: T | null;
|
|
265
|
+
readonly activeIndex: number;
|
|
266
|
+
activate(indexOrElement: number | T | null): void;
|
|
267
|
+
readonly orientation: "horizontal" | "vertical";
|
|
268
|
+
readonly activation: "automatic" | "manual";
|
|
269
|
+
}
|
|
270
|
+
interface MenuOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
271
|
+
readonly closeOnSelect?: boolean;
|
|
272
|
+
readonly aria?: boolean;
|
|
273
|
+
readonly returnFocusTo?: ElementTarget<HTMLElement>;
|
|
274
|
+
readonly typeahead?: boolean | TypeaheadOptions<T>;
|
|
275
|
+
readonly toggleHidden?: boolean;
|
|
276
|
+
readonly onOpen?: (menu: MenuInstance<T>) => void;
|
|
277
|
+
readonly onClose?: (menu: MenuInstance<T>) => void;
|
|
278
|
+
}
|
|
279
|
+
interface MenuInstance<T extends HTMLElement = HTMLElement> extends KeystraInstance<T> {
|
|
280
|
+
readonly isOpen: boolean;
|
|
281
|
+
open(options?: {
|
|
282
|
+
focus?: "first" | "last" | "current" | number;
|
|
283
|
+
}): void;
|
|
284
|
+
close(options?: {
|
|
285
|
+
restoreFocus?: boolean;
|
|
286
|
+
}): void;
|
|
287
|
+
toggle(): void;
|
|
288
|
+
}
|
|
289
|
+
interface DropdownOptions<T extends HTMLElement = HTMLElement> extends MenuOptions<T> {
|
|
290
|
+
readonly trigger?: ElementTarget<HTMLElement>;
|
|
291
|
+
readonly openKeys?: KeyBindingInput;
|
|
292
|
+
readonly aria?: boolean;
|
|
293
|
+
readonly closeOnBlur?: boolean;
|
|
294
|
+
readonly closeOnOutsidePointer?: boolean;
|
|
295
|
+
}
|
|
296
|
+
interface DropdownInstance<T extends HTMLElement = HTMLElement> extends MenuInstance<T> {
|
|
297
|
+
readonly trigger: HTMLElement | null;
|
|
298
|
+
}
|
|
299
|
+
interface ListOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
300
|
+
readonly selection?: boolean | SelectionOptions<T>;
|
|
301
|
+
readonly aria?: boolean;
|
|
302
|
+
readonly typeahead?: boolean | TypeaheadOptions<T>;
|
|
303
|
+
}
|
|
304
|
+
interface GridOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
305
|
+
readonly columns?: number;
|
|
306
|
+
readonly aria?: boolean;
|
|
307
|
+
readonly maintainColumn?: boolean;
|
|
308
|
+
readonly rowHomeEnd?: boolean;
|
|
309
|
+
}
|
|
310
|
+
interface GridInstance<T extends HTMLElement = HTMLElement> extends KeystraInstance<T> {
|
|
311
|
+
readonly columns: number;
|
|
312
|
+
readonly rows: number;
|
|
313
|
+
readonly position: {
|
|
314
|
+
readonly row: number;
|
|
315
|
+
readonly column: number;
|
|
316
|
+
};
|
|
317
|
+
focusCell(row: number, column: number): T | null;
|
|
318
|
+
}
|
|
319
|
+
interface TreeOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
320
|
+
readonly items?: ItemSelector<T>;
|
|
321
|
+
readonly groupSelector?: string;
|
|
322
|
+
readonly collapseBehavior?: "attribute" | "hidden" | "none";
|
|
323
|
+
readonly aria?: boolean;
|
|
324
|
+
readonly toggleHidden?: boolean;
|
|
325
|
+
readonly hiddenClass?: string;
|
|
326
|
+
readonly typeahead?: boolean | TypeaheadOptions<T>;
|
|
327
|
+
readonly onExpand?: (node: T, index: number) => void;
|
|
328
|
+
readonly onCollapse?: (node: T, index: number) => void;
|
|
329
|
+
}
|
|
330
|
+
interface TreeInstance<T extends HTMLElement = HTMLElement> extends KeystraInstance<T> {
|
|
331
|
+
expand(elementOrIndex?: T | number): void;
|
|
332
|
+
collapse(elementOrIndex?: T | number): void;
|
|
333
|
+
toggleExpanded(elementOrIndex?: T | number): void;
|
|
334
|
+
expandAll(): void;
|
|
335
|
+
collapseAll(): void;
|
|
336
|
+
isExpanded(element: T): boolean;
|
|
337
|
+
isExpandable(element: T): boolean;
|
|
338
|
+
level(element: T): number;
|
|
339
|
+
parent(element: T): T | null;
|
|
340
|
+
}
|
|
341
|
+
interface CommandPaletteOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
342
|
+
readonly input?: ElementTarget<HTMLInputElement | HTMLTextAreaElement>;
|
|
343
|
+
readonly toggleHidden?: boolean;
|
|
344
|
+
readonly aria?: boolean;
|
|
345
|
+
readonly list?: ElementTarget<Element>;
|
|
346
|
+
readonly placeholder?: string;
|
|
347
|
+
readonly onQuery?: (query: string) => void;
|
|
348
|
+
readonly onSubmit?: (item: T | null, query: string) => void;
|
|
349
|
+
readonly onCancel?: () => void;
|
|
350
|
+
readonly openKeys?: KeyBindingInput;
|
|
351
|
+
}
|
|
352
|
+
interface CommandPaletteInstance<T extends HTMLElement = HTMLElement> extends KeystraInstance<T> {
|
|
353
|
+
readonly isOpen: boolean;
|
|
354
|
+
readonly query: string;
|
|
355
|
+
readonly input: HTMLInputElement | HTMLTextAreaElement | null;
|
|
356
|
+
open(): void;
|
|
357
|
+
close(options?: {
|
|
358
|
+
restoreFocus?: boolean;
|
|
359
|
+
}): void;
|
|
360
|
+
toggle(): void;
|
|
361
|
+
setQuery(query: string): void;
|
|
362
|
+
}
|
|
363
|
+
interface RovingFocusOptions<T extends HTMLElement = HTMLElement> extends BaseOptions<T> {
|
|
364
|
+
readonly initialIndex?: number;
|
|
365
|
+
}
|
|
366
|
+
interface HookOptions extends Omit<BaseOptions<HTMLElement>, "container" | "items" | "elements"> {
|
|
367
|
+
readonly container?: ElementTarget<Element>;
|
|
368
|
+
readonly items?: ItemSelector<HTMLElement>;
|
|
369
|
+
}
|
|
370
|
+
interface KeystraHandle {
|
|
371
|
+
readonly instance: KeystraInstance<HTMLElement> | null;
|
|
372
|
+
readonly container: Element | null;
|
|
373
|
+
attach(container: ElementTarget<Element> | null): KeystraInstance<HTMLElement> | null;
|
|
374
|
+
detach(): void;
|
|
375
|
+
destroy(): void;
|
|
376
|
+
}
|
|
377
|
+
interface KeyBindingOptions {
|
|
378
|
+
readonly target?: EventTarget | string | null;
|
|
379
|
+
readonly capture?: boolean;
|
|
380
|
+
readonly preventDefault?: boolean;
|
|
381
|
+
readonly stopPropagation?: boolean;
|
|
382
|
+
readonly allowInEditable?: boolean;
|
|
383
|
+
readonly editableSelector?: string | null;
|
|
384
|
+
readonly when?: () => boolean;
|
|
385
|
+
readonly enabled?: boolean;
|
|
386
|
+
readonly sequences?: readonly KeySequenceInput[];
|
|
387
|
+
}
|
|
388
|
+
interface KeyBindingHandle {
|
|
389
|
+
enable(): void;
|
|
390
|
+
disable(): void;
|
|
391
|
+
destroy(): void;
|
|
392
|
+
matches(event: KeyboardEvent): boolean;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export type { AutoFocusOptions as A, BaseOptions as B, CommandPaletteInstance as C, DefaultKeyMap as D, ElementTarget as E, SelectionMode as F, GridInstance as G, HookOptions as H, ItemSelector as I, SelectionOptions as J, KeyAction as K, ListOptions as L, MenuInstance as M, NavigationMode as N, TabsOptions as O, ParsedKeyBinding as P, TreeInstance as Q, RovingFocusOptions as R, SelectionController as S, TabsInstance as T, TreeOptions as U, TypeaheadOptions as V, Unsubscribe as W, CommandPaletteOptions as a, Direction as b, DropdownInstance as c, DropdownOptions as d, EventHandler as e, EventName as f, EventPayload as g, GridOptions as h, KeyBinding as i, KeyBindingHandle as j, KeyBindingInput as k, KeyBindingObject as l, KeyBindingOptions as m, KeyMap as n, KeySequenceBinding as o, KeySequenceInput as p, KeySequenceOptions as q, KeystraEventMap as r, KeystraHandle as s, KeystraInstance as t, KeystraOptions as u, MenuOptions as v, NavigationStrategy as w, NavigationStrategyContext as x, NormalizedKeyEvent as y, RovingOptions as z };
|