@angular/cdk 20.0.0-next.0 → 20.0.0-next.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/a11y/index.d.ts +330 -1234
- package/a11y-module.d-7d03e079.d.ts +313 -0
- package/accordion/index.d.ts +8 -27
- package/activedescendant-key-manager.d-11921e3a.d.ts +31 -0
- package/bidi/index.d.ts +3 -62
- package/bidi-module.d-f8648621.d.ts +53 -0
- package/clipboard/index.d.ts +61 -75
- package/coercion/index.d.ts +10 -33
- package/coercion/private/index.d.ts +2 -2
- package/collections/index.d.ts +13 -291
- package/data-source.d-7cab2c9d.d.ts +42 -0
- package/dialog/index.d.ts +204 -249
- package/drag-drop/index.d.ts +1077 -1157
- package/fesm2022/a11y-module-e6996d20.mjs +952 -0
- package/fesm2022/a11y-module-e6996d20.mjs.map +1 -0
- package/fesm2022/a11y.mjs +47 -2445
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/accordion.mjs +12 -16
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/activedescendant-key-manager-1351a9d3.mjs +16 -0
- package/fesm2022/activedescendant-key-manager-1351a9d3.mjs.map +1 -0
- package/fesm2022/array-ee3b4bab.mjs +6 -0
- package/fesm2022/array-ee3b4bab.mjs.map +1 -0
- package/fesm2022/backwards-compatibility-bcbe473e.mjs +25 -0
- package/fesm2022/backwards-compatibility-bcbe473e.mjs.map +1 -0
- package/fesm2022/bidi-module-0726b65c.mjs +78 -0
- package/fesm2022/bidi-module-0726b65c.mjs.map +1 -0
- package/fesm2022/bidi.mjs +4 -143
- package/fesm2022/bidi.mjs.map +1 -1
- package/fesm2022/breakpoints-observer-d4584b66.mjs +179 -0
- package/fesm2022/breakpoints-observer-d4584b66.mjs.map +1 -0
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/clipboard.mjs +10 -14
- package/fesm2022/clipboard.mjs.map +1 -1
- package/fesm2022/coercion/private.mjs +2 -18
- package/fesm2022/coercion/private.mjs.map +1 -1
- package/fesm2022/coercion.mjs +5 -39
- package/fesm2022/coercion.mjs.map +1 -1
- package/fesm2022/collections.mjs +7 -476
- package/fesm2022/collections.mjs.map +1 -1
- package/fesm2022/css-pixel-value-286c9a60.mjs +10 -0
- package/fesm2022/css-pixel-value-286c9a60.mjs.map +1 -0
- package/fesm2022/data-source-5320b6fd.mjs +15 -0
- package/fesm2022/data-source-5320b6fd.mjs.map +1 -0
- package/fesm2022/dialog.mjs +37 -39
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/directionality-7ea26429.mjs +72 -0
- package/fesm2022/directionality-7ea26429.mjs.map +1 -0
- package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs +44 -0
- package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs.map +1 -0
- package/fesm2022/drag-drop.mjs +48 -50
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/element-705567fe.mjs +29 -0
- package/fesm2022/element-705567fe.mjs.map +1 -0
- package/fesm2022/fake-event-detection-7055b1bd.mjs +24 -0
- package/fesm2022/fake-event-detection-7055b1bd.mjs.map +1 -0
- package/fesm2022/focus-key-manager-58d29acd.mjs +22 -0
- package/fesm2022/focus-key-manager-58d29acd.mjs.map +1 -0
- package/fesm2022/focus-monitor-cebaa0d1.mjs +629 -0
- package/fesm2022/focus-monitor-cebaa0d1.mjs.map +1 -0
- package/fesm2022/id-generator-fba495fb.mjs +37 -0
- package/fesm2022/id-generator-fba495fb.mjs.map +1 -0
- package/fesm2022/keycodes-107cd3e4.mjs +122 -0
- package/fesm2022/keycodes-107cd3e4.mjs.map +1 -0
- package/fesm2022/keycodes.mjs +2 -136
- package/fesm2022/keycodes.mjs.map +1 -1
- package/fesm2022/layout.mjs +12 -184
- package/fesm2022/layout.mjs.map +1 -1
- package/fesm2022/list-key-manager-c7b5cefb.mjs +360 -0
- package/fesm2022/list-key-manager-c7b5cefb.mjs.map +1 -0
- package/fesm2022/listbox.mjs +21 -20
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +76 -60
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/modifiers-33a5859e.mjs +13 -0
- package/fesm2022/modifiers-33a5859e.mjs.map +1 -0
- package/fesm2022/observable-97c0792c.mjs +15 -0
- package/fesm2022/observable-97c0792c.mjs.map +1 -0
- package/fesm2022/observe-content-d2a6b5a0.mjs +210 -0
- package/fesm2022/observe-content-d2a6b5a0.mjs.map +1 -0
- package/fesm2022/observers/private.mjs +3 -7
- package/fesm2022/observers/private.mjs.map +1 -1
- package/fesm2022/observers.mjs +5 -213
- package/fesm2022/observers.mjs.map +1 -1
- package/fesm2022/overlay-module-863b82c9.mjs +3029 -0
- package/fesm2022/overlay-module-863b82c9.mjs.map +1 -0
- package/fesm2022/overlay.mjs +28 -3019
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/passive-listeners-c0bdc49f.mjs +31 -0
- package/fesm2022/passive-listeners-c0bdc49f.mjs.map +1 -0
- package/fesm2022/platform-1be098b0.mjs +77 -0
- package/fesm2022/platform-1be098b0.mjs.map +1 -0
- package/fesm2022/platform.mjs +13 -293
- package/fesm2022/platform.mjs.map +1 -1
- package/fesm2022/portal-directives-c88fea11.mjs +615 -0
- package/fesm2022/portal-directives-c88fea11.mjs.map +1 -0
- package/fesm2022/portal.mjs +3 -650
- package/fesm2022/portal.mjs.map +1 -1
- package/fesm2022/private.mjs +3 -63
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs +156 -0
- package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs.map +1 -0
- package/fesm2022/scrolling-61955dd1.mjs +99 -0
- package/fesm2022/scrolling-61955dd1.mjs.map +1 -0
- package/fesm2022/scrolling-module-aa9eeac5.mjs +1463 -0
- package/fesm2022/scrolling-module-aa9eeac5.mjs.map +1 -0
- package/fesm2022/scrolling.mjs +12 -1463
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection-model-30243dba.mjs +221 -0
- package/fesm2022/selection-model-30243dba.mjs.map +1 -0
- package/fesm2022/shadow-dom-9f403d00.mjs +49 -0
- package/fesm2022/shadow-dom-9f403d00.mjs.map +1 -0
- package/fesm2022/stepper.mjs +32 -30
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/style-loader-e14dc585.mjs +47 -0
- package/fesm2022/style-loader-e14dc585.mjs.map +1 -0
- package/fesm2022/table.mjs +88 -132
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/test-environment-34eef1ee.mjs +19 -0
- package/fesm2022/test-environment-34eef1ee.mjs.map +1 -0
- package/fesm2022/testing/selenium-webdriver.mjs +2 -1
- package/fesm2022/testing/selenium-webdriver.mjs.map +1 -1
- package/fesm2022/testing/testbed.mjs +33 -74
- package/fesm2022/testing/testbed.mjs.map +1 -1
- package/fesm2022/testing.mjs +2 -697
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/text-field.mjs +20 -23
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/text-filtering-b60ba8a2.mjs +698 -0
- package/fesm2022/text-filtering-b60ba8a2.mjs.map +1 -0
- package/fesm2022/tree-key-manager-2f20c79c.mjs +360 -0
- package/fesm2022/tree-key-manager-2f20c79c.mjs.map +1 -0
- package/fesm2022/tree.mjs +33 -33
- package/fesm2022/tree.mjs.map +1 -1
- package/fesm2022/typeahead-11ae39bd.mjs +88 -0
- package/fesm2022/typeahead-11ae39bd.mjs.map +1 -0
- package/fesm2022/unique-selection-dispatcher-1d6f91d8.mjs +49 -0
- package/fesm2022/unique-selection-dispatcher-1d6f91d8.mjs.map +1 -0
- package/fesm2022/visually-hidden-83aea4a0.mjs +18 -0
- package/fesm2022/visually-hidden-83aea4a0.mjs.map +1 -0
- package/focus-key-manager.d-415a6958.d.ts +33 -0
- package/focus-monitor.d-810a02e6.d.ts +209 -0
- package/harness-environment.d-4d615248.d.ts +619 -0
- package/index.d.ts +2 -2
- package/keycodes/index.d.ts +123 -244
- package/layout/index.d.ts +23 -25
- package/list-key-manager.d-72e9a2e7.d.ts +164 -0
- package/listbox/index.d.ts +91 -107
- package/menu/index.d.ts +596 -682
- package/number-property.d-ce316715.d.ts +15 -0
- package/observe-content.d-c08bc882.d.ts +84 -0
- package/observers/index.d.ts +4 -90
- package/observers/private/index.d.ts +3 -3
- package/overlay/index.d.ts +110 -951
- package/overlay-module.d-5d06db8a.d.ts +790 -0
- package/package.json +1 -1
- package/platform/index.d.ts +45 -86
- package/platform.d-0a5b4792.d.ts +33 -0
- package/portal/index.d.ts +5 -264
- package/portal-directives.d-d345bd53.d.ts +210 -0
- package/private/index.d.ts +3 -20
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.d.ts +7 -687
- package/scrolling-module.d-a08a462d.d.ts +551 -0
- package/selection-model.d-1a70542c.d.ts +111 -0
- package/stepper/index.d.ts +74 -124
- package/style-loader.d-19baab84.d.ts +21 -0
- package/table/index.d.ts +329 -453
- package/testing/index.d.ts +32 -675
- package/testing/selenium-webdriver/index.d.ts +30 -20
- package/testing/testbed/index.d.ts +9 -19
- package/text-field/index.d.ts +9 -30
- package/tree/index.d.ts +205 -271
- package/tree-key-manager-strategy.d-603161dd.d.ts +116 -0
- package/unique-selection-dispatcher.d-7993b9f5.d.ts +32 -0
- package/view-repeater.d-79039e1f.d.ts +88 -0
- package/viewport-ruler.d-f3d3e82f.d.ts +57 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
import { tap, debounceTime, filter, map } from 'rxjs/operators';
|
|
3
|
+
import { c as A, Z, d as ZERO, N as NINE } from './keycodes-107cd3e4.mjs';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL_MS = 200;
|
|
6
|
+
/**
|
|
7
|
+
* Selects items based on keyboard inputs. Implements the typeahead functionality of
|
|
8
|
+
* `role="listbox"` or `role="tree"` and other related roles.
|
|
9
|
+
*/
|
|
10
|
+
class Typeahead {
|
|
11
|
+
_letterKeyStream = new Subject();
|
|
12
|
+
_items = [];
|
|
13
|
+
_selectedItemIndex = -1;
|
|
14
|
+
/** Buffer for the letters that the user has pressed */
|
|
15
|
+
_pressedLetters = [];
|
|
16
|
+
_skipPredicateFn;
|
|
17
|
+
_selectedItem = new Subject();
|
|
18
|
+
selectedItem = this._selectedItem;
|
|
19
|
+
constructor(initialItems, config) {
|
|
20
|
+
const typeAheadInterval = typeof config?.debounceInterval === 'number'
|
|
21
|
+
? config.debounceInterval
|
|
22
|
+
: DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL_MS;
|
|
23
|
+
if (config?.skipPredicate) {
|
|
24
|
+
this._skipPredicateFn = config.skipPredicate;
|
|
25
|
+
}
|
|
26
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
27
|
+
initialItems.length &&
|
|
28
|
+
initialItems.some(item => typeof item.getLabel !== 'function')) {
|
|
29
|
+
throw new Error('KeyManager items in typeahead mode must implement the `getLabel` method.');
|
|
30
|
+
}
|
|
31
|
+
this.setItems(initialItems);
|
|
32
|
+
this._setupKeyHandler(typeAheadInterval);
|
|
33
|
+
}
|
|
34
|
+
destroy() {
|
|
35
|
+
this._pressedLetters = [];
|
|
36
|
+
this._letterKeyStream.complete();
|
|
37
|
+
this._selectedItem.complete();
|
|
38
|
+
}
|
|
39
|
+
setCurrentSelectedItemIndex(index) {
|
|
40
|
+
this._selectedItemIndex = index;
|
|
41
|
+
}
|
|
42
|
+
setItems(items) {
|
|
43
|
+
this._items = items;
|
|
44
|
+
}
|
|
45
|
+
handleKey(event) {
|
|
46
|
+
const keyCode = event.keyCode;
|
|
47
|
+
// Attempt to use the `event.key` which also maps it to the user's keyboard language,
|
|
48
|
+
// otherwise fall back to resolving alphanumeric characters via the keyCode.
|
|
49
|
+
if (event.key && event.key.length === 1) {
|
|
50
|
+
this._letterKeyStream.next(event.key.toLocaleUpperCase());
|
|
51
|
+
}
|
|
52
|
+
else if ((keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE)) {
|
|
53
|
+
this._letterKeyStream.next(String.fromCharCode(keyCode));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Gets whether the user is currently typing into the manager using the typeahead feature. */
|
|
57
|
+
isTyping() {
|
|
58
|
+
return this._pressedLetters.length > 0;
|
|
59
|
+
}
|
|
60
|
+
/** Resets the currently stored sequence of typed letters. */
|
|
61
|
+
reset() {
|
|
62
|
+
this._pressedLetters = [];
|
|
63
|
+
}
|
|
64
|
+
_setupKeyHandler(typeAheadInterval) {
|
|
65
|
+
// Debounce the presses of non-navigational keys, collect the ones that correspond to letters
|
|
66
|
+
// and convert those letters back into a string. Afterwards find the first item that starts
|
|
67
|
+
// with that string and select it.
|
|
68
|
+
this._letterKeyStream
|
|
69
|
+
.pipe(tap(letter => this._pressedLetters.push(letter)), debounceTime(typeAheadInterval), filter(() => this._pressedLetters.length > 0), map(() => this._pressedLetters.join('').toLocaleUpperCase()))
|
|
70
|
+
.subscribe(inputString => {
|
|
71
|
+
// Start at 1 because we want to start searching at the item immediately
|
|
72
|
+
// following the current active item.
|
|
73
|
+
for (let i = 1; i < this._items.length + 1; i++) {
|
|
74
|
+
const index = (this._selectedItemIndex + i) % this._items.length;
|
|
75
|
+
const item = this._items[index];
|
|
76
|
+
if (!this._skipPredicateFn?.(item) &&
|
|
77
|
+
item.getLabel?.().toLocaleUpperCase().trim().indexOf(inputString) === 0) {
|
|
78
|
+
this._selectedItem.next(item);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this._pressedLetters = [];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { Typeahead as T };
|
|
88
|
+
//# sourceMappingURL=typeahead-11ae39bd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeahead-11ae39bd.mjs","sources":["../../../../../../src/cdk/a11y/key-manager/typeahead.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {A, NINE, Z, ZERO} from '../../keycodes';\nimport {Subject, Observable} from 'rxjs';\nimport {debounceTime, filter, map, tap} from 'rxjs/operators';\n\nconst DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL_MS = 200;\n\ninterface TypeaheadItem {\n getLabel?(): string;\n}\n\ninterface TypeaheadConfig<T> {\n debounceInterval?: number;\n skipPredicate?: (item: T) => boolean | undefined;\n}\n\n/**\n * Selects items based on keyboard inputs. Implements the typeahead functionality of\n * `role=\"listbox\"` or `role=\"tree\"` and other related roles.\n */\nexport class Typeahead<T extends TypeaheadItem> {\n private readonly _letterKeyStream = new Subject<string>();\n private _items: readonly T[] = [];\n private _selectedItemIndex = -1;\n\n /** Buffer for the letters that the user has pressed */\n private _pressedLetters: string[] = [];\n\n private _skipPredicateFn?: (item: T) => boolean | undefined;\n\n private readonly _selectedItem = new Subject<T>();\n readonly selectedItem: Observable<T> = this._selectedItem;\n\n constructor(initialItems: readonly T[], config?: TypeaheadConfig<T>) {\n const typeAheadInterval =\n typeof config?.debounceInterval === 'number'\n ? config.debounceInterval\n : DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL_MS;\n\n if (config?.skipPredicate) {\n this._skipPredicateFn = config.skipPredicate;\n }\n\n if (\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n initialItems.length &&\n initialItems.some(item => typeof item.getLabel !== 'function')\n ) {\n throw new Error('KeyManager items in typeahead mode must implement the `getLabel` method.');\n }\n\n this.setItems(initialItems);\n this._setupKeyHandler(typeAheadInterval);\n }\n\n destroy() {\n this._pressedLetters = [];\n this._letterKeyStream.complete();\n this._selectedItem.complete();\n }\n\n setCurrentSelectedItemIndex(index: number) {\n this._selectedItemIndex = index;\n }\n\n setItems(items: readonly T[]) {\n this._items = items;\n }\n\n handleKey(event: KeyboardEvent): void {\n const keyCode = event.keyCode;\n\n // Attempt to use the `event.key` which also maps it to the user's keyboard language,\n // otherwise fall back to resolving alphanumeric characters via the keyCode.\n if (event.key && event.key.length === 1) {\n this._letterKeyStream.next(event.key.toLocaleUpperCase());\n } else if ((keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE)) {\n this._letterKeyStream.next(String.fromCharCode(keyCode));\n }\n }\n\n /** Gets whether the user is currently typing into the manager using the typeahead feature. */\n isTyping(): boolean {\n return this._pressedLetters.length > 0;\n }\n\n /** Resets the currently stored sequence of typed letters. */\n reset(): void {\n this._pressedLetters = [];\n }\n\n private _setupKeyHandler(typeAheadInterval: number) {\n // Debounce the presses of non-navigational keys, collect the ones that correspond to letters\n // and convert those letters back into a string. Afterwards find the first item that starts\n // with that string and select it.\n this._letterKeyStream\n .pipe(\n tap(letter => this._pressedLetters.push(letter)),\n debounceTime(typeAheadInterval),\n filter(() => this._pressedLetters.length > 0),\n map(() => this._pressedLetters.join('').toLocaleUpperCase()),\n )\n .subscribe(inputString => {\n // Start at 1 because we want to start searching at the item immediately\n // following the current active item.\n for (let i = 1; i < this._items.length + 1; i++) {\n const index = (this._selectedItemIndex + i) % this._items.length;\n const item = this._items[index];\n\n if (\n !this._skipPredicateFn?.(item) &&\n item.getLabel?.().toLocaleUpperCase().trim().indexOf(inputString) === 0\n ) {\n this._selectedItem.next(item);\n break;\n }\n }\n\n this._pressedLetters = [];\n });\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Class to coordinate unique selection based on name.
|
|
6
|
+
* Intended to be consumed as an Angular service.
|
|
7
|
+
* This service is needed because native radio change events are only fired on the item currently
|
|
8
|
+
* being selected, and we still need to uncheck the previous selection.
|
|
9
|
+
*
|
|
10
|
+
* This service does not *store* any IDs and names because they may change at any time, so it is
|
|
11
|
+
* less error-prone if they are simply passed through when the events occur.
|
|
12
|
+
*/
|
|
13
|
+
class UniqueSelectionDispatcher {
|
|
14
|
+
_listeners = [];
|
|
15
|
+
/**
|
|
16
|
+
* Notify other items that selection for the given name has been set.
|
|
17
|
+
* @param id ID of the item.
|
|
18
|
+
* @param name Name of the item.
|
|
19
|
+
*/
|
|
20
|
+
notify(id, name) {
|
|
21
|
+
for (let listener of this._listeners) {
|
|
22
|
+
listener(id, name);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Listen for future changes to item selection.
|
|
27
|
+
* @return Function used to deregister listener
|
|
28
|
+
*/
|
|
29
|
+
listen(listener) {
|
|
30
|
+
this._listeners.push(listener);
|
|
31
|
+
return () => {
|
|
32
|
+
this._listeners = this._listeners.filter((registered) => {
|
|
33
|
+
return listener !== registered;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
ngOnDestroy() {
|
|
38
|
+
this._listeners = [];
|
|
39
|
+
}
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: UniqueSelectionDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
41
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: UniqueSelectionDispatcher, providedIn: 'root' });
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: UniqueSelectionDispatcher, decorators: [{
|
|
44
|
+
type: Injectable,
|
|
45
|
+
args: [{ providedIn: 'root' }]
|
|
46
|
+
}] });
|
|
47
|
+
|
|
48
|
+
export { UniqueSelectionDispatcher as U };
|
|
49
|
+
//# sourceMappingURL=unique-selection-dispatcher-1d6f91d8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique-selection-dispatcher-1d6f91d8.mjs","sources":["../../../../../../src/cdk/collections/unique-selection-dispatcher.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injectable, OnDestroy} from '@angular/core';\n\n// Users of the Dispatcher never need to see this type, but TypeScript requires it to be exported.\nexport type UniqueSelectionDispatcherListener = (id: string, name: string) => void;\n\n/**\n * Class to coordinate unique selection based on name.\n * Intended to be consumed as an Angular service.\n * This service is needed because native radio change events are only fired on the item currently\n * being selected, and we still need to uncheck the previous selection.\n *\n * This service does not *store* any IDs and names because they may change at any time, so it is\n * less error-prone if they are simply passed through when the events occur.\n */\n@Injectable({providedIn: 'root'})\nexport class UniqueSelectionDispatcher implements OnDestroy {\n private _listeners: UniqueSelectionDispatcherListener[] = [];\n\n /**\n * Notify other items that selection for the given name has been set.\n * @param id ID of the item.\n * @param name Name of the item.\n */\n notify(id: string, name: string) {\n for (let listener of this._listeners) {\n listener(id, name);\n }\n }\n\n /**\n * Listen for future changes to item selection.\n * @return Function used to deregister listener\n */\n listen(listener: UniqueSelectionDispatcherListener): () => void {\n this._listeners.push(listener);\n return () => {\n this._listeners = this._listeners.filter((registered: UniqueSelectionDispatcherListener) => {\n return listener !== registered;\n });\n };\n }\n\n ngOnDestroy() {\n this._listeners = [];\n }\n}\n"],"names":[],"mappings":";;;AAaA;;;;;;;;AAQG;MAEU,yBAAyB,CAAA;IAC5B,UAAU,GAAwC,EAAE,CAAA;AAE5D;;;;AAIG;IACH,MAAM,CAAC,EAAU,EAAE,IAAY,EAAA;AAC7B,QAAA,KAAK,IAAI,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;AACpC,YAAA,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;SACpB;KACF;AAEA;;;AAGG;AACH,IAAA,MAAM,CAAC,QAA2C,EAAA;AAChD,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AAC9B,QAAA,OAAO,MAAK;AACV,YAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,UAA6C,KAAI;gBACzF,OAAO,QAAQ,KAAK,UAAU,CAAA;AAChC,aAAC,CAAC,CAAA;AACJ,SAAC,CAAA;KACH;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;KACtB;8GA7BW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAzB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,cADb,MAAM,EAAA,CAAA,CAAA;;kGAClB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC,CAAA;;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component used to load the .cdk-visually-hidden styles.
|
|
6
|
+
* @docs-private
|
|
7
|
+
*/
|
|
8
|
+
class _VisuallyHiddenLoader {
|
|
9
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: _VisuallyHiddenLoader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0-next.1", type: _VisuallyHiddenLoader, isStandalone: true, selector: "ng-component", exportAs: ["cdkVisuallyHidden"], ngImport: i0, template: '', isInline: true, styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
11
|
+
}
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: _VisuallyHiddenLoader, decorators: [{
|
|
13
|
+
type: Component,
|
|
14
|
+
args: [{ exportAs: 'cdkVisuallyHidden', encapsulation: ViewEncapsulation.None, template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}"] }]
|
|
15
|
+
}] });
|
|
16
|
+
|
|
17
|
+
export { _VisuallyHiddenLoader as _ };
|
|
18
|
+
//# sourceMappingURL=visually-hidden-83aea4a0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visually-hidden-83aea4a0.mjs","sources":["../../../../../../src/cdk/private/visually-hidden/visually-hidden.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';\n\n/**\n * Component used to load the .cdk-visually-hidden styles.\n * @docs-private\n */\n@Component({\n styleUrl: 'visually-hidden.css',\n exportAs: 'cdkVisuallyHidden',\n encapsulation: ViewEncapsulation.None,\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class _VisuallyHiddenLoader {}\n"],"names":[],"mappings":";;;AAUA;;;AAGG;MAQU,qBAAqB,CAAA;8GAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,IAAA,EAAA,qBAAqB,yGAHtB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,kQAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;kGAGD,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAPjC,SAAS;+BAEE,mBAAmB,EAAA,aAAA,EACd,iBAAiB,CAAC,IAAI,YAC3B,EAAE,EAAA,eAAA,EACK,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,kQAAA,CAAA,EAAA,CAAA;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { L as ListKeyManagerOption, b as ListKeyManager } from './list-key-manager.d-72e9a2e7.js';
|
|
2
|
+
import { F as FocusOrigin } from './focus-monitor.d-810a02e6.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is the interface for focusable items (used by the FocusKeyManager).
|
|
6
|
+
* Each item must know how to focus itself, whether or not it is currently disabled
|
|
7
|
+
* and be able to supply its label.
|
|
8
|
+
*/
|
|
9
|
+
interface FocusableOption extends ListKeyManagerOption {
|
|
10
|
+
/** Focuses the `FocusableOption`. */
|
|
11
|
+
focus(origin?: FocusOrigin): void;
|
|
12
|
+
}
|
|
13
|
+
declare class FocusKeyManager<T> extends ListKeyManager<FocusableOption & T> {
|
|
14
|
+
private _origin;
|
|
15
|
+
/**
|
|
16
|
+
* Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
|
|
17
|
+
* @param origin Focus origin to be used when focusing items.
|
|
18
|
+
*/
|
|
19
|
+
setFocusOrigin(origin: FocusOrigin): this;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the active item to the item at the specified
|
|
22
|
+
* index and focuses the newly active item.
|
|
23
|
+
* @param index Index of the item to be set as active.
|
|
24
|
+
*/
|
|
25
|
+
setActiveItem(index: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the active item to the item that is specified and focuses it.
|
|
28
|
+
* @param item Item to be set as active.
|
|
29
|
+
*/
|
|
30
|
+
setActiveItem(item: T): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { type FocusableOption as F, FocusKeyManager as a };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, OnDestroy, ElementRef, AfterViewInit, EventEmitter } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
type FocusOrigin = 'touch' | 'mouse' | 'keyboard' | 'program' | null;
|
|
6
|
+
/**
|
|
7
|
+
* Corresponds to the options that can be passed to the native `focus` event.
|
|
8
|
+
* via https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
9
|
+
*/
|
|
10
|
+
interface FocusOptions {
|
|
11
|
+
/** Whether the browser should scroll to the element when it is focused. */
|
|
12
|
+
preventScroll?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Detection mode used for attributing the origin of a focus event. */
|
|
15
|
+
declare enum FocusMonitorDetectionMode {
|
|
16
|
+
/**
|
|
17
|
+
* Any mousedown, keydown, or touchstart event that happened in the previous
|
|
18
|
+
* tick or the current tick will be used to assign a focus event's origin (to
|
|
19
|
+
* either mouse, keyboard, or touch). This is the default option.
|
|
20
|
+
*/
|
|
21
|
+
IMMEDIATE = 0,
|
|
22
|
+
/**
|
|
23
|
+
* A focus event's origin is always attributed to the last corresponding
|
|
24
|
+
* mousedown, keydown, or touchstart event, no matter how long ago it occurred.
|
|
25
|
+
*/
|
|
26
|
+
EVENTUAL = 1
|
|
27
|
+
}
|
|
28
|
+
/** Injectable service-level options for FocusMonitor. */
|
|
29
|
+
interface FocusMonitorOptions {
|
|
30
|
+
detectionMode?: FocusMonitorDetectionMode;
|
|
31
|
+
}
|
|
32
|
+
/** InjectionToken for FocusMonitorOptions. */
|
|
33
|
+
declare const FOCUS_MONITOR_DEFAULT_OPTIONS: InjectionToken<FocusMonitorOptions>;
|
|
34
|
+
/** Monitors mouse and keyboard events to determine the cause of focus events. */
|
|
35
|
+
declare class FocusMonitor implements OnDestroy {
|
|
36
|
+
private _ngZone;
|
|
37
|
+
private _platform;
|
|
38
|
+
private readonly _inputModalityDetector;
|
|
39
|
+
/** The focus origin that the next focus event is a result of. */
|
|
40
|
+
private _origin;
|
|
41
|
+
/** The FocusOrigin of the last focus event tracked by the FocusMonitor. */
|
|
42
|
+
private _lastFocusOrigin;
|
|
43
|
+
/** Whether the window has just been focused. */
|
|
44
|
+
private _windowFocused;
|
|
45
|
+
/** The timeout id of the window focus timeout. */
|
|
46
|
+
private _windowFocusTimeoutId;
|
|
47
|
+
/** The timeout id of the origin clearing timeout. */
|
|
48
|
+
private _originTimeoutId;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the origin was determined via a touch interaction. Necessary as properly attributing
|
|
51
|
+
* focus events to touch interactions requires special logic.
|
|
52
|
+
*/
|
|
53
|
+
private _originFromTouchInteraction;
|
|
54
|
+
/** Map of elements being monitored to their info. */
|
|
55
|
+
private _elementInfo;
|
|
56
|
+
/** The number of elements currently being monitored. */
|
|
57
|
+
private _monitoredElementCount;
|
|
58
|
+
/**
|
|
59
|
+
* Keeps track of the root nodes to which we've currently bound a focus/blur handler,
|
|
60
|
+
* as well as the number of monitored elements that they contain. We have to treat focus/blur
|
|
61
|
+
* handlers differently from the rest of the events, because the browser won't emit events
|
|
62
|
+
* to the document when focus moves inside of a shadow root.
|
|
63
|
+
*/
|
|
64
|
+
private _rootNodeFocusListenerCount;
|
|
65
|
+
/**
|
|
66
|
+
* The specified detection mode, used for attributing the origin of a focus
|
|
67
|
+
* event.
|
|
68
|
+
*/
|
|
69
|
+
private readonly _detectionMode;
|
|
70
|
+
/**
|
|
71
|
+
* Event listener for `focus` events on the window.
|
|
72
|
+
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
73
|
+
*/
|
|
74
|
+
private _windowFocusListener;
|
|
75
|
+
/** Used to reference correct document/window */
|
|
76
|
+
protected _document?: Document | null | undefined;
|
|
77
|
+
/** Subject for stopping our InputModalityDetector subscription. */
|
|
78
|
+
private readonly _stopInputModalityDetector;
|
|
79
|
+
constructor(...args: unknown[]);
|
|
80
|
+
/**
|
|
81
|
+
* Event listener for `focus` and 'blur' events on the document.
|
|
82
|
+
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
83
|
+
*/
|
|
84
|
+
private _rootNodeFocusAndBlurListener;
|
|
85
|
+
/**
|
|
86
|
+
* Monitors focus on an element and applies appropriate CSS classes.
|
|
87
|
+
* @param element The element to monitor
|
|
88
|
+
* @param checkChildren Whether to count the element as focused when its children are focused.
|
|
89
|
+
* @returns An observable that emits when the focus state of the element changes.
|
|
90
|
+
* When the element is blurred, null will be emitted.
|
|
91
|
+
*/
|
|
92
|
+
monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
|
|
93
|
+
/**
|
|
94
|
+
* Monitors focus on an element and applies appropriate CSS classes.
|
|
95
|
+
* @param element The element to monitor
|
|
96
|
+
* @param checkChildren Whether to count the element as focused when its children are focused.
|
|
97
|
+
* @returns An observable that emits when the focus state of the element changes.
|
|
98
|
+
* When the element is blurred, null will be emitted.
|
|
99
|
+
*/
|
|
100
|
+
monitor(element: ElementRef<HTMLElement>, checkChildren?: boolean): Observable<FocusOrigin>;
|
|
101
|
+
/**
|
|
102
|
+
* Stops monitoring an element and removes all focus classes.
|
|
103
|
+
* @param element The element to stop monitoring.
|
|
104
|
+
*/
|
|
105
|
+
stopMonitoring(element: HTMLElement): void;
|
|
106
|
+
/**
|
|
107
|
+
* Stops monitoring an element and removes all focus classes.
|
|
108
|
+
* @param element The element to stop monitoring.
|
|
109
|
+
*/
|
|
110
|
+
stopMonitoring(element: ElementRef<HTMLElement>): void;
|
|
111
|
+
/**
|
|
112
|
+
* Focuses the element via the specified focus origin.
|
|
113
|
+
* @param element Element to focus.
|
|
114
|
+
* @param origin Focus origin.
|
|
115
|
+
* @param options Options that can be used to configure the focus behavior.
|
|
116
|
+
*/
|
|
117
|
+
focusVia(element: HTMLElement, origin: FocusOrigin, options?: FocusOptions): void;
|
|
118
|
+
/**
|
|
119
|
+
* Focuses the element via the specified focus origin.
|
|
120
|
+
* @param element Element to focus.
|
|
121
|
+
* @param origin Focus origin.
|
|
122
|
+
* @param options Options that can be used to configure the focus behavior.
|
|
123
|
+
*/
|
|
124
|
+
focusVia(element: ElementRef<HTMLElement>, origin: FocusOrigin, options?: FocusOptions): void;
|
|
125
|
+
ngOnDestroy(): void;
|
|
126
|
+
/** Access injected document if available or fallback to global document reference */
|
|
127
|
+
private _getDocument;
|
|
128
|
+
/** Use defaultView of injected document if available or fallback to global window reference */
|
|
129
|
+
private _getWindow;
|
|
130
|
+
private _getFocusOrigin;
|
|
131
|
+
/**
|
|
132
|
+
* Returns whether the focus event should be attributed to touch. Recall that in IMMEDIATE mode, a
|
|
133
|
+
* touch origin isn't immediately reset at the next tick (see _setOrigin). This means that when we
|
|
134
|
+
* handle a focus event following a touch interaction, we need to determine whether (1) the focus
|
|
135
|
+
* event was directly caused by the touch interaction or (2) the focus event was caused by a
|
|
136
|
+
* subsequent programmatic focus call triggered by the touch interaction.
|
|
137
|
+
* @param focusEventTarget The target of the focus event under examination.
|
|
138
|
+
*/
|
|
139
|
+
private _shouldBeAttributedToTouch;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the focus classes on the element based on the given focus origin.
|
|
142
|
+
* @param element The element to update the classes on.
|
|
143
|
+
* @param origin The focus origin.
|
|
144
|
+
*/
|
|
145
|
+
private _setClasses;
|
|
146
|
+
/**
|
|
147
|
+
* Updates the focus origin. If we're using immediate detection mode, we schedule an async
|
|
148
|
+
* function to clear the origin at the end of a timeout. The duration of the timeout depends on
|
|
149
|
+
* the origin being set.
|
|
150
|
+
* @param origin The origin to set.
|
|
151
|
+
* @param isFromInteraction Whether we are setting the origin from an interaction event.
|
|
152
|
+
*/
|
|
153
|
+
private _setOrigin;
|
|
154
|
+
/**
|
|
155
|
+
* Handles focus events on a registered element.
|
|
156
|
+
* @param event The focus event.
|
|
157
|
+
* @param element The monitored element.
|
|
158
|
+
*/
|
|
159
|
+
private _onFocus;
|
|
160
|
+
/**
|
|
161
|
+
* Handles blur events on a registered element.
|
|
162
|
+
* @param event The blur event.
|
|
163
|
+
* @param element The monitored element.
|
|
164
|
+
*/
|
|
165
|
+
_onBlur(event: FocusEvent, element: HTMLElement): void;
|
|
166
|
+
private _emitOrigin;
|
|
167
|
+
private _registerGlobalListeners;
|
|
168
|
+
private _removeGlobalListeners;
|
|
169
|
+
/** Updates all the state on an element once its focus origin has changed. */
|
|
170
|
+
private _originChanged;
|
|
171
|
+
/**
|
|
172
|
+
* Collects the `MonitoredElementInfo` of a particular element and
|
|
173
|
+
* all of its ancestors that have enabled `checkChildren`.
|
|
174
|
+
* @param element Element from which to start the search.
|
|
175
|
+
*/
|
|
176
|
+
private _getClosestElementsInfo;
|
|
177
|
+
/**
|
|
178
|
+
* Returns whether an interaction is likely to have come from the user clicking the `label` of
|
|
179
|
+
* an `input` or `textarea` in order to focus it.
|
|
180
|
+
* @param focusEventTarget Target currently receiving focus.
|
|
181
|
+
*/
|
|
182
|
+
private _isLastInteractionFromInputLabel;
|
|
183
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FocusMonitor, never>;
|
|
184
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FocusMonitor>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Directive that determines how a particular element was focused (via keyboard, mouse, touch, or
|
|
188
|
+
* programmatically) and adds corresponding classes to the element.
|
|
189
|
+
*
|
|
190
|
+
* There are two variants of this directive:
|
|
191
|
+
* 1) cdkMonitorElementFocus: does not consider an element to be focused if one of its children is
|
|
192
|
+
* focused.
|
|
193
|
+
* 2) cdkMonitorSubtreeFocus: considers an element focused if it or any of its children are focused.
|
|
194
|
+
*/
|
|
195
|
+
declare class CdkMonitorFocus implements AfterViewInit, OnDestroy {
|
|
196
|
+
private _elementRef;
|
|
197
|
+
private _focusMonitor;
|
|
198
|
+
private _monitorSubscription;
|
|
199
|
+
private _focusOrigin;
|
|
200
|
+
readonly cdkFocusChange: EventEmitter<FocusOrigin>;
|
|
201
|
+
constructor(...args: unknown[]);
|
|
202
|
+
get focusOrigin(): FocusOrigin;
|
|
203
|
+
ngAfterViewInit(): void;
|
|
204
|
+
ngOnDestroy(): void;
|
|
205
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CdkMonitorFocus, never>;
|
|
206
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMonitorFocus, "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", ["cdkMonitorFocus"], {}, { "cdkFocusChange": "cdkFocusChange"; }, never, never, true, never>;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { CdkMonitorFocus as C, type FocusOrigin as F, type FocusOptions as a, FocusMonitorDetectionMode as b, type FocusMonitorOptions as c, FOCUS_MONITOR_DEFAULT_OPTIONS as d, FocusMonitor as e };
|