1
|
/**
|
2
|
* @license Angular v4.4.6
|
3
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
4
|
* License: MIT
|
5
|
*/
|
6
|
(function (global, factory) {
|
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Observable'), require('rxjs/observable/merge'), require('rxjs/operator/share'), require('rxjs/Subject')) :
|
8
|
typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Observable', 'rxjs/observable/merge', 'rxjs/operator/share', 'rxjs/Subject'], factory) :
|
9
|
(factory((global.ng = global.ng || {}, global.ng.core = global.ng.core || {}),global.Rx,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx));
|
10
|
}(this, (function (exports,rxjs_Observable,rxjs_observable_merge,rxjs_operator_share,rxjs_Subject) { 'use strict';
|
11
|
|
12
|
/*! *****************************************************************************
|
13
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
14
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
15
|
this file except in compliance with the License. You may obtain a copy of the
|
16
|
License at http://www.apache.org/licenses/LICENSE-2.0
|
17
|
|
18
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
19
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
20
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
21
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
22
|
|
23
|
See the Apache Version 2.0 License for specific language governing permissions
|
24
|
and limitations under the License.
|
25
|
***************************************************************************** */
|
26
|
/* global Reflect, Promise */
|
27
|
|
28
|
var extendStatics = Object.setPrototypeOf ||
|
29
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
30
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31
|
|
32
|
function __extends(d, b) {
|
33
|
extendStatics(d, b);
|
34
|
function __() { this.constructor = d; }
|
35
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* @license Angular v4.4.6
|
40
|
* (c) 2010-2017 Google, Inc. https://angular.io/
|
41
|
* License: MIT
|
42
|
*/
|
43
|
/**
|
44
|
* Creates a token that can be used in a DI Provider.
|
45
|
*
|
46
|
* ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview))
|
47
|
*
|
48
|
* ```typescript
|
49
|
* var t = new OpaqueToken("value");
|
50
|
*
|
51
|
* var injector = Injector.resolveAndCreate([
|
52
|
* {provide: t, useValue: "bindingValue"}
|
53
|
* ]);
|
54
|
*
|
55
|
* expect(injector.get(t)).toEqual("bindingValue");
|
56
|
* ```
|
57
|
*
|
58
|
* Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions
|
59
|
* caused by multiple providers using the same string as two different tokens.
|
60
|
*
|
61
|
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
|
62
|
* error messages.
|
63
|
* @deprecated since v4.0.0 because it does not support type information, use `InjectionToken<?>`
|
64
|
* instead.
|
65
|
*/
|
66
|
var OpaqueToken = (function () {
|
67
|
/**
|
68
|
* @param {?} _desc
|
69
|
*/
|
70
|
function OpaqueToken(_desc) {
|
71
|
this._desc = _desc;
|
72
|
}
|
73
|
/**
|
74
|
* @return {?}
|
75
|
*/
|
76
|
OpaqueToken.prototype.toString = function () { return "Token " + this._desc; };
|
77
|
return OpaqueToken;
|
78
|
}());
|
79
|
/**
|
80
|
* Creates a token that can be used in a DI Provider.
|
81
|
*
|
82
|
* Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
|
83
|
* runtime representation) such as when injecting an interface, callable type, array or
|
84
|
* parametrized type.
|
85
|
*
|
86
|
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
|
87
|
* the `Injector`. This provides additional level of type safety.
|
88
|
*
|
89
|
* ```
|
90
|
* interface MyInterface {...}
|
91
|
* var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
|
92
|
* // myInterface is inferred to be MyInterface.
|
93
|
* ```
|
94
|
*
|
95
|
* ### Example
|
96
|
*
|
97
|
* {\@example core/di/ts/injector_spec.ts region='InjectionToken'}
|
98
|
*
|
99
|
* \@stable
|
100
|
*/
|
101
|
var InjectionToken = (function (_super) {
|
102
|
__extends(InjectionToken, _super);
|
103
|
/**
|
104
|
* @param {?} desc
|
105
|
*/
|
106
|
function InjectionToken(desc) {
|
107
|
return _super.call(this, desc) || this;
|
108
|
}
|
109
|
/**
|
110
|
* @return {?}
|
111
|
*/
|
112
|
InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; };
|
113
|
return InjectionToken;
|
114
|
}(OpaqueToken));
|
115
|
/**
|
116
|
* @license
|
117
|
* Copyright Google Inc. All Rights Reserved.
|
118
|
*
|
119
|
* Use of this source code is governed by an MIT-style license that can be
|
120
|
* found in the LICENSE file at https://angular.io/license
|
121
|
*/
|
122
|
var __window = typeof window !== 'undefined' && window;
|
123
|
var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
124
|
self instanceof WorkerGlobalScope && self;
|
125
|
var __global = typeof global !== 'undefined' && global;
|
126
|
var _global = __window || __global || __self;
|
127
|
var _symbolIterator = null;
|
128
|
/**
|
129
|
* @return {?}
|
130
|
*/
|
131
|
function getSymbolIterator() {
|
132
|
if (!_symbolIterator) {
|
133
|
var /** @type {?} */ Symbol = _global['Symbol'];
|
134
|
if (Symbol && Symbol.iterator) {
|
135
|
_symbolIterator = Symbol.iterator;
|
136
|
}
|
137
|
else {
|
138
|
// es6-shim specific logic
|
139
|
var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
|
140
|
for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
|
141
|
var /** @type {?} */ key = keys[i];
|
142
|
if (key !== 'entries' && key !== 'size' &&
|
143
|
((Map)).prototype[key] === Map.prototype['entries']) {
|
144
|
_symbolIterator = key;
|
145
|
}
|
146
|
}
|
147
|
}
|
148
|
}
|
149
|
return _symbolIterator;
|
150
|
}
|
151
|
/**
|
152
|
* @param {?} fn
|
153
|
* @return {?}
|
154
|
*/
|
155
|
function scheduleMicroTask(fn) {
|
156
|
Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
157
|
}
|
158
|
/**
|
159
|
* @param {?} a
|
160
|
* @param {?} b
|
161
|
* @return {?}
|
162
|
*/
|
163
|
function looseIdentical(a, b) {
|
164
|
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
165
|
}
|
166
|
/**
|
167
|
* @param {?} token
|
168
|
* @return {?}
|
169
|
*/
|
170
|
function stringify(token) {
|
171
|
if (typeof token === 'string') {
|
172
|
return token;
|
173
|
}
|
174
|
if (token == null) {
|
175
|
return '' + token;
|
176
|
}
|
177
|
if (token.overriddenName) {
|
178
|
return "" + token.overriddenName;
|
179
|
}
|
180
|
if (token.name) {
|
181
|
return "" + token.name;
|
182
|
}
|
183
|
var /** @type {?} */ res = token.toString();
|
184
|
if (res == null) {
|
185
|
return '' + res;
|
186
|
}
|
187
|
var /** @type {?} */ newLineIndex = res.indexOf('\n');
|
188
|
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
189
|
}
|
190
|
/**
|
191
|
* @license
|
192
|
* Copyright Google Inc. All Rights Reserved.
|
193
|
*
|
194
|
* Use of this source code is governed by an MIT-style license that can be
|
195
|
* found in the LICENSE file at https://angular.io/license
|
196
|
*/
|
197
|
var _nextClassId = 0;
|
198
|
var Reflect$1 = _global['Reflect'];
|
199
|
/**
|
200
|
* @param {?} annotation
|
201
|
* @return {?}
|
202
|
*/
|
203
|
function extractAnnotation(annotation) {
|
204
|
if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {
|
205
|
// it is a decorator, extract annotation
|
206
|
annotation = annotation.annotation;
|
207
|
}
|
208
|
return annotation;
|
209
|
}
|
210
|
/**
|
211
|
* @param {?} fnOrArray
|
212
|
* @param {?} key
|
213
|
* @return {?}
|
214
|
*/
|
215
|
function applyParams(fnOrArray, key) {
|
216
|
if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function ||
|
217
|
fnOrArray === Number || fnOrArray === Array) {
|
218
|
throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor");
|
219
|
}
|
220
|
if (typeof fnOrArray === 'function') {
|
221
|
return fnOrArray;
|
222
|
}
|
223
|
if (Array.isArray(fnOrArray)) {
|
224
|
var /** @type {?} */ annotations = (fnOrArray);
|
225
|
var /** @type {?} */ annoLength = annotations.length - 1;
|
226
|
var /** @type {?} */ fn = fnOrArray[annoLength];
|
227
|
if (typeof fn !== 'function') {
|
228
|
throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'");
|
229
|
}
|
230
|
if (annoLength != fn.length) {
|
231
|
throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn));
|
232
|
}
|
233
|
var /** @type {?} */ paramsAnnotations = [];
|
234
|
for (var /** @type {?} */ i = 0, /** @type {?} */ ii = annotations.length - 1; i < ii; i++) {
|
235
|
var /** @type {?} */ paramAnnotations = [];
|
236
|
paramsAnnotations.push(paramAnnotations);
|
237
|
var /** @type {?} */ annotation = annotations[i];
|
238
|
if (Array.isArray(annotation)) {
|
239
|
for (var /** @type {?} */ j = 0; j < annotation.length; j++) {
|
240
|
paramAnnotations.push(extractAnnotation(annotation[j]));
|
241
|
}
|
242
|
}
|
243
|
else if (typeof annotation === 'function') {
|
244
|
paramAnnotations.push(extractAnnotation(annotation));
|
245
|
}
|
246
|
else {
|
247
|
paramAnnotations.push(annotation);
|
248
|
}
|
249
|
}
|
250
|
Reflect$1.defineMetadata('parameters', paramsAnnotations, fn);
|
251
|
return fn;
|
252
|
}
|
253
|
throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'");
|
254
|
}
|
255
|
/**
|
256
|
* Provides a way for expressing ES6 classes with parameter annotations in ES5.
|
257
|
*
|
258
|
* ## Basic Example
|
259
|
*
|
260
|
* ```
|
261
|
* var Greeter = ng.Class({
|
262
|
* constructor: function(name) {
|
263
|
* this.name = name;
|
264
|
* },
|
265
|
*
|
266
|
* greet: function() {
|
267
|
* alert('Hello ' + this.name + '!');
|
268
|
* }
|
269
|
* });
|
270
|
* ```
|
271
|
*
|
272
|
* is equivalent to ES6:
|
273
|
*
|
274
|
* ```
|
275
|
* class Greeter {
|
276
|
* constructor(name) {
|
277
|
* this.name = name;
|
278
|
* }
|
279
|
*
|
280
|
* greet() {
|
281
|
* alert('Hello ' + this.name + '!');
|
282
|
* }
|
283
|
* }
|
284
|
* ```
|
285
|
*
|
286
|
* or equivalent to ES5:
|
287
|
*
|
288
|
* ```
|
289
|
* var Greeter = function (name) {
|
290
|
* this.name = name;
|
291
|
* }
|
292
|
*
|
293
|
* Greeter.prototype.greet = function () {
|
294
|
* alert('Hello ' + this.name + '!');
|
295
|
* }
|
296
|
* ```
|
297
|
*
|
298
|
* ### Example with parameter annotations
|
299
|
*
|
300
|
* ```
|
301
|
* var MyService = ng.Class({
|
302
|
* constructor: [String, [new Optional(), Service], function(name, myService) {
|
303
|
* ...
|
304
|
* }]
|
305
|
* });
|
306
|
* ```
|
307
|
*
|
308
|
* is equivalent to ES6:
|
309
|
*
|
310
|
* ```
|
311
|
* class MyService {
|
312
|
* constructor(name: string, \@Optional() myService: Service) {
|
313
|
* ...
|
314
|
* }
|
315
|
* }
|
316
|
* ```
|
317
|
*
|
318
|
* ### Example with inheritance
|
319
|
*
|
320
|
* ```
|
321
|
* var Shape = ng.Class({
|
322
|
* constructor: (color) {
|
323
|
* this.color = color;
|
324
|
* }
|
325
|
* });
|
326
|
*
|
327
|
* var Square = ng.Class({
|
328
|
* extends: Shape,
|
329
|
* constructor: function(color, size) {
|
330
|
* Shape.call(this, color);
|
331
|
* this.size = size;
|
332
|
* }
|
333
|
* });
|
334
|
* ```
|
335
|
* @suppress {globalThis}
|
336
|
* \@stable
|
337
|
* @param {?} clsDef
|
338
|
* @return {?}
|
339
|
*/
|
340
|
function Class(clsDef) {
|
341
|
var /** @type {?} */ constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
|
342
|
var /** @type {?} */ proto = constructor.prototype;
|
343
|
if (clsDef.hasOwnProperty('extends')) {
|
344
|
if (typeof clsDef.extends === 'function') {
|
345
|
((constructor)).prototype = proto =
|
346
|
Object.create(((clsDef.extends)).prototype);
|
347
|
}
|
348
|
else {
|
349
|
throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends));
|
350
|
}
|
351
|
}
|
352
|
for (var /** @type {?} */ key in clsDef) {
|
353
|
if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) {
|
354
|
proto[key] = applyParams(clsDef[key], key);
|
355
|
}
|
356
|
}
|
357
|
if (this && this.annotations instanceof Array) {
|
358
|
Reflect$1.defineMetadata('annotations', this.annotations, constructor);
|
359
|
}
|
360
|
var /** @type {?} */ constructorName = constructor['name'];
|
361
|
if (!constructorName || constructorName === 'constructor') {
|
362
|
((constructor))['overriddenName'] = "class" + _nextClassId++;
|
363
|
}
|
364
|
return (constructor);
|
365
|
}
|
366
|
/**
|
367
|
* @suppress {globalThis}
|
368
|
* @param {?} name
|
369
|
* @param {?=} props
|
370
|
* @param {?=} parentClass
|
371
|
* @param {?=} chainFn
|
372
|
* @return {?}
|
373
|
*/
|
374
|
function makeDecorator(name, props, parentClass, chainFn) {
|
375
|
var /** @type {?} */ metaCtor = makeMetadataCtor(props);
|
376
|
/**
|
377
|
* @param {?} objOrType
|
378
|
* @return {?}
|
379
|
*/
|
380
|
function DecoratorFactory(objOrType) {
|
381
|
if (!(Reflect$1 && Reflect$1.getOwnMetadata)) {
|
382
|
throw 'reflect-metadata shim is required when using class decorators';
|
383
|
}
|
384
|
if (this instanceof DecoratorFactory) {
|
385
|
metaCtor.call(this, objOrType);
|
386
|
return this;
|
387
|
}
|
388
|
var /** @type {?} */ annotationInstance = new ((DecoratorFactory))(objOrType);
|
389
|
var /** @type {?} */ chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : [];
|
390
|
chainAnnotation.push(annotationInstance);
|
391
|
var /** @type {?} */ TypeDecorator = (function TypeDecorator(cls) {
|
392
|
var /** @type {?} */ annotations = Reflect$1.getOwnMetadata('annotations', cls) || [];
|
393
|
annotations.push(annotationInstance);
|
394
|
Reflect$1.defineMetadata('annotations', annotations, cls);
|
395
|
return cls;
|
396
|
});
|
397
|
TypeDecorator.annotations = chainAnnotation;
|
398
|
TypeDecorator.Class = Class;
|
399
|
if (chainFn)
|
400
|
chainFn(TypeDecorator);
|
401
|
return TypeDecorator;
|
402
|
}
|
403
|
if (parentClass) {
|
404
|
DecoratorFactory.prototype = Object.create(parentClass.prototype);
|
405
|
}
|
406
|
DecoratorFactory.prototype.toString = function () { return "@" + name; };
|
407
|
((DecoratorFactory)).annotationCls = DecoratorFactory;
|
408
|
return DecoratorFactory;
|
409
|
}
|
410
|
/**
|
411
|
* @param {?=} props
|
412
|
* @return {?}
|
413
|
*/
|
414
|
function makeMetadataCtor(props) {
|
415
|
return function ctor() {
|
416
|
var args = [];
|
417
|
for (var _i = 0; _i < arguments.length; _i++) {
|
418
|
args[_i] = arguments[_i];
|
419
|
}
|
420
|
if (props) {
|
421
|
var /** @type {?} */ values = props.apply(void 0, args);
|
422
|
for (var /** @type {?} */ propName in values) {
|
423
|
this[propName] = values[propName];
|
424
|
}
|
425
|
}
|
426
|
};
|
427
|
}
|
428
|
/**
|
429
|
* @param {?} name
|
430
|
* @param {?=} props
|
431
|
* @param {?=} parentClass
|
432
|
* @return {?}
|
433
|
*/
|
434
|
function makeParamDecorator(name, props, parentClass) {
|
435
|
var /** @type {?} */ metaCtor = makeMetadataCtor(props);
|
436
|
/**
|
437
|
* @param {...?} args
|
438
|
* @return {?}
|
439
|
*/
|
440
|
function ParamDecoratorFactory() {
|
441
|
var args = [];
|
442
|
for (var _i = 0; _i < arguments.length; _i++) {
|
443
|
args[_i] = arguments[_i];
|
444
|
}
|
445
|
if (this instanceof ParamDecoratorFactory) {
|
446
|
metaCtor.apply(this, args);
|
447
|
return this;
|
448
|
}
|
449
|
var /** @type {?} */ annotationInstance = new (((ParamDecoratorFactory)).bind.apply(((ParamDecoratorFactory)), [void 0].concat(args)))();
|
450
|
((ParamDecorator)).annotation = annotationInstance;
|
451
|
return ParamDecorator;
|
452
|
/**
|
453
|
* @param {?} cls
|
454
|
* @param {?} unusedKey
|
455
|
* @param {?} index
|
456
|
* @return {?}
|
457
|
*/
|
458
|
function ParamDecorator(cls, unusedKey, index) {
|
459
|
var /** @type {?} */ parameters = Reflect$1.getOwnMetadata('parameters', cls) || [];
|
460
|
// there might be gaps if some in between parameters do not have annotations.
|
461
|
// we pad with nulls.
|
462
|
while (parameters.length <= index) {
|
463
|
parameters.push(null);
|
464
|
}
|
465
|
parameters[index] = parameters[index] || []; /** @type {?} */
|
466
|
((parameters[index])).push(annotationInstance);
|
467
|
Reflect$1.defineMetadata('parameters', parameters, cls);
|
468
|
return cls;
|
469
|
}
|
470
|
}
|
471
|
if (parentClass) {
|
472
|
ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
473
|
}
|
474
|
ParamDecoratorFactory.prototype.toString = function () { return "@" + name; };
|
475
|
((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
|
476
|
return ParamDecoratorFactory;
|
477
|
}
|
478
|
/**
|
479
|
* @param {?} name
|
480
|
* @param {?=} props
|
481
|
* @param {?=} parentClass
|
482
|
* @return {?}
|
483
|
*/
|
484
|
function makePropDecorator(name, props, parentClass) {
|
485
|
var /** @type {?} */ metaCtor = makeMetadataCtor(props);
|
486
|
/**
|
487
|
* @param {...?} args
|
488
|
* @return {?}
|
489
|
*/
|
490
|
function PropDecoratorFactory() {
|
491
|
var args = [];
|
492
|
for (var _i = 0; _i < arguments.length; _i++) {
|
493
|
args[_i] = arguments[_i];
|
494
|
}
|
495
|
if (this instanceof PropDecoratorFactory) {
|
496
|
metaCtor.apply(this, args);
|
497
|
return this;
|
498
|
}
|
499
|
var /** @type {?} */ decoratorInstance = new (((PropDecoratorFactory)).bind.apply(((PropDecoratorFactory)), [void 0].concat(args)))();
|
500
|
return function PropDecorator(target, name) {
|
501
|
var /** @type {?} */ meta = Reflect$1.getOwnMetadata('propMetadata', target.constructor) || {};
|
502
|
meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
|
503
|
meta[name].unshift(decoratorInstance);
|
504
|
Reflect$1.defineMetadata('propMetadata', meta, target.constructor);
|
505
|
};
|
506
|
}
|
507
|
if (parentClass) {
|
508
|
PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
509
|
}
|
510
|
PropDecoratorFactory.prototype.toString = function () { return "@" + name; };
|
511
|
((PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
|
512
|
return PropDecoratorFactory;
|
513
|
}
|
514
|
/**
|
515
|
* @license
|
516
|
* Copyright Google Inc. All Rights Reserved.
|
517
|
*
|
518
|
* Use of this source code is governed by an MIT-style license that can be
|
519
|
* found in the LICENSE file at https://angular.io/license
|
520
|
*/
|
521
|
/**
|
522
|
* This token can be used to create a virtual provider that will populate the
|
523
|
* `entryComponents` fields of components and ng modules based on its `useValue`.
|
524
|
* All components that are referenced in the `useValue` value (either directly
|
525
|
* or in a nested array or map) will be added to the `entryComponents` property.
|
526
|
*
|
527
|
* ### Example
|
528
|
* The following example shows how the router can populate the `entryComponents`
|
529
|
* field of an NgModule based on the router configuration which refers
|
530
|
* to components.
|
531
|
*
|
532
|
* ```typescript
|
533
|
* // helper function inside the router
|
534
|
* function provideRoutes(routes) {
|
535
|
* return [
|
536
|
* {provide: ROUTES, useValue: routes},
|
537
|
* {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
|
538
|
* ];
|
539
|
* }
|
540
|
*
|
541
|
* // user code
|
542
|
* let routes = [
|
543
|
* {path: '/root', component: RootComp},
|
544
|
* {path: '/teams', component: TeamsComp}
|
545
|
* ];
|
546
|
*
|
547
|
* \@NgModule({
|
548
|
* providers: [provideRoutes(routes)]
|
549
|
* })
|
550
|
* class ModuleWithRoutes {}
|
551
|
* ```
|
552
|
*
|
553
|
* \@experimental
|
554
|
*/
|
555
|
var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
|
556
|
/**
|
557
|
* Attribute decorator and metadata.
|
558
|
*
|
559
|
* \@stable
|
560
|
* \@Annotation
|
561
|
*/
|
562
|
var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
|
563
|
/**
|
564
|
* Base class for query metadata.
|
565
|
*
|
566
|
* See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
|
567
|
* more information.
|
568
|
*
|
569
|
* \@stable
|
570
|
* @abstract
|
571
|
*/
|
572
|
var Query = (function () {
|
573
|
function Query() {
|
574
|
}
|
575
|
return Query;
|
576
|
}());
|
577
|
/**
|
578
|
* ContentChildren decorator and metadata.
|
579
|
*
|
580
|
* \@stable
|
581
|
* \@Annotation
|
582
|
*/
|
583
|
var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
|
584
|
if (data === void 0) { data = {}; }
|
585
|
return (Object.assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
|
586
|
}, Query);
|
587
|
/**
|
588
|
* ContentChild decorator and metadata.
|
589
|
*
|
590
|
* \@stable
|
591
|
* \@Annotation
|
592
|
*/
|
593
|
var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
|
594
|
if (data === void 0) { data = {}; }
|
595
|
return (Object.assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
|
596
|
}, Query);
|
597
|
/**
|
598
|
* ViewChildren decorator and metadata.
|
599
|
*
|
600
|
* \@stable
|
601
|
* \@Annotation
|
602
|
*/
|
603
|
var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
|
604
|
if (data === void 0) { data = {}; }
|
605
|
return (Object.assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
|
606
|
}, Query);
|
607
|
/**
|
608
|
* ViewChild decorator and metadata.
|
609
|
*
|
610
|
* \@stable
|
611
|
* \@Annotation
|
612
|
*/
|
613
|
var ViewChild = makePropDecorator('ViewChild', function (selector, data) { return (Object.assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data)); }, Query);
|
614
|
var ChangeDetectionStrategy = {};
|
615
|
ChangeDetectionStrategy.OnPush = 0;
|
616
|
ChangeDetectionStrategy.Default = 1;
|
617
|
ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
|
618
|
ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
|
619
|
var ChangeDetectorStatus = {};
|
620
|
ChangeDetectorStatus.CheckOnce = 0;
|
621
|
ChangeDetectorStatus.Checked = 1;
|
622
|
ChangeDetectorStatus.CheckAlways = 2;
|
623
|
ChangeDetectorStatus.Detached = 3;
|
624
|
ChangeDetectorStatus.Errored = 4;
|
625
|
ChangeDetectorStatus.Destroyed = 5;
|
626
|
ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
|
627
|
ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
|
628
|
ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
|
629
|
ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
|
630
|
ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
|
631
|
ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
|
632
|
/**
|
633
|
* @param {?} changeDetectionStrategy
|
634
|
* @return {?}
|
635
|
*/
|
636
|
function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
637
|
return changeDetectionStrategy == null ||
|
638
|
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
639
|
}
|
640
|
/**
|
641
|
* @license
|
642
|
* Copyright Google Inc. All Rights Reserved.
|
643
|
*
|
644
|
* Use of this source code is governed by an MIT-style license that can be
|
645
|
* found in the LICENSE file at https://angular.io/license
|
646
|
*/
|
647
|
/**
|
648
|
* Directive decorator and metadata.
|
649
|
*
|
650
|
* \@stable
|
651
|
* \@Annotation
|
652
|
*/
|
653
|
var Directive = makeDecorator('Directive', function (dir) {
|
654
|
if (dir === void 0) { dir = {}; }
|
655
|
return dir;
|
656
|
});
|
657
|
/**
|
658
|
* Component decorator and metadata.
|
659
|
*
|
660
|
* \@stable
|
661
|
* \@Annotation
|
662
|
*/
|
663
|
var Component = makeDecorator('Component', function (c) {
|
664
|
if (c === void 0) { c = {}; }
|
665
|
return (Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c));
|
666
|
}, Directive);
|
667
|
/**
|
668
|
* Pipe decorator and metadata.
|
669
|
*
|
670
|
* \@stable
|
671
|
* \@Annotation
|
672
|
*/
|
673
|
var Pipe = makeDecorator('Pipe', function (p) { return (Object.assign({ pure: true }, p)); });
|
674
|
/**
|
675
|
* Input decorator and metadata.
|
676
|
*
|
677
|
* \@stable
|
678
|
* \@Annotation
|
679
|
*/
|
680
|
var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
|
681
|
/**
|
682
|
* Output decorator and metadata.
|
683
|
*
|
684
|
* \@stable
|
685
|
* \@Annotation
|
686
|
*/
|
687
|
var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
|
688
|
/**
|
689
|
* HostBinding decorator and metadata.
|
690
|
*
|
691
|
* \@stable
|
692
|
* \@Annotation
|
693
|
*/
|
694
|
var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
|
695
|
/**
|
696
|
* HostListener decorator and metadata.
|
697
|
*
|
698
|
* \@stable
|
699
|
* \@Annotation
|
700
|
*/
|
701
|
var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
|
702
|
/**
|
703
|
* @license
|
704
|
* Copyright Google Inc. All Rights Reserved.
|
705
|
*
|
706
|
* Use of this source code is governed by an MIT-style license that can be
|
707
|
* found in the LICENSE file at https://angular.io/license
|
708
|
*/
|
709
|
/**
|
710
|
* Defines a schema that will allow:
|
711
|
* - any non-Angular elements with a `-` in their name,
|
712
|
* - any properties on elements with a `-` in their name which is the common rule for custom
|
713
|
* elements.
|
714
|
*
|
715
|
* \@stable
|
716
|
*/
|
717
|
var CUSTOM_ELEMENTS_SCHEMA = {
|
718
|
name: 'custom-elements'
|
719
|
};
|
720
|
/**
|
721
|
* Defines a schema that will allow any property on any element.
|
722
|
*
|
723
|
* \@experimental
|
724
|
*/
|
725
|
var NO_ERRORS_SCHEMA = {
|
726
|
name: 'no-errors-schema'
|
727
|
};
|
728
|
/**
|
729
|
* NgModule decorator and metadata.
|
730
|
*
|
731
|
* \@stable
|
732
|
* \@Annotation
|
733
|
*/
|
734
|
var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; });
|
735
|
var ViewEncapsulation = {};
|
736
|
ViewEncapsulation.Emulated = 0;
|
737
|
ViewEncapsulation.Native = 1;
|
738
|
ViewEncapsulation.None = 2;
|
739
|
ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
|
740
|
ViewEncapsulation[ViewEncapsulation.Native] = "Native";
|
741
|
ViewEncapsulation[ViewEncapsulation.None] = "None";
|
742
|
/**
|
743
|
* Metadata properties available for configuring Views.
|
744
|
*
|
745
|
* For details on the `\@Component` annotation, see {\@link Component}.
|
746
|
*
|
747
|
* ### Example
|
748
|
*
|
749
|
* ```
|
750
|
* \@Component({
|
751
|
* selector: 'greet',
|
752
|
* template: 'Hello {{name}}!',
|
753
|
* })
|
754
|
* class Greet {
|
755
|
* name: string;
|
756
|
*
|
757
|
* constructor() {
|
758
|
* this.name = 'World';
|
759
|
* }
|
760
|
* }
|
761
|
* ```
|
762
|
*
|
763
|
* @deprecated Use Component instead.
|
764
|
*
|
765
|
* {\@link Component}
|
766
|
*/
|
767
|
var ViewMetadata = (function () {
|
768
|
/**
|
769
|
* @param {?=} opts
|
770
|
*/
|
771
|
function ViewMetadata(opts) {
|
772
|
if (opts === void 0) { opts = {}; }
|
773
|
this.templateUrl = opts.templateUrl;
|
774
|
this.template = opts.template;
|
775
|
this.styleUrls = opts.styleUrls;
|
776
|
this.styles = opts.styles;
|
777
|
this.encapsulation = opts.encapsulation;
|
778
|
this.animations = opts.animations;
|
779
|
this.interpolation = opts.interpolation;
|
780
|
}
|
781
|
return ViewMetadata;
|
782
|
}());
|
783
|
/**
|
784
|
* @license
|
785
|
* Copyright Google Inc. All Rights Reserved.
|
786
|
*
|
787
|
* Use of this source code is governed by an MIT-style license that can be
|
788
|
* found in the LICENSE file at https://angular.io/license
|
789
|
*/
|
790
|
/**
|
791
|
* \@whatItDoes Represents the version of Angular
|
792
|
*
|
793
|
* \@stable
|
794
|
*/
|
795
|
var Version = (function () {
|
796
|
/**
|
797
|
* @param {?} full
|
798
|
*/
|
799
|
function Version(full) {
|
800
|
this.full = full;
|
801
|
}
|
802
|
Object.defineProperty(Version.prototype, "major", {
|
803
|
/**
|
804
|
* @return {?}
|
805
|
*/
|
806
|
get: function () { return this.full.split('.')[0]; },
|
807
|
enumerable: true,
|
808
|
configurable: true
|
809
|
});
|
810
|
Object.defineProperty(Version.prototype, "minor", {
|
811
|
/**
|
812
|
* @return {?}
|
813
|
*/
|
814
|
get: function () { return this.full.split('.')[1]; },
|
815
|
enumerable: true,
|
816
|
configurable: true
|
817
|
});
|
818
|
Object.defineProperty(Version.prototype, "patch", {
|
819
|
/**
|
820
|
* @return {?}
|
821
|
*/
|
822
|
get: function () { return this.full.split('.').slice(2).join('.'); },
|
823
|
enumerable: true,
|
824
|
configurable: true
|
825
|
});
|
826
|
return Version;
|
827
|
}());
|
828
|
/**
|
829
|
* \@stable
|
830
|
*/
|
831
|
var VERSION = new Version('4.4.6');
|
832
|
/**
|
833
|
* @license
|
834
|
* Copyright Google Inc. All Rights Reserved.
|
835
|
*
|
836
|
* Use of this source code is governed by an MIT-style license that can be
|
837
|
* found in the LICENSE file at https://angular.io/license
|
838
|
*/
|
839
|
/**
|
840
|
* Inject decorator and metadata.
|
841
|
*
|
842
|
* \@stable
|
843
|
* \@Annotation
|
844
|
*/
|
845
|
var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
|
846
|
/**
|
847
|
* Optional decorator and metadata.
|
848
|
*
|
849
|
* \@stable
|
850
|
* \@Annotation
|
851
|
*/
|
852
|
var Optional = makeParamDecorator('Optional');
|
853
|
/**
|
854
|
* Injectable decorator and metadata.
|
855
|
*
|
856
|
* \@stable
|
857
|
* \@Annotation
|
858
|
*/
|
859
|
var Injectable = makeDecorator('Injectable');
|
860
|
/**
|
861
|
* Self decorator and metadata.
|
862
|
*
|
863
|
* \@stable
|
864
|
* \@Annotation
|
865
|
*/
|
866
|
var Self = makeParamDecorator('Self');
|
867
|
/**
|
868
|
* SkipSelf decorator and metadata.
|
869
|
*
|
870
|
* \@stable
|
871
|
* \@Annotation
|
872
|
*/
|
873
|
var SkipSelf = makeParamDecorator('SkipSelf');
|
874
|
/**
|
875
|
* Host decorator and metadata.
|
876
|
*
|
877
|
* \@stable
|
878
|
* \@Annotation
|
879
|
*/
|
880
|
var Host = makeParamDecorator('Host');
|
881
|
/**
|
882
|
* @license
|
883
|
* Copyright Google Inc. All Rights Reserved.
|
884
|
*
|
885
|
* Use of this source code is governed by an MIT-style license that can be
|
886
|
* found in the LICENSE file at https://angular.io/license
|
887
|
*/
|
888
|
/**
|
889
|
* Allows to refer to references which are not yet defined.
|
890
|
*
|
891
|
* For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
|
892
|
* DI is declared,
|
893
|
* but not yet defined. It is also used when the `token` which we use when creating a query is not
|
894
|
* yet defined.
|
895
|
*
|
896
|
* ### Example
|
897
|
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
|
898
|
* \@experimental
|
899
|
* @param {?} forwardRefFn
|
900
|
* @return {?}
|
901
|
*/
|
902
|
function forwardRef(forwardRefFn) {
|
903
|
((forwardRefFn)).__forward_ref__ = forwardRef;
|
904
|
((forwardRefFn)).toString = function () { return stringify(this()); };
|
905
|
return (((forwardRefFn)));
|
906
|
}
|
907
|
/**
|
908
|
* Lazily retrieves the reference value from a forwardRef.
|
909
|
*
|
910
|
* Acts as the identity function when given a non-forward-ref value.
|
911
|
*
|
912
|
* ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
|
913
|
*
|
914
|
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
|
915
|
*
|
916
|
* See: {\@link forwardRef}
|
917
|
* \@experimental
|
918
|
* @param {?} type
|
919
|
* @return {?}
|
920
|
*/
|
921
|
function resolveForwardRef(type) {
|
922
|
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
|
923
|
type.__forward_ref__ === forwardRef) {
|
924
|
return ((type))();
|
925
|
}
|
926
|
else {
|
927
|
return type;
|
928
|
}
|
929
|
}
|
930
|
/**
|
931
|
* @license
|
932
|
* Copyright Google Inc. All Rights Reserved.
|
933
|
*
|
934
|
* Use of this source code is governed by an MIT-style license that can be
|
935
|
* found in the LICENSE file at https://angular.io/license
|
936
|
*/
|
937
|
var _THROW_IF_NOT_FOUND = new Object();
|
938
|
var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
939
|
var _NullInjector = (function () {
|
940
|
function _NullInjector() {
|
941
|
}
|
942
|
/**
|
943
|
* @param {?} token
|
944
|
* @param {?=} notFoundValue
|
945
|
* @return {?}
|
946
|
*/
|
947
|
_NullInjector.prototype.get = function (token, notFoundValue) {
|
948
|
if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
|
949
|
if (notFoundValue === _THROW_IF_NOT_FOUND) {
|
950
|
throw new Error("No provider for " + stringify(token) + "!");
|
951
|
}
|
952
|
return notFoundValue;
|
953
|
};
|
954
|
return _NullInjector;
|
955
|
}());
|
956
|
/**
|
957
|
* \@whatItDoes Injector interface
|
958
|
* \@howToUse
|
959
|
* ```
|
960
|
* const injector: Injector = ...;
|
961
|
* injector.get(...);
|
962
|
* ```
|
963
|
*
|
964
|
* \@description
|
965
|
* For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
|
966
|
*
|
967
|
* ### Example
|
968
|
*
|
969
|
* {\@example core/di/ts/injector_spec.ts region='Injector'}
|
970
|
*
|
971
|
* `Injector` returns itself when given `Injector` as a token:
|
972
|
* {\@example core/di/ts/injector_spec.ts region='injectInjector'}
|
973
|
*
|
974
|
* \@stable
|
975
|
* @abstract
|
976
|
*/
|
977
|
var Injector = (function () {
|
978
|
function Injector() {
|
979
|
}
|
980
|
/**
|
981
|
* Retrieves an instance from the injector based on the provided token.
|
982
|
* If not found:
|
983
|
* - Throws an error if no `notFoundValue` that is not equal to
|
984
|
* Injector.THROW_IF_NOT_FOUND is given
|
985
|
* - Returns the `notFoundValue` otherwise
|
986
|
* @abstract
|
987
|
* @template T
|
988
|
* @param {?} token
|
989
|
* @param {?=} notFoundValue
|
990
|
* @return {?}
|
991
|
*/
|
992
|
Injector.prototype.get = function (token, notFoundValue) { };
|
993
|
/**
|
994
|
* @deprecated from v4.0.0 use Type<T> or InjectionToken<T>
|
995
|
* @suppress {duplicate}
|
996
|
* @abstract
|
997
|
* @param {?} token
|
998
|
* @param {?=} notFoundValue
|
999
|
* @return {?}
|
1000
|
*/
|
1001
|
Injector.prototype.get = function (token, notFoundValue) { };
|
1002
|
return Injector;
|
1003
|
}());
|
1004
|
Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
1005
|
Injector.NULL = new _NullInjector();
|
1006
|
/**
|
1007
|
* @license
|
1008
|
* Copyright Google Inc. All Rights Reserved.
|
1009
|
*
|
1010
|
* Use of this source code is governed by an MIT-style license that can be
|
1011
|
* found in the LICENSE file at https://angular.io/license
|
1012
|
*/
|
1013
|
var ERROR_COMPONENT_TYPE = 'ngComponentType';
|
1014
|
var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
|
1015
|
var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
1016
|
var ERROR_LOGGER = 'ngErrorLogger';
|
1017
|
/**
|
1018
|
* @param {?} error
|
1019
|
* @return {?}
|
1020
|
*/
|
1021
|
/**
|
1022
|
* @param {?} error
|
1023
|
* @return {?}
|
1024
|
*/
|
1025
|
function getDebugContext(error) {
|
1026
|
return ((error))[ERROR_DEBUG_CONTEXT];
|
1027
|
}
|
1028
|
/**
|
1029
|
* @param {?} error
|
1030
|
* @return {?}
|
1031
|
*/
|
1032
|
function getOriginalError(error) {
|
1033
|
return ((error))[ERROR_ORIGINAL_ERROR];
|
1034
|
}
|
1035
|
/**
|
1036
|
* @param {?} error
|
1037
|
* @return {?}
|
1038
|
*/
|
1039
|
function getErrorLogger(error) {
|
1040
|
return ((error))[ERROR_LOGGER] || defaultErrorLogger;
|
1041
|
}
|
1042
|
/**
|
1043
|
* @param {?} console
|
1044
|
* @param {...?} values
|
1045
|
* @return {?}
|
1046
|
*/
|
1047
|
function defaultErrorLogger(console) {
|
1048
|
var values = [];
|
1049
|
for (var _i = 1; _i < arguments.length; _i++) {
|
1050
|
values[_i - 1] = arguments[_i];
|
1051
|
}
|
1052
|
console.error.apply(console, values);
|
1053
|
}
|
1054
|
/**
|
1055
|
* @license
|
1056
|
* Copyright Google Inc. All Rights Reserved.
|
1057
|
*
|
1058
|
* Use of this source code is governed by an MIT-style license that can be
|
1059
|
* found in the LICENSE file at https://angular.io/license
|
1060
|
*/
|
1061
|
/**
|
1062
|
* \@whatItDoes Provides a hook for centralized exception handling.
|
1063
|
*
|
1064
|
* \@description
|
1065
|
*
|
1066
|
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
1067
|
* intercept error handling, write a custom exception handler that replaces this default as
|
1068
|
* appropriate for your app.
|
1069
|
*
|
1070
|
* ### Example
|
1071
|
*
|
1072
|
* ```
|
1073
|
* class MyErrorHandler implements ErrorHandler {
|
1074
|
* handleError(error) {
|
1075
|
* // do something with the exception
|
1076
|
* }
|
1077
|
* }
|
1078
|
*
|
1079
|
* \@NgModule({
|
1080
|
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
1081
|
* })
|
1082
|
* class MyModule {}
|
1083
|
* ```
|
1084
|
*
|
1085
|
* \@stable
|
1086
|
*/
|
1087
|
var ErrorHandler = (function () {
|
1088
|
/**
|
1089
|
* @param {?=} deprecatedParameter
|
1090
|
*/
|
1091
|
function ErrorHandler(
|
1092
|
/**
|
1093
|
* @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never
|
1094
|
* rethrow.
|
1095
|
*/
|
1096
|
deprecatedParameter) {
|
1097
|
/**
|
1098
|
* \@internal
|
1099
|
*/
|
1100
|
this._console = console;
|
1101
|
}
|
1102
|
/**
|
1103
|
* @param {?} error
|
1104
|
* @return {?}
|
1105
|
*/
|
1106
|
ErrorHandler.prototype.handleError = function (error) {
|
1107
|
var /** @type {?} */ originalError = this._findOriginalError(error);
|
1108
|
var /** @type {?} */ context = this._findContext(error);
|
1109
|
// Note: Browser consoles show the place from where console.error was called.
|
1110
|
// We can use this to give users additional information about the error.
|
1111
|
var /** @type {?} */ errorLogger = getErrorLogger(error);
|
1112
|
errorLogger(this._console, "ERROR", error);
|
1113
|
if (originalError) {
|
1114
|
errorLogger(this._console, "ORIGINAL ERROR", originalError);
|
1115
|
}
|
1116
|
if (context) {
|
1117
|
errorLogger(this._console, 'ERROR CONTEXT', context);
|
1118
|
}
|
1119
|
};
|
1120
|
/**
|
1121
|
* \@internal
|
1122
|
* @param {?} error
|
1123
|
* @return {?}
|
1124
|
*/
|
1125
|
ErrorHandler.prototype._findContext = function (error) {
|
1126
|
if (error) {
|
1127
|
return getDebugContext(error) ? getDebugContext(error) :
|
1128
|
this._findContext(getOriginalError(error));
|
1129
|
}
|
1130
|
return null;
|
1131
|
};
|
1132
|
/**
|
1133
|
* \@internal
|
1134
|
* @param {?} error
|
1135
|
* @return {?}
|
1136
|
*/
|
1137
|
ErrorHandler.prototype._findOriginalError = function (error) {
|
1138
|
var /** @type {?} */ e = getOriginalError(error);
|
1139
|
while (e && getOriginalError(e)) {
|
1140
|
e = getOriginalError(e);
|
1141
|
}
|
1142
|
return e;
|
1143
|
};
|
1144
|
return ErrorHandler;
|
1145
|
}());
|
1146
|
/**
|
1147
|
* @param {?} message
|
1148
|
* @param {?} originalError
|
1149
|
* @return {?}
|
1150
|
*/
|
1151
|
function wrappedError(message, originalError) {
|
1152
|
var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
|
1153
|
var /** @type {?} */ error = Error(msg);
|
1154
|
((error))[ERROR_ORIGINAL_ERROR] = originalError;
|
1155
|
return error;
|
1156
|
}
|
1157
|
/**
|
1158
|
* @license
|
1159
|
* Copyright Google Inc. All Rights Reserved.
|
1160
|
*
|
1161
|
* Use of this source code is governed by an MIT-style license that can be
|
1162
|
* found in the LICENSE file at https://angular.io/license
|
1163
|
*/
|
1164
|
/**
|
1165
|
* @param {?} keys
|
1166
|
* @return {?}
|
1167
|
*/
|
1168
|
function findFirstClosedCycle(keys) {
|
1169
|
var /** @type {?} */ res = [];
|
1170
|
for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
|
1171
|
if (res.indexOf(keys[i]) > -1) {
|
1172
|
res.push(keys[i]);
|
1173
|
return res;
|
1174
|
}
|
1175
|
res.push(keys[i]);
|
1176
|
}
|
1177
|
return res;
|
1178
|
}
|
1179
|
/**
|
1180
|
* @param {?} keys
|
1181
|
* @return {?}
|
1182
|
*/
|
1183
|
function constructResolvingPath(keys) {
|
1184
|
if (keys.length > 1) {
|
1185
|
var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse());
|
1186
|
var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); });
|
1187
|
return ' (' + tokenStrs.join(' -> ') + ')';
|
1188
|
}
|
1189
|
return '';
|
1190
|
}
|
1191
|
/**
|
1192
|
* @param {?} injector
|
1193
|
* @param {?} key
|
1194
|
* @param {?} constructResolvingMessage
|
1195
|
* @param {?=} originalError
|
1196
|
* @return {?}
|
1197
|
*/
|
1198
|
function injectionError(injector, key, constructResolvingMessage, originalError) {
|
1199
|
var /** @type {?} */ keys = [key];
|
1200
|
var /** @type {?} */ errMsg = constructResolvingMessage(keys);
|
1201
|
var /** @type {?} */ error = ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg)));
|
1202
|
error.addKey = addKey;
|
1203
|
error.keys = keys;
|
1204
|
error.injectors = [injector];
|
1205
|
error.constructResolvingMessage = constructResolvingMessage;
|
1206
|
((error))[ERROR_ORIGINAL_ERROR] = originalError;
|
1207
|
return error;
|
1208
|
}
|
1209
|
/**
|
1210
|
* @this {?}
|
1211
|
* @param {?} injector
|
1212
|
* @param {?} key
|
1213
|
* @return {?}
|
1214
|
*/
|
1215
|
function addKey(injector, key) {
|
1216
|
this.injectors.push(injector);
|
1217
|
this.keys.push(key);
|
1218
|
// Note: This updated message won't be reflected in the `.stack` property
|
1219
|
this.message = this.constructResolvingMessage(this.keys);
|
1220
|
}
|
1221
|
/**
|
1222
|
* Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the
|
1223
|
* {\@link Injector} does not have a {\@link Provider} for the given key.
|
1224
|
*
|
1225
|
* ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview))
|
1226
|
*
|
1227
|
* ```typescript
|
1228
|
* class A {
|
1229
|
* constructor(b:B) {}
|
1230
|
* }
|
1231
|
*
|
1232
|
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
|
1233
|
* ```
|
1234
|
* @param {?} injector
|
1235
|
* @param {?} key
|
1236
|
* @return {?}
|
1237
|
*/
|
1238
|
function noProviderError(injector, key) {
|
1239
|
return injectionError(injector, key, function (keys) {
|
1240
|
var /** @type {?} */ first = stringify(keys[0].token);
|
1241
|
return "No provider for " + first + "!" + constructResolvingPath(keys);
|
1242
|
});
|
1243
|
}
|
1244
|
/**
|
1245
|
* Thrown when dependencies form a cycle.
|
1246
|
*
|
1247
|
* ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info))
|
1248
|
*
|
1249
|
* ```typescript
|
1250
|
* var injector = Injector.resolveAndCreate([
|
1251
|
* {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
|
1252
|
* {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
|
1253
|
* ]);
|
1254
|
*
|
1255
|
* expect(() => injector.get("one")).toThrowError();
|
1256
|
* ```
|
1257
|
*
|
1258
|
* Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
|
1259
|
* @param {?} injector
|
1260
|
* @param {?} key
|
1261
|
* @return {?}
|
1262
|
*/
|
1263
|
function cyclicDependencyError(injector, key) {
|
1264
|
return injectionError(injector, key, function (keys) {
|
1265
|
return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
|
1266
|
});
|
1267
|
}
|
1268
|
/**
|
1269
|
* Thrown when a constructing type returns with an Error.
|
1270
|
*
|
1271
|
* The `InstantiationError` class contains the original error plus the dependency graph which caused
|
1272
|
* this object to be instantiated.
|
1273
|
*
|
1274
|
* ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview))
|
1275
|
*
|
1276
|
* ```typescript
|
1277
|
* class A {
|
1278
|
* constructor() {
|
1279
|
* throw new Error('message');
|
1280
|
* }
|
1281
|
* }
|
1282
|
*
|
1283
|
* var injector = Injector.resolveAndCreate([A]);
|
1284
|
* try {
|
1285
|
* injector.get(A);
|
1286
|
* } catch (e) {
|
1287
|
* expect(e instanceof InstantiationError).toBe(true);
|
1288
|
* expect(e.originalException.message).toEqual("message");
|
1289
|
* expect(e.originalStack).toBeDefined();
|
1290
|
* }
|
1291
|
* ```
|
1292
|
* @param {?} injector
|
1293
|
* @param {?} originalException
|
1294
|
* @param {?} originalStack
|
1295
|
* @param {?} key
|
1296
|
* @return {?}
|
1297
|
*/
|
1298
|
function instantiationError(injector, originalException, originalStack, key) {
|
1299
|
return injectionError(injector, key, function (keys) {
|
1300
|
var /** @type {?} */ first = stringify(keys[0].token);
|
1301
|
return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
|
1302
|
}, originalException);
|
1303
|
}
|
1304
|
/**
|
1305
|
* Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector}
|
1306
|
* creation.
|
1307
|
*
|
1308
|
* ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview))
|
1309
|
*
|
1310
|
* ```typescript
|
1311
|
* expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
|
1312
|
* ```
|
1313
|
* @param {?} provider
|
1314
|
* @return {?}
|
1315
|
*/
|
1316
|
function invalidProviderError(provider) {
|
1317
|
return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
|
1318
|
}
|
1319
|
/**
|
1320
|
* Thrown when the class has no annotation information.
|
1321
|
*
|
1322
|
* Lack of annotation information prevents the {\@link Injector} from determining which dependencies
|
1323
|
* need to be injected into the constructor.
|
1324
|
*
|
1325
|
* ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview))
|
1326
|
*
|
1327
|
* ```typescript
|
1328
|
* class A {
|
1329
|
* constructor(b) {}
|
1330
|
* }
|
1331
|
*
|
1332
|
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
|
1333
|
* ```
|
1334
|
*
|
1335
|
* This error is also thrown when the class not marked with {\@link Injectable} has parameter types.
|
1336
|
*
|
1337
|
* ```typescript
|
1338
|
* class B {}
|
1339
|
*
|
1340
|
* class A {
|
1341
|
* constructor(b:B) {} // no information about the parameter types of A is available at runtime.
|
1342
|
* }
|
1343
|
*
|
1344
|
* expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
|
1345
|
* ```
|
1346
|
* \@stable
|
1347
|
* @param {?} typeOrFunc
|
1348
|
* @param {?} params
|
1349
|
* @return {?}
|
1350
|
*/
|
1351
|
function noAnnotationError(typeOrFunc, params) {
|
1352
|
var /** @type {?} */ signature = [];
|
1353
|
for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) {
|
1354
|
var /** @type {?} */ parameter = params[i];
|
1355
|
if (!parameter || parameter.length == 0) {
|
1356
|
signature.push('?');
|
1357
|
}
|
1358
|
else {
|
1359
|
signature.push(parameter.map(stringify).join(' '));
|
1360
|
}
|
1361
|
}
|
1362
|
return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
|
1363
|
signature.join(', ') + '). ' +
|
1364
|
'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
1365
|
stringify(typeOrFunc) + '\' is decorated with Injectable.');
|
1366
|
}
|
1367
|
/**
|
1368
|
* Thrown when getting an object by index.
|
1369
|
*
|
1370
|
* ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview))
|
1371
|
*
|
1372
|
* ```typescript
|
1373
|
* class A {}
|
1374
|
*
|
1375
|
* var injector = Injector.resolveAndCreate([A]);
|
1376
|
*
|
1377
|
* expect(() => injector.getAt(100)).toThrowError();
|
1378
|
* ```
|
1379
|
* \@stable
|
1380
|
* @param {?} index
|
1381
|
* @return {?}
|
1382
|
*/
|
1383
|
function outOfBoundsError(index) {
|
1384
|
return Error("Index " + index + " is out-of-bounds.");
|
1385
|
}
|
1386
|
/**
|
1387
|
* Thrown when a multi provider and a regular provider are bound to the same token.
|
1388
|
*
|
1389
|
* ### Example
|
1390
|
*
|
1391
|
* ```typescript
|
1392
|
* expect(() => Injector.resolveAndCreate([
|
1393
|
* { provide: "Strings", useValue: "string1", multi: true},
|
1394
|
* { provide: "Strings", useValue: "string2", multi: false}
|
1395
|
* ])).toThrowError();
|
1396
|
* ```
|
1397
|
* @param {?} provider1
|
1398
|
* @param {?} provider2
|
1399
|
* @return {?}
|
1400
|
*/
|
1401
|
function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
|
1402
|
return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
|
1403
|
}
|
1404
|
/**
|
1405
|
* @license
|
1406
|
* Copyright Google Inc. All Rights Reserved.
|
1407
|
*
|
1408
|
* Use of this source code is governed by an MIT-style license that can be
|
1409
|
* found in the LICENSE file at https://angular.io/license
|
1410
|
*/
|
1411
|
/**
|
1412
|
* A unique object used for retrieving items from the {\@link ReflectiveInjector}.
|
1413
|
*
|
1414
|
* Keys have:
|
1415
|
* - a system-wide unique `id`.
|
1416
|
* - a `token`.
|
1417
|
*
|
1418
|
* `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows
|
1419
|
* the
|
1420
|
* injector to store created objects in a more efficient way.
|
1421
|
*
|
1422
|
* `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when
|
1423
|
* resolving
|
1424
|
* providers.
|
1425
|
* \@experimental
|
1426
|
*/
|
1427
|
var ReflectiveKey = (function () {
|
1428
|
/**
|
1429
|
* Private
|
1430
|
* @param {?} token
|
1431
|
* @param {?} id
|
1432
|
*/
|
1433
|
function ReflectiveKey(token, id) {
|
1434
|
this.token = token;
|
1435
|
this.id = id;
|
1436
|
if (!token) {
|
1437
|
throw new Error('Token must be defined!');
|
1438
|
}
|
1439
|
}
|
1440
|
Object.defineProperty(ReflectiveKey.prototype, "displayName", {
|
1441
|
/**
|
1442
|
* Returns a stringified token.
|
1443
|
* @return {?}
|
1444
|
*/
|
1445
|
get: function () { return stringify(this.token); },
|
1446
|
enumerable: true,
|
1447
|
configurable: true
|
1448
|
});
|
1449
|
/**
|
1450
|
* Retrieves a `Key` for a token.
|
1451
|
* @param {?} token
|
1452
|
* @return {?}
|
1453
|
*/
|
1454
|
ReflectiveKey.get = function (token) {
|
1455
|
return _globalKeyRegistry.get(resolveForwardRef(token));
|
1456
|
};
|
1457
|
Object.defineProperty(ReflectiveKey, "numberOfKeys", {
|
1458
|
/**
|
1459
|
* @return {?} the number of keys registered in the system.
|
1460
|
*/
|
1461
|
get: function () { return _globalKeyRegistry.numberOfKeys; },
|
1462
|
enumerable: true,
|
1463
|
configurable: true
|
1464
|
});
|
1465
|
return ReflectiveKey;
|
1466
|
}());
|
1467
|
/**
|
1468
|
* \@internal
|
1469
|
*/
|
1470
|
var KeyRegistry = (function () {
|
1471
|
function KeyRegistry() {
|
1472
|
this._allKeys = new Map();
|
1473
|
}
|
1474
|
/**
|
1475
|
* @param {?} token
|
1476
|
* @return {?}
|
1477
|
*/
|
1478
|
KeyRegistry.prototype.get = function (token) {
|
1479
|
if (token instanceof ReflectiveKey)
|
1480
|
return token;
|
1481
|
if (this._allKeys.has(token)) {
|
1482
|
return ((this._allKeys.get(token)));
|
1483
|
}
|
1484
|
var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
|
1485
|
this._allKeys.set(token, newKey);
|
1486
|
return newKey;
|
1487
|
};
|
1488
|
Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
|
1489
|
/**
|
1490
|
* @return {?}
|
1491
|
*/
|
1492
|
get: function () { return this._allKeys.size; },
|
1493
|
enumerable: true,
|
1494
|
configurable: true
|
1495
|
});
|
1496
|
return KeyRegistry;
|
1497
|
}());
|
1498
|
var _globalKeyRegistry = new KeyRegistry();
|
1499
|
/**
|
1500
|
* \@whatItDoes Represents a type that a Component or other object is instances of.
|
1501
|
*
|
1502
|
* \@description
|
1503
|
*
|
1504
|
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
1505
|
* the `MyCustomComponent` constructor function.
|
1506
|
*
|
1507
|
* \@stable
|
1508
|
*/
|
1509
|
var Type = Function;
|
1510
|
/**
|
1511
|
* @param {?} v
|
1512
|
* @return {?}
|
1513
|
*/
|
1514
|
function isType(v) {
|
1515
|
return typeof v === 'function';
|
1516
|
}
|
1517
|
/**
|
1518
|
* @license
|
1519
|
* Copyright Google Inc. All Rights Reserved.
|
1520
|
*
|
1521
|
* Use of this source code is governed by an MIT-style license that can be
|
1522
|
* found in the LICENSE file at https://angular.io/license
|
1523
|
*/
|
1524
|
/**
|
1525
|
* Attention: This regex has to hold even if the code is minified!
|
1526
|
*/
|
1527
|
var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
|
1528
|
var ReflectionCapabilities = (function () {
|
1529
|
/**
|
1530
|
* @param {?=} reflect
|
1531
|
*/
|
1532
|
function ReflectionCapabilities(reflect) {
|
1533
|
this._reflect = reflect || _global['Reflect'];
|
1534
|
}
|
1535
|
/**
|
1536
|
* @return {?}
|
1537
|
*/
|
1538
|
ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
|
1539
|
/**
|
1540
|
* @template T
|
1541
|
* @param {?} t
|
1542
|
* @return {?}
|
1543
|
*/
|
1544
|
ReflectionCapabilities.prototype.factory = function (t) { return function () {
|
1545
|
var args = [];
|
1546
|
for (var _i = 0; _i < arguments.length; _i++) {
|
1547
|
args[_i] = arguments[_i];
|
1548
|
}
|
1549
|
return new (t.bind.apply(t, [void 0].concat(args)))();
|
1550
|
}; };
|
1551
|
/**
|
1552
|
* \@internal
|
1553
|
* @param {?} paramTypes
|
1554
|
* @param {?} paramAnnotations
|
1555
|
* @return {?}
|
1556
|
*/
|
1557
|
ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
|
1558
|
var /** @type {?} */ result;
|
1559
|
if (typeof paramTypes === 'undefined') {
|
1560
|
result = new Array(paramAnnotations.length);
|
1561
|
}
|
1562
|
else {
|
1563
|
result = new Array(paramTypes.length);
|
1564
|
}
|
1565
|
for (var /** @type {?} */ i = 0; i < result.length; i++) {
|
1566
|
// TS outputs Object for parameters without types, while Traceur omits
|
1567
|
// the annotations. For now we preserve the Traceur behavior to aid
|
1568
|
// migration, but this can be revisited.
|
1569
|
if (typeof paramTypes === 'undefined') {
|
1570
|
result[i] = [];
|
1571
|
}
|
1572
|
else if (paramTypes[i] != Object) {
|
1573
|
result[i] = [paramTypes[i]];
|
1574
|
}
|
1575
|
else {
|
1576
|
result[i] = [];
|
1577
|
}
|
1578
|
if (paramAnnotations && paramAnnotations[i] != null) {
|
1579
|
result[i] = result[i].concat(paramAnnotations[i]);
|
1580
|
}
|
1581
|
}
|
1582
|
return result;
|
1583
|
};
|
1584
|
/**
|
1585
|
* @param {?} type
|
1586
|
* @param {?} parentCtor
|
1587
|
* @return {?}
|
1588
|
*/
|
1589
|
ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) {
|
1590
|
// If we have no decorators, we only have function.length as metadata.
|
1591
|
// In that case, to detect whether a child class declared an own constructor or not,
|
1592
|
// we need to look inside of that constructor to check whether it is
|
1593
|
// just calling the parent.
|
1594
|
// This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
|
1595
|
// that sets 'design:paramtypes' to []
|
1596
|
// if a class inherits from another class but has no ctor declared itself.
|
1597
|
if (DELEGATE_CTOR.exec(type.toString())) {
|
1598
|
return null;
|
1599
|
}
|
1600
|
// Prefer the direct API.
|
1601
|
if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) {
|
1602
|
return ((type)).parameters;
|
1603
|
}
|
1604
|
// API of tsickle for lowering decorators to properties on the class.
|
1605
|
var /** @type {?} */ tsickleCtorParams = ((type)).ctorParameters;
|
1606
|
if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
|
1607
|
// Newer tsickle uses a function closure
|
1608
|
// Retain the non-function case for compatibility with older tsickle
|
1609
|
var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
|
1610
|
var /** @type {?} */ paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
|
1611
|
var /** @type {?} */ paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); });
|
1612
|
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
1613
|
}
|
1614
|
// API for metadata created by invoking the decorators.
|
1615
|
if (this._reflect != null && this._reflect.getOwnMetadata != null) {
|
1616
|
var /** @type {?} */ paramAnnotations = this._reflect.getOwnMetadata('parameters', type);
|
1617
|
var /** @type {?} */ paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);
|
1618
|
if (paramTypes || paramAnnotations) {
|
1619
|
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
1620
|
}
|
1621
|
}
|
1622
|
// If a class has no decorators, at least create metadata
|
1623
|
// based on function.length.
|
1624
|
// Note: We know that this is a real constructor as we checked
|
1625
|
// the content of the constructor above.
|
1626
|
return new Array(((type.length))).fill(undefined);
|
1627
|
};
|
1628
|
/**
|
1629
|
* @param {?} type
|
1630
|
* @return {?}
|
1631
|
*/
|
1632
|
ReflectionCapabilities.prototype.parameters = function (type) {
|
1633
|
// Note: only report metadata if we have at least one class decorator
|
1634
|
// to stay in sync with the static reflector.
|
1635
|
if (!isType(type)) {
|
1636
|
return [];
|
1637
|
}
|
1638
|
var /** @type {?} */ parentCtor = getParentCtor(type);
|
1639
|
var /** @type {?} */ parameters = this._ownParameters(type, parentCtor);
|
1640
|
if (!parameters && parentCtor !== Object) {
|
1641
|
parameters = this.parameters(parentCtor);
|
1642
|
}
|
1643
|
return parameters || [];
|
1644
|
};
|
1645
|
/**
|
1646
|
* @param {?} typeOrFunc
|
1647
|
* @param {?} parentCtor
|
1648
|
* @return {?}
|
1649
|
*/
|
1650
|
ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) {
|
1651
|
// Prefer the direct API.
|
1652
|
if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) {
|
1653
|
var /** @type {?} */ annotations = ((typeOrFunc)).annotations;
|
1654
|
if (typeof annotations === 'function' && annotations.annotations) {
|
1655
|
annotations = annotations.annotations;
|
1656
|
}
|
1657
|
return annotations;
|
1658
|
}
|
1659
|
// API of tsickle for lowering decorators to properties on the class.
|
1660
|
if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) {
|
1661
|
return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators);
|
1662
|
}
|
1663
|
// API for metadata created by invoking the decorators.
|
1664
|
if (this._reflect && this._reflect.getOwnMetadata) {
|
1665
|
return this._reflect.getOwnMetadata('annotations', typeOrFunc);
|
1666
|
}
|
1667
|
return null;
|
1668
|
};
|
1669
|
/**
|
1670
|
* @param {?} typeOrFunc
|
1671
|
* @return {?}
|
1672
|
*/
|
1673
|
ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
|
1674
|
if (!isType(typeOrFunc)) {
|
1675
|
return [];
|
1676
|
}
|
1677
|
var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
|
1678
|
var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
|
1679
|
var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
|
1680
|
return parentAnnotations.concat(ownAnnotations);
|
1681
|
};
|
1682
|
/**
|
1683
|
* @param {?} typeOrFunc
|
1684
|
* @param {?} parentCtor
|
1685
|
* @return {?}
|
1686
|
*/
|
1687
|
ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) {
|
1688
|
// Prefer the direct API.
|
1689
|
if (((typeOrFunc)).propMetadata &&
|
1690
|
((typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
|
1691
|
var /** @type {?} */ propMetadata = ((typeOrFunc)).propMetadata;
|
1692
|
if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
1693
|
propMetadata = propMetadata.propMetadata;
|
1694
|
}
|
1695
|
return propMetadata;
|
1696
|
}
|
1697
|
// API of tsickle for lowering decorators to properties on the class.
|
1698
|
if (((typeOrFunc)).propDecorators &&
|
1699
|
((typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
|
1700
|
var /** @type {?} */ propDecorators_1 = ((typeOrFunc)).propDecorators;
|
1701
|
var /** @type {?} */ propMetadata_1 = ({});
|
1702
|
Object.keys(propDecorators_1).forEach(function (prop) {
|
1703
|
propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
|
1704
|
});
|
1705
|
return propMetadata_1;
|
1706
|
}
|
1707
|
// API for metadata created by invoking the decorators.
|
1708
|
if (this._reflect && this._reflect.getOwnMetadata) {
|
1709
|
return this._reflect.getOwnMetadata('propMetadata', typeOrFunc);
|
1710
|
}
|
1711
|
return null;
|
1712
|
};
|
1713
|
/**
|
1714
|
* @param {?} typeOrFunc
|
1715
|
* @return {?}
|
1716
|
*/
|
1717
|
ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
|
1718
|
if (!isType(typeOrFunc)) {
|
1719
|
return {};
|
1720
|
}
|
1721
|
var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
|
1722
|
var /** @type {?} */ propMetadata = {};
|
1723
|
if (parentCtor !== Object) {
|
1724
|
var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor);
|
1725
|
Object.keys(parentPropMetadata_1).forEach(function (propName) {
|
1726
|
propMetadata[propName] = parentPropMetadata_1[propName];
|
1727
|
});
|
1728
|
}
|
1729
|
var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
1730
|
if (ownPropMetadata) {
|
1731
|
Object.keys(ownPropMetadata).forEach(function (propName) {
|
1732
|
var /** @type {?} */ decorators = [];
|
1733
|
if (propMetadata.hasOwnProperty(propName)) {
|
1734
|
decorators.push.apply(decorators, propMetadata[propName]);
|
1735
|
}
|
1736
|
decorators.push.apply(decorators, ownPropMetadata[propName]);
|
1737
|
propMetadata[propName] = decorators;
|
1738
|
});
|
1739
|
}
|
1740
|
return propMetadata;
|
1741
|
};
|
1742
|
/**
|
1743
|
* @param {?} type
|
1744
|
* @param {?} lcProperty
|
1745
|
* @return {?}
|
1746
|
*/
|
1747
|
ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
|
1748
|
return type instanceof Type && lcProperty in type.prototype;
|
1749
|
};
|
1750
|
/**
|
1751
|
* @param {?} name
|
1752
|
* @return {?}
|
1753
|
*/
|
1754
|
ReflectionCapabilities.prototype.getter = function (name) { return (new Function('o', 'return o.' + name + ';')); };
|
1755
|
/**
|
1756
|
* @param {?} name
|
1757
|
* @return {?}
|
1758
|
*/
|
1759
|
ReflectionCapabilities.prototype.setter = function (name) {
|
1760
|
return (new Function('o', 'v', 'return o.' + name + ' = v;'));
|
1761
|
};
|
1762
|
/**
|
1763
|
* @param {?} name
|
1764
|
* @return {?}
|
1765
|
*/
|
1766
|
ReflectionCapabilities.prototype.method = function (name) {
|
1767
|
var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
|
1768
|
return (new Function('o', 'args', functionBody));
|
1769
|
};
|
1770
|
/**
|
1771
|
* @param {?} type
|
1772
|
* @return {?}
|
1773
|
*/
|
1774
|
ReflectionCapabilities.prototype.importUri = function (type) {
|
1775
|
// StaticSymbol
|
1776
|
if (typeof type === 'object' && type['filePath']) {
|
1777
|
return type['filePath'];
|
1778
|
}
|
1779
|
// Runtime type
|
1780
|
return "./" + stringify(type);
|
1781
|
};
|
1782
|
/**
|
1783
|
* @param {?} type
|
1784
|
* @return {?}
|
1785
|
*/
|
1786
|
ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
|
1787
|
/**
|
1788
|
* @param {?} name
|
1789
|
* @param {?} moduleUrl
|
1790
|
* @param {?} members
|
1791
|
* @param {?} runtime
|
1792
|
* @return {?}
|
1793
|
*/
|
1794
|
ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
|
1795
|
return runtime;
|
1796
|
};
|
1797
|
/**
|
1798
|
* @param {?} enumIdentifier
|
1799
|
* @param {?} name
|
1800
|
* @return {?}
|
1801
|
*/
|
1802
|
ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };
|
1803
|
return ReflectionCapabilities;
|
1804
|
}());
|
1805
|
/**
|
1806
|
* @param {?} decoratorInvocations
|
1807
|
* @return {?}
|
1808
|
*/
|
1809
|
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
1810
|
if (!decoratorInvocations) {
|
1811
|
return [];
|
1812
|
}
|
1813
|
return decoratorInvocations.map(function (decoratorInvocation) {
|
1814
|
var /** @type {?} */ decoratorType = decoratorInvocation.type;
|
1815
|
var /** @type {?} */ annotationCls = decoratorType.annotationCls;
|
1816
|
var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
1817
|
return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
|
1818
|
});
|
1819
|
}
|
1820
|
/**
|
1821
|
* @param {?} ctor
|
1822
|
* @return {?}
|
1823
|
*/
|
1824
|
function getParentCtor(ctor) {
|
1825
|
var /** @type {?} */ parentProto = Object.getPrototypeOf(ctor.prototype);
|
1826
|
var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null;
|
1827
|
// Note: We always use `Object` as the null value
|
1828
|
// to simplify checking later on.
|
1829
|
return parentCtor || Object;
|
1830
|
}
|
1831
|
/**
|
1832
|
* @license
|
1833
|
* Copyright Google Inc. All Rights Reserved.
|
1834
|
*
|
1835
|
* Use of this source code is governed by an MIT-style license that can be
|
1836
|
* found in the LICENSE file at https://angular.io/license
|
1837
|
*/
|
1838
|
/**
|
1839
|
* Provides access to reflection data about symbols. Used internally by Angular
|
1840
|
* to power dependency injection and compilation.
|
1841
|
*/
|
1842
|
var Reflector = (function () {
|
1843
|
/**
|
1844
|
* @param {?} reflectionCapabilities
|
1845
|
*/
|
1846
|
function Reflector(reflectionCapabilities) {
|
1847
|
this.reflectionCapabilities = reflectionCapabilities;
|
1848
|
}
|
1849
|
/**
|
1850
|
* @param {?} caps
|
1851
|
* @return {?}
|
1852
|
*/
|
1853
|
Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; };
|
1854
|
/**
|
1855
|
* @param {?} type
|
1856
|
* @return {?}
|
1857
|
*/
|
1858
|
Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); };
|
1859
|
/**
|
1860
|
* @param {?} typeOrFunc
|
1861
|
* @return {?}
|
1862
|
*/
|
1863
|
Reflector.prototype.parameters = function (typeOrFunc) {
|
1864
|
return this.reflectionCapabilities.parameters(typeOrFunc);
|
1865
|
};
|
1866
|
/**
|
1867
|
* @param {?} typeOrFunc
|
1868
|
* @return {?}
|
1869
|
*/
|
1870
|
Reflector.prototype.annotations = function (typeOrFunc) {
|
1871
|
return this.reflectionCapabilities.annotations(typeOrFunc);
|
1872
|
};
|
1873
|
/**
|
1874
|
* @param {?} typeOrFunc
|
1875
|
* @return {?}
|
1876
|
*/
|
1877
|
Reflector.prototype.propMetadata = function (typeOrFunc) {
|
1878
|
return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
1879
|
};
|
1880
|
/**
|
1881
|
* @param {?} type
|
1882
|
* @param {?} lcProperty
|
1883
|
* @return {?}
|
1884
|
*/
|
1885
|
Reflector.prototype.hasLifecycleHook = function (type, lcProperty) {
|
1886
|
return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
1887
|
};
|
1888
|
/**
|
1889
|
* @param {?} name
|
1890
|
* @return {?}
|
1891
|
*/
|
1892
|
Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); };
|
1893
|
/**
|
1894
|
* @param {?} name
|
1895
|
* @return {?}
|
1896
|
*/
|
1897
|
Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); };
|
1898
|
/**
|
1899
|
* @param {?} name
|
1900
|
* @return {?}
|
1901
|
*/
|
1902
|
Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); };
|
1903
|
/**
|
1904
|
* @param {?} type
|
1905
|
* @return {?}
|
1906
|
*/
|
1907
|
Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
|
1908
|
/**
|
1909
|
* @param {?} type
|
1910
|
* @return {?}
|
1911
|
*/
|
1912
|
Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
|
1913
|
/**
|
1914
|
* @param {?} name
|
1915
|
* @param {?} moduleUrl
|
1916
|
* @param {?} members
|
1917
|
* @param {?} runtime
|
1918
|
* @return {?}
|
1919
|
*/
|
1920
|
Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
|
1921
|
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
1922
|
};
|
1923
|
/**
|
1924
|
* @param {?} identifier
|
1925
|
* @param {?} name
|
1926
|
* @return {?}
|
1927
|
*/
|
1928
|
Reflector.prototype.resolveEnum = function (identifier, name) {
|
1929
|
return this.reflectionCapabilities.resolveEnum(identifier, name);
|
1930
|
};
|
1931
|
return Reflector;
|
1932
|
}());
|
1933
|
/**
|
1934
|
* @license
|
1935
|
* Copyright Google Inc. All Rights Reserved.
|
1936
|
*
|
1937
|
* Use of this source code is governed by an MIT-style license that can be
|
1938
|
* found in the LICENSE file at https://angular.io/license
|
1939
|
*/
|
1940
|
/**
|
1941
|
* The {\@link Reflector} used internally in Angular to access metadata
|
1942
|
* about symbols.
|
1943
|
*/
|
1944
|
var reflector = new Reflector(new ReflectionCapabilities());
|
1945
|
/**
|
1946
|
* @license
|
1947
|
* Copyright Google Inc. All Rights Reserved.
|
1948
|
*
|
1949
|
* Use of this source code is governed by an MIT-style license that can be
|
1950
|
* found in the LICENSE file at https://angular.io/license
|
1951
|
*/
|
1952
|
/**
|
1953
|
* `Dependency` is used by the framework to extend DI.
|
1954
|
* This is internal to Angular and should not be used directly.
|
1955
|
*/
|
1956
|
var ReflectiveDependency = (function () {
|
1957
|
/**
|
1958
|
* @param {?} key
|
1959
|
* @param {?} optional
|
1960
|
* @param {?} visibility
|
1961
|
*/
|
1962
|
function ReflectiveDependency(key, optional, visibility) {
|
1963
|
this.key = key;
|
1964
|
this.optional = optional;
|
1965
|
this.visibility = visibility;
|
1966
|
}
|
1967
|
/**
|
1968
|
* @param {?} key
|
1969
|
* @return {?}
|
1970
|
*/
|
1971
|
ReflectiveDependency.fromKey = function (key) {
|
1972
|
return new ReflectiveDependency(key, false, null);
|
1973
|
};
|
1974
|
return ReflectiveDependency;
|
1975
|
}());
|
1976
|
var _EMPTY_LIST = [];
|
1977
|
var ResolvedReflectiveProvider_ = (function () {
|
1978
|
/**
|
1979
|
* @param {?} key
|
1980
|
* @param {?} resolvedFactories
|
1981
|
* @param {?} multiProvider
|
1982
|
*/
|
1983
|
function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
|
1984
|
this.key = key;
|
1985
|
this.resolvedFactories = resolvedFactories;
|
1986
|
this.multiProvider = multiProvider;
|
1987
|
}
|
1988
|
Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", {
|
1989
|
/**
|
1990
|
* @return {?}
|
1991
|
*/
|
1992
|
get: function () { return this.resolvedFactories[0]; },
|
1993
|
enumerable: true,
|
1994
|
configurable: true
|
1995
|
});
|
1996
|
return ResolvedReflectiveProvider_;
|
1997
|
}());
|
1998
|
/**
|
1999
|
* An internal resolved representation of a factory function created by resolving {\@link
|
2000
|
* Provider}.
|
2001
|
* \@experimental
|
2002
|
*/
|
2003
|
var ResolvedReflectiveFactory = (function () {
|
2004
|
/**
|
2005
|
* @param {?} factory
|
2006
|
* @param {?} dependencies
|
2007
|
*/
|
2008
|
function ResolvedReflectiveFactory(factory, dependencies) {
|
2009
|
this.factory = factory;
|
2010
|
this.dependencies = dependencies;
|
2011
|
}
|
2012
|
return ResolvedReflectiveFactory;
|
2013
|
}());
|
2014
|
/**
|
2015
|
* Resolve a single provider.
|
2016
|
* @param {?} provider
|
2017
|
* @return {?}
|
2018
|
*/
|
2019
|
function resolveReflectiveFactory(provider) {
|
2020
|
var /** @type {?} */ factoryFn;
|
2021
|
var /** @type {?} */ resolvedDeps;
|
2022
|
if (provider.useClass) {
|
2023
|
var /** @type {?} */ useClass = resolveForwardRef(provider.useClass);
|
2024
|
factoryFn = reflector.factory(useClass);
|
2025
|
resolvedDeps = _dependenciesFor(useClass);
|
2026
|
}
|
2027
|
else if (provider.useExisting) {
|
2028
|
factoryFn = function (aliasInstance) { return aliasInstance; };
|
2029
|
resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
2030
|
}
|
2031
|
else if (provider.useFactory) {
|
2032
|
factoryFn = provider.useFactory;
|
2033
|
resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
|
2034
|
}
|
2035
|
else {
|
2036
|
factoryFn = function () { return provider.useValue; };
|
2037
|
resolvedDeps = _EMPTY_LIST;
|
2038
|
}
|
2039
|
return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
|
2040
|
}
|
2041
|
/**
|
2042
|
* Converts the {\@link Provider} into {\@link ResolvedProvider}.
|
2043
|
*
|
2044
|
* {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains
|
2045
|
* convenience provider syntax.
|
2046
|
* @param {?} provider
|
2047
|
* @return {?}
|
2048
|
*/
|
2049
|
function resolveReflectiveProvider(provider) {
|
2050
|
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
|
2051
|
}
|
2052
|
/**
|
2053
|
* Resolve a list of Providers.
|
2054
|
* @param {?} providers
|
2055
|
* @return {?}
|
2056
|
*/
|
2057
|
function resolveReflectiveProviders(providers) {
|
2058
|
var /** @type {?} */ normalized = _normalizeProviders(providers, []);
|
2059
|
var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider);
|
2060
|
var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
|
2061
|
return Array.from(resolvedProviderMap.values());
|
2062
|
}
|
2063
|
/**
|
2064
|
* Merges a list of ResolvedProviders into a list where
|
2065
|
* each key is contained exactly once and multi providers
|
2066
|
* have been merged.
|
2067
|
* @param {?} providers
|
2068
|
* @param {?} normalizedProvidersMap
|
2069
|
* @return {?}
|
2070
|
*/
|
2071
|
function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
|
2072
|
for (var /** @type {?} */ i = 0; i < providers.length; i++) {
|
2073
|
var /** @type {?} */ provider = providers[i];
|
2074
|
var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
|
2075
|
if (existing) {
|
2076
|
if (provider.multiProvider !== existing.multiProvider) {
|
2077
|
throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
|
2078
|
}
|
2079
|
if (provider.multiProvider) {
|
2080
|
for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
|
2081
|
existing.resolvedFactories.push(provider.resolvedFactories[j]);
|
2082
|
}
|
2083
|
}
|
2084
|
else {
|
2085
|
normalizedProvidersMap.set(provider.key.id, provider);
|
2086
|
}
|
2087
|
}
|
2088
|
else {
|
2089
|
var /** @type {?} */ resolvedProvider = void 0;
|
2090
|
if (provider.multiProvider) {
|
2091
|
resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
|
2092
|
}
|
2093
|
else {
|
2094
|
resolvedProvider = provider;
|
2095
|
}
|
2096
|
normalizedProvidersMap.set(provider.key.id, resolvedProvider);
|
2097
|
}
|
2098
|
}
|
2099
|
return normalizedProvidersMap;
|
2100
|
}
|
2101
|
/**
|
2102
|
* @param {?} providers
|
2103
|
* @param {?} res
|
2104
|
* @return {?}
|
2105
|
*/
|
2106
|
function _normalizeProviders(providers, res) {
|
2107
|
providers.forEach(function (b) {
|
2108
|
if (b instanceof Type) {
|
2109
|
res.push({ provide: b, useClass: b });
|
2110
|
}
|
2111
|
else if (b && typeof b == 'object' && ((b)).provide !== undefined) {
|
2112
|
res.push(/** @type {?} */ (b));
|
2113
|
}
|
2114
|
else if (b instanceof Array) {
|
2115
|
_normalizeProviders(b, res);
|
2116
|
}
|
2117
|
else {
|
2118
|
throw invalidProviderError(b);
|
2119
|
}
|
2120
|
});
|
2121
|
return res;
|
2122
|
}
|
2123
|
/**
|
2124
|
* @param {?} typeOrFunc
|
2125
|
* @param {?=} dependencies
|
2126
|
* @return {?}
|
2127
|
*/
|
2128
|
function constructDependencies(typeOrFunc, dependencies) {
|
2129
|
if (!dependencies) {
|
2130
|
return _dependenciesFor(typeOrFunc);
|
2131
|
}
|
2132
|
else {
|
2133
|
var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; });
|
2134
|
return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
|
2135
|
}
|
2136
|
}
|
2137
|
/**
|
2138
|
* @param {?} typeOrFunc
|
2139
|
* @return {?}
|
2140
|
*/
|
2141
|
function _dependenciesFor(typeOrFunc) {
|
2142
|
var /** @type {?} */ params = reflector.parameters(typeOrFunc);
|
2143
|
if (!params)
|
2144
|
return [];
|
2145
|
if (params.some(function (p) { return p == null; })) {
|
2146
|
throw noAnnotationError(typeOrFunc, params);
|
2147
|
}
|
2148
|
return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
|
2149
|
}
|
2150
|
/**
|
2151
|
* @param {?} typeOrFunc
|
2152
|
* @param {?} metadata
|
2153
|
* @param {?} params
|
2154
|
* @return {?}
|
2155
|
*/
|
2156
|
function _extractToken(typeOrFunc, metadata, params) {
|
2157
|
var /** @type {?} */ token = null;
|
2158
|
var /** @type {?} */ optional = false;
|
2159
|
if (!Array.isArray(metadata)) {
|
2160
|
if (metadata instanceof Inject) {
|
2161
|
return _createDependency(metadata.token, optional, null);
|
2162
|
}
|
2163
|
else {
|
2164
|
return _createDependency(metadata, optional, null);
|
2165
|
}
|
2166
|
}
|
2167
|
var /** @type {?} */ visibility = null;
|
2168
|
for (var /** @type {?} */ i = 0; i < metadata.length; ++i) {
|
2169
|
var /** @type {?} */ paramMetadata = metadata[i];
|
2170
|
if (paramMetadata instanceof Type) {
|
2171
|
token = paramMetadata;
|
2172
|
}
|
2173
|
else if (paramMetadata instanceof Inject) {
|
2174
|
token = paramMetadata.token;
|
2175
|
}
|
2176
|
else if (paramMetadata instanceof Optional) {
|
2177
|
optional = true;
|
2178
|
}
|
2179
|
else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
|
2180
|
visibility = paramMetadata;
|
2181
|
}
|
2182
|
else if (paramMetadata instanceof InjectionToken) {
|
2183
|
token = paramMetadata;
|
2184
|
}
|
2185
|
}
|
2186
|
token = resolveForwardRef(token);
|
2187
|
if (token != null) {
|
2188
|
return _createDependency(token, optional, visibility);
|
2189
|
}
|
2190
|
else {
|
2191
|
throw noAnnotationError(typeOrFunc, params);
|
2192
|
}
|
2193
|
}
|
2194
|
/**
|
2195
|
* @param {?} token
|
2196
|
* @param {?} optional
|
2197
|
* @param {?} visibility
|
2198
|
* @return {?}
|
2199
|
*/
|
2200
|
function _createDependency(token, optional, visibility) {
|
2201
|
return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
|
2202
|
}
|
2203
|
/**
|
2204
|
* @license
|
2205
|
* Copyright Google Inc. All Rights Reserved.
|
2206
|
*
|
2207
|
* Use of this source code is governed by an MIT-style license that can be
|
2208
|
* found in the LICENSE file at https://angular.io/license
|
2209
|
*/
|
2210
|
// Threshold for the dynamic version
|
2211
|
var UNDEFINED = new Object();
|
2212
|
/**
|
2213
|
* A ReflectiveDependency injection container used for instantiating objects and resolving
|
2214
|
* dependencies.
|
2215
|
*
|
2216
|
* An `Injector` is a replacement for a `new` operator, which can automatically resolve the
|
2217
|
* constructor dependencies.
|
2218
|
*
|
2219
|
* In typical use, application code asks for the dependencies in the constructor and they are
|
2220
|
* resolved by the `Injector`.
|
2221
|
*
|
2222
|
* ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview))
|
2223
|
*
|
2224
|
* The following example creates an `Injector` configured to create `Engine` and `Car`.
|
2225
|
*
|
2226
|
* ```typescript
|
2227
|
* \@Injectable()
|
2228
|
* class Engine {
|
2229
|
* }
|
2230
|
*
|
2231
|
* \@Injectable()
|
2232
|
* class Car {
|
2233
|
* constructor(public engine:Engine) {}
|
2234
|
* }
|
2235
|
*
|
2236
|
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
|
2237
|
* var car = injector.get(Car);
|
2238
|
* expect(car instanceof Car).toBe(true);
|
2239
|
* expect(car.engine instanceof Engine).toBe(true);
|
2240
|
* ```
|
2241
|
*
|
2242
|
* Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
|
2243
|
* resolve all of the object's dependencies automatically.
|
2244
|
*
|
2245
|
* \@stable
|
2246
|
* @abstract
|
2247
|
*/
|
2248
|
var ReflectiveInjector = (function () {
|
2249
|
function ReflectiveInjector() {
|
2250
|
}
|
2251
|
/**
|
2252
|
* Turns an array of provider definitions into an array of resolved providers.
|
2253
|
*
|
2254
|
* A resolution is a process of flattening multiple nested arrays and converting individual
|
2255
|
* providers into an array of {\@link ResolvedReflectiveProvider}s.
|
2256
|
*
|
2257
|
* ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
|
2258
|
*
|
2259
|
* ```typescript
|
2260
|
* \@Injectable()
|
2261
|
* class Engine {
|
2262
|
* }
|
2263
|
*
|
2264
|
* \@Injectable()
|
2265
|
* class Car {
|
2266
|
* constructor(public engine:Engine) {}
|
2267
|
* }
|
2268
|
*
|
2269
|
* var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
|
2270
|
*
|
2271
|
* expect(providers.length).toEqual(2);
|
2272
|
*
|
2273
|
* expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
|
2274
|
* expect(providers[0].key.displayName).toBe("Car");
|
2275
|
* expect(providers[0].dependencies.length).toEqual(1);
|
2276
|
* expect(providers[0].factory).toBeDefined();
|
2277
|
*
|
2278
|
* expect(providers[1].key.displayName).toBe("Engine");
|
2279
|
* });
|
2280
|
* ```
|
2281
|
*
|
2282
|
* See {\@link ReflectiveInjector#fromResolvedProviders} for more info.
|
2283
|
* @param {?} providers
|
2284
|
* @return {?}
|
2285
|
*/
|
2286
|
ReflectiveInjector.resolve = function (providers) {
|
2287
|
return resolveReflectiveProviders(providers);
|
2288
|
};
|
2289
|
/**
|
2290
|
* Resolves an array of providers and creates an injector from those providers.
|
2291
|
*
|
2292
|
* The passed-in providers can be an array of `Type`, {\@link Provider},
|
2293
|
* or a recursive array of more providers.
|
2294
|
*
|
2295
|
* ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
|
2296
|
*
|
2297
|
* ```typescript
|
2298
|
* \@Injectable()
|
2299
|
* class Engine {
|
2300
|
* }
|
2301
|
*
|
2302
|
* \@Injectable()
|
2303
|
* class Car {
|
2304
|
* constructor(public engine:Engine) {}
|
2305
|
* }
|
2306
|
*
|
2307
|
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
|
2308
|
* expect(injector.get(Car) instanceof Car).toBe(true);
|
2309
|
* ```
|
2310
|
*
|
2311
|
* This function is slower than the corresponding `fromResolvedProviders`
|
2312
|
* because it needs to resolve the passed-in providers first.
|
2313
|
* See {\@link ReflectiveInjector#resolve} and {\@link ReflectiveInjector#fromResolvedProviders}.
|
2314
|
* @param {?} providers
|
2315
|
* @param {?=} parent
|
2316
|
* @return {?}
|
2317
|
*/
|
2318
|
ReflectiveInjector.resolveAndCreate = function (providers, parent) {
|
2319
|
var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
2320
|
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
2321
|
};
|
2322
|
/**
|
2323
|
* Creates an injector from previously resolved providers.
|
2324
|
*
|
2325
|
* This API is the recommended way to construct injectors in performance-sensitive parts.
|
2326
|
*
|
2327
|
* ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
|
2328
|
*
|
2329
|
* ```typescript
|
2330
|
* \@Injectable()
|
2331
|
* class Engine {
|
2332
|
* }
|
2333
|
*
|
2334
|
* \@Injectable()
|
2335
|
* class Car {
|
2336
|
* constructor(public engine:Engine) {}
|
2337
|
* }
|
2338
|
*
|
2339
|
* var providers = ReflectiveInjector.resolve([Car, Engine]);
|
2340
|
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
|
2341
|
* expect(injector.get(Car) instanceof Car).toBe(true);
|
2342
|
* ```
|
2343
|
* \@experimental
|
2344
|
* @param {?} providers
|
2345
|
* @param {?=} parent
|
2346
|
* @return {?}
|
2347
|
*/
|
2348
|
ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
|
2349
|
return new ReflectiveInjector_(providers, parent);
|
2350
|
};
|
2351
|
/**
|
2352
|
* Parent of this injector.
|
2353
|
*
|
2354
|
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
|
2355
|
* -->
|
2356
|
*
|
2357
|
* ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview))
|
2358
|
*
|
2359
|
* ```typescript
|
2360
|
* var parent = ReflectiveInjector.resolveAndCreate([]);
|
2361
|
* var child = parent.resolveAndCreateChild([]);
|
2362
|
* expect(child.parent).toBe(parent);
|
2363
|
* ```
|
2364
|
* @abstract
|
2365
|
* @return {?}
|
2366
|
*/
|
2367
|
ReflectiveInjector.prototype.parent = function () { };
|
2368
|
/**
|
2369
|
* Resolves an array of providers and creates a child injector from those providers.
|
2370
|
*
|
2371
|
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
|
2372
|
* -->
|
2373
|
*
|
2374
|
* The passed-in providers can be an array of `Type`, {\@link Provider},
|
2375
|
* or a recursive array of more providers.
|
2376
|
*
|
2377
|
* ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview))
|
2378
|
*
|
2379
|
* ```typescript
|
2380
|
* class ParentProvider {}
|
2381
|
* class ChildProvider {}
|
2382
|
*
|
2383
|
* var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]);
|
2384
|
* var child = parent.resolveAndCreateChild([ChildProvider]);
|
2385
|
*
|
2386
|
* expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true);
|
2387
|
* expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
|
2388
|
* expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
|
2389
|
* ```
|
2390
|
*
|
2391
|
* This function is slower than the corresponding `createChildFromResolved`
|
2392
|
* because it needs to resolve the passed-in providers first.
|
2393
|
* See {\@link ReflectiveInjector#resolve} and {\@link ReflectiveInjector#createChildFromResolved}.
|
2394
|
* @abstract
|
2395
|
* @param {?} providers
|
2396
|
* @return {?}
|
2397
|
*/
|
2398
|
ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { };
|
2399
|
/**
|
2400
|
* Creates a child injector from previously resolved providers.
|
2401
|
*
|
2402
|
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
|
2403
|
* -->
|
2404
|
*
|
2405
|
* This API is the recommended way to construct injectors in performance-sensitive parts.
|
2406
|
*
|
2407
|
* ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview))
|
2408
|
*
|
2409
|
* ```typescript
|
2410
|
* class ParentProvider {}
|
2411
|
* class ChildProvider {}
|
2412
|
*
|
2413
|
* var parentProviders = ReflectiveInjector.resolve([ParentProvider]);
|
2414
|
* var childProviders = ReflectiveInjector.resolve([ChildProvider]);
|
2415
|
*
|
2416
|
* var parent = ReflectiveInjector.fromResolvedProviders(parentProviders);
|
2417
|
* var child = parent.createChildFromResolved(childProviders);
|
2418
|
*
|
2419
|
* expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true);
|
2420
|
* expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
|
2421
|
* expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
|
2422
|
* ```
|
2423
|
* @abstract
|
2424
|
* @param {?} providers
|
2425
|
* @return {?}
|
2426
|
*/
|
2427
|
ReflectiveInjector.prototype.createChildFromResolved = function (providers) { };
|
2428
|
/**
|
2429
|
* Resolves a provider and instantiates an object in the context of the injector.
|
2430
|
*
|
2431
|
* The created object does not get cached by the injector.
|
2432
|
*
|
2433
|
* ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview))
|
2434
|
*
|
2435
|
* ```typescript
|
2436
|
* \@Injectable()
|
2437
|
* class Engine {
|
2438
|
* }
|
2439
|
*
|
2440
|
* \@Injectable()
|
2441
|
* class Car {
|
2442
|
* constructor(public engine:Engine) {}
|
2443
|
* }
|
2444
|
*
|
2445
|
* var injector = ReflectiveInjector.resolveAndCreate([Engine]);
|
2446
|
*
|
2447
|
* var car = injector.resolveAndInstantiate(Car);
|
2448
|
* expect(car.engine).toBe(injector.get(Engine));
|
2449
|
* expect(car).not.toBe(injector.resolveAndInstantiate(Car));
|
2450
|
* ```
|
2451
|
* @abstract
|
2452
|
* @param {?} provider
|
2453
|
* @return {?}
|
2454
|
*/
|
2455
|
ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { };
|
2456
|
/**
|
2457
|
* Instantiates an object using a resolved provider in the context of the injector.
|
2458
|
*
|
2459
|
* The created object does not get cached by the injector.
|
2460
|
*
|
2461
|
* ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview))
|
2462
|
*
|
2463
|
* ```typescript
|
2464
|
* \@Injectable()
|
2465
|
* class Engine {
|
2466
|
* }
|
2467
|
*
|
2468
|
* \@Injectable()
|
2469
|
* class Car {
|
2470
|
* constructor(public engine:Engine) {}
|
2471
|
* }
|
2472
|
*
|
2473
|
* var injector = ReflectiveInjector.resolveAndCreate([Engine]);
|
2474
|
* var carProvider = ReflectiveInjector.resolve([Car])[0];
|
2475
|
* var car = injector.instantiateResolved(carProvider);
|
2476
|
* expect(car.engine).toBe(injector.get(Engine));
|
2477
|
* expect(car).not.toBe(injector.instantiateResolved(carProvider));
|
2478
|
* ```
|
2479
|
* @abstract
|
2480
|
* @param {?} provider
|
2481
|
* @return {?}
|
2482
|
*/
|
2483
|
ReflectiveInjector.prototype.instantiateResolved = function (provider) { };
|
2484
|
/**
|
2485
|
* @abstract
|
2486
|
* @param {?} token
|
2487
|
* @param {?=} notFoundValue
|
2488
|
* @return {?}
|
2489
|
*/
|
2490
|
ReflectiveInjector.prototype.get = function (token, notFoundValue) { };
|
2491
|
return ReflectiveInjector;
|
2492
|
}());
|
2493
|
var ReflectiveInjector_ = (function () {
|
2494
|
/**
|
2495
|
* Private
|
2496
|
* @param {?} _providers
|
2497
|
* @param {?=} _parent
|
2498
|
*/
|
2499
|
function ReflectiveInjector_(_providers, _parent) {
|
2500
|
/**
|
2501
|
* \@internal
|
2502
|
*/
|
2503
|
this._constructionCounter = 0;
|
2504
|
this._providers = _providers;
|
2505
|
this._parent = _parent || null;
|
2506
|
var len = _providers.length;
|
2507
|
this.keyIds = new Array(len);
|
2508
|
this.objs = new Array(len);
|
2509
|
for (var i = 0; i < len; i++) {
|
2510
|
this.keyIds[i] = _providers[i].key.id;
|
2511
|
this.objs[i] = UNDEFINED;
|
2512
|
}
|
2513
|
}
|
2514
|
/**
|
2515
|
* @param {?} token
|
2516
|
* @param {?=} notFoundValue
|
2517
|
* @return {?}
|
2518
|
*/
|
2519
|
ReflectiveInjector_.prototype.get = function (token, notFoundValue) {
|
2520
|
if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
|
2521
|
return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
|
2522
|
};
|
2523
|
Object.defineProperty(ReflectiveInjector_.prototype, "parent", {
|
2524
|
/**
|
2525
|
* @return {?}
|
2526
|
*/
|
2527
|
get: function () { return this._parent; },
|
2528
|
enumerable: true,
|
2529
|
configurable: true
|
2530
|
});
|
2531
|
/**
|
2532
|
* @param {?} providers
|
2533
|
* @return {?}
|
2534
|
*/
|
2535
|
ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) {
|
2536
|
var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
2537
|
return this.createChildFromResolved(ResolvedReflectiveProviders);
|
2538
|
};
|
2539
|
/**
|
2540
|
* @param {?} providers
|
2541
|
* @return {?}
|
2542
|
*/
|
2543
|
ReflectiveInjector_.prototype.createChildFromResolved = function (providers) {
|
2544
|
var /** @type {?} */ inj = new ReflectiveInjector_(providers);
|
2545
|
inj._parent = this;
|
2546
|
return inj;
|
2547
|
};
|
2548
|
/**
|
2549
|
* @param {?} provider
|
2550
|
* @return {?}
|
2551
|
*/
|
2552
|
ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) {
|
2553
|
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
2554
|
};
|
2555
|
/**
|
2556
|
* @param {?} provider
|
2557
|
* @return {?}
|
2558
|
*/
|
2559
|
ReflectiveInjector_.prototype.instantiateResolved = function (provider) {
|
2560
|
return this._instantiateProvider(provider);
|
2561
|
};
|
2562
|
/**
|
2563
|
* @param {?} index
|
2564
|
* @return {?}
|
2565
|
*/
|
2566
|
ReflectiveInjector_.prototype.getProviderAtIndex = function (index) {
|
2567
|
if (index < 0 || index >= this._providers.length) {
|
2568
|
throw outOfBoundsError(index);
|
2569
|
}
|
2570
|
return this._providers[index];
|
2571
|
};
|
2572
|
/**
|
2573
|
* \@internal
|
2574
|
* @param {?} provider
|
2575
|
* @return {?}
|
2576
|
*/
|
2577
|
ReflectiveInjector_.prototype._new = function (provider) {
|
2578
|
if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
|
2579
|
throw cyclicDependencyError(this, provider.key);
|
2580
|
}
|
2581
|
return this._instantiateProvider(provider);
|
2582
|
};
|
2583
|
/**
|
2584
|
* @return {?}
|
2585
|
*/
|
2586
|
ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; };
|
2587
|
/**
|
2588
|
* @param {?} provider
|
2589
|
* @return {?}
|
2590
|
*/
|
2591
|
ReflectiveInjector_.prototype._instantiateProvider = function (provider) {
|
2592
|
if (provider.multiProvider) {
|
2593
|
var /** @type {?} */ res = new Array(provider.resolvedFactories.length);
|
2594
|
for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) {
|
2595
|
res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
|
2596
|
}
|
2597
|
return res;
|
2598
|
}
|
2599
|
else {
|
2600
|
return this._instantiate(provider, provider.resolvedFactories[0]);
|
2601
|
}
|
2602
|
};
|
2603
|
/**
|
2604
|
* @param {?} provider
|
2605
|
* @param {?} ResolvedReflectiveFactory
|
2606
|
* @return {?}
|
2607
|
*/
|
2608
|
ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) {
|
2609
|
var _this = this;
|
2610
|
var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory;
|
2611
|
var /** @type {?} */ deps;
|
2612
|
try {
|
2613
|
deps =
|
2614
|
ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
|
2615
|
}
|
2616
|
catch (e) {
|
2617
|
if (e.addKey) {
|
2618
|
e.addKey(this, provider.key);
|
2619
|
}
|
2620
|
throw e;
|
2621
|
}
|
2622
|
var /** @type {?} */ obj;
|
2623
|
try {
|
2624
|
obj = factory.apply(void 0, deps);
|
2625
|
}
|
2626
|
catch (e) {
|
2627
|
throw instantiationError(this, e, e.stack, provider.key);
|
2628
|
}
|
2629
|
return obj;
|
2630
|
};
|
2631
|
/**
|
2632
|
* @param {?} dep
|
2633
|
* @return {?}
|
2634
|
*/
|
2635
|
ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) {
|
2636
|
return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
|
2637
|
};
|
2638
|
/**
|
2639
|
* @param {?} key
|
2640
|
* @param {?} visibility
|
2641
|
* @param {?} notFoundValue
|
2642
|
* @return {?}
|
2643
|
*/
|
2644
|
ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) {
|
2645
|
if (key === INJECTOR_KEY) {
|
2646
|
return this;
|
2647
|
}
|
2648
|
if (visibility instanceof Self) {
|
2649
|
return this._getByKeySelf(key, notFoundValue);
|
2650
|
}
|
2651
|
else {
|
2652
|
return this._getByKeyDefault(key, notFoundValue, visibility);
|
2653
|
}
|
2654
|
};
|
2655
|
/**
|
2656
|
* @param {?} keyId
|
2657
|
* @return {?}
|
2658
|
*/
|
2659
|
ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) {
|
2660
|
for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) {
|
2661
|
if (this.keyIds[i] === keyId) {
|
2662
|
if (this.objs[i] === UNDEFINED) {
|
2663
|
this.objs[i] = this._new(this._providers[i]);
|
2664
|
}
|
2665
|
return this.objs[i];
|
2666
|
}
|
2667
|
}
|
2668
|
return UNDEFINED;
|
2669
|
};
|
2670
|
/**
|
2671
|
* \@internal
|
2672
|
* @param {?} key
|
2673
|
* @param {?} notFoundValue
|
2674
|
* @return {?}
|
2675
|
*/
|
2676
|
ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) {
|
2677
|
if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
2678
|
return notFoundValue;
|
2679
|
}
|
2680
|
else {
|
2681
|
throw noProviderError(this, key);
|
2682
|
}
|
2683
|
};
|
2684
|
/**
|
2685
|
* \@internal
|
2686
|
* @param {?} key
|
2687
|
* @param {?} notFoundValue
|
2688
|
* @return {?}
|
2689
|
*/
|
2690
|
ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) {
|
2691
|
var /** @type {?} */ obj = this._getObjByKeyId(key.id);
|
2692
|
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
2693
|
};
|
2694
|
/**
|
2695
|
* \@internal
|
2696
|
* @param {?} key
|
2697
|
* @param {?} notFoundValue
|
2698
|
* @param {?} visibility
|
2699
|
* @return {?}
|
2700
|
*/
|
2701
|
ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) {
|
2702
|
var /** @type {?} */ inj;
|
2703
|
if (visibility instanceof SkipSelf) {
|
2704
|
inj = this._parent;
|
2705
|
}
|
2706
|
else {
|
2707
|
inj = this;
|
2708
|
}
|
2709
|
while (inj instanceof ReflectiveInjector_) {
|
2710
|
var /** @type {?} */ inj_ = (inj);
|
2711
|
var /** @type {?} */ obj = inj_._getObjByKeyId(key.id);
|
2712
|
if (obj !== UNDEFINED)
|
2713
|
return obj;
|
2714
|
inj = inj_._parent;
|
2715
|
}
|
2716
|
if (inj !== null) {
|
2717
|
return inj.get(key.token, notFoundValue);
|
2718
|
}
|
2719
|
else {
|
2720
|
return this._throwOrNull(key, notFoundValue);
|
2721
|
}
|
2722
|
};
|
2723
|
Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
|
2724
|
/**
|
2725
|
* @return {?}
|
2726
|
*/
|
2727
|
get: function () {
|
2728
|
var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
|
2729
|
.join(', ');
|
2730
|
return "ReflectiveInjector(providers: [" + providers + "])";
|
2731
|
},
|
2732
|
enumerable: true,
|
2733
|
configurable: true
|
2734
|
});
|
2735
|
/**
|
2736
|
* @return {?}
|
2737
|
*/
|
2738
|
ReflectiveInjector_.prototype.toString = function () { return this.displayName; };
|
2739
|
return ReflectiveInjector_;
|
2740
|
}());
|
2741
|
var INJECTOR_KEY = ReflectiveKey.get(Injector);
|
2742
|
/**
|
2743
|
* @param {?} injector
|
2744
|
* @param {?} fn
|
2745
|
* @return {?}
|
2746
|
*/
|
2747
|
function _mapProviders(injector, fn) {
|
2748
|
var /** @type {?} */ res = new Array(injector._providers.length);
|
2749
|
for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) {
|
2750
|
res[i] = fn(injector.getProviderAtIndex(i));
|
2751
|
}
|
2752
|
return res;
|
2753
|
}
|
2754
|
/**
|
2755
|
* @license
|
2756
|
* Copyright Google Inc. All Rights Reserved.
|
2757
|
*
|
2758
|
* Use of this source code is governed by an MIT-style license that can be
|
2759
|
* found in the LICENSE file at https://angular.io/license
|
2760
|
*/
|
2761
|
/**
|
2762
|
* @module
|
2763
|
* @description
|
2764
|
* The `di` module provides dependency injection container services.
|
2765
|
*/
|
2766
|
/**
|
2767
|
* @license
|
2768
|
* Copyright Google Inc. All Rights Reserved.
|
2769
|
*
|
2770
|
* Use of this source code is governed by an MIT-style license that can be
|
2771
|
* found in the LICENSE file at https://angular.io/license
|
2772
|
*/
|
2773
|
/**
|
2774
|
* Determine if the argument is shaped like a Promise
|
2775
|
* @param {?} obj
|
2776
|
* @return {?}
|
2777
|
*/
|
2778
|
function isPromise(obj) {
|
2779
|
// allow any Promise/A+ compliant thenable.
|
2780
|
// It's up to the caller to ensure that obj.then conforms to the spec
|
2781
|
return !!obj && typeof obj.then === 'function';
|
2782
|
}
|
2783
|
/**
|
2784
|
* Determine if the argument is an Observable
|
2785
|
* @param {?} obj
|
2786
|
* @return {?}
|
2787
|
*/
|
2788
|
function isObservable(obj) {
|
2789
|
// TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
|
2790
|
return !!obj && typeof obj.subscribe === 'function';
|
2791
|
}
|
2792
|
/**
|
2793
|
* @license
|
2794
|
* Copyright Google Inc. All Rights Reserved.
|
2795
|
*
|
2796
|
* Use of this source code is governed by an MIT-style license that can be
|
2797
|
* found in the LICENSE file at https://angular.io/license
|
2798
|
*/
|
2799
|
/**
|
2800
|
* A function that will be executed when an application is initialized.
|
2801
|
* \@experimental
|
2802
|
*/
|
2803
|
var APP_INITIALIZER = new InjectionToken('Application Initializer');
|
2804
|
/**
|
2805
|
* A class that reflects the state of running {\@link APP_INITIALIZER}s.
|
2806
|
*
|
2807
|
* \@experimental
|
2808
|
*/
|
2809
|
var ApplicationInitStatus = (function () {
|
2810
|
/**
|
2811
|
* @param {?} appInits
|
2812
|
*/
|
2813
|
function ApplicationInitStatus(appInits) {
|
2814
|
var _this = this;
|
2815
|
this.appInits = appInits;
|
2816
|
this.initialized = false;
|
2817
|
this._done = false;
|
2818
|
this._donePromise = new Promise(function (res, rej) {
|
2819
|
_this.resolve = res;
|
2820
|
_this.reject = rej;
|
2821
|
});
|
2822
|
}
|
2823
|
/**
|
2824
|
* \@internal
|
2825
|
* @return {?}
|
2826
|
*/
|
2827
|
ApplicationInitStatus.prototype.runInitializers = function () {
|
2828
|
var _this = this;
|
2829
|
if (this.initialized) {
|
2830
|
return;
|
2831
|
}
|
2832
|
var /** @type {?} */ asyncInitPromises = [];
|
2833
|
var /** @type {?} */ complete = function () {
|
2834
|
_this._done = true;
|
2835
|
_this.resolve();
|
2836
|
};
|
2837
|
if (this.appInits) {
|
2838
|
for (var /** @type {?} */ i = 0; i < this.appInits.length; i++) {
|
2839
|
var /** @type {?} */ initResult = this.appInits[i]();
|
2840
|
if (isPromise(initResult)) {
|
2841
|
asyncInitPromises.push(initResult);
|
2842
|
}
|
2843
|
}
|
2844
|
}
|
2845
|
Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
|
2846
|
if (asyncInitPromises.length === 0) {
|
2847
|
complete();
|
2848
|
}
|
2849
|
this.initialized = true;
|
2850
|
};
|
2851
|
Object.defineProperty(ApplicationInitStatus.prototype, "done", {
|
2852
|
/**
|
2853
|
* @return {?}
|
2854
|
*/
|
2855
|
get: function () { return this._done; },
|
2856
|
enumerable: true,
|
2857
|
configurable: true
|
2858
|
});
|
2859
|
Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", {
|
2860
|
/**
|
2861
|
* @return {?}
|
2862
|
*/
|
2863
|
get: function () { return this._donePromise; },
|
2864
|
enumerable: true,
|
2865
|
configurable: true
|
2866
|
});
|
2867
|
return ApplicationInitStatus;
|
2868
|
}());
|
2869
|
ApplicationInitStatus.decorators = [
|
2870
|
{ type: Injectable },
|
2871
|
];
|
2872
|
/**
|
2873
|
* @nocollapse
|
2874
|
*/
|
2875
|
ApplicationInitStatus.ctorParameters = function () { return [
|
2876
|
{ type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
|
2877
|
]; };
|
2878
|
/**
|
2879
|
* @license
|
2880
|
* Copyright Google Inc. All Rights Reserved.
|
2881
|
*
|
2882
|
* Use of this source code is governed by an MIT-style license that can be
|
2883
|
* found in the LICENSE file at https://angular.io/license
|
2884
|
*/
|
2885
|
/**
|
2886
|
* A DI Token representing a unique string id assigned to the application by Angular and used
|
2887
|
* primarily for prefixing application attributes and CSS styles when
|
2888
|
* {\@link ViewEncapsulation#Emulated} is being used.
|
2889
|
*
|
2890
|
* If you need to avoid randomly generated value to be used as an application id, you can provide
|
2891
|
* a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector}
|
2892
|
* using this token.
|
2893
|
* \@experimental
|
2894
|
*/
|
2895
|
var APP_ID = new InjectionToken('AppId');
|
2896
|
/**
|
2897
|
* @return {?}
|
2898
|
*/
|
2899
|
function _appIdRandomProviderFactory() {
|
2900
|
return "" + _randomChar() + _randomChar() + _randomChar();
|
2901
|
}
|
2902
|
/**
|
2903
|
* Providers that will generate a random APP_ID_TOKEN.
|
2904
|
* \@experimental
|
2905
|
*/
|
2906
|
var APP_ID_RANDOM_PROVIDER = {
|
2907
|
provide: APP_ID,
|
2908
|
useFactory: _appIdRandomProviderFactory,
|
2909
|
deps: [],
|
2910
|
};
|
2911
|
/**
|
2912
|
* @return {?}
|
2913
|
*/
|
2914
|
function _randomChar() {
|
2915
|
return String.fromCharCode(97 + Math.floor(Math.random() * 25));
|
2916
|
}
|
2917
|
/**
|
2918
|
* A function that will be executed when a platform is initialized.
|
2919
|
* \@experimental
|
2920
|
*/
|
2921
|
var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
|
2922
|
/**
|
2923
|
* A token that indicates an opaque platform id.
|
2924
|
* \@experimental
|
2925
|
*/
|
2926
|
var PLATFORM_ID = new InjectionToken('Platform ID');
|
2927
|
/**
|
2928
|
* All callbacks provided via this token will be called for every component that is bootstrapped.
|
2929
|
* Signature of the callback:
|
2930
|
*
|
2931
|
* `(componentRef: ComponentRef) => void`.
|
2932
|
*
|
2933
|
* \@experimental
|
2934
|
*/
|
2935
|
var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
|
2936
|
/**
|
2937
|
* A token which indicates the root directory of the application
|
2938
|
* \@experimental
|
2939
|
*/
|
2940
|
var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
|
2941
|
/**
|
2942
|
* @license
|
2943
|
* Copyright Google Inc. All Rights Reserved.
|
2944
|
*
|
2945
|
* Use of this source code is governed by an MIT-style license that can be
|
2946
|
* found in the LICENSE file at https://angular.io/license
|
2947
|
*/
|
2948
|
var Console = (function () {
|
2949
|
function Console() {
|
2950
|
}
|
2951
|
/**
|
2952
|
* @param {?} message
|
2953
|
* @return {?}
|
2954
|
*/
|
2955
|
Console.prototype.log = function (message) {
|
2956
|
// tslint:disable-next-line:no-console
|
2957
|
console.log(message);
|
2958
|
};
|
2959
|
/**
|
2960
|
* @param {?} message
|
2961
|
* @return {?}
|
2962
|
*/
|
2963
|
Console.prototype.warn = function (message) {
|
2964
|
// tslint:disable-next-line:no-console
|
2965
|
console.warn(message);
|
2966
|
};
|
2967
|
return Console;
|
2968
|
}());
|
2969
|
Console.decorators = [
|
2970
|
{ type: Injectable },
|
2971
|
];
|
2972
|
/**
|
2973
|
* @nocollapse
|
2974
|
*/
|
2975
|
Console.ctorParameters = function () { return []; };
|
2976
|
/**
|
2977
|
* @license
|
2978
|
* Copyright Google Inc. All Rights Reserved.
|
2979
|
*
|
2980
|
* Use of this source code is governed by an MIT-style license that can be
|
2981
|
* found in the LICENSE file at https://angular.io/license
|
2982
|
*/
|
2983
|
/**
|
2984
|
* Combination of NgModuleFactory and ComponentFactorys.
|
2985
|
*
|
2986
|
* \@experimental
|
2987
|
*/
|
2988
|
var ModuleWithComponentFactories = (function () {
|
2989
|
/**
|
2990
|
* @param {?} ngModuleFactory
|
2991
|
* @param {?} componentFactories
|
2992
|
*/
|
2993
|
function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
|
2994
|
this.ngModuleFactory = ngModuleFactory;
|
2995
|
this.componentFactories = componentFactories;
|
2996
|
}
|
2997
|
return ModuleWithComponentFactories;
|
2998
|
}());
|
2999
|
/**
|
3000
|
* @return {?}
|
3001
|
*/
|
3002
|
function _throwError() {
|
3003
|
throw new Error("Runtime compiler is not loaded");
|
3004
|
}
|
3005
|
/**
|
3006
|
* Low-level service for running the angular compiler during runtime
|
3007
|
* to create {\@link ComponentFactory}s, which
|
3008
|
* can later be used to create and render a Component instance.
|
3009
|
*
|
3010
|
* Each `\@NgModule` provides an own `Compiler` to its injector,
|
3011
|
* that will use the directives/pipes of the ng module for compilation
|
3012
|
* of components.
|
3013
|
* \@stable
|
3014
|
*/
|
3015
|
var Compiler = (function () {
|
3016
|
function Compiler() {
|
3017
|
}
|
3018
|
/**
|
3019
|
* Compiles the given NgModule and all of its components. All templates of the components listed
|
3020
|
* in `entryComponents` have to be inlined.
|
3021
|
* @template T
|
3022
|
* @param {?} moduleType
|
3023
|
* @return {?}
|
3024
|
*/
|
3025
|
Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); };
|
3026
|
/**
|
3027
|
* Compiles the given NgModule and all of its components
|
3028
|
* @template T
|
3029
|
* @param {?} moduleType
|
3030
|
* @return {?}
|
3031
|
*/
|
3032
|
Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); };
|
3033
|
/**
|
3034
|
* Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
|
3035
|
* @template T
|
3036
|
* @param {?} moduleType
|
3037
|
* @return {?}
|
3038
|
*/
|
3039
|
Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
|
3040
|
throw _throwError();
|
3041
|
};
|
3042
|
/**
|
3043
|
* Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
|
3044
|
* @template T
|
3045
|
* @param {?} moduleType
|
3046
|
* @return {?}
|
3047
|
*/
|
3048
|
Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
|
3049
|
throw _throwError();
|
3050
|
};
|
3051
|
/**
|
3052
|
* Exposes the CSS-style selectors that have been used in `ngContent` directives within
|
3053
|
* the template of the given component.
|
3054
|
* This is used by the `upgrade` library to compile the appropriate transclude content
|
3055
|
* in the AngularJS wrapper component.
|
3056
|
*
|
3057
|
* @deprecated since v4. Use ComponentFactory.ngContentSelectors instead.
|
3058
|
* @param {?} component
|
3059
|
* @return {?}
|
3060
|
*/
|
3061
|
Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); };
|
3062
|
/**
|
3063
|
* Clears all caches.
|
3064
|
* @return {?}
|
3065
|
*/
|
3066
|
Compiler.prototype.clearCache = function () { };
|
3067
|
/**
|
3068
|
* Clears the cache for the given component/ngModule.
|
3069
|
* @param {?} type
|
3070
|
* @return {?}
|
3071
|
*/
|
3072
|
Compiler.prototype.clearCacheFor = function (type) { };
|
3073
|
return Compiler;
|
3074
|
}());
|
3075
|
Compiler.decorators = [
|
3076
|
{ type: Injectable },
|
3077
|
];
|
3078
|
/**
|
3079
|
* @nocollapse
|
3080
|
*/
|
3081
|
Compiler.ctorParameters = function () { return []; };
|
3082
|
/**
|
3083
|
* Token to provide CompilerOptions in the platform injector.
|
3084
|
*
|
3085
|
* \@experimental
|
3086
|
*/
|
3087
|
var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
|
3088
|
/**
|
3089
|
* A factory for creating a Compiler
|
3090
|
*
|
3091
|
* \@experimental
|
3092
|
* @abstract
|
3093
|
*/
|
3094
|
var CompilerFactory = (function () {
|
3095
|
function CompilerFactory() {
|
3096
|
}
|
3097
|
/**
|
3098
|
* @abstract
|
3099
|
* @param {?=} options
|
3100
|
* @return {?}
|
3101
|
*/
|
3102
|
CompilerFactory.prototype.createCompiler = function (options) { };
|
3103
|
return CompilerFactory;
|
3104
|
}());
|
3105
|
/**
|
3106
|
* @license
|
3107
|
* Copyright Google Inc. All Rights Reserved.
|
3108
|
*
|
3109
|
* Use of this source code is governed by an MIT-style license that can be
|
3110
|
* found in the LICENSE file at https://angular.io/license
|
3111
|
*/
|
3112
|
/**
|
3113
|
* Represents an instance of a Component created via a {\@link ComponentFactory}.
|
3114
|
*
|
3115
|
* `ComponentRef` provides access to the Component Instance as well other objects related to this
|
3116
|
* Component Instance and allows you to destroy the Component Instance via the {\@link #destroy}
|
3117
|
* method.
|
3118
|
* \@stable
|
3119
|
* @abstract
|
3120
|
*/
|
3121
|
var ComponentRef = (function () {
|
3122
|
function ComponentRef() {
|
3123
|
}
|
3124
|
/**
|
3125
|
* Location of the Host Element of this Component Instance.
|
3126
|
* @abstract
|
3127
|
* @return {?}
|
3128
|
*/
|
3129
|
ComponentRef.prototype.location = function () { };
|
3130
|
/**
|
3131
|
* The injector on which the component instance exists.
|
3132
|
* @abstract
|
3133
|
* @return {?}
|
3134
|
*/
|
3135
|
ComponentRef.prototype.injector = function () { };
|
3136
|
/**
|
3137
|
* The instance of the Component.
|
3138
|
* @abstract
|
3139
|
* @return {?}
|
3140
|
*/
|
3141
|
ComponentRef.prototype.instance = function () { };
|
3142
|
/**
|
3143
|
* The {\@link ViewRef} of the Host View of this Component instance.
|
3144
|
* @abstract
|
3145
|
* @return {?}
|
3146
|
*/
|
3147
|
ComponentRef.prototype.hostView = function () { };
|
3148
|
/**
|
3149
|
* The {\@link ChangeDetectorRef} of the Component instance.
|
3150
|
* @abstract
|
3151
|
* @return {?}
|
3152
|
*/
|
3153
|
ComponentRef.prototype.changeDetectorRef = function () { };
|
3154
|
/**
|
3155
|
* The component type.
|
3156
|
* @abstract
|
3157
|
* @return {?}
|
3158
|
*/
|
3159
|
ComponentRef.prototype.componentType = function () { };
|
3160
|
/**
|
3161
|
* Destroys the component instance and all of the data structures associated with it.
|
3162
|
* @abstract
|
3163
|
* @return {?}
|
3164
|
*/
|
3165
|
ComponentRef.prototype.destroy = function () { };
|
3166
|
/**
|
3167
|
* Allows to register a callback that will be called when the component is destroyed.
|
3168
|
* @abstract
|
3169
|
* @param {?} callback
|
3170
|
* @return {?}
|
3171
|
*/
|
3172
|
ComponentRef.prototype.onDestroy = function (callback) { };
|
3173
|
return ComponentRef;
|
3174
|
}());
|
3175
|
/**
|
3176
|
* \@stable
|
3177
|
* @abstract
|
3178
|
*/
|
3179
|
var ComponentFactory = (function () {
|
3180
|
function ComponentFactory() {
|
3181
|
}
|
3182
|
/**
|
3183
|
* @abstract
|
3184
|
* @return {?}
|
3185
|
*/
|
3186
|
ComponentFactory.prototype.selector = function () { };
|
3187
|
/**
|
3188
|
* @abstract
|
3189
|
* @return {?}
|
3190
|
*/
|
3191
|
ComponentFactory.prototype.componentType = function () { };
|
3192
|
/**
|
3193
|
* selector for all <ng-content> elements in the component.
|
3194
|
* @abstract
|
3195
|
* @return {?}
|
3196
|
*/
|
3197
|
ComponentFactory.prototype.ngContentSelectors = function () { };
|
3198
|
/**
|
3199
|
* the inputs of the component.
|
3200
|
* @abstract
|
3201
|
* @return {?}
|
3202
|
*/
|
3203
|
ComponentFactory.prototype.inputs = function () { };
|
3204
|
/**
|
3205
|
* the outputs of the component.
|
3206
|
* @abstract
|
3207
|
* @return {?}
|
3208
|
*/
|
3209
|
ComponentFactory.prototype.outputs = function () { };
|
3210
|
/**
|
3211
|
* Creates a new component.
|
3212
|
* @abstract
|
3213
|
* @param {?} injector
|
3214
|
* @param {?=} projectableNodes
|
3215
|
* @param {?=} rootSelectorOrNode
|
3216
|
* @param {?=} ngModule
|
3217
|
* @return {?}
|
3218
|
*/
|
3219
|
ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { };
|
3220
|
return ComponentFactory;
|
3221
|
}());
|
3222
|
/**
|
3223
|
* @license
|
3224
|
* Copyright Google Inc. All Rights Reserved.
|
3225
|
*
|
3226
|
* Use of this source code is governed by an MIT-style license that can be
|
3227
|
* found in the LICENSE file at https://angular.io/license
|
3228
|
*/
|
3229
|
/**
|
3230
|
* @param {?} component
|
3231
|
* @return {?}
|
3232
|
*/
|
3233
|
function noComponentFactoryError(component) {
|
3234
|
var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
|
3235
|
((error))[ERROR_COMPONENT] = component;
|
3236
|
return error;
|
3237
|
}
|
3238
|
var ERROR_COMPONENT = 'ngComponent';
|
3239
|
/**
|
3240
|
* @param {?} error
|
3241
|
* @return {?}
|
3242
|
*/
|
3243
|
var _NullComponentFactoryResolver = (function () {
|
3244
|
function _NullComponentFactoryResolver() {
|
3245
|
}
|
3246
|
/**
|
3247
|
* @template T
|
3248
|
* @param {?} component
|
3249
|
* @return {?}
|
3250
|
*/
|
3251
|
_NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
|
3252
|
throw noComponentFactoryError(component);
|
3253
|
};
|
3254
|
return _NullComponentFactoryResolver;
|
3255
|
}());
|
3256
|
/**
|
3257
|
* \@stable
|
3258
|
* @abstract
|
3259
|
*/
|
3260
|
var ComponentFactoryResolver = (function () {
|
3261
|
function ComponentFactoryResolver() {
|
3262
|
}
|
3263
|
/**
|
3264
|
* @abstract
|
3265
|
* @template T
|
3266
|
* @param {?} component
|
3267
|
* @return {?}
|
3268
|
*/
|
3269
|
ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { };
|
3270
|
return ComponentFactoryResolver;
|
3271
|
}());
|
3272
|
ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
|
3273
|
var CodegenComponentFactoryResolver = (function () {
|
3274
|
/**
|
3275
|
* @param {?} factories
|
3276
|
* @param {?} _parent
|
3277
|
* @param {?} _ngModule
|
3278
|
*/
|
3279
|
function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
|
3280
|
this._parent = _parent;
|
3281
|
this._ngModule = _ngModule;
|
3282
|
this._factories = new Map();
|
3283
|
for (var i = 0; i < factories.length; i++) {
|
3284
|
var factory = factories[i];
|
3285
|
this._factories.set(factory.componentType, factory);
|
3286
|
}
|
3287
|
}
|
3288
|
/**
|
3289
|
* @template T
|
3290
|
* @param {?} component
|
3291
|
* @return {?}
|
3292
|
*/
|
3293
|
CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
|
3294
|
var /** @type {?} */ factory = this._factories.get(component);
|
3295
|
if (!factory && this._parent) {
|
3296
|
factory = this._parent.resolveComponentFactory(component);
|
3297
|
}
|
3298
|
if (!factory) {
|
3299
|
throw noComponentFactoryError(component);
|
3300
|
}
|
3301
|
return new ComponentFactoryBoundToModule(factory, this._ngModule);
|
3302
|
};
|
3303
|
return CodegenComponentFactoryResolver;
|
3304
|
}());
|
3305
|
var ComponentFactoryBoundToModule = (function (_super) {
|
3306
|
__extends(ComponentFactoryBoundToModule, _super);
|
3307
|
/**
|
3308
|
* @param {?} factory
|
3309
|
* @param {?} ngModule
|
3310
|
*/
|
3311
|
function ComponentFactoryBoundToModule(factory, ngModule) {
|
3312
|
var _this = _super.call(this) || this;
|
3313
|
_this.factory = factory;
|
3314
|
_this.ngModule = ngModule;
|
3315
|
return _this;
|
3316
|
}
|
3317
|
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", {
|
3318
|
/**
|
3319
|
* @return {?}
|
3320
|
*/
|
3321
|
get: function () { return this.factory.selector; },
|
3322
|
enumerable: true,
|
3323
|
configurable: true
|
3324
|
});
|
3325
|
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", {
|
3326
|
/**
|
3327
|
* @return {?}
|
3328
|
*/
|
3329
|
get: function () { return this.factory.componentType; },
|
3330
|
enumerable: true,
|
3331
|
configurable: true
|
3332
|
});
|
3333
|
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", {
|
3334
|
/**
|
3335
|
* @return {?}
|
3336
|
*/
|
3337
|
get: function () { return this.factory.ngContentSelectors; },
|
3338
|
enumerable: true,
|
3339
|
configurable: true
|
3340
|
});
|
3341
|
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", {
|
3342
|
/**
|
3343
|
* @return {?}
|
3344
|
*/
|
3345
|
get: function () { return this.factory.inputs; },
|
3346
|
enumerable: true,
|
3347
|
configurable: true
|
3348
|
});
|
3349
|
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", {
|
3350
|
/**
|
3351
|
* @return {?}
|
3352
|
*/
|
3353
|
get: function () { return this.factory.outputs; },
|
3354
|
enumerable: true,
|
3355
|
configurable: true
|
3356
|
});
|
3357
|
/**
|
3358
|
* @param {?} injector
|
3359
|
* @param {?=} projectableNodes
|
3360
|
* @param {?=} rootSelectorOrNode
|
3361
|
* @param {?=} ngModule
|
3362
|
* @return {?}
|
3363
|
*/
|
3364
|
ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
3365
|
return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
|
3366
|
};
|
3367
|
return ComponentFactoryBoundToModule;
|
3368
|
}(ComponentFactory));
|
3369
|
/**
|
3370
|
* @license
|
3371
|
* Copyright Google Inc. All Rights Reserved.
|
3372
|
*
|
3373
|
* Use of this source code is governed by an MIT-style license that can be
|
3374
|
* found in the LICENSE file at https://angular.io/license
|
3375
|
*/
|
3376
|
/**
|
3377
|
* Represents an instance of an NgModule created via a {\@link NgModuleFactory}.
|
3378
|
*
|
3379
|
* `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
|
3380
|
* NgModule Instance.
|
3381
|
*
|
3382
|
* \@stable
|
3383
|
* @abstract
|
3384
|
*/
|
3385
|
var NgModuleRef = (function () {
|
3386
|
function NgModuleRef() {
|
3387
|
}
|
3388
|
/**
|
3389
|
* The injector that contains all of the providers of the NgModule.
|
3390
|
* @abstract
|
3391
|
* @return {?}
|
3392
|
*/
|
3393
|
NgModuleRef.prototype.injector = function () { };
|
3394
|
/**
|
3395
|
* The ComponentFactoryResolver to get hold of the ComponentFactories
|
3396
|
* declared in the `entryComponents` property of the module.
|
3397
|
* @abstract
|
3398
|
* @return {?}
|
3399
|
*/
|
3400
|
NgModuleRef.prototype.componentFactoryResolver = function () { };
|
3401
|
/**
|
3402
|
* The NgModule instance.
|
3403
|
* @abstract
|
3404
|
* @return {?}
|
3405
|
*/
|
3406
|
NgModuleRef.prototype.instance = function () { };
|
3407
|
/**
|
3408
|
* Destroys the module instance and all of the data structures associated with it.
|
3409
|
* @abstract
|
3410
|
* @return {?}
|
3411
|
*/
|
3412
|
NgModuleRef.prototype.destroy = function () { };
|
3413
|
/**
|
3414
|
* Allows to register a callback that will be called when the module is destroyed.
|
3415
|
* @abstract
|
3416
|
* @param {?} callback
|
3417
|
* @return {?}
|
3418
|
*/
|
3419
|
NgModuleRef.prototype.onDestroy = function (callback) { };
|
3420
|
return NgModuleRef;
|
3421
|
}());
|
3422
|
/**
|
3423
|
* \@experimental
|
3424
|
* @abstract
|
3425
|
*/
|
3426
|
var NgModuleFactory = (function () {
|
3427
|
function NgModuleFactory() {
|
3428
|
}
|
3429
|
/**
|
3430
|
* @abstract
|
3431
|
* @return {?}
|
3432
|
*/
|
3433
|
NgModuleFactory.prototype.moduleType = function () { };
|
3434
|
/**
|
3435
|
* @abstract
|
3436
|
* @param {?} parentInjector
|
3437
|
* @return {?}
|
3438
|
*/
|
3439
|
NgModuleFactory.prototype.create = function (parentInjector) { };
|
3440
|
return NgModuleFactory;
|
3441
|
}());
|
3442
|
/**
|
3443
|
* @license
|
3444
|
* Copyright Google Inc. All Rights Reserved.
|
3445
|
*
|
3446
|
* Use of this source code is governed by an MIT-style license that can be
|
3447
|
* found in the LICENSE file at https://angular.io/license
|
3448
|
*/
|
3449
|
var trace;
|
3450
|
var events;
|
3451
|
/**
|
3452
|
* @return {?}
|
3453
|
*/
|
3454
|
function detectWTF() {
|
3455
|
var /** @type {?} */ wtf = ((_global) /** TODO #9100 */)['wtf'];
|
3456
|
if (wtf) {
|
3457
|
trace = wtf['trace'];
|
3458
|
if (trace) {
|
3459
|
events = trace['events'];
|
3460
|
return true;
|
3461
|
}
|
3462
|
}
|
3463
|
return false;
|
3464
|
}
|
3465
|
/**
|
3466
|
* @param {?} signature
|
3467
|
* @param {?=} flags
|
3468
|
* @return {?}
|
3469
|
*/
|
3470
|
function createScope$1(signature, flags) {
|
3471
|
if (flags === void 0) { flags = null; }
|
3472
|
return events.createScope(signature, flags);
|
3473
|
}
|
3474
|
/**
|
3475
|
* @template T
|
3476
|
* @param {?} scope
|
3477
|
* @param {?=} returnValue
|
3478
|
* @return {?}
|
3479
|
*/
|
3480
|
function leave(scope, returnValue) {
|
3481
|
trace.leaveScope(scope, returnValue);
|
3482
|
return returnValue;
|
3483
|
}
|
3484
|
/**
|
3485
|
* @param {?} rangeType
|
3486
|
* @param {?} action
|
3487
|
* @return {?}
|
3488
|
*/
|
3489
|
function startTimeRange(rangeType, action) {
|
3490
|
return trace.beginTimeRange(rangeType, action);
|
3491
|
}
|
3492
|
/**
|
3493
|
* @param {?} range
|
3494
|
* @return {?}
|
3495
|
*/
|
3496
|
function endTimeRange(range) {
|
3497
|
trace.endTimeRange(range);
|
3498
|
}
|
3499
|
/**
|
3500
|
* @license
|
3501
|
* Copyright Google Inc. All Rights Reserved.
|
3502
|
*
|
3503
|
* Use of this source code is governed by an MIT-style license that can be
|
3504
|
* found in the LICENSE file at https://angular.io/license
|
3505
|
*/
|
3506
|
/**
|
3507
|
* True if WTF is enabled.
|
3508
|
*/
|
3509
|
var wtfEnabled = detectWTF();
|
3510
|
/**
|
3511
|
* @param {?=} arg0
|
3512
|
* @param {?=} arg1
|
3513
|
* @return {?}
|
3514
|
*/
|
3515
|
function noopScope(arg0, arg1) {
|
3516
|
return null;
|
3517
|
}
|
3518
|
/**
|
3519
|
* Create trace scope.
|
3520
|
*
|
3521
|
* Scopes must be strictly nested and are analogous to stack frames, but
|
3522
|
* do not have to follow the stack frames. Instead it is recommended that they follow logical
|
3523
|
* nesting. You may want to use
|
3524
|
* [Event
|
3525
|
* Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
|
3526
|
* as they are defined in WTF.
|
3527
|
*
|
3528
|
* Used to mark scope entry. The return value is used to leave the scope.
|
3529
|
*
|
3530
|
* var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
|
3531
|
*
|
3532
|
* someMethod() {
|
3533
|
* var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
|
3534
|
* // DO SOME WORK HERE
|
3535
|
* return wtfLeave(s, 123); // Return value 123
|
3536
|
* }
|
3537
|
*
|
3538
|
* Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
|
3539
|
* negatively impact the performance of your application. For this reason we recommend that
|
3540
|
* you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
|
3541
|
* so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
|
3542
|
* exception, will produce incorrect trace, but presence of exception signifies logic error which
|
3543
|
* needs to be fixed before the app should be profiled. Add try-finally only when you expect that
|
3544
|
* an exception is expected during normal execution while profiling.
|
3545
|
*
|
3546
|
* \@experimental
|
3547
|
*/
|
3548
|
var wtfCreateScope = wtfEnabled ? createScope$1 : function (signature, flags) { return noopScope; };
|
3549
|
/**
|
3550
|
* Used to mark end of Scope.
|
3551
|
*
|
3552
|
* - `scope` to end.
|
3553
|
* - `returnValue` (optional) to be passed to the WTF.
|
3554
|
*
|
3555
|
* Returns the `returnValue for easy chaining.
|
3556
|
* \@experimental
|
3557
|
*/
|
3558
|
var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
|
3559
|
/**
|
3560
|
* Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
|
3561
|
* The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
|
3562
|
* enabled.
|
3563
|
*
|
3564
|
* someMethod() {
|
3565
|
* var s = wtfStartTimeRange('HTTP:GET', 'some.url');
|
3566
|
* var future = new Future.delay(5).then((_) {
|
3567
|
* wtfEndTimeRange(s);
|
3568
|
* });
|
3569
|
* }
|
3570
|
* \@experimental
|
3571
|
*/
|
3572
|
var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
|
3573
|
/**
|
3574
|
* Ends a async time range operation.
|
3575
|
* [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
|
3576
|
* enabled.
|
3577
|
* \@experimental
|
3578
|
*/
|
3579
|
var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
|
3580
|
/**
|
3581
|
* @license
|
3582
|
* Copyright Google Inc. All Rights Reserved.
|
3583
|
*
|
3584
|
* Use of this source code is governed by an MIT-style license that can be
|
3585
|
* found in the LICENSE file at https://angular.io/license
|
3586
|
*/
|
3587
|
/**
|
3588
|
* Use by directives and components to emit custom Events.
|
3589
|
*
|
3590
|
* ### Examples
|
3591
|
*
|
3592
|
* In the following example, `Zippy` alternatively emits `open` and `close` events when its
|
3593
|
* title gets clicked:
|
3594
|
*
|
3595
|
* ```
|
3596
|
* \@Component({
|
3597
|
* selector: 'zippy',
|
3598
|
* template: `
|
3599
|
* <div class="zippy">
|
3600
|
* <div (click)="toggle()">Toggle</div>
|
3601
|
* <div [hidden]="!visible">
|
3602
|
* <ng-content></ng-content>
|
3603
|
* </div>
|
3604
|
* </div>`})
|
3605
|
* export class Zippy {
|
3606
|
* visible: boolean = true;
|
3607
|
* \@Output() open: EventEmitter<any> = new EventEmitter();
|
3608
|
* \@Output() close: EventEmitter<any> = new EventEmitter();
|
3609
|
*
|
3610
|
* toggle() {
|
3611
|
* this.visible = !this.visible;
|
3612
|
* if (this.visible) {
|
3613
|
* this.open.emit(null);
|
3614
|
* } else {
|
3615
|
* this.close.emit(null);
|
3616
|
* }
|
3617
|
* }
|
3618
|
* }
|
3619
|
* ```
|
3620
|
*
|
3621
|
* The events payload can be accessed by the parameter `$event` on the components output event
|
3622
|
* handler:
|
3623
|
*
|
3624
|
* ```
|
3625
|
* <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
|
3626
|
* ```
|
3627
|
*
|
3628
|
* Uses Rx.Observable but provides an adapter to make it work as specified here:
|
3629
|
* https://github.com/jhusain/observable-spec
|
3630
|
*
|
3631
|
* Once a reference implementation of the spec is available, switch to it.
|
3632
|
* \@stable
|
3633
|
*/
|
3634
|
var EventEmitter = (function (_super) {
|
3635
|
__extends(EventEmitter, _super);
|
3636
|
/**
|
3637
|
* Creates an instance of {\@link EventEmitter}, which depending on `isAsync`,
|
3638
|
* delivers events synchronously or asynchronously.
|
3639
|
*
|
3640
|
* @param {?=} isAsync By default, events are delivered synchronously (default value: `false`).
|
3641
|
* Set to `true` for asynchronous event delivery.
|
3642
|
*/
|
3643
|
function EventEmitter(isAsync) {
|
3644
|
if (isAsync === void 0) { isAsync = false; }
|
3645
|
var _this = _super.call(this) || this;
|
3646
|
_this.__isAsync = isAsync;
|
3647
|
return _this;
|
3648
|
}
|
3649
|
/**
|
3650
|
* @param {?=} value
|
3651
|
* @return {?}
|
3652
|
*/
|
3653
|
EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
|
3654
|
/**
|
3655
|
* @param {?=} generatorOrNext
|
3656
|
* @param {?=} error
|
3657
|
* @param {?=} complete
|
3658
|
* @return {?}
|
3659
|
*/
|
3660
|
EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
|
3661
|
var /** @type {?} */ schedulerFn;
|
3662
|
var /** @type {?} */ errorFn = function (err) { return null; };
|
3663
|
var /** @type {?} */ completeFn = function () { return null; };
|
3664
|
if (generatorOrNext && typeof generatorOrNext === 'object') {
|
3665
|
schedulerFn = this.__isAsync ? function (value) {
|
3666
|
setTimeout(function () { return generatorOrNext.next(value); });
|
3667
|
} : function (value) { generatorOrNext.next(value); };
|
3668
|
if (generatorOrNext.error) {
|
3669
|
errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
|
3670
|
function (err) { generatorOrNext.error(err); };
|
3671
|
}
|
3672
|
if (generatorOrNext.complete) {
|
3673
|
completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
|
3674
|
function () { generatorOrNext.complete(); };
|
3675
|
}
|
3676
|
}
|
3677
|
else {
|
3678
|
schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
|
3679
|
function (value) { generatorOrNext(value); };
|
3680
|
if (error) {
|
3681
|
errorFn =
|
3682
|
this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
|
3683
|
}
|
3684
|
if (complete) {
|
3685
|
completeFn =
|
3686
|
this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
|
3687
|
}
|
3688
|
}
|
3689
|
return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
|
3690
|
};
|
3691
|
return EventEmitter;
|
3692
|
}(rxjs_Subject.Subject));
|
3693
|
/**
|
3694
|
* @license
|
3695
|
* Copyright Google Inc. All Rights Reserved.
|
3696
|
*
|
3697
|
* Use of this source code is governed by an MIT-style license that can be
|
3698
|
* found in the LICENSE file at https://angular.io/license
|
3699
|
*/
|
3700
|
/**
|
3701
|
* An injectable service for executing work inside or outside of the Angular zone.
|
3702
|
*
|
3703
|
* The most common use of this service is to optimize performance when starting a work consisting of
|
3704
|
* one or more asynchronous tasks that don't require UI updates or error handling to be handled by
|
3705
|
* Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks
|
3706
|
* can reenter the Angular zone via {\@link #run}.
|
3707
|
*
|
3708
|
* <!-- TODO: add/fix links to:
|
3709
|
* - docs explaining zones and the use of zones in Angular and change-detection
|
3710
|
* - link to runOutsideAngular/run (throughout this file!)
|
3711
|
* -->
|
3712
|
*
|
3713
|
* ### Example
|
3714
|
*
|
3715
|
* ```
|
3716
|
* import {Component, NgZone} from '\@angular/core';
|
3717
|
* import {NgIf} from '\@angular/common';
|
3718
|
*
|
3719
|
* \@Component({
|
3720
|
* selector: 'ng-zone-demo'.
|
3721
|
* template: `
|
3722
|
* <h2>Demo: NgZone</h2>
|
3723
|
*
|
3724
|
* <p>Progress: {{progress}}%</p>
|
3725
|
* <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
|
3726
|
*
|
3727
|
* <button (click)="processWithinAngularZone()">Process within Angular zone</button>
|
3728
|
* <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
|
3729
|
* `,
|
3730
|
* })
|
3731
|
* export class NgZoneDemo {
|
3732
|
* progress: number = 0;
|
3733
|
* label: string;
|
3734
|
*
|
3735
|
* constructor(private _ngZone: NgZone) {}
|
3736
|
*
|
3737
|
* // Loop inside the Angular zone
|
3738
|
* // so the UI DOES refresh after each setTimeout cycle
|
3739
|
* processWithinAngularZone() {
|
3740
|
* this.label = 'inside';
|
3741
|
* this.progress = 0;
|
3742
|
* this._increaseProgress(() => console.log('Inside Done!'));
|
3743
|
* }
|
3744
|
*
|
3745
|
* // Loop outside of the Angular zone
|
3746
|
* // so the UI DOES NOT refresh after each setTimeout cycle
|
3747
|
* processOutsideOfAngularZone() {
|
3748
|
* this.label = 'outside';
|
3749
|
* this.progress = 0;
|
3750
|
* this._ngZone.runOutsideAngular(() => {
|
3751
|
* this._increaseProgress(() => {
|
3752
|
* // reenter the Angular zone and display done
|
3753
|
* this._ngZone.run(() => {console.log('Outside Done!') });
|
3754
|
* }}));
|
3755
|
* }
|
3756
|
*
|
3757
|
* _increaseProgress(doneCallback: () => void) {
|
3758
|
* this.progress += 1;
|
3759
|
* console.log(`Current progress: ${this.progress}%`);
|
3760
|
*
|
3761
|
* if (this.progress < 100) {
|
3762
|
* window.setTimeout(() => this._increaseProgress(doneCallback)), 10)
|
3763
|
* } else {
|
3764
|
* doneCallback();
|
3765
|
* }
|
3766
|
* }
|
3767
|
* }
|
3768
|
* ```
|
3769
|
*
|
3770
|
* \@experimental
|
3771
|
*/
|
3772
|
var NgZone = (function () {
|
3773
|
/**
|
3774
|
* @param {?} __0
|
3775
|
*/
|
3776
|
function NgZone(_a) {
|
3777
|
var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
|
3778
|
this.hasPendingMicrotasks = false;
|
3779
|
this.hasPendingMacrotasks = false;
|
3780
|
/**
|
3781
|
* Whether there are no outstanding microtasks or macrotasks.
|
3782
|
*/
|
3783
|
this.isStable = true;
|
3784
|
/**
|
3785
|
* Notifies when code enters Angular Zone. This gets fired first on VM Turn.
|
3786
|
*/
|
3787
|
this.onUnstable = new EventEmitter(false);
|
3788
|
/**
|
3789
|
* Notifies when there is no more microtasks enqueue in the current VM Turn.
|
3790
|
* This is a hint for Angular to do change detection, which may enqueue more microtasks.
|
3791
|
* For this reason this event can fire multiple times per VM Turn.
|
3792
|
*/
|
3793
|
this.onMicrotaskEmpty = new EventEmitter(false);
|
3794
|
/**
|
3795
|
* Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
|
3796
|
* implies we are about to relinquish VM turn.
|
3797
|
* This event gets called just once.
|
3798
|
*/
|
3799
|
this.onStable = new EventEmitter(false);
|
3800
|
/**
|
3801
|
* Notifies that an error has been delivered.
|
3802
|
*/
|
3803
|
this.onError = new EventEmitter(false);
|
3804
|
if (typeof Zone == 'undefined') {
|
3805
|
throw new Error('Angular requires Zone.js prolyfill.');
|
3806
|
}
|
3807
|
Zone.assertZonePatched();
|
3808
|
var self = this;
|
3809
|
self._nesting = 0;
|
3810
|
self._outer = self._inner = Zone.current;
|
3811
|
if (Zone['wtfZoneSpec']) {
|
3812
|
self._inner = self._inner.fork(Zone['wtfZoneSpec']);
|
3813
|
}
|
3814
|
if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
|
3815
|
self._inner = self._inner.fork(Zone['longStackTraceZoneSpec']);
|
3816
|
}
|
3817
|
forkInnerZoneWithAngularBehavior(self);
|
3818
|
}
|
3819
|
/**
|
3820
|
* @return {?}
|
3821
|
*/
|
3822
|
NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
|
3823
|
/**
|
3824
|
* @return {?}
|
3825
|
*/
|
3826
|
NgZone.assertInAngularZone = function () {
|
3827
|
if (!NgZone.isInAngularZone()) {
|
3828
|
throw new Error('Expected to be in Angular Zone, but it is not!');
|
3829
|
}
|
3830
|
};
|
3831
|
/**
|
3832
|
* @return {?}
|
3833
|
*/
|
3834
|
NgZone.assertNotInAngularZone = function () {
|
3835
|
if (NgZone.isInAngularZone()) {
|
3836
|
throw new Error('Expected to not be in Angular Zone, but it is!');
|
3837
|
}
|
3838
|
};
|
3839
|
/**
|
3840
|
* Executes the `fn` function synchronously within the Angular zone and returns value returned by
|
3841
|
* the function.
|
3842
|
*
|
3843
|
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
|
3844
|
* outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
|
3845
|
*
|
3846
|
* Any future tasks or microtasks scheduled from within this function will continue executing from
|
3847
|
* within the Angular zone.
|
3848
|
*
|
3849
|
* If a synchronous error happens it will be rethrown and not reported via `onError`.
|
3850
|
* @param {?} fn
|
3851
|
* @return {?}
|
3852
|
*/
|
3853
|
NgZone.prototype.run = function (fn) { return (((this)))._inner.run(fn); };
|
3854
|
/**
|
3855
|
* Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
|
3856
|
* rethrown.
|
3857
|
* @param {?} fn
|
3858
|
* @return {?}
|
3859
|
*/
|
3860
|
NgZone.prototype.runGuarded = function (fn) { return (((this)))._inner.runGuarded(fn); };
|
3861
|
/**
|
3862
|
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
|
3863
|
* the function.
|
3864
|
*
|
3865
|
* Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
|
3866
|
* work that
|
3867
|
* doesn't trigger Angular change-detection or is subject to Angular's error handling.
|
3868
|
*
|
3869
|
* Any future tasks or microtasks scheduled from within this function will continue executing from
|
3870
|
* outside of the Angular zone.
|
3871
|
*
|
3872
|
* Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
|
3873
|
* @param {?} fn
|
3874
|
* @return {?}
|
3875
|
*/
|
3876
|
NgZone.prototype.runOutsideAngular = function (fn) { return (((this)))._outer.run(fn); };
|
3877
|
return NgZone;
|
3878
|
}());
|
3879
|
/**
|
3880
|
* @param {?} zone
|
3881
|
* @return {?}
|
3882
|
*/
|
3883
|
function checkStable(zone) {
|
3884
|
if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
|
3885
|
try {
|
3886
|
zone._nesting++;
|
3887
|
zone.onMicrotaskEmpty.emit(null);
|
3888
|
}
|
3889
|
finally {
|
3890
|
zone._nesting--;
|
3891
|
if (!zone.hasPendingMicrotasks) {
|
3892
|
try {
|
3893
|
zone.runOutsideAngular(function () { return zone.onStable.emit(null); });
|
3894
|
}
|
3895
|
finally {
|
3896
|
zone.isStable = true;
|
3897
|
}
|
3898
|
}
|
3899
|
}
|
3900
|
}
|
3901
|
}
|
3902
|
/**
|
3903
|
* @param {?} zone
|
3904
|
* @return {?}
|
3905
|
*/
|
3906
|
function forkInnerZoneWithAngularBehavior(zone) {
|
3907
|
zone._inner = zone._inner.fork({
|
3908
|
name: 'angular',
|
3909
|
properties: /** @type {?} */ ({ 'isAngularZone': true }),
|
3910
|
onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
|
3911
|
try {
|
3912
|
onEnter(zone);
|
3913
|
return delegate.invokeTask(target, task, applyThis, applyArgs);
|
3914
|
}
|
3915
|
finally {
|
3916
|
onLeave(zone);
|
3917
|
}
|
3918
|
},
|
3919
|
onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
|
3920
|
try {
|
3921
|
onEnter(zone);
|
3922
|
return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
3923
|
}
|
3924
|
finally {
|
3925
|
onLeave(zone);
|
3926
|
}
|
3927
|
},
|
3928
|
onHasTask: function (delegate, current, target, hasTaskState) {
|
3929
|
delegate.hasTask(target, hasTaskState);
|
3930
|
if (current === target) {
|
3931
|
// We are only interested in hasTask events which originate from our zone
|
3932
|
// (A child hasTask event is not interesting to us)
|
3933
|
if (hasTaskState.change == 'microTask') {
|
3934
|
zone.hasPendingMicrotasks = hasTaskState.microTask;
|
3935
|
checkStable(zone);
|
3936
|
}
|
3937
|
else if (hasTaskState.change == 'macroTask') {
|
3938
|
zone.hasPendingMacrotasks = hasTaskState.macroTask;
|
3939
|
}
|
3940
|
}
|
3941
|
},
|
3942
|
onHandleError: function (delegate, current, target, error) {
|
3943
|
delegate.handleError(target, error);
|
3944
|
zone.runOutsideAngular(function () { return zone.onError.emit(error); });
|
3945
|
return false;
|
3946
|
}
|
3947
|
});
|
3948
|
}
|
3949
|
/**
|
3950
|
* @param {?} zone
|
3951
|
* @return {?}
|
3952
|
*/
|
3953
|
function onEnter(zone) {
|
3954
|
zone._nesting++;
|
3955
|
if (zone.isStable) {
|
3956
|
zone.isStable = false;
|
3957
|
zone.onUnstable.emit(null);
|
3958
|
}
|
3959
|
}
|
3960
|
/**
|
3961
|
* @param {?} zone
|
3962
|
* @return {?}
|
3963
|
*/
|
3964
|
function onLeave(zone) {
|
3965
|
zone._nesting--;
|
3966
|
checkStable(zone);
|
3967
|
}
|
3968
|
/**
|
3969
|
* @license
|
3970
|
* Copyright Google Inc. All Rights Reserved.
|
3971
|
*
|
3972
|
* Use of this source code is governed by an MIT-style license that can be
|
3973
|
* found in the LICENSE file at https://angular.io/license
|
3974
|
*/
|
3975
|
/**
|
3976
|
* The Testability service provides testing hooks that can be accessed from
|
3977
|
* the browser and by services such as Protractor. Each bootstrapped Angular
|
3978
|
* application on the page will have an instance of Testability.
|
3979
|
* \@experimental
|
3980
|
*/
|
3981
|
var Testability = (function () {
|
3982
|
/**
|
3983
|
* @param {?} _ngZone
|
3984
|
*/
|
3985
|
function Testability(_ngZone) {
|
3986
|
this._ngZone = _ngZone;
|
3987
|
/**
|
3988
|
* \@internal
|
3989
|
*/
|
3990
|
this._pendingCount = 0;
|
3991
|
/**
|
3992
|
* \@internal
|
3993
|
*/
|
3994
|
this._isZoneStable = true;
|
3995
|
/**
|
3996
|
* Whether any work was done since the last 'whenStable' callback. This is
|
3997
|
* useful to detect if this could have potentially destabilized another
|
3998
|
* component while it is stabilizing.
|
3999
|
* \@internal
|
4000
|
*/
|
4001
|
this._didWork = false;
|
4002
|
/**
|
4003
|
* \@internal
|
4004
|
*/
|
4005
|
this._callbacks = [];
|
4006
|
this._watchAngularEvents();
|
4007
|
}
|
4008
|
/**
|
4009
|
* \@internal
|
4010
|
* @return {?}
|
4011
|
*/
|
4012
|
Testability.prototype._watchAngularEvents = function () {
|
4013
|
var _this = this;
|
4014
|
this._ngZone.onUnstable.subscribe({
|
4015
|
next: function () {
|
4016
|
_this._didWork = true;
|
4017
|
_this._isZoneStable = false;
|
4018
|
}
|
4019
|
});
|
4020
|
this._ngZone.runOutsideAngular(function () {
|
4021
|
_this._ngZone.onStable.subscribe({
|
4022
|
next: function () {
|
4023
|
NgZone.assertNotInAngularZone();
|
4024
|
scheduleMicroTask(function () {
|
4025
|
_this._isZoneStable = true;
|
4026
|
_this._runCallbacksIfReady();
|
4027
|
});
|
4028
|
}
|
4029
|
});
|
4030
|
});
|
4031
|
};
|
4032
|
/**
|
4033
|
* @return {?}
|
4034
|
*/
|
4035
|
Testability.prototype.increasePendingRequestCount = function () {
|
4036
|
this._pendingCount += 1;
|
4037
|
this._didWork = true;
|
4038
|
return this._pendingCount;
|
4039
|
};
|
4040
|
/**
|
4041
|
* @return {?}
|
4042
|
*/
|
4043
|
Testability.prototype.decreasePendingRequestCount = function () {
|
4044
|
this._pendingCount -= 1;
|
4045
|
if (this._pendingCount < 0) {
|
4046
|
throw new Error('pending async requests below zero');
|
4047
|
}
|
4048
|
this._runCallbacksIfReady();
|
4049
|
return this._pendingCount;
|
4050
|
};
|
4051
|
/**
|
4052
|
* @return {?}
|
4053
|
*/
|
4054
|
Testability.prototype.isStable = function () {
|
4055
|
return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
|
4056
|
};
|
4057
|
/**
|
4058
|
* \@internal
|
4059
|
* @return {?}
|
4060
|
*/
|
4061
|
Testability.prototype._runCallbacksIfReady = function () {
|
4062
|
var _this = this;
|
4063
|
if (this.isStable()) {
|
4064
|
// Schedules the call backs in a new frame so that it is always async.
|
4065
|
scheduleMicroTask(function () {
|
4066
|
while (_this._callbacks.length !== 0) {
|
4067
|
(((_this._callbacks.pop())))(_this._didWork);
|
4068
|
}
|
4069
|
_this._didWork = false;
|
4070
|
});
|
4071
|
}
|
4072
|
else {
|
4073
|
// Not Ready
|
4074
|
this._didWork = true;
|
4075
|
}
|
4076
|
};
|
4077
|
/**
|
4078
|
* @param {?} callback
|
4079
|
* @return {?}
|
4080
|
*/
|
4081
|
Testability.prototype.whenStable = function (callback) {
|
4082
|
this._callbacks.push(callback);
|
4083
|
this._runCallbacksIfReady();
|
4084
|
};
|
4085
|
/**
|
4086
|
* @return {?}
|
4087
|
*/
|
4088
|
Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; };
|
4089
|
/**
|
4090
|
* @deprecated use findProviders
|
4091
|
* @param {?} using
|
4092
|
* @param {?} provider
|
4093
|
* @param {?} exactMatch
|
4094
|
* @return {?}
|
4095
|
*/
|
4096
|
Testability.prototype.findBindings = function (using, provider, exactMatch) {
|
4097
|
// TODO(juliemr): implement.
|
4098
|
return [];
|
4099
|
};
|
4100
|
/**
|
4101
|
* @param {?} using
|
4102
|
* @param {?} provider
|
4103
|
* @param {?} exactMatch
|
4104
|
* @return {?}
|
4105
|
*/
|
4106
|
Testability.prototype.findProviders = function (using, provider, exactMatch) {
|
4107
|
// TODO(juliemr): implement.
|
4108
|
return [];
|
4109
|
};
|
4110
|
return Testability;
|
4111
|
}());
|
4112
|
Testability.decorators = [
|
4113
|
{ type: Injectable },
|
4114
|
];
|
4115
|
/**
|
4116
|
* @nocollapse
|
4117
|
*/
|
4118
|
Testability.ctorParameters = function () { return [
|
4119
|
{ type: NgZone, },
|
4120
|
]; };
|
4121
|
/**
|
4122
|
* A global registry of {\@link Testability} instances for specific elements.
|
4123
|
* \@experimental
|
4124
|
*/
|
4125
|
var TestabilityRegistry = (function () {
|
4126
|
function TestabilityRegistry() {
|
4127
|
/**
|
4128
|
* \@internal
|
4129
|
*/
|
4130
|
this._applications = new Map();
|
4131
|
_testabilityGetter.addToWindow(this);
|
4132
|
}
|
4133
|
/**
|
4134
|
* @param {?} token
|
4135
|
* @param {?} testability
|
4136
|
* @return {?}
|
4137
|
*/
|
4138
|
TestabilityRegistry.prototype.registerApplication = function (token, testability) {
|
4139
|
this._applications.set(token, testability);
|
4140
|
};
|
4141
|
/**
|
4142
|
* @param {?} elem
|
4143
|
* @return {?}
|
4144
|
*/
|
4145
|
TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; };
|
4146
|
/**
|
4147
|
* @return {?}
|
4148
|
*/
|
4149
|
TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); };
|
4150
|
/**
|
4151
|
* @return {?}
|
4152
|
*/
|
4153
|
TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); };
|
4154
|
/**
|
4155
|
* @param {?} elem
|
4156
|
* @param {?=} findInAncestors
|
4157
|
* @return {?}
|
4158
|
*/
|
4159
|
TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) {
|
4160
|
if (findInAncestors === void 0) { findInAncestors = true; }
|
4161
|
return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
|
4162
|
};
|
4163
|
return TestabilityRegistry;
|
4164
|
}());
|
4165
|
TestabilityRegistry.decorators = [
|
4166
|
{ type: Injectable },
|
4167
|
];
|
4168
|
/**
|
4169
|
* @nocollapse
|
4170
|
*/
|
4171
|
TestabilityRegistry.ctorParameters = function () { return []; };
|
4172
|
var _NoopGetTestability = (function () {
|
4173
|
function _NoopGetTestability() {
|
4174
|
}
|
4175
|
/**
|
4176
|
* @param {?} registry
|
4177
|
* @return {?}
|
4178
|
*/
|
4179
|
_NoopGetTestability.prototype.addToWindow = function (registry) { };
|
4180
|
/**
|
4181
|
* @param {?} registry
|
4182
|
* @param {?} elem
|
4183
|
* @param {?} findInAncestors
|
4184
|
* @return {?}
|
4185
|
*/
|
4186
|
_NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
|
4187
|
return null;
|
4188
|
};
|
4189
|
return _NoopGetTestability;
|
4190
|
}());
|
4191
|
/**
|
4192
|
* Set the {\@link GetTestability} implementation used by the Angular testing framework.
|
4193
|
* \@experimental
|
4194
|
* @param {?} getter
|
4195
|
* @return {?}
|
4196
|
*/
|
4197
|
function setTestabilityGetter(getter) {
|
4198
|
_testabilityGetter = getter;
|
4199
|
}
|
4200
|
var _testabilityGetter = new _NoopGetTestability();
|
4201
|
/**
|
4202
|
* @license
|
4203
|
* Copyright Google Inc. All Rights Reserved.
|
4204
|
*
|
4205
|
* Use of this source code is governed by an MIT-style license that can be
|
4206
|
* found in the LICENSE file at https://angular.io/license
|
4207
|
*/
|
4208
|
var _devMode = true;
|
4209
|
var _runModeLocked = false;
|
4210
|
var _platform;
|
4211
|
var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
|
4212
|
/**
|
4213
|
* Disable Angular's development mode, which turns off assertions and other
|
4214
|
* checks within the framework.
|
4215
|
*
|
4216
|
* One important assertion this disables verifies that a change detection pass
|
4217
|
* does not result in additional changes to any bindings (also known as
|
4218
|
* unidirectional data flow).
|
4219
|
*
|
4220
|
* \@stable
|
4221
|
* @return {?}
|
4222
|
*/
|
4223
|
function enableProdMode() {
|
4224
|
if (_runModeLocked) {
|
4225
|
throw new Error('Cannot enable prod mode after platform setup.');
|
4226
|
}
|
4227
|
_devMode = false;
|
4228
|
}
|
4229
|
/**
|
4230
|
* Returns whether Angular is in development mode. After called once,
|
4231
|
* the value is locked and won't change any more.
|
4232
|
*
|
4233
|
* By default, this is true, unless a user calls `enableProdMode` before calling this.
|
4234
|
*
|
4235
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4236
|
* @return {?}
|
4237
|
*/
|
4238
|
function isDevMode() {
|
4239
|
_runModeLocked = true;
|
4240
|
return _devMode;
|
4241
|
}
|
4242
|
/**
|
4243
|
* A token for third-party components that can register themselves with NgProbe.
|
4244
|
*
|
4245
|
* \@experimental
|
4246
|
*/
|
4247
|
var NgProbeToken = (function () {
|
4248
|
/**
|
4249
|
* @param {?} name
|
4250
|
* @param {?} token
|
4251
|
*/
|
4252
|
function NgProbeToken(name, token) {
|
4253
|
this.name = name;
|
4254
|
this.token = token;
|
4255
|
}
|
4256
|
return NgProbeToken;
|
4257
|
}());
|
4258
|
/**
|
4259
|
* Creates a platform.
|
4260
|
* Platforms have to be eagerly created via this function.
|
4261
|
*
|
4262
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4263
|
* @param {?} injector
|
4264
|
* @return {?}
|
4265
|
*/
|
4266
|
function createPlatform(injector) {
|
4267
|
if (_platform && !_platform.destroyed &&
|
4268
|
!_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
4269
|
throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
|
4270
|
}
|
4271
|
_platform = injector.get(PlatformRef);
|
4272
|
var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null);
|
4273
|
if (inits)
|
4274
|
inits.forEach(function (init) { return init(); });
|
4275
|
return _platform;
|
4276
|
}
|
4277
|
/**
|
4278
|
* Creates a factory for a platform
|
4279
|
*
|
4280
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4281
|
* @param {?} parentPlatformFactory
|
4282
|
* @param {?} name
|
4283
|
* @param {?=} providers
|
4284
|
* @return {?}
|
4285
|
*/
|
4286
|
function createPlatformFactory(parentPlatformFactory, name, providers) {
|
4287
|
if (providers === void 0) { providers = []; }
|
4288
|
var /** @type {?} */ marker = new InjectionToken("Platform: " + name);
|
4289
|
return function (extraProviders) {
|
4290
|
if (extraProviders === void 0) { extraProviders = []; }
|
4291
|
var /** @type {?} */ platform = getPlatform();
|
4292
|
if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
4293
|
if (parentPlatformFactory) {
|
4294
|
parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
|
4295
|
}
|
4296
|
else {
|
4297
|
createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true })));
|
4298
|
}
|
4299
|
}
|
4300
|
return assertPlatform(marker);
|
4301
|
};
|
4302
|
}
|
4303
|
/**
|
4304
|
* Checks that there currently is a platform which contains the given token as a provider.
|
4305
|
*
|
4306
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4307
|
* @param {?} requiredToken
|
4308
|
* @return {?}
|
4309
|
*/
|
4310
|
function assertPlatform(requiredToken) {
|
4311
|
var /** @type {?} */ platform = getPlatform();
|
4312
|
if (!platform) {
|
4313
|
throw new Error('No platform exists!');
|
4314
|
}
|
4315
|
if (!platform.injector.get(requiredToken, null)) {
|
4316
|
throw new Error('A platform with a different configuration has been created. Please destroy it first.');
|
4317
|
}
|
4318
|
return platform;
|
4319
|
}
|
4320
|
/**
|
4321
|
* Destroy the existing platform.
|
4322
|
*
|
4323
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4324
|
* @return {?}
|
4325
|
*/
|
4326
|
function destroyPlatform() {
|
4327
|
if (_platform && !_platform.destroyed) {
|
4328
|
_platform.destroy();
|
4329
|
}
|
4330
|
}
|
4331
|
/**
|
4332
|
* Returns the current platform.
|
4333
|
*
|
4334
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4335
|
* @return {?}
|
4336
|
*/
|
4337
|
function getPlatform() {
|
4338
|
return _platform && !_platform.destroyed ? _platform : null;
|
4339
|
}
|
4340
|
/**
|
4341
|
* The Angular platform is the entry point for Angular on a web page. Each page
|
4342
|
* has exactly one platform, and services (such as reflection) which are common
|
4343
|
* to every Angular application running on the page are bound in its scope.
|
4344
|
*
|
4345
|
* A page's platform is initialized implicitly when a platform is created via a platform factory
|
4346
|
* (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function.
|
4347
|
*
|
4348
|
* \@stable
|
4349
|
* @abstract
|
4350
|
*/
|
4351
|
var PlatformRef = (function () {
|
4352
|
function PlatformRef() {
|
4353
|
}
|
4354
|
/**
|
4355
|
* Creates an instance of an `\@NgModule` for the given platform
|
4356
|
* for offline compilation.
|
4357
|
*
|
4358
|
* ## Simple Example
|
4359
|
*
|
4360
|
* ```typescript
|
4361
|
* my_module.ts:
|
4362
|
*
|
4363
|
* \@NgModule({
|
4364
|
* imports: [BrowserModule]
|
4365
|
* })
|
4366
|
* class MyModule {}
|
4367
|
*
|
4368
|
* main.ts:
|
4369
|
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
4370
|
* import {platformBrowser} from '\@angular/platform-browser';
|
4371
|
*
|
4372
|
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
|
4373
|
* ```
|
4374
|
*
|
4375
|
* \@experimental APIs related to application bootstrap are currently under review.
|
4376
|
* @abstract
|
4377
|
* @template M
|
4378
|
* @param {?} moduleFactory
|
4379
|
* @return {?}
|
4380
|
*/
|
4381
|
PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { };
|
4382
|
/**
|
4383
|
* Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
|
4384
|
*
|
4385
|
* ## Simple Example
|
4386
|
*
|
4387
|
* ```typescript
|
4388
|
* \@NgModule({
|
4389
|
* imports: [BrowserModule]
|
4390
|
* })
|
4391
|
* class MyModule {}
|
4392
|
*
|
4393
|
* let moduleRef = platformBrowser().bootstrapModule(MyModule);
|
4394
|
* ```
|
4395
|
* \@stable
|
4396
|
* @abstract
|
4397
|
* @template M
|
4398
|
* @param {?} moduleType
|
4399
|
* @param {?=} compilerOptions
|
4400
|
* @return {?}
|
4401
|
*/
|
4402
|
PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { };
|
4403
|
/**
|
4404
|
* Register a listener to be called when the platform is disposed.
|
4405
|
* @abstract
|
4406
|
* @param {?} callback
|
4407
|
* @return {?}
|
4408
|
*/
|
4409
|
PlatformRef.prototype.onDestroy = function (callback) { };
|
4410
|
/**
|
4411
|
* Retrieve the platform {\@link Injector}, which is the parent injector for
|
4412
|
* every Angular application on the page and provides singleton providers.
|
4413
|
* @abstract
|
4414
|
* @return {?}
|
4415
|
*/
|
4416
|
PlatformRef.prototype.injector = function () { };
|
4417
|
/**
|
4418
|
* Destroy the Angular platform and all Angular applications on the page.
|
4419
|
* @abstract
|
4420
|
* @return {?}
|
4421
|
*/
|
4422
|
PlatformRef.prototype.destroy = function () { };
|
4423
|
/**
|
4424
|
* @abstract
|
4425
|
* @return {?}
|
4426
|
*/
|
4427
|
PlatformRef.prototype.destroyed = function () { };
|
4428
|
return PlatformRef;
|
4429
|
}());
|
4430
|
/**
|
4431
|
* @param {?} errorHandler
|
4432
|
* @param {?} ngZone
|
4433
|
* @param {?} callback
|
4434
|
* @return {?}
|
4435
|
*/
|
4436
|
function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
|
4437
|
try {
|
4438
|
var /** @type {?} */ result = callback();
|
4439
|
if (isPromise(result)) {
|
4440
|
return result.catch(function (e) {
|
4441
|
ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
|
4442
|
// rethrow as the exception handler might not do it
|
4443
|
throw e;
|
4444
|
});
|
4445
|
}
|
4446
|
return result;
|
4447
|
}
|
4448
|
catch (e) {
|
4449
|
ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
|
4450
|
// rethrow as the exception handler might not do it
|
4451
|
throw e;
|
4452
|
}
|
4453
|
}
|
4454
|
/**
|
4455
|
* workaround https://github.com/angular/tsickle/issues/350
|
4456
|
* @suppress {checkTypes}
|
4457
|
*/
|
4458
|
var PlatformRef_ = (function (_super) {
|
4459
|
__extends(PlatformRef_, _super);
|
4460
|
/**
|
4461
|
* @param {?} _injector
|
4462
|
*/
|
4463
|
function PlatformRef_(_injector) {
|
4464
|
var _this = _super.call(this) || this;
|
4465
|
_this._injector = _injector;
|
4466
|
_this._modules = [];
|
4467
|
_this._destroyListeners = [];
|
4468
|
_this._destroyed = false;
|
4469
|
return _this;
|
4470
|
}
|
4471
|
/**
|
4472
|
* @param {?} callback
|
4473
|
* @return {?}
|
4474
|
*/
|
4475
|
PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
|
4476
|
Object.defineProperty(PlatformRef_.prototype, "injector", {
|
4477
|
/**
|
4478
|
* @return {?}
|
4479
|
*/
|
4480
|
get: function () { return this._injector; },
|
4481
|
enumerable: true,
|
4482
|
configurable: true
|
4483
|
});
|
4484
|
Object.defineProperty(PlatformRef_.prototype, "destroyed", {
|
4485
|
/**
|
4486
|
* @return {?}
|
4487
|
*/
|
4488
|
get: function () { return this._destroyed; },
|
4489
|
enumerable: true,
|
4490
|
configurable: true
|
4491
|
});
|
4492
|
/**
|
4493
|
* @return {?}
|
4494
|
*/
|
4495
|
PlatformRef_.prototype.destroy = function () {
|
4496
|
if (this._destroyed) {
|
4497
|
throw new Error('The platform has already been destroyed!');
|
4498
|
}
|
4499
|
this._modules.slice().forEach(function (module) { return module.destroy(); });
|
4500
|
this._destroyListeners.forEach(function (listener) { return listener(); });
|
4501
|
this._destroyed = true;
|
4502
|
};
|
4503
|
/**
|
4504
|
* @template M
|
4505
|
* @param {?} moduleFactory
|
4506
|
* @return {?}
|
4507
|
*/
|
4508
|
PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) {
|
4509
|
return this._bootstrapModuleFactoryWithZone(moduleFactory);
|
4510
|
};
|
4511
|
/**
|
4512
|
* @template M
|
4513
|
* @param {?} moduleFactory
|
4514
|
* @param {?=} ngZone
|
4515
|
* @return {?}
|
4516
|
*/
|
4517
|
PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) {
|
4518
|
var _this = this;
|
4519
|
// Note: We need to create the NgZone _before_ we instantiate the module,
|
4520
|
// as instantiating the module creates some providers eagerly.
|
4521
|
// So we create a mini parent injector that just contains the new NgZone and
|
4522
|
// pass that as parent to the NgModuleFactory.
|
4523
|
if (!ngZone)
|
4524
|
ngZone = new NgZone({ enableLongStackTrace: isDevMode() });
|
4525
|
// Attention: Don't use ApplicationRef.run here,
|
4526
|
// as we want to be sure that all possible constructor calls are inside `ngZone.run`!
|
4527
|
return ngZone.run(function () {
|
4528
|
var /** @type {?} */ ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector);
|
4529
|
var /** @type {?} */ moduleRef = (moduleFactory.create(ngZoneInjector));
|
4530
|
var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
|
4531
|
if (!exceptionHandler) {
|
4532
|
throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
|
4533
|
}
|
4534
|
moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */
|
4535
|
((ngZone)).runOutsideAngular(function () { return ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); });
|
4536
|
return _callAndReportToErrorHandler(exceptionHandler, /** @type {?} */ ((ngZone)), function () {
|
4537
|
var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus);
|
4538
|
initStatus.runInitializers();
|
4539
|
return initStatus.donePromise.then(function () {
|
4540
|
_this._moduleDoBootstrap(moduleRef);
|
4541
|
return moduleRef;
|
4542
|
});
|
4543
|
});
|
4544
|
});
|
4545
|
};
|
4546
|
/**
|
4547
|
* @template M
|
4548
|
* @param {?} moduleType
|
4549
|
* @param {?=} compilerOptions
|
4550
|
* @return {?}
|
4551
|
*/
|
4552
|
PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) {
|
4553
|
if (compilerOptions === void 0) { compilerOptions = []; }
|
4554
|
return this._bootstrapModuleWithZone(moduleType, compilerOptions);
|
4555
|
};
|
4556
|
/**
|
4557
|
* @template M
|
4558
|
* @param {?} moduleType
|
4559
|
* @param {?=} compilerOptions
|
4560
|
* @param {?=} ngZone
|
4561
|
* @return {?}
|
4562
|
*/
|
4563
|
PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone) {
|
4564
|
var _this = this;
|
4565
|
if (compilerOptions === void 0) { compilerOptions = []; }
|
4566
|
var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory);
|
4567
|
var /** @type {?} */ compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]);
|
4568
|
return compiler.compileModuleAsync(moduleType)
|
4569
|
.then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); });
|
4570
|
};
|
4571
|
/**
|
4572
|
* @param {?} moduleRef
|
4573
|
* @return {?}
|
4574
|
*/
|
4575
|
PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) {
|
4576
|
var /** @type {?} */ appRef = (moduleRef.injector.get(ApplicationRef));
|
4577
|
if (moduleRef._bootstrapComponents.length > 0) {
|
4578
|
moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
|
4579
|
}
|
4580
|
else if (moduleRef.instance.ngDoBootstrap) {
|
4581
|
moduleRef.instance.ngDoBootstrap(appRef);
|
4582
|
}
|
4583
|
else {
|
4584
|
throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
|
4585
|
"Please define one of these.");
|
4586
|
}
|
4587
|
this._modules.push(moduleRef);
|
4588
|
};
|
4589
|
return PlatformRef_;
|
4590
|
}(PlatformRef));
|
4591
|
PlatformRef_.decorators = [
|
4592
|
{ type: Injectable },
|
4593
|
];
|
4594
|
/**
|
4595
|
* @nocollapse
|
4596
|
*/
|
4597
|
PlatformRef_.ctorParameters = function () { return [
|
4598
|
{ type: Injector, },
|
4599
|
]; };
|
4600
|
/**
|
4601
|
* A reference to an Angular application running on a page.
|
4602
|
*
|
4603
|
* \@stable
|
4604
|
* @abstract
|
4605
|
*/
|
4606
|
var ApplicationRef = (function () {
|
4607
|
function ApplicationRef() {
|
4608
|
}
|
4609
|
/**
|
4610
|
* Bootstrap a new component at the root level of the application.
|
4611
|
*
|
4612
|
* ### Bootstrap process
|
4613
|
*
|
4614
|
* When bootstrapping a new root component into an application, Angular mounts the
|
4615
|
* specified application component onto DOM elements identified by the [componentType]'s
|
4616
|
* selector and kicks off automatic change detection to finish initializing the component.
|
4617
|
*
|
4618
|
* Optionally, a component can be mounted onto a DOM element that does not match the
|
4619
|
* [componentType]'s selector.
|
4620
|
*
|
4621
|
* ### Example
|
4622
|
* {\@example core/ts/platform/platform.ts region='longform'}
|
4623
|
* @abstract
|
4624
|
* @template C
|
4625
|
* @param {?} componentFactory
|
4626
|
* @param {?=} rootSelectorOrNode
|
4627
|
* @return {?}
|
4628
|
*/
|
4629
|
ApplicationRef.prototype.bootstrap = function (componentFactory, rootSelectorOrNode) { };
|
4630
|
/**
|
4631
|
* Invoke this method to explicitly process change detection and its side-effects.
|
4632
|
*
|
4633
|
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
|
4634
|
* further changes are detected. If additional changes are picked up during this second cycle,
|
4635
|
* bindings in the app have side-effects that cannot be resolved in a single change detection
|
4636
|
* pass.
|
4637
|
* In this case, Angular throws an error, since an Angular application can only have one change
|
4638
|
* detection pass during which all change detection must complete.
|
4639
|
* @abstract
|
4640
|
* @return {?}
|
4641
|
*/
|
4642
|
ApplicationRef.prototype.tick = function () { };
|
4643
|
/**
|
4644
|
* Get a list of component types registered to this application.
|
4645
|
* This list is populated even before the component is created.
|
4646
|
* @abstract
|
4647
|
* @return {?}
|
4648
|
*/
|
4649
|
ApplicationRef.prototype.componentTypes = function () { };
|
4650
|
/**
|
4651
|
* Get a list of components registered to this application.
|
4652
|
* @abstract
|
4653
|
* @return {?}
|
4654
|
*/
|
4655
|
ApplicationRef.prototype.components = function () { };
|
4656
|
/**
|
4657
|
* Attaches a view so that it will be dirty checked.
|
4658
|
* The view will be automatically detached when it is destroyed.
|
4659
|
* This will throw if the view is already attached to a ViewContainer.
|
4660
|
* @abstract
|
4661
|
* @param {?} view
|
4662
|
* @return {?}
|
4663
|
*/
|
4664
|
ApplicationRef.prototype.attachView = function (view) { };
|
4665
|
/**
|
4666
|
* Detaches a view from dirty checking again.
|
4667
|
* @abstract
|
4668
|
* @param {?} view
|
4669
|
* @return {?}
|
4670
|
*/
|
4671
|
ApplicationRef.prototype.detachView = function (view) { };
|
4672
|
/**
|
4673
|
* Returns the number of attached views.
|
4674
|
* @abstract
|
4675
|
* @return {?}
|
4676
|
*/
|
4677
|
ApplicationRef.prototype.viewCount = function () { };
|
4678
|
/**
|
4679
|
* Returns an Observable that indicates when the application is stable or unstable.
|
4680
|
* @abstract
|
4681
|
* @return {?}
|
4682
|
*/
|
4683
|
ApplicationRef.prototype.isStable = function () { };
|
4684
|
return ApplicationRef;
|
4685
|
}());
|
4686
|
/**
|
4687
|
* workaround https://github.com/angular/tsickle/issues/350
|
4688
|
* @suppress {checkTypes}
|
4689
|
*/
|
4690
|
var ApplicationRef_ = (function (_super) {
|
4691
|
__extends(ApplicationRef_, _super);
|
4692
|
/**
|
4693
|
* @param {?} _zone
|
4694
|
* @param {?} _console
|
4695
|
* @param {?} _injector
|
4696
|
* @param {?} _exceptionHandler
|
4697
|
* @param {?} _componentFactoryResolver
|
4698
|
* @param {?} _initStatus
|
4699
|
*/
|
4700
|
function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
|
4701
|
var _this = _super.call(this) || this;
|
4702
|
_this._zone = _zone;
|
4703
|
_this._console = _console;
|
4704
|
_this._injector = _injector;
|
4705
|
_this._exceptionHandler = _exceptionHandler;
|
4706
|
_this._componentFactoryResolver = _componentFactoryResolver;
|
4707
|
_this._initStatus = _initStatus;
|
4708
|
_this._bootstrapListeners = [];
|
4709
|
_this._rootComponents = [];
|
4710
|
_this._rootComponentTypes = [];
|
4711
|
_this._views = [];
|
4712
|
_this._runningTick = false;
|
4713
|
_this._enforceNoNewChanges = false;
|
4714
|
_this._stable = true;
|
4715
|
_this._enforceNoNewChanges = isDevMode();
|
4716
|
_this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
|
4717
|
var isCurrentlyStable = new rxjs_Observable.Observable(function (observer) {
|
4718
|
_this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
|
4719
|
!_this._zone.hasPendingMicrotasks;
|
4720
|
_this._zone.runOutsideAngular(function () {
|
4721
|
observer.next(_this._stable);
|
4722
|
observer.complete();
|
4723
|
});
|
4724
|
});
|
4725
|
var isStable = new rxjs_Observable.Observable(function (observer) {
|
4726
|
// Create the subscription to onStable outside the Angular Zone so that
|
4727
|
// the callback is run outside the Angular Zone.
|
4728
|
var stableSub;
|
4729
|
_this._zone.runOutsideAngular(function () {
|
4730
|
stableSub = _this._zone.onStable.subscribe(function () {
|
4731
|
NgZone.assertNotInAngularZone();
|
4732
|
// Check whether there are no pending macro/micro tasks in the next tick
|
4733
|
// to allow for NgZone to update the state.
|
4734
|
scheduleMicroTask(function () {
|
4735
|
if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
|
4736
|
!_this._zone.hasPendingMicrotasks) {
|
4737
|
_this._stable = true;
|
4738
|
observer.next(true);
|
4739
|
}
|
4740
|
});
|
4741
|
});
|
4742
|
});
|
4743
|
var unstableSub = _this._zone.onUnstable.subscribe(function () {
|
4744
|
NgZone.assertInAngularZone();
|
4745
|
if (_this._stable) {
|
4746
|
_this._stable = false;
|
4747
|
_this._zone.runOutsideAngular(function () { observer.next(false); });
|
4748
|
}
|
4749
|
});
|
4750
|
return function () {
|
4751
|
stableSub.unsubscribe();
|
4752
|
unstableSub.unsubscribe();
|
4753
|
};
|
4754
|
});
|
4755
|
_this._isStable = rxjs_observable_merge.merge(isCurrentlyStable, rxjs_operator_share.share.call(isStable));
|
4756
|
return _this;
|
4757
|
}
|
4758
|
/**
|
4759
|
* @param {?} viewRef
|
4760
|
* @return {?}
|
4761
|
*/
|
4762
|
ApplicationRef_.prototype.attachView = function (viewRef) {
|
4763
|
var /** @type {?} */ view = ((viewRef));
|
4764
|
this._views.push(view);
|
4765
|
view.attachToAppRef(this);
|
4766
|
};
|
4767
|
/**
|
4768
|
* @param {?} viewRef
|
4769
|
* @return {?}
|
4770
|
*/
|
4771
|
ApplicationRef_.prototype.detachView = function (viewRef) {
|
4772
|
var /** @type {?} */ view = ((viewRef));
|
4773
|
remove(this._views, view);
|
4774
|
view.detachFromAppRef();
|
4775
|
};
|
4776
|
/**
|
4777
|
* @template C
|
4778
|
* @param {?} componentOrFactory
|
4779
|
* @param {?=} rootSelectorOrNode
|
4780
|
* @return {?}
|
4781
|
*/
|
4782
|
ApplicationRef_.prototype.bootstrap = function (componentOrFactory, rootSelectorOrNode) {
|
4783
|
var _this = this;
|
4784
|
if (!this._initStatus.done) {
|
4785
|
throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
4786
|
}
|
4787
|
var /** @type {?} */ componentFactory;
|
4788
|
if (componentOrFactory instanceof ComponentFactory) {
|
4789
|
componentFactory = componentOrFactory;
|
4790
|
}
|
4791
|
else {
|
4792
|
componentFactory = ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
|
4793
|
}
|
4794
|
this._rootComponentTypes.push(componentFactory.componentType);
|
4795
|
// Create a factory associated with the current module if it's not bound to some other
|
4796
|
var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
|
4797
|
null :
|
4798
|
this._injector.get(NgModuleRef);
|
4799
|
var /** @type {?} */ selectorOrNode = rootSelectorOrNode || componentFactory.selector;
|
4800
|
var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
|
4801
|
compRef.onDestroy(function () { _this._unloadComponent(compRef); });
|
4802
|
var /** @type {?} */ testability = compRef.injector.get(Testability, null);
|
4803
|
if (testability) {
|
4804
|
compRef.injector.get(TestabilityRegistry)
|
4805
|
.registerApplication(compRef.location.nativeElement, testability);
|
4806
|
}
|
4807
|
this._loadComponent(compRef);
|
4808
|
if (isDevMode()) {
|
4809
|
this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
|
4810
|
}
|
4811
|
return compRef;
|
4812
|
};
|
4813
|
/**
|
4814
|
* @param {?} componentRef
|
4815
|
* @return {?}
|
4816
|
*/
|
4817
|
ApplicationRef_.prototype._loadComponent = function (componentRef) {
|
4818
|
this.attachView(componentRef.hostView);
|
4819
|
this.tick();
|
4820
|
this._rootComponents.push(componentRef);
|
4821
|
// Get the listeners lazily to prevent DI cycles.
|
4822
|
var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
|
4823
|
listeners.forEach(function (listener) { return listener(componentRef); });
|
4824
|
};
|
4825
|
/**
|
4826
|
* @param {?} componentRef
|
4827
|
* @return {?}
|
4828
|
*/
|
4829
|
ApplicationRef_.prototype._unloadComponent = function (componentRef) {
|
4830
|
this.detachView(componentRef.hostView);
|
4831
|
remove(this._rootComponents, componentRef);
|
4832
|
};
|
4833
|
/**
|
4834
|
* @return {?}
|
4835
|
*/
|
4836
|
ApplicationRef_.prototype.tick = function () {
|
4837
|
var _this = this;
|
4838
|
if (this._runningTick) {
|
4839
|
throw new Error('ApplicationRef.tick is called recursively');
|
4840
|
}
|
4841
|
var /** @type {?} */ scope = ApplicationRef_._tickScope();
|
4842
|
try {
|
4843
|
this._runningTick = true;
|
4844
|
this._views.forEach(function (view) { return view.detectChanges(); });
|
4845
|
if (this._enforceNoNewChanges) {
|
4846
|
this._views.forEach(function (view) { return view.checkNoChanges(); });
|
4847
|
}
|
4848
|
}
|
4849
|
catch (e) {
|
4850
|
// Attention: Don't rethrow as it could cancel subscriptions to Observables!
|
4851
|
this._zone.runOutsideAngular(function () { return _this._exceptionHandler.handleError(e); });
|
4852
|
}
|
4853
|
finally {
|
4854
|
this._runningTick = false;
|
4855
|
wtfLeave(scope);
|
4856
|
}
|
4857
|
};
|
4858
|
/**
|
4859
|
* @return {?}
|
4860
|
*/
|
4861
|
ApplicationRef_.prototype.ngOnDestroy = function () {
|
4862
|
// TODO(alxhub): Dispose of the NgZone.
|
4863
|
this._views.slice().forEach(function (view) { return view.destroy(); });
|
4864
|
};
|
4865
|
Object.defineProperty(ApplicationRef_.prototype, "viewCount", {
|
4866
|
/**
|
4867
|
* @return {?}
|
4868
|
*/
|
4869
|
get: function () { return this._views.length; },
|
4870
|
enumerable: true,
|
4871
|
configurable: true
|
4872
|
});
|
4873
|
Object.defineProperty(ApplicationRef_.prototype, "componentTypes", {
|
4874
|
/**
|
4875
|
* @return {?}
|
4876
|
*/
|
4877
|
get: function () { return this._rootComponentTypes; },
|
4878
|
enumerable: true,
|
4879
|
configurable: true
|
4880
|
});
|
4881
|
Object.defineProperty(ApplicationRef_.prototype, "components", {
|
4882
|
/**
|
4883
|
* @return {?}
|
4884
|
*/
|
4885
|
get: function () { return this._rootComponents; },
|
4886
|
enumerable: true,
|
4887
|
configurable: true
|
4888
|
});
|
4889
|
Object.defineProperty(ApplicationRef_.prototype, "isStable", {
|
4890
|
/**
|
4891
|
* @return {?}
|
4892
|
*/
|
4893
|
get: function () { return this._isStable; },
|
4894
|
enumerable: true,
|
4895
|
configurable: true
|
4896
|
});
|
4897
|
return ApplicationRef_;
|
4898
|
}(ApplicationRef));
|
4899
|
/**
|
4900
|
* \@internal
|
4901
|
*/
|
4902
|
ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()');
|
4903
|
ApplicationRef_.decorators = [
|
4904
|
{ type: Injectable },
|
4905
|
];
|
4906
|
/**
|
4907
|
* @nocollapse
|
4908
|
*/
|
4909
|
ApplicationRef_.ctorParameters = function () { return [
|
4910
|
{ type: NgZone, },
|
4911
|
{ type: Console, },
|
4912
|
{ type: Injector, },
|
4913
|
{ type: ErrorHandler, },
|
4914
|
{ type: ComponentFactoryResolver, },
|
4915
|
{ type: ApplicationInitStatus, },
|
4916
|
]; };
|
4917
|
/**
|
4918
|
* @template T
|
4919
|
* @param {?} list
|
4920
|
* @param {?} el
|
4921
|
* @return {?}
|
4922
|
*/
|
4923
|
function remove(list, el) {
|
4924
|
var /** @type {?} */ index = list.indexOf(el);
|
4925
|
if (index > -1) {
|
4926
|
list.splice(index, 1);
|
4927
|
}
|
4928
|
}
|
4929
|
/**
|
4930
|
* @license
|
4931
|
* Copyright Google Inc. All Rights Reserved.
|
4932
|
*
|
4933
|
* Use of this source code is governed by an MIT-style license that can be
|
4934
|
* found in the LICENSE file at https://angular.io/license
|
4935
|
*/
|
4936
|
// Public API for Zone
|
4937
|
/**
|
4938
|
* @license
|
4939
|
* Copyright Google Inc. All Rights Reserved.
|
4940
|
*
|
4941
|
* Use of this source code is governed by an MIT-style license that can be
|
4942
|
* found in the LICENSE file at https://angular.io/license
|
4943
|
*/
|
4944
|
/**
|
4945
|
* @deprecated Use `RendererType2` (and `Renderer2`) instead.
|
4946
|
*/
|
4947
|
var RenderComponentType = (function () {
|
4948
|
/**
|
4949
|
* @param {?} id
|
4950
|
* @param {?} templateUrl
|
4951
|
* @param {?} slotCount
|
4952
|
* @param {?} encapsulation
|
4953
|
* @param {?} styles
|
4954
|
* @param {?} animations
|
4955
|
*/
|
4956
|
function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
|
4957
|
this.id = id;
|
4958
|
this.templateUrl = templateUrl;
|
4959
|
this.slotCount = slotCount;
|
4960
|
this.encapsulation = encapsulation;
|
4961
|
this.styles = styles;
|
4962
|
this.animations = animations;
|
4963
|
}
|
4964
|
return RenderComponentType;
|
4965
|
}());
|
4966
|
/**
|
4967
|
* @deprecated Debug info is handeled internally in the view engine now.
|
4968
|
* @abstract
|
4969
|
*/
|
4970
|
var RenderDebugInfo = (function () {
|
4971
|
function RenderDebugInfo() {
|
4972
|
}
|
4973
|
/**
|
4974
|
* @abstract
|
4975
|
* @return {?}
|
4976
|
*/
|
4977
|
RenderDebugInfo.prototype.injector = function () { };
|
4978
|
/**
|
4979
|
* @abstract
|
4980
|
* @return {?}
|
4981
|
*/
|
4982
|
RenderDebugInfo.prototype.component = function () { };
|
4983
|
/**
|
4984
|
* @abstract
|
4985
|
* @return {?}
|
4986
|
*/
|
4987
|
RenderDebugInfo.prototype.providerTokens = function () { };
|
4988
|
/**
|
4989
|
* @abstract
|
4990
|
* @return {?}
|
4991
|
*/
|
4992
|
RenderDebugInfo.prototype.references = function () { };
|
4993
|
/**
|
4994
|
* @abstract
|
4995
|
* @return {?}
|
4996
|
*/
|
4997
|
RenderDebugInfo.prototype.context = function () { };
|
4998
|
/**
|
4999
|
* @abstract
|
5000
|
* @return {?}
|
5001
|
*/
|
5002
|
RenderDebugInfo.prototype.source = function () { };
|
5003
|
return RenderDebugInfo;
|
5004
|
}());
|
5005
|
/**
|
5006
|
* @deprecated Use the `Renderer2` instead.
|
5007
|
* @abstract
|
5008
|
*/
|
5009
|
var Renderer = (function () {
|
5010
|
function Renderer() {
|
5011
|
}
|
5012
|
/**
|
5013
|
* @abstract
|
5014
|
* @param {?} selectorOrNode
|
5015
|
* @param {?=} debugInfo
|
5016
|
* @return {?}
|
5017
|
*/
|
5018
|
Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { };
|
5019
|
/**
|
5020
|
* @abstract
|
5021
|
* @param {?} parentElement
|
5022
|
* @param {?} name
|
5023
|
* @param {?=} debugInfo
|
5024
|
* @return {?}
|
5025
|
*/
|
5026
|
Renderer.prototype.createElement = function (parentElement, name, debugInfo) { };
|
5027
|
/**
|
5028
|
* @abstract
|
5029
|
* @param {?} hostElement
|
5030
|
* @return {?}
|
5031
|
*/
|
5032
|
Renderer.prototype.createViewRoot = function (hostElement) { };
|
5033
|
/**
|
5034
|
* @abstract
|
5035
|
* @param {?} parentElement
|
5036
|
* @param {?=} debugInfo
|
5037
|
* @return {?}
|
5038
|
*/
|
5039
|
Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { };
|
5040
|
/**
|
5041
|
* @abstract
|
5042
|
* @param {?} parentElement
|
5043
|
* @param {?} value
|
5044
|
* @param {?=} debugInfo
|
5045
|
* @return {?}
|
5046
|
*/
|
5047
|
Renderer.prototype.createText = function (parentElement, value, debugInfo) { };
|
5048
|
/**
|
5049
|
* @abstract
|
5050
|
* @param {?} parentElement
|
5051
|
* @param {?} nodes
|
5052
|
* @return {?}
|
5053
|
*/
|
5054
|
Renderer.prototype.projectNodes = function (parentElement, nodes) { };
|
5055
|
/**
|
5056
|
* @abstract
|
5057
|
* @param {?} node
|
5058
|
* @param {?} viewRootNodes
|
5059
|
* @return {?}
|
5060
|
*/
|
5061
|
Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { };
|
5062
|
/**
|
5063
|
* @abstract
|
5064
|
* @param {?} viewRootNodes
|
5065
|
* @return {?}
|
5066
|
*/
|
5067
|
Renderer.prototype.detachView = function (viewRootNodes) { };
|
5068
|
/**
|
5069
|
* @abstract
|
5070
|
* @param {?} hostElement
|
5071
|
* @param {?} viewAllNodes
|
5072
|
* @return {?}
|
5073
|
*/
|
5074
|
Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { };
|
5075
|
/**
|
5076
|
* @abstract
|
5077
|
* @param {?} renderElement
|
5078
|
* @param {?} name
|
5079
|
* @param {?} callback
|
5080
|
* @return {?}
|
5081
|
*/
|
5082
|
Renderer.prototype.listen = function (renderElement, name, callback) { };
|
5083
|
/**
|
5084
|
* @abstract
|
5085
|
* @param {?} target
|
5086
|
* @param {?} name
|
5087
|
* @param {?} callback
|
5088
|
* @return {?}
|
5089
|
*/
|
5090
|
Renderer.prototype.listenGlobal = function (target, name, callback) { };
|
5091
|
/**
|
5092
|
* @abstract
|
5093
|
* @param {?} renderElement
|
5094
|
* @param {?} propertyName
|
5095
|
* @param {?} propertyValue
|
5096
|
* @return {?}
|
5097
|
*/
|
5098
|
Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { };
|
5099
|
/**
|
5100
|
* @abstract
|
5101
|
* @param {?} renderElement
|
5102
|
* @param {?} attributeName
|
5103
|
* @param {?} attributeValue
|
5104
|
* @return {?}
|
5105
|
*/
|
5106
|
Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { };
|
5107
|
/**
|
5108
|
* Used only in debug mode to serialize property changes to dom nodes as attributes.
|
5109
|
* @abstract
|
5110
|
* @param {?} renderElement
|
5111
|
* @param {?} propertyName
|
5112
|
* @param {?} propertyValue
|
5113
|
* @return {?}
|
5114
|
*/
|
5115
|
Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
|
5116
|
/**
|
5117
|
* @abstract
|
5118
|
* @param {?} renderElement
|
5119
|
* @param {?} className
|
5120
|
* @param {?} isAdd
|
5121
|
* @return {?}
|
5122
|
*/
|
5123
|
Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { };
|
5124
|
/**
|
5125
|
* @abstract
|
5126
|
* @param {?} renderElement
|
5127
|
* @param {?} styleName
|
5128
|
* @param {?} styleValue
|
5129
|
* @return {?}
|
5130
|
*/
|
5131
|
Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { };
|
5132
|
/**
|
5133
|
* @abstract
|
5134
|
* @param {?} renderElement
|
5135
|
* @param {?} methodName
|
5136
|
* @param {?=} args
|
5137
|
* @return {?}
|
5138
|
*/
|
5139
|
Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { };
|
5140
|
/**
|
5141
|
* @abstract
|
5142
|
* @param {?} renderNode
|
5143
|
* @param {?} text
|
5144
|
* @return {?}
|
5145
|
*/
|
5146
|
Renderer.prototype.setText = function (renderNode, text) { };
|
5147
|
/**
|
5148
|
* @abstract
|
5149
|
* @param {?} element
|
5150
|
* @param {?} startingStyles
|
5151
|
* @param {?} keyframes
|
5152
|
* @param {?} duration
|
5153
|
* @param {?} delay
|
5154
|
* @param {?} easing
|
5155
|
* @param {?=} previousPlayers
|
5156
|
* @return {?}
|
5157
|
*/
|
5158
|
Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { };
|
5159
|
return Renderer;
|
5160
|
}());
|
5161
|
var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
5162
|
/**
|
5163
|
* Injectable service that provides a low-level interface for modifying the UI.
|
5164
|
*
|
5165
|
* Use this service to bypass Angular's templating and make custom UI changes that can't be
|
5166
|
* expressed declaratively. For example if you need to set a property or an attribute whose name is
|
5167
|
* not statically known, use {\@link Renderer#setElementProperty} or {\@link
|
5168
|
* Renderer#setElementAttribute}
|
5169
|
* respectively.
|
5170
|
*
|
5171
|
* If you are implementing a custom renderer, you must implement this interface.
|
5172
|
*
|
5173
|
* The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
|
5174
|
*
|
5175
|
* @deprecated Use `RendererFactory2` instead.
|
5176
|
* @abstract
|
5177
|
*/
|
5178
|
var RootRenderer = (function () {
|
5179
|
function RootRenderer() {
|
5180
|
}
|
5181
|
/**
|
5182
|
* @abstract
|
5183
|
* @param {?} componentType
|
5184
|
* @return {?}
|
5185
|
*/
|
5186
|
RootRenderer.prototype.renderComponent = function (componentType) { };
|
5187
|
return RootRenderer;
|
5188
|
}());
|
5189
|
/**
|
5190
|
* \@experimental
|
5191
|
* @abstract
|
5192
|
*/
|
5193
|
var RendererFactory2 = (function () {
|
5194
|
function RendererFactory2() {
|
5195
|
}
|
5196
|
/**
|
5197
|
* @abstract
|
5198
|
* @param {?} hostElement
|
5199
|
* @param {?} type
|
5200
|
* @return {?}
|
5201
|
*/
|
5202
|
RendererFactory2.prototype.createRenderer = function (hostElement, type) { };
|
5203
|
/**
|
5204
|
* @abstract
|
5205
|
* @return {?}
|
5206
|
*/
|
5207
|
RendererFactory2.prototype.begin = function () { };
|
5208
|
/**
|
5209
|
* @abstract
|
5210
|
* @return {?}
|
5211
|
*/
|
5212
|
RendererFactory2.prototype.end = function () { };
|
5213
|
/**
|
5214
|
* @abstract
|
5215
|
* @return {?}
|
5216
|
*/
|
5217
|
RendererFactory2.prototype.whenRenderingDone = function () { };
|
5218
|
return RendererFactory2;
|
5219
|
}());
|
5220
|
var RendererStyleFlags2 = {};
|
5221
|
RendererStyleFlags2.Important = 1;
|
5222
|
RendererStyleFlags2.DashCase = 2;
|
5223
|
RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
|
5224
|
RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
|
5225
|
/**
|
5226
|
* \@experimental
|
5227
|
* @abstract
|
5228
|
*/
|
5229
|
var Renderer2 = (function () {
|
5230
|
function Renderer2() {
|
5231
|
}
|
5232
|
/**
|
5233
|
* This field can be used to store arbitrary data on this renderer instance.
|
5234
|
* This is useful for renderers that delegate to other renderers.
|
5235
|
* @abstract
|
5236
|
* @return {?}
|
5237
|
*/
|
5238
|
Renderer2.prototype.data = function () { };
|
5239
|
/**
|
5240
|
* @abstract
|
5241
|
* @return {?}
|
5242
|
*/
|
5243
|
Renderer2.prototype.destroy = function () { };
|
5244
|
/**
|
5245
|
* @abstract
|
5246
|
* @param {?} name
|
5247
|
* @param {?=} namespace
|
5248
|
* @return {?}
|
5249
|
*/
|
5250
|
Renderer2.prototype.createElement = function (name, namespace) { };
|
5251
|
/**
|
5252
|
* @abstract
|
5253
|
* @param {?} value
|
5254
|
* @return {?}
|
5255
|
*/
|
5256
|
Renderer2.prototype.createComment = function (value) { };
|
5257
|
/**
|
5258
|
* @abstract
|
5259
|
* @param {?} value
|
5260
|
* @return {?}
|
5261
|
*/
|
5262
|
Renderer2.prototype.createText = function (value) { };
|
5263
|
/**
|
5264
|
* @abstract
|
5265
|
* @param {?} parent
|
5266
|
* @param {?} newChild
|
5267
|
* @return {?}
|
5268
|
*/
|
5269
|
Renderer2.prototype.appendChild = function (parent, newChild) { };
|
5270
|
/**
|
5271
|
* @abstract
|
5272
|
* @param {?} parent
|
5273
|
* @param {?} newChild
|
5274
|
* @param {?} refChild
|
5275
|
* @return {?}
|
5276
|
*/
|
5277
|
Renderer2.prototype.insertBefore = function (parent, newChild, refChild) { };
|
5278
|
/**
|
5279
|
* @abstract
|
5280
|
* @param {?} parent
|
5281
|
* @param {?} oldChild
|
5282
|
* @return {?}
|
5283
|
*/
|
5284
|
Renderer2.prototype.removeChild = function (parent, oldChild) { };
|
5285
|
/**
|
5286
|
* @abstract
|
5287
|
* @param {?} selectorOrNode
|
5288
|
* @return {?}
|
5289
|
*/
|
5290
|
Renderer2.prototype.selectRootElement = function (selectorOrNode) { };
|
5291
|
/**
|
5292
|
* Attention: On WebWorkers, this will always return a value,
|
5293
|
* as we are asking for a result synchronously. I.e.
|
5294
|
* the caller can't rely on checking whether this is null or not.
|
5295
|
* @abstract
|
5296
|
* @param {?} node
|
5297
|
* @return {?}
|
5298
|
*/
|
5299
|
Renderer2.prototype.parentNode = function (node) { };
|
5300
|
/**
|
5301
|
* Attention: On WebWorkers, this will always return a value,
|
5302
|
* as we are asking for a result synchronously. I.e.
|
5303
|
* the caller can't rely on checking whether this is null or not.
|
5304
|
* @abstract
|
5305
|
* @param {?} node
|
5306
|
* @return {?}
|
5307
|
*/
|
5308
|
Renderer2.prototype.nextSibling = function (node) { };
|
5309
|
/**
|
5310
|
* @abstract
|
5311
|
* @param {?} el
|
5312
|
* @param {?} name
|
5313
|
* @param {?} value
|
5314
|
* @param {?=} namespace
|
5315
|
* @return {?}
|
5316
|
*/
|
5317
|
Renderer2.prototype.setAttribute = function (el, name, value, namespace) { };
|
5318
|
/**
|
5319
|
* @abstract
|
5320
|
* @param {?} el
|
5321
|
* @param {?} name
|
5322
|
* @param {?=} namespace
|
5323
|
* @return {?}
|
5324
|
*/
|
5325
|
Renderer2.prototype.removeAttribute = function (el, name, namespace) { };
|
5326
|
/**
|
5327
|
* @abstract
|
5328
|
* @param {?} el
|
5329
|
* @param {?} name
|
5330
|
* @return {?}
|
5331
|
*/
|
5332
|
Renderer2.prototype.addClass = function (el, name) { };
|
5333
|
/**
|
5334
|
* @abstract
|
5335
|
* @param {?} el
|
5336
|
* @param {?} name
|
5337
|
* @return {?}
|
5338
|
*/
|
5339
|
Renderer2.prototype.removeClass = function (el, name) { };
|
5340
|
/**
|
5341
|
* @abstract
|
5342
|
* @param {?} el
|
5343
|
* @param {?} style
|
5344
|
* @param {?} value
|
5345
|
* @param {?=} flags
|
5346
|
* @return {?}
|
5347
|
*/
|
5348
|
Renderer2.prototype.setStyle = function (el, style, value, flags) { };
|
5349
|
/**
|
5350
|
* @abstract
|
5351
|
* @param {?} el
|
5352
|
* @param {?} style
|
5353
|
* @param {?=} flags
|
5354
|
* @return {?}
|
5355
|
*/
|
5356
|
Renderer2.prototype.removeStyle = function (el, style, flags) { };
|
5357
|
/**
|
5358
|
* @abstract
|
5359
|
* @param {?} el
|
5360
|
* @param {?} name
|
5361
|
* @param {?} value
|
5362
|
* @return {?}
|
5363
|
*/
|
5364
|
Renderer2.prototype.setProperty = function (el, name, value) { };
|
5365
|
/**
|
5366
|
* @abstract
|
5367
|
* @param {?} node
|
5368
|
* @param {?} value
|
5369
|
* @return {?}
|
5370
|
*/
|
5371
|
Renderer2.prototype.setValue = function (node, value) { };
|
5372
|
/**
|
5373
|
* @abstract
|
5374
|
* @param {?} target
|
5375
|
* @param {?} eventName
|
5376
|
* @param {?} callback
|
5377
|
* @return {?}
|
5378
|
*/
|
5379
|
Renderer2.prototype.listen = function (target, eventName, callback) { };
|
5380
|
return Renderer2;
|
5381
|
}());
|
5382
|
/**
|
5383
|
* @license
|
5384
|
* Copyright Google Inc. All Rights Reserved.
|
5385
|
*
|
5386
|
* Use of this source code is governed by an MIT-style license that can be
|
5387
|
* found in the LICENSE file at https://angular.io/license
|
5388
|
*/
|
5389
|
// Public API for render
|
5390
|
var ElementRef = (function () {
|
5391
|
/**
|
5392
|
* @param {?} nativeElement
|
5393
|
*/
|
5394
|
function ElementRef(nativeElement) {
|
5395
|
this.nativeElement = nativeElement;
|
5396
|
}
|
5397
|
return ElementRef;
|
5398
|
}());
|
5399
|
/**
|
5400
|
* @license
|
5401
|
* Copyright Google Inc. All Rights Reserved.
|
5402
|
*
|
5403
|
* Use of this source code is governed by an MIT-style license that can be
|
5404
|
* found in the LICENSE file at https://angular.io/license
|
5405
|
*/
|
5406
|
/**
|
5407
|
* Used to load ng module factories.
|
5408
|
* \@stable
|
5409
|
* @abstract
|
5410
|
*/
|
5411
|
var NgModuleFactoryLoader = (function () {
|
5412
|
function NgModuleFactoryLoader() {
|
5413
|
}
|
5414
|
/**
|
5415
|
* @abstract
|
5416
|
* @param {?} path
|
5417
|
* @return {?}
|
5418
|
*/
|
5419
|
NgModuleFactoryLoader.prototype.load = function (path) { };
|
5420
|
return NgModuleFactoryLoader;
|
5421
|
}());
|
5422
|
var moduleFactories = new Map();
|
5423
|
/**
|
5424
|
* Registers a loaded module. Should only be called from generated NgModuleFactory code.
|
5425
|
* \@experimental
|
5426
|
* @param {?} id
|
5427
|
* @param {?} factory
|
5428
|
* @return {?}
|
5429
|
*/
|
5430
|
function registerModuleFactory(id, factory) {
|
5431
|
var /** @type {?} */ existing = moduleFactories.get(id);
|
5432
|
if (existing) {
|
5433
|
throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
|
5434
|
}
|
5435
|
moduleFactories.set(id, factory);
|
5436
|
}
|
5437
|
/**
|
5438
|
* @return {?}
|
5439
|
*/
|
5440
|
/**
|
5441
|
* Returns the NgModuleFactory with the given id, if it exists and has been loaded.
|
5442
|
* Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
|
5443
|
* cannot be found.
|
5444
|
* \@experimental
|
5445
|
* @param {?} id
|
5446
|
* @return {?}
|
5447
|
*/
|
5448
|
function getModuleFactory(id) {
|
5449
|
var /** @type {?} */ factory = moduleFactories.get(id);
|
5450
|
if (!factory)
|
5451
|
throw new Error("No module with ID " + id + " loaded");
|
5452
|
return factory;
|
5453
|
}
|
5454
|
/**
|
5455
|
* @license
|
5456
|
* Copyright Google Inc. All Rights Reserved.
|
5457
|
*
|
5458
|
* Use of this source code is governed by an MIT-style license that can be
|
5459
|
* found in the LICENSE file at https://angular.io/license
|
5460
|
*/
|
5461
|
/**
|
5462
|
* An unmodifiable list of items that Angular keeps up to date when the state
|
5463
|
* of the application changes.
|
5464
|
*
|
5465
|
* The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList}
|
5466
|
* provide.
|
5467
|
*
|
5468
|
* Implements an iterable interface, therefore it can be used in both ES6
|
5469
|
* javascript `for (var i of items)` loops as well as in Angular templates with
|
5470
|
* `*ngFor="let i of myList"`.
|
5471
|
*
|
5472
|
* Changes can be observed by subscribing to the changes `Observable`.
|
5473
|
*
|
5474
|
* NOTE: In the future this class will implement an `Observable` interface.
|
5475
|
*
|
5476
|
* ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
|
5477
|
* ```typescript
|
5478
|
* \@Component({...})
|
5479
|
* class Container {
|
5480
|
* \@ViewChildren(Item) items:QueryList<Item>;
|
5481
|
* }
|
5482
|
* ```
|
5483
|
* \@stable
|
5484
|
*/
|
5485
|
var QueryList = (function () {
|
5486
|
function QueryList() {
|
5487
|
this._dirty = true;
|
5488
|
this._results = [];
|
5489
|
this._emitter = new EventEmitter();
|
5490
|
}
|
5491
|
Object.defineProperty(QueryList.prototype, "changes", {
|
5492
|
/**
|
5493
|
* @return {?}
|
5494
|
*/
|
5495
|
get: function () { return this._emitter; },
|
5496
|
enumerable: true,
|
5497
|
configurable: true
|
5498
|
});
|
5499
|
Object.defineProperty(QueryList.prototype, "length", {
|
5500
|
/**
|
5501
|
* @return {?}
|
5502
|
*/
|
5503
|
get: function () { return this._results.length; },
|
5504
|
enumerable: true,
|
5505
|
configurable: true
|
5506
|
});
|
5507
|
Object.defineProperty(QueryList.prototype, "first", {
|
5508
|
/**
|
5509
|
* @return {?}
|
5510
|
*/
|
5511
|
get: function () { return this._results[0]; },
|
5512
|
enumerable: true,
|
5513
|
configurable: true
|
5514
|
});
|
5515
|
Object.defineProperty(QueryList.prototype, "last", {
|
5516
|
/**
|
5517
|
* @return {?}
|
5518
|
*/
|
5519
|
get: function () { return this._results[this.length - 1]; },
|
5520
|
enumerable: true,
|
5521
|
configurable: true
|
5522
|
});
|
5523
|
/**
|
5524
|
* See
|
5525
|
* [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
|
5526
|
* @template U
|
5527
|
* @param {?} fn
|
5528
|
* @return {?}
|
5529
|
*/
|
5530
|
QueryList.prototype.map = function (fn) { return this._results.map(fn); };
|
5531
|
/**
|
5532
|
* See
|
5533
|
* [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
|
5534
|
* @param {?} fn
|
5535
|
* @return {?}
|
5536
|
*/
|
5537
|
QueryList.prototype.filter = function (fn) {
|
5538
|
return this._results.filter(fn);
|
5539
|
};
|
5540
|
/**
|
5541
|
* See
|
5542
|
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
|
5543
|
* @param {?} fn
|
5544
|
* @return {?}
|
5545
|
*/
|
5546
|
QueryList.prototype.find = function (fn) {
|
5547
|
return this._results.find(fn);
|
5548
|
};
|
5549
|
/**
|
5550
|
* See
|
5551
|
* [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
|
5552
|
* @template U
|
5553
|
* @param {?} fn
|
5554
|
* @param {?} init
|
5555
|
* @return {?}
|
5556
|
*/
|
5557
|
QueryList.prototype.reduce = function (fn, init) {
|
5558
|
return this._results.reduce(fn, init);
|
5559
|
};
|
5560
|
/**
|
5561
|
* See
|
5562
|
* [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
|
5563
|
* @param {?} fn
|
5564
|
* @return {?}
|
5565
|
*/
|
5566
|
QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
|
5567
|
/**
|
5568
|
* See
|
5569
|
* [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
|
5570
|
* @param {?} fn
|
5571
|
* @return {?}
|
5572
|
*/
|
5573
|
QueryList.prototype.some = function (fn) {
|
5574
|
return this._results.some(fn);
|
5575
|
};
|
5576
|
/**
|
5577
|
* @return {?}
|
5578
|
*/
|
5579
|
QueryList.prototype.toArray = function () { return this._results.slice(); };
|
5580
|
/**
|
5581
|
* @return {?}
|
5582
|
*/
|
5583
|
QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); };
|
5584
|
/**
|
5585
|
* @return {?}
|
5586
|
*/
|
5587
|
QueryList.prototype.toString = function () { return this._results.toString(); };
|
5588
|
/**
|
5589
|
* @param {?} res
|
5590
|
* @return {?}
|
5591
|
*/
|
5592
|
QueryList.prototype.reset = function (res) {
|
5593
|
this._results = flatten(res);
|
5594
|
this._dirty = false;
|
5595
|
};
|
5596
|
/**
|
5597
|
* @return {?}
|
5598
|
*/
|
5599
|
QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); };
|
5600
|
/**
|
5601
|
* internal
|
5602
|
* @return {?}
|
5603
|
*/
|
5604
|
QueryList.prototype.setDirty = function () { this._dirty = true; };
|
5605
|
Object.defineProperty(QueryList.prototype, "dirty", {
|
5606
|
/**
|
5607
|
* internal
|
5608
|
* @return {?}
|
5609
|
*/
|
5610
|
get: function () { return this._dirty; },
|
5611
|
enumerable: true,
|
5612
|
configurable: true
|
5613
|
});
|
5614
|
/**
|
5615
|
* internal
|
5616
|
* @return {?}
|
5617
|
*/
|
5618
|
QueryList.prototype.destroy = function () {
|
5619
|
this._emitter.complete();
|
5620
|
this._emitter.unsubscribe();
|
5621
|
};
|
5622
|
return QueryList;
|
5623
|
}());
|
5624
|
/**
|
5625
|
* @template T
|
5626
|
* @param {?} list
|
5627
|
* @return {?}
|
5628
|
*/
|
5629
|
function flatten(list) {
|
5630
|
return list.reduce(function (flat, item) {
|
5631
|
var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
|
5632
|
return ((flat)).concat(flatItem);
|
5633
|
}, []);
|
5634
|
}
|
5635
|
/**
|
5636
|
* @license
|
5637
|
* Copyright Google Inc. All Rights Reserved.
|
5638
|
*
|
5639
|
* Use of this source code is governed by an MIT-style license that can be
|
5640
|
* found in the LICENSE file at https://angular.io/license
|
5641
|
*/
|
5642
|
var _SEPARATOR = '#';
|
5643
|
var FACTORY_CLASS_SUFFIX = 'NgFactory';
|
5644
|
/**
|
5645
|
* Configuration for SystemJsNgModuleLoader.
|
5646
|
* token.
|
5647
|
*
|
5648
|
* \@experimental
|
5649
|
* @abstract
|
5650
|
*/
|
5651
|
var SystemJsNgModuleLoaderConfig = (function () {
|
5652
|
function SystemJsNgModuleLoaderConfig() {
|
5653
|
}
|
5654
|
return SystemJsNgModuleLoaderConfig;
|
5655
|
}());
|
5656
|
var DEFAULT_CONFIG = {
|
5657
|
factoryPathPrefix: '',
|
5658
|
factoryPathSuffix: '.ngfactory',
|
5659
|
};
|
5660
|
/**
|
5661
|
* NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
|
5662
|
* \@experimental
|
5663
|
*/
|
5664
|
var SystemJsNgModuleLoader = (function () {
|
5665
|
/**
|
5666
|
* @param {?} _compiler
|
5667
|
* @param {?=} config
|
5668
|
*/
|
5669
|
function SystemJsNgModuleLoader(_compiler, config) {
|
5670
|
this._compiler = _compiler;
|
5671
|
this._config = config || DEFAULT_CONFIG;
|
5672
|
}
|
5673
|
/**
|
5674
|
* @param {?} path
|
5675
|
* @return {?}
|
5676
|
*/
|
5677
|
SystemJsNgModuleLoader.prototype.load = function (path) {
|
5678
|
var /** @type {?} */ offlineMode = this._compiler instanceof Compiler;
|
5679
|
return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
|
5680
|
};
|
5681
|
/**
|
5682
|
* @param {?} path
|
5683
|
* @return {?}
|
5684
|
*/
|
5685
|
SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
|
5686
|
var _this = this;
|
5687
|
var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
|
5688
|
if (exportName === undefined) {
|
5689
|
exportName = 'default';
|
5690
|
}
|
5691
|
return System.import(module)
|
5692
|
.then(function (module) { return module[exportName]; })
|
5693
|
.then(function (type) { return checkNotEmpty(type, module, exportName); })
|
5694
|
.then(function (type) { return _this._compiler.compileModuleAsync(type); });
|
5695
|
};
|
5696
|
/**
|
5697
|
* @param {?} path
|
5698
|
* @return {?}
|
5699
|
*/
|
5700
|
SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
|
5701
|
var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
|
5702
|
var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX;
|
5703
|
if (exportName === undefined) {
|
5704
|
exportName = 'default';
|
5705
|
factoryClassSuffix = '';
|
5706
|
}
|
5707
|
return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
|
5708
|
.then(function (module) { return module[exportName + factoryClassSuffix]; })
|
5709
|
.then(function (factory) { return checkNotEmpty(factory, module, exportName); });
|
5710
|
};
|
5711
|
return SystemJsNgModuleLoader;
|
5712
|
}());
|
5713
|
SystemJsNgModuleLoader.decorators = [
|
5714
|
{ type: Injectable },
|
5715
|
];
|
5716
|
/**
|
5717
|
* @nocollapse
|
5718
|
*/
|
5719
|
SystemJsNgModuleLoader.ctorParameters = function () { return [
|
5720
|
{ type: Compiler, },
|
5721
|
{ type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
|
5722
|
]; };
|
5723
|
/**
|
5724
|
* @param {?} value
|
5725
|
* @param {?} modulePath
|
5726
|
* @param {?} exportName
|
5727
|
* @return {?}
|
5728
|
*/
|
5729
|
function checkNotEmpty(value, modulePath, exportName) {
|
5730
|
if (!value) {
|
5731
|
throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
|
5732
|
}
|
5733
|
return value;
|
5734
|
}
|
5735
|
/**
|
5736
|
* @license
|
5737
|
* Copyright Google Inc. All Rights Reserved.
|
5738
|
*
|
5739
|
* Use of this source code is governed by an MIT-style license that can be
|
5740
|
* found in the LICENSE file at https://angular.io/license
|
5741
|
*/
|
5742
|
/**
|
5743
|
* Represents an Embedded Template that can be used to instantiate Embedded Views.
|
5744
|
*
|
5745
|
* You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
|
5746
|
* (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
|
5747
|
* the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
|
5748
|
* the `TemplateRef` from a Component or a Directive via {\@link Query}.
|
5749
|
*
|
5750
|
* To instantiate Embedded Views based on a Template, use
|
5751
|
* {\@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
|
5752
|
* View Container.
|
5753
|
* \@stable
|
5754
|
* @abstract
|
5755
|
*/
|
5756
|
var TemplateRef = (function () {
|
5757
|
function TemplateRef() {
|
5758
|
}
|
5759
|
/**
|
5760
|
* @abstract
|
5761
|
* @return {?}
|
5762
|
*/
|
5763
|
TemplateRef.prototype.elementRef = function () { };
|
5764
|
/**
|
5765
|
* @abstract
|
5766
|
* @param {?} context
|
5767
|
* @return {?}
|
5768
|
*/
|
5769
|
TemplateRef.prototype.createEmbeddedView = function (context) { };
|
5770
|
return TemplateRef;
|
5771
|
}());
|
5772
|
/**
|
5773
|
* @license
|
5774
|
* Copyright Google Inc. All Rights Reserved.
|
5775
|
*
|
5776
|
* Use of this source code is governed by an MIT-style license that can be
|
5777
|
* found in the LICENSE file at https://angular.io/license
|
5778
|
*/
|
5779
|
/**
|
5780
|
* Represents a container where one or more Views can be attached.
|
5781
|
*
|
5782
|
* The container can contain two kinds of Views. Host Views, created by instantiating a
|
5783
|
* {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an
|
5784
|
* {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}.
|
5785
|
*
|
5786
|
* The location of the View Container within the containing View is specified by the Anchor
|
5787
|
* `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
|
5788
|
* have a single View Container.
|
5789
|
*
|
5790
|
* Root elements of Views attached to this container become siblings of the Anchor Element in
|
5791
|
* the Rendered View.
|
5792
|
*
|
5793
|
* To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected
|
5794
|
* with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query.
|
5795
|
* \@stable
|
5796
|
* @abstract
|
5797
|
*/
|
5798
|
var ViewContainerRef = (function () {
|
5799
|
function ViewContainerRef() {
|
5800
|
}
|
5801
|
/**
|
5802
|
* Anchor element that specifies the location of this container in the containing View.
|
5803
|
* <!-- TODO: rename to anchorElement -->
|
5804
|
* @abstract
|
5805
|
* @return {?}
|
5806
|
*/
|
5807
|
ViewContainerRef.prototype.element = function () { };
|
5808
|
/**
|
5809
|
* @abstract
|
5810
|
* @return {?}
|
5811
|
*/
|
5812
|
ViewContainerRef.prototype.injector = function () { };
|
5813
|
/**
|
5814
|
* @abstract
|
5815
|
* @return {?}
|
5816
|
*/
|
5817
|
ViewContainerRef.prototype.parentInjector = function () { };
|
5818
|
/**
|
5819
|
* Destroys all Views in this container.
|
5820
|
* @abstract
|
5821
|
* @return {?}
|
5822
|
*/
|
5823
|
ViewContainerRef.prototype.clear = function () { };
|
5824
|
/**
|
5825
|
* Returns the {\@link ViewRef} for the View located in this container at the specified index.
|
5826
|
* @abstract
|
5827
|
* @param {?} index
|
5828
|
* @return {?}
|
5829
|
*/
|
5830
|
ViewContainerRef.prototype.get = function (index) { };
|
5831
|
/**
|
5832
|
* Returns the number of Views currently attached to this container.
|
5833
|
* @abstract
|
5834
|
* @return {?}
|
5835
|
*/
|
5836
|
ViewContainerRef.prototype.length = function () { };
|
5837
|
/**
|
5838
|
* Instantiates an Embedded View based on the {\@link TemplateRef `templateRef`} and inserts it
|
5839
|
* into this container at the specified `index`.
|
5840
|
*
|
5841
|
* If `index` is not specified, the new View will be inserted as the last View in the container.
|
5842
|
*
|
5843
|
* Returns the {\@link ViewRef} for the newly created View.
|
5844
|
* @abstract
|
5845
|
* @template C
|
5846
|
* @param {?} templateRef
|
5847
|
* @param {?=} context
|
5848
|
* @param {?=} index
|
5849
|
* @return {?}
|
5850
|
*/
|
5851
|
ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { };
|
5852
|
/**
|
5853
|
* Instantiates a single {\@link Component} and inserts its Host View into this container at the
|
5854
|
* specified `index`.
|
5855
|
*
|
5856
|
* The component is instantiated using its {\@link ComponentFactory} which can be
|
5857
|
* obtained via {\@link ComponentFactoryResolver#resolveComponentFactory}.
|
5858
|
*
|
5859
|
* If `index` is not specified, the new View will be inserted as the last View in the container.
|
5860
|
*
|
5861
|
* You can optionally specify the {\@link Injector} that will be used as parent for the Component.
|
5862
|
*
|
5863
|
* Returns the {\@link ComponentRef} of the Host View created for the newly instantiated Component.
|
5864
|
* @abstract
|
5865
|
* @template C
|
5866
|
* @param {?} componentFactory
|
5867
|
* @param {?=} index
|
5868
|
* @param {?=} injector
|
5869
|
* @param {?=} projectableNodes
|
5870
|
* @param {?=} ngModule
|
5871
|
* @return {?}
|
5872
|
*/
|
5873
|
ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModule) { };
|
5874
|
/**
|
5875
|
* Inserts a View identified by a {\@link ViewRef} into the container at the specified `index`.
|
5876
|
*
|
5877
|
* If `index` is not specified, the new View will be inserted as the last View in the container.
|
5878
|
*
|
5879
|
* Returns the inserted {\@link ViewRef}.
|
5880
|
* @abstract
|
5881
|
* @param {?} viewRef
|
5882
|
* @param {?=} index
|
5883
|
* @return {?}
|
5884
|
*/
|
5885
|
ViewContainerRef.prototype.insert = function (viewRef, index) { };
|
5886
|
/**
|
5887
|
* Moves a View identified by a {\@link ViewRef} into the container at the specified `index`.
|
5888
|
*
|
5889
|
* Returns the inserted {\@link ViewRef}.
|
5890
|
* @abstract
|
5891
|
* @param {?} viewRef
|
5892
|
* @param {?} currentIndex
|
5893
|
* @return {?}
|
5894
|
*/
|
5895
|
ViewContainerRef.prototype.move = function (viewRef, currentIndex) { };
|
5896
|
/**
|
5897
|
* Returns the index of the View, specified via {\@link ViewRef}, within the current container or
|
5898
|
* `-1` if this container doesn't contain the View.
|
5899
|
* @abstract
|
5900
|
* @param {?} viewRef
|
5901
|
* @return {?}
|
5902
|
*/
|
5903
|
ViewContainerRef.prototype.indexOf = function (viewRef) { };
|
5904
|
/**
|
5905
|
* Destroys a View attached to this container at the specified `index`.
|
5906
|
*
|
5907
|
* If `index` is not specified, the last View in the container will be removed.
|
5908
|
* @abstract
|
5909
|
* @param {?=} index
|
5910
|
* @return {?}
|
5911
|
*/
|
5912
|
ViewContainerRef.prototype.remove = function (index) { };
|
5913
|
/**
|
5914
|
* Use along with {\@link #insert} to move a View within the current container.
|
5915
|
*
|
5916
|
* If the `index` param is omitted, the last {\@link ViewRef} is detached.
|
5917
|
* @abstract
|
5918
|
* @param {?=} index
|
5919
|
* @return {?}
|
5920
|
*/
|
5921
|
ViewContainerRef.prototype.detach = function (index) { };
|
5922
|
return ViewContainerRef;
|
5923
|
}());
|
5924
|
/**
|
5925
|
* \@stable
|
5926
|
* @abstract
|
5927
|
*/
|
5928
|
var ChangeDetectorRef = (function () {
|
5929
|
function ChangeDetectorRef() {
|
5930
|
}
|
5931
|
/**
|
5932
|
* Marks all {\@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.
|
5933
|
*
|
5934
|
* <!-- TODO: Add a link to a chapter on OnPush components -->
|
5935
|
*
|
5936
|
* ### Example ([live demo](http://plnkr.co/edit/GC512b?p=preview))
|
5937
|
*
|
5938
|
* ```typescript
|
5939
|
* \@Component({
|
5940
|
* selector: 'cmp',
|
5941
|
* changeDetection: ChangeDetectionStrategy.OnPush,
|
5942
|
* template: `Number of ticks: {{numberOfTicks}}`
|
5943
|
* })
|
5944
|
* class Cmp {
|
5945
|
* numberOfTicks = 0;
|
5946
|
*
|
5947
|
* constructor(private ref: ChangeDetectorRef) {
|
5948
|
* setInterval(() => {
|
5949
|
* this.numberOfTicks++;
|
5950
|
* // the following is required, otherwise the view will not be updated
|
5951
|
* this.ref.markForCheck();
|
5952
|
* }, 1000);
|
5953
|
* }
|
5954
|
* }
|
5955
|
*
|
5956
|
* \@Component({
|
5957
|
* selector: 'app',
|
5958
|
* changeDetection: ChangeDetectionStrategy.OnPush,
|
5959
|
* template: `
|
5960
|
* <cmp><cmp>
|
5961
|
* `,
|
5962
|
* })
|
5963
|
* class App {
|
5964
|
* }
|
5965
|
* ```
|
5966
|
* @abstract
|
5967
|
* @return {?}
|
5968
|
*/
|
5969
|
ChangeDetectorRef.prototype.markForCheck = function () { };
|
5970
|
/**
|
5971
|
* Detaches the change detector from the change detector tree.
|
5972
|
*
|
5973
|
* The detached change detector will not be checked until it is reattached.
|
5974
|
*
|
5975
|
* This can also be used in combination with {\@link ChangeDetectorRef#detectChanges} to implement
|
5976
|
* local change
|
5977
|
* detection checks.
|
5978
|
*
|
5979
|
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
|
5980
|
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
|
5981
|
*
|
5982
|
* ### Example
|
5983
|
*
|
5984
|
* The following example defines a component with a large list of readonly data.
|
5985
|
* Imagine the data changes constantly, many times per second. For performance reasons,
|
5986
|
* we want to check and update the list every five seconds. We can do that by detaching
|
5987
|
* the component's change detector and doing a local check every five seconds.
|
5988
|
*
|
5989
|
* ```typescript
|
5990
|
* class DataProvider {
|
5991
|
* // in a real application the returned data will be different every time
|
5992
|
* get data() {
|
5993
|
* return [1,2,3,4,5];
|
5994
|
* }
|
5995
|
* }
|
5996
|
*
|
5997
|
* \@Component({
|
5998
|
* selector: 'giant-list',
|
5999
|
* template: `
|
6000
|
* <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
|
6001
|
* `,
|
6002
|
* })
|
6003
|
* class GiantList {
|
6004
|
* constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
|
6005
|
* ref.detach();
|
6006
|
* setInterval(() => {
|
6007
|
* this.ref.detectChanges();
|
6008
|
* }, 5000);
|
6009
|
* }
|
6010
|
* }
|
6011
|
*
|
6012
|
* \@Component({
|
6013
|
* selector: 'app',
|
6014
|
* providers: [DataProvider],
|
6015
|
* template: `
|
6016
|
* <giant-list><giant-list>
|
6017
|
* `,
|
6018
|
* })
|
6019
|
* class App {
|
6020
|
* }
|
6021
|
* ```
|
6022
|
* @abstract
|
6023
|
* @return {?}
|
6024
|
*/
|
6025
|
ChangeDetectorRef.prototype.detach = function () { };
|
6026
|
/**
|
6027
|
* Checks the change detector and its children.
|
6028
|
*
|
6029
|
* This can also be used in combination with {\@link ChangeDetectorRef#detach} to implement local
|
6030
|
* change detection
|
6031
|
* checks.
|
6032
|
*
|
6033
|
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
|
6034
|
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
|
6035
|
*
|
6036
|
* ### Example
|
6037
|
*
|
6038
|
* The following example defines a component with a large list of readonly data.
|
6039
|
* Imagine, the data changes constantly, many times per second. For performance reasons,
|
6040
|
* we want to check and update the list every five seconds.
|
6041
|
*
|
6042
|
* We can do that by detaching the component's change detector and doing a local change detection
|
6043
|
* check
|
6044
|
* every five seconds.
|
6045
|
*
|
6046
|
* See {\@link ChangeDetectorRef#detach} for more information.
|
6047
|
* @abstract
|
6048
|
* @return {?}
|
6049
|
*/
|
6050
|
ChangeDetectorRef.prototype.detectChanges = function () { };
|
6051
|
/**
|
6052
|
* Checks the change detector and its children, and throws if any changes are detected.
|
6053
|
*
|
6054
|
* This is used in development mode to verify that running change detection doesn't introduce
|
6055
|
* other changes.
|
6056
|
* @abstract
|
6057
|
* @return {?}
|
6058
|
*/
|
6059
|
ChangeDetectorRef.prototype.checkNoChanges = function () { };
|
6060
|
/**
|
6061
|
* Reattach the change detector to the change detector tree.
|
6062
|
*
|
6063
|
* This also marks OnPush ancestors as to be checked. This reattached change detector will be
|
6064
|
* checked during the next change detection run.
|
6065
|
*
|
6066
|
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
|
6067
|
*
|
6068
|
* ### Example ([live demo](http://plnkr.co/edit/aUhZha?p=preview))
|
6069
|
*
|
6070
|
* The following example creates a component displaying `live` data. The component will detach
|
6071
|
* its change detector from the main change detector tree when the component's live property
|
6072
|
* is set to false.
|
6073
|
*
|
6074
|
* ```typescript
|
6075
|
* class DataProvider {
|
6076
|
* data = 1;
|
6077
|
*
|
6078
|
* constructor() {
|
6079
|
* setInterval(() => {
|
6080
|
* this.data = this.data * 2;
|
6081
|
* }, 500);
|
6082
|
* }
|
6083
|
* }
|
6084
|
*
|
6085
|
* \@Component({
|
6086
|
* selector: 'live-data',
|
6087
|
* inputs: ['live'],
|
6088
|
* template: 'Data: {{dataProvider.data}}'
|
6089
|
* })
|
6090
|
* class LiveData {
|
6091
|
* constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {}
|
6092
|
*
|
6093
|
* set live(value) {
|
6094
|
* if (value) {
|
6095
|
* this.ref.reattach();
|
6096
|
* } else {
|
6097
|
* this.ref.detach();
|
6098
|
* }
|
6099
|
* }
|
6100
|
* }
|
6101
|
*
|
6102
|
* \@Component({
|
6103
|
* selector: 'app',
|
6104
|
* providers: [DataProvider],
|
6105
|
* template: `
|
6106
|
* Live Update: <input type="checkbox" [(ngModel)]="live">
|
6107
|
* <live-data [live]="live"><live-data>
|
6108
|
* `,
|
6109
|
* })
|
6110
|
* class App {
|
6111
|
* live = true;
|
6112
|
* }
|
6113
|
* ```
|
6114
|
* @abstract
|
6115
|
* @return {?}
|
6116
|
*/
|
6117
|
ChangeDetectorRef.prototype.reattach = function () { };
|
6118
|
return ChangeDetectorRef;
|
6119
|
}());
|
6120
|
/**
|
6121
|
* @license
|
6122
|
* Copyright Google Inc. All Rights Reserved.
|
6123
|
*
|
6124
|
* Use of this source code is governed by an MIT-style license that can be
|
6125
|
* found in the LICENSE file at https://angular.io/license
|
6126
|
*/
|
6127
|
/**
|
6128
|
* \@stable
|
6129
|
* @abstract
|
6130
|
*/
|
6131
|
var ViewRef = (function (_super) {
|
6132
|
__extends(ViewRef, _super);
|
6133
|
function ViewRef() {
|
6134
|
return _super !== null && _super.apply(this, arguments) || this;
|
6135
|
}
|
6136
|
/**
|
6137
|
* Destroys the view and all of the data structures associated with it.
|
6138
|
* @abstract
|
6139
|
* @return {?}
|
6140
|
*/
|
6141
|
ViewRef.prototype.destroy = function () { };
|
6142
|
/**
|
6143
|
* @abstract
|
6144
|
* @return {?}
|
6145
|
*/
|
6146
|
ViewRef.prototype.destroyed = function () { };
|
6147
|
/**
|
6148
|
* @abstract
|
6149
|
* @param {?} callback
|
6150
|
* @return {?}
|
6151
|
*/
|
6152
|
ViewRef.prototype.onDestroy = function (callback) { };
|
6153
|
return ViewRef;
|
6154
|
}(ChangeDetectorRef));
|
6155
|
/**
|
6156
|
* Represents an Angular View.
|
6157
|
*
|
6158
|
* <!-- TODO: move the next two paragraphs to the dev guide -->
|
6159
|
* A View is a fundamental building block of the application UI. It is the smallest grouping of
|
6160
|
* Elements which are created and destroyed together.
|
6161
|
*
|
6162
|
* Properties of elements in a View can change, but the structure (number and order) of elements in
|
6163
|
* a View cannot. Changing the structure of Elements can only be done by inserting, moving or
|
6164
|
* removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers.
|
6165
|
* <!-- /TODO -->
|
6166
|
*
|
6167
|
* ### Example
|
6168
|
*
|
6169
|
* Given this template...
|
6170
|
*
|
6171
|
* ```
|
6172
|
* Count: {{items.length}}
|
6173
|
* <ul>
|
6174
|
* <li *ngFor="let item of items">{{item}}</li>
|
6175
|
* </ul>
|
6176
|
* ```
|
6177
|
*
|
6178
|
* We have two {\@link TemplateRef}s:
|
6179
|
*
|
6180
|
* Outer {\@link TemplateRef}:
|
6181
|
* ```
|
6182
|
* Count: {{items.length}}
|
6183
|
* <ul>
|
6184
|
* <ng-template ngFor let-item [ngForOf]="items"></ng-template>
|
6185
|
* </ul>
|
6186
|
* ```
|
6187
|
*
|
6188
|
* Inner {\@link TemplateRef}:
|
6189
|
* ```
|
6190
|
* <li>{{item}}</li>
|
6191
|
* ```
|
6192
|
*
|
6193
|
* Notice that the original template is broken down into two separate {\@link TemplateRef}s.
|
6194
|
*
|
6195
|
* The outer/inner {\@link TemplateRef}s are then assembled into views like so:
|
6196
|
*
|
6197
|
* ```
|
6198
|
* <!-- ViewRef: outer-0 -->
|
6199
|
* Count: 2
|
6200
|
* <ul>
|
6201
|
* <ng-template view-container-ref></ng-template>
|
6202
|
* <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
|
6203
|
* <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
|
6204
|
* </ul>
|
6205
|
* <!-- /ViewRef: outer-0 -->
|
6206
|
* ```
|
6207
|
* \@experimental
|
6208
|
* @abstract
|
6209
|
*/
|
6210
|
var EmbeddedViewRef = (function (_super) {
|
6211
|
__extends(EmbeddedViewRef, _super);
|
6212
|
function EmbeddedViewRef() {
|
6213
|
return _super !== null && _super.apply(this, arguments) || this;
|
6214
|
}
|
6215
|
/**
|
6216
|
* @abstract
|
6217
|
* @return {?}
|
6218
|
*/
|
6219
|
EmbeddedViewRef.prototype.context = function () { };
|
6220
|
/**
|
6221
|
* @abstract
|
6222
|
* @return {?}
|
6223
|
*/
|
6224
|
EmbeddedViewRef.prototype.rootNodes = function () { };
|
6225
|
return EmbeddedViewRef;
|
6226
|
}(ViewRef));
|
6227
|
/**
|
6228
|
* @license
|
6229
|
* Copyright Google Inc. All Rights Reserved.
|
6230
|
*
|
6231
|
* Use of this source code is governed by an MIT-style license that can be
|
6232
|
* found in the LICENSE file at https://angular.io/license
|
6233
|
*/
|
6234
|
// Public API for compiler
|
6235
|
/**
|
6236
|
* @license
|
6237
|
* Copyright Google Inc. All Rights Reserved.
|
6238
|
*
|
6239
|
* Use of this source code is governed by an MIT-style license that can be
|
6240
|
* found in the LICENSE file at https://angular.io/license
|
6241
|
*/
|
6242
|
var EventListener = (function () {
|
6243
|
/**
|
6244
|
* @param {?} name
|
6245
|
* @param {?} callback
|
6246
|
*/
|
6247
|
function EventListener(name, callback) {
|
6248
|
this.name = name;
|
6249
|
this.callback = callback;
|
6250
|
}
|
6251
|
return EventListener;
|
6252
|
}());
|
6253
|
/**
|
6254
|
* \@experimental All debugging apis are currently experimental.
|
6255
|
*/
|
6256
|
var DebugNode = (function () {
|
6257
|
/**
|
6258
|
* @param {?} nativeNode
|
6259
|
* @param {?} parent
|
6260
|
* @param {?} _debugContext
|
6261
|
*/
|
6262
|
function DebugNode(nativeNode, parent, _debugContext) {
|
6263
|
this._debugContext = _debugContext;
|
6264
|
this.nativeNode = nativeNode;
|
6265
|
if (parent && parent instanceof DebugElement) {
|
6266
|
parent.addChild(this);
|
6267
|
}
|
6268
|
else {
|
6269
|
this.parent = null;
|
6270
|
}
|
6271
|
this.listeners = [];
|
6272
|
}
|
6273
|
Object.defineProperty(DebugNode.prototype, "injector", {
|
6274
|
/**
|
6275
|
* @return {?}
|
6276
|
*/
|
6277
|
get: function () { return this._debugContext.injector; },
|
6278
|
enumerable: true,
|
6279
|
configurable: true
|
6280
|
});
|
6281
|
Object.defineProperty(DebugNode.prototype, "componentInstance", {
|
6282
|
/**
|
6283
|
* @return {?}
|
6284
|
*/
|
6285
|
get: function () { return this._debugContext.component; },
|
6286
|
enumerable: true,
|
6287
|
configurable: true
|
6288
|
});
|
6289
|
Object.defineProperty(DebugNode.prototype, "context", {
|
6290
|
/**
|
6291
|
* @return {?}
|
6292
|
*/
|
6293
|
get: function () { return this._debugContext.context; },
|
6294
|
enumerable: true,
|
6295
|
configurable: true
|
6296
|
});
|
6297
|
Object.defineProperty(DebugNode.prototype, "references", {
|
6298
|
/**
|
6299
|
* @return {?}
|
6300
|
*/
|
6301
|
get: function () { return this._debugContext.references; },
|
6302
|
enumerable: true,
|
6303
|
configurable: true
|
6304
|
});
|
6305
|
Object.defineProperty(DebugNode.prototype, "providerTokens", {
|
6306
|
/**
|
6307
|
* @return {?}
|
6308
|
*/
|
6309
|
get: function () { return this._debugContext.providerTokens; },
|
6310
|
enumerable: true,
|
6311
|
configurable: true
|
6312
|
});
|
6313
|
Object.defineProperty(DebugNode.prototype, "source", {
|
6314
|
/**
|
6315
|
* @deprecated since v4
|
6316
|
* @return {?}
|
6317
|
*/
|
6318
|
get: function () { return 'Deprecated since v4'; },
|
6319
|
enumerable: true,
|
6320
|
configurable: true
|
6321
|
});
|
6322
|
return DebugNode;
|
6323
|
}());
|
6324
|
/**
|
6325
|
* \@experimental All debugging apis are currently experimental.
|
6326
|
*/
|
6327
|
var DebugElement = (function (_super) {
|
6328
|
__extends(DebugElement, _super);
|
6329
|
/**
|
6330
|
* @param {?} nativeNode
|
6331
|
* @param {?} parent
|
6332
|
* @param {?} _debugContext
|
6333
|
*/
|
6334
|
function DebugElement(nativeNode, parent, _debugContext) {
|
6335
|
var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
|
6336
|
_this.properties = {};
|
6337
|
_this.attributes = {};
|
6338
|
_this.classes = {};
|
6339
|
_this.styles = {};
|
6340
|
_this.childNodes = [];
|
6341
|
_this.nativeElement = nativeNode;
|
6342
|
return _this;
|
6343
|
}
|
6344
|
/**
|
6345
|
* @param {?} child
|
6346
|
* @return {?}
|
6347
|
*/
|
6348
|
DebugElement.prototype.addChild = function (child) {
|
6349
|
if (child) {
|
6350
|
this.childNodes.push(child);
|
6351
|
child.parent = this;
|
6352
|
}
|
6353
|
};
|
6354
|
/**
|
6355
|
* @param {?} child
|
6356
|
* @return {?}
|
6357
|
*/
|
6358
|
DebugElement.prototype.removeChild = function (child) {
|
6359
|
var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
|
6360
|
if (childIndex !== -1) {
|
6361
|
child.parent = null;
|
6362
|
this.childNodes.splice(childIndex, 1);
|
6363
|
}
|
6364
|
};
|
6365
|
/**
|
6366
|
* @param {?} child
|
6367
|
* @param {?} newChildren
|
6368
|
* @return {?}
|
6369
|
*/
|
6370
|
DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
|
6371
|
var _this = this;
|
6372
|
var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
|
6373
|
if (siblingIndex !== -1) {
|
6374
|
(_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
|
6375
|
newChildren.forEach(function (c) {
|
6376
|
if (c.parent) {
|
6377
|
c.parent.removeChild(c);
|
6378
|
}
|
6379
|
c.parent = _this;
|
6380
|
});
|
6381
|
}
|
6382
|
var _a;
|
6383
|
};
|
6384
|
/**
|
6385
|
* @param {?} refChild
|
6386
|
* @param {?} newChild
|
6387
|
* @return {?}
|
6388
|
*/
|
6389
|
DebugElement.prototype.insertBefore = function (refChild, newChild) {
|
6390
|
var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild);
|
6391
|
if (refIndex === -1) {
|
6392
|
this.addChild(newChild);
|
6393
|
}
|
6394
|
else {
|
6395
|
if (newChild.parent) {
|
6396
|
newChild.parent.removeChild(newChild);
|
6397
|
}
|
6398
|
newChild.parent = this;
|
6399
|
this.childNodes.splice(refIndex, 0, newChild);
|
6400
|
}
|
6401
|
};
|
6402
|
/**
|
6403
|
* @param {?} predicate
|
6404
|
* @return {?}
|
6405
|
*/
|
6406
|
DebugElement.prototype.query = function (predicate) {
|
6407
|
var /** @type {?} */ results = this.queryAll(predicate);
|
6408
|
return results[0] || null;
|
6409
|
};
|
6410
|
/**
|
6411
|
* @param {?} predicate
|
6412
|
* @return {?}
|
6413
|
*/
|
6414
|
DebugElement.prototype.queryAll = function (predicate) {
|
6415
|
var /** @type {?} */ matches = [];
|
6416
|
_queryElementChildren(this, predicate, matches);
|
6417
|
return matches;
|
6418
|
};
|
6419
|
/**
|
6420
|
* @param {?} predicate
|
6421
|
* @return {?}
|
6422
|
*/
|
6423
|
DebugElement.prototype.queryAllNodes = function (predicate) {
|
6424
|
var /** @type {?} */ matches = [];
|
6425
|
_queryNodeChildren(this, predicate, matches);
|
6426
|
return matches;
|
6427
|
};
|
6428
|
Object.defineProperty(DebugElement.prototype, "children", {
|
6429
|
/**
|
6430
|
* @return {?}
|
6431
|
*/
|
6432
|
get: function () {
|
6433
|
return (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
|
6434
|
},
|
6435
|
enumerable: true,
|
6436
|
configurable: true
|
6437
|
});
|
6438
|
/**
|
6439
|
* @param {?} eventName
|
6440
|
* @param {?} eventObj
|
6441
|
* @return {?}
|
6442
|
*/
|
6443
|
DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
|
6444
|
this.listeners.forEach(function (listener) {
|
6445
|
if (listener.name == eventName) {
|
6446
|
listener.callback(eventObj);
|
6447
|
}
|
6448
|
});
|
6449
|
};
|
6450
|
return DebugElement;
|
6451
|
}(DebugNode));
|
6452
|
/**
|
6453
|
* \@experimental
|
6454
|
* @param {?} debugEls
|
6455
|
* @return {?}
|
6456
|
*/
|
6457
|
function asNativeElements(debugEls) {
|
6458
|
return debugEls.map(function (el) { return el.nativeElement; });
|
6459
|
}
|
6460
|
/**
|
6461
|
* @param {?} element
|
6462
|
* @param {?} predicate
|
6463
|
* @param {?} matches
|
6464
|
* @return {?}
|
6465
|
*/
|
6466
|
function _queryElementChildren(element, predicate, matches) {
|
6467
|
element.childNodes.forEach(function (node) {
|
6468
|
if (node instanceof DebugElement) {
|
6469
|
if (predicate(node)) {
|
6470
|
matches.push(node);
|
6471
|
}
|
6472
|
_queryElementChildren(node, predicate, matches);
|
6473
|
}
|
6474
|
});
|
6475
|
}
|
6476
|
/**
|
6477
|
* @param {?} parentNode
|
6478
|
* @param {?} predicate
|
6479
|
* @param {?} matches
|
6480
|
* @return {?}
|
6481
|
*/
|
6482
|
function _queryNodeChildren(parentNode, predicate, matches) {
|
6483
|
if (parentNode instanceof DebugElement) {
|
6484
|
parentNode.childNodes.forEach(function (node) {
|
6485
|
if (predicate(node)) {
|
6486
|
matches.push(node);
|
6487
|
}
|
6488
|
if (node instanceof DebugElement) {
|
6489
|
_queryNodeChildren(node, predicate, matches);
|
6490
|
}
|
6491
|
});
|
6492
|
}
|
6493
|
}
|
6494
|
// Need to keep the nodes in a global Map so that multiple angular apps are supported.
|
6495
|
var _nativeNodeToDebugNode = new Map();
|
6496
|
/**
|
6497
|
* \@experimental
|
6498
|
* @param {?} nativeNode
|
6499
|
* @return {?}
|
6500
|
*/
|
6501
|
function getDebugNode(nativeNode) {
|
6502
|
return _nativeNodeToDebugNode.get(nativeNode) || null;
|
6503
|
}
|
6504
|
/**
|
6505
|
* @return {?}
|
6506
|
*/
|
6507
|
/**
|
6508
|
* @param {?} node
|
6509
|
* @return {?}
|
6510
|
*/
|
6511
|
function indexDebugNode(node) {
|
6512
|
_nativeNodeToDebugNode.set(node.nativeNode, node);
|
6513
|
}
|
6514
|
/**
|
6515
|
* @param {?} node
|
6516
|
* @return {?}
|
6517
|
*/
|
6518
|
function removeDebugNodeFromIndex(node) {
|
6519
|
_nativeNodeToDebugNode.delete(node.nativeNode);
|
6520
|
}
|
6521
|
/**
|
6522
|
* @license
|
6523
|
* Copyright Google Inc. All Rights Reserved.
|
6524
|
*
|
6525
|
* Use of this source code is governed by an MIT-style license that can be
|
6526
|
* found in the LICENSE file at https://angular.io/license
|
6527
|
*/
|
6528
|
/**
|
6529
|
* @param {?} a
|
6530
|
* @param {?} b
|
6531
|
* @return {?}
|
6532
|
*/
|
6533
|
function devModeEqual(a, b) {
|
6534
|
var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a);
|
6535
|
var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b);
|
6536
|
if (isListLikeIterableA && isListLikeIterableB) {
|
6537
|
return areIterablesEqual(a, b, devModeEqual);
|
6538
|
}
|
6539
|
else {
|
6540
|
var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
6541
|
var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
6542
|
if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
6543
|
return true;
|
6544
|
}
|
6545
|
else {
|
6546
|
return looseIdentical(a, b);
|
6547
|
}
|
6548
|
}
|
6549
|
}
|
6550
|
/**
|
6551
|
* Indicates that the result of a {\@link Pipe} transformation has changed even though the
|
6552
|
* reference
|
6553
|
* has not changed.
|
6554
|
*
|
6555
|
* The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored.
|
6556
|
*
|
6557
|
* Example:
|
6558
|
*
|
6559
|
* ```
|
6560
|
* if (this._latestValue === this._latestReturnedValue) {
|
6561
|
* return this._latestReturnedValue;
|
6562
|
* } else {
|
6563
|
* this._latestReturnedValue = this._latestValue;
|
6564
|
* return WrappedValue.wrap(this._latestValue); // this will force update
|
6565
|
* }
|
6566
|
* ```
|
6567
|
* \@stable
|
6568
|
*/
|
6569
|
var WrappedValue = (function () {
|
6570
|
/**
|
6571
|
* @param {?} wrapped
|
6572
|
*/
|
6573
|
function WrappedValue(wrapped) {
|
6574
|
this.wrapped = wrapped;
|
6575
|
}
|
6576
|
/**
|
6577
|
* @param {?} value
|
6578
|
* @return {?}
|
6579
|
*/
|
6580
|
WrappedValue.wrap = function (value) { return new WrappedValue(value); };
|
6581
|
return WrappedValue;
|
6582
|
}());
|
6583
|
/**
|
6584
|
* Helper class for unwrapping WrappedValue s
|
6585
|
*/
|
6586
|
var ValueUnwrapper = (function () {
|
6587
|
function ValueUnwrapper() {
|
6588
|
this.hasWrappedValue = false;
|
6589
|
}
|
6590
|
/**
|
6591
|
* @param {?} value
|
6592
|
* @return {?}
|
6593
|
*/
|
6594
|
ValueUnwrapper.prototype.unwrap = function (value) {
|
6595
|
if (value instanceof WrappedValue) {
|
6596
|
this.hasWrappedValue = true;
|
6597
|
return value.wrapped;
|
6598
|
}
|
6599
|
return value;
|
6600
|
};
|
6601
|
/**
|
6602
|
* @return {?}
|
6603
|
*/
|
6604
|
ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; };
|
6605
|
return ValueUnwrapper;
|
6606
|
}());
|
6607
|
/**
|
6608
|
* Represents a basic change from a previous to a new value.
|
6609
|
* \@stable
|
6610
|
*/
|
6611
|
var SimpleChange = (function () {
|
6612
|
/**
|
6613
|
* @param {?} previousValue
|
6614
|
* @param {?} currentValue
|
6615
|
* @param {?} firstChange
|
6616
|
*/
|
6617
|
function SimpleChange(previousValue, currentValue, firstChange) {
|
6618
|
this.previousValue = previousValue;
|
6619
|
this.currentValue = currentValue;
|
6620
|
this.firstChange = firstChange;
|
6621
|
}
|
6622
|
/**
|
6623
|
* Check whether the new value is the first value assigned.
|
6624
|
* @return {?}
|
6625
|
*/
|
6626
|
SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
|
6627
|
return SimpleChange;
|
6628
|
}());
|
6629
|
/**
|
6630
|
* @param {?} obj
|
6631
|
* @return {?}
|
6632
|
*/
|
6633
|
function isListLikeIterable(obj) {
|
6634
|
if (!isJsObject(obj))
|
6635
|
return false;
|
6636
|
return Array.isArray(obj) ||
|
6637
|
(!(obj instanceof Map) &&
|
6638
|
getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
|
6639
|
}
|
6640
|
/**
|
6641
|
* @param {?} a
|
6642
|
* @param {?} b
|
6643
|
* @param {?} comparator
|
6644
|
* @return {?}
|
6645
|
*/
|
6646
|
function areIterablesEqual(a, b, comparator) {
|
6647
|
var /** @type {?} */ iterator1 = a[getSymbolIterator()]();
|
6648
|
var /** @type {?} */ iterator2 = b[getSymbolIterator()]();
|
6649
|
while (true) {
|
6650
|
var /** @type {?} */ item1 = iterator1.next();
|
6651
|
var /** @type {?} */ item2 = iterator2.next();
|
6652
|
if (item1.done && item2.done)
|
6653
|
return true;
|
6654
|
if (item1.done || item2.done)
|
6655
|
return false;
|
6656
|
if (!comparator(item1.value, item2.value))
|
6657
|
return false;
|
6658
|
}
|
6659
|
}
|
6660
|
/**
|
6661
|
* @param {?} obj
|
6662
|
* @param {?} fn
|
6663
|
* @return {?}
|
6664
|
*/
|
6665
|
function iterateListLike(obj, fn) {
|
6666
|
if (Array.isArray(obj)) {
|
6667
|
for (var /** @type {?} */ i = 0; i < obj.length; i++) {
|
6668
|
fn(obj[i]);
|
6669
|
}
|
6670
|
}
|
6671
|
else {
|
6672
|
var /** @type {?} */ iterator = obj[getSymbolIterator()]();
|
6673
|
var /** @type {?} */ item = void 0;
|
6674
|
while (!((item = iterator.next()).done)) {
|
6675
|
fn(item.value);
|
6676
|
}
|
6677
|
}
|
6678
|
}
|
6679
|
/**
|
6680
|
* @param {?} o
|
6681
|
* @return {?}
|
6682
|
*/
|
6683
|
function isJsObject(o) {
|
6684
|
return o !== null && (typeof o === 'function' || typeof o === 'object');
|
6685
|
}
|
6686
|
/**
|
6687
|
* @license
|
6688
|
* Copyright Google Inc. All Rights Reserved.
|
6689
|
*
|
6690
|
* Use of this source code is governed by an MIT-style license that can be
|
6691
|
* found in the LICENSE file at https://angular.io/license
|
6692
|
*/
|
6693
|
var DefaultIterableDifferFactory = (function () {
|
6694
|
function DefaultIterableDifferFactory() {
|
6695
|
}
|
6696
|
/**
|
6697
|
* @param {?} obj
|
6698
|
* @return {?}
|
6699
|
*/
|
6700
|
DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); };
|
6701
|
/**
|
6702
|
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
|
6703
|
* @template V
|
6704
|
* @param {?=} cdRefOrTrackBy
|
6705
|
* @param {?=} trackByFn
|
6706
|
* @return {?}
|
6707
|
*/
|
6708
|
DefaultIterableDifferFactory.prototype.create = function (cdRefOrTrackBy, trackByFn) {
|
6709
|
return new DefaultIterableDiffer(trackByFn || (cdRefOrTrackBy));
|
6710
|
};
|
6711
|
return DefaultIterableDifferFactory;
|
6712
|
}());
|
6713
|
var trackByIdentity = function (index, item) { return item; };
|
6714
|
/**
|
6715
|
* @deprecated v4.0.0 - Should not be part of public API.
|
6716
|
*/
|
6717
|
var DefaultIterableDiffer = (function () {
|
6718
|
/**
|
6719
|
* @param {?=} trackByFn
|
6720
|
*/
|
6721
|
function DefaultIterableDiffer(trackByFn) {
|
6722
|
this._length = 0;
|
6723
|
this._collection = null;
|
6724
|
this._linkedRecords = null;
|
6725
|
this._unlinkedRecords = null;
|
6726
|
this._previousItHead = null;
|
6727
|
this._itHead = null;
|
6728
|
this._itTail = null;
|
6729
|
this._additionsHead = null;
|
6730
|
this._additionsTail = null;
|
6731
|
this._movesHead = null;
|
6732
|
this._movesTail = null;
|
6733
|
this._removalsHead = null;
|
6734
|
this._removalsTail = null;
|
6735
|
this._identityChangesHead = null;
|
6736
|
this._identityChangesTail = null;
|
6737
|
this._trackByFn = trackByFn || trackByIdentity;
|
6738
|
}
|
6739
|
Object.defineProperty(DefaultIterableDiffer.prototype, "collection", {
|
6740
|
/**
|
6741
|
* @return {?}
|
6742
|
*/
|
6743
|
get: function () { return this._collection; },
|
6744
|
enumerable: true,
|
6745
|
configurable: true
|
6746
|
});
|
6747
|
Object.defineProperty(DefaultIterableDiffer.prototype, "length", {
|
6748
|
/**
|
6749
|
* @return {?}
|
6750
|
*/
|
6751
|
get: function () { return this._length; },
|
6752
|
enumerable: true,
|
6753
|
configurable: true
|
6754
|
});
|
6755
|
/**
|
6756
|
* @param {?} fn
|
6757
|
* @return {?}
|
6758
|
*/
|
6759
|
DefaultIterableDiffer.prototype.forEachItem = function (fn) {
|
6760
|
var /** @type {?} */ record;
|
6761
|
for (record = this._itHead; record !== null; record = record._next) {
|
6762
|
fn(record);
|
6763
|
}
|
6764
|
};
|
6765
|
/**
|
6766
|
* @param {?} fn
|
6767
|
* @return {?}
|
6768
|
*/
|
6769
|
DefaultIterableDiffer.prototype.forEachOperation = function (fn) {
|
6770
|
var /** @type {?} */ nextIt = this._itHead;
|
6771
|
var /** @type {?} */ nextRemove = this._removalsHead;
|
6772
|
var /** @type {?} */ addRemoveOffset = 0;
|
6773
|
var /** @type {?} */ moveOffsets = null;
|
6774
|
while (nextIt || nextRemove) {
|
6775
|
// Figure out which is the next record to process
|
6776
|
// Order: remove, add, move
|
6777
|
var /** @type {?} */ record = !nextRemove ||
|
6778
|
nextIt && ((nextIt.currentIndex)) <
|
6779
|
getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? ((nextIt)) :
|
6780
|
nextRemove;
|
6781
|
var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
|
6782
|
var /** @type {?} */ currentIndex = record.currentIndex;
|
6783
|
// consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
|
6784
|
if (record === nextRemove) {
|
6785
|
addRemoveOffset--;
|
6786
|
nextRemove = nextRemove._nextRemoved;
|
6787
|
}
|
6788
|
else {
|
6789
|
nextIt = ((nextIt))._next;
|
6790
|
if (record.previousIndex == null) {
|
6791
|
addRemoveOffset++;
|
6792
|
}
|
6793
|
else {
|
6794
|
// INVARIANT: currentIndex < previousIndex
|
6795
|
if (!moveOffsets)
|
6796
|
moveOffsets = [];
|
6797
|
var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
|
6798
|
var /** @type {?} */ localCurrentIndex = ((currentIndex)) - addRemoveOffset;
|
6799
|
if (localMovePreviousIndex != localCurrentIndex) {
|
6800
|
for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) {
|
6801
|
var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
|
6802
|
var /** @type {?} */ index = offset + i;
|
6803
|
if (localCurrentIndex <= index && index < localMovePreviousIndex) {
|
6804
|
moveOffsets[i] = offset + 1;
|
6805
|
}
|
6806
|
}
|
6807
|
var /** @type {?} */ previousIndex = record.previousIndex;
|
6808
|
moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
|
6809
|
}
|
6810
|
}
|
6811
|
}
|
6812
|
if (adjPreviousIndex !== currentIndex) {
|
6813
|
fn(record, adjPreviousIndex, currentIndex);
|
6814
|
}
|
6815
|
}
|
6816
|
};
|
6817
|
/**
|
6818
|
* @param {?} fn
|
6819
|
* @return {?}
|
6820
|
*/
|
6821
|
DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) {
|
6822
|
var /** @type {?} */ record;
|
6823
|
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
6824
|
fn(record);
|
6825
|
}
|
6826
|
};
|
6827
|
/**
|
6828
|
* @param {?} fn
|
6829
|
* @return {?}
|
6830
|
*/
|
6831
|
DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) {
|
6832
|
var /** @type {?} */ record;
|
6833
|
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
6834
|
fn(record);
|
6835
|
}
|
6836
|
};
|
6837
|
/**
|
6838
|
* @param {?} fn
|
6839
|
* @return {?}
|
6840
|
*/
|
6841
|
DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) {
|
6842
|
var /** @type {?} */ record;
|
6843
|
for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
6844
|
fn(record);
|
6845
|
}
|
6846
|
};
|
6847
|
/**
|
6848
|
* @param {?} fn
|
6849
|
* @return {?}
|
6850
|
*/
|
6851
|
DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) {
|
6852
|
var /** @type {?} */ record;
|
6853
|
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
6854
|
fn(record);
|
6855
|
}
|
6856
|
};
|
6857
|
/**
|
6858
|
* @param {?} fn
|
6859
|
* @return {?}
|
6860
|
*/
|
6861
|
DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) {
|
6862
|
var /** @type {?} */ record;
|
6863
|
for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
|
6864
|
fn(record);
|
6865
|
}
|
6866
|
};
|
6867
|
/**
|
6868
|
* @param {?} collection
|
6869
|
* @return {?}
|
6870
|
*/
|
6871
|
DefaultIterableDiffer.prototype.diff = function (collection) {
|
6872
|
if (collection == null)
|
6873
|
collection = [];
|
6874
|
if (!isListLikeIterable(collection)) {
|
6875
|
throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
|
6876
|
}
|
6877
|
if (this.check(collection)) {
|
6878
|
return this;
|
6879
|
}
|
6880
|
else {
|
6881
|
return null;
|
6882
|
}
|
6883
|
};
|
6884
|
/**
|
6885
|
* @return {?}
|
6886
|
*/
|
6887
|
DefaultIterableDiffer.prototype.onDestroy = function () { };
|
6888
|
/**
|
6889
|
* @param {?} collection
|
6890
|
* @return {?}
|
6891
|
*/
|
6892
|
DefaultIterableDiffer.prototype.check = function (collection) {
|
6893
|
var _this = this;
|
6894
|
this._reset();
|
6895
|
var /** @type {?} */ record = this._itHead;
|
6896
|
var /** @type {?} */ mayBeDirty = false;
|
6897
|
var /** @type {?} */ index;
|
6898
|
var /** @type {?} */ item;
|
6899
|
var /** @type {?} */ itemTrackBy;
|
6900
|
if (Array.isArray(collection)) {
|
6901
|
this._length = collection.length;
|
6902
|
for (var /** @type {?} */ index_1 = 0; index_1 < this._length; index_1++) {
|
6903
|
item = collection[index_1];
|
6904
|
itemTrackBy = this._trackByFn(index_1, item);
|
6905
|
if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
|
6906
|
record = this._mismatch(record, item, itemTrackBy, index_1);
|
6907
|
mayBeDirty = true;
|
6908
|
}
|
6909
|
else {
|
6910
|
if (mayBeDirty) {
|
6911
|
// TODO(misko): can we limit this to duplicates only?
|
6912
|
record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
|
6913
|
}
|
6914
|
if (!looseIdentical(record.item, item))
|
6915
|
this._addIdentityChange(record, item);
|
6916
|
}
|
6917
|
record = record._next;
|
6918
|
}
|
6919
|
}
|
6920
|
else {
|
6921
|
index = 0;
|
6922
|
iterateListLike(collection, function (item) {
|
6923
|
itemTrackBy = _this._trackByFn(index, item);
|
6924
|
if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
|
6925
|
record = _this._mismatch(record, item, itemTrackBy, index);
|
6926
|
mayBeDirty = true;
|
6927
|
}
|
6928
|
else {
|
6929
|
if (mayBeDirty) {
|
6930
|
// TODO(misko): can we limit this to duplicates only?
|
6931
|
record = _this._verifyReinsertion(record, item, itemTrackBy, index);
|
6932
|
}
|
6933
|
if (!looseIdentical(record.item, item))
|
6934
|
_this._addIdentityChange(record, item);
|
6935
|
}
|
6936
|
record = record._next;
|
6937
|
index++;
|
6938
|
});
|
6939
|
this._length = index;
|
6940
|
}
|
6941
|
this._truncate(record);
|
6942
|
this._collection = collection;
|
6943
|
return this.isDirty;
|
6944
|
};
|
6945
|
Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
|
6946
|
/**
|
6947
|
* @return {?}
|
6948
|
*/
|
6949
|
get: function () {
|
6950
|
return this._additionsHead !== null || this._movesHead !== null ||
|
6951
|
this._removalsHead !== null || this._identityChangesHead !== null;
|
6952
|
},
|
6953
|
enumerable: true,
|
6954
|
configurable: true
|
6955
|
});
|
6956
|
/**
|
6957
|
* Reset the state of the change objects to show no changes. This means set previousKey to
|
6958
|
* currentKey, and clear all of the queues (additions, moves, removals).
|
6959
|
* Set the previousIndexes of moved and added items to their currentIndexes
|
6960
|
* Reset the list of additions, moves and removals
|
6961
|
*
|
6962
|
* \@internal
|
6963
|
* @return {?}
|
6964
|
*/
|
6965
|
DefaultIterableDiffer.prototype._reset = function () {
|
6966
|
if (this.isDirty) {
|
6967
|
var /** @type {?} */ record = void 0;
|
6968
|
var /** @type {?} */ nextRecord = void 0;
|
6969
|
for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
|
6970
|
record._nextPrevious = record._next;
|
6971
|
}
|
6972
|
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
6973
|
record.previousIndex = record.currentIndex;
|
6974
|
}
|
6975
|
this._additionsHead = this._additionsTail = null;
|
6976
|
for (record = this._movesHead; record !== null; record = nextRecord) {
|
6977
|
record.previousIndex = record.currentIndex;
|
6978
|
nextRecord = record._nextMoved;
|
6979
|
}
|
6980
|
this._movesHead = this._movesTail = null;
|
6981
|
this._removalsHead = this._removalsTail = null;
|
6982
|
this._identityChangesHead = this._identityChangesTail = null;
|
6983
|
// todo(vicb) when assert gets supported
|
6984
|
// assert(!this.isDirty);
|
6985
|
}
|
6986
|
};
|
6987
|
/**
|
6988
|
* This is the core function which handles differences between collections.
|
6989
|
*
|
6990
|
* - `record` is the record which we saw at this position last time. If null then it is a new
|
6991
|
* item.
|
6992
|
* - `item` is the current item in the collection
|
6993
|
* - `index` is the position of the item in the collection
|
6994
|
*
|
6995
|
* \@internal
|
6996
|
* @param {?} record
|
6997
|
* @param {?} item
|
6998
|
* @param {?} itemTrackBy
|
6999
|
* @param {?} index
|
7000
|
* @return {?}
|
7001
|
*/
|
7002
|
DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) {
|
7003
|
// The previous record after which we will append the current one.
|
7004
|
var /** @type {?} */ previousRecord;
|
7005
|
if (record === null) {
|
7006
|
previousRecord = this._itTail;
|
7007
|
}
|
7008
|
else {
|
7009
|
previousRecord = record._prev;
|
7010
|
// Remove the record from the collection since we know it does not match the item.
|
7011
|
this._remove(record);
|
7012
|
}
|
7013
|
// Attempt to see if we have seen the item before.
|
7014
|
record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
|
7015
|
if (record !== null) {
|
7016
|
// We have seen this before, we need to move it forward in the collection.
|
7017
|
// But first we need to check if identity changed, so we can update in view if necessary
|
7018
|
if (!looseIdentical(record.item, item))
|
7019
|
this._addIdentityChange(record, item);
|
7020
|
this._moveAfter(record, previousRecord, index);
|
7021
|
}
|
7022
|
else {
|
7023
|
// Never seen it, check evicted list.
|
7024
|
record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
7025
|
if (record !== null) {
|
7026
|
// It is an item which we have evicted earlier: reinsert it back into the list.
|
7027
|
// But first we need to check if identity changed, so we can update in view if necessary
|
7028
|
if (!looseIdentical(record.item, item))
|
7029
|
this._addIdentityChange(record, item);
|
7030
|
this._reinsertAfter(record, previousRecord, index);
|
7031
|
}
|
7032
|
else {
|
7033
|
// It is a new item: add it.
|
7034
|
record =
|
7035
|
this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
|
7036
|
}
|
7037
|
}
|
7038
|
return record;
|
7039
|
};
|
7040
|
/**
|
7041
|
* This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
|
7042
|
*
|
7043
|
* Use case: `[a, a]` => `[b, a, a]`
|
7044
|
*
|
7045
|
* If we did not have this check then the insertion of `b` would:
|
7046
|
* 1) evict first `a`
|
7047
|
* 2) insert `b` at `0` index.
|
7048
|
* 3) leave `a` at index `1` as is. <-- this is wrong!
|
7049
|
* 3) reinsert `a` at index 2. <-- this is wrong!
|
7050
|
*
|
7051
|
* The correct behavior is:
|
7052
|
* 1) evict first `a`
|
7053
|
* 2) insert `b` at `0` index.
|
7054
|
* 3) reinsert `a` at index 1.
|
7055
|
* 3) move `a` at from `1` to `2`.
|
7056
|
*
|
7057
|
*
|
7058
|
* Double check that we have not evicted a duplicate item. We need to check if the item type may
|
7059
|
* have already been removed:
|
7060
|
* The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
|
7061
|
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
|
7062
|
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
|
7063
|
* at the end.
|
7064
|
*
|
7065
|
* \@internal
|
7066
|
* @param {?} record
|
7067
|
* @param {?} item
|
7068
|
* @param {?} itemTrackBy
|
7069
|
* @param {?} index
|
7070
|
* @return {?}
|
7071
|
*/
|
7072
|
DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) {
|
7073
|
var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
7074
|
if (reinsertRecord !== null) {
|
7075
|
record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index);
|
7076
|
}
|
7077
|
else if (record.currentIndex != index) {
|
7078
|
record.currentIndex = index;
|
7079
|
this._addToMoves(record, index);
|
7080
|
}
|
7081
|
return record;
|
7082
|
};
|
7083
|
/**
|
7084
|
* Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
|
7085
|
*
|
7086
|
* - `record` The first excess {\@link IterableChangeRecord_}.
|
7087
|
*
|
7088
|
* \@internal
|
7089
|
* @param {?} record
|
7090
|
* @return {?}
|
7091
|
*/
|
7092
|
DefaultIterableDiffer.prototype._truncate = function (record) {
|
7093
|
// Anything after that needs to be removed;
|
7094
|
while (record !== null) {
|
7095
|
var /** @type {?} */ nextRecord = record._next;
|
7096
|
this._addToRemovals(this._unlink(record));
|
7097
|
record = nextRecord;
|
7098
|
}
|
7099
|
if (this._unlinkedRecords !== null) {
|
7100
|
this._unlinkedRecords.clear();
|
7101
|
}
|
7102
|
if (this._additionsTail !== null) {
|
7103
|
this._additionsTail._nextAdded = null;
|
7104
|
}
|
7105
|
if (this._movesTail !== null) {
|
7106
|
this._movesTail._nextMoved = null;
|
7107
|
}
|
7108
|
if (this._itTail !== null) {
|
7109
|
this._itTail._next = null;
|
7110
|
}
|
7111
|
if (this._removalsTail !== null) {
|
7112
|
this._removalsTail._nextRemoved = null;
|
7113
|
}
|
7114
|
if (this._identityChangesTail !== null) {
|
7115
|
this._identityChangesTail._nextIdentityChange = null;
|
7116
|
}
|
7117
|
};
|
7118
|
/**
|
7119
|
* \@internal
|
7120
|
* @param {?} record
|
7121
|
* @param {?} prevRecord
|
7122
|
* @param {?} index
|
7123
|
* @return {?}
|
7124
|
*/
|
7125
|
DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) {
|
7126
|
if (this._unlinkedRecords !== null) {
|
7127
|
this._unlinkedRecords.remove(record);
|
7128
|
}
|
7129
|
var /** @type {?} */ prev = record._prevRemoved;
|
7130
|
var /** @type {?} */ next = record._nextRemoved;
|
7131
|
if (prev === null) {
|
7132
|
this._removalsHead = next;
|
7133
|
}
|
7134
|
else {
|
7135
|
prev._nextRemoved = next;
|
7136
|
}
|
7137
|
if (next === null) {
|
7138
|
this._removalsTail = prev;
|
7139
|
}
|
7140
|
else {
|
7141
|
next._prevRemoved = prev;
|
7142
|
}
|
7143
|
this._insertAfter(record, prevRecord, index);
|
7144
|
this._addToMoves(record, index);
|
7145
|
return record;
|
7146
|
};
|
7147
|
/**
|
7148
|
* \@internal
|
7149
|
* @param {?} record
|
7150
|
* @param {?} prevRecord
|
7151
|
* @param {?} index
|
7152
|
* @return {?}
|
7153
|
*/
|
7154
|
DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) {
|
7155
|
this._unlink(record);
|
7156
|
this._insertAfter(record, prevRecord, index);
|
7157
|
this._addToMoves(record, index);
|
7158
|
return record;
|
7159
|
};
|
7160
|
/**
|
7161
|
* \@internal
|
7162
|
* @param {?} record
|
7163
|
* @param {?} prevRecord
|
7164
|
* @param {?} index
|
7165
|
* @return {?}
|
7166
|
*/
|
7167
|
DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) {
|
7168
|
this._insertAfter(record, prevRecord, index);
|
7169
|
if (this._additionsTail === null) {
|
7170
|
// todo(vicb)
|
7171
|
// assert(this._additionsHead === null);
|
7172
|
this._additionsTail = this._additionsHead = record;
|
7173
|
}
|
7174
|
else {
|
7175
|
// todo(vicb)
|
7176
|
// assert(_additionsTail._nextAdded === null);
|
7177
|
// assert(record._nextAdded === null);
|
7178
|
this._additionsTail = this._additionsTail._nextAdded = record;
|
7179
|
}
|
7180
|
return record;
|
7181
|
};
|
7182
|
/**
|
7183
|
* \@internal
|
7184
|
* @param {?} record
|
7185
|
* @param {?} prevRecord
|
7186
|
* @param {?} index
|
7187
|
* @return {?}
|
7188
|
*/
|
7189
|
DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) {
|
7190
|
// todo(vicb)
|
7191
|
// assert(record != prevRecord);
|
7192
|
// assert(record._next === null);
|
7193
|
// assert(record._prev === null);
|
7194
|
var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next;
|
7195
|
// todo(vicb)
|
7196
|
// assert(next != record);
|
7197
|
// assert(prevRecord != record);
|
7198
|
record._next = next;
|
7199
|
record._prev = prevRecord;
|
7200
|
if (next === null) {
|
7201
|
this._itTail = record;
|
7202
|
}
|
7203
|
else {
|
7204
|
next._prev = record;
|
7205
|
}
|
7206
|
if (prevRecord === null) {
|
7207
|
this._itHead = record;
|
7208
|
}
|
7209
|
else {
|
7210
|
prevRecord._next = record;
|
7211
|
}
|
7212
|
if (this._linkedRecords === null) {
|
7213
|
this._linkedRecords = new _DuplicateMap();
|
7214
|
}
|
7215
|
this._linkedRecords.put(record);
|
7216
|
record.currentIndex = index;
|
7217
|
return record;
|
7218
|
};
|
7219
|
/**
|
7220
|
* \@internal
|
7221
|
* @param {?} record
|
7222
|
* @return {?}
|
7223
|
*/
|
7224
|
DefaultIterableDiffer.prototype._remove = function (record) {
|
7225
|
return this._addToRemovals(this._unlink(record));
|
7226
|
};
|
7227
|
/**
|
7228
|
* \@internal
|
7229
|
* @param {?} record
|
7230
|
* @return {?}
|
7231
|
*/
|
7232
|
DefaultIterableDiffer.prototype._unlink = function (record) {
|
7233
|
if (this._linkedRecords !== null) {
|
7234
|
this._linkedRecords.remove(record);
|
7235
|
}
|
7236
|
var /** @type {?} */ prev = record._prev;
|
7237
|
var /** @type {?} */ next = record._next;
|
7238
|
// todo(vicb)
|
7239
|
// assert((record._prev = null) === null);
|
7240
|
// assert((record._next = null) === null);
|
7241
|
if (prev === null) {
|
7242
|
this._itHead = next;
|
7243
|
}
|
7244
|
else {
|
7245
|
prev._next = next;
|
7246
|
}
|
7247
|
if (next === null) {
|
7248
|
this._itTail = prev;
|
7249
|
}
|
7250
|
else {
|
7251
|
next._prev = prev;
|
7252
|
}
|
7253
|
return record;
|
7254
|
};
|
7255
|
/**
|
7256
|
* \@internal
|
7257
|
* @param {?} record
|
7258
|
* @param {?} toIndex
|
7259
|
* @return {?}
|
7260
|
*/
|
7261
|
DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) {
|
7262
|
// todo(vicb)
|
7263
|
// assert(record._nextMoved === null);
|
7264
|
if (record.previousIndex === toIndex) {
|
7265
|
return record;
|
7266
|
}
|
7267
|
if (this._movesTail === null) {
|
7268
|
// todo(vicb)
|
7269
|
// assert(_movesHead === null);
|
7270
|
this._movesTail = this._movesHead = record;
|
7271
|
}
|
7272
|
else {
|
7273
|
// todo(vicb)
|
7274
|
// assert(_movesTail._nextMoved === null);
|
7275
|
this._movesTail = this._movesTail._nextMoved = record;
|
7276
|
}
|
7277
|
return record;
|
7278
|
};
|
7279
|
/**
|
7280
|
* @param {?} record
|
7281
|
* @return {?}
|
7282
|
*/
|
7283
|
DefaultIterableDiffer.prototype._addToRemovals = function (record) {
|
7284
|
if (this._unlinkedRecords === null) {
|
7285
|
this._unlinkedRecords = new _DuplicateMap();
|
7286
|
}
|
7287
|
this._unlinkedRecords.put(record);
|
7288
|
record.currentIndex = null;
|
7289
|
record._nextRemoved = null;
|
7290
|
if (this._removalsTail === null) {
|
7291
|
// todo(vicb)
|
7292
|
// assert(_removalsHead === null);
|
7293
|
this._removalsTail = this._removalsHead = record;
|
7294
|
record._prevRemoved = null;
|
7295
|
}
|
7296
|
else {
|
7297
|
// todo(vicb)
|
7298
|
// assert(_removalsTail._nextRemoved === null);
|
7299
|
// assert(record._nextRemoved === null);
|
7300
|
record._prevRemoved = this._removalsTail;
|
7301
|
this._removalsTail = this._removalsTail._nextRemoved = record;
|
7302
|
}
|
7303
|
return record;
|
7304
|
};
|
7305
|
/**
|
7306
|
* \@internal
|
7307
|
* @param {?} record
|
7308
|
* @param {?} item
|
7309
|
* @return {?}
|
7310
|
*/
|
7311
|
DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) {
|
7312
|
record.item = item;
|
7313
|
if (this._identityChangesTail === null) {
|
7314
|
this._identityChangesTail = this._identityChangesHead = record;
|
7315
|
}
|
7316
|
else {
|
7317
|
this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
|
7318
|
}
|
7319
|
return record;
|
7320
|
};
|
7321
|
/**
|
7322
|
* @return {?}
|
7323
|
*/
|
7324
|
DefaultIterableDiffer.prototype.toString = function () {
|
7325
|
var /** @type {?} */ list = [];
|
7326
|
this.forEachItem(function (record) { return list.push(record); });
|
7327
|
var /** @type {?} */ previous = [];
|
7328
|
this.forEachPreviousItem(function (record) { return previous.push(record); });
|
7329
|
var /** @type {?} */ additions = [];
|
7330
|
this.forEachAddedItem(function (record) { return additions.push(record); });
|
7331
|
var /** @type {?} */ moves = [];
|
7332
|
this.forEachMovedItem(function (record) { return moves.push(record); });
|
7333
|
var /** @type {?} */ removals = [];
|
7334
|
this.forEachRemovedItem(function (record) { return removals.push(record); });
|
7335
|
var /** @type {?} */ identityChanges = [];
|
7336
|
this.forEachIdentityChange(function (record) { return identityChanges.push(record); });
|
7337
|
return 'collection: ' + list.join(', ') + '\n' +
|
7338
|
'previous: ' + previous.join(', ') + '\n' +
|
7339
|
'additions: ' + additions.join(', ') + '\n' +
|
7340
|
'moves: ' + moves.join(', ') + '\n' +
|
7341
|
'removals: ' + removals.join(', ') + '\n' +
|
7342
|
'identityChanges: ' + identityChanges.join(', ') + '\n';
|
7343
|
};
|
7344
|
return DefaultIterableDiffer;
|
7345
|
}());
|
7346
|
/**
|
7347
|
* \@stable
|
7348
|
*/
|
7349
|
var IterableChangeRecord_ = (function () {
|
7350
|
/**
|
7351
|
* @param {?} item
|
7352
|
* @param {?} trackById
|
7353
|
*/
|
7354
|
function IterableChangeRecord_(item, trackById) {
|
7355
|
this.item = item;
|
7356
|
this.trackById = trackById;
|
7357
|
this.currentIndex = null;
|
7358
|
this.previousIndex = null;
|
7359
|
/**
|
7360
|
* \@internal
|
7361
|
*/
|
7362
|
this._nextPrevious = null;
|
7363
|
/**
|
7364
|
* \@internal
|
7365
|
*/
|
7366
|
this._prev = null;
|
7367
|
/**
|
7368
|
* \@internal
|
7369
|
*/
|
7370
|
this._next = null;
|
7371
|
/**
|
7372
|
* \@internal
|
7373
|
*/
|
7374
|
this._prevDup = null;
|
7375
|
/**
|
7376
|
* \@internal
|
7377
|
*/
|
7378
|
this._nextDup = null;
|
7379
|
/**
|
7380
|
* \@internal
|
7381
|
*/
|
7382
|
this._prevRemoved = null;
|
7383
|
/**
|
7384
|
* \@internal
|
7385
|
*/
|
7386
|
this._nextRemoved = null;
|
7387
|
/**
|
7388
|
* \@internal
|
7389
|
*/
|
7390
|
this._nextAdded = null;
|
7391
|
/**
|
7392
|
* \@internal
|
7393
|
*/
|
7394
|
this._nextMoved = null;
|
7395
|
/**
|
7396
|
* \@internal
|
7397
|
*/
|
7398
|
this._nextIdentityChange = null;
|
7399
|
}
|
7400
|
/**
|
7401
|
* @return {?}
|
7402
|
*/
|
7403
|
IterableChangeRecord_.prototype.toString = function () {
|
7404
|
return this.previousIndex === this.currentIndex ? stringify(this.item) :
|
7405
|
stringify(this.item) + '[' +
|
7406
|
stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']';
|
7407
|
};
|
7408
|
return IterableChangeRecord_;
|
7409
|
}());
|
7410
|
var _DuplicateItemRecordList = (function () {
|
7411
|
function _DuplicateItemRecordList() {
|
7412
|
/**
|
7413
|
* \@internal
|
7414
|
*/
|
7415
|
this._head = null;
|
7416
|
/**
|
7417
|
* \@internal
|
7418
|
*/
|
7419
|
this._tail = null;
|
7420
|
}
|
7421
|
/**
|
7422
|
* Append the record to the list of duplicates.
|
7423
|
*
|
7424
|
* Note: by design all records in the list of duplicates hold the same value in record.item.
|
7425
|
* @param {?} record
|
7426
|
* @return {?}
|
7427
|
*/
|
7428
|
_DuplicateItemRecordList.prototype.add = function (record) {
|
7429
|
if (this._head === null) {
|
7430
|
this._head = this._tail = record;
|
7431
|
record._nextDup = null;
|
7432
|
record._prevDup = null;
|
7433
|
}
|
7434
|
else {
|
7435
|
((
|
7436
|
// todo(vicb)
|
7437
|
// assert(record.item == _head.item ||
|
7438
|
// record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
|
7439
|
this._tail))._nextDup = record;
|
7440
|
record._prevDup = this._tail;
|
7441
|
record._nextDup = null;
|
7442
|
this._tail = record;
|
7443
|
}
|
7444
|
};
|
7445
|
/**
|
7446
|
* @param {?} trackById
|
7447
|
* @param {?} atOrAfterIndex
|
7448
|
* @return {?}
|
7449
|
*/
|
7450
|
_DuplicateItemRecordList.prototype.get = function (trackById, atOrAfterIndex) {
|
7451
|
var /** @type {?} */ record;
|
7452
|
for (record = this._head; record !== null; record = record._nextDup) {
|
7453
|
if ((atOrAfterIndex === null || atOrAfterIndex <= ((record.currentIndex))) &&
|
7454
|
looseIdentical(record.trackById, trackById)) {
|
7455
|
return record;
|
7456
|
}
|
7457
|
}
|
7458
|
return null;
|
7459
|
};
|
7460
|
/**
|
7461
|
* Remove one {\@link IterableChangeRecord_} from the list of duplicates.
|
7462
|
*
|
7463
|
* Returns whether the list of duplicates is empty.
|
7464
|
* @param {?} record
|
7465
|
* @return {?}
|
7466
|
*/
|
7467
|
_DuplicateItemRecordList.prototype.remove = function (record) {
|
7468
|
// todo(vicb)
|
7469
|
// assert(() {
|
7470
|
// // verify that the record being removed is in the list.
|
7471
|
// for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
|
7472
|
// if (identical(cursor, record)) return true;
|
7473
|
// }
|
7474
|
// return false;
|
7475
|
//});
|
7476
|
var /** @type {?} */ prev = record._prevDup;
|
7477
|
var /** @type {?} */ next = record._nextDup;
|
7478
|
if (prev === null) {
|
7479
|
this._head = next;
|
7480
|
}
|
7481
|
else {
|
7482
|
prev._nextDup = next;
|
7483
|
}
|
7484
|
if (next === null) {
|
7485
|
this._tail = prev;
|
7486
|
}
|
7487
|
else {
|
7488
|
next._prevDup = prev;
|
7489
|
}
|
7490
|
return this._head === null;
|
7491
|
};
|
7492
|
return _DuplicateItemRecordList;
|
7493
|
}());
|
7494
|
var _DuplicateMap = (function () {
|
7495
|
function _DuplicateMap() {
|
7496
|
this.map = new Map();
|
7497
|
}
|
7498
|
/**
|
7499
|
* @param {?} record
|
7500
|
* @return {?}
|
7501
|
*/
|
7502
|
_DuplicateMap.prototype.put = function (record) {
|
7503
|
var /** @type {?} */ key = record.trackById;
|
7504
|
var /** @type {?} */ duplicates = this.map.get(key);
|
7505
|
if (!duplicates) {
|
7506
|
duplicates = new _DuplicateItemRecordList();
|
7507
|
this.map.set(key, duplicates);
|
7508
|
}
|
7509
|
duplicates.add(record);
|
7510
|
};
|
7511
|
/**
|
7512
|
* Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
|
7513
|
* have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
|
7514
|
*
|
7515
|
* Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
|
7516
|
* have any more `a`s needs to return the second `a`.
|
7517
|
* @param {?} trackById
|
7518
|
* @param {?} atOrAfterIndex
|
7519
|
* @return {?}
|
7520
|
*/
|
7521
|
_DuplicateMap.prototype.get = function (trackById, atOrAfterIndex) {
|
7522
|
var /** @type {?} */ key = trackById;
|
7523
|
var /** @type {?} */ recordList = this.map.get(key);
|
7524
|
return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
|
7525
|
};
|
7526
|
/**
|
7527
|
* Removes a {\@link IterableChangeRecord_} from the list of duplicates.
|
7528
|
*
|
7529
|
* The list of duplicates also is removed from the map if it gets empty.
|
7530
|
* @param {?} record
|
7531
|
* @return {?}
|
7532
|
*/
|
7533
|
_DuplicateMap.prototype.remove = function (record) {
|
7534
|
var /** @type {?} */ key = record.trackById;
|
7535
|
var /** @type {?} */ recordList = ((this.map.get(key)));
|
7536
|
// Remove the list of duplicates when it gets empty
|
7537
|
if (recordList.remove(record)) {
|
7538
|
this.map.delete(key);
|
7539
|
}
|
7540
|
return record;
|
7541
|
};
|
7542
|
Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
|
7543
|
/**
|
7544
|
* @return {?}
|
7545
|
*/
|
7546
|
get: function () { return this.map.size === 0; },
|
7547
|
enumerable: true,
|
7548
|
configurable: true
|
7549
|
});
|
7550
|
/**
|
7551
|
* @return {?}
|
7552
|
*/
|
7553
|
_DuplicateMap.prototype.clear = function () { this.map.clear(); };
|
7554
|
/**
|
7555
|
* @return {?}
|
7556
|
*/
|
7557
|
_DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; };
|
7558
|
return _DuplicateMap;
|
7559
|
}());
|
7560
|
/**
|
7561
|
* @param {?} item
|
7562
|
* @param {?} addRemoveOffset
|
7563
|
* @param {?} moveOffsets
|
7564
|
* @return {?}
|
7565
|
*/
|
7566
|
function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
|
7567
|
var /** @type {?} */ previousIndex = item.previousIndex;
|
7568
|
if (previousIndex === null)
|
7569
|
return previousIndex;
|
7570
|
var /** @type {?} */ moveOffset = 0;
|
7571
|
if (moveOffsets && previousIndex < moveOffsets.length) {
|
7572
|
moveOffset = moveOffsets[previousIndex];
|
7573
|
}
|
7574
|
return previousIndex + addRemoveOffset + moveOffset;
|
7575
|
}
|
7576
|
/**
|
7577
|
* @license
|
7578
|
* Copyright Google Inc. All Rights Reserved.
|
7579
|
*
|
7580
|
* Use of this source code is governed by an MIT-style license that can be
|
7581
|
* found in the LICENSE file at https://angular.io/license
|
7582
|
*/
|
7583
|
var DefaultKeyValueDifferFactory = (function () {
|
7584
|
function DefaultKeyValueDifferFactory() {
|
7585
|
}
|
7586
|
/**
|
7587
|
* @param {?} obj
|
7588
|
* @return {?}
|
7589
|
*/
|
7590
|
DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); };
|
7591
|
/**
|
7592
|
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
|
7593
|
* @template K, V
|
7594
|
* @param {?=} cd
|
7595
|
* @return {?}
|
7596
|
*/
|
7597
|
DefaultKeyValueDifferFactory.prototype.create = function (cd) {
|
7598
|
return new DefaultKeyValueDiffer();
|
7599
|
};
|
7600
|
return DefaultKeyValueDifferFactory;
|
7601
|
}());
|
7602
|
var DefaultKeyValueDiffer = (function () {
|
7603
|
function DefaultKeyValueDiffer() {
|
7604
|
this._records = new Map();
|
7605
|
this._mapHead = null;
|
7606
|
this._appendAfter = null;
|
7607
|
this._previousMapHead = null;
|
7608
|
this._changesHead = null;
|
7609
|
this._changesTail = null;
|
7610
|
this._additionsHead = null;
|
7611
|
this._additionsTail = null;
|
7612
|
this._removalsHead = null;
|
7613
|
this._removalsTail = null;
|
7614
|
}
|
7615
|
Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
|
7616
|
/**
|
7617
|
* @return {?}
|
7618
|
*/
|
7619
|
get: function () {
|
7620
|
return this._additionsHead !== null || this._changesHead !== null ||
|
7621
|
this._removalsHead !== null;
|
7622
|
},
|
7623
|
enumerable: true,
|
7624
|
configurable: true
|
7625
|
});
|
7626
|
/**
|
7627
|
* @param {?} fn
|
7628
|
* @return {?}
|
7629
|
*/
|
7630
|
DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
|
7631
|
var /** @type {?} */ record;
|
7632
|
for (record = this._mapHead; record !== null; record = record._next) {
|
7633
|
fn(record);
|
7634
|
}
|
7635
|
};
|
7636
|
/**
|
7637
|
* @param {?} fn
|
7638
|
* @return {?}
|
7639
|
*/
|
7640
|
DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
|
7641
|
var /** @type {?} */ record;
|
7642
|
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
7643
|
fn(record);
|
7644
|
}
|
7645
|
};
|
7646
|
/**
|
7647
|
* @param {?} fn
|
7648
|
* @return {?}
|
7649
|
*/
|
7650
|
DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
|
7651
|
var /** @type {?} */ record;
|
7652
|
for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
7653
|
fn(record);
|
7654
|
}
|
7655
|
};
|
7656
|
/**
|
7657
|
* @param {?} fn
|
7658
|
* @return {?}
|
7659
|
*/
|
7660
|
DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
|
7661
|
var /** @type {?} */ record;
|
7662
|
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
7663
|
fn(record);
|
7664
|
}
|
7665
|
};
|
7666
|
/**
|
7667
|
* @param {?} fn
|
7668
|
* @return {?}
|
7669
|
*/
|
7670
|
DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
|
7671
|
var /** @type {?} */ record;
|
7672
|
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
7673
|
fn(record);
|
7674
|
}
|
7675
|
};
|
7676
|
/**
|
7677
|
* @param {?=} map
|
7678
|
* @return {?}
|
7679
|
*/
|
7680
|
DefaultKeyValueDiffer.prototype.diff = function (map) {
|
7681
|
if (!map) {
|
7682
|
map = new Map();
|
7683
|
}
|
7684
|
else if (!(map instanceof Map || isJsObject(map))) {
|
7685
|
throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
|
7686
|
}
|
7687
|
return this.check(map) ? this : null;
|
7688
|
};
|
7689
|
/**
|
7690
|
* @return {?}
|
7691
|
*/
|
7692
|
DefaultKeyValueDiffer.prototype.onDestroy = function () { };
|
7693
|
/**
|
7694
|
* Check the current state of the map vs the previous.
|
7695
|
* The algorithm is optimised for when the keys do no change.
|
7696
|
* @param {?} map
|
7697
|
* @return {?}
|
7698
|
*/
|
7699
|
DefaultKeyValueDiffer.prototype.check = function (map) {
|
7700
|
var _this = this;
|
7701
|
this._reset();
|
7702
|
var /** @type {?} */ insertBefore = this._mapHead;
|
7703
|
this._appendAfter = null;
|
7704
|
this._forEach(map, function (value, key) {
|
7705
|
if (insertBefore && insertBefore.key === key) {
|
7706
|
_this._maybeAddToChanges(insertBefore, value);
|
7707
|
_this._appendAfter = insertBefore;
|
7708
|
insertBefore = insertBefore._next;
|
7709
|
}
|
7710
|
else {
|
7711
|
var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value);
|
7712
|
insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
|
7713
|
}
|
7714
|
});
|
7715
|
// Items remaining at the end of the list have been deleted
|
7716
|
if (insertBefore) {
|
7717
|
if (insertBefore._prev) {
|
7718
|
insertBefore._prev._next = null;
|
7719
|
}
|
7720
|
this._removalsHead = insertBefore;
|
7721
|
for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) {
|
7722
|
if (record === this._mapHead) {
|
7723
|
this._mapHead = null;
|
7724
|
}
|
7725
|
this._records.delete(record.key);
|
7726
|
record._nextRemoved = record._next;
|
7727
|
record.previousValue = record.currentValue;
|
7728
|
record.currentValue = null;
|
7729
|
record._prev = null;
|
7730
|
record._next = null;
|
7731
|
}
|
7732
|
}
|
7733
|
// Make sure tails have no next records from previous runs
|
7734
|
if (this._changesTail)
|
7735
|
this._changesTail._nextChanged = null;
|
7736
|
if (this._additionsTail)
|
7737
|
this._additionsTail._nextAdded = null;
|
7738
|
return this.isDirty;
|
7739
|
};
|
7740
|
/**
|
7741
|
* Inserts a record before `before` or append at the end of the list when `before` is null.
|
7742
|
*
|
7743
|
* Notes:
|
7744
|
* - This method appends at `this._appendAfter`,
|
7745
|
* - This method updates `this._appendAfter`,
|
7746
|
* - The return value is the new value for the insertion pointer.
|
7747
|
* @param {?} before
|
7748
|
* @param {?} record
|
7749
|
* @return {?}
|
7750
|
*/
|
7751
|
DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) {
|
7752
|
if (before) {
|
7753
|
var /** @type {?} */ prev = before._prev;
|
7754
|
record._next = before;
|
7755
|
record._prev = prev;
|
7756
|
before._prev = record;
|
7757
|
if (prev) {
|
7758
|
prev._next = record;
|
7759
|
}
|
7760
|
if (before === this._mapHead) {
|
7761
|
this._mapHead = record;
|
7762
|
}
|
7763
|
this._appendAfter = before;
|
7764
|
return before;
|
7765
|
}
|
7766
|
if (this._appendAfter) {
|
7767
|
this._appendAfter._next = record;
|
7768
|
record._prev = this._appendAfter;
|
7769
|
}
|
7770
|
else {
|
7771
|
this._mapHead = record;
|
7772
|
}
|
7773
|
this._appendAfter = record;
|
7774
|
return null;
|
7775
|
};
|
7776
|
/**
|
7777
|
* @param {?} key
|
7778
|
* @param {?} value
|
7779
|
* @return {?}
|
7780
|
*/
|
7781
|
DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) {
|
7782
|
if (this._records.has(key)) {
|
7783
|
var /** @type {?} */ record_1 = ((this._records.get(key)));
|
7784
|
this._maybeAddToChanges(record_1, value);
|
7785
|
var /** @type {?} */ prev = record_1._prev;
|
7786
|
var /** @type {?} */ next = record_1._next;
|
7787
|
if (prev) {
|
7788
|
prev._next = next;
|
7789
|
}
|
7790
|
if (next) {
|
7791
|
next._prev = prev;
|
7792
|
}
|
7793
|
record_1._next = null;
|
7794
|
record_1._prev = null;
|
7795
|
return record_1;
|
7796
|
}
|
7797
|
var /** @type {?} */ record = new KeyValueChangeRecord_(key);
|
7798
|
this._records.set(key, record);
|
7799
|
record.currentValue = value;
|
7800
|
this._addToAdditions(record);
|
7801
|
return record;
|
7802
|
};
|
7803
|
/**
|
7804
|
* \@internal
|
7805
|
* @return {?}
|
7806
|
*/
|
7807
|
DefaultKeyValueDiffer.prototype._reset = function () {
|
7808
|
if (this.isDirty) {
|
7809
|
var /** @type {?} */ record = void 0;
|
7810
|
// let `_previousMapHead` contain the state of the map before the changes
|
7811
|
this._previousMapHead = this._mapHead;
|
7812
|
for (record = this._previousMapHead; record !== null; record = record._next) {
|
7813
|
record._nextPrevious = record._next;
|
7814
|
}
|
7815
|
// Update `record.previousValue` with the value of the item before the changes
|
7816
|
// We need to update all changed items (that's those which have been added and changed)
|
7817
|
for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
7818
|
record.previousValue = record.currentValue;
|
7819
|
}
|
7820
|
for (record = this._additionsHead; record != null; record = record._nextAdded) {
|
7821
|
record.previousValue = record.currentValue;
|
7822
|
}
|
7823
|
this._changesHead = this._changesTail = null;
|
7824
|
this._additionsHead = this._additionsTail = null;
|
7825
|
this._removalsHead = null;
|
7826
|
}
|
7827
|
};
|
7828
|
/**
|
7829
|
* @param {?} record
|
7830
|
* @param {?} newValue
|
7831
|
* @return {?}
|
7832
|
*/
|
7833
|
DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) {
|
7834
|
if (!looseIdentical(newValue, record.currentValue)) {
|
7835
|
record.previousValue = record.currentValue;
|
7836
|
record.currentValue = newValue;
|
7837
|
this._addToChanges(record);
|
7838
|
}
|
7839
|
};
|
7840
|
/**
|
7841
|
* @param {?} record
|
7842
|
* @return {?}
|
7843
|
*/
|
7844
|
DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
|
7845
|
if (this._additionsHead === null) {
|
7846
|
this._additionsHead = this._additionsTail = record;
|
7847
|
}
|
7848
|
else {
|
7849
|
((this._additionsTail))._nextAdded = record;
|
7850
|
this._additionsTail = record;
|
7851
|
}
|
7852
|
};
|
7853
|
/**
|
7854
|
* @param {?} record
|
7855
|
* @return {?}
|
7856
|
*/
|
7857
|
DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
|
7858
|
if (this._changesHead === null) {
|
7859
|
this._changesHead = this._changesTail = record;
|
7860
|
}
|
7861
|
else {
|
7862
|
((this._changesTail))._nextChanged = record;
|
7863
|
this._changesTail = record;
|
7864
|
}
|
7865
|
};
|
7866
|
/**
|
7867
|
* \@internal
|
7868
|
* @template K, V
|
7869
|
* @param {?} obj
|
7870
|
* @param {?} fn
|
7871
|
* @return {?}
|
7872
|
*/
|
7873
|
DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
|
7874
|
if (obj instanceof Map) {
|
7875
|
obj.forEach(fn);
|
7876
|
}
|
7877
|
else {
|
7878
|
Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
|
7879
|
}
|
7880
|
};
|
7881
|
return DefaultKeyValueDiffer;
|
7882
|
}());
|
7883
|
/**
|
7884
|
* \@stable
|
7885
|
*/
|
7886
|
var KeyValueChangeRecord_ = (function () {
|
7887
|
/**
|
7888
|
* @param {?} key
|
7889
|
*/
|
7890
|
function KeyValueChangeRecord_(key) {
|
7891
|
this.key = key;
|
7892
|
this.previousValue = null;
|
7893
|
this.currentValue = null;
|
7894
|
/**
|
7895
|
* \@internal
|
7896
|
*/
|
7897
|
this._nextPrevious = null;
|
7898
|
/**
|
7899
|
* \@internal
|
7900
|
*/
|
7901
|
this._next = null;
|
7902
|
/**
|
7903
|
* \@internal
|
7904
|
*/
|
7905
|
this._prev = null;
|
7906
|
/**
|
7907
|
* \@internal
|
7908
|
*/
|
7909
|
this._nextAdded = null;
|
7910
|
/**
|
7911
|
* \@internal
|
7912
|
*/
|
7913
|
this._nextRemoved = null;
|
7914
|
/**
|
7915
|
* \@internal
|
7916
|
*/
|
7917
|
this._nextChanged = null;
|
7918
|
}
|
7919
|
return KeyValueChangeRecord_;
|
7920
|
}());
|
7921
|
/**
|
7922
|
* @license
|
7923
|
* Copyright Google Inc. All Rights Reserved.
|
7924
|
*
|
7925
|
* Use of this source code is governed by an MIT-style license that can be
|
7926
|
* found in the LICENSE file at https://angular.io/license
|
7927
|
*/
|
7928
|
/**
|
7929
|
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
|
7930
|
* \@stable
|
7931
|
*/
|
7932
|
var IterableDiffers = (function () {
|
7933
|
/**
|
7934
|
* @param {?} factories
|
7935
|
*/
|
7936
|
function IterableDiffers(factories) {
|
7937
|
this.factories = factories;
|
7938
|
}
|
7939
|
/**
|
7940
|
* @param {?} factories
|
7941
|
* @param {?=} parent
|
7942
|
* @return {?}
|
7943
|
*/
|
7944
|
IterableDiffers.create = function (factories, parent) {
|
7945
|
if (parent != null) {
|
7946
|
var /** @type {?} */ copied = parent.factories.slice();
|
7947
|
factories = factories.concat(copied);
|
7948
|
return new IterableDiffers(factories);
|
7949
|
}
|
7950
|
else {
|
7951
|
return new IterableDiffers(factories);
|
7952
|
}
|
7953
|
};
|
7954
|
/**
|
7955
|
* Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
|
7956
|
* inherited {\@link IterableDiffers} instance with the provided factories and return a new
|
7957
|
* {\@link IterableDiffers} instance.
|
7958
|
*
|
7959
|
* The following example shows how to extend an existing list of factories,
|
7960
|
* which will only be applied to the injector for this component and its children.
|
7961
|
* This step is all that's required to make a new {\@link IterableDiffer} available.
|
7962
|
*
|
7963
|
* ### Example
|
7964
|
*
|
7965
|
* ```
|
7966
|
* \@Component({
|
7967
|
* viewProviders: [
|
7968
|
* IterableDiffers.extend([new ImmutableListDiffer()])
|
7969
|
* ]
|
7970
|
* })
|
7971
|
* ```
|
7972
|
* @param {?} factories
|
7973
|
* @return {?}
|
7974
|
*/
|
7975
|
IterableDiffers.extend = function (factories) {
|
7976
|
return {
|
7977
|
provide: IterableDiffers,
|
7978
|
useFactory: function (parent) {
|
7979
|
if (!parent) {
|
7980
|
// Typically would occur when calling IterableDiffers.extend inside of dependencies passed
|
7981
|
// to
|
7982
|
// bootstrap(), which would override default pipes instead of extending them.
|
7983
|
throw new Error('Cannot extend IterableDiffers without a parent injector');
|
7984
|
}
|
7985
|
return IterableDiffers.create(factories, parent);
|
7986
|
},
|
7987
|
// Dependency technically isn't optional, but we can provide a better error message this way.
|
7988
|
deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
|
7989
|
};
|
7990
|
};
|
7991
|
/**
|
7992
|
* @param {?} iterable
|
7993
|
* @return {?}
|
7994
|
*/
|
7995
|
IterableDiffers.prototype.find = function (iterable) {
|
7996
|
var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); });
|
7997
|
if (factory != null) {
|
7998
|
return factory;
|
7999
|
}
|
8000
|
else {
|
8001
|
throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
|
8002
|
}
|
8003
|
};
|
8004
|
return IterableDiffers;
|
8005
|
}());
|
8006
|
/**
|
8007
|
* @param {?} type
|
8008
|
* @return {?}
|
8009
|
*/
|
8010
|
function getTypeNameForDebugging(type) {
|
8011
|
return type['name'] || typeof type;
|
8012
|
}
|
8013
|
/**
|
8014
|
* @license
|
8015
|
* Copyright Google Inc. All Rights Reserved.
|
8016
|
*
|
8017
|
* Use of this source code is governed by an MIT-style license that can be
|
8018
|
* found in the LICENSE file at https://angular.io/license
|
8019
|
*/
|
8020
|
/**
|
8021
|
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
|
8022
|
* \@stable
|
8023
|
*/
|
8024
|
var KeyValueDiffers = (function () {
|
8025
|
/**
|
8026
|
* @param {?} factories
|
8027
|
*/
|
8028
|
function KeyValueDiffers(factories) {
|
8029
|
this.factories = factories;
|
8030
|
}
|
8031
|
/**
|
8032
|
* @template S
|
8033
|
* @param {?} factories
|
8034
|
* @param {?=} parent
|
8035
|
* @return {?}
|
8036
|
*/
|
8037
|
KeyValueDiffers.create = function (factories, parent) {
|
8038
|
if (parent) {
|
8039
|
var /** @type {?} */ copied = parent.factories.slice();
|
8040
|
factories = factories.concat(copied);
|
8041
|
}
|
8042
|
return new KeyValueDiffers(factories);
|
8043
|
};
|
8044
|
/**
|
8045
|
* Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
|
8046
|
* inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
|
8047
|
* {\@link KeyValueDiffers} instance.
|
8048
|
*
|
8049
|
* The following example shows how to extend an existing list of factories,
|
8050
|
* which will only be applied to the injector for this component and its children.
|
8051
|
* This step is all that's required to make a new {\@link KeyValueDiffer} available.
|
8052
|
*
|
8053
|
* ### Example
|
8054
|
*
|
8055
|
* ```
|
8056
|
* \@Component({
|
8057
|
* viewProviders: [
|
8058
|
* KeyValueDiffers.extend([new ImmutableMapDiffer()])
|
8059
|
* ]
|
8060
|
* })
|
8061
|
* ```
|
8062
|
* @template S
|
8063
|
* @param {?} factories
|
8064
|
* @return {?}
|
8065
|
*/
|
8066
|
KeyValueDiffers.extend = function (factories) {
|
8067
|
return {
|
8068
|
provide: KeyValueDiffers,
|
8069
|
useFactory: function (parent) {
|
8070
|
if (!parent) {
|
8071
|
// Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
|
8072
|
// to bootstrap(), which would override default pipes instead of extending them.
|
8073
|
throw new Error('Cannot extend KeyValueDiffers without a parent injector');
|
8074
|
}
|
8075
|
return KeyValueDiffers.create(factories, parent);
|
8076
|
},
|
8077
|
// Dependency technically isn't optional, but we can provide a better error message this way.
|
8078
|
deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
|
8079
|
};
|
8080
|
};
|
8081
|
/**
|
8082
|
* @param {?} kv
|
8083
|
* @return {?}
|
8084
|
*/
|
8085
|
KeyValueDiffers.prototype.find = function (kv) {
|
8086
|
var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); });
|
8087
|
if (factory) {
|
8088
|
return factory;
|
8089
|
}
|
8090
|
throw new Error("Cannot find a differ supporting object '" + kv + "'");
|
8091
|
};
|
8092
|
return KeyValueDiffers;
|
8093
|
}());
|
8094
|
/**
|
8095
|
* @license
|
8096
|
* Copyright Google Inc. All Rights Reserved.
|
8097
|
*
|
8098
|
* Use of this source code is governed by an MIT-style license that can be
|
8099
|
* found in the LICENSE file at https://angular.io/license
|
8100
|
*/
|
8101
|
/**
|
8102
|
* Structural diffing for `Object`s and `Map`s.
|
8103
|
*/
|
8104
|
var keyValDiff = [new DefaultKeyValueDifferFactory()];
|
8105
|
/**
|
8106
|
* Structural diffing for `Iterable` types such as `Array`s.
|
8107
|
*/
|
8108
|
var iterableDiff = [new DefaultIterableDifferFactory()];
|
8109
|
var defaultIterableDiffers = new IterableDiffers(iterableDiff);
|
8110
|
var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
|
8111
|
/**
|
8112
|
* @license
|
8113
|
* Copyright Google Inc. All Rights Reserved.
|
8114
|
*
|
8115
|
* Use of this source code is governed by an MIT-style license that can be
|
8116
|
* found in the LICENSE file at https://angular.io/license
|
8117
|
*/
|
8118
|
/**
|
8119
|
* @module
|
8120
|
* @description
|
8121
|
* Change detection enables data binding in Angular.
|
8122
|
*/
|
8123
|
/**
|
8124
|
* @license
|
8125
|
* Copyright Google Inc. All Rights Reserved.
|
8126
|
*
|
8127
|
* Use of this source code is governed by an MIT-style license that can be
|
8128
|
* found in the LICENSE file at https://angular.io/license
|
8129
|
*/
|
8130
|
/**
|
8131
|
* @return {?}
|
8132
|
*/
|
8133
|
function _reflector() {
|
8134
|
return reflector;
|
8135
|
}
|
8136
|
var _CORE_PLATFORM_PROVIDERS = [
|
8137
|
// Set a default platform name for platforms that don't set it explicitly.
|
8138
|
{ provide: PLATFORM_ID, useValue: 'unknown' },
|
8139
|
PlatformRef_,
|
8140
|
{ provide: PlatformRef, useExisting: PlatformRef_ },
|
8141
|
{ provide: Reflector, useFactory: _reflector, deps: [] },
|
8142
|
TestabilityRegistry,
|
8143
|
Console,
|
8144
|
];
|
8145
|
/**
|
8146
|
* This platform has to be included in any other platform
|
8147
|
*
|
8148
|
* \@experimental
|
8149
|
*/
|
8150
|
var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
8151
|
/**
|
8152
|
* @license
|
8153
|
* Copyright Google Inc. All Rights Reserved.
|
8154
|
*
|
8155
|
* Use of this source code is governed by an MIT-style license that can be
|
8156
|
* found in the LICENSE file at https://angular.io/license
|
8157
|
*/
|
8158
|
/**
|
8159
|
* \@experimental i18n support is experimental.
|
8160
|
*/
|
8161
|
var LOCALE_ID = new InjectionToken('LocaleId');
|
8162
|
/**
|
8163
|
* \@experimental i18n support is experimental.
|
8164
|
*/
|
8165
|
var TRANSLATIONS = new InjectionToken('Translations');
|
8166
|
/**
|
8167
|
* \@experimental i18n support is experimental.
|
8168
|
*/
|
8169
|
var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
|
8170
|
var MissingTranslationStrategy = {};
|
8171
|
MissingTranslationStrategy.Error = 0;
|
8172
|
MissingTranslationStrategy.Warning = 1;
|
8173
|
MissingTranslationStrategy.Ignore = 2;
|
8174
|
MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
|
8175
|
MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
|
8176
|
MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
|
8177
|
/**
|
8178
|
* @license
|
8179
|
* Copyright Google Inc. All Rights Reserved.
|
8180
|
*
|
8181
|
* Use of this source code is governed by an MIT-style license that can be
|
8182
|
* found in the LICENSE file at https://angular.io/license
|
8183
|
*/
|
8184
|
/**
|
8185
|
* @return {?}
|
8186
|
*/
|
8187
|
function _iterableDiffersFactory() {
|
8188
|
return defaultIterableDiffers;
|
8189
|
}
|
8190
|
/**
|
8191
|
* @return {?}
|
8192
|
*/
|
8193
|
function _keyValueDiffersFactory() {
|
8194
|
return defaultKeyValueDiffers;
|
8195
|
}
|
8196
|
/**
|
8197
|
* @param {?=} locale
|
8198
|
* @return {?}
|
8199
|
*/
|
8200
|
function _localeFactory(locale) {
|
8201
|
return locale || 'en-US';
|
8202
|
}
|
8203
|
/**
|
8204
|
* This module includes the providers of \@angular/core that are needed
|
8205
|
* to bootstrap components via `ApplicationRef`.
|
8206
|
*
|
8207
|
* \@experimental
|
8208
|
*/
|
8209
|
var ApplicationModule = (function () {
|
8210
|
/**
|
8211
|
* @param {?} appRef
|
8212
|
*/
|
8213
|
function ApplicationModule(appRef) {
|
8214
|
}
|
8215
|
return ApplicationModule;
|
8216
|
}());
|
8217
|
ApplicationModule.decorators = [
|
8218
|
{ type: NgModule, args: [{
|
8219
|
providers: [
|
8220
|
ApplicationRef_,
|
8221
|
{ provide: ApplicationRef, useExisting: ApplicationRef_ },
|
8222
|
ApplicationInitStatus,
|
8223
|
Compiler,
|
8224
|
APP_ID_RANDOM_PROVIDER,
|
8225
|
{ provide: IterableDiffers, useFactory: _iterableDiffersFactory },
|
8226
|
{ provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
|
8227
|
{
|
8228
|
provide: LOCALE_ID,
|
8229
|
useFactory: _localeFactory,
|
8230
|
deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
|
8231
|
},
|
8232
|
]
|
8233
|
},] },
|
8234
|
];
|
8235
|
/**
|
8236
|
* @nocollapse
|
8237
|
*/
|
8238
|
ApplicationModule.ctorParameters = function () { return [
|
8239
|
{ type: ApplicationRef, },
|
8240
|
]; };
|
8241
|
var SecurityContext = {};
|
8242
|
SecurityContext.NONE = 0;
|
8243
|
SecurityContext.HTML = 1;
|
8244
|
SecurityContext.STYLE = 2;
|
8245
|
SecurityContext.SCRIPT = 3;
|
8246
|
SecurityContext.URL = 4;
|
8247
|
SecurityContext.RESOURCE_URL = 5;
|
8248
|
SecurityContext[SecurityContext.NONE] = "NONE";
|
8249
|
SecurityContext[SecurityContext.HTML] = "HTML";
|
8250
|
SecurityContext[SecurityContext.STYLE] = "STYLE";
|
8251
|
SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
|
8252
|
SecurityContext[SecurityContext.URL] = "URL";
|
8253
|
SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
|
8254
|
/**
|
8255
|
* Sanitizer is used by the views to sanitize potentially dangerous values.
|
8256
|
*
|
8257
|
* \@stable
|
8258
|
* @abstract
|
8259
|
*/
|
8260
|
var Sanitizer = (function () {
|
8261
|
function Sanitizer() {
|
8262
|
}
|
8263
|
/**
|
8264
|
* @abstract
|
8265
|
* @param {?} context
|
8266
|
* @param {?} value
|
8267
|
* @return {?}
|
8268
|
*/
|
8269
|
Sanitizer.prototype.sanitize = function (context, value) { };
|
8270
|
return Sanitizer;
|
8271
|
}());
|
8272
|
/**
|
8273
|
* @license
|
8274
|
* Copyright Google Inc. All Rights Reserved.
|
8275
|
*
|
8276
|
* Use of this source code is governed by an MIT-style license that can be
|
8277
|
* found in the LICENSE file at https://angular.io/license
|
8278
|
*/
|
8279
|
/**
|
8280
|
* Node instance data.
|
8281
|
*
|
8282
|
* We have a separate type per NodeType to save memory
|
8283
|
* (TextData | ElementData | ProviderData | PureExpressionData | QueryList<any>)
|
8284
|
*
|
8285
|
* To keep our code monomorphic,
|
8286
|
* we prohibit using `NodeData` directly but enforce the use of accessors (`asElementData`, ...).
|
8287
|
* This way, no usage site can get a `NodeData` from view.nodes and then use it for different
|
8288
|
* purposes.
|
8289
|
*/
|
8290
|
/**
|
8291
|
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
|
8292
|
* @param {?} view
|
8293
|
* @param {?} index
|
8294
|
* @return {?}
|
8295
|
*/
|
8296
|
function asTextData(view, index) {
|
8297
|
return (view.nodes[index]);
|
8298
|
}
|
8299
|
/**
|
8300
|
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
|
8301
|
* @param {?} view
|
8302
|
* @param {?} index
|
8303
|
* @return {?}
|
8304
|
*/
|
8305
|
function asElementData(view, index) {
|
8306
|
return (view.nodes[index]);
|
8307
|
}
|
8308
|
/**
|
8309
|
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
|
8310
|
* @param {?} view
|
8311
|
* @param {?} index
|
8312
|
* @return {?}
|
8313
|
*/
|
8314
|
function asProviderData(view, index) {
|
8315
|
return (view.nodes[index]);
|
8316
|
}
|
8317
|
/**
|
8318
|
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
|
8319
|
* @param {?} view
|
8320
|
* @param {?} index
|
8321
|
* @return {?}
|
8322
|
*/
|
8323
|
function asPureExpressionData(view, index) {
|
8324
|
return (view.nodes[index]);
|
8325
|
}
|
8326
|
/**
|
8327
|
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
|
8328
|
* @param {?} view
|
8329
|
* @param {?} index
|
8330
|
* @return {?}
|
8331
|
*/
|
8332
|
function asQueryList(view, index) {
|
8333
|
return (view.nodes[index]);
|
8334
|
}
|
8335
|
/**
|
8336
|
* @abstract
|
8337
|
*/
|
8338
|
var DebugContext = (function () {
|
8339
|
function DebugContext() {
|
8340
|
}
|
8341
|
/**
|
8342
|
* @abstract
|
8343
|
* @return {?}
|
8344
|
*/
|
8345
|
DebugContext.prototype.view = function () { };
|
8346
|
/**
|
8347
|
* @abstract
|
8348
|
* @return {?}
|
8349
|
*/
|
8350
|
DebugContext.prototype.nodeIndex = function () { };
|
8351
|
/**
|
8352
|
* @abstract
|
8353
|
* @return {?}
|
8354
|
*/
|
8355
|
DebugContext.prototype.injector = function () { };
|
8356
|
/**
|
8357
|
* @abstract
|
8358
|
* @return {?}
|
8359
|
*/
|
8360
|
DebugContext.prototype.component = function () { };
|
8361
|
/**
|
8362
|
* @abstract
|
8363
|
* @return {?}
|
8364
|
*/
|
8365
|
DebugContext.prototype.providerTokens = function () { };
|
8366
|
/**
|
8367
|
* @abstract
|
8368
|
* @return {?}
|
8369
|
*/
|
8370
|
DebugContext.prototype.references = function () { };
|
8371
|
/**
|
8372
|
* @abstract
|
8373
|
* @return {?}
|
8374
|
*/
|
8375
|
DebugContext.prototype.context = function () { };
|
8376
|
/**
|
8377
|
* @abstract
|
8378
|
* @return {?}
|
8379
|
*/
|
8380
|
DebugContext.prototype.componentRenderElement = function () { };
|
8381
|
/**
|
8382
|
* @abstract
|
8383
|
* @return {?}
|
8384
|
*/
|
8385
|
DebugContext.prototype.renderNode = function () { };
|
8386
|
/**
|
8387
|
* @abstract
|
8388
|
* @param {?} console
|
8389
|
* @param {...?} values
|
8390
|
* @return {?}
|
8391
|
*/
|
8392
|
DebugContext.prototype.logError = function (console) {
|
8393
|
var values = [];
|
8394
|
for (var _i = 1; _i < arguments.length; _i++) {
|
8395
|
values[_i - 1] = arguments[_i];
|
8396
|
}
|
8397
|
};
|
8398
|
return DebugContext;
|
8399
|
}());
|
8400
|
/**
|
8401
|
* This object is used to prevent cycles in the source files and to have a place where
|
8402
|
* debug mode can hook it. It is lazily filled when `isDevMode` is known.
|
8403
|
*/
|
8404
|
var Services = {
|
8405
|
setCurrentNode: undefined,
|
8406
|
createRootView: undefined,
|
8407
|
createEmbeddedView: undefined,
|
8408
|
createComponentView: undefined,
|
8409
|
createNgModuleRef: undefined,
|
8410
|
overrideProvider: undefined,
|
8411
|
clearProviderOverrides: undefined,
|
8412
|
checkAndUpdateView: undefined,
|
8413
|
checkNoChangesView: undefined,
|
8414
|
destroyView: undefined,
|
8415
|
resolveDep: undefined,
|
8416
|
createDebugContext: undefined,
|
8417
|
handleEvent: undefined,
|
8418
|
updateDirectives: undefined,
|
8419
|
updateRenderer: undefined,
|
8420
|
dirtyParentQueries: undefined,
|
8421
|
};
|
8422
|
/**
|
8423
|
* @license
|
8424
|
* Copyright Google Inc. All Rights Reserved.
|
8425
|
*
|
8426
|
* Use of this source code is governed by an MIT-style license that can be
|
8427
|
* found in the LICENSE file at https://angular.io/license
|
8428
|
*/
|
8429
|
/**
|
8430
|
* @param {?} context
|
8431
|
* @param {?} oldValue
|
8432
|
* @param {?} currValue
|
8433
|
* @param {?} isFirstCheck
|
8434
|
* @return {?}
|
8435
|
*/
|
8436
|
function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
|
8437
|
var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
|
8438
|
if (isFirstCheck) {
|
8439
|
msg +=
|
8440
|
" It seems like the view has been created after its parent and its children have been dirty checked." +
|
8441
|
" Has it been created in a change detection hook ?";
|
8442
|
}
|
8443
|
return viewDebugError(msg, context);
|
8444
|
}
|
8445
|
/**
|
8446
|
* @param {?} err
|
8447
|
* @param {?} context
|
8448
|
* @return {?}
|
8449
|
*/
|
8450
|
function viewWrappedDebugError(err, context) {
|
8451
|
if (!(err instanceof Error)) {
|
8452
|
// errors that are not Error instances don't have a stack,
|
8453
|
// so it is ok to wrap them into a new Error object...
|
8454
|
err = new Error(err.toString());
|
8455
|
}
|
8456
|
_addDebugContext(err, context);
|
8457
|
return err;
|
8458
|
}
|
8459
|
/**
|
8460
|
* @param {?} msg
|
8461
|
* @param {?} context
|
8462
|
* @return {?}
|
8463
|
*/
|
8464
|
function viewDebugError(msg, context) {
|
8465
|
var /** @type {?} */ err = new Error(msg);
|
8466
|
_addDebugContext(err, context);
|
8467
|
return err;
|
8468
|
}
|
8469
|
/**
|
8470
|
* @param {?} err
|
8471
|
* @param {?} context
|
8472
|
* @return {?}
|
8473
|
*/
|
8474
|
function _addDebugContext(err, context) {
|
8475
|
((err))[ERROR_DEBUG_CONTEXT] = context;
|
8476
|
((err))[ERROR_LOGGER] = context.logError.bind(context);
|
8477
|
}
|
8478
|
/**
|
8479
|
* @param {?} err
|
8480
|
* @return {?}
|
8481
|
*/
|
8482
|
function isViewDebugError(err) {
|
8483
|
return !!getDebugContext(err);
|
8484
|
}
|
8485
|
/**
|
8486
|
* @param {?} action
|
8487
|
* @return {?}
|
8488
|
*/
|
8489
|
function viewDestroyedError(action) {
|
8490
|
return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
|
8491
|
}
|
8492
|
/**
|
8493
|
* @license
|
8494
|
* Copyright Google Inc. All Rights Reserved.
|
8495
|
*
|
8496
|
* Use of this source code is governed by an MIT-style license that can be
|
8497
|
* found in the LICENSE file at https://angular.io/license
|
8498
|
*/
|
8499
|
var NOOP = function () { };
|
8500
|
var _tokenKeyCache = new Map();
|
8501
|
/**
|
8502
|
* @param {?} token
|
8503
|
* @return {?}
|
8504
|
*/
|
8505
|
function tokenKey(token) {
|
8506
|
var /** @type {?} */ key = _tokenKeyCache.get(token);
|
8507
|
if (!key) {
|
8508
|
key = stringify(token) + '_' + _tokenKeyCache.size;
|
8509
|
_tokenKeyCache.set(token, key);
|
8510
|
}
|
8511
|
return key;
|
8512
|
}
|
8513
|
/**
|
8514
|
* @param {?} view
|
8515
|
* @param {?} nodeIdx
|
8516
|
* @param {?} bindingIdx
|
8517
|
* @param {?} value
|
8518
|
* @return {?}
|
8519
|
*/
|
8520
|
function unwrapValue(view, nodeIdx, bindingIdx, value) {
|
8521
|
if (value instanceof WrappedValue) {
|
8522
|
value = value.wrapped;
|
8523
|
var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
|
8524
|
var /** @type {?} */ oldValue = view.oldValues[globalBindingIdx];
|
8525
|
if (oldValue instanceof WrappedValue) {
|
8526
|
oldValue = oldValue.wrapped;
|
8527
|
}
|
8528
|
view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
|
8529
|
}
|
8530
|
return value;
|
8531
|
}
|
8532
|
var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
|
8533
|
var EMPTY_RENDERER_TYPE_ID = '$$empty';
|
8534
|
/**
|
8535
|
* @param {?} values
|
8536
|
* @return {?}
|
8537
|
*/
|
8538
|
function createRendererType2(values) {
|
8539
|
return {
|
8540
|
id: UNDEFINED_RENDERER_TYPE_ID,
|
8541
|
styles: values.styles,
|
8542
|
encapsulation: values.encapsulation,
|
8543
|
data: values.data
|
8544
|
};
|
8545
|
}
|
8546
|
var _renderCompCount = 0;
|
8547
|
/**
|
8548
|
* @param {?=} type
|
8549
|
* @return {?}
|
8550
|
*/
|
8551
|
function resolveRendererType2(type) {
|
8552
|
if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
|
8553
|
// first time we see this RendererType2. Initialize it...
|
8554
|
var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
|
8555
|
type.styles.length || Object.keys(type.data).length);
|
8556
|
if (isFilled) {
|
8557
|
type.id = "c" + _renderCompCount++;
|
8558
|
}
|
8559
|
else {
|
8560
|
type.id = EMPTY_RENDERER_TYPE_ID;
|
8561
|
}
|
8562
|
}
|
8563
|
if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
|
8564
|
type = null;
|
8565
|
}
|
8566
|
return type || null;
|
8567
|
}
|
8568
|
/**
|
8569
|
* @param {?} view
|
8570
|
* @param {?} def
|
8571
|
* @param {?} bindingIdx
|
8572
|
* @param {?} value
|
8573
|
* @return {?}
|
8574
|
*/
|
8575
|
function checkBinding(view, def, bindingIdx, value) {
|
8576
|
var /** @type {?} */ oldValues = view.oldValues;
|
8577
|
if ((view.state & 2 /* FirstCheck */) ||
|
8578
|
!looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
|
8579
|
return true;
|
8580
|
}
|
8581
|
return false;
|
8582
|
}
|
8583
|
/**
|
8584
|
* @param {?} view
|
8585
|
* @param {?} def
|
8586
|
* @param {?} bindingIdx
|
8587
|
* @param {?} value
|
8588
|
* @return {?}
|
8589
|
*/
|
8590
|
function checkAndUpdateBinding(view, def, bindingIdx, value) {
|
8591
|
if (checkBinding(view, def, bindingIdx, value)) {
|
8592
|
view.oldValues[def.bindingIndex + bindingIdx] = value;
|
8593
|
return true;
|
8594
|
}
|
8595
|
return false;
|
8596
|
}
|
8597
|
/**
|
8598
|
* @param {?} view
|
8599
|
* @param {?} def
|
8600
|
* @param {?} bindingIdx
|
8601
|
* @param {?} value
|
8602
|
* @return {?}
|
8603
|
*/
|
8604
|
function checkBindingNoChanges(view, def, bindingIdx, value) {
|
8605
|
var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
8606
|
if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) {
|
8607
|
throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), oldValue, value, (view.state & 1 /* BeforeFirstCheck */) !== 0);
|
8608
|
}
|
8609
|
}
|
8610
|
/**
|
8611
|
* @param {?} view
|
8612
|
* @return {?}
|
8613
|
*/
|
8614
|
function markParentViewsForCheck(view) {
|
8615
|
var /** @type {?} */ currView = view;
|
8616
|
while (currView) {
|
8617
|
if (currView.def.flags & 2 /* OnPush */) {
|
8618
|
currView.state |= 8 /* ChecksEnabled */;
|
8619
|
}
|
8620
|
currView = currView.viewContainerParent || currView.parent;
|
8621
|
}
|
8622
|
}
|
8623
|
/**
|
8624
|
* @param {?} view
|
8625
|
* @param {?} endView
|
8626
|
* @return {?}
|
8627
|
*/
|
8628
|
function markParentViewsForCheckProjectedViews(view, endView) {
|
8629
|
var /** @type {?} */ currView = view;
|
8630
|
while (currView && currView !== endView) {
|
8631
|
currView.state |= 64 /* CheckProjectedViews */;
|
8632
|
currView = currView.viewContainerParent || currView.parent;
|
8633
|
}
|
8634
|
}
|
8635
|
/**
|
8636
|
* @param {?} view
|
8637
|
* @param {?} nodeIndex
|
8638
|
* @param {?} eventName
|
8639
|
* @param {?} event
|
8640
|
* @return {?}
|
8641
|
*/
|
8642
|
function dispatchEvent(view, nodeIndex, eventName, event) {
|
8643
|
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
|
8644
|
var /** @type {?} */ startView = nodeDef.flags & 33554432 /* ComponentView */ ? asElementData(view, nodeIndex).componentView : view;
|
8645
|
markParentViewsForCheck(startView);
|
8646
|
return Services.handleEvent(view, nodeIndex, eventName, event);
|
8647
|
}
|
8648
|
/**
|
8649
|
* @param {?} view
|
8650
|
* @return {?}
|
8651
|
*/
|
8652
|
function declaredViewContainer(view) {
|
8653
|
if (view.parent) {
|
8654
|
var /** @type {?} */ parentView = view.parent;
|
8655
|
return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).nodeIndex);
|
8656
|
}
|
8657
|
return null;
|
8658
|
}
|
8659
|
/**
|
8660
|
* for component views, this is the host element.
|
8661
|
* for embedded views, this is the index of the parent node
|
8662
|
* that contains the view container.
|
8663
|
* @param {?} view
|
8664
|
* @return {?}
|
8665
|
*/
|
8666
|
function viewParentEl(view) {
|
8667
|
var /** @type {?} */ parentView = view.parent;
|
8668
|
if (parentView) {
|
8669
|
return ((view.parentNodeDef)).parent;
|
8670
|
}
|
8671
|
else {
|
8672
|
return null;
|
8673
|
}
|
8674
|
}
|
8675
|
/**
|
8676
|
* @param {?} view
|
8677
|
* @param {?} def
|
8678
|
* @return {?}
|
8679
|
*/
|
8680
|
function renderNode(view, def) {
|
8681
|
switch (def.flags & 201347067 /* Types */) {
|
8682
|
case 1 /* TypeElement */:
|
8683
|
return asElementData(view, def.nodeIndex).renderElement;
|
8684
|
case 2 /* TypeText */:
|
8685
|
return asTextData(view, def.nodeIndex).renderText;
|
8686
|
}
|
8687
|
}
|
8688
|
/**
|
8689
|
* @param {?} target
|
8690
|
* @param {?} name
|
8691
|
* @return {?}
|
8692
|
*/
|
8693
|
function elementEventFullName(target, name) {
|
8694
|
return target ? target + ":" + name : name;
|
8695
|
}
|
8696
|
/**
|
8697
|
* @param {?} view
|
8698
|
* @return {?}
|
8699
|
*/
|
8700
|
function isComponentView(view) {
|
8701
|
return !!view.parent && !!(((view.parentNodeDef)).flags & 32768 /* Component */);
|
8702
|
}
|
8703
|
/**
|
8704
|
* @param {?} view
|
8705
|
* @return {?}
|
8706
|
*/
|
8707
|
function isEmbeddedView(view) {
|
8708
|
return !!view.parent && !(((view.parentNodeDef)).flags & 32768 /* Component */);
|
8709
|
}
|
8710
|
/**
|
8711
|
* @param {?} queryId
|
8712
|
* @return {?}
|
8713
|
*/
|
8714
|
function filterQueryId(queryId) {
|
8715
|
return 1 << (queryId % 32);
|
8716
|
}
|
8717
|
/**
|
8718
|
* @param {?} matchedQueriesDsl
|
8719
|
* @return {?}
|
8720
|
*/
|
8721
|
function splitMatchedQueriesDsl(matchedQueriesDsl) {
|
8722
|
var /** @type {?} */ matchedQueries = {};
|
8723
|
var /** @type {?} */ matchedQueryIds = 0;
|
8724
|
var /** @type {?} */ references = {};
|
8725
|
if (matchedQueriesDsl) {
|
8726
|
matchedQueriesDsl.forEach(function (_a) {
|
8727
|
var queryId = _a[0], valueType = _a[1];
|
8728
|
if (typeof queryId === 'number') {
|
8729
|
matchedQueries[queryId] = valueType;
|
8730
|
matchedQueryIds |= filterQueryId(queryId);
|
8731
|
}
|
8732
|
else {
|
8733
|
references[queryId] = valueType;
|
8734
|
}
|
8735
|
});
|
8736
|
}
|
8737
|
return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
|
8738
|
}
|
8739
|
/**
|
8740
|
* @param {?} deps
|
8741
|
* @return {?}
|
8742
|
*/
|
8743
|
function splitDepsDsl(deps) {
|
8744
|
return deps.map(function (value) {
|
8745
|
var /** @type {?} */ token;
|
8746
|
var /** @type {?} */ flags;
|
8747
|
if (Array.isArray(value)) {
|
8748
|
flags = value[0], token = value[1];
|
8749
|
}
|
8750
|
else {
|
8751
|
flags = 0 /* None */;
|
8752
|
token = value;
|
8753
|
}
|
8754
|
return { flags: flags, token: token, tokenKey: tokenKey(token) };
|
8755
|
});
|
8756
|
}
|
8757
|
/**
|
8758
|
* @param {?} view
|
8759
|
* @param {?} renderHost
|
8760
|
* @param {?} def
|
8761
|
* @return {?}
|
8762
|
*/
|
8763
|
function getParentRenderElement(view, renderHost, def) {
|
8764
|
var /** @type {?} */ renderParent = def.renderParent;
|
8765
|
if (renderParent) {
|
8766
|
if ((renderParent.flags & 1 /* TypeElement */) === 0 ||
|
8767
|
(renderParent.flags & 33554432 /* ComponentView */) === 0 ||
|
8768
|
(((renderParent.element)).componentRendererType && ((((renderParent.element)).componentRendererType)).encapsulation ===
|
8769
|
ViewEncapsulation.Native)) {
|
8770
|
// only children of non components, or children of components with native encapsulation should
|
8771
|
// be attached.
|
8772
|
return asElementData(view, /** @type {?} */ ((def.renderParent)).nodeIndex).renderElement;
|
8773
|
}
|
8774
|
}
|
8775
|
else {
|
8776
|
return renderHost;
|
8777
|
}
|
8778
|
}
|
8779
|
var DEFINITION_CACHE = new WeakMap();
|
8780
|
/**
|
8781
|
* @template D
|
8782
|
* @param {?} factory
|
8783
|
* @return {?}
|
8784
|
*/
|
8785
|
function resolveDefinition(factory) {
|
8786
|
var /** @type {?} */ value = (((DEFINITION_CACHE.get(factory))));
|
8787
|
if (!value) {
|
8788
|
value = factory(function () { return NOOP; });
|
8789
|
value.factory = factory;
|
8790
|
DEFINITION_CACHE.set(factory, value);
|
8791
|
}
|
8792
|
return value;
|
8793
|
}
|
8794
|
/**
|
8795
|
* @param {?} view
|
8796
|
* @return {?}
|
8797
|
*/
|
8798
|
function rootRenderNodes(view) {
|
8799
|
var /** @type {?} */ renderNodes = [];
|
8800
|
visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes);
|
8801
|
return renderNodes;
|
8802
|
}
|
8803
|
/**
|
8804
|
* @param {?} view
|
8805
|
* @param {?} action
|
8806
|
* @param {?} parentNode
|
8807
|
* @param {?} nextSibling
|
8808
|
* @param {?=} target
|
8809
|
* @return {?}
|
8810
|
*/
|
8811
|
function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
|
8812
|
// We need to re-compute the parent node in case the nodes have been moved around manually
|
8813
|
if (action === 3 /* RemoveChild */) {
|
8814
|
parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode))));
|
8815
|
}
|
8816
|
visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
|
8817
|
}
|
8818
|
/**
|
8819
|
* @param {?} view
|
8820
|
* @param {?} action
|
8821
|
* @param {?} startIndex
|
8822
|
* @param {?} endIndex
|
8823
|
* @param {?} parentNode
|
8824
|
* @param {?} nextSibling
|
8825
|
* @param {?=} target
|
8826
|
* @return {?}
|
8827
|
*/
|
8828
|
function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
|
8829
|
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
|
8830
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
8831
|
if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) {
|
8832
|
visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
|
8833
|
}
|
8834
|
// jump to next sibling
|
8835
|
i += nodeDef.childCount;
|
8836
|
}
|
8837
|
}
|
8838
|
/**
|
8839
|
* @param {?} view
|
8840
|
* @param {?} ngContentIndex
|
8841
|
* @param {?} action
|
8842
|
* @param {?} parentNode
|
8843
|
* @param {?} nextSibling
|
8844
|
* @param {?=} target
|
8845
|
* @return {?}
|
8846
|
*/
|
8847
|
function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
|
8848
|
var /** @type {?} */ compView = view;
|
8849
|
while (compView && !isComponentView(compView)) {
|
8850
|
compView = compView.parent;
|
8851
|
}
|
8852
|
var /** @type {?} */ hostView = ((compView)).parent;
|
8853
|
var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView)));
|
8854
|
var /** @type {?} */ startIndex = ((hostElDef)).nodeIndex + 1;
|
8855
|
var /** @type {?} */ endIndex = ((hostElDef)).nodeIndex + ((hostElDef)).childCount;
|
8856
|
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
|
8857
|
var /** @type {?} */ nodeDef = ((hostView)).def.nodes[i];
|
8858
|
if (nodeDef.ngContentIndex === ngContentIndex) {
|
8859
|
visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target);
|
8860
|
}
|
8861
|
// jump to next sibling
|
8862
|
i += nodeDef.childCount;
|
8863
|
}
|
8864
|
if (!((hostView)).parent) {
|
8865
|
// a root view
|
8866
|
var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex];
|
8867
|
if (projectedNodes) {
|
8868
|
for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) {
|
8869
|
execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
|
8870
|
}
|
8871
|
}
|
8872
|
}
|
8873
|
}
|
8874
|
/**
|
8875
|
* @param {?} view
|
8876
|
* @param {?} nodeDef
|
8877
|
* @param {?} action
|
8878
|
* @param {?} parentNode
|
8879
|
* @param {?} nextSibling
|
8880
|
* @param {?=} target
|
8881
|
* @return {?}
|
8882
|
*/
|
8883
|
function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
|
8884
|
if (nodeDef.flags & 8 /* TypeNgContent */) {
|
8885
|
visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
|
8886
|
}
|
8887
|
else {
|
8888
|
var /** @type {?} */ rn = renderNode(view, nodeDef);
|
8889
|
if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) &&
|
8890
|
(nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) {
|
8891
|
// Note: we might need to do both actions.
|
8892
|
if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) {
|
8893
|
execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
8894
|
}
|
8895
|
if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) {
|
8896
|
var /** @type {?} */ compView = asElementData(view, nodeDef.nodeIndex).componentView;
|
8897
|
execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
|
8898
|
}
|
8899
|
}
|
8900
|
else {
|
8901
|
execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
8902
|
}
|
8903
|
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
|
8904
|
var /** @type {?} */ embeddedViews = ((asElementData(view, nodeDef.nodeIndex).viewContainer))._embeddedViews;
|
8905
|
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
|
8906
|
visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
|
8907
|
}
|
8908
|
}
|
8909
|
if (nodeDef.flags & 1 /* TypeElement */ && !((nodeDef.element)).name) {
|
8910
|
visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
|
8911
|
}
|
8912
|
}
|
8913
|
}
|
8914
|
/**
|
8915
|
* @param {?} view
|
8916
|
* @param {?} renderNode
|
8917
|
* @param {?} action
|
8918
|
* @param {?} parentNode
|
8919
|
* @param {?} nextSibling
|
8920
|
* @param {?=} target
|
8921
|
* @return {?}
|
8922
|
*/
|
8923
|
function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
|
8924
|
var /** @type {?} */ renderer = view.renderer;
|
8925
|
switch (action) {
|
8926
|
case 1 /* AppendChild */:
|
8927
|
renderer.appendChild(parentNode, renderNode);
|
8928
|
break;
|
8929
|
case 2 /* InsertBefore */:
|
8930
|
renderer.insertBefore(parentNode, renderNode, nextSibling);
|
8931
|
break;
|
8932
|
case 3 /* RemoveChild */:
|
8933
|
renderer.removeChild(parentNode, renderNode);
|
8934
|
break;
|
8935
|
case 0 /* Collect */:
|
8936
|
((target)).push(renderNode);
|
8937
|
break;
|
8938
|
}
|
8939
|
}
|
8940
|
var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
|
8941
|
/**
|
8942
|
* @param {?} name
|
8943
|
* @return {?}
|
8944
|
*/
|
8945
|
function splitNamespace(name) {
|
8946
|
if (name[0] === ':') {
|
8947
|
var /** @type {?} */ match = ((name.match(NS_PREFIX_RE)));
|
8948
|
return [match[1], match[2]];
|
8949
|
}
|
8950
|
return ['', name];
|
8951
|
}
|
8952
|
/**
|
8953
|
* @param {?} bindings
|
8954
|
* @return {?}
|
8955
|
*/
|
8956
|
function calcBindingFlags(bindings) {
|
8957
|
var /** @type {?} */ flags = 0;
|
8958
|
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
|
8959
|
flags |= bindings[i].flags;
|
8960
|
}
|
8961
|
return flags;
|
8962
|
}
|
8963
|
/**
|
8964
|
* @param {?} valueCount
|
8965
|
* @param {?} constAndInterp
|
8966
|
* @return {?}
|
8967
|
*/
|
8968
|
function interpolate(valueCount, constAndInterp) {
|
8969
|
var /** @type {?} */ result = '';
|
8970
|
for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) {
|
8971
|
result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
|
8972
|
}
|
8973
|
return result + constAndInterp[valueCount * 2];
|
8974
|
}
|
8975
|
/**
|
8976
|
* @param {?} valueCount
|
8977
|
* @param {?} c0
|
8978
|
* @param {?} a1
|
8979
|
* @param {?} c1
|
8980
|
* @param {?=} a2
|
8981
|
* @param {?=} c2
|
8982
|
* @param {?=} a3
|
8983
|
* @param {?=} c3
|
8984
|
* @param {?=} a4
|
8985
|
* @param {?=} c4
|
8986
|
* @param {?=} a5
|
8987
|
* @param {?=} c5
|
8988
|
* @param {?=} a6
|
8989
|
* @param {?=} c6
|
8990
|
* @param {?=} a7
|
8991
|
* @param {?=} c7
|
8992
|
* @param {?=} a8
|
8993
|
* @param {?=} c8
|
8994
|
* @param {?=} a9
|
8995
|
* @param {?=} c9
|
8996
|
* @return {?}
|
8997
|
*/
|
8998
|
function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
|
8999
|
switch (valueCount) {
|
9000
|
case 1:
|
9001
|
return c0 + _toStringWithNull(a1) + c1;
|
9002
|
case 2:
|
9003
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
|
9004
|
case 3:
|
9005
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9006
|
c3;
|
9007
|
case 4:
|
9008
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9009
|
c3 + _toStringWithNull(a4) + c4;
|
9010
|
case 5:
|
9011
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9012
|
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
9013
|
case 6:
|
9014
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9015
|
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
|
9016
|
case 7:
|
9017
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9018
|
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9019
|
c6 + _toStringWithNull(a7) + c7;
|
9020
|
case 8:
|
9021
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9022
|
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9023
|
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
9024
|
case 9:
|
9025
|
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9026
|
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9027
|
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
|
9028
|
default:
|
9029
|
throw new Error("Does not support more than 9 expressions");
|
9030
|
}
|
9031
|
}
|
9032
|
/**
|
9033
|
* @param {?} v
|
9034
|
* @return {?}
|
9035
|
*/
|
9036
|
function _toStringWithNull(v) {
|
9037
|
return v != null ? v.toString() : '';
|
9038
|
}
|
9039
|
var EMPTY_ARRAY = [];
|
9040
|
var EMPTY_MAP = {};
|
9041
|
/**
|
9042
|
* @license
|
9043
|
* Copyright Google Inc. All Rights Reserved.
|
9044
|
*
|
9045
|
* Use of this source code is governed by an MIT-style license that can be
|
9046
|
* found in the LICENSE file at https://angular.io/license
|
9047
|
*/
|
9048
|
/**
|
9049
|
* @param {?} flags
|
9050
|
* @param {?} matchedQueriesDsl
|
9051
|
* @param {?} ngContentIndex
|
9052
|
* @param {?} childCount
|
9053
|
* @param {?=} handleEvent
|
9054
|
* @param {?=} templateFactory
|
9055
|
* @return {?}
|
9056
|
*/
|
9057
|
function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
|
9058
|
flags |= 1 /* TypeElement */;
|
9059
|
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
9060
|
var /** @type {?} */ template = templateFactory ? resolveDefinition(templateFactory) : null;
|
9061
|
return {
|
9062
|
// will bet set by the view definition
|
9063
|
nodeIndex: -1,
|
9064
|
parent: null,
|
9065
|
renderParent: null,
|
9066
|
bindingIndex: -1,
|
9067
|
outputIndex: -1,
|
9068
|
// regular values
|
9069
|
flags: flags,
|
9070
|
checkIndex: -1,
|
9071
|
childFlags: 0,
|
9072
|
directChildFlags: 0,
|
9073
|
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
|
9074
|
bindings: [],
|
9075
|
bindingFlags: 0,
|
9076
|
outputs: [],
|
9077
|
element: {
|
9078
|
ns: null,
|
9079
|
name: null,
|
9080
|
attrs: null, template: template,
|
9081
|
componentProvider: null,
|
9082
|
componentView: null,
|
9083
|
componentRendererType: null,
|
9084
|
publicProviders: null,
|
9085
|
allProviders: null,
|
9086
|
handleEvent: handleEvent || NOOP
|
9087
|
},
|
9088
|
provider: null,
|
9089
|
text: null,
|
9090
|
query: null,
|
9091
|
ngContent: null
|
9092
|
};
|
9093
|
}
|
9094
|
/**
|
9095
|
* @param {?} checkIndex
|
9096
|
* @param {?} flags
|
9097
|
* @param {?} matchedQueriesDsl
|
9098
|
* @param {?} ngContentIndex
|
9099
|
* @param {?} childCount
|
9100
|
* @param {?} namespaceAndName
|
9101
|
* @param {?=} fixedAttrs
|
9102
|
* @param {?=} bindings
|
9103
|
* @param {?=} outputs
|
9104
|
* @param {?=} handleEvent
|
9105
|
* @param {?=} componentView
|
9106
|
* @param {?=} componentRendererType
|
9107
|
* @return {?}
|
9108
|
*/
|
9109
|
function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
|
9110
|
if (fixedAttrs === void 0) { fixedAttrs = []; }
|
9111
|
if (!handleEvent) {
|
9112
|
handleEvent = NOOP;
|
9113
|
}
|
9114
|
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
9115
|
var /** @type {?} */ ns = ((null));
|
9116
|
var /** @type {?} */ name = ((null));
|
9117
|
if (namespaceAndName) {
|
9118
|
_b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
|
9119
|
}
|
9120
|
bindings = bindings || [];
|
9121
|
var /** @type {?} */ bindingDefs = new Array(bindings.length);
|
9122
|
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
|
9123
|
var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
|
9124
|
var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
|
9125
|
var /** @type {?} */ securityContext = ((undefined));
|
9126
|
var /** @type {?} */ suffix = ((undefined));
|
9127
|
switch (bindingFlags & 15 /* Types */) {
|
9128
|
case 4 /* TypeElementStyle */:
|
9129
|
suffix = (suffixOrSecurityContext);
|
9130
|
break;
|
9131
|
case 1 /* TypeElementAttribute */:
|
9132
|
case 8 /* TypeProperty */:
|
9133
|
securityContext = (suffixOrSecurityContext);
|
9134
|
break;
|
9135
|
}
|
9136
|
bindingDefs[i] =
|
9137
|
{ flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
|
9138
|
}
|
9139
|
outputs = outputs || [];
|
9140
|
var /** @type {?} */ outputDefs = new Array(outputs.length);
|
9141
|
for (var /** @type {?} */ i = 0; i < outputs.length; i++) {
|
9142
|
var _e = outputs[i], target = _e[0], eventName = _e[1];
|
9143
|
outputDefs[i] = {
|
9144
|
type: 0 /* ElementOutput */,
|
9145
|
target: /** @type {?} */ (target), eventName: eventName,
|
9146
|
propName: null
|
9147
|
};
|
9148
|
}
|
9149
|
fixedAttrs = fixedAttrs || [];
|
9150
|
var /** @type {?} */ attrs = (fixedAttrs.map(function (_a) {
|
9151
|
var namespaceAndName = _a[0], value = _a[1];
|
9152
|
var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
|
9153
|
return [ns, name, value];
|
9154
|
}));
|
9155
|
componentRendererType = resolveRendererType2(componentRendererType);
|
9156
|
if (componentView) {
|
9157
|
flags |= 33554432 /* ComponentView */;
|
9158
|
}
|
9159
|
flags |= 1 /* TypeElement */;
|
9160
|
return {
|
9161
|
// will bet set by the view definition
|
9162
|
nodeIndex: -1,
|
9163
|
parent: null,
|
9164
|
renderParent: null,
|
9165
|
bindingIndex: -1,
|
9166
|
outputIndex: -1,
|
9167
|
// regular values
|
9168
|
checkIndex: checkIndex,
|
9169
|
flags: flags,
|
9170
|
childFlags: 0,
|
9171
|
directChildFlags: 0,
|
9172
|
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
|
9173
|
bindings: bindingDefs,
|
9174
|
bindingFlags: calcBindingFlags(bindingDefs),
|
9175
|
outputs: outputDefs,
|
9176
|
element: {
|
9177
|
ns: ns,
|
9178
|
name: name,
|
9179
|
attrs: attrs,
|
9180
|
template: null,
|
9181
|
// will bet set by the view definition
|
9182
|
componentProvider: null,
|
9183
|
componentView: componentView || null,
|
9184
|
componentRendererType: componentRendererType,
|
9185
|
publicProviders: null,
|
9186
|
allProviders: null,
|
9187
|
handleEvent: handleEvent || NOOP,
|
9188
|
},
|
9189
|
provider: null,
|
9190
|
text: null,
|
9191
|
query: null,
|
9192
|
ngContent: null
|
9193
|
};
|
9194
|
var _b;
|
9195
|
}
|
9196
|
/**
|
9197
|
* @param {?} view
|
9198
|
* @param {?} renderHost
|
9199
|
* @param {?} def
|
9200
|
* @return {?}
|
9201
|
*/
|
9202
|
function createElement(view, renderHost, def) {
|
9203
|
var /** @type {?} */ elDef = ((def.element));
|
9204
|
var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode;
|
9205
|
var /** @type {?} */ renderer = view.renderer;
|
9206
|
var /** @type {?} */ el;
|
9207
|
if (view.parent || !rootSelectorOrNode) {
|
9208
|
if (elDef.name) {
|
9209
|
el = renderer.createElement(elDef.name, elDef.ns);
|
9210
|
}
|
9211
|
else {
|
9212
|
el = renderer.createComment('');
|
9213
|
}
|
9214
|
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
|
9215
|
if (parentEl) {
|
9216
|
renderer.appendChild(parentEl, el);
|
9217
|
}
|
9218
|
}
|
9219
|
else {
|
9220
|
el = renderer.selectRootElement(rootSelectorOrNode);
|
9221
|
}
|
9222
|
if (elDef.attrs) {
|
9223
|
for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) {
|
9224
|
var _a = elDef.attrs[i], ns = _a[0], name = _a[1], value = _a[2];
|
9225
|
renderer.setAttribute(el, name, value, ns);
|
9226
|
}
|
9227
|
}
|
9228
|
return el;
|
9229
|
}
|
9230
|
/**
|
9231
|
* @param {?} view
|
9232
|
* @param {?} compView
|
9233
|
* @param {?} def
|
9234
|
* @param {?} el
|
9235
|
* @return {?}
|
9236
|
*/
|
9237
|
function listenToElementOutputs(view, compView, def, el) {
|
9238
|
for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
|
9239
|
var /** @type {?} */ output = def.outputs[i];
|
9240
|
var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
|
9241
|
var /** @type {?} */ listenTarget = output.target;
|
9242
|
var /** @type {?} */ listenerView = view;
|
9243
|
if (output.target === 'component') {
|
9244
|
listenTarget = null;
|
9245
|
listenerView = compView;
|
9246
|
}
|
9247
|
var /** @type {?} */ disposable = (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */
|
9248
|
((view.disposables))[def.outputIndex + i] = disposable;
|
9249
|
}
|
9250
|
}
|
9251
|
/**
|
9252
|
* @param {?} view
|
9253
|
* @param {?} index
|
9254
|
* @param {?} eventName
|
9255
|
* @return {?}
|
9256
|
*/
|
9257
|
function renderEventHandlerClosure(view, index, eventName) {
|
9258
|
return function (event) {
|
9259
|
try {
|
9260
|
return dispatchEvent(view, index, eventName, event);
|
9261
|
}
|
9262
|
catch (e) {
|
9263
|
// Attention: Don't rethrow, to keep in sync with directive events.
|
9264
|
view.root.errorHandler.handleError(e);
|
9265
|
}
|
9266
|
};
|
9267
|
}
|
9268
|
/**
|
9269
|
* @param {?} view
|
9270
|
* @param {?} def
|
9271
|
* @param {?} v0
|
9272
|
* @param {?} v1
|
9273
|
* @param {?} v2
|
9274
|
* @param {?} v3
|
9275
|
* @param {?} v4
|
9276
|
* @param {?} v5
|
9277
|
* @param {?} v6
|
9278
|
* @param {?} v7
|
9279
|
* @param {?} v8
|
9280
|
* @param {?} v9
|
9281
|
* @return {?}
|
9282
|
*/
|
9283
|
function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
9284
|
var /** @type {?} */ bindLen = def.bindings.length;
|
9285
|
var /** @type {?} */ changed = false;
|
9286
|
if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
|
9287
|
changed = true;
|
9288
|
if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
|
9289
|
changed = true;
|
9290
|
if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
|
9291
|
changed = true;
|
9292
|
if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
|
9293
|
changed = true;
|
9294
|
if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
|
9295
|
changed = true;
|
9296
|
if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
|
9297
|
changed = true;
|
9298
|
if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
|
9299
|
changed = true;
|
9300
|
if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
|
9301
|
changed = true;
|
9302
|
if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
|
9303
|
changed = true;
|
9304
|
if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
|
9305
|
changed = true;
|
9306
|
return changed;
|
9307
|
}
|
9308
|
/**
|
9309
|
* @param {?} view
|
9310
|
* @param {?} def
|
9311
|
* @param {?} values
|
9312
|
* @return {?}
|
9313
|
*/
|
9314
|
function checkAndUpdateElementDynamic(view, def, values) {
|
9315
|
var /** @type {?} */ changed = false;
|
9316
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
9317
|
if (checkAndUpdateElementValue(view, def, i, values[i]))
|
9318
|
changed = true;
|
9319
|
}
|
9320
|
return changed;
|
9321
|
}
|
9322
|
/**
|
9323
|
* @param {?} view
|
9324
|
* @param {?} def
|
9325
|
* @param {?} bindingIdx
|
9326
|
* @param {?} value
|
9327
|
* @return {?}
|
9328
|
*/
|
9329
|
function checkAndUpdateElementValue(view, def, bindingIdx, value) {
|
9330
|
if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
|
9331
|
return false;
|
9332
|
}
|
9333
|
var /** @type {?} */ binding = def.bindings[bindingIdx];
|
9334
|
var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
|
9335
|
var /** @type {?} */ renderNode$$1 = elData.renderElement;
|
9336
|
var /** @type {?} */ name = ((binding.name));
|
9337
|
switch (binding.flags & 15 /* Types */) {
|
9338
|
case 1 /* TypeElementAttribute */:
|
9339
|
setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
|
9340
|
break;
|
9341
|
case 2 /* TypeElementClass */:
|
9342
|
setElementClass(view, renderNode$$1, name, value);
|
9343
|
break;
|
9344
|
case 4 /* TypeElementStyle */:
|
9345
|
setElementStyle(view, binding, renderNode$$1, name, value);
|
9346
|
break;
|
9347
|
case 8 /* TypeProperty */:
|
9348
|
var /** @type {?} */ bindView = (def.flags & 33554432 /* ComponentView */ &&
|
9349
|
binding.flags & 32 /* SyntheticHostProperty */) ?
|
9350
|
elData.componentView :
|
9351
|
view;
|
9352
|
setElementProperty(bindView, binding, renderNode$$1, name, value);
|
9353
|
break;
|
9354
|
}
|
9355
|
return true;
|
9356
|
}
|
9357
|
/**
|
9358
|
* @param {?} view
|
9359
|
* @param {?} binding
|
9360
|
* @param {?} renderNode
|
9361
|
* @param {?} ns
|
9362
|
* @param {?} name
|
9363
|
* @param {?} value
|
9364
|
* @return {?}
|
9365
|
*/
|
9366
|
function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
|
9367
|
var /** @type {?} */ securityContext = binding.securityContext;
|
9368
|
var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
9369
|
renderValue = renderValue != null ? renderValue.toString() : null;
|
9370
|
var /** @type {?} */ renderer = view.renderer;
|
9371
|
if (value != null) {
|
9372
|
renderer.setAttribute(renderNode$$1, name, renderValue, ns);
|
9373
|
}
|
9374
|
else {
|
9375
|
renderer.removeAttribute(renderNode$$1, name, ns);
|
9376
|
}
|
9377
|
}
|
9378
|
/**
|
9379
|
* @param {?} view
|
9380
|
* @param {?} renderNode
|
9381
|
* @param {?} name
|
9382
|
* @param {?} value
|
9383
|
* @return {?}
|
9384
|
*/
|
9385
|
function setElementClass(view, renderNode$$1, name, value) {
|
9386
|
var /** @type {?} */ renderer = view.renderer;
|
9387
|
if (value) {
|
9388
|
renderer.addClass(renderNode$$1, name);
|
9389
|
}
|
9390
|
else {
|
9391
|
renderer.removeClass(renderNode$$1, name);
|
9392
|
}
|
9393
|
}
|
9394
|
/**
|
9395
|
* @param {?} view
|
9396
|
* @param {?} binding
|
9397
|
* @param {?} renderNode
|
9398
|
* @param {?} name
|
9399
|
* @param {?} value
|
9400
|
* @return {?}
|
9401
|
*/
|
9402
|
function setElementStyle(view, binding, renderNode$$1, name, value) {
|
9403
|
var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value));
|
9404
|
if (renderValue != null) {
|
9405
|
renderValue = renderValue.toString();
|
9406
|
var /** @type {?} */ unit = binding.suffix;
|
9407
|
if (unit != null) {
|
9408
|
renderValue = renderValue + unit;
|
9409
|
}
|
9410
|
}
|
9411
|
else {
|
9412
|
renderValue = null;
|
9413
|
}
|
9414
|
var /** @type {?} */ renderer = view.renderer;
|
9415
|
if (renderValue != null) {
|
9416
|
renderer.setStyle(renderNode$$1, name, renderValue);
|
9417
|
}
|
9418
|
else {
|
9419
|
renderer.removeStyle(renderNode$$1, name);
|
9420
|
}
|
9421
|
}
|
9422
|
/**
|
9423
|
* @param {?} view
|
9424
|
* @param {?} binding
|
9425
|
* @param {?} renderNode
|
9426
|
* @param {?} name
|
9427
|
* @param {?} value
|
9428
|
* @return {?}
|
9429
|
*/
|
9430
|
function setElementProperty(view, binding, renderNode$$1, name, value) {
|
9431
|
var /** @type {?} */ securityContext = binding.securityContext;
|
9432
|
var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
9433
|
view.renderer.setProperty(renderNode$$1, name, renderValue);
|
9434
|
}
|
9435
|
/**
|
9436
|
* @license
|
9437
|
* Copyright Google Inc. All Rights Reserved.
|
9438
|
*
|
9439
|
* Use of this source code is governed by an MIT-style license that can be
|
9440
|
* found in the LICENSE file at https://angular.io/license
|
9441
|
*/
|
9442
|
var UNDEFINED_VALUE = new Object();
|
9443
|
var InjectorRefTokenKey$1 = tokenKey(Injector);
|
9444
|
var NgModuleRefTokenKey = tokenKey(NgModuleRef);
|
9445
|
/**
|
9446
|
* @param {?} flags
|
9447
|
* @param {?} token
|
9448
|
* @param {?} value
|
9449
|
* @param {?} deps
|
9450
|
* @return {?}
|
9451
|
*/
|
9452
|
function moduleProvideDef(flags, token, value, deps) {
|
9453
|
var /** @type {?} */ depDefs = splitDepsDsl(deps);
|
9454
|
return {
|
9455
|
// will bet set by the module definition
|
9456
|
index: -1,
|
9457
|
deps: depDefs, flags: flags, token: token, value: value
|
9458
|
};
|
9459
|
}
|
9460
|
/**
|
9461
|
* @param {?} providers
|
9462
|
* @return {?}
|
9463
|
*/
|
9464
|
function moduleDef(providers) {
|
9465
|
var /** @type {?} */ providersByKey = {};
|
9466
|
for (var /** @type {?} */ i = 0; i < providers.length; i++) {
|
9467
|
var /** @type {?} */ provider = providers[i];
|
9468
|
provider.index = i;
|
9469
|
providersByKey[tokenKey(provider.token)] = provider;
|
9470
|
}
|
9471
|
return {
|
9472
|
// Will be filled later...
|
9473
|
factory: null,
|
9474
|
providersByKey: providersByKey,
|
9475
|
providers: providers
|
9476
|
};
|
9477
|
}
|
9478
|
/**
|
9479
|
* @param {?} data
|
9480
|
* @return {?}
|
9481
|
*/
|
9482
|
function initNgModule(data) {
|
9483
|
var /** @type {?} */ def = data._def;
|
9484
|
var /** @type {?} */ providers = data._providers = new Array(def.providers.length);
|
9485
|
for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
|
9486
|
var /** @type {?} */ provDef = def.providers[i];
|
9487
|
if (!(provDef.flags & 4096 /* LazyProvider */)) {
|
9488
|
providers[i] = _createProviderInstance$1(data, provDef);
|
9489
|
}
|
9490
|
}
|
9491
|
}
|
9492
|
/**
|
9493
|
* @param {?} data
|
9494
|
* @param {?} depDef
|
9495
|
* @param {?=} notFoundValue
|
9496
|
* @return {?}
|
9497
|
*/
|
9498
|
function resolveNgModuleDep(data, depDef, notFoundValue) {
|
9499
|
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
9500
|
if (depDef.flags & 8 /* Value */) {
|
9501
|
return depDef.token;
|
9502
|
}
|
9503
|
if (depDef.flags & 2 /* Optional */) {
|
9504
|
notFoundValue = null;
|
9505
|
}
|
9506
|
if (depDef.flags & 1 /* SkipSelf */) {
|
9507
|
return data._parent.get(depDef.token, notFoundValue);
|
9508
|
}
|
9509
|
var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
|
9510
|
switch (tokenKey$$1) {
|
9511
|
case InjectorRefTokenKey$1:
|
9512
|
case NgModuleRefTokenKey:
|
9513
|
return data;
|
9514
|
}
|
9515
|
var /** @type {?} */ providerDef = data._def.providersByKey[tokenKey$$1];
|
9516
|
if (providerDef) {
|
9517
|
var /** @type {?} */ providerInstance = data._providers[providerDef.index];
|
9518
|
if (providerInstance === undefined) {
|
9519
|
providerInstance = data._providers[providerDef.index] =
|
9520
|
_createProviderInstance$1(data, providerDef);
|
9521
|
}
|
9522
|
return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
|
9523
|
}
|
9524
|
return data._parent.get(depDef.token, notFoundValue);
|
9525
|
}
|
9526
|
/**
|
9527
|
* @param {?} ngModule
|
9528
|
* @param {?} providerDef
|
9529
|
* @return {?}
|
9530
|
*/
|
9531
|
function _createProviderInstance$1(ngModule, providerDef) {
|
9532
|
var /** @type {?} */ injectable;
|
9533
|
switch (providerDef.flags & 201347067 /* Types */) {
|
9534
|
case 512 /* TypeClassProvider */:
|
9535
|
injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
|
9536
|
break;
|
9537
|
case 1024 /* TypeFactoryProvider */:
|
9538
|
injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
|
9539
|
break;
|
9540
|
case 2048 /* TypeUseExistingProvider */:
|
9541
|
injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
|
9542
|
break;
|
9543
|
case 256 /* TypeValueProvider */:
|
9544
|
injectable = providerDef.value;
|
9545
|
break;
|
9546
|
}
|
9547
|
return injectable === undefined ? UNDEFINED_VALUE : injectable;
|
9548
|
}
|
9549
|
/**
|
9550
|
* @param {?} ngModule
|
9551
|
* @param {?} ctor
|
9552
|
* @param {?} deps
|
9553
|
* @return {?}
|
9554
|
*/
|
9555
|
function _createClass(ngModule, ctor, deps) {
|
9556
|
var /** @type {?} */ len = deps.length;
|
9557
|
switch (len) {
|
9558
|
case 0:
|
9559
|
return new ctor();
|
9560
|
case 1:
|
9561
|
return new ctor(resolveNgModuleDep(ngModule, deps[0]));
|
9562
|
case 2:
|
9563
|
return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
9564
|
case 3:
|
9565
|
return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
9566
|
default:
|
9567
|
var /** @type {?} */ depValues = new Array(len);
|
9568
|
for (var /** @type {?} */ i = 0; i < len; i++) {
|
9569
|
depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
9570
|
}
|
9571
|
return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
|
9572
|
}
|
9573
|
}
|
9574
|
/**
|
9575
|
* @param {?} ngModule
|
9576
|
* @param {?} factory
|
9577
|
* @param {?} deps
|
9578
|
* @return {?}
|
9579
|
*/
|
9580
|
function _callFactory(ngModule, factory, deps) {
|
9581
|
var /** @type {?} */ len = deps.length;
|
9582
|
switch (len) {
|
9583
|
case 0:
|
9584
|
return factory();
|
9585
|
case 1:
|
9586
|
return factory(resolveNgModuleDep(ngModule, deps[0]));
|
9587
|
case 2:
|
9588
|
return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
9589
|
case 3:
|
9590
|
return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
9591
|
default:
|
9592
|
var /** @type {?} */ depValues = Array(len);
|
9593
|
for (var /** @type {?} */ i = 0; i < len; i++) {
|
9594
|
depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
9595
|
}
|
9596
|
return factory.apply(void 0, depValues);
|
9597
|
}
|
9598
|
}
|
9599
|
/**
|
9600
|
* @param {?} ngModule
|
9601
|
* @param {?} lifecycles
|
9602
|
* @return {?}
|
9603
|
*/
|
9604
|
function callNgModuleLifecycle(ngModule, lifecycles) {
|
9605
|
var /** @type {?} */ def = ngModule._def;
|
9606
|
for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
|
9607
|
var /** @type {?} */ provDef = def.providers[i];
|
9608
|
if (provDef.flags & 131072 /* OnDestroy */) {
|
9609
|
var /** @type {?} */ instance = ngModule._providers[i];
|
9610
|
if (instance && instance !== UNDEFINED_VALUE) {
|
9611
|
instance.ngOnDestroy();
|
9612
|
}
|
9613
|
}
|
9614
|
}
|
9615
|
}
|
9616
|
/**
|
9617
|
* @license
|
9618
|
* Copyright Google Inc. All Rights Reserved.
|
9619
|
*
|
9620
|
* Use of this source code is governed by an MIT-style license that can be
|
9621
|
* found in the LICENSE file at https://angular.io/license
|
9622
|
*/
|
9623
|
/**
|
9624
|
* @param {?} parentView
|
9625
|
* @param {?} elementData
|
9626
|
* @param {?} viewIndex
|
9627
|
* @param {?} view
|
9628
|
* @return {?}
|
9629
|
*/
|
9630
|
function attachEmbeddedView(parentView, elementData, viewIndex, view) {
|
9631
|
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9632
|
if (viewIndex === null || viewIndex === undefined) {
|
9633
|
viewIndex = embeddedViews.length;
|
9634
|
}
|
9635
|
view.viewContainerParent = parentView;
|
9636
|
addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view);
|
9637
|
attachProjectedView(elementData, view);
|
9638
|
Services.dirtyParentQueries(view);
|
9639
|
var /** @type {?} */ prevView = ((viewIndex)) > 0 ? embeddedViews[((viewIndex)) - 1] : null;
|
9640
|
renderAttachEmbeddedView(elementData, prevView, view);
|
9641
|
}
|
9642
|
/**
|
9643
|
* @param {?} vcElementData
|
9644
|
* @param {?} view
|
9645
|
* @return {?}
|
9646
|
*/
|
9647
|
function attachProjectedView(vcElementData, view) {
|
9648
|
var /** @type {?} */ dvcElementData = declaredViewContainer(view);
|
9649
|
if (!dvcElementData || dvcElementData === vcElementData ||
|
9650
|
view.state & 16 /* IsProjectedView */) {
|
9651
|
return;
|
9652
|
}
|
9653
|
// Note: For performance reasons, we
|
9654
|
// - add a view to template._projectedViews only 1x throughout its lifetime,
|
9655
|
// and remove it not until the view is destroyed.
|
9656
|
// (hard, as when a parent view is attached/detached we would need to attach/detach all
|
9657
|
// nested projected views as well, even accross component boundaries).
|
9658
|
// - don't track the insertion order of views in the projected views array
|
9659
|
// (hard, as when the views of the same template are inserted different view containers)
|
9660
|
view.state |= 16 /* IsProjectedView */;
|
9661
|
var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
|
9662
|
if (!projectedViews) {
|
9663
|
projectedViews = dvcElementData.template._projectedViews = [];
|
9664
|
}
|
9665
|
projectedViews.push(view);
|
9666
|
// Note: we are changing the NodeDef here as we cannot calculate
|
9667
|
// the fact whether a template is used for projection during compilation.
|
9668
|
markNodeAsProjectedTemplate(/** @type {?} */ ((view.parent)).def, /** @type {?} */ ((view.parentNodeDef)));
|
9669
|
}
|
9670
|
/**
|
9671
|
* @param {?} viewDef
|
9672
|
* @param {?} nodeDef
|
9673
|
* @return {?}
|
9674
|
*/
|
9675
|
function markNodeAsProjectedTemplate(viewDef, nodeDef) {
|
9676
|
if (nodeDef.flags & 4 /* ProjectedTemplate */) {
|
9677
|
return;
|
9678
|
}
|
9679
|
viewDef.nodeFlags |= 4 /* ProjectedTemplate */;
|
9680
|
nodeDef.flags |= 4 /* ProjectedTemplate */;
|
9681
|
var /** @type {?} */ parentNodeDef = nodeDef.parent;
|
9682
|
while (parentNodeDef) {
|
9683
|
parentNodeDef.childFlags |= 4 /* ProjectedTemplate */;
|
9684
|
parentNodeDef = parentNodeDef.parent;
|
9685
|
}
|
9686
|
}
|
9687
|
/**
|
9688
|
* @param {?} elementData
|
9689
|
* @param {?=} viewIndex
|
9690
|
* @return {?}
|
9691
|
*/
|
9692
|
function detachEmbeddedView(elementData, viewIndex) {
|
9693
|
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9694
|
if (viewIndex == null || viewIndex >= embeddedViews.length) {
|
9695
|
viewIndex = embeddedViews.length - 1;
|
9696
|
}
|
9697
|
if (viewIndex < 0) {
|
9698
|
return null;
|
9699
|
}
|
9700
|
var /** @type {?} */ view = embeddedViews[viewIndex];
|
9701
|
view.viewContainerParent = null;
|
9702
|
removeFromArray(embeddedViews, viewIndex);
|
9703
|
// See attachProjectedView for why we don't update projectedViews here.
|
9704
|
Services.dirtyParentQueries(view);
|
9705
|
renderDetachView(view);
|
9706
|
return view;
|
9707
|
}
|
9708
|
/**
|
9709
|
* @param {?} view
|
9710
|
* @return {?}
|
9711
|
*/
|
9712
|
function detachProjectedView(view) {
|
9713
|
if (!(view.state & 16 /* IsProjectedView */)) {
|
9714
|
return;
|
9715
|
}
|
9716
|
var /** @type {?} */ dvcElementData = declaredViewContainer(view);
|
9717
|
if (dvcElementData) {
|
9718
|
var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
|
9719
|
if (projectedViews) {
|
9720
|
removeFromArray(projectedViews, projectedViews.indexOf(view));
|
9721
|
Services.dirtyParentQueries(view);
|
9722
|
}
|
9723
|
}
|
9724
|
}
|
9725
|
/**
|
9726
|
* @param {?} elementData
|
9727
|
* @param {?} oldViewIndex
|
9728
|
* @param {?} newViewIndex
|
9729
|
* @return {?}
|
9730
|
*/
|
9731
|
function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
|
9732
|
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9733
|
var /** @type {?} */ view = embeddedViews[oldViewIndex];
|
9734
|
removeFromArray(embeddedViews, oldViewIndex);
|
9735
|
if (newViewIndex == null) {
|
9736
|
newViewIndex = embeddedViews.length;
|
9737
|
}
|
9738
|
addToArray(embeddedViews, newViewIndex, view);
|
9739
|
// Note: Don't need to change projectedViews as the order in there
|
9740
|
// as always invalid...
|
9741
|
Services.dirtyParentQueries(view);
|
9742
|
renderDetachView(view);
|
9743
|
var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
|
9744
|
renderAttachEmbeddedView(elementData, prevView, view);
|
9745
|
return view;
|
9746
|
}
|
9747
|
/**
|
9748
|
* @param {?} elementData
|
9749
|
* @param {?} prevView
|
9750
|
* @param {?} view
|
9751
|
* @return {?}
|
9752
|
*/
|
9753
|
function renderAttachEmbeddedView(elementData, prevView, view) {
|
9754
|
var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) :
|
9755
|
elementData.renderElement;
|
9756
|
var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode);
|
9757
|
var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode);
|
9758
|
// Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be!
|
9759
|
// However, browsers automatically do `appendChild` when there is no `nextSibling`.
|
9760
|
visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined);
|
9761
|
}
|
9762
|
/**
|
9763
|
* @param {?} view
|
9764
|
* @return {?}
|
9765
|
*/
|
9766
|
function renderDetachView(view) {
|
9767
|
visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined);
|
9768
|
}
|
9769
|
/**
|
9770
|
* @param {?} arr
|
9771
|
* @param {?} index
|
9772
|
* @param {?} value
|
9773
|
* @return {?}
|
9774
|
*/
|
9775
|
function addToArray(arr, index, value) {
|
9776
|
// perf: array.push is faster than array.splice!
|
9777
|
if (index >= arr.length) {
|
9778
|
arr.push(value);
|
9779
|
}
|
9780
|
else {
|
9781
|
arr.splice(index, 0, value);
|
9782
|
}
|
9783
|
}
|
9784
|
/**
|
9785
|
* @param {?} arr
|
9786
|
* @param {?} index
|
9787
|
* @return {?}
|
9788
|
*/
|
9789
|
function removeFromArray(arr, index) {
|
9790
|
// perf: array.pop is faster than array.splice!
|
9791
|
if (index >= arr.length - 1) {
|
9792
|
arr.pop();
|
9793
|
}
|
9794
|
else {
|
9795
|
arr.splice(index, 1);
|
9796
|
}
|
9797
|
}
|
9798
|
/**
|
9799
|
* @license
|
9800
|
* Copyright Google Inc. All Rights Reserved.
|
9801
|
*
|
9802
|
* Use of this source code is governed by an MIT-style license that can be
|
9803
|
* found in the LICENSE file at https://angular.io/license
|
9804
|
*/
|
9805
|
var EMPTY_CONTEXT = new Object();
|
9806
|
/**
|
9807
|
* @param {?} selector
|
9808
|
* @param {?} componentType
|
9809
|
* @param {?} viewDefFactory
|
9810
|
* @param {?} inputs
|
9811
|
* @param {?} outputs
|
9812
|
* @param {?} ngContentSelectors
|
9813
|
* @return {?}
|
9814
|
*/
|
9815
|
function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
|
9816
|
return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
|
9817
|
}
|
9818
|
/**
|
9819
|
* @param {?} componentFactory
|
9820
|
* @return {?}
|
9821
|
*/
|
9822
|
function getComponentViewDefinitionFactory(componentFactory) {
|
9823
|
return ((componentFactory)).viewDefFactory;
|
9824
|
}
|
9825
|
var ComponentFactory_ = (function (_super) {
|
9826
|
__extends(ComponentFactory_, _super);
|
9827
|
/**
|
9828
|
* @param {?} selector
|
9829
|
* @param {?} componentType
|
9830
|
* @param {?} viewDefFactory
|
9831
|
* @param {?} _inputs
|
9832
|
* @param {?} _outputs
|
9833
|
* @param {?} ngContentSelectors
|
9834
|
*/
|
9835
|
function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
|
9836
|
var _this =
|
9837
|
// Attention: this ctor is called as top level function.
|
9838
|
// Putting any logic in here will destroy closure tree shaking!
|
9839
|
_super.call(this) || this;
|
9840
|
_this.selector = selector;
|
9841
|
_this.componentType = componentType;
|
9842
|
_this._inputs = _inputs;
|
9843
|
_this._outputs = _outputs;
|
9844
|
_this.ngContentSelectors = ngContentSelectors;
|
9845
|
_this.viewDefFactory = viewDefFactory;
|
9846
|
return _this;
|
9847
|
}
|
9848
|
Object.defineProperty(ComponentFactory_.prototype, "inputs", {
|
9849
|
/**
|
9850
|
* @return {?}
|
9851
|
*/
|
9852
|
get: function () {
|
9853
|
var /** @type {?} */ inputsArr = [];
|
9854
|
var /** @type {?} */ inputs = ((this._inputs));
|
9855
|
for (var /** @type {?} */ propName in inputs) {
|
9856
|
var /** @type {?} */ templateName = inputs[propName];
|
9857
|
inputsArr.push({ propName: propName, templateName: templateName });
|
9858
|
}
|
9859
|
return inputsArr;
|
9860
|
},
|
9861
|
enumerable: true,
|
9862
|
configurable: true
|
9863
|
});
|
9864
|
Object.defineProperty(ComponentFactory_.prototype, "outputs", {
|
9865
|
/**
|
9866
|
* @return {?}
|
9867
|
*/
|
9868
|
get: function () {
|
9869
|
var /** @type {?} */ outputsArr = [];
|
9870
|
for (var /** @type {?} */ propName in this._outputs) {
|
9871
|
var /** @type {?} */ templateName = this._outputs[propName];
|
9872
|
outputsArr.push({ propName: propName, templateName: templateName });
|
9873
|
}
|
9874
|
return outputsArr;
|
9875
|
},
|
9876
|
enumerable: true,
|
9877
|
configurable: true
|
9878
|
});
|
9879
|
/**
|
9880
|
* Creates a new component.
|
9881
|
* @param {?} injector
|
9882
|
* @param {?=} projectableNodes
|
9883
|
* @param {?=} rootSelectorOrNode
|
9884
|
* @param {?=} ngModule
|
9885
|
* @return {?}
|
9886
|
*/
|
9887
|
ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
9888
|
if (!ngModule) {
|
9889
|
throw new Error('ngModule should be provided');
|
9890
|
}
|
9891
|
var /** @type {?} */ viewDef = resolveDefinition(this.viewDefFactory);
|
9892
|
var /** @type {?} */ componentNodeIndex = ((((viewDef.nodes[0].element)).componentProvider)).nodeIndex;
|
9893
|
var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
|
9894
|
var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance;
|
9895
|
if (rootSelectorOrNode) {
|
9896
|
view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
|
9897
|
}
|
9898
|
return new ComponentRef_(view, new ViewRef_(view), component);
|
9899
|
};
|
9900
|
return ComponentFactory_;
|
9901
|
}(ComponentFactory));
|
9902
|
var ComponentRef_ = (function (_super) {
|
9903
|
__extends(ComponentRef_, _super);
|
9904
|
/**
|
9905
|
* @param {?} _view
|
9906
|
* @param {?} _viewRef
|
9907
|
* @param {?} _component
|
9908
|
*/
|
9909
|
function ComponentRef_(_view, _viewRef, _component) {
|
9910
|
var _this = _super.call(this) || this;
|
9911
|
_this._view = _view;
|
9912
|
_this._viewRef = _viewRef;
|
9913
|
_this._component = _component;
|
9914
|
_this._elDef = _this._view.def.nodes[0];
|
9915
|
return _this;
|
9916
|
}
|
9917
|
Object.defineProperty(ComponentRef_.prototype, "location", {
|
9918
|
/**
|
9919
|
* @return {?}
|
9920
|
*/
|
9921
|
get: function () {
|
9922
|
return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
|
9923
|
},
|
9924
|
enumerable: true,
|
9925
|
configurable: true
|
9926
|
});
|
9927
|
Object.defineProperty(ComponentRef_.prototype, "injector", {
|
9928
|
/**
|
9929
|
* @return {?}
|
9930
|
*/
|
9931
|
get: function () { return new Injector_(this._view, this._elDef); },
|
9932
|
enumerable: true,
|
9933
|
configurable: true
|
9934
|
});
|
9935
|
Object.defineProperty(ComponentRef_.prototype, "instance", {
|
9936
|
/**
|
9937
|
* @return {?}
|
9938
|
*/
|
9939
|
get: function () { return this._component; },
|
9940
|
enumerable: true,
|
9941
|
configurable: true
|
9942
|
});
|
9943
|
Object.defineProperty(ComponentRef_.prototype, "hostView", {
|
9944
|
/**
|
9945
|
* @return {?}
|
9946
|
*/
|
9947
|
get: function () { return this._viewRef; },
|
9948
|
enumerable: true,
|
9949
|
configurable: true
|
9950
|
});
|
9951
|
Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", {
|
9952
|
/**
|
9953
|
* @return {?}
|
9954
|
*/
|
9955
|
get: function () { return this._viewRef; },
|
9956
|
enumerable: true,
|
9957
|
configurable: true
|
9958
|
});
|
9959
|
Object.defineProperty(ComponentRef_.prototype, "componentType", {
|
9960
|
/**
|
9961
|
* @return {?}
|
9962
|
*/
|
9963
|
get: function () { return (this._component.constructor); },
|
9964
|
enumerable: true,
|
9965
|
configurable: true
|
9966
|
});
|
9967
|
/**
|
9968
|
* @return {?}
|
9969
|
*/
|
9970
|
ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); };
|
9971
|
/**
|
9972
|
* @param {?} callback
|
9973
|
* @return {?}
|
9974
|
*/
|
9975
|
ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); };
|
9976
|
return ComponentRef_;
|
9977
|
}(ComponentRef));
|
9978
|
/**
|
9979
|
* @param {?} view
|
9980
|
* @param {?} elDef
|
9981
|
* @param {?} elData
|
9982
|
* @return {?}
|
9983
|
*/
|
9984
|
function createViewContainerData(view, elDef, elData) {
|
9985
|
return new ViewContainerRef_(view, elDef, elData);
|
9986
|
}
|
9987
|
var ViewContainerRef_ = (function () {
|
9988
|
/**
|
9989
|
* @param {?} _view
|
9990
|
* @param {?} _elDef
|
9991
|
* @param {?} _data
|
9992
|
*/
|
9993
|
function ViewContainerRef_(_view, _elDef, _data) {
|
9994
|
this._view = _view;
|
9995
|
this._elDef = _elDef;
|
9996
|
this._data = _data;
|
9997
|
/**
|
9998
|
* \@internal
|
9999
|
*/
|
10000
|
this._embeddedViews = [];
|
10001
|
}
|
10002
|
Object.defineProperty(ViewContainerRef_.prototype, "element", {
|
10003
|
/**
|
10004
|
* @return {?}
|
10005
|
*/
|
10006
|
get: function () { return new ElementRef(this._data.renderElement); },
|
10007
|
enumerable: true,
|
10008
|
configurable: true
|
10009
|
});
|
10010
|
Object.defineProperty(ViewContainerRef_.prototype, "injector", {
|
10011
|
/**
|
10012
|
* @return {?}
|
10013
|
*/
|
10014
|
get: function () { return new Injector_(this._view, this._elDef); },
|
10015
|
enumerable: true,
|
10016
|
configurable: true
|
10017
|
});
|
10018
|
Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
|
10019
|
/**
|
10020
|
* @return {?}
|
10021
|
*/
|
10022
|
get: function () {
|
10023
|
var /** @type {?} */ view = this._view;
|
10024
|
var /** @type {?} */ elDef = this._elDef.parent;
|
10025
|
while (!elDef && view) {
|
10026
|
elDef = viewParentEl(view);
|
10027
|
view = ((view.parent));
|
10028
|
}
|
10029
|
return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
|
10030
|
},
|
10031
|
enumerable: true,
|
10032
|
configurable: true
|
10033
|
});
|
10034
|
/**
|
10035
|
* @return {?}
|
10036
|
*/
|
10037
|
ViewContainerRef_.prototype.clear = function () {
|
10038
|
var /** @type {?} */ len = this._embeddedViews.length;
|
10039
|
for (var /** @type {?} */ i = len - 1; i >= 0; i--) {
|
10040
|
var /** @type {?} */ view = ((detachEmbeddedView(this._data, i)));
|
10041
|
Services.destroyView(view);
|
10042
|
}
|
10043
|
};
|
10044
|
/**
|
10045
|
* @param {?} index
|
10046
|
* @return {?}
|
10047
|
*/
|
10048
|
ViewContainerRef_.prototype.get = function (index) {
|
10049
|
var /** @type {?} */ view = this._embeddedViews[index];
|
10050
|
if (view) {
|
10051
|
var /** @type {?} */ ref = new ViewRef_(view);
|
10052
|
ref.attachToViewContainerRef(this);
|
10053
|
return ref;
|
10054
|
}
|
10055
|
return null;
|
10056
|
};
|
10057
|
Object.defineProperty(ViewContainerRef_.prototype, "length", {
|
10058
|
/**
|
10059
|
* @return {?}
|
10060
|
*/
|
10061
|
get: function () { return this._embeddedViews.length; },
|
10062
|
enumerable: true,
|
10063
|
configurable: true
|
10064
|
});
|
10065
|
/**
|
10066
|
* @template C
|
10067
|
* @param {?} templateRef
|
10068
|
* @param {?=} context
|
10069
|
* @param {?=} index
|
10070
|
* @return {?}
|
10071
|
*/
|
10072
|
ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
|
10073
|
var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || ({}));
|
10074
|
this.insert(viewRef, index);
|
10075
|
return viewRef;
|
10076
|
};
|
10077
|
/**
|
10078
|
* @template C
|
10079
|
* @param {?} componentFactory
|
10080
|
* @param {?=} index
|
10081
|
* @param {?=} injector
|
10082
|
* @param {?=} projectableNodes
|
10083
|
* @param {?=} ngModuleRef
|
10084
|
* @return {?}
|
10085
|
*/
|
10086
|
ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
|
10087
|
var /** @type {?} */ contextInjector = injector || this.parentInjector;
|
10088
|
if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
|
10089
|
ngModuleRef = contextInjector.get(NgModuleRef);
|
10090
|
}
|
10091
|
var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
10092
|
this.insert(componentRef.hostView, index);
|
10093
|
return componentRef;
|
10094
|
};
|
10095
|
/**
|
10096
|
* @param {?} viewRef
|
10097
|
* @param {?=} index
|
10098
|
* @return {?}
|
10099
|
*/
|
10100
|
ViewContainerRef_.prototype.insert = function (viewRef, index) {
|
10101
|
if (viewRef.destroyed) {
|
10102
|
throw new Error('Cannot insert a destroyed View in a ViewContainer!');
|
10103
|
}
|
10104
|
var /** @type {?} */ viewRef_ = (viewRef);
|
10105
|
var /** @type {?} */ viewData = viewRef_._view;
|
10106
|
attachEmbeddedView(this._view, this._data, index, viewData);
|
10107
|
viewRef_.attachToViewContainerRef(this);
|
10108
|
return viewRef;
|
10109
|
};
|
10110
|
/**
|
10111
|
* @param {?} viewRef
|
10112
|
* @param {?} currentIndex
|
10113
|
* @return {?}
|
10114
|
*/
|
10115
|
ViewContainerRef_.prototype.move = function (viewRef, currentIndex) {
|
10116
|
if (viewRef.destroyed) {
|
10117
|
throw new Error('Cannot move a destroyed View in a ViewContainer!');
|
10118
|
}
|
10119
|
var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view);
|
10120
|
moveEmbeddedView(this._data, previousIndex, currentIndex);
|
10121
|
return viewRef;
|
10122
|
};
|
10123
|
/**
|
10124
|
* @param {?} viewRef
|
10125
|
* @return {?}
|
10126
|
*/
|
10127
|
ViewContainerRef_.prototype.indexOf = function (viewRef) {
|
10128
|
return this._embeddedViews.indexOf(((viewRef))._view);
|
10129
|
};
|
10130
|
/**
|
10131
|
* @param {?=} index
|
10132
|
* @return {?}
|
10133
|
*/
|
10134
|
ViewContainerRef_.prototype.remove = function (index) {
|
10135
|
var /** @type {?} */ viewData = detachEmbeddedView(this._data, index);
|
10136
|
if (viewData) {
|
10137
|
Services.destroyView(viewData);
|
10138
|
}
|
10139
|
};
|
10140
|
/**
|
10141
|
* @param {?=} index
|
10142
|
* @return {?}
|
10143
|
*/
|
10144
|
ViewContainerRef_.prototype.detach = function (index) {
|
10145
|
var /** @type {?} */ view = detachEmbeddedView(this._data, index);
|
10146
|
return view ? new ViewRef_(view) : null;
|
10147
|
};
|
10148
|
return ViewContainerRef_;
|
10149
|
}());
|
10150
|
/**
|
10151
|
* @param {?} view
|
10152
|
* @return {?}
|
10153
|
*/
|
10154
|
function createChangeDetectorRef(view) {
|
10155
|
return new ViewRef_(view);
|
10156
|
}
|
10157
|
var ViewRef_ = (function () {
|
10158
|
/**
|
10159
|
* @param {?} _view
|
10160
|
*/
|
10161
|
function ViewRef_(_view) {
|
10162
|
this._view = _view;
|
10163
|
this._viewContainerRef = null;
|
10164
|
this._appRef = null;
|
10165
|
}
|
10166
|
Object.defineProperty(ViewRef_.prototype, "rootNodes", {
|
10167
|
/**
|
10168
|
* @return {?}
|
10169
|
*/
|
10170
|
get: function () { return rootRenderNodes(this._view); },
|
10171
|
enumerable: true,
|
10172
|
configurable: true
|
10173
|
});
|
10174
|
Object.defineProperty(ViewRef_.prototype, "context", {
|
10175
|
/**
|
10176
|
* @return {?}
|
10177
|
*/
|
10178
|
get: function () { return this._view.context; },
|
10179
|
enumerable: true,
|
10180
|
configurable: true
|
10181
|
});
|
10182
|
Object.defineProperty(ViewRef_.prototype, "destroyed", {
|
10183
|
/**
|
10184
|
* @return {?}
|
10185
|
*/
|
10186
|
get: function () { return (this._view.state & 128 /* Destroyed */) !== 0; },
|
10187
|
enumerable: true,
|
10188
|
configurable: true
|
10189
|
});
|
10190
|
/**
|
10191
|
* @return {?}
|
10192
|
*/
|
10193
|
ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); };
|
10194
|
/**
|
10195
|
* @return {?}
|
10196
|
*/
|
10197
|
ViewRef_.prototype.detach = function () { this._view.state &= ~4 /* Attached */; };
|
10198
|
/**
|
10199
|
* @return {?}
|
10200
|
*/
|
10201
|
ViewRef_.prototype.detectChanges = function () {
|
10202
|
var /** @type {?} */ fs = this._view.root.rendererFactory;
|
10203
|
if (fs.begin) {
|
10204
|
fs.begin();
|
10205
|
}
|
10206
|
Services.checkAndUpdateView(this._view);
|
10207
|
if (fs.end) {
|
10208
|
fs.end();
|
10209
|
}
|
10210
|
};
|
10211
|
/**
|
10212
|
* @return {?}
|
10213
|
*/
|
10214
|
ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); };
|
10215
|
/**
|
10216
|
* @return {?}
|
10217
|
*/
|
10218
|
ViewRef_.prototype.reattach = function () { this._view.state |= 4 /* Attached */; };
|
10219
|
/**
|
10220
|
* @param {?} callback
|
10221
|
* @return {?}
|
10222
|
*/
|
10223
|
ViewRef_.prototype.onDestroy = function (callback) {
|
10224
|
if (!this._view.disposables) {
|
10225
|
this._view.disposables = [];
|
10226
|
}
|
10227
|
this._view.disposables.push(/** @type {?} */ (callback));
|
10228
|
};
|
10229
|
/**
|
10230
|
* @return {?}
|
10231
|
*/
|
10232
|
ViewRef_.prototype.destroy = function () {
|
10233
|
if (this._appRef) {
|
10234
|
this._appRef.detachView(this);
|
10235
|
}
|
10236
|
else if (this._viewContainerRef) {
|
10237
|
this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
|
10238
|
}
|
10239
|
Services.destroyView(this._view);
|
10240
|
};
|
10241
|
/**
|
10242
|
* @return {?}
|
10243
|
*/
|
10244
|
ViewRef_.prototype.detachFromAppRef = function () {
|
10245
|
this._appRef = null;
|
10246
|
renderDetachView(this._view);
|
10247
|
Services.dirtyParentQueries(this._view);
|
10248
|
};
|
10249
|
/**
|
10250
|
* @param {?} appRef
|
10251
|
* @return {?}
|
10252
|
*/
|
10253
|
ViewRef_.prototype.attachToAppRef = function (appRef) {
|
10254
|
if (this._viewContainerRef) {
|
10255
|
throw new Error('This view is already attached to a ViewContainer!');
|
10256
|
}
|
10257
|
this._appRef = appRef;
|
10258
|
};
|
10259
|
/**
|
10260
|
* @param {?} vcRef
|
10261
|
* @return {?}
|
10262
|
*/
|
10263
|
ViewRef_.prototype.attachToViewContainerRef = function (vcRef) {
|
10264
|
if (this._appRef) {
|
10265
|
throw new Error('This view is already attached directly to the ApplicationRef!');
|
10266
|
}
|
10267
|
this._viewContainerRef = vcRef;
|
10268
|
};
|
10269
|
return ViewRef_;
|
10270
|
}());
|
10271
|
/**
|
10272
|
* @param {?} view
|
10273
|
* @param {?} def
|
10274
|
* @return {?}
|
10275
|
*/
|
10276
|
function createTemplateData(view, def) {
|
10277
|
return new TemplateRef_(view, def);
|
10278
|
}
|
10279
|
var TemplateRef_ = (function (_super) {
|
10280
|
__extends(TemplateRef_, _super);
|
10281
|
/**
|
10282
|
* @param {?} _parentView
|
10283
|
* @param {?} _def
|
10284
|
*/
|
10285
|
function TemplateRef_(_parentView, _def) {
|
10286
|
var _this = _super.call(this) || this;
|
10287
|
_this._parentView = _parentView;
|
10288
|
_this._def = _def;
|
10289
|
return _this;
|
10290
|
}
|
10291
|
/**
|
10292
|
* @param {?} context
|
10293
|
* @return {?}
|
10294
|
*/
|
10295
|
TemplateRef_.prototype.createEmbeddedView = function (context) {
|
10296
|
return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ ((((this._def.element)).template)), context));
|
10297
|
};
|
10298
|
Object.defineProperty(TemplateRef_.prototype, "elementRef", {
|
10299
|
/**
|
10300
|
* @return {?}
|
10301
|
*/
|
10302
|
get: function () {
|
10303
|
return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
|
10304
|
},
|
10305
|
enumerable: true,
|
10306
|
configurable: true
|
10307
|
});
|
10308
|
return TemplateRef_;
|
10309
|
}(TemplateRef));
|
10310
|
/**
|
10311
|
* @param {?} view
|
10312
|
* @param {?} elDef
|
10313
|
* @return {?}
|
10314
|
*/
|
10315
|
function createInjector(view, elDef) {
|
10316
|
return new Injector_(view, elDef);
|
10317
|
}
|
10318
|
var Injector_ = (function () {
|
10319
|
/**
|
10320
|
* @param {?} view
|
10321
|
* @param {?} elDef
|
10322
|
*/
|
10323
|
function Injector_(view, elDef) {
|
10324
|
this.view = view;
|
10325
|
this.elDef = elDef;
|
10326
|
}
|
10327
|
/**
|
10328
|
* @param {?} token
|
10329
|
* @param {?=} notFoundValue
|
10330
|
* @return {?}
|
10331
|
*/
|
10332
|
Injector_.prototype.get = function (token, notFoundValue) {
|
10333
|
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
10334
|
var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false;
|
10335
|
return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue);
|
10336
|
};
|
10337
|
return Injector_;
|
10338
|
}());
|
10339
|
/**
|
10340
|
* @param {?} view
|
10341
|
* @param {?} index
|
10342
|
* @return {?}
|
10343
|
*/
|
10344
|
function nodeValue(view, index) {
|
10345
|
var /** @type {?} */ def = view.def.nodes[index];
|
10346
|
if (def.flags & 1 /* TypeElement */) {
|
10347
|
var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
|
10348
|
return ((def.element)).template ? elData.template : elData.renderElement;
|
10349
|
}
|
10350
|
else if (def.flags & 2 /* TypeText */) {
|
10351
|
return asTextData(view, def.nodeIndex).renderText;
|
10352
|
}
|
10353
|
else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) {
|
10354
|
return asProviderData(view, def.nodeIndex).instance;
|
10355
|
}
|
10356
|
throw new Error("Illegal state: read nodeValue for node index " + index);
|
10357
|
}
|
10358
|
/**
|
10359
|
* @param {?} view
|
10360
|
* @return {?}
|
10361
|
*/
|
10362
|
function createRendererV1(view) {
|
10363
|
return new RendererAdapter(view.renderer);
|
10364
|
}
|
10365
|
var RendererAdapter = (function () {
|
10366
|
/**
|
10367
|
* @param {?} delegate
|
10368
|
*/
|
10369
|
function RendererAdapter(delegate) {
|
10370
|
this.delegate = delegate;
|
10371
|
}
|
10372
|
/**
|
10373
|
* @param {?} selectorOrNode
|
10374
|
* @return {?}
|
10375
|
*/
|
10376
|
RendererAdapter.prototype.selectRootElement = function (selectorOrNode) {
|
10377
|
return this.delegate.selectRootElement(selectorOrNode);
|
10378
|
};
|
10379
|
/**
|
10380
|
* @param {?} parent
|
10381
|
* @param {?} namespaceAndName
|
10382
|
* @return {?}
|
10383
|
*/
|
10384
|
RendererAdapter.prototype.createElement = function (parent, namespaceAndName) {
|
10385
|
var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
|
10386
|
var /** @type {?} */ el = this.delegate.createElement(name, ns);
|
10387
|
if (parent) {
|
10388
|
this.delegate.appendChild(parent, el);
|
10389
|
}
|
10390
|
return el;
|
10391
|
};
|
10392
|
/**
|
10393
|
* @param {?} hostElement
|
10394
|
* @return {?}
|
10395
|
*/
|
10396
|
RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; };
|
10397
|
/**
|
10398
|
* @param {?} parentElement
|
10399
|
* @return {?}
|
10400
|
*/
|
10401
|
RendererAdapter.prototype.createTemplateAnchor = function (parentElement) {
|
10402
|
var /** @type {?} */ comment = this.delegate.createComment('');
|
10403
|
if (parentElement) {
|
10404
|
this.delegate.appendChild(parentElement, comment);
|
10405
|
}
|
10406
|
return comment;
|
10407
|
};
|
10408
|
/**
|
10409
|
* @param {?} parentElement
|
10410
|
* @param {?} value
|
10411
|
* @return {?}
|
10412
|
*/
|
10413
|
RendererAdapter.prototype.createText = function (parentElement, value) {
|
10414
|
var /** @type {?} */ node = this.delegate.createText(value);
|
10415
|
if (parentElement) {
|
10416
|
this.delegate.appendChild(parentElement, node);
|
10417
|
}
|
10418
|
return node;
|
10419
|
};
|
10420
|
/**
|
10421
|
* @param {?} parentElement
|
10422
|
* @param {?} nodes
|
10423
|
* @return {?}
|
10424
|
*/
|
10425
|
RendererAdapter.prototype.projectNodes = function (parentElement, nodes) {
|
10426
|
for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
|
10427
|
this.delegate.appendChild(parentElement, nodes[i]);
|
10428
|
}
|
10429
|
};
|
10430
|
/**
|
10431
|
* @param {?} node
|
10432
|
* @param {?} viewRootNodes
|
10433
|
* @return {?}
|
10434
|
*/
|
10435
|
RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) {
|
10436
|
var /** @type {?} */ parentElement = this.delegate.parentNode(node);
|
10437
|
var /** @type {?} */ nextSibling = this.delegate.nextSibling(node);
|
10438
|
for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
|
10439
|
this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
|
10440
|
}
|
10441
|
};
|
10442
|
/**
|
10443
|
* @param {?} viewRootNodes
|
10444
|
* @return {?}
|
10445
|
*/
|
10446
|
RendererAdapter.prototype.detachView = function (viewRootNodes) {
|
10447
|
for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
|
10448
|
var /** @type {?} */ node = viewRootNodes[i];
|
10449
|
var /** @type {?} */ parentElement = this.delegate.parentNode(node);
|
10450
|
this.delegate.removeChild(parentElement, node);
|
10451
|
}
|
10452
|
};
|
10453
|
/**
|
10454
|
* @param {?} hostElement
|
10455
|
* @param {?} viewAllNodes
|
10456
|
* @return {?}
|
10457
|
*/
|
10458
|
RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) {
|
10459
|
for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) {
|
10460
|
((this.delegate.destroyNode))(viewAllNodes[i]);
|
10461
|
}
|
10462
|
};
|
10463
|
/**
|
10464
|
* @param {?} renderElement
|
10465
|
* @param {?} name
|
10466
|
* @param {?} callback
|
10467
|
* @return {?}
|
10468
|
*/
|
10469
|
RendererAdapter.prototype.listen = function (renderElement, name, callback) {
|
10470
|
return this.delegate.listen(renderElement, name, /** @type {?} */ (callback));
|
10471
|
};
|
10472
|
/**
|
10473
|
* @param {?} target
|
10474
|
* @param {?} name
|
10475
|
* @param {?} callback
|
10476
|
* @return {?}
|
10477
|
*/
|
10478
|
RendererAdapter.prototype.listenGlobal = function (target, name, callback) {
|
10479
|
return this.delegate.listen(target, name, /** @type {?} */ (callback));
|
10480
|
};
|
10481
|
/**
|
10482
|
* @param {?} renderElement
|
10483
|
* @param {?} propertyName
|
10484
|
* @param {?} propertyValue
|
10485
|
* @return {?}
|
10486
|
*/
|
10487
|
RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
|
10488
|
this.delegate.setProperty(renderElement, propertyName, propertyValue);
|
10489
|
};
|
10490
|
/**
|
10491
|
* @param {?} renderElement
|
10492
|
* @param {?} namespaceAndName
|
10493
|
* @param {?} attributeValue
|
10494
|
* @return {?}
|
10495
|
*/
|
10496
|
RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) {
|
10497
|
var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
|
10498
|
if (attributeValue != null) {
|
10499
|
this.delegate.setAttribute(renderElement, name, attributeValue, ns);
|
10500
|
}
|
10501
|
else {
|
10502
|
this.delegate.removeAttribute(renderElement, name, ns);
|
10503
|
}
|
10504
|
};
|
10505
|
/**
|
10506
|
* @param {?} renderElement
|
10507
|
* @param {?} propertyName
|
10508
|
* @param {?} propertyValue
|
10509
|
* @return {?}
|
10510
|
*/
|
10511
|
RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
|
10512
|
/**
|
10513
|
* @param {?} renderElement
|
10514
|
* @param {?} className
|
10515
|
* @param {?} isAdd
|
10516
|
* @return {?}
|
10517
|
*/
|
10518
|
RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) {
|
10519
|
if (isAdd) {
|
10520
|
this.delegate.addClass(renderElement, className);
|
10521
|
}
|
10522
|
else {
|
10523
|
this.delegate.removeClass(renderElement, className);
|
10524
|
}
|
10525
|
};
|
10526
|
/**
|
10527
|
* @param {?} renderElement
|
10528
|
* @param {?} styleName
|
10529
|
* @param {?} styleValue
|
10530
|
* @return {?}
|
10531
|
*/
|
10532
|
RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
|
10533
|
if (styleValue != null) {
|
10534
|
this.delegate.setStyle(renderElement, styleName, styleValue);
|
10535
|
}
|
10536
|
else {
|
10537
|
this.delegate.removeStyle(renderElement, styleName);
|
10538
|
}
|
10539
|
};
|
10540
|
/**
|
10541
|
* @param {?} renderElement
|
10542
|
* @param {?} methodName
|
10543
|
* @param {?} args
|
10544
|
* @return {?}
|
10545
|
*/
|
10546
|
RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) {
|
10547
|
((renderElement))[methodName].apply(renderElement, args);
|
10548
|
};
|
10549
|
/**
|
10550
|
* @param {?} renderNode
|
10551
|
* @param {?} text
|
10552
|
* @return {?}
|
10553
|
*/
|
10554
|
RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
|
10555
|
/**
|
10556
|
* @return {?}
|
10557
|
*/
|
10558
|
RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); };
|
10559
|
return RendererAdapter;
|
10560
|
}());
|
10561
|
/**
|
10562
|
* @param {?} moduleType
|
10563
|
* @param {?} parent
|
10564
|
* @param {?} bootstrapComponents
|
10565
|
* @param {?} def
|
10566
|
* @return {?}
|
10567
|
*/
|
10568
|
function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
|
10569
|
return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
|
10570
|
}
|
10571
|
var NgModuleRef_ = (function () {
|
10572
|
/**
|
10573
|
* @param {?} _moduleType
|
10574
|
* @param {?} _parent
|
10575
|
* @param {?} _bootstrapComponents
|
10576
|
* @param {?} _def
|
10577
|
*/
|
10578
|
function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
|
10579
|
this._moduleType = _moduleType;
|
10580
|
this._parent = _parent;
|
10581
|
this._bootstrapComponents = _bootstrapComponents;
|
10582
|
this._def = _def;
|
10583
|
this._destroyListeners = [];
|
10584
|
this._destroyed = false;
|
10585
|
initNgModule(this);
|
10586
|
}
|
10587
|
/**
|
10588
|
* @param {?} token
|
10589
|
* @param {?=} notFoundValue
|
10590
|
* @return {?}
|
10591
|
*/
|
10592
|
NgModuleRef_.prototype.get = function (token, notFoundValue) {
|
10593
|
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
10594
|
return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 /* None */ }, notFoundValue);
|
10595
|
};
|
10596
|
Object.defineProperty(NgModuleRef_.prototype, "instance", {
|
10597
|
/**
|
10598
|
* @return {?}
|
10599
|
*/
|
10600
|
get: function () { return this.get(this._moduleType); },
|
10601
|
enumerable: true,
|
10602
|
configurable: true
|
10603
|
});
|
10604
|
Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
|
10605
|
/**
|
10606
|
* @return {?}
|
10607
|
*/
|
10608
|
get: function () { return this.get(ComponentFactoryResolver); },
|
10609
|
enumerable: true,
|
10610
|
configurable: true
|
10611
|
});
|
10612
|
Object.defineProperty(NgModuleRef_.prototype, "injector", {
|
10613
|
/**
|
10614
|
* @return {?}
|
10615
|
*/
|
10616
|
get: function () { return this; },
|
10617
|
enumerable: true,
|
10618
|
configurable: true
|
10619
|
});
|
10620
|
/**
|
10621
|
* @return {?}
|
10622
|
*/
|
10623
|
NgModuleRef_.prototype.destroy = function () {
|
10624
|
if (this._destroyed) {
|
10625
|
throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
|
10626
|
}
|
10627
|
this._destroyed = true;
|
10628
|
callNgModuleLifecycle(this, 131072 /* OnDestroy */);
|
10629
|
this._destroyListeners.forEach(function (listener) { return listener(); });
|
10630
|
};
|
10631
|
/**
|
10632
|
* @param {?} callback
|
10633
|
* @return {?}
|
10634
|
*/
|
10635
|
NgModuleRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
|
10636
|
return NgModuleRef_;
|
10637
|
}());
|
10638
|
/**
|
10639
|
* @license
|
10640
|
* Copyright Google Inc. All Rights Reserved.
|
10641
|
*
|
10642
|
* Use of this source code is governed by an MIT-style license that can be
|
10643
|
* found in the LICENSE file at https://angular.io/license
|
10644
|
*/
|
10645
|
var RendererV1TokenKey = tokenKey(Renderer);
|
10646
|
var Renderer2TokenKey = tokenKey(Renderer2);
|
10647
|
var ElementRefTokenKey = tokenKey(ElementRef);
|
10648
|
var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
|
10649
|
var TemplateRefTokenKey = tokenKey(TemplateRef);
|
10650
|
var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
|
10651
|
var InjectorRefTokenKey = tokenKey(Injector);
|
10652
|
/**
|
10653
|
* @param {?} checkIndex
|
10654
|
* @param {?} flags
|
10655
|
* @param {?} matchedQueries
|
10656
|
* @param {?} childCount
|
10657
|
* @param {?} ctor
|
10658
|
* @param {?} deps
|
10659
|
* @param {?=} props
|
10660
|
* @param {?=} outputs
|
10661
|
* @return {?}
|
10662
|
*/
|
10663
|
function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
|
10664
|
var /** @type {?} */ bindings = [];
|
10665
|
if (props) {
|
10666
|
for (var /** @type {?} */ prop in props) {
|
10667
|
var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
|
10668
|
bindings[bindingIndex] = {
|
10669
|
flags: 8 /* TypeProperty */,
|
10670
|
name: prop, nonMinifiedName: nonMinifiedName,
|
10671
|
ns: null,
|
10672
|
securityContext: null,
|
10673
|
suffix: null
|
10674
|
};
|
10675
|
}
|
10676
|
}
|
10677
|
var /** @type {?} */ outputDefs = [];
|
10678
|
if (outputs) {
|
10679
|
for (var /** @type {?} */ propName in outputs) {
|
10680
|
outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] });
|
10681
|
}
|
10682
|
}
|
10683
|
flags |= 16384 /* TypeDirective */;
|
10684
|
return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
|
10685
|
}
|
10686
|
/**
|
10687
|
* @param {?} flags
|
10688
|
* @param {?} ctor
|
10689
|
* @param {?} deps
|
10690
|
* @return {?}
|
10691
|
*/
|
10692
|
function pipeDef(flags, ctor, deps) {
|
10693
|
flags |= 16 /* TypePipe */;
|
10694
|
return _def(-1, flags, null, 0, ctor, ctor, deps);
|
10695
|
}
|
10696
|
/**
|
10697
|
* @param {?} flags
|
10698
|
* @param {?} matchedQueries
|
10699
|
* @param {?} token
|
10700
|
* @param {?} value
|
10701
|
* @param {?} deps
|
10702
|
* @return {?}
|
10703
|
*/
|
10704
|
function providerDef(flags, matchedQueries, token, value, deps) {
|
10705
|
return _def(-1, flags, matchedQueries, 0, token, value, deps);
|
10706
|
}
|
10707
|
/**
|
10708
|
* @param {?} checkIndex
|
10709
|
* @param {?} flags
|
10710
|
* @param {?} matchedQueriesDsl
|
10711
|
* @param {?} childCount
|
10712
|
* @param {?} token
|
10713
|
* @param {?} value
|
10714
|
* @param {?} deps
|
10715
|
* @param {?=} bindings
|
10716
|
* @param {?=} outputs
|
10717
|
* @return {?}
|
10718
|
*/
|
10719
|
function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
|
10720
|
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
10721
|
if (!outputs) {
|
10722
|
outputs = [];
|
10723
|
}
|
10724
|
if (!bindings) {
|
10725
|
bindings = [];
|
10726
|
}
|
10727
|
var /** @type {?} */ depDefs = splitDepsDsl(deps);
|
10728
|
return {
|
10729
|
// will bet set by the view definition
|
10730
|
nodeIndex: -1,
|
10731
|
parent: null,
|
10732
|
renderParent: null,
|
10733
|
bindingIndex: -1,
|
10734
|
outputIndex: -1,
|
10735
|
// regular values
|
10736
|
checkIndex: checkIndex,
|
10737
|
flags: flags,
|
10738
|
childFlags: 0,
|
10739
|
directChildFlags: 0,
|
10740
|
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
|
10741
|
ngContentIndex: -1, childCount: childCount, bindings: bindings,
|
10742
|
bindingFlags: calcBindingFlags(bindings), outputs: outputs,
|
10743
|
element: null,
|
10744
|
provider: { token: token, value: value, deps: depDefs },
|
10745
|
text: null,
|
10746
|
query: null,
|
10747
|
ngContent: null
|
10748
|
};
|
10749
|
}
|
10750
|
/**
|
10751
|
* @param {?} view
|
10752
|
* @param {?} def
|
10753
|
* @return {?}
|
10754
|
*/
|
10755
|
function createProviderInstance(view, def) {
|
10756
|
return _createProviderInstance(view, def);
|
10757
|
}
|
10758
|
/**
|
10759
|
* @param {?} view
|
10760
|
* @param {?} def
|
10761
|
* @return {?}
|
10762
|
*/
|
10763
|
function createPipeInstance(view, def) {
|
10764
|
// deps are looked up from component.
|
10765
|
var /** @type {?} */ compView = view;
|
10766
|
while (compView.parent && !isComponentView(compView)) {
|
10767
|
compView = compView.parent;
|
10768
|
}
|
10769
|
// pipes can see the private services of the component
|
10770
|
var /** @type {?} */ allowPrivateServices = true;
|
10771
|
// pipes are always eager and classes!
|
10772
|
return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
|
10773
|
}
|
10774
|
/**
|
10775
|
* @param {?} view
|
10776
|
* @param {?} def
|
10777
|
* @return {?}
|
10778
|
*/
|
10779
|
function createDirectiveInstance(view, def) {
|
10780
|
// components can see other private services, other directives can't.
|
10781
|
var /** @type {?} */ allowPrivateServices = (def.flags & 32768 /* Component */) > 0;
|
10782
|
// directives are always eager and classes!
|
10783
|
var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
|
10784
|
if (def.outputs.length) {
|
10785
|
for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
|
10786
|
var /** @type {?} */ output = def.outputs[i];
|
10787
|
var /** @type {?} */ subscription = instance[((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).nodeIndex, output.eventName)); /** @type {?} */
|
10788
|
((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
|
10789
|
}
|
10790
|
}
|
10791
|
return instance;
|
10792
|
}
|
10793
|
/**
|
10794
|
* @param {?} view
|
10795
|
* @param {?} index
|
10796
|
* @param {?} eventName
|
10797
|
* @return {?}
|
10798
|
*/
|
10799
|
function eventHandlerClosure(view, index, eventName) {
|
10800
|
return function (event) {
|
10801
|
try {
|
10802
|
return dispatchEvent(view, index, eventName, event);
|
10803
|
}
|
10804
|
catch (e) {
|
10805
|
// Attention: Don't rethrow, as it would cancel Observable subscriptions!
|
10806
|
view.root.errorHandler.handleError(e);
|
10807
|
}
|
10808
|
};
|
10809
|
}
|
10810
|
/**
|
10811
|
* @param {?} view
|
10812
|
* @param {?} def
|
10813
|
* @param {?} v0
|
10814
|
* @param {?} v1
|
10815
|
* @param {?} v2
|
10816
|
* @param {?} v3
|
10817
|
* @param {?} v4
|
10818
|
* @param {?} v5
|
10819
|
* @param {?} v6
|
10820
|
* @param {?} v7
|
10821
|
* @param {?} v8
|
10822
|
* @param {?} v9
|
10823
|
* @return {?}
|
10824
|
*/
|
10825
|
function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
10826
|
var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
|
10827
|
var /** @type {?} */ directive = providerData.instance;
|
10828
|
var /** @type {?} */ changed = false;
|
10829
|
var /** @type {?} */ changes = ((undefined));
|
10830
|
var /** @type {?} */ bindLen = def.bindings.length;
|
10831
|
if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
|
10832
|
changed = true;
|
10833
|
changes = updateProp(view, providerData, def, 0, v0, changes);
|
10834
|
}
|
10835
|
if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
|
10836
|
changed = true;
|
10837
|
changes = updateProp(view, providerData, def, 1, v1, changes);
|
10838
|
}
|
10839
|
if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
|
10840
|
changed = true;
|
10841
|
changes = updateProp(view, providerData, def, 2, v2, changes);
|
10842
|
}
|
10843
|
if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
|
10844
|
changed = true;
|
10845
|
changes = updateProp(view, providerData, def, 3, v3, changes);
|
10846
|
}
|
10847
|
if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
|
10848
|
changed = true;
|
10849
|
changes = updateProp(view, providerData, def, 4, v4, changes);
|
10850
|
}
|
10851
|
if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
|
10852
|
changed = true;
|
10853
|
changes = updateProp(view, providerData, def, 5, v5, changes);
|
10854
|
}
|
10855
|
if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
|
10856
|
changed = true;
|
10857
|
changes = updateProp(view, providerData, def, 6, v6, changes);
|
10858
|
}
|
10859
|
if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
|
10860
|
changed = true;
|
10861
|
changes = updateProp(view, providerData, def, 7, v7, changes);
|
10862
|
}
|
10863
|
if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
|
10864
|
changed = true;
|
10865
|
changes = updateProp(view, providerData, def, 8, v8, changes);
|
10866
|
}
|
10867
|
if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
|
10868
|
changed = true;
|
10869
|
changes = updateProp(view, providerData, def, 9, v9, changes);
|
10870
|
}
|
10871
|
if (changes) {
|
10872
|
directive.ngOnChanges(changes);
|
10873
|
}
|
10874
|
if ((view.state & 2 /* FirstCheck */) && (def.flags & 65536 /* OnInit */)) {
|
10875
|
directive.ngOnInit();
|
10876
|
}
|
10877
|
if (def.flags & 262144 /* DoCheck */) {
|
10878
|
directive.ngDoCheck();
|
10879
|
}
|
10880
|
return changed;
|
10881
|
}
|
10882
|
/**
|
10883
|
* @param {?} view
|
10884
|
* @param {?} def
|
10885
|
* @param {?} values
|
10886
|
* @return {?}
|
10887
|
*/
|
10888
|
function checkAndUpdateDirectiveDynamic(view, def, values) {
|
10889
|
var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
|
10890
|
var /** @type {?} */ directive = providerData.instance;
|
10891
|
var /** @type {?} */ changed = false;
|
10892
|
var /** @type {?} */ changes = ((undefined));
|
10893
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
10894
|
if (checkBinding(view, def, i, values[i])) {
|
10895
|
changed = true;
|
10896
|
changes = updateProp(view, providerData, def, i, values[i], changes);
|
10897
|
}
|
10898
|
}
|
10899
|
if (changes) {
|
10900
|
directive.ngOnChanges(changes);
|
10901
|
}
|
10902
|
if ((view.state & 2 /* FirstCheck */) && (def.flags & 65536 /* OnInit */)) {
|
10903
|
directive.ngOnInit();
|
10904
|
}
|
10905
|
if (def.flags & 262144 /* DoCheck */) {
|
10906
|
directive.ngDoCheck();
|
10907
|
}
|
10908
|
return changed;
|
10909
|
}
|
10910
|
/**
|
10911
|
* @param {?} view
|
10912
|
* @param {?} def
|
10913
|
* @return {?}
|
10914
|
*/
|
10915
|
function _createProviderInstance(view, def) {
|
10916
|
// private services can see other private services
|
10917
|
var /** @type {?} */ allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0;
|
10918
|
var /** @type {?} */ providerDef = def.provider;
|
10919
|
switch (def.flags & 201347067 /* Types */) {
|
10920
|
case 512 /* TypeClassProvider */:
|
10921
|
return createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
|
10922
|
case 1024 /* TypeFactoryProvider */:
|
10923
|
return callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
|
10924
|
case 2048 /* TypeUseExistingProvider */:
|
10925
|
return resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]);
|
10926
|
case 256 /* TypeValueProvider */:
|
10927
|
return ((providerDef)).value;
|
10928
|
}
|
10929
|
}
|
10930
|
/**
|
10931
|
* @param {?} view
|
10932
|
* @param {?} elDef
|
10933
|
* @param {?} allowPrivateServices
|
10934
|
* @param {?} ctor
|
10935
|
* @param {?} deps
|
10936
|
* @return {?}
|
10937
|
*/
|
10938
|
function createClass(view, elDef, allowPrivateServices, ctor, deps) {
|
10939
|
var /** @type {?} */ len = deps.length;
|
10940
|
switch (len) {
|
10941
|
case 0:
|
10942
|
return new ctor();
|
10943
|
case 1:
|
10944
|
return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
10945
|
case 2:
|
10946
|
return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
10947
|
case 3:
|
10948
|
return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
10949
|
default:
|
10950
|
var /** @type {?} */ depValues = new Array(len);
|
10951
|
for (var /** @type {?} */ i = 0; i < len; i++) {
|
10952
|
depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
|
10953
|
}
|
10954
|
return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
|
10955
|
}
|
10956
|
}
|
10957
|
/**
|
10958
|
* @param {?} view
|
10959
|
* @param {?} elDef
|
10960
|
* @param {?} allowPrivateServices
|
10961
|
* @param {?} factory
|
10962
|
* @param {?} deps
|
10963
|
* @return {?}
|
10964
|
*/
|
10965
|
function callFactory(view, elDef, allowPrivateServices, factory, deps) {
|
10966
|
var /** @type {?} */ len = deps.length;
|
10967
|
switch (len) {
|
10968
|
case 0:
|
10969
|
return factory();
|
10970
|
case 1:
|
10971
|
return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
10972
|
case 2:
|
10973
|
return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
10974
|
case 3:
|
10975
|
return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
10976
|
default:
|
10977
|
var /** @type {?} */ depValues = Array(len);
|
10978
|
for (var /** @type {?} */ i = 0; i < len; i++) {
|
10979
|
depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
|
10980
|
}
|
10981
|
return factory.apply(void 0, depValues);
|
10982
|
}
|
10983
|
}
|
10984
|
// This default value is when checking the hierarchy for a token.
|
10985
|
//
|
10986
|
// It means both:
|
10987
|
// - the token is not provided by the current injector,
|
10988
|
// - only the element injectors should be checked (ie do not check module injectors
|
10989
|
//
|
10990
|
// mod1
|
10991
|
// /
|
10992
|
// el1 mod2
|
10993
|
// \ /
|
10994
|
// el2
|
10995
|
//
|
10996
|
// When requesting el2.injector.get(token), we should check in the following order and return the
|
10997
|
// first found value:
|
10998
|
// - el2.injector.get(token, default)
|
10999
|
// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
|
11000
|
// - mod2.injector.get(token, default)
|
11001
|
var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
11002
|
/**
|
11003
|
* @param {?} view
|
11004
|
* @param {?} elDef
|
11005
|
* @param {?} allowPrivateServices
|
11006
|
* @param {?} depDef
|
11007
|
* @param {?=} notFoundValue
|
11008
|
* @return {?}
|
11009
|
*/
|
11010
|
function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
|
11011
|
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
11012
|
if (depDef.flags & 8 /* Value */) {
|
11013
|
return depDef.token;
|
11014
|
}
|
11015
|
var /** @type {?} */ startView = view;
|
11016
|
if (depDef.flags & 2 /* Optional */) {
|
11017
|
notFoundValue = null;
|
11018
|
}
|
11019
|
var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
|
11020
|
if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
|
11021
|
// directives on the same element as a component should be able to control the change detector
|
11022
|
// of that component as well.
|
11023
|
allowPrivateServices = !!(elDef && ((elDef.element)).componentView);
|
11024
|
}
|
11025
|
if (elDef && (depDef.flags & 1 /* SkipSelf */)) {
|
11026
|
allowPrivateServices = false;
|
11027
|
elDef = ((elDef.parent));
|
11028
|
}
|
11029
|
while (view) {
|
11030
|
if (elDef) {
|
11031
|
switch (tokenKey$$1) {
|
11032
|
case RendererV1TokenKey: {
|
11033
|
var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
|
11034
|
return createRendererV1(compView);
|
11035
|
}
|
11036
|
case Renderer2TokenKey: {
|
11037
|
var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
|
11038
|
return compView.renderer;
|
11039
|
}
|
11040
|
case ElementRefTokenKey:
|
11041
|
return new ElementRef(asElementData(view, elDef.nodeIndex).renderElement);
|
11042
|
case ViewContainerRefTokenKey:
|
11043
|
return asElementData(view, elDef.nodeIndex).viewContainer;
|
11044
|
case TemplateRefTokenKey: {
|
11045
|
if (((elDef.element)).template) {
|
11046
|
return asElementData(view, elDef.nodeIndex).template;
|
11047
|
}
|
11048
|
break;
|
11049
|
}
|
11050
|
case ChangeDetectorRefTokenKey: {
|
11051
|
var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices);
|
11052
|
return createChangeDetectorRef(cdView);
|
11053
|
}
|
11054
|
case InjectorRefTokenKey:
|
11055
|
return createInjector(view, elDef);
|
11056
|
default:
|
11057
|
var /** @type {?} */ providerDef_1 = (((allowPrivateServices ? ((elDef.element)).allProviders : ((elDef.element)).publicProviders)))[tokenKey$$1];
|
11058
|
if (providerDef_1) {
|
11059
|
var /** @type {?} */ providerData = asProviderData(view, providerDef_1.nodeIndex);
|
11060
|
if (!providerData) {
|
11061
|
providerData = { instance: _createProviderInstance(view, providerDef_1) };
|
11062
|
view.nodes[providerDef_1.nodeIndex] = (providerData);
|
11063
|
}
|
11064
|
return providerData.instance;
|
11065
|
}
|
11066
|
}
|
11067
|
}
|
11068
|
allowPrivateServices = isComponentView(view);
|
11069
|
elDef = ((viewParentEl(view)));
|
11070
|
view = ((view.parent));
|
11071
|
}
|
11072
|
var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
|
11073
|
if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
11074
|
notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
11075
|
// Return the value from the root element injector when
|
11076
|
// - it provides it
|
11077
|
// (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
|
11078
|
// - the module injector should not be checked
|
11079
|
// (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
|
11080
|
return value;
|
11081
|
}
|
11082
|
return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
|
11083
|
}
|
11084
|
/**
|
11085
|
* @param {?} view
|
11086
|
* @param {?} elDef
|
11087
|
* @param {?} allowPrivateServices
|
11088
|
* @return {?}
|
11089
|
*/
|
11090
|
function findCompView(view, elDef, allowPrivateServices) {
|
11091
|
var /** @type {?} */ compView;
|
11092
|
if (allowPrivateServices) {
|
11093
|
compView = asElementData(view, elDef.nodeIndex).componentView;
|
11094
|
}
|
11095
|
else {
|
11096
|
compView = view;
|
11097
|
while (compView.parent && !isComponentView(compView)) {
|
11098
|
compView = compView.parent;
|
11099
|
}
|
11100
|
}
|
11101
|
return compView;
|
11102
|
}
|
11103
|
/**
|
11104
|
* @param {?} view
|
11105
|
* @param {?} providerData
|
11106
|
* @param {?} def
|
11107
|
* @param {?} bindingIdx
|
11108
|
* @param {?} value
|
11109
|
* @param {?} changes
|
11110
|
* @return {?}
|
11111
|
*/
|
11112
|
function updateProp(view, providerData, def, bindingIdx, value, changes) {
|
11113
|
if (def.flags & 32768 /* Component */) {
|
11114
|
var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).nodeIndex).componentView;
|
11115
|
if (compView.def.flags & 2 /* OnPush */) {
|
11116
|
compView.state |= 8 /* ChecksEnabled */;
|
11117
|
}
|
11118
|
}
|
11119
|
var /** @type {?} */ binding = def.bindings[bindingIdx];
|
11120
|
var /** @type {?} */ propName = ((binding.name));
|
11121
|
// Note: This is still safe with Closure Compiler as
|
11122
|
// the user passed in the property name as an object has to `providerDef`,
|
11123
|
// so Closure Compiler will have renamed the property correctly already.
|
11124
|
providerData.instance[propName] = value;
|
11125
|
if (def.flags & 524288 /* OnChanges */) {
|
11126
|
changes = changes || {};
|
11127
|
var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
11128
|
if (oldValue instanceof WrappedValue) {
|
11129
|
oldValue = oldValue.wrapped;
|
11130
|
}
|
11131
|
var /** @type {?} */ binding_1 = def.bindings[bindingIdx];
|
11132
|
changes[((binding_1.nonMinifiedName))] =
|
11133
|
new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0);
|
11134
|
}
|
11135
|
view.oldValues[def.bindingIndex + bindingIdx] = value;
|
11136
|
return changes;
|
11137
|
}
|
11138
|
/**
|
11139
|
* @param {?} view
|
11140
|
* @param {?} lifecycles
|
11141
|
* @return {?}
|
11142
|
*/
|
11143
|
function callLifecycleHooksChildrenFirst(view, lifecycles) {
|
11144
|
if (!(view.def.nodeFlags & lifecycles)) {
|
11145
|
return;
|
11146
|
}
|
11147
|
var /** @type {?} */ nodes = view.def.nodes;
|
11148
|
for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
|
11149
|
var /** @type {?} */ nodeDef = nodes[i];
|
11150
|
var /** @type {?} */ parent = nodeDef.parent;
|
11151
|
if (!parent && nodeDef.flags & lifecycles) {
|
11152
|
// matching root node (e.g. a pipe)
|
11153
|
callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
|
11154
|
}
|
11155
|
if ((nodeDef.childFlags & lifecycles) === 0) {
|
11156
|
// no child matches one of the lifecycles
|
11157
|
i += nodeDef.childCount;
|
11158
|
}
|
11159
|
while (parent && (parent.flags & 1 /* TypeElement */) &&
|
11160
|
i === parent.nodeIndex + parent.childCount) {
|
11161
|
// last child of an element
|
11162
|
if (parent.directChildFlags & lifecycles) {
|
11163
|
callElementProvidersLifecycles(view, parent, lifecycles);
|
11164
|
}
|
11165
|
parent = parent.parent;
|
11166
|
}
|
11167
|
}
|
11168
|
}
|
11169
|
/**
|
11170
|
* @param {?} view
|
11171
|
* @param {?} elDef
|
11172
|
* @param {?} lifecycles
|
11173
|
* @return {?}
|
11174
|
*/
|
11175
|
function callElementProvidersLifecycles(view, elDef, lifecycles) {
|
11176
|
for (var /** @type {?} */ i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
|
11177
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
11178
|
if (nodeDef.flags & lifecycles) {
|
11179
|
callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
|
11180
|
}
|
11181
|
// only visit direct children
|
11182
|
i += nodeDef.childCount;
|
11183
|
}
|
11184
|
}
|
11185
|
/**
|
11186
|
* @param {?} view
|
11187
|
* @param {?} index
|
11188
|
* @param {?} lifecycles
|
11189
|
* @return {?}
|
11190
|
*/
|
11191
|
function callProviderLifecycles(view, index, lifecycles) {
|
11192
|
var /** @type {?} */ providerData = asProviderData(view, index);
|
11193
|
if (!providerData) {
|
11194
|
return;
|
11195
|
}
|
11196
|
var /** @type {?} */ provider = providerData.instance;
|
11197
|
if (!provider) {
|
11198
|
return;
|
11199
|
}
|
11200
|
Services.setCurrentNode(view, index);
|
11201
|
if (lifecycles & 1048576 /* AfterContentInit */) {
|
11202
|
provider.ngAfterContentInit();
|
11203
|
}
|
11204
|
if (lifecycles & 2097152 /* AfterContentChecked */) {
|
11205
|
provider.ngAfterContentChecked();
|
11206
|
}
|
11207
|
if (lifecycles & 4194304 /* AfterViewInit */) {
|
11208
|
provider.ngAfterViewInit();
|
11209
|
}
|
11210
|
if (lifecycles & 8388608 /* AfterViewChecked */) {
|
11211
|
provider.ngAfterViewChecked();
|
11212
|
}
|
11213
|
if (lifecycles & 131072 /* OnDestroy */) {
|
11214
|
provider.ngOnDestroy();
|
11215
|
}
|
11216
|
}
|
11217
|
/**
|
11218
|
* @license
|
11219
|
* Copyright Google Inc. All Rights Reserved.
|
11220
|
*
|
11221
|
* Use of this source code is governed by an MIT-style license that can be
|
11222
|
* found in the LICENSE file at https://angular.io/license
|
11223
|
*/
|
11224
|
/**
|
11225
|
* @param {?} flags
|
11226
|
* @param {?} id
|
11227
|
* @param {?} bindings
|
11228
|
* @return {?}
|
11229
|
*/
|
11230
|
function queryDef(flags, id, bindings) {
|
11231
|
var /** @type {?} */ bindingDefs = [];
|
11232
|
for (var /** @type {?} */ propName in bindings) {
|
11233
|
var /** @type {?} */ bindingType = bindings[propName];
|
11234
|
bindingDefs.push({ propName: propName, bindingType: bindingType });
|
11235
|
}
|
11236
|
return {
|
11237
|
// will bet set by the view definition
|
11238
|
nodeIndex: -1,
|
11239
|
parent: null,
|
11240
|
renderParent: null,
|
11241
|
bindingIndex: -1,
|
11242
|
outputIndex: -1,
|
11243
|
// regular values
|
11244
|
// TODO(vicb): check
|
11245
|
checkIndex: -1, flags: flags,
|
11246
|
childFlags: 0,
|
11247
|
directChildFlags: 0,
|
11248
|
childMatchedQueries: 0,
|
11249
|
ngContentIndex: -1,
|
11250
|
matchedQueries: {},
|
11251
|
matchedQueryIds: 0,
|
11252
|
references: {},
|
11253
|
childCount: 0,
|
11254
|
bindings: [],
|
11255
|
bindingFlags: 0,
|
11256
|
outputs: [],
|
11257
|
element: null,
|
11258
|
provider: null,
|
11259
|
text: null,
|
11260
|
query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
|
11261
|
ngContent: null
|
11262
|
};
|
11263
|
}
|
11264
|
/**
|
11265
|
* @return {?}
|
11266
|
*/
|
11267
|
function createQuery() {
|
11268
|
return new QueryList();
|
11269
|
}
|
11270
|
/**
|
11271
|
* @param {?} view
|
11272
|
* @return {?}
|
11273
|
*/
|
11274
|
function dirtyParentQueries(view) {
|
11275
|
var /** @type {?} */ queryIds = view.def.nodeMatchedQueries;
|
11276
|
while (view.parent && isEmbeddedView(view)) {
|
11277
|
var /** @type {?} */ tplDef = ((view.parentNodeDef));
|
11278
|
view = view.parent;
|
11279
|
// content queries
|
11280
|
var /** @type {?} */ end = tplDef.nodeIndex + tplDef.childCount;
|
11281
|
for (var /** @type {?} */ i = 0; i <= end; i++) {
|
11282
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
11283
|
if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
|
11284
|
(nodeDef.flags & 536870912 /* DynamicQuery */) &&
|
11285
|
(((nodeDef.query)).filterId & queryIds) === ((nodeDef.query)).filterId) {
|
11286
|
asQueryList(view, i).setDirty();
|
11287
|
}
|
11288
|
if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) ||
|
11289
|
!(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
|
11290
|
!(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
|
11291
|
// skip elements that don't contain the template element or no query.
|
11292
|
i += nodeDef.childCount;
|
11293
|
}
|
11294
|
}
|
11295
|
}
|
11296
|
// view queries
|
11297
|
if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
|
11298
|
for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) {
|
11299
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
11300
|
if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
|
11301
|
asQueryList(view, i).setDirty();
|
11302
|
}
|
11303
|
// only visit the root nodes
|
11304
|
i += nodeDef.childCount;
|
11305
|
}
|
11306
|
}
|
11307
|
}
|
11308
|
/**
|
11309
|
* @param {?} view
|
11310
|
* @param {?} nodeDef
|
11311
|
* @return {?}
|
11312
|
*/
|
11313
|
function checkAndUpdateQuery(view, nodeDef) {
|
11314
|
var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
|
11315
|
if (!queryList.dirty) {
|
11316
|
return;
|
11317
|
}
|
11318
|
var /** @type {?} */ directiveInstance;
|
11319
|
var /** @type {?} */ newValues = ((undefined));
|
11320
|
if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
|
11321
|
var /** @type {?} */ elementDef_1 = ((((nodeDef.parent)).parent));
|
11322
|
newValues = calcQueryValues(view, elementDef_1.nodeIndex, elementDef_1.nodeIndex + elementDef_1.childCount, /** @type {?} */ ((nodeDef.query)), []);
|
11323
|
directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).instance;
|
11324
|
}
|
11325
|
else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
|
11326
|
newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []);
|
11327
|
directiveInstance = view.component;
|
11328
|
}
|
11329
|
queryList.reset(newValues);
|
11330
|
var /** @type {?} */ bindings = ((nodeDef.query)).bindings;
|
11331
|
var /** @type {?} */ notify = false;
|
11332
|
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
|
11333
|
var /** @type {?} */ binding = bindings[i];
|
11334
|
var /** @type {?} */ boundValue = void 0;
|
11335
|
switch (binding.bindingType) {
|
11336
|
case 0 /* First */:
|
11337
|
boundValue = queryList.first;
|
11338
|
break;
|
11339
|
case 1 /* All */:
|
11340
|
boundValue = queryList;
|
11341
|
notify = true;
|
11342
|
break;
|
11343
|
}
|
11344
|
directiveInstance[binding.propName] = boundValue;
|
11345
|
}
|
11346
|
if (notify) {
|
11347
|
queryList.notifyOnChanges();
|
11348
|
}
|
11349
|
}
|
11350
|
/**
|
11351
|
* @param {?} view
|
11352
|
* @param {?} startIndex
|
11353
|
* @param {?} endIndex
|
11354
|
* @param {?} queryDef
|
11355
|
* @param {?} values
|
11356
|
* @return {?}
|
11357
|
*/
|
11358
|
function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
|
11359
|
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
|
11360
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
11361
|
var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id];
|
11362
|
if (valueType != null) {
|
11363
|
values.push(getQueryValue(view, nodeDef, valueType));
|
11364
|
}
|
11365
|
if (nodeDef.flags & 1 /* TypeElement */ && ((nodeDef.element)).template &&
|
11366
|
(((((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
|
11367
|
queryDef.filterId) {
|
11368
|
var /** @type {?} */ elementData = asElementData(view, i);
|
11369
|
// check embedded views that were attached at the place of their template,
|
11370
|
// but process child nodes first if some match the query (see issue #16568)
|
11371
|
if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
|
11372
|
calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
|
11373
|
i += nodeDef.childCount;
|
11374
|
}
|
11375
|
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
|
11376
|
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
11377
|
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
|
11378
|
var /** @type {?} */ embeddedView = embeddedViews[k];
|
11379
|
var /** @type {?} */ dvc = declaredViewContainer(embeddedView);
|
11380
|
if (dvc && dvc === elementData) {
|
11381
|
calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
|
11382
|
}
|
11383
|
}
|
11384
|
}
|
11385
|
var /** @type {?} */ projectedViews = elementData.template._projectedViews;
|
11386
|
if (projectedViews) {
|
11387
|
for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) {
|
11388
|
var /** @type {?} */ projectedView = projectedViews[k];
|
11389
|
calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
|
11390
|
}
|
11391
|
}
|
11392
|
}
|
11393
|
if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
|
11394
|
// if no child matches the query, skip the children.
|
11395
|
i += nodeDef.childCount;
|
11396
|
}
|
11397
|
}
|
11398
|
return values;
|
11399
|
}
|
11400
|
/**
|
11401
|
* @param {?} view
|
11402
|
* @param {?} nodeDef
|
11403
|
* @param {?} queryValueType
|
11404
|
* @return {?}
|
11405
|
*/
|
11406
|
function getQueryValue(view, nodeDef, queryValueType) {
|
11407
|
if (queryValueType != null) {
|
11408
|
// a match
|
11409
|
switch (queryValueType) {
|
11410
|
case 1 /* RenderElement */:
|
11411
|
return asElementData(view, nodeDef.nodeIndex).renderElement;
|
11412
|
case 0 /* ElementRef */:
|
11413
|
return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
|
11414
|
case 2 /* TemplateRef */:
|
11415
|
return asElementData(view, nodeDef.nodeIndex).template;
|
11416
|
case 3 /* ViewContainerRef */:
|
11417
|
return asElementData(view, nodeDef.nodeIndex).viewContainer;
|
11418
|
case 4 /* Provider */:
|
11419
|
return asProviderData(view, nodeDef.nodeIndex).instance;
|
11420
|
}
|
11421
|
}
|
11422
|
}
|
11423
|
/**
|
11424
|
* @license
|
11425
|
* Copyright Google Inc. All Rights Reserved.
|
11426
|
*
|
11427
|
* Use of this source code is governed by an MIT-style license that can be
|
11428
|
* found in the LICENSE file at https://angular.io/license
|
11429
|
*/
|
11430
|
/**
|
11431
|
* @param {?} ngContentIndex
|
11432
|
* @param {?} index
|
11433
|
* @return {?}
|
11434
|
*/
|
11435
|
function ngContentDef(ngContentIndex, index) {
|
11436
|
return {
|
11437
|
// will bet set by the view definition
|
11438
|
nodeIndex: -1,
|
11439
|
parent: null,
|
11440
|
renderParent: null,
|
11441
|
bindingIndex: -1,
|
11442
|
outputIndex: -1,
|
11443
|
// regular values
|
11444
|
checkIndex: -1,
|
11445
|
flags: 8 /* TypeNgContent */,
|
11446
|
childFlags: 0,
|
11447
|
directChildFlags: 0,
|
11448
|
childMatchedQueries: 0,
|
11449
|
matchedQueries: {},
|
11450
|
matchedQueryIds: 0,
|
11451
|
references: {}, ngContentIndex: ngContentIndex,
|
11452
|
childCount: 0,
|
11453
|
bindings: [],
|
11454
|
bindingFlags: 0,
|
11455
|
outputs: [],
|
11456
|
element: null,
|
11457
|
provider: null,
|
11458
|
text: null,
|
11459
|
query: null,
|
11460
|
ngContent: { index: index }
|
11461
|
};
|
11462
|
}
|
11463
|
/**
|
11464
|
* @param {?} view
|
11465
|
* @param {?} renderHost
|
11466
|
* @param {?} def
|
11467
|
* @return {?}
|
11468
|
*/
|
11469
|
function appendNgContent(view, renderHost, def) {
|
11470
|
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
|
11471
|
if (!parentEl) {
|
11472
|
// Nothing to do if there is no parent element.
|
11473
|
return;
|
11474
|
}
|
11475
|
var /** @type {?} */ ngContentIndex = ((def.ngContent)).index;
|
11476
|
visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined);
|
11477
|
}
|
11478
|
/**
|
11479
|
* @license
|
11480
|
* Copyright Google Inc. All Rights Reserved.
|
11481
|
*
|
11482
|
* Use of this source code is governed by an MIT-style license that can be
|
11483
|
* found in the LICENSE file at https://angular.io/license
|
11484
|
*/
|
11485
|
/**
|
11486
|
* @param {?} checkIndex
|
11487
|
* @param {?} argCount
|
11488
|
* @return {?}
|
11489
|
*/
|
11490
|
function purePipeDef(checkIndex, argCount) {
|
11491
|
// argCount + 1 to include the pipe as first arg
|
11492
|
return _pureExpressionDef(128 /* TypePurePipe */, checkIndex, new Array(argCount + 1));
|
11493
|
}
|
11494
|
/**
|
11495
|
* @param {?} checkIndex
|
11496
|
* @param {?} argCount
|
11497
|
* @return {?}
|
11498
|
*/
|
11499
|
function pureArrayDef(checkIndex, argCount) {
|
11500
|
return _pureExpressionDef(32 /* TypePureArray */, checkIndex, new Array(argCount));
|
11501
|
}
|
11502
|
/**
|
11503
|
* @param {?} checkIndex
|
11504
|
* @param {?} propToIndex
|
11505
|
* @return {?}
|
11506
|
*/
|
11507
|
function pureObjectDef(checkIndex, propToIndex) {
|
11508
|
var /** @type {?} */ keys = Object.keys(propToIndex);
|
11509
|
var /** @type {?} */ nbKeys = keys.length;
|
11510
|
var /** @type {?} */ propertyNames = new Array(nbKeys);
|
11511
|
for (var /** @type {?} */ i = 0; i < nbKeys; i++) {
|
11512
|
var /** @type {?} */ key = keys[i];
|
11513
|
var /** @type {?} */ index = propToIndex[key];
|
11514
|
propertyNames[index] = key;
|
11515
|
}
|
11516
|
return _pureExpressionDef(64 /* TypePureObject */, checkIndex, propertyNames);
|
11517
|
}
|
11518
|
/**
|
11519
|
* @param {?} flags
|
11520
|
* @param {?} checkIndex
|
11521
|
* @param {?} propertyNames
|
11522
|
* @return {?}
|
11523
|
*/
|
11524
|
function _pureExpressionDef(flags, checkIndex, propertyNames) {
|
11525
|
var /** @type {?} */ bindings = new Array(propertyNames.length);
|
11526
|
for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) {
|
11527
|
var /** @type {?} */ prop = propertyNames[i];
|
11528
|
bindings[i] = {
|
11529
|
flags: 8 /* TypeProperty */,
|
11530
|
name: prop,
|
11531
|
ns: null,
|
11532
|
nonMinifiedName: prop,
|
11533
|
securityContext: null,
|
11534
|
suffix: null
|
11535
|
};
|
11536
|
}
|
11537
|
return {
|
11538
|
// will bet set by the view definition
|
11539
|
nodeIndex: -1,
|
11540
|
parent: null,
|
11541
|
renderParent: null,
|
11542
|
bindingIndex: -1,
|
11543
|
outputIndex: -1,
|
11544
|
// regular values
|
11545
|
checkIndex: checkIndex,
|
11546
|
flags: flags,
|
11547
|
childFlags: 0,
|
11548
|
directChildFlags: 0,
|
11549
|
childMatchedQueries: 0,
|
11550
|
matchedQueries: {},
|
11551
|
matchedQueryIds: 0,
|
11552
|
references: {},
|
11553
|
ngContentIndex: -1,
|
11554
|
childCount: 0, bindings: bindings,
|
11555
|
bindingFlags: calcBindingFlags(bindings),
|
11556
|
outputs: [],
|
11557
|
element: null,
|
11558
|
provider: null,
|
11559
|
text: null,
|
11560
|
query: null,
|
11561
|
ngContent: null
|
11562
|
};
|
11563
|
}
|
11564
|
/**
|
11565
|
* @param {?} view
|
11566
|
* @param {?} def
|
11567
|
* @return {?}
|
11568
|
*/
|
11569
|
function createPureExpression(view, def) {
|
11570
|
return { value: undefined };
|
11571
|
}
|
11572
|
/**
|
11573
|
* @param {?} view
|
11574
|
* @param {?} def
|
11575
|
* @param {?} v0
|
11576
|
* @param {?} v1
|
11577
|
* @param {?} v2
|
11578
|
* @param {?} v3
|
11579
|
* @param {?} v4
|
11580
|
* @param {?} v5
|
11581
|
* @param {?} v6
|
11582
|
* @param {?} v7
|
11583
|
* @param {?} v8
|
11584
|
* @param {?} v9
|
11585
|
* @return {?}
|
11586
|
*/
|
11587
|
function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
11588
|
var /** @type {?} */ bindings = def.bindings;
|
11589
|
var /** @type {?} */ changed = false;
|
11590
|
var /** @type {?} */ bindLen = bindings.length;
|
11591
|
if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
11592
|
changed = true;
|
11593
|
if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
11594
|
changed = true;
|
11595
|
if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
11596
|
changed = true;
|
11597
|
if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
11598
|
changed = true;
|
11599
|
if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
11600
|
changed = true;
|
11601
|
if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
11602
|
changed = true;
|
11603
|
if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
11604
|
changed = true;
|
11605
|
if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
11606
|
changed = true;
|
11607
|
if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
11608
|
changed = true;
|
11609
|
if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
11610
|
changed = true;
|
11611
|
if (changed) {
|
11612
|
var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
|
11613
|
var /** @type {?} */ value = void 0;
|
11614
|
switch (def.flags & 201347067 /* Types */) {
|
11615
|
case 32 /* TypePureArray */:
|
11616
|
value = new Array(bindings.length);
|
11617
|
if (bindLen > 0)
|
11618
|
value[0] = v0;
|
11619
|
if (bindLen > 1)
|
11620
|
value[1] = v1;
|
11621
|
if (bindLen > 2)
|
11622
|
value[2] = v2;
|
11623
|
if (bindLen > 3)
|
11624
|
value[3] = v3;
|
11625
|
if (bindLen > 4)
|
11626
|
value[4] = v4;
|
11627
|
if (bindLen > 5)
|
11628
|
value[5] = v5;
|
11629
|
if (bindLen > 6)
|
11630
|
value[6] = v6;
|
11631
|
if (bindLen > 7)
|
11632
|
value[7] = v7;
|
11633
|
if (bindLen > 8)
|
11634
|
value[8] = v8;
|
11635
|
if (bindLen > 9)
|
11636
|
value[9] = v9;
|
11637
|
break;
|
11638
|
case 64 /* TypePureObject */:
|
11639
|
value = {};
|
11640
|
if (bindLen > 0)
|
11641
|
value[((bindings[0].name))] = v0;
|
11642
|
if (bindLen > 1)
|
11643
|
value[((bindings[1].name))] = v1;
|
11644
|
if (bindLen > 2)
|
11645
|
value[((bindings[2].name))] = v2;
|
11646
|
if (bindLen > 3)
|
11647
|
value[((bindings[3].name))] = v3;
|
11648
|
if (bindLen > 4)
|
11649
|
value[((bindings[4].name))] = v4;
|
11650
|
if (bindLen > 5)
|
11651
|
value[((bindings[5].name))] = v5;
|
11652
|
if (bindLen > 6)
|
11653
|
value[((bindings[6].name))] = v6;
|
11654
|
if (bindLen > 7)
|
11655
|
value[((bindings[7].name))] = v7;
|
11656
|
if (bindLen > 8)
|
11657
|
value[((bindings[8].name))] = v8;
|
11658
|
if (bindLen > 9)
|
11659
|
value[((bindings[9].name))] = v9;
|
11660
|
break;
|
11661
|
case 128 /* TypePurePipe */:
|
11662
|
var /** @type {?} */ pipe = v0;
|
11663
|
switch (bindLen) {
|
11664
|
case 1:
|
11665
|
value = pipe.transform(v0);
|
11666
|
break;
|
11667
|
case 2:
|
11668
|
value = pipe.transform(v1);
|
11669
|
break;
|
11670
|
case 3:
|
11671
|
value = pipe.transform(v1, v2);
|
11672
|
break;
|
11673
|
case 4:
|
11674
|
value = pipe.transform(v1, v2, v3);
|
11675
|
break;
|
11676
|
case 5:
|
11677
|
value = pipe.transform(v1, v2, v3, v4);
|
11678
|
break;
|
11679
|
case 6:
|
11680
|
value = pipe.transform(v1, v2, v3, v4, v5);
|
11681
|
break;
|
11682
|
case 7:
|
11683
|
value = pipe.transform(v1, v2, v3, v4, v5, v6);
|
11684
|
break;
|
11685
|
case 8:
|
11686
|
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
|
11687
|
break;
|
11688
|
case 9:
|
11689
|
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
|
11690
|
break;
|
11691
|
case 10:
|
11692
|
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
11693
|
break;
|
11694
|
}
|
11695
|
break;
|
11696
|
}
|
11697
|
data.value = value;
|
11698
|
}
|
11699
|
return changed;
|
11700
|
}
|
11701
|
/**
|
11702
|
* @param {?} view
|
11703
|
* @param {?} def
|
11704
|
* @param {?} values
|
11705
|
* @return {?}
|
11706
|
*/
|
11707
|
function checkAndUpdatePureExpressionDynamic(view, def, values) {
|
11708
|
var /** @type {?} */ bindings = def.bindings;
|
11709
|
var /** @type {?} */ changed = false;
|
11710
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
11711
|
// Note: We need to loop over all values, so that
|
11712
|
// the old values are updates as well!
|
11713
|
if (checkAndUpdateBinding(view, def, i, values[i])) {
|
11714
|
changed = true;
|
11715
|
}
|
11716
|
}
|
11717
|
if (changed) {
|
11718
|
var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
|
11719
|
var /** @type {?} */ value = void 0;
|
11720
|
switch (def.flags & 201347067 /* Types */) {
|
11721
|
case 32 /* TypePureArray */:
|
11722
|
value = values;
|
11723
|
break;
|
11724
|
case 64 /* TypePureObject */:
|
11725
|
value = {};
|
11726
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
11727
|
value[((bindings[i].name))] = values[i];
|
11728
|
}
|
11729
|
break;
|
11730
|
case 128 /* TypePurePipe */:
|
11731
|
var /** @type {?} */ pipe = values[0];
|
11732
|
var /** @type {?} */ params = values.slice(1);
|
11733
|
value = pipe.transform.apply(pipe, params);
|
11734
|
break;
|
11735
|
}
|
11736
|
data.value = value;
|
11737
|
}
|
11738
|
return changed;
|
11739
|
}
|
11740
|
/**
|
11741
|
* @license
|
11742
|
* Copyright Google Inc. All Rights Reserved.
|
11743
|
*
|
11744
|
* Use of this source code is governed by an MIT-style license that can be
|
11745
|
* found in the LICENSE file at https://angular.io/license
|
11746
|
*/
|
11747
|
/**
|
11748
|
* @param {?} checkIndex
|
11749
|
* @param {?} ngContentIndex
|
11750
|
* @param {?} staticText
|
11751
|
* @return {?}
|
11752
|
*/
|
11753
|
function textDef(checkIndex, ngContentIndex, staticText) {
|
11754
|
var /** @type {?} */ bindings = new Array(staticText.length - 1);
|
11755
|
for (var /** @type {?} */ i = 1; i < staticText.length; i++) {
|
11756
|
bindings[i - 1] = {
|
11757
|
flags: 8 /* TypeProperty */,
|
11758
|
name: null,
|
11759
|
ns: null,
|
11760
|
nonMinifiedName: null,
|
11761
|
securityContext: null,
|
11762
|
suffix: staticText[i],
|
11763
|
};
|
11764
|
}
|
11765
|
return {
|
11766
|
// will bet set by the view definition
|
11767
|
nodeIndex: -1,
|
11768
|
parent: null,
|
11769
|
renderParent: null,
|
11770
|
bindingIndex: -1,
|
11771
|
outputIndex: -1,
|
11772
|
// regular values
|
11773
|
checkIndex: checkIndex,
|
11774
|
flags: 2 /* TypeText */,
|
11775
|
childFlags: 0,
|
11776
|
directChildFlags: 0,
|
11777
|
childMatchedQueries: 0,
|
11778
|
matchedQueries: {},
|
11779
|
matchedQueryIds: 0,
|
11780
|
references: {}, ngContentIndex: ngContentIndex,
|
11781
|
childCount: 0, bindings: bindings,
|
11782
|
bindingFlags: 8 /* TypeProperty */,
|
11783
|
outputs: [],
|
11784
|
element: null,
|
11785
|
provider: null,
|
11786
|
text: { prefix: staticText[0] },
|
11787
|
query: null,
|
11788
|
ngContent: null,
|
11789
|
};
|
11790
|
}
|
11791
|
/**
|
11792
|
* @param {?} view
|
11793
|
* @param {?} renderHost
|
11794
|
* @param {?} def
|
11795
|
* @return {?}
|
11796
|
*/
|
11797
|
function createText(view, renderHost, def) {
|
11798
|
var /** @type {?} */ renderNode$$1;
|
11799
|
var /** @type {?} */ renderer = view.renderer;
|
11800
|
renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix);
|
11801
|
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
|
11802
|
if (parentEl) {
|
11803
|
renderer.appendChild(parentEl, renderNode$$1);
|
11804
|
}
|
11805
|
return { renderText: renderNode$$1 };
|
11806
|
}
|
11807
|
/**
|
11808
|
* @param {?} view
|
11809
|
* @param {?} def
|
11810
|
* @param {?} v0
|
11811
|
* @param {?} v1
|
11812
|
* @param {?} v2
|
11813
|
* @param {?} v3
|
11814
|
* @param {?} v4
|
11815
|
* @param {?} v5
|
11816
|
* @param {?} v6
|
11817
|
* @param {?} v7
|
11818
|
* @param {?} v8
|
11819
|
* @param {?} v9
|
11820
|
* @return {?}
|
11821
|
*/
|
11822
|
function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
11823
|
var /** @type {?} */ changed = false;
|
11824
|
var /** @type {?} */ bindings = def.bindings;
|
11825
|
var /** @type {?} */ bindLen = bindings.length;
|
11826
|
if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
11827
|
changed = true;
|
11828
|
if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
11829
|
changed = true;
|
11830
|
if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
11831
|
changed = true;
|
11832
|
if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
11833
|
changed = true;
|
11834
|
if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
11835
|
changed = true;
|
11836
|
if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
11837
|
changed = true;
|
11838
|
if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
11839
|
changed = true;
|
11840
|
if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
11841
|
changed = true;
|
11842
|
if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
11843
|
changed = true;
|
11844
|
if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
11845
|
changed = true;
|
11846
|
if (changed) {
|
11847
|
var /** @type {?} */ value = ((def.text)).prefix;
|
11848
|
if (bindLen > 0)
|
11849
|
value += _addInterpolationPart(v0, bindings[0]);
|
11850
|
if (bindLen > 1)
|
11851
|
value += _addInterpolationPart(v1, bindings[1]);
|
11852
|
if (bindLen > 2)
|
11853
|
value += _addInterpolationPart(v2, bindings[2]);
|
11854
|
if (bindLen > 3)
|
11855
|
value += _addInterpolationPart(v3, bindings[3]);
|
11856
|
if (bindLen > 4)
|
11857
|
value += _addInterpolationPart(v4, bindings[4]);
|
11858
|
if (bindLen > 5)
|
11859
|
value += _addInterpolationPart(v5, bindings[5]);
|
11860
|
if (bindLen > 6)
|
11861
|
value += _addInterpolationPart(v6, bindings[6]);
|
11862
|
if (bindLen > 7)
|
11863
|
value += _addInterpolationPart(v7, bindings[7]);
|
11864
|
if (bindLen > 8)
|
11865
|
value += _addInterpolationPart(v8, bindings[8]);
|
11866
|
if (bindLen > 9)
|
11867
|
value += _addInterpolationPart(v9, bindings[9]);
|
11868
|
var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
|
11869
|
view.renderer.setValue(renderNode$$1, value);
|
11870
|
}
|
11871
|
return changed;
|
11872
|
}
|
11873
|
/**
|
11874
|
* @param {?} view
|
11875
|
* @param {?} def
|
11876
|
* @param {?} values
|
11877
|
* @return {?}
|
11878
|
*/
|
11879
|
function checkAndUpdateTextDynamic(view, def, values) {
|
11880
|
var /** @type {?} */ bindings = def.bindings;
|
11881
|
var /** @type {?} */ changed = false;
|
11882
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
11883
|
// Note: We need to loop over all values, so that
|
11884
|
// the old values are updates as well!
|
11885
|
if (checkAndUpdateBinding(view, def, i, values[i])) {
|
11886
|
changed = true;
|
11887
|
}
|
11888
|
}
|
11889
|
if (changed) {
|
11890
|
var /** @type {?} */ value = '';
|
11891
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
11892
|
value = value + _addInterpolationPart(values[i], bindings[i]);
|
11893
|
}
|
11894
|
value = ((def.text)).prefix + value;
|
11895
|
var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
|
11896
|
view.renderer.setValue(renderNode$$1, value);
|
11897
|
}
|
11898
|
return changed;
|
11899
|
}
|
11900
|
/**
|
11901
|
* @param {?} value
|
11902
|
* @param {?} binding
|
11903
|
* @return {?}
|
11904
|
*/
|
11905
|
function _addInterpolationPart(value, binding) {
|
11906
|
var /** @type {?} */ valueStr = value != null ? value.toString() : '';
|
11907
|
return valueStr + binding.suffix;
|
11908
|
}
|
11909
|
/**
|
11910
|
* @license
|
11911
|
* Copyright Google Inc. All Rights Reserved.
|
11912
|
*
|
11913
|
* Use of this source code is governed by an MIT-style license that can be
|
11914
|
* found in the LICENSE file at https://angular.io/license
|
11915
|
*/
|
11916
|
/**
|
11917
|
* @param {?} flags
|
11918
|
* @param {?} nodes
|
11919
|
* @param {?=} updateDirectives
|
11920
|
* @param {?=} updateRenderer
|
11921
|
* @return {?}
|
11922
|
*/
|
11923
|
function viewDef(flags, nodes, updateDirectives, updateRenderer) {
|
11924
|
// clone nodes and set auto calculated values
|
11925
|
var /** @type {?} */ viewBindingCount = 0;
|
11926
|
var /** @type {?} */ viewDisposableCount = 0;
|
11927
|
var /** @type {?} */ viewNodeFlags = 0;
|
11928
|
var /** @type {?} */ viewRootNodeFlags = 0;
|
11929
|
var /** @type {?} */ viewMatchedQueries = 0;
|
11930
|
var /** @type {?} */ currentParent = null;
|
11931
|
var /** @type {?} */ currentRenderParent = null;
|
11932
|
var /** @type {?} */ currentElementHasPublicProviders = false;
|
11933
|
var /** @type {?} */ currentElementHasPrivateProviders = false;
|
11934
|
var /** @type {?} */ lastRenderRootNode = null;
|
11935
|
for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
|
11936
|
var /** @type {?} */ node = nodes[i];
|
11937
|
node.nodeIndex = i;
|
11938
|
node.parent = currentParent;
|
11939
|
node.bindingIndex = viewBindingCount;
|
11940
|
node.outputIndex = viewDisposableCount;
|
11941
|
node.renderParent = currentRenderParent;
|
11942
|
viewNodeFlags |= node.flags;
|
11943
|
viewMatchedQueries |= node.matchedQueryIds;
|
11944
|
if (node.element) {
|
11945
|
var /** @type {?} */ elDef = node.element;
|
11946
|
elDef.publicProviders =
|
11947
|
currentParent ? ((currentParent.element)).publicProviders : Object.create(null);
|
11948
|
elDef.allProviders = elDef.publicProviders;
|
11949
|
// Note: We assume that all providers of an element are before any child element!
|
11950
|
currentElementHasPublicProviders = false;
|
11951
|
currentElementHasPrivateProviders = false;
|
11952
|
if (node.element.template) {
|
11953
|
viewMatchedQueries |= node.element.template.nodeMatchedQueries;
|
11954
|
}
|
11955
|
}
|
11956
|
validateNode(currentParent, node, nodes.length);
|
11957
|
viewBindingCount += node.bindings.length;
|
11958
|
viewDisposableCount += node.outputs.length;
|
11959
|
if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) {
|
11960
|
lastRenderRootNode = node;
|
11961
|
}
|
11962
|
if (node.flags & 20224 /* CatProvider */) {
|
11963
|
if (!currentElementHasPublicProviders) {
|
11964
|
currentElementHasPublicProviders = true; /** @type {?} */
|
11965
|
((((
|
11966
|
// Use prototypical inheritance to not get O(n^2) complexity...
|
11967
|
currentParent)).element)).publicProviders =
|
11968
|
Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders); /** @type {?} */
|
11969
|
((((currentParent)).element)).allProviders = ((((currentParent)).element)).publicProviders;
|
11970
|
}
|
11971
|
var /** @type {?} */ isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0;
|
11972
|
var /** @type {?} */ isComponent = (node.flags & 32768 /* Component */) !== 0;
|
11973
|
if (!isPrivateService || isComponent) {
|
11974
|
((((((currentParent)).element)).publicProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
|
11975
|
}
|
11976
|
else {
|
11977
|
if (!currentElementHasPrivateProviders) {
|
11978
|
currentElementHasPrivateProviders = true; /** @type {?} */
|
11979
|
((((
|
11980
|
// Use prototypical inheritance to not get O(n^2) complexity...
|
11981
|
currentParent)).element)).allProviders =
|
11982
|
Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders);
|
11983
|
} /** @type {?} */
|
11984
|
((((((currentParent)).element)).allProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
|
11985
|
}
|
11986
|
if (isComponent) {
|
11987
|
((((currentParent)).element)).componentProvider = node;
|
11988
|
}
|
11989
|
}
|
11990
|
if (currentParent) {
|
11991
|
currentParent.childFlags |= node.flags;
|
11992
|
currentParent.directChildFlags |= node.flags;
|
11993
|
currentParent.childMatchedQueries |= node.matchedQueryIds;
|
11994
|
if (node.element && node.element.template) {
|
11995
|
currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
|
11996
|
}
|
11997
|
}
|
11998
|
else {
|
11999
|
viewRootNodeFlags |= node.flags;
|
12000
|
}
|
12001
|
if (node.childCount > 0) {
|
12002
|
currentParent = node;
|
12003
|
if (!isNgContainer(node)) {
|
12004
|
currentRenderParent = node;
|
12005
|
}
|
12006
|
}
|
12007
|
else {
|
12008
|
// When the current node has no children, check if it is the last children of its parent.
|
12009
|
// When it is, propagate the flags up.
|
12010
|
// The loop is required because an element could be the last transitive children of several
|
12011
|
// elements. We loop to either the root or the highest opened element (= with remaining
|
12012
|
// children)
|
12013
|
while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
|
12014
|
var /** @type {?} */ newParent = currentParent.parent;
|
12015
|
if (newParent) {
|
12016
|
newParent.childFlags |= currentParent.childFlags;
|
12017
|
newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
12018
|
}
|
12019
|
currentParent = newParent;
|
12020
|
// We also need to update the render parent & account for ng-container
|
12021
|
if (currentParent && isNgContainer(currentParent)) {
|
12022
|
currentRenderParent = currentParent.renderParent;
|
12023
|
}
|
12024
|
else {
|
12025
|
currentRenderParent = currentParent;
|
12026
|
}
|
12027
|
}
|
12028
|
}
|
12029
|
}
|
12030
|
var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return ((((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
|
12031
|
return {
|
12032
|
// Will be filled later...
|
12033
|
factory: null,
|
12034
|
nodeFlags: viewNodeFlags,
|
12035
|
rootNodeFlags: viewRootNodeFlags,
|
12036
|
nodeMatchedQueries: viewMatchedQueries, flags: flags,
|
12037
|
nodes: nodes,
|
12038
|
updateDirectives: updateDirectives || NOOP,
|
12039
|
updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent,
|
12040
|
bindingCount: viewBindingCount,
|
12041
|
outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
|
12042
|
};
|
12043
|
}
|
12044
|
/**
|
12045
|
* @param {?} node
|
12046
|
* @return {?}
|
12047
|
*/
|
12048
|
function isNgContainer(node) {
|
12049
|
return (node.flags & 1 /* TypeElement */) !== 0 && ((node.element)).name === null;
|
12050
|
}
|
12051
|
/**
|
12052
|
* @param {?} parent
|
12053
|
* @param {?} node
|
12054
|
* @param {?} nodeCount
|
12055
|
* @return {?}
|
12056
|
*/
|
12057
|
function validateNode(parent, node, nodeCount) {
|
12058
|
var /** @type {?} */ template = node.element && node.element.template;
|
12059
|
if (template) {
|
12060
|
if (!template.lastRenderRootNode) {
|
12061
|
throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
|
12062
|
}
|
12063
|
if (template.lastRenderRootNode &&
|
12064
|
template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) {
|
12065
|
throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.nodeIndex + "!");
|
12066
|
}
|
12067
|
}
|
12068
|
if (node.flags & 20224 /* CatProvider */) {
|
12069
|
var /** @type {?} */ parentFlags = parent ? parent.flags : 0;
|
12070
|
if ((parentFlags & 1 /* TypeElement */) === 0) {
|
12071
|
throw new Error("Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index " + node.nodeIndex + "!");
|
12072
|
}
|
12073
|
}
|
12074
|
if (node.query) {
|
12075
|
if (node.flags & 67108864 /* TypeContentQuery */ &&
|
12076
|
(!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) {
|
12077
|
throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.nodeIndex + "!");
|
12078
|
}
|
12079
|
if (node.flags & 134217728 /* TypeViewQuery */ && parent) {
|
12080
|
throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.nodeIndex + "!");
|
12081
|
}
|
12082
|
}
|
12083
|
if (node.childCount) {
|
12084
|
var /** @type {?} */ parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
|
12085
|
if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
|
12086
|
throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.nodeIndex + "!");
|
12087
|
}
|
12088
|
}
|
12089
|
}
|
12090
|
/**
|
12091
|
* @param {?} parent
|
12092
|
* @param {?} anchorDef
|
12093
|
* @param {?} viewDef
|
12094
|
* @param {?=} context
|
12095
|
* @return {?}
|
12096
|
*/
|
12097
|
function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
|
12098
|
// embedded views are seen as siblings to the anchor, so we need
|
12099
|
// to get the parent of the anchor and use it as parentIndex.
|
12100
|
var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
|
12101
|
initView(view, parent.component, context);
|
12102
|
createViewNodes(view);
|
12103
|
return view;
|
12104
|
}
|
12105
|
/**
|
12106
|
* @param {?} root
|
12107
|
* @param {?} def
|
12108
|
* @param {?=} context
|
12109
|
* @return {?}
|
12110
|
*/
|
12111
|
function createRootView(root, def, context) {
|
12112
|
var /** @type {?} */ view = createView(root, root.renderer, null, null, def);
|
12113
|
initView(view, context, context);
|
12114
|
createViewNodes(view);
|
12115
|
return view;
|
12116
|
}
|
12117
|
/**
|
12118
|
* @param {?} parentView
|
12119
|
* @param {?} nodeDef
|
12120
|
* @param {?} viewDef
|
12121
|
* @param {?} hostElement
|
12122
|
* @return {?}
|
12123
|
*/
|
12124
|
function createComponentView(parentView, nodeDef, viewDef, hostElement) {
|
12125
|
var /** @type {?} */ rendererType = ((nodeDef.element)).componentRendererType;
|
12126
|
var /** @type {?} */ compRenderer;
|
12127
|
if (!rendererType) {
|
12128
|
compRenderer = parentView.root.renderer;
|
12129
|
}
|
12130
|
else {
|
12131
|
compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
|
12132
|
}
|
12133
|
return createView(parentView.root, compRenderer, parentView, /** @type {?} */ ((nodeDef.element)).componentProvider, viewDef);
|
12134
|
}
|
12135
|
/**
|
12136
|
* @param {?} root
|
12137
|
* @param {?} renderer
|
12138
|
* @param {?} parent
|
12139
|
* @param {?} parentNodeDef
|
12140
|
* @param {?} def
|
12141
|
* @return {?}
|
12142
|
*/
|
12143
|
function createView(root, renderer, parent, parentNodeDef, def) {
|
12144
|
var /** @type {?} */ nodes = new Array(def.nodes.length);
|
12145
|
var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null;
|
12146
|
var /** @type {?} */ view = {
|
12147
|
def: def,
|
12148
|
parent: parent,
|
12149
|
viewContainerParent: null, parentNodeDef: parentNodeDef,
|
12150
|
context: null,
|
12151
|
component: null, nodes: nodes,
|
12152
|
state: 13 /* CatInit */, root: root, renderer: renderer,
|
12153
|
oldValues: new Array(def.bindingCount), disposables: disposables
|
12154
|
};
|
12155
|
return view;
|
12156
|
}
|
12157
|
/**
|
12158
|
* @param {?} view
|
12159
|
* @param {?} component
|
12160
|
* @param {?} context
|
12161
|
* @return {?}
|
12162
|
*/
|
12163
|
function initView(view, component, context) {
|
12164
|
view.component = component;
|
12165
|
view.context = context;
|
12166
|
}
|
12167
|
/**
|
12168
|
* @param {?} view
|
12169
|
* @return {?}
|
12170
|
*/
|
12171
|
function createViewNodes(view) {
|
12172
|
var /** @type {?} */ renderHost;
|
12173
|
if (isComponentView(view)) {
|
12174
|
var /** @type {?} */ hostDef = view.parentNodeDef;
|
12175
|
renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((((hostDef)).parent)).nodeIndex).renderElement;
|
12176
|
}
|
12177
|
var /** @type {?} */ def = view.def;
|
12178
|
var /** @type {?} */ nodes = view.nodes;
|
12179
|
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
|
12180
|
var /** @type {?} */ nodeDef = def.nodes[i];
|
12181
|
Services.setCurrentNode(view, i);
|
12182
|
var /** @type {?} */ nodeData = void 0;
|
12183
|
switch (nodeDef.flags & 201347067 /* Types */) {
|
12184
|
case 1 /* TypeElement */:
|
12185
|
var /** @type {?} */ el = (createElement(view, renderHost, nodeDef));
|
12186
|
var /** @type {?} */ componentView = ((undefined));
|
12187
|
if (nodeDef.flags & 33554432 /* ComponentView */) {
|
12188
|
var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((((nodeDef.element)).componentView)));
|
12189
|
componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
|
12190
|
}
|
12191
|
listenToElementOutputs(view, componentView, nodeDef, el);
|
12192
|
nodeData = ({
|
12193
|
renderElement: el,
|
12194
|
componentView: componentView,
|
12195
|
viewContainer: null,
|
12196
|
template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
|
12197
|
});
|
12198
|
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
|
12199
|
nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
|
12200
|
}
|
12201
|
break;
|
12202
|
case 2 /* TypeText */:
|
12203
|
nodeData = (createText(view, renderHost, nodeDef));
|
12204
|
break;
|
12205
|
case 512 /* TypeClassProvider */:
|
12206
|
case 1024 /* TypeFactoryProvider */:
|
12207
|
case 2048 /* TypeUseExistingProvider */:
|
12208
|
case 256 /* TypeValueProvider */: {
|
12209
|
nodeData = nodes[i];
|
12210
|
if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */)) {
|
12211
|
var /** @type {?} */ instance = createProviderInstance(view, nodeDef);
|
12212
|
nodeData = ({ instance: instance });
|
12213
|
}
|
12214
|
break;
|
12215
|
}
|
12216
|
case 16 /* TypePipe */: {
|
12217
|
var /** @type {?} */ instance = createPipeInstance(view, nodeDef);
|
12218
|
nodeData = ({ instance: instance });
|
12219
|
break;
|
12220
|
}
|
12221
|
case 16384 /* TypeDirective */: {
|
12222
|
nodeData = nodes[i];
|
12223
|
if (!nodeData) {
|
12224
|
var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef);
|
12225
|
nodeData = ({ instance: instance });
|
12226
|
}
|
12227
|
if (nodeDef.flags & 32768 /* Component */) {
|
12228
|
var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).componentView;
|
12229
|
initView(compView, nodeData.instance, nodeData.instance);
|
12230
|
}
|
12231
|
break;
|
12232
|
}
|
12233
|
case 32 /* TypePureArray */:
|
12234
|
case 64 /* TypePureObject */:
|
12235
|
case 128 /* TypePurePipe */:
|
12236
|
nodeData = (createPureExpression(view, nodeDef));
|
12237
|
break;
|
12238
|
case 67108864 /* TypeContentQuery */:
|
12239
|
case 134217728 /* TypeViewQuery */:
|
12240
|
nodeData = (createQuery());
|
12241
|
break;
|
12242
|
case 8 /* TypeNgContent */:
|
12243
|
appendNgContent(view, renderHost, nodeDef);
|
12244
|
// no runtime data needed for NgContent...
|
12245
|
nodeData = undefined;
|
12246
|
break;
|
12247
|
}
|
12248
|
nodes[i] = nodeData;
|
12249
|
}
|
12250
|
// Create the ViewData.nodes of component views after we created everything else,
|
12251
|
// so that e.g. ng-content works
|
12252
|
execComponentViewsAction(view, ViewAction.CreateViewNodes);
|
12253
|
// fill static content and view queries
|
12254
|
execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */);
|
12255
|
}
|
12256
|
/**
|
12257
|
* @param {?} view
|
12258
|
* @return {?}
|
12259
|
*/
|
12260
|
function checkNoChangesView(view) {
|
12261
|
markProjectedViewsForCheck(view);
|
12262
|
Services.updateDirectives(view, 1 /* CheckNoChanges */);
|
12263
|
execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
|
12264
|
Services.updateRenderer(view, 1 /* CheckNoChanges */);
|
12265
|
execComponentViewsAction(view, ViewAction.CheckNoChanges);
|
12266
|
// Note: We don't check queries for changes as we didn't do this in v2.x.
|
12267
|
// TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message.
|
12268
|
view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
|
12269
|
}
|
12270
|
/**
|
12271
|
* @param {?} view
|
12272
|
* @return {?}
|
12273
|
*/
|
12274
|
function checkAndUpdateView(view) {
|
12275
|
if (view.state & 1 /* BeforeFirstCheck */) {
|
12276
|
view.state &= ~1 /* BeforeFirstCheck */;
|
12277
|
view.state |= 2 /* FirstCheck */;
|
12278
|
}
|
12279
|
else {
|
12280
|
view.state &= ~2 /* FirstCheck */;
|
12281
|
}
|
12282
|
markProjectedViewsForCheck(view);
|
12283
|
Services.updateDirectives(view, 0 /* CheckAndUpdate */);
|
12284
|
execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
|
12285
|
execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
|
12286
|
callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ |
|
12287
|
(view.state & 2 /* FirstCheck */ ? 1048576 /* AfterContentInit */ : 0));
|
12288
|
Services.updateRenderer(view, 0 /* CheckAndUpdate */);
|
12289
|
execComponentViewsAction(view, ViewAction.CheckAndUpdate);
|
12290
|
execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
|
12291
|
callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ |
|
12292
|
(view.state & 2 /* FirstCheck */ ? 4194304 /* AfterViewInit */ : 0));
|
12293
|
if (view.def.flags & 2 /* OnPush */) {
|
12294
|
view.state &= ~8 /* ChecksEnabled */;
|
12295
|
}
|
12296
|
view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
|
12297
|
}
|
12298
|
/**
|
12299
|
* @param {?} view
|
12300
|
* @param {?} nodeDef
|
12301
|
* @param {?} argStyle
|
12302
|
* @param {?=} v0
|
12303
|
* @param {?=} v1
|
12304
|
* @param {?=} v2
|
12305
|
* @param {?=} v3
|
12306
|
* @param {?=} v4
|
12307
|
* @param {?=} v5
|
12308
|
* @param {?=} v6
|
12309
|
* @param {?=} v7
|
12310
|
* @param {?=} v8
|
12311
|
* @param {?=} v9
|
12312
|
* @return {?}
|
12313
|
*/
|
12314
|
function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12315
|
if (argStyle === 0 /* Inline */) {
|
12316
|
return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12317
|
}
|
12318
|
else {
|
12319
|
return checkAndUpdateNodeDynamic(view, nodeDef, v0);
|
12320
|
}
|
12321
|
}
|
12322
|
/**
|
12323
|
* @param {?} view
|
12324
|
* @return {?}
|
12325
|
*/
|
12326
|
function markProjectedViewsForCheck(view) {
|
12327
|
var /** @type {?} */ def = view.def;
|
12328
|
if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) {
|
12329
|
return;
|
12330
|
}
|
12331
|
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
|
12332
|
var /** @type {?} */ nodeDef = def.nodes[i];
|
12333
|
if (nodeDef.flags & 4 /* ProjectedTemplate */) {
|
12334
|
var /** @type {?} */ projectedViews = asElementData(view, i).template._projectedViews;
|
12335
|
if (projectedViews) {
|
12336
|
for (var /** @type {?} */ i_1 = 0; i_1 < projectedViews.length; i_1++) {
|
12337
|
var /** @type {?} */ projectedView = projectedViews[i_1];
|
12338
|
projectedView.state |= 32 /* CheckProjectedView */;
|
12339
|
markParentViewsForCheckProjectedViews(projectedView, view);
|
12340
|
}
|
12341
|
}
|
12342
|
}
|
12343
|
else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) {
|
12344
|
// a parent with leafs
|
12345
|
// no child is a component,
|
12346
|
// then skip the children
|
12347
|
i += nodeDef.childCount;
|
12348
|
}
|
12349
|
}
|
12350
|
}
|
12351
|
/**
|
12352
|
* @param {?} view
|
12353
|
* @param {?} nodeDef
|
12354
|
* @param {?=} v0
|
12355
|
* @param {?=} v1
|
12356
|
* @param {?=} v2
|
12357
|
* @param {?=} v3
|
12358
|
* @param {?=} v4
|
12359
|
* @param {?=} v5
|
12360
|
* @param {?=} v6
|
12361
|
* @param {?=} v7
|
12362
|
* @param {?=} v8
|
12363
|
* @param {?=} v9
|
12364
|
* @return {?}
|
12365
|
*/
|
12366
|
function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12367
|
switch (nodeDef.flags & 201347067 /* Types */) {
|
12368
|
case 1 /* TypeElement */:
|
12369
|
return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12370
|
case 2 /* TypeText */:
|
12371
|
return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12372
|
case 16384 /* TypeDirective */:
|
12373
|
return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12374
|
case 32 /* TypePureArray */:
|
12375
|
case 64 /* TypePureObject */:
|
12376
|
case 128 /* TypePurePipe */:
|
12377
|
return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12378
|
default:
|
12379
|
throw 'unreachable';
|
12380
|
}
|
12381
|
}
|
12382
|
/**
|
12383
|
* @param {?} view
|
12384
|
* @param {?} nodeDef
|
12385
|
* @param {?} values
|
12386
|
* @return {?}
|
12387
|
*/
|
12388
|
function checkAndUpdateNodeDynamic(view, nodeDef, values) {
|
12389
|
switch (nodeDef.flags & 201347067 /* Types */) {
|
12390
|
case 1 /* TypeElement */:
|
12391
|
return checkAndUpdateElementDynamic(view, nodeDef, values);
|
12392
|
case 2 /* TypeText */:
|
12393
|
return checkAndUpdateTextDynamic(view, nodeDef, values);
|
12394
|
case 16384 /* TypeDirective */:
|
12395
|
return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
|
12396
|
case 32 /* TypePureArray */:
|
12397
|
case 64 /* TypePureObject */:
|
12398
|
case 128 /* TypePurePipe */:
|
12399
|
return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
|
12400
|
default:
|
12401
|
throw 'unreachable';
|
12402
|
}
|
12403
|
}
|
12404
|
/**
|
12405
|
* @param {?} view
|
12406
|
* @param {?} nodeDef
|
12407
|
* @param {?} argStyle
|
12408
|
* @param {?=} v0
|
12409
|
* @param {?=} v1
|
12410
|
* @param {?=} v2
|
12411
|
* @param {?=} v3
|
12412
|
* @param {?=} v4
|
12413
|
* @param {?=} v5
|
12414
|
* @param {?=} v6
|
12415
|
* @param {?=} v7
|
12416
|
* @param {?=} v8
|
12417
|
* @param {?=} v9
|
12418
|
* @return {?}
|
12419
|
*/
|
12420
|
function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12421
|
if (argStyle === 0 /* Inline */) {
|
12422
|
checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12423
|
}
|
12424
|
else {
|
12425
|
checkNoChangesNodeDynamic(view, nodeDef, v0);
|
12426
|
}
|
12427
|
// Returning false is ok here as we would have thrown in case of a change.
|
12428
|
return false;
|
12429
|
}
|
12430
|
/**
|
12431
|
* @param {?} view
|
12432
|
* @param {?} nodeDef
|
12433
|
* @param {?} v0
|
12434
|
* @param {?} v1
|
12435
|
* @param {?} v2
|
12436
|
* @param {?} v3
|
12437
|
* @param {?} v4
|
12438
|
* @param {?} v5
|
12439
|
* @param {?} v6
|
12440
|
* @param {?} v7
|
12441
|
* @param {?} v8
|
12442
|
* @param {?} v9
|
12443
|
* @return {?}
|
12444
|
*/
|
12445
|
function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12446
|
var /** @type {?} */ bindLen = nodeDef.bindings.length;
|
12447
|
if (bindLen > 0)
|
12448
|
checkBindingNoChanges(view, nodeDef, 0, v0);
|
12449
|
if (bindLen > 1)
|
12450
|
checkBindingNoChanges(view, nodeDef, 1, v1);
|
12451
|
if (bindLen > 2)
|
12452
|
checkBindingNoChanges(view, nodeDef, 2, v2);
|
12453
|
if (bindLen > 3)
|
12454
|
checkBindingNoChanges(view, nodeDef, 3, v3);
|
12455
|
if (bindLen > 4)
|
12456
|
checkBindingNoChanges(view, nodeDef, 4, v4);
|
12457
|
if (bindLen > 5)
|
12458
|
checkBindingNoChanges(view, nodeDef, 5, v5);
|
12459
|
if (bindLen > 6)
|
12460
|
checkBindingNoChanges(view, nodeDef, 6, v6);
|
12461
|
if (bindLen > 7)
|
12462
|
checkBindingNoChanges(view, nodeDef, 7, v7);
|
12463
|
if (bindLen > 8)
|
12464
|
checkBindingNoChanges(view, nodeDef, 8, v8);
|
12465
|
if (bindLen > 9)
|
12466
|
checkBindingNoChanges(view, nodeDef, 9, v9);
|
12467
|
}
|
12468
|
/**
|
12469
|
* @param {?} view
|
12470
|
* @param {?} nodeDef
|
12471
|
* @param {?} values
|
12472
|
* @return {?}
|
12473
|
*/
|
12474
|
function checkNoChangesNodeDynamic(view, nodeDef, values) {
|
12475
|
for (var /** @type {?} */ i = 0; i < values.length; i++) {
|
12476
|
checkBindingNoChanges(view, nodeDef, i, values[i]);
|
12477
|
}
|
12478
|
}
|
12479
|
/**
|
12480
|
* Workaround https://github.com/angular/tsickle/issues/497
|
12481
|
* @suppress {misplacedTypeAnnotation}
|
12482
|
* @param {?} view
|
12483
|
* @param {?} nodeDef
|
12484
|
* @return {?}
|
12485
|
*/
|
12486
|
function checkNoChangesQuery(view, nodeDef) {
|
12487
|
var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
|
12488
|
if (queryList.dirty) {
|
12489
|
throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), "Query " + ((nodeDef.query)).id + " not dirty", "Query " + ((nodeDef.query)).id + " dirty", (view.state & 1 /* BeforeFirstCheck */) !== 0);
|
12490
|
}
|
12491
|
}
|
12492
|
/**
|
12493
|
* @param {?} view
|
12494
|
* @return {?}
|
12495
|
*/
|
12496
|
function destroyView(view) {
|
12497
|
if (view.state & 128 /* Destroyed */) {
|
12498
|
return;
|
12499
|
}
|
12500
|
execEmbeddedViewsAction(view, ViewAction.Destroy);
|
12501
|
execComponentViewsAction(view, ViewAction.Destroy);
|
12502
|
callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */);
|
12503
|
if (view.disposables) {
|
12504
|
for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) {
|
12505
|
view.disposables[i]();
|
12506
|
}
|
12507
|
}
|
12508
|
detachProjectedView(view);
|
12509
|
if (view.renderer.destroyNode) {
|
12510
|
destroyViewNodes(view);
|
12511
|
}
|
12512
|
if (isComponentView(view)) {
|
12513
|
view.renderer.destroy();
|
12514
|
}
|
12515
|
view.state |= 128 /* Destroyed */;
|
12516
|
}
|
12517
|
/**
|
12518
|
* @param {?} view
|
12519
|
* @return {?}
|
12520
|
*/
|
12521
|
function destroyViewNodes(view) {
|
12522
|
var /** @type {?} */ len = view.def.nodes.length;
|
12523
|
for (var /** @type {?} */ i = 0; i < len; i++) {
|
12524
|
var /** @type {?} */ def = view.def.nodes[i];
|
12525
|
if (def.flags & 1 /* TypeElement */) {
|
12526
|
((view.renderer.destroyNode))(asElementData(view, i).renderElement);
|
12527
|
}
|
12528
|
else if (def.flags & 2 /* TypeText */) {
|
12529
|
((view.renderer.destroyNode))(asTextData(view, i).renderText);
|
12530
|
}
|
12531
|
else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */) {
|
12532
|
asQueryList(view, i).destroy();
|
12533
|
}
|
12534
|
}
|
12535
|
}
|
12536
|
var ViewAction = {};
|
12537
|
ViewAction.CreateViewNodes = 0;
|
12538
|
ViewAction.CheckNoChanges = 1;
|
12539
|
ViewAction.CheckNoChangesProjectedViews = 2;
|
12540
|
ViewAction.CheckAndUpdate = 3;
|
12541
|
ViewAction.CheckAndUpdateProjectedViews = 4;
|
12542
|
ViewAction.Destroy = 5;
|
12543
|
ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
|
12544
|
ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
|
12545
|
ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews";
|
12546
|
ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
|
12547
|
ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews";
|
12548
|
ViewAction[ViewAction.Destroy] = "Destroy";
|
12549
|
/**
|
12550
|
* @param {?} view
|
12551
|
* @param {?} action
|
12552
|
* @return {?}
|
12553
|
*/
|
12554
|
function execComponentViewsAction(view, action) {
|
12555
|
var /** @type {?} */ def = view.def;
|
12556
|
if (!(def.nodeFlags & 33554432 /* ComponentView */)) {
|
12557
|
return;
|
12558
|
}
|
12559
|
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
|
12560
|
var /** @type {?} */ nodeDef = def.nodes[i];
|
12561
|
if (nodeDef.flags & 33554432 /* ComponentView */) {
|
12562
|
// a leaf
|
12563
|
callViewAction(asElementData(view, i).componentView, action);
|
12564
|
}
|
12565
|
else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) {
|
12566
|
// a parent with leafs
|
12567
|
// no child is a component,
|
12568
|
// then skip the children
|
12569
|
i += nodeDef.childCount;
|
12570
|
}
|
12571
|
}
|
12572
|
}
|
12573
|
/**
|
12574
|
* @param {?} view
|
12575
|
* @param {?} action
|
12576
|
* @return {?}
|
12577
|
*/
|
12578
|
function execEmbeddedViewsAction(view, action) {
|
12579
|
var /** @type {?} */ def = view.def;
|
12580
|
if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) {
|
12581
|
return;
|
12582
|
}
|
12583
|
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
|
12584
|
var /** @type {?} */ nodeDef = def.nodes[i];
|
12585
|
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
|
12586
|
// a leaf
|
12587
|
var /** @type {?} */ embeddedViews = ((asElementData(view, i).viewContainer))._embeddedViews;
|
12588
|
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
|
12589
|
callViewAction(embeddedViews[k], action);
|
12590
|
}
|
12591
|
}
|
12592
|
else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) {
|
12593
|
// a parent with leafs
|
12594
|
// no child is a component,
|
12595
|
// then skip the children
|
12596
|
i += nodeDef.childCount;
|
12597
|
}
|
12598
|
}
|
12599
|
}
|
12600
|
/**
|
12601
|
* @param {?} view
|
12602
|
* @param {?} action
|
12603
|
* @return {?}
|
12604
|
*/
|
12605
|
function callViewAction(view, action) {
|
12606
|
var /** @type {?} */ viewState = view.state;
|
12607
|
switch (action) {
|
12608
|
case ViewAction.CheckNoChanges:
|
12609
|
if ((viewState & 128 /* Destroyed */) === 0) {
|
12610
|
if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
|
12611
|
checkNoChangesView(view);
|
12612
|
}
|
12613
|
else if (viewState & 64 /* CheckProjectedViews */) {
|
12614
|
execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
|
12615
|
}
|
12616
|
}
|
12617
|
break;
|
12618
|
case ViewAction.CheckNoChangesProjectedViews:
|
12619
|
if ((viewState & 128 /* Destroyed */) === 0) {
|
12620
|
if (viewState & 32 /* CheckProjectedView */) {
|
12621
|
checkNoChangesView(view);
|
12622
|
}
|
12623
|
else if (viewState & 64 /* CheckProjectedViews */) {
|
12624
|
execProjectedViewsAction(view, action);
|
12625
|
}
|
12626
|
}
|
12627
|
break;
|
12628
|
case ViewAction.CheckAndUpdate:
|
12629
|
if ((viewState & 128 /* Destroyed */) === 0) {
|
12630
|
if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
|
12631
|
checkAndUpdateView(view);
|
12632
|
}
|
12633
|
else if (viewState & 64 /* CheckProjectedViews */) {
|
12634
|
execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
|
12635
|
}
|
12636
|
}
|
12637
|
break;
|
12638
|
case ViewAction.CheckAndUpdateProjectedViews:
|
12639
|
if ((viewState & 128 /* Destroyed */) === 0) {
|
12640
|
if (viewState & 32 /* CheckProjectedView */) {
|
12641
|
checkAndUpdateView(view);
|
12642
|
}
|
12643
|
else if (viewState & 64 /* CheckProjectedViews */) {
|
12644
|
execProjectedViewsAction(view, action);
|
12645
|
}
|
12646
|
}
|
12647
|
break;
|
12648
|
case ViewAction.Destroy:
|
12649
|
// Note: destroyView recurses over all views,
|
12650
|
// so we don't need to special case projected views here.
|
12651
|
destroyView(view);
|
12652
|
break;
|
12653
|
case ViewAction.CreateViewNodes:
|
12654
|
createViewNodes(view);
|
12655
|
break;
|
12656
|
}
|
12657
|
}
|
12658
|
/**
|
12659
|
* @param {?} view
|
12660
|
* @param {?} action
|
12661
|
* @return {?}
|
12662
|
*/
|
12663
|
function execProjectedViewsAction(view, action) {
|
12664
|
execEmbeddedViewsAction(view, action);
|
12665
|
execComponentViewsAction(view, action);
|
12666
|
}
|
12667
|
/**
|
12668
|
* @param {?} view
|
12669
|
* @param {?} queryFlags
|
12670
|
* @param {?} staticDynamicQueryFlag
|
12671
|
* @param {?} checkType
|
12672
|
* @return {?}
|
12673
|
*/
|
12674
|
function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
|
12675
|
if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
|
12676
|
return;
|
12677
|
}
|
12678
|
var /** @type {?} */ nodeCount = view.def.nodes.length;
|
12679
|
for (var /** @type {?} */ i = 0; i < nodeCount; i++) {
|
12680
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
12681
|
if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
|
12682
|
Services.setCurrentNode(view, nodeDef.nodeIndex);
|
12683
|
switch (checkType) {
|
12684
|
case 0 /* CheckAndUpdate */:
|
12685
|
checkAndUpdateQuery(view, nodeDef);
|
12686
|
break;
|
12687
|
case 1 /* CheckNoChanges */:
|
12688
|
checkNoChangesQuery(view, nodeDef);
|
12689
|
break;
|
12690
|
}
|
12691
|
}
|
12692
|
if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
|
12693
|
// no child has a matching query
|
12694
|
// then skip the children
|
12695
|
i += nodeDef.childCount;
|
12696
|
}
|
12697
|
}
|
12698
|
}
|
12699
|
/**
|
12700
|
* @license
|
12701
|
* Copyright Google Inc. All Rights Reserved.
|
12702
|
*
|
12703
|
* Use of this source code is governed by an MIT-style license that can be
|
12704
|
* found in the LICENSE file at https://angular.io/license
|
12705
|
*/
|
12706
|
var initialized = false;
|
12707
|
/**
|
12708
|
* @return {?}
|
12709
|
*/
|
12710
|
function initServicesIfNeeded() {
|
12711
|
if (initialized) {
|
12712
|
return;
|
12713
|
}
|
12714
|
initialized = true;
|
12715
|
var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices();
|
12716
|
Services.setCurrentNode = services.setCurrentNode;
|
12717
|
Services.createRootView = services.createRootView;
|
12718
|
Services.createEmbeddedView = services.createEmbeddedView;
|
12719
|
Services.createComponentView = services.createComponentView;
|
12720
|
Services.createNgModuleRef = services.createNgModuleRef;
|
12721
|
Services.overrideProvider = services.overrideProvider;
|
12722
|
Services.clearProviderOverrides = services.clearProviderOverrides;
|
12723
|
Services.checkAndUpdateView = services.checkAndUpdateView;
|
12724
|
Services.checkNoChangesView = services.checkNoChangesView;
|
12725
|
Services.destroyView = services.destroyView;
|
12726
|
Services.resolveDep = resolveDep;
|
12727
|
Services.createDebugContext = services.createDebugContext;
|
12728
|
Services.handleEvent = services.handleEvent;
|
12729
|
Services.updateDirectives = services.updateDirectives;
|
12730
|
Services.updateRenderer = services.updateRenderer;
|
12731
|
Services.dirtyParentQueries = dirtyParentQueries;
|
12732
|
}
|
12733
|
/**
|
12734
|
* @return {?}
|
12735
|
*/
|
12736
|
function createProdServices() {
|
12737
|
return {
|
12738
|
setCurrentNode: function () { },
|
12739
|
createRootView: createProdRootView,
|
12740
|
createEmbeddedView: createEmbeddedView,
|
12741
|
createComponentView: createComponentView,
|
12742
|
createNgModuleRef: createNgModuleRef,
|
12743
|
overrideProvider: NOOP,
|
12744
|
clearProviderOverrides: NOOP,
|
12745
|
checkAndUpdateView: checkAndUpdateView,
|
12746
|
checkNoChangesView: checkNoChangesView,
|
12747
|
destroyView: destroyView,
|
12748
|
createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
|
12749
|
handleEvent: function (view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); },
|
12750
|
updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
|
12751
|
prodCheckNoChangesNode, view); },
|
12752
|
updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
|
12753
|
prodCheckNoChangesNode, view); },
|
12754
|
};
|
12755
|
}
|
12756
|
/**
|
12757
|
* @return {?}
|
12758
|
*/
|
12759
|
function createDebugServices() {
|
12760
|
return {
|
12761
|
setCurrentNode: debugSetCurrentNode,
|
12762
|
createRootView: debugCreateRootView,
|
12763
|
createEmbeddedView: debugCreateEmbeddedView,
|
12764
|
createComponentView: debugCreateComponentView,
|
12765
|
createNgModuleRef: debugCreateNgModuleRef,
|
12766
|
overrideProvider: debugOverrideProvider,
|
12767
|
clearProviderOverrides: debugClearProviderOverrides,
|
12768
|
checkAndUpdateView: debugCheckAndUpdateView,
|
12769
|
checkNoChangesView: debugCheckNoChangesView,
|
12770
|
destroyView: debugDestroyView,
|
12771
|
createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
|
12772
|
handleEvent: debugHandleEvent,
|
12773
|
updateDirectives: debugUpdateDirectives,
|
12774
|
updateRenderer: debugUpdateRenderer,
|
12775
|
};
|
12776
|
}
|
12777
|
/**
|
12778
|
* @param {?} elInjector
|
12779
|
* @param {?} projectableNodes
|
12780
|
* @param {?} rootSelectorOrNode
|
12781
|
* @param {?} def
|
12782
|
* @param {?} ngModule
|
12783
|
* @param {?=} context
|
12784
|
* @return {?}
|
12785
|
*/
|
12786
|
function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
12787
|
var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
|
12788
|
return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
|
12789
|
}
|
12790
|
/**
|
12791
|
* @param {?} elInjector
|
12792
|
* @param {?} projectableNodes
|
12793
|
* @param {?} rootSelectorOrNode
|
12794
|
* @param {?} def
|
12795
|
* @param {?} ngModule
|
12796
|
* @param {?=} context
|
12797
|
* @return {?}
|
12798
|
*/
|
12799
|
function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
12800
|
var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
|
12801
|
var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
|
12802
|
var /** @type {?} */ defWithOverride = applyProviderOverridesToView(def);
|
12803
|
return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
|
12804
|
}
|
12805
|
/**
|
12806
|
* @param {?} elInjector
|
12807
|
* @param {?} ngModule
|
12808
|
* @param {?} rendererFactory
|
12809
|
* @param {?} projectableNodes
|
12810
|
* @param {?} rootSelectorOrNode
|
12811
|
* @return {?}
|
12812
|
*/
|
12813
|
function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
|
12814
|
var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer);
|
12815
|
var /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler);
|
12816
|
var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null);
|
12817
|
return {
|
12818
|
ngModule: ngModule,
|
12819
|
injector: elInjector, projectableNodes: projectableNodes,
|
12820
|
selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
|
12821
|
};
|
12822
|
}
|
12823
|
/**
|
12824
|
* @param {?} parentView
|
12825
|
* @param {?} anchorDef
|
12826
|
* @param {?} viewDef
|
12827
|
* @param {?=} context
|
12828
|
* @return {?}
|
12829
|
*/
|
12830
|
function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
|
12831
|
var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
|
12832
|
return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
|
12833
|
}
|
12834
|
/**
|
12835
|
* @param {?} parentView
|
12836
|
* @param {?} nodeDef
|
12837
|
* @param {?} viewDef
|
12838
|
* @param {?} hostElement
|
12839
|
* @return {?}
|
12840
|
*/
|
12841
|
function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
|
12842
|
var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
|
12843
|
return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, defWithOverride, hostElement]);
|
12844
|
}
|
12845
|
/**
|
12846
|
* @param {?} moduleType
|
12847
|
* @param {?} parentInjector
|
12848
|
* @param {?} bootstrapComponents
|
12849
|
* @param {?} def
|
12850
|
* @return {?}
|
12851
|
*/
|
12852
|
function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
|
12853
|
var /** @type {?} */ defWithOverride = applyProviderOverridesToNgModule(def);
|
12854
|
return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
|
12855
|
}
|
12856
|
var providerOverrides = new Map();
|
12857
|
/**
|
12858
|
* @param {?} override
|
12859
|
* @return {?}
|
12860
|
*/
|
12861
|
function debugOverrideProvider(override) {
|
12862
|
providerOverrides.set(override.token, override);
|
12863
|
}
|
12864
|
/**
|
12865
|
* @return {?}
|
12866
|
*/
|
12867
|
function debugClearProviderOverrides() {
|
12868
|
providerOverrides.clear();
|
12869
|
}
|
12870
|
/**
|
12871
|
* @param {?} def
|
12872
|
* @return {?}
|
12873
|
*/
|
12874
|
function applyProviderOverridesToView(def) {
|
12875
|
if (providerOverrides.size === 0) {
|
12876
|
return def;
|
12877
|
}
|
12878
|
var /** @type {?} */ elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
|
12879
|
if (elementIndicesWithOverwrittenProviders.length === 0) {
|
12880
|
return def;
|
12881
|
}
|
12882
|
// clone the whole view definition,
|
12883
|
// as it maintains references between the nodes that are hard to update.
|
12884
|
def = ((def.factory))(function () { return NOOP; });
|
12885
|
for (var /** @type {?} */ i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
|
12886
|
applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
|
12887
|
}
|
12888
|
return def;
|
12889
|
/**
|
12890
|
* @param {?} def
|
12891
|
* @return {?}
|
12892
|
*/
|
12893
|
function findElementIndicesWithOverwrittenProviders(def) {
|
12894
|
var /** @type {?} */ elIndicesWithOverwrittenProviders = [];
|
12895
|
var /** @type {?} */ lastElementDef = null;
|
12896
|
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
|
12897
|
var /** @type {?} */ nodeDef = def.nodes[i];
|
12898
|
if (nodeDef.flags & 1 /* TypeElement */) {
|
12899
|
lastElementDef = nodeDef;
|
12900
|
}
|
12901
|
if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ &&
|
12902
|
providerOverrides.has(/** @type {?} */ ((nodeDef.provider)).token)) {
|
12903
|
elIndicesWithOverwrittenProviders.push(/** @type {?} */ ((lastElementDef)).nodeIndex);
|
12904
|
lastElementDef = null;
|
12905
|
}
|
12906
|
}
|
12907
|
return elIndicesWithOverwrittenProviders;
|
12908
|
}
|
12909
|
/**
|
12910
|
* @param {?} viewDef
|
12911
|
* @param {?} elIndex
|
12912
|
* @return {?}
|
12913
|
*/
|
12914
|
function applyProviderOverridesToElement(viewDef$$1, elIndex) {
|
12915
|
for (var /** @type {?} */ i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
|
12916
|
var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
|
12917
|
if (nodeDef.flags & 1 /* TypeElement */) {
|
12918
|
// stop at the next element
|
12919
|
return;
|
12920
|
}
|
12921
|
if (nodeDef.flags & 3840 /* CatProviderNoDirective */) {
|
12922
|
var /** @type {?} */ provider = ((nodeDef.provider));
|
12923
|
var /** @type {?} */ override = providerOverrides.get(provider.token);
|
12924
|
if (override) {
|
12925
|
nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
|
12926
|
provider.deps = splitDepsDsl(override.deps);
|
12927
|
provider.value = override.value;
|
12928
|
}
|
12929
|
}
|
12930
|
}
|
12931
|
}
|
12932
|
}
|
12933
|
/**
|
12934
|
* @param {?} def
|
12935
|
* @return {?}
|
12936
|
*/
|
12937
|
function applyProviderOverridesToNgModule(def) {
|
12938
|
var _a = calcHasOverrides(def), hasOverrides = _a.hasOverrides, hasDeprecatedOverrides = _a.hasDeprecatedOverrides;
|
12939
|
if (!hasOverrides) {
|
12940
|
return def;
|
12941
|
}
|
12942
|
// clone the whole view definition,
|
12943
|
// as it maintains references between the nodes that are hard to update.
|
12944
|
def = ((def.factory))(function () { return NOOP; });
|
12945
|
applyProviderOverrides(def);
|
12946
|
return def;
|
12947
|
/**
|
12948
|
* @param {?} def
|
12949
|
* @return {?}
|
12950
|
*/
|
12951
|
function calcHasOverrides(def) {
|
12952
|
var /** @type {?} */ hasOverrides = false;
|
12953
|
var /** @type {?} */ hasDeprecatedOverrides = false;
|
12954
|
if (providerOverrides.size === 0) {
|
12955
|
return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
|
12956
|
}
|
12957
|
def.providers.forEach(function (node) {
|
12958
|
var /** @type {?} */ override = providerOverrides.get(node.token);
|
12959
|
if ((node.flags & 3840 /* CatProviderNoDirective */) && override) {
|
12960
|
hasOverrides = true;
|
12961
|
hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
|
12962
|
}
|
12963
|
});
|
12964
|
return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
|
12965
|
}
|
12966
|
/**
|
12967
|
* @param {?} def
|
12968
|
* @return {?}
|
12969
|
*/
|
12970
|
function applyProviderOverrides(def) {
|
12971
|
for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
|
12972
|
var /** @type {?} */ provider = def.providers[i];
|
12973
|
if (hasDeprecatedOverrides) {
|
12974
|
// We had a bug where me made
|
12975
|
// all providers lazy. Keep this logic behind a flag
|
12976
|
// for migrating existing users.
|
12977
|
provider.flags |= 4096 /* LazyProvider */;
|
12978
|
}
|
12979
|
var /** @type {?} */ override = providerOverrides.get(provider.token);
|
12980
|
if (override) {
|
12981
|
provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
|
12982
|
provider.deps = splitDepsDsl(override.deps);
|
12983
|
provider.value = override.value;
|
12984
|
}
|
12985
|
}
|
12986
|
}
|
12987
|
}
|
12988
|
/**
|
12989
|
* @param {?} view
|
12990
|
* @param {?} checkIndex
|
12991
|
* @param {?} argStyle
|
12992
|
* @param {?=} v0
|
12993
|
* @param {?=} v1
|
12994
|
* @param {?=} v2
|
12995
|
* @param {?=} v3
|
12996
|
* @param {?=} v4
|
12997
|
* @param {?=} v5
|
12998
|
* @param {?=} v6
|
12999
|
* @param {?=} v7
|
13000
|
* @param {?=} v8
|
13001
|
* @param {?=} v9
|
13002
|
* @return {?}
|
13003
|
*/
|
13004
|
function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
13005
|
var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
|
13006
|
checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
13007
|
return (nodeDef.flags & 224 /* CatPureExpression */) ?
|
13008
|
asPureExpressionData(view, checkIndex).value :
|
13009
|
undefined;
|
13010
|
}
|
13011
|
/**
|
13012
|
* @param {?} view
|
13013
|
* @param {?} checkIndex
|
13014
|
* @param {?} argStyle
|
13015
|
* @param {?=} v0
|
13016
|
* @param {?=} v1
|
13017
|
* @param {?=} v2
|
13018
|
* @param {?=} v3
|
13019
|
* @param {?=} v4
|
13020
|
* @param {?=} v5
|
13021
|
* @param {?=} v6
|
13022
|
* @param {?=} v7
|
13023
|
* @param {?=} v8
|
13024
|
* @param {?=} v9
|
13025
|
* @return {?}
|
13026
|
*/
|
13027
|
function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
13028
|
var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
|
13029
|
checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
13030
|
return (nodeDef.flags & 224 /* CatPureExpression */) ?
|
13031
|
asPureExpressionData(view, checkIndex).value :
|
13032
|
undefined;
|
13033
|
}
|
13034
|
/**
|
13035
|
* @param {?} view
|
13036
|
* @return {?}
|
13037
|
*/
|
13038
|
function debugCheckAndUpdateView(view) {
|
13039
|
return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
|
13040
|
}
|
13041
|
/**
|
13042
|
* @param {?} view
|
13043
|
* @return {?}
|
13044
|
*/
|
13045
|
function debugCheckNoChangesView(view) {
|
13046
|
return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
|
13047
|
}
|
13048
|
/**
|
13049
|
* @param {?} view
|
13050
|
* @return {?}
|
13051
|
*/
|
13052
|
function debugDestroyView(view) {
|
13053
|
return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
|
13054
|
}
|
13055
|
var DebugAction = {};
|
13056
|
DebugAction.create = 0;
|
13057
|
DebugAction.detectChanges = 1;
|
13058
|
DebugAction.checkNoChanges = 2;
|
13059
|
DebugAction.destroy = 3;
|
13060
|
DebugAction.handleEvent = 4;
|
13061
|
DebugAction[DebugAction.create] = "create";
|
13062
|
DebugAction[DebugAction.detectChanges] = "detectChanges";
|
13063
|
DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
|
13064
|
DebugAction[DebugAction.destroy] = "destroy";
|
13065
|
DebugAction[DebugAction.handleEvent] = "handleEvent";
|
13066
|
var _currentAction;
|
13067
|
var _currentView;
|
13068
|
var _currentNodeIndex;
|
13069
|
/**
|
13070
|
* @param {?} view
|
13071
|
* @param {?} nodeIndex
|
13072
|
* @return {?}
|
13073
|
*/
|
13074
|
function debugSetCurrentNode(view, nodeIndex) {
|
13075
|
_currentView = view;
|
13076
|
_currentNodeIndex = nodeIndex;
|
13077
|
}
|
13078
|
/**
|
13079
|
* @param {?} view
|
13080
|
* @param {?} nodeIndex
|
13081
|
* @param {?} eventName
|
13082
|
* @param {?} event
|
13083
|
* @return {?}
|
13084
|
*/
|
13085
|
function debugHandleEvent(view, nodeIndex, eventName, event) {
|
13086
|
debugSetCurrentNode(view, nodeIndex);
|
13087
|
return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
|
13088
|
}
|
13089
|
/**
|
13090
|
* @param {?} view
|
13091
|
* @param {?} checkType
|
13092
|
* @return {?}
|
13093
|
*/
|
13094
|
function debugUpdateDirectives(view, checkType) {
|
13095
|
if (view.state & 128 /* Destroyed */) {
|
13096
|
throw viewDestroyedError(DebugAction[_currentAction]);
|
13097
|
}
|
13098
|
debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
|
13099
|
return view.def.updateDirectives(debugCheckDirectivesFn, view);
|
13100
|
/**
|
13101
|
* @param {?} view
|
13102
|
* @param {?} nodeIndex
|
13103
|
* @param {?} argStyle
|
13104
|
* @param {...?} values
|
13105
|
* @return {?}
|
13106
|
*/
|
13107
|
function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
|
13108
|
var values = [];
|
13109
|
for (var _i = 3; _i < arguments.length; _i++) {
|
13110
|
values[_i - 3] = arguments[_i];
|
13111
|
}
|
13112
|
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
|
13113
|
if (checkType === 0 /* CheckAndUpdate */) {
|
13114
|
debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
13115
|
}
|
13116
|
else {
|
13117
|
debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
13118
|
}
|
13119
|
if (nodeDef.flags & 16384 /* TypeDirective */) {
|
13120
|
debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
|
13121
|
}
|
13122
|
return (nodeDef.flags & 224 /* CatPureExpression */) ?
|
13123
|
asPureExpressionData(view, nodeDef.nodeIndex).value :
|
13124
|
undefined;
|
13125
|
}
|
13126
|
}
|
13127
|
/**
|
13128
|
* @param {?} view
|
13129
|
* @param {?} checkType
|
13130
|
* @return {?}
|
13131
|
*/
|
13132
|
function debugUpdateRenderer(view, checkType) {
|
13133
|
if (view.state & 128 /* Destroyed */) {
|
13134
|
throw viewDestroyedError(DebugAction[_currentAction]);
|
13135
|
}
|
13136
|
debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
|
13137
|
return view.def.updateRenderer(debugCheckRenderNodeFn, view);
|
13138
|
/**
|
13139
|
* @param {?} view
|
13140
|
* @param {?} nodeIndex
|
13141
|
* @param {?} argStyle
|
13142
|
* @param {...?} values
|
13143
|
* @return {?}
|
13144
|
*/
|
13145
|
function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
|
13146
|
var values = [];
|
13147
|
for (var _i = 3; _i < arguments.length; _i++) {
|
13148
|
values[_i - 3] = arguments[_i];
|
13149
|
}
|
13150
|
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
|
13151
|
if (checkType === 0 /* CheckAndUpdate */) {
|
13152
|
debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
13153
|
}
|
13154
|
else {
|
13155
|
debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
13156
|
}
|
13157
|
if (nodeDef.flags & 3 /* CatRenderNode */) {
|
13158
|
debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
|
13159
|
}
|
13160
|
return (nodeDef.flags & 224 /* CatPureExpression */) ?
|
13161
|
asPureExpressionData(view, nodeDef.nodeIndex).value :
|
13162
|
undefined;
|
13163
|
}
|
13164
|
}
|
13165
|
/**
|
13166
|
* @param {?} view
|
13167
|
* @param {?} nodeDef
|
13168
|
* @param {?} argStyle
|
13169
|
* @param {?} givenValues
|
13170
|
* @return {?}
|
13171
|
*/
|
13172
|
function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
|
13173
|
var /** @type {?} */ changed = ((checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
|
13174
|
if (changed) {
|
13175
|
var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
|
13176
|
if (nodeDef.flags & 16384 /* TypeDirective */) {
|
13177
|
var /** @type {?} */ bindingValues = {};
|
13178
|
for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) {
|
13179
|
var /** @type {?} */ binding = nodeDef.bindings[i];
|
13180
|
var /** @type {?} */ value = values[i];
|
13181
|
if (binding.flags & 8 /* TypeProperty */) {
|
13182
|
bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] =
|
13183
|
normalizeDebugBindingValue(value);
|
13184
|
}
|
13185
|
}
|
13186
|
var /** @type {?} */ elDef = ((nodeDef.parent));
|
13187
|
var /** @type {?} */ el = asElementData(view, elDef.nodeIndex).renderElement;
|
13188
|
if (!((elDef.element)).name) {
|
13189
|
// a comment.
|
13190
|
view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
|
13191
|
}
|
13192
|
else {
|
13193
|
// a regular element.
|
13194
|
for (var /** @type {?} */ attr in bindingValues) {
|
13195
|
var /** @type {?} */ value = bindingValues[attr];
|
13196
|
if (value != null) {
|
13197
|
view.renderer.setAttribute(el, attr, value);
|
13198
|
}
|
13199
|
else {
|
13200
|
view.renderer.removeAttribute(el, attr);
|
13201
|
}
|
13202
|
}
|
13203
|
}
|
13204
|
}
|
13205
|
}
|
13206
|
}
|
13207
|
/**
|
13208
|
* @param {?} view
|
13209
|
* @param {?} nodeDef
|
13210
|
* @param {?} argStyle
|
13211
|
* @param {?} values
|
13212
|
* @return {?}
|
13213
|
*/
|
13214
|
function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
|
13215
|
((checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
|
13216
|
}
|
13217
|
/**
|
13218
|
* @param {?} name
|
13219
|
* @return {?}
|
13220
|
*/
|
13221
|
function normalizeDebugBindingName(name) {
|
13222
|
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
13223
|
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
13224
|
return "ng-reflect-" + name;
|
13225
|
}
|
13226
|
var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
13227
|
/**
|
13228
|
* @param {?} input
|
13229
|
* @return {?}
|
13230
|
*/
|
13231
|
function camelCaseToDashCase(input) {
|
13232
|
return input.replace(CAMEL_CASE_REGEXP, function () {
|
13233
|
var m = [];
|
13234
|
for (var _i = 0; _i < arguments.length; _i++) {
|
13235
|
m[_i] = arguments[_i];
|
13236
|
}
|
13237
|
return '-' + m[1].toLowerCase();
|
13238
|
});
|
13239
|
}
|
13240
|
/**
|
13241
|
* @param {?} value
|
13242
|
* @return {?}
|
13243
|
*/
|
13244
|
function normalizeDebugBindingValue(value) {
|
13245
|
try {
|
13246
|
// Limit the size of the value as otherwise the DOM just gets polluted.
|
13247
|
return value != null ? value.toString().slice(0, 30) : value;
|
13248
|
}
|
13249
|
catch (e) {
|
13250
|
return '[ERROR] Exception while trying to serialize the value';
|
13251
|
}
|
13252
|
}
|
13253
|
/**
|
13254
|
* @param {?} view
|
13255
|
* @param {?} nodeIndex
|
13256
|
* @return {?}
|
13257
|
*/
|
13258
|
function nextDirectiveWithBinding(view, nodeIndex) {
|
13259
|
for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
|
13260
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
13261
|
if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) {
|
13262
|
return i;
|
13263
|
}
|
13264
|
}
|
13265
|
return null;
|
13266
|
}
|
13267
|
/**
|
13268
|
* @param {?} view
|
13269
|
* @param {?} nodeIndex
|
13270
|
* @return {?}
|
13271
|
*/
|
13272
|
function nextRenderNodeWithBinding(view, nodeIndex) {
|
13273
|
for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
|
13274
|
var /** @type {?} */ nodeDef = view.def.nodes[i];
|
13275
|
if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) {
|
13276
|
return i;
|
13277
|
}
|
13278
|
}
|
13279
|
return null;
|
13280
|
}
|
13281
|
var DebugContext_ = (function () {
|
13282
|
/**
|
13283
|
* @param {?} view
|
13284
|
* @param {?} nodeIndex
|
13285
|
*/
|
13286
|
function DebugContext_(view, nodeIndex) {
|
13287
|
this.view = view;
|
13288
|
this.nodeIndex = nodeIndex;
|
13289
|
if (nodeIndex == null) {
|
13290
|
this.nodeIndex = nodeIndex = 0;
|
13291
|
}
|
13292
|
this.nodeDef = view.def.nodes[nodeIndex];
|
13293
|
var elDef = this.nodeDef;
|
13294
|
var elView = view;
|
13295
|
while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) {
|
13296
|
elDef = elDef.parent;
|
13297
|
}
|
13298
|
if (!elDef) {
|
13299
|
while (!elDef && elView) {
|
13300
|
elDef = viewParentEl(elView);
|
13301
|
elView = elView.parent;
|
13302
|
}
|
13303
|
}
|
13304
|
this.elDef = elDef;
|
13305
|
this.elView = elView;
|
13306
|
}
|
13307
|
Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
|
13308
|
/**
|
13309
|
* @return {?}
|
13310
|
*/
|
13311
|
get: function () {
|
13312
|
// Has to be done lazily as we use the DebugContext also during creation of elements...
|
13313
|
return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
|
13314
|
},
|
13315
|
enumerable: true,
|
13316
|
configurable: true
|
13317
|
});
|
13318
|
Object.defineProperty(DebugContext_.prototype, "injector", {
|
13319
|
/**
|
13320
|
* @return {?}
|
13321
|
*/
|
13322
|
get: function () { return createInjector(this.elView, this.elDef); },
|
13323
|
enumerable: true,
|
13324
|
configurable: true
|
13325
|
});
|
13326
|
Object.defineProperty(DebugContext_.prototype, "component", {
|
13327
|
/**
|
13328
|
* @return {?}
|
13329
|
*/
|
13330
|
get: function () { return this.elOrCompView.component; },
|
13331
|
enumerable: true,
|
13332
|
configurable: true
|
13333
|
});
|
13334
|
Object.defineProperty(DebugContext_.prototype, "context", {
|
13335
|
/**
|
13336
|
* @return {?}
|
13337
|
*/
|
13338
|
get: function () { return this.elOrCompView.context; },
|
13339
|
enumerable: true,
|
13340
|
configurable: true
|
13341
|
});
|
13342
|
Object.defineProperty(DebugContext_.prototype, "providerTokens", {
|
13343
|
/**
|
13344
|
* @return {?}
|
13345
|
*/
|
13346
|
get: function () {
|
13347
|
var /** @type {?} */ tokens = [];
|
13348
|
if (this.elDef) {
|
13349
|
for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
|
13350
|
var /** @type {?} */ childDef = this.elView.def.nodes[i];
|
13351
|
if (childDef.flags & 20224 /* CatProvider */) {
|
13352
|
tokens.push(/** @type {?} */ ((childDef.provider)).token);
|
13353
|
}
|
13354
|
i += childDef.childCount;
|
13355
|
}
|
13356
|
}
|
13357
|
return tokens;
|
13358
|
},
|
13359
|
enumerable: true,
|
13360
|
configurable: true
|
13361
|
});
|
13362
|
Object.defineProperty(DebugContext_.prototype, "references", {
|
13363
|
/**
|
13364
|
* @return {?}
|
13365
|
*/
|
13366
|
get: function () {
|
13367
|
var /** @type {?} */ references = {};
|
13368
|
if (this.elDef) {
|
13369
|
collectReferences(this.elView, this.elDef, references);
|
13370
|
for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
|
13371
|
var /** @type {?} */ childDef = this.elView.def.nodes[i];
|
13372
|
if (childDef.flags & 20224 /* CatProvider */) {
|
13373
|
collectReferences(this.elView, childDef, references);
|
13374
|
}
|
13375
|
i += childDef.childCount;
|
13376
|
}
|
13377
|
}
|
13378
|
return references;
|
13379
|
},
|
13380
|
enumerable: true,
|
13381
|
configurable: true
|
13382
|
});
|
13383
|
Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
|
13384
|
/**
|
13385
|
* @return {?}
|
13386
|
*/
|
13387
|
get: function () {
|
13388
|
var /** @type {?} */ elData = findHostElement(this.elOrCompView);
|
13389
|
return elData ? elData.renderElement : undefined;
|
13390
|
},
|
13391
|
enumerable: true,
|
13392
|
configurable: true
|
13393
|
});
|
13394
|
Object.defineProperty(DebugContext_.prototype, "renderNode", {
|
13395
|
/**
|
13396
|
* @return {?}
|
13397
|
*/
|
13398
|
get: function () {
|
13399
|
return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) :
|
13400
|
renderNode(this.elView, this.elDef);
|
13401
|
},
|
13402
|
enumerable: true,
|
13403
|
configurable: true
|
13404
|
});
|
13405
|
/**
|
13406
|
* @param {?} console
|
13407
|
* @param {...?} values
|
13408
|
* @return {?}
|
13409
|
*/
|
13410
|
DebugContext_.prototype.logError = function (console) {
|
13411
|
var values = [];
|
13412
|
for (var _i = 1; _i < arguments.length; _i++) {
|
13413
|
values[_i - 1] = arguments[_i];
|
13414
|
}
|
13415
|
var /** @type {?} */ logViewDef;
|
13416
|
var /** @type {?} */ logNodeIndex;
|
13417
|
if (this.nodeDef.flags & 2 /* TypeText */) {
|
13418
|
logViewDef = this.view.def;
|
13419
|
logNodeIndex = this.nodeDef.nodeIndex;
|
13420
|
}
|
13421
|
else {
|
13422
|
logViewDef = this.elView.def;
|
13423
|
logNodeIndex = this.elDef.nodeIndex;
|
13424
|
}
|
13425
|
// Note: we only generate a log function for text and element nodes
|
13426
|
// to make the generated code as small as possible.
|
13427
|
var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
|
13428
|
var /** @type {?} */ currRenderNodeIndex = -1;
|
13429
|
var /** @type {?} */ nodeLogger = function () {
|
13430
|
currRenderNodeIndex++;
|
13431
|
if (currRenderNodeIndex === renderNodeIndex) {
|
13432
|
return (_a = console.error).bind.apply(_a, [console].concat(values));
|
13433
|
}
|
13434
|
else {
|
13435
|
return NOOP;
|
13436
|
}
|
13437
|
var _a;
|
13438
|
}; /** @type {?} */
|
13439
|
((logViewDef.factory))(nodeLogger);
|
13440
|
if (currRenderNodeIndex < renderNodeIndex) {
|
13441
|
console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
|
13442
|
console.error.apply(console, values);
|
13443
|
}
|
13444
|
};
|
13445
|
return DebugContext_;
|
13446
|
}());
|
13447
|
/**
|
13448
|
* @param {?} viewDef
|
13449
|
* @param {?} nodeIndex
|
13450
|
* @return {?}
|
13451
|
*/
|
13452
|
function getRenderNodeIndex(viewDef$$1, nodeIndex) {
|
13453
|
var /** @type {?} */ renderNodeIndex = -1;
|
13454
|
for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) {
|
13455
|
var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
|
13456
|
if (nodeDef.flags & 3 /* CatRenderNode */) {
|
13457
|
renderNodeIndex++;
|
13458
|
}
|
13459
|
}
|
13460
|
return renderNodeIndex;
|
13461
|
}
|
13462
|
/**
|
13463
|
* @param {?} view
|
13464
|
* @return {?}
|
13465
|
*/
|
13466
|
function findHostElement(view) {
|
13467
|
while (view && !isComponentView(view)) {
|
13468
|
view = ((view.parent));
|
13469
|
}
|
13470
|
if (view.parent) {
|
13471
|
return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).nodeIndex);
|
13472
|
}
|
13473
|
return null;
|
13474
|
}
|
13475
|
/**
|
13476
|
* @param {?} view
|
13477
|
* @param {?} nodeDef
|
13478
|
* @param {?} references
|
13479
|
* @return {?}
|
13480
|
*/
|
13481
|
function collectReferences(view, nodeDef, references) {
|
13482
|
for (var /** @type {?} */ refName in nodeDef.references) {
|
13483
|
references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
|
13484
|
}
|
13485
|
}
|
13486
|
/**
|
13487
|
* @param {?} action
|
13488
|
* @param {?} fn
|
13489
|
* @param {?} self
|
13490
|
* @param {?} args
|
13491
|
* @return {?}
|
13492
|
*/
|
13493
|
function callWithDebugContext(action, fn, self, args) {
|
13494
|
var /** @type {?} */ oldAction = _currentAction;
|
13495
|
var /** @type {?} */ oldView = _currentView;
|
13496
|
var /** @type {?} */ oldNodeIndex = _currentNodeIndex;
|
13497
|
try {
|
13498
|
_currentAction = action;
|
13499
|
var /** @type {?} */ result = fn.apply(self, args);
|
13500
|
_currentView = oldView;
|
13501
|
_currentNodeIndex = oldNodeIndex;
|
13502
|
_currentAction = oldAction;
|
13503
|
return result;
|
13504
|
}
|
13505
|
catch (e) {
|
13506
|
if (isViewDebugError(e) || !_currentView) {
|
13507
|
throw e;
|
13508
|
}
|
13509
|
throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext())));
|
13510
|
}
|
13511
|
}
|
13512
|
/**
|
13513
|
* @return {?}
|
13514
|
*/
|
13515
|
function getCurrentDebugContext() {
|
13516
|
return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
|
13517
|
}
|
13518
|
var DebugRendererFactory2 = (function () {
|
13519
|
/**
|
13520
|
* @param {?} delegate
|
13521
|
*/
|
13522
|
function DebugRendererFactory2(delegate) {
|
13523
|
this.delegate = delegate;
|
13524
|
}
|
13525
|
/**
|
13526
|
* @param {?} element
|
13527
|
* @param {?} renderData
|
13528
|
* @return {?}
|
13529
|
*/
|
13530
|
DebugRendererFactory2.prototype.createRenderer = function (element, renderData) {
|
13531
|
return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
|
13532
|
};
|
13533
|
/**
|
13534
|
* @return {?}
|
13535
|
*/
|
13536
|
DebugRendererFactory2.prototype.begin = function () {
|
13537
|
if (this.delegate.begin) {
|
13538
|
this.delegate.begin();
|
13539
|
}
|
13540
|
};
|
13541
|
/**
|
13542
|
* @return {?}
|
13543
|
*/
|
13544
|
DebugRendererFactory2.prototype.end = function () {
|
13545
|
if (this.delegate.end) {
|
13546
|
this.delegate.end();
|
13547
|
}
|
13548
|
};
|
13549
|
/**
|
13550
|
* @return {?}
|
13551
|
*/
|
13552
|
DebugRendererFactory2.prototype.whenRenderingDone = function () {
|
13553
|
if (this.delegate.whenRenderingDone) {
|
13554
|
return this.delegate.whenRenderingDone();
|
13555
|
}
|
13556
|
return Promise.resolve(null);
|
13557
|
};
|
13558
|
return DebugRendererFactory2;
|
13559
|
}());
|
13560
|
var DebugRenderer2 = (function () {
|
13561
|
/**
|
13562
|
* @param {?} delegate
|
13563
|
*/
|
13564
|
function DebugRenderer2(delegate) {
|
13565
|
this.delegate = delegate;
|
13566
|
}
|
13567
|
Object.defineProperty(DebugRenderer2.prototype, "data", {
|
13568
|
/**
|
13569
|
* @return {?}
|
13570
|
*/
|
13571
|
get: function () { return this.delegate.data; },
|
13572
|
enumerable: true,
|
13573
|
configurable: true
|
13574
|
});
|
13575
|
/**
|
13576
|
* @param {?} node
|
13577
|
* @return {?}
|
13578
|
*/
|
13579
|
DebugRenderer2.prototype.destroyNode = function (node) {
|
13580
|
removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node))));
|
13581
|
if (this.delegate.destroyNode) {
|
13582
|
this.delegate.destroyNode(node);
|
13583
|
}
|
13584
|
};
|
13585
|
/**
|
13586
|
* @return {?}
|
13587
|
*/
|
13588
|
DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); };
|
13589
|
/**
|
13590
|
* @param {?} name
|
13591
|
* @param {?=} namespace
|
13592
|
* @return {?}
|
13593
|
*/
|
13594
|
DebugRenderer2.prototype.createElement = function (name, namespace) {
|
13595
|
var /** @type {?} */ el = this.delegate.createElement(name, namespace);
|
13596
|
var /** @type {?} */ debugCtx = getCurrentDebugContext();
|
13597
|
if (debugCtx) {
|
13598
|
var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx);
|
13599
|
debugEl.name = name;
|
13600
|
indexDebugNode(debugEl);
|
13601
|
}
|
13602
|
return el;
|
13603
|
};
|
13604
|
/**
|
13605
|
* @param {?} value
|
13606
|
* @return {?}
|
13607
|
*/
|
13608
|
DebugRenderer2.prototype.createComment = function (value) {
|
13609
|
var /** @type {?} */ comment = this.delegate.createComment(value);
|
13610
|
var /** @type {?} */ debugCtx = getCurrentDebugContext();
|
13611
|
if (debugCtx) {
|
13612
|
indexDebugNode(new DebugNode(comment, null, debugCtx));
|
13613
|
}
|
13614
|
return comment;
|
13615
|
};
|
13616
|
/**
|
13617
|
* @param {?} value
|
13618
|
* @return {?}
|
13619
|
*/
|
13620
|
DebugRenderer2.prototype.createText = function (value) {
|
13621
|
var /** @type {?} */ text = this.delegate.createText(value);
|
13622
|
var /** @type {?} */ debugCtx = getCurrentDebugContext();
|
13623
|
if (debugCtx) {
|
13624
|
indexDebugNode(new DebugNode(text, null, debugCtx));
|
13625
|
}
|
13626
|
return text;
|
13627
|
};
|
13628
|
/**
|
13629
|
* @param {?} parent
|
13630
|
* @param {?} newChild
|
13631
|
* @return {?}
|
13632
|
*/
|
13633
|
DebugRenderer2.prototype.appendChild = function (parent, newChild) {
|
13634
|
var /** @type {?} */ debugEl = getDebugNode(parent);
|
13635
|
var /** @type {?} */ debugChildEl = getDebugNode(newChild);
|
13636
|
if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13637
|
debugEl.addChild(debugChildEl);
|
13638
|
}
|
13639
|
this.delegate.appendChild(parent, newChild);
|
13640
|
};
|
13641
|
/**
|
13642
|
* @param {?} parent
|
13643
|
* @param {?} newChild
|
13644
|
* @param {?} refChild
|
13645
|
* @return {?}
|
13646
|
*/
|
13647
|
DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
|
13648
|
var /** @type {?} */ debugEl = getDebugNode(parent);
|
13649
|
var /** @type {?} */ debugChildEl = getDebugNode(newChild);
|
13650
|
var /** @type {?} */ debugRefEl = ((getDebugNode(refChild)));
|
13651
|
if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13652
|
debugEl.insertBefore(debugRefEl, debugChildEl);
|
13653
|
}
|
13654
|
this.delegate.insertBefore(parent, newChild, refChild);
|
13655
|
};
|
13656
|
/**
|
13657
|
* @param {?} parent
|
13658
|
* @param {?} oldChild
|
13659
|
* @return {?}
|
13660
|
*/
|
13661
|
DebugRenderer2.prototype.removeChild = function (parent, oldChild) {
|
13662
|
var /** @type {?} */ debugEl = getDebugNode(parent);
|
13663
|
var /** @type {?} */ debugChildEl = getDebugNode(oldChild);
|
13664
|
if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13665
|
debugEl.removeChild(debugChildEl);
|
13666
|
}
|
13667
|
this.delegate.removeChild(parent, oldChild);
|
13668
|
};
|
13669
|
/**
|
13670
|
* @param {?} selectorOrNode
|
13671
|
* @return {?}
|
13672
|
*/
|
13673
|
DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) {
|
13674
|
var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode);
|
13675
|
var /** @type {?} */ debugCtx = getCurrentDebugContext();
|
13676
|
if (debugCtx) {
|
13677
|
indexDebugNode(new DebugElement(el, null, debugCtx));
|
13678
|
}
|
13679
|
return el;
|
13680
|
};
|
13681
|
/**
|
13682
|
* @param {?} el
|
13683
|
* @param {?} name
|
13684
|
* @param {?} value
|
13685
|
* @param {?=} namespace
|
13686
|
* @return {?}
|
13687
|
*/
|
13688
|
DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
|
13689
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13690
|
if (debugEl && debugEl instanceof DebugElement) {
|
13691
|
var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
|
13692
|
debugEl.attributes[fullName] = value;
|
13693
|
}
|
13694
|
this.delegate.setAttribute(el, name, value, namespace);
|
13695
|
};
|
13696
|
/**
|
13697
|
* @param {?} el
|
13698
|
* @param {?} name
|
13699
|
* @param {?=} namespace
|
13700
|
* @return {?}
|
13701
|
*/
|
13702
|
DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) {
|
13703
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13704
|
if (debugEl && debugEl instanceof DebugElement) {
|
13705
|
var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
|
13706
|
debugEl.attributes[fullName] = null;
|
13707
|
}
|
13708
|
this.delegate.removeAttribute(el, name, namespace);
|
13709
|
};
|
13710
|
/**
|
13711
|
* @param {?} el
|
13712
|
* @param {?} name
|
13713
|
* @return {?}
|
13714
|
*/
|
13715
|
DebugRenderer2.prototype.addClass = function (el, name) {
|
13716
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13717
|
if (debugEl && debugEl instanceof DebugElement) {
|
13718
|
debugEl.classes[name] = true;
|
13719
|
}
|
13720
|
this.delegate.addClass(el, name);
|
13721
|
};
|
13722
|
/**
|
13723
|
* @param {?} el
|
13724
|
* @param {?} name
|
13725
|
* @return {?}
|
13726
|
*/
|
13727
|
DebugRenderer2.prototype.removeClass = function (el, name) {
|
13728
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13729
|
if (debugEl && debugEl instanceof DebugElement) {
|
13730
|
debugEl.classes[name] = false;
|
13731
|
}
|
13732
|
this.delegate.removeClass(el, name);
|
13733
|
};
|
13734
|
/**
|
13735
|
* @param {?} el
|
13736
|
* @param {?} style
|
13737
|
* @param {?} value
|
13738
|
* @param {?} flags
|
13739
|
* @return {?}
|
13740
|
*/
|
13741
|
DebugRenderer2.prototype.setStyle = function (el, style, value, flags) {
|
13742
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13743
|
if (debugEl && debugEl instanceof DebugElement) {
|
13744
|
debugEl.styles[style] = value;
|
13745
|
}
|
13746
|
this.delegate.setStyle(el, style, value, flags);
|
13747
|
};
|
13748
|
/**
|
13749
|
* @param {?} el
|
13750
|
* @param {?} style
|
13751
|
* @param {?} flags
|
13752
|
* @return {?}
|
13753
|
*/
|
13754
|
DebugRenderer2.prototype.removeStyle = function (el, style, flags) {
|
13755
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13756
|
if (debugEl && debugEl instanceof DebugElement) {
|
13757
|
debugEl.styles[style] = null;
|
13758
|
}
|
13759
|
this.delegate.removeStyle(el, style, flags);
|
13760
|
};
|
13761
|
/**
|
13762
|
* @param {?} el
|
13763
|
* @param {?} name
|
13764
|
* @param {?} value
|
13765
|
* @return {?}
|
13766
|
*/
|
13767
|
DebugRenderer2.prototype.setProperty = function (el, name, value) {
|
13768
|
var /** @type {?} */ debugEl = getDebugNode(el);
|
13769
|
if (debugEl && debugEl instanceof DebugElement) {
|
13770
|
debugEl.properties[name] = value;
|
13771
|
}
|
13772
|
this.delegate.setProperty(el, name, value);
|
13773
|
};
|
13774
|
/**
|
13775
|
* @param {?} target
|
13776
|
* @param {?} eventName
|
13777
|
* @param {?} callback
|
13778
|
* @return {?}
|
13779
|
*/
|
13780
|
DebugRenderer2.prototype.listen = function (target, eventName, callback) {
|
13781
|
if (typeof target !== 'string') {
|
13782
|
var /** @type {?} */ debugEl = getDebugNode(target);
|
13783
|
if (debugEl) {
|
13784
|
debugEl.listeners.push(new EventListener(eventName, callback));
|
13785
|
}
|
13786
|
}
|
13787
|
return this.delegate.listen(target, eventName, callback);
|
13788
|
};
|
13789
|
/**
|
13790
|
* @param {?} node
|
13791
|
* @return {?}
|
13792
|
*/
|
13793
|
DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); };
|
13794
|
/**
|
13795
|
* @param {?} node
|
13796
|
* @return {?}
|
13797
|
*/
|
13798
|
DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); };
|
13799
|
/**
|
13800
|
* @param {?} node
|
13801
|
* @param {?} value
|
13802
|
* @return {?}
|
13803
|
*/
|
13804
|
DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); };
|
13805
|
return DebugRenderer2;
|
13806
|
}());
|
13807
|
/**
|
13808
|
* @license
|
13809
|
* Copyright Google Inc. All Rights Reserved.
|
13810
|
*
|
13811
|
* Use of this source code is governed by an MIT-style license that can be
|
13812
|
* found in the LICENSE file at https://angular.io/license
|
13813
|
*/
|
13814
|
/**
|
13815
|
* @param {?} override
|
13816
|
* @return {?}
|
13817
|
*/
|
13818
|
function overrideProvider(override) {
|
13819
|
initServicesIfNeeded();
|
13820
|
return Services.overrideProvider(override);
|
13821
|
}
|
13822
|
/**
|
13823
|
* @return {?}
|
13824
|
*/
|
13825
|
function clearProviderOverrides() {
|
13826
|
initServicesIfNeeded();
|
13827
|
return Services.clearProviderOverrides();
|
13828
|
}
|
13829
|
/**
|
13830
|
* @param {?} ngModuleType
|
13831
|
* @param {?} bootstrapComponents
|
13832
|
* @param {?} defFactory
|
13833
|
* @return {?}
|
13834
|
*/
|
13835
|
function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
|
13836
|
return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
|
13837
|
}
|
13838
|
var NgModuleFactory_ = (function (_super) {
|
13839
|
__extends(NgModuleFactory_, _super);
|
13840
|
/**
|
13841
|
* @param {?} moduleType
|
13842
|
* @param {?} _bootstrapComponents
|
13843
|
* @param {?} _ngModuleDefFactory
|
13844
|
*/
|
13845
|
function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
|
13846
|
var _this =
|
13847
|
// Attention: this ctor is called as top level function.
|
13848
|
// Putting any logic in here will destroy closure tree shaking!
|
13849
|
_super.call(this) || this;
|
13850
|
_this.moduleType = moduleType;
|
13851
|
_this._bootstrapComponents = _bootstrapComponents;
|
13852
|
_this._ngModuleDefFactory = _ngModuleDefFactory;
|
13853
|
return _this;
|
13854
|
}
|
13855
|
/**
|
13856
|
* @param {?} parentInjector
|
13857
|
* @return {?}
|
13858
|
*/
|
13859
|
NgModuleFactory_.prototype.create = function (parentInjector) {
|
13860
|
initServicesIfNeeded();
|
13861
|
var /** @type {?} */ def = resolveDefinition(this._ngModuleDefFactory);
|
13862
|
return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
|
13863
|
};
|
13864
|
return NgModuleFactory_;
|
13865
|
}(NgModuleFactory));
|
13866
|
/**
|
13867
|
* @license
|
13868
|
* Copyright Google Inc. All Rights Reserved.
|
13869
|
*
|
13870
|
* Use of this source code is governed by an MIT-style license that can be
|
13871
|
* found in the LICENSE file at https://angular.io/license
|
13872
|
*/
|
13873
|
/**
|
13874
|
* @license
|
13875
|
* Copyright Google Inc. All Rights Reserved.
|
13876
|
*
|
13877
|
* Use of this source code is governed by an MIT-style license that can be
|
13878
|
* found in the LICENSE file at https://angular.io/license
|
13879
|
*/
|
13880
|
/**
|
13881
|
* @license
|
13882
|
* Copyright Google Inc. All Rights Reserved.
|
13883
|
*
|
13884
|
* Use of this source code is governed by an MIT-style license that can be
|
13885
|
* found in the LICENSE file at https://angular.io/license
|
13886
|
*/
|
13887
|
/**
|
13888
|
* \@experimental Animation support is experimental.
|
13889
|
*/
|
13890
|
/**
|
13891
|
* `trigger` is an animation-specific function that is designed to be used inside of Angular's
|
13892
|
* animation DSL language. If this information is new, please navigate to the
|
13893
|
* {\@link Component#animations component animations metadata page} to gain a better
|
13894
|
* understanding of how animations in Angular are used.
|
13895
|
*
|
13896
|
* `trigger` Creates an animation trigger which will a list of {\@link state state} and
|
13897
|
* {\@link transition transition} entries that will be evaluated when the expression
|
13898
|
* bound to the trigger changes.
|
13899
|
*
|
13900
|
* Triggers are registered within the component annotation data under the
|
13901
|
* {\@link Component#animations animations section}. An animation trigger can be placed on an element
|
13902
|
* within a template by referencing the name of the trigger followed by the expression value that
|
13903
|
* the
|
13904
|
* trigger is bound to (in the form of `[\@triggerName]="expression"`.
|
13905
|
*
|
13906
|
* Animation trigger bindings strigify values and then match the previous and current values against
|
13907
|
* any linked transitions. If a boolean value is provided into the trigger binding then it will both
|
13908
|
* be represented as `1` or `true` and `0` or `false` for a true and false boolean values
|
13909
|
* respectively.
|
13910
|
*
|
13911
|
* ### Usage
|
13912
|
*
|
13913
|
* `trigger` will create an animation trigger reference based on the provided `name` value. The
|
13914
|
* provided `animation` value is expected to be an array consisting of {\@link state state} and
|
13915
|
* {\@link transition transition} declarations.
|
13916
|
*
|
13917
|
* ```typescript
|
13918
|
* \@Component({
|
13919
|
* selector: 'my-component',
|
13920
|
* templateUrl: 'my-component-tpl.html',
|
13921
|
* animations: [
|
13922
|
* trigger("myAnimationTrigger", [
|
13923
|
* state(...),
|
13924
|
* state(...),
|
13925
|
* transition(...),
|
13926
|
* transition(...)
|
13927
|
* ])
|
13928
|
* ]
|
13929
|
* })
|
13930
|
* class MyComponent {
|
13931
|
* myStatusExp = "something";
|
13932
|
* }
|
13933
|
* ```
|
13934
|
*
|
13935
|
* The template associated with this component will make use of the `myAnimationTrigger` animation
|
13936
|
* trigger by binding to an element within its template code.
|
13937
|
*
|
13938
|
* ```html
|
13939
|
* <!-- somewhere inside of my-component-tpl.html -->
|
13940
|
* <div [\@myAnimationTrigger]="myStatusExp">...</div>
|
13941
|
* ```
|
13942
|
*
|
13943
|
* ## Disable Animations
|
13944
|
* A special animation control binding called `\@.disabled` can be placed on an element which will
|
13945
|
* then disable animations for any inner animation triggers situated within the element as well as
|
13946
|
* any animations on the element itself.
|
13947
|
*
|
13948
|
* When true, the `\@.disabled` binding will prevent all animations from rendering. The example
|
13949
|
* below shows how to use this feature:
|
13950
|
*
|
13951
|
* ```ts
|
13952
|
* \@Component({
|
13953
|
* selector: 'my-component',
|
13954
|
* template: `
|
13955
|
* <div [\@.disabled]="isDisabled">
|
13956
|
* <div [\@childAnimation]="exp"></div>
|
13957
|
* </div>
|
13958
|
* `,
|
13959
|
* animations: [
|
13960
|
* trigger("childAnimation", [
|
13961
|
* // ...
|
13962
|
* ])
|
13963
|
* ]
|
13964
|
* })
|
13965
|
* class MyComponent {
|
13966
|
* isDisabled = true;
|
13967
|
* exp = '...';
|
13968
|
* }
|
13969
|
* ```
|
13970
|
*
|
13971
|
* The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening
|
13972
|
* (when true).
|
13973
|
*
|
13974
|
* Note that `\@.disbled` will only disable all animations (this means any animations running on
|
13975
|
* the same element will also be disabled).
|
13976
|
*
|
13977
|
* ### Disabling Animations Application-wide
|
13978
|
* When an area of the template is set to have animations disabled, **all** inner components will
|
13979
|
* also have their animations disabled as well. This means that all animations for an angular
|
13980
|
* application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular
|
13981
|
* component.
|
13982
|
*
|
13983
|
* ```ts
|
13984
|
* import {Component, HostBinding} from '\@angular/core';
|
13985
|
*
|
13986
|
* \@Component({
|
13987
|
* selector: 'app-component',
|
13988
|
* templateUrl: 'app.component.html',
|
13989
|
* })
|
13990
|
* class AppComponent {
|
13991
|
* \@HostBinding('\@.disabled')
|
13992
|
* public animationsDisabled = true;
|
13993
|
* }
|
13994
|
* ```
|
13995
|
*
|
13996
|
* ### What about animations that us `query()` and `animateChild()`?
|
13997
|
* Despite inner animations being disabled, a parent animation can {\@link query query} for inner
|
13998
|
* elements located in disabled areas of the template and still animate them as it sees fit. This is
|
13999
|
* also the case for when a sub animation is queried by a parent and then later animated using {\@link
|
14000
|
* animateChild animateChild}.
|
14001
|
*
|
14002
|
* \@experimental Animation support is experimental.
|
14003
|
* @param {?} name
|
14004
|
* @param {?} definitions
|
14005
|
* @return {?}
|
14006
|
*/
|
14007
|
function trigger$1(name, definitions) {
|
14008
|
return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
|
14009
|
}
|
14010
|
/**
|
14011
|
* `animate` is an animation-specific function that is designed to be used inside of Angular's
|
14012
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14013
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14014
|
* how animations in Angular are used.
|
14015
|
*
|
14016
|
* `animate` specifies an animation step that will apply the provided `styles` data for a given
|
14017
|
* amount of time based on the provided `timing` expression value. Calls to `animate` are expected
|
14018
|
* to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
|
14019
|
* transition transition}.
|
14020
|
*
|
14021
|
* ### Usage
|
14022
|
*
|
14023
|
* The `animate` function accepts two input parameters: `timing` and `styles`:
|
14024
|
*
|
14025
|
* - `timing` is a string based value that can be a combination of a duration with optional delay
|
14026
|
* and easing values. The format for the expression breaks down to `duration delay easing`
|
14027
|
* (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
|
14028
|
* delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
|
14029
|
* `duration` value in millisecond form.
|
14030
|
* - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
|
14031
|
* keyframes keyframes}. If left empty then the styles from the destination state will be collected
|
14032
|
* and used (this is useful when describing an animation step that will complete an animation by
|
14033
|
* {\@link transition#the-final-animate-call animating to the final state}).
|
14034
|
*
|
14035
|
* ```typescript
|
14036
|
* // various functions for specifying timing data
|
14037
|
* animate(500, style(...))
|
14038
|
* animate("1s", style(...))
|
14039
|
* animate("100ms 0.5s", style(...))
|
14040
|
* animate("5s ease", style(...))
|
14041
|
* animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
|
14042
|
*
|
14043
|
* // either style() of keyframes() can be used
|
14044
|
* animate(500, style({ background: "red" }))
|
14045
|
* animate(500, keyframes([
|
14046
|
* style({ background: "blue" })),
|
14047
|
* style({ background: "red" }))
|
14048
|
* ])
|
14049
|
* ```
|
14050
|
*
|
14051
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14052
|
*
|
14053
|
* \@experimental Animation support is experimental.
|
14054
|
* @param {?} timings
|
14055
|
* @param {?=} styles
|
14056
|
* @return {?}
|
14057
|
*/
|
14058
|
function animate$1(timings, styles) {
|
14059
|
if (styles === void 0) { styles = null; }
|
14060
|
return { type: 4 /* Animate */, styles: styles, timings: timings };
|
14061
|
}
|
14062
|
/**
|
14063
|
* `group` is an animation-specific function that is designed to be used inside of Angular's
|
14064
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14065
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14066
|
* how animations in Angular are used.
|
14067
|
*
|
14068
|
* `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
|
14069
|
* useful when a series of styles must be animated/closed off at different starting/ending times.
|
14070
|
*
|
14071
|
* The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
|
14072
|
* transition} and it will only continue to the next instruction once all of the inner animation
|
14073
|
* steps have completed.
|
14074
|
*
|
14075
|
* ### Usage
|
14076
|
*
|
14077
|
* The `steps` data that is passed into the `group` animation function can either consist of {\@link
|
14078
|
* style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
|
14079
|
* within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
|
14080
|
* animate#usage animate() with a delay value} to offset styles to be applied at a later time).
|
14081
|
*
|
14082
|
* ```typescript
|
14083
|
* group([
|
14084
|
* animate("1s", { background: "black" }))
|
14085
|
* animate("2s", { color: "white" }))
|
14086
|
* ])
|
14087
|
* ```
|
14088
|
*
|
14089
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14090
|
*
|
14091
|
* \@experimental Animation support is experimental.
|
14092
|
* @param {?} steps
|
14093
|
* @param {?=} options
|
14094
|
* @return {?}
|
14095
|
*/
|
14096
|
function group$1(steps, options) {
|
14097
|
if (options === void 0) { options = null; }
|
14098
|
return { type: 3 /* Group */, steps: steps, options: options };
|
14099
|
}
|
14100
|
/**
|
14101
|
* `sequence` is an animation-specific function that is designed to be used inside of Angular's
|
14102
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14103
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14104
|
* how animations in Angular are used.
|
14105
|
*
|
14106
|
* `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
|
14107
|
* default when an array is passed as animation data into {\@link transition transition}.)
|
14108
|
*
|
14109
|
* The `sequence` function can either be used within a {\@link group group} or a {\@link transition
|
14110
|
* transition} and it will only continue to the next instruction once each of the inner animation
|
14111
|
* steps have completed.
|
14112
|
*
|
14113
|
* To perform animation styling in parallel with other animation steps then have a look at the
|
14114
|
* {\@link group group} animation function.
|
14115
|
*
|
14116
|
* ### Usage
|
14117
|
*
|
14118
|
* The `steps` data that is passed into the `sequence` animation function can either consist of
|
14119
|
* {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
|
14120
|
* provided styling data immediately while a call to `animate()` will apply its styling data over a
|
14121
|
* given time depending on its timing data.
|
14122
|
*
|
14123
|
* ```typescript
|
14124
|
* sequence([
|
14125
|
* style({ opacity: 0 })),
|
14126
|
* animate("1s", { opacity: 1 }))
|
14127
|
* ])
|
14128
|
* ```
|
14129
|
*
|
14130
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14131
|
*
|
14132
|
* \@experimental Animation support is experimental.
|
14133
|
* @param {?} steps
|
14134
|
* @param {?=} options
|
14135
|
* @return {?}
|
14136
|
*/
|
14137
|
function sequence$1(steps, options) {
|
14138
|
if (options === void 0) { options = null; }
|
14139
|
return { type: 2 /* Sequence */, steps: steps, options: options };
|
14140
|
}
|
14141
|
/**
|
14142
|
* `style` is an animation-specific function that is designed to be used inside of Angular's
|
14143
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14144
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14145
|
* how animations in Angular are used.
|
14146
|
*
|
14147
|
* `style` declares a key/value object containing CSS properties/styles that can then be used for
|
14148
|
* {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
|
14149
|
* for both {\@link animate animate} and {\@link keyframes keyframes}.
|
14150
|
*
|
14151
|
* ### Usage
|
14152
|
*
|
14153
|
* `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
|
14154
|
* to be defined.
|
14155
|
*
|
14156
|
* ```typescript
|
14157
|
* // string values are used for css properties
|
14158
|
* style({ background: "red", color: "blue" })
|
14159
|
*
|
14160
|
* // numerical (pixel) values are also supported
|
14161
|
* style({ width: 100, height: 0 })
|
14162
|
* ```
|
14163
|
*
|
14164
|
* #### Auto-styles (using `*`)
|
14165
|
*
|
14166
|
* When an asterix (`*`) character is used as a value then it will be detected from the element
|
14167
|
* being animated and applied as animation data when the animation starts.
|
14168
|
*
|
14169
|
* This feature proves useful for a state depending on layout and/or environment factors; in such
|
14170
|
* cases the styles are calculated just before the animation starts.
|
14171
|
*
|
14172
|
* ```typescript
|
14173
|
* // the steps below will animate from 0 to the
|
14174
|
* // actual height of the element
|
14175
|
* style({ height: 0 }),
|
14176
|
* animate("1s", style({ height: "*" }))
|
14177
|
* ```
|
14178
|
*
|
14179
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14180
|
*
|
14181
|
* \@experimental Animation support is experimental.
|
14182
|
* @param {?} tokens
|
14183
|
* @return {?}
|
14184
|
*/
|
14185
|
function style$1(tokens) {
|
14186
|
return { type: 6 /* Style */, styles: tokens, offset: null };
|
14187
|
}
|
14188
|
/**
|
14189
|
* `state` is an animation-specific function that is designed to be used inside of Angular's
|
14190
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14191
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14192
|
* how animations in Angular are used.
|
14193
|
*
|
14194
|
* `state` declares an animation state within the given trigger. When a state is active within a
|
14195
|
* component then its associated styles will persist on the element that the trigger is attached to
|
14196
|
* (even when the animation ends).
|
14197
|
*
|
14198
|
* To animate between states, have a look at the animation {\@link transition transition} DSL
|
14199
|
* function. To register states to an animation trigger please have a look at the {\@link trigger
|
14200
|
* trigger} function.
|
14201
|
*
|
14202
|
* #### The `void` state
|
14203
|
*
|
14204
|
* The `void` state value is a reserved word that angular uses to determine when the element is not
|
14205
|
* apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
|
14206
|
* associated element is void).
|
14207
|
*
|
14208
|
* #### The `*` (default) state
|
14209
|
*
|
14210
|
* The `*` state (when styled) is a fallback state that will be used if the state that is being
|
14211
|
* animated is not declared within the trigger.
|
14212
|
*
|
14213
|
* ### Usage
|
14214
|
*
|
14215
|
* `state` will declare an animation state with its associated styles
|
14216
|
* within the given trigger.
|
14217
|
*
|
14218
|
* - `stateNameExpr` can be one or more state names separated by commas.
|
14219
|
* - `styles` refers to the {\@link style styling data} that will be persisted on the element once
|
14220
|
* the state has been reached.
|
14221
|
*
|
14222
|
* ```typescript
|
14223
|
* // "void" is a reserved name for a state and is used to represent
|
14224
|
* // the state in which an element is detached from from the application.
|
14225
|
* state("void", style({ height: 0 }))
|
14226
|
*
|
14227
|
* // user-defined states
|
14228
|
* state("closed", style({ height: 0 }))
|
14229
|
* state("open, visible", style({ height: "*" }))
|
14230
|
* ```
|
14231
|
*
|
14232
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14233
|
*
|
14234
|
* \@experimental Animation support is experimental.
|
14235
|
* @param {?} name
|
14236
|
* @param {?} styles
|
14237
|
* @param {?=} options
|
14238
|
* @return {?}
|
14239
|
*/
|
14240
|
function state$1(name, styles, options) {
|
14241
|
return { type: 0 /* State */, name: name, styles: styles, options: options };
|
14242
|
}
|
14243
|
/**
|
14244
|
* `keyframes` is an animation-specific function that is designed to be used inside of Angular's
|
14245
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14246
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14247
|
* how animations in Angular are used.
|
14248
|
*
|
14249
|
* `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
|
14250
|
* by an `offset` value.
|
14251
|
*
|
14252
|
* ### Usage
|
14253
|
*
|
14254
|
* The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
|
14255
|
* animation function. Instead of applying animations from where they are currently to their
|
14256
|
* destination, keyframes can describe how each style entry is applied and at what point within the
|
14257
|
* animation arc (much like CSS Keyframe Animations do).
|
14258
|
*
|
14259
|
* For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
|
14260
|
* percentage of the animate time the styles will be applied.
|
14261
|
*
|
14262
|
* ```typescript
|
14263
|
* // the provided offset values describe when each backgroundColor value is applied.
|
14264
|
* animate("5s", keyframes([
|
14265
|
* style({ backgroundColor: "red", offset: 0 }),
|
14266
|
* style({ backgroundColor: "blue", offset: 0.2 }),
|
14267
|
* style({ backgroundColor: "orange", offset: 0.3 }),
|
14268
|
* style({ backgroundColor: "black", offset: 1 })
|
14269
|
* ]))
|
14270
|
* ```
|
14271
|
*
|
14272
|
* Alternatively, if there are no `offset` values used within the style entries then the offsets
|
14273
|
* will be calculated automatically.
|
14274
|
*
|
14275
|
* ```typescript
|
14276
|
* animate("5s", keyframes([
|
14277
|
* style({ backgroundColor: "red" }) // offset = 0
|
14278
|
* style({ backgroundColor: "blue" }) // offset = 0.33
|
14279
|
* style({ backgroundColor: "orange" }) // offset = 0.66
|
14280
|
* style({ backgroundColor: "black" }) // offset = 1
|
14281
|
* ]))
|
14282
|
* ```
|
14283
|
*
|
14284
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14285
|
*
|
14286
|
* \@experimental Animation support is experimental.
|
14287
|
* @param {?} steps
|
14288
|
* @return {?}
|
14289
|
*/
|
14290
|
function keyframes$1(steps) {
|
14291
|
return { type: 5 /* Keyframes */, steps: steps };
|
14292
|
}
|
14293
|
/**
|
14294
|
* `transition` is an animation-specific function that is designed to be used inside of Angular's
|
14295
|
* animation DSL language. If this information is new, please navigate to the {\@link
|
14296
|
* Component#animations component animations metadata page} to gain a better understanding of
|
14297
|
* how animations in Angular are used.
|
14298
|
*
|
14299
|
* `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
|
14300
|
* provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
|
14301
|
* state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
|
14302
|
* and/or ending state).
|
14303
|
*
|
14304
|
* A function can also be provided as the `stateChangeExpr` argument for a transition and this
|
14305
|
* function will be executed each time a state change occurs. If the value returned within the
|
14306
|
* function is true then the associated animation will be run.
|
14307
|
*
|
14308
|
* Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
|
14309
|
* to animate to a state value and persist its styles then one or more {\@link state animation
|
14310
|
* states} is expected to be defined.
|
14311
|
*
|
14312
|
* ### Usage
|
14313
|
*
|
14314
|
* An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
|
14315
|
* what the previous state is and what the current state has become. In other words, if a transition
|
14316
|
* is defined that matches the old/current state criteria then the associated animation will be
|
14317
|
* triggered.
|
14318
|
*
|
14319
|
* ```typescript
|
14320
|
* // all transition/state changes are defined within an animation trigger
|
14321
|
* trigger("myAnimationTrigger", [
|
14322
|
* // if a state is defined then its styles will be persisted when the
|
14323
|
* // animation has fully completed itself
|
14324
|
* state("on", style({ background: "green" })),
|
14325
|
* state("off", style({ background: "grey" })),
|
14326
|
*
|
14327
|
* // a transition animation that will be kicked off when the state value
|
14328
|
* // bound to "myAnimationTrigger" changes from "on" to "off"
|
14329
|
* transition("on => off", animate(500)),
|
14330
|
*
|
14331
|
* // it is also possible to do run the same animation for both directions
|
14332
|
* transition("on <=> off", animate(500)),
|
14333
|
*
|
14334
|
* // or to define multiple states pairs separated by commas
|
14335
|
* transition("on => off, off => void", animate(500)),
|
14336
|
*
|
14337
|
* // this is a catch-all state change for when an element is inserted into
|
14338
|
* // the page and the destination state is unknown
|
14339
|
* transition("void => *", [
|
14340
|
* style({ opacity: 0 }),
|
14341
|
* animate(500)
|
14342
|
* ]),
|
14343
|
*
|
14344
|
* // this will capture a state change between any states
|
14345
|
* transition("* => *", animate("1s 0s")),
|
14346
|
*
|
14347
|
* // you can also go full out and include a function
|
14348
|
* transition((fromState, toState) => {
|
14349
|
* // when `true` then it will allow the animation below to be invoked
|
14350
|
* return fromState == "off" && toState == "on";
|
14351
|
* }, animate("1s 0s"))
|
14352
|
* ])
|
14353
|
* ```
|
14354
|
*
|
14355
|
* The template associated with this component will make use of the `myAnimationTrigger` animation
|
14356
|
* trigger by binding to an element within its template code.
|
14357
|
*
|
14358
|
* ```html
|
14359
|
* <!-- somewhere inside of my-component-tpl.html -->
|
14360
|
* <div [\@myAnimationTrigger]="myStatusExp">...</div>
|
14361
|
* ```
|
14362
|
*
|
14363
|
* #### The final `animate` call
|
14364
|
*
|
14365
|
* If the final step within the transition steps is a call to `animate()` that **only** uses a
|
14366
|
* timing value with **no style data** then it will be automatically used as the final animation arc
|
14367
|
* for the element to animate itself to the final state. This involves an automatic mix of
|
14368
|
* adding/removing CSS styles so that the element will be in the exact state it should be for the
|
14369
|
* applied state to be presented correctly.
|
14370
|
*
|
14371
|
* ```
|
14372
|
* // start off by hiding the element, but make sure that it animates properly to whatever state
|
14373
|
* // is currently active for "myAnimationTrigger"
|
14374
|
* transition("void => *", [
|
14375
|
* style({ opacity: 0 }),
|
14376
|
* animate(500)
|
14377
|
* ])
|
14378
|
* ```
|
14379
|
*
|
14380
|
* ### Transition Aliases (`:enter` and `:leave`)
|
14381
|
*
|
14382
|
* Given that enter (insertion) and leave (removal) animations are so common, the `transition`
|
14383
|
* function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
|
14384
|
* => void` state changes.
|
14385
|
*
|
14386
|
* ```
|
14387
|
* transition(":enter", [
|
14388
|
* style({ opacity: 0 }),
|
14389
|
* animate(500, style({ opacity: 1 }))
|
14390
|
* ])
|
14391
|
* transition(":leave", [
|
14392
|
* animate(500, style({ opacity: 0 }))
|
14393
|
* ])
|
14394
|
* ```
|
14395
|
*
|
14396
|
* ### Boolean values
|
14397
|
* if a trigger binding value is a boolean value then it can be matched using a transition
|
14398
|
* expression that compares `true` and `false` or `1` and `0`.
|
14399
|
*
|
14400
|
* ```
|
14401
|
* // in the template
|
14402
|
* <div [\@openClose]="open ? true : false">...</div>
|
14403
|
*
|
14404
|
* // in the component metadata
|
14405
|
* trigger('openClose', [
|
14406
|
* state('true', style({ height: '*' })),
|
14407
|
* state('false', style({ height: '0px' })),
|
14408
|
* transition('false <=> true', animate(500))
|
14409
|
* ])
|
14410
|
* ```
|
14411
|
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
|
14412
|
*
|
14413
|
* \@experimental Animation support is experimental.
|
14414
|
* @param {?} stateChangeExpr
|
14415
|
* @param {?} steps
|
14416
|
* @param {?=} options
|
14417
|
* @return {?}
|
14418
|
*/
|
14419
|
function transition$1(stateChangeExpr, steps, options) {
|
14420
|
if (options === void 0) { options = null; }
|
14421
|
return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
|
14422
|
}
|
14423
|
/**
|
14424
|
* `animation` is an animation-specific function that is designed to be used inside of Angular's
|
14425
|
* animation DSL language.
|
14426
|
*
|
14427
|
* `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
|
14428
|
* invoked in another animation or sequence. Reusable animations are designed to make use of
|
14429
|
* animation parameters and the produced animation can be used via the `useAnimation` method.
|
14430
|
*
|
14431
|
* ```
|
14432
|
* var fadeAnimation = animation([
|
14433
|
* style({ opacity: '{{ start }}' }),
|
14434
|
* animate('{{ time }}',
|
14435
|
* style({ opacity: '{{ end }}'}))
|
14436
|
* ], { params: { time: '1000ms', start: 0, end: 1 }});
|
14437
|
* ```
|
14438
|
*
|
14439
|
* If parameters are attached to an animation then they act as **default parameter values**. When an
|
14440
|
* animation is invoked via `useAnimation` then parameter values are allowed to be passed in
|
14441
|
* directly. If any of the passed in parameter values are missing then the default values will be
|
14442
|
* used.
|
14443
|
*
|
14444
|
* ```
|
14445
|
* useAnimation(fadeAnimation, {
|
14446
|
* params: {
|
14447
|
* time: '2s',
|
14448
|
* start: 1,
|
14449
|
* end: 0
|
14450
|
* }
|
14451
|
* })
|
14452
|
* ```
|
14453
|
*
|
14454
|
* If one or more parameter values are missing before animated then an error will be thrown.
|
14455
|
*
|
14456
|
* \@experimental Animation support is experimental.
|
14457
|
* @param {?} steps
|
14458
|
* @param {?=} options
|
14459
|
* @return {?}
|
14460
|
*/
|
14461
|
/**
|
14462
|
* `animateChild` is an animation-specific function that is designed to be used inside of Angular's
|
14463
|
* animation DSL language. It works by allowing a queried element to execute its own
|
14464
|
* animation within the animation sequence.
|
14465
|
*
|
14466
|
* Each time an animation is triggered in angular, the parent animation
|
14467
|
* will always get priority and any child animations will be blocked. In order
|
14468
|
* for a child animation to run, the parent animation must query each of the elements
|
14469
|
* containing child animations and then allow the animations to run using `animateChild`.
|
14470
|
*
|
14471
|
* The example HTML code below shows both parent and child elements that have animation
|
14472
|
* triggers that will execute at the same time.
|
14473
|
*
|
14474
|
* ```html
|
14475
|
* <!-- parent-child.component.html -->
|
14476
|
* <button (click)="exp =! exp">Toggle</button>
|
14477
|
* <hr>
|
14478
|
*
|
14479
|
* <div [\@parentAnimation]="exp">
|
14480
|
* <header>Hello</header>
|
14481
|
* <div [\@childAnimation]="exp">
|
14482
|
* one
|
14483
|
* </div>
|
14484
|
* <div [\@childAnimation]="exp">
|
14485
|
* two
|
14486
|
* </div>
|
14487
|
* <div [\@childAnimation]="exp">
|
14488
|
* three
|
14489
|
* </div>
|
14490
|
* </div>
|
14491
|
* ```
|
14492
|
*
|
14493
|
* Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
|
14494
|
* because it has priority. However, using `query` and `animateChild` each of the inner animations
|
14495
|
* can also fire:
|
14496
|
*
|
14497
|
* ```ts
|
14498
|
* // parent-child.component.ts
|
14499
|
* import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
|
14500
|
* \@Component({
|
14501
|
* selector: 'parent-child-component',
|
14502
|
* animations: [
|
14503
|
* trigger('parentAnimation', [
|
14504
|
* transition('false => true', [
|
14505
|
* query('header', [
|
14506
|
* style({ opacity: 0 }),
|
14507
|
* animate(500, style({ opacity: 1 }))
|
14508
|
* ]),
|
14509
|
* query('\@childAnimation', [
|
14510
|
* animateChild()
|
14511
|
* ])
|
14512
|
* ])
|
14513
|
* ]),
|
14514
|
* trigger('childAnimation', [
|
14515
|
* transition('false => true', [
|
14516
|
* style({ opacity: 0 }),
|
14517
|
* animate(500, style({ opacity: 1 }))
|
14518
|
* ])
|
14519
|
* ])
|
14520
|
* ]
|
14521
|
* })
|
14522
|
* class ParentChildCmp {
|
14523
|
* exp: boolean = false;
|
14524
|
* }
|
14525
|
* ```
|
14526
|
*
|
14527
|
* In the animation code above, when the `parentAnimation` transition kicks off it first queries to
|
14528
|
* find the header element and fades it in. It then finds each of the sub elements that contain the
|
14529
|
* `\@childAnimation` trigger and then allows for their animations to fire.
|
14530
|
*
|
14531
|
* This example can be further extended by using stagger:
|
14532
|
*
|
14533
|
* ```ts
|
14534
|
* query('\@childAnimation', stagger(100, [
|
14535
|
* animateChild()
|
14536
|
* ]))
|
14537
|
* ```
|
14538
|
*
|
14539
|
* Now each of the sub animations start off with respect to the `100ms` staggering step.
|
14540
|
*
|
14541
|
* ## The first frame of child animations
|
14542
|
* When sub animations are executed using `animateChild` the animation engine will always apply the
|
14543
|
* first frame of every sub animation immediately at the start of the animation sequence. This way
|
14544
|
* the parent animation does not need to set any initial styling data on the sub elements before the
|
14545
|
* sub animations kick off.
|
14546
|
*
|
14547
|
* In the example above the first frame of the `childAnimation`'s `false => true` transition
|
14548
|
* consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
|
14549
|
* animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
|
14550
|
* with `animateChild` will it then animate to its destination of `opacity: 1`.
|
14551
|
*
|
14552
|
* Note that this feature designed to be used alongside {\@link query query()} and it will only work
|
14553
|
* with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
|
14554
|
* and transitions are not handled by this API).
|
14555
|
*
|
14556
|
* \@experimental Animation support is experimental.
|
14557
|
* @param {?=} options
|
14558
|
* @return {?}
|
14559
|
*/
|
14560
|
/**
|
14561
|
* `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
|
14562
|
* animation DSL language. It is used to kick off a reusable animation that is created using {\@link
|
14563
|
* animation animation()}.
|
14564
|
*
|
14565
|
* \@experimental Animation support is experimental.
|
14566
|
* @param {?} animation
|
14567
|
* @param {?=} options
|
14568
|
* @return {?}
|
14569
|
*/
|
14570
|
/**
|
14571
|
* `query` is an animation-specific function that is designed to be used inside of Angular's
|
14572
|
* animation DSL language.
|
14573
|
*
|
14574
|
* query() is used to find one or more inner elements within the current element that is
|
14575
|
* being animated within the sequence. The provided animation steps are applied
|
14576
|
* to the queried element (by default, an array is provided, then this will be
|
14577
|
* treated as an animation sequence).
|
14578
|
*
|
14579
|
* ### Usage
|
14580
|
*
|
14581
|
* query() is designed to collect mutiple elements and works internally by using
|
14582
|
* `element.querySelectorAll`. An additional options object can be provided which
|
14583
|
* can be used to limit the total amount of items to be collected.
|
14584
|
*
|
14585
|
* ```js
|
14586
|
* query('div', [
|
14587
|
* animate(...),
|
14588
|
* animate(...)
|
14589
|
* ], { limit: 1 })
|
14590
|
* ```
|
14591
|
*
|
14592
|
* query(), by default, will throw an error when zero items are found. If a query
|
14593
|
* has the `optional` flag set to true then this error will be ignored.
|
14594
|
*
|
14595
|
* ```js
|
14596
|
* query('.some-element-that-may-not-be-there', [
|
14597
|
* animate(...),
|
14598
|
* animate(...)
|
14599
|
* ], { optional: true })
|
14600
|
* ```
|
14601
|
*
|
14602
|
* ### Special Selector Values
|
14603
|
*
|
14604
|
* The selector value within a query can collect elements that contain angular-specific
|
14605
|
* characteristics
|
14606
|
* using special pseudo-selectors tokens.
|
14607
|
*
|
14608
|
* These include:
|
14609
|
*
|
14610
|
* - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
|
14611
|
* - Querying all currently animating elements using `query(":animating")`
|
14612
|
* - Querying elements that contain an animation trigger using `query("\@triggerName")`
|
14613
|
* - Querying all elements that contain an animation triggers using `query("\@*")`
|
14614
|
* - Including the current element into the animation sequence using `query(":self")`
|
14615
|
*
|
14616
|
*
|
14617
|
* Each of these pseudo-selector tokens can be merged together into a combined query selector
|
14618
|
* string:
|
14619
|
*
|
14620
|
* ```
|
14621
|
* query(':self, .record:enter, .record:leave, \@subTrigger', [...])
|
14622
|
* ```
|
14623
|
*
|
14624
|
* ### Demo
|
14625
|
*
|
14626
|
* ```
|
14627
|
* \@Component({
|
14628
|
* selector: 'inner',
|
14629
|
* template: `
|
14630
|
* <div [\@queryAnimation]="exp">
|
14631
|
* <h1>Title</h1>
|
14632
|
* <div class="content">
|
14633
|
* Blah blah blah
|
14634
|
* </div>
|
14635
|
* </div>
|
14636
|
* `,
|
14637
|
* animations: [
|
14638
|
* trigger('queryAnimation', [
|
14639
|
* transition('* => goAnimate', [
|
14640
|
* // hide the inner elements
|
14641
|
* query('h1', style({ opacity: 0 })),
|
14642
|
* query('.content', style({ opacity: 0 })),
|
14643
|
*
|
14644
|
* // animate the inner elements in, one by one
|
14645
|
* query('h1', animate(1000, style({ opacity: 1 })),
|
14646
|
* query('.content', animate(1000, style({ opacity: 1 })),
|
14647
|
* ])
|
14648
|
* ])
|
14649
|
* ]
|
14650
|
* })
|
14651
|
* class Cmp {
|
14652
|
* exp = '';
|
14653
|
*
|
14654
|
* goAnimate() {
|
14655
|
* this.exp = 'goAnimate';
|
14656
|
* }
|
14657
|
* }
|
14658
|
* ```
|
14659
|
*
|
14660
|
* \@experimental Animation support is experimental.
|
14661
|
* @param {?} selector
|
14662
|
* @param {?} animation
|
14663
|
* @param {?=} options
|
14664
|
* @return {?}
|
14665
|
*/
|
14666
|
/**
|
14667
|
* `stagger` is an animation-specific function that is designed to be used inside of Angular's
|
14668
|
* animation DSL language. It is designed to be used inside of an animation {\@link query query()}
|
14669
|
* and works by issuing a timing gap between after each queried item is animated.
|
14670
|
*
|
14671
|
* ### Usage
|
14672
|
*
|
14673
|
* In the example below there is a container element that wraps a list of items stamped out
|
14674
|
* by an ngFor. The container element contains an animation trigger that will later be set
|
14675
|
* to query for each of the inner items.
|
14676
|
*
|
14677
|
* ```html
|
14678
|
* <!-- list.component.html -->
|
14679
|
* <button (click)="toggle()">Show / Hide Items</button>
|
14680
|
* <hr />
|
14681
|
* <div [\@listAnimation]="items.length">
|
14682
|
* <div *ngFor="let item of items">
|
14683
|
* {{ item }}
|
14684
|
* </div>
|
14685
|
* </div>
|
14686
|
* ```
|
14687
|
*
|
14688
|
* The component code for this looks as such:
|
14689
|
*
|
14690
|
* ```ts
|
14691
|
* import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
|
14692
|
* \@Component({
|
14693
|
* templateUrl: 'list.component.html',
|
14694
|
* animations: [
|
14695
|
* trigger('listAnimation', [
|
14696
|
* //...
|
14697
|
* ])
|
14698
|
* ]
|
14699
|
* })
|
14700
|
* class ListComponent {
|
14701
|
* items = [];
|
14702
|
*
|
14703
|
* showItems() {
|
14704
|
* this.items = [0,1,2,3,4];
|
14705
|
* }
|
14706
|
*
|
14707
|
* hideItems() {
|
14708
|
* this.items = [];
|
14709
|
* }
|
14710
|
*
|
14711
|
* toggle() {
|
14712
|
* this.items.length ? this.hideItems() : this.showItems();
|
14713
|
* }
|
14714
|
* }
|
14715
|
* ```
|
14716
|
*
|
14717
|
* And now for the animation trigger code:
|
14718
|
*
|
14719
|
* ```ts
|
14720
|
* trigger('listAnimation', [
|
14721
|
* transition('* => *', [ // each time the binding value changes
|
14722
|
* query(':leave', [
|
14723
|
* stagger(100, [
|
14724
|
* animate('0.5s', style({ opacity: 0 }))
|
14725
|
* ])
|
14726
|
* ]),
|
14727
|
* query(':enter', [
|
14728
|
* style({ opacity: 0 }),
|
14729
|
* stagger(100, [
|
14730
|
* animate('0.5s', style({ opacity: 1 }))
|
14731
|
* ])
|
14732
|
* ])
|
14733
|
* ])
|
14734
|
* ])
|
14735
|
* ```
|
14736
|
*
|
14737
|
* Now each time the items are added/removed then either the opacity
|
14738
|
* fade-in animation will run or each removed item will be faded out.
|
14739
|
* When either of these animations occur then a stagger effect will be
|
14740
|
* applied after each item's animation is started.
|
14741
|
*
|
14742
|
* \@experimental Animation support is experimental.
|
14743
|
* @param {?} timings
|
14744
|
* @param {?} animation
|
14745
|
* @return {?}
|
14746
|
*/
|
14747
|
/**
|
14748
|
* @license
|
14749
|
* Copyright Google Inc. All Rights Reserved.
|
14750
|
*
|
14751
|
* Use of this source code is governed by an MIT-style license that can be
|
14752
|
* found in the LICENSE file at https://angular.io/license
|
14753
|
*/
|
14754
|
/**
|
14755
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14756
|
*/
|
14757
|
var AUTO_STYLE$$1 = '*';
|
14758
|
/**
|
14759
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14760
|
* @param {?} name
|
14761
|
* @param {?} definitions
|
14762
|
* @return {?}
|
14763
|
*/
|
14764
|
function trigger$$1(name, definitions) {
|
14765
|
return trigger$1(name, definitions);
|
14766
|
}
|
14767
|
/**
|
14768
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14769
|
* @param {?} timings
|
14770
|
* @param {?=} styles
|
14771
|
* @return {?}
|
14772
|
*/
|
14773
|
function animate$$1(timings, styles) {
|
14774
|
return animate$1(timings, styles);
|
14775
|
}
|
14776
|
/**
|
14777
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14778
|
* @param {?} steps
|
14779
|
* @return {?}
|
14780
|
*/
|
14781
|
function group$$1(steps) {
|
14782
|
return group$1(steps);
|
14783
|
}
|
14784
|
/**
|
14785
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14786
|
* @param {?} steps
|
14787
|
* @return {?}
|
14788
|
*/
|
14789
|
function sequence$$1(steps) {
|
14790
|
return sequence$1(steps);
|
14791
|
}
|
14792
|
/**
|
14793
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14794
|
* @param {?} tokens
|
14795
|
* @return {?}
|
14796
|
*/
|
14797
|
function style$$1(tokens) {
|
14798
|
return style$1(tokens);
|
14799
|
}
|
14800
|
/**
|
14801
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14802
|
* @param {?} name
|
14803
|
* @param {?} styles
|
14804
|
* @return {?}
|
14805
|
*/
|
14806
|
function state$$1(name, styles) {
|
14807
|
return state$1(name, styles);
|
14808
|
}
|
14809
|
/**
|
14810
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14811
|
* @param {?} steps
|
14812
|
* @return {?}
|
14813
|
*/
|
14814
|
function keyframes$$1(steps) {
|
14815
|
return keyframes$1(steps);
|
14816
|
}
|
14817
|
/**
|
14818
|
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
|
14819
|
* @param {?} stateChangeExpr
|
14820
|
* @param {?} steps
|
14821
|
* @return {?}
|
14822
|
*/
|
14823
|
function transition$$1(stateChangeExpr, steps) {
|
14824
|
return transition$1(stateChangeExpr, steps);
|
14825
|
}
|
14826
|
|
14827
|
exports.Class = Class;
|
14828
|
exports.createPlatform = createPlatform;
|
14829
|
exports.assertPlatform = assertPlatform;
|
14830
|
exports.destroyPlatform = destroyPlatform;
|
14831
|
exports.getPlatform = getPlatform;
|
14832
|
exports.PlatformRef = PlatformRef;
|
14833
|
exports.ApplicationRef = ApplicationRef;
|
14834
|
exports.enableProdMode = enableProdMode;
|
14835
|
exports.isDevMode = isDevMode;
|
14836
|
exports.createPlatformFactory = createPlatformFactory;
|
14837
|
exports.NgProbeToken = NgProbeToken;
|
14838
|
exports.APP_ID = APP_ID;
|
14839
|
exports.PACKAGE_ROOT_URL = PACKAGE_ROOT_URL;
|
14840
|
exports.PLATFORM_INITIALIZER = PLATFORM_INITIALIZER;
|
14841
|
exports.PLATFORM_ID = PLATFORM_ID;
|
14842
|
exports.APP_BOOTSTRAP_LISTENER = APP_BOOTSTRAP_LISTENER;
|
14843
|
exports.APP_INITIALIZER = APP_INITIALIZER;
|
14844
|
exports.ApplicationInitStatus = ApplicationInitStatus;
|
14845
|
exports.DebugElement = DebugElement;
|
14846
|
exports.DebugNode = DebugNode;
|
14847
|
exports.asNativeElements = asNativeElements;
|
14848
|
exports.getDebugNode = getDebugNode;
|
14849
|
exports.Testability = Testability;
|
14850
|
exports.TestabilityRegistry = TestabilityRegistry;
|
14851
|
exports.setTestabilityGetter = setTestabilityGetter;
|
14852
|
exports.TRANSLATIONS = TRANSLATIONS;
|
14853
|
exports.TRANSLATIONS_FORMAT = TRANSLATIONS_FORMAT;
|
14854
|
exports.LOCALE_ID = LOCALE_ID;
|
14855
|
exports.MissingTranslationStrategy = MissingTranslationStrategy;
|
14856
|
exports.ApplicationModule = ApplicationModule;
|
14857
|
exports.wtfCreateScope = wtfCreateScope;
|
14858
|
exports.wtfLeave = wtfLeave;
|
14859
|
exports.wtfStartTimeRange = wtfStartTimeRange;
|
14860
|
exports.wtfEndTimeRange = wtfEndTimeRange;
|
14861
|
exports.Type = Type;
|
14862
|
exports.EventEmitter = EventEmitter;
|
14863
|
exports.ErrorHandler = ErrorHandler;
|
14864
|
exports.Sanitizer = Sanitizer;
|
14865
|
exports.SecurityContext = SecurityContext;
|
14866
|
exports.ANALYZE_FOR_ENTRY_COMPONENTS = ANALYZE_FOR_ENTRY_COMPONENTS;
|
14867
|
exports.Attribute = Attribute;
|
14868
|
exports.ContentChild = ContentChild;
|
14869
|
exports.ContentChildren = ContentChildren;
|
14870
|
exports.Query = Query;
|
14871
|
exports.ViewChild = ViewChild;
|
14872
|
exports.ViewChildren = ViewChildren;
|
14873
|
exports.Component = Component;
|
14874
|
exports.Directive = Directive;
|
14875
|
exports.HostBinding = HostBinding;
|
14876
|
exports.HostListener = HostListener;
|
14877
|
exports.Input = Input;
|
14878
|
exports.Output = Output;
|
14879
|
exports.Pipe = Pipe;
|
14880
|
exports.CUSTOM_ELEMENTS_SCHEMA = CUSTOM_ELEMENTS_SCHEMA;
|
14881
|
exports.NO_ERRORS_SCHEMA = NO_ERRORS_SCHEMA;
|
14882
|
exports.NgModule = NgModule;
|
14883
|
exports.ViewEncapsulation = ViewEncapsulation;
|
14884
|
exports.Version = Version;
|
14885
|
exports.VERSION = VERSION;
|
14886
|
exports.forwardRef = forwardRef;
|
14887
|
exports.resolveForwardRef = resolveForwardRef;
|
14888
|
exports.Injector = Injector;
|
14889
|
exports.ReflectiveInjector = ReflectiveInjector;
|
14890
|
exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory;
|
14891
|
exports.ReflectiveKey = ReflectiveKey;
|
14892
|
exports.InjectionToken = InjectionToken;
|
14893
|
exports.OpaqueToken = OpaqueToken;
|
14894
|
exports.Inject = Inject;
|
14895
|
exports.Optional = Optional;
|
14896
|
exports.Injectable = Injectable;
|
14897
|
exports.Self = Self;
|
14898
|
exports.SkipSelf = SkipSelf;
|
14899
|
exports.Host = Host;
|
14900
|
exports.NgZone = NgZone;
|
14901
|
exports.RenderComponentType = RenderComponentType;
|
14902
|
exports.Renderer = Renderer;
|
14903
|
exports.Renderer2 = Renderer2;
|
14904
|
exports.RendererFactory2 = RendererFactory2;
|
14905
|
exports.RendererStyleFlags2 = RendererStyleFlags2;
|
14906
|
exports.RootRenderer = RootRenderer;
|
14907
|
exports.COMPILER_OPTIONS = COMPILER_OPTIONS;
|
14908
|
exports.Compiler = Compiler;
|
14909
|
exports.CompilerFactory = CompilerFactory;
|
14910
|
exports.ModuleWithComponentFactories = ModuleWithComponentFactories;
|
14911
|
exports.ComponentFactory = ComponentFactory;
|
14912
|
exports.ComponentRef = ComponentRef;
|
14913
|
exports.ComponentFactoryResolver = ComponentFactoryResolver;
|
14914
|
exports.ElementRef = ElementRef;
|
14915
|
exports.NgModuleFactory = NgModuleFactory;
|
14916
|
exports.NgModuleRef = NgModuleRef;
|
14917
|
exports.NgModuleFactoryLoader = NgModuleFactoryLoader;
|
14918
|
exports.getModuleFactory = getModuleFactory;
|
14919
|
exports.QueryList = QueryList;
|
14920
|
exports.SystemJsNgModuleLoader = SystemJsNgModuleLoader;
|
14921
|
exports.SystemJsNgModuleLoaderConfig = SystemJsNgModuleLoaderConfig;
|
14922
|
exports.TemplateRef = TemplateRef;
|
14923
|
exports.ViewContainerRef = ViewContainerRef;
|
14924
|
exports.EmbeddedViewRef = EmbeddedViewRef;
|
14925
|
exports.ViewRef = ViewRef;
|
14926
|
exports.ChangeDetectionStrategy = ChangeDetectionStrategy;
|
14927
|
exports.ChangeDetectorRef = ChangeDetectorRef;
|
14928
|
exports.DefaultIterableDiffer = DefaultIterableDiffer;
|
14929
|
exports.IterableDiffers = IterableDiffers;
|
14930
|
exports.KeyValueDiffers = KeyValueDiffers;
|
14931
|
exports.SimpleChange = SimpleChange;
|
14932
|
exports.WrappedValue = WrappedValue;
|
14933
|
exports.platformCore = platformCore;
|
14934
|
exports.ɵALLOW_MULTIPLE_PLATFORMS = ALLOW_MULTIPLE_PLATFORMS;
|
14935
|
exports.ɵAPP_ID_RANDOM_PROVIDER = APP_ID_RANDOM_PROVIDER;
|
14936
|
exports.ɵValueUnwrapper = ValueUnwrapper;
|
14937
|
exports.ɵdevModeEqual = devModeEqual;
|
14938
|
exports.ɵisListLikeIterable = isListLikeIterable;
|
14939
|
exports.ɵChangeDetectorStatus = ChangeDetectorStatus;
|
14940
|
exports.ɵisDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy;
|
14941
|
exports.ɵConsole = Console;
|
14942
|
exports.ɵERROR_COMPONENT_TYPE = ERROR_COMPONENT_TYPE;
|
14943
|
exports.ɵComponentFactory = ComponentFactory;
|
14944
|
exports.ɵCodegenComponentFactoryResolver = CodegenComponentFactoryResolver;
|
14945
|
exports.ɵViewMetadata = ViewMetadata;
|
14946
|
exports.ɵReflectionCapabilities = ReflectionCapabilities;
|
14947
|
exports.ɵRenderDebugInfo = RenderDebugInfo;
|
14948
|
exports.ɵglobal = _global;
|
14949
|
exports.ɵlooseIdentical = looseIdentical;
|
14950
|
exports.ɵstringify = stringify;
|
14951
|
exports.ɵmakeDecorator = makeDecorator;
|
14952
|
exports.ɵisObservable = isObservable;
|
14953
|
exports.ɵisPromise = isPromise;
|
14954
|
exports.ɵclearProviderOverrides = clearProviderOverrides;
|
14955
|
exports.ɵoverrideProvider = overrideProvider;
|
14956
|
exports.ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR;
|
14957
|
exports.ɵregisterModuleFactory = registerModuleFactory;
|
14958
|
exports.ɵEMPTY_ARRAY = EMPTY_ARRAY;
|
14959
|
exports.ɵEMPTY_MAP = EMPTY_MAP;
|
14960
|
exports.ɵand = anchorDef;
|
14961
|
exports.ɵccf = createComponentFactory;
|
14962
|
exports.ɵcmf = createNgModuleFactory;
|
14963
|
exports.ɵcrt = createRendererType2;
|
14964
|
exports.ɵdid = directiveDef;
|
14965
|
exports.ɵeld = elementDef;
|
14966
|
exports.ɵelementEventFullName = elementEventFullName;
|
14967
|
exports.ɵgetComponentViewDefinitionFactory = getComponentViewDefinitionFactory;
|
14968
|
exports.ɵinlineInterpolate = inlineInterpolate;
|
14969
|
exports.ɵinterpolate = interpolate;
|
14970
|
exports.ɵmod = moduleDef;
|
14971
|
exports.ɵmpd = moduleProvideDef;
|
14972
|
exports.ɵncd = ngContentDef;
|
14973
|
exports.ɵnov = nodeValue;
|
14974
|
exports.ɵpid = pipeDef;
|
14975
|
exports.ɵprd = providerDef;
|
14976
|
exports.ɵpad = pureArrayDef;
|
14977
|
exports.ɵpod = pureObjectDef;
|
14978
|
exports.ɵppd = purePipeDef;
|
14979
|
exports.ɵqud = queryDef;
|
14980
|
exports.ɵted = textDef;
|
14981
|
exports.ɵunv = unwrapValue;
|
14982
|
exports.ɵvid = viewDef;
|
14983
|
exports.AUTO_STYLE = AUTO_STYLE$$1;
|
14984
|
exports.trigger = trigger$$1;
|
14985
|
exports.animate = animate$$1;
|
14986
|
exports.group = group$$1;
|
14987
|
exports.sequence = sequence$$1;
|
14988
|
exports.style = style$$1;
|
14989
|
exports.state = state$$1;
|
14990
|
exports.keyframes = keyframes$$1;
|
14991
|
exports.transition = transition$$1;
|
14992
|
exports.ɵx = animate$1;
|
14993
|
exports.ɵy = group$1;
|
14994
|
exports.ɵbc = keyframes$1;
|
14995
|
exports.ɵz = sequence$1;
|
14996
|
exports.ɵbb = state$1;
|
14997
|
exports.ɵba = style$1;
|
14998
|
exports.ɵbd = transition$1;
|
14999
|
exports.ɵw = trigger$1;
|
15000
|
exports.ɵk = _iterableDiffersFactory;
|
15001
|
exports.ɵl = _keyValueDiffersFactory;
|
15002
|
exports.ɵm = _localeFactory;
|
15003
|
exports.ɵe = ApplicationRef_;
|
15004
|
exports.ɵf = _appIdRandomProviderFactory;
|
15005
|
exports.ɵg = defaultIterableDiffers;
|
15006
|
exports.ɵh = defaultKeyValueDiffers;
|
15007
|
exports.ɵi = DefaultIterableDifferFactory;
|
15008
|
exports.ɵj = DefaultKeyValueDifferFactory;
|
15009
|
exports.ɵb = ReflectiveInjector_;
|
15010
|
exports.ɵc = ReflectiveDependency;
|
15011
|
exports.ɵd = resolveReflectiveProviders;
|
15012
|
exports.ɵn = wtfEnabled;
|
15013
|
exports.ɵp = createScope$1;
|
15014
|
exports.ɵo = detectWTF;
|
15015
|
exports.ɵs = endTimeRange;
|
15016
|
exports.ɵq = leave;
|
15017
|
exports.ɵr = startTimeRange;
|
15018
|
exports.ɵa = makeParamDecorator;
|
15019
|
exports.ɵt = _def;
|
15020
|
exports.ɵu = DebugContext;
|
15021
|
|
15022
|
Object.defineProperty(exports, '__esModule', { value: true });
|
15023
|
|
15024
|
})));
|
15025
|
//# sourceMappingURL=core.umd.js.map
|