@angular/core 15.0.0-next.3 → 15.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/core_private_export.mjs +2 -2
- package/esm2020/src/di/index.mjs +1 -1
- package/esm2020/src/di/injectable.mjs +1 -1
- package/esm2020/src/di/injection_token.mjs +6 -3
- package/esm2020/src/di/injector.mjs +1 -1
- package/esm2020/src/di/injector_compatibility.mjs +15 -11
- package/esm2020/src/di/interface/injector.mjs +1 -1
- package/esm2020/src/di/r3_injector.mjs +3 -2
- package/esm2020/src/errors.mjs +1 -1
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/render3/component_ref.mjs +113 -84
- package/esm2020/src/render3/context_discovery.mjs +7 -7
- package/esm2020/src/render3/di.mjs +3 -2
- package/esm2020/src/render3/features/host_directives_feature.mjs +101 -10
- package/esm2020/src/render3/features/ng_onchanges_feature.mjs +4 -2
- package/esm2020/src/render3/instructions/element.mjs +3 -15
- package/esm2020/src/render3/instructions/shared.mjs +151 -128
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/jit/module.mjs +2 -2
- package/esm2020/src/render3/ng_module_ref.mjs +1 -1
- package/esm2020/src/render3/node_manipulation.mjs +15 -1
- package/esm2020/src/render3/util/discovery_utils.mjs +2 -2
- package/esm2020/src/util/is_dev_mode.mjs +11 -19
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/src/zone/async-stack-tagging.mjs +28 -0
- package/esm2020/src/zone/ng_zone.mjs +8 -3
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/esm2020/testing/src/test_bed.mjs +4 -4
- package/fesm2015/core.mjs +1789 -1613
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +1055 -904
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +1788 -1614
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +1052 -902
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +105 -24
- package/package.json +1 -1
- package/testing/index.d.ts +9 -1
package/fesm2020/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.0.0-next.
|
|
2
|
+
* @license Angular v15.0.0-next.5
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -582,152 +582,6 @@ function assertInjectImplementationNotEqual(fn) {
|
|
|
582
582
|
assertNotEqual(_injectImplementation, fn, 'Calling ɵɵinject would cause infinite recursion');
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
/**
|
|
586
|
-
* @license
|
|
587
|
-
* Copyright Google LLC All Rights Reserved.
|
|
588
|
-
*
|
|
589
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
590
|
-
* found in the LICENSE file at https://angular.io/license
|
|
591
|
-
*/
|
|
592
|
-
/**
|
|
593
|
-
* Convince closure compiler that the wrapped function has no side-effects.
|
|
594
|
-
*
|
|
595
|
-
* Closure compiler always assumes that `toString` has no side-effects. We use this quirk to
|
|
596
|
-
* allow us to execute a function but have closure compiler mark the call as no-side-effects.
|
|
597
|
-
* It is important that the return value for the `noSideEffects` function be assigned
|
|
598
|
-
* to something which is retained otherwise the call to `noSideEffects` will be removed by closure
|
|
599
|
-
* compiler.
|
|
600
|
-
*/
|
|
601
|
-
function noSideEffects(fn) {
|
|
602
|
-
return { toString: fn }.toString();
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* @license
|
|
607
|
-
* Copyright Google LLC All Rights Reserved.
|
|
608
|
-
*
|
|
609
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
610
|
-
* found in the LICENSE file at https://angular.io/license
|
|
611
|
-
*/
|
|
612
|
-
/**
|
|
613
|
-
* The strategy that the default change detector uses to detect changes.
|
|
614
|
-
* When set, takes effect the next time change detection is triggered.
|
|
615
|
-
*
|
|
616
|
-
* @see {@link ChangeDetectorRef#usage-notes Change detection usage}
|
|
617
|
-
*
|
|
618
|
-
* @publicApi
|
|
619
|
-
*/
|
|
620
|
-
var ChangeDetectionStrategy;
|
|
621
|
-
(function (ChangeDetectionStrategy) {
|
|
622
|
-
/**
|
|
623
|
-
* Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated
|
|
624
|
-
* until reactivated by setting the strategy to `Default` (`CheckAlways`).
|
|
625
|
-
* Change detection can still be explicitly invoked.
|
|
626
|
-
* This strategy applies to all child directives and cannot be overridden.
|
|
627
|
-
*/
|
|
628
|
-
ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
|
|
629
|
-
/**
|
|
630
|
-
* Use the default `CheckAlways` strategy, in which change detection is automatic until
|
|
631
|
-
* explicitly deactivated.
|
|
632
|
-
*/
|
|
633
|
-
ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
|
|
634
|
-
})(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
|
|
635
|
-
/**
|
|
636
|
-
* Defines the possible states of the default change detector.
|
|
637
|
-
* @see `ChangeDetectorRef`
|
|
638
|
-
*/
|
|
639
|
-
var ChangeDetectorStatus;
|
|
640
|
-
(function (ChangeDetectorStatus) {
|
|
641
|
-
/**
|
|
642
|
-
* A state in which, after calling `detectChanges()`, the change detector
|
|
643
|
-
* state becomes `Checked`, and must be explicitly invoked or reactivated.
|
|
644
|
-
*/
|
|
645
|
-
ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
|
|
646
|
-
/**
|
|
647
|
-
* A state in which change detection is skipped until the change detector mode
|
|
648
|
-
* becomes `CheckOnce`.
|
|
649
|
-
*/
|
|
650
|
-
ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
|
|
651
|
-
/**
|
|
652
|
-
* A state in which change detection continues automatically until explicitly
|
|
653
|
-
* deactivated.
|
|
654
|
-
*/
|
|
655
|
-
ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
|
|
656
|
-
/**
|
|
657
|
-
* A state in which a change detector sub tree is not a part of the main tree and
|
|
658
|
-
* should be skipped.
|
|
659
|
-
*/
|
|
660
|
-
ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
|
|
661
|
-
/**
|
|
662
|
-
* Indicates that the change detector encountered an error checking a binding
|
|
663
|
-
* or calling a directive lifecycle method and is now in an inconsistent state. Change
|
|
664
|
-
* detectors in this state do not detect changes.
|
|
665
|
-
*/
|
|
666
|
-
ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
|
|
667
|
-
/**
|
|
668
|
-
* Indicates that the change detector has been destroyed.
|
|
669
|
-
*/
|
|
670
|
-
ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
|
|
671
|
-
})(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
|
|
672
|
-
/**
|
|
673
|
-
* Reports whether a given strategy is currently the default for change detection.
|
|
674
|
-
* @param changeDetectionStrategy The strategy to check.
|
|
675
|
-
* @returns True if the given strategy is the current default, false otherwise.
|
|
676
|
-
* @see `ChangeDetectorStatus`
|
|
677
|
-
* @see `ChangeDetectorRef`
|
|
678
|
-
*/
|
|
679
|
-
function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
|
680
|
-
return changeDetectionStrategy == null ||
|
|
681
|
-
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* @license
|
|
686
|
-
* Copyright Google LLC All Rights Reserved.
|
|
687
|
-
*
|
|
688
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
689
|
-
* found in the LICENSE file at https://angular.io/license
|
|
690
|
-
*/
|
|
691
|
-
/**
|
|
692
|
-
* Defines the CSS styles encapsulation policies for the {@link Component} decorator's
|
|
693
|
-
* `encapsulation` option.
|
|
694
|
-
*
|
|
695
|
-
* See {@link Component#encapsulation encapsulation}.
|
|
696
|
-
*
|
|
697
|
-
* @usageNotes
|
|
698
|
-
* ### Example
|
|
699
|
-
*
|
|
700
|
-
* {@example core/ts/metadata/encapsulation.ts region='longform'}
|
|
701
|
-
*
|
|
702
|
-
* @publicApi
|
|
703
|
-
*/
|
|
704
|
-
var ViewEncapsulation$1;
|
|
705
|
-
(function (ViewEncapsulation) {
|
|
706
|
-
// TODO: consider making `ViewEncapsulation` a `const enum` instead. See
|
|
707
|
-
// https://github.com/angular/angular/issues/44119 for additional information.
|
|
708
|
-
/**
|
|
709
|
-
* Emulates a native Shadow DOM encapsulation behavior by adding a specific attribute to the
|
|
710
|
-
* component's host element and applying the same attribute to all the CSS selectors provided
|
|
711
|
-
* via {@link Component#styles styles} or {@link Component#styleUrls styleUrls}.
|
|
712
|
-
*
|
|
713
|
-
* This is the default option.
|
|
714
|
-
*/
|
|
715
|
-
ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
|
|
716
|
-
// Historically the 1 value was for `Native` encapsulation which has been removed as of v11.
|
|
717
|
-
/**
|
|
718
|
-
* Doesn't provide any sort of CSS style encapsulation, meaning that all the styles provided
|
|
719
|
-
* via {@link Component#styles styles} or {@link Component#styleUrls styleUrls} are applicable
|
|
720
|
-
* to any HTML element of the application regardless of their host Component.
|
|
721
|
-
*/
|
|
722
|
-
ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
|
|
723
|
-
/**
|
|
724
|
-
* Uses the browser's native Shadow DOM API to encapsulate CSS styles, meaning that it creates
|
|
725
|
-
* a ShadowRoot for the component's host element which is then used to encapsulate
|
|
726
|
-
* all the Component's styling.
|
|
727
|
-
*/
|
|
728
|
-
ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
|
|
729
|
-
})(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
|
|
730
|
-
|
|
731
585
|
/**
|
|
732
586
|
* @license
|
|
733
587
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -826,61 +680,437 @@ function initNgDevMode() {
|
|
|
826
680
|
* Use of this source code is governed by an MIT-style license that can be
|
|
827
681
|
* found in the LICENSE file at https://angular.io/license
|
|
828
682
|
*/
|
|
683
|
+
const _THROW_IF_NOT_FOUND = {};
|
|
684
|
+
const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
|
685
|
+
/*
|
|
686
|
+
* Name of a property (that we patch onto DI decorator), which is used as an annotation of which
|
|
687
|
+
* InjectFlag this decorator represents. This allows to avoid direct references to the DI decorators
|
|
688
|
+
* in the code, thus making them tree-shakable.
|
|
689
|
+
*/
|
|
690
|
+
const DI_DECORATOR_FLAG = '__NG_DI_FLAG__';
|
|
691
|
+
const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
|
|
692
|
+
const NG_TOKEN_PATH = 'ngTokenPath';
|
|
693
|
+
const NEW_LINE = /\n/gm;
|
|
694
|
+
const NO_NEW_LINE = 'ɵ';
|
|
695
|
+
const SOURCE = '__source';
|
|
829
696
|
/**
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
*
|
|
697
|
+
* Current injector value used by `inject`.
|
|
698
|
+
* - `undefined`: it is an error to call `inject`
|
|
699
|
+
* - `null`: `inject` can be called but there is no injector (limp-mode).
|
|
700
|
+
* - Injector instance: Use the injector for resolution.
|
|
834
701
|
*/
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
702
|
+
let _currentInjector = undefined;
|
|
703
|
+
function setCurrentInjector(injector) {
|
|
704
|
+
const former = _currentInjector;
|
|
705
|
+
_currentInjector = injector;
|
|
706
|
+
return former;
|
|
707
|
+
}
|
|
708
|
+
function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
|
709
|
+
if (_currentInjector === undefined) {
|
|
710
|
+
throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
|
|
711
|
+
`inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`EnvironmentInjector#runInContext\`.`);
|
|
712
|
+
}
|
|
713
|
+
else if (_currentInjector === null) {
|
|
714
|
+
return injectRootLimpMode(token, undefined, flags);
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
return _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
function ɵɵinject(token, flags = InjectFlags.Default) {
|
|
721
|
+
return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
|
|
845
722
|
}
|
|
846
|
-
|
|
847
723
|
/**
|
|
848
|
-
*
|
|
849
|
-
*
|
|
724
|
+
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
725
|
+
* particular class.
|
|
850
726
|
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
const NG_DIR_DEF = getClosureSafeProperty({ ɵdir: getClosureSafeProperty });
|
|
856
|
-
const NG_PIPE_DEF = getClosureSafeProperty({ ɵpipe: getClosureSafeProperty });
|
|
857
|
-
const NG_MOD_DEF = getClosureSafeProperty({ ɵmod: getClosureSafeProperty });
|
|
858
|
-
const NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty });
|
|
859
|
-
/**
|
|
860
|
-
* If a directive is diPublic, bloomAdd sets a property on the type with this constant as
|
|
861
|
-
* the key and the directive's unique ID as the value. This allows us to map directives to their
|
|
862
|
-
* bloom filter bit for DI.
|
|
727
|
+
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
728
|
+
* and thus in the stack trace.
|
|
729
|
+
*
|
|
730
|
+
* @codeGenApi
|
|
863
731
|
*/
|
|
864
|
-
|
|
865
|
-
|
|
732
|
+
function ɵɵinvalidFactoryDep(index) {
|
|
733
|
+
throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
|
|
734
|
+
`This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
|
|
735
|
+
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
|
|
866
736
|
|
|
737
|
+
Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
|
|
738
|
+
}
|
|
867
739
|
/**
|
|
868
|
-
*
|
|
869
|
-
*
|
|
740
|
+
* Injects a token from the currently active injector.
|
|
741
|
+
* `inject` is only supported during instantiation of a dependency by the DI system. It can be used
|
|
742
|
+
* during:
|
|
743
|
+
* - Construction (via the `constructor`) of a class being instantiated by the DI system, such
|
|
744
|
+
* as an `@Injectable` or `@Component`.
|
|
745
|
+
* - In the initializer for fields of such classes.
|
|
746
|
+
* - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.
|
|
747
|
+
* - In the `factory` function specified for an `InjectionToken`.
|
|
870
748
|
*
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
* Create a component definition object.
|
|
749
|
+
* @param token A token that represents a dependency that should be injected.
|
|
750
|
+
* @param flags Optional flags that control how injection is executed.
|
|
751
|
+
* The flags correspond to injection strategies that can be specified with
|
|
752
|
+
* parameter decorators `@Host`, `@Self`, `@SkipSef`, and `@Optional`.
|
|
753
|
+
* @returns the injected value if operation is successful, `null` otherwise.
|
|
754
|
+
* @throws if called outside of a supported context.
|
|
878
755
|
*
|
|
756
|
+
* @usageNotes
|
|
757
|
+
* In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a
|
|
758
|
+
* field initializer:
|
|
879
759
|
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
882
|
-
* class
|
|
883
|
-
*
|
|
760
|
+
* ```typescript
|
|
761
|
+
* @Injectable({providedIn: 'root'})
|
|
762
|
+
* export class Car {
|
|
763
|
+
* radio: Radio|undefined;
|
|
764
|
+
* // OK: field initializer
|
|
765
|
+
* spareTyre = inject(Tyre);
|
|
766
|
+
*
|
|
767
|
+
* constructor() {
|
|
768
|
+
* // OK: constructor body
|
|
769
|
+
* this.radio = inject(Radio);
|
|
770
|
+
* }
|
|
771
|
+
* }
|
|
772
|
+
* ```
|
|
773
|
+
*
|
|
774
|
+
* It is also legal to call `inject` from a provider's factory:
|
|
775
|
+
*
|
|
776
|
+
* ```typescript
|
|
777
|
+
* providers: [
|
|
778
|
+
* {provide: Car, useFactory: () => {
|
|
779
|
+
* // OK: a class factory
|
|
780
|
+
* const engine = inject(Engine);
|
|
781
|
+
* return new Car(engine);
|
|
782
|
+
* }}
|
|
783
|
+
* ]
|
|
784
|
+
* ```
|
|
785
|
+
*
|
|
786
|
+
* Calls to the `inject()` function outside of the class creation context will result in error. Most
|
|
787
|
+
* notably, calls to `inject()` are disallowed after a class instance was created, in methods
|
|
788
|
+
* (including lifecycle hooks):
|
|
789
|
+
*
|
|
790
|
+
* ```typescript
|
|
791
|
+
* @Component({ ... })
|
|
792
|
+
* export class CarComponent {
|
|
793
|
+
* ngOnInit() {
|
|
794
|
+
* // ERROR: too late, the component instance was already created
|
|
795
|
+
* const engine = inject(Engine);
|
|
796
|
+
* engine.start();
|
|
797
|
+
* }
|
|
798
|
+
* }
|
|
799
|
+
* ```
|
|
800
|
+
*
|
|
801
|
+
* @publicApi
|
|
802
|
+
*/
|
|
803
|
+
function inject(token, flags = InjectFlags.Default) {
|
|
804
|
+
return ɵɵinject(token, convertToBitFlags(flags));
|
|
805
|
+
}
|
|
806
|
+
// Converts object-based DI flags (`InjectOptions`) to bit flags (`InjectFlags`).
|
|
807
|
+
function convertToBitFlags(flags) {
|
|
808
|
+
if (typeof flags === 'undefined' || typeof flags === 'number') {
|
|
809
|
+
return flags;
|
|
810
|
+
}
|
|
811
|
+
// While TypeScript doesn't accept it without a cast, bitwise OR with false-y values in
|
|
812
|
+
// JavaScript is a no-op. We can use that for a very codesize-efficient conversion from
|
|
813
|
+
// `InjectOptions` to `InjectFlags`.
|
|
814
|
+
return (0 /* InternalInjectFlags.Default */ | // comment to force a line break in the formatter
|
|
815
|
+
(flags.optional && 8 /* InternalInjectFlags.Optional */) |
|
|
816
|
+
(flags.host && 1 /* InternalInjectFlags.Host */) |
|
|
817
|
+
(flags.self && 2 /* InternalInjectFlags.Self */) |
|
|
818
|
+
(flags.skipSelf && 4 /* InternalInjectFlags.SkipSelf */));
|
|
819
|
+
}
|
|
820
|
+
function injectArgs(types) {
|
|
821
|
+
const args = [];
|
|
822
|
+
for (let i = 0; i < types.length; i++) {
|
|
823
|
+
const arg = resolveForwardRef(types[i]);
|
|
824
|
+
if (Array.isArray(arg)) {
|
|
825
|
+
if (arg.length === 0) {
|
|
826
|
+
throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
|
|
827
|
+
}
|
|
828
|
+
let type = undefined;
|
|
829
|
+
let flags = InjectFlags.Default;
|
|
830
|
+
for (let j = 0; j < arg.length; j++) {
|
|
831
|
+
const meta = arg[j];
|
|
832
|
+
const flag = getInjectFlag(meta);
|
|
833
|
+
if (typeof flag === 'number') {
|
|
834
|
+
// Special case when we handle @Inject decorator.
|
|
835
|
+
if (flag === -1 /* DecoratorFlags.Inject */) {
|
|
836
|
+
type = meta.token;
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
flags |= flag;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
type = meta;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
args.push(ɵɵinject(type, flags));
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
args.push(ɵɵinject(arg));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return args;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Attaches a given InjectFlag to a given decorator using monkey-patching.
|
|
856
|
+
* Since DI decorators can be used in providers `deps` array (when provider is configured using
|
|
857
|
+
* `useFactory`) without initialization (e.g. `Host`) and as an instance (e.g. `new Host()`), we
|
|
858
|
+
* attach the flag to make it available both as a static property and as a field on decorator
|
|
859
|
+
* instance.
|
|
860
|
+
*
|
|
861
|
+
* @param decorator Provided DI decorator.
|
|
862
|
+
* @param flag InjectFlag that should be applied.
|
|
863
|
+
*/
|
|
864
|
+
function attachInjectFlag(decorator, flag) {
|
|
865
|
+
decorator[DI_DECORATOR_FLAG] = flag;
|
|
866
|
+
decorator.prototype[DI_DECORATOR_FLAG] = flag;
|
|
867
|
+
return decorator;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Reads monkey-patched property that contains InjectFlag attached to a decorator.
|
|
871
|
+
*
|
|
872
|
+
* @param token Token that may contain monkey-patched DI flags property.
|
|
873
|
+
*/
|
|
874
|
+
function getInjectFlag(token) {
|
|
875
|
+
return token[DI_DECORATOR_FLAG];
|
|
876
|
+
}
|
|
877
|
+
function catchInjectorError(e, token, injectorErrorName, source) {
|
|
878
|
+
const tokenPath = e[NG_TEMP_TOKEN_PATH];
|
|
879
|
+
if (token[SOURCE]) {
|
|
880
|
+
tokenPath.unshift(token[SOURCE]);
|
|
881
|
+
}
|
|
882
|
+
e.message = formatError('\n' + e.message, tokenPath, injectorErrorName, source);
|
|
883
|
+
e[NG_TOKEN_PATH] = tokenPath;
|
|
884
|
+
e[NG_TEMP_TOKEN_PATH] = null;
|
|
885
|
+
throw e;
|
|
886
|
+
}
|
|
887
|
+
function formatError(text, obj, injectorErrorName, source = null) {
|
|
888
|
+
text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;
|
|
889
|
+
let context = stringify(obj);
|
|
890
|
+
if (Array.isArray(obj)) {
|
|
891
|
+
context = obj.map(stringify).join(' -> ');
|
|
892
|
+
}
|
|
893
|
+
else if (typeof obj === 'object') {
|
|
894
|
+
let parts = [];
|
|
895
|
+
for (let key in obj) {
|
|
896
|
+
if (obj.hasOwnProperty(key)) {
|
|
897
|
+
let value = obj[key];
|
|
898
|
+
parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
context = `{${parts.join(', ')}}`;
|
|
902
|
+
}
|
|
903
|
+
return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\n ')}`;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* @license
|
|
908
|
+
* Copyright Google LLC All Rights Reserved.
|
|
909
|
+
*
|
|
910
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
911
|
+
* found in the LICENSE file at https://angular.io/license
|
|
912
|
+
*/
|
|
913
|
+
/**
|
|
914
|
+
* Convince closure compiler that the wrapped function has no side-effects.
|
|
915
|
+
*
|
|
916
|
+
* Closure compiler always assumes that `toString` has no side-effects. We use this quirk to
|
|
917
|
+
* allow us to execute a function but have closure compiler mark the call as no-side-effects.
|
|
918
|
+
* It is important that the return value for the `noSideEffects` function be assigned
|
|
919
|
+
* to something which is retained otherwise the call to `noSideEffects` will be removed by closure
|
|
920
|
+
* compiler.
|
|
921
|
+
*/
|
|
922
|
+
function noSideEffects(fn) {
|
|
923
|
+
return { toString: fn }.toString();
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* @license
|
|
928
|
+
* Copyright Google LLC All Rights Reserved.
|
|
929
|
+
*
|
|
930
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
931
|
+
* found in the LICENSE file at https://angular.io/license
|
|
932
|
+
*/
|
|
933
|
+
/**
|
|
934
|
+
* The strategy that the default change detector uses to detect changes.
|
|
935
|
+
* When set, takes effect the next time change detection is triggered.
|
|
936
|
+
*
|
|
937
|
+
* @see {@link ChangeDetectorRef#usage-notes Change detection usage}
|
|
938
|
+
*
|
|
939
|
+
* @publicApi
|
|
940
|
+
*/
|
|
941
|
+
var ChangeDetectionStrategy;
|
|
942
|
+
(function (ChangeDetectionStrategy) {
|
|
943
|
+
/**
|
|
944
|
+
* Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated
|
|
945
|
+
* until reactivated by setting the strategy to `Default` (`CheckAlways`).
|
|
946
|
+
* Change detection can still be explicitly invoked.
|
|
947
|
+
* This strategy applies to all child directives and cannot be overridden.
|
|
948
|
+
*/
|
|
949
|
+
ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
|
|
950
|
+
/**
|
|
951
|
+
* Use the default `CheckAlways` strategy, in which change detection is automatic until
|
|
952
|
+
* explicitly deactivated.
|
|
953
|
+
*/
|
|
954
|
+
ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
|
|
955
|
+
})(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
|
|
956
|
+
/**
|
|
957
|
+
* Defines the possible states of the default change detector.
|
|
958
|
+
* @see `ChangeDetectorRef`
|
|
959
|
+
*/
|
|
960
|
+
var ChangeDetectorStatus;
|
|
961
|
+
(function (ChangeDetectorStatus) {
|
|
962
|
+
/**
|
|
963
|
+
* A state in which, after calling `detectChanges()`, the change detector
|
|
964
|
+
* state becomes `Checked`, and must be explicitly invoked or reactivated.
|
|
965
|
+
*/
|
|
966
|
+
ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
|
|
967
|
+
/**
|
|
968
|
+
* A state in which change detection is skipped until the change detector mode
|
|
969
|
+
* becomes `CheckOnce`.
|
|
970
|
+
*/
|
|
971
|
+
ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
|
|
972
|
+
/**
|
|
973
|
+
* A state in which change detection continues automatically until explicitly
|
|
974
|
+
* deactivated.
|
|
975
|
+
*/
|
|
976
|
+
ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
|
|
977
|
+
/**
|
|
978
|
+
* A state in which a change detector sub tree is not a part of the main tree and
|
|
979
|
+
* should be skipped.
|
|
980
|
+
*/
|
|
981
|
+
ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
|
|
982
|
+
/**
|
|
983
|
+
* Indicates that the change detector encountered an error checking a binding
|
|
984
|
+
* or calling a directive lifecycle method and is now in an inconsistent state. Change
|
|
985
|
+
* detectors in this state do not detect changes.
|
|
986
|
+
*/
|
|
987
|
+
ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
|
|
988
|
+
/**
|
|
989
|
+
* Indicates that the change detector has been destroyed.
|
|
990
|
+
*/
|
|
991
|
+
ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
|
|
992
|
+
})(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
|
|
993
|
+
/**
|
|
994
|
+
* Reports whether a given strategy is currently the default for change detection.
|
|
995
|
+
* @param changeDetectionStrategy The strategy to check.
|
|
996
|
+
* @returns True if the given strategy is the current default, false otherwise.
|
|
997
|
+
* @see `ChangeDetectorStatus`
|
|
998
|
+
* @see `ChangeDetectorRef`
|
|
999
|
+
*/
|
|
1000
|
+
function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
|
1001
|
+
return changeDetectionStrategy == null ||
|
|
1002
|
+
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* @license
|
|
1007
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1008
|
+
*
|
|
1009
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1010
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1011
|
+
*/
|
|
1012
|
+
/**
|
|
1013
|
+
* Defines the CSS styles encapsulation policies for the {@link Component} decorator's
|
|
1014
|
+
* `encapsulation` option.
|
|
1015
|
+
*
|
|
1016
|
+
* See {@link Component#encapsulation encapsulation}.
|
|
1017
|
+
*
|
|
1018
|
+
* @usageNotes
|
|
1019
|
+
* ### Example
|
|
1020
|
+
*
|
|
1021
|
+
* {@example core/ts/metadata/encapsulation.ts region='longform'}
|
|
1022
|
+
*
|
|
1023
|
+
* @publicApi
|
|
1024
|
+
*/
|
|
1025
|
+
var ViewEncapsulation$1;
|
|
1026
|
+
(function (ViewEncapsulation) {
|
|
1027
|
+
// TODO: consider making `ViewEncapsulation` a `const enum` instead. See
|
|
1028
|
+
// https://github.com/angular/angular/issues/44119 for additional information.
|
|
1029
|
+
/**
|
|
1030
|
+
* Emulates a native Shadow DOM encapsulation behavior by adding a specific attribute to the
|
|
1031
|
+
* component's host element and applying the same attribute to all the CSS selectors provided
|
|
1032
|
+
* via {@link Component#styles styles} or {@link Component#styleUrls styleUrls}.
|
|
1033
|
+
*
|
|
1034
|
+
* This is the default option.
|
|
1035
|
+
*/
|
|
1036
|
+
ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
|
|
1037
|
+
// Historically the 1 value was for `Native` encapsulation which has been removed as of v11.
|
|
1038
|
+
/**
|
|
1039
|
+
* Doesn't provide any sort of CSS style encapsulation, meaning that all the styles provided
|
|
1040
|
+
* via {@link Component#styles styles} or {@link Component#styleUrls styleUrls} are applicable
|
|
1041
|
+
* to any HTML element of the application regardless of their host Component.
|
|
1042
|
+
*/
|
|
1043
|
+
ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
|
|
1044
|
+
/**
|
|
1045
|
+
* Uses the browser's native Shadow DOM API to encapsulate CSS styles, meaning that it creates
|
|
1046
|
+
* a ShadowRoot for the component's host element which is then used to encapsulate
|
|
1047
|
+
* all the Component's styling.
|
|
1048
|
+
*/
|
|
1049
|
+
ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
|
|
1050
|
+
})(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* @license
|
|
1054
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1055
|
+
*
|
|
1056
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1057
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1058
|
+
*/
|
|
1059
|
+
/**
|
|
1060
|
+
* This file contains reuseable "empty" symbols that can be used as default return values
|
|
1061
|
+
* in different parts of the rendering code. Because the same symbols are returned, this
|
|
1062
|
+
* allows for identity checks against these values to be consistently used by the framework
|
|
1063
|
+
* code.
|
|
1064
|
+
*/
|
|
1065
|
+
const EMPTY_OBJ = {};
|
|
1066
|
+
const EMPTY_ARRAY = [];
|
|
1067
|
+
// freezing the values prevents any code from accidentally inserting new values in
|
|
1068
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
|
|
1069
|
+
// These property accesses can be ignored because ngDevMode will be set to false
|
|
1070
|
+
// when optimizing code and the whole if statement will be dropped.
|
|
1071
|
+
// tslint:disable-next-line:no-toplevel-property-access
|
|
1072
|
+
Object.freeze(EMPTY_OBJ);
|
|
1073
|
+
// tslint:disable-next-line:no-toplevel-property-access
|
|
1074
|
+
Object.freeze(EMPTY_ARRAY);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* @license
|
|
1079
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1080
|
+
*
|
|
1081
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1082
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1083
|
+
*/
|
|
1084
|
+
const NG_COMP_DEF = getClosureSafeProperty({ ɵcmp: getClosureSafeProperty });
|
|
1085
|
+
const NG_DIR_DEF = getClosureSafeProperty({ ɵdir: getClosureSafeProperty });
|
|
1086
|
+
const NG_PIPE_DEF = getClosureSafeProperty({ ɵpipe: getClosureSafeProperty });
|
|
1087
|
+
const NG_MOD_DEF = getClosureSafeProperty({ ɵmod: getClosureSafeProperty });
|
|
1088
|
+
const NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty });
|
|
1089
|
+
/**
|
|
1090
|
+
* If a directive is diPublic, bloomAdd sets a property on the type with this constant as
|
|
1091
|
+
* the key and the directive's unique ID as the value. This allows us to map directives to their
|
|
1092
|
+
* bloom filter bit for DI.
|
|
1093
|
+
*/
|
|
1094
|
+
// TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.
|
|
1095
|
+
const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* @license
|
|
1099
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1100
|
+
*
|
|
1101
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1102
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1103
|
+
*/
|
|
1104
|
+
/** Counter used to generate unique IDs for component definitions. */
|
|
1105
|
+
let componentDefCount = 0;
|
|
1106
|
+
/**
|
|
1107
|
+
* Create a component definition object.
|
|
1108
|
+
*
|
|
1109
|
+
*
|
|
1110
|
+
* # Example
|
|
1111
|
+
* ```
|
|
1112
|
+
* class MyDirective {
|
|
1113
|
+
* // Generated by Angular Template Compiler
|
|
884
1114
|
* // [Symbol] syntax will not be supported by TypeScript until v2.7
|
|
885
1115
|
* static ɵcmp = defineComponent({
|
|
886
1116
|
* ...
|
|
@@ -1529,11 +1759,12 @@ function rememberChangeHistoryAndInvokeOnChangesHook() {
|
|
|
1529
1759
|
}
|
|
1530
1760
|
}
|
|
1531
1761
|
function ngOnChangesSetInput(instance, value, publicName, privateName) {
|
|
1762
|
+
const declaredName = this.declaredInputs[publicName];
|
|
1763
|
+
ngDevMode && assertString(declaredName, 'Name of input in ngOnChanges has to be a string');
|
|
1532
1764
|
const simpleChangesStore = getSimpleChangesStore(instance) ||
|
|
1533
1765
|
setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null });
|
|
1534
1766
|
const current = simpleChangesStore.current || (simpleChangesStore.current = {});
|
|
1535
1767
|
const previous = simpleChangesStore.previous;
|
|
1536
|
-
const declaredName = this.declaredInputs[publicName];
|
|
1537
1768
|
const previousChange = previous[declaredName];
|
|
1538
1769
|
current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);
|
|
1539
1770
|
instance[privateName] = value;
|
|
@@ -3602,7 +3833,7 @@ class NodeInjector {
|
|
|
3602
3833
|
this._lView = _lView;
|
|
3603
3834
|
}
|
|
3604
3835
|
get(token, notFoundValue, flags) {
|
|
3605
|
-
return getOrCreateInjectable(this._tNode, this._lView, token, flags, notFoundValue);
|
|
3836
|
+
return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);
|
|
3606
3837
|
}
|
|
3607
3838
|
}
|
|
3608
3839
|
/** Creates a `NodeInjector` for the current node. */
|
|
@@ -3897,8 +4128,11 @@ const Attribute = makeParamDecorator('Attribute', (attributeName) => ({ attribut
|
|
|
3897
4128
|
* As you can see in the Tree-shakable InjectionToken example below.
|
|
3898
4129
|
*
|
|
3899
4130
|
* Additionally, if a `factory` is specified you can also specify the `providedIn` option, which
|
|
3900
|
-
* overrides the above behavior and marks the token as belonging to a particular `@NgModule
|
|
3901
|
-
* mentioned above, `'root'` is the default value for
|
|
4131
|
+
* overrides the above behavior and marks the token as belonging to a particular `@NgModule` (note:
|
|
4132
|
+
* this option is now deprecated). As mentioned above, `'root'` is the default value for
|
|
4133
|
+
* `providedIn`.
|
|
4134
|
+
*
|
|
4135
|
+
* The `providedIn: NgModule` and `providedIn: 'any'` options are deprecated.
|
|
3902
4136
|
*
|
|
3903
4137
|
* @usageNotes
|
|
3904
4138
|
* ### Basic Examples
|
|
@@ -4664,306 +4898,80 @@ class ReflectionCapabilities {
|
|
|
4664
4898
|
// Prefer the direct API.
|
|
4665
4899
|
if (typeOrFunc.propMetadata &&
|
|
4666
4900
|
typeOrFunc.propMetadata !== parentCtor.propMetadata) {
|
|
4667
|
-
let propMetadata = typeOrFunc.propMetadata;
|
|
4668
|
-
if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
|
4669
|
-
propMetadata = propMetadata.propMetadata;
|
|
4670
|
-
}
|
|
4671
|
-
return propMetadata;
|
|
4672
|
-
}
|
|
4673
|
-
// API of tsickle for lowering decorators to properties on the class.
|
|
4674
|
-
if (typeOrFunc.propDecorators &&
|
|
4675
|
-
typeOrFunc.propDecorators !== parentCtor.propDecorators) {
|
|
4676
|
-
const propDecorators = typeOrFunc.propDecorators;
|
|
4677
|
-
const propMetadata = {};
|
|
4678
|
-
Object.keys(propDecorators).forEach(prop => {
|
|
4679
|
-
propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
|
4680
|
-
});
|
|
4681
|
-
return propMetadata;
|
|
4682
|
-
}
|
|
4683
|
-
// API for metadata created by invoking the decorators.
|
|
4684
|
-
if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
|
|
4685
|
-
return typeOrFunc[PROP_METADATA];
|
|
4686
|
-
}
|
|
4687
|
-
return null;
|
|
4688
|
-
}
|
|
4689
|
-
propMetadata(typeOrFunc) {
|
|
4690
|
-
if (!isType(typeOrFunc)) {
|
|
4691
|
-
return {};
|
|
4692
|
-
}
|
|
4693
|
-
const parentCtor = getParentCtor(typeOrFunc);
|
|
4694
|
-
const propMetadata = {};
|
|
4695
|
-
if (parentCtor !== Object) {
|
|
4696
|
-
const parentPropMetadata = this.propMetadata(parentCtor);
|
|
4697
|
-
Object.keys(parentPropMetadata).forEach((propName) => {
|
|
4698
|
-
propMetadata[propName] = parentPropMetadata[propName];
|
|
4699
|
-
});
|
|
4700
|
-
}
|
|
4701
|
-
const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
|
4702
|
-
if (ownPropMetadata) {
|
|
4703
|
-
Object.keys(ownPropMetadata).forEach((propName) => {
|
|
4704
|
-
const decorators = [];
|
|
4705
|
-
if (propMetadata.hasOwnProperty(propName)) {
|
|
4706
|
-
decorators.push(...propMetadata[propName]);
|
|
4707
|
-
}
|
|
4708
|
-
decorators.push(...ownPropMetadata[propName]);
|
|
4709
|
-
propMetadata[propName] = decorators;
|
|
4710
|
-
});
|
|
4711
|
-
}
|
|
4712
|
-
return propMetadata;
|
|
4713
|
-
}
|
|
4714
|
-
ownPropMetadata(typeOrFunc) {
|
|
4715
|
-
if (!isType(typeOrFunc)) {
|
|
4716
|
-
return {};
|
|
4717
|
-
}
|
|
4718
|
-
return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
|
|
4719
|
-
}
|
|
4720
|
-
hasLifecycleHook(type, lcProperty) {
|
|
4721
|
-
return type instanceof Type && lcProperty in type.prototype;
|
|
4722
|
-
}
|
|
4723
|
-
}
|
|
4724
|
-
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
|
4725
|
-
if (!decoratorInvocations) {
|
|
4726
|
-
return [];
|
|
4727
|
-
}
|
|
4728
|
-
return decoratorInvocations.map(decoratorInvocation => {
|
|
4729
|
-
const decoratorType = decoratorInvocation.type;
|
|
4730
|
-
const annotationCls = decoratorType.annotationCls;
|
|
4731
|
-
const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
|
4732
|
-
return new annotationCls(...annotationArgs);
|
|
4733
|
-
});
|
|
4734
|
-
}
|
|
4735
|
-
function getParentCtor(ctor) {
|
|
4736
|
-
const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
|
|
4737
|
-
const parentCtor = parentProto ? parentProto.constructor : null;
|
|
4738
|
-
// Note: We always use `Object` as the null value
|
|
4739
|
-
// to simplify checking later on.
|
|
4740
|
-
return parentCtor || Object;
|
|
4741
|
-
}
|
|
4742
|
-
|
|
4743
|
-
/**
|
|
4744
|
-
* @license
|
|
4745
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4746
|
-
*
|
|
4747
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4748
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4749
|
-
*/
|
|
4750
|
-
const _THROW_IF_NOT_FOUND = {};
|
|
4751
|
-
const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
|
4752
|
-
/*
|
|
4753
|
-
* Name of a property (that we patch onto DI decorator), which is used as an annotation of which
|
|
4754
|
-
* InjectFlag this decorator represents. This allows to avoid direct references to the DI decorators
|
|
4755
|
-
* in the code, thus making them tree-shakable.
|
|
4756
|
-
*/
|
|
4757
|
-
const DI_DECORATOR_FLAG = '__NG_DI_FLAG__';
|
|
4758
|
-
const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
|
|
4759
|
-
const NG_TOKEN_PATH = 'ngTokenPath';
|
|
4760
|
-
const NEW_LINE = /\n/gm;
|
|
4761
|
-
const NO_NEW_LINE = 'ɵ';
|
|
4762
|
-
const SOURCE = '__source';
|
|
4763
|
-
/**
|
|
4764
|
-
* Current injector value used by `inject`.
|
|
4765
|
-
* - `undefined`: it is an error to call `inject`
|
|
4766
|
-
* - `null`: `inject` can be called but there is no injector (limp-mode).
|
|
4767
|
-
* - Injector instance: Use the injector for resolution.
|
|
4768
|
-
*/
|
|
4769
|
-
let _currentInjector = undefined;
|
|
4770
|
-
function setCurrentInjector(injector) {
|
|
4771
|
-
const former = _currentInjector;
|
|
4772
|
-
_currentInjector = injector;
|
|
4773
|
-
return former;
|
|
4774
|
-
}
|
|
4775
|
-
function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
|
4776
|
-
if (_currentInjector === undefined) {
|
|
4777
|
-
throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
|
|
4778
|
-
`inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`EnvironmentInjector#runInContext\`.`);
|
|
4779
|
-
}
|
|
4780
|
-
else if (_currentInjector === null) {
|
|
4781
|
-
return injectRootLimpMode(token, undefined, flags);
|
|
4782
|
-
}
|
|
4783
|
-
else {
|
|
4784
|
-
return _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);
|
|
4785
|
-
}
|
|
4786
|
-
}
|
|
4787
|
-
function ɵɵinject(token, flags = InjectFlags.Default) {
|
|
4788
|
-
return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
|
|
4789
|
-
}
|
|
4790
|
-
/**
|
|
4791
|
-
* Throws an error indicating that a factory function could not be generated by the compiler for a
|
|
4792
|
-
* particular class.
|
|
4793
|
-
*
|
|
4794
|
-
* The name of the class is not mentioned here, but will be in the generated factory function name
|
|
4795
|
-
* and thus in the stack trace.
|
|
4796
|
-
*
|
|
4797
|
-
* @codeGenApi
|
|
4798
|
-
*/
|
|
4799
|
-
function ɵɵinvalidFactoryDep(index) {
|
|
4800
|
-
throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
|
|
4801
|
-
`This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
|
|
4802
|
-
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
|
|
4803
|
-
|
|
4804
|
-
Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
|
|
4805
|
-
}
|
|
4806
|
-
/**
|
|
4807
|
-
* Injects a token from the currently active injector.
|
|
4808
|
-
* `inject` is only supported during instantiation of a dependency by the DI system. It can be used
|
|
4809
|
-
* during:
|
|
4810
|
-
* - Construction (via the `constructor`) of a class being instantiated by the DI system, such
|
|
4811
|
-
* as an `@Injectable` or `@Component`.
|
|
4812
|
-
* - In the initializer for fields of such classes.
|
|
4813
|
-
* - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.
|
|
4814
|
-
* - In the `factory` function specified for an `InjectionToken`.
|
|
4815
|
-
*
|
|
4816
|
-
* @param token A token that represents a dependency that should be injected.
|
|
4817
|
-
* @param flags Optional flags that control how injection is executed.
|
|
4818
|
-
* The flags correspond to injection strategies that can be specified with
|
|
4819
|
-
* parameter decorators `@Host`, `@Self`, `@SkipSef`, and `@Optional`.
|
|
4820
|
-
* @returns the injected value if operation is successful, `null` otherwise.
|
|
4821
|
-
* @throws if called outside of a supported context.
|
|
4822
|
-
*
|
|
4823
|
-
* @usageNotes
|
|
4824
|
-
* In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a
|
|
4825
|
-
* field initializer:
|
|
4826
|
-
*
|
|
4827
|
-
* ```typescript
|
|
4828
|
-
* @Injectable({providedIn: 'root'})
|
|
4829
|
-
* export class Car {
|
|
4830
|
-
* radio: Radio|undefined;
|
|
4831
|
-
* // OK: field initializer
|
|
4832
|
-
* spareTyre = inject(Tyre);
|
|
4833
|
-
*
|
|
4834
|
-
* constructor() {
|
|
4835
|
-
* // OK: constructor body
|
|
4836
|
-
* this.radio = inject(Radio);
|
|
4837
|
-
* }
|
|
4838
|
-
* }
|
|
4839
|
-
* ```
|
|
4840
|
-
*
|
|
4841
|
-
* It is also legal to call `inject` from a provider's factory:
|
|
4842
|
-
*
|
|
4843
|
-
* ```typescript
|
|
4844
|
-
* providers: [
|
|
4845
|
-
* {provide: Car, useFactory: () => {
|
|
4846
|
-
* // OK: a class factory
|
|
4847
|
-
* const engine = inject(Engine);
|
|
4848
|
-
* return new Car(engine);
|
|
4849
|
-
* }}
|
|
4850
|
-
* ]
|
|
4851
|
-
* ```
|
|
4852
|
-
*
|
|
4853
|
-
* Calls to the `inject()` function outside of the class creation context will result in error. Most
|
|
4854
|
-
* notably, calls to `inject()` are disallowed after a class instance was created, in methods
|
|
4855
|
-
* (including lifecycle hooks):
|
|
4856
|
-
*
|
|
4857
|
-
* ```typescript
|
|
4858
|
-
* @Component({ ... })
|
|
4859
|
-
* export class CarComponent {
|
|
4860
|
-
* ngOnInit() {
|
|
4861
|
-
* // ERROR: too late, the component instance was already created
|
|
4862
|
-
* const engine = inject(Engine);
|
|
4863
|
-
* engine.start();
|
|
4864
|
-
* }
|
|
4865
|
-
* }
|
|
4866
|
-
* ```
|
|
4867
|
-
*
|
|
4868
|
-
* @publicApi
|
|
4869
|
-
*/
|
|
4870
|
-
function inject(token, flags = InjectFlags.Default) {
|
|
4871
|
-
if (typeof flags !== 'number') {
|
|
4872
|
-
// While TypeScript doesn't accept it without a cast, bitwise OR with false-y values in
|
|
4873
|
-
// JavaScript is a no-op. We can use that for a very codesize-efficient conversion from
|
|
4874
|
-
// `InjectOptions` to `InjectFlags`.
|
|
4875
|
-
flags = (0 /* InternalInjectFlags.Default */ | // comment to force a line break in the formatter
|
|
4876
|
-
(flags.optional && 8 /* InternalInjectFlags.Optional */) |
|
|
4877
|
-
(flags.host && 1 /* InternalInjectFlags.Host */) |
|
|
4878
|
-
(flags.self && 2 /* InternalInjectFlags.Self */) |
|
|
4879
|
-
(flags.skipSelf && 4 /* InternalInjectFlags.SkipSelf */));
|
|
4880
|
-
}
|
|
4881
|
-
return ɵɵinject(token, flags);
|
|
4882
|
-
}
|
|
4883
|
-
function injectArgs(types) {
|
|
4884
|
-
const args = [];
|
|
4885
|
-
for (let i = 0; i < types.length; i++) {
|
|
4886
|
-
const arg = resolveForwardRef(types[i]);
|
|
4887
|
-
if (Array.isArray(arg)) {
|
|
4888
|
-
if (arg.length === 0) {
|
|
4889
|
-
throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
|
|
4901
|
+
let propMetadata = typeOrFunc.propMetadata;
|
|
4902
|
+
if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
|
4903
|
+
propMetadata = propMetadata.propMetadata;
|
|
4890
4904
|
}
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4905
|
+
return propMetadata;
|
|
4906
|
+
}
|
|
4907
|
+
// API of tsickle for lowering decorators to properties on the class.
|
|
4908
|
+
if (typeOrFunc.propDecorators &&
|
|
4909
|
+
typeOrFunc.propDecorators !== parentCtor.propDecorators) {
|
|
4910
|
+
const propDecorators = typeOrFunc.propDecorators;
|
|
4911
|
+
const propMetadata = {};
|
|
4912
|
+
Object.keys(propDecorators).forEach(prop => {
|
|
4913
|
+
propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
|
4914
|
+
});
|
|
4915
|
+
return propMetadata;
|
|
4916
|
+
}
|
|
4917
|
+
// API for metadata created by invoking the decorators.
|
|
4918
|
+
if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
|
|
4919
|
+
return typeOrFunc[PROP_METADATA];
|
|
4920
|
+
}
|
|
4921
|
+
return null;
|
|
4922
|
+
}
|
|
4923
|
+
propMetadata(typeOrFunc) {
|
|
4924
|
+
if (!isType(typeOrFunc)) {
|
|
4925
|
+
return {};
|
|
4926
|
+
}
|
|
4927
|
+
const parentCtor = getParentCtor(typeOrFunc);
|
|
4928
|
+
const propMetadata = {};
|
|
4929
|
+
if (parentCtor !== Object) {
|
|
4930
|
+
const parentPropMetadata = this.propMetadata(parentCtor);
|
|
4931
|
+
Object.keys(parentPropMetadata).forEach((propName) => {
|
|
4932
|
+
propMetadata[propName] = parentPropMetadata[propName];
|
|
4933
|
+
});
|
|
4934
|
+
}
|
|
4935
|
+
const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
|
4936
|
+
if (ownPropMetadata) {
|
|
4937
|
+
Object.keys(ownPropMetadata).forEach((propName) => {
|
|
4938
|
+
const decorators = [];
|
|
4939
|
+
if (propMetadata.hasOwnProperty(propName)) {
|
|
4940
|
+
decorators.push(...propMetadata[propName]);
|
|
4907
4941
|
}
|
|
4908
|
-
|
|
4909
|
-
|
|
4942
|
+
decorators.push(...ownPropMetadata[propName]);
|
|
4943
|
+
propMetadata[propName] = decorators;
|
|
4944
|
+
});
|
|
4910
4945
|
}
|
|
4911
|
-
|
|
4912
|
-
|
|
4946
|
+
return propMetadata;
|
|
4947
|
+
}
|
|
4948
|
+
ownPropMetadata(typeOrFunc) {
|
|
4949
|
+
if (!isType(typeOrFunc)) {
|
|
4950
|
+
return {};
|
|
4913
4951
|
}
|
|
4952
|
+
return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
|
|
4914
4953
|
}
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
/**
|
|
4918
|
-
* Attaches a given InjectFlag to a given decorator using monkey-patching.
|
|
4919
|
-
* Since DI decorators can be used in providers `deps` array (when provider is configured using
|
|
4920
|
-
* `useFactory`) without initialization (e.g. `Host`) and as an instance (e.g. `new Host()`), we
|
|
4921
|
-
* attach the flag to make it available both as a static property and as a field on decorator
|
|
4922
|
-
* instance.
|
|
4923
|
-
*
|
|
4924
|
-
* @param decorator Provided DI decorator.
|
|
4925
|
-
* @param flag InjectFlag that should be applied.
|
|
4926
|
-
*/
|
|
4927
|
-
function attachInjectFlag(decorator, flag) {
|
|
4928
|
-
decorator[DI_DECORATOR_FLAG] = flag;
|
|
4929
|
-
decorator.prototype[DI_DECORATOR_FLAG] = flag;
|
|
4930
|
-
return decorator;
|
|
4931
|
-
}
|
|
4932
|
-
/**
|
|
4933
|
-
* Reads monkey-patched property that contains InjectFlag attached to a decorator.
|
|
4934
|
-
*
|
|
4935
|
-
* @param token Token that may contain monkey-patched DI flags property.
|
|
4936
|
-
*/
|
|
4937
|
-
function getInjectFlag(token) {
|
|
4938
|
-
return token[DI_DECORATOR_FLAG];
|
|
4939
|
-
}
|
|
4940
|
-
function catchInjectorError(e, token, injectorErrorName, source) {
|
|
4941
|
-
const tokenPath = e[NG_TEMP_TOKEN_PATH];
|
|
4942
|
-
if (token[SOURCE]) {
|
|
4943
|
-
tokenPath.unshift(token[SOURCE]);
|
|
4954
|
+
hasLifecycleHook(type, lcProperty) {
|
|
4955
|
+
return type instanceof Type && lcProperty in type.prototype;
|
|
4944
4956
|
}
|
|
4945
|
-
e.message = formatError('\n' + e.message, tokenPath, injectorErrorName, source);
|
|
4946
|
-
e[NG_TOKEN_PATH] = tokenPath;
|
|
4947
|
-
e[NG_TEMP_TOKEN_PATH] = null;
|
|
4948
|
-
throw e;
|
|
4949
4957
|
}
|
|
4950
|
-
function
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
if (Array.isArray(obj)) {
|
|
4954
|
-
context = obj.map(stringify).join(' -> ');
|
|
4955
|
-
}
|
|
4956
|
-
else if (typeof obj === 'object') {
|
|
4957
|
-
let parts = [];
|
|
4958
|
-
for (let key in obj) {
|
|
4959
|
-
if (obj.hasOwnProperty(key)) {
|
|
4960
|
-
let value = obj[key];
|
|
4961
|
-
parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
|
|
4962
|
-
}
|
|
4963
|
-
}
|
|
4964
|
-
context = `{${parts.join(', ')}}`;
|
|
4958
|
+
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
|
4959
|
+
if (!decoratorInvocations) {
|
|
4960
|
+
return [];
|
|
4965
4961
|
}
|
|
4966
|
-
return
|
|
4962
|
+
return decoratorInvocations.map(decoratorInvocation => {
|
|
4963
|
+
const decoratorType = decoratorInvocation.type;
|
|
4964
|
+
const annotationCls = decoratorType.annotationCls;
|
|
4965
|
+
const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
|
4966
|
+
return new annotationCls(...annotationArgs);
|
|
4967
|
+
});
|
|
4968
|
+
}
|
|
4969
|
+
function getParentCtor(ctor) {
|
|
4970
|
+
const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
|
|
4971
|
+
const parentCtor = parentProto ? parentProto.constructor : null;
|
|
4972
|
+
// Note: We always use `Object` as the null value
|
|
4973
|
+
// to simplify checking later on.
|
|
4974
|
+
return parentCtor || Object;
|
|
4967
4975
|
}
|
|
4968
4976
|
|
|
4969
4977
|
/**
|
|
@@ -6750,6 +6758,7 @@ class R3Injector extends EnvironmentInjector {
|
|
|
6750
6758
|
}
|
|
6751
6759
|
get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
|
|
6752
6760
|
this.assertNotDestroyed();
|
|
6761
|
+
flags = convertToBitFlags(flags);
|
|
6753
6762
|
// Set the injection context.
|
|
6754
6763
|
const previousInjector = setCurrentInjector(this);
|
|
6755
6764
|
const previousInjectImplementation = setInjectImplementation(undefined);
|
|
@@ -7022,143 +7031,12 @@ function forEachSingleProvider(providers, fn) {
|
|
|
7022
7031
|
}
|
|
7023
7032
|
else if (isImportedNgModuleProviders(provider)) {
|
|
7024
7033
|
forEachSingleProvider(provider.ɵproviders, fn);
|
|
7025
|
-
}
|
|
7026
|
-
else {
|
|
7027
|
-
fn(provider);
|
|
7028
|
-
}
|
|
7029
|
-
}
|
|
7030
|
-
}
|
|
7031
|
-
|
|
7032
|
-
/**
|
|
7033
|
-
* @license
|
|
7034
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7035
|
-
*
|
|
7036
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7037
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7038
|
-
*/
|
|
7039
|
-
/**
|
|
7040
|
-
* Represents a component created by a `ComponentFactory`.
|
|
7041
|
-
* Provides access to the component instance and related objects,
|
|
7042
|
-
* and provides the means of destroying the instance.
|
|
7043
|
-
*
|
|
7044
|
-
* @publicApi
|
|
7045
|
-
*/
|
|
7046
|
-
class ComponentRef$1 {
|
|
7047
|
-
}
|
|
7048
|
-
/**
|
|
7049
|
-
* Base class for a factory that can create a component dynamically.
|
|
7050
|
-
* Instantiate a factory for a given type of component with `resolveComponentFactory()`.
|
|
7051
|
-
* Use the resulting `ComponentFactory.create()` method to create a component of that type.
|
|
7052
|
-
*
|
|
7053
|
-
* @see [Dynamic Components](guide/dynamic-component-loader)
|
|
7054
|
-
*
|
|
7055
|
-
* @publicApi
|
|
7056
|
-
*
|
|
7057
|
-
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
|
7058
|
-
* Component class can be used directly.
|
|
7059
|
-
*/
|
|
7060
|
-
class ComponentFactory$1 {
|
|
7061
|
-
}
|
|
7062
|
-
|
|
7063
|
-
/**
|
|
7064
|
-
* @license
|
|
7065
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7066
|
-
*
|
|
7067
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7068
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7069
|
-
*/
|
|
7070
|
-
function noComponentFactoryError(component) {
|
|
7071
|
-
const error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`);
|
|
7072
|
-
error[ERROR_COMPONENT] = component;
|
|
7073
|
-
return error;
|
|
7074
|
-
}
|
|
7075
|
-
const ERROR_COMPONENT = 'ngComponent';
|
|
7076
|
-
function getComponent$1(error) {
|
|
7077
|
-
return error[ERROR_COMPONENT];
|
|
7078
|
-
}
|
|
7079
|
-
class _NullComponentFactoryResolver {
|
|
7080
|
-
resolveComponentFactory(component) {
|
|
7081
|
-
throw noComponentFactoryError(component);
|
|
7082
|
-
}
|
|
7083
|
-
}
|
|
7084
|
-
/**
|
|
7085
|
-
* A simple registry that maps `Components` to generated `ComponentFactory` classes
|
|
7086
|
-
* that can be used to create instances of components.
|
|
7087
|
-
* Use to obtain the factory for a given component type,
|
|
7088
|
-
* then use the factory's `create()` method to create a component of that type.
|
|
7089
|
-
*
|
|
7090
|
-
* Note: since v13, dynamic component creation via
|
|
7091
|
-
* [`ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent)
|
|
7092
|
-
* does **not** require resolving component factory: component class can be used directly.
|
|
7093
|
-
*
|
|
7094
|
-
* @publicApi
|
|
7095
|
-
*
|
|
7096
|
-
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
|
7097
|
-
* Component class can be used directly.
|
|
7098
|
-
*/
|
|
7099
|
-
class ComponentFactoryResolver$1 {
|
|
7100
|
-
}
|
|
7101
|
-
ComponentFactoryResolver$1.NULL = ( /* @__PURE__ */new _NullComponentFactoryResolver());
|
|
7102
|
-
|
|
7103
|
-
/**
|
|
7104
|
-
* @license
|
|
7105
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7106
|
-
*
|
|
7107
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7108
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7109
|
-
*/
|
|
7110
|
-
/**
|
|
7111
|
-
* Creates an ElementRef from the most recent node.
|
|
7112
|
-
*
|
|
7113
|
-
* @returns The ElementRef instance to use
|
|
7114
|
-
*/
|
|
7115
|
-
function injectElementRef() {
|
|
7116
|
-
return createElementRef(getCurrentTNode(), getLView());
|
|
7117
|
-
}
|
|
7118
|
-
/**
|
|
7119
|
-
* Creates an ElementRef given a node.
|
|
7120
|
-
*
|
|
7121
|
-
* @param tNode The node for which you'd like an ElementRef
|
|
7122
|
-
* @param lView The view to which the node belongs
|
|
7123
|
-
* @returns The ElementRef instance to use
|
|
7124
|
-
*/
|
|
7125
|
-
function createElementRef(tNode, lView) {
|
|
7126
|
-
return new ElementRef(getNativeByTNode(tNode, lView));
|
|
7127
|
-
}
|
|
7128
|
-
/**
|
|
7129
|
-
* A wrapper around a native element inside of a View.
|
|
7130
|
-
*
|
|
7131
|
-
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
|
|
7132
|
-
* element.
|
|
7133
|
-
*
|
|
7134
|
-
* @security Permitting direct access to the DOM can make your application more vulnerable to
|
|
7135
|
-
* XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
|
|
7136
|
-
* [Security Guide](https://g.co/ng/security).
|
|
7137
|
-
*
|
|
7138
|
-
* @publicApi
|
|
7139
|
-
*/
|
|
7140
|
-
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
|
|
7141
|
-
// i.e. users have to ask for what they need. With that, we can build better analysis tools
|
|
7142
|
-
// and could do better codegen in the future.
|
|
7143
|
-
class ElementRef {
|
|
7144
|
-
constructor(nativeElement) {
|
|
7145
|
-
this.nativeElement = nativeElement;
|
|
7034
|
+
}
|
|
7035
|
+
else {
|
|
7036
|
+
fn(provider);
|
|
7037
|
+
}
|
|
7146
7038
|
}
|
|
7147
7039
|
}
|
|
7148
|
-
/**
|
|
7149
|
-
* @internal
|
|
7150
|
-
* @nocollapse
|
|
7151
|
-
*/
|
|
7152
|
-
ElementRef.__NG_ELEMENT_ID__ = injectElementRef;
|
|
7153
|
-
/**
|
|
7154
|
-
* Unwraps `ElementRef` and return the `nativeElement`.
|
|
7155
|
-
*
|
|
7156
|
-
* @param value value to unwrap
|
|
7157
|
-
* @returns `nativeElement` if `ElementRef` otherwise returns value as is.
|
|
7158
|
-
*/
|
|
7159
|
-
function unwrapElementRef(value) {
|
|
7160
|
-
return value instanceof ElementRef ? value.nativeElement : value;
|
|
7161
|
-
}
|
|
7162
7040
|
|
|
7163
7041
|
/**
|
|
7164
7042
|
* @license
|
|
@@ -7167,66 +7045,29 @@ function unwrapElementRef(value) {
|
|
|
7167
7045
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7168
7046
|
* found in the LICENSE file at https://angular.io/license
|
|
7169
7047
|
*/
|
|
7170
|
-
const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
|
7171
7048
|
/**
|
|
7172
|
-
*
|
|
7049
|
+
* Represents a component created by a `ComponentFactory`.
|
|
7050
|
+
* Provides access to the component instance and related objects,
|
|
7051
|
+
* and provides the means of destroying the instance.
|
|
7173
7052
|
*
|
|
7174
7053
|
* @publicApi
|
|
7175
7054
|
*/
|
|
7176
|
-
class
|
|
7055
|
+
class ComponentRef$1 {
|
|
7177
7056
|
}
|
|
7178
7057
|
/**
|
|
7179
|
-
*
|
|
7180
|
-
*
|
|
7181
|
-
*
|
|
7182
|
-
*
|
|
7183
|
-
* Create your custom renderer using `RendererFactory2`.
|
|
7058
|
+
* Base class for a factory that can create a component dynamically.
|
|
7059
|
+
* Instantiate a factory for a given type of component with `resolveComponentFactory()`.
|
|
7060
|
+
* Use the resulting `ComponentFactory.create()` method to create a component of that type.
|
|
7184
7061
|
*
|
|
7185
|
-
*
|
|
7186
|
-
* make custom UI changes that can't be expressed declaratively.
|
|
7187
|
-
* For example if you need to set a property or an attribute whose name is
|
|
7188
|
-
* not statically known, use the `setProperty()` or
|
|
7189
|
-
* `setAttribute()` method.
|
|
7062
|
+
* @see [Dynamic Components](guide/dynamic-component-loader)
|
|
7190
7063
|
*
|
|
7191
7064
|
* @publicApi
|
|
7192
|
-
*/
|
|
7193
|
-
class Renderer2 {
|
|
7194
|
-
}
|
|
7195
|
-
/**
|
|
7196
|
-
* @internal
|
|
7197
|
-
* @nocollapse
|
|
7198
|
-
*/
|
|
7199
|
-
Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
|
|
7200
|
-
/** Injects a Renderer2 for the current component. */
|
|
7201
|
-
function injectRenderer2() {
|
|
7202
|
-
// We need the Renderer to be based on the component that it's being injected into, however since
|
|
7203
|
-
// DI happens before we've entered its view, `getLView` will return the parent view instead.
|
|
7204
|
-
const lView = getLView();
|
|
7205
|
-
const tNode = getCurrentTNode();
|
|
7206
|
-
const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
|
|
7207
|
-
return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
|
|
7208
|
-
}
|
|
7209
|
-
|
|
7210
|
-
/**
|
|
7211
|
-
* @license
|
|
7212
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7213
|
-
*
|
|
7214
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7215
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7216
|
-
*/
|
|
7217
|
-
/**
|
|
7218
|
-
* Sanitizer is used by the views to sanitize potentially dangerous values.
|
|
7219
7065
|
*
|
|
7220
|
-
* @
|
|
7066
|
+
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
|
7067
|
+
* Component class can be used directly.
|
|
7221
7068
|
*/
|
|
7222
|
-
class
|
|
7069
|
+
class ComponentFactory$1 {
|
|
7223
7070
|
}
|
|
7224
|
-
/** @nocollapse */
|
|
7225
|
-
Sanitizer.ɵprov = ɵɵdefineInjectable({
|
|
7226
|
-
token: Sanitizer,
|
|
7227
|
-
providedIn: 'root',
|
|
7228
|
-
factory: () => null,
|
|
7229
|
-
});
|
|
7230
7071
|
|
|
7231
7072
|
/**
|
|
7232
7073
|
* @license
|
|
@@ -7235,80 +7076,38 @@ Sanitizer.ɵprov = ɵɵdefineInjectable({
|
|
|
7235
7076
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7236
7077
|
* found in the LICENSE file at https://angular.io/license
|
|
7237
7078
|
*/
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7079
|
+
function noComponentFactoryError(component) {
|
|
7080
|
+
const error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`);
|
|
7081
|
+
error[ERROR_COMPONENT] = component;
|
|
7082
|
+
return error;
|
|
7083
|
+
}
|
|
7084
|
+
const ERROR_COMPONENT = 'ngComponent';
|
|
7085
|
+
function getComponent$1(error) {
|
|
7086
|
+
return error[ERROR_COMPONENT];
|
|
7087
|
+
}
|
|
7088
|
+
class _NullComponentFactoryResolver {
|
|
7089
|
+
resolveComponentFactory(component) {
|
|
7090
|
+
throw noComponentFactoryError(component);
|
|
7249
7091
|
}
|
|
7250
7092
|
}
|
|
7251
7093
|
/**
|
|
7252
|
-
*
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
/**
|
|
7257
|
-
* @license
|
|
7258
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7259
|
-
*
|
|
7260
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7261
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7262
|
-
*/
|
|
7263
|
-
// This default value is when checking the hierarchy for a token.
|
|
7264
|
-
//
|
|
7265
|
-
// It means both:
|
|
7266
|
-
// - the token is not provided by the current injector,
|
|
7267
|
-
// - only the element injectors should be checked (ie do not check module injectors
|
|
7268
|
-
//
|
|
7269
|
-
// mod1
|
|
7270
|
-
// /
|
|
7271
|
-
// el1 mod2
|
|
7272
|
-
// \ /
|
|
7273
|
-
// el2
|
|
7274
|
-
//
|
|
7275
|
-
// When requesting el2.injector.get(token), we should check in the following order and return the
|
|
7276
|
-
// first found value:
|
|
7277
|
-
// - el2.injector.get(token, default)
|
|
7278
|
-
// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
|
|
7279
|
-
// - mod2.injector.get(token, default)
|
|
7280
|
-
const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
|
7281
|
-
|
|
7282
|
-
/**
|
|
7283
|
-
* @license
|
|
7284
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7094
|
+
* A simple registry that maps `Components` to generated `ComponentFactory` classes
|
|
7095
|
+
* that can be used to create instances of components.
|
|
7096
|
+
* Use to obtain the factory for a given component type,
|
|
7097
|
+
* then use the factory's `create()` method to create a component of that type.
|
|
7285
7098
|
*
|
|
7286
|
-
*
|
|
7287
|
-
*
|
|
7288
|
-
|
|
7289
|
-
/**
|
|
7290
|
-
* Defines a schema that allows an NgModule to contain the following:
|
|
7291
|
-
* - Non-Angular elements named with dash case (`-`).
|
|
7292
|
-
* - Element properties named with dash case (`-`).
|
|
7293
|
-
* Dash case is the naming convention for custom elements.
|
|
7099
|
+
* Note: since v13, dynamic component creation via
|
|
7100
|
+
* [`ViewContainerRef.createComponent`](api/core/ViewContainerRef#createComponent)
|
|
7101
|
+
* does **not** require resolving component factory: component class can be used directly.
|
|
7294
7102
|
*
|
|
7295
7103
|
* @publicApi
|
|
7296
|
-
*/
|
|
7297
|
-
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
7298
|
-
name: 'custom-elements'
|
|
7299
|
-
};
|
|
7300
|
-
/**
|
|
7301
|
-
* Defines a schema that allows any property on any element.
|
|
7302
|
-
*
|
|
7303
|
-
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
7304
|
-
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
7305
|
-
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
7306
7104
|
*
|
|
7307
|
-
* @
|
|
7105
|
+
* @deprecated Angular no longer requires Component factories. Please use other APIs where
|
|
7106
|
+
* Component class can be used directly.
|
|
7308
7107
|
*/
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7108
|
+
class ComponentFactoryResolver$1 {
|
|
7109
|
+
}
|
|
7110
|
+
ComponentFactoryResolver$1.NULL = ( /* @__PURE__ */new _NullComponentFactoryResolver());
|
|
7312
7111
|
|
|
7313
7112
|
/**
|
|
7314
7113
|
* @license
|
|
@@ -7317,262 +7116,207 @@ const NO_ERRORS_SCHEMA = {
|
|
|
7317
7116
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7318
7117
|
* found in the LICENSE file at https://angular.io/license
|
|
7319
7118
|
*/
|
|
7320
|
-
let shouldThrowErrorOnUnknownElement = false;
|
|
7321
|
-
/**
|
|
7322
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
7323
|
-
* instead of just logging the error.
|
|
7324
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
7325
|
-
*/
|
|
7326
|
-
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
7327
|
-
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
7328
|
-
}
|
|
7329
|
-
/**
|
|
7330
|
-
* Gets the current value of the strict mode.
|
|
7331
|
-
*/
|
|
7332
|
-
function ɵgetUnknownElementStrictMode() {
|
|
7333
|
-
return shouldThrowErrorOnUnknownElement;
|
|
7334
|
-
}
|
|
7335
|
-
let shouldThrowErrorOnUnknownProperty = false;
|
|
7336
|
-
/**
|
|
7337
|
-
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
7338
|
-
* instead of just logging the error.
|
|
7339
|
-
* (for AOT-compiled ones this check happens at build time).
|
|
7340
|
-
*/
|
|
7341
|
-
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
7342
|
-
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
7343
|
-
}
|
|
7344
|
-
/**
|
|
7345
|
-
* Gets the current value of the strict mode.
|
|
7346
|
-
*/
|
|
7347
|
-
function ɵgetUnknownPropertyStrictMode() {
|
|
7348
|
-
return shouldThrowErrorOnUnknownProperty;
|
|
7349
|
-
}
|
|
7350
7119
|
/**
|
|
7351
|
-
*
|
|
7352
|
-
*
|
|
7353
|
-
*
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
* - it's a known HTML element
|
|
7358
|
-
* - it's a known custom element
|
|
7359
|
-
* - the element matches any directive
|
|
7360
|
-
* - the element is allowed by one of the schemas
|
|
7361
|
-
*
|
|
7362
|
-
* @param element Element to validate
|
|
7363
|
-
* @param lView An `LView` that represents a current component that is being rendered
|
|
7364
|
-
* @param tagName Name of the tag to check
|
|
7365
|
-
* @param schemas Array of schemas
|
|
7366
|
-
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
7367
|
-
*/
|
|
7368
|
-
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
7369
|
-
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
7370
|
-
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
7371
|
-
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
7372
|
-
// execute the check below.
|
|
7373
|
-
if (schemas === null)
|
|
7374
|
-
return;
|
|
7375
|
-
// If the element matches any directive, it's considered as valid.
|
|
7376
|
-
if (!hasDirectives && tagName !== null) {
|
|
7377
|
-
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
7378
|
-
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
7379
|
-
// of HTMLUnknownElement in browsers that support web components.
|
|
7380
|
-
const isUnknown =
|
|
7381
|
-
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
7382
|
-
// because while most browsers return 'function', IE returns 'object'.
|
|
7383
|
-
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
7384
|
-
element instanceof HTMLUnknownElement) ||
|
|
7385
|
-
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
7386
|
-
!customElements.get(tagName));
|
|
7387
|
-
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
7388
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
7389
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
7390
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
7391
|
-
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
7392
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
7393
|
-
'a part of an @NgModule where this component is declared'}.\n`;
|
|
7394
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
7395
|
-
message +=
|
|
7396
|
-
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
7397
|
-
}
|
|
7398
|
-
else {
|
|
7399
|
-
message +=
|
|
7400
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
7401
|
-
}
|
|
7402
|
-
if (shouldThrowErrorOnUnknownElement) {
|
|
7403
|
-
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
7404
|
-
}
|
|
7405
|
-
else {
|
|
7406
|
-
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
7407
|
-
}
|
|
7408
|
-
}
|
|
7409
|
-
}
|
|
7120
|
+
* Creates an ElementRef from the most recent node.
|
|
7121
|
+
*
|
|
7122
|
+
* @returns The ElementRef instance to use
|
|
7123
|
+
*/
|
|
7124
|
+
function injectElementRef() {
|
|
7125
|
+
return createElementRef(getCurrentTNode(), getLView());
|
|
7410
7126
|
}
|
|
7411
7127
|
/**
|
|
7412
|
-
*
|
|
7413
|
-
* false if it's not the case.
|
|
7414
|
-
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
7415
|
-
* ones this check happens at build time).
|
|
7128
|
+
* Creates an ElementRef given a node.
|
|
7416
7129
|
*
|
|
7417
|
-
* The
|
|
7418
|
-
*
|
|
7419
|
-
*
|
|
7420
|
-
|
|
7130
|
+
* @param tNode The node for which you'd like an ElementRef
|
|
7131
|
+
* @param lView The view to which the node belongs
|
|
7132
|
+
* @returns The ElementRef instance to use
|
|
7133
|
+
*/
|
|
7134
|
+
function createElementRef(tNode, lView) {
|
|
7135
|
+
return new ElementRef(getNativeByTNode(tNode, lView));
|
|
7136
|
+
}
|
|
7137
|
+
/**
|
|
7138
|
+
* A wrapper around a native element inside of a View.
|
|
7421
7139
|
*
|
|
7422
|
-
*
|
|
7423
|
-
*
|
|
7424
|
-
*
|
|
7425
|
-
* @
|
|
7140
|
+
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
|
|
7141
|
+
* element.
|
|
7142
|
+
*
|
|
7143
|
+
* @security Permitting direct access to the DOM can make your application more vulnerable to
|
|
7144
|
+
* XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
|
|
7145
|
+
* [Security Guide](https://g.co/ng/security).
|
|
7146
|
+
*
|
|
7147
|
+
* @publicApi
|
|
7426
7148
|
*/
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
return true;
|
|
7434
|
-
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
7435
|
-
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
7436
|
-
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
7437
|
-
return true;
|
|
7149
|
+
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
|
|
7150
|
+
// i.e. users have to ask for what they need. With that, we can build better analysis tools
|
|
7151
|
+
// and could do better codegen in the future.
|
|
7152
|
+
class ElementRef {
|
|
7153
|
+
constructor(nativeElement) {
|
|
7154
|
+
this.nativeElement = nativeElement;
|
|
7438
7155
|
}
|
|
7439
|
-
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
7440
|
-
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
7441
|
-
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
7442
7156
|
}
|
|
7443
7157
|
/**
|
|
7444
|
-
*
|
|
7158
|
+
* @internal
|
|
7159
|
+
* @nocollapse
|
|
7160
|
+
*/
|
|
7161
|
+
ElementRef.__NG_ELEMENT_ID__ = injectElementRef;
|
|
7162
|
+
/**
|
|
7163
|
+
* Unwraps `ElementRef` and return the `nativeElement`.
|
|
7445
7164
|
*
|
|
7446
|
-
* @param
|
|
7447
|
-
* @
|
|
7448
|
-
* @param nodeType Type of the node hosting the property
|
|
7449
|
-
* @param lView An `LView` that represents a current component
|
|
7165
|
+
* @param value value to unwrap
|
|
7166
|
+
* @returns `nativeElement` if `ElementRef` otherwise returns value as is.
|
|
7450
7167
|
*/
|
|
7451
|
-
function
|
|
7452
|
-
|
|
7453
|
-
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
7454
|
-
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
7455
|
-
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
7456
|
-
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
7457
|
-
// a default value of the `tNode.value` is not feasible at this moment.
|
|
7458
|
-
if (!tagName && nodeType === 4 /* TNodeType.Container */) {
|
|
7459
|
-
tagName = 'ng-template';
|
|
7460
|
-
}
|
|
7461
|
-
const isHostStandalone = isHostComponentStandalone(lView);
|
|
7462
|
-
const templateLocation = getTemplateLocationDetails(lView);
|
|
7463
|
-
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
7464
|
-
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
7465
|
-
const importLocation = isHostStandalone ?
|
|
7466
|
-
'included in the \'@Component.imports\' of this component' :
|
|
7467
|
-
'a part of an @NgModule where this component is declared';
|
|
7468
|
-
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
7469
|
-
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
7470
|
-
// a template, but the directive or the `CommonModule` is not imported.
|
|
7471
|
-
const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
|
|
7472
|
-
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
7473
|
-
`please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
|
|
7474
|
-
}
|
|
7475
|
-
else {
|
|
7476
|
-
// May be an Angular component, which is not imported/declared?
|
|
7477
|
-
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
7478
|
-
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
7479
|
-
// May be a Web Component?
|
|
7480
|
-
if (tagName && tagName.indexOf('-') > -1) {
|
|
7481
|
-
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
7482
|
-
`to the ${schemas} of this component to suppress this message.`;
|
|
7483
|
-
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
7484
|
-
`the ${schemas} of this component.`;
|
|
7485
|
-
}
|
|
7486
|
-
else {
|
|
7487
|
-
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
7488
|
-
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
7489
|
-
`the ${schemas} of this component.`;
|
|
7490
|
-
}
|
|
7491
|
-
}
|
|
7492
|
-
reportUnknownPropertyError(message);
|
|
7168
|
+
function unwrapElementRef(value) {
|
|
7169
|
+
return value instanceof ElementRef ? value.nativeElement : value;
|
|
7493
7170
|
}
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7171
|
+
|
|
7172
|
+
/**
|
|
7173
|
+
* @license
|
|
7174
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7175
|
+
*
|
|
7176
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7177
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7178
|
+
*/
|
|
7179
|
+
const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
|
7180
|
+
/**
|
|
7181
|
+
* Creates and initializes a custom renderer that implements the `Renderer2` base class.
|
|
7182
|
+
*
|
|
7183
|
+
* @publicApi
|
|
7184
|
+
*/
|
|
7185
|
+
class RendererFactory2 {
|
|
7501
7186
|
}
|
|
7502
7187
|
/**
|
|
7503
|
-
*
|
|
7504
|
-
*
|
|
7505
|
-
*
|
|
7188
|
+
* Extend this base class to implement custom rendering. By default, Angular
|
|
7189
|
+
* renders a template into DOM. You can use custom rendering to intercept
|
|
7190
|
+
* rendering calls, or to render to something other than DOM.
|
|
7506
7191
|
*
|
|
7507
|
-
*
|
|
7192
|
+
* Create your custom renderer using `RendererFactory2`.
|
|
7508
7193
|
*
|
|
7509
|
-
*
|
|
7194
|
+
* Use a custom renderer to bypass Angular's templating and
|
|
7195
|
+
* make custom UI changes that can't be expressed declaratively.
|
|
7196
|
+
* For example if you need to set a property or an attribute whose name is
|
|
7197
|
+
* not statically known, use the `setProperty()` or
|
|
7198
|
+
* `setAttribute()` method.
|
|
7199
|
+
*
|
|
7200
|
+
* @publicApi
|
|
7510
7201
|
*/
|
|
7511
|
-
|
|
7512
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
7513
|
-
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
7514
|
-
const context = declarationLView[CONTEXT];
|
|
7515
|
-
// Unable to obtain a context.
|
|
7516
|
-
if (!context)
|
|
7517
|
-
return null;
|
|
7518
|
-
return context.constructor ? getComponentDef(context.constructor) : null;
|
|
7202
|
+
class Renderer2 {
|
|
7519
7203
|
}
|
|
7520
7204
|
/**
|
|
7521
|
-
*
|
|
7522
|
-
*
|
|
7523
|
-
|
|
7205
|
+
* @internal
|
|
7206
|
+
* @nocollapse
|
|
7207
|
+
*/
|
|
7208
|
+
Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
|
|
7209
|
+
/** Injects a Renderer2 for the current component. */
|
|
7210
|
+
function injectRenderer2() {
|
|
7211
|
+
// We need the Renderer to be based on the component that it's being injected into, however since
|
|
7212
|
+
// DI happens before we've entered its view, `getLView` will return the parent view instead.
|
|
7213
|
+
const lView = getLView();
|
|
7214
|
+
const tNode = getCurrentTNode();
|
|
7215
|
+
const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
|
|
7216
|
+
return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
|
|
7217
|
+
}
|
|
7218
|
+
|
|
7219
|
+
/**
|
|
7220
|
+
* @license
|
|
7221
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7524
7222
|
*
|
|
7525
|
-
*
|
|
7223
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7224
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7225
|
+
*/
|
|
7226
|
+
/**
|
|
7227
|
+
* Sanitizer is used by the views to sanitize potentially dangerous values.
|
|
7526
7228
|
*
|
|
7527
|
-
* @
|
|
7229
|
+
* @publicApi
|
|
7528
7230
|
*/
|
|
7529
|
-
|
|
7530
|
-
!ngDevMode && throwError('Must never be called in production mode');
|
|
7531
|
-
const componentDef = getDeclarationComponentDef(lView);
|
|
7532
|
-
// Treat host component as non-standalone if we can't obtain the def.
|
|
7533
|
-
return !!componentDef?.standalone;
|
|
7231
|
+
class Sanitizer {
|
|
7534
7232
|
}
|
|
7233
|
+
/** @nocollapse */
|
|
7234
|
+
Sanitizer.ɵprov = ɵɵdefineInjectable({
|
|
7235
|
+
token: Sanitizer,
|
|
7236
|
+
providedIn: 'root',
|
|
7237
|
+
factory: () => null,
|
|
7238
|
+
});
|
|
7239
|
+
|
|
7535
7240
|
/**
|
|
7536
|
-
*
|
|
7537
|
-
*
|
|
7538
|
-
* be too slow for production mode.
|
|
7241
|
+
* @license
|
|
7242
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7539
7243
|
*
|
|
7540
|
-
*
|
|
7541
|
-
* in
|
|
7244
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7245
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7246
|
+
*/
|
|
7247
|
+
/**
|
|
7248
|
+
* @description Represents the version of Angular
|
|
7542
7249
|
*
|
|
7543
|
-
* @
|
|
7250
|
+
* @publicApi
|
|
7544
7251
|
*/
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7252
|
+
class Version {
|
|
7253
|
+
constructor(full) {
|
|
7254
|
+
this.full = full;
|
|
7255
|
+
this.major = full.split('.')[0];
|
|
7256
|
+
this.minor = full.split('.')[1];
|
|
7257
|
+
this.patch = full.split('.').slice(2).join('.');
|
|
7258
|
+
}
|
|
7550
7259
|
}
|
|
7551
7260
|
/**
|
|
7552
|
-
*
|
|
7553
|
-
* We use this set to produce a more precises error message with a note
|
|
7554
|
-
* that the `CommonModule` should also be included.
|
|
7261
|
+
* @publicApi
|
|
7555
7262
|
*/
|
|
7556
|
-
const
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7263
|
+
const VERSION = new Version('15.0.0-next.5');
|
|
7264
|
+
|
|
7265
|
+
/**
|
|
7266
|
+
* @license
|
|
7267
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7268
|
+
*
|
|
7269
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7270
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7271
|
+
*/
|
|
7272
|
+
// This default value is when checking the hierarchy for a token.
|
|
7273
|
+
//
|
|
7274
|
+
// It means both:
|
|
7275
|
+
// - the token is not provided by the current injector,
|
|
7276
|
+
// - only the element injectors should be checked (ie do not check module injectors
|
|
7277
|
+
//
|
|
7278
|
+
// mod1
|
|
7279
|
+
// /
|
|
7280
|
+
// el1 mod2
|
|
7281
|
+
// \ /
|
|
7282
|
+
// el2
|
|
7283
|
+
//
|
|
7284
|
+
// When requesting el2.injector.get(token), we should check in the following order and return the
|
|
7285
|
+
// first found value:
|
|
7286
|
+
// - el2.injector.get(token, default)
|
|
7287
|
+
// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
|
|
7288
|
+
// - mod2.injector.get(token, default)
|
|
7289
|
+
const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
|
7290
|
+
|
|
7560
7291
|
/**
|
|
7561
|
-
*
|
|
7562
|
-
*
|
|
7563
|
-
*
|
|
7292
|
+
* @license
|
|
7293
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7294
|
+
*
|
|
7295
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7296
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7564
7297
|
*/
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7298
|
+
// Keeps track of the currently-active LViews.
|
|
7299
|
+
const TRACKED_LVIEWS = new Map();
|
|
7300
|
+
// Used for generating unique IDs for LViews.
|
|
7301
|
+
let uniqueIdCounter = 0;
|
|
7302
|
+
/** Gets a unique ID that can be assigned to an LView. */
|
|
7303
|
+
function getUniqueLViewId() {
|
|
7304
|
+
return uniqueIdCounter++;
|
|
7305
|
+
}
|
|
7306
|
+
/** Starts tracking an LView. */
|
|
7307
|
+
function registerLView(lView) {
|
|
7308
|
+
ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');
|
|
7309
|
+
TRACKED_LVIEWS.set(lView[ID], lView);
|
|
7310
|
+
}
|
|
7311
|
+
/** Gets an LView by its unique ID. */
|
|
7312
|
+
function getLViewById(id) {
|
|
7313
|
+
ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');
|
|
7314
|
+
return TRACKED_LVIEWS.get(id) || null;
|
|
7315
|
+
}
|
|
7316
|
+
/** Stops tracking an LView. */
|
|
7317
|
+
function unregisterLView(lView) {
|
|
7318
|
+
ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');
|
|
7319
|
+
TRACKED_LVIEWS.delete(lView[ID]);
|
|
7576
7320
|
}
|
|
7577
7321
|
|
|
7578
7322
|
/**
|
|
@@ -7582,15 +7326,38 @@ function matchingSchemas(schemas, tagName) {
|
|
|
7582
7326
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7583
7327
|
* found in the LICENSE file at https://angular.io/license
|
|
7584
7328
|
*/
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
function
|
|
7593
|
-
|
|
7329
|
+
/**
|
|
7330
|
+
* The internal view context which is specific to a given DOM element, directive or
|
|
7331
|
+
* component instance. Each value in here (besides the LView and element node details)
|
|
7332
|
+
* can be present, null or undefined. If undefined then it implies the value has not been
|
|
7333
|
+
* looked up yet, otherwise, if null, then a lookup was executed and nothing was found.
|
|
7334
|
+
*
|
|
7335
|
+
* Each value will get filled when the respective value is examined within the getContext
|
|
7336
|
+
* function. The component, element and each directive instance will share the same instance
|
|
7337
|
+
* of the context.
|
|
7338
|
+
*/
|
|
7339
|
+
class LContext {
|
|
7340
|
+
constructor(
|
|
7341
|
+
/**
|
|
7342
|
+
* ID of the component's parent view data.
|
|
7343
|
+
*/
|
|
7344
|
+
lViewId,
|
|
7345
|
+
/**
|
|
7346
|
+
* The index instance of the node.
|
|
7347
|
+
*/
|
|
7348
|
+
nodeIndex,
|
|
7349
|
+
/**
|
|
7350
|
+
* The instance of the DOM node that is attached to the lNode.
|
|
7351
|
+
*/
|
|
7352
|
+
native) {
|
|
7353
|
+
this.lViewId = lViewId;
|
|
7354
|
+
this.nodeIndex = nodeIndex;
|
|
7355
|
+
this.native = native;
|
|
7356
|
+
}
|
|
7357
|
+
/** Component's parent view data. */
|
|
7358
|
+
get lView() {
|
|
7359
|
+
return getLViewById(this.lViewId);
|
|
7360
|
+
}
|
|
7594
7361
|
}
|
|
7595
7362
|
|
|
7596
7363
|
/**
|
|
@@ -7601,158 +7368,304 @@ function getOriginalError(error) {
|
|
|
7601
7368
|
* found in the LICENSE file at https://angular.io/license
|
|
7602
7369
|
*/
|
|
7603
7370
|
/**
|
|
7604
|
-
*
|
|
7605
|
-
*
|
|
7606
|
-
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
7607
|
-
* intercept error handling, write a custom exception handler that replaces this default as
|
|
7608
|
-
* appropriate for your app.
|
|
7371
|
+
* Returns the matching `LContext` data for a given DOM node, directive or component instance.
|
|
7609
7372
|
*
|
|
7610
|
-
*
|
|
7611
|
-
*
|
|
7373
|
+
* This function will examine the provided DOM element, component, or directive instance\'s
|
|
7374
|
+
* monkey-patched property to derive the `LContext` data. Once called then the monkey-patched
|
|
7375
|
+
* value will be that of the newly created `LContext`.
|
|
7612
7376
|
*
|
|
7613
|
-
*
|
|
7614
|
-
*
|
|
7615
|
-
*
|
|
7616
|
-
*
|
|
7617
|
-
* }
|
|
7618
|
-
* }
|
|
7377
|
+
* If the monkey-patched value is the `LView` instance then the context value for that
|
|
7378
|
+
* target will be created and the monkey-patch reference will be updated. Therefore when this
|
|
7379
|
+
* function is called it may mutate the provided element\'s, component\'s or any of the associated
|
|
7380
|
+
* directive\'s monkey-patch values.
|
|
7619
7381
|
*
|
|
7620
|
-
*
|
|
7621
|
-
*
|
|
7622
|
-
*
|
|
7623
|
-
*
|
|
7624
|
-
*
|
|
7382
|
+
* If the monkey-patch value is not detected then the code will walk up the DOM until an element
|
|
7383
|
+
* is found which contains a monkey-patch reference. When that occurs then the provided element
|
|
7384
|
+
* will be updated with a new context (which is then returned). If the monkey-patch value is not
|
|
7385
|
+
* detected for a component/directive instance then it will throw an error (all components and
|
|
7386
|
+
* directives should be automatically monkey-patched by ivy).
|
|
7625
7387
|
*
|
|
7626
|
-
* @
|
|
7388
|
+
* @param target Component, Directive or DOM Node.
|
|
7627
7389
|
*/
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7390
|
+
function getLContext(target) {
|
|
7391
|
+
let mpValue = readPatchedData(target);
|
|
7392
|
+
if (mpValue) {
|
|
7393
|
+
// only when it's an array is it considered an LView instance
|
|
7394
|
+
// ... otherwise it's an already constructed LContext instance
|
|
7395
|
+
if (isLView(mpValue)) {
|
|
7396
|
+
const lView = mpValue;
|
|
7397
|
+
let nodeIndex;
|
|
7398
|
+
let component = undefined;
|
|
7399
|
+
let directives = undefined;
|
|
7400
|
+
if (isComponentInstance(target)) {
|
|
7401
|
+
nodeIndex = findViaComponent(lView, target);
|
|
7402
|
+
if (nodeIndex == -1) {
|
|
7403
|
+
throw new Error('The provided component was not found in the application');
|
|
7404
|
+
}
|
|
7405
|
+
component = target;
|
|
7406
|
+
}
|
|
7407
|
+
else if (isDirectiveInstance(target)) {
|
|
7408
|
+
nodeIndex = findViaDirective(lView, target);
|
|
7409
|
+
if (nodeIndex == -1) {
|
|
7410
|
+
throw new Error('The provided directive was not found in the application');
|
|
7411
|
+
}
|
|
7412
|
+
directives = getDirectivesAtNodeIndex(nodeIndex, lView);
|
|
7413
|
+
}
|
|
7414
|
+
else {
|
|
7415
|
+
nodeIndex = findViaNativeElement(lView, target);
|
|
7416
|
+
if (nodeIndex == -1) {
|
|
7417
|
+
return null;
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
// the goal is not to fill the entire context full of data because the lookups
|
|
7421
|
+
// are expensive. Instead, only the target data (the element, component, container, ICU
|
|
7422
|
+
// expression or directive details) are filled into the context. If called multiple times
|
|
7423
|
+
// with different target values then the missing target data will be filled in.
|
|
7424
|
+
const native = unwrapRNode(lView[nodeIndex]);
|
|
7425
|
+
const existingCtx = readPatchedData(native);
|
|
7426
|
+
const context = (existingCtx && !Array.isArray(existingCtx)) ?
|
|
7427
|
+
existingCtx :
|
|
7428
|
+
createLContext(lView, nodeIndex, native);
|
|
7429
|
+
// only when the component has been discovered then update the monkey-patch
|
|
7430
|
+
if (component && context.component === undefined) {
|
|
7431
|
+
context.component = component;
|
|
7432
|
+
attachPatchData(context.component, context);
|
|
7433
|
+
}
|
|
7434
|
+
// only when the directives have been discovered then update the monkey-patch
|
|
7435
|
+
if (directives && context.directives === undefined) {
|
|
7436
|
+
context.directives = directives;
|
|
7437
|
+
for (let i = 0; i < directives.length; i++) {
|
|
7438
|
+
attachPatchData(directives[i], context);
|
|
7439
|
+
}
|
|
7440
|
+
}
|
|
7441
|
+
attachPatchData(context.native, context);
|
|
7442
|
+
mpValue = context;
|
|
7443
|
+
}
|
|
7634
7444
|
}
|
|
7635
|
-
|
|
7636
|
-
const
|
|
7637
|
-
|
|
7638
|
-
if
|
|
7639
|
-
|
|
7445
|
+
else {
|
|
7446
|
+
const rElement = target;
|
|
7447
|
+
ngDevMode && assertDomNode(rElement);
|
|
7448
|
+
// if the context is not found then we need to traverse upwards up the DOM
|
|
7449
|
+
// to find the nearest element that has already been monkey patched with data
|
|
7450
|
+
let parent = rElement;
|
|
7451
|
+
while (parent = parent.parentNode) {
|
|
7452
|
+
const parentContext = readPatchedData(parent);
|
|
7453
|
+
if (parentContext) {
|
|
7454
|
+
const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
|
|
7455
|
+
// the edge of the app was also reached here through another means
|
|
7456
|
+
// (maybe because the DOM was changed manually).
|
|
7457
|
+
if (!lView) {
|
|
7458
|
+
return null;
|
|
7459
|
+
}
|
|
7460
|
+
const index = findViaNativeElement(lView, rElement);
|
|
7461
|
+
if (index >= 0) {
|
|
7462
|
+
const native = unwrapRNode(lView[index]);
|
|
7463
|
+
const context = createLContext(lView, index, native);
|
|
7464
|
+
attachPatchData(native, context);
|
|
7465
|
+
mpValue = context;
|
|
7466
|
+
break;
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7640
7469
|
}
|
|
7641
7470
|
}
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7471
|
+
return mpValue || null;
|
|
7472
|
+
}
|
|
7473
|
+
/**
|
|
7474
|
+
* Creates an empty instance of a `LContext` context
|
|
7475
|
+
*/
|
|
7476
|
+
function createLContext(lView, nodeIndex, native) {
|
|
7477
|
+
return new LContext(lView[ID], nodeIndex, native);
|
|
7478
|
+
}
|
|
7479
|
+
/**
|
|
7480
|
+
* Takes a component instance and returns the view for that component.
|
|
7481
|
+
*
|
|
7482
|
+
* @param componentInstance
|
|
7483
|
+
* @returns The component's view
|
|
7484
|
+
*/
|
|
7485
|
+
function getComponentViewByInstance(componentInstance) {
|
|
7486
|
+
let patchedData = readPatchedData(componentInstance);
|
|
7487
|
+
let lView;
|
|
7488
|
+
if (isLView(patchedData)) {
|
|
7489
|
+
const contextLView = patchedData;
|
|
7490
|
+
const nodeIndex = findViaComponent(contextLView, componentInstance);
|
|
7491
|
+
lView = getComponentLViewByIndex(nodeIndex, contextLView);
|
|
7492
|
+
const context = createLContext(contextLView, nodeIndex, lView[HOST]);
|
|
7493
|
+
context.component = componentInstance;
|
|
7494
|
+
attachPatchData(componentInstance, context);
|
|
7495
|
+
attachPatchData(context.native, context);
|
|
7496
|
+
}
|
|
7497
|
+
else {
|
|
7498
|
+
const context = patchedData;
|
|
7499
|
+
const contextLView = context.lView;
|
|
7500
|
+
ngDevMode && assertLView(contextLView);
|
|
7501
|
+
lView = getComponentLViewByIndex(context.nodeIndex, contextLView);
|
|
7502
|
+
}
|
|
7503
|
+
return lView;
|
|
7504
|
+
}
|
|
7505
|
+
/**
|
|
7506
|
+
* This property will be monkey-patched on elements, components and directives.
|
|
7507
|
+
*/
|
|
7508
|
+
const MONKEY_PATCH_KEY_NAME = '__ngContext__';
|
|
7509
|
+
/**
|
|
7510
|
+
* Assigns the given data to the given target (which could be a component,
|
|
7511
|
+
* directive or DOM node instance) using monkey-patching.
|
|
7512
|
+
*/
|
|
7513
|
+
function attachPatchData(target, data) {
|
|
7514
|
+
ngDevMode && assertDefined(target, 'Target expected');
|
|
7515
|
+
// Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this
|
|
7516
|
+
// for `LView`, because we have control over when an `LView` is created and destroyed, whereas
|
|
7517
|
+
// we can't know when to remove an `LContext`.
|
|
7518
|
+
if (isLView(data)) {
|
|
7519
|
+
target[MONKEY_PATCH_KEY_NAME] = data[ID];
|
|
7520
|
+
registerLView(data);
|
|
7521
|
+
}
|
|
7522
|
+
else {
|
|
7523
|
+
target[MONKEY_PATCH_KEY_NAME] = data;
|
|
7649
7524
|
}
|
|
7650
7525
|
}
|
|
7651
|
-
|
|
7652
7526
|
/**
|
|
7653
|
-
*
|
|
7654
|
-
*
|
|
7655
|
-
*
|
|
7656
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7657
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7527
|
+
* Returns the monkey-patch value data present on the target (which could be
|
|
7528
|
+
* a component, directive or a DOM node).
|
|
7658
7529
|
*/
|
|
7530
|
+
function readPatchedData(target) {
|
|
7531
|
+
ngDevMode && assertDefined(target, 'Target expected');
|
|
7532
|
+
const data = target[MONKEY_PATCH_KEY_NAME];
|
|
7533
|
+
return (typeof data === 'number') ? getLViewById(data) : data || null;
|
|
7534
|
+
}
|
|
7535
|
+
function readPatchedLView(target) {
|
|
7536
|
+
const value = readPatchedData(target);
|
|
7537
|
+
if (value) {
|
|
7538
|
+
return (isLView(value) ? value : value.lView);
|
|
7539
|
+
}
|
|
7540
|
+
return null;
|
|
7541
|
+
}
|
|
7542
|
+
function isComponentInstance(instance) {
|
|
7543
|
+
return instance && instance.constructor && instance.constructor.ɵcmp;
|
|
7544
|
+
}
|
|
7545
|
+
function isDirectiveInstance(instance) {
|
|
7546
|
+
return instance && instance.constructor && instance.constructor.ɵdir;
|
|
7547
|
+
}
|
|
7659
7548
|
/**
|
|
7660
|
-
*
|
|
7661
|
-
*
|
|
7662
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
7549
|
+
* Locates the element within the given LView and returns the matching index
|
|
7663
7550
|
*/
|
|
7664
|
-
|
|
7551
|
+
function findViaNativeElement(lView, target) {
|
|
7552
|
+
const tView = lView[TVIEW];
|
|
7553
|
+
for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
|
|
7554
|
+
if (unwrapRNode(lView[i]) === target) {
|
|
7555
|
+
return i;
|
|
7556
|
+
}
|
|
7557
|
+
}
|
|
7558
|
+
return -1;
|
|
7559
|
+
}
|
|
7665
7560
|
/**
|
|
7666
|
-
*
|
|
7561
|
+
* Locates the next tNode (child, sibling or parent).
|
|
7667
7562
|
*/
|
|
7668
|
-
|
|
7669
|
-
|
|
7563
|
+
function traverseNextElement(tNode) {
|
|
7564
|
+
if (tNode.child) {
|
|
7565
|
+
return tNode.child;
|
|
7566
|
+
}
|
|
7567
|
+
else if (tNode.next) {
|
|
7568
|
+
return tNode.next;
|
|
7569
|
+
}
|
|
7570
|
+
else {
|
|
7571
|
+
// Let's take the following template: <div><span>text</span></div><component/>
|
|
7572
|
+
// After checking the text node, we need to find the next parent that has a "next" TNode,
|
|
7573
|
+
// in this case the parent `div`, so that we can find the component.
|
|
7574
|
+
while (tNode.parent && !tNode.parent.next) {
|
|
7575
|
+
tNode = tNode.parent;
|
|
7576
|
+
}
|
|
7577
|
+
return tNode.parent && tNode.parent.next;
|
|
7578
|
+
}
|
|
7579
|
+
}
|
|
7670
7580
|
/**
|
|
7671
|
-
*
|
|
7672
|
-
*
|
|
7673
|
-
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
7674
|
-
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
7675
|
-
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
7676
|
-
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
7677
|
-
*
|
|
7678
|
-
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
7679
|
-
*
|
|
7680
|
-
* ```
|
|
7681
|
-
* div.innerHTML = div.innerHTML
|
|
7682
|
-
* ```
|
|
7683
|
-
*
|
|
7684
|
-
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
7685
|
-
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
7686
|
-
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
7687
|
-
* may contain such text and expect them to be safe.)
|
|
7688
|
-
*
|
|
7689
|
-
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
7690
|
-
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
7691
|
-
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
7692
|
-
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
7693
|
-
*
|
|
7694
|
-
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
7695
|
-
* sequence.
|
|
7581
|
+
* Locates the component within the given LView and returns the matching index
|
|
7696
7582
|
*/
|
|
7697
|
-
function
|
|
7698
|
-
|
|
7583
|
+
function findViaComponent(lView, componentInstance) {
|
|
7584
|
+
const componentIndices = lView[TVIEW].components;
|
|
7585
|
+
if (componentIndices) {
|
|
7586
|
+
for (let i = 0; i < componentIndices.length; i++) {
|
|
7587
|
+
const elementComponentIndex = componentIndices[i];
|
|
7588
|
+
const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
|
|
7589
|
+
if (componentView[CONTEXT] === componentInstance) {
|
|
7590
|
+
return elementComponentIndex;
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
}
|
|
7594
|
+
else {
|
|
7595
|
+
const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
|
|
7596
|
+
const rootComponent = rootComponentView[CONTEXT];
|
|
7597
|
+
if (rootComponent === componentInstance) {
|
|
7598
|
+
// we are dealing with the root element here therefore we know that the
|
|
7599
|
+
// element is the very first element after the HEADER data in the lView
|
|
7600
|
+
return HEADER_OFFSET;
|
|
7601
|
+
}
|
|
7602
|
+
}
|
|
7603
|
+
return -1;
|
|
7699
7604
|
}
|
|
7700
|
-
|
|
7701
7605
|
/**
|
|
7702
|
-
*
|
|
7703
|
-
* Copyright Google LLC All Rights Reserved.
|
|
7704
|
-
*
|
|
7705
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7706
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7606
|
+
* Locates the directive within the given LView and returns the matching index
|
|
7707
7607
|
*/
|
|
7708
|
-
function
|
|
7709
|
-
//
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7608
|
+
function findViaDirective(lView, directiveInstance) {
|
|
7609
|
+
// if a directive is monkey patched then it will (by default)
|
|
7610
|
+
// have a reference to the LView of the current view. The
|
|
7611
|
+
// element bound to the directive being search lives somewhere
|
|
7612
|
+
// in the view data. We loop through the nodes and check their
|
|
7613
|
+
// list of directives for the instance.
|
|
7614
|
+
let tNode = lView[TVIEW].firstChild;
|
|
7615
|
+
while (tNode) {
|
|
7616
|
+
const directiveIndexStart = tNode.directiveStart;
|
|
7617
|
+
const directiveIndexEnd = tNode.directiveEnd;
|
|
7618
|
+
for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
|
|
7619
|
+
if (lView[i] === directiveInstance) {
|
|
7620
|
+
return tNode.index;
|
|
7621
|
+
}
|
|
7622
|
+
}
|
|
7623
|
+
tNode = traverseNextElement(tNode);
|
|
7724
7624
|
}
|
|
7625
|
+
return -1;
|
|
7725
7626
|
}
|
|
7726
|
-
|
|
7727
7627
|
/**
|
|
7728
|
-
*
|
|
7729
|
-
*
|
|
7628
|
+
* Returns a list of directives applied to a node at a specific index. The list includes
|
|
7629
|
+
* directives matched by selector and any host directives, but it excludes components.
|
|
7630
|
+
* Use `getComponentAtNodeIndex` to find the component applied to a node.
|
|
7730
7631
|
*
|
|
7731
|
-
*
|
|
7732
|
-
*
|
|
7632
|
+
* @param nodeIndex The node index
|
|
7633
|
+
* @param lView The target view data
|
|
7733
7634
|
*/
|
|
7734
|
-
|
|
7735
|
-
const
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7635
|
+
function getDirectivesAtNodeIndex(nodeIndex, lView) {
|
|
7636
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7637
|
+
if (tNode.directiveStart === 0)
|
|
7638
|
+
return EMPTY_ARRAY;
|
|
7639
|
+
const results = [];
|
|
7640
|
+
for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
|
|
7641
|
+
const directiveInstance = lView[i];
|
|
7642
|
+
if (!isComponentInstance(directiveInstance)) {
|
|
7643
|
+
results.push(directiveInstance);
|
|
7644
|
+
}
|
|
7645
|
+
}
|
|
7646
|
+
return results;
|
|
7746
7647
|
}
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
return
|
|
7648
|
+
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
7649
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7650
|
+
const { directiveStart, componentOffset } = tNode;
|
|
7651
|
+
return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
|
|
7751
7652
|
}
|
|
7752
|
-
/**
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7653
|
+
/**
|
|
7654
|
+
* Returns a map of local references (local reference name => element or directive instance) that
|
|
7655
|
+
* exist on a given element.
|
|
7656
|
+
*/
|
|
7657
|
+
function discoverLocalRefs(lView, nodeIndex) {
|
|
7658
|
+
const tNode = lView[TVIEW].data[nodeIndex];
|
|
7659
|
+
if (tNode && tNode.localNames) {
|
|
7660
|
+
const result = {};
|
|
7661
|
+
let localIndex = tNode.index + 1;
|
|
7662
|
+
for (let i = 0; i < tNode.localNames.length; i += 2) {
|
|
7663
|
+
result[tNode.localNames[i]] = lView[localIndex];
|
|
7664
|
+
localIndex++;
|
|
7665
|
+
}
|
|
7666
|
+
return result;
|
|
7667
|
+
}
|
|
7668
|
+
return null;
|
|
7756
7669
|
}
|
|
7757
7670
|
|
|
7758
7671
|
/**
|
|
@@ -7763,38 +7676,28 @@ function unregisterLView(lView) {
|
|
|
7763
7676
|
* found in the LICENSE file at https://angular.io/license
|
|
7764
7677
|
*/
|
|
7765
7678
|
/**
|
|
7766
|
-
*
|
|
7767
|
-
*
|
|
7768
|
-
*
|
|
7769
|
-
*
|
|
7679
|
+
* Defines a schema that allows an NgModule to contain the following:
|
|
7680
|
+
* - Non-Angular elements named with dash case (`-`).
|
|
7681
|
+
* - Element properties named with dash case (`-`).
|
|
7682
|
+
* Dash case is the naming convention for custom elements.
|
|
7770
7683
|
*
|
|
7771
|
-
*
|
|
7772
|
-
* function. The component, element and each directive instance will share the same instance
|
|
7773
|
-
* of the context.
|
|
7684
|
+
* @publicApi
|
|
7774
7685
|
*/
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
this.nodeIndex = nodeIndex;
|
|
7791
|
-
this.native = native;
|
|
7792
|
-
}
|
|
7793
|
-
/** Component's parent view data. */
|
|
7794
|
-
get lView() {
|
|
7795
|
-
return getLViewById(this.lViewId);
|
|
7796
|
-
}
|
|
7797
|
-
}
|
|
7686
|
+
const CUSTOM_ELEMENTS_SCHEMA = {
|
|
7687
|
+
name: 'custom-elements'
|
|
7688
|
+
};
|
|
7689
|
+
/**
|
|
7690
|
+
* Defines a schema that allows any property on any element.
|
|
7691
|
+
*
|
|
7692
|
+
* This schema allows you to ignore the errors related to any unknown elements or properties in a
|
|
7693
|
+
* template. The usage of this schema is generally discouraged because it prevents useful validation
|
|
7694
|
+
* and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
|
|
7695
|
+
*
|
|
7696
|
+
* @publicApi
|
|
7697
|
+
*/
|
|
7698
|
+
const NO_ERRORS_SCHEMA = {
|
|
7699
|
+
name: 'no-errors-schema'
|
|
7700
|
+
};
|
|
7798
7701
|
|
|
7799
7702
|
/**
|
|
7800
7703
|
* @license
|
|
@@ -7803,305 +7706,411 @@ class LContext {
|
|
|
7803
7706
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7804
7707
|
* found in the LICENSE file at https://angular.io/license
|
|
7805
7708
|
*/
|
|
7709
|
+
let shouldThrowErrorOnUnknownElement = false;
|
|
7806
7710
|
/**
|
|
7807
|
-
*
|
|
7808
|
-
*
|
|
7809
|
-
*
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
*
|
|
7816
|
-
|
|
7711
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
|
|
7712
|
+
* instead of just logging the error.
|
|
7713
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
7714
|
+
*/
|
|
7715
|
+
function ɵsetUnknownElementStrictMode(shouldThrow) {
|
|
7716
|
+
shouldThrowErrorOnUnknownElement = shouldThrow;
|
|
7717
|
+
}
|
|
7718
|
+
/**
|
|
7719
|
+
* Gets the current value of the strict mode.
|
|
7720
|
+
*/
|
|
7721
|
+
function ɵgetUnknownElementStrictMode() {
|
|
7722
|
+
return shouldThrowErrorOnUnknownElement;
|
|
7723
|
+
}
|
|
7724
|
+
let shouldThrowErrorOnUnknownProperty = false;
|
|
7725
|
+
/**
|
|
7726
|
+
* Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
|
|
7727
|
+
* instead of just logging the error.
|
|
7728
|
+
* (for AOT-compiled ones this check happens at build time).
|
|
7729
|
+
*/
|
|
7730
|
+
function ɵsetUnknownPropertyStrictMode(shouldThrow) {
|
|
7731
|
+
shouldThrowErrorOnUnknownProperty = shouldThrow;
|
|
7732
|
+
}
|
|
7733
|
+
/**
|
|
7734
|
+
* Gets the current value of the strict mode.
|
|
7735
|
+
*/
|
|
7736
|
+
function ɵgetUnknownPropertyStrictMode() {
|
|
7737
|
+
return shouldThrowErrorOnUnknownProperty;
|
|
7738
|
+
}
|
|
7739
|
+
/**
|
|
7740
|
+
* Validates that the element is known at runtime and produces
|
|
7741
|
+
* an error if it's not the case.
|
|
7742
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
7743
|
+
* ones this check happens at build time).
|
|
7817
7744
|
*
|
|
7818
|
-
*
|
|
7819
|
-
*
|
|
7820
|
-
*
|
|
7821
|
-
*
|
|
7822
|
-
*
|
|
7745
|
+
* The element is considered known if either:
|
|
7746
|
+
* - it's a known HTML element
|
|
7747
|
+
* - it's a known custom element
|
|
7748
|
+
* - the element matches any directive
|
|
7749
|
+
* - the element is allowed by one of the schemas
|
|
7823
7750
|
*
|
|
7824
|
-
* @param
|
|
7751
|
+
* @param element Element to validate
|
|
7752
|
+
* @param lView An `LView` that represents a current component that is being rendered
|
|
7753
|
+
* @param tagName Name of the tag to check
|
|
7754
|
+
* @param schemas Array of schemas
|
|
7755
|
+
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
7825
7756
|
*/
|
|
7826
|
-
function
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7757
|
+
function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
|
|
7758
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
7759
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
7760
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
7761
|
+
// execute the check below.
|
|
7762
|
+
if (schemas === null)
|
|
7763
|
+
return;
|
|
7764
|
+
// If the element matches any directive, it's considered as valid.
|
|
7765
|
+
if (!hasDirectives && tagName !== null) {
|
|
7766
|
+
// The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
|
|
7767
|
+
// as a custom element. Note that unknown elements with a dash in their name won't be instances
|
|
7768
|
+
// of HTMLUnknownElement in browsers that support web components.
|
|
7769
|
+
const isUnknown =
|
|
7770
|
+
// Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
|
|
7771
|
+
// because while most browsers return 'function', IE returns 'object'.
|
|
7772
|
+
(typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
|
7773
|
+
element instanceof HTMLUnknownElement) ||
|
|
7774
|
+
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
7775
|
+
!customElements.get(tagName));
|
|
7776
|
+
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
7777
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
7778
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
7779
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
7780
|
+
let message = `'${tagName}' is not a known element${templateLocation}:\n`;
|
|
7781
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
7782
|
+
'a part of an @NgModule where this component is declared'}.\n`;
|
|
7783
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
7784
|
+
message +=
|
|
7785
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
7849
7786
|
}
|
|
7850
7787
|
else {
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
return null;
|
|
7854
|
-
}
|
|
7788
|
+
message +=
|
|
7789
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
7855
7790
|
}
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
// expression or directive details) are filled into the context. If called multiple times
|
|
7859
|
-
// with different target values then the missing target data will be filled in.
|
|
7860
|
-
const native = unwrapRNode(lView[nodeIndex]);
|
|
7861
|
-
const existingCtx = readPatchedData(native);
|
|
7862
|
-
const context = (existingCtx && !Array.isArray(existingCtx)) ?
|
|
7863
|
-
existingCtx :
|
|
7864
|
-
createLContext(lView, nodeIndex, native);
|
|
7865
|
-
// only when the component has been discovered then update the monkey-patch
|
|
7866
|
-
if (component && context.component === undefined) {
|
|
7867
|
-
context.component = component;
|
|
7868
|
-
attachPatchData(context.component, context);
|
|
7791
|
+
if (shouldThrowErrorOnUnknownElement) {
|
|
7792
|
+
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
7869
7793
|
}
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
context.directives = directives;
|
|
7873
|
-
for (let i = 0; i < directives.length; i++) {
|
|
7874
|
-
attachPatchData(directives[i], context);
|
|
7875
|
-
}
|
|
7794
|
+
else {
|
|
7795
|
+
console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
|
|
7876
7796
|
}
|
|
7877
|
-
attachPatchData(context.native, context);
|
|
7878
|
-
mpValue = context;
|
|
7879
7797
|
}
|
|
7880
7798
|
}
|
|
7799
|
+
}
|
|
7800
|
+
/**
|
|
7801
|
+
* Validates that the property of the element is known at runtime and returns
|
|
7802
|
+
* false if it's not the case.
|
|
7803
|
+
* This check is relevant for JIT-compiled components (for AOT-compiled
|
|
7804
|
+
* ones this check happens at build time).
|
|
7805
|
+
*
|
|
7806
|
+
* The property is considered known if either:
|
|
7807
|
+
* - it's a known property of the element
|
|
7808
|
+
* - the element is allowed by one of the schemas
|
|
7809
|
+
* - the property is used for animations
|
|
7810
|
+
*
|
|
7811
|
+
* @param element Element to validate
|
|
7812
|
+
* @param propName Name of the property to check
|
|
7813
|
+
* @param tagName Name of the tag hosting the property
|
|
7814
|
+
* @param schemas Array of schemas
|
|
7815
|
+
*/
|
|
7816
|
+
function isPropertyValid(element, propName, tagName, schemas) {
|
|
7817
|
+
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
7818
|
+
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
7819
|
+
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
7820
|
+
// execute the check below.
|
|
7821
|
+
if (schemas === null)
|
|
7822
|
+
return true;
|
|
7823
|
+
// The property is considered valid if the element matches the schema, it exists on the element,
|
|
7824
|
+
// or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
|
|
7825
|
+
if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
|
|
7826
|
+
return true;
|
|
7827
|
+
}
|
|
7828
|
+
// Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
|
|
7829
|
+
// need to account for both here, while being careful with `typeof null` also returning 'object'.
|
|
7830
|
+
return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
|
7831
|
+
}
|
|
7832
|
+
/**
|
|
7833
|
+
* Logs or throws an error that a property is not supported on an element.
|
|
7834
|
+
*
|
|
7835
|
+
* @param propName Name of the invalid property
|
|
7836
|
+
* @param tagName Name of the tag hosting the property
|
|
7837
|
+
* @param nodeType Type of the node hosting the property
|
|
7838
|
+
* @param lView An `LView` that represents a current component
|
|
7839
|
+
*/
|
|
7840
|
+
function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
|
|
7841
|
+
// Special-case a situation when a structural directive is applied to
|
|
7842
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
7843
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
7844
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
7845
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
7846
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
7847
|
+
if (!tagName && nodeType === 4 /* TNodeType.Container */) {
|
|
7848
|
+
tagName = 'ng-template';
|
|
7849
|
+
}
|
|
7850
|
+
const isHostStandalone = isHostComponentStandalone(lView);
|
|
7851
|
+
const templateLocation = getTemplateLocationDetails(lView);
|
|
7852
|
+
let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
|
|
7853
|
+
const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
7854
|
+
const importLocation = isHostStandalone ?
|
|
7855
|
+
'included in the \'@Component.imports\' of this component' :
|
|
7856
|
+
'a part of an @NgModule where this component is declared';
|
|
7857
|
+
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
7858
|
+
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
7859
|
+
// a template, but the directive or the `CommonModule` is not imported.
|
|
7860
|
+
const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
|
|
7861
|
+
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
7862
|
+
`please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
|
|
7863
|
+
}
|
|
7881
7864
|
else {
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
//
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
}
|
|
7896
|
-
const index = findViaNativeElement(lView, rElement);
|
|
7897
|
-
if (index >= 0) {
|
|
7898
|
-
const native = unwrapRNode(lView[index]);
|
|
7899
|
-
const context = createLContext(lView, index, native);
|
|
7900
|
-
attachPatchData(native, context);
|
|
7901
|
-
mpValue = context;
|
|
7902
|
-
break;
|
|
7903
|
-
}
|
|
7904
|
-
}
|
|
7865
|
+
// May be an Angular component, which is not imported/declared?
|
|
7866
|
+
message += `\n1. If '${tagName}' is an Angular component and it has the ` +
|
|
7867
|
+
`'${propName}' input, then verify that it is ${importLocation}.`;
|
|
7868
|
+
// May be a Web Component?
|
|
7869
|
+
if (tagName && tagName.indexOf('-') > -1) {
|
|
7870
|
+
message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
|
|
7871
|
+
`to the ${schemas} of this component to suppress this message.`;
|
|
7872
|
+
message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
7873
|
+
`the ${schemas} of this component.`;
|
|
7874
|
+
}
|
|
7875
|
+
else {
|
|
7876
|
+
// If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
|
|
7877
|
+
message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
|
|
7878
|
+
`the ${schemas} of this component.`;
|
|
7905
7879
|
}
|
|
7906
7880
|
}
|
|
7907
|
-
|
|
7908
|
-
}
|
|
7909
|
-
/**
|
|
7910
|
-
* Creates an empty instance of a `LContext` context
|
|
7911
|
-
*/
|
|
7912
|
-
function createLContext(lView, nodeIndex, native) {
|
|
7913
|
-
return new LContext(lView[ID], nodeIndex, native);
|
|
7881
|
+
reportUnknownPropertyError(message);
|
|
7914
7882
|
}
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
* @param componentInstance
|
|
7919
|
-
* @returns The component's view
|
|
7920
|
-
*/
|
|
7921
|
-
function getComponentViewByInstance(componentInstance) {
|
|
7922
|
-
let patchedData = readPatchedData(componentInstance);
|
|
7923
|
-
let lView;
|
|
7924
|
-
if (isLView(patchedData)) {
|
|
7925
|
-
const contextLView = patchedData;
|
|
7926
|
-
const nodeIndex = findViaComponent(contextLView, componentInstance);
|
|
7927
|
-
lView = getComponentLViewByIndex(nodeIndex, contextLView);
|
|
7928
|
-
const context = createLContext(contextLView, nodeIndex, lView[HOST]);
|
|
7929
|
-
context.component = componentInstance;
|
|
7930
|
-
attachPatchData(componentInstance, context);
|
|
7931
|
-
attachPatchData(context.native, context);
|
|
7883
|
+
function reportUnknownPropertyError(message) {
|
|
7884
|
+
if (shouldThrowErrorOnUnknownProperty) {
|
|
7885
|
+
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
7932
7886
|
}
|
|
7933
7887
|
else {
|
|
7934
|
-
|
|
7935
|
-
const contextLView = context.lView;
|
|
7936
|
-
ngDevMode && assertLView(contextLView);
|
|
7937
|
-
lView = getComponentLViewByIndex(context.nodeIndex, contextLView);
|
|
7888
|
+
console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
|
|
7938
7889
|
}
|
|
7939
|
-
return lView;
|
|
7940
7890
|
}
|
|
7941
7891
|
/**
|
|
7942
|
-
*
|
|
7892
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
7893
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
7894
|
+
* be too slow for production mode and also it relies on the constructor function being available.
|
|
7895
|
+
*
|
|
7896
|
+
* Gets a reference to the host component def (where a current component is declared).
|
|
7897
|
+
*
|
|
7898
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
7943
7899
|
*/
|
|
7944
|
-
|
|
7900
|
+
function getDeclarationComponentDef(lView) {
|
|
7901
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
7902
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
7903
|
+
const context = declarationLView[CONTEXT];
|
|
7904
|
+
// Unable to obtain a context.
|
|
7905
|
+
if (!context)
|
|
7906
|
+
return null;
|
|
7907
|
+
return context.constructor ? getComponentDef(context.constructor) : null;
|
|
7908
|
+
}
|
|
7945
7909
|
/**
|
|
7946
|
-
*
|
|
7947
|
-
*
|
|
7910
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
7911
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
7912
|
+
* be too slow for production mode.
|
|
7913
|
+
*
|
|
7914
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
7915
|
+
*
|
|
7916
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
7948
7917
|
*/
|
|
7949
|
-
function
|
|
7950
|
-
ngDevMode &&
|
|
7951
|
-
|
|
7952
|
-
//
|
|
7953
|
-
|
|
7954
|
-
if (isLView(data)) {
|
|
7955
|
-
target[MONKEY_PATCH_KEY_NAME] = data[ID];
|
|
7956
|
-
registerLView(data);
|
|
7957
|
-
}
|
|
7958
|
-
else {
|
|
7959
|
-
target[MONKEY_PATCH_KEY_NAME] = data;
|
|
7960
|
-
}
|
|
7918
|
+
function isHostComponentStandalone(lView) {
|
|
7919
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
7920
|
+
const componentDef = getDeclarationComponentDef(lView);
|
|
7921
|
+
// Treat host component as non-standalone if we can't obtain the def.
|
|
7922
|
+
return !!componentDef?.standalone;
|
|
7961
7923
|
}
|
|
7962
7924
|
/**
|
|
7963
|
-
*
|
|
7964
|
-
*
|
|
7925
|
+
* WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
|
|
7926
|
+
* and must **not** be used in production bundles. The function makes megamorphic reads, which might
|
|
7927
|
+
* be too slow for production mode.
|
|
7928
|
+
*
|
|
7929
|
+
* Constructs a string describing the location of the host component template. The function is used
|
|
7930
|
+
* in dev mode to produce error messages.
|
|
7931
|
+
*
|
|
7932
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
7965
7933
|
*/
|
|
7966
|
-
function
|
|
7967
|
-
ngDevMode &&
|
|
7968
|
-
const
|
|
7969
|
-
|
|
7970
|
-
}
|
|
7971
|
-
function readPatchedLView(target) {
|
|
7972
|
-
const value = readPatchedData(target);
|
|
7973
|
-
if (value) {
|
|
7974
|
-
return (isLView(value) ? value : value.lView);
|
|
7975
|
-
}
|
|
7976
|
-
return null;
|
|
7977
|
-
}
|
|
7978
|
-
function isComponentInstance(instance) {
|
|
7979
|
-
return instance && instance.constructor && instance.constructor.ɵcmp;
|
|
7980
|
-
}
|
|
7981
|
-
function isDirectiveInstance(instance) {
|
|
7982
|
-
return instance && instance.constructor && instance.constructor.ɵdir;
|
|
7934
|
+
function getTemplateLocationDetails(lView) {
|
|
7935
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
7936
|
+
const hostComponentDef = getDeclarationComponentDef(lView);
|
|
7937
|
+
const componentClassName = hostComponentDef?.type?.name;
|
|
7938
|
+
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
7983
7939
|
}
|
|
7984
7940
|
/**
|
|
7985
|
-
*
|
|
7941
|
+
* The set of known control flow directives and their corresponding imports.
|
|
7942
|
+
* We use this set to produce a more precises error message with a note
|
|
7943
|
+
* that the `CommonModule` should also be included.
|
|
7986
7944
|
*/
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7945
|
+
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
|
|
7946
|
+
['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
|
|
7947
|
+
['ngSwitchDefault', 'NgSwitchDefault']
|
|
7948
|
+
]);
|
|
7949
|
+
/**
|
|
7950
|
+
* Returns true if the tag name is allowed by specified schemas.
|
|
7951
|
+
* @param schemas Array of schemas
|
|
7952
|
+
* @param tagName Name of the tag
|
|
7953
|
+
*/
|
|
7954
|
+
function matchingSchemas(schemas, tagName) {
|
|
7955
|
+
if (schemas !== null) {
|
|
7956
|
+
for (let i = 0; i < schemas.length; i++) {
|
|
7957
|
+
const schema = schemas[i];
|
|
7958
|
+
if (schema === NO_ERRORS_SCHEMA ||
|
|
7959
|
+
schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
|
7960
|
+
return true;
|
|
7961
|
+
}
|
|
7992
7962
|
}
|
|
7993
7963
|
}
|
|
7994
|
-
return
|
|
7964
|
+
return false;
|
|
7995
7965
|
}
|
|
7966
|
+
|
|
7996
7967
|
/**
|
|
7997
|
-
*
|
|
7968
|
+
* @license
|
|
7969
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7970
|
+
*
|
|
7971
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7972
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7998
7973
|
*/
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
}
|
|
8006
|
-
else {
|
|
8007
|
-
// Let's take the following template: <div><span>text</span></div><component/>
|
|
8008
|
-
// After checking the text node, we need to find the next parent that has a "next" TNode,
|
|
8009
|
-
// in this case the parent `div`, so that we can find the component.
|
|
8010
|
-
while (tNode.parent && !tNode.parent.next) {
|
|
8011
|
-
tNode = tNode.parent;
|
|
8012
|
-
}
|
|
8013
|
-
return tNode.parent && tNode.parent.next;
|
|
8014
|
-
}
|
|
7974
|
+
const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
|
7975
|
+
function wrappedError(message, originalError) {
|
|
7976
|
+
const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
|
7977
|
+
const error = Error(msg);
|
|
7978
|
+
error[ERROR_ORIGINAL_ERROR] = originalError;
|
|
7979
|
+
return error;
|
|
8015
7980
|
}
|
|
7981
|
+
function getOriginalError(error) {
|
|
7982
|
+
return error[ERROR_ORIGINAL_ERROR];
|
|
7983
|
+
}
|
|
7984
|
+
|
|
8016
7985
|
/**
|
|
8017
|
-
*
|
|
7986
|
+
* @license
|
|
7987
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7988
|
+
*
|
|
7989
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7990
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8018
7991
|
*/
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
7992
|
+
/**
|
|
7993
|
+
* Provides a hook for centralized exception handling.
|
|
7994
|
+
*
|
|
7995
|
+
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
7996
|
+
* intercept error handling, write a custom exception handler that replaces this default as
|
|
7997
|
+
* appropriate for your app.
|
|
7998
|
+
*
|
|
7999
|
+
* @usageNotes
|
|
8000
|
+
* ### Example
|
|
8001
|
+
*
|
|
8002
|
+
* ```
|
|
8003
|
+
* class MyErrorHandler implements ErrorHandler {
|
|
8004
|
+
* handleError(error) {
|
|
8005
|
+
* // do something with the exception
|
|
8006
|
+
* }
|
|
8007
|
+
* }
|
|
8008
|
+
*
|
|
8009
|
+
* @NgModule({
|
|
8010
|
+
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
8011
|
+
* })
|
|
8012
|
+
* class MyModule {}
|
|
8013
|
+
* ```
|
|
8014
|
+
*
|
|
8015
|
+
* @publicApi
|
|
8016
|
+
*/
|
|
8017
|
+
class ErrorHandler {
|
|
8018
|
+
constructor() {
|
|
8019
|
+
/**
|
|
8020
|
+
* @internal
|
|
8021
|
+
*/
|
|
8022
|
+
this._console = console;
|
|
8029
8023
|
}
|
|
8030
|
-
|
|
8031
|
-
const
|
|
8032
|
-
|
|
8033
|
-
if (
|
|
8034
|
-
|
|
8035
|
-
// element is the very first element after the HEADER data in the lView
|
|
8036
|
-
return HEADER_OFFSET;
|
|
8024
|
+
handleError(error) {
|
|
8025
|
+
const originalError = this._findOriginalError(error);
|
|
8026
|
+
this._console.error('ERROR', error);
|
|
8027
|
+
if (originalError) {
|
|
8028
|
+
this._console.error('ORIGINAL ERROR', originalError);
|
|
8037
8029
|
}
|
|
8038
8030
|
}
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
function findViaDirective(lView, directiveInstance) {
|
|
8045
|
-
// if a directive is monkey patched then it will (by default)
|
|
8046
|
-
// have a reference to the LView of the current view. The
|
|
8047
|
-
// element bound to the directive being search lives somewhere
|
|
8048
|
-
// in the view data. We loop through the nodes and check their
|
|
8049
|
-
// list of directives for the instance.
|
|
8050
|
-
let tNode = lView[TVIEW].firstChild;
|
|
8051
|
-
while (tNode) {
|
|
8052
|
-
const directiveIndexStart = tNode.directiveStart;
|
|
8053
|
-
const directiveIndexEnd = tNode.directiveEnd;
|
|
8054
|
-
for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
|
|
8055
|
-
if (lView[i] === directiveInstance) {
|
|
8056
|
-
return tNode.index;
|
|
8057
|
-
}
|
|
8031
|
+
/** @internal */
|
|
8032
|
+
_findOriginalError(error) {
|
|
8033
|
+
let e = error && getOriginalError(error);
|
|
8034
|
+
while (e && getOriginalError(e)) {
|
|
8035
|
+
e = getOriginalError(e);
|
|
8058
8036
|
}
|
|
8059
|
-
|
|
8037
|
+
return e || null;
|
|
8060
8038
|
}
|
|
8061
|
-
return -1;
|
|
8062
8039
|
}
|
|
8040
|
+
|
|
8063
8041
|
/**
|
|
8064
|
-
*
|
|
8065
|
-
*
|
|
8042
|
+
* @license
|
|
8043
|
+
* Copyright Google LLC All Rights Reserved.
|
|
8066
8044
|
*
|
|
8067
|
-
*
|
|
8068
|
-
*
|
|
8069
|
-
* @param includeComponents Whether or not to include components in returned directives
|
|
8045
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8046
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8070
8047
|
*/
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8048
|
+
/**
|
|
8049
|
+
* Disallowed strings in the comment.
|
|
8050
|
+
*
|
|
8051
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
8052
|
+
*/
|
|
8053
|
+
const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
8054
|
+
/**
|
|
8055
|
+
* Delimiter in the disallowed strings which needs to be wrapped with zero with character.
|
|
8056
|
+
*/
|
|
8057
|
+
const COMMENT_DELIMITER = /(<|>)/;
|
|
8058
|
+
const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
|
8059
|
+
/**
|
|
8060
|
+
* Escape the content of comment strings so that it can be safely inserted into a comment node.
|
|
8061
|
+
*
|
|
8062
|
+
* The issue is that HTML does not specify any way to escape comment end text inside the comment.
|
|
8063
|
+
* Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
|
|
8064
|
+
* "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
|
|
8065
|
+
* can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
|
|
8066
|
+
*
|
|
8067
|
+
* see: https://html.spec.whatwg.org/multipage/syntax.html#comments
|
|
8068
|
+
*
|
|
8069
|
+
* ```
|
|
8070
|
+
* div.innerHTML = div.innerHTML
|
|
8071
|
+
* ```
|
|
8072
|
+
*
|
|
8073
|
+
* One would expect that the above code would be safe to do, but it turns out that because comment
|
|
8074
|
+
* text is not escaped, the comment may contain text which will prematurely close the comment
|
|
8075
|
+
* opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
|
|
8076
|
+
* may contain such text and expect them to be safe.)
|
|
8077
|
+
*
|
|
8078
|
+
* This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
|
|
8079
|
+
* surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
|
|
8080
|
+
* comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
|
|
8081
|
+
* text it will render normally but it will not cause the HTML parser to close/open the comment.
|
|
8082
|
+
*
|
|
8083
|
+
* @param value text to make safe for comment node by escaping the comment open/close character
|
|
8084
|
+
* sequence.
|
|
8085
|
+
*/
|
|
8086
|
+
function escapeCommentText(value) {
|
|
8087
|
+
return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
|
8088
8088
|
}
|
|
8089
|
+
|
|
8089
8090
|
/**
|
|
8090
|
-
*
|
|
8091
|
-
*
|
|
8091
|
+
* @license
|
|
8092
|
+
* Copyright Google LLC All Rights Reserved.
|
|
8093
|
+
*
|
|
8094
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8095
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8092
8096
|
*/
|
|
8093
|
-
function
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8097
|
+
function normalizeDebugBindingName(name) {
|
|
8098
|
+
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
|
|
8099
|
+
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
|
8100
|
+
return `ng-reflect-${name}`;
|
|
8101
|
+
}
|
|
8102
|
+
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
|
8103
|
+
function camelCaseToDashCase(input) {
|
|
8104
|
+
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
|
8105
|
+
}
|
|
8106
|
+
function normalizeDebugBindingValue(value) {
|
|
8107
|
+
try {
|
|
8108
|
+
// Limit the size of the value as otherwise the DOM just gets polluted.
|
|
8109
|
+
return value != null ? value.toString().slice(0, 30) : value;
|
|
8110
|
+
}
|
|
8111
|
+
catch (e) {
|
|
8112
|
+
return '[ERROR] Exception while trying to serialize the value';
|
|
8103
8113
|
}
|
|
8104
|
-
return null;
|
|
8105
8114
|
}
|
|
8106
8115
|
|
|
8107
8116
|
/**
|
|
@@ -9320,6 +9329,19 @@ function writeDirectClass(renderer, element, newValue) {
|
|
|
9320
9329
|
}
|
|
9321
9330
|
ngDevMode && ngDevMode.rendererSetClassName++;
|
|
9322
9331
|
}
|
|
9332
|
+
/** Sets up the static DOM attributes on an `RNode`. */
|
|
9333
|
+
function setupStaticAttributes(renderer, element, tNode) {
|
|
9334
|
+
const { mergedAttrs, classes, styles } = tNode;
|
|
9335
|
+
if (mergedAttrs !== null) {
|
|
9336
|
+
setUpAttributes(renderer, element, mergedAttrs);
|
|
9337
|
+
}
|
|
9338
|
+
if (classes !== null) {
|
|
9339
|
+
writeDirectClass(renderer, element, classes);
|
|
9340
|
+
}
|
|
9341
|
+
if (styles !== null) {
|
|
9342
|
+
writeDirectStyle(renderer, element, styles);
|
|
9343
|
+
}
|
|
9344
|
+
}
|
|
9323
9345
|
|
|
9324
9346
|
/**
|
|
9325
9347
|
* @license
|
|
@@ -12261,9 +12283,6 @@ function createViewBlueprint(bindingStartIndex, initialViewLength) {
|
|
|
12261
12283
|
}
|
|
12262
12284
|
return blueprint;
|
|
12263
12285
|
}
|
|
12264
|
-
function createError(text, token) {
|
|
12265
|
-
return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
|
|
12266
|
-
}
|
|
12267
12286
|
/**
|
|
12268
12287
|
* Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
|
|
12269
12288
|
*
|
|
@@ -12387,26 +12406,49 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12387
12406
|
}
|
|
12388
12407
|
return tNode;
|
|
12389
12408
|
}
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12409
|
+
/**
|
|
12410
|
+
* Generates the `PropertyAliases` data structure from the provided input/output mapping.
|
|
12411
|
+
* @param aliasMap Input/output mapping from the directive definition.
|
|
12412
|
+
* @param directiveIndex Index of the directive.
|
|
12413
|
+
* @param propertyAliases Object in which to store the results.
|
|
12414
|
+
* @param hostDirectiveAliasMap Object used to alias or filter out properties for host directives.
|
|
12415
|
+
* If the mapping is provided, it'll act as an allowlist, as well as a mapping of what public
|
|
12416
|
+
* name inputs/outputs should be exposed under.
|
|
12417
|
+
*/
|
|
12418
|
+
function generatePropertyAliases(aliasMap, directiveIndex, propertyAliases, hostDirectiveAliasMap) {
|
|
12419
|
+
for (let publicName in aliasMap) {
|
|
12420
|
+
if (aliasMap.hasOwnProperty(publicName)) {
|
|
12421
|
+
propertyAliases = propertyAliases === null ? {} : propertyAliases;
|
|
12422
|
+
const internalName = aliasMap[publicName];
|
|
12423
|
+
// If there are no host directive mappings, we want to remap using the alias map from the
|
|
12424
|
+
// definition itself. If there is an alias map, it has two functions:
|
|
12425
|
+
// 1. It serves as an allowlist of bindings that are exposed by the host directives. Only the
|
|
12426
|
+
// ones inside the host directive map will be exposed on the host.
|
|
12427
|
+
// 2. The public name of the property is aliased using the host directive alias map, rather
|
|
12428
|
+
// than the alias map from the definition.
|
|
12429
|
+
if (hostDirectiveAliasMap === null) {
|
|
12430
|
+
addPropertyAlias(propertyAliases, directiveIndex, publicName, internalName);
|
|
12397
12431
|
}
|
|
12398
|
-
else {
|
|
12399
|
-
(
|
|
12432
|
+
else if (hostDirectiveAliasMap.hasOwnProperty(publicName)) {
|
|
12433
|
+
addPropertyAlias(propertyAliases, directiveIndex, hostDirectiveAliasMap[publicName], internalName);
|
|
12400
12434
|
}
|
|
12401
12435
|
}
|
|
12402
12436
|
}
|
|
12403
|
-
return
|
|
12437
|
+
return propertyAliases;
|
|
12438
|
+
}
|
|
12439
|
+
function addPropertyAlias(propertyAliases, directiveIndex, publicName, internalName) {
|
|
12440
|
+
if (propertyAliases.hasOwnProperty(publicName)) {
|
|
12441
|
+
propertyAliases[publicName].push(directiveIndex, internalName);
|
|
12442
|
+
}
|
|
12443
|
+
else {
|
|
12444
|
+
propertyAliases[publicName] = [directiveIndex, internalName];
|
|
12445
|
+
}
|
|
12404
12446
|
}
|
|
12405
12447
|
/**
|
|
12406
12448
|
* Initializes data structures required to work with directive inputs and outputs.
|
|
12407
12449
|
* Initialization is done for all directives matched on a given TNode.
|
|
12408
12450
|
*/
|
|
12409
|
-
function initializeInputAndOutputAliases(tView, tNode) {
|
|
12451
|
+
function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) {
|
|
12410
12452
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12411
12453
|
const start = tNode.directiveStart;
|
|
12412
12454
|
const end = tNode.directiveEnd;
|
|
@@ -12415,16 +12457,21 @@ function initializeInputAndOutputAliases(tView, tNode) {
|
|
|
12415
12457
|
const inputsFromAttrs = ngDevMode ? new TNodeInitialInputs() : [];
|
|
12416
12458
|
let inputsStore = null;
|
|
12417
12459
|
let outputsStore = null;
|
|
12418
|
-
for (let
|
|
12419
|
-
const directiveDef = tViewData[
|
|
12420
|
-
|
|
12421
|
-
|
|
12460
|
+
for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
|
12461
|
+
const directiveDef = tViewData[directiveIndex];
|
|
12462
|
+
const aliasData = hostDirectiveDefinitionMap ? hostDirectiveDefinitionMap.get(directiveDef) : null;
|
|
12463
|
+
const aliasedInputs = aliasData ? aliasData.inputs : null;
|
|
12464
|
+
const aliasedOutputs = aliasData ? aliasData.outputs : null;
|
|
12465
|
+
inputsStore =
|
|
12466
|
+
generatePropertyAliases(directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs);
|
|
12467
|
+
outputsStore =
|
|
12468
|
+
generatePropertyAliases(directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs);
|
|
12422
12469
|
// Do not use unbound attributes as inputs to structural directives, since structural
|
|
12423
12470
|
// directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
|
|
12424
12471
|
// TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
|
|
12425
12472
|
// should be set for inline templates.
|
|
12426
12473
|
const initialInputs = (inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12427
|
-
generateInitialInputs(inputsStore,
|
|
12474
|
+
generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs) :
|
|
12428
12475
|
null;
|
|
12429
12476
|
inputsFromAttrs.push(initialInputs);
|
|
12430
12477
|
}
|
|
@@ -12540,28 +12587,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
|
|
|
12540
12587
|
}
|
|
12541
12588
|
}
|
|
12542
12589
|
}
|
|
12543
|
-
/**
|
|
12544
|
-
* Instantiate a root component.
|
|
12545
|
-
*/
|
|
12546
|
-
function instantiateRootComponent(tView, lView, def) {
|
|
12547
|
-
const rootTNode = getCurrentTNode();
|
|
12548
|
-
if (tView.firstCreatePass) {
|
|
12549
|
-
if (def.providersResolver)
|
|
12550
|
-
def.providersResolver(def);
|
|
12551
|
-
const directiveIndex = allocExpando(tView, lView, 1, null);
|
|
12552
|
-
ngDevMode &&
|
|
12553
|
-
assertEqual(directiveIndex, rootTNode.directiveStart, 'Because this is a root component the allocated expando should match the TNode component.');
|
|
12554
|
-
configureViewWithDirective(tView, rootTNode, lView, directiveIndex, def);
|
|
12555
|
-
initializeInputAndOutputAliases(tView, rootTNode);
|
|
12556
|
-
}
|
|
12557
|
-
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
|
|
12558
|
-
attachPatchData(directive, lView);
|
|
12559
|
-
const native = getNativeByTNode(rootTNode, lView);
|
|
12560
|
-
if (native) {
|
|
12561
|
-
attachPatchData(native, lView);
|
|
12562
|
-
}
|
|
12563
|
-
return directive;
|
|
12564
|
-
}
|
|
12565
12590
|
/**
|
|
12566
12591
|
* Resolve the matched directives on a node.
|
|
12567
12592
|
*/
|
|
@@ -12571,59 +12596,19 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12571
12596
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12572
12597
|
let hasDirectives = false;
|
|
12573
12598
|
if (getBindingsEnabled()) {
|
|
12574
|
-
const directiveDefsMatchedBySelectors = findDirectiveDefMatches(tView, lView, tNode);
|
|
12575
|
-
const directiveDefs = directiveDefsMatchedBySelectors ?
|
|
12576
|
-
findHostDirectiveDefs$1(directiveDefsMatchedBySelectors, tView, lView, tNode) :
|
|
12577
|
-
null;
|
|
12578
12599
|
const exportsMap = localRefs === null ? null : { '': -1 };
|
|
12600
|
+
const matchResult = findDirectiveDefMatches(tView, tNode);
|
|
12601
|
+
let directiveDefs;
|
|
12602
|
+
let hostDirectiveDefs;
|
|
12603
|
+
if (matchResult === null) {
|
|
12604
|
+
directiveDefs = hostDirectiveDefs = null;
|
|
12605
|
+
}
|
|
12606
|
+
else {
|
|
12607
|
+
[directiveDefs, hostDirectiveDefs] = matchResult;
|
|
12608
|
+
}
|
|
12579
12609
|
if (directiveDefs !== null) {
|
|
12580
12610
|
hasDirectives = true;
|
|
12581
|
-
|
|
12582
|
-
// When the same token is provided by several directives on the same node, some rules apply in
|
|
12583
|
-
// the viewEngine:
|
|
12584
|
-
// - viewProviders have priority over providers
|
|
12585
|
-
// - the last directive in NgModule.declarations has priority over the previous one
|
|
12586
|
-
// So to match these rules, the order in which providers are added in the arrays is very
|
|
12587
|
-
// important.
|
|
12588
|
-
for (let i = 0; i < directiveDefs.length; i++) {
|
|
12589
|
-
const def = directiveDefs[i];
|
|
12590
|
-
if (def.providersResolver)
|
|
12591
|
-
def.providersResolver(def);
|
|
12592
|
-
}
|
|
12593
|
-
let preOrderHooksFound = false;
|
|
12594
|
-
let preOrderCheckHooksFound = false;
|
|
12595
|
-
let directiveIdx = allocExpando(tView, lView, directiveDefs.length, null);
|
|
12596
|
-
ngDevMode &&
|
|
12597
|
-
assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
|
|
12598
|
-
for (let i = 0; i < directiveDefs.length; i++) {
|
|
12599
|
-
const def = directiveDefs[i];
|
|
12600
|
-
// Merge the attrs in the order of matches. This assumes that the first directive is the
|
|
12601
|
-
// component itself, so that the component has the least priority.
|
|
12602
|
-
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
|
12603
|
-
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
12604
|
-
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
12605
|
-
if (def.contentQueries !== null)
|
|
12606
|
-
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
12607
|
-
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
12608
|
-
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
12609
|
-
const lifeCycleHooks = def.type.prototype;
|
|
12610
|
-
// Only push a node index into the preOrderHooks array if this is the first
|
|
12611
|
-
// pre-order hook found on this node.
|
|
12612
|
-
if (!preOrderHooksFound &&
|
|
12613
|
-
(lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
|
|
12614
|
-
// We will push the actual hook function into this array later during dir instantiation.
|
|
12615
|
-
// We cannot do it now because we must ensure hooks are registered in the same
|
|
12616
|
-
// order that directives are created (i.e. injection order).
|
|
12617
|
-
(tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index);
|
|
12618
|
-
preOrderHooksFound = true;
|
|
12619
|
-
}
|
|
12620
|
-
if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
|
|
12621
|
-
(tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(tNode.index);
|
|
12622
|
-
preOrderCheckHooksFound = true;
|
|
12623
|
-
}
|
|
12624
|
-
directiveIdx++;
|
|
12625
|
-
}
|
|
12626
|
-
initializeInputAndOutputAliases(tView, tNode);
|
|
12611
|
+
initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs);
|
|
12627
12612
|
}
|
|
12628
12613
|
if (exportsMap)
|
|
12629
12614
|
cacheMatchingLocalNames(tNode, localRefs, exportsMap);
|
|
@@ -12632,17 +12617,71 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12632
12617
|
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
|
12633
12618
|
return hasDirectives;
|
|
12634
12619
|
}
|
|
12620
|
+
/** Initializes the data structures necessary for a list of directives to be instantiated. */
|
|
12621
|
+
function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) {
|
|
12622
|
+
ngDevMode && assertFirstCreatePass(tView);
|
|
12623
|
+
// Publishes the directive types to DI so they can be injected. Needs to
|
|
12624
|
+
// happen in a separate pass before the TNode flags have been initialized.
|
|
12625
|
+
for (let i = 0; i < directives.length; i++) {
|
|
12626
|
+
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type);
|
|
12627
|
+
}
|
|
12628
|
+
initTNodeFlags(tNode, tView.data.length, directives.length);
|
|
12629
|
+
// When the same token is provided by several directives on the same node, some rules apply in
|
|
12630
|
+
// the viewEngine:
|
|
12631
|
+
// - viewProviders have priority over providers
|
|
12632
|
+
// - the last directive in NgModule.declarations has priority over the previous one
|
|
12633
|
+
// So to match these rules, the order in which providers are added in the arrays is very
|
|
12634
|
+
// important.
|
|
12635
|
+
for (let i = 0; i < directives.length; i++) {
|
|
12636
|
+
const def = directives[i];
|
|
12637
|
+
if (def.providersResolver)
|
|
12638
|
+
def.providersResolver(def);
|
|
12639
|
+
}
|
|
12640
|
+
let preOrderHooksFound = false;
|
|
12641
|
+
let preOrderCheckHooksFound = false;
|
|
12642
|
+
let directiveIdx = allocExpando(tView, lView, directives.length, null);
|
|
12643
|
+
ngDevMode &&
|
|
12644
|
+
assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
|
|
12645
|
+
for (let i = 0; i < directives.length; i++) {
|
|
12646
|
+
const def = directives[i];
|
|
12647
|
+
// Merge the attrs in the order of matches. This assumes that the first directive is the
|
|
12648
|
+
// component itself, so that the component has the least priority.
|
|
12649
|
+
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
|
12650
|
+
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
12651
|
+
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
12652
|
+
if (def.contentQueries !== null)
|
|
12653
|
+
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
12654
|
+
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
12655
|
+
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
12656
|
+
const lifeCycleHooks = def.type.prototype;
|
|
12657
|
+
// Only push a node index into the preOrderHooks array if this is the first
|
|
12658
|
+
// pre-order hook found on this node.
|
|
12659
|
+
if (!preOrderHooksFound &&
|
|
12660
|
+
(lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
|
|
12661
|
+
// We will push the actual hook function into this array later during dir instantiation.
|
|
12662
|
+
// We cannot do it now because we must ensure hooks are registered in the same
|
|
12663
|
+
// order that directives are created (i.e. injection order).
|
|
12664
|
+
(tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index);
|
|
12665
|
+
preOrderHooksFound = true;
|
|
12666
|
+
}
|
|
12667
|
+
if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
|
|
12668
|
+
(tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(tNode.index);
|
|
12669
|
+
preOrderCheckHooksFound = true;
|
|
12670
|
+
}
|
|
12671
|
+
directiveIdx++;
|
|
12672
|
+
}
|
|
12673
|
+
initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
|
|
12674
|
+
}
|
|
12635
12675
|
/**
|
|
12636
12676
|
* Add `hostBindings` to the `TView.hostBindingOpCodes`.
|
|
12637
12677
|
*
|
|
12638
12678
|
* @param tView `TView` to which the `hostBindings` should be added.
|
|
12639
12679
|
* @param tNode `TNode` the element which contains the directive
|
|
12640
|
-
* @param lView `LView` current `LView`
|
|
12641
12680
|
* @param directiveIdx Directive index in view.
|
|
12642
12681
|
* @param directiveVarsIdx Where will the directive's vars be stored
|
|
12643
12682
|
* @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
|
|
12644
12683
|
*/
|
|
12645
|
-
function registerHostBindingOpCodes(tView, tNode,
|
|
12684
|
+
function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
|
|
12646
12685
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12647
12686
|
const hostBindings = def.hostBindings;
|
|
12648
12687
|
if (hostBindings) {
|
|
@@ -12743,38 +12782,64 @@ function invokeHostBindingsInCreationMode(def, directive) {
|
|
|
12743
12782
|
* Matches the current node against all available selectors.
|
|
12744
12783
|
* If a component is matched (at most one), it is returned in first position in the array.
|
|
12745
12784
|
*/
|
|
12746
|
-
function findDirectiveDefMatches(tView,
|
|
12785
|
+
function findDirectiveDefMatches(tView, tNode) {
|
|
12747
12786
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12748
12787
|
ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
|
|
12749
12788
|
const registry = tView.directiveRegistry;
|
|
12750
12789
|
let matches = null;
|
|
12790
|
+
let hostDirectiveDefs = null;
|
|
12751
12791
|
if (registry) {
|
|
12752
12792
|
for (let i = 0; i < registry.length; i++) {
|
|
12753
12793
|
const def = registry[i];
|
|
12754
12794
|
if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
|
|
12755
12795
|
matches || (matches = ngDevMode ? new MatchesArray() : []);
|
|
12756
|
-
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type);
|
|
12757
12796
|
if (isComponentDef(def)) {
|
|
12758
12797
|
if (ngDevMode) {
|
|
12759
12798
|
assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
|
|
12760
12799
|
`Please use a different tag to activate the ${stringify(def.type)} component.`);
|
|
12761
12800
|
if (isComponentHost(tNode)) {
|
|
12762
|
-
|
|
12763
|
-
// `matches` array, see how we store components/directives in `matches` below.
|
|
12764
|
-
throwMultipleComponentError(tNode, matches[0].type, def.type);
|
|
12801
|
+
throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
|
|
12765
12802
|
}
|
|
12766
12803
|
}
|
|
12767
|
-
|
|
12768
|
-
//
|
|
12769
|
-
|
|
12804
|
+
// Components are inserted at the front of the matches array so that their lifecycle
|
|
12805
|
+
// hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
|
|
12806
|
+
// compatibility. This logic doesn't make sense with host directives, because it
|
|
12807
|
+
// would allow the host directives to undo any overrides the host may have made.
|
|
12808
|
+
// To handle this case, the host directives of components are inserted at the beginning
|
|
12809
|
+
// of the array, followed by the component. As such, the insertion order is as follows:
|
|
12810
|
+
// 1. Host directives belonging to the selector-matched component.
|
|
12811
|
+
// 2. Selector-matched component.
|
|
12812
|
+
// 3. Host directives belonging to selector-matched directives.
|
|
12813
|
+
// 4. Selector-matched directives.
|
|
12814
|
+
if (def.findHostDirectiveDefs !== null) {
|
|
12815
|
+
const hostDirectiveMatches = [];
|
|
12816
|
+
hostDirectiveDefs = hostDirectiveDefs || new Map();
|
|
12817
|
+
def.findHostDirectiveDefs(def, hostDirectiveMatches, hostDirectiveDefs);
|
|
12818
|
+
// Add all host directives declared on this component, followed by the component itself.
|
|
12819
|
+
// Host directives should execute first so the host has a chance to override changes
|
|
12820
|
+
// to the DOM made by them.
|
|
12821
|
+
matches.unshift(...hostDirectiveMatches, def);
|
|
12822
|
+
// Component is offset starting from the beginning of the host directives array.
|
|
12823
|
+
const componentOffset = hostDirectiveMatches.length;
|
|
12824
|
+
markAsComponentHost(tView, tNode, componentOffset);
|
|
12825
|
+
}
|
|
12826
|
+
else {
|
|
12827
|
+
// No host directives on this component, just add the
|
|
12828
|
+
// component def to the beginning of the matches.
|
|
12829
|
+
matches.unshift(def);
|
|
12830
|
+
markAsComponentHost(tView, tNode, 0);
|
|
12831
|
+
}
|
|
12770
12832
|
}
|
|
12771
12833
|
else {
|
|
12834
|
+
// Append any host directives to the matches first.
|
|
12835
|
+
hostDirectiveDefs = hostDirectiveDefs || new Map();
|
|
12836
|
+
def.findHostDirectiveDefs?.(def, matches, hostDirectiveDefs);
|
|
12772
12837
|
matches.push(def);
|
|
12773
12838
|
}
|
|
12774
12839
|
}
|
|
12775
12840
|
}
|
|
12776
12841
|
}
|
|
12777
|
-
return matches;
|
|
12842
|
+
return matches === null ? null : [matches, hostDirectiveDefs];
|
|
12778
12843
|
}
|
|
12779
12844
|
/**
|
|
12780
12845
|
* Marks a given TNode as a component's host. This consists of:
|
|
@@ -12788,26 +12853,6 @@ function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
|
12788
12853
|
(tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
|
|
12789
12854
|
.push(hostTNode.index);
|
|
12790
12855
|
}
|
|
12791
|
-
/**
|
|
12792
|
-
* Given an array of directives that were matched by their selectors, this function
|
|
12793
|
-
* produces a new array that also includes any host directives that have to be applied.
|
|
12794
|
-
* @param selectorMatches Directives matched in a template based on their selectors.
|
|
12795
|
-
* @param tView Current TView.
|
|
12796
|
-
* @param lView Current LView.
|
|
12797
|
-
* @param tNode Current TNode that is being matched.
|
|
12798
|
-
*/
|
|
12799
|
-
function findHostDirectiveDefs$1(selectorMatches, tView, lView, tNode) {
|
|
12800
|
-
const matches = [];
|
|
12801
|
-
for (const def of selectorMatches) {
|
|
12802
|
-
if (def.findHostDirectiveDefs === null) {
|
|
12803
|
-
matches.push(def);
|
|
12804
|
-
}
|
|
12805
|
-
else {
|
|
12806
|
-
def.findHostDirectiveDefs(matches, def, tView, lView, tNode);
|
|
12807
|
-
}
|
|
12808
|
-
}
|
|
12809
|
-
return matches;
|
|
12810
|
-
}
|
|
12811
12856
|
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
12812
12857
|
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
12813
12858
|
if (localRefs) {
|
|
@@ -12875,7 +12920,7 @@ function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
|
|
|
12875
12920
|
const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
|
|
12876
12921
|
tView.blueprint[directiveIndex] = nodeInjectorFactory;
|
|
12877
12922
|
lView[directiveIndex] = nodeInjectorFactory;
|
|
12878
|
-
registerHostBindingOpCodes(tView, tNode,
|
|
12923
|
+
registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
|
|
12879
12924
|
}
|
|
12880
12925
|
function addComponentLogic(lView, hostTNode, def) {
|
|
12881
12926
|
const native = getNativeByTNode(hostTNode, lView);
|
|
@@ -13798,6 +13843,7 @@ class ChainedInjector {
|
|
|
13798
13843
|
this.parentInjector = parentInjector;
|
|
13799
13844
|
}
|
|
13800
13845
|
get(token, notFoundValue, flags) {
|
|
13846
|
+
flags = convertToBitFlags(flags);
|
|
13801
13847
|
const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
|
|
13802
13848
|
if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
|
13803
13849
|
notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
|
@@ -13874,42 +13920,34 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
13874
13920
|
let component;
|
|
13875
13921
|
let tElementNode;
|
|
13876
13922
|
try {
|
|
13877
|
-
const
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
setUpAttributes(hostRenderer, hostRNode, attrs);
|
|
13889
|
-
}
|
|
13890
|
-
if (classes && classes.length > 0) {
|
|
13891
|
-
writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
|
|
13892
|
-
}
|
|
13893
|
-
}
|
|
13923
|
+
const rootComponentDef = this.componentDef;
|
|
13924
|
+
let rootDirectives;
|
|
13925
|
+
let hostDirectiveDefs = null;
|
|
13926
|
+
if (rootComponentDef.findHostDirectiveDefs) {
|
|
13927
|
+
rootDirectives = [];
|
|
13928
|
+
hostDirectiveDefs = new Map();
|
|
13929
|
+
rootComponentDef.findHostDirectiveDefs(rootComponentDef, rootDirectives, hostDirectiveDefs);
|
|
13930
|
+
rootDirectives.push(rootComponentDef);
|
|
13931
|
+
}
|
|
13932
|
+
else {
|
|
13933
|
+
rootDirectives = [rootComponentDef];
|
|
13894
13934
|
}
|
|
13935
|
+
const hostTNode = createRootComponentTNode(rootLView, hostRNode);
|
|
13936
|
+
const componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, rendererFactory, hostRenderer);
|
|
13895
13937
|
tElementNode = getTNode(rootTView, HEADER_OFFSET);
|
|
13938
|
+
// TODO(crisbeto): in practice `hostRNode` should always be defined, but there are some tests
|
|
13939
|
+
// where the renderer is mocked out and `undefined` is returned. We should update the tests so
|
|
13940
|
+
// that this check can be removed.
|
|
13941
|
+
if (hostRNode) {
|
|
13942
|
+
setRootNodeAttributes(hostRenderer, rootComponentDef, hostRNode, rootSelectorOrNode);
|
|
13943
|
+
}
|
|
13896
13944
|
if (projectableNodes !== undefined) {
|
|
13897
|
-
|
|
13898
|
-
for (let i = 0; i < this.ngContentSelectors.length; i++) {
|
|
13899
|
-
const nodesforSlot = projectableNodes[i];
|
|
13900
|
-
// Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
|
|
13901
|
-
// case). Here we do normalize passed data structure to be an array of arrays to avoid
|
|
13902
|
-
// complex checks down the line.
|
|
13903
|
-
// We also normalize the length of the passed in projectable nodes (to match the number of
|
|
13904
|
-
// <ng-container> slots defined by a component).
|
|
13905
|
-
projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
|
|
13906
|
-
}
|
|
13945
|
+
projectNodes(tElementNode, this.ngContentSelectors, projectableNodes);
|
|
13907
13946
|
}
|
|
13908
13947
|
// TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
|
|
13909
13948
|
// executed here?
|
|
13910
13949
|
// Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
|
|
13911
|
-
component =
|
|
13912
|
-
createRootComponent(componentView, this.componentDef, rootLView, [LifecycleHooksFeature]);
|
|
13950
|
+
component = createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, [LifecycleHooksFeature]);
|
|
13913
13951
|
renderView(rootTView, rootLView, null);
|
|
13914
13952
|
}
|
|
13915
13953
|
finally {
|
|
@@ -13980,11 +14018,22 @@ const NULL_INJECTOR = {
|
|
|
13980
14018
|
throwProviderNotFoundError(token, 'NullInjector');
|
|
13981
14019
|
}
|
|
13982
14020
|
};
|
|
14021
|
+
/** Creates a TNode that can be used to instantiate a root component. */
|
|
14022
|
+
function createRootComponentTNode(lView, rNode) {
|
|
14023
|
+
const tView = lView[TVIEW];
|
|
14024
|
+
const index = HEADER_OFFSET;
|
|
14025
|
+
ngDevMode && assertIndexInRange(lView, index);
|
|
14026
|
+
lView[index] = rNode;
|
|
14027
|
+
// '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
|
|
14028
|
+
// the same time we want to communicate the debug `TNode` that this is a special `TNode`
|
|
14029
|
+
// representing a host element.
|
|
14030
|
+
return getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
|
|
14031
|
+
}
|
|
13983
14032
|
/**
|
|
13984
14033
|
* Creates the root component view and the root component node.
|
|
13985
14034
|
*
|
|
13986
14035
|
* @param rNode Render host element.
|
|
13987
|
-
* @param
|
|
14036
|
+
* @param rootComponentDef ComponentDef
|
|
13988
14037
|
* @param rootView The parent view where the host node is stored
|
|
13989
14038
|
* @param rendererFactory Factory to be used for creating child renderers.
|
|
13990
14039
|
* @param hostRenderer The current renderer
|
|
@@ -13992,72 +14041,95 @@ const NULL_INJECTOR = {
|
|
|
13992
14041
|
*
|
|
13993
14042
|
* @returns Component view created
|
|
13994
14043
|
*/
|
|
13995
|
-
function createRootComponentView(rNode,
|
|
14044
|
+
function createRootComponentView(tNode, rNode, rootComponentDef, rootDirectives, rootView, rendererFactory, hostRenderer, sanitizer) {
|
|
13996
14045
|
const tView = rootView[TVIEW];
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
rootView[index]
|
|
14000
|
-
// '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
|
|
14001
|
-
// the same time we want to communicate the debug `TNode` that this is a special `TNode`
|
|
14002
|
-
// representing a host element.
|
|
14003
|
-
const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
|
|
14004
|
-
const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
|
|
14005
|
-
if (mergedAttrs !== null) {
|
|
14006
|
-
computeStaticStyling(tNode, mergedAttrs, true);
|
|
14007
|
-
if (rNode !== null) {
|
|
14008
|
-
setUpAttributes(hostRenderer, rNode, mergedAttrs);
|
|
14009
|
-
if (tNode.classes !== null) {
|
|
14010
|
-
writeDirectClass(hostRenderer, rNode, tNode.classes);
|
|
14011
|
-
}
|
|
14012
|
-
if (tNode.styles !== null) {
|
|
14013
|
-
writeDirectStyle(hostRenderer, rNode, tNode.styles);
|
|
14014
|
-
}
|
|
14015
|
-
}
|
|
14016
|
-
}
|
|
14017
|
-
const viewRenderer = rendererFactory.createRenderer(rNode, def);
|
|
14018
|
-
const componentView = createLView(rootView, getOrCreateComponentTView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
|
|
14046
|
+
applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer);
|
|
14047
|
+
const viewRenderer = rendererFactory.createRenderer(rNode, rootComponentDef);
|
|
14048
|
+
const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
|
|
14019
14049
|
if (tView.firstCreatePass) {
|
|
14020
|
-
|
|
14021
|
-
markAsComponentHost(tView, tNode, 0);
|
|
14022
|
-
initTNodeFlags(tNode, rootView.length, 1);
|
|
14050
|
+
markAsComponentHost(tView, tNode, rootDirectives.length - 1);
|
|
14023
14051
|
}
|
|
14024
14052
|
addToViewTree(rootView, componentView);
|
|
14025
14053
|
// Store component view at node index, with node as the HOST
|
|
14026
|
-
return rootView[index] = componentView;
|
|
14054
|
+
return rootView[tNode.index] = componentView;
|
|
14055
|
+
}
|
|
14056
|
+
/** Sets up the styling information on a root component. */
|
|
14057
|
+
function applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer) {
|
|
14058
|
+
for (const def of rootDirectives) {
|
|
14059
|
+
tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
|
14060
|
+
}
|
|
14061
|
+
if (tNode.mergedAttrs !== null) {
|
|
14062
|
+
computeStaticStyling(tNode, tNode.mergedAttrs, true);
|
|
14063
|
+
if (rNode !== null) {
|
|
14064
|
+
setupStaticAttributes(hostRenderer, rNode, tNode);
|
|
14065
|
+
}
|
|
14066
|
+
}
|
|
14027
14067
|
}
|
|
14028
14068
|
/**
|
|
14029
14069
|
* Creates a root component and sets it up with features and host bindings.Shared by
|
|
14030
14070
|
* renderComponent() and ViewContainerRef.createComponent().
|
|
14031
14071
|
*/
|
|
14032
|
-
function createRootComponent(componentView,
|
|
14072
|
+
function createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, hostFeatures) {
|
|
14073
|
+
const rootTNode = getCurrentTNode();
|
|
14074
|
+
ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
|
|
14033
14075
|
const tView = rootLView[TVIEW];
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14076
|
+
const native = getNativeByTNode(rootTNode, rootLView);
|
|
14077
|
+
initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null, hostDirectiveDefs);
|
|
14078
|
+
for (let i = 0; i < rootDirectives.length; i++) {
|
|
14079
|
+
const directiveIndex = rootTNode.directiveStart + i;
|
|
14080
|
+
const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode);
|
|
14081
|
+
attachPatchData(directiveInstance, rootLView);
|
|
14082
|
+
}
|
|
14083
|
+
invokeDirectivesHostBindings(tView, rootLView, rootTNode);
|
|
14084
|
+
if (native) {
|
|
14085
|
+
attachPatchData(native, rootLView);
|
|
14086
|
+
}
|
|
14087
|
+
// We're guaranteed for the `componentOffset` to be positive here
|
|
14088
|
+
// since a root component always matches a component def.
|
|
14089
|
+
ngDevMode &&
|
|
14090
|
+
assertGreaterThan(rootTNode.componentOffset, -1, 'componentOffset must be great than -1');
|
|
14091
|
+
const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
|
|
14038
14092
|
componentView[CONTEXT] = rootLView[CONTEXT] = component;
|
|
14039
14093
|
if (hostFeatures !== null) {
|
|
14040
14094
|
for (const feature of hostFeatures) {
|
|
14041
|
-
feature(component,
|
|
14095
|
+
feature(component, rootComponentDef);
|
|
14042
14096
|
}
|
|
14043
14097
|
}
|
|
14044
14098
|
// We want to generate an empty QueryList for root content queries for backwards
|
|
14045
14099
|
// compatibility with ViewEngine.
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14100
|
+
executeContentQueries(tView, rootTNode, componentView);
|
|
14101
|
+
return component;
|
|
14102
|
+
}
|
|
14103
|
+
/** Sets the static attributes on a root component. */
|
|
14104
|
+
function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
|
|
14105
|
+
if (rootSelectorOrNode) {
|
|
14106
|
+
setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
|
|
14050
14107
|
}
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14108
|
+
else {
|
|
14109
|
+
// If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
|
|
14110
|
+
// is not defined), also apply attributes and classes extracted from component selector.
|
|
14111
|
+
// Extract attributes and classes from the first selector only to match VE behavior.
|
|
14112
|
+
const { attrs, classes } = extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
|
|
14113
|
+
if (attrs) {
|
|
14114
|
+
setUpAttributes(hostRenderer, hostRNode, attrs);
|
|
14115
|
+
}
|
|
14116
|
+
if (classes && classes.length > 0) {
|
|
14117
|
+
writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
|
|
14118
|
+
}
|
|
14119
|
+
}
|
|
14120
|
+
}
|
|
14121
|
+
/** Projects the `projectableNodes` that were specified when creating a root component. */
|
|
14122
|
+
function projectNodes(tNode, ngContentSelectors, projectableNodes) {
|
|
14123
|
+
const projection = tNode.projection = [];
|
|
14124
|
+
for (let i = 0; i < ngContentSelectors.length; i++) {
|
|
14125
|
+
const nodesforSlot = projectableNodes[i];
|
|
14126
|
+
// Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
|
|
14127
|
+
// case). Here we do normalize passed data structure to be an array of arrays to avoid
|
|
14128
|
+
// complex checks down the line.
|
|
14129
|
+
// We also normalize the length of the passed in projectable nodes (to match the number of
|
|
14130
|
+
// <ng-container> slots defined by a component).
|
|
14131
|
+
projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
|
|
14059
14132
|
}
|
|
14060
|
-
return component;
|
|
14061
14133
|
}
|
|
14062
14134
|
/**
|
|
14063
14135
|
* Used to enable lifecycle hooks on the root component.
|
|
@@ -14323,7 +14395,7 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14323
14395
|
* found in the LICENSE file at https://angular.io/license
|
|
14324
14396
|
*/
|
|
14325
14397
|
/**
|
|
14326
|
-
* This feature
|
|
14398
|
+
* This feature adds the host directives behavior to a directive definition by patching a
|
|
14327
14399
|
* function onto it. The expectation is that the runtime will invoke the function during
|
|
14328
14400
|
* directive matching.
|
|
14329
14401
|
*
|
|
@@ -14357,17 +14429,22 @@ function ɵɵHostDirectivesFeature(rawHostDirectives) {
|
|
|
14357
14429
|
});
|
|
14358
14430
|
};
|
|
14359
14431
|
}
|
|
14360
|
-
function findHostDirectiveDefs(
|
|
14361
|
-
if (
|
|
14362
|
-
for (const hostDirectiveConfig of
|
|
14432
|
+
function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs) {
|
|
14433
|
+
if (currentDef.hostDirectives !== null) {
|
|
14434
|
+
for (const hostDirectiveConfig of currentDef.hostDirectives) {
|
|
14363
14435
|
const hostDirectiveDef = getDirectiveDef(hostDirectiveConfig.directive);
|
|
14364
|
-
|
|
14436
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
14437
|
+
validateHostDirective(hostDirectiveConfig, hostDirectiveDef, matchedDefs);
|
|
14438
|
+
}
|
|
14439
|
+
// We need to patch the `declaredInputs` so that
|
|
14440
|
+
// `ngOnChanges` can map the properties correctly.
|
|
14441
|
+
patchDeclaredInputs(hostDirectiveDef.declaredInputs, hostDirectiveConfig.inputs);
|
|
14365
14442
|
// Host directives execute before the host so that its host bindings can be overwritten.
|
|
14366
|
-
findHostDirectiveDefs(
|
|
14443
|
+
findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
|
|
14444
|
+
hostDirectiveDefs.set(hostDirectiveDef, hostDirectiveConfig);
|
|
14445
|
+
matchedDefs.push(hostDirectiveDef);
|
|
14367
14446
|
}
|
|
14368
14447
|
}
|
|
14369
|
-
// Push the def itself at the end since it needs to execute after the host directives.
|
|
14370
|
-
matches.push(def);
|
|
14371
14448
|
}
|
|
14372
14449
|
/**
|
|
14373
14450
|
* Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
|
|
@@ -14383,6 +14460,90 @@ function bindingArrayToMap(bindings) {
|
|
|
14383
14460
|
}
|
|
14384
14461
|
return result;
|
|
14385
14462
|
}
|
|
14463
|
+
/**
|
|
14464
|
+
* `ngOnChanges` has some leftover legacy ViewEngine behavior where the keys inside the
|
|
14465
|
+
* `SimpleChanges` event refer to the *declared* name of the input, not its public name or its
|
|
14466
|
+
* minified name. E.g. in `@Input('alias') foo: string`, the name in the `SimpleChanges` object
|
|
14467
|
+
* will always be `foo`, and not `alias` or the minified name of `foo` in apps using property
|
|
14468
|
+
* minification.
|
|
14469
|
+
*
|
|
14470
|
+
* This is achieved through the `DirectiveDef.declaredInputs` map that is constructed when the
|
|
14471
|
+
* definition is declared. When a property is written to the directive instance, the
|
|
14472
|
+
* `NgOnChangesFeature` will try to remap the property name being written to using the
|
|
14473
|
+
* `declaredInputs`.
|
|
14474
|
+
*
|
|
14475
|
+
* Since the host directive input remapping happens during directive matching, `declaredInputs`
|
|
14476
|
+
* won't contain the new alias that the input is available under. This function addresses the
|
|
14477
|
+
* issue by patching the host directive aliases to the `declaredInputs`. There is *not* a risk of
|
|
14478
|
+
* this patching accidentally introducing new inputs to the host directive, because `declaredInputs`
|
|
14479
|
+
* is used *only* by the `NgOnChangesFeature` when determining what name is used in the
|
|
14480
|
+
* `SimpleChanges` object which won't be reached if an input doesn't exist.
|
|
14481
|
+
*/
|
|
14482
|
+
function patchDeclaredInputs(declaredInputs, exposedInputs) {
|
|
14483
|
+
for (const publicName in exposedInputs) {
|
|
14484
|
+
if (exposedInputs.hasOwnProperty(publicName)) {
|
|
14485
|
+
const remappedPublicName = exposedInputs[publicName];
|
|
14486
|
+
const privateName = declaredInputs[publicName];
|
|
14487
|
+
// We *technically* shouldn't be able to hit this case because we can't have multiple
|
|
14488
|
+
// inputs on the same property and we have validations against conflicting aliases in
|
|
14489
|
+
// `validateMappings`. If we somehow did, it would lead to `ngOnChanges` being invoked
|
|
14490
|
+
// with the wrong name so we have a non-user-friendly assertion here just in case.
|
|
14491
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
|
14492
|
+
declaredInputs.hasOwnProperty(remappedPublicName)) {
|
|
14493
|
+
assertEqual(declaredInputs[remappedPublicName], declaredInputs[publicName], `Conflicting host directive input alias ${publicName}.`);
|
|
14494
|
+
}
|
|
14495
|
+
declaredInputs[remappedPublicName] = privateName;
|
|
14496
|
+
}
|
|
14497
|
+
}
|
|
14498
|
+
}
|
|
14499
|
+
/**
|
|
14500
|
+
* Verifies that the host directive has been configured correctly.
|
|
14501
|
+
* @param hostDirectiveConfig Host directive configuration object.
|
|
14502
|
+
* @param directiveDef Directive definition of the host directive.
|
|
14503
|
+
* @param matchedDefs Directives that have been matched so far.
|
|
14504
|
+
*/
|
|
14505
|
+
function validateHostDirective(hostDirectiveConfig, directiveDef, matchedDefs) {
|
|
14506
|
+
// TODO(crisbeto): implement more of these checks in the compiler.
|
|
14507
|
+
const type = hostDirectiveConfig.directive;
|
|
14508
|
+
if (directiveDef === null) {
|
|
14509
|
+
if (getComponentDef(type) !== null) {
|
|
14510
|
+
throw new RuntimeError(310 /* RuntimeErrorCode.HOST_DIRECTIVE_COMPONENT */, `Host directive ${type.name} cannot be a component.`);
|
|
14511
|
+
}
|
|
14512
|
+
throw new RuntimeError(307 /* RuntimeErrorCode.HOST_DIRECTIVE_UNRESOLVABLE */, `Could not resolve metadata for host directive ${type.name}. ` +
|
|
14513
|
+
`Make sure that the ${type.name} class is annotated with an @Directive decorator.`);
|
|
14514
|
+
}
|
|
14515
|
+
if (!directiveDef.standalone) {
|
|
14516
|
+
throw new RuntimeError(308 /* RuntimeErrorCode.HOST_DIRECTIVE_NOT_STANDALONE */, `Host directive ${directiveDef.type.name} must be standalone.`);
|
|
14517
|
+
}
|
|
14518
|
+
if (matchedDefs.indexOf(directiveDef) > -1) {
|
|
14519
|
+
throw new RuntimeError(309 /* RuntimeErrorCode.DUPLICATE_DIRECTITVE */, `Directive ${directiveDef.type.name} matches multiple times on the same element. ` +
|
|
14520
|
+
`Directives can only match an element once.`);
|
|
14521
|
+
}
|
|
14522
|
+
validateMappings('input', directiveDef, hostDirectiveConfig.inputs);
|
|
14523
|
+
validateMappings('output', directiveDef, hostDirectiveConfig.outputs);
|
|
14524
|
+
}
|
|
14525
|
+
/**
|
|
14526
|
+
* Checks that the host directive inputs/outputs configuration is valid.
|
|
14527
|
+
* @param bindingType Kind of binding that is being validated. Used in the error message.
|
|
14528
|
+
* @param def Definition of the host directive that is being validated against.
|
|
14529
|
+
* @param hostDirectiveDefs Host directive mapping object that shold be validated.
|
|
14530
|
+
*/
|
|
14531
|
+
function validateMappings(bindingType, def, hostDirectiveDefs) {
|
|
14532
|
+
const className = def.type.name;
|
|
14533
|
+
const bindings = bindingType === 'input' ? def.inputs : def.outputs;
|
|
14534
|
+
for (const publicName in hostDirectiveDefs) {
|
|
14535
|
+
if (hostDirectiveDefs.hasOwnProperty(publicName)) {
|
|
14536
|
+
if (!bindings.hasOwnProperty(publicName)) {
|
|
14537
|
+
throw new RuntimeError(311 /* RuntimeErrorCode.HOST_DIRECTIVE_UNDEFINED_BINDING */, `Directive ${className} does not have an ${bindingType} with a public name of ${publicName}.`);
|
|
14538
|
+
}
|
|
14539
|
+
const remappedPublicName = hostDirectiveDefs[publicName];
|
|
14540
|
+
if (bindings.hasOwnProperty(remappedPublicName) &&
|
|
14541
|
+
bindings[remappedPublicName] !== publicName) {
|
|
14542
|
+
throw new RuntimeError(312 /* RuntimeErrorCode.HOST_DIRECTIVE_CONFLICTING_ALIAS */, `Cannot alias ${bindingType} ${publicName} of host directive ${className} to ${remappedPublicName}, because it already has a different ${bindingType} with the same public name.`);
|
|
14543
|
+
}
|
|
14544
|
+
}
|
|
14545
|
+
}
|
|
14546
|
+
}
|
|
14386
14547
|
|
|
14387
14548
|
/**
|
|
14388
14549
|
* @license
|
|
@@ -15326,18 +15487,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
15326
15487
|
elementStartFirstCreatePass(adjustedIndex, tView, lView, native, name, attrsIndex, localRefsIndex) :
|
|
15327
15488
|
tView.data[adjustedIndex];
|
|
15328
15489
|
setCurrentTNode(tNode, true);
|
|
15329
|
-
|
|
15330
|
-
if (mergedAttrs !== null) {
|
|
15331
|
-
setUpAttributes(renderer, native, mergedAttrs);
|
|
15332
|
-
}
|
|
15333
|
-
const classes = tNode.classes;
|
|
15334
|
-
if (classes !== null) {
|
|
15335
|
-
writeDirectClass(renderer, native, classes);
|
|
15336
|
-
}
|
|
15337
|
-
const styles = tNode.styles;
|
|
15338
|
-
if (styles !== null) {
|
|
15339
|
-
writeDirectStyle(renderer, native, styles);
|
|
15340
|
-
}
|
|
15490
|
+
setupStaticAttributes(renderer, native, tNode);
|
|
15341
15491
|
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
15342
15492
|
// In the i18n case, the translation may have removed this element, so only add it if it is not
|
|
15343
15493
|
// detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
@@ -22027,7 +22177,7 @@ function getDirectives(node) {
|
|
|
22027
22177
|
return [];
|
|
22028
22178
|
}
|
|
22029
22179
|
if (context.directives === undefined) {
|
|
22030
|
-
context.directives = getDirectivesAtNodeIndex(nodeIndex, lView
|
|
22180
|
+
context.directives = getDirectivesAtNodeIndex(nodeIndex, lView);
|
|
22031
22181
|
}
|
|
22032
22182
|
// The `directives` in this case are a named array called `LComponentView`. Clone the
|
|
22033
22183
|
// result so we don't expose an internal data structure in the user's console.
|
|
@@ -24319,7 +24469,7 @@ function generateStandaloneInDeclarationsError(type, location) {
|
|
|
24319
24469
|
function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
|
|
24320
24470
|
if (verifiedNgModule.get(moduleType))
|
|
24321
24471
|
return;
|
|
24322
|
-
// skip verifications of standalone components, directives and pipes
|
|
24472
|
+
// skip verifications of standalone components, directives, and pipes
|
|
24323
24473
|
if (isStandalone(moduleType))
|
|
24324
24474
|
return;
|
|
24325
24475
|
verifiedNgModule.set(moduleType, true);
|
|
@@ -26036,6 +26186,34 @@ function getNativeRequestAnimationFrame() {
|
|
|
26036
26186
|
return { nativeRequestAnimationFrame, nativeCancelAnimationFrame };
|
|
26037
26187
|
}
|
|
26038
26188
|
|
|
26189
|
+
/**
|
|
26190
|
+
* @license
|
|
26191
|
+
* Copyright Google LLC All Rights Reserved.
|
|
26192
|
+
*
|
|
26193
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
26194
|
+
* found in the LICENSE file at https://angular.io/license
|
|
26195
|
+
*/
|
|
26196
|
+
class AsyncStackTaggingZoneSpec {
|
|
26197
|
+
constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
|
|
26198
|
+
this.name = 'asyncStackTagging for ' + namePrefix;
|
|
26199
|
+
this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);
|
|
26200
|
+
}
|
|
26201
|
+
onScheduleTask(delegate, _current, target, task) {
|
|
26202
|
+
task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
|
|
26203
|
+
return delegate.scheduleTask(target, task);
|
|
26204
|
+
}
|
|
26205
|
+
onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
|
|
26206
|
+
let ret;
|
|
26207
|
+
if (task.consoleTask) {
|
|
26208
|
+
ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
|
|
26209
|
+
}
|
|
26210
|
+
else {
|
|
26211
|
+
ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
|
|
26212
|
+
}
|
|
26213
|
+
return ret;
|
|
26214
|
+
}
|
|
26215
|
+
}
|
|
26216
|
+
|
|
26039
26217
|
/**
|
|
26040
26218
|
* @license
|
|
26041
26219
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -26152,8 +26330,12 @@ class NgZone {
|
|
|
26152
26330
|
const self = this;
|
|
26153
26331
|
self._nesting = 0;
|
|
26154
26332
|
self._outer = self._inner = Zone.current;
|
|
26155
|
-
|
|
26156
|
-
|
|
26333
|
+
// AsyncStackTaggingZoneSpec provides `linked stack traces` to show
|
|
26334
|
+
// where the async operation is scheduled. For more details, refer
|
|
26335
|
+
// to this article, https://developer.chrome.com/blog/devtools-better-angular-debugging/
|
|
26336
|
+
// And we only import this AsyncStackTaggingZoneSpec in development mode,
|
|
26337
|
+
// in the production mode, the AsyncStackTaggingZoneSpec will be tree shaken away.
|
|
26338
|
+
if (ngDevMode) {
|
|
26157
26339
|
self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));
|
|
26158
26340
|
}
|
|
26159
26341
|
if (Zone['TaskTrackingZoneSpec']) {
|
|
@@ -27587,24 +27769,16 @@ function _mergeArrays(parts) {
|
|
|
27587
27769
|
* found in the LICENSE file at https://angular.io/license
|
|
27588
27770
|
*/
|
|
27589
27771
|
/**
|
|
27590
|
-
*
|
|
27591
|
-
*
|
|
27592
|
-
* For more information on how to run and debug tests with either Ivy or View Engine (legacy),
|
|
27593
|
-
* please see [BAZEL.md](./docs/BAZEL.md).
|
|
27594
|
-
*/
|
|
27595
|
-
let _devMode = true;
|
|
27596
|
-
let _runModeLocked = false;
|
|
27597
|
-
/**
|
|
27598
|
-
* Returns whether Angular is in development mode. After called once,
|
|
27599
|
-
* the value is locked and won't change any more.
|
|
27772
|
+
* Returns whether Angular is in development mode.
|
|
27600
27773
|
*
|
|
27601
|
-
* By default, this is true, unless
|
|
27774
|
+
* By default, this is true, unless `enableProdMode` is invoked prior to calling this method or the
|
|
27775
|
+
* application is built using the Angular CLI with the `optimization` option.
|
|
27776
|
+
* @see {@link cli/build ng build}
|
|
27602
27777
|
*
|
|
27603
27778
|
* @publicApi
|
|
27604
27779
|
*/
|
|
27605
27780
|
function isDevMode() {
|
|
27606
|
-
|
|
27607
|
-
return _devMode;
|
|
27781
|
+
return typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
27608
27782
|
}
|
|
27609
27783
|
/**
|
|
27610
27784
|
* Disable Angular's development mode, which turns off assertions and other
|
|
@@ -27614,18 +27788,18 @@ function isDevMode() {
|
|
|
27614
27788
|
* does not result in additional changes to any bindings (also known as
|
|
27615
27789
|
* unidirectional data flow).
|
|
27616
27790
|
*
|
|
27791
|
+
* Using this method is discouraged as the Angular CLI will set production mode when using the
|
|
27792
|
+
* `optimization` option.
|
|
27793
|
+
* @see {@link cli/build ng build}
|
|
27794
|
+
*
|
|
27617
27795
|
* @publicApi
|
|
27618
27796
|
*/
|
|
27619
27797
|
function enableProdMode() {
|
|
27620
|
-
if (_runModeLocked) {
|
|
27621
|
-
throw new Error('Cannot enable prod mode after platform setup.');
|
|
27622
|
-
}
|
|
27623
27798
|
// The below check is there so when ngDevMode is set via terser
|
|
27624
27799
|
// `global['ngDevMode'] = false;` is also dropped.
|
|
27625
|
-
if (typeof ngDevMode === undefined ||
|
|
27800
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
27626
27801
|
_global['ngDevMode'] = false;
|
|
27627
27802
|
}
|
|
27628
|
-
_devMode = false;
|
|
27629
27803
|
}
|
|
27630
27804
|
|
|
27631
27805
|
/**
|
|
@@ -29871,5 +30045,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
|
29871
30045
|
* Generated bundle index. Do not edit.
|
|
29872
30046
|
*/
|
|
29873
30047
|
|
|
29874
|
-
export { ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, platformCore, reflectComponentType, resolveForwardRef, setTestabilityGetter, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ChangeDetectorStatus as ɵChangeDetectorStatus, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, ViewRef$1 as ɵViewRef, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, getDebugNode as ɵgetDebugNode, getDebugNodeR2 as ɵgetDebugNodeR2, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, isBoundToModule as ɵisBoundToModule, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy, isInjectable as ɵisInjectable, isListLikeIterable as ɵisListLikeIterable, isObservable as ɵisObservable, isPromise as ɵisPromise, isStandalone as ɵisStandalone, isSubscribable as ɵisSubscribable, ɵivyEnabled, makeDecorator as ɵmakeDecorator, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵviewQuery };
|
|
30048
|
+
export { ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, platformCore, reflectComponentType, resolveForwardRef, setTestabilityGetter, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ChangeDetectorStatus as ɵChangeDetectorStatus, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, ViewRef$1 as ɵViewRef, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, getDebugNode as ɵgetDebugNode, getDebugNodeR2 as ɵgetDebugNodeR2, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, isBoundToModule as ɵisBoundToModule, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy, isInjectable as ɵisInjectable, isListLikeIterable as ɵisListLikeIterable, isObservable as ɵisObservable, isPromise as ɵisPromise, isStandalone as ɵisStandalone, isSubscribable as ɵisSubscribable, ɵivyEnabled, makeDecorator as ɵmakeDecorator, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵviewQuery };
|
|
29875
30049
|
//# sourceMappingURL=core.mjs.map
|