@angular/aria 21.0.3 → 21.1.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/_adev_assets/aria-accordion.json +743 -0
- package/_adev_assets/aria-combobox.json +603 -0
- package/_adev_assets/aria-grid.json +893 -0
- package/_adev_assets/aria-listbox.json +540 -0
- package/_adev_assets/aria-menu.json +1049 -0
- package/_adev_assets/aria-tabs.json +880 -0
- package/_adev_assets/aria-toolbar.json +545 -0
- package/_adev_assets/aria-tree.json +853 -0
- package/fesm2022/_widget-chunk.mjs +246 -4
- package/fesm2022/_widget-chunk.mjs.map +1 -1
- package/fesm2022/accordion.mjs +4 -17
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs +120 -96
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +201 -225
- package/fesm2022/grid.mjs.map +1 -1
- package/fesm2022/listbox.mjs +161 -173
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +238 -256
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +932 -7
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs.mjs +168 -182
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +3 -15
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree.mjs +2 -4
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +3 -3
- package/types/_grid-chunk.d.ts +210 -3
- package/types/accordion.d.ts +49 -52
- package/types/combobox.d.ts +111 -25
- package/types/grid.d.ts +32 -37
- package/types/listbox.d.ts +5 -8
- package/types/menu.d.ts +113 -113
- package/types/private.d.ts +498 -10
- package/types/tabs.d.ts +84 -89
- package/types/toolbar.d.ts +66 -69
- package/types/tree.d.ts +103 -106
- package/fesm2022/_combobox-chunk.mjs +0 -425
- package/fesm2022/_combobox-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +0 -522
- package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-popup-chunk.mjs +0 -46
- package/fesm2022/_combobox-popup-chunk.mjs.map +0 -1
- package/fesm2022/_list-navigation-chunk.mjs +0 -116
- package/fesm2022/_list-navigation-chunk.mjs.map +0 -1
- package/fesm2022/_pointer-event-manager-chunk.mjs +0 -134
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
- package/types/_combobox-chunk.d.ts +0 -98
- package/types/_combobox-chunk.d2.ts +0 -193
- package/types/_list-chunk.d.ts +0 -212
- package/types/_list-navigation-chunk.d.ts +0 -212
- package/types/_listbox-chunk.d.ts +0 -106
|
@@ -1,6 +1,248 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { signal, computed, linkedSignal, untracked } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
var Modifier;
|
|
4
|
+
(function (Modifier) {
|
|
5
|
+
Modifier[Modifier["None"] = 0] = "None";
|
|
6
|
+
Modifier[Modifier["Ctrl"] = 1] = "Ctrl";
|
|
7
|
+
Modifier[Modifier["Shift"] = 2] = "Shift";
|
|
8
|
+
Modifier[Modifier["Alt"] = 4] = "Alt";
|
|
9
|
+
Modifier[Modifier["Meta"] = 8] = "Meta";
|
|
10
|
+
Modifier["Any"] = "Any";
|
|
11
|
+
})(Modifier || (Modifier = {}));
|
|
12
|
+
class EventManager {
|
|
13
|
+
configs = [];
|
|
14
|
+
handle(event) {
|
|
15
|
+
for (const config of this.configs) {
|
|
16
|
+
if (config.matcher(event)) {
|
|
17
|
+
config.handler(event);
|
|
18
|
+
if (config.preventDefault) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
}
|
|
21
|
+
if (config.stopPropagation) {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function getModifiers(event) {
|
|
29
|
+
return (+event.ctrlKey && Modifier.Ctrl) | (+event.shiftKey && Modifier.Shift) | (+event.altKey && Modifier.Alt) | (+event.metaKey && Modifier.Meta);
|
|
30
|
+
}
|
|
31
|
+
function hasModifiers(event, modifiers) {
|
|
32
|
+
const eventModifiers = getModifiers(event);
|
|
33
|
+
const modifiersList = Array.isArray(modifiers) ? modifiers : [modifiers];
|
|
34
|
+
if (modifiersList.includes(Modifier.Any)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return modifiersList.some(modifiers => eventModifiers === modifiers);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class KeyboardEventManager extends EventManager {
|
|
41
|
+
options = {
|
|
42
|
+
preventDefault: true,
|
|
43
|
+
stopPropagation: true
|
|
44
|
+
};
|
|
45
|
+
on(...args) {
|
|
46
|
+
const {
|
|
47
|
+
modifiers,
|
|
48
|
+
key,
|
|
49
|
+
handler,
|
|
50
|
+
options
|
|
51
|
+
} = this._normalizeInputs(...args);
|
|
52
|
+
this.configs.push({
|
|
53
|
+
handler: handler,
|
|
54
|
+
matcher: event => this._isMatch(event, key, modifiers),
|
|
55
|
+
...this.options,
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
_normalizeInputs(...args) {
|
|
61
|
+
const withModifiers = Array.isArray(args[0]) || args[0] in Modifier;
|
|
62
|
+
const modifiers = withModifiers ? args[0] : Modifier.None;
|
|
63
|
+
const key = withModifiers ? args[1] : args[0];
|
|
64
|
+
const handler = withModifiers ? args[2] : args[1];
|
|
65
|
+
const options = withModifiers ? args[3] : args[2];
|
|
66
|
+
return {
|
|
67
|
+
key: key,
|
|
68
|
+
handler: handler,
|
|
69
|
+
modifiers: modifiers,
|
|
70
|
+
options: options ?? {}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
_isMatch(event, key, modifiers) {
|
|
74
|
+
if (!hasModifiers(event, modifiers)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
if (key instanceof RegExp) {
|
|
78
|
+
return key.test(event.key);
|
|
79
|
+
}
|
|
80
|
+
const keyStr = typeof key === 'string' ? key : key();
|
|
81
|
+
return keyStr.toLowerCase() === event.key.toLowerCase();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var MouseButton;
|
|
86
|
+
(function (MouseButton) {
|
|
87
|
+
MouseButton[MouseButton["Main"] = 0] = "Main";
|
|
88
|
+
MouseButton[MouseButton["Auxiliary"] = 1] = "Auxiliary";
|
|
89
|
+
MouseButton[MouseButton["Secondary"] = 2] = "Secondary";
|
|
90
|
+
})(MouseButton || (MouseButton = {}));
|
|
91
|
+
class PointerEventManager extends EventManager {
|
|
92
|
+
options = {
|
|
93
|
+
preventDefault: false,
|
|
94
|
+
stopPropagation: false
|
|
95
|
+
};
|
|
96
|
+
on(...args) {
|
|
97
|
+
const {
|
|
98
|
+
button,
|
|
99
|
+
handler,
|
|
100
|
+
modifiers
|
|
101
|
+
} = this._normalizeInputs(...args);
|
|
102
|
+
this.configs.push({
|
|
103
|
+
handler,
|
|
104
|
+
matcher: event => this._isMatch(event, button, modifiers),
|
|
105
|
+
...this.options
|
|
106
|
+
});
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
_normalizeInputs(...args) {
|
|
110
|
+
if (args.length === 3) {
|
|
111
|
+
return {
|
|
112
|
+
button: args[0],
|
|
113
|
+
modifiers: args[1],
|
|
114
|
+
handler: args[2]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (args.length === 2) {
|
|
118
|
+
return {
|
|
119
|
+
button: MouseButton.Main,
|
|
120
|
+
modifiers: args[0],
|
|
121
|
+
handler: args[1]
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
button: MouseButton.Main,
|
|
126
|
+
modifiers: Modifier.None,
|
|
127
|
+
handler: args[0]
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
_isMatch(event, button, modifiers) {
|
|
131
|
+
return button === (event.button ?? 0) && hasModifiers(event, modifiers);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
class ListFocus {
|
|
136
|
+
inputs;
|
|
137
|
+
prevActiveItem = signal(undefined);
|
|
138
|
+
prevActiveIndex = computed(() => {
|
|
139
|
+
return this.prevActiveItem() ? this.inputs.items().indexOf(this.prevActiveItem()) : -1;
|
|
140
|
+
});
|
|
141
|
+
activeIndex = computed(() => {
|
|
142
|
+
return this.inputs.activeItem() ? this.inputs.items().indexOf(this.inputs.activeItem()) : -1;
|
|
143
|
+
});
|
|
144
|
+
constructor(inputs) {
|
|
145
|
+
this.inputs = inputs;
|
|
146
|
+
}
|
|
147
|
+
isListDisabled() {
|
|
148
|
+
return this.inputs.disabled() || this.inputs.items().every(i => i.disabled());
|
|
149
|
+
}
|
|
150
|
+
getActiveDescendant() {
|
|
151
|
+
if (this.isListDisabled()) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
if (this.inputs.focusMode() === 'roving') {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
return this.inputs.activeItem()?.id() ?? undefined;
|
|
158
|
+
}
|
|
159
|
+
getListTabIndex() {
|
|
160
|
+
if (this.isListDisabled()) {
|
|
161
|
+
return 0;
|
|
162
|
+
}
|
|
163
|
+
return this.inputs.focusMode() === 'activedescendant' ? 0 : -1;
|
|
164
|
+
}
|
|
165
|
+
getItemTabIndex(item) {
|
|
166
|
+
if (this.isListDisabled()) {
|
|
167
|
+
return -1;
|
|
168
|
+
}
|
|
169
|
+
if (this.inputs.focusMode() === 'activedescendant') {
|
|
170
|
+
return -1;
|
|
171
|
+
}
|
|
172
|
+
return this.inputs.activeItem() === item ? 0 : -1;
|
|
173
|
+
}
|
|
174
|
+
focus(item, opts) {
|
|
175
|
+
if (this.isListDisabled() || !this.isFocusable(item)) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
this.prevActiveItem.set(this.inputs.activeItem());
|
|
179
|
+
this.inputs.activeItem.set(item);
|
|
180
|
+
if (opts?.focusElement || opts?.focusElement === undefined) {
|
|
181
|
+
this.inputs.focusMode() === 'roving' ? item.element()?.focus() : this.inputs.element()?.focus();
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
isFocusable(item) {
|
|
186
|
+
return !item.disabled() || this.inputs.softDisabled();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
class ListNavigation {
|
|
191
|
+
inputs;
|
|
192
|
+
constructor(inputs) {
|
|
193
|
+
this.inputs = inputs;
|
|
194
|
+
}
|
|
195
|
+
goto(item, opts) {
|
|
196
|
+
return item ? this.inputs.focusManager.focus(item, opts) : false;
|
|
197
|
+
}
|
|
198
|
+
next(opts) {
|
|
199
|
+
return this._advance(1, opts);
|
|
200
|
+
}
|
|
201
|
+
peekNext() {
|
|
202
|
+
return this._peek(1);
|
|
203
|
+
}
|
|
204
|
+
prev(opts) {
|
|
205
|
+
return this._advance(-1, opts);
|
|
206
|
+
}
|
|
207
|
+
peekPrev() {
|
|
208
|
+
return this._peek(-1);
|
|
209
|
+
}
|
|
210
|
+
first(opts) {
|
|
211
|
+
const item = this.peekFirst();
|
|
212
|
+
return item ? this.goto(item, opts) : false;
|
|
213
|
+
}
|
|
214
|
+
last(opts) {
|
|
215
|
+
const item = this.peekLast();
|
|
216
|
+
return item ? this.goto(item, opts) : false;
|
|
217
|
+
}
|
|
218
|
+
peekFirst(items = this.inputs.items()) {
|
|
219
|
+
return items.find(i => this.inputs.focusManager.isFocusable(i));
|
|
220
|
+
}
|
|
221
|
+
peekLast(items = this.inputs.items()) {
|
|
222
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
223
|
+
if (this.inputs.focusManager.isFocusable(items[i])) {
|
|
224
|
+
return items[i];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
_advance(delta, opts) {
|
|
230
|
+
const item = this._peek(delta);
|
|
231
|
+
return item ? this.goto(item, opts) : false;
|
|
232
|
+
}
|
|
233
|
+
_peek(delta) {
|
|
234
|
+
const items = this.inputs.items();
|
|
235
|
+
const itemCount = items.length;
|
|
236
|
+
const startIndex = this.inputs.focusManager.activeIndex();
|
|
237
|
+
const step = i => this.inputs.wrap() ? (i + delta + itemCount) % itemCount : i + delta;
|
|
238
|
+
for (let i = step(startIndex); i !== startIndex && i < itemCount && i >= 0; i = step(i)) {
|
|
239
|
+
if (this.inputs.focusManager.isFocusable(items[i])) {
|
|
240
|
+
return items[i];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
4
246
|
|
|
5
247
|
class GridData {
|
|
6
248
|
inputs;
|
|
@@ -1034,5 +1276,5 @@ class GridCellWidgetPattern {
|
|
|
1034
1276
|
}
|
|
1035
1277
|
}
|
|
1036
1278
|
|
|
1037
|
-
export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern };
|
|
1279
|
+
export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern, KeyboardEventManager, ListFocus, ListNavigation, Modifier, PointerEventManager };
|
|
1038
1280
|
//# sourceMappingURL=_widget-chunk.mjs.map
|