@angular/platform-browser 21.0.0-next.9 → 21.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/_browser-chunk.mjs +359 -473
- package/fesm2022/_browser-chunk.mjs.map +1 -1
- package/fesm2022/_dom_renderer-chunk.mjs +723 -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.1
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -8,338 +8,324 @@ import { DOCUMENT, ɵgetDOM as _getDOM } from '@angular/common';
|
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { Injectable, Inject, InjectionToken, ɵRuntimeError as _RuntimeError, APP_ID, CSP_NONCE, PLATFORM_ID, Optional, ViewEncapsulation, ɵTracingService as _TracingService, RendererStyleFlags2, ɵallLeavingAnimations as _allLeavingAnimations } from '@angular/core';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* The plugin definition for the `EventManager` class
|
|
13
|
-
*
|
|
14
|
-
* It can be used as a base class to create custom manager plugins, i.e. you can create your own
|
|
15
|
-
* class that extends the `EventManagerPlugin` one.
|
|
16
|
-
*
|
|
17
|
-
* @see [Extend event handling](guide/templates/event-listeners#extend-event-handling)
|
|
18
|
-
*
|
|
19
|
-
* @publicApi
|
|
20
|
-
*/
|
|
21
11
|
class EventManagerPlugin {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Using non-null assertion because it's set by EventManager's constructor
|
|
28
|
-
manager;
|
|
12
|
+
_doc;
|
|
13
|
+
constructor(_doc) {
|
|
14
|
+
this._doc = _doc;
|
|
15
|
+
}
|
|
16
|
+
manager;
|
|
29
17
|
}
|
|
30
18
|
|
|
31
19
|
class DomEventsPlugin extends EventManagerPlugin {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
20
|
+
constructor(doc) {
|
|
21
|
+
super(doc);
|
|
22
|
+
}
|
|
23
|
+
supports(eventName) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
addEventListener(element, eventName, handler, options) {
|
|
27
|
+
element.addEventListener(eventName, handler, options);
|
|
28
|
+
return () => this.removeEventListener(element, eventName, handler, options);
|
|
29
|
+
}
|
|
30
|
+
removeEventListener(target, eventName, callback, options) {
|
|
31
|
+
return target.removeEventListener(eventName, callback, options);
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
34
|
+
minVersion: "12.0.0",
|
|
35
|
+
version: "21.0.0-rc.1",
|
|
36
|
+
ngImport: i0,
|
|
37
|
+
type: DomEventsPlugin,
|
|
38
|
+
deps: [{
|
|
39
|
+
token: DOCUMENT
|
|
40
|
+
}],
|
|
41
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
42
|
+
});
|
|
43
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
44
|
+
minVersion: "12.0.0",
|
|
45
|
+
version: "21.0.0-rc.1",
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
type: DomEventsPlugin
|
|
48
|
+
});
|
|
49
49
|
}
|
|
50
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
51
|
+
minVersion: "12.0.0",
|
|
52
|
+
version: "21.0.0-rc.1",
|
|
53
|
+
ngImport: i0,
|
|
54
|
+
type: DomEventsPlugin,
|
|
55
|
+
decorators: [{
|
|
56
|
+
type: Injectable
|
|
57
|
+
}],
|
|
58
|
+
ctorParameters: () => [{
|
|
59
|
+
type: undefined,
|
|
60
|
+
decorators: [{
|
|
61
|
+
type: Inject,
|
|
62
|
+
args: [DOCUMENT]
|
|
63
|
+
}]
|
|
64
|
+
}]
|
|
65
|
+
});
|
|
56
66
|
|
|
57
|
-
/**
|
|
58
|
-
* The injection token for plugins of the `EventManager` service.
|
|
59
|
-
*
|
|
60
|
-
* @see [Extend event handling](guide/templates/event-listeners#extend-event-handling)
|
|
61
|
-
*
|
|
62
|
-
* @publicApi
|
|
63
|
-
*/
|
|
64
67
|
const EVENT_MANAGER_PLUGINS = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'EventManagerPlugins' : '');
|
|
65
|
-
/**
|
|
66
|
-
* An injectable service that provides event management for Angular
|
|
67
|
-
* through a browser plug-in.
|
|
68
|
-
*
|
|
69
|
-
* @publicApi
|
|
70
|
-
*/
|
|
71
68
|
class EventManager {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.9", ngImport: i0, type: EventManager, deps: [{ token: EVENT_MANAGER_PLUGINS }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
127
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.9", ngImport: i0, type: EventManager });
|
|
69
|
+
_zone;
|
|
70
|
+
_plugins;
|
|
71
|
+
_eventNameToPlugin = new Map();
|
|
72
|
+
constructor(plugins, _zone) {
|
|
73
|
+
this._zone = _zone;
|
|
74
|
+
plugins.forEach(plugin => {
|
|
75
|
+
plugin.manager = this;
|
|
76
|
+
});
|
|
77
|
+
const otherPlugins = plugins.filter(p => !(p instanceof DomEventsPlugin));
|
|
78
|
+
this._plugins = otherPlugins.slice().reverse();
|
|
79
|
+
const domEventPlugin = plugins.find(p => p instanceof DomEventsPlugin);
|
|
80
|
+
if (domEventPlugin) {
|
|
81
|
+
this._plugins.push(domEventPlugin);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
addEventListener(element, eventName, handler, options) {
|
|
85
|
+
const plugin = this._findPluginFor(eventName);
|
|
86
|
+
return plugin.addEventListener(element, eventName, handler, options);
|
|
87
|
+
}
|
|
88
|
+
getZone() {
|
|
89
|
+
return this._zone;
|
|
90
|
+
}
|
|
91
|
+
_findPluginFor(eventName) {
|
|
92
|
+
let plugin = this._eventNameToPlugin.get(eventName);
|
|
93
|
+
if (plugin) {
|
|
94
|
+
return plugin;
|
|
95
|
+
}
|
|
96
|
+
const plugins = this._plugins;
|
|
97
|
+
plugin = plugins.find(plugin => plugin.supports(eventName));
|
|
98
|
+
if (!plugin) {
|
|
99
|
+
throw new _RuntimeError(5101, (typeof ngDevMode === 'undefined' || ngDevMode) && `No event manager plugin found for event ${eventName}`);
|
|
100
|
+
}
|
|
101
|
+
this._eventNameToPlugin.set(eventName, plugin);
|
|
102
|
+
return plugin;
|
|
103
|
+
}
|
|
104
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
105
|
+
minVersion: "12.0.0",
|
|
106
|
+
version: "21.0.0-rc.1",
|
|
107
|
+
ngImport: i0,
|
|
108
|
+
type: EventManager,
|
|
109
|
+
deps: [{
|
|
110
|
+
token: EVENT_MANAGER_PLUGINS
|
|
111
|
+
}, {
|
|
112
|
+
token: i0.NgZone
|
|
113
|
+
}],
|
|
114
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
115
|
+
});
|
|
116
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
117
|
+
minVersion: "12.0.0",
|
|
118
|
+
version: "21.0.0-rc.1",
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
type: EventManager
|
|
121
|
+
});
|
|
128
122
|
}
|
|
129
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
124
|
+
minVersion: "12.0.0",
|
|
125
|
+
version: "21.0.0-rc.1",
|
|
126
|
+
ngImport: i0,
|
|
127
|
+
type: EventManager,
|
|
128
|
+
decorators: [{
|
|
129
|
+
type: Injectable
|
|
130
|
+
}],
|
|
131
|
+
ctorParameters: () => [{
|
|
132
|
+
type: undefined,
|
|
133
|
+
decorators: [{
|
|
134
|
+
type: Inject,
|
|
135
|
+
args: [EVENT_MANAGER_PLUGINS]
|
|
136
|
+
}]
|
|
137
|
+
}, {
|
|
138
|
+
type: i0.NgZone
|
|
139
|
+
}]
|
|
140
|
+
});
|
|
135
141
|
|
|
136
|
-
/** The style elements attribute name used to set value of `APP_ID` token. */
|
|
137
142
|
const APP_ID_ATTRIBUTE_NAME = 'ng-app-id';
|
|
138
|
-
/**
|
|
139
|
-
* Removes all provided elements from the document.
|
|
140
|
-
* @param elements An array of HTML Elements.
|
|
141
|
-
*/
|
|
142
143
|
function removeElements(elements) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
for (const element of elements) {
|
|
145
|
+
element.remove();
|
|
146
|
+
}
|
|
146
147
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Creates a `style` element with the provided inline style content.
|
|
149
|
-
* @param style A string of the inline style content.
|
|
150
|
-
* @param doc A DOM Document to use to create the element.
|
|
151
|
-
* @returns An HTMLStyleElement instance.
|
|
152
|
-
*/
|
|
153
148
|
function createStyleElement(style, doc) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
const styleElement = doc.createElement('style');
|
|
150
|
+
styleElement.textContent = style;
|
|
151
|
+
return styleElement;
|
|
157
152
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Searches a DOM document's head element for style elements with a matching application
|
|
160
|
-
* identifier attribute (`ng-app-id`) to the provide identifier and adds usage records for each.
|
|
161
|
-
* @param doc An HTML DOM document instance.
|
|
162
|
-
* @param appId A string containing an Angular application identifer.
|
|
163
|
-
* @param inline A Map object for tracking inline (defined via `styles` in component decorator) style usage.
|
|
164
|
-
* @param external A Map object for tracking external (defined via `styleUrls` in component decorator) style usage.
|
|
165
|
-
*/
|
|
166
153
|
function addServerStyles(doc, appId, inline, external) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
154
|
+
const elements = doc.head?.querySelectorAll(`style[${APP_ID_ATTRIBUTE_NAME}="${appId}"],link[${APP_ID_ATTRIBUTE_NAME}="${appId}"]`);
|
|
155
|
+
if (elements) {
|
|
156
|
+
for (const styleElement of elements) {
|
|
157
|
+
styleElement.removeAttribute(APP_ID_ATTRIBUTE_NAME);
|
|
158
|
+
if (styleElement instanceof HTMLLinkElement) {
|
|
159
|
+
external.set(styleElement.href.slice(styleElement.href.lastIndexOf('/') + 1), {
|
|
160
|
+
usage: 0,
|
|
161
|
+
elements: [styleElement]
|
|
162
|
+
});
|
|
163
|
+
} else if (styleElement.textContent) {
|
|
164
|
+
inline.set(styleElement.textContent, {
|
|
165
|
+
usage: 0,
|
|
166
|
+
elements: [styleElement]
|
|
167
|
+
});
|
|
168
|
+
}
|
|
183
169
|
}
|
|
170
|
+
}
|
|
184
171
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Creates a `link` element for the provided external style URL.
|
|
187
|
-
* @param url A string of the URL for the stylesheet.
|
|
188
|
-
* @param doc A DOM Document to use to create the element.
|
|
189
|
-
* @returns An HTMLLinkElement instance.
|
|
190
|
-
*/
|
|
191
172
|
function createLinkElement(url, doc) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
173
|
+
const linkElement = doc.createElement('link');
|
|
174
|
+
linkElement.setAttribute('rel', 'stylesheet');
|
|
175
|
+
linkElement.setAttribute('href', url);
|
|
176
|
+
return linkElement;
|
|
196
177
|
}
|
|
197
178
|
class SharedStylesHost {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
addElement(host, element) {
|
|
304
|
-
// Add a nonce if present
|
|
305
|
-
if (this.nonce) {
|
|
306
|
-
element.setAttribute('nonce', this.nonce);
|
|
307
|
-
}
|
|
308
|
-
// Add application identifier when on the server to support client-side reuse
|
|
309
|
-
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
|
|
310
|
-
element.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);
|
|
311
|
-
}
|
|
312
|
-
// Insert the element into the DOM with the host node as parent
|
|
313
|
-
return host.appendChild(element);
|
|
314
|
-
}
|
|
315
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.9", ngImport: i0, type: SharedStylesHost, deps: [{ token: DOCUMENT }, { token: APP_ID }, { token: CSP_NONCE, optional: true }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
316
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.9", ngImport: i0, type: SharedStylesHost });
|
|
179
|
+
doc;
|
|
180
|
+
appId;
|
|
181
|
+
nonce;
|
|
182
|
+
inline = new Map();
|
|
183
|
+
external = new Map();
|
|
184
|
+
hosts = new Set();
|
|
185
|
+
constructor(doc, appId, nonce, platformId = {}) {
|
|
186
|
+
this.doc = doc;
|
|
187
|
+
this.appId = appId;
|
|
188
|
+
this.nonce = nonce;
|
|
189
|
+
addServerStyles(doc, appId, this.inline, this.external);
|
|
190
|
+
this.hosts.add(doc.head);
|
|
191
|
+
}
|
|
192
|
+
addStyles(styles, urls) {
|
|
193
|
+
for (const value of styles) {
|
|
194
|
+
this.addUsage(value, this.inline, createStyleElement);
|
|
195
|
+
}
|
|
196
|
+
urls?.forEach(value => this.addUsage(value, this.external, createLinkElement));
|
|
197
|
+
}
|
|
198
|
+
removeStyles(styles, urls) {
|
|
199
|
+
for (const value of styles) {
|
|
200
|
+
this.removeUsage(value, this.inline);
|
|
201
|
+
}
|
|
202
|
+
urls?.forEach(value => this.removeUsage(value, this.external));
|
|
203
|
+
}
|
|
204
|
+
addUsage(value, usages, creator) {
|
|
205
|
+
const record = usages.get(value);
|
|
206
|
+
if (record) {
|
|
207
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && record.usage === 0) {
|
|
208
|
+
record.elements.forEach(element => element.setAttribute('ng-style-reused', ''));
|
|
209
|
+
}
|
|
210
|
+
record.usage++;
|
|
211
|
+
} else {
|
|
212
|
+
usages.set(value, {
|
|
213
|
+
usage: 1,
|
|
214
|
+
elements: [...this.hosts].map(host => this.addElement(host, creator(value, this.doc)))
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
removeUsage(value, usages) {
|
|
219
|
+
const record = usages.get(value);
|
|
220
|
+
if (record) {
|
|
221
|
+
record.usage--;
|
|
222
|
+
if (record.usage <= 0) {
|
|
223
|
+
removeElements(record.elements);
|
|
224
|
+
usages.delete(value);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
ngOnDestroy() {
|
|
229
|
+
for (const [, {
|
|
230
|
+
elements
|
|
231
|
+
}] of [...this.inline, ...this.external]) {
|
|
232
|
+
removeElements(elements);
|
|
233
|
+
}
|
|
234
|
+
this.hosts.clear();
|
|
235
|
+
}
|
|
236
|
+
addHost(hostNode) {
|
|
237
|
+
this.hosts.add(hostNode);
|
|
238
|
+
for (const [style, {
|
|
239
|
+
elements
|
|
240
|
+
}] of this.inline) {
|
|
241
|
+
elements.push(this.addElement(hostNode, createStyleElement(style, this.doc)));
|
|
242
|
+
}
|
|
243
|
+
for (const [url, {
|
|
244
|
+
elements
|
|
245
|
+
}] of this.external) {
|
|
246
|
+
elements.push(this.addElement(hostNode, createLinkElement(url, this.doc)));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
removeHost(hostNode) {
|
|
250
|
+
this.hosts.delete(hostNode);
|
|
251
|
+
}
|
|
252
|
+
addElement(host, element) {
|
|
253
|
+
if (this.nonce) {
|
|
254
|
+
element.setAttribute('nonce', this.nonce);
|
|
255
|
+
}
|
|
256
|
+
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
|
|
257
|
+
element.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);
|
|
258
|
+
}
|
|
259
|
+
return host.appendChild(element);
|
|
260
|
+
}
|
|
261
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
262
|
+
minVersion: "12.0.0",
|
|
263
|
+
version: "21.0.0-rc.1",
|
|
264
|
+
ngImport: i0,
|
|
265
|
+
type: SharedStylesHost,
|
|
266
|
+
deps: [{
|
|
267
|
+
token: DOCUMENT
|
|
268
|
+
}, {
|
|
269
|
+
token: APP_ID
|
|
270
|
+
}, {
|
|
271
|
+
token: CSP_NONCE,
|
|
272
|
+
optional: true
|
|
273
|
+
}, {
|
|
274
|
+
token: PLATFORM_ID
|
|
275
|
+
}],
|
|
276
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
277
|
+
});
|
|
278
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
279
|
+
minVersion: "12.0.0",
|
|
280
|
+
version: "21.0.0-rc.1",
|
|
281
|
+
ngImport: i0,
|
|
282
|
+
type: SharedStylesHost
|
|
283
|
+
});
|
|
317
284
|
}
|
|
318
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
286
|
+
minVersion: "12.0.0",
|
|
287
|
+
version: "21.0.0-rc.1",
|
|
288
|
+
ngImport: i0,
|
|
289
|
+
type: SharedStylesHost,
|
|
290
|
+
decorators: [{
|
|
291
|
+
type: Injectable
|
|
292
|
+
}],
|
|
293
|
+
ctorParameters: () => [{
|
|
294
|
+
type: Document,
|
|
295
|
+
decorators: [{
|
|
296
|
+
type: Inject,
|
|
297
|
+
args: [DOCUMENT]
|
|
298
|
+
}]
|
|
299
|
+
}, {
|
|
300
|
+
type: undefined,
|
|
301
|
+
decorators: [{
|
|
302
|
+
type: Inject,
|
|
303
|
+
args: [APP_ID]
|
|
304
|
+
}]
|
|
305
|
+
}, {
|
|
306
|
+
type: undefined,
|
|
307
|
+
decorators: [{
|
|
308
|
+
type: Inject,
|
|
309
|
+
args: [CSP_NONCE]
|
|
310
|
+
}, {
|
|
311
|
+
type: Optional
|
|
312
|
+
}]
|
|
313
|
+
}, {
|
|
314
|
+
type: undefined,
|
|
315
|
+
decorators: [{
|
|
316
|
+
type: Inject,
|
|
317
|
+
args: [PLATFORM_ID]
|
|
318
|
+
}]
|
|
319
|
+
}]
|
|
320
|
+
});
|
|
335
321
|
|
|
336
322
|
const NAMESPACE_URIS = {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
323
|
+
'svg': 'http://www.w3.org/2000/svg',
|
|
324
|
+
'xhtml': 'http://www.w3.org/1999/xhtml',
|
|
325
|
+
'xlink': 'http://www.w3.org/1999/xlink',
|
|
326
|
+
'xml': 'http://www.w3.org/XML/1998/namespace',
|
|
327
|
+
'xmlns': 'http://www.w3.org/2000/xmlns/',
|
|
328
|
+
'math': 'http://www.w3.org/1998/Math/MathML'
|
|
343
329
|
};
|
|
344
330
|
const COMPONENT_REGEX = /%COMP%/g;
|
|
345
331
|
const SOURCEMAP_URL_REGEXP = /\/\*#\s*sourceMappingURL=(.+?)\s*\*\//;
|
|
@@ -347,485 +333,462 @@ const PROTOCOL_REGEXP = /^https?:/;
|
|
|
347
333
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
348
334
|
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
|
349
335
|
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
|
350
|
-
/**
|
|
351
|
-
* The default value for the `REMOVE_STYLES_ON_COMPONENT_DESTROY` DI token.
|
|
352
|
-
*/
|
|
353
336
|
const REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;
|
|
354
|
-
/**
|
|
355
|
-
* A DI token that indicates whether styles
|
|
356
|
-
* of destroyed components should be removed from DOM.
|
|
357
|
-
*
|
|
358
|
-
* By default, the value is set to `true`.
|
|
359
|
-
* @publicApi
|
|
360
|
-
*/
|
|
361
337
|
const REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'RemoveStylesOnCompDestroy' : '', {
|
|
362
|
-
|
|
363
|
-
factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT,
|
|
338
|
+
factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT
|
|
364
339
|
});
|
|
365
340
|
function shimContentAttribute(componentShortId) {
|
|
366
|
-
|
|
341
|
+
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
|
367
342
|
}
|
|
368
343
|
function shimHostAttribute(componentShortId) {
|
|
369
|
-
|
|
344
|
+
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
|
370
345
|
}
|
|
371
346
|
function shimStylesContent(compId, styles) {
|
|
372
|
-
|
|
347
|
+
return styles.map(s => s.replace(COMPONENT_REGEX, compId));
|
|
373
348
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Prepends a baseHref to the `sourceMappingURL` within the provided CSS content.
|
|
376
|
-
* If the `sourceMappingURL` contains an inline (encoded) map, the function skips processing.
|
|
377
|
-
*
|
|
378
|
-
* @note For inline stylesheets, the `sourceMappingURL` is relative to the page's origin
|
|
379
|
-
* and not the provided baseHref. This function is needed as when accessing the page with a URL
|
|
380
|
-
* containing two or more segments.
|
|
381
|
-
* For example, if the baseHref is set to `/`, and you visit a URL like `http://localhost/foo/bar`,
|
|
382
|
-
* the map would be requested from `http://localhost/foo/bar/comp.css.map` instead of what you'd expect,
|
|
383
|
-
* which is `http://localhost/comp.css.map`. This behavior is corrected by modifying the `sourceMappingURL`
|
|
384
|
-
* to ensure external source maps are loaded relative to the baseHref.
|
|
385
|
-
*
|
|
386
|
-
|
|
387
|
-
* @param baseHref - The base URL to prepend to the `sourceMappingURL`.
|
|
388
|
-
* @param styles - An array of CSS content strings, each potentially containing a `sourceMappingURL`.
|
|
389
|
-
* @returns The updated array of CSS content strings with modified `sourceMappingURL` values,
|
|
390
|
-
* or the original content if no modification is needed.
|
|
391
|
-
*/
|
|
392
349
|
function addBaseHrefToCssSourceMap(baseHref, styles) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
});
|
|
350
|
+
if (!baseHref) {
|
|
351
|
+
return styles;
|
|
352
|
+
}
|
|
353
|
+
const absoluteBaseHrefUrl = new URL(baseHref, 'http://localhost');
|
|
354
|
+
return styles.map(cssContent => {
|
|
355
|
+
if (!cssContent.includes('sourceMappingURL=')) {
|
|
356
|
+
return cssContent;
|
|
357
|
+
}
|
|
358
|
+
return cssContent.replace(SOURCEMAP_URL_REGEXP, (_, sourceMapUrl) => {
|
|
359
|
+
if (sourceMapUrl[0] === '/' || sourceMapUrl.startsWith('data:') || PROTOCOL_REGEXP.test(sourceMapUrl)) {
|
|
360
|
+
return `/*# sourceMappingURL=${sourceMapUrl} */`;
|
|
361
|
+
}
|
|
362
|
+
const {
|
|
363
|
+
pathname: resolvedSourceMapUrl
|
|
364
|
+
} = new URL(sourceMapUrl, absoluteBaseHrefUrl);
|
|
365
|
+
return `/*# sourceMappingURL=${resolvedSourceMapUrl} */`;
|
|
410
366
|
});
|
|
367
|
+
});
|
|
411
368
|
}
|
|
412
369
|
class DomRendererFactory2 {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
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
|
-
|
|
370
|
+
eventManager;
|
|
371
|
+
sharedStylesHost;
|
|
372
|
+
appId;
|
|
373
|
+
removeStylesOnCompDestroy;
|
|
374
|
+
doc;
|
|
375
|
+
platformId;
|
|
376
|
+
ngZone;
|
|
377
|
+
nonce;
|
|
378
|
+
tracingService;
|
|
379
|
+
rendererByCompId = new Map();
|
|
380
|
+
defaultRenderer;
|
|
381
|
+
platformIsServer;
|
|
382
|
+
constructor(eventManager, sharedStylesHost, appId, removeStylesOnCompDestroy, doc, platformId, ngZone, nonce = null, tracingService = null) {
|
|
383
|
+
this.eventManager = eventManager;
|
|
384
|
+
this.sharedStylesHost = sharedStylesHost;
|
|
385
|
+
this.appId = appId;
|
|
386
|
+
this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
|
|
387
|
+
this.doc = doc;
|
|
388
|
+
this.platformId = platformId;
|
|
389
|
+
this.ngZone = ngZone;
|
|
390
|
+
this.nonce = nonce;
|
|
391
|
+
this.tracingService = tracingService;
|
|
392
|
+
this.platformIsServer = typeof ngServerMode !== 'undefined' && ngServerMode;
|
|
393
|
+
this.defaultRenderer = new DefaultDomRenderer2(eventManager, doc, ngZone, this.platformIsServer, this.tracingService);
|
|
394
|
+
}
|
|
395
|
+
createRenderer(element, type) {
|
|
396
|
+
if (!element || !type) {
|
|
397
|
+
return this.defaultRenderer;
|
|
398
|
+
}
|
|
399
|
+
if (typeof ngServerMode !== 'undefined' && ngServerMode && (type.encapsulation === ViewEncapsulation.ShadowDom || type.encapsulation === ViewEncapsulation.IsolatedShadowDom)) {
|
|
400
|
+
type = {
|
|
401
|
+
...type,
|
|
402
|
+
encapsulation: ViewEncapsulation.Emulated
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
const renderer = this.getOrCreateRenderer(element, type);
|
|
406
|
+
if (renderer instanceof EmulatedEncapsulationDomRenderer2) {
|
|
407
|
+
renderer.applyToHost(element);
|
|
408
|
+
} else if (renderer instanceof NoneEncapsulationDomRenderer) {
|
|
409
|
+
renderer.applyStyles();
|
|
410
|
+
}
|
|
411
|
+
return renderer;
|
|
412
|
+
}
|
|
413
|
+
getOrCreateRenderer(element, type) {
|
|
414
|
+
const rendererByCompId = this.rendererByCompId;
|
|
415
|
+
let renderer = rendererByCompId.get(type.id);
|
|
416
|
+
if (!renderer) {
|
|
417
|
+
const doc = this.doc;
|
|
418
|
+
const ngZone = this.ngZone;
|
|
419
|
+
const eventManager = this.eventManager;
|
|
420
|
+
const sharedStylesHost = this.sharedStylesHost;
|
|
421
|
+
const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy;
|
|
422
|
+
const platformIsServer = this.platformIsServer;
|
|
423
|
+
const tracingService = this.tracingService;
|
|
424
|
+
switch (type.encapsulation) {
|
|
425
|
+
case ViewEncapsulation.Emulated:
|
|
426
|
+
renderer = new EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, type, this.appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService);
|
|
427
|
+
break;
|
|
428
|
+
case ViewEncapsulation.ShadowDom:
|
|
429
|
+
return new ShadowDomRenderer(eventManager, element, type, doc, ngZone, this.nonce, platformIsServer, tracingService, sharedStylesHost);
|
|
430
|
+
case ViewEncapsulation.IsolatedShadowDom:
|
|
431
|
+
return new ShadowDomRenderer(eventManager, element, type, doc, ngZone, this.nonce, platformIsServer, tracingService);
|
|
432
|
+
default:
|
|
433
|
+
renderer = new NoneEncapsulationDomRenderer(eventManager, sharedStylesHost, type, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService);
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
rendererByCompId.set(type.id, renderer);
|
|
437
|
+
}
|
|
438
|
+
return renderer;
|
|
439
|
+
}
|
|
440
|
+
ngOnDestroy() {
|
|
441
|
+
this.rendererByCompId.clear();
|
|
442
|
+
}
|
|
443
|
+
componentReplaced(componentId) {
|
|
444
|
+
this.rendererByCompId.delete(componentId);
|
|
445
|
+
}
|
|
446
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
447
|
+
minVersion: "12.0.0",
|
|
448
|
+
version: "21.0.0-rc.1",
|
|
449
|
+
ngImport: i0,
|
|
450
|
+
type: DomRendererFactory2,
|
|
451
|
+
deps: [{
|
|
452
|
+
token: EventManager
|
|
453
|
+
}, {
|
|
454
|
+
token: SharedStylesHost
|
|
455
|
+
}, {
|
|
456
|
+
token: APP_ID
|
|
457
|
+
}, {
|
|
458
|
+
token: REMOVE_STYLES_ON_COMPONENT_DESTROY
|
|
459
|
+
}, {
|
|
460
|
+
token: DOCUMENT
|
|
461
|
+
}, {
|
|
462
|
+
token: PLATFORM_ID
|
|
463
|
+
}, {
|
|
464
|
+
token: i0.NgZone
|
|
465
|
+
}, {
|
|
466
|
+
token: CSP_NONCE
|
|
467
|
+
}, {
|
|
468
|
+
token: _TracingService,
|
|
469
|
+
optional: true
|
|
470
|
+
}],
|
|
471
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
472
|
+
});
|
|
473
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
474
|
+
minVersion: "12.0.0",
|
|
475
|
+
version: "21.0.0-rc.1",
|
|
476
|
+
ngImport: i0,
|
|
477
|
+
type: DomRendererFactory2
|
|
478
|
+
});
|
|
499
479
|
}
|
|
500
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
480
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
481
|
+
minVersion: "12.0.0",
|
|
482
|
+
version: "21.0.0-rc.1",
|
|
483
|
+
ngImport: i0,
|
|
484
|
+
type: DomRendererFactory2,
|
|
485
|
+
decorators: [{
|
|
486
|
+
type: Injectable
|
|
487
|
+
}],
|
|
488
|
+
ctorParameters: () => [{
|
|
489
|
+
type: EventManager
|
|
490
|
+
}, {
|
|
491
|
+
type: SharedStylesHost
|
|
492
|
+
}, {
|
|
493
|
+
type: undefined,
|
|
494
|
+
decorators: [{
|
|
495
|
+
type: Inject,
|
|
496
|
+
args: [APP_ID]
|
|
497
|
+
}]
|
|
498
|
+
}, {
|
|
499
|
+
type: undefined,
|
|
500
|
+
decorators: [{
|
|
501
|
+
type: Inject,
|
|
502
|
+
args: [REMOVE_STYLES_ON_COMPONENT_DESTROY]
|
|
503
|
+
}]
|
|
504
|
+
}, {
|
|
505
|
+
type: Document,
|
|
506
|
+
decorators: [{
|
|
507
|
+
type: Inject,
|
|
508
|
+
args: [DOCUMENT]
|
|
509
|
+
}]
|
|
510
|
+
}, {
|
|
511
|
+
type: Object,
|
|
512
|
+
decorators: [{
|
|
513
|
+
type: Inject,
|
|
514
|
+
args: [PLATFORM_ID]
|
|
515
|
+
}]
|
|
516
|
+
}, {
|
|
517
|
+
type: i0.NgZone
|
|
518
|
+
}, {
|
|
519
|
+
type: undefined,
|
|
520
|
+
decorators: [{
|
|
521
|
+
type: Inject,
|
|
522
|
+
args: [CSP_NONCE]
|
|
523
|
+
}]
|
|
524
|
+
}, {
|
|
525
|
+
type: i0.ɵTracingService,
|
|
526
|
+
decorators: [{
|
|
527
|
+
type: Inject,
|
|
528
|
+
args: [_TracingService]
|
|
529
|
+
}, {
|
|
530
|
+
type: Optional
|
|
531
|
+
}]
|
|
532
|
+
}]
|
|
533
|
+
});
|
|
523
534
|
class DefaultDomRenderer2 {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
createElement(name
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
this.throwOnSyntheticProps &&
|
|
663
|
-
checkNoSyntheticProp(event, 'listener');
|
|
664
|
-
if (typeof target === 'string') {
|
|
665
|
-
target = _getDOM().getGlobalEventTarget(this.doc, target);
|
|
666
|
-
if (!target) {
|
|
667
|
-
throw new _RuntimeError(5102 /* RuntimeErrorCode.UNSUPPORTED_EVENT_TARGET */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
668
|
-
`Unsupported event target ${target} for event ${event}`);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
let wrappedCallback = this.decoratePreventDefault(callback);
|
|
672
|
-
if (this.tracingService?.wrapEventListener) {
|
|
673
|
-
wrappedCallback = this.tracingService.wrapEventListener(target, event, wrappedCallback);
|
|
674
|
-
}
|
|
675
|
-
return this.eventManager.addEventListener(target, event, wrappedCallback, options);
|
|
676
|
-
}
|
|
677
|
-
decoratePreventDefault(eventHandler) {
|
|
678
|
-
// `DebugNode.triggerEventHandler` needs to know if the listener was created with
|
|
679
|
-
// decoratePreventDefault or is a listener added outside the Angular context so it can handle
|
|
680
|
-
// the two differently. In the first case, the special '__ngUnwrap__' token is passed to the
|
|
681
|
-
// unwrap the listener (see below).
|
|
682
|
-
return (event) => {
|
|
683
|
-
// Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function
|
|
684
|
-
// so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The
|
|
685
|
-
// debug_node can inspect the listener toString contents for the existence of this special
|
|
686
|
-
// token. Because the token is a string literal, it is ensured to not be modified by compiled
|
|
687
|
-
// code.
|
|
688
|
-
if (event === '__ngUnwrap__') {
|
|
689
|
-
return eventHandler;
|
|
690
|
-
}
|
|
691
|
-
// Run the event handler inside the ngZone because event handlers are not patched
|
|
692
|
-
// by Zone on the server. This is required only for tests.
|
|
693
|
-
const allowDefaultBehavior = typeof ngServerMode !== 'undefined' && ngServerMode
|
|
694
|
-
? this.ngZone.runGuarded(() => eventHandler(event))
|
|
695
|
-
: eventHandler(event);
|
|
696
|
-
if (allowDefaultBehavior === false) {
|
|
697
|
-
event.preventDefault();
|
|
698
|
-
}
|
|
699
|
-
return undefined;
|
|
700
|
-
};
|
|
701
|
-
}
|
|
535
|
+
eventManager;
|
|
536
|
+
doc;
|
|
537
|
+
ngZone;
|
|
538
|
+
platformIsServer;
|
|
539
|
+
tracingService;
|
|
540
|
+
data = Object.create(null);
|
|
541
|
+
throwOnSyntheticProps = true;
|
|
542
|
+
constructor(eventManager, doc, ngZone, platformIsServer, tracingService) {
|
|
543
|
+
this.eventManager = eventManager;
|
|
544
|
+
this.doc = doc;
|
|
545
|
+
this.ngZone = ngZone;
|
|
546
|
+
this.platformIsServer = platformIsServer;
|
|
547
|
+
this.tracingService = tracingService;
|
|
548
|
+
}
|
|
549
|
+
destroy() {}
|
|
550
|
+
destroyNode = null;
|
|
551
|
+
createElement(name, namespace) {
|
|
552
|
+
if (namespace) {
|
|
553
|
+
return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
|
|
554
|
+
}
|
|
555
|
+
return this.doc.createElement(name);
|
|
556
|
+
}
|
|
557
|
+
createComment(value) {
|
|
558
|
+
return this.doc.createComment(value);
|
|
559
|
+
}
|
|
560
|
+
createText(value) {
|
|
561
|
+
return this.doc.createTextNode(value);
|
|
562
|
+
}
|
|
563
|
+
appendChild(parent, newChild) {
|
|
564
|
+
const targetParent = isTemplateNode(parent) ? parent.content : parent;
|
|
565
|
+
targetParent.appendChild(newChild);
|
|
566
|
+
}
|
|
567
|
+
insertBefore(parent, newChild, refChild) {
|
|
568
|
+
if (parent) {
|
|
569
|
+
const targetParent = isTemplateNode(parent) ? parent.content : parent;
|
|
570
|
+
targetParent.insertBefore(newChild, refChild);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
removeChild(_parent, oldChild) {
|
|
574
|
+
oldChild.remove();
|
|
575
|
+
}
|
|
576
|
+
selectRootElement(selectorOrNode, preserveContent) {
|
|
577
|
+
let el = typeof selectorOrNode === 'string' ? this.doc.querySelector(selectorOrNode) : selectorOrNode;
|
|
578
|
+
if (!el) {
|
|
579
|
+
throw new _RuntimeError(-5104, (typeof ngDevMode === 'undefined' || ngDevMode) && `The selector "${selectorOrNode}" did not match any elements`);
|
|
580
|
+
}
|
|
581
|
+
if (!preserveContent) {
|
|
582
|
+
el.textContent = '';
|
|
583
|
+
}
|
|
584
|
+
return el;
|
|
585
|
+
}
|
|
586
|
+
parentNode(node) {
|
|
587
|
+
return node.parentNode;
|
|
588
|
+
}
|
|
589
|
+
nextSibling(node) {
|
|
590
|
+
return node.nextSibling;
|
|
591
|
+
}
|
|
592
|
+
setAttribute(el, name, value, namespace) {
|
|
593
|
+
if (namespace) {
|
|
594
|
+
name = namespace + ':' + name;
|
|
595
|
+
const namespaceUri = NAMESPACE_URIS[namespace];
|
|
596
|
+
if (namespaceUri) {
|
|
597
|
+
el.setAttributeNS(namespaceUri, name, value);
|
|
598
|
+
} else {
|
|
599
|
+
el.setAttribute(name, value);
|
|
600
|
+
}
|
|
601
|
+
} else {
|
|
602
|
+
el.setAttribute(name, value);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
removeAttribute(el, name, namespace) {
|
|
606
|
+
if (namespace) {
|
|
607
|
+
const namespaceUri = NAMESPACE_URIS[namespace];
|
|
608
|
+
if (namespaceUri) {
|
|
609
|
+
el.removeAttributeNS(namespaceUri, name);
|
|
610
|
+
} else {
|
|
611
|
+
el.removeAttribute(`${namespace}:${name}`);
|
|
612
|
+
}
|
|
613
|
+
} else {
|
|
614
|
+
el.removeAttribute(name);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
addClass(el, name) {
|
|
618
|
+
el.classList.add(name);
|
|
619
|
+
}
|
|
620
|
+
removeClass(el, name) {
|
|
621
|
+
el.classList.remove(name);
|
|
622
|
+
}
|
|
623
|
+
setStyle(el, style, value, flags) {
|
|
624
|
+
if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
|
|
625
|
+
el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? 'important' : '');
|
|
626
|
+
} else {
|
|
627
|
+
el.style[style] = value;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
removeStyle(el, style, flags) {
|
|
631
|
+
if (flags & RendererStyleFlags2.DashCase) {
|
|
632
|
+
el.style.removeProperty(style);
|
|
633
|
+
} else {
|
|
634
|
+
el.style[style] = '';
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
setProperty(el, name, value) {
|
|
638
|
+
if (el == null) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
(typeof ngDevMode === 'undefined' || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(name, 'property');
|
|
642
|
+
el[name] = value;
|
|
643
|
+
}
|
|
644
|
+
setValue(node, value) {
|
|
645
|
+
node.nodeValue = value;
|
|
646
|
+
}
|
|
647
|
+
listen(target, event, callback, options) {
|
|
648
|
+
(typeof ngDevMode === 'undefined' || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(event, 'listener');
|
|
649
|
+
if (typeof target === 'string') {
|
|
650
|
+
target = _getDOM().getGlobalEventTarget(this.doc, target);
|
|
651
|
+
if (!target) {
|
|
652
|
+
throw new _RuntimeError(5102, (typeof ngDevMode === 'undefined' || ngDevMode) && `Unsupported event target ${target} for event ${event}`);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
let wrappedCallback = this.decoratePreventDefault(callback);
|
|
656
|
+
if (this.tracingService?.wrapEventListener) {
|
|
657
|
+
wrappedCallback = this.tracingService.wrapEventListener(target, event, wrappedCallback);
|
|
658
|
+
}
|
|
659
|
+
return this.eventManager.addEventListener(target, event, wrappedCallback, options);
|
|
660
|
+
}
|
|
661
|
+
decoratePreventDefault(eventHandler) {
|
|
662
|
+
return event => {
|
|
663
|
+
if (event === '__ngUnwrap__') {
|
|
664
|
+
return eventHandler;
|
|
665
|
+
}
|
|
666
|
+
const allowDefaultBehavior = typeof ngServerMode !== 'undefined' && ngServerMode ? this.ngZone.runGuarded(() => eventHandler(event)) : eventHandler(event);
|
|
667
|
+
if (allowDefaultBehavior === false) {
|
|
668
|
+
event.preventDefault();
|
|
669
|
+
}
|
|
670
|
+
return undefined;
|
|
671
|
+
};
|
|
672
|
+
}
|
|
702
673
|
}
|
|
703
674
|
const AT_CHARCODE = (() => '@'.charCodeAt(0))();
|
|
704
675
|
function checkNoSyntheticProp(name, nameKind) {
|
|
705
|
-
|
|
706
|
-
|
|
676
|
+
if (name.charCodeAt(0) === AT_CHARCODE) {
|
|
677
|
+
throw new _RuntimeError(5105, `Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
|
|
707
678
|
- Make sure \`provideAnimationsAsync()\`, \`provideAnimations()\` or \`provideNoopAnimations()\` call was added to a list of providers used to bootstrap an application.
|
|
708
679
|
- There is a corresponding animation configuration named \`${name}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.dev/api/core/Component#animations).`);
|
|
709
|
-
|
|
680
|
+
}
|
|
710
681
|
}
|
|
711
682
|
function isTemplateNode(node) {
|
|
712
|
-
|
|
683
|
+
return node.tagName === 'TEMPLATE' && node.content !== undefined;
|
|
713
684
|
}
|
|
714
685
|
class ShadowDomRenderer extends DefaultDomRenderer2 {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
nodeOrShadowRoot(
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
|
|
774
|
-
}
|
|
775
|
-
destroy() {
|
|
776
|
-
if (this.sharedStylesHost) {
|
|
777
|
-
this.sharedStylesHost.removeHost(this.shadowRoot);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
686
|
+
hostEl;
|
|
687
|
+
sharedStylesHost;
|
|
688
|
+
shadowRoot;
|
|
689
|
+
constructor(eventManager, hostEl, component, doc, ngZone, nonce, platformIsServer, tracingService, sharedStylesHost) {
|
|
690
|
+
super(eventManager, doc, ngZone, platformIsServer, tracingService);
|
|
691
|
+
this.hostEl = hostEl;
|
|
692
|
+
this.sharedStylesHost = sharedStylesHost;
|
|
693
|
+
this.shadowRoot = hostEl.attachShadow({
|
|
694
|
+
mode: 'open'
|
|
695
|
+
});
|
|
696
|
+
if (this.sharedStylesHost) {
|
|
697
|
+
this.sharedStylesHost.addHost(this.shadowRoot);
|
|
698
|
+
}
|
|
699
|
+
let styles = component.styles;
|
|
700
|
+
if (ngDevMode) {
|
|
701
|
+
const baseHref = _getDOM().getBaseHref(doc) ?? '';
|
|
702
|
+
styles = addBaseHrefToCssSourceMap(baseHref, styles);
|
|
703
|
+
}
|
|
704
|
+
styles = shimStylesContent(component.id, styles);
|
|
705
|
+
for (const style of styles) {
|
|
706
|
+
const styleEl = document.createElement('style');
|
|
707
|
+
if (nonce) {
|
|
708
|
+
styleEl.setAttribute('nonce', nonce);
|
|
709
|
+
}
|
|
710
|
+
styleEl.textContent = style;
|
|
711
|
+
this.shadowRoot.appendChild(styleEl);
|
|
712
|
+
}
|
|
713
|
+
const styleUrls = component.getExternalStyles?.();
|
|
714
|
+
if (styleUrls) {
|
|
715
|
+
for (const styleUrl of styleUrls) {
|
|
716
|
+
const linkEl = createLinkElement(styleUrl, doc);
|
|
717
|
+
if (nonce) {
|
|
718
|
+
linkEl.setAttribute('nonce', nonce);
|
|
719
|
+
}
|
|
720
|
+
this.shadowRoot.appendChild(linkEl);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
nodeOrShadowRoot(node) {
|
|
725
|
+
return node === this.hostEl ? this.shadowRoot : node;
|
|
726
|
+
}
|
|
727
|
+
appendChild(parent, newChild) {
|
|
728
|
+
return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
|
|
729
|
+
}
|
|
730
|
+
insertBefore(parent, newChild, refChild) {
|
|
731
|
+
return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
|
|
732
|
+
}
|
|
733
|
+
removeChild(_parent, oldChild) {
|
|
734
|
+
return super.removeChild(null, oldChild);
|
|
735
|
+
}
|
|
736
|
+
parentNode(node) {
|
|
737
|
+
return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
|
|
738
|
+
}
|
|
739
|
+
destroy() {
|
|
740
|
+
if (this.sharedStylesHost) {
|
|
741
|
+
this.sharedStylesHost.removeHost(this.shadowRoot);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
780
744
|
}
|
|
781
745
|
class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
746
|
+
sharedStylesHost;
|
|
747
|
+
removeStylesOnCompDestroy;
|
|
748
|
+
styles;
|
|
749
|
+
styleUrls;
|
|
750
|
+
constructor(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService, compId) {
|
|
751
|
+
super(eventManager, doc, ngZone, platformIsServer, tracingService);
|
|
752
|
+
this.sharedStylesHost = sharedStylesHost;
|
|
753
|
+
this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
|
|
754
|
+
let styles = component.styles;
|
|
755
|
+
if (ngDevMode) {
|
|
756
|
+
const baseHref = _getDOM().getBaseHref(doc) ?? '';
|
|
757
|
+
styles = addBaseHrefToCssSourceMap(baseHref, styles);
|
|
758
|
+
}
|
|
759
|
+
this.styles = compId ? shimStylesContent(compId, styles) : styles;
|
|
760
|
+
this.styleUrls = component.getExternalStyles?.(compId);
|
|
761
|
+
}
|
|
762
|
+
applyStyles() {
|
|
763
|
+
this.sharedStylesHost.addStyles(this.styles, this.styleUrls);
|
|
764
|
+
}
|
|
765
|
+
destroy() {
|
|
766
|
+
if (!this.removeStylesOnCompDestroy) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
if (_allLeavingAnimations.size === 0) {
|
|
770
|
+
this.sharedStylesHost.removeStyles(this.styles, this.styleUrls);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
810
773
|
}
|
|
811
774
|
class EmulatedEncapsulationDomRenderer2 extends NoneEncapsulationDomRenderer {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
775
|
+
contentAttr;
|
|
776
|
+
hostAttr;
|
|
777
|
+
constructor(eventManager, sharedStylesHost, component, appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService) {
|
|
778
|
+
const compId = appId + '-' + component.id;
|
|
779
|
+
super(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService, compId);
|
|
780
|
+
this.contentAttr = shimContentAttribute(compId);
|
|
781
|
+
this.hostAttr = shimHostAttribute(compId);
|
|
782
|
+
}
|
|
783
|
+
applyToHost(element) {
|
|
784
|
+
this.applyStyles();
|
|
785
|
+
this.setAttribute(element, this.hostAttr, '');
|
|
786
|
+
}
|
|
787
|
+
createElement(parent, name) {
|
|
788
|
+
const el = super.createElement(parent, name);
|
|
789
|
+
super.setAttribute(el, this.contentAttr, '');
|
|
790
|
+
return el;
|
|
791
|
+
}
|
|
829
792
|
}
|
|
830
793
|
|
|
831
794
|
export { DomEventsPlugin, DomRendererFactory2, EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin, REMOVE_STYLES_ON_COMPONENT_DESTROY, SharedStylesHost };
|