-
Notifications
You must be signed in to change notification settings - Fork 15
/
core.js
16256 lines (16160 loc) · 493 KB
/
core.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @license Angular v4.0.0-rc.1-f32f4de
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
import { Observable } from 'rxjs/Observable';
import { merge } from 'rxjs/observable/merge';
import { share } from 'rxjs/operator/share';
import { $$observable } from 'rxjs/symbol/observable';
import { Subject } from 'rxjs/Subject';
/**
* Creates a token that can be used in a DI Provider.
*
* ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview))
*
* ```typescript
* var t = new OpaqueToken("value");
*
* var injector = Injector.resolveAndCreate([
* {provide: t, useValue: "bindingValue"}
* ]);
*
* expect(injector.get(t)).toEqual("bindingValue");
* ```
*
* Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions
* caused by multiple providers using the same string as two different tokens.
*
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
* error messages.
* @deprecated since v4.0.0 because it does not support type information, use `InjectionToken<?>`
* instead.
*/
class OpaqueToken {
/**
* @param {?} _desc
*/
constructor(_desc) {
this._desc = _desc;
}
/**
* @return {?}
*/
toString() { return `Token ${this._desc}`; }
}
/**
* Creates a token that can be used in a DI Provider.
*
* Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
* runtime representation) such as when injecting an interface, callable type, array or
* parametrized type.
*
* `InjectionToken` is parametrize on `T` which is the type of object which will be returned by the
* `Injector`. This provides additional level of type safety.
*
* ```
* interface MyInterface {...}
* var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
* // myInterface is inferred to be MyInterface.
* ```
*
* ### Example
*
* {\@example core/di/ts/injector_spec.ts region='Injector'}
*
* \@stable
*/
class InjectionToken extends OpaqueToken {
/**
* @param {?} desc
*/
constructor(desc) { super(desc); }
/**
* @return {?}
*/
toString() { return `InjectionToken ${this._desc}`; }
}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
let /** @type {?} */ globalScope;
if (typeof window === 'undefined') {
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
// TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
globalScope = (self);
}
else {
globalScope = (global);
}
}
else {
globalScope = (window);
}
/**
* @param {?} fn
* @return {?}
*/
function scheduleMicroTask(fn) {
Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
}
// Need to declare a new variable for global here since TypeScript
// exports the original value of the symbol.
const /** @type {?} */ global$1 = globalScope;
/**
* @param {?} type
* @return {?}
*/
function getTypeNameForDebugging(type) {
return type['name'] || typeof type;
}
// TODO: remove calls to assert in production environment
// Note: Can't just export this and import in in other files
// as `assert` is a reserved keyword in Dart
global$1.assert = function assert(condition) {
// TODO: to be fixed properly via #2830, noop for now
};
/**
* @param {?} obj
* @return {?}
*/
function isPresent(obj) {
return obj != null;
}
/**
* @param {?} obj
* @return {?}
*/
function isBlank(obj) {
return obj == null;
}
/**
* @param {?} token
* @return {?}
*/
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (token == null) {
return '' + token;
}
if (token.overriddenName) {
return `${token.overriddenName}`;
}
if (token.name) {
return `${token.name}`;
}
const /** @type {?} */ res = token.toString();
const /** @type {?} */ newLineIndex = res.indexOf('\n');
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
}
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function looseIdentical(a, b) {
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
}
/**
* @param {?} o
* @return {?}
*/
function isJsObject(o) {
return o !== null && (typeof o === 'function' || typeof o === 'object');
}
/**
* @param {?} obj
* @return {?}
*/
function print(obj) {
// tslint:disable-next-line:no-console
console.log(obj);
}
/**
* @param {?} obj
* @return {?}
*/
function warn(obj) {
console.warn(obj);
}
let /** @type {?} */ _symbolIterator = null;
/**
* @return {?}
*/
function getSymbolIterator() {
if (!_symbolIterator) {
if (((globalScope)).Symbol && Symbol.iterator) {
_symbolIterator = Symbol.iterator;
}
else {
// es6-shim specific logic
const /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
for (let /** @type {?} */ i = 0; i < keys.length; ++i) {
const /** @type {?} */ key = keys[i];
if (key !== 'entries' && key !== 'size' &&
((Map)).prototype[key] === Map.prototype['entries']) {
_symbolIterator = key;
}
}
}
}
return _symbolIterator;
}
/**
* @param {?} obj
* @return {?}
*/
function isPrimitive(obj) {
return !isJsObject(obj);
}
let /** @type {?} */ _nextClassId = 0;
const /** @type {?} */ Reflect = global$1.Reflect;
/**
* @param {?} annotation
* @return {?}
*/
function extractAnnotation(annotation) {
if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {
// it is a decorator, extract annotation
annotation = annotation.annotation;
}
return annotation;
}
/**
* @param {?} fnOrArray
* @param {?} key
* @return {?}
*/
function applyParams(fnOrArray, key) {
if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function ||
fnOrArray === Number || fnOrArray === Array) {
throw new Error(`Can not use native ${stringify(fnOrArray)} as constructor`);
}
if (typeof fnOrArray === 'function') {
return fnOrArray;
}
if (Array.isArray(fnOrArray)) {
const /** @type {?} */ annotations = fnOrArray;
const /** @type {?} */ annoLength = annotations.length - 1;
const /** @type {?} */ fn = fnOrArray[annoLength];
if (typeof fn !== 'function') {
throw new Error(`Last position of Class method array must be Function in key ${key} was '${stringify(fn)}'`);
}
if (annoLength != fn.length) {
throw new Error(`Number of annotations (${annoLength}) does not match number of arguments (${fn.length}) in the function: ${stringify(fn)}`);
}
const /** @type {?} */ paramsAnnotations = [];
for (let /** @type {?} */ i = 0, /** @type {?} */ ii = annotations.length - 1; i < ii; i++) {
const /** @type {?} */ paramAnnotations = [];
paramsAnnotations.push(paramAnnotations);
const /** @type {?} */ annotation = annotations[i];
if (Array.isArray(annotation)) {
for (let /** @type {?} */ j = 0; j < annotation.length; j++) {
paramAnnotations.push(extractAnnotation(annotation[j]));
}
}
else if (typeof annotation === 'function') {
paramAnnotations.push(extractAnnotation(annotation));
}
else {
paramAnnotations.push(annotation);
}
}
Reflect.defineMetadata('parameters', paramsAnnotations, fn);
return fn;
}
throw new Error(`Only Function or Array is supported in Class definition for key '${key}' is '${stringify(fnOrArray)}'`);
}
/**
* Provides a way for expressing ES6 classes with parameter annotations in ES5.
*
* ## Basic Example
*
* ```
* var Greeter = ng.Class({
* constructor: function(name) {
* this.name = name;
* },
*
* greet: function() {
* alert('Hello ' + this.name + '!');
* }
* });
* ```
*
* is equivalent to ES6:
*
* ```
* class Greeter {
* constructor(name) {
* this.name = name;
* }
*
* greet() {
* alert('Hello ' + this.name + '!');
* }
* }
* ```
*
* or equivalent to ES5:
*
* ```
* var Greeter = function (name) {
* this.name = name;
* }
*
* Greeter.prototype.greet = function () {
* alert('Hello ' + this.name + '!');
* }
* ```
*
* ### Example with parameter annotations
*
* ```
* var MyService = ng.Class({
* constructor: [String, [new Optional(), Service], function(name, myService) {
* ...
* }]
* });
* ```
*
* is equivalent to ES6:
*
* ```
* class MyService {
* constructor(name: string, \@Optional() myService: Service) {
* ...
* }
* }
* ```
*
* ### Example with inheritance
*
* ```
* var Shape = ng.Class({
* constructor: (color) {
* this.color = color;
* }
* });
*
* var Square = ng.Class({
* extends: Shape,
* constructor: function(color, size) {
* Shape.call(this, color);
* this.size = size;
* }
* });
* ```
* @suppress {globalThis}
* \@stable
* @param {?} clsDef
* @return {?}
*/
function Class(clsDef) {
const /** @type {?} */ constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
let /** @type {?} */ proto = constructor.prototype;
if (clsDef.hasOwnProperty('extends')) {
if (typeof clsDef.extends === 'function') {
((constructor)).prototype = proto =
Object.create(((clsDef.extends)).prototype);
}
else {
throw new Error(`Class definition 'extends' property must be a constructor function was: ${stringify(clsDef.extends)}`);
}
}
for (const /** @type {?} */ key in clsDef) {
if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) {
proto[key] = applyParams(clsDef[key], key);
}
}
if (this && this.annotations instanceof Array) {
Reflect.defineMetadata('annotations', this.annotations, constructor);
}
const /** @type {?} */ constructorName = constructor['name'];
if (!constructorName || constructorName === 'constructor') {
((constructor))['overriddenName'] = `class${_nextClassId++}`;
}
return (constructor);
}
/**
* @suppress {globalThis}
* @param {?} name
* @param {?} props
* @param {?=} parentClass
* @param {?=} chainFn
* @return {?}
*/
function makeDecorator(name, props, parentClass, chainFn = null) {
const /** @type {?} */ metaCtor = makeMetadataCtor([props]);
/**
* @param {?} objOrType
* @return {?}
*/
function DecoratorFactory(objOrType) {
if (!(Reflect && Reflect.getOwnMetadata)) {
throw 'reflect-metadata shim is required when using class decorators';
}
if (this instanceof DecoratorFactory) {
metaCtor.call(this, objOrType);
return this;
}
const /** @type {?} */ annotationInstance = new ((DecoratorFactory))(objOrType);
const /** @type {?} */ chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : [];
chainAnnotation.push(annotationInstance);
const /** @type {?} */ TypeDecorator = (function TypeDecorator(cls) {
const /** @type {?} */ annotations = Reflect.getOwnMetadata('annotations', cls) || [];
annotations.push(annotationInstance);
Reflect.defineMetadata('annotations', annotations, cls);
return cls;
});
TypeDecorator.annotations = chainAnnotation;
TypeDecorator.Class = Class;
if (chainFn)
chainFn(TypeDecorator);
return TypeDecorator;
}
if (parentClass) {
DecoratorFactory.prototype = Object.create(parentClass.prototype);
}
DecoratorFactory.prototype.toString = () => `@${name}`;
((DecoratorFactory)).annotationCls = DecoratorFactory;
return DecoratorFactory;
}
/**
* @param {?} props
* @return {?}
*/
function makeMetadataCtor(props) {
return function ctor(...args) {
props.forEach((prop, i) => {
const /** @type {?} */ argVal = args[i];
if (Array.isArray(prop)) {
// plain parameter
this[prop[0]] = argVal === undefined ? prop[1] : argVal;
}
else {
for (const /** @type {?} */ propName in prop) {
this[propName] =
argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName];
}
}
});
};
}
/**
* @param {?} name
* @param {?} props
* @param {?=} parentClass
* @return {?}
*/
function makeParamDecorator(name, props, parentClass) {
const /** @type {?} */ metaCtor = makeMetadataCtor(props);
/**
* @param {...?} args
* @return {?}
*/
function ParamDecoratorFactory(...args) {
if (this instanceof ParamDecoratorFactory) {
metaCtor.apply(this, args);
return this;
}
const /** @type {?} */ annotationInstance = new ((ParamDecoratorFactory))(...args);
((ParamDecorator)).annotation = annotationInstance;
return ParamDecorator;
/**
* @param {?} cls
* @param {?} unusedKey
* @param {?} index
* @return {?}
*/
function ParamDecorator(cls, unusedKey, index) {
const /** @type {?} */ parameters = Reflect.getOwnMetadata('parameters', cls) || [];
// there might be gaps if some in between parameters do not have annotations.
// we pad with nulls.
while (parameters.length <= index) {
parameters.push(null);
}
parameters[index] = parameters[index] || [];
parameters[index].push(annotationInstance);
Reflect.defineMetadata('parameters', parameters, cls);
return cls;
}
}
if (parentClass) {
ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
}
ParamDecoratorFactory.prototype.toString = () => `@${name}`;
((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
return ParamDecoratorFactory;
}
/**
* @param {?} name
* @param {?} props
* @param {?=} parentClass
* @return {?}
*/
function makePropDecorator(name, props, parentClass) {
const /** @type {?} */ metaCtor = makeMetadataCtor(props);
/**
* @param {...?} args
* @return {?}
*/
function PropDecoratorFactory(...args) {
if (this instanceof PropDecoratorFactory) {
metaCtor.apply(this, args);
return this;
}
const /** @type {?} */ decoratorInstance = new ((PropDecoratorFactory))(...args);
return function PropDecorator(target, name) {
const /** @type {?} */ meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {};
meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
meta[name].unshift(decoratorInstance);
Reflect.defineMetadata('propMetadata', meta, target.constructor);
};
}
if (parentClass) {
PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
}
PropDecoratorFactory.prototype.toString = () => `@${name}`;
((PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
return PropDecoratorFactory;
}
/**
* This token can be used to create a virtual provider that will populate the
* `entryComponents` fields of components and ng modules based on its `useValue`.
* All components that are referenced in the `useValue` value (either directly
* or in a nested array or map) will be added to the `entryComponents` property.
*
* ### Example
* The following example shows how the router can populate the `entryComponents`
* field of an NgModule based on the router configuration which refers
* to components.
*
* ```typescript
* // helper function inside the router
* function provideRoutes(routes) {
* return [
* {provide: ROUTES, useValue: routes},
* {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
* ];
* }
*
* // user code
* let routes = [
* {path: '/root', component: RootComp},
* {path: '/teams', component: TeamsComp}
* ];
*
* @NgModule({
* providers: [provideRoutes(routes)]
* })
* class ModuleWithRoutes {}
* ```
*
* @experimental
*/
const /** @type {?} */ ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
/**
* Attribute decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Attribute = makeParamDecorator('Attribute', [['attributeName', undefined]]);
/**
* Base class for query metadata.
*
* See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
* more information.
*
* \@stable
* @abstract
*/
class Query {
}
/**
* ContentChildren decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ ContentChildren = (makePropDecorator('ContentChildren', [
['selector', undefined], {
first: false,
isViewQuery: false,
descendants: false,
read: undefined,
}
], Query));
/**
* ContentChild decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ ContentChild = makePropDecorator('ContentChild', [
['selector', undefined], {
first: true,
isViewQuery: false,
descendants: true,
read: undefined,
}
], Query);
/**
* ViewChildren decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ ViewChildren = makePropDecorator('ViewChildren', [
['selector', undefined], {
first: false,
isViewQuery: true,
descendants: true,
read: undefined,
}
], Query);
/**
* ViewChild decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ ViewChild = makePropDecorator('ViewChild', [
['selector', undefined], {
first: true,
isViewQuery: true,
descendants: true,
read: undefined,
}
], Query);
let ChangeDetectionStrategy = {};
ChangeDetectionStrategy.OnPush = 0;
ChangeDetectionStrategy.Default = 1;
ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
let ChangeDetectorStatus = {};
ChangeDetectorStatus.CheckOnce = 0;
ChangeDetectorStatus.Checked = 1;
ChangeDetectorStatus.CheckAlways = 2;
ChangeDetectorStatus.Detached = 3;
ChangeDetectorStatus.Errored = 4;
ChangeDetectorStatus.Destroyed = 5;
ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
/**
* @param {?} changeDetectionStrategy
* @return {?}
*/
function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
return isBlank(changeDetectionStrategy) ||
changeDetectionStrategy === ChangeDetectionStrategy.Default;
}
/**
* Directive decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Directive = (makeDecorator('Directive', {
selector: undefined,
inputs: undefined,
outputs: undefined,
host: undefined,
providers: undefined,
exportAs: undefined,
queries: undefined
}));
/**
* Component decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Component = (makeDecorator('Component', {
selector: undefined,
inputs: undefined,
outputs: undefined,
host: undefined,
exportAs: undefined,
moduleId: undefined,
providers: undefined,
viewProviders: undefined,
changeDetection: ChangeDetectionStrategy.Default,
queries: undefined,
templateUrl: undefined,
template: undefined,
styleUrls: undefined,
styles: undefined,
animations: undefined,
encapsulation: undefined,
interpolation: undefined,
entryComponents: undefined
}, Directive));
/**
* Pipe decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Pipe = (makeDecorator('Pipe', {
name: undefined,
pure: true,
}));
/**
* Input decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Input = makePropDecorator('Input', [['bindingPropertyName', undefined]]);
/**
* Output decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Output = makePropDecorator('Output', [['bindingPropertyName', undefined]]);
/**
* HostBinding decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ HostBinding = makePropDecorator('HostBinding', [['hostPropertyName', undefined]]);
/**
* HostListener decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ HostListener = makePropDecorator('HostListener', [['eventName', undefined], ['args', []]]);
/**
* Defines a schema that will allow:
* - any non-Angular elements with a `-` in their name,
* - any properties on elements with a `-` in their name which is the common rule for custom
* elements.
*
* @stable
*/
const /** @type {?} */ CUSTOM_ELEMENTS_SCHEMA = {
name: 'custom-elements'
};
/**
* Defines a schema that will allow any property on any element.
*
* @experimental
*/
const /** @type {?} */ NO_ERRORS_SCHEMA = {
name: 'no-errors-schema'
};
/**
* NgModule decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ NgModule = (makeDecorator('NgModule', {
providers: undefined,
declarations: undefined,
imports: undefined,
exports: undefined,
entryComponents: undefined,
bootstrap: undefined,
schemas: undefined,
id: undefined,
}));
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
let ViewEncapsulation = {};
ViewEncapsulation.Emulated = 0;
ViewEncapsulation.Native = 1;
ViewEncapsulation.None = 2;
ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
ViewEncapsulation[ViewEncapsulation.Native] = "Native";
ViewEncapsulation[ViewEncapsulation.None] = "None";
/**
* Metadata properties available for configuring Views.
*
* For details on the `\@Component` annotation, see {\@link Component}.
*
* ### Example
*
* ```
* \@Component({
* selector: 'greet',
* template: 'Hello {{name}}!',
* })
* class Greet {
* name: string;
*
* constructor() {
* this.name = 'World';
* }
* }
* ```
*
* @deprecated Use Component instead.
*
* {\@link Component}
*/
class ViewMetadata {
/**
* @param {?=} __0
*/
constructor({ templateUrl, template, encapsulation, styles, styleUrls, animations, interpolation } = {}) {
this.templateUrl = templateUrl;
this.template = template;
this.styleUrls = styleUrls;
this.styles = styles;
this.encapsulation = encapsulation;
this.animations = animations;
this.interpolation = interpolation;
}
}
/**
* \@whatItDoes Represents the version of Angular
*
* \@stable
*/
class Version {
/**
* @param {?} full
*/
constructor(full) {
this.full = full;
}
/**
* @return {?}
*/
get major() { return this.full.split('.')[0]; }
/**
* @return {?}
*/
get minor() { return this.full.split('.')[1]; }
/**
* @return {?}
*/
get patch() { return this.full.split('.').slice(2).join('.'); }
}
/**
* @stable
*/
const /** @type {?} */ VERSION = new Version('4.0.0-rc.1-f32f4de');
/**
* Inject decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Inject = makeParamDecorator('Inject', [['token', undefined]]);
/**
* Optional decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Optional = makeParamDecorator('Optional', []);
/**
* Injectable decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Injectable = (makeDecorator('Injectable', []));
/**
* Self decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Self = makeParamDecorator('Self', []);
/**
* SkipSelf decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ SkipSelf = makeParamDecorator('SkipSelf', []);
/**
* Host decorator and metadata.
*
* @stable
* @Annotation
*/
const /** @type {?} */ Host = makeParamDecorator('Host', []);
/**
* Allows to refer to references which are not yet defined.
*
* For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
* DI is declared,
* but not yet defined. It is also used when the `token` which we use when creating a query is not
* yet defined.
*
* ### Example
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
* \@experimental
* @param {?} forwardRefFn
* @return {?}
*/
function forwardRef(forwardRefFn) {
((forwardRefFn)).__forward_ref__ = forwardRef;
((forwardRefFn)).toString = function () { return stringify(this()); };
return (((forwardRefFn)));
}
/**
* Lazily retrieves the reference value from a forwardRef.
*
* Acts as the identity function when given a non-forward-ref value.
*
* ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
*
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
*
* See: {\@link forwardRef}
* \@experimental
* @param {?} type
* @return {?}
*/
function resolveForwardRef(type) {
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
type.__forward_ref__ === forwardRef) {
return ((type))();
}
else {
return type;
}
}
const /** @type {?} */ _THROW_IF_NOT_FOUND = new Object();
const /** @type {?} */ THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
class _NullInjector {
/**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
get(token, notFoundValue = _THROW_IF_NOT_FOUND) {
if (notFoundValue === _THROW_IF_NOT_FOUND) {
throw new Error(`No provider for ${stringify(token)}!`);
}
return notFoundValue;
}
}
/**
* \@whatItDoes Injector interface
* \@howToUse
* ```
* const injector: Injector = ...;
* injector.get(...);
* ```
*
* \@description
* For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
*
* ### Example
*
* {\@example core/di/ts/injector_spec.ts region='Injector'}
*
* `Injector` returns itself when given `Injector` as a token:
* {\@example core/di/ts/injector_spec.ts region='injectInjector'}
*
* \@stable
* @abstract
*/
class Injector {
/**
* Retrieves an instance from the injector based on the provided token.
* If not found:
* - Throws {\@link NoProviderError} if no `notFoundValue` that is not equal to
* Injector.THROW_IF_NOT_FOUND is given
* - Returns the `notFoundValue` otherwise
* @abstract
* @param {?} token
* @param {?=} notFoundValue