@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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.8
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
- supportsDOMEvents = true;
20
- static makeCurrent() {
21
- _setRootDomAdapter(new BrowserDomAdapter());
22
- }
23
- onAndCancel(el, evt, listener, options) {
24
- el.addEventListener(evt, listener, options);
25
- return () => {
26
- el.removeEventListener(evt, listener, options);
27
- };
28
- }
29
- dispatchEvent(el, evt) {
30
- el.dispatchEvent(evt);
31
- }
32
- remove(node) {
33
- node.remove();
34
- }
35
- createElement(tagName, doc) {
36
- doc = doc || this.getDefaultDocument();
37
- return doc.createElement(tagName);
38
- }
39
- createHtmlDocument() {
40
- return document.implementation.createHTMLDocument('fakeTitle');
41
- }
42
- getDefaultDocument() {
43
- return document;
44
- }
45
- isElementNode(node) {
46
- return node.nodeType === Node.ELEMENT_NODE;
47
- }
48
- isShadowRoot(node) {
49
- return node instanceof DocumentFragment;
50
- }
51
- /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
52
- getGlobalEventTarget(doc, target) {
53
- if (target === 'window') {
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
- getUserAgent() {
72
- return window.navigator.userAgent;
49
+ if (target === 'document') {
50
+ return doc;
73
51
  }
74
- getCookie(name) {
75
- return _parseCookieValue(document.cookie, name);
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
- baseElement = baseElement || document.head.querySelector('base');
81
- return baseElement ? baseElement.getAttribute('href') : null;
73
+ baseElement = baseElement || document.head.querySelector('base');
74
+ return baseElement ? baseElement.getAttribute('href') : null;
82
75
  }
83
76
  function relativePath(url) {
84
- // The base URL doesn't really matter, we just need it so relative paths have something
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
- addToWindow(registry) {
91
- _global['getAngularTestability'] = (elem, findInAncestors = true) => {
92
- const testability = registry.findTestabilityInTree(elem, findInAncestors);
93
- if (testability == null) {
94
- throw new _RuntimeError(5103 /* RuntimeErrorCode.TESTABILITY_NOT_FOUND */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
95
- 'Could not find testability for element.');
96
- }
97
- return testability;
98
- };
99
- _global['getAllAngularTestabilities'] = () => registry.getAllTestabilities();
100
- _global['getAllAngularRootElements'] = () => registry.getAllRootElements();
101
- const whenAllStable = (callback) => {
102
- const testabilities = _global['getAllAngularTestabilities']();
103
- let count = testabilities.length;
104
- const decrement = function () {
105
- count--;
106
- if (count == 0) {
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
- _global['frameworkStabilizers'].push(whenAllStable);
99
+ };
100
+ testabilities.forEach(testability => {
101
+ testability.whenStable(decrement);
102
+ });
103
+ };
104
+ if (!_global['frameworkStabilizers']) {
105
+ _global['frameworkStabilizers'] = [];
118
106
  }
119
- findTestabilityInTree(registry, elem, findInAncestors) {
120
- if (elem == null) {
121
- return null;
122
- }
123
- const t = registry.getTestability(elem);
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
- * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.
139
- */
140
- class BrowserXhr {
141
- build() {
142
- return new XMLHttpRequest();
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
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
145
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserXhr });
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 DomEventsPlugin extends EventManagerPlugin {
152
- constructor(doc) {
153
- super(doc);
154
- }
155
- // This plugin should come last in the list of plugins, because it accepts all
156
- // events.
157
- supports(eventName) {
158
- return true;
159
- }
160
- addEventListener(element, eventName, handler, options) {
161
- element.addEventListener(eventName, handler, options);
162
- return () => this.removeEventListener(element, eventName, handler, options);
163
- }
164
- removeEventListener(target, eventName, callback, options) {
165
- return target.removeEventListener(eventName, callback, options);
166
- }
167
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
168
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomEventsPlugin });
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({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomEventsPlugin, decorators: [{
171
- type: Injectable
172
- }], ctorParameters: () => [{ type: undefined, decorators: [{
173
- type: Inject,
174
- args: [DOCUMENT]
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
- '\b': 'Backspace',
185
- '\t': 'Tab',
186
- '\x7F': 'Delete',
187
- '\x1B': 'Escape',
188
- 'Del': 'Delete',
189
- 'Esc': 'Escape',
190
- 'Left': 'ArrowLeft',
191
- 'Right': 'ArrowRight',
192
- 'Up': 'ArrowUp',
193
- 'Down': 'ArrowDown',
194
- 'Menu': 'ContextMenu',
195
- 'Scroll': 'ScrollLock',
196
- 'Win': 'OS',
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
- 'alt': (event) => event.altKey,
203
- 'control': (event) => event.ctrlKey,
204
- 'meta': (event) => event.metaKey,
205
- 'shift': (event) => event.shiftKey,
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
- * Initializes an instance of the browser plug-in.
213
- * @param doc The document in which key events will be detected.
214
- */
215
- constructor(doc) {
216
- super(doc);
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
- * Reports whether a named key event is supported.
220
- * @param eventName The event name to query.
221
- * @return True if the named key event is supported.
222
- */
223
- supports(eventName) {
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
- * Registers a handler for a specific element and key event.
228
- * @param element The HTML element to receive event notifications.
229
- * @param eventName The name of the key event to listen for.
230
- * @param handler A function to call when the notification occurs. Receives the
231
- * event object as an argument.
232
- * @returns The key event that was registered.
233
- */
234
- addEventListener(element, eventName, handler, options) {
235
- const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
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
- * Parses the user provided full keyboard event definition and normalizes it for
243
- * later internal use. It ensures the string is all lowercase, converts special
244
- * characters to a standard spelling, and orders all the values consistently.
245
- *
246
- * @param eventName The name of the key event to listen for.
247
- * @returns an object with the full, normalized string, and the dom event name
248
- * or null in the case when the event doesn't match a keyboard event.
249
- */
250
- static parseEventName(eventName) {
251
- const parts = eventName.toLowerCase().split('.');
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
- /** @internal */
336
- static _normalizeKey(keyName) {
337
- return keyName === 'esc' ? 'escape' : keyName;
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
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: KeyEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
340
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: KeyEventsPlugin });
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({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: KeyEventsPlugin, decorators: [{
343
- type: Injectable
344
- }], ctorParameters: () => [{ type: undefined, decorators: [{
345
- type: Inject,
346
- args: [DOCUMENT]
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
- const config = {
413
- rootComponent,
414
- platformRef: context?.platformRef,
415
- ...createProvidersConfig(options),
416
- };
417
- // Attempt to resolve component resources before bootstrapping in JIT mode,
418
- // however don't interrupt the bootstrapping process.
419
- if ((typeof ngJitMode === 'undefined' || ngJitMode) && typeof fetch === 'function') {
420
- return _resolveComponentResources(fetch)
421
- .catch((error) => {
422
- console.error(error);
423
- return Promise.resolve();
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
- return _internalCreateApplication(createProvidersConfig(options));
304
+ return _internalCreateApplication(createProvidersConfig(options));
443
305
  }
444
306
  function createProvidersConfig(options) {
445
- return {
446
- appProviders: [...BROWSER_MODULE_PROVIDERS, ...(options?.providers ?? [])],
447
- platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS,
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
- // Return a copy to prevent changes to the original array in case any in-place
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
- BrowserDomAdapter.makeCurrent();
316
+ BrowserDomAdapter.makeCurrent();
469
317
  }
470
318
  function errorHandler() {
471
- return new ErrorHandler();
319
+ return new ErrorHandler();
472
320
  }
473
321
  function _document() {
474
- // Tell ivy about the global document
475
- _setDocument(document);
476
- return document;
322
+ _setDocument(document);
323
+ return document;
477
324
  }
478
- const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
479
- { provide: PLATFORM_ID, useValue: _PLATFORM_BROWSER_ID },
480
- { provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
481
- { provide: DOCUMENT, useFactory: _document },
482
- ];
483
- /**
484
- * A factory function that returns a `PlatformRef` instance associated with browser service
485
- * providers.
486
- *
487
- * @publicApi
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
- provide: _TESTABILITY_GETTER,
500
- useClass: BrowserGetTestability,
501
- },
502
- {
503
- provide: _TESTABILITY,
504
- useClass: Testability,
505
- },
506
- {
507
- provide: Testability, // Also provide as `Testability` for backwards-compatibility.
508
- useClass: Testability,
509
- },
510
- ];
511
- const BROWSER_MODULE_PROVIDERS = [
512
- { provide: _INJECTOR_SCOPE, useValue: 'root' },
513
- { provide: ErrorHandler, useFactory: errorHandler },
514
- {
515
- provide: EVENT_MANAGER_PLUGINS,
516
- useClass: DomEventsPlugin,
517
- multi: true,
518
- },
519
- { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
520
- DomRendererFactory2,
521
- SharedStylesHost,
522
- EventManager,
523
- { provide: RendererFactory2, useExisting: DomRendererFactory2 },
524
- { provide: XhrFactory, useClass: BrowserXhr },
525
- typeof ngDevMode === 'undefined' || ngDevMode
526
- ? { provide: BROWSER_MODULE_PROVIDERS_MARKER, useValue: true }
527
- : [],
528
- ];
529
- /**
530
- * Exports required infrastructure for all Angular apps.
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
- constructor() {
540
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
541
- const providersAlreadyPresent = inject(BROWSER_MODULE_PROVIDERS_MARKER, {
542
- optional: true,
543
- skipSelf: true,
544
- });
545
- if (providersAlreadyPresent) {
546
- throw new _RuntimeError(5100 /* RuntimeErrorCode.BROWSER_MODULE_ALREADY_LOADED */, `Providers from the \`BrowserModule\` have already been loaded. If you need access ` +
547
- `to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
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
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
552
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserModule, exports: [CommonModule, ApplicationModule] });
553
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserModule, providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS], imports: [CommonModule, ApplicationModule] });
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({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: BrowserModule, decorators: [{
556
- type: NgModule,
557
- args: [{
558
- providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
559
- exports: [CommonModule, ApplicationModule],
560
- }]
561
- }], ctorParameters: () => [] });
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, DomEventsPlugin, KeyEventsPlugin, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport };
423
+ export { BrowserDomAdapter, BrowserGetTestability, BrowserModule, KeyEventsPlugin, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport };
564
424
  //# sourceMappingURL=_browser-chunk.mjs.map