@angular/platform-browser 21.0.0-next.1 → 21.0.0-next.10
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 +424 -0
- package/fesm2022/_browser-chunk.mjs.map +1 -0
- package/fesm2022/_dom_renderer-chunk.mjs +796 -0
- package/fesm2022/_dom_renderer-chunk.mjs.map +1 -0
- package/fesm2022/animations-async.mjs +237 -0
- package/fesm2022/animations-async.mjs.map +1 -0
- package/fesm2022/animations.mjs +159 -173
- package/fesm2022/animations.mjs.map +1 -1
- package/fesm2022/platform-browser.mjs +619 -915
- package/fesm2022/platform-browser.mjs.map +1 -1
- package/fesm2022/testing.mjs +107 -75
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +10 -10
- package/{browser.d.d.ts → types/_browser-chunk.d.ts} +16 -11
- package/{animations/async/index.d.ts → types/animations-async.d.ts} +2 -2
- package/{animations/index.d.ts → types/animations.d.ts} +3 -3
- package/{index.d.ts → types/platform-browser.d.ts} +36 -30
- package/{testing/index.d.ts → types/testing.d.ts} +3 -3
- package/fesm2022/animations/async.mjs +0 -302
- package/fesm2022/animations/async.mjs.map +0 -1
- package/fesm2022/browser.mjs +0 -560
- package/fesm2022/browser.mjs.map +0 -1
- package/fesm2022/dom_renderer.mjs +0 -837
- package/fesm2022/dom_renderer.mjs.map +0 -1
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Angular v21.0.0-next.10
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { DOCUMENT, ɵgetDOM as _getDOM } from '@angular/common';
|
|
8
|
+
import * as i0 from '@angular/core';
|
|
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-next.10",
|
|
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-next.10",
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
type: DomEventsPlugin
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
51
|
+
minVersion: "12.0.0",
|
|
52
|
+
version: "21.0.0-next.10",
|
|
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
|
+
});
|
|
66
|
+
|
|
67
|
+
const EVENT_MANAGER_PLUGINS = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'EventManagerPlugins' : '');
|
|
68
|
+
class 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-next.10",
|
|
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-next.10",
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
type: EventManager
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
124
|
+
minVersion: "12.0.0",
|
|
125
|
+
version: "21.0.0-next.10",
|
|
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
|
+
});
|
|
141
|
+
|
|
142
|
+
const APP_ID_ATTRIBUTE_NAME = 'ng-app-id';
|
|
143
|
+
function removeElements(elements) {
|
|
144
|
+
for (const element of elements) {
|
|
145
|
+
element.remove();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function createStyleElement(style, doc) {
|
|
149
|
+
const styleElement = doc.createElement('style');
|
|
150
|
+
styleElement.textContent = style;
|
|
151
|
+
return styleElement;
|
|
152
|
+
}
|
|
153
|
+
function addServerStyles(doc, appId, inline, external) {
|
|
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
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function createLinkElement(url, doc) {
|
|
173
|
+
const linkElement = doc.createElement('link');
|
|
174
|
+
linkElement.setAttribute('rel', 'stylesheet');
|
|
175
|
+
linkElement.setAttribute('href', url);
|
|
176
|
+
return linkElement;
|
|
177
|
+
}
|
|
178
|
+
class 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-next.10",
|
|
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-next.10",
|
|
281
|
+
ngImport: i0,
|
|
282
|
+
type: SharedStylesHost
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
286
|
+
minVersion: "12.0.0",
|
|
287
|
+
version: "21.0.0-next.10",
|
|
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
|
+
});
|
|
321
|
+
|
|
322
|
+
const NAMESPACE_URIS = {
|
|
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'
|
|
329
|
+
};
|
|
330
|
+
const COMPONENT_REGEX = /%COMP%/g;
|
|
331
|
+
const SOURCEMAP_URL_REGEXP = /\/\*#\s*sourceMappingURL=(.+?)\s*\*\//;
|
|
332
|
+
const PROTOCOL_REGEXP = /^https?:/;
|
|
333
|
+
const COMPONENT_VARIABLE = '%COMP%';
|
|
334
|
+
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
|
335
|
+
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
|
336
|
+
const REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;
|
|
337
|
+
const REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'RemoveStylesOnCompDestroy' : '', {
|
|
338
|
+
providedIn: 'root',
|
|
339
|
+
factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT
|
|
340
|
+
});
|
|
341
|
+
function shimContentAttribute(componentShortId) {
|
|
342
|
+
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
|
343
|
+
}
|
|
344
|
+
function shimHostAttribute(componentShortId) {
|
|
345
|
+
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
|
346
|
+
}
|
|
347
|
+
function shimStylesContent(compId, styles) {
|
|
348
|
+
return styles.map(s => s.replace(COMPONENT_REGEX, compId));
|
|
349
|
+
}
|
|
350
|
+
function addBaseHrefToCssSourceMap(baseHref, styles) {
|
|
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} */`;
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
class DomRendererFactory2 {
|
|
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-next.10",
|
|
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-next.10",
|
|
477
|
+
ngImport: i0,
|
|
478
|
+
type: DomRendererFactory2
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
482
|
+
minVersion: "12.0.0",
|
|
483
|
+
version: "21.0.0-next.10",
|
|
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
|
+
});
|
|
535
|
+
class DefaultDomRenderer2 {
|
|
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
|
+
}
|
|
674
|
+
}
|
|
675
|
+
const AT_CHARCODE = (() => '@'.charCodeAt(0))();
|
|
676
|
+
function checkNoSyntheticProp(name, nameKind) {
|
|
677
|
+
if (name.charCodeAt(0) === AT_CHARCODE) {
|
|
678
|
+
throw new _RuntimeError(5105, `Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
|
|
679
|
+
- Make sure \`provideAnimationsAsync()\`, \`provideAnimations()\` or \`provideNoopAnimations()\` call was added to a list of providers used to bootstrap an application.
|
|
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).`);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
function isTemplateNode(node) {
|
|
684
|
+
return node.tagName === 'TEMPLATE' && node.content !== undefined;
|
|
685
|
+
}
|
|
686
|
+
class ShadowDomRenderer extends DefaultDomRenderer2 {
|
|
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
|
+
}
|
|
745
|
+
}
|
|
746
|
+
class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {
|
|
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
|
+
}
|
|
774
|
+
}
|
|
775
|
+
class EmulatedEncapsulationDomRenderer2 extends NoneEncapsulationDomRenderer {
|
|
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
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export { DomEventsPlugin, DomRendererFactory2, EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin, REMOVE_STYLES_ON_COMPONENT_DESTROY, SharedStylesHost };
|
|
796
|
+
//# sourceMappingURL=_dom_renderer-chunk.mjs.map
|