@angular/platform-browser 13.0.0-next.8 → 13.0.0-rc.2

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