@loadsmart/miranda-wc 1.48.1 → 1.49.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.
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ReactiveControllerHost, ReactiveController } from 'lit';
|
|
2
|
+
export declare const SEARCH_BUFFER_TIMEOUT = 500;
|
|
3
|
+
export type FocusManagerControllerHost = ReactiveControllerHost & HTMLElement;
|
|
4
|
+
export type FocusManagerControllerOptions = {
|
|
5
|
+
query: string | string[];
|
|
6
|
+
focusOnType?: boolean;
|
|
7
|
+
getInteractiveElement?: (host: FocusManagerControllerHost) => HTMLElement;
|
|
8
|
+
};
|
|
9
|
+
export type PositionalFocus = 'first' | 'last' | 'previous' | 'next';
|
|
10
|
+
/**
|
|
11
|
+
* Check if `keyboardEventKey` is a character, and more specifically, anything
|
|
12
|
+
* other than a space, tab, or newline.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isPrintableCharacter(keyboardEventKey: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Manages **virtual/visual** focus, for a11y purposes.
|
|
17
|
+
*/
|
|
18
|
+
export declare class FocusManagerController implements ReactiveController {
|
|
19
|
+
#private;
|
|
20
|
+
host: FocusManagerControllerHost;
|
|
21
|
+
activeDescendant: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Keys (printable characters) the user typed on the watched host.
|
|
24
|
+
* The expectation is that the user wants to focus/select something.
|
|
25
|
+
*/
|
|
26
|
+
quickSearchBuffer: string;
|
|
27
|
+
/**
|
|
28
|
+
* Timeout to clear the buffer.
|
|
29
|
+
*/
|
|
30
|
+
quickSearchBufferTimeout?: number | null;
|
|
31
|
+
/**
|
|
32
|
+
* Query to get virtually focusable elements inside the `host`.
|
|
33
|
+
*/
|
|
34
|
+
query: string;
|
|
35
|
+
/**
|
|
36
|
+
* When user types printable characters, should the focus move to the next `queried` item whose label
|
|
37
|
+
* starts with `quickSearchBuffer`, if such an item exists (otherwise, focus does not move)?
|
|
38
|
+
*/
|
|
39
|
+
focusOnType: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Get the element that will receive the `aria-activedescendant` attribute. This is necessary when the
|
|
42
|
+
* host element is not the one directly hosting the focusable elements.
|
|
43
|
+
* If no override is provided, the `host` element itself is used.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant MDN, aria-activedescendant}
|
|
46
|
+
*/
|
|
47
|
+
getInteractiveElement: (host: FocusManagerControllerHost) => HTMLElement;
|
|
48
|
+
constructor(host: FocusManagerControllerHost, options: FocusManagerControllerOptions);
|
|
49
|
+
hostConnected(): void;
|
|
50
|
+
hostDisconnected(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get the list of elements matching the given `options.query`.
|
|
53
|
+
*/
|
|
54
|
+
get queried(): HTMLElement[];
|
|
55
|
+
/**
|
|
56
|
+
* Get the currently focused element, based on `activeDescendant`.
|
|
57
|
+
*/
|
|
58
|
+
get focused(): HTMLElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* If none of the options are selected, the first option receives focus; otherwise, the
|
|
61
|
+
* focus moves to the next option.
|
|
62
|
+
* If we are at the end of the `queried` array, the focus moves to the first option.
|
|
63
|
+
*/
|
|
64
|
+
focusNext(): void;
|
|
65
|
+
/**
|
|
66
|
+
* If none of the options are selected, the last option receives focus; otherwise, the
|
|
67
|
+
* focus moves to the next option.
|
|
68
|
+
* If we are at the start of the `queried` array, the focus moves to the last option.
|
|
69
|
+
*/
|
|
70
|
+
focusPrevious(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Focus the first element in `queried`.
|
|
73
|
+
*/
|
|
74
|
+
focusFirst(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Focus the last element in `queried`.
|
|
77
|
+
*/
|
|
78
|
+
focusLast(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Focus the given element or the element at the given index or position, based on `queried`.
|
|
81
|
+
*/
|
|
82
|
+
focus(where: number | HTMLElement | PositionalFocus): void;
|
|
83
|
+
/**
|
|
84
|
+
* Remove the visual focus (`.is-focused` class) from the currently focused element and
|
|
85
|
+
* clear the `activeDescendant` attribute.
|
|
86
|
+
*/
|
|
87
|
+
clear(): void;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=focus-manager.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-manager.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/focus-manager/focus-manager.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,KAAK,CAAC;AAGtE,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,GAAG,WAAW,CAAC;AAE9E,MAAM,MAAM,6BAA6B,GAAG;IAC3C,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,0BAA0B,KAAK,WAAW,CAAC;CAC1E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AAWrE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAOtE;AAED;;GAEG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;;IAChE,IAAI,EAAE,0BAA0B,CAAC;IAEjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEvC;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;;;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