@angular/platform-browser 13.0.0-next.0 → 13.0.0-next.12

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.
Files changed (102) hide show
  1. package/animations/animations.d.ts +47 -56
  2. package/animations/package.json +5 -5
  3. package/esm2020/animations/animations.mjs +5 -0
  4. package/{esm2015/animations/index.js → esm2020/animations/index.mjs} +0 -0
  5. package/{esm2015/animations/public_api.js → esm2020/animations/public_api.mjs} +0 -0
  6. package/esm2020/animations/src/animation_builder.mjs +106 -0
  7. package/esm2020/animations/src/animation_renderer.mjs +248 -0
  8. package/{esm2015/animations/src/animations.js → esm2020/animations/src/animations.mjs} +0 -0
  9. package/esm2020/animations/src/module.mjs +68 -0
  10. package/{esm2015/animations/src/private_export.js → esm2020/animations/src/private_export.mjs} +0 -0
  11. package/esm2020/animations/src/providers.mjs +71 -0
  12. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  13. package/esm2020/platform-browser.mjs +5 -0
  14. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  15. package/{esm2015/src/browser/browser_adapter.js → esm2020/src/browser/browser_adapter.mjs} +0 -0
  16. package/{esm2015/src/browser/generic_browser_adapter.js → esm2020/src/browser/generic_browser_adapter.mjs} +0 -0
  17. package/esm2020/src/browser/meta.mjs +182 -0
  18. package/esm2020/src/browser/server-transition.mjs +36 -0
  19. package/{esm2015/src/browser/testability.js → esm2020/src/browser/testability.mjs} +0 -0
  20. package/esm2020/src/browser/title.mjs +54 -0
  21. package/{esm2015/src/browser/tools/browser.js → esm2020/src/browser/tools/browser.mjs} +0 -0
  22. package/{esm2015/src/browser/tools/common_tools.js → esm2020/src/browser/tools/common_tools.mjs} +0 -0
  23. package/{esm2015/src/browser/tools/tools.js → esm2020/src/browser/tools/tools.mjs} +0 -0
  24. package/esm2020/src/browser/transfer_state.mjs +158 -0
  25. package/esm2020/src/browser/xhr.mjs +16 -0
  26. package/esm2020/src/browser.mjs +132 -0
  27. package/{esm2015/src/dom/debug/by.js → esm2020/src/dom/debug/by.mjs} +0 -0
  28. package/esm2020/src/dom/debug/ng_probe.mjs +54 -0
  29. package/esm2020/src/dom/dom_renderer.mjs +310 -0
  30. package/esm2020/src/dom/events/dom_events.mjs +37 -0
  31. package/esm2020/src/dom/events/event_manager.mjs +103 -0
  32. package/esm2020/src/dom/events/hammer_gestures.mjs +266 -0
  33. package/esm2020/src/dom/events/key_events.mjs +204 -0
  34. package/esm2020/src/dom/shared_styles_host.mjs +83 -0
  35. package/{esm2015/src/dom/util.js → esm2020/src/dom/util.mjs} +0 -0
  36. package/{esm2015/src/platform-browser.js → esm2020/src/platform-browser.mjs} +0 -0
  37. package/{esm2015/src/private_export.js → esm2020/src/private_export.mjs} +0 -0
  38. package/{esm2015/src/security/dom_sanitization_service.js → esm2020/src/security/dom_sanitization_service.mjs} +16 -12
  39. package/{esm2015/src/version.js → esm2020/src/version.mjs} +1 -1
  40. package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
  41. package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
  42. package/esm2020/testing/src/browser.mjs +48 -0
  43. package/{esm2015/testing/src/browser_util.js → esm2020/testing/src/browser_util.mjs} +0 -0
  44. package/{esm2015/testing/src/matchers.js → esm2020/testing/src/matchers.mjs} +0 -0
  45. package/{esm2015/testing/src/testing.js → esm2020/testing/src/testing.mjs} +0 -0
  46. package/esm2020/testing/testing.mjs +5 -0
  47. package/fesm2015/{animations.js → animations.mjs} +52 -40
  48. package/fesm2015/animations.mjs.map +1 -0
  49. package/fesm2015/platform-browser.mjs +2152 -0
  50. package/fesm2015/platform-browser.mjs.map +1 -0
  51. package/fesm2015/{testing.js → testing.mjs} +23 -15
  52. package/fesm2015/testing.mjs.map +1 -0
  53. package/fesm2020/animations.mjs +524 -0
  54. package/fesm2020/animations.mjs.map +1 -0
  55. package/{fesm2015/platform-browser.js → fesm2020/platform-browser.mjs} +165 -125
  56. package/fesm2020/platform-browser.mjs.map +1 -0
  57. package/fesm2020/testing.mjs +285 -0
  58. package/fesm2020/testing.mjs.map +1 -0
  59. package/package.json +34 -10
  60. package/platform-browser.d.ts +63 -78
  61. package/testing/package.json +5 -5
  62. package/testing/testing.d.ts +6 -4
  63. package/animations/animations.metadata.json +0 -1
  64. package/animations.d.ts +0 -7
  65. package/animations.metadata.json +0 -1
  66. package/bundles/platform-browser-animations.umd.js +0 -873
  67. package/bundles/platform-browser-animations.umd.js.map +0 -1
  68. package/bundles/platform-browser-testing.umd.js +0 -684
  69. package/bundles/platform-browser-testing.umd.js.map +0 -1
  70. package/bundles/platform-browser.umd.js +0 -2504
  71. package/bundles/platform-browser.umd.js.map +0 -1
  72. package/esm2015/animations/animations.externs.js +0 -6
  73. package/esm2015/animations/animations.js +0 -7
  74. package/esm2015/animations/src/animation_builder.js +0 -105
  75. package/esm2015/animations/src/animation_renderer.js +0 -249
  76. package/esm2015/animations/src/module.js +0 -59
  77. package/esm2015/animations/src/providers.js +0 -69
  78. package/esm2015/platform-browser.externs.js +0 -6
  79. package/esm2015/platform-browser.js +0 -16
  80. package/esm2015/src/browser/meta.js +0 -180
  81. package/esm2015/src/browser/server-transition.js +0 -35
  82. package/esm2015/src/browser/title.js +0 -52
  83. package/esm2015/src/browser/transfer_state.js +0 -151
  84. package/esm2015/src/browser/xhr.js +0 -20
  85. package/esm2015/src/browser.js +0 -125
  86. package/esm2015/src/dom/debug/ng_probe.js +0 -56
  87. package/esm2015/src/dom/dom_renderer.js +0 -306
  88. package/esm2015/src/dom/events/dom_events.js +0 -34
  89. package/esm2015/src/dom/events/event_manager.js +0 -101
  90. package/esm2015/src/dom/events/hammer_gestures.js +0 -252
  91. package/esm2015/src/dom/events/key_events.js +0 -203
  92. package/esm2015/src/dom/shared_styles_host.js +0 -78
  93. package/esm2015/testing/src/browser.js +0 -41
  94. package/esm2015/testing/testing.externs.js +0 -6
  95. package/esm2015/testing/testing.js +0 -6
  96. package/fesm2015/animations.js.map +0 -1
  97. package/fesm2015/platform-browser.js.map +0 -1
  98. package/fesm2015/testing.js.map +0 -1
  99. package/platform-browser.metadata.json +0 -1
  100. package/testing/testing.metadata.json +0 -1
  101. package/testing.d.ts +0 -7
  102. package/testing.metadata.json +0 -1
@@ -1,2504 +0,0 @@
1
- /**
2
- * @license Angular v13.0.0-next.0
3
- * (c) 2010-2021 Google LLC. https://angular.io/
4
- * License: MIT
5
- */
6
-
7
- (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core')) :
9
- typeof define === 'function' && define.amd ? define('@angular/platform-browser', ['exports', '@angular/common', '@angular/core'], factory) :
10
- (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowser = {}), global.ng.common, global.ng.core));
11
- }(this, (function (exports, common, i0) { 'use strict';
12
-
13
- /*! *****************************************************************************
14
- Copyright (c) Microsoft Corporation.
15
-
16
- Permission to use, copy, modify, and/or distribute this software for any
17
- purpose with or without fee is hereby granted.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
- PERFORMANCE OF THIS SOFTWARE.
26
- ***************************************************************************** */
27
- /* global Reflect, Promise */
28
- var extendStatics = function (d, b) {
29
- extendStatics = Object.setPrototypeOf ||
30
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31
- function (d, b) { for (var p in b)
32
- if (Object.prototype.hasOwnProperty.call(b, p))
33
- d[p] = b[p]; };
34
- return extendStatics(d, b);
35
- };
36
- function __extends(d, b) {
37
- if (typeof b !== "function" && b !== null)
38
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
39
- extendStatics(d, b);
40
- function __() { this.constructor = d; }
41
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42
- }
43
- var __assign = function () {
44
- __assign = Object.assign || function __assign(t) {
45
- for (var s, i = 1, n = arguments.length; i < n; i++) {
46
- s = arguments[i];
47
- for (var p in s)
48
- if (Object.prototype.hasOwnProperty.call(s, p))
49
- t[p] = s[p];
50
- }
51
- return t;
52
- };
53
- return __assign.apply(this, arguments);
54
- };
55
- function __rest(s, e) {
56
- var t = {};
57
- for (var p in s)
58
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
59
- t[p] = s[p];
60
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
61
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
62
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
63
- t[p[i]] = s[p[i]];
64
- }
65
- return t;
66
- }
67
- function __decorate(decorators, target, key, desc) {
68
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
69
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
70
- r = Reflect.decorate(decorators, target, key, desc);
71
- else
72
- for (var i = decorators.length - 1; i >= 0; i--)
73
- if (d = decorators[i])
74
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
75
- return c > 3 && r && Object.defineProperty(target, key, r), r;
76
- }
77
- function __param(paramIndex, decorator) {
78
- return function (target, key) { decorator(target, key, paramIndex); };
79
- }
80
- function __metadata(metadataKey, metadataValue) {
81
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
82
- return Reflect.metadata(metadataKey, metadataValue);
83
- }
84
- function __awaiter(thisArg, _arguments, P, generator) {
85
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
86
- return new (P || (P = Promise))(function (resolve, reject) {
87
- function fulfilled(value) { try {
88
- step(generator.next(value));
89
- }
90
- catch (e) {
91
- reject(e);
92
- } }
93
- function rejected(value) { try {
94
- step(generator["throw"](value));
95
- }
96
- catch (e) {
97
- reject(e);
98
- } }
99
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
100
- step((generator = generator.apply(thisArg, _arguments || [])).next());
101
- });
102
- }
103
- function __generator(thisArg, body) {
104
- var _ = { label: 0, sent: function () { if (t[0] & 1)
105
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
106
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
107
- function verb(n) { return function (v) { return step([n, v]); }; }
108
- function step(op) {
109
- if (f)
110
- throw new TypeError("Generator is already executing.");
111
- while (_)
112
- try {
113
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
114
- return t;
115
- if (y = 0, t)
116
- op = [op[0] & 2, t.value];
117
- switch (op[0]) {
118
- case 0:
119
- case 1:
120
- t = op;
121
- break;
122
- case 4:
123
- _.label++;
124
- return { value: op[1], done: false };
125
- case 5:
126
- _.label++;
127
- y = op[1];
128
- op = [0];
129
- continue;
130
- case 7:
131
- op = _.ops.pop();
132
- _.trys.pop();
133
- continue;
134
- default:
135
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
136
- _ = 0;
137
- continue;
138
- }
139
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
140
- _.label = op[1];
141
- break;
142
- }
143
- if (op[0] === 6 && _.label < t[1]) {
144
- _.label = t[1];
145
- t = op;
146
- break;
147
- }
148
- if (t && _.label < t[2]) {
149
- _.label = t[2];
150
- _.ops.push(op);
151
- break;
152
- }
153
- if (t[2])
154
- _.ops.pop();
155
- _.trys.pop();
156
- continue;
157
- }
158
- op = body.call(thisArg, _);
159
- }
160
- catch (e) {
161
- op = [6, e];
162
- y = 0;
163
- }
164
- finally {
165
- f = t = 0;
166
- }
167
- if (op[0] & 5)
168
- throw op[1];
169
- return { value: op[0] ? op[1] : void 0, done: true };
170
- }
171
- }
172
- var __createBinding = Object.create ? (function (o, m, k, k2) {
173
- if (k2 === undefined)
174
- k2 = k;
175
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
176
- }) : (function (o, m, k, k2) {
177
- if (k2 === undefined)
178
- k2 = k;
179
- o[k2] = m[k];
180
- });
181
- function __exportStar(m, o) {
182
- for (var p in m)
183
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
184
- __createBinding(o, m, p);
185
- }
186
- function __values(o) {
187
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
188
- if (m)
189
- return m.call(o);
190
- if (o && typeof o.length === "number")
191
- return {
192
- next: function () {
193
- if (o && i >= o.length)
194
- o = void 0;
195
- return { value: o && o[i++], done: !o };
196
- }
197
- };
198
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
199
- }
200
- function __read(o, n) {
201
- var m = typeof Symbol === "function" && o[Symbol.iterator];
202
- if (!m)
203
- return o;
204
- var i = m.call(o), r, ar = [], e;
205
- try {
206
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
207
- ar.push(r.value);
208
- }
209
- catch (error) {
210
- e = { error: error };
211
- }
212
- finally {
213
- try {
214
- if (r && !r.done && (m = i["return"]))
215
- m.call(i);
216
- }
217
- finally {
218
- if (e)
219
- throw e.error;
220
- }
221
- }
222
- return ar;
223
- }
224
- /** @deprecated */
225
- function __spread() {
226
- for (var ar = [], i = 0; i < arguments.length; i++)
227
- ar = ar.concat(__read(arguments[i]));
228
- return ar;
229
- }
230
- /** @deprecated */
231
- function __spreadArrays() {
232
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
233
- s += arguments[i].length;
234
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
235
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
236
- r[k] = a[j];
237
- return r;
238
- }
239
- function __spreadArray(to, from, pack) {
240
- if (pack || arguments.length === 2)
241
- for (var i = 0, l = from.length, ar; i < l; i++) {
242
- if (ar || !(i in from)) {
243
- if (!ar)
244
- ar = Array.prototype.slice.call(from, 0, i);
245
- ar[i] = from[i];
246
- }
247
- }
248
- return to.concat(ar || from);
249
- }
250
- function __await(v) {
251
- return this instanceof __await ? (this.v = v, this) : new __await(v);
252
- }
253
- function __asyncGenerator(thisArg, _arguments, generator) {
254
- if (!Symbol.asyncIterator)
255
- throw new TypeError("Symbol.asyncIterator is not defined.");
256
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
257
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
258
- function verb(n) { if (g[n])
259
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
260
- function resume(n, v) { try {
261
- step(g[n](v));
262
- }
263
- catch (e) {
264
- settle(q[0][3], e);
265
- } }
266
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
267
- function fulfill(value) { resume("next", value); }
268
- function reject(value) { resume("throw", value); }
269
- function settle(f, v) { if (f(v), q.shift(), q.length)
270
- resume(q[0][0], q[0][1]); }
271
- }
272
- function __asyncDelegator(o) {
273
- var i, p;
274
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
275
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
276
- }
277
- function __asyncValues(o) {
278
- if (!Symbol.asyncIterator)
279
- throw new TypeError("Symbol.asyncIterator is not defined.");
280
- var m = o[Symbol.asyncIterator], i;
281
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
282
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
283
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
284
- }
285
- function __makeTemplateObject(cooked, raw) {
286
- if (Object.defineProperty) {
287
- Object.defineProperty(cooked, "raw", { value: raw });
288
- }
289
- else {
290
- cooked.raw = raw;
291
- }
292
- return cooked;
293
- }
294
- ;
295
- var __setModuleDefault = Object.create ? (function (o, v) {
296
- Object.defineProperty(o, "default", { enumerable: true, value: v });
297
- }) : function (o, v) {
298
- o["default"] = v;
299
- };
300
- function __importStar(mod) {
301
- if (mod && mod.__esModule)
302
- return mod;
303
- var result = {};
304
- if (mod != null)
305
- for (var k in mod)
306
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
307
- __createBinding(result, mod, k);
308
- __setModuleDefault(result, mod);
309
- return result;
310
- }
311
- function __importDefault(mod) {
312
- return (mod && mod.__esModule) ? mod : { default: mod };
313
- }
314
- function __classPrivateFieldGet(receiver, state, kind, f) {
315
- if (kind === "a" && !f)
316
- throw new TypeError("Private accessor was defined without a getter");
317
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
318
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
319
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
320
- }
321
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
322
- if (kind === "m")
323
- throw new TypeError("Private method is not writable");
324
- if (kind === "a" && !f)
325
- throw new TypeError("Private accessor was defined without a setter");
326
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
327
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
328
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
329
- }
330
-
331
- /**
332
- * Provides DOM operations in any browser environment.
333
- *
334
- * @security Tread carefully! Interacting with the DOM directly is dangerous and
335
- * can introduce XSS risks.
336
- */
337
- var GenericBrowserDomAdapter = /** @class */ (function (_super) {
338
- __extends(GenericBrowserDomAdapter, _super);
339
- function GenericBrowserDomAdapter() {
340
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
341
- _this.supportsDOMEvents = true;
342
- return _this;
343
- }
344
- return GenericBrowserDomAdapter;
345
- }(common.ɵDomAdapter));
346
-
347
- /**
348
- * A `DomAdapter` powered by full browser DOM APIs.
349
- *
350
- * @security Tread carefully! Interacting with the DOM directly is dangerous and
351
- * can introduce XSS risks.
352
- */
353
- /* tslint:disable:requireParameterType no-console */
354
- var BrowserDomAdapter = /** @class */ (function (_super) {
355
- __extends(BrowserDomAdapter, _super);
356
- function BrowserDomAdapter() {
357
- return _super !== null && _super.apply(this, arguments) || this;
358
- }
359
- BrowserDomAdapter.makeCurrent = function () {
360
- common.ɵsetRootDomAdapter(new BrowserDomAdapter());
361
- };
362
- BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) {
363
- el.addEventListener(evt, listener, false);
364
- // Needed to follow Dart's subscription semantic, until fix of
365
- // https://code.google.com/p/dart/issues/detail?id=17406
366
- return function () {
367
- el.removeEventListener(evt, listener, false);
368
- };
369
- };
370
- BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) {
371
- el.dispatchEvent(evt);
372
- };
373
- BrowserDomAdapter.prototype.remove = function (node) {
374
- if (node.parentNode) {
375
- node.parentNode.removeChild(node);
376
- }
377
- };
378
- BrowserDomAdapter.prototype.createElement = function (tagName, doc) {
379
- doc = doc || this.getDefaultDocument();
380
- return doc.createElement(tagName);
381
- };
382
- BrowserDomAdapter.prototype.createHtmlDocument = function () {
383
- return document.implementation.createHTMLDocument('fakeTitle');
384
- };
385
- BrowserDomAdapter.prototype.getDefaultDocument = function () {
386
- return document;
387
- };
388
- BrowserDomAdapter.prototype.isElementNode = function (node) {
389
- return node.nodeType === Node.ELEMENT_NODE;
390
- };
391
- BrowserDomAdapter.prototype.isShadowRoot = function (node) {
392
- return node instanceof DocumentFragment;
393
- };
394
- /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
395
- BrowserDomAdapter.prototype.getGlobalEventTarget = function (doc, target) {
396
- if (target === 'window') {
397
- return window;
398
- }
399
- if (target === 'document') {
400
- return doc;
401
- }
402
- if (target === 'body') {
403
- return doc.body;
404
- }
405
- return null;
406
- };
407
- BrowserDomAdapter.prototype.getBaseHref = function (doc) {
408
- var href = getBaseElementHref();
409
- return href == null ? null : relativePath(href);
410
- };
411
- BrowserDomAdapter.prototype.resetBaseElement = function () {
412
- baseElement = null;
413
- };
414
- BrowserDomAdapter.prototype.getUserAgent = function () {
415
- return window.navigator.userAgent;
416
- };
417
- BrowserDomAdapter.prototype.getCookie = function (name) {
418
- return common.ɵparseCookieValue(document.cookie, name);
419
- };
420
- return BrowserDomAdapter;
421
- }(GenericBrowserDomAdapter));
422
- var baseElement = null;
423
- function getBaseElementHref() {
424
- baseElement = baseElement || document.querySelector('base');
425
- return baseElement ? baseElement.getAttribute('href') : null;
426
- }
427
- // based on urlUtils.js in AngularJS 1
428
- var urlParsingNode;
429
- function relativePath(url) {
430
- urlParsingNode = urlParsingNode || document.createElement('a');
431
- urlParsingNode.setAttribute('href', url);
432
- var pathName = urlParsingNode.pathname;
433
- return pathName.charAt(0) === '/' ? pathName : "/" + pathName;
434
- }
435
-
436
- /**
437
- * @license
438
- * Copyright Google LLC All Rights Reserved.
439
- *
440
- * Use of this source code is governed by an MIT-style license that can be
441
- * found in the LICENSE file at https://angular.io/license
442
- */
443
- /**
444
- * An id that identifies a particular application being bootstrapped, that should
445
- * match across the client/server boundary.
446
- */
447
- var TRANSITION_ID = new i0.InjectionToken('TRANSITION_ID');
448
- function appInitializerFactory(transitionId, document, injector) {
449
- return function () {
450
- // Wait for all application initializers to be completed before removing the styles set by
451
- // the server.
452
- injector.get(i0.ApplicationInitStatus).donePromise.then(function () {
453
- var dom = common.ɵgetDOM();
454
- var styles = Array.prototype.slice.apply(document.querySelectorAll("style[ng-transition]"));
455
- styles.filter(function (el) { return el.getAttribute('ng-transition') === transitionId; })
456
- .forEach(function (el) { return dom.remove(el); });
457
- });
458
- };
459
- }
460
- var SERVER_TRANSITION_PROVIDERS = [
461
- {
462
- provide: i0.APP_INITIALIZER,
463
- useFactory: appInitializerFactory,
464
- deps: [TRANSITION_ID, common.DOCUMENT, i0.Injector],
465
- multi: true
466
- },
467
- ];
468
-
469
- /**
470
- * @license
471
- * Copyright Google LLC All Rights Reserved.
472
- *
473
- * Use of this source code is governed by an MIT-style license that can be
474
- * found in the LICENSE file at https://angular.io/license
475
- */
476
- var BrowserGetTestability = /** @class */ (function () {
477
- function BrowserGetTestability() {
478
- }
479
- BrowserGetTestability.init = function () {
480
- i0.setTestabilityGetter(new BrowserGetTestability());
481
- };
482
- BrowserGetTestability.prototype.addToWindow = function (registry) {
483
- i0.ɵglobal['getAngularTestability'] = function (elem, findInAncestors) {
484
- if (findInAncestors === void 0) { findInAncestors = true; }
485
- var testability = registry.findTestabilityInTree(elem, findInAncestors);
486
- if (testability == null) {
487
- throw new Error('Could not find testability for element.');
488
- }
489
- return testability;
490
- };
491
- i0.ɵglobal['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
492
- i0.ɵglobal['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
493
- var whenAllStable = function (callback /** TODO #9100 */) {
494
- var testabilities = i0.ɵglobal['getAllAngularTestabilities']();
495
- var count = testabilities.length;
496
- var didWork = false;
497
- var decrement = function (didWork_ /** TODO #9100 */) {
498
- didWork = didWork || didWork_;
499
- count--;
500
- if (count == 0) {
501
- callback(didWork);
502
- }
503
- };
504
- testabilities.forEach(function (testability /** TODO #9100 */) {
505
- testability.whenStable(decrement);
506
- });
507
- };
508
- if (!i0.ɵglobal['frameworkStabilizers']) {
509
- i0.ɵglobal['frameworkStabilizers'] = [];
510
- }
511
- i0.ɵglobal['frameworkStabilizers'].push(whenAllStable);
512
- };
513
- BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
514
- if (elem == null) {
515
- return null;
516
- }
517
- var t = registry.getTestability(elem);
518
- if (t != null) {
519
- return t;
520
- }
521
- else if (!findInAncestors) {
522
- return null;
523
- }
524
- if (common.ɵgetDOM().isShadowRoot(elem)) {
525
- return this.findTestabilityInTree(registry, elem.host, true);
526
- }
527
- return this.findTestabilityInTree(registry, elem.parentElement, true);
528
- };
529
- return BrowserGetTestability;
530
- }());
531
-
532
- /**
533
- * @license
534
- * Copyright Google LLC All Rights Reserved.
535
- *
536
- * Use of this source code is governed by an MIT-style license that can be
537
- * found in the LICENSE file at https://angular.io/license
538
- */
539
- /**
540
- * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.
541
- */
542
- var BrowserXhr = /** @class */ (function () {
543
- function BrowserXhr() {
544
- }
545
- BrowserXhr.prototype.build = function () {
546
- return new XMLHttpRequest();
547
- };
548
- return BrowserXhr;
549
- }());
550
- BrowserXhr.decorators = [
551
- { type: i0.Injectable }
552
- ];
553
-
554
- /**
555
- * @license
556
- * Copyright Google LLC All Rights Reserved.
557
- *
558
- * Use of this source code is governed by an MIT-style license that can be
559
- * found in the LICENSE file at https://angular.io/license
560
- */
561
- var CAMEL_CASE_REGEXP = /([A-Z])/g;
562
- var DASH_CASE_REGEXP = /-([a-z])/g;
563
- function camelCaseToDashCase(input) {
564
- return input.replace(CAMEL_CASE_REGEXP, function () {
565
- var m = [];
566
- for (var _i = 0; _i < arguments.length; _i++) {
567
- m[_i] = arguments[_i];
568
- }
569
- return '-' + m[1].toLowerCase();
570
- });
571
- }
572
- function dashCaseToCamelCase(input) {
573
- return input.replace(DASH_CASE_REGEXP, function () {
574
- var m = [];
575
- for (var _i = 0; _i < arguments.length; _i++) {
576
- m[_i] = arguments[_i];
577
- }
578
- return m[1].toUpperCase();
579
- });
580
- }
581
- /**
582
- * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
583
- * `name` is `'probe'`.
584
- * @param name Name under which it will be exported. Keep in mind this will be a property of the
585
- * global `ng` object.
586
- * @param value The value to export.
587
- */
588
- function exportNgVar(name, value) {
589
- if (typeof COMPILED === 'undefined' || !COMPILED) {
590
- // Note: we can't export `ng` when using closure enhanced optimization as:
591
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
592
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
593
- // for typings for angularJS (via `goog.provide('ng....')`).
594
- var ng = i0.ɵglobal['ng'] = i0.ɵglobal['ng'] || {};
595
- ng[name] = value;
596
- }
597
- }
598
-
599
- /**
600
- * @license
601
- * Copyright Google LLC All Rights Reserved.
602
- *
603
- * Use of this source code is governed by an MIT-style license that can be
604
- * found in the LICENSE file at https://angular.io/license
605
- */
606
- var ɵ0 = function () { return ({
607
- 'ApplicationRef': i0.ApplicationRef,
608
- 'NgZone': i0.NgZone,
609
- }); };
610
- var CORE_TOKENS = (ɵ0)();
611
- var INSPECT_GLOBAL_NAME = 'probe';
612
- var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
613
- /**
614
- * Returns a {@link DebugElement} for the given native DOM element, or
615
- * null if the given native element does not have an Angular view associated
616
- * with it.
617
- */
618
- function inspectNativeElementR2(element) {
619
- return i0.ɵgetDebugNodeR2(element);
620
- }
621
- function _createNgProbeR2(coreTokens) {
622
- exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElementR2);
623
- exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object.assign(Object.assign({}, CORE_TOKENS), _ngProbeTokensToMap(coreTokens || [])));
624
- return function () { return inspectNativeElementR2; };
625
- }
626
- function _ngProbeTokensToMap(tokens) {
627
- return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
628
- }
629
- /**
630
- * In Ivy, we don't support NgProbe because we have our own set of testing utilities
631
- * with more robust functionality.
632
- *
633
- * We shouldn't bring in NgProbe because it prevents DebugNode and friends from
634
- * tree-shaking properly.
635
- */
636
- var ELEMENT_PROBE_PROVIDERS__POST_R3__ = [];
637
- /**
638
- * Providers which support debugging Angular applications (e.g. via `ng.probe`).
639
- */
640
- var ELEMENT_PROBE_PROVIDERS__PRE_R3__ = [
641
- {
642
- provide: i0.APP_INITIALIZER,
643
- useFactory: _createNgProbeR2,
644
- deps: [
645
- [i0.NgProbeToken, new i0.Optional()],
646
- ],
647
- multi: true,
648
- },
649
- ];
650
- var ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
651
-
652
- /**
653
- * @license
654
- * Copyright Google LLC All Rights Reserved.
655
- *
656
- * Use of this source code is governed by an MIT-style license that can be
657
- * found in the LICENSE file at https://angular.io/license
658
- */
659
- /**
660
- * The injection token for the event-manager plug-in service.
661
- *
662
- * @publicApi
663
- */
664
- var EVENT_MANAGER_PLUGINS = new i0.InjectionToken('EventManagerPlugins');
665
- /**
666
- * An injectable service that provides event management for Angular
667
- * through a browser plug-in.
668
- *
669
- * @publicApi
670
- */
671
- var EventManager = /** @class */ (function () {
672
- /**
673
- * Initializes an instance of the event-manager service.
674
- */
675
- function EventManager(plugins, _zone) {
676
- var _this = this;
677
- this._zone = _zone;
678
- this._eventNameToPlugin = new Map();
679
- plugins.forEach(function (p) { return p.manager = _this; });
680
- this._plugins = plugins.slice().reverse();
681
- }
682
- /**
683
- * Registers a handler for a specific element and event.
684
- *
685
- * @param element The HTML element to receive event notifications.
686
- * @param eventName The name of the event to listen for.
687
- * @param handler A function to call when the notification occurs. Receives the
688
- * event object as an argument.
689
- * @returns A callback function that can be used to remove the handler.
690
- */
691
- EventManager.prototype.addEventListener = function (element, eventName, handler) {
692
- var plugin = this._findPluginFor(eventName);
693
- return plugin.addEventListener(element, eventName, handler);
694
- };
695
- /**
696
- * Registers a global handler for an event in a target view.
697
- *
698
- * @param target A target for global event notifications. One of "window", "document", or "body".
699
- * @param eventName The name of the event to listen for.
700
- * @param handler A function to call when the notification occurs. Receives the
701
- * event object as an argument.
702
- * @returns A callback function that can be used to remove the handler.
703
- * @deprecated No longer being used in Ivy code. To be removed in version 14.
704
- */
705
- EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
706
- var plugin = this._findPluginFor(eventName);
707
- return plugin.addGlobalEventListener(target, eventName, handler);
708
- };
709
- /**
710
- * Retrieves the compilation zone in which event listeners are registered.
711
- */
712
- EventManager.prototype.getZone = function () {
713
- return this._zone;
714
- };
715
- /** @internal */
716
- EventManager.prototype._findPluginFor = function (eventName) {
717
- var plugin = this._eventNameToPlugin.get(eventName);
718
- if (plugin) {
719
- return plugin;
720
- }
721
- var plugins = this._plugins;
722
- for (var i = 0; i < plugins.length; i++) {
723
- var plugin_1 = plugins[i];
724
- if (plugin_1.supports(eventName)) {
725
- this._eventNameToPlugin.set(eventName, plugin_1);
726
- return plugin_1;
727
- }
728
- }
729
- throw new Error("No event manager plugin found for event " + eventName);
730
- };
731
- return EventManager;
732
- }());
733
- EventManager.decorators = [
734
- { type: i0.Injectable }
735
- ];
736
- EventManager.ctorParameters = function () { return [
737
- { type: Array, decorators: [{ type: i0.Inject, args: [EVENT_MANAGER_PLUGINS,] }] },
738
- { type: i0.NgZone }
739
- ]; };
740
- var EventManagerPlugin = /** @class */ (function () {
741
- function EventManagerPlugin(_doc) {
742
- this._doc = _doc;
743
- }
744
- EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
745
- var target = common.ɵgetDOM().getGlobalEventTarget(this._doc, element);
746
- if (!target) {
747
- throw new Error("Unsupported event target " + target + " for event " + eventName);
748
- }
749
- return this.addEventListener(target, eventName, handler);
750
- };
751
- return EventManagerPlugin;
752
- }());
753
-
754
- var SharedStylesHost = /** @class */ (function () {
755
- function SharedStylesHost() {
756
- /** @internal */
757
- this._stylesSet = new Set();
758
- }
759
- SharedStylesHost.prototype.addStyles = function (styles) {
760
- var _this = this;
761
- var additions = new Set();
762
- styles.forEach(function (style) {
763
- if (!_this._stylesSet.has(style)) {
764
- _this._stylesSet.add(style);
765
- additions.add(style);
766
- }
767
- });
768
- this.onStylesAdded(additions);
769
- };
770
- SharedStylesHost.prototype.onStylesAdded = function (additions) { };
771
- SharedStylesHost.prototype.getAllStyles = function () {
772
- return Array.from(this._stylesSet);
773
- };
774
- return SharedStylesHost;
775
- }());
776
- SharedStylesHost.decorators = [
777
- { type: i0.Injectable }
778
- ];
779
- var DomSharedStylesHost = /** @class */ (function (_super) {
780
- __extends(DomSharedStylesHost, _super);
781
- function DomSharedStylesHost(_doc) {
782
- var _this = _super.call(this) || this;
783
- _this._doc = _doc;
784
- // Maps all registered host nodes to a list of style nodes that have been added to the host node.
785
- _this._hostNodes = new Map();
786
- _this._hostNodes.set(_doc.head, []);
787
- return _this;
788
- }
789
- DomSharedStylesHost.prototype._addStylesToHost = function (styles, host, styleNodes) {
790
- var _this = this;
791
- styles.forEach(function (style) {
792
- var styleEl = _this._doc.createElement('style');
793
- styleEl.textContent = style;
794
- styleNodes.push(host.appendChild(styleEl));
795
- });
796
- };
797
- DomSharedStylesHost.prototype.addHost = function (hostNode) {
798
- var styleNodes = [];
799
- this._addStylesToHost(this._stylesSet, hostNode, styleNodes);
800
- this._hostNodes.set(hostNode, styleNodes);
801
- };
802
- DomSharedStylesHost.prototype.removeHost = function (hostNode) {
803
- var styleNodes = this._hostNodes.get(hostNode);
804
- if (styleNodes) {
805
- styleNodes.forEach(removeStyle);
806
- }
807
- this._hostNodes.delete(hostNode);
808
- };
809
- DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
810
- var _this = this;
811
- this._hostNodes.forEach(function (styleNodes, hostNode) {
812
- _this._addStylesToHost(additions, hostNode, styleNodes);
813
- });
814
- };
815
- DomSharedStylesHost.prototype.ngOnDestroy = function () {
816
- this._hostNodes.forEach(function (styleNodes) { return styleNodes.forEach(removeStyle); });
817
- };
818
- return DomSharedStylesHost;
819
- }(SharedStylesHost));
820
- DomSharedStylesHost.decorators = [
821
- { type: i0.Injectable }
822
- ];
823
- DomSharedStylesHost.ctorParameters = function () { return [
824
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
825
- ]; };
826
- function removeStyle(styleNode) {
827
- common.ɵgetDOM().remove(styleNode);
828
- }
829
-
830
- var NAMESPACE_URIS = {
831
- 'svg': 'http://www.w3.org/2000/svg',
832
- 'xhtml': 'http://www.w3.org/1999/xhtml',
833
- 'xlink': 'http://www.w3.org/1999/xlink',
834
- 'xml': 'http://www.w3.org/XML/1998/namespace',
835
- 'xmlns': 'http://www.w3.org/2000/xmlns/',
836
- };
837
- var COMPONENT_REGEX = /%COMP%/g;
838
- var NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
839
- var COMPONENT_VARIABLE = '%COMP%';
840
- var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
841
- var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
842
- function shimContentAttribute(componentShortId) {
843
- return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
844
- }
845
- function shimHostAttribute(componentShortId) {
846
- return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
847
- }
848
- function flattenStyles(compId, styles, target) {
849
- for (var i = 0; i < styles.length; i++) {
850
- var style = styles[i];
851
- if (Array.isArray(style)) {
852
- flattenStyles(compId, style, target);
853
- }
854
- else {
855
- style = style.replace(COMPONENT_REGEX, compId);
856
- target.push(style);
857
- }
858
- }
859
- return target;
860
- }
861
- function decoratePreventDefault(eventHandler) {
862
- // `DebugNode.triggerEventHandler` needs to know if the listener was created with
863
- // decoratePreventDefault or is a listener added outside the Angular context so it can handle the
864
- // two differently. In the first case, the special '__ngUnwrap__' token is passed to the unwrap
865
- // the listener (see below).
866
- return function (event) {
867
- // Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function
868
- // so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The debug_node
869
- // can inspect the listener toString contents for the existence of this special token. Because
870
- // the token is a string literal, it is ensured to not be modified by compiled code.
871
- if (event === '__ngUnwrap__') {
872
- return eventHandler;
873
- }
874
- var allowDefaultBehavior = eventHandler(event);
875
- if (allowDefaultBehavior === false) {
876
- // TODO(tbosch): move preventDefault into event plugins...
877
- event.preventDefault();
878
- event.returnValue = false;
879
- }
880
- return undefined;
881
- };
882
- }
883
- var hasLoggedNativeEncapsulationWarning = false;
884
- var DomRendererFactory2 = /** @class */ (function () {
885
- function DomRendererFactory2(eventManager, sharedStylesHost, appId) {
886
- this.eventManager = eventManager;
887
- this.sharedStylesHost = sharedStylesHost;
888
- this.appId = appId;
889
- this.rendererByCompId = new Map();
890
- this.defaultRenderer = new DefaultDomRenderer2(eventManager);
891
- }
892
- DomRendererFactory2.prototype.createRenderer = function (element, type) {
893
- if (!element || !type) {
894
- return this.defaultRenderer;
895
- }
896
- switch (type.encapsulation) {
897
- case i0.ViewEncapsulation.Emulated: {
898
- var renderer = this.rendererByCompId.get(type.id);
899
- if (!renderer) {
900
- renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
901
- this.rendererByCompId.set(type.id, renderer);
902
- }
903
- renderer.applyToHost(element);
904
- return renderer;
905
- }
906
- // @ts-ignore TODO: Remove as part of FW-2290. TS complains about us dealing with an enum
907
- // value that is not known (but previously was the value for ViewEncapsulation.Native)
908
- case 1:
909
- case i0.ViewEncapsulation.ShadowDom:
910
- // TODO(FW-2290): remove the `case 1:` fallback logic and the warning in v12.
911
- if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
912
- // @ts-ignore TODO: Remove as part of FW-2290. TS complains about us dealing with an
913
- // enum value that is not known (but previously was the value for
914
- // ViewEncapsulation.Native)
915
- !hasLoggedNativeEncapsulationWarning && type.encapsulation === 1) {
916
- hasLoggedNativeEncapsulationWarning = true;
917
- console.warn('ViewEncapsulation.Native is no longer supported. Falling back to ViewEncapsulation.ShadowDom. The fallback will be removed in v12.');
918
- }
919
- return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
920
- default: {
921
- if (!this.rendererByCompId.has(type.id)) {
922
- var styles = flattenStyles(type.id, type.styles, []);
923
- this.sharedStylesHost.addStyles(styles);
924
- this.rendererByCompId.set(type.id, this.defaultRenderer);
925
- }
926
- return this.defaultRenderer;
927
- }
928
- }
929
- };
930
- DomRendererFactory2.prototype.begin = function () { };
931
- DomRendererFactory2.prototype.end = function () { };
932
- return DomRendererFactory2;
933
- }());
934
- DomRendererFactory2.decorators = [
935
- { type: i0.Injectable }
936
- ];
937
- DomRendererFactory2.ctorParameters = function () { return [
938
- { type: EventManager },
939
- { type: DomSharedStylesHost },
940
- { type: String, decorators: [{ type: i0.Inject, args: [i0.APP_ID,] }] }
941
- ]; };
942
- var DefaultDomRenderer2 = /** @class */ (function () {
943
- function DefaultDomRenderer2(eventManager) {
944
- this.eventManager = eventManager;
945
- this.data = Object.create(null);
946
- }
947
- DefaultDomRenderer2.prototype.destroy = function () { };
948
- DefaultDomRenderer2.prototype.createElement = function (name, namespace) {
949
- if (namespace) {
950
- // In cases where Ivy (not ViewEngine) is giving us the actual namespace, the look up by key
951
- // will result in undefined, so we just return the namespace here.
952
- return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
953
- }
954
- return document.createElement(name);
955
- };
956
- DefaultDomRenderer2.prototype.createComment = function (value) {
957
- return document.createComment(value);
958
- };
959
- DefaultDomRenderer2.prototype.createText = function (value) {
960
- return document.createTextNode(value);
961
- };
962
- DefaultDomRenderer2.prototype.appendChild = function (parent, newChild) {
963
- parent.appendChild(newChild);
964
- };
965
- DefaultDomRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
966
- if (parent) {
967
- parent.insertBefore(newChild, refChild);
968
- }
969
- };
970
- DefaultDomRenderer2.prototype.removeChild = function (parent, oldChild) {
971
- if (parent) {
972
- parent.removeChild(oldChild);
973
- }
974
- };
975
- DefaultDomRenderer2.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
976
- var el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
977
- selectorOrNode;
978
- if (!el) {
979
- throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
980
- }
981
- if (!preserveContent) {
982
- el.textContent = '';
983
- }
984
- return el;
985
- };
986
- DefaultDomRenderer2.prototype.parentNode = function (node) {
987
- return node.parentNode;
988
- };
989
- DefaultDomRenderer2.prototype.nextSibling = function (node) {
990
- return node.nextSibling;
991
- };
992
- DefaultDomRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
993
- if (namespace) {
994
- name = namespace + ':' + name;
995
- // TODO(FW-811): Ivy may cause issues here because it's passing around
996
- // full URIs for namespaces, therefore this lookup will fail.
997
- var namespaceUri = NAMESPACE_URIS[namespace];
998
- if (namespaceUri) {
999
- el.setAttributeNS(namespaceUri, name, value);
1000
- }
1001
- else {
1002
- el.setAttribute(name, value);
1003
- }
1004
- }
1005
- else {
1006
- el.setAttribute(name, value);
1007
- }
1008
- };
1009
- DefaultDomRenderer2.prototype.removeAttribute = function (el, name, namespace) {
1010
- if (namespace) {
1011
- // TODO(FW-811): Ivy may cause issues here because it's passing around
1012
- // full URIs for namespaces, therefore this lookup will fail.
1013
- var namespaceUri = NAMESPACE_URIS[namespace];
1014
- if (namespaceUri) {
1015
- el.removeAttributeNS(namespaceUri, name);
1016
- }
1017
- else {
1018
- // TODO(FW-811): Since ivy is passing around full URIs for namespaces
1019
- // this could result in properties like `http://www.w3.org/2000/svg:cx="123"`,
1020
- // which is wrong.
1021
- el.removeAttribute(namespace + ":" + name);
1022
- }
1023
- }
1024
- else {
1025
- el.removeAttribute(name);
1026
- }
1027
- };
1028
- DefaultDomRenderer2.prototype.addClass = function (el, name) {
1029
- el.classList.add(name);
1030
- };
1031
- DefaultDomRenderer2.prototype.removeClass = function (el, name) {
1032
- el.classList.remove(name);
1033
- };
1034
- DefaultDomRenderer2.prototype.setStyle = function (el, style, value, flags) {
1035
- if (flags & (i0.RendererStyleFlags2.DashCase | i0.RendererStyleFlags2.Important)) {
1036
- el.style.setProperty(style, value, flags & i0.RendererStyleFlags2.Important ? 'important' : '');
1037
- }
1038
- else {
1039
- el.style[style] = value;
1040
- }
1041
- };
1042
- DefaultDomRenderer2.prototype.removeStyle = function (el, style, flags) {
1043
- if (flags & i0.RendererStyleFlags2.DashCase) {
1044
- el.style.removeProperty(style);
1045
- }
1046
- else {
1047
- // IE requires '' instead of null
1048
- // see https://github.com/angular/angular/issues/7916
1049
- el.style[style] = '';
1050
- }
1051
- };
1052
- DefaultDomRenderer2.prototype.setProperty = function (el, name, value) {
1053
- NG_DEV_MODE && checkNoSyntheticProp(name, 'property');
1054
- el[name] = value;
1055
- };
1056
- DefaultDomRenderer2.prototype.setValue = function (node, value) {
1057
- node.nodeValue = value;
1058
- };
1059
- DefaultDomRenderer2.prototype.listen = function (target, event, callback) {
1060
- NG_DEV_MODE && checkNoSyntheticProp(event, 'listener');
1061
- if (typeof target === 'string') {
1062
- return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
1063
- }
1064
- return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
1065
- };
1066
- return DefaultDomRenderer2;
1067
- }());
1068
- var ɵ0$1 = function () { return '@'.charCodeAt(0); };
1069
- var AT_CHARCODE = (ɵ0$1)();
1070
- function checkNoSyntheticProp(name, nameKind) {
1071
- if (name.charCodeAt(0) === AT_CHARCODE) {
1072
- throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
1073
- }
1074
- }
1075
- var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
1076
- __extends(EmulatedEncapsulationDomRenderer2, _super);
1077
- function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component, appId) {
1078
- var _this = _super.call(this, eventManager) || this;
1079
- _this.component = component;
1080
- var styles = flattenStyles(appId + '-' + component.id, component.styles, []);
1081
- sharedStylesHost.addStyles(styles);
1082
- _this.contentAttr = shimContentAttribute(appId + '-' + component.id);
1083
- _this.hostAttr = shimHostAttribute(appId + '-' + component.id);
1084
- return _this;
1085
- }
1086
- EmulatedEncapsulationDomRenderer2.prototype.applyToHost = function (element) {
1087
- _super.prototype.setAttribute.call(this, element, this.hostAttr, '');
1088
- };
1089
- EmulatedEncapsulationDomRenderer2.prototype.createElement = function (parent, name) {
1090
- var el = _super.prototype.createElement.call(this, parent, name);
1091
- _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
1092
- return el;
1093
- };
1094
- return EmulatedEncapsulationDomRenderer2;
1095
- }(DefaultDomRenderer2));
1096
- var ShadowDomRenderer = /** @class */ (function (_super) {
1097
- __extends(ShadowDomRenderer, _super);
1098
- function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
1099
- var _this = _super.call(this, eventManager) || this;
1100
- _this.sharedStylesHost = sharedStylesHost;
1101
- _this.hostEl = hostEl;
1102
- _this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
1103
- _this.sharedStylesHost.addHost(_this.shadowRoot);
1104
- var styles = flattenStyles(component.id, component.styles, []);
1105
- for (var i = 0; i < styles.length; i++) {
1106
- var styleEl = document.createElement('style');
1107
- styleEl.textContent = styles[i];
1108
- _this.shadowRoot.appendChild(styleEl);
1109
- }
1110
- return _this;
1111
- }
1112
- ShadowDomRenderer.prototype.nodeOrShadowRoot = function (node) {
1113
- return node === this.hostEl ? this.shadowRoot : node;
1114
- };
1115
- ShadowDomRenderer.prototype.destroy = function () {
1116
- this.sharedStylesHost.removeHost(this.shadowRoot);
1117
- };
1118
- ShadowDomRenderer.prototype.appendChild = function (parent, newChild) {
1119
- return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
1120
- };
1121
- ShadowDomRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
1122
- return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
1123
- };
1124
- ShadowDomRenderer.prototype.removeChild = function (parent, oldChild) {
1125
- return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
1126
- };
1127
- ShadowDomRenderer.prototype.parentNode = function (node) {
1128
- return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
1129
- };
1130
- return ShadowDomRenderer;
1131
- }(DefaultDomRenderer2));
1132
-
1133
- var DomEventsPlugin = /** @class */ (function (_super) {
1134
- __extends(DomEventsPlugin, _super);
1135
- function DomEventsPlugin(doc) {
1136
- return _super.call(this, doc) || this;
1137
- }
1138
- // This plugin should come last in the list of plugins, because it accepts all
1139
- // events.
1140
- DomEventsPlugin.prototype.supports = function (eventName) {
1141
- return true;
1142
- };
1143
- DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1144
- var _this = this;
1145
- element.addEventListener(eventName, handler, false);
1146
- return function () { return _this.removeEventListener(element, eventName, handler); };
1147
- };
1148
- DomEventsPlugin.prototype.removeEventListener = function (target, eventName, callback) {
1149
- return target.removeEventListener(eventName, callback);
1150
- };
1151
- return DomEventsPlugin;
1152
- }(EventManagerPlugin));
1153
- DomEventsPlugin.decorators = [
1154
- { type: i0.Injectable }
1155
- ];
1156
- DomEventsPlugin.ctorParameters = function () { return [
1157
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
1158
- ]; };
1159
-
1160
- /**
1161
- * Supported HammerJS recognizer event names.
1162
- */
1163
- var EVENT_NAMES = {
1164
- // pan
1165
- 'pan': true,
1166
- 'panstart': true,
1167
- 'panmove': true,
1168
- 'panend': true,
1169
- 'pancancel': true,
1170
- 'panleft': true,
1171
- 'panright': true,
1172
- 'panup': true,
1173
- 'pandown': true,
1174
- // pinch
1175
- 'pinch': true,
1176
- 'pinchstart': true,
1177
- 'pinchmove': true,
1178
- 'pinchend': true,
1179
- 'pinchcancel': true,
1180
- 'pinchin': true,
1181
- 'pinchout': true,
1182
- // press
1183
- 'press': true,
1184
- 'pressup': true,
1185
- // rotate
1186
- 'rotate': true,
1187
- 'rotatestart': true,
1188
- 'rotatemove': true,
1189
- 'rotateend': true,
1190
- 'rotatecancel': true,
1191
- // swipe
1192
- 'swipe': true,
1193
- 'swipeleft': true,
1194
- 'swiperight': true,
1195
- 'swipeup': true,
1196
- 'swipedown': true,
1197
- // tap
1198
- 'tap': true,
1199
- 'doubletap': true
1200
- };
1201
- /**
1202
- * DI token for providing [HammerJS](https://hammerjs.github.io/) support to Angular.
1203
- * @see `HammerGestureConfig`
1204
- *
1205
- * @ngModule HammerModule
1206
- * @publicApi
1207
- */
1208
- var HAMMER_GESTURE_CONFIG = new i0.InjectionToken('HammerGestureConfig');
1209
- /**
1210
- * Injection token used to provide a {@link HammerLoader} to Angular.
1211
- *
1212
- * @publicApi
1213
- */
1214
- var HAMMER_LOADER = new i0.InjectionToken('HammerLoader');
1215
- /**
1216
- * An injectable [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
1217
- * for gesture recognition. Configures specific event recognition.
1218
- * @publicApi
1219
- */
1220
- var HammerGestureConfig = /** @class */ (function () {
1221
- function HammerGestureConfig() {
1222
- /**
1223
- * A set of supported event names for gestures to be used in Angular.
1224
- * Angular supports all built-in recognizers, as listed in
1225
- * [HammerJS documentation](https://hammerjs.github.io/).
1226
- */
1227
- this.events = [];
1228
- /**
1229
- * Maps gesture event names to a set of configuration options
1230
- * that specify overrides to the default values for specific properties.
1231
- *
1232
- * The key is a supported event name to be configured,
1233
- * and the options object contains a set of properties, with override values
1234
- * to be applied to the named recognizer event.
1235
- * For example, to disable recognition of the rotate event, specify
1236
- * `{"rotate": {"enable": false}}`.
1237
- *
1238
- * Properties that are not present take the HammerJS default values.
1239
- * For information about which properties are supported for which events,
1240
- * and their allowed and default values, see
1241
- * [HammerJS documentation](https://hammerjs.github.io/).
1242
- *
1243
- */
1244
- this.overrides = {};
1245
- }
1246
- /**
1247
- * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
1248
- * and attaches it to a given HTML element.
1249
- * @param element The element that will recognize gestures.
1250
- * @returns A HammerJS event-manager object.
1251
- */
1252
- HammerGestureConfig.prototype.buildHammer = function (element) {
1253
- var mc = new Hammer(element, this.options);
1254
- mc.get('pinch').set({ enable: true });
1255
- mc.get('rotate').set({ enable: true });
1256
- for (var eventName in this.overrides) {
1257
- mc.get(eventName).set(this.overrides[eventName]);
1258
- }
1259
- return mc;
1260
- };
1261
- return HammerGestureConfig;
1262
- }());
1263
- HammerGestureConfig.decorators = [
1264
- { type: i0.Injectable }
1265
- ];
1266
- /**
1267
- * Event plugin that adds Hammer support to an application.
1268
- *
1269
- * @ngModule HammerModule
1270
- */
1271
- var HammerGesturesPlugin = /** @class */ (function (_super) {
1272
- __extends(HammerGesturesPlugin, _super);
1273
- function HammerGesturesPlugin(doc, _config, console, loader) {
1274
- var _this = _super.call(this, doc) || this;
1275
- _this._config = _config;
1276
- _this.console = console;
1277
- _this.loader = loader;
1278
- _this._loaderPromise = null;
1279
- return _this;
1280
- }
1281
- HammerGesturesPlugin.prototype.supports = function (eventName) {
1282
- if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
1283
- return false;
1284
- }
1285
- if (!window.Hammer && !this.loader) {
1286
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
1287
- this.console.warn("The \"" + eventName + "\" event cannot be bound because Hammer.JS is not " +
1288
- "loaded and no custom loader has been specified.");
1289
- }
1290
- return false;
1291
- }
1292
- return true;
1293
- };
1294
- HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
1295
- var _this = this;
1296
- var zone = this.manager.getZone();
1297
- eventName = eventName.toLowerCase();
1298
- // If Hammer is not present but a loader is specified, we defer adding the event listener
1299
- // until Hammer is loaded.
1300
- if (!window.Hammer && this.loader) {
1301
- this._loaderPromise = this._loaderPromise || this.loader();
1302
- // This `addEventListener` method returns a function to remove the added listener.
1303
- // Until Hammer is loaded, the returned function needs to *cancel* the registration rather
1304
- // than remove anything.
1305
- var cancelRegistration_1 = false;
1306
- var deregister_1 = function () {
1307
- cancelRegistration_1 = true;
1308
- };
1309
- this._loaderPromise
1310
- .then(function () {
1311
- // If Hammer isn't actually loaded when the custom loader resolves, give up.
1312
- if (!window.Hammer) {
1313
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
1314
- _this.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present.");
1315
- }
1316
- deregister_1 = function () { };
1317
- return;
1318
- }
1319
- if (!cancelRegistration_1) {
1320
- // Now that Hammer is loaded and the listener is being loaded for real,
1321
- // the deregistration function changes from canceling registration to removal.
1322
- deregister_1 = _this.addEventListener(element, eventName, handler);
1323
- }
1324
- })
1325
- .catch(function () {
1326
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
1327
- _this.console.warn("The \"" + eventName + "\" event cannot be bound because the custom " +
1328
- "Hammer.JS loader failed.");
1329
- }
1330
- deregister_1 = function () { };
1331
- });
1332
- // Return a function that *executes* `deregister` (and not `deregister` itself) so that we
1333
- // can change the behavior of `deregister` once the listener is added. Using a closure in
1334
- // this way allows us to avoid any additional data structures to track listener removal.
1335
- return function () {
1336
- deregister_1();
1337
- };
1338
- }
1339
- return zone.runOutsideAngular(function () {
1340
- // Creating the manager bind events, must be done outside of angular
1341
- var mc = _this._config.buildHammer(element);
1342
- var callback = function (eventObj) {
1343
- zone.runGuarded(function () {
1344
- handler(eventObj);
1345
- });
1346
- };
1347
- mc.on(eventName, callback);
1348
- return function () {
1349
- mc.off(eventName, callback);
1350
- // destroy mc to prevent memory leak
1351
- if (typeof mc.destroy === 'function') {
1352
- mc.destroy();
1353
- }
1354
- };
1355
- });
1356
- };
1357
- HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) {
1358
- return this._config.events.indexOf(eventName) > -1;
1359
- };
1360
- return HammerGesturesPlugin;
1361
- }(EventManagerPlugin));
1362
- HammerGesturesPlugin.decorators = [
1363
- { type: i0.Injectable }
1364
- ];
1365
- HammerGesturesPlugin.ctorParameters = function () { return [
1366
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
1367
- { type: HammerGestureConfig, decorators: [{ type: i0.Inject, args: [HAMMER_GESTURE_CONFIG,] }] },
1368
- { type: i0.ɵConsole },
1369
- { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [HAMMER_LOADER,] }] }
1370
- ]; };
1371
- /**
1372
- * In Ivy, support for Hammer gestures is optional, so applications must
1373
- * import the `HammerModule` at root to turn on support. This means that
1374
- * Hammer-specific code can be tree-shaken away if not needed.
1375
- */
1376
- var HAMMER_PROVIDERS__POST_R3__ = [];
1377
- /**
1378
- * In View Engine, support for Hammer gestures is built-in by default.
1379
- */
1380
- var HAMMER_PROVIDERS__PRE_R3__ = [
1381
- {
1382
- provide: EVENT_MANAGER_PLUGINS,
1383
- useClass: HammerGesturesPlugin,
1384
- multi: true,
1385
- deps: [common.DOCUMENT, HAMMER_GESTURE_CONFIG, i0.ɵConsole, [new i0.Optional(), HAMMER_LOADER]]
1386
- },
1387
- { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
1388
- ];
1389
- var HAMMER_PROVIDERS = HAMMER_PROVIDERS__PRE_R3__;
1390
- /**
1391
- * Adds support for HammerJS.
1392
- *
1393
- * Import this module at the root of your application so that Angular can work with
1394
- * HammerJS to detect gesture events.
1395
- *
1396
- * Note that applications still need to include the HammerJS script itself. This module
1397
- * simply sets up the coordination layer between HammerJS and Angular's EventManager.
1398
- *
1399
- * @publicApi
1400
- */
1401
- var HammerModule = /** @class */ (function () {
1402
- function HammerModule() {
1403
- }
1404
- return HammerModule;
1405
- }());
1406
- HammerModule.decorators = [
1407
- { type: i0.NgModule, args: [{ providers: HAMMER_PROVIDERS__PRE_R3__ },] }
1408
- ];
1409
-
1410
- /**
1411
- * Defines supported modifiers for key events.
1412
- */
1413
- var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
1414
- var DOM_KEY_LOCATION_NUMPAD = 3;
1415
- // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
1416
- var _keyMap = {
1417
- // The following values are here for cross-browser compatibility and to match the W3C standard
1418
- // cf https://www.w3.org/TR/DOM-Level-3-Events-key/
1419
- '\b': 'Backspace',
1420
- '\t': 'Tab',
1421
- '\x7F': 'Delete',
1422
- '\x1B': 'Escape',
1423
- 'Del': 'Delete',
1424
- 'Esc': 'Escape',
1425
- 'Left': 'ArrowLeft',
1426
- 'Right': 'ArrowRight',
1427
- 'Up': 'ArrowUp',
1428
- 'Down': 'ArrowDown',
1429
- 'Menu': 'ContextMenu',
1430
- 'Scroll': 'ScrollLock',
1431
- 'Win': 'OS'
1432
- };
1433
- // There is a bug in Chrome for numeric keypad keys:
1434
- // https://code.google.com/p/chromium/issues/detail?id=155654
1435
- // 1, 2, 3 ... are reported as A, B, C ...
1436
- var _chromeNumKeyPadMap = {
1437
- 'A': '1',
1438
- 'B': '2',
1439
- 'C': '3',
1440
- 'D': '4',
1441
- 'E': '5',
1442
- 'F': '6',
1443
- 'G': '7',
1444
- 'H': '8',
1445
- 'I': '9',
1446
- 'J': '*',
1447
- 'K': '+',
1448
- 'M': '-',
1449
- 'N': '.',
1450
- 'O': '/',
1451
- '\x60': '0',
1452
- '\x90': 'NumLock'
1453
- };
1454
- var ɵ0$2 = function (event) { return event.altKey; }, ɵ1 = function (event) { return event.ctrlKey; }, ɵ2 = function (event) { return event.metaKey; }, ɵ3 = function (event) { return event.shiftKey; };
1455
- /**
1456
- * Retrieves modifiers from key-event objects.
1457
- */
1458
- var MODIFIER_KEY_GETTERS = {
1459
- 'alt': ɵ0$2,
1460
- 'control': ɵ1,
1461
- 'meta': ɵ2,
1462
- 'shift': ɵ3
1463
- };
1464
- /**
1465
- * @publicApi
1466
- * A browser plug-in that provides support for handling of key events in Angular.
1467
- */
1468
- var KeyEventsPlugin = /** @class */ (function (_super) {
1469
- __extends(KeyEventsPlugin, _super);
1470
- /**
1471
- * Initializes an instance of the browser plug-in.
1472
- * @param doc The document in which key events will be detected.
1473
- */
1474
- function KeyEventsPlugin(doc) {
1475
- return _super.call(this, doc) || this;
1476
- }
1477
- /**
1478
- * Reports whether a named key event is supported.
1479
- * @param eventName The event name to query.
1480
- * @return True if the named key event is supported.
1481
- */
1482
- KeyEventsPlugin.prototype.supports = function (eventName) {
1483
- return KeyEventsPlugin.parseEventName(eventName) != null;
1484
- };
1485
- /**
1486
- * Registers a handler for a specific element and key event.
1487
- * @param element The HTML element to receive event notifications.
1488
- * @param eventName The name of the key event to listen for.
1489
- * @param handler A function to call when the notification occurs. Receives the
1490
- * event object as an argument.
1491
- * @returns The key event that was registered.
1492
- */
1493
- KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1494
- var parsedEvent = KeyEventsPlugin.parseEventName(eventName);
1495
- var outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
1496
- return this.manager.getZone().runOutsideAngular(function () {
1497
- return common.ɵgetDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
1498
- });
1499
- };
1500
- KeyEventsPlugin.parseEventName = function (eventName) {
1501
- var parts = eventName.toLowerCase().split('.');
1502
- var domEventName = parts.shift();
1503
- if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
1504
- return null;
1505
- }
1506
- var key = KeyEventsPlugin._normalizeKey(parts.pop());
1507
- var fullKey = '';
1508
- MODIFIER_KEYS.forEach(function (modifierName) {
1509
- var index = parts.indexOf(modifierName);
1510
- if (index > -1) {
1511
- parts.splice(index, 1);
1512
- fullKey += modifierName + '.';
1513
- }
1514
- });
1515
- fullKey += key;
1516
- if (parts.length != 0 || key.length === 0) {
1517
- // returning null instead of throwing to let another plugin process the event
1518
- return null;
1519
- }
1520
- // NOTE: Please don't rewrite this as so, as it will break JSCompiler property renaming.
1521
- // The code must remain in the `result['domEventName']` form.
1522
- // return {domEventName, fullKey};
1523
- var result = {};
1524
- result['domEventName'] = domEventName;
1525
- result['fullKey'] = fullKey;
1526
- return result;
1527
- };
1528
- KeyEventsPlugin.getEventFullKey = function (event) {
1529
- var fullKey = '';
1530
- var key = getEventKey(event);
1531
- key = key.toLowerCase();
1532
- if (key === ' ') {
1533
- key = 'space'; // for readability
1534
- }
1535
- else if (key === '.') {
1536
- key = 'dot'; // because '.' is used as a separator in event names
1537
- }
1538
- MODIFIER_KEYS.forEach(function (modifierName) {
1539
- if (modifierName != key) {
1540
- var modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
1541
- if (modifierGetter(event)) {
1542
- fullKey += modifierName + '.';
1543
- }
1544
- }
1545
- });
1546
- fullKey += key;
1547
- return fullKey;
1548
- };
1549
- /**
1550
- * Configures a handler callback for a key event.
1551
- * @param fullKey The event name that combines all simultaneous keystrokes.
1552
- * @param handler The function that responds to the key event.
1553
- * @param zone The zone in which the event occurred.
1554
- * @returns A callback function.
1555
- */
1556
- KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) {
1557
- return function (event /** TODO #9100 */) {
1558
- if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
1559
- zone.runGuarded(function () { return handler(event); });
1560
- }
1561
- };
1562
- };
1563
- /** @internal */
1564
- KeyEventsPlugin._normalizeKey = function (keyName) {
1565
- // TODO: switch to a Map if the mapping grows too much
1566
- switch (keyName) {
1567
- case 'esc':
1568
- return 'escape';
1569
- default:
1570
- return keyName;
1571
- }
1572
- };
1573
- return KeyEventsPlugin;
1574
- }(EventManagerPlugin));
1575
- KeyEventsPlugin.decorators = [
1576
- { type: i0.Injectable }
1577
- ];
1578
- KeyEventsPlugin.ctorParameters = function () { return [
1579
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
1580
- ]; };
1581
- function getEventKey(event) {
1582
- var key = event.key;
1583
- if (key == null) {
1584
- key = event.keyIdentifier;
1585
- // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
1586
- // Safari cf
1587
- // https://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
1588
- if (key == null) {
1589
- return 'Unidentified';
1590
- }
1591
- if (key.startsWith('U+')) {
1592
- key = String.fromCharCode(parseInt(key.substring(2), 16));
1593
- if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
1594
- // There is a bug in Chrome for numeric keypad keys:
1595
- // https://code.google.com/p/chromium/issues/detail?id=155654
1596
- // 1, 2, 3 ... are reported as A, B, C ...
1597
- key = _chromeNumKeyPadMap[key];
1598
- }
1599
- }
1600
- }
1601
- return _keyMap[key] || key;
1602
- }
1603
-
1604
- /**
1605
- * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
1606
- * values to be safe to use in the different DOM contexts.
1607
- *
1608
- * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
1609
- * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
1610
- * the website.
1611
- *
1612
- * In specific situations, it might be necessary to disable sanitization, for example if the
1613
- * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
1614
- * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
1615
- * methods, and then binding to that value from the template.
1616
- *
1617
- * These situations should be very rare, and extraordinary care must be taken to avoid creating a
1618
- * Cross Site Scripting (XSS) security bug!
1619
- *
1620
- * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
1621
- * close as possible to the source of the value, to make it easy to verify no security bug is
1622
- * created by its use.
1623
- *
1624
- * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
1625
- * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
1626
- * code. The sanitizer leaves safe values intact.
1627
- *
1628
- * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
1629
- * sanitization for the value passed in. Carefully check and audit all values and code paths going
1630
- * into this call. Make sure any user data is appropriately escaped for this security context.
1631
- * For more detail, see the [Security Guide](https://g.co/ng/security).
1632
- *
1633
- * @publicApi
1634
- */
1635
- var DomSanitizer = /** @class */ (function () {
1636
- function DomSanitizer() {
1637
- }
1638
- return DomSanitizer;
1639
- }());
1640
- DomSanitizer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DomSanitizer_Factory() { return i0.ɵɵinject(DomSanitizerImpl); }, token: DomSanitizer, providedIn: "root" });
1641
- DomSanitizer.decorators = [
1642
- { type: i0.Injectable, args: [{ providedIn: 'root', useExisting: i0.forwardRef(function () { return DomSanitizerImpl; }) },] }
1643
- ];
1644
- function domSanitizerImplFactory(injector) {
1645
- return new DomSanitizerImpl(injector.get(common.DOCUMENT));
1646
- }
1647
- var DomSanitizerImpl = /** @class */ (function (_super) {
1648
- __extends(DomSanitizerImpl, _super);
1649
- function DomSanitizerImpl(_doc) {
1650
- var _this = _super.call(this) || this;
1651
- _this._doc = _doc;
1652
- return _this;
1653
- }
1654
- DomSanitizerImpl.prototype.sanitize = function (ctx, value) {
1655
- if (value == null)
1656
- return null;
1657
- switch (ctx) {
1658
- case i0.SecurityContext.NONE:
1659
- return value;
1660
- case i0.SecurityContext.HTML:
1661
- if (i0.ɵallowSanitizationBypassAndThrow(value, "HTML" /* Html */)) {
1662
- return i0.ɵunwrapSafeValue(value);
1663
- }
1664
- return i0.ɵ_sanitizeHtml(this._doc, String(value)).toString();
1665
- case i0.SecurityContext.STYLE:
1666
- if (i0.ɵallowSanitizationBypassAndThrow(value, "Style" /* Style */)) {
1667
- return i0.ɵunwrapSafeValue(value);
1668
- }
1669
- return value;
1670
- case i0.SecurityContext.SCRIPT:
1671
- if (i0.ɵallowSanitizationBypassAndThrow(value, "Script" /* Script */)) {
1672
- return i0.ɵunwrapSafeValue(value);
1673
- }
1674
- throw new Error('unsafe value used in a script context');
1675
- case i0.SecurityContext.URL:
1676
- var type = i0.ɵgetSanitizationBypassType(value);
1677
- if (i0.ɵallowSanitizationBypassAndThrow(value, "URL" /* Url */)) {
1678
- return i0.ɵunwrapSafeValue(value);
1679
- }
1680
- return i0.ɵ_sanitizeUrl(String(value));
1681
- case i0.SecurityContext.RESOURCE_URL:
1682
- if (i0.ɵallowSanitizationBypassAndThrow(value, "ResourceURL" /* ResourceUrl */)) {
1683
- return i0.ɵunwrapSafeValue(value);
1684
- }
1685
- throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
1686
- default:
1687
- throw new Error("Unexpected SecurityContext " + ctx + " (see https://g.co/ng/security#xss)");
1688
- }
1689
- };
1690
- DomSanitizerImpl.prototype.bypassSecurityTrustHtml = function (value) {
1691
- return i0.ɵbypassSanitizationTrustHtml(value);
1692
- };
1693
- DomSanitizerImpl.prototype.bypassSecurityTrustStyle = function (value) {
1694
- return i0.ɵbypassSanitizationTrustStyle(value);
1695
- };
1696
- DomSanitizerImpl.prototype.bypassSecurityTrustScript = function (value) {
1697
- return i0.ɵbypassSanitizationTrustScript(value);
1698
- };
1699
- DomSanitizerImpl.prototype.bypassSecurityTrustUrl = function (value) {
1700
- return i0.ɵbypassSanitizationTrustUrl(value);
1701
- };
1702
- DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = function (value) {
1703
- return i0.ɵbypassSanitizationTrustResourceUrl(value);
1704
- };
1705
- return DomSanitizerImpl;
1706
- }(DomSanitizer));
1707
- DomSanitizerImpl.ɵprov = i0.ɵɵdefineInjectable({ factory: function DomSanitizerImpl_Factory() { return domSanitizerImplFactory(i0.ɵɵinject(i0.INJECTOR)); }, token: DomSanitizerImpl, providedIn: "root" });
1708
- DomSanitizerImpl.decorators = [
1709
- { type: i0.Injectable, args: [{ providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [i0.Injector] },] }
1710
- ];
1711
- DomSanitizerImpl.ctorParameters = function () { return [
1712
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
1713
- ]; };
1714
-
1715
- /**
1716
- * @license
1717
- * Copyright Google LLC All Rights Reserved.
1718
- *
1719
- * Use of this source code is governed by an MIT-style license that can be
1720
- * found in the LICENSE file at https://angular.io/license
1721
- */
1722
- function initDomAdapter() {
1723
- BrowserDomAdapter.makeCurrent();
1724
- BrowserGetTestability.init();
1725
- }
1726
- function errorHandler() {
1727
- return new i0.ErrorHandler();
1728
- }
1729
- function _document() {
1730
- // Tell ivy about the global document
1731
- i0.ɵsetDocument(document);
1732
- return document;
1733
- }
1734
- var ɵ0$3 = common.ɵPLATFORM_BROWSER_ID;
1735
- var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
1736
- { provide: i0.PLATFORM_ID, useValue: ɵ0$3 },
1737
- { provide: i0.PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
1738
- { provide: common.DOCUMENT, useFactory: _document, deps: [] },
1739
- ];
1740
- var BROWSER_SANITIZATION_PROVIDERS__PRE_R3__ = [
1741
- { provide: i0.Sanitizer, useExisting: DomSanitizer },
1742
- { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [common.DOCUMENT] },
1743
- ];
1744
- var BROWSER_SANITIZATION_PROVIDERS__POST_R3__ = [];
1745
- /**
1746
- * @security Replacing built-in sanitization providers exposes the application to XSS risks.
1747
- * Attacker-controlled data introduced by an unsanitized provider could expose your
1748
- * application to XSS risks. For more detail, see the [Security Guide](https://g.co/ng/security).
1749
- * @publicApi
1750
- */
1751
- var BROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS__PRE_R3__;
1752
- /**
1753
- * A factory function that returns a `PlatformRef` instance associated with browser service
1754
- * providers.
1755
- *
1756
- * @publicApi
1757
- */
1758
- var platformBrowser = i0.createPlatformFactory(i0.platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
1759
- var BROWSER_MODULE_PROVIDERS = [
1760
- BROWSER_SANITIZATION_PROVIDERS,
1761
- { provide: i0.ɵINJECTOR_SCOPE, useValue: 'root' },
1762
- { provide: i0.ErrorHandler, useFactory: errorHandler, deps: [] },
1763
- {
1764
- provide: EVENT_MANAGER_PLUGINS,
1765
- useClass: DomEventsPlugin,
1766
- multi: true,
1767
- deps: [common.DOCUMENT, i0.NgZone, i0.PLATFORM_ID]
1768
- },
1769
- { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [common.DOCUMENT] },
1770
- HAMMER_PROVIDERS,
1771
- {
1772
- provide: DomRendererFactory2,
1773
- useClass: DomRendererFactory2,
1774
- deps: [EventManager, DomSharedStylesHost, i0.APP_ID]
1775
- },
1776
- { provide: i0.RendererFactory2, useExisting: DomRendererFactory2 },
1777
- { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
1778
- { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [common.DOCUMENT] },
1779
- { provide: i0.Testability, useClass: i0.Testability, deps: [i0.NgZone] },
1780
- { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, i0.NgZone] },
1781
- { provide: common.XhrFactory, useClass: BrowserXhr, deps: [] },
1782
- ELEMENT_PROBE_PROVIDERS,
1783
- ];
1784
- /**
1785
- * Exports required infrastructure for all Angular apps.
1786
- * Included by default in all Angular apps created with the CLI
1787
- * `new` command.
1788
- * Re-exports `CommonModule` and `ApplicationModule`, making their
1789
- * exports and providers available to all apps.
1790
- *
1791
- * @publicApi
1792
- */
1793
- var BrowserModule = /** @class */ (function () {
1794
- function BrowserModule(parentModule) {
1795
- if (parentModule) {
1796
- throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
1797
- }
1798
- }
1799
- /**
1800
- * Configures a browser-based app to transition from a server-rendered app, if
1801
- * one is present on the page.
1802
- *
1803
- * @param params An object containing an identifier for the app to transition.
1804
- * The ID must match between the client and server versions of the app.
1805
- * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`.
1806
- */
1807
- BrowserModule.withServerTransition = function (params) {
1808
- return {
1809
- ngModule: BrowserModule,
1810
- providers: [
1811
- { provide: i0.APP_ID, useValue: params.appId },
1812
- { provide: TRANSITION_ID, useExisting: i0.APP_ID },
1813
- SERVER_TRANSITION_PROVIDERS,
1814
- ],
1815
- };
1816
- };
1817
- return BrowserModule;
1818
- }());
1819
- BrowserModule.decorators = [
1820
- { type: i0.NgModule, args: [{ providers: BROWSER_MODULE_PROVIDERS, exports: [common.CommonModule, i0.ApplicationModule] },] }
1821
- ];
1822
- BrowserModule.ctorParameters = function () { return [
1823
- { type: BrowserModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }, { type: i0.Inject, args: [BrowserModule,] }] }
1824
- ]; };
1825
-
1826
- /**
1827
- * @license
1828
- * Copyright Google LLC All Rights Reserved.
1829
- *
1830
- * Use of this source code is governed by an MIT-style license that can be
1831
- * found in the LICENSE file at https://angular.io/license
1832
- */
1833
- /**
1834
- * Factory to create a `Meta` service instance for the current DOM document.
1835
- */
1836
- function createMeta() {
1837
- return new Meta(i0.ɵɵinject(common.DOCUMENT));
1838
- }
1839
- /**
1840
- * A service for managing HTML `<meta>` tags.
1841
- *
1842
- * Properties of the `MetaDefinition` object match the attributes of the
1843
- * HTML `<meta>` tag. These tags define document metadata that is important for
1844
- * things like configuring a Content Security Policy, defining browser compatibility
1845
- * and security settings, setting HTTP Headers, defining rich content for social sharing,
1846
- * and Search Engine Optimization (SEO).
1847
- *
1848
- * To identify specific `<meta>` tags in a document, use an attribute selection
1849
- * string in the format `"tag_attribute='value string'"`.
1850
- * For example, an `attrSelector` value of `"name='description'"` matches a tag
1851
- * whose `name` attribute has the value `"description"`.
1852
- * Selectors are used with the `querySelector()` Document method,
1853
- * in the format `meta[{attrSelector}]`.
1854
- *
1855
- * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
1856
- * @see [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
1857
- *
1858
- *
1859
- * @publicApi
1860
- */
1861
- var Meta = /** @class */ (function () {
1862
- function Meta(_doc) {
1863
- this._doc = _doc;
1864
- this._dom = common.ɵgetDOM();
1865
- }
1866
- /**
1867
- * Retrieves or creates a specific `<meta>` tag element in the current HTML document.
1868
- * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
1869
- * values in the provided tag definition, and verifies that all other attribute values are equal.
1870
- * If an existing element is found, it is returned and is not modified in any way.
1871
- * @param tag The definition of a `<meta>` element to match or create.
1872
- * @param forceCreation True to create a new element without checking whether one already exists.
1873
- * @returns The existing element with the same attributes and values if found,
1874
- * the new element if no match is found, or `null` if the tag parameter is not defined.
1875
- */
1876
- Meta.prototype.addTag = function (tag, forceCreation) {
1877
- if (forceCreation === void 0) { forceCreation = false; }
1878
- if (!tag)
1879
- return null;
1880
- return this._getOrCreateElement(tag, forceCreation);
1881
- };
1882
- /**
1883
- * Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
1884
- * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
1885
- * values in the provided tag definition, and verifies that all other attribute values are equal.
1886
- * @param tags An array of tag definitions to match or create.
1887
- * @param forceCreation True to create new elements without checking whether they already exist.
1888
- * @returns The matching elements if found, or the new elements.
1889
- */
1890
- Meta.prototype.addTags = function (tags, forceCreation) {
1891
- var _this = this;
1892
- if (forceCreation === void 0) { forceCreation = false; }
1893
- if (!tags)
1894
- return [];
1895
- return tags.reduce(function (result, tag) {
1896
- if (tag) {
1897
- result.push(_this._getOrCreateElement(tag, forceCreation));
1898
- }
1899
- return result;
1900
- }, []);
1901
- };
1902
- /**
1903
- * Retrieves a `<meta>` tag element in the current HTML document.
1904
- * @param attrSelector The tag attribute and value to match against, in the format
1905
- * `"tag_attribute='value string'"`.
1906
- * @returns The matching element, if any.
1907
- */
1908
- Meta.prototype.getTag = function (attrSelector) {
1909
- if (!attrSelector)
1910
- return null;
1911
- return this._doc.querySelector("meta[" + attrSelector + "]") || null;
1912
- };
1913
- /**
1914
- * Retrieves a set of `<meta>` tag elements in the current HTML document.
1915
- * @param attrSelector The tag attribute and value to match against, in the format
1916
- * `"tag_attribute='value string'"`.
1917
- * @returns The matching elements, if any.
1918
- */
1919
- Meta.prototype.getTags = function (attrSelector) {
1920
- if (!attrSelector)
1921
- return [];
1922
- var list /*NodeList*/ = this._doc.querySelectorAll("meta[" + attrSelector + "]");
1923
- return list ? [].slice.call(list) : [];
1924
- };
1925
- /**
1926
- * Modifies an existing `<meta>` tag element in the current HTML document.
1927
- * @param tag The tag description with which to replace the existing tag content.
1928
- * @param selector A tag attribute and value to match against, to identify
1929
- * an existing tag. A string in the format `"tag_attribute=`value string`"`.
1930
- * If not supplied, matches a tag with the same `name` or `property` attribute value as the
1931
- * replacement tag.
1932
- * @return The modified element.
1933
- */
1934
- Meta.prototype.updateTag = function (tag, selector) {
1935
- if (!tag)
1936
- return null;
1937
- selector = selector || this._parseSelector(tag);
1938
- var meta = this.getTag(selector);
1939
- if (meta) {
1940
- return this._setMetaElementAttributes(tag, meta);
1941
- }
1942
- return this._getOrCreateElement(tag, true);
1943
- };
1944
- /**
1945
- * Removes an existing `<meta>` tag element from the current HTML document.
1946
- * @param attrSelector A tag attribute and value to match against, to identify
1947
- * an existing tag. A string in the format `"tag_attribute=`value string`"`.
1948
- */
1949
- Meta.prototype.removeTag = function (attrSelector) {
1950
- this.removeTagElement(this.getTag(attrSelector));
1951
- };
1952
- /**
1953
- * Removes an existing `<meta>` tag element from the current HTML document.
1954
- * @param meta The tag definition to match against to identify an existing tag.
1955
- */
1956
- Meta.prototype.removeTagElement = function (meta) {
1957
- if (meta) {
1958
- this._dom.remove(meta);
1959
- }
1960
- };
1961
- Meta.prototype._getOrCreateElement = function (meta, forceCreation) {
1962
- var _this = this;
1963
- if (forceCreation === void 0) { forceCreation = false; }
1964
- if (!forceCreation) {
1965
- var selector = this._parseSelector(meta);
1966
- // It's allowed to have multiple elements with the same name so it's not enough to
1967
- // just check that element with the same name already present on the page. We also need to
1968
- // check if element has tag attributes
1969
- var elem = this.getTags(selector).filter(function (elem) { return _this._containsAttributes(meta, elem); })[0];
1970
- if (elem !== undefined)
1971
- return elem;
1972
- }
1973
- var element = this._dom.createElement('meta');
1974
- this._setMetaElementAttributes(meta, element);
1975
- var head = this._doc.getElementsByTagName('head')[0];
1976
- head.appendChild(element);
1977
- return element;
1978
- };
1979
- Meta.prototype._setMetaElementAttributes = function (tag, el) {
1980
- var _this = this;
1981
- Object.keys(tag).forEach(function (prop) { return el.setAttribute(_this._getMetaKeyMap(prop), tag[prop]); });
1982
- return el;
1983
- };
1984
- Meta.prototype._parseSelector = function (tag) {
1985
- var attr = tag.name ? 'name' : 'property';
1986
- return attr + "=\"" + tag[attr] + "\"";
1987
- };
1988
- Meta.prototype._containsAttributes = function (tag, elem) {
1989
- var _this = this;
1990
- return Object.keys(tag).every(function (key) { return elem.getAttribute(_this._getMetaKeyMap(key)) === tag[key]; });
1991
- };
1992
- Meta.prototype._getMetaKeyMap = function (prop) {
1993
- return META_KEYS_MAP[prop] || prop;
1994
- };
1995
- return Meta;
1996
- }());
1997
- Meta.ɵprov = i0.ɵɵdefineInjectable({ factory: createMeta, token: Meta, providedIn: "root" });
1998
- Meta.decorators = [
1999
- { type: i0.Injectable, args: [{ providedIn: 'root', useFactory: createMeta, deps: [] },] }
2000
- ];
2001
- Meta.ctorParameters = function () { return [
2002
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
2003
- ]; };
2004
- /**
2005
- * Mapping for MetaDefinition properties with their correct meta attribute names
2006
- */
2007
- var META_KEYS_MAP = {
2008
- httpEquiv: 'http-equiv'
2009
- };
2010
-
2011
- /**
2012
- * @license
2013
- * Copyright Google LLC All Rights Reserved.
2014
- *
2015
- * Use of this source code is governed by an MIT-style license that can be
2016
- * found in the LICENSE file at https://angular.io/license
2017
- */
2018
- /**
2019
- * Factory to create Title service.
2020
- */
2021
- function createTitle() {
2022
- return new Title(i0.ɵɵinject(common.DOCUMENT));
2023
- }
2024
- /**
2025
- * A service that can be used to get and set the title of a current HTML document.
2026
- *
2027
- * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
2028
- * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
2029
- * (representing the `<title>` tag). Instead, this service can be used to set and get the current
2030
- * title value.
2031
- *
2032
- * @publicApi
2033
- */
2034
- var Title = /** @class */ (function () {
2035
- function Title(_doc) {
2036
- this._doc = _doc;
2037
- }
2038
- /**
2039
- * Get the title of the current HTML document.
2040
- */
2041
- Title.prototype.getTitle = function () {
2042
- return this._doc.title;
2043
- };
2044
- /**
2045
- * Set the title of the current HTML document.
2046
- * @param newTitle
2047
- */
2048
- Title.prototype.setTitle = function (newTitle) {
2049
- this._doc.title = newTitle || '';
2050
- };
2051
- return Title;
2052
- }());
2053
- Title.ɵprov = i0.ɵɵdefineInjectable({ factory: createTitle, token: Title, providedIn: "root" });
2054
- Title.decorators = [
2055
- { type: i0.Injectable, args: [{ providedIn: 'root', useFactory: createTitle, deps: [] },] }
2056
- ];
2057
- Title.ctorParameters = function () { return [
2058
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
2059
- ]; };
2060
-
2061
- /**
2062
- * @license
2063
- * Copyright Google LLC All Rights Reserved.
2064
- *
2065
- * Use of this source code is governed by an MIT-style license that can be
2066
- * found in the LICENSE file at https://angular.io/license
2067
- */
2068
- var win = typeof window !== 'undefined' && window || {};
2069
-
2070
- /**
2071
- * @license
2072
- * Copyright Google LLC All Rights Reserved.
2073
- *
2074
- * Use of this source code is governed by an MIT-style license that can be
2075
- * found in the LICENSE file at https://angular.io/license
2076
- */
2077
- var ChangeDetectionPerfRecord = /** @class */ (function () {
2078
- function ChangeDetectionPerfRecord(msPerTick, numTicks) {
2079
- this.msPerTick = msPerTick;
2080
- this.numTicks = numTicks;
2081
- }
2082
- return ChangeDetectionPerfRecord;
2083
- }());
2084
- /**
2085
- * Entry point for all Angular profiling-related debug tools. This object
2086
- * corresponds to the `ng.profiler` in the dev console.
2087
- */
2088
- var AngularProfiler = /** @class */ (function () {
2089
- function AngularProfiler(ref) {
2090
- this.appRef = ref.injector.get(i0.ApplicationRef);
2091
- }
2092
- // tslint:disable:no-console
2093
- /**
2094
- * Exercises change detection in a loop and then prints the average amount of
2095
- * time in milliseconds how long a single round of change detection takes for
2096
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
2097
- * of 500 milliseconds.
2098
- *
2099
- * Optionally, a user may pass a `config` parameter containing a map of
2100
- * options. Supported options are:
2101
- *
2102
- * `record` (boolean) - causes the profiler to record a CPU profile while
2103
- * it exercises the change detector. Example:
2104
- *
2105
- * ```
2106
- * ng.profiler.timeChangeDetection({record: true})
2107
- * ```
2108
- */
2109
- AngularProfiler.prototype.timeChangeDetection = function (config) {
2110
- var record = config && config['record'];
2111
- var profileName = 'Change Detection';
2112
- // Profiler is not available in Android browsers without dev tools opened
2113
- var isProfilerAvailable = win.console.profile != null;
2114
- if (record && isProfilerAvailable) {
2115
- win.console.profile(profileName);
2116
- }
2117
- var start = performanceNow();
2118
- var numTicks = 0;
2119
- while (numTicks < 5 || (performanceNow() - start) < 500) {
2120
- this.appRef.tick();
2121
- numTicks++;
2122
- }
2123
- var end = performanceNow();
2124
- if (record && isProfilerAvailable) {
2125
- win.console.profileEnd(profileName);
2126
- }
2127
- var msPerTick = (end - start) / numTicks;
2128
- win.console.log("ran " + numTicks + " change detection cycles");
2129
- win.console.log(msPerTick.toFixed(2) + " ms per check");
2130
- return new ChangeDetectionPerfRecord(msPerTick, numTicks);
2131
- };
2132
- return AngularProfiler;
2133
- }());
2134
- function performanceNow() {
2135
- return win.performance && win.performance.now ? win.performance.now() :
2136
- new Date().getTime();
2137
- }
2138
-
2139
- /**
2140
- * @license
2141
- * Copyright Google LLC All Rights Reserved.
2142
- *
2143
- * Use of this source code is governed by an MIT-style license that can be
2144
- * found in the LICENSE file at https://angular.io/license
2145
- */
2146
- var PROFILER_GLOBAL_NAME = 'profiler';
2147
- /**
2148
- * Enabled Angular debug tools that are accessible via your browser's
2149
- * developer console.
2150
- *
2151
- * Usage:
2152
- *
2153
- * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
2154
- * 1. Type `ng.` (usually the console will show auto-complete suggestion)
2155
- * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
2156
- * then hit Enter.
2157
- *
2158
- * @publicApi
2159
- */
2160
- function enableDebugTools(ref) {
2161
- exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
2162
- return ref;
2163
- }
2164
- /**
2165
- * Disables Angular tools.
2166
- *
2167
- * @publicApi
2168
- */
2169
- function disableDebugTools() {
2170
- exportNgVar(PROFILER_GLOBAL_NAME, null);
2171
- }
2172
-
2173
- /**
2174
- * @license
2175
- * Copyright Google LLC All Rights Reserved.
2176
- *
2177
- * Use of this source code is governed by an MIT-style license that can be
2178
- * found in the LICENSE file at https://angular.io/license
2179
- */
2180
- function escapeHtml(text) {
2181
- var escapedText = {
2182
- '&': '&a;',
2183
- '"': '&q;',
2184
- '\'': '&s;',
2185
- '<': '&l;',
2186
- '>': '&g;',
2187
- };
2188
- return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
2189
- }
2190
- function unescapeHtml(text) {
2191
- var unescapedText = {
2192
- '&a;': '&',
2193
- '&q;': '"',
2194
- '&s;': '\'',
2195
- '&l;': '<',
2196
- '&g;': '>',
2197
- };
2198
- return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
2199
- }
2200
- /**
2201
- * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
2202
- *
2203
- * Example:
2204
- *
2205
- * ```
2206
- * const COUNTER_KEY = makeStateKey<number>('counter');
2207
- * let value = 10;
2208
- *
2209
- * transferState.set(COUNTER_KEY, value);
2210
- * ```
2211
- *
2212
- * @publicApi
2213
- */
2214
- function makeStateKey(key) {
2215
- return key;
2216
- }
2217
- /**
2218
- * A key value store that is transferred from the application on the server side to the application
2219
- * on the client side.
2220
- *
2221
- * `TransferState` will be available as an injectable token. To use it import
2222
- * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
2223
- *
2224
- * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
2225
- * boolean, number, string, null and non-class objects will be serialized and deserialized in a
2226
- * non-lossy manner.
2227
- *
2228
- * @publicApi
2229
- */
2230
- var TransferState = /** @class */ (function () {
2231
- function TransferState() {
2232
- this.store = {};
2233
- this.onSerializeCallbacks = {};
2234
- }
2235
- /** @internal */
2236
- TransferState.init = function (initState) {
2237
- var transferState = new TransferState();
2238
- transferState.store = initState;
2239
- return transferState;
2240
- };
2241
- /**
2242
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
2243
- */
2244
- TransferState.prototype.get = function (key, defaultValue) {
2245
- return this.store[key] !== undefined ? this.store[key] : defaultValue;
2246
- };
2247
- /**
2248
- * Set the value corresponding to a key.
2249
- */
2250
- TransferState.prototype.set = function (key, value) {
2251
- this.store[key] = value;
2252
- };
2253
- /**
2254
- * Remove a key from the store.
2255
- */
2256
- TransferState.prototype.remove = function (key) {
2257
- delete this.store[key];
2258
- };
2259
- /**
2260
- * Test whether a key exists in the store.
2261
- */
2262
- TransferState.prototype.hasKey = function (key) {
2263
- return this.store.hasOwnProperty(key);
2264
- };
2265
- /**
2266
- * Register a callback to provide the value for a key when `toJson` is called.
2267
- */
2268
- TransferState.prototype.onSerialize = function (key, callback) {
2269
- this.onSerializeCallbacks[key] = callback;
2270
- };
2271
- /**
2272
- * Serialize the current state of the store to JSON.
2273
- */
2274
- TransferState.prototype.toJson = function () {
2275
- // Call the onSerialize callbacks and put those values into the store.
2276
- for (var key in this.onSerializeCallbacks) {
2277
- if (this.onSerializeCallbacks.hasOwnProperty(key)) {
2278
- try {
2279
- this.store[key] = this.onSerializeCallbacks[key]();
2280
- }
2281
- catch (e) {
2282
- console.warn('Exception in onSerialize callback: ', e);
2283
- }
2284
- }
2285
- }
2286
- return JSON.stringify(this.store);
2287
- };
2288
- return TransferState;
2289
- }());
2290
- TransferState.decorators = [
2291
- { type: i0.Injectable }
2292
- ];
2293
- function initTransferState(doc, appId) {
2294
- // Locate the script tag with the JSON data transferred from the server.
2295
- // The id of the script tag is set to the Angular appId + 'state'.
2296
- var script = doc.getElementById(appId + '-state');
2297
- var initialState = {};
2298
- if (script && script.textContent) {
2299
- try {
2300
- // Avoid using any here as it triggers lint errors in google3 (any is not allowed).
2301
- initialState = JSON.parse(unescapeHtml(script.textContent));
2302
- }
2303
- catch (e) {
2304
- console.warn('Exception while restoring TransferState for app ' + appId, e);
2305
- }
2306
- }
2307
- return TransferState.init(initialState);
2308
- }
2309
- /**
2310
- * NgModule to install on the client side while using the `TransferState` to transfer state from
2311
- * server to client.
2312
- *
2313
- * @publicApi
2314
- */
2315
- var BrowserTransferStateModule = /** @class */ (function () {
2316
- function BrowserTransferStateModule() {
2317
- }
2318
- return BrowserTransferStateModule;
2319
- }());
2320
- BrowserTransferStateModule.decorators = [
2321
- { type: i0.NgModule, args: [{
2322
- providers: [{ provide: TransferState, useFactory: initTransferState, deps: [common.DOCUMENT, i0.APP_ID] }],
2323
- },] }
2324
- ];
2325
-
2326
- /**
2327
- * @license
2328
- * Copyright Google LLC All Rights Reserved.
2329
- *
2330
- * Use of this source code is governed by an MIT-style license that can be
2331
- * found in the LICENSE file at https://angular.io/license
2332
- */
2333
- /**
2334
- * Predicates for use with {@link DebugElement}'s query functions.
2335
- *
2336
- * @publicApi
2337
- */
2338
- var By = /** @class */ (function () {
2339
- function By() {
2340
- }
2341
- /**
2342
- * Match all nodes.
2343
- *
2344
- * @usageNotes
2345
- * ### Example
2346
- *
2347
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
2348
- */
2349
- By.all = function () {
2350
- return function () { return true; };
2351
- };
2352
- /**
2353
- * Match elements by the given CSS selector.
2354
- *
2355
- * @usageNotes
2356
- * ### Example
2357
- *
2358
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
2359
- */
2360
- By.css = function (selector) {
2361
- return function (debugElement) {
2362
- return debugElement.nativeElement != null ?
2363
- elementMatches(debugElement.nativeElement, selector) :
2364
- false;
2365
- };
2366
- };
2367
- /**
2368
- * Match nodes that have the given directive present.
2369
- *
2370
- * @usageNotes
2371
- * ### Example
2372
- *
2373
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
2374
- */
2375
- By.directive = function (type) {
2376
- return function (debugNode) { return debugNode.providerTokens.indexOf(type) !== -1; };
2377
- };
2378
- return By;
2379
- }());
2380
- function elementMatches(n, selector) {
2381
- if (common.ɵgetDOM().isElementNode(n)) {
2382
- return n.matches && n.matches(selector) ||
2383
- n.msMatchesSelector && n.msMatchesSelector(selector) ||
2384
- n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
2385
- }
2386
- return false;
2387
- }
2388
-
2389
- /**
2390
- * @license
2391
- * Copyright Google LLC All Rights Reserved.
2392
- *
2393
- * Use of this source code is governed by an MIT-style license that can be
2394
- * found in the LICENSE file at https://angular.io/license
2395
- */
2396
-
2397
- /**
2398
- * @license
2399
- * Copyright Google LLC All Rights Reserved.
2400
- *
2401
- * Use of this source code is governed by an MIT-style license that can be
2402
- * found in the LICENSE file at https://angular.io/license
2403
- */
2404
- /**
2405
- * @publicApi
2406
- */
2407
- var VERSION = new i0.Version('13.0.0-next.0');
2408
-
2409
- /**
2410
- * @license
2411
- * Copyright Google LLC All Rights Reserved.
2412
- *
2413
- * Use of this source code is governed by an MIT-style license that can be
2414
- * found in the LICENSE file at https://angular.io/license
2415
- */
2416
-
2417
- /**
2418
- * @license
2419
- * Copyright Google LLC All Rights Reserved.
2420
- *
2421
- * Use of this source code is governed by an MIT-style license that can be
2422
- * found in the LICENSE file at https://angular.io/license
2423
- */
2424
- // This file only reexports content of the `src` folder. Keep it that way.
2425
-
2426
- /**
2427
- * @license
2428
- * Copyright Google LLC All Rights Reserved.
2429
- *
2430
- * Use of this source code is governed by an MIT-style license that can be
2431
- * found in the LICENSE file at https://angular.io/license
2432
- */
2433
-
2434
- /**
2435
- * Generated bundle index. Do not edit.
2436
- */
2437
-
2438
- Object.defineProperty(exports, 'ɵgetDOM', {
2439
- enumerable: true,
2440
- get: function () {
2441
- return common.ɵgetDOM;
2442
- }
2443
- });
2444
- exports.BrowserModule = BrowserModule;
2445
- exports.BrowserTransferStateModule = BrowserTransferStateModule;
2446
- exports.By = By;
2447
- exports.DomSanitizer = DomSanitizer;
2448
- exports.EVENT_MANAGER_PLUGINS = EVENT_MANAGER_PLUGINS;
2449
- exports.EventManager = EventManager;
2450
- exports.HAMMER_GESTURE_CONFIG = HAMMER_GESTURE_CONFIG;
2451
- exports.HAMMER_LOADER = HAMMER_LOADER;
2452
- exports.HammerGestureConfig = HammerGestureConfig;
2453
- exports.HammerModule = HammerModule;
2454
- exports.Meta = Meta;
2455
- exports.Title = Title;
2456
- exports.TransferState = TransferState;
2457
- exports.VERSION = VERSION;
2458
- exports.disableDebugTools = disableDebugTools;
2459
- exports.enableDebugTools = enableDebugTools;
2460
- exports.makeStateKey = makeStateKey;
2461
- exports.platformBrowser = platformBrowser;
2462
- exports.ɵBROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS;
2463
- exports.ɵBROWSER_SANITIZATION_PROVIDERS__POST_R3__ = BROWSER_SANITIZATION_PROVIDERS__POST_R3__;
2464
- exports.ɵBrowserDomAdapter = BrowserDomAdapter;
2465
- exports.ɵBrowserGetTestability = BrowserGetTestability;
2466
- exports.ɵDomEventsPlugin = DomEventsPlugin;
2467
- exports.ɵDomRendererFactory2 = DomRendererFactory2;
2468
- exports.ɵDomSanitizerImpl = DomSanitizerImpl;
2469
- exports.ɵDomSharedStylesHost = DomSharedStylesHost;
2470
- exports.ɵELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS;
2471
- exports.ɵELEMENT_PROBE_PROVIDERS__POST_R3__ = ELEMENT_PROBE_PROVIDERS__POST_R3__;
2472
- exports.ɵHAMMER_PROVIDERS__POST_R3__ = HAMMER_PROVIDERS__POST_R3__;
2473
- exports.ɵHammerGesturesPlugin = HammerGesturesPlugin;
2474
- exports.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS = INTERNAL_BROWSER_PLATFORM_PROVIDERS;
2475
- exports.ɵKeyEventsPlugin = KeyEventsPlugin;
2476
- exports.ɵNAMESPACE_URIS = NAMESPACE_URIS;
2477
- exports.ɵSharedStylesHost = SharedStylesHost;
2478
- exports.ɵTRANSITION_ID = TRANSITION_ID;
2479
- exports.ɵangular_packages_platform_browser_platform_browser_a = errorHandler;
2480
- exports.ɵangular_packages_platform_browser_platform_browser_b = _document;
2481
- exports.ɵangular_packages_platform_browser_platform_browser_c = BROWSER_MODULE_PROVIDERS;
2482
- exports.ɵangular_packages_platform_browser_platform_browser_d = createMeta;
2483
- exports.ɵangular_packages_platform_browser_platform_browser_e = createTitle;
2484
- exports.ɵangular_packages_platform_browser_platform_browser_f = initTransferState;
2485
- exports.ɵangular_packages_platform_browser_platform_browser_g = EventManagerPlugin;
2486
- exports.ɵangular_packages_platform_browser_platform_browser_h = HAMMER_PROVIDERS__PRE_R3__;
2487
- exports.ɵangular_packages_platform_browser_platform_browser_i = HAMMER_PROVIDERS;
2488
- exports.ɵangular_packages_platform_browser_platform_browser_j = domSanitizerImplFactory;
2489
- exports.ɵangular_packages_platform_browser_platform_browser_k = appInitializerFactory;
2490
- exports.ɵangular_packages_platform_browser_platform_browser_l = SERVER_TRANSITION_PROVIDERS;
2491
- exports.ɵangular_packages_platform_browser_platform_browser_m = _createNgProbeR2;
2492
- exports.ɵangular_packages_platform_browser_platform_browser_n = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
2493
- exports.ɵangular_packages_platform_browser_platform_browser_o = BrowserXhr;
2494
- exports.ɵangular_packages_platform_browser_platform_browser_p = GenericBrowserDomAdapter;
2495
- exports.ɵescapeHtml = escapeHtml;
2496
- exports.ɵflattenStyles = flattenStyles;
2497
- exports.ɵinitDomAdapter = initDomAdapter;
2498
- exports.ɵshimContentAttribute = shimContentAttribute;
2499
- exports.ɵshimHostAttribute = shimHostAttribute;
2500
-
2501
- Object.defineProperty(exports, '__esModule', { value: true });
2502
-
2503
- })));
2504
- //# sourceMappingURL=platform-browser.umd.js.map