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