@angular/platform-browser 21.0.0-next.9 → 21.0.0-rc.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.
- package/fesm2022/_browser-chunk.mjs +359 -473
- package/fesm2022/_browser-chunk.mjs.map +1 -1
- package/fesm2022/_dom_renderer-chunk.mjs +724 -760
- package/fesm2022/_dom_renderer-chunk.mjs.map +1 -1
- package/fesm2022/animations-async.mjs +214 -278
- package/fesm2022/animations-async.mjs.map +1 -1
- package/fesm2022/animations.mjs +154 -167
- package/fesm2022/animations.mjs.map +1 -1
- package/fesm2022/platform-browser.mjs +614 -887
- package/fesm2022/platform-browser.mjs.map +1 -1
- package/fesm2022/testing.mjs +101 -65
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +4 -4
- package/types/_browser-chunk.d.ts +1 -1
- package/types/animations-async.d.ts +1 -1
- package/types/animations.d.ts +1 -1
- package/types/platform-browser.d.ts +1 -1
- package/types/testing.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-
|
|
2
|
+
* @license Angular v21.0.0-rc.0
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -9,530 +9,416 @@ import * as i0 from '@angular/core';
|
|
|
9
9
|
import { ɵglobal as _global, ɵRuntimeError as _RuntimeError, Injectable, Inject, ɵresolveComponentResources as _resolveComponentResources, ɵinternalCreateApplication as _internalCreateApplication, PLATFORM_ID, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, InjectionToken, ɵTESTABILITY_GETTER as _TESTABILITY_GETTER, ɵTESTABILITY as _TESTABILITY, Testability, ɵINJECTOR_SCOPE as _INJECTOR_SCOPE, ErrorHandler, RendererFactory2, inject, ApplicationModule, NgModule, ɵsetDocument as _setDocument } from '@angular/core';
|
|
10
10
|
import { EventManagerPlugin, EVENT_MANAGER_PLUGINS, DomEventsPlugin, DomRendererFactory2, SharedStylesHost, EventManager } from './_dom_renderer-chunk.mjs';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* A `DomAdapter` powered by full browser DOM APIs.
|
|
14
|
-
*
|
|
15
|
-
* @security Tread carefully! Interacting with the DOM directly is dangerous and
|
|
16
|
-
* can introduce XSS risks.
|
|
17
|
-
*/
|
|
18
12
|
class BrowserDomAdapter extends _DomAdapter {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return window;
|
|
55
|
-
}
|
|
56
|
-
if (target === 'document') {
|
|
57
|
-
return doc;
|
|
58
|
-
}
|
|
59
|
-
if (target === 'body') {
|
|
60
|
-
return doc.body;
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
getBaseHref(doc) {
|
|
65
|
-
const href = getBaseElementHref();
|
|
66
|
-
return href == null ? null : relativePath(href);
|
|
67
|
-
}
|
|
68
|
-
resetBaseElement() {
|
|
69
|
-
baseElement = null;
|
|
13
|
+
supportsDOMEvents = true;
|
|
14
|
+
static makeCurrent() {
|
|
15
|
+
_setRootDomAdapter(new BrowserDomAdapter());
|
|
16
|
+
}
|
|
17
|
+
onAndCancel(el, evt, listener, options) {
|
|
18
|
+
el.addEventListener(evt, listener, options);
|
|
19
|
+
return () => {
|
|
20
|
+
el.removeEventListener(evt, listener, options);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
dispatchEvent(el, evt) {
|
|
24
|
+
el.dispatchEvent(evt);
|
|
25
|
+
}
|
|
26
|
+
remove(node) {
|
|
27
|
+
node.remove();
|
|
28
|
+
}
|
|
29
|
+
createElement(tagName, doc) {
|
|
30
|
+
doc = doc || this.getDefaultDocument();
|
|
31
|
+
return doc.createElement(tagName);
|
|
32
|
+
}
|
|
33
|
+
createHtmlDocument() {
|
|
34
|
+
return document.implementation.createHTMLDocument('fakeTitle');
|
|
35
|
+
}
|
|
36
|
+
getDefaultDocument() {
|
|
37
|
+
return document;
|
|
38
|
+
}
|
|
39
|
+
isElementNode(node) {
|
|
40
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
41
|
+
}
|
|
42
|
+
isShadowRoot(node) {
|
|
43
|
+
return node instanceof DocumentFragment;
|
|
44
|
+
}
|
|
45
|
+
getGlobalEventTarget(doc, target) {
|
|
46
|
+
if (target === 'window') {
|
|
47
|
+
return window;
|
|
70
48
|
}
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
if (target === 'document') {
|
|
50
|
+
return doc;
|
|
73
51
|
}
|
|
74
|
-
|
|
75
|
-
|
|
52
|
+
if (target === 'body') {
|
|
53
|
+
return doc.body;
|
|
76
54
|
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
getBaseHref(doc) {
|
|
58
|
+
const href = getBaseElementHref();
|
|
59
|
+
return href == null ? null : relativePath(href);
|
|
60
|
+
}
|
|
61
|
+
resetBaseElement() {
|
|
62
|
+
baseElement = null;
|
|
63
|
+
}
|
|
64
|
+
getUserAgent() {
|
|
65
|
+
return window.navigator.userAgent;
|
|
66
|
+
}
|
|
67
|
+
getCookie(name) {
|
|
68
|
+
return _parseCookieValue(document.cookie, name);
|
|
69
|
+
}
|
|
77
70
|
}
|
|
78
71
|
let baseElement = null;
|
|
79
72
|
function getBaseElementHref() {
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
baseElement = baseElement || document.head.querySelector('base');
|
|
74
|
+
return baseElement ? baseElement.getAttribute('href') : null;
|
|
82
75
|
}
|
|
83
76
|
function relativePath(url) {
|
|
84
|
-
|
|
85
|
-
// to resolve against. In the browser `HTMLBaseElement.href` is always absolute.
|
|
86
|
-
return new URL(url, document.baseURI).pathname;
|
|
77
|
+
return new URL(url, document.baseURI).pathname;
|
|
87
78
|
}
|
|
88
79
|
|
|
89
80
|
class BrowserGetTestability {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
callback();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
testabilities.forEach((testability) => {
|
|
111
|
-
testability.whenStable(decrement);
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
if (!_global['frameworkStabilizers']) {
|
|
115
|
-
_global['frameworkStabilizers'] = [];
|
|
81
|
+
addToWindow(registry) {
|
|
82
|
+
_global['getAngularTestability'] = (elem, findInAncestors = true) => {
|
|
83
|
+
const testability = registry.findTestabilityInTree(elem, findInAncestors);
|
|
84
|
+
if (testability == null) {
|
|
85
|
+
throw new _RuntimeError(5103, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Could not find testability for element.');
|
|
86
|
+
}
|
|
87
|
+
return testability;
|
|
88
|
+
};
|
|
89
|
+
_global['getAllAngularTestabilities'] = () => registry.getAllTestabilities();
|
|
90
|
+
_global['getAllAngularRootElements'] = () => registry.getAllRootElements();
|
|
91
|
+
const whenAllStable = callback => {
|
|
92
|
+
const testabilities = _global['getAllAngularTestabilities']();
|
|
93
|
+
let count = testabilities.length;
|
|
94
|
+
const decrement = function () {
|
|
95
|
+
count--;
|
|
96
|
+
if (count == 0) {
|
|
97
|
+
callback();
|
|
116
98
|
}
|
|
117
|
-
|
|
99
|
+
};
|
|
100
|
+
testabilities.forEach(testability => {
|
|
101
|
+
testability.whenStable(decrement);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
if (!_global['frameworkStabilizers']) {
|
|
105
|
+
_global['frameworkStabilizers'] = [];
|
|
118
106
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (t != null) {
|
|
125
|
-
return t;
|
|
126
|
-
}
|
|
127
|
-
else if (!findInAncestors) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
if (_getDOM().isShadowRoot(elem)) {
|
|
131
|
-
return this.findTestabilityInTree(registry, elem.host, true);
|
|
132
|
-
}
|
|
133
|
-
return this.findTestabilityInTree(registry, elem.parentElement, true);
|
|
107
|
+
_global['frameworkStabilizers'].push(whenAllStable);
|
|
108
|
+
}
|
|
109
|
+
findTestabilityInTree(registry, elem, findInAncestors) {
|
|
110
|
+
if (elem == null) {
|
|
111
|
+
return null;
|
|
134
112
|
}
|
|
113
|
+
const t = registry.getTestability(elem);
|
|
114
|
+
if (t != null) {
|
|
115
|
+
return t;
|
|
116
|
+
} else if (!findInAncestors) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
if (_getDOM().isShadowRoot(elem)) {
|
|
120
|
+
return this.findTestabilityInTree(registry, elem.host, true);
|
|
121
|
+
}
|
|
122
|
+
return this.findTestabilityInTree(registry, elem.parentElement, true);
|
|
123
|
+
}
|
|
135
124
|
}
|
|
136
125
|
|
|
137
|
-
/**
|
|
138
|
-
* A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.
|
|
139
|
-
*/
|
|
140
126
|
class BrowserXhr {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
127
|
+
build() {
|
|
128
|
+
return new XMLHttpRequest();
|
|
129
|
+
}
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
131
|
+
minVersion: "12.0.0",
|
|
132
|
+
version: "21.0.0-rc.0",
|
|
133
|
+
ngImport: i0,
|
|
134
|
+
type: BrowserXhr,
|
|
135
|
+
deps: [],
|
|
136
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
137
|
+
});
|
|
138
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
139
|
+
minVersion: "12.0.0",
|
|
140
|
+
version: "21.0.0-rc.0",
|
|
141
|
+
ngImport: i0,
|
|
142
|
+
type: BrowserXhr
|
|
143
|
+
});
|
|
146
144
|
}
|
|
147
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
146
|
+
minVersion: "12.0.0",
|
|
147
|
+
version: "21.0.0-rc.0",
|
|
148
|
+
ngImport: i0,
|
|
149
|
+
type: BrowserXhr,
|
|
150
|
+
decorators: [{
|
|
151
|
+
type: Injectable
|
|
152
|
+
}]
|
|
153
|
+
});
|
|
150
154
|
|
|
151
|
-
/**
|
|
152
|
-
* Defines supported modifiers for key events.
|
|
153
|
-
*/
|
|
154
155
|
const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
|
155
|
-
// The following values are here for cross-browser compatibility and to match the W3C standard
|
|
156
|
-
// cf https://www.w3.org/TR/DOM-Level-3-Events-key/
|
|
157
156
|
const _keyMap = {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
157
|
+
'\b': 'Backspace',
|
|
158
|
+
'\t': 'Tab',
|
|
159
|
+
'\x7F': 'Delete',
|
|
160
|
+
'\x1B': 'Escape',
|
|
161
|
+
'Del': 'Delete',
|
|
162
|
+
'Esc': 'Escape',
|
|
163
|
+
'Left': 'ArrowLeft',
|
|
164
|
+
'Right': 'ArrowRight',
|
|
165
|
+
'Up': 'ArrowUp',
|
|
166
|
+
'Down': 'ArrowDown',
|
|
167
|
+
'Menu': 'ContextMenu',
|
|
168
|
+
'Scroll': 'ScrollLock',
|
|
169
|
+
'Win': 'OS'
|
|
171
170
|
};
|
|
172
|
-
/**
|
|
173
|
-
* Retrieves modifiers from key-event objects.
|
|
174
|
-
*/
|
|
175
171
|
const MODIFIER_KEY_GETTERS = {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
'alt': event => event.altKey,
|
|
173
|
+
'control': event => event.ctrlKey,
|
|
174
|
+
'meta': event => event.metaKey,
|
|
175
|
+
'shift': event => event.shiftKey
|
|
180
176
|
};
|
|
181
|
-
/**
|
|
182
|
-
* A browser plug-in that provides support for handling of key events in Angular.
|
|
183
|
-
*/
|
|
184
177
|
class KeyEventsPlugin extends EventManagerPlugin {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
178
|
+
constructor(doc) {
|
|
179
|
+
super(doc);
|
|
180
|
+
}
|
|
181
|
+
supports(eventName) {
|
|
182
|
+
return KeyEventsPlugin.parseEventName(eventName) != null;
|
|
183
|
+
}
|
|
184
|
+
addEventListener(element, eventName, handler, options) {
|
|
185
|
+
const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
|
|
186
|
+
const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
|
187
|
+
return this.manager.getZone().runOutsideAngular(() => {
|
|
188
|
+
return _getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler, options);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
static parseEventName(eventName) {
|
|
192
|
+
const parts = eventName.toLowerCase().split('.');
|
|
193
|
+
const domEventName = parts.shift();
|
|
194
|
+
if (parts.length === 0 || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
|
195
|
+
return null;
|
|
191
196
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return KeyEventsPlugin.parseEventName(eventName) != null;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Registers a handler for a specific element and key event.
|
|
202
|
-
* @param element The HTML element to receive event notifications.
|
|
203
|
-
* @param eventName The name of the key event to listen for.
|
|
204
|
-
* @param handler A function to call when the notification occurs. Receives the
|
|
205
|
-
* event object as an argument.
|
|
206
|
-
* @returns The key event that was registered.
|
|
207
|
-
*/
|
|
208
|
-
addEventListener(element, eventName, handler, options) {
|
|
209
|
-
const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
|
|
210
|
-
const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
|
211
|
-
return this.manager.getZone().runOutsideAngular(() => {
|
|
212
|
-
return _getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler, options);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Parses the user provided full keyboard event definition and normalizes it for
|
|
217
|
-
* later internal use. It ensures the string is all lowercase, converts special
|
|
218
|
-
* characters to a standard spelling, and orders all the values consistently.
|
|
219
|
-
*
|
|
220
|
-
* @param eventName The name of the key event to listen for.
|
|
221
|
-
* @returns an object with the full, normalized string, and the dom event name
|
|
222
|
-
* or null in the case when the event doesn't match a keyboard event.
|
|
223
|
-
*/
|
|
224
|
-
static parseEventName(eventName) {
|
|
225
|
-
const parts = eventName.toLowerCase().split('.');
|
|
226
|
-
const domEventName = parts.shift();
|
|
227
|
-
if (parts.length === 0 || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
const key = KeyEventsPlugin._normalizeKey(parts.pop());
|
|
231
|
-
let fullKey = '';
|
|
232
|
-
let codeIX = parts.indexOf('code');
|
|
233
|
-
if (codeIX > -1) {
|
|
234
|
-
parts.splice(codeIX, 1);
|
|
235
|
-
fullKey = 'code.';
|
|
236
|
-
}
|
|
237
|
-
MODIFIER_KEYS.forEach((modifierName) => {
|
|
238
|
-
const index = parts.indexOf(modifierName);
|
|
239
|
-
if (index > -1) {
|
|
240
|
-
parts.splice(index, 1);
|
|
241
|
-
fullKey += modifierName + '.';
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
fullKey += key;
|
|
245
|
-
if (parts.length != 0 || key.length === 0) {
|
|
246
|
-
// returning null instead of throwing to let another plugin process the event
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
// NOTE: Please don't rewrite this as so, as it will break JSCompiler property renaming.
|
|
250
|
-
// The code must remain in the `result['domEventName']` form.
|
|
251
|
-
// return {domEventName, fullKey};
|
|
252
|
-
const result = {};
|
|
253
|
-
result['domEventName'] = domEventName;
|
|
254
|
-
result['fullKey'] = fullKey;
|
|
255
|
-
return result;
|
|
197
|
+
const key = KeyEventsPlugin._normalizeKey(parts.pop());
|
|
198
|
+
let fullKey = '';
|
|
199
|
+
let codeIX = parts.indexOf('code');
|
|
200
|
+
if (codeIX > -1) {
|
|
201
|
+
parts.splice(codeIX, 1);
|
|
202
|
+
fullKey = 'code.';
|
|
256
203
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
static matchEventFullKeyCode(event, fullKeyCode) {
|
|
268
|
-
let keycode = _keyMap[event.key] || event.key;
|
|
269
|
-
let key = '';
|
|
270
|
-
if (fullKeyCode.indexOf('code.') > -1) {
|
|
271
|
-
keycode = event.code;
|
|
272
|
-
key = 'code.';
|
|
273
|
-
}
|
|
274
|
-
// the keycode could be unidentified so we have to check here
|
|
275
|
-
if (keycode == null || !keycode)
|
|
276
|
-
return false;
|
|
277
|
-
keycode = keycode.toLowerCase();
|
|
278
|
-
if (keycode === ' ') {
|
|
279
|
-
keycode = 'space'; // for readability
|
|
280
|
-
}
|
|
281
|
-
else if (keycode === '.') {
|
|
282
|
-
keycode = 'dot'; // because '.' is used as a separator in event names
|
|
283
|
-
}
|
|
284
|
-
MODIFIER_KEYS.forEach((modifierName) => {
|
|
285
|
-
if (modifierName !== keycode) {
|
|
286
|
-
const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
|
287
|
-
if (modifierGetter(event)) {
|
|
288
|
-
key += modifierName + '.';
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
key += keycode;
|
|
293
|
-
return key === fullKeyCode;
|
|
204
|
+
MODIFIER_KEYS.forEach(modifierName => {
|
|
205
|
+
const index = parts.indexOf(modifierName);
|
|
206
|
+
if (index > -1) {
|
|
207
|
+
parts.splice(index, 1);
|
|
208
|
+
fullKey += modifierName + '.';
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
fullKey += key;
|
|
212
|
+
if (parts.length != 0 || key.length === 0) {
|
|
213
|
+
return null;
|
|
294
214
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
};
|
|
215
|
+
const result = {};
|
|
216
|
+
result['domEventName'] = domEventName;
|
|
217
|
+
result['fullKey'] = fullKey;
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
static matchEventFullKeyCode(event, fullKeyCode) {
|
|
221
|
+
let keycode = _keyMap[event.key] || event.key;
|
|
222
|
+
let key = '';
|
|
223
|
+
if (fullKeyCode.indexOf('code.') > -1) {
|
|
224
|
+
keycode = event.code;
|
|
225
|
+
key = 'code.';
|
|
308
226
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
227
|
+
if (keycode == null || !keycode) return false;
|
|
228
|
+
keycode = keycode.toLowerCase();
|
|
229
|
+
if (keycode === ' ') {
|
|
230
|
+
keycode = 'space';
|
|
231
|
+
} else if (keycode === '.') {
|
|
232
|
+
keycode = 'dot';
|
|
312
233
|
}
|
|
313
|
-
|
|
314
|
-
|
|
234
|
+
MODIFIER_KEYS.forEach(modifierName => {
|
|
235
|
+
if (modifierName !== keycode) {
|
|
236
|
+
const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
|
237
|
+
if (modifierGetter(event)) {
|
|
238
|
+
key += modifierName + '.';
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
key += keycode;
|
|
243
|
+
return key === fullKeyCode;
|
|
244
|
+
}
|
|
245
|
+
static eventCallback(fullKey, handler, zone) {
|
|
246
|
+
return event => {
|
|
247
|
+
if (KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
|
|
248
|
+
zone.runGuarded(() => handler(event));
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
static _normalizeKey(keyName) {
|
|
253
|
+
return keyName === 'esc' ? 'escape' : keyName;
|
|
254
|
+
}
|
|
255
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
256
|
+
minVersion: "12.0.0",
|
|
257
|
+
version: "21.0.0-rc.0",
|
|
258
|
+
ngImport: i0,
|
|
259
|
+
type: KeyEventsPlugin,
|
|
260
|
+
deps: [{
|
|
261
|
+
token: DOCUMENT
|
|
262
|
+
}],
|
|
263
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
264
|
+
});
|
|
265
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
266
|
+
minVersion: "12.0.0",
|
|
267
|
+
version: "21.0.0-rc.0",
|
|
268
|
+
ngImport: i0,
|
|
269
|
+
type: KeyEventsPlugin
|
|
270
|
+
});
|
|
315
271
|
}
|
|
316
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
272
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
273
|
+
minVersion: "12.0.0",
|
|
274
|
+
version: "21.0.0-rc.0",
|
|
275
|
+
ngImport: i0,
|
|
276
|
+
type: KeyEventsPlugin,
|
|
277
|
+
decorators: [{
|
|
278
|
+
type: Injectable
|
|
279
|
+
}],
|
|
280
|
+
ctorParameters: () => [{
|
|
281
|
+
type: undefined,
|
|
282
|
+
decorators: [{
|
|
283
|
+
type: Inject,
|
|
284
|
+
args: [DOCUMENT]
|
|
285
|
+
}]
|
|
286
|
+
}]
|
|
287
|
+
});
|
|
322
288
|
|
|
323
|
-
/**
|
|
324
|
-
* Bootstraps an instance of an Angular application and renders a standalone component as the
|
|
325
|
-
* application's root component. More information about standalone components can be found in [this
|
|
326
|
-
* guide](guide/components/importing).
|
|
327
|
-
*
|
|
328
|
-
* @usageNotes
|
|
329
|
-
* The root component passed into this function *must* be a standalone one (should have the
|
|
330
|
-
* `standalone: true` flag in the `@Component` decorator config).
|
|
331
|
-
*
|
|
332
|
-
* ```angular-ts
|
|
333
|
-
* @Component({
|
|
334
|
-
* standalone: true,
|
|
335
|
-
* template: 'Hello world!'
|
|
336
|
-
* })
|
|
337
|
-
* class RootComponent {}
|
|
338
|
-
*
|
|
339
|
-
* const appRef: ApplicationRef = await bootstrapApplication(RootComponent);
|
|
340
|
-
* ```
|
|
341
|
-
*
|
|
342
|
-
* You can add the list of providers that should be available in the application injector by
|
|
343
|
-
* specifying the `providers` field in an object passed as the second argument:
|
|
344
|
-
*
|
|
345
|
-
* ```ts
|
|
346
|
-
* await bootstrapApplication(RootComponent, {
|
|
347
|
-
* providers: [
|
|
348
|
-
* {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}
|
|
349
|
-
* ]
|
|
350
|
-
* });
|
|
351
|
-
* ```
|
|
352
|
-
*
|
|
353
|
-
* The `importProvidersFrom` helper method can be used to collect all providers from any
|
|
354
|
-
* existing NgModule (and transitively from all NgModules that it imports):
|
|
355
|
-
*
|
|
356
|
-
* ```ts
|
|
357
|
-
* await bootstrapApplication(RootComponent, {
|
|
358
|
-
* providers: [
|
|
359
|
-
* importProvidersFrom(SomeNgModule)
|
|
360
|
-
* ]
|
|
361
|
-
* });
|
|
362
|
-
* ```
|
|
363
|
-
*
|
|
364
|
-
* Note: the `bootstrapApplication` method doesn't include [Testability](api/core/Testability) by
|
|
365
|
-
* default. You can add [Testability](api/core/Testability) by getting the list of necessary
|
|
366
|
-
* providers using `provideProtractorTestingSupport()` function and adding them into the `providers`
|
|
367
|
-
* array, for example:
|
|
368
|
-
*
|
|
369
|
-
* ```ts
|
|
370
|
-
* import {provideProtractorTestingSupport} from '@angular/platform-browser';
|
|
371
|
-
*
|
|
372
|
-
* await bootstrapApplication(RootComponent, {providers: [provideProtractorTestingSupport()]});
|
|
373
|
-
* ```
|
|
374
|
-
*
|
|
375
|
-
* @param rootComponent A reference to a standalone component that should be rendered.
|
|
376
|
-
* @param options Extra configuration for the bootstrap operation, see `ApplicationConfig` for
|
|
377
|
-
* additional info.
|
|
378
|
-
* @param context Optional context object that can be used to provide a pre-existing
|
|
379
|
-
* platform injector. This is useful for advanced use-cases, for example, server-side
|
|
380
|
-
* rendering, where the platform is created for each request.
|
|
381
|
-
* @returns A promise that returns an `ApplicationRef` instance once resolved.
|
|
382
|
-
*
|
|
383
|
-
* @publicApi
|
|
384
|
-
*/
|
|
385
289
|
function bootstrapApplication(rootComponent, options, context) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
})
|
|
399
|
-
.then(() => _internalCreateApplication(config));
|
|
400
|
-
}
|
|
401
|
-
return _internalCreateApplication(config);
|
|
290
|
+
const config = {
|
|
291
|
+
rootComponent,
|
|
292
|
+
platformRef: context?.platformRef,
|
|
293
|
+
...createProvidersConfig(options)
|
|
294
|
+
};
|
|
295
|
+
if ((typeof ngJitMode === 'undefined' || ngJitMode) && typeof fetch === 'function') {
|
|
296
|
+
return _resolveComponentResources(fetch).catch(error => {
|
|
297
|
+
console.error(error);
|
|
298
|
+
return Promise.resolve();
|
|
299
|
+
}).then(() => _internalCreateApplication(config));
|
|
300
|
+
}
|
|
301
|
+
return _internalCreateApplication(config);
|
|
402
302
|
}
|
|
403
|
-
/**
|
|
404
|
-
* Create an instance of an Angular application without bootstrapping any components. This is useful
|
|
405
|
-
* for the situation where one wants to decouple application environment creation (a platform and
|
|
406
|
-
* associated injectors) from rendering components on a screen. Components can be subsequently
|
|
407
|
-
* bootstrapped on the returned `ApplicationRef`.
|
|
408
|
-
*
|
|
409
|
-
* @param options Extra configuration for the application environment, see `ApplicationConfig` for
|
|
410
|
-
* additional info.
|
|
411
|
-
* @returns A promise that returns an `ApplicationRef` instance once resolved.
|
|
412
|
-
*
|
|
413
|
-
* @publicApi
|
|
414
|
-
*/
|
|
415
303
|
function createApplication(options) {
|
|
416
|
-
|
|
304
|
+
return _internalCreateApplication(createProvidersConfig(options));
|
|
417
305
|
}
|
|
418
306
|
function createProvidersConfig(options) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
307
|
+
return {
|
|
308
|
+
appProviders: [...BROWSER_MODULE_PROVIDERS, ...(options?.providers ?? [])],
|
|
309
|
+
platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
|
|
310
|
+
};
|
|
423
311
|
}
|
|
424
|
-
/**
|
|
425
|
-
* Returns a set of providers required to setup [Testability](api/core/Testability) for an
|
|
426
|
-
* application bootstrapped using the `bootstrapApplication` function. The set of providers is
|
|
427
|
-
* needed to support testing an application with Protractor (which relies on the Testability APIs
|
|
428
|
-
* to be present).
|
|
429
|
-
*
|
|
430
|
-
* @returns An array of providers required to setup Testability for an application and make it
|
|
431
|
-
* available for testing using Protractor.
|
|
432
|
-
*
|
|
433
|
-
* @publicApi
|
|
434
|
-
*/
|
|
435
312
|
function provideProtractorTestingSupport() {
|
|
436
|
-
|
|
437
|
-
// alterations are performed to the `provideProtractorTestingSupport` call results in app
|
|
438
|
-
// code.
|
|
439
|
-
return [...TESTABILITY_PROVIDERS];
|
|
313
|
+
return [...TESTABILITY_PROVIDERS];
|
|
440
314
|
}
|
|
441
315
|
function initDomAdapter() {
|
|
442
|
-
|
|
316
|
+
BrowserDomAdapter.makeCurrent();
|
|
443
317
|
}
|
|
444
318
|
function errorHandler() {
|
|
445
|
-
|
|
319
|
+
return new ErrorHandler();
|
|
446
320
|
}
|
|
447
321
|
function _document() {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
return document;
|
|
322
|
+
_setDocument(document);
|
|
323
|
+
return document;
|
|
451
324
|
}
|
|
452
|
-
const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
325
|
+
const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [{
|
|
326
|
+
provide: PLATFORM_ID,
|
|
327
|
+
useValue: _PLATFORM_BROWSER_ID
|
|
328
|
+
}, {
|
|
329
|
+
provide: PLATFORM_INITIALIZER,
|
|
330
|
+
useValue: initDomAdapter,
|
|
331
|
+
multi: true
|
|
332
|
+
}, {
|
|
333
|
+
provide: DOCUMENT,
|
|
334
|
+
useFactory: _document
|
|
335
|
+
}];
|
|
463
336
|
const platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
|
464
|
-
/**
|
|
465
|
-
* Internal marker to signal whether providers from the `BrowserModule` are already present in DI.
|
|
466
|
-
* This is needed to avoid loading `BrowserModule` providers twice. We can't rely on the
|
|
467
|
-
* `BrowserModule` presence itself, since the standalone-based bootstrap just imports
|
|
468
|
-
* `BrowserModule` providers without referencing the module itself.
|
|
469
|
-
*/
|
|
470
337
|
const BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'BrowserModule Providers Marker' : '');
|
|
471
|
-
const TESTABILITY_PROVIDERS = [
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
* Included by default in all Angular apps created with the CLI
|
|
506
|
-
* `new` command.
|
|
507
|
-
* Re-exports `CommonModule` and `ApplicationModule`, making their
|
|
508
|
-
* exports and providers available to all apps.
|
|
509
|
-
*
|
|
510
|
-
* @publicApi
|
|
511
|
-
*/
|
|
338
|
+
const TESTABILITY_PROVIDERS = [{
|
|
339
|
+
provide: _TESTABILITY_GETTER,
|
|
340
|
+
useClass: BrowserGetTestability
|
|
341
|
+
}, {
|
|
342
|
+
provide: _TESTABILITY,
|
|
343
|
+
useClass: Testability
|
|
344
|
+
}, {
|
|
345
|
+
provide: Testability,
|
|
346
|
+
useClass: Testability
|
|
347
|
+
}];
|
|
348
|
+
const BROWSER_MODULE_PROVIDERS = [{
|
|
349
|
+
provide: _INJECTOR_SCOPE,
|
|
350
|
+
useValue: 'root'
|
|
351
|
+
}, {
|
|
352
|
+
provide: ErrorHandler,
|
|
353
|
+
useFactory: errorHandler
|
|
354
|
+
}, {
|
|
355
|
+
provide: EVENT_MANAGER_PLUGINS,
|
|
356
|
+
useClass: DomEventsPlugin,
|
|
357
|
+
multi: true
|
|
358
|
+
}, {
|
|
359
|
+
provide: EVENT_MANAGER_PLUGINS,
|
|
360
|
+
useClass: KeyEventsPlugin,
|
|
361
|
+
multi: true
|
|
362
|
+
}, DomRendererFactory2, SharedStylesHost, EventManager, {
|
|
363
|
+
provide: RendererFactory2,
|
|
364
|
+
useExisting: DomRendererFactory2
|
|
365
|
+
}, {
|
|
366
|
+
provide: XhrFactory,
|
|
367
|
+
useClass: BrowserXhr
|
|
368
|
+
}, typeof ngDevMode === 'undefined' || ngDevMode ? {
|
|
369
|
+
provide: BROWSER_MODULE_PROVIDERS_MARKER,
|
|
370
|
+
useValue: true
|
|
371
|
+
} : []];
|
|
512
372
|
class BrowserModule {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}
|
|
523
|
-
}
|
|
373
|
+
constructor() {
|
|
374
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
375
|
+
const providersAlreadyPresent = inject(BROWSER_MODULE_PROVIDERS_MARKER, {
|
|
376
|
+
optional: true,
|
|
377
|
+
skipSelf: true
|
|
378
|
+
});
|
|
379
|
+
if (providersAlreadyPresent) {
|
|
380
|
+
throw new _RuntimeError(5100, `Providers from the \`BrowserModule\` have already been loaded. If you need access ` + `to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
|
|
381
|
+
}
|
|
524
382
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
383
|
+
}
|
|
384
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
385
|
+
minVersion: "12.0.0",
|
|
386
|
+
version: "21.0.0-rc.0",
|
|
387
|
+
ngImport: i0,
|
|
388
|
+
type: BrowserModule,
|
|
389
|
+
deps: [],
|
|
390
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
391
|
+
});
|
|
392
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
393
|
+
minVersion: "14.0.0",
|
|
394
|
+
version: "21.0.0-rc.0",
|
|
395
|
+
ngImport: i0,
|
|
396
|
+
type: BrowserModule,
|
|
397
|
+
exports: [CommonModule, ApplicationModule]
|
|
398
|
+
});
|
|
399
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
400
|
+
minVersion: "12.0.0",
|
|
401
|
+
version: "21.0.0-rc.0",
|
|
402
|
+
ngImport: i0,
|
|
403
|
+
type: BrowserModule,
|
|
404
|
+
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
|
|
405
|
+
imports: [CommonModule, ApplicationModule]
|
|
406
|
+
});
|
|
528
407
|
}
|
|
529
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
408
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
409
|
+
minVersion: "12.0.0",
|
|
410
|
+
version: "21.0.0-rc.0",
|
|
411
|
+
ngImport: i0,
|
|
412
|
+
type: BrowserModule,
|
|
413
|
+
decorators: [{
|
|
414
|
+
type: NgModule,
|
|
415
|
+
args: [{
|
|
416
|
+
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
|
|
417
|
+
exports: [CommonModule, ApplicationModule]
|
|
418
|
+
}]
|
|
419
|
+
}],
|
|
420
|
+
ctorParameters: () => []
|
|
421
|
+
});
|
|
536
422
|
|
|
537
423
|
export { BrowserDomAdapter, BrowserGetTestability, BrowserModule, KeyEventsPlugin, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport };
|
|
538
424
|
//# sourceMappingURL=_browser-chunk.mjs.map
|