@loadsmart/miranda-wc 1.48.1 → 1.50.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;;;;;;OAMG;IACH,qBAAqB,EAAE,CAAC,IAAI,EAAE,0BAA0B,KAAK,WAAW,CAAC;gBAGxE,IAAI,EAAE,0BAA0B,EAChC,OAAO,EAAE,6BAA6B;IAevC,aAAa;IAWb,gBAAgB;IAIhB;;OAEG;IACH,IAAI,OAAO,IAAI,WAAW,EAAE,CAE3B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,WAAW,GAAG,IAAI,CAMhC;IAED;;;;OAIG;IACH,SAAS;IAIT;;;;OAIG;IACH,aAAa;IAIb;;OAEG;IACH,UAAU;IAIV;;OAEG;IACH,SAAS;IAIT;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,eAAe;IAUnD;;;OAGG;IACH,KAAK;CAyKL"}
@@ -0,0 +1,3 @@
1
+ export { FocusManagerController } from './focus-manager.controller';
2
+ export type { PositionalFocus, FocusManagerControllerHost, FocusManagerControllerOptions, } from './focus-manager.controller';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/focus-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EACX,eAAe,EACf,0BAA0B,EAC1B,6BAA6B,GAC7B,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { KeyboardSupportController, getShortcutKey, } from './keyboard-support.controller';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/keyboard-support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,cAAc,GACd,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { LitElement, ReactiveControllerHost, ReactiveController } from 'lit';
2
+ export type KeyboardSupportControllerHost = ReactiveControllerHost & LitElement;
3
+ export type Shortcut = {
4
+ /**
5
+ * key identifier for the pressed key
6
+ */
7
+ key: string;
8
+ /**
9
+ * is the meta (Command for Mac, Windows for MS Windows) key pressed?
10
+ */
11
+ meta?: boolean;
12
+ /**
13
+ * is the shift key pressed?
14
+ */
15
+ shift?: boolean;
16
+ /**
17
+ * is the ctrl key pressed?
18
+ */
19
+ ctrl?: boolean;
20
+ /**
21
+ * is the alt key pressed?
22
+ */
23
+ alt?: boolean;
24
+ };
25
+ export type ShortcutHandler = (event: KeyboardEvent) => void;
26
+ export type Keymap = {
27
+ shortcut: Shortcut | Shortcut[];
28
+ handler: ShortcutHandler;
29
+ };
30
+ export type KeyboardSupportControllerOptions = {
31
+ getEventTarget: (host: KeyboardSupportControllerHost) => HTMLElement;
32
+ };
33
+ export declare function getShortcutKey(shortcut: Shortcut): string;
34
+ /**
35
+ * Enable a component to implement behavior based on shortcuts.
36
+ */
37
+ export declare class KeyboardSupportController implements ReactiveController {
38
+ #private;
39
+ host: KeyboardSupportControllerHost;
40
+ keymap: Map<string, ShortcutHandler>;
41
+ /**
42
+ * Get the element to which the keyboard event listener should be attached.
43
+ * This can be useful when you want to prevent [retargetting](https://lit.dev/docs/components/events/#shadowdom), which
44
+ * happens for events fired from the component's shadow DOM.
45
+ *
46
+ * By default, the target element will be the `host` element.
47
+ *
48
+ * @see {@link https://lit.dev/docs/components/events/#adding-event-listeners-to-the-component-or-its-shadow-root Lit, Adding event listeners to the component or its shadow root}
49
+ */
50
+ getEventTarget: KeyboardSupportControllerOptions['getEventTarget'];
51
+ constructor(host: KeyboardSupportControllerHost, keymap: Keymap | Keymap[], options?: KeyboardSupportControllerOptions | null);
52
+ hostConnected(): Promise<void>;
53
+ hostDisconnected(): void;
54
+ }
55
+ //# sourceMappingURL=keyboard-support.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-support.controller.d.ts","sourceRoot":"","sources":["../../../src/controllers/keyboard-support/keyboard-support.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,sBAAsB,EACtB,kBAAkB,EAClB,MAAM,KAAK,CAAC;AAGb,MAAM,MAAM,6BAA6B,GAAG,sBAAsB,GAAG,UAAU,CAAC;AAEhF,MAAM,MAAM,QAAQ,GAAG;IACtB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAE7D,MAAM,MAAM,MAAM,GAAG;IACpB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;IAChC,OAAO,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC9C,cAAc,EAAE,CAAC,IAAI,EAAE,6BAA6B,KAAK,WAAW,CAAC;CACrE,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAUzD;AAED;;GAEG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB;;IACnE,IAAI,EAAE,6BAA6B,CAAC;IAEpC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAa;IAEjD;;;;;;;;OAQG;IACH,cAAc,EAAE,gCAAgC,CAAC,gBAAgB,CAAC,CAAC;gBAGlE,IAAI,EAAE,6BAA6B,EACnC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,gCAAgC,GAAG,IAAI;IAgB5C,aAAa;IAInB,gBAAgB;CAwBhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadsmart/miranda-wc",
3
- "version": "1.48.1",
3
+ "version": "1.50.0",
4
4
  "description": "Miranda Web Components component library",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",