@angular/platform-browser 21.0.0-next.8 → 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 +361 -501
- package/fesm2022/_browser-chunk.mjs.map +1 -1
- package/fesm2022/_dom_renderer-chunk.mjs +732 -731
- 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 +616 -885
- 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 +32 -23
- 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
|
*/
|
|
@@ -7,558 +7,418 @@
|
|
|
7
7
|
import { ɵDomAdapter as _DomAdapter, ɵsetRootDomAdapter as _setRootDomAdapter, ɵparseCookieValue as _parseCookieValue, ɵgetDOM as _getDOM, DOCUMENT, ɵPLATFORM_BROWSER_ID as _PLATFORM_BROWSER_ID, XhrFactory, CommonModule } from '@angular/common';
|
|
8
8
|
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
|
-
import { EventManagerPlugin, EVENT_MANAGER_PLUGINS, DomRendererFactory2, SharedStylesHost, EventManager } from './_dom_renderer-chunk.mjs';
|
|
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
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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);
|
|
143
121
|
}
|
|
144
|
-
|
|
145
|
-
|
|
122
|
+
return this.findTestabilityInTree(registry, elem.parentElement, true);
|
|
123
|
+
}
|
|
146
124
|
}
|
|
147
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserXhr, decorators: [{
|
|
148
|
-
type: Injectable
|
|
149
|
-
}] });
|
|
150
125
|
|
|
151
|
-
class
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
126
|
+
class BrowserXhr {
|
|
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
|
+
});
|
|
169
144
|
}
|
|
170
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
+
});
|
|
176
154
|
|
|
177
|
-
/**
|
|
178
|
-
* Defines supported modifiers for key events.
|
|
179
|
-
*/
|
|
180
155
|
const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
|
181
|
-
// The following values are here for cross-browser compatibility and to match the W3C standard
|
|
182
|
-
// cf https://www.w3.org/TR/DOM-Level-3-Events-key/
|
|
183
156
|
const _keyMap = {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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'
|
|
197
170
|
};
|
|
198
|
-
/**
|
|
199
|
-
* Retrieves modifiers from key-event objects.
|
|
200
|
-
*/
|
|
201
171
|
const MODIFIER_KEY_GETTERS = {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
172
|
+
'alt': event => event.altKey,
|
|
173
|
+
'control': event => event.ctrlKey,
|
|
174
|
+
'meta': event => event.metaKey,
|
|
175
|
+
'shift': event => event.shiftKey
|
|
206
176
|
};
|
|
207
|
-
/**
|
|
208
|
-
* A browser plug-in that provides support for handling of key events in Angular.
|
|
209
|
-
*/
|
|
210
177
|
class KeyEventsPlugin extends EventManagerPlugin {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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;
|
|
217
196
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return KeyEventsPlugin.parseEventName(eventName) != null;
|
|
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.';
|
|
225
203
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
|
237
|
-
return this.manager.getZone().runOutsideAngular(() => {
|
|
238
|
-
return _getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler, options);
|
|
239
|
-
});
|
|
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;
|
|
240
214
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const domEventName = parts.shift();
|
|
253
|
-
if (parts.length === 0 || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
const key = KeyEventsPlugin._normalizeKey(parts.pop());
|
|
257
|
-
let fullKey = '';
|
|
258
|
-
let codeIX = parts.indexOf('code');
|
|
259
|
-
if (codeIX > -1) {
|
|
260
|
-
parts.splice(codeIX, 1);
|
|
261
|
-
fullKey = 'code.';
|
|
262
|
-
}
|
|
263
|
-
MODIFIER_KEYS.forEach((modifierName) => {
|
|
264
|
-
const index = parts.indexOf(modifierName);
|
|
265
|
-
if (index > -1) {
|
|
266
|
-
parts.splice(index, 1);
|
|
267
|
-
fullKey += modifierName + '.';
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
fullKey += key;
|
|
271
|
-
if (parts.length != 0 || key.length === 0) {
|
|
272
|
-
// returning null instead of throwing to let another plugin process the event
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
// NOTE: Please don't rewrite this as so, as it will break JSCompiler property renaming.
|
|
276
|
-
// The code must remain in the `result['domEventName']` form.
|
|
277
|
-
// return {domEventName, fullKey};
|
|
278
|
-
const result = {};
|
|
279
|
-
result['domEventName'] = domEventName;
|
|
280
|
-
result['fullKey'] = fullKey;
|
|
281
|
-
return result;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Determines whether the actual keys pressed match the configured key code string.
|
|
285
|
-
* The `fullKeyCode` event is normalized in the `parseEventName` method when the
|
|
286
|
-
* event is attached to the DOM during the `addEventListener` call. This is unseen
|
|
287
|
-
* by the end user and is normalized for internal consistency and parsing.
|
|
288
|
-
*
|
|
289
|
-
* @param event The keyboard event.
|
|
290
|
-
* @param fullKeyCode The normalized user defined expected key event string
|
|
291
|
-
* @returns boolean.
|
|
292
|
-
*/
|
|
293
|
-
static matchEventFullKeyCode(event, fullKeyCode) {
|
|
294
|
-
let keycode = _keyMap[event.key] || event.key;
|
|
295
|
-
let key = '';
|
|
296
|
-
if (fullKeyCode.indexOf('code.') > -1) {
|
|
297
|
-
keycode = event.code;
|
|
298
|
-
key = 'code.';
|
|
299
|
-
}
|
|
300
|
-
// the keycode could be unidentified so we have to check here
|
|
301
|
-
if (keycode == null || !keycode)
|
|
302
|
-
return false;
|
|
303
|
-
keycode = keycode.toLowerCase();
|
|
304
|
-
if (keycode === ' ') {
|
|
305
|
-
keycode = 'space'; // for readability
|
|
306
|
-
}
|
|
307
|
-
else if (keycode === '.') {
|
|
308
|
-
keycode = 'dot'; // because '.' is used as a separator in event names
|
|
309
|
-
}
|
|
310
|
-
MODIFIER_KEYS.forEach((modifierName) => {
|
|
311
|
-
if (modifierName !== keycode) {
|
|
312
|
-
const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
|
313
|
-
if (modifierGetter(event)) {
|
|
314
|
-
key += modifierName + '.';
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
key += keycode;
|
|
319
|
-
return key === fullKeyCode;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Configures a handler callback for a key event.
|
|
323
|
-
* @param fullKey The event name that combines all simultaneous keystrokes.
|
|
324
|
-
* @param handler The function that responds to the key event.
|
|
325
|
-
* @param zone The zone in which the event occurred.
|
|
326
|
-
* @returns A callback function.
|
|
327
|
-
*/
|
|
328
|
-
static eventCallback(fullKey, handler, zone) {
|
|
329
|
-
return (event) => {
|
|
330
|
-
if (KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
|
|
331
|
-
zone.runGuarded(() => handler(event));
|
|
332
|
-
}
|
|
333
|
-
};
|
|
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.';
|
|
334
226
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
227
|
+
if (keycode == null || !keycode) return false;
|
|
228
|
+
keycode = keycode.toLowerCase();
|
|
229
|
+
if (keycode === ' ') {
|
|
230
|
+
keycode = 'space';
|
|
231
|
+
} else if (keycode === '.') {
|
|
232
|
+
keycode = 'dot';
|
|
338
233
|
}
|
|
339
|
-
|
|
340
|
-
|
|
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
|
+
});
|
|
341
271
|
}
|
|
342
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
+
});
|
|
348
288
|
|
|
349
|
-
/**
|
|
350
|
-
* Bootstraps an instance of an Angular application and renders a standalone component as the
|
|
351
|
-
* application's root component. More information about standalone components can be found in [this
|
|
352
|
-
* guide](guide/components/importing).
|
|
353
|
-
*
|
|
354
|
-
* @usageNotes
|
|
355
|
-
* The root component passed into this function *must* be a standalone one (should have the
|
|
356
|
-
* `standalone: true` flag in the `@Component` decorator config).
|
|
357
|
-
*
|
|
358
|
-
* ```angular-ts
|
|
359
|
-
* @Component({
|
|
360
|
-
* standalone: true,
|
|
361
|
-
* template: 'Hello world!'
|
|
362
|
-
* })
|
|
363
|
-
* class RootComponent {}
|
|
364
|
-
*
|
|
365
|
-
* const appRef: ApplicationRef = await bootstrapApplication(RootComponent);
|
|
366
|
-
* ```
|
|
367
|
-
*
|
|
368
|
-
* You can add the list of providers that should be available in the application injector by
|
|
369
|
-
* specifying the `providers` field in an object passed as the second argument:
|
|
370
|
-
*
|
|
371
|
-
* ```ts
|
|
372
|
-
* await bootstrapApplication(RootComponent, {
|
|
373
|
-
* providers: [
|
|
374
|
-
* {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}
|
|
375
|
-
* ]
|
|
376
|
-
* });
|
|
377
|
-
* ```
|
|
378
|
-
*
|
|
379
|
-
* The `importProvidersFrom` helper method can be used to collect all providers from any
|
|
380
|
-
* existing NgModule (and transitively from all NgModules that it imports):
|
|
381
|
-
*
|
|
382
|
-
* ```ts
|
|
383
|
-
* await bootstrapApplication(RootComponent, {
|
|
384
|
-
* providers: [
|
|
385
|
-
* importProvidersFrom(SomeNgModule)
|
|
386
|
-
* ]
|
|
387
|
-
* });
|
|
388
|
-
* ```
|
|
389
|
-
*
|
|
390
|
-
* Note: the `bootstrapApplication` method doesn't include [Testability](api/core/Testability) by
|
|
391
|
-
* default. You can add [Testability](api/core/Testability) by getting the list of necessary
|
|
392
|
-
* providers using `provideProtractorTestingSupport()` function and adding them into the `providers`
|
|
393
|
-
* array, for example:
|
|
394
|
-
*
|
|
395
|
-
* ```ts
|
|
396
|
-
* import {provideProtractorTestingSupport} from '@angular/platform-browser';
|
|
397
|
-
*
|
|
398
|
-
* await bootstrapApplication(RootComponent, {providers: [provideProtractorTestingSupport()]});
|
|
399
|
-
* ```
|
|
400
|
-
*
|
|
401
|
-
* @param rootComponent A reference to a standalone component that should be rendered.
|
|
402
|
-
* @param options Extra configuration for the bootstrap operation, see `ApplicationConfig` for
|
|
403
|
-
* additional info.
|
|
404
|
-
* @param context Optional context object that can be used to provide a pre-existing
|
|
405
|
-
* platform injector. This is useful for advanced use-cases, for example, server-side
|
|
406
|
-
* rendering, where the platform is created for each request.
|
|
407
|
-
* @returns A promise that returns an `ApplicationRef` instance once resolved.
|
|
408
|
-
*
|
|
409
|
-
* @publicApi
|
|
410
|
-
*/
|
|
411
289
|
function bootstrapApplication(rootComponent, options, context) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
})
|
|
425
|
-
.then(() => _internalCreateApplication(config));
|
|
426
|
-
}
|
|
427
|
-
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);
|
|
428
302
|
}
|
|
429
|
-
/**
|
|
430
|
-
* Create an instance of an Angular application without bootstrapping any components. This is useful
|
|
431
|
-
* for the situation where one wants to decouple application environment creation (a platform and
|
|
432
|
-
* associated injectors) from rendering components on a screen. Components can be subsequently
|
|
433
|
-
* bootstrapped on the returned `ApplicationRef`.
|
|
434
|
-
*
|
|
435
|
-
* @param options Extra configuration for the application environment, see `ApplicationConfig` for
|
|
436
|
-
* additional info.
|
|
437
|
-
* @returns A promise that returns an `ApplicationRef` instance once resolved.
|
|
438
|
-
*
|
|
439
|
-
* @publicApi
|
|
440
|
-
*/
|
|
441
303
|
function createApplication(options) {
|
|
442
|
-
|
|
304
|
+
return _internalCreateApplication(createProvidersConfig(options));
|
|
443
305
|
}
|
|
444
306
|
function createProvidersConfig(options) {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
307
|
+
return {
|
|
308
|
+
appProviders: [...BROWSER_MODULE_PROVIDERS, ...(options?.providers ?? [])],
|
|
309
|
+
platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
|
|
310
|
+
};
|
|
449
311
|
}
|
|
450
|
-
/**
|
|
451
|
-
* Returns a set of providers required to setup [Testability](api/core/Testability) for an
|
|
452
|
-
* application bootstrapped using the `bootstrapApplication` function. The set of providers is
|
|
453
|
-
* needed to support testing an application with Protractor (which relies on the Testability APIs
|
|
454
|
-
* to be present).
|
|
455
|
-
*
|
|
456
|
-
* @returns An array of providers required to setup Testability for an application and make it
|
|
457
|
-
* available for testing using Protractor.
|
|
458
|
-
*
|
|
459
|
-
* @publicApi
|
|
460
|
-
*/
|
|
461
312
|
function provideProtractorTestingSupport() {
|
|
462
|
-
|
|
463
|
-
// alterations are performed to the `provideProtractorTestingSupport` call results in app
|
|
464
|
-
// code.
|
|
465
|
-
return [...TESTABILITY_PROVIDERS];
|
|
313
|
+
return [...TESTABILITY_PROVIDERS];
|
|
466
314
|
}
|
|
467
315
|
function initDomAdapter() {
|
|
468
|
-
|
|
316
|
+
BrowserDomAdapter.makeCurrent();
|
|
469
317
|
}
|
|
470
318
|
function errorHandler() {
|
|
471
|
-
|
|
319
|
+
return new ErrorHandler();
|
|
472
320
|
}
|
|
473
321
|
function _document() {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
return document;
|
|
322
|
+
_setDocument(document);
|
|
323
|
+
return document;
|
|
477
324
|
}
|
|
478
|
-
const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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
|
+
}];
|
|
489
336
|
const platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
|
490
|
-
/**
|
|
491
|
-
* Internal marker to signal whether providers from the `BrowserModule` are already present in DI.
|
|
492
|
-
* This is needed to avoid loading `BrowserModule` providers twice. We can't rely on the
|
|
493
|
-
* `BrowserModule` presence itself, since the standalone-based bootstrap just imports
|
|
494
|
-
* `BrowserModule` providers without referencing the module itself.
|
|
495
|
-
*/
|
|
496
337
|
const BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'BrowserModule Providers Marker' : '');
|
|
497
|
-
const TESTABILITY_PROVIDERS = [
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
* Included by default in all Angular apps created with the CLI
|
|
532
|
-
* `new` command.
|
|
533
|
-
* Re-exports `CommonModule` and `ApplicationModule`, making their
|
|
534
|
-
* exports and providers available to all apps.
|
|
535
|
-
*
|
|
536
|
-
* @publicApi
|
|
537
|
-
*/
|
|
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
|
+
} : []];
|
|
538
372
|
class BrowserModule {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
549
|
-
}
|
|
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
|
+
}
|
|
550
382
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
+
});
|
|
554
407
|
}
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
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
|
+
});
|
|
562
422
|
|
|
563
|
-
export { BrowserDomAdapter, BrowserGetTestability, BrowserModule,
|
|
423
|
+
export { BrowserDomAdapter, BrowserGetTestability, BrowserModule, KeyEventsPlugin, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport };
|
|
564
424
|
//# sourceMappingURL=_browser-chunk.mjs.map
|