@angular/core 15.0.0-next.3 → 15.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/esm2020/src/core_private_export.mjs +2 -2
  2. package/esm2020/src/di/index.mjs +1 -1
  3. package/esm2020/src/di/injector.mjs +1 -1
  4. package/esm2020/src/di/injector_compatibility.mjs +15 -11
  5. package/esm2020/src/di/interface/injector.mjs +1 -1
  6. package/esm2020/src/di/r3_injector.mjs +3 -2
  7. package/esm2020/src/render3/component_ref.mjs +102 -83
  8. package/esm2020/src/render3/context_discovery.mjs +7 -7
  9. package/esm2020/src/render3/di.mjs +3 -2
  10. package/esm2020/src/render3/features/host_directives_feature.mjs +2 -3
  11. package/esm2020/src/render3/instructions/element.mjs +3 -15
  12. package/esm2020/src/render3/instructions/shared.mjs +93 -106
  13. package/esm2020/src/render3/ng_module_ref.mjs +1 -1
  14. package/esm2020/src/render3/node_manipulation.mjs +15 -1
  15. package/esm2020/src/render3/util/discovery_utils.mjs +2 -2
  16. package/esm2020/src/util/is_dev_mode.mjs +11 -19
  17. package/esm2020/src/version.mjs +1 -1
  18. package/esm2020/src/zone/async-stack-tagging.mjs +28 -0
  19. package/esm2020/src/zone/ng_zone.mjs +8 -3
  20. package/esm2020/testing/src/logger.mjs +3 -3
  21. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  22. package/esm2020/testing/src/test_bed.mjs +4 -4
  23. package/fesm2015/core.mjs +1506 -1470
  24. package/fesm2015/core.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +888 -877
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/core.mjs +1509 -1475
  28. package/fesm2020/core.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +886 -876
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/index.d.ts +60 -5
  32. package/package.json +1 -1
  33. 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.3
2
+ * @license Angular v15.0.0-next.4
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
- * This file contains reuseable "empty" symbols that can be used as default return values
831
- * in different parts of the rendering code. Because the same symbols are returned, this
832
- * allows for identity checks against these values to be consistently used by the framework
833
- * code.
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
- const EMPTY_OBJ = {};
836
- const EMPTY_ARRAY = [];
837
- // freezing the values prevents any code from accidentally inserting new values in
838
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
839
- // These property accesses can be ignored because ngDevMode will be set to false
840
- // when optimizing code and the whole if statement will be dropped.
841
- // tslint:disable-next-line:no-toplevel-property-access
842
- Object.freeze(EMPTY_OBJ);
843
- // tslint:disable-next-line:no-toplevel-property-access
844
- Object.freeze(EMPTY_ARRAY);
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
- * @license
849
- * Copyright Google LLC All Rights Reserved.
724
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
725
+ * particular class.
850
726
  *
851
- * Use of this source code is governed by an MIT-style license that can be
852
- * found in the LICENSE file at https://angular.io/license
853
- */
854
- const NG_COMP_DEF = getClosureSafeProperty({ ɵcmp: getClosureSafeProperty });
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
- // TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.
865
- const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
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
- * @license
869
- * Copyright Google LLC All Rights Reserved.
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
- * Use of this source code is governed by an MIT-style license that can be
872
- * found in the LICENSE file at https://angular.io/license
873
- */
874
- /** Counter used to generate unique IDs for component definitions. */
875
- let componentDefCount = 0;
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
- * # Example
881
- * ```
882
- * class MyDirective {
883
- * // Generated by Angular Template Compiler
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
  * ...
@@ -3602,7 +3832,7 @@ class NodeInjector {
3602
3832
  this._lView = _lView;
3603
3833
  }
3604
3834
  get(token, notFoundValue, flags) {
3605
- return getOrCreateInjectable(this._tNode, this._lView, token, flags, notFoundValue);
3835
+ return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);
3606
3836
  }
3607
3837
  }
3608
3838
  /** Creates a `NodeInjector` for the current node. */
@@ -4674,296 +4904,70 @@ class ReflectionCapabilities {
4674
4904
  if (typeOrFunc.propDecorators &&
4675
4905
  typeOrFunc.propDecorators !== parentCtor.propDecorators) {
4676
4906
  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.');
4890
- }
4891
- let type = undefined;
4892
- let flags = InjectFlags.Default;
4893
- for (let j = 0; j < arg.length; j++) {
4894
- const meta = arg[j];
4895
- const flag = getInjectFlag(meta);
4896
- if (typeof flag === 'number') {
4897
- // Special case when we handle @Inject decorator.
4898
- if (flag === -1 /* DecoratorFlags.Inject */) {
4899
- type = meta.token;
4900
- }
4901
- else {
4902
- flags |= flag;
4903
- }
4904
- }
4905
- else {
4906
- type = meta;
4907
+ const propMetadata = {};
4908
+ Object.keys(propDecorators).forEach(prop => {
4909
+ propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
4910
+ });
4911
+ return propMetadata;
4912
+ }
4913
+ // API for metadata created by invoking the decorators.
4914
+ if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
4915
+ return typeOrFunc[PROP_METADATA];
4916
+ }
4917
+ return null;
4918
+ }
4919
+ propMetadata(typeOrFunc) {
4920
+ if (!isType(typeOrFunc)) {
4921
+ return {};
4922
+ }
4923
+ const parentCtor = getParentCtor(typeOrFunc);
4924
+ const propMetadata = {};
4925
+ if (parentCtor !== Object) {
4926
+ const parentPropMetadata = this.propMetadata(parentCtor);
4927
+ Object.keys(parentPropMetadata).forEach((propName) => {
4928
+ propMetadata[propName] = parentPropMetadata[propName];
4929
+ });
4930
+ }
4931
+ const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
4932
+ if (ownPropMetadata) {
4933
+ Object.keys(ownPropMetadata).forEach((propName) => {
4934
+ const decorators = [];
4935
+ if (propMetadata.hasOwnProperty(propName)) {
4936
+ decorators.push(...propMetadata[propName]);
4907
4937
  }
4908
- }
4909
- args.push(ɵɵinject(type, flags));
4938
+ decorators.push(...ownPropMetadata[propName]);
4939
+ propMetadata[propName] = decorators;
4940
+ });
4910
4941
  }
4911
- else {
4912
- args.push(ɵɵinject(arg));
4942
+ return propMetadata;
4943
+ }
4944
+ ownPropMetadata(typeOrFunc) {
4945
+ if (!isType(typeOrFunc)) {
4946
+ return {};
4913
4947
  }
4948
+ return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
4914
4949
  }
4915
- return args;
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]);
4950
+ hasLifecycleHook(type, lcProperty) {
4951
+ return type instanceof Type && lcProperty in type.prototype;
4944
4952
  }
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
4953
  }
4950
- function formatError(text, obj, injectorErrorName, source = null) {
4951
- text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;
4952
- let context = stringify(obj);
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(', ')}}`;
4954
+ function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
4955
+ if (!decoratorInvocations) {
4956
+ return [];
4965
4957
  }
4966
- return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\n ')}`;
4958
+ return decoratorInvocations.map(decoratorInvocation => {
4959
+ const decoratorType = decoratorInvocation.type;
4960
+ const annotationCls = decoratorType.annotationCls;
4961
+ const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
4962
+ return new annotationCls(...annotationArgs);
4963
+ });
4964
+ }
4965
+ function getParentCtor(ctor) {
4966
+ const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
4967
+ const parentCtor = parentProto ? parentProto.constructor : null;
4968
+ // Note: We always use `Object` as the null value
4969
+ // to simplify checking later on.
4970
+ return parentCtor || Object;
4967
4971
  }
4968
4972
 
4969
4973
  /**
@@ -6750,6 +6754,7 @@ class R3Injector extends EnvironmentInjector {
6750
6754
  }
6751
6755
  get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
6752
6756
  this.assertNotDestroyed();
6757
+ flags = convertToBitFlags(flags);
6753
6758
  // Set the injection context.
6754
6759
  const previousInjector = setCurrentInjector(this);
6755
6760
  const previousInjectImplementation = setInjectImplementation(undefined);
@@ -7151,164 +7156,14 @@ class ElementRef {
7151
7156
  */
7152
7157
  ElementRef.__NG_ELEMENT_ID__ = injectElementRef;
7153
7158
  /**
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
-
7163
- /**
7164
- * @license
7165
- * Copyright Google LLC All Rights Reserved.
7166
- *
7167
- * Use of this source code is governed by an MIT-style license that can be
7168
- * found in the LICENSE file at https://angular.io/license
7169
- */
7170
- const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
7171
- /**
7172
- * Creates and initializes a custom renderer that implements the `Renderer2` base class.
7173
- *
7174
- * @publicApi
7175
- */
7176
- class RendererFactory2 {
7177
- }
7178
- /**
7179
- * Extend this base class to implement custom rendering. By default, Angular
7180
- * renders a template into DOM. You can use custom rendering to intercept
7181
- * rendering calls, or to render to something other than DOM.
7182
- *
7183
- * Create your custom renderer using `RendererFactory2`.
7184
- *
7185
- * Use a custom renderer to bypass Angular's templating and
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.
7190
- *
7191
- * @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
- *
7220
- * @publicApi
7221
- */
7222
- class Sanitizer {
7223
- }
7224
- /** @nocollapse */
7225
- Sanitizer.ɵprov = ɵɵdefineInjectable({
7226
- token: Sanitizer,
7227
- providedIn: 'root',
7228
- factory: () => null,
7229
- });
7230
-
7231
- /**
7232
- * @license
7233
- * Copyright Google LLC All Rights Reserved.
7234
- *
7235
- * Use of this source code is governed by an MIT-style license that can be
7236
- * found in the LICENSE file at https://angular.io/license
7237
- */
7238
- /**
7239
- * @description Represents the version of Angular
7240
- *
7241
- * @publicApi
7242
- */
7243
- class Version {
7244
- constructor(full) {
7245
- this.full = full;
7246
- this.major = full.split('.')[0];
7247
- this.minor = full.split('.')[1];
7248
- this.patch = full.split('.').slice(2).join('.');
7249
- }
7250
- }
7251
- /**
7252
- * @publicApi
7253
- */
7254
- const VERSION = new Version('15.0.0-next.3');
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.
7285
- *
7286
- * Use of this source code is governed by an MIT-style license that can be
7287
- * found in the LICENSE file at https://angular.io/license
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.
7294
- *
7295
- * @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.
7159
+ * Unwraps `ElementRef` and return the `nativeElement`.
7306
7160
  *
7307
- * @publicApi
7161
+ * @param value value to unwrap
7162
+ * @returns `nativeElement` if `ElementRef` otherwise returns value as is.
7308
7163
  */
7309
- const NO_ERRORS_SCHEMA = {
7310
- name: 'no-errors-schema'
7311
- };
7164
+ function unwrapElementRef(value) {
7165
+ return value instanceof ElementRef ? value.nativeElement : value;
7166
+ }
7312
7167
 
7313
7168
  /**
7314
7169
  * @license
@@ -7317,263 +7172,117 @@ const NO_ERRORS_SCHEMA = {
7317
7172
  * Use of this source code is governed by an MIT-style license that can be
7318
7173
  * found in the LICENSE file at https://angular.io/license
7319
7174
  */
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
- }
7175
+ const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
7350
7176
  /**
7351
- * Validates that the element is known at runtime and produces
7352
- * an error if it's not the case.
7353
- * This check is relevant for JIT-compiled components (for AOT-compiled
7354
- * ones this check happens at build time).
7355
- *
7356
- * The element is considered known if either:
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
7177
+ * Creates and initializes a custom renderer that implements the `Renderer2` base class.
7361
7178
  *
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
7179
+ * @publicApi
7367
7180
  */
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
- }
7181
+ class RendererFactory2 {
7410
7182
  }
7411
7183
  /**
7412
- * Validates that the property of the element is known at runtime and returns
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).
7184
+ * Extend this base class to implement custom rendering. By default, Angular
7185
+ * renders a template into DOM. You can use custom rendering to intercept
7186
+ * rendering calls, or to render to something other than DOM.
7416
7187
  *
7417
- * The property is considered known if either:
7418
- * - it's a known property of the element
7419
- * - the element is allowed by one of the schemas
7420
- * - the property is used for animations
7188
+ * Create your custom renderer using `RendererFactory2`.
7421
7189
  *
7422
- * @param element Element to validate
7423
- * @param propName Name of the property to check
7424
- * @param tagName Name of the tag hosting the property
7425
- * @param schemas Array of schemas
7190
+ * Use a custom renderer to bypass Angular's templating and
7191
+ * make custom UI changes that can't be expressed declaratively.
7192
+ * For example if you need to set a property or an attribute whose name is
7193
+ * not statically known, use the `setProperty()` or
7194
+ * `setAttribute()` method.
7195
+ *
7196
+ * @publicApi
7426
7197
  */
7427
- function isPropertyValid(element, propName, tagName, schemas) {
7428
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7429
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7430
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7431
- // execute the check below.
7432
- if (schemas === null)
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;
7438
- }
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);
7198
+ class Renderer2 {
7442
7199
  }
7443
7200
  /**
7444
- * Logs or throws an error that a property is not supported on an element.
7445
- *
7446
- * @param propName Name of the invalid property
7447
- * @param tagName Name of the tag hosting the property
7448
- * @param nodeType Type of the node hosting the property
7449
- * @param lView An `LView` that represents a current component
7201
+ * @internal
7202
+ * @nocollapse
7450
7203
  */
7451
- function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
7452
- // Special-case a situation when a structural directive is applied to
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);
7493
- }
7494
- function reportUnknownPropertyError(message) {
7495
- if (shouldThrowErrorOnUnknownProperty) {
7496
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
7497
- }
7498
- else {
7499
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
7500
- }
7204
+ Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
7205
+ /** Injects a Renderer2 for the current component. */
7206
+ function injectRenderer2() {
7207
+ // We need the Renderer to be based on the component that it's being injected into, however since
7208
+ // DI happens before we've entered its view, `getLView` will return the parent view instead.
7209
+ const lView = getLView();
7210
+ const tNode = getCurrentTNode();
7211
+ const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
7212
+ return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
7501
7213
  }
7214
+
7502
7215
  /**
7503
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7504
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7505
- * be too slow for production mode and also it relies on the constructor function being available.
7506
- *
7507
- * Gets a reference to the host component def (where a current component is declared).
7216
+ * @license
7217
+ * Copyright Google LLC All Rights Reserved.
7508
7218
  *
7509
- * @param lView An `LView` that represents a current component that is being rendered.
7219
+ * Use of this source code is governed by an MIT-style license that can be
7220
+ * found in the LICENSE file at https://angular.io/license
7510
7221
  */
7511
- function getDeclarationComponentDef(lView) {
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;
7519
- }
7520
7222
  /**
7521
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7522
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7523
- * be too slow for production mode.
7524
- *
7525
- * Checks if the current component is declared inside of a standalone component template.
7223
+ * Sanitizer is used by the views to sanitize potentially dangerous values.
7526
7224
  *
7527
- * @param lView An `LView` that represents a current component that is being rendered.
7225
+ * @publicApi
7528
7226
  */
7529
- function isHostComponentStandalone(lView) {
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;
7227
+ class Sanitizer {
7534
7228
  }
7535
- /**
7536
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7537
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7538
- * be too slow for production mode.
7229
+ /** @nocollapse */
7230
+ Sanitizer.ɵprov = ɵɵdefineInjectable({
7231
+ token: Sanitizer,
7232
+ providedIn: 'root',
7233
+ factory: () => null,
7234
+ });
7235
+
7236
+ /**
7237
+ * @license
7238
+ * Copyright Google LLC All Rights Reserved.
7539
7239
  *
7540
- * Constructs a string describing the location of the host component template. The function is used
7541
- * in dev mode to produce error messages.
7240
+ * Use of this source code is governed by an MIT-style license that can be
7241
+ * found in the LICENSE file at https://angular.io/license
7242
+ */
7243
+ /**
7244
+ * @description Represents the version of Angular
7542
7245
  *
7543
- * @param lView An `LView` that represents a current component that is being rendered.
7246
+ * @publicApi
7544
7247
  */
7545
- function getTemplateLocationDetails(lView) {
7546
- !ngDevMode && throwError('Must never be called in production mode');
7547
- const hostComponentDef = getDeclarationComponentDef(lView);
7548
- const componentClassName = hostComponentDef?.type?.name;
7549
- return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
7248
+ class Version {
7249
+ constructor(full) {
7250
+ this.full = full;
7251
+ this.major = full.split('.')[0];
7252
+ this.minor = full.split('.')[1];
7253
+ this.patch = full.split('.').slice(2).join('.');
7254
+ }
7550
7255
  }
7551
7256
  /**
7552
- * The set of known control flow directives and their corresponding imports.
7553
- * We use this set to produce a more precises error message with a note
7554
- * that the `CommonModule` should also be included.
7257
+ * @publicApi
7555
7258
  */
7556
- const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
7557
- ['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
7558
- ['ngSwitchDefault', 'NgSwitchDefault']
7559
- ]);
7259
+ const VERSION = new Version('15.0.0-next.4');
7260
+
7560
7261
  /**
7561
- * Returns true if the tag name is allowed by specified schemas.
7562
- * @param schemas Array of schemas
7563
- * @param tagName Name of the tag
7262
+ * @license
7263
+ * Copyright Google LLC All Rights Reserved.
7264
+ *
7265
+ * Use of this source code is governed by an MIT-style license that can be
7266
+ * found in the LICENSE file at https://angular.io/license
7564
7267
  */
7565
- function matchingSchemas(schemas, tagName) {
7566
- if (schemas !== null) {
7567
- for (let i = 0; i < schemas.length; i++) {
7568
- const schema = schemas[i];
7569
- if (schema === NO_ERRORS_SCHEMA ||
7570
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
7571
- return true;
7572
- }
7573
- }
7574
- }
7575
- return false;
7576
- }
7268
+ // This default value is when checking the hierarchy for a token.
7269
+ //
7270
+ // It means both:
7271
+ // - the token is not provided by the current injector,
7272
+ // - only the element injectors should be checked (ie do not check module injectors
7273
+ //
7274
+ // mod1
7275
+ // /
7276
+ // el1 mod2
7277
+ // \ /
7278
+ // el2
7279
+ //
7280
+ // When requesting el2.injector.get(token), we should check in the following order and return the
7281
+ // first found value:
7282
+ // - el2.injector.get(token, default)
7283
+ // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
7284
+ // - mod2.injector.get(token, default)
7285
+ const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
7577
7286
 
7578
7287
  /**
7579
7288
  * @license
@@ -7582,15 +7291,28 @@ function matchingSchemas(schemas, tagName) {
7582
7291
  * Use of this source code is governed by an MIT-style license that can be
7583
7292
  * found in the LICENSE file at https://angular.io/license
7584
7293
  */
7585
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
7586
- function wrappedError(message, originalError) {
7587
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
7588
- const error = Error(msg);
7589
- error[ERROR_ORIGINAL_ERROR] = originalError;
7590
- return error;
7294
+ // Keeps track of the currently-active LViews.
7295
+ const TRACKED_LVIEWS = new Map();
7296
+ // Used for generating unique IDs for LViews.
7297
+ let uniqueIdCounter = 0;
7298
+ /** Gets a unique ID that can be assigned to an LView. */
7299
+ function getUniqueLViewId() {
7300
+ return uniqueIdCounter++;
7591
7301
  }
7592
- function getOriginalError(error) {
7593
- return error[ERROR_ORIGINAL_ERROR];
7302
+ /** Starts tracking an LView. */
7303
+ function registerLView(lView) {
7304
+ ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');
7305
+ TRACKED_LVIEWS.set(lView[ID], lView);
7306
+ }
7307
+ /** Gets an LView by its unique ID. */
7308
+ function getLViewById(id) {
7309
+ ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');
7310
+ return TRACKED_LVIEWS.get(id) || null;
7311
+ }
7312
+ /** Stops tracking an LView. */
7313
+ function unregisterLView(lView) {
7314
+ ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');
7315
+ TRACKED_LVIEWS.delete(lView[ID]);
7594
7316
  }
7595
7317
 
7596
7318
  /**
@@ -7601,158 +7323,345 @@ function getOriginalError(error) {
7601
7323
  * found in the LICENSE file at https://angular.io/license
7602
7324
  */
7603
7325
  /**
7604
- * Provides a hook for centralized exception handling.
7326
+ * The internal view context which is specific to a given DOM element, directive or
7327
+ * component instance. Each value in here (besides the LView and element node details)
7328
+ * can be present, null or undefined. If undefined then it implies the value has not been
7329
+ * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.
7605
7330
  *
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.
7331
+ * Each value will get filled when the respective value is examined within the getContext
7332
+ * function. The component, element and each directive instance will share the same instance
7333
+ * of the context.
7334
+ */
7335
+ class LContext {
7336
+ constructor(
7337
+ /**
7338
+ * ID of the component's parent view data.
7339
+ */
7340
+ lViewId,
7341
+ /**
7342
+ * The index instance of the node.
7343
+ */
7344
+ nodeIndex,
7345
+ /**
7346
+ * The instance of the DOM node that is attached to the lNode.
7347
+ */
7348
+ native) {
7349
+ this.lViewId = lViewId;
7350
+ this.nodeIndex = nodeIndex;
7351
+ this.native = native;
7352
+ }
7353
+ /** Component's parent view data. */
7354
+ get lView() {
7355
+ return getLViewById(this.lViewId);
7356
+ }
7357
+ }
7358
+
7359
+ /**
7360
+ * @license
7361
+ * Copyright Google LLC All Rights Reserved.
7609
7362
  *
7610
- * @usageNotes
7611
- * ### Example
7363
+ * Use of this source code is governed by an MIT-style license that can be
7364
+ * found in the LICENSE file at https://angular.io/license
7365
+ */
7366
+ /**
7367
+ * Returns the matching `LContext` data for a given DOM node, directive or component instance.
7612
7368
  *
7613
- * ```
7614
- * class MyErrorHandler implements ErrorHandler {
7615
- * handleError(error) {
7616
- * // do something with the exception
7617
- * }
7618
- * }
7369
+ * This function will examine the provided DOM element, component, or directive instance\'s
7370
+ * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched
7371
+ * value will be that of the newly created `LContext`.
7619
7372
  *
7620
- * @NgModule({
7621
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
7622
- * })
7623
- * class MyModule {}
7624
- * ```
7373
+ * If the monkey-patched value is the `LView` instance then the context value for that
7374
+ * target will be created and the monkey-patch reference will be updated. Therefore when this
7375
+ * function is called it may mutate the provided element\'s, component\'s or any of the associated
7376
+ * directive\'s monkey-patch values.
7625
7377
  *
7626
- * @publicApi
7378
+ * If the monkey-patch value is not detected then the code will walk up the DOM until an element
7379
+ * is found which contains a monkey-patch reference. When that occurs then the provided element
7380
+ * will be updated with a new context (which is then returned). If the monkey-patch value is not
7381
+ * detected for a component/directive instance then it will throw an error (all components and
7382
+ * directives should be automatically monkey-patched by ivy).
7383
+ *
7384
+ * @param target Component, Directive or DOM Node.
7627
7385
  */
7628
- class ErrorHandler {
7629
- constructor() {
7630
- /**
7631
- * @internal
7632
- */
7633
- this._console = console;
7634
- }
7635
- handleError(error) {
7636
- const originalError = this._findOriginalError(error);
7637
- this._console.error('ERROR', error);
7638
- if (originalError) {
7639
- this._console.error('ORIGINAL ERROR', originalError);
7386
+ function getLContext(target) {
7387
+ let mpValue = readPatchedData(target);
7388
+ if (mpValue) {
7389
+ // only when it's an array is it considered an LView instance
7390
+ // ... otherwise it's an already constructed LContext instance
7391
+ if (isLView(mpValue)) {
7392
+ const lView = mpValue;
7393
+ let nodeIndex;
7394
+ let component = undefined;
7395
+ let directives = undefined;
7396
+ if (isComponentInstance(target)) {
7397
+ nodeIndex = findViaComponent(lView, target);
7398
+ if (nodeIndex == -1) {
7399
+ throw new Error('The provided component was not found in the application');
7400
+ }
7401
+ component = target;
7402
+ }
7403
+ else if (isDirectiveInstance(target)) {
7404
+ nodeIndex = findViaDirective(lView, target);
7405
+ if (nodeIndex == -1) {
7406
+ throw new Error('The provided directive was not found in the application');
7407
+ }
7408
+ directives = getDirectivesAtNodeIndex(nodeIndex, lView);
7409
+ }
7410
+ else {
7411
+ nodeIndex = findViaNativeElement(lView, target);
7412
+ if (nodeIndex == -1) {
7413
+ return null;
7414
+ }
7415
+ }
7416
+ // the goal is not to fill the entire context full of data because the lookups
7417
+ // are expensive. Instead, only the target data (the element, component, container, ICU
7418
+ // expression or directive details) are filled into the context. If called multiple times
7419
+ // with different target values then the missing target data will be filled in.
7420
+ const native = unwrapRNode(lView[nodeIndex]);
7421
+ const existingCtx = readPatchedData(native);
7422
+ const context = (existingCtx && !Array.isArray(existingCtx)) ?
7423
+ existingCtx :
7424
+ createLContext(lView, nodeIndex, native);
7425
+ // only when the component has been discovered then update the monkey-patch
7426
+ if (component && context.component === undefined) {
7427
+ context.component = component;
7428
+ attachPatchData(context.component, context);
7429
+ }
7430
+ // only when the directives have been discovered then update the monkey-patch
7431
+ if (directives && context.directives === undefined) {
7432
+ context.directives = directives;
7433
+ for (let i = 0; i < directives.length; i++) {
7434
+ attachPatchData(directives[i], context);
7435
+ }
7436
+ }
7437
+ attachPatchData(context.native, context);
7438
+ mpValue = context;
7640
7439
  }
7641
7440
  }
7642
- /** @internal */
7643
- _findOriginalError(error) {
7644
- let e = error && getOriginalError(error);
7645
- while (e && getOriginalError(e)) {
7646
- e = getOriginalError(e);
7441
+ else {
7442
+ const rElement = target;
7443
+ ngDevMode && assertDomNode(rElement);
7444
+ // if the context is not found then we need to traverse upwards up the DOM
7445
+ // to find the nearest element that has already been monkey patched with data
7446
+ let parent = rElement;
7447
+ while (parent = parent.parentNode) {
7448
+ const parentContext = readPatchedData(parent);
7449
+ if (parentContext) {
7450
+ const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
7451
+ // the edge of the app was also reached here through another means
7452
+ // (maybe because the DOM was changed manually).
7453
+ if (!lView) {
7454
+ return null;
7455
+ }
7456
+ const index = findViaNativeElement(lView, rElement);
7457
+ if (index >= 0) {
7458
+ const native = unwrapRNode(lView[index]);
7459
+ const context = createLContext(lView, index, native);
7460
+ attachPatchData(native, context);
7461
+ mpValue = context;
7462
+ break;
7463
+ }
7464
+ }
7647
7465
  }
7648
- return e || null;
7649
7466
  }
7467
+ return mpValue || null;
7650
7468
  }
7651
-
7652
7469
  /**
7653
- * @license
7654
- * Copyright Google LLC All Rights Reserved.
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
7470
+ * Creates an empty instance of a `LContext` context
7658
7471
  */
7472
+ function createLContext(lView, nodeIndex, native) {
7473
+ return new LContext(lView[ID], nodeIndex, native);
7474
+ }
7659
7475
  /**
7660
- * Disallowed strings in the comment.
7476
+ * Takes a component instance and returns the view for that component.
7661
7477
  *
7662
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
7478
+ * @param componentInstance
7479
+ * @returns The component's view
7663
7480
  */
7664
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
7481
+ function getComponentViewByInstance(componentInstance) {
7482
+ let patchedData = readPatchedData(componentInstance);
7483
+ let lView;
7484
+ if (isLView(patchedData)) {
7485
+ const contextLView = patchedData;
7486
+ const nodeIndex = findViaComponent(contextLView, componentInstance);
7487
+ lView = getComponentLViewByIndex(nodeIndex, contextLView);
7488
+ const context = createLContext(contextLView, nodeIndex, lView[HOST]);
7489
+ context.component = componentInstance;
7490
+ attachPatchData(componentInstance, context);
7491
+ attachPatchData(context.native, context);
7492
+ }
7493
+ else {
7494
+ const context = patchedData;
7495
+ const contextLView = context.lView;
7496
+ ngDevMode && assertLView(contextLView);
7497
+ lView = getComponentLViewByIndex(context.nodeIndex, contextLView);
7498
+ }
7499
+ return lView;
7500
+ }
7665
7501
  /**
7666
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
7502
+ * This property will be monkey-patched on elements, components and directives.
7667
7503
  */
7668
- const COMMENT_DELIMITER = /(<|>)/;
7669
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
7504
+ const MONKEY_PATCH_KEY_NAME = '__ngContext__';
7670
7505
  /**
7671
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
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.
7506
+ * Assigns the given data to the given target (which could be a component,
7507
+ * directive or DOM node instance) using monkey-patching.
7696
7508
  */
7697
- function escapeCommentText(value) {
7698
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
7509
+ function attachPatchData(target, data) {
7510
+ ngDevMode && assertDefined(target, 'Target expected');
7511
+ // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this
7512
+ // for `LView`, because we have control over when an `LView` is created and destroyed, whereas
7513
+ // we can't know when to remove an `LContext`.
7514
+ if (isLView(data)) {
7515
+ target[MONKEY_PATCH_KEY_NAME] = data[ID];
7516
+ registerLView(data);
7517
+ }
7518
+ else {
7519
+ target[MONKEY_PATCH_KEY_NAME] = data;
7520
+ }
7699
7521
  }
7700
-
7701
7522
  /**
7702
- * @license
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
7523
+ * Returns the monkey-patch value data present on the target (which could be
7524
+ * a component, directive or a DOM node).
7707
7525
  */
7708
- function normalizeDebugBindingName(name) {
7709
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
7710
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
7711
- return `ng-reflect-${name}`;
7526
+ function readPatchedData(target) {
7527
+ ngDevMode && assertDefined(target, 'Target expected');
7528
+ const data = target[MONKEY_PATCH_KEY_NAME];
7529
+ return (typeof data === 'number') ? getLViewById(data) : data || null;
7712
7530
  }
7713
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
7714
- function camelCaseToDashCase(input) {
7715
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
7531
+ function readPatchedLView(target) {
7532
+ const value = readPatchedData(target);
7533
+ if (value) {
7534
+ return (isLView(value) ? value : value.lView);
7535
+ }
7536
+ return null;
7716
7537
  }
7717
- function normalizeDebugBindingValue(value) {
7718
- try {
7719
- // Limit the size of the value as otherwise the DOM just gets polluted.
7720
- return value != null ? value.toString().slice(0, 30) : value;
7538
+ function isComponentInstance(instance) {
7539
+ return instance && instance.constructor && instance.constructor.ɵcmp;
7540
+ }
7541
+ function isDirectiveInstance(instance) {
7542
+ return instance && instance.constructor && instance.constructor.ɵdir;
7543
+ }
7544
+ /**
7545
+ * Locates the element within the given LView and returns the matching index
7546
+ */
7547
+ function findViaNativeElement(lView, target) {
7548
+ const tView = lView[TVIEW];
7549
+ for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
7550
+ if (unwrapRNode(lView[i]) === target) {
7551
+ return i;
7552
+ }
7721
7553
  }
7722
- catch (e) {
7723
- return '[ERROR] Exception while trying to serialize the value';
7554
+ return -1;
7555
+ }
7556
+ /**
7557
+ * Locates the next tNode (child, sibling or parent).
7558
+ */
7559
+ function traverseNextElement(tNode) {
7560
+ if (tNode.child) {
7561
+ return tNode.child;
7562
+ }
7563
+ else if (tNode.next) {
7564
+ return tNode.next;
7565
+ }
7566
+ else {
7567
+ // Let's take the following template: <div><span>text</span></div><component/>
7568
+ // After checking the text node, we need to find the next parent that has a "next" TNode,
7569
+ // in this case the parent `div`, so that we can find the component.
7570
+ while (tNode.parent && !tNode.parent.next) {
7571
+ tNode = tNode.parent;
7572
+ }
7573
+ return tNode.parent && tNode.parent.next;
7724
7574
  }
7725
7575
  }
7726
-
7727
7576
  /**
7728
- * @license
7729
- * Copyright Google LLC All Rights Reserved.
7730
- *
7731
- * Use of this source code is governed by an MIT-style license that can be
7732
- * found in the LICENSE file at https://angular.io/license
7577
+ * Locates the component within the given LView and returns the matching index
7733
7578
  */
7734
- // Keeps track of the currently-active LViews.
7735
- const TRACKED_LVIEWS = new Map();
7736
- // Used for generating unique IDs for LViews.
7737
- let uniqueIdCounter = 0;
7738
- /** Gets a unique ID that can be assigned to an LView. */
7739
- function getUniqueLViewId() {
7740
- return uniqueIdCounter++;
7579
+ function findViaComponent(lView, componentInstance) {
7580
+ const componentIndices = lView[TVIEW].components;
7581
+ if (componentIndices) {
7582
+ for (let i = 0; i < componentIndices.length; i++) {
7583
+ const elementComponentIndex = componentIndices[i];
7584
+ const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
7585
+ if (componentView[CONTEXT] === componentInstance) {
7586
+ return elementComponentIndex;
7587
+ }
7588
+ }
7589
+ }
7590
+ else {
7591
+ const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
7592
+ const rootComponent = rootComponentView[CONTEXT];
7593
+ if (rootComponent === componentInstance) {
7594
+ // we are dealing with the root element here therefore we know that the
7595
+ // element is the very first element after the HEADER data in the lView
7596
+ return HEADER_OFFSET;
7597
+ }
7598
+ }
7599
+ return -1;
7741
7600
  }
7742
- /** Starts tracking an LView. */
7743
- function registerLView(lView) {
7744
- ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');
7745
- TRACKED_LVIEWS.set(lView[ID], lView);
7601
+ /**
7602
+ * Locates the directive within the given LView and returns the matching index
7603
+ */
7604
+ function findViaDirective(lView, directiveInstance) {
7605
+ // if a directive is monkey patched then it will (by default)
7606
+ // have a reference to the LView of the current view. The
7607
+ // element bound to the directive being search lives somewhere
7608
+ // in the view data. We loop through the nodes and check their
7609
+ // list of directives for the instance.
7610
+ let tNode = lView[TVIEW].firstChild;
7611
+ while (tNode) {
7612
+ const directiveIndexStart = tNode.directiveStart;
7613
+ const directiveIndexEnd = tNode.directiveEnd;
7614
+ for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
7615
+ if (lView[i] === directiveInstance) {
7616
+ return tNode.index;
7617
+ }
7618
+ }
7619
+ tNode = traverseNextElement(tNode);
7620
+ }
7621
+ return -1;
7746
7622
  }
7747
- /** Gets an LView by its unique ID. */
7748
- function getLViewById(id) {
7749
- ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');
7750
- return TRACKED_LVIEWS.get(id) || null;
7623
+ /**
7624
+ * Returns a list of directives applied to a node at a specific index. The list includes
7625
+ * directives matched by selector and any host directives, but it excludes components.
7626
+ * Use `getComponentAtNodeIndex` to find the component applied to a node.
7627
+ *
7628
+ * @param nodeIndex The node index
7629
+ * @param lView The target view data
7630
+ */
7631
+ function getDirectivesAtNodeIndex(nodeIndex, lView) {
7632
+ const tNode = lView[TVIEW].data[nodeIndex];
7633
+ if (tNode.directiveStart === 0)
7634
+ return EMPTY_ARRAY;
7635
+ const results = [];
7636
+ for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
7637
+ const directiveInstance = lView[i];
7638
+ if (!isComponentInstance(directiveInstance)) {
7639
+ results.push(directiveInstance);
7640
+ }
7641
+ }
7642
+ return results;
7751
7643
  }
7752
- /** Stops tracking an LView. */
7753
- function unregisterLView(lView) {
7754
- ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');
7755
- TRACKED_LVIEWS.delete(lView[ID]);
7644
+ function getComponentAtNodeIndex(nodeIndex, lView) {
7645
+ const tNode = lView[TVIEW].data[nodeIndex];
7646
+ const { directiveStart, componentOffset } = tNode;
7647
+ return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
7648
+ }
7649
+ /**
7650
+ * Returns a map of local references (local reference name => element or directive instance) that
7651
+ * exist on a given element.
7652
+ */
7653
+ function discoverLocalRefs(lView, nodeIndex) {
7654
+ const tNode = lView[TVIEW].data[nodeIndex];
7655
+ if (tNode && tNode.localNames) {
7656
+ const result = {};
7657
+ let localIndex = tNode.index + 1;
7658
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
7659
+ result[tNode.localNames[i]] = lView[localIndex];
7660
+ localIndex++;
7661
+ }
7662
+ return result;
7663
+ }
7664
+ return null;
7756
7665
  }
7757
7666
 
7758
7667
  /**
@@ -7763,38 +7672,28 @@ function unregisterLView(lView) {
7763
7672
  * found in the LICENSE file at https://angular.io/license
7764
7673
  */
7765
7674
  /**
7766
- * The internal view context which is specific to a given DOM element, directive or
7767
- * component instance. Each value in here (besides the LView and element node details)
7768
- * can be present, null or undefined. If undefined then it implies the value has not been
7769
- * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.
7675
+ * Defines a schema that allows an NgModule to contain the following:
7676
+ * - Non-Angular elements named with dash case (`-`).
7677
+ * - Element properties named with dash case (`-`).
7678
+ * Dash case is the naming convention for custom elements.
7770
7679
  *
7771
- * Each value will get filled when the respective value is examined within the getContext
7772
- * function. The component, element and each directive instance will share the same instance
7773
- * of the context.
7680
+ * @publicApi
7774
7681
  */
7775
- class LContext {
7776
- constructor(
7777
- /**
7778
- * ID of the component's parent view data.
7779
- */
7780
- lViewId,
7781
- /**
7782
- * The index instance of the node.
7783
- */
7784
- nodeIndex,
7785
- /**
7786
- * The instance of the DOM node that is attached to the lNode.
7787
- */
7788
- native) {
7789
- this.lViewId = lViewId;
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
- }
7682
+ const CUSTOM_ELEMENTS_SCHEMA = {
7683
+ name: 'custom-elements'
7684
+ };
7685
+ /**
7686
+ * Defines a schema that allows any property on any element.
7687
+ *
7688
+ * This schema allows you to ignore the errors related to any unknown elements or properties in a
7689
+ * template. The usage of this schema is generally discouraged because it prevents useful validation
7690
+ * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
7691
+ *
7692
+ * @publicApi
7693
+ */
7694
+ const NO_ERRORS_SCHEMA = {
7695
+ name: 'no-errors-schema'
7696
+ };
7798
7697
 
7799
7698
  /**
7800
7699
  * @license
@@ -7803,305 +7702,411 @@ class LContext {
7803
7702
  * Use of this source code is governed by an MIT-style license that can be
7804
7703
  * found in the LICENSE file at https://angular.io/license
7805
7704
  */
7705
+ let shouldThrowErrorOnUnknownElement = false;
7806
7706
  /**
7807
- * Returns the matching `LContext` data for a given DOM node, directive or component instance.
7808
- *
7809
- * This function will examine the provided DOM element, component, or directive instance\'s
7810
- * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched
7811
- * value will be that of the newly created `LContext`.
7812
- *
7813
- * If the monkey-patched value is the `LView` instance then the context value for that
7814
- * target will be created and the monkey-patch reference will be updated. Therefore when this
7815
- * function is called it may mutate the provided element\'s, component\'s or any of the associated
7816
- * directive\'s monkey-patch values.
7707
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
7708
+ * instead of just logging the error.
7709
+ * (for AOT-compiled ones this check happens at build time).
7710
+ */
7711
+ function ɵsetUnknownElementStrictMode(shouldThrow) {
7712
+ shouldThrowErrorOnUnknownElement = shouldThrow;
7713
+ }
7714
+ /**
7715
+ * Gets the current value of the strict mode.
7716
+ */
7717
+ function ɵgetUnknownElementStrictMode() {
7718
+ return shouldThrowErrorOnUnknownElement;
7719
+ }
7720
+ let shouldThrowErrorOnUnknownProperty = false;
7721
+ /**
7722
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
7723
+ * instead of just logging the error.
7724
+ * (for AOT-compiled ones this check happens at build time).
7725
+ */
7726
+ function ɵsetUnknownPropertyStrictMode(shouldThrow) {
7727
+ shouldThrowErrorOnUnknownProperty = shouldThrow;
7728
+ }
7729
+ /**
7730
+ * Gets the current value of the strict mode.
7731
+ */
7732
+ function ɵgetUnknownPropertyStrictMode() {
7733
+ return shouldThrowErrorOnUnknownProperty;
7734
+ }
7735
+ /**
7736
+ * Validates that the element is known at runtime and produces
7737
+ * an error if it's not the case.
7738
+ * This check is relevant for JIT-compiled components (for AOT-compiled
7739
+ * ones this check happens at build time).
7817
7740
  *
7818
- * If the monkey-patch value is not detected then the code will walk up the DOM until an element
7819
- * is found which contains a monkey-patch reference. When that occurs then the provided element
7820
- * will be updated with a new context (which is then returned). If the monkey-patch value is not
7821
- * detected for a component/directive instance then it will throw an error (all components and
7822
- * directives should be automatically monkey-patched by ivy).
7741
+ * The element is considered known if either:
7742
+ * - it's a known HTML element
7743
+ * - it's a known custom element
7744
+ * - the element matches any directive
7745
+ * - the element is allowed by one of the schemas
7823
7746
  *
7824
- * @param target Component, Directive or DOM Node.
7747
+ * @param element Element to validate
7748
+ * @param lView An `LView` that represents a current component that is being rendered
7749
+ * @param tagName Name of the tag to check
7750
+ * @param schemas Array of schemas
7751
+ * @param hasDirectives Boolean indicating that the element matches any directive
7825
7752
  */
7826
- function getLContext(target) {
7827
- let mpValue = readPatchedData(target);
7828
- if (mpValue) {
7829
- // only when it's an array is it considered an LView instance
7830
- // ... otherwise it's an already constructed LContext instance
7831
- if (isLView(mpValue)) {
7832
- const lView = mpValue;
7833
- let nodeIndex;
7834
- let component = undefined;
7835
- let directives = undefined;
7836
- if (isComponentInstance(target)) {
7837
- nodeIndex = findViaComponent(lView, target);
7838
- if (nodeIndex == -1) {
7839
- throw new Error('The provided component was not found in the application');
7840
- }
7841
- component = target;
7842
- }
7843
- else if (isDirectiveInstance(target)) {
7844
- nodeIndex = findViaDirective(lView, target);
7845
- if (nodeIndex == -1) {
7846
- throw new Error('The provided directive was not found in the application');
7847
- }
7848
- directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
7753
+ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
7754
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7755
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7756
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7757
+ // execute the check below.
7758
+ if (schemas === null)
7759
+ return;
7760
+ // If the element matches any directive, it's considered as valid.
7761
+ if (!hasDirectives && tagName !== null) {
7762
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
7763
+ // as a custom element. Note that unknown elements with a dash in their name won't be instances
7764
+ // of HTMLUnknownElement in browsers that support web components.
7765
+ const isUnknown =
7766
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
7767
+ // because while most browsers return 'function', IE returns 'object'.
7768
+ (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
7769
+ element instanceof HTMLUnknownElement) ||
7770
+ (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
7771
+ !customElements.get(tagName));
7772
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
7773
+ const isHostStandalone = isHostComponentStandalone(lView);
7774
+ const templateLocation = getTemplateLocationDetails(lView);
7775
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
7776
+ let message = `'${tagName}' is not a known element${templateLocation}:\n`;
7777
+ message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
7778
+ 'a part of an @NgModule where this component is declared'}.\n`;
7779
+ if (tagName && tagName.indexOf('-') > -1) {
7780
+ message +=
7781
+ `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
7849
7782
  }
7850
7783
  else {
7851
- nodeIndex = findViaNativeElement(lView, target);
7852
- if (nodeIndex == -1) {
7853
- return null;
7854
- }
7855
- }
7856
- // the goal is not to fill the entire context full of data because the lookups
7857
- // are expensive. Instead, only the target data (the element, component, container, ICU
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);
7784
+ message +=
7785
+ `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
7869
7786
  }
7870
- // only when the directives have been discovered then update the monkey-patch
7871
- if (directives && context.directives === undefined) {
7872
- context.directives = directives;
7873
- for (let i = 0; i < directives.length; i++) {
7874
- attachPatchData(directives[i], context);
7875
- }
7787
+ if (shouldThrowErrorOnUnknownElement) {
7788
+ throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
7876
7789
  }
7877
- attachPatchData(context.native, context);
7878
- mpValue = context;
7879
- }
7880
- }
7881
- else {
7882
- const rElement = target;
7883
- ngDevMode && assertDomNode(rElement);
7884
- // if the context is not found then we need to traverse upwards up the DOM
7885
- // to find the nearest element that has already been monkey patched with data
7886
- let parent = rElement;
7887
- while (parent = parent.parentNode) {
7888
- const parentContext = readPatchedData(parent);
7889
- if (parentContext) {
7890
- const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
7891
- // the edge of the app was also reached here through another means
7892
- // (maybe because the DOM was changed manually).
7893
- if (!lView) {
7894
- return null;
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
- }
7790
+ else {
7791
+ console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
7904
7792
  }
7905
7793
  }
7906
7794
  }
7907
- return mpValue || null;
7908
7795
  }
7909
7796
  /**
7910
- * Creates an empty instance of a `LContext` context
7797
+ * Validates that the property of the element is known at runtime and returns
7798
+ * false if it's not the case.
7799
+ * This check is relevant for JIT-compiled components (for AOT-compiled
7800
+ * ones this check happens at build time).
7801
+ *
7802
+ * The property is considered known if either:
7803
+ * - it's a known property of the element
7804
+ * - the element is allowed by one of the schemas
7805
+ * - the property is used for animations
7806
+ *
7807
+ * @param element Element to validate
7808
+ * @param propName Name of the property to check
7809
+ * @param tagName Name of the tag hosting the property
7810
+ * @param schemas Array of schemas
7911
7811
  */
7912
- function createLContext(lView, nodeIndex, native) {
7913
- return new LContext(lView[ID], nodeIndex, native);
7812
+ function isPropertyValid(element, propName, tagName, schemas) {
7813
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7814
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7815
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7816
+ // execute the check below.
7817
+ if (schemas === null)
7818
+ return true;
7819
+ // The property is considered valid if the element matches the schema, it exists on the element,
7820
+ // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
7821
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
7822
+ return true;
7823
+ }
7824
+ // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
7825
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
7826
+ return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
7914
7827
  }
7915
7828
  /**
7916
- * Takes a component instance and returns the view for that component.
7829
+ * Logs or throws an error that a property is not supported on an element.
7917
7830
  *
7918
- * @param componentInstance
7919
- * @returns The component's view
7831
+ * @param propName Name of the invalid property
7832
+ * @param tagName Name of the tag hosting the property
7833
+ * @param nodeType Type of the node hosting the property
7834
+ * @param lView An `LView` that represents a current component
7920
7835
  */
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);
7836
+ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
7837
+ // Special-case a situation when a structural directive is applied to
7838
+ // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
7839
+ // In this case the compiler generates the `ɵɵtemplate` instruction with
7840
+ // the `null` as the tagName. The directive matching logic at runtime relies
7841
+ // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
7842
+ // a default value of the `tNode.value` is not feasible at this moment.
7843
+ if (!tagName && nodeType === 4 /* TNodeType.Container */) {
7844
+ tagName = 'ng-template';
7845
+ }
7846
+ const isHostStandalone = isHostComponentStandalone(lView);
7847
+ const templateLocation = getTemplateLocationDetails(lView);
7848
+ let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
7849
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
7850
+ const importLocation = isHostStandalone ?
7851
+ 'included in the \'@Component.imports\' of this component' :
7852
+ 'a part of an @NgModule where this component is declared';
7853
+ if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
7854
+ // Most likely this is a control flow directive (such as `*ngIf`) used in
7855
+ // a template, but the directive or the `CommonModule` is not imported.
7856
+ const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
7857
+ message += `\nIf the '${propName}' is an Angular control flow directive, ` +
7858
+ `please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
7932
7859
  }
7933
7860
  else {
7934
- const context = patchedData;
7935
- const contextLView = context.lView;
7936
- ngDevMode && assertLView(contextLView);
7937
- lView = getComponentLViewByIndex(context.nodeIndex, contextLView);
7861
+ // May be an Angular component, which is not imported/declared?
7862
+ message += `\n1. If '${tagName}' is an Angular component and it has the ` +
7863
+ `'${propName}' input, then verify that it is ${importLocation}.`;
7864
+ // May be a Web Component?
7865
+ if (tagName && tagName.indexOf('-') > -1) {
7866
+ message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
7867
+ `to the ${schemas} of this component to suppress this message.`;
7868
+ message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
7869
+ `the ${schemas} of this component.`;
7870
+ }
7871
+ else {
7872
+ // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
7873
+ message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
7874
+ `the ${schemas} of this component.`;
7875
+ }
7938
7876
  }
7939
- return lView;
7877
+ reportUnknownPropertyError(message);
7940
7878
  }
7941
- /**
7942
- * This property will be monkey-patched on elements, components and directives.
7943
- */
7944
- const MONKEY_PATCH_KEY_NAME = '__ngContext__';
7945
- /**
7946
- * Assigns the given data to the given target (which could be a component,
7947
- * directive or DOM node instance) using monkey-patching.
7948
- */
7949
- function attachPatchData(target, data) {
7950
- ngDevMode && assertDefined(target, 'Target expected');
7951
- // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this
7952
- // for `LView`, because we have control over when an `LView` is created and destroyed, whereas
7953
- // we can't know when to remove an `LContext`.
7954
- if (isLView(data)) {
7955
- target[MONKEY_PATCH_KEY_NAME] = data[ID];
7956
- registerLView(data);
7879
+ function reportUnknownPropertyError(message) {
7880
+ if (shouldThrowErrorOnUnknownProperty) {
7881
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
7957
7882
  }
7958
7883
  else {
7959
- target[MONKEY_PATCH_KEY_NAME] = data;
7884
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
7960
7885
  }
7961
7886
  }
7962
7887
  /**
7963
- * Returns the monkey-patch value data present on the target (which could be
7964
- * a component, directive or a DOM node).
7888
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7889
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7890
+ * be too slow for production mode and also it relies on the constructor function being available.
7891
+ *
7892
+ * Gets a reference to the host component def (where a current component is declared).
7893
+ *
7894
+ * @param lView An `LView` that represents a current component that is being rendered.
7965
7895
  */
7966
- function readPatchedData(target) {
7967
- ngDevMode && assertDefined(target, 'Target expected');
7968
- const data = target[MONKEY_PATCH_KEY_NAME];
7969
- return (typeof data === 'number') ? getLViewById(data) : data || null;
7970
- }
7971
- function readPatchedLView(target) {
7972
- const value = readPatchedData(target);
7973
- if (value) {
7974
- return (isLView(value) ? value : value.lView);
7975
- }
7976
- return null;
7896
+ function getDeclarationComponentDef(lView) {
7897
+ !ngDevMode && throwError('Must never be called in production mode');
7898
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
7899
+ const context = declarationLView[CONTEXT];
7900
+ // Unable to obtain a context.
7901
+ if (!context)
7902
+ return null;
7903
+ return context.constructor ? getComponentDef(context.constructor) : null;
7977
7904
  }
7978
- function isComponentInstance(instance) {
7979
- return instance && instance.constructor && instance.constructor.ɵcmp;
7905
+ /**
7906
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7907
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7908
+ * be too slow for production mode.
7909
+ *
7910
+ * Checks if the current component is declared inside of a standalone component template.
7911
+ *
7912
+ * @param lView An `LView` that represents a current component that is being rendered.
7913
+ */
7914
+ function isHostComponentStandalone(lView) {
7915
+ !ngDevMode && throwError('Must never be called in production mode');
7916
+ const componentDef = getDeclarationComponentDef(lView);
7917
+ // Treat host component as non-standalone if we can't obtain the def.
7918
+ return !!componentDef?.standalone;
7980
7919
  }
7981
- function isDirectiveInstance(instance) {
7982
- return instance && instance.constructor && instance.constructor.ɵdir;
7920
+ /**
7921
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7922
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7923
+ * be too slow for production mode.
7924
+ *
7925
+ * Constructs a string describing the location of the host component template. The function is used
7926
+ * in dev mode to produce error messages.
7927
+ *
7928
+ * @param lView An `LView` that represents a current component that is being rendered.
7929
+ */
7930
+ function getTemplateLocationDetails(lView) {
7931
+ !ngDevMode && throwError('Must never be called in production mode');
7932
+ const hostComponentDef = getDeclarationComponentDef(lView);
7933
+ const componentClassName = hostComponentDef?.type?.name;
7934
+ return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
7983
7935
  }
7984
7936
  /**
7985
- * Locates the element within the given LView and returns the matching index
7937
+ * The set of known control flow directives and their corresponding imports.
7938
+ * We use this set to produce a more precises error message with a note
7939
+ * that the `CommonModule` should also be included.
7986
7940
  */
7987
- function findViaNativeElement(lView, target) {
7988
- const tView = lView[TVIEW];
7989
- for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
7990
- if (unwrapRNode(lView[i]) === target) {
7991
- return i;
7941
+ const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
7942
+ ['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
7943
+ ['ngSwitchDefault', 'NgSwitchDefault']
7944
+ ]);
7945
+ /**
7946
+ * Returns true if the tag name is allowed by specified schemas.
7947
+ * @param schemas Array of schemas
7948
+ * @param tagName Name of the tag
7949
+ */
7950
+ function matchingSchemas(schemas, tagName) {
7951
+ if (schemas !== null) {
7952
+ for (let i = 0; i < schemas.length; i++) {
7953
+ const schema = schemas[i];
7954
+ if (schema === NO_ERRORS_SCHEMA ||
7955
+ schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
7956
+ return true;
7957
+ }
7992
7958
  }
7993
7959
  }
7994
- return -1;
7960
+ return false;
7995
7961
  }
7962
+
7996
7963
  /**
7997
- * Locates the next tNode (child, sibling or parent).
7964
+ * @license
7965
+ * Copyright Google LLC All Rights Reserved.
7966
+ *
7967
+ * Use of this source code is governed by an MIT-style license that can be
7968
+ * found in the LICENSE file at https://angular.io/license
7998
7969
  */
7999
- function traverseNextElement(tNode) {
8000
- if (tNode.child) {
8001
- return tNode.child;
8002
- }
8003
- else if (tNode.next) {
8004
- return tNode.next;
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
- }
7970
+ const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
7971
+ function wrappedError(message, originalError) {
7972
+ const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
7973
+ const error = Error(msg);
7974
+ error[ERROR_ORIGINAL_ERROR] = originalError;
7975
+ return error;
7976
+ }
7977
+ function getOriginalError(error) {
7978
+ return error[ERROR_ORIGINAL_ERROR];
8015
7979
  }
7980
+
8016
7981
  /**
8017
- * Locates the component within the given LView and returns the matching index
7982
+ * @license
7983
+ * Copyright Google LLC All Rights Reserved.
7984
+ *
7985
+ * Use of this source code is governed by an MIT-style license that can be
7986
+ * found in the LICENSE file at https://angular.io/license
8018
7987
  */
8019
- function findViaComponent(lView, componentInstance) {
8020
- const componentIndices = lView[TVIEW].components;
8021
- if (componentIndices) {
8022
- for (let i = 0; i < componentIndices.length; i++) {
8023
- const elementComponentIndex = componentIndices[i];
8024
- const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
8025
- if (componentView[CONTEXT] === componentInstance) {
8026
- return elementComponentIndex;
8027
- }
7988
+ /**
7989
+ * Provides a hook for centralized exception handling.
7990
+ *
7991
+ * The default implementation of `ErrorHandler` prints error messages to the `console`. To
7992
+ * intercept error handling, write a custom exception handler that replaces this default as
7993
+ * appropriate for your app.
7994
+ *
7995
+ * @usageNotes
7996
+ * ### Example
7997
+ *
7998
+ * ```
7999
+ * class MyErrorHandler implements ErrorHandler {
8000
+ * handleError(error) {
8001
+ * // do something with the exception
8002
+ * }
8003
+ * }
8004
+ *
8005
+ * @NgModule({
8006
+ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
8007
+ * })
8008
+ * class MyModule {}
8009
+ * ```
8010
+ *
8011
+ * @publicApi
8012
+ */
8013
+ class ErrorHandler {
8014
+ constructor() {
8015
+ /**
8016
+ * @internal
8017
+ */
8018
+ this._console = console;
8019
+ }
8020
+ handleError(error) {
8021
+ const originalError = this._findOriginalError(error);
8022
+ this._console.error('ERROR', error);
8023
+ if (originalError) {
8024
+ this._console.error('ORIGINAL ERROR', originalError);
8028
8025
  }
8029
8026
  }
8030
- else {
8031
- const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
8032
- const rootComponent = rootComponentView[CONTEXT];
8033
- if (rootComponent === componentInstance) {
8034
- // we are dealing with the root element here therefore we know that the
8035
- // element is the very first element after the HEADER data in the lView
8036
- return HEADER_OFFSET;
8027
+ /** @internal */
8028
+ _findOriginalError(error) {
8029
+ let e = error && getOriginalError(error);
8030
+ while (e && getOriginalError(e)) {
8031
+ e = getOriginalError(e);
8037
8032
  }
8033
+ return e || null;
8038
8034
  }
8039
- return -1;
8040
8035
  }
8036
+
8041
8037
  /**
8042
- * Locates the directive within the given LView and returns the matching index
8038
+ * @license
8039
+ * Copyright Google LLC All Rights Reserved.
8040
+ *
8041
+ * Use of this source code is governed by an MIT-style license that can be
8042
+ * found in the LICENSE file at https://angular.io/license
8043
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
- }
8058
- }
8059
- tNode = traverseNextElement(tNode);
8060
- }
8061
- return -1;
8062
- }
8063
8044
  /**
8064
- * Returns a list of directives extracted from the given view based on the
8065
- * provided list of directive index values.
8045
+ * Disallowed strings in the comment.
8066
8046
  *
8067
- * @param nodeIndex The node index
8068
- * @param lView The target view data
8069
- * @param includeComponents Whether or not to include components in returned directives
8047
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
8070
8048
  */
8071
- function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
8072
- const tNode = lView[TVIEW].data[nodeIndex];
8073
- if (tNode.directiveStart === 0)
8074
- return EMPTY_ARRAY;
8075
- const results = [];
8076
- for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
8077
- const directiveInstance = lView[i];
8078
- if (!isComponentInstance(directiveInstance) || includeComponents) {
8079
- results.push(directiveInstance);
8080
- }
8081
- }
8082
- return results;
8083
- }
8084
- function getComponentAtNodeIndex(nodeIndex, lView) {
8085
- const tNode = lView[TVIEW].data[nodeIndex];
8086
- const { directiveStart, componentOffset } = tNode;
8087
- return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
8049
+ const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
8050
+ /**
8051
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
8052
+ */
8053
+ const COMMENT_DELIMITER = /(<|>)/;
8054
+ const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
8055
+ /**
8056
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
8057
+ *
8058
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
8059
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
8060
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
8061
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
8062
+ *
8063
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
8064
+ *
8065
+ * ```
8066
+ * div.innerHTML = div.innerHTML
8067
+ * ```
8068
+ *
8069
+ * One would expect that the above code would be safe to do, but it turns out that because comment
8070
+ * text is not escaped, the comment may contain text which will prematurely close the comment
8071
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
8072
+ * may contain such text and expect them to be safe.)
8073
+ *
8074
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
8075
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
8076
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
8077
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
8078
+ *
8079
+ * @param value text to make safe for comment node by escaping the comment open/close character
8080
+ * sequence.
8081
+ */
8082
+ function escapeCommentText(value) {
8083
+ return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
8088
8084
  }
8085
+
8089
8086
  /**
8090
- * Returns a map of local references (local reference name => element or directive instance) that
8091
- * exist on a given element.
8087
+ * @license
8088
+ * Copyright Google LLC All Rights Reserved.
8089
+ *
8090
+ * Use of this source code is governed by an MIT-style license that can be
8091
+ * found in the LICENSE file at https://angular.io/license
8092
8092
  */
8093
- function discoverLocalRefs(lView, nodeIndex) {
8094
- const tNode = lView[TVIEW].data[nodeIndex];
8095
- if (tNode && tNode.localNames) {
8096
- const result = {};
8097
- let localIndex = tNode.index + 1;
8098
- for (let i = 0; i < tNode.localNames.length; i += 2) {
8099
- result[tNode.localNames[i]] = lView[localIndex];
8100
- localIndex++;
8101
- }
8102
- return result;
8093
+ function normalizeDebugBindingName(name) {
8094
+ // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
8095
+ name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
8096
+ return `ng-reflect-${name}`;
8097
+ }
8098
+ const CAMEL_CASE_REGEXP = /([A-Z])/g;
8099
+ function camelCaseToDashCase(input) {
8100
+ return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
8101
+ }
8102
+ function normalizeDebugBindingValue(value) {
8103
+ try {
8104
+ // Limit the size of the value as otherwise the DOM just gets polluted.
8105
+ return value != null ? value.toString().slice(0, 30) : value;
8106
+ }
8107
+ catch (e) {
8108
+ return '[ERROR] Exception while trying to serialize the value';
8103
8109
  }
8104
- return null;
8105
8110
  }
8106
8111
 
8107
8112
  /**
@@ -9320,6 +9325,19 @@ function writeDirectClass(renderer, element, newValue) {
9320
9325
  }
9321
9326
  ngDevMode && ngDevMode.rendererSetClassName++;
9322
9327
  }
9328
+ /** Sets up the static DOM attributes on an `RNode`. */
9329
+ function setupStaticAttributes(renderer, element, tNode) {
9330
+ const { mergedAttrs, classes, styles } = tNode;
9331
+ if (mergedAttrs !== null) {
9332
+ setUpAttributes(renderer, element, mergedAttrs);
9333
+ }
9334
+ if (classes !== null) {
9335
+ writeDirectClass(renderer, element, classes);
9336
+ }
9337
+ if (styles !== null) {
9338
+ writeDirectStyle(renderer, element, styles);
9339
+ }
9340
+ }
9323
9341
 
9324
9342
  /**
9325
9343
  * @license
@@ -12540,28 +12558,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12540
12558
  }
12541
12559
  }
12542
12560
  }
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
12561
  /**
12566
12562
  * Resolve the matched directives on a node.
12567
12563
  */
@@ -12571,59 +12567,16 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
12571
12567
  ngDevMode && assertFirstCreatePass(tView);
12572
12568
  let hasDirectives = false;
12573
12569
  if (getBindingsEnabled()) {
12574
- const directiveDefsMatchedBySelectors = findDirectiveDefMatches(tView, lView, tNode);
12575
- const directiveDefs = directiveDefsMatchedBySelectors ?
12576
- findHostDirectiveDefs$1(directiveDefsMatchedBySelectors, tView, lView, tNode) :
12577
- null;
12570
+ const directiveDefs = findDirectiveDefMatches(tView, lView, tNode);
12578
12571
  const exportsMap = localRefs === null ? null : { '': -1 };
12579
12572
  if (directiveDefs !== null) {
12580
- hasDirectives = true;
12581
- initTNodeFlags(tNode, tView.data.length, directiveDefs.length);
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');
12573
+ // Publishes the directive types to DI so they can be injected. Needs to
12574
+ // happen in a separate pass before the TNode flags have been initialized.
12598
12575
  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++;
12576
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directiveDefs[i].type);
12625
12577
  }
12626
- initializeInputAndOutputAliases(tView, tNode);
12578
+ hasDirectives = true;
12579
+ initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap);
12627
12580
  }
12628
12581
  if (exportsMap)
12629
12582
  cacheMatchingLocalNames(tNode, localRefs, exportsMap);
@@ -12632,17 +12585,66 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
12632
12585
  tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
12633
12586
  return hasDirectives;
12634
12587
  }
12588
+ /** Initializes the data structures necessary for a list of directives to be instantiated. */
12589
+ function initializeDirectives(tView, lView, tNode, directives, exportsMap) {
12590
+ ngDevMode && assertFirstCreatePass(tView);
12591
+ initTNodeFlags(tNode, tView.data.length, directives.length);
12592
+ // When the same token is provided by several directives on the same node, some rules apply in
12593
+ // the viewEngine:
12594
+ // - viewProviders have priority over providers
12595
+ // - the last directive in NgModule.declarations has priority over the previous one
12596
+ // So to match these rules, the order in which providers are added in the arrays is very
12597
+ // important.
12598
+ for (let i = 0; i < directives.length; i++) {
12599
+ const def = directives[i];
12600
+ if (def.providersResolver)
12601
+ def.providersResolver(def);
12602
+ }
12603
+ let preOrderHooksFound = false;
12604
+ let preOrderCheckHooksFound = false;
12605
+ let directiveIdx = allocExpando(tView, lView, directives.length, null);
12606
+ ngDevMode &&
12607
+ assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
12608
+ for (let i = 0; i < directives.length; i++) {
12609
+ const def = directives[i];
12610
+ // Merge the attrs in the order of matches. This assumes that the first directive is the
12611
+ // component itself, so that the component has the least priority.
12612
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
12613
+ configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
12614
+ saveNameToExportMap(directiveIdx, def, exportsMap);
12615
+ if (def.contentQueries !== null)
12616
+ tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
12617
+ if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
12618
+ tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
12619
+ const lifeCycleHooks = def.type.prototype;
12620
+ // Only push a node index into the preOrderHooks array if this is the first
12621
+ // pre-order hook found on this node.
12622
+ if (!preOrderHooksFound &&
12623
+ (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
12624
+ // We will push the actual hook function into this array later during dir instantiation.
12625
+ // We cannot do it now because we must ensure hooks are registered in the same
12626
+ // order that directives are created (i.e. injection order).
12627
+ (tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index);
12628
+ preOrderHooksFound = true;
12629
+ }
12630
+ if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
12631
+ (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(tNode.index);
12632
+ preOrderCheckHooksFound = true;
12633
+ }
12634
+ directiveIdx++;
12635
+ }
12636
+ initializeInputAndOutputAliases(tView, tNode);
12637
+ }
12635
12638
  /**
12636
12639
  * Add `hostBindings` to the `TView.hostBindingOpCodes`.
12637
12640
  *
12638
12641
  * @param tView `TView` to which the `hostBindings` should be added.
12639
12642
  * @param tNode `TNode` the element which contains the directive
12640
- * @param lView `LView` current `LView`
12641
12643
  * @param directiveIdx Directive index in view.
12642
12644
  * @param directiveVarsIdx Where will the directive's vars be stored
12643
12645
  * @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
12644
12646
  */
12645
- function registerHostBindingOpCodes(tView, tNode, lView, directiveIdx, directiveVarsIdx, def) {
12647
+ function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
12646
12648
  ngDevMode && assertFirstCreatePass(tView);
12647
12649
  const hostBindings = def.hostBindings;
12648
12650
  if (hostBindings) {
@@ -12743,7 +12745,7 @@ function invokeHostBindingsInCreationMode(def, directive) {
12743
12745
  * Matches the current node against all available selectors.
12744
12746
  * If a component is matched (at most one), it is returned in first position in the array.
12745
12747
  */
12746
- function findDirectiveDefMatches(tView, viewData, tNode) {
12748
+ function findDirectiveDefMatches(tView, lView, tNode) {
12747
12749
  ngDevMode && assertFirstCreatePass(tView);
12748
12750
  ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
12749
12751
  const registry = tView.directiveRegistry;
@@ -12753,22 +12755,45 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
12753
12755
  const def = registry[i];
12754
12756
  if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
12755
12757
  matches || (matches = ngDevMode ? new MatchesArray() : []);
12756
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type);
12757
12758
  if (isComponentDef(def)) {
12758
12759
  if (ngDevMode) {
12759
12760
  assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
12760
12761
  `Please use a different tag to activate the ${stringify(def.type)} component.`);
12761
12762
  if (isComponentHost(tNode)) {
12762
- // If another component has been matched previously, it's the first element in the
12763
- // `matches` array, see how we store components/directives in `matches` below.
12764
- throwMultipleComponentError(tNode, matches[0].type, def.type);
12763
+ throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
12765
12764
  }
12766
12765
  }
12767
- markAsComponentHost(tView, tNode, 0);
12768
- // The component is always stored first with directives after.
12769
- matches.unshift(def);
12766
+ // Components are inserted at the front of the matches array so that their lifecycle
12767
+ // hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
12768
+ // compatibility. This logic doesn't make sense with host directives, because it
12769
+ // would allow the host directives to undo any overrides the host may have made.
12770
+ // To handle this case, the host directives of components are inserted at the beginning
12771
+ // of the array, followed by the component. As such, the insertion order is as follows:
12772
+ // 1. Host directives belonging to the selector-matched component.
12773
+ // 2. Selector-matched component.
12774
+ // 3. Host directives belonging to selector-matched directives.
12775
+ // 4. Selector-matched directives.
12776
+ if (def.findHostDirectiveDefs !== null) {
12777
+ const hostDirectiveMatches = [];
12778
+ def.findHostDirectiveDefs(hostDirectiveMatches, def, tView, lView, tNode);
12779
+ // Add all host directives declared on this component, followed by the component itself.
12780
+ // Host directives should execute first so the host has a chance to override changes
12781
+ // to the DOM made by them.
12782
+ matches.unshift(...hostDirectiveMatches, def);
12783
+ // Component is offset starting from the beginning of the host directives array.
12784
+ const componentOffset = hostDirectiveMatches.length;
12785
+ markAsComponentHost(tView, tNode, componentOffset);
12786
+ }
12787
+ else {
12788
+ // No host directives on this component, just add the
12789
+ // component def to the beginning of the matches.
12790
+ matches.unshift(def);
12791
+ markAsComponentHost(tView, tNode, 0);
12792
+ }
12770
12793
  }
12771
12794
  else {
12795
+ // Append any host directives to the matches first.
12796
+ def.findHostDirectiveDefs?.(matches, def, tView, lView, tNode);
12772
12797
  matches.push(def);
12773
12798
  }
12774
12799
  }
@@ -12788,26 +12813,6 @@ function markAsComponentHost(tView, hostTNode, componentOffset) {
12788
12813
  (tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
12789
12814
  .push(hostTNode.index);
12790
12815
  }
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
12816
  /** Caches local names and their matching directive indices for query and template lookups. */
12812
12817
  function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
12813
12818
  if (localRefs) {
@@ -12875,7 +12880,7 @@ function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
12875
12880
  const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
12876
12881
  tView.blueprint[directiveIndex] = nodeInjectorFactory;
12877
12882
  lView[directiveIndex] = nodeInjectorFactory;
12878
- registerHostBindingOpCodes(tView, tNode, lView, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
12883
+ registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
12879
12884
  }
12880
12885
  function addComponentLogic(lView, hostTNode, def) {
12881
12886
  const native = getNativeByTNode(hostTNode, lView);
@@ -13798,6 +13803,7 @@ class ChainedInjector {
13798
13803
  this.parentInjector = parentInjector;
13799
13804
  }
13800
13805
  get(token, notFoundValue, flags) {
13806
+ flags = convertToBitFlags(flags);
13801
13807
  const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
13802
13808
  if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
13803
13809
  notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
@@ -13874,42 +13880,23 @@ class ComponentFactory extends ComponentFactory$1 {
13874
13880
  let component;
13875
13881
  let tElementNode;
13876
13882
  try {
13877
- const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
13883
+ const rootDirectives = [this.componentDef];
13884
+ const hostTNode = createRootComponentTNode(rootLView, hostRNode);
13885
+ const componentView = createRootComponentView(hostTNode, hostRNode, this.componentDef, rootDirectives, rootLView, rendererFactory, hostRenderer);
13886
+ tElementNode = getTNode(rootTView, HEADER_OFFSET);
13887
+ // TODO(crisbeto): in practice `hostRNode` should always be defined, but there are some tests
13888
+ // where the renderer is mocked out and `undefined` is returned. We should update the tests so
13889
+ // that this check can be removed.
13878
13890
  if (hostRNode) {
13879
- if (rootSelectorOrNode) {
13880
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
13881
- }
13882
- else {
13883
- // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
13884
- // is not defined), also apply attributes and classes extracted from component selector.
13885
- // Extract attributes and classes from the first selector only to match VE behavior.
13886
- const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
13887
- if (attrs) {
13888
- setUpAttributes(hostRenderer, hostRNode, attrs);
13889
- }
13890
- if (classes && classes.length > 0) {
13891
- writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
13892
- }
13893
- }
13891
+ setRootNodeAttributes(hostRenderer, this.componentDef, hostRNode, rootSelectorOrNode);
13894
13892
  }
13895
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
13896
13893
  if (projectableNodes !== undefined) {
13897
- const projection = tElementNode.projection = [];
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
- }
13894
+ projectNodes(tElementNode, this.ngContentSelectors, projectableNodes);
13907
13895
  }
13908
13896
  // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
13909
13897
  // executed here?
13910
13898
  // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
13911
- component =
13912
- createRootComponent(componentView, this.componentDef, rootLView, [LifecycleHooksFeature]);
13899
+ component = createRootComponent(componentView, this.componentDef, rootDirectives, rootLView, [LifecycleHooksFeature]);
13913
13900
  renderView(rootTView, rootLView, null);
13914
13901
  }
13915
13902
  finally {
@@ -13980,11 +13967,22 @@ const NULL_INJECTOR = {
13980
13967
  throwProviderNotFoundError(token, 'NullInjector');
13981
13968
  }
13982
13969
  };
13970
+ /** Creates a TNode that can be used to instantiate a root component. */
13971
+ function createRootComponentTNode(lView, rNode) {
13972
+ const tView = lView[TVIEW];
13973
+ const index = HEADER_OFFSET;
13974
+ ngDevMode && assertIndexInRange(lView, index);
13975
+ lView[index] = rNode;
13976
+ // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13977
+ // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13978
+ // representing a host element.
13979
+ return getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13980
+ }
13983
13981
  /**
13984
13982
  * Creates the root component view and the root component node.
13985
13983
  *
13986
13984
  * @param rNode Render host element.
13987
- * @param def ComponentDef
13985
+ * @param rootComponentDef ComponentDef
13988
13986
  * @param rootView The parent view where the host node is stored
13989
13987
  * @param rendererFactory Factory to be used for creating child renderers.
13990
13988
  * @param hostRenderer The current renderer
@@ -13992,72 +13990,96 @@ const NULL_INJECTOR = {
13992
13990
  *
13993
13991
  * @returns Component view created
13994
13992
  */
13995
- function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13993
+ function createRootComponentView(tNode, rNode, rootComponentDef, rootDirectives, rootView, rendererFactory, hostRenderer, sanitizer) {
13996
13994
  const tView = rootView[TVIEW];
13997
- const index = HEADER_OFFSET;
13998
- ngDevMode && assertIndexInRange(rootView, index);
13999
- rootView[index] = rNode;
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);
13995
+ applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer);
13996
+ const viewRenderer = rendererFactory.createRenderer(rNode, rootComponentDef);
13997
+ 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
13998
  if (tView.firstCreatePass) {
14020
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13999
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, rootComponentDef.type);
14021
14000
  markAsComponentHost(tView, tNode, 0);
14022
- initTNodeFlags(tNode, rootView.length, 1);
14023
14001
  }
14024
14002
  addToViewTree(rootView, componentView);
14025
14003
  // Store component view at node index, with node as the HOST
14026
- return rootView[index] = componentView;
14004
+ return rootView[tNode.index] = componentView;
14005
+ }
14006
+ /** Sets up the styling information on a root component. */
14007
+ function applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer) {
14008
+ for (const def of rootDirectives) {
14009
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
14010
+ }
14011
+ if (tNode.mergedAttrs !== null) {
14012
+ computeStaticStyling(tNode, tNode.mergedAttrs, true);
14013
+ if (rNode !== null) {
14014
+ setupStaticAttributes(hostRenderer, rNode, tNode);
14015
+ }
14016
+ }
14027
14017
  }
14028
14018
  /**
14029
14019
  * Creates a root component and sets it up with features and host bindings.Shared by
14030
14020
  * renderComponent() and ViewContainerRef.createComponent().
14031
14021
  */
14032
- function createRootComponent(componentView, componentDef, rootLView, hostFeatures) {
14022
+ function createRootComponent(componentView, rootComponentDef, rootDirectives, rootLView, hostFeatures) {
14023
+ const rootTNode = getCurrentTNode();
14024
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
14033
14025
  const tView = rootLView[TVIEW];
14034
- // Create directive instance with factory() and store at next index in viewData
14035
- const component = instantiateRootComponent(tView, rootLView, componentDef);
14036
- // Root view only contains an instance of this component,
14037
- // so we use a reference to that component instance as a context.
14026
+ const native = getNativeByTNode(rootTNode, rootLView);
14027
+ initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null);
14028
+ for (let i = 0; i < rootDirectives.length; i++) {
14029
+ const directiveIndex = rootTNode.directiveStart + i;
14030
+ const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode);
14031
+ attachPatchData(directiveInstance, rootLView);
14032
+ }
14033
+ invokeDirectivesHostBindings(tView, rootLView, rootTNode);
14034
+ if (native) {
14035
+ attachPatchData(native, rootLView);
14036
+ }
14037
+ // We're guaranteed for the `componentOffset` to be positive here
14038
+ // since a root component always matches a component def.
14039
+ ngDevMode &&
14040
+ assertGreaterThan(rootTNode.componentOffset, -1, 'componentOffset must be great than -1');
14041
+ const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
14038
14042
  componentView[CONTEXT] = rootLView[CONTEXT] = component;
14039
14043
  if (hostFeatures !== null) {
14040
14044
  for (const feature of hostFeatures) {
14041
- feature(component, componentDef);
14045
+ feature(component, rootComponentDef);
14042
14046
  }
14043
14047
  }
14044
14048
  // We want to generate an empty QueryList for root content queries for backwards
14045
14049
  // compatibility with ViewEngine.
14046
- if (componentDef.contentQueries) {
14047
- const tNode = getCurrentTNode();
14048
- ngDevMode && assertDefined(tNode, 'TNode expected');
14049
- componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
14050
+ executeContentQueries(tView, rootTNode, componentView);
14051
+ return component;
14052
+ }
14053
+ /** Sets the static attributes on a root component. */
14054
+ function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
14055
+ if (rootSelectorOrNode) {
14056
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
14050
14057
  }
14051
- const rootTNode = getCurrentTNode();
14052
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
14053
- if (tView.firstCreatePass &&
14054
- (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
14055
- setSelectedIndex(rootTNode.index);
14056
- const rootTView = rootLView[TVIEW];
14057
- registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
14058
- invokeHostBindingsInCreationMode(componentDef, component);
14058
+ else {
14059
+ // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
14060
+ // is not defined), also apply attributes and classes extracted from component selector.
14061
+ // Extract attributes and classes from the first selector only to match VE behavior.
14062
+ const { attrs, classes } = extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
14063
+ if (attrs) {
14064
+ setUpAttributes(hostRenderer, hostRNode, attrs);
14065
+ }
14066
+ if (classes && classes.length > 0) {
14067
+ writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
14068
+ }
14069
+ }
14070
+ }
14071
+ /** Projects the `projectableNodes` that were specified when creating a root component. */
14072
+ function projectNodes(tNode, ngContentSelectors, projectableNodes) {
14073
+ const projection = tNode.projection = [];
14074
+ for (let i = 0; i < ngContentSelectors.length; i++) {
14075
+ const nodesforSlot = projectableNodes[i];
14076
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
14077
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
14078
+ // complex checks down the line.
14079
+ // We also normalize the length of the passed in projectable nodes (to match the number of
14080
+ // <ng-container> slots defined by a component).
14081
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
14059
14082
  }
14060
- return component;
14061
14083
  }
14062
14084
  /**
14063
14085
  * Used to enable lifecycle hooks on the root component.
@@ -14364,10 +14386,9 @@ function findHostDirectiveDefs(matches, def, tView, lView, tNode) {
14364
14386
  // TODO(crisbeto): assert that the def exists.
14365
14387
  // Host directives execute before the host so that its host bindings can be overwritten.
14366
14388
  findHostDirectiveDefs(matches, hostDirectiveDef, tView, lView, tNode);
14389
+ matches.push(hostDirectiveDef);
14367
14390
  }
14368
14391
  }
14369
- // Push the def itself at the end since it needs to execute after the host directives.
14370
- matches.push(def);
14371
14392
  }
14372
14393
  /**
14373
14394
  * Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
@@ -15326,18 +15347,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
15326
15347
  elementStartFirstCreatePass(adjustedIndex, tView, lView, native, name, attrsIndex, localRefsIndex) :
15327
15348
  tView.data[adjustedIndex];
15328
15349
  setCurrentTNode(tNode, true);
15329
- const mergedAttrs = tNode.mergedAttrs;
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
- }
15350
+ setupStaticAttributes(renderer, native, tNode);
15341
15351
  if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
15342
15352
  // In the i18n case, the translation may have removed this element, so only add it if it is not
15343
15353
  // detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
@@ -22027,7 +22037,7 @@ function getDirectives(node) {
22027
22037
  return [];
22028
22038
  }
22029
22039
  if (context.directives === undefined) {
22030
- context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
22040
+ context.directives = getDirectivesAtNodeIndex(nodeIndex, lView);
22031
22041
  }
22032
22042
  // The `directives` in this case are a named array called `LComponentView`. Clone the
22033
22043
  // result so we don't expose an internal data structure in the user's console.
@@ -26036,6 +26046,34 @@ function getNativeRequestAnimationFrame() {
26036
26046
  return { nativeRequestAnimationFrame, nativeCancelAnimationFrame };
26037
26047
  }
26038
26048
 
26049
+ /**
26050
+ * @license
26051
+ * Copyright Google LLC All Rights Reserved.
26052
+ *
26053
+ * Use of this source code is governed by an MIT-style license that can be
26054
+ * found in the LICENSE file at https://angular.io/license
26055
+ */
26056
+ class AsyncStackTaggingZoneSpec {
26057
+ constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
26058
+ this.name = 'asyncStackTagging for ' + namePrefix;
26059
+ this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);
26060
+ }
26061
+ onScheduleTask(delegate, _current, target, task) {
26062
+ task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
26063
+ return delegate.scheduleTask(target, task);
26064
+ }
26065
+ onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
26066
+ let ret;
26067
+ if (task.consoleTask) {
26068
+ ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
26069
+ }
26070
+ else {
26071
+ ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
26072
+ }
26073
+ return ret;
26074
+ }
26075
+ }
26076
+
26039
26077
  /**
26040
26078
  * @license
26041
26079
  * Copyright Google LLC All Rights Reserved.
@@ -26152,8 +26190,12 @@ class NgZone {
26152
26190
  const self = this;
26153
26191
  self._nesting = 0;
26154
26192
  self._outer = self._inner = Zone.current;
26155
- if (Zone['AsyncStackTaggingZoneSpec']) {
26156
- const AsyncStackTaggingZoneSpec = Zone['AsyncStackTaggingZoneSpec'];
26193
+ // AsyncStackTaggingZoneSpec provides `linked stack traces` to show
26194
+ // where the async operation is scheduled. For more details, refer
26195
+ // to this article, https://developer.chrome.com/blog/devtools-better-angular-debugging/
26196
+ // And we only import this AsyncStackTaggingZoneSpec in development mode,
26197
+ // in the production mode, the AsyncStackTaggingZoneSpec will be tree shaken away.
26198
+ if (ngDevMode) {
26157
26199
  self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));
26158
26200
  }
26159
26201
  if (Zone['TaskTrackingZoneSpec']) {
@@ -27587,24 +27629,16 @@ function _mergeArrays(parts) {
27587
27629
  * found in the LICENSE file at https://angular.io/license
27588
27630
  */
27589
27631
  /**
27590
- * This file is used to control if the default rendering pipeline should be `ViewEngine` or `Ivy`.
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.
27632
+ * Returns whether Angular is in development mode.
27600
27633
  *
27601
- * By default, this is true, unless a user calls `enableProdMode` before calling this.
27634
+ * By default, this is true, unless `enableProdMode` is invoked prior to calling this method or the
27635
+ * application is built using the Angular CLI with the `optimization` option.
27636
+ * @see {@link cli/build ng build}
27602
27637
  *
27603
27638
  * @publicApi
27604
27639
  */
27605
27640
  function isDevMode() {
27606
- _runModeLocked = true;
27607
- return _devMode;
27641
+ return typeof ngDevMode === 'undefined' || !!ngDevMode;
27608
27642
  }
27609
27643
  /**
27610
27644
  * Disable Angular's development mode, which turns off assertions and other
@@ -27614,18 +27648,18 @@ function isDevMode() {
27614
27648
  * does not result in additional changes to any bindings (also known as
27615
27649
  * unidirectional data flow).
27616
27650
  *
27651
+ * Using this method is discouraged as the Angular CLI will set production mode when using the
27652
+ * `optimization` option.
27653
+ * @see {@link cli/build ng build}
27654
+ *
27617
27655
  * @publicApi
27618
27656
  */
27619
27657
  function enableProdMode() {
27620
- if (_runModeLocked) {
27621
- throw new Error('Cannot enable prod mode after platform setup.');
27622
- }
27623
27658
  // The below check is there so when ngDevMode is set via terser
27624
27659
  // `global['ngDevMode'] = false;` is also dropped.
27625
- if (typeof ngDevMode === undefined || !!ngDevMode) {
27660
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
27626
27661
  _global['ngDevMode'] = false;
27627
27662
  }
27628
- _devMode = false;
27629
27663
  }
27630
27664
 
27631
27665
  /**
@@ -29871,5 +29905,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29871
29905
  * Generated bundle index. Do not edit.
29872
29906
  */
29873
29907
 
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 };
29908
+ 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
29909
  //# sourceMappingURL=core.mjs.map