@angular/platform-browser 21.0.0-next.8 → 21.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,968 +1,699 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.8
2
+ * @license Angular v21.0.0-rc.0
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- export { BrowserModule, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserGetTestability as ɵBrowserGetTestability, DomEventsPlugin as ɵDomEventsPlugin, KeyEventsPlugin as ɵKeyEventsPlugin } from './_browser-chunk.mjs';
7
+ export { BrowserModule, bootstrapApplication, createApplication, platformBrowser, provideProtractorTestingSupport, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserGetTestability as ɵBrowserGetTestability, KeyEventsPlugin as ɵKeyEventsPlugin } from './_browser-chunk.mjs';
8
8
  import { ɵgetDOM as _getDOM, DOCUMENT } from '@angular/common';
9
9
  export { ɵgetDOM } from '@angular/common';
10
10
  import * as i0 from '@angular/core';
11
11
  import { Injectable, Inject, ɵglobal as _global, ApplicationRef, InjectionToken, ɵConsole as _Console, Optional, Injector, NgModule, forwardRef, ɵRuntimeError as _RuntimeError, ɵXSS_SECURITY_URL as _XSS_SECURITY_URL, SecurityContext, ɵallowSanitizationBypassAndThrow as _allowSanitizationBypassAndThrow, ɵunwrapSafeValue as _unwrapSafeValue, ɵ_sanitizeUrl as __sanitizeUrl, ɵ_sanitizeHtml as __sanitizeHtml, ɵbypassSanitizationTrustHtml as _bypassSanitizationTrustHtml, ɵbypassSanitizationTrustStyle as _bypassSanitizationTrustStyle, ɵbypassSanitizationTrustScript as _bypassSanitizationTrustScript, ɵbypassSanitizationTrustUrl as _bypassSanitizationTrustUrl, ɵbypassSanitizationTrustResourceUrl as _bypassSanitizationTrustResourceUrl, ɵwithI18nSupport as _withI18nSupport, ɵwithEventReplay as _withEventReplay, ɵwithIncrementalHydration as _withIncrementalHydration, makeEnvironmentProviders, ɵwithDomHydration as _withDomHydration, ENVIRONMENT_INITIALIZER, inject, ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION as _IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, ɵformatRuntimeError as _formatRuntimeError, Version } from '@angular/core';
12
12
  import { EventManagerPlugin, EVENT_MANAGER_PLUGINS } from './_dom_renderer-chunk.mjs';
13
- export { EventManager, REMOVE_STYLES_ON_COMPONENT_DESTROY, DomRendererFactory2 as ɵDomRendererFactory2, SharedStylesHost as ɵSharedStylesHost } from './_dom_renderer-chunk.mjs';
13
+ export { EventManager, REMOVE_STYLES_ON_COMPONENT_DESTROY, DomEventsPlugin as ɵDomEventsPlugin, DomRendererFactory2 as ɵDomRendererFactory2, SharedStylesHost as ɵSharedStylesHost } from './_dom_renderer-chunk.mjs';
14
14
  import { ɵwithHttpTransferCache as _withHttpTransferCache } from '@angular/common/http';
15
15
 
16
- /**
17
- * A service for managing HTML `<meta>` tags.
18
- *
19
- * Properties of the `MetaDefinition` object match the attributes of the
20
- * HTML `<meta>` tag. These tags define document metadata that is important for
21
- * things like configuring a Content Security Policy, defining browser compatibility
22
- * and security settings, setting HTTP Headers, defining rich content for social sharing,
23
- * and Search Engine Optimization (SEO).
24
- *
25
- * To identify specific `<meta>` tags in a document, use an attribute selection
26
- * string in the format `"tag_attribute='value string'"`.
27
- * For example, an `attrSelector` value of `"name='description'"` matches a tag
28
- * whose `name` attribute has the value `"description"`.
29
- * Selectors are used with the `querySelector()` Document method,
30
- * in the format `meta[{attrSelector}]`.
31
- *
32
- * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
33
- * @see [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
34
- *
35
- *
36
- * @publicApi
37
- */
38
16
  class Meta {
39
- _doc;
40
- _dom;
41
- constructor(_doc) {
42
- this._doc = _doc;
43
- this._dom = _getDOM();
44
- }
45
- /**
46
- * Retrieves or creates a specific `<meta>` tag element in the current HTML document.
47
- * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
48
- * values in the provided tag definition, and verifies that all other attribute values are equal.
49
- * If an existing element is found, it is returned and is not modified in any way.
50
- * @param tag The definition of a `<meta>` element to match or create.
51
- * @param forceCreation True to create a new element without checking whether one already exists.
52
- * @returns The existing element with the same attributes and values if found,
53
- * the new element if no match is found, or `null` if the tag parameter is not defined.
54
- */
55
- addTag(tag, forceCreation = false) {
56
- if (!tag)
57
- return null;
58
- return this._getOrCreateElement(tag, forceCreation);
59
- }
60
- /**
61
- * Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
62
- * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
63
- * values in the provided tag definition, and verifies that all other attribute values are equal.
64
- * @param tags An array of tag definitions to match or create.
65
- * @param forceCreation True to create new elements without checking whether they already exist.
66
- * @returns The matching elements if found, or the new elements.
67
- */
68
- addTags(tags, forceCreation = false) {
69
- if (!tags)
70
- return [];
71
- return tags.reduce((result, tag) => {
72
- if (tag) {
73
- result.push(this._getOrCreateElement(tag, forceCreation));
74
- }
75
- return result;
76
- }, []);
77
- }
78
- /**
79
- * Retrieves a `<meta>` tag element in the current HTML document.
80
- * @param attrSelector The tag attribute and value to match against, in the format
81
- * `"tag_attribute='value string'"`.
82
- * @returns The matching element, if any.
83
- */
84
- getTag(attrSelector) {
85
- if (!attrSelector)
86
- return null;
87
- return this._doc.querySelector(`meta[${attrSelector}]`) || null;
88
- }
89
- /**
90
- * Retrieves a set of `<meta>` tag elements in the current HTML document.
91
- * @param attrSelector The tag attribute and value to match against, in the format
92
- * `"tag_attribute='value string'"`.
93
- * @returns The matching elements, if any.
94
- */
95
- getTags(attrSelector) {
96
- if (!attrSelector)
97
- return [];
98
- const list /*NodeList*/ = this._doc.querySelectorAll(`meta[${attrSelector}]`);
99
- return list ? [].slice.call(list) : [];
100
- }
101
- /**
102
- * Modifies an existing `<meta>` tag element in the current HTML document.
103
- * @param tag The tag description with which to replace the existing tag content.
104
- * @param selector A tag attribute and value to match against, to identify
105
- * an existing tag. A string in the format `"tag_attribute=`value string`"`.
106
- * If not supplied, matches a tag with the same `name` or `property` attribute value as the
107
- * replacement tag.
108
- * @return The modified element.
109
- */
110
- updateTag(tag, selector) {
111
- if (!tag)
112
- return null;
113
- selector = selector || this._parseSelector(tag);
114
- const meta = this.getTag(selector);
115
- if (meta) {
116
- return this._setMetaElementAttributes(tag, meta);
117
- }
118
- return this._getOrCreateElement(tag, true);
119
- }
120
- /**
121
- * Removes an existing `<meta>` tag element from the current HTML document.
122
- * @param attrSelector A tag attribute and value to match against, to identify
123
- * an existing tag. A string in the format `"tag_attribute=`value string`"`.
124
- */
125
- removeTag(attrSelector) {
126
- this.removeTagElement(this.getTag(attrSelector));
127
- }
128
- /**
129
- * Removes an existing `<meta>` tag element from the current HTML document.
130
- * @param meta The tag definition to match against to identify an existing tag.
131
- */
132
- removeTagElement(meta) {
133
- if (meta) {
134
- this._dom.remove(meta);
135
- }
136
- }
137
- _getOrCreateElement(meta, forceCreation = false) {
138
- if (!forceCreation) {
139
- const selector = this._parseSelector(meta);
140
- // It's allowed to have multiple elements with the same name so it's not enough to
141
- // just check that element with the same name already present on the page. We also need to
142
- // check if element has tag attributes
143
- const elem = this.getTags(selector).filter((elem) => this._containsAttributes(meta, elem))[0];
144
- if (elem !== undefined)
145
- return elem;
146
- }
147
- const element = this._dom.createElement('meta');
148
- this._setMetaElementAttributes(meta, element);
149
- const head = this._doc.getElementsByTagName('head')[0];
150
- head.appendChild(element);
151
- return element;
152
- }
153
- _setMetaElementAttributes(tag, el) {
154
- Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
155
- return el;
156
- }
157
- _parseSelector(tag) {
158
- const attr = tag.name ? 'name' : 'property';
159
- return `${attr}="${tag[attr]}"`;
160
- }
161
- _containsAttributes(tag, elem) {
162
- return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
163
- }
164
- _getMetaKeyMap(prop) {
165
- return META_KEYS_MAP[prop] || prop;
166
- }
167
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Meta, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
168
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Meta, providedIn: 'root' });
17
+ _doc;
18
+ _dom;
19
+ constructor(_doc) {
20
+ this._doc = _doc;
21
+ this._dom = _getDOM();
22
+ }
23
+ addTag(tag, forceCreation = false) {
24
+ if (!tag) return null;
25
+ return this._getOrCreateElement(tag, forceCreation);
26
+ }
27
+ addTags(tags, forceCreation = false) {
28
+ if (!tags) return [];
29
+ return tags.reduce((result, tag) => {
30
+ if (tag) {
31
+ result.push(this._getOrCreateElement(tag, forceCreation));
32
+ }
33
+ return result;
34
+ }, []);
35
+ }
36
+ getTag(attrSelector) {
37
+ if (!attrSelector) return null;
38
+ return this._doc.querySelector(`meta[${attrSelector}]`) || null;
39
+ }
40
+ getTags(attrSelector) {
41
+ if (!attrSelector) return [];
42
+ const list = this._doc.querySelectorAll(`meta[${attrSelector}]`);
43
+ return list ? [].slice.call(list) : [];
44
+ }
45
+ updateTag(tag, selector) {
46
+ if (!tag) return null;
47
+ selector = selector || this._parseSelector(tag);
48
+ const meta = this.getTag(selector);
49
+ if (meta) {
50
+ return this._setMetaElementAttributes(tag, meta);
51
+ }
52
+ return this._getOrCreateElement(tag, true);
53
+ }
54
+ removeTag(attrSelector) {
55
+ this.removeTagElement(this.getTag(attrSelector));
56
+ }
57
+ removeTagElement(meta) {
58
+ if (meta) {
59
+ this._dom.remove(meta);
60
+ }
61
+ }
62
+ _getOrCreateElement(meta, forceCreation = false) {
63
+ if (!forceCreation) {
64
+ const selector = this._parseSelector(meta);
65
+ const elem = this.getTags(selector).filter(elem => this._containsAttributes(meta, elem))[0];
66
+ if (elem !== undefined) return elem;
67
+ }
68
+ const element = this._dom.createElement('meta');
69
+ this._setMetaElementAttributes(meta, element);
70
+ const head = this._doc.getElementsByTagName('head')[0];
71
+ head.appendChild(element);
72
+ return element;
73
+ }
74
+ _setMetaElementAttributes(tag, el) {
75
+ Object.keys(tag).forEach(prop => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
76
+ return el;
77
+ }
78
+ _parseSelector(tag) {
79
+ const attr = tag.name ? 'name' : 'property';
80
+ return `${attr}="${tag[attr]}"`;
81
+ }
82
+ _containsAttributes(tag, elem) {
83
+ return Object.keys(tag).every(key => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
84
+ }
85
+ _getMetaKeyMap(prop) {
86
+ return META_KEYS_MAP[prop] || prop;
87
+ }
88
+ static ɵfac = i0.ɵɵngDeclareFactory({
89
+ minVersion: "12.0.0",
90
+ version: "21.0.0-rc.0",
91
+ ngImport: i0,
92
+ type: Meta,
93
+ deps: [{
94
+ token: DOCUMENT
95
+ }],
96
+ target: i0.ɵɵFactoryTarget.Injectable
97
+ });
98
+ static ɵprov = i0.ɵɵngDeclareInjectable({
99
+ minVersion: "12.0.0",
100
+ version: "21.0.0-rc.0",
101
+ ngImport: i0,
102
+ type: Meta,
103
+ providedIn: 'root'
104
+ });
169
105
  }
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Meta, decorators: [{
171
- type: Injectable,
172
- args: [{ providedIn: 'root' }]
173
- }], ctorParameters: () => [{ type: undefined, decorators: [{
174
- type: Inject,
175
- args: [DOCUMENT]
176
- }] }] });
177
- /**
178
- * Mapping for MetaDefinition properties with their correct meta attribute names
179
- */
106
+ i0.ɵɵngDeclareClassMetadata({
107
+ minVersion: "12.0.0",
108
+ version: "21.0.0-rc.0",
109
+ ngImport: i0,
110
+ type: Meta,
111
+ decorators: [{
112
+ type: Injectable,
113
+ args: [{
114
+ providedIn: 'root'
115
+ }]
116
+ }],
117
+ ctorParameters: () => [{
118
+ type: undefined,
119
+ decorators: [{
120
+ type: Inject,
121
+ args: [DOCUMENT]
122
+ }]
123
+ }]
124
+ });
180
125
  const META_KEYS_MAP = {
181
- httpEquiv: 'http-equiv',
126
+ httpEquiv: 'http-equiv'
182
127
  };
183
128
 
184
- /**
185
- * A service that can be used to get and set the title of a current HTML document.
186
- *
187
- * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
188
- * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
189
- * (representing the `<title>` tag). Instead, this service can be used to set and get the current
190
- * title value.
191
- *
192
- * @publicApi
193
- */
194
129
  class Title {
195
- _doc;
196
- constructor(_doc) {
197
- this._doc = _doc;
198
- }
199
- /**
200
- * Get the title of the current HTML document.
201
- */
202
- getTitle() {
203
- return this._doc.title;
204
- }
205
- /**
206
- * Set the title of the current HTML document.
207
- * @param newTitle
208
- */
209
- setTitle(newTitle) {
210
- this._doc.title = newTitle || '';
211
- }
212
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Title, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
213
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Title, providedIn: 'root' });
130
+ _doc;
131
+ constructor(_doc) {
132
+ this._doc = _doc;
133
+ }
134
+ getTitle() {
135
+ return this._doc.title;
136
+ }
137
+ setTitle(newTitle) {
138
+ this._doc.title = newTitle || '';
139
+ }
140
+ static ɵfac = i0.ɵɵngDeclareFactory({
141
+ minVersion: "12.0.0",
142
+ version: "21.0.0-rc.0",
143
+ ngImport: i0,
144
+ type: Title,
145
+ deps: [{
146
+ token: DOCUMENT
147
+ }],
148
+ target: i0.ɵɵFactoryTarget.Injectable
149
+ });
150
+ static ɵprov = i0.ɵɵngDeclareInjectable({
151
+ minVersion: "12.0.0",
152
+ version: "21.0.0-rc.0",
153
+ ngImport: i0,
154
+ type: Title,
155
+ providedIn: 'root'
156
+ });
214
157
  }
215
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Title, decorators: [{
216
- type: Injectable,
217
- args: [{ providedIn: 'root' }]
218
- }], ctorParameters: () => [{ type: undefined, decorators: [{
219
- type: Inject,
220
- args: [DOCUMENT]
221
- }] }] });
158
+ i0.ɵɵngDeclareClassMetadata({
159
+ minVersion: "12.0.0",
160
+ version: "21.0.0-rc.0",
161
+ ngImport: i0,
162
+ type: Title,
163
+ decorators: [{
164
+ type: Injectable,
165
+ args: [{
166
+ providedIn: 'root'
167
+ }]
168
+ }],
169
+ ctorParameters: () => [{
170
+ type: undefined,
171
+ decorators: [{
172
+ type: Inject,
173
+ args: [DOCUMENT]
174
+ }]
175
+ }]
176
+ });
222
177
 
223
- /// <reference path="../../../goog.d.ts" />
224
- /**
225
- * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
226
- * `name` is `'probe'`.
227
- * @param name Name under which it will be exported. Keep in mind this will be a property of the
228
- * global `ng` object.
229
- * @param value The value to export.
230
- */
231
178
  function exportNgVar(name, value) {
232
- if (typeof COMPILED === 'undefined' || !COMPILED) {
233
- // Note: we can't export `ng` when using closure enhanced optimization as:
234
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
235
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
236
- // for typings for angularJS (via `goog.provide('ng....')`).
237
- const ng = (_global['ng'] = _global['ng'] || {});
238
- ng[name] = value;
239
- }
179
+ if (typeof COMPILED === 'undefined' || !COMPILED) {
180
+ const ng = _global['ng'] = _global['ng'] || {};
181
+ ng[name] = value;
182
+ }
240
183
  }
241
184
 
242
185
  class ChangeDetectionPerfRecord {
243
- msPerTick;
244
- numTicks;
245
- constructor(msPerTick, numTicks) {
246
- this.msPerTick = msPerTick;
247
- this.numTicks = numTicks;
248
- }
186
+ msPerTick;
187
+ numTicks;
188
+ constructor(msPerTick, numTicks) {
189
+ this.msPerTick = msPerTick;
190
+ this.numTicks = numTicks;
191
+ }
249
192
  }
250
- /**
251
- * Entry point for all Angular profiling-related debug tools. This object
252
- * corresponds to the `ng.profiler` in the dev console.
253
- */
254
193
  class AngularProfiler {
255
- appRef;
256
- constructor(ref) {
257
- this.appRef = ref.injector.get(ApplicationRef);
258
- }
259
- // tslint:disable:no-console
260
- /**
261
- * Exercises change detection in a loop and then prints the average amount of
262
- * time in milliseconds how long a single round of change detection takes for
263
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
264
- * of 500 milliseconds.
265
- *
266
- * Optionally, a user may pass a `config` parameter containing a map of
267
- * options. Supported options are:
268
- *
269
- * `record` (boolean) - causes the profiler to record a CPU profile while
270
- * it exercises the change detector. Example:
271
- *
272
- * ```ts
273
- * ng.profiler.timeChangeDetection({record: true})
274
- * ```
275
- */
276
- timeChangeDetection(config) {
277
- const record = config && config['record'];
278
- const profileName = 'Change Detection';
279
- // Profiler is not available in Android browsers without dev tools opened
280
- if (record && 'profile' in console && typeof console.profile === 'function') {
281
- console.profile(profileName);
282
- }
283
- const start = performance.now();
284
- let numTicks = 0;
285
- while (numTicks < 5 || performance.now() - start < 500) {
286
- this.appRef.tick();
287
- numTicks++;
288
- }
289
- const end = performance.now();
290
- if (record && 'profileEnd' in console && typeof console.profileEnd === 'function') {
291
- console.profileEnd(profileName);
292
- }
293
- const msPerTick = (end - start) / numTicks;
294
- console.log(`ran ${numTicks} change detection cycles`);
295
- console.log(`${msPerTick.toFixed(2)} ms per check`);
296
- return new ChangeDetectionPerfRecord(msPerTick, numTicks);
297
- }
194
+ appRef;
195
+ constructor(ref) {
196
+ this.appRef = ref.injector.get(ApplicationRef);
197
+ }
198
+ timeChangeDetection(config) {
199
+ const record = config && config['record'];
200
+ const profileName = 'Change Detection';
201
+ if (record && 'profile' in console && typeof console.profile === 'function') {
202
+ console.profile(profileName);
203
+ }
204
+ const start = performance.now();
205
+ let numTicks = 0;
206
+ while (numTicks < 5 || performance.now() - start < 500) {
207
+ this.appRef.tick();
208
+ numTicks++;
209
+ }
210
+ const end = performance.now();
211
+ if (record && 'profileEnd' in console && typeof console.profileEnd === 'function') {
212
+ console.profileEnd(profileName);
213
+ }
214
+ const msPerTick = (end - start) / numTicks;
215
+ console.log(`ran ${numTicks} change detection cycles`);
216
+ console.log(`${msPerTick.toFixed(2)} ms per check`);
217
+ return new ChangeDetectionPerfRecord(msPerTick, numTicks);
218
+ }
298
219
  }
299
220
 
300
221
  const PROFILER_GLOBAL_NAME = 'profiler';
301
- /**
302
- * Enabled Angular debug tools that are accessible via your browser's
303
- * developer console.
304
- *
305
- * Usage:
306
- *
307
- * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
308
- * 1. Type `ng.` (usually the console will show auto-complete suggestion)
309
- * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
310
- * then hit Enter.
311
- *
312
- * @publicApi
313
- */
314
222
  function enableDebugTools(ref) {
315
- exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
316
- return ref;
223
+ exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
224
+ return ref;
317
225
  }
318
- /**
319
- * Disables Angular tools.
320
- *
321
- * @publicApi
322
- */
323
226
  function disableDebugTools() {
324
- exportNgVar(PROFILER_GLOBAL_NAME, null);
227
+ exportNgVar(PROFILER_GLOBAL_NAME, null);
325
228
  }
326
229
 
327
- /**
328
- * Predicates for use with {@link DebugElement}'s query functions.
329
- *
330
- * @publicApi
331
- */
332
230
  class By {
333
- /**
334
- * Match all nodes.
335
- *
336
- * @usageNotes
337
- * ### Example
338
- *
339
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
340
- */
341
- static all() {
342
- return () => true;
343
- }
344
- /**
345
- * Match elements by the given CSS selector.
346
- *
347
- * @usageNotes
348
- * ### Example
349
- *
350
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
351
- */
352
- static css(selector) {
353
- return (debugElement) => {
354
- return debugElement.nativeElement != null
355
- ? elementMatches(debugElement.nativeElement, selector)
356
- : false;
357
- };
358
- }
359
- /**
360
- * Match nodes that have the given directive present.
361
- *
362
- * @usageNotes
363
- * ### Example
364
- *
365
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
366
- */
367
- static directive(type) {
368
- return (debugNode) => debugNode.providerTokens.indexOf(type) !== -1;
369
- }
231
+ static all() {
232
+ return () => true;
233
+ }
234
+ static css(selector) {
235
+ return debugElement => {
236
+ return debugElement.nativeElement != null ? elementMatches(debugElement.nativeElement, selector) : false;
237
+ };
238
+ }
239
+ static directive(type) {
240
+ return debugNode => debugNode.providerTokens.indexOf(type) !== -1;
241
+ }
370
242
  }
371
243
  function elementMatches(n, selector) {
372
- if (_getDOM().isElementNode(n)) {
373
- return ((n.matches && n.matches(selector)) ||
374
- (n.msMatchesSelector && n.msMatchesSelector(selector)) ||
375
- (n.webkitMatchesSelector && n.webkitMatchesSelector(selector)));
376
- }
377
- return false;
244
+ if (_getDOM().isElementNode(n)) {
245
+ return n.matches && n.matches(selector) || n.msMatchesSelector && n.msMatchesSelector(selector) || n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
246
+ }
247
+ return false;
378
248
  }
379
249
 
380
- /// <reference types="hammerjs" />
381
- /**
382
- * Supported HammerJS recognizer event names.
383
- */
384
250
  const EVENT_NAMES = {
385
- // pan
386
- 'pan': true,
387
- 'panstart': true,
388
- 'panmove': true,
389
- 'panend': true,
390
- 'pancancel': true,
391
- 'panleft': true,
392
- 'panright': true,
393
- 'panup': true,
394
- 'pandown': true,
395
- // pinch
396
- 'pinch': true,
397
- 'pinchstart': true,
398
- 'pinchmove': true,
399
- 'pinchend': true,
400
- 'pinchcancel': true,
401
- 'pinchin': true,
402
- 'pinchout': true,
403
- // press
404
- 'press': true,
405
- 'pressup': true,
406
- // rotate
407
- 'rotate': true,
408
- 'rotatestart': true,
409
- 'rotatemove': true,
410
- 'rotateend': true,
411
- 'rotatecancel': true,
412
- // swipe
413
- 'swipe': true,
414
- 'swipeleft': true,
415
- 'swiperight': true,
416
- 'swipeup': true,
417
- 'swipedown': true,
418
- // tap
419
- 'tap': true,
420
- 'doubletap': true,
251
+ 'pan': true,
252
+ 'panstart': true,
253
+ 'panmove': true,
254
+ 'panend': true,
255
+ 'pancancel': true,
256
+ 'panleft': true,
257
+ 'panright': true,
258
+ 'panup': true,
259
+ 'pandown': true,
260
+ 'pinch': true,
261
+ 'pinchstart': true,
262
+ 'pinchmove': true,
263
+ 'pinchend': true,
264
+ 'pinchcancel': true,
265
+ 'pinchin': true,
266
+ 'pinchout': true,
267
+ 'press': true,
268
+ 'pressup': true,
269
+ 'rotate': true,
270
+ 'rotatestart': true,
271
+ 'rotatemove': true,
272
+ 'rotateend': true,
273
+ 'rotatecancel': true,
274
+ 'swipe': true,
275
+ 'swipeleft': true,
276
+ 'swiperight': true,
277
+ 'swipeup': true,
278
+ 'swipedown': true,
279
+ 'tap': true,
280
+ 'doubletap': true
421
281
  };
422
- /**
423
- * DI token for providing [HammerJS](https://hammerjs.github.io/) support to Angular.
424
- * @see {@link HammerGestureConfig}
425
- *
426
- * @ngModule HammerModule
427
- * @publicApi
428
- *
429
- * @deprecated The HammerJS integration is deprecated. Replace it by your own implementation.
430
- */
431
282
  const HAMMER_GESTURE_CONFIG = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'HammerGestureConfig' : '');
432
- /**
433
- * Injection token used to provide a HammerLoader to Angular.
434
- *
435
- * @see {@link HammerLoader}
436
- *
437
- * @publicApi
438
- *
439
- * @deprecated The HammerJS integration is deprecated. Replace it by your own implementation.
440
- */
441
283
  const HAMMER_LOADER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'HammerLoader' : '');
442
- /**
443
- * An injectable [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
444
- * for gesture recognition. Configures specific event recognition.
445
- * @publicApi
446
- *
447
- * @deprecated The HammerJS integration is deprecated. Replace it by your own implementation.
448
- */
449
284
  class HammerGestureConfig {
450
- /**
451
- * A set of supported event names for gestures to be used in Angular.
452
- * Angular supports all built-in recognizers, as listed in
453
- * [HammerJS documentation](https://hammerjs.github.io/).
454
- */
455
- events = [];
456
- /**
457
- * Maps gesture event names to a set of configuration options
458
- * that specify overrides to the default values for specific properties.
459
- *
460
- * The key is a supported event name to be configured,
461
- * and the options object contains a set of properties, with override values
462
- * to be applied to the named recognizer event.
463
- * For example, to disable recognition of the rotate event, specify
464
- * `{"rotate": {"enable": false}}`.
465
- *
466
- * Properties that are not present take the HammerJS default values.
467
- * For information about which properties are supported for which events,
468
- * and their allowed and default values, see
469
- * [HammerJS documentation](https://hammerjs.github.io/).
470
- *
471
- */
472
- overrides = {};
473
- /**
474
- * Properties whose default values can be overridden for a given event.
475
- * Different sets of properties apply to different events.
476
- * For information about which properties are supported for which events,
477
- * and their allowed and default values, see
478
- * [HammerJS documentation](https://hammerjs.github.io/).
479
- */
480
- options;
481
- /**
482
- * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
483
- * and attaches it to a given HTML element.
484
- * @param element The element that will recognize gestures.
485
- * @returns A HammerJS event-manager object.
486
- */
487
- buildHammer(element) {
488
- const mc = new Hammer(element, this.options);
489
- mc.get('pinch').set({ enable: true });
490
- mc.get('rotate').set({ enable: true });
491
- for (const eventName in this.overrides) {
492
- mc.get(eventName).set(this.overrides[eventName]);
493
- }
494
- return mc;
495
- }
496
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerGestureConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
497
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerGestureConfig });
285
+ events = [];
286
+ overrides = {};
287
+ options;
288
+ buildHammer(element) {
289
+ const mc = new Hammer(element, this.options);
290
+ mc.get('pinch').set({
291
+ enable: true
292
+ });
293
+ mc.get('rotate').set({
294
+ enable: true
295
+ });
296
+ for (const eventName in this.overrides) {
297
+ mc.get(eventName).set(this.overrides[eventName]);
298
+ }
299
+ return mc;
300
+ }
301
+ static ɵfac = i0.ɵɵngDeclareFactory({
302
+ minVersion: "12.0.0",
303
+ version: "21.0.0-rc.0",
304
+ ngImport: i0,
305
+ type: HammerGestureConfig,
306
+ deps: [],
307
+ target: i0.ɵɵFactoryTarget.Injectable
308
+ });
309
+ static ɵprov = i0.ɵɵngDeclareInjectable({
310
+ minVersion: "12.0.0",
311
+ version: "21.0.0-rc.0",
312
+ ngImport: i0,
313
+ type: HammerGestureConfig
314
+ });
498
315
  }
499
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerGestureConfig, decorators: [{
500
- type: Injectable
501
- }] });
502
- /**
503
- * Event plugin that adds Hammer support to an application.
504
- *
505
- * @ngModule HammerModule
506
- */
316
+ i0.ɵɵngDeclareClassMetadata({
317
+ minVersion: "12.0.0",
318
+ version: "21.0.0-rc.0",
319
+ ngImport: i0,
320
+ type: HammerGestureConfig,
321
+ decorators: [{
322
+ type: Injectable
323
+ }]
324
+ });
507
325
  class HammerGesturesPlugin extends EventManagerPlugin {
508
- _config;
509
- _injector;
510
- loader;
511
- _loaderPromise = null;
512
- constructor(doc, _config, _injector, loader) {
513
- super(doc);
514
- this._config = _config;
515
- this._injector = _injector;
516
- this.loader = loader;
517
- }
518
- supports(eventName) {
519
- if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
520
- return false;
326
+ _config;
327
+ _injector;
328
+ loader;
329
+ _loaderPromise = null;
330
+ constructor(doc, _config, _injector, loader) {
331
+ super(doc);
332
+ this._config = _config;
333
+ this._injector = _injector;
334
+ this.loader = loader;
335
+ }
336
+ supports(eventName) {
337
+ if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
338
+ return false;
339
+ }
340
+ if (!window.Hammer && !this.loader) {
341
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
342
+ const _console = this._injector.get(_Console);
343
+ _console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not ` + `loaded and no custom loader has been specified.`);
344
+ }
345
+ return false;
346
+ }
347
+ return true;
348
+ }
349
+ addEventListener(element, eventName, handler) {
350
+ const zone = this.manager.getZone();
351
+ eventName = eventName.toLowerCase();
352
+ if (!window.Hammer && this.loader) {
353
+ this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader());
354
+ let cancelRegistration = false;
355
+ let deregister = () => {
356
+ cancelRegistration = true;
357
+ };
358
+ zone.runOutsideAngular(() => this._loaderPromise.then(() => {
359
+ if (!window.Hammer) {
360
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
361
+ const _console = this._injector.get(_Console);
362
+ _console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
363
+ }
364
+ deregister = () => {};
365
+ return;
521
366
  }
522
- if (!window.Hammer && !this.loader) {
523
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
524
- // Get a `Console` through an injector to tree-shake the
525
- // class when it is unused in production.
526
- const _console = this._injector.get(_Console);
527
- _console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not ` +
528
- `loaded and no custom loader has been specified.`);
529
- }
530
- return false;
367
+ if (!cancelRegistration) {
368
+ deregister = this.addEventListener(element, eventName, handler);
531
369
  }
532
- return true;
533
- }
534
- addEventListener(element, eventName, handler) {
535
- const zone = this.manager.getZone();
536
- eventName = eventName.toLowerCase();
537
- // If Hammer is not present but a loader is specified, we defer adding the event listener
538
- // until Hammer is loaded.
539
- if (!window.Hammer && this.loader) {
540
- this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader());
541
- // This `addEventListener` method returns a function to remove the added listener.
542
- // Until Hammer is loaded, the returned function needs to *cancel* the registration rather
543
- // than remove anything.
544
- let cancelRegistration = false;
545
- let deregister = () => {
546
- cancelRegistration = true;
547
- };
548
- zone.runOutsideAngular(() => this._loaderPromise.then(() => {
549
- // If Hammer isn't actually loaded when the custom loader resolves, give up.
550
- if (!window.Hammer) {
551
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
552
- const _console = this._injector.get(_Console);
553
- _console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
554
- }
555
- deregister = () => { };
556
- return;
557
- }
558
- if (!cancelRegistration) {
559
- // Now that Hammer is loaded and the listener is being loaded for real,
560
- // the deregistration function changes from canceling registration to
561
- // removal.
562
- deregister = this.addEventListener(element, eventName, handler);
563
- }
564
- }).catch(() => {
565
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
566
- const _console = this._injector.get(_Console);
567
- _console.warn(`The "${eventName}" event cannot be bound because the custom ` +
568
- `Hammer.JS loader failed.`);
569
- }
570
- deregister = () => { };
571
- }));
572
- // Return a function that *executes* `deregister` (and not `deregister` itself) so that we
573
- // can change the behavior of `deregister` once the listener is added. Using a closure in
574
- // this way allows us to avoid any additional data structures to track listener removal.
575
- return () => {
576
- deregister();
577
- };
370
+ }).catch(() => {
371
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
372
+ const _console = this._injector.get(_Console);
373
+ _console.warn(`The "${eventName}" event cannot be bound because the custom ` + `Hammer.JS loader failed.`);
578
374
  }
579
- return zone.runOutsideAngular(() => {
580
- // Creating the manager bind events, must be done outside of angular
581
- const mc = this._config.buildHammer(element);
582
- const callback = function (eventObj) {
583
- zone.runGuarded(function () {
584
- handler(eventObj);
585
- });
586
- };
587
- mc.on(eventName, callback);
588
- return () => {
589
- mc.off(eventName, callback);
590
- // destroy mc to prevent memory leak
591
- if (typeof mc.destroy === 'function') {
592
- mc.destroy();
593
- }
594
- };
375
+ deregister = () => {};
376
+ }));
377
+ return () => {
378
+ deregister();
379
+ };
380
+ }
381
+ return zone.runOutsideAngular(() => {
382
+ const mc = this._config.buildHammer(element);
383
+ const callback = function (eventObj) {
384
+ zone.runGuarded(function () {
385
+ handler(eventObj);
595
386
  });
596
- }
597
- isCustomEvent(eventName) {
598
- return this._config.events.indexOf(eventName) > -1;
599
- }
600
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerGesturesPlugin, deps: [{ token: DOCUMENT }, { token: HAMMER_GESTURE_CONFIG }, { token: i0.Injector }, { token: HAMMER_LOADER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
601
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerGesturesPlugin });
387
+ };
388
+ mc.on(eventName, callback);
389
+ return () => {
390
+ mc.off(eventName, callback);
391
+ if (typeof mc.destroy === 'function') {
392
+ mc.destroy();
393
+ }
394
+ };
395
+ });
396
+ }
397
+ isCustomEvent(eventName) {
398
+ return this._config.events.indexOf(eventName) > -1;
399
+ }
400
+ static ɵfac = i0.ɵɵngDeclareFactory({
401
+ minVersion: "12.0.0",
402
+ version: "21.0.0-rc.0",
403
+ ngImport: i0,
404
+ type: HammerGesturesPlugin,
405
+ deps: [{
406
+ token: DOCUMENT
407
+ }, {
408
+ token: HAMMER_GESTURE_CONFIG
409
+ }, {
410
+ token: i0.Injector
411
+ }, {
412
+ token: HAMMER_LOADER,
413
+ optional: true
414
+ }],
415
+ target: i0.ɵɵFactoryTarget.Injectable
416
+ });
417
+ static ɵprov = i0.ɵɵngDeclareInjectable({
418
+ minVersion: "12.0.0",
419
+ version: "21.0.0-rc.0",
420
+ ngImport: i0,
421
+ type: HammerGesturesPlugin
422
+ });
602
423
  }
603
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerGesturesPlugin, decorators: [{
604
- type: Injectable
605
- }], ctorParameters: () => [{ type: undefined, decorators: [{
606
- type: Inject,
607
- args: [DOCUMENT]
608
- }] }, { type: HammerGestureConfig, decorators: [{
609
- type: Inject,
610
- args: [HAMMER_GESTURE_CONFIG]
611
- }] }, { type: i0.Injector }, { type: undefined, decorators: [{
612
- type: Optional
613
- }, {
614
- type: Inject,
615
- args: [HAMMER_LOADER]
616
- }] }] });
617
- /**
618
- * Adds support for HammerJS.
619
- *
620
- * Import this module at the root of your application so that Angular can work with
621
- * HammerJS to detect gesture events.
622
- *
623
- * Note that applications still need to include the HammerJS script itself. This module
624
- * simply sets up the coordination layer between HammerJS and Angular's `EventManager`.
625
- *
626
- * @publicApi
627
- *
628
- * @deprecated The hammer integration is deprecated. Replace it by your own implementation.
629
- */
424
+ i0.ɵɵngDeclareClassMetadata({
425
+ minVersion: "12.0.0",
426
+ version: "21.0.0-rc.0",
427
+ ngImport: i0,
428
+ type: HammerGesturesPlugin,
429
+ decorators: [{
430
+ type: Injectable
431
+ }],
432
+ ctorParameters: () => [{
433
+ type: undefined,
434
+ decorators: [{
435
+ type: Inject,
436
+ args: [DOCUMENT]
437
+ }]
438
+ }, {
439
+ type: HammerGestureConfig,
440
+ decorators: [{
441
+ type: Inject,
442
+ args: [HAMMER_GESTURE_CONFIG]
443
+ }]
444
+ }, {
445
+ type: i0.Injector
446
+ }, {
447
+ type: undefined,
448
+ decorators: [{
449
+ type: Optional
450
+ }, {
451
+ type: Inject,
452
+ args: [HAMMER_LOADER]
453
+ }]
454
+ }]
455
+ });
630
456
  class HammerModule {
631
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
632
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerModule });
633
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerModule, providers: [
634
- {
635
- provide: EVENT_MANAGER_PLUGINS,
636
- useClass: HammerGesturesPlugin,
637
- multi: true,
638
- deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]],
639
- },
640
- { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
641
- ] });
457
+ static ɵfac = i0.ɵɵngDeclareFactory({
458
+ minVersion: "12.0.0",
459
+ version: "21.0.0-rc.0",
460
+ ngImport: i0,
461
+ type: HammerModule,
462
+ deps: [],
463
+ target: i0.ɵɵFactoryTarget.NgModule
464
+ });
465
+ static ɵmod = i0.ɵɵngDeclareNgModule({
466
+ minVersion: "14.0.0",
467
+ version: "21.0.0-rc.0",
468
+ ngImport: i0,
469
+ type: HammerModule
470
+ });
471
+ static ɵinj = i0.ɵɵngDeclareInjector({
472
+ minVersion: "12.0.0",
473
+ version: "21.0.0-rc.0",
474
+ ngImport: i0,
475
+ type: HammerModule,
476
+ providers: [{
477
+ provide: EVENT_MANAGER_PLUGINS,
478
+ useClass: HammerGesturesPlugin,
479
+ multi: true,
480
+ deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
481
+ }, {
482
+ provide: HAMMER_GESTURE_CONFIG,
483
+ useClass: HammerGestureConfig
484
+ }]
485
+ });
642
486
  }
643
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: HammerModule, decorators: [{
644
- type: NgModule,
645
- args: [{
646
- providers: [
647
- {
648
- provide: EVENT_MANAGER_PLUGINS,
649
- useClass: HammerGesturesPlugin,
650
- multi: true,
651
- deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]],
652
- },
653
- { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
654
- ],
655
- }]
656
- }] });
487
+ i0.ɵɵngDeclareClassMetadata({
488
+ minVersion: "12.0.0",
489
+ version: "21.0.0-rc.0",
490
+ ngImport: i0,
491
+ type: HammerModule,
492
+ decorators: [{
493
+ type: NgModule,
494
+ args: [{
495
+ providers: [{
496
+ provide: EVENT_MANAGER_PLUGINS,
497
+ useClass: HammerGesturesPlugin,
498
+ multi: true,
499
+ deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
500
+ }, {
501
+ provide: HAMMER_GESTURE_CONFIG,
502
+ useClass: HammerGestureConfig
503
+ }]
504
+ }]
505
+ }]
506
+ });
657
507
 
658
- /**
659
- * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
660
- * values to be safe to use in the different DOM contexts.
661
- *
662
- * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
663
- * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
664
- * the website.
665
- *
666
- * In specific situations, it might be necessary to disable sanitization, for example if the
667
- * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
668
- * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
669
- * methods, and then binding to that value from the template.
670
- *
671
- * These situations should be very rare, and extraordinary care must be taken to avoid creating a
672
- * Cross Site Scripting (XSS) security bug!
673
- *
674
- * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
675
- * close as possible to the source of the value, to make it easy to verify no security bug is
676
- * created by its use.
677
- *
678
- * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
679
- * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
680
- * code. The sanitizer leaves safe values intact.
681
- *
682
- * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
683
- * sanitization for the value passed in. Carefully check and audit all values and code paths going
684
- * into this call. Make sure any user data is appropriately escaped for this security context.
685
- * For more detail, see the [Security Guide](https://g.co/ng/security).
686
- *
687
- * @publicApi
688
- */
689
508
  class DomSanitizer {
690
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomSanitizer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
691
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomSanitizer, providedIn: 'root', useExisting: i0.forwardRef(() => DomSanitizerImpl) });
509
+ static ɵfac = i0.ɵɵngDeclareFactory({
510
+ minVersion: "12.0.0",
511
+ version: "21.0.0-rc.0",
512
+ ngImport: i0,
513
+ type: DomSanitizer,
514
+ deps: [],
515
+ target: i0.ɵɵFactoryTarget.Injectable
516
+ });
517
+ static ɵprov = i0.ɵɵngDeclareInjectable({
518
+ minVersion: "12.0.0",
519
+ version: "21.0.0-rc.0",
520
+ ngImport: i0,
521
+ type: DomSanitizer,
522
+ providedIn: 'root',
523
+ useExisting: i0.forwardRef(() => DomSanitizerImpl)
524
+ });
692
525
  }
693
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomSanitizer, decorators: [{
694
- type: Injectable,
695
- args: [{ providedIn: 'root', useExisting: forwardRef(() => DomSanitizerImpl) }]
696
- }] });
526
+ i0.ɵɵngDeclareClassMetadata({
527
+ minVersion: "12.0.0",
528
+ version: "21.0.0-rc.0",
529
+ ngImport: i0,
530
+ type: DomSanitizer,
531
+ decorators: [{
532
+ type: Injectable,
533
+ args: [{
534
+ providedIn: 'root',
535
+ useExisting: forwardRef(() => DomSanitizerImpl)
536
+ }]
537
+ }]
538
+ });
697
539
  class DomSanitizerImpl extends DomSanitizer {
698
- _doc;
699
- constructor(_doc) {
700
- super();
701
- this._doc = _doc;
702
- }
703
- sanitize(ctx, value) {
704
- if (value == null)
705
- return null;
706
- switch (ctx) {
707
- case SecurityContext.NONE:
708
- return value;
709
- case SecurityContext.HTML:
710
- if (_allowSanitizationBypassAndThrow(value, "HTML" /* BypassType.Html */)) {
711
- return _unwrapSafeValue(value);
712
- }
713
- return __sanitizeHtml(this._doc, String(value)).toString();
714
- case SecurityContext.STYLE:
715
- if (_allowSanitizationBypassAndThrow(value, "Style" /* BypassType.Style */)) {
716
- return _unwrapSafeValue(value);
717
- }
718
- return value;
719
- case SecurityContext.SCRIPT:
720
- if (_allowSanitizationBypassAndThrow(value, "Script" /* BypassType.Script */)) {
721
- return _unwrapSafeValue(value);
722
- }
723
- throw new _RuntimeError(5200 /* RuntimeErrorCode.SANITIZATION_UNSAFE_SCRIPT */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
724
- 'unsafe value used in a script context');
725
- case SecurityContext.URL:
726
- if (_allowSanitizationBypassAndThrow(value, "URL" /* BypassType.Url */)) {
727
- return _unwrapSafeValue(value);
728
- }
729
- return __sanitizeUrl(String(value));
730
- case SecurityContext.RESOURCE_URL:
731
- if (_allowSanitizationBypassAndThrow(value, "ResourceURL" /* BypassType.ResourceUrl */)) {
732
- return _unwrapSafeValue(value);
733
- }
734
- throw new _RuntimeError(5201 /* RuntimeErrorCode.SANITIZATION_UNSAFE_RESOURCE_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
735
- `unsafe value used in a resource URL context (see ${_XSS_SECURITY_URL})`);
736
- default:
737
- throw new _RuntimeError(5202 /* RuntimeErrorCode.SANITIZATION_UNEXPECTED_CTX */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
738
- `Unexpected SecurityContext ${ctx} (see ${_XSS_SECURITY_URL})`);
540
+ _doc;
541
+ constructor(_doc) {
542
+ super();
543
+ this._doc = _doc;
544
+ }
545
+ sanitize(ctx, value) {
546
+ if (value == null) return null;
547
+ switch (ctx) {
548
+ case SecurityContext.NONE:
549
+ return value;
550
+ case SecurityContext.HTML:
551
+ if (_allowSanitizationBypassAndThrow(value, "HTML")) {
552
+ return _unwrapSafeValue(value);
739
553
  }
740
- }
741
- bypassSecurityTrustHtml(value) {
742
- return _bypassSanitizationTrustHtml(value);
743
- }
744
- bypassSecurityTrustStyle(value) {
745
- return _bypassSanitizationTrustStyle(value);
746
- }
747
- bypassSecurityTrustScript(value) {
748
- return _bypassSanitizationTrustScript(value);
749
- }
750
- bypassSecurityTrustUrl(value) {
751
- return _bypassSanitizationTrustUrl(value);
752
- }
753
- bypassSecurityTrustResourceUrl(value) {
754
- return _bypassSanitizationTrustResourceUrl(value);
755
- }
756
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomSanitizerImpl, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
757
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomSanitizerImpl, providedIn: 'root' });
554
+ return __sanitizeHtml(this._doc, String(value)).toString();
555
+ case SecurityContext.STYLE:
556
+ if (_allowSanitizationBypassAndThrow(value, "Style")) {
557
+ return _unwrapSafeValue(value);
558
+ }
559
+ return value;
560
+ case SecurityContext.SCRIPT:
561
+ if (_allowSanitizationBypassAndThrow(value, "Script")) {
562
+ return _unwrapSafeValue(value);
563
+ }
564
+ throw new _RuntimeError(5200, (typeof ngDevMode === 'undefined' || ngDevMode) && 'unsafe value used in a script context');
565
+ case SecurityContext.URL:
566
+ if (_allowSanitizationBypassAndThrow(value, "URL")) {
567
+ return _unwrapSafeValue(value);
568
+ }
569
+ return __sanitizeUrl(String(value));
570
+ case SecurityContext.RESOURCE_URL:
571
+ if (_allowSanitizationBypassAndThrow(value, "ResourceURL")) {
572
+ return _unwrapSafeValue(value);
573
+ }
574
+ throw new _RuntimeError(5201, (typeof ngDevMode === 'undefined' || ngDevMode) && `unsafe value used in a resource URL context (see ${_XSS_SECURITY_URL})`);
575
+ default:
576
+ throw new _RuntimeError(5202, (typeof ngDevMode === 'undefined' || ngDevMode) && `Unexpected SecurityContext ${ctx} (see ${_XSS_SECURITY_URL})`);
577
+ }
578
+ }
579
+ bypassSecurityTrustHtml(value) {
580
+ return _bypassSanitizationTrustHtml(value);
581
+ }
582
+ bypassSecurityTrustStyle(value) {
583
+ return _bypassSanitizationTrustStyle(value);
584
+ }
585
+ bypassSecurityTrustScript(value) {
586
+ return _bypassSanitizationTrustScript(value);
587
+ }
588
+ bypassSecurityTrustUrl(value) {
589
+ return _bypassSanitizationTrustUrl(value);
590
+ }
591
+ bypassSecurityTrustResourceUrl(value) {
592
+ return _bypassSanitizationTrustResourceUrl(value);
593
+ }
594
+ static ɵfac = i0.ɵɵngDeclareFactory({
595
+ minVersion: "12.0.0",
596
+ version: "21.0.0-rc.0",
597
+ ngImport: i0,
598
+ type: DomSanitizerImpl,
599
+ deps: [{
600
+ token: DOCUMENT
601
+ }],
602
+ target: i0.ɵɵFactoryTarget.Injectable
603
+ });
604
+ static ɵprov = i0.ɵɵngDeclareInjectable({
605
+ minVersion: "12.0.0",
606
+ version: "21.0.0-rc.0",
607
+ ngImport: i0,
608
+ type: DomSanitizerImpl,
609
+ providedIn: 'root'
610
+ });
758
611
  }
759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: DomSanitizerImpl, decorators: [{
760
- type: Injectable,
761
- args: [{ providedIn: 'root' }]
762
- }], ctorParameters: () => [{ type: undefined, decorators: [{
763
- type: Inject,
764
- args: [DOCUMENT]
765
- }] }] });
612
+ i0.ɵɵngDeclareClassMetadata({
613
+ minVersion: "12.0.0",
614
+ version: "21.0.0-rc.0",
615
+ ngImport: i0,
616
+ type: DomSanitizerImpl,
617
+ decorators: [{
618
+ type: Injectable,
619
+ args: [{
620
+ providedIn: 'root'
621
+ }]
622
+ }],
623
+ ctorParameters: () => [{
624
+ type: undefined,
625
+ decorators: [{
626
+ type: Inject,
627
+ args: [DOCUMENT]
628
+ }]
629
+ }]
630
+ });
766
631
 
767
- /**
768
- * The list of features as an enum to uniquely type each `HydrationFeature`.
769
- * @see {@link HydrationFeature}
770
- *
771
- * @publicApi
772
- */
773
632
  var HydrationFeatureKind;
774
633
  (function (HydrationFeatureKind) {
775
- HydrationFeatureKind[HydrationFeatureKind["NoHttpTransferCache"] = 0] = "NoHttpTransferCache";
776
- HydrationFeatureKind[HydrationFeatureKind["HttpTransferCacheOptions"] = 1] = "HttpTransferCacheOptions";
777
- HydrationFeatureKind[HydrationFeatureKind["I18nSupport"] = 2] = "I18nSupport";
778
- HydrationFeatureKind[HydrationFeatureKind["EventReplay"] = 3] = "EventReplay";
779
- HydrationFeatureKind[HydrationFeatureKind["IncrementalHydration"] = 4] = "IncrementalHydration";
634
+ HydrationFeatureKind[HydrationFeatureKind["NoHttpTransferCache"] = 0] = "NoHttpTransferCache";
635
+ HydrationFeatureKind[HydrationFeatureKind["HttpTransferCacheOptions"] = 1] = "HttpTransferCacheOptions";
636
+ HydrationFeatureKind[HydrationFeatureKind["I18nSupport"] = 2] = "I18nSupport";
637
+ HydrationFeatureKind[HydrationFeatureKind["EventReplay"] = 3] = "EventReplay";
638
+ HydrationFeatureKind[HydrationFeatureKind["IncrementalHydration"] = 4] = "IncrementalHydration";
780
639
  })(HydrationFeatureKind || (HydrationFeatureKind = {}));
781
- /**
782
- * Helper function to create an object that represents a Hydration feature.
783
- */
784
640
  function hydrationFeature(ɵkind, ɵproviders = [], ɵoptions = {}) {
785
- return { ɵkind, ɵproviders };
641
+ return {
642
+ ɵkind,
643
+ ɵproviders
644
+ };
786
645
  }
787
- /**
788
- * Disables HTTP transfer cache. Effectively causes HTTP requests to be performed twice: once on the
789
- * server and other one on the browser.
790
- *
791
- * @publicApi
792
- */
793
646
  function withNoHttpTransferCache() {
794
- // This feature has no providers and acts as a flag that turns off
795
- // HTTP transfer cache (which otherwise is turned on by default).
796
- return hydrationFeature(HydrationFeatureKind.NoHttpTransferCache);
647
+ return hydrationFeature(HydrationFeatureKind.NoHttpTransferCache);
797
648
  }
798
- /**
799
- * The function accepts an object, which allows to configure cache parameters,
800
- * such as which headers should be included (no headers are included by default),
801
- * whether POST requests should be cached or a callback function to determine if a
802
- * particular request should be cached.
803
- *
804
- * @publicApi
805
- */
806
649
  function withHttpTransferCacheOptions(options) {
807
- // This feature has no providers and acts as a flag to pass options to the HTTP transfer cache.
808
- return hydrationFeature(HydrationFeatureKind.HttpTransferCacheOptions, _withHttpTransferCache(options));
650
+ return hydrationFeature(HydrationFeatureKind.HttpTransferCacheOptions, _withHttpTransferCache(options));
809
651
  }
810
- /**
811
- * Enables support for hydrating i18n blocks.
812
- *
813
- * @publicApi 20.0
814
- */
815
652
  function withI18nSupport() {
816
- return hydrationFeature(HydrationFeatureKind.I18nSupport, _withI18nSupport());
653
+ return hydrationFeature(HydrationFeatureKind.I18nSupport, _withI18nSupport());
817
654
  }
818
- /**
819
- * Enables support for replaying user events (e.g. `click`s) that happened on a page
820
- * before hydration logic has completed. Once an application is hydrated, all captured
821
- * events are replayed and relevant event listeners are executed.
822
- *
823
- * @usageNotes
824
- *
825
- * Basic example of how you can enable event replay in your application when
826
- * `bootstrapApplication` function is used:
827
- * ```ts
828
- * bootstrapApplication(AppComponent, {
829
- * providers: [provideClientHydration(withEventReplay())]
830
- * });
831
- * ```
832
- * @publicApi
833
- * @see {@link provideClientHydration}
834
- */
835
655
  function withEventReplay() {
836
- return hydrationFeature(HydrationFeatureKind.EventReplay, _withEventReplay());
656
+ return hydrationFeature(HydrationFeatureKind.EventReplay, _withEventReplay());
837
657
  }
838
- /**
839
- * Enables support for incremental hydration using the `hydrate` trigger syntax.
840
- *
841
- * @usageNotes
842
- *
843
- * Basic example of how you can enable incremental hydration in your application when
844
- * the `bootstrapApplication` function is used:
845
- * ```ts
846
- * bootstrapApplication(AppComponent, {
847
- * providers: [provideClientHydration(withIncrementalHydration())]
848
- * });
849
- * ```
850
- * @publicApi 20.0
851
- * @see {@link provideClientHydration}
852
- */
853
658
  function withIncrementalHydration() {
854
- return hydrationFeature(HydrationFeatureKind.IncrementalHydration, _withIncrementalHydration());
659
+ return hydrationFeature(HydrationFeatureKind.IncrementalHydration, _withIncrementalHydration());
855
660
  }
856
- /**
857
- * Returns an `ENVIRONMENT_INITIALIZER` token setup with a function
858
- * that verifies whether enabledBlocking initial navigation is used in an application
859
- * and logs a warning in a console if it's not compatible with hydration.
860
- */
861
661
  function provideEnabledBlockingInitialNavigationDetector() {
862
- return [
863
- {
864
- provide: ENVIRONMENT_INITIALIZER,
865
- useValue: () => {
866
- const isEnabledBlockingInitialNavigation = inject(_IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, {
867
- optional: true,
868
- });
869
- if (isEnabledBlockingInitialNavigation) {
870
- const console = inject(_Console);
871
- const message = _formatRuntimeError(5001 /* RuntimeErrorCode.HYDRATION_CONFLICTING_FEATURES */, 'Configuration error: found both hydration and enabledBlocking initial navigation ' +
872
- 'in the same application, which is a contradiction.');
873
- console.warn(message);
874
- }
875
- },
876
- multi: true,
877
- },
878
- ];
662
+ return [{
663
+ provide: ENVIRONMENT_INITIALIZER,
664
+ useValue: () => {
665
+ const isEnabledBlockingInitialNavigation = inject(_IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, {
666
+ optional: true
667
+ });
668
+ if (isEnabledBlockingInitialNavigation) {
669
+ const console = inject(_Console);
670
+ const message = _formatRuntimeError(5001, 'Configuration error: found both hydration and enabledBlocking initial navigation ' + 'in the same application, which is a contradiction.');
671
+ console.warn(message);
672
+ }
673
+ },
674
+ multi: true
675
+ }];
879
676
  }
880
- /**
881
- * Sets up providers necessary to enable hydration functionality for the application.
882
- *
883
- * By default, the function enables the recommended set of features for the optimal
884
- * performance for most of the applications. It includes the following features:
885
- *
886
- * * Reconciling DOM hydration. Learn more about it [here](guide/hydration).
887
- * * [`HttpClient`](api/common/http/HttpClient) response caching while running on the server and
888
- * transferring this cache to the client to avoid extra HTTP requests. Learn more about data caching
889
- * [here](guide/ssr#caching-data-when-using-httpclient).
890
- *
891
- * These functions allow you to disable some of the default features or enable new ones:
892
- *
893
- * * {@link withNoHttpTransferCache} to disable HTTP transfer cache
894
- * * {@link withHttpTransferCacheOptions} to configure some HTTP transfer cache options
895
- * * {@link withI18nSupport} to enable hydration support for i18n blocks
896
- * * {@link withEventReplay} to enable support for replaying user events
897
- *
898
- * @usageNotes
899
- *
900
- * Basic example of how you can enable hydration in your application when
901
- * `bootstrapApplication` function is used:
902
- * ```ts
903
- * bootstrapApplication(AppComponent, {
904
- * providers: [provideClientHydration()]
905
- * });
906
- * ```
907
- *
908
- * Alternatively if you are using NgModules, you would add `provideClientHydration`
909
- * to your root app module's provider list.
910
- * ```ts
911
- * @NgModule({
912
- * declarations: [RootCmp],
913
- * bootstrap: [RootCmp],
914
- * providers: [provideClientHydration()],
915
- * })
916
- * export class AppModule {}
917
- * ```
918
- *
919
- * @see {@link withNoHttpTransferCache}
920
- * @see {@link withHttpTransferCacheOptions}
921
- * @see {@link withI18nSupport}
922
- * @see {@link withEventReplay}
923
- *
924
- * @param features Optional features to configure additional hydration behaviors.
925
- * @returns A set of providers to enable hydration.
926
- *
927
- * @publicApi 17.0
928
- */
929
677
  function provideClientHydration(...features) {
930
- const providers = [];
931
- const featuresKind = new Set();
932
- for (const { ɵproviders, ɵkind } of features) {
933
- featuresKind.add(ɵkind);
934
- if (ɵproviders.length) {
935
- providers.push(ɵproviders);
936
- }
937
- }
938
- const hasHttpTransferCacheOptions = featuresKind.has(HydrationFeatureKind.HttpTransferCacheOptions);
939
- if (typeof ngDevMode !== 'undefined' &&
940
- ngDevMode &&
941
- featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) &&
942
- hasHttpTransferCacheOptions) {
943
- throw new _RuntimeError(5001 /* RuntimeErrorCode.HYDRATION_CONFLICTING_FEATURES */, 'Configuration error: found both withHttpTransferCacheOptions() and withNoHttpTransferCache() in the same call to provideClientHydration(), which is a contradiction.');
944
- }
945
- return makeEnvironmentProviders([
946
- typeof ngDevMode !== 'undefined' && ngDevMode
947
- ? provideEnabledBlockingInitialNavigationDetector()
948
- : [],
949
- _withDomHydration(),
950
- featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) || hasHttpTransferCacheOptions
951
- ? []
952
- : _withHttpTransferCache({}),
953
- providers,
954
- ]);
678
+ const providers = [];
679
+ const featuresKind = new Set();
680
+ for (const {
681
+ ɵproviders,
682
+ ɵkind
683
+ } of features) {
684
+ featuresKind.add(ɵkind);
685
+ if (ɵproviders.length) {
686
+ providers.push(ɵproviders);
687
+ }
688
+ }
689
+ const hasHttpTransferCacheOptions = featuresKind.has(HydrationFeatureKind.HttpTransferCacheOptions);
690
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) && hasHttpTransferCacheOptions) {
691
+ throw new _RuntimeError(5001, 'Configuration error: found both withHttpTransferCacheOptions() and withNoHttpTransferCache() in the same call to provideClientHydration(), which is a contradiction.');
692
+ }
693
+ return makeEnvironmentProviders([typeof ngDevMode !== 'undefined' && ngDevMode ? provideEnabledBlockingInitialNavigationDetector() : [], _withDomHydration(), featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) || hasHttpTransferCacheOptions ? [] : _withHttpTransferCache({}), providers]);
955
694
  }
956
695
 
957
- /**
958
- * @module
959
- * @description
960
- * Entry point for all public APIs of the platform-browser package.
961
- */
962
- /**
963
- * @publicApi
964
- */
965
- const VERSION = new Version('21.0.0-next.8');
696
+ const VERSION = new Version('21.0.0-rc.0');
966
697
 
967
698
  export { By, DomSanitizer, EVENT_MANAGER_PLUGINS, EventManagerPlugin, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, HammerModule, HydrationFeatureKind, Meta, Title, VERSION, disableDebugTools, enableDebugTools, provideClientHydration, withEventReplay, withHttpTransferCacheOptions, withI18nSupport, withIncrementalHydration, withNoHttpTransferCache, DomSanitizerImpl as ɵDomSanitizerImpl, HammerGesturesPlugin as ɵHammerGesturesPlugin };
968
699
  //# sourceMappingURL=platform-browser.mjs.map