@angular/core 15.0.0-next.2 → 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 (44) hide show
  1. package/esm2020/src/core_private_export.mjs +2 -2
  2. package/esm2020/src/debug/debug_node.mjs +1 -1
  3. package/esm2020/src/di/index.mjs +1 -1
  4. package/esm2020/src/di/injector.mjs +1 -1
  5. package/esm2020/src/di/injector_compatibility.mjs +15 -11
  6. package/esm2020/src/di/interface/injector.mjs +1 -1
  7. package/esm2020/src/di/r3_injector.mjs +3 -2
  8. package/esm2020/src/render3/component_ref.mjs +103 -84
  9. package/esm2020/src/render3/context_discovery.mjs +17 -14
  10. package/esm2020/src/render3/definition.mjs +3 -2
  11. package/esm2020/src/render3/di.mjs +3 -2
  12. package/esm2020/src/render3/features/host_directives_feature.mjs +35 -13
  13. package/esm2020/src/render3/instructions/element.mjs +4 -16
  14. package/esm2020/src/render3/instructions/listener.mjs +2 -4
  15. package/esm2020/src/render3/instructions/lview_debug.mjs +9 -9
  16. package/esm2020/src/render3/instructions/projection.mjs +1 -1
  17. package/esm2020/src/render3/instructions/shared.mjs +123 -101
  18. package/esm2020/src/render3/instructions/styling.mjs +2 -2
  19. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  20. package/esm2020/src/render3/interfaces/node.mjs +3 -3
  21. package/esm2020/src/render3/interfaces/type_checks.mjs +3 -3
  22. package/esm2020/src/render3/jit/directive.mjs +7 -2
  23. package/esm2020/src/render3/ng_module_ref.mjs +1 -1
  24. package/esm2020/src/render3/node_manipulation.mjs +20 -5
  25. package/esm2020/src/render3/node_manipulation_i18n.mjs +2 -2
  26. package/esm2020/src/render3/util/discovery_utils.mjs +2 -2
  27. package/esm2020/src/util/is_dev_mode.mjs +11 -19
  28. package/esm2020/src/version.mjs +1 -1
  29. package/esm2020/src/zone/async-stack-tagging.mjs +28 -0
  30. package/esm2020/src/zone/ng_zone.mjs +8 -3
  31. package/esm2020/testing/src/logger.mjs +3 -3
  32. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  33. package/esm2020/testing/src/test_bed.mjs +4 -4
  34. package/fesm2015/core.mjs +1463 -1363
  35. package/fesm2015/core.mjs.map +1 -1
  36. package/fesm2015/testing.mjs +970 -901
  37. package/fesm2015/testing.mjs.map +1 -1
  38. package/fesm2020/core.mjs +1464 -1366
  39. package/fesm2020/core.mjs.map +1 -1
  40. package/fesm2020/testing.mjs +969 -900
  41. package/fesm2020/testing.mjs.map +1 -1
  42. package/index.d.ts +100 -33
  43. package/package.json +1 -1
  44. package/testing/index.d.ts +9 -1
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.2
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
  * ...
@@ -931,7 +1161,8 @@ function ɵɵdefineComponent(componentDefinition) {
931
1161
  setInput: null,
932
1162
  schemas: componentDefinition.schemas || null,
933
1163
  tView: null,
934
- applyHostDirectives: null,
1164
+ findHostDirectiveDefs: null,
1165
+ hostDirectives: null,
935
1166
  };
936
1167
  const dependencies = componentDefinition.dependencies;
937
1168
  const feature = componentDefinition.features;
@@ -1265,10 +1496,10 @@ function isLContainer(value) {
1265
1496
  return Array.isArray(value) && value[TYPE] === true;
1266
1497
  }
1267
1498
  function isContentQueryHost(tNode) {
1268
- return (tNode.flags & 8 /* TNodeFlags.hasContentQuery */) !== 0;
1499
+ return (tNode.flags & 4 /* TNodeFlags.hasContentQuery */) !== 0;
1269
1500
  }
1270
1501
  function isComponentHost(tNode) {
1271
- return (tNode.flags & 2 /* TNodeFlags.isComponentHost */) === 2 /* TNodeFlags.isComponentHost */;
1502
+ return tNode.componentOffset > -1;
1272
1503
  }
1273
1504
  function isDirectiveHost(tNode) {
1274
1505
  return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
@@ -2678,7 +2909,7 @@ const unusedValueExportToPlacateAjd$5 = 1;
2678
2909
  * @param tNode
2679
2910
  */
2680
2911
  function hasClassInput(tNode) {
2681
- return (tNode.flags & 16 /* TNodeFlags.hasClassInput */) !== 0;
2912
+ return (tNode.flags & 8 /* TNodeFlags.hasClassInput */) !== 0;
2682
2913
  }
2683
2914
  /**
2684
2915
  * Returns `true` if the `TNode` has a directive which has `@Input()` for `style` binding.
@@ -2702,7 +2933,7 @@ function hasClassInput(tNode) {
2702
2933
  * @param tNode
2703
2934
  */
2704
2935
  function hasStyleInput(tNode) {
2705
- return (tNode.flags & 32 /* TNodeFlags.hasStyleInput */) !== 0;
2936
+ return (tNode.flags & 16 /* TNodeFlags.hasStyleInput */) !== 0;
2706
2937
  }
2707
2938
 
2708
2939
  /**
@@ -3594,7 +3825,7 @@ class NodeInjector {
3594
3825
  this._lView = _lView;
3595
3826
  }
3596
3827
  get(token, notFoundValue, flags) {
3597
- return getOrCreateInjectable(this._tNode, this._lView, token, flags, notFoundValue);
3828
+ return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);
3598
3829
  }
3599
3830
  }
3600
3831
  /** Creates a `NodeInjector` for the current node. */
@@ -4681,267 +4912,41 @@ class ReflectionCapabilities {
4681
4912
  Object.keys(ownPropMetadata).forEach((propName) => {
4682
4913
  const decorators = [];
4683
4914
  if (propMetadata.hasOwnProperty(propName)) {
4684
- decorators.push(...propMetadata[propName]);
4685
- }
4686
- decorators.push(...ownPropMetadata[propName]);
4687
- propMetadata[propName] = decorators;
4688
- });
4689
- }
4690
- return propMetadata;
4691
- }
4692
- ownPropMetadata(typeOrFunc) {
4693
- if (!isType(typeOrFunc)) {
4694
- return {};
4695
- }
4696
- return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
4697
- }
4698
- hasLifecycleHook(type, lcProperty) {
4699
- return type instanceof Type && lcProperty in type.prototype;
4700
- }
4701
- }
4702
- function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
4703
- if (!decoratorInvocations) {
4704
- return [];
4705
- }
4706
- return decoratorInvocations.map(decoratorInvocation => {
4707
- const decoratorType = decoratorInvocation.type;
4708
- const annotationCls = decoratorType.annotationCls;
4709
- const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
4710
- return new annotationCls(...annotationArgs);
4711
- });
4712
- }
4713
- function getParentCtor(ctor) {
4714
- const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
4715
- const parentCtor = parentProto ? parentProto.constructor : null;
4716
- // Note: We always use `Object` as the null value
4717
- // to simplify checking later on.
4718
- return parentCtor || Object;
4719
- }
4720
-
4721
- /**
4722
- * @license
4723
- * Copyright Google LLC All Rights Reserved.
4724
- *
4725
- * Use of this source code is governed by an MIT-style license that can be
4726
- * found in the LICENSE file at https://angular.io/license
4727
- */
4728
- const _THROW_IF_NOT_FOUND = {};
4729
- const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
4730
- /*
4731
- * Name of a property (that we patch onto DI decorator), which is used as an annotation of which
4732
- * InjectFlag this decorator represents. This allows to avoid direct references to the DI decorators
4733
- * in the code, thus making them tree-shakable.
4734
- */
4735
- const DI_DECORATOR_FLAG = '__NG_DI_FLAG__';
4736
- const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
4737
- const NG_TOKEN_PATH = 'ngTokenPath';
4738
- const NEW_LINE = /\n/gm;
4739
- const NO_NEW_LINE = 'ɵ';
4740
- const SOURCE = '__source';
4741
- /**
4742
- * Current injector value used by `inject`.
4743
- * - `undefined`: it is an error to call `inject`
4744
- * - `null`: `inject` can be called but there is no injector (limp-mode).
4745
- * - Injector instance: Use the injector for resolution.
4746
- */
4747
- let _currentInjector = undefined;
4748
- function setCurrentInjector(injector) {
4749
- const former = _currentInjector;
4750
- _currentInjector = injector;
4751
- return former;
4752
- }
4753
- function injectInjectorOnly(token, flags = InjectFlags.Default) {
4754
- if (_currentInjector === undefined) {
4755
- throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4756
- `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\`.`);
4757
- }
4758
- else if (_currentInjector === null) {
4759
- return injectRootLimpMode(token, undefined, flags);
4760
- }
4761
- else {
4762
- return _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);
4763
- }
4764
- }
4765
- function ɵɵinject(token, flags = InjectFlags.Default) {
4766
- return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
4767
- }
4768
- /**
4769
- * Throws an error indicating that a factory function could not be generated by the compiler for a
4770
- * particular class.
4771
- *
4772
- * The name of the class is not mentioned here, but will be in the generated factory function name
4773
- * and thus in the stack trace.
4774
- *
4775
- * @codeGenApi
4776
- */
4777
- function ɵɵinvalidFactoryDep(index) {
4778
- throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4779
- `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4780
- 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.
4781
-
4782
- 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.`);
4783
- }
4784
- /**
4785
- * Injects a token from the currently active injector.
4786
- * `inject` is only supported during instantiation of a dependency by the DI system. It can be used
4787
- * during:
4788
- * - Construction (via the `constructor`) of a class being instantiated by the DI system, such
4789
- * as an `@Injectable` or `@Component`.
4790
- * - In the initializer for fields of such classes.
4791
- * - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.
4792
- * - In the `factory` function specified for an `InjectionToken`.
4793
- *
4794
- * @param token A token that represents a dependency that should be injected.
4795
- * @param flags Optional flags that control how injection is executed.
4796
- * The flags correspond to injection strategies that can be specified with
4797
- * parameter decorators `@Host`, `@Self`, `@SkipSef`, and `@Optional`.
4798
- * @returns the injected value if operation is successful, `null` otherwise.
4799
- * @throws if called outside of a supported context.
4800
- *
4801
- * @usageNotes
4802
- * In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a
4803
- * field initializer:
4804
- *
4805
- * ```typescript
4806
- * @Injectable({providedIn: 'root'})
4807
- * export class Car {
4808
- * radio: Radio|undefined;
4809
- * // OK: field initializer
4810
- * spareTyre = inject(Tyre);
4811
- *
4812
- * constructor() {
4813
- * // OK: constructor body
4814
- * this.radio = inject(Radio);
4815
- * }
4816
- * }
4817
- * ```
4818
- *
4819
- * It is also legal to call `inject` from a provider's factory:
4820
- *
4821
- * ```typescript
4822
- * providers: [
4823
- * {provide: Car, useFactory: () => {
4824
- * // OK: a class factory
4825
- * const engine = inject(Engine);
4826
- * return new Car(engine);
4827
- * }}
4828
- * ]
4829
- * ```
4830
- *
4831
- * Calls to the `inject()` function outside of the class creation context will result in error. Most
4832
- * notably, calls to `inject()` are disallowed after a class instance was created, in methods
4833
- * (including lifecycle hooks):
4834
- *
4835
- * ```typescript
4836
- * @Component({ ... })
4837
- * export class CarComponent {
4838
- * ngOnInit() {
4839
- * // ERROR: too late, the component instance was already created
4840
- * const engine = inject(Engine);
4841
- * engine.start();
4842
- * }
4843
- * }
4844
- * ```
4845
- *
4846
- * @publicApi
4847
- */
4848
- function inject(token, flags = InjectFlags.Default) {
4849
- if (typeof flags !== 'number') {
4850
- // While TypeScript doesn't accept it without a cast, bitwise OR with false-y values in
4851
- // JavaScript is a no-op. We can use that for a very codesize-efficient conversion from
4852
- // `InjectOptions` to `InjectFlags`.
4853
- flags = (0 /* InternalInjectFlags.Default */ | // comment to force a line break in the formatter
4854
- (flags.optional && 8 /* InternalInjectFlags.Optional */) |
4855
- (flags.host && 1 /* InternalInjectFlags.Host */) |
4856
- (flags.self && 2 /* InternalInjectFlags.Self */) |
4857
- (flags.skipSelf && 4 /* InternalInjectFlags.SkipSelf */));
4858
- }
4859
- return ɵɵinject(token, flags);
4860
- }
4861
- function injectArgs(types) {
4862
- const args = [];
4863
- for (let i = 0; i < types.length; i++) {
4864
- const arg = resolveForwardRef(types[i]);
4865
- if (Array.isArray(arg)) {
4866
- if (arg.length === 0) {
4867
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4868
- }
4869
- let type = undefined;
4870
- let flags = InjectFlags.Default;
4871
- for (let j = 0; j < arg.length; j++) {
4872
- const meta = arg[j];
4873
- const flag = getInjectFlag(meta);
4874
- if (typeof flag === 'number') {
4875
- // Special case when we handle @Inject decorator.
4876
- if (flag === -1 /* DecoratorFlags.Inject */) {
4877
- type = meta.token;
4878
- }
4879
- else {
4880
- flags |= flag;
4881
- }
4882
- }
4883
- else {
4884
- type = meta;
4915
+ decorators.push(...propMetadata[propName]);
4885
4916
  }
4886
- }
4887
- args.push(ɵɵinject(type, flags));
4917
+ decorators.push(...ownPropMetadata[propName]);
4918
+ propMetadata[propName] = decorators;
4919
+ });
4888
4920
  }
4889
- else {
4890
- args.push(ɵɵinject(arg));
4921
+ return propMetadata;
4922
+ }
4923
+ ownPropMetadata(typeOrFunc) {
4924
+ if (!isType(typeOrFunc)) {
4925
+ return {};
4891
4926
  }
4927
+ return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
4892
4928
  }
4893
- return args;
4894
- }
4895
- /**
4896
- * Attaches a given InjectFlag to a given decorator using monkey-patching.
4897
- * Since DI decorators can be used in providers `deps` array (when provider is configured using
4898
- * `useFactory`) without initialization (e.g. `Host`) and as an instance (e.g. `new Host()`), we
4899
- * attach the flag to make it available both as a static property and as a field on decorator
4900
- * instance.
4901
- *
4902
- * @param decorator Provided DI decorator.
4903
- * @param flag InjectFlag that should be applied.
4904
- */
4905
- function attachInjectFlag(decorator, flag) {
4906
- decorator[DI_DECORATOR_FLAG] = flag;
4907
- decorator.prototype[DI_DECORATOR_FLAG] = flag;
4908
- return decorator;
4909
- }
4910
- /**
4911
- * Reads monkey-patched property that contains InjectFlag attached to a decorator.
4912
- *
4913
- * @param token Token that may contain monkey-patched DI flags property.
4914
- */
4915
- function getInjectFlag(token) {
4916
- return token[DI_DECORATOR_FLAG];
4917
- }
4918
- function catchInjectorError(e, token, injectorErrorName, source) {
4919
- const tokenPath = e[NG_TEMP_TOKEN_PATH];
4920
- if (token[SOURCE]) {
4921
- tokenPath.unshift(token[SOURCE]);
4929
+ hasLifecycleHook(type, lcProperty) {
4930
+ return type instanceof Type && lcProperty in type.prototype;
4922
4931
  }
4923
- e.message = formatError('\n' + e.message, tokenPath, injectorErrorName, source);
4924
- e[NG_TOKEN_PATH] = tokenPath;
4925
- e[NG_TEMP_TOKEN_PATH] = null;
4926
- throw e;
4927
4932
  }
4928
- function formatError(text, obj, injectorErrorName, source = null) {
4929
- text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;
4930
- let context = stringify(obj);
4931
- if (Array.isArray(obj)) {
4932
- context = obj.map(stringify).join(' -> ');
4933
- }
4934
- else if (typeof obj === 'object') {
4935
- let parts = [];
4936
- for (let key in obj) {
4937
- if (obj.hasOwnProperty(key)) {
4938
- let value = obj[key];
4939
- parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
4940
- }
4941
- }
4942
- context = `{${parts.join(', ')}}`;
4933
+ function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
4934
+ if (!decoratorInvocations) {
4935
+ return [];
4943
4936
  }
4944
- return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\n ')}`;
4937
+ return decoratorInvocations.map(decoratorInvocation => {
4938
+ const decoratorType = decoratorInvocation.type;
4939
+ const annotationCls = decoratorType.annotationCls;
4940
+ const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
4941
+ return new annotationCls(...annotationArgs);
4942
+ });
4943
+ }
4944
+ function getParentCtor(ctor) {
4945
+ const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
4946
+ const parentCtor = parentProto ? parentProto.constructor : null;
4947
+ // Note: We always use `Object` as the null value
4948
+ // to simplify checking later on.
4949
+ return parentCtor || Object;
4945
4950
  }
4946
4951
 
4947
4952
  /**
@@ -6734,6 +6739,7 @@ class R3Injector extends EnvironmentInjector {
6734
6739
  }
6735
6740
  get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
6736
6741
  this.assertNotDestroyed();
6742
+ flags = convertToBitFlags(flags);
6737
6743
  // Set the injection context.
6738
6744
  const previousInjector = setCurrentInjector(this);
6739
6745
  const previousInjectImplementation = setInjectImplementation(undefined);
@@ -7235,7 +7241,7 @@ class Version {
7235
7241
  /**
7236
7242
  * @publicApi
7237
7243
  */
7238
- const VERSION = new Version('15.0.0-next.2');
7244
+ const VERSION = new Version('15.0.0-next.4');
7239
7245
 
7240
7246
  /**
7241
7247
  * @license
@@ -7270,29 +7276,70 @@ const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
7270
7276
  * Use of this source code is governed by an MIT-style license that can be
7271
7277
  * found in the LICENSE file at https://angular.io/license
7272
7278
  */
7279
+ // Keeps track of the currently-active LViews.
7280
+ const TRACKED_LVIEWS = new Map();
7281
+ // Used for generating unique IDs for LViews.
7282
+ let uniqueIdCounter = 0;
7283
+ /** Gets a unique ID that can be assigned to an LView. */
7284
+ function getUniqueLViewId() {
7285
+ return uniqueIdCounter++;
7286
+ }
7287
+ /** Starts tracking an LView. */
7288
+ function registerLView(lView) {
7289
+ ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');
7290
+ TRACKED_LVIEWS.set(lView[ID], lView);
7291
+ }
7292
+ /** Gets an LView by its unique ID. */
7293
+ function getLViewById(id) {
7294
+ ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');
7295
+ return TRACKED_LVIEWS.get(id) || null;
7296
+ }
7297
+ /** Stops tracking an LView. */
7298
+ function unregisterLView(lView) {
7299
+ ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');
7300
+ TRACKED_LVIEWS.delete(lView[ID]);
7301
+ }
7302
+
7273
7303
  /**
7274
- * Defines a schema that allows an NgModule to contain the following:
7275
- * - Non-Angular elements named with dash case (`-`).
7276
- * - Element properties named with dash case (`-`).
7277
- * Dash case is the naming convention for custom elements.
7304
+ * @license
7305
+ * Copyright Google LLC All Rights Reserved.
7278
7306
  *
7279
- * @publicApi
7307
+ * Use of this source code is governed by an MIT-style license that can be
7308
+ * found in the LICENSE file at https://angular.io/license
7280
7309
  */
7281
- const CUSTOM_ELEMENTS_SCHEMA = {
7282
- name: 'custom-elements'
7283
- };
7284
7310
  /**
7285
- * Defines a schema that allows any property on any element.
7286
- *
7287
- * This schema allows you to ignore the errors related to any unknown elements or properties in a
7288
- * template. The usage of this schema is generally discouraged because it prevents useful validation
7289
- * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
7311
+ * The internal view context which is specific to a given DOM element, directive or
7312
+ * component instance. Each value in here (besides the LView and element node details)
7313
+ * can be present, null or undefined. If undefined then it implies the value has not been
7314
+ * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.
7290
7315
  *
7291
- * @publicApi
7316
+ * Each value will get filled when the respective value is examined within the getContext
7317
+ * function. The component, element and each directive instance will share the same instance
7318
+ * of the context.
7292
7319
  */
7293
- const NO_ERRORS_SCHEMA = {
7294
- name: 'no-errors-schema'
7295
- };
7320
+ class LContext {
7321
+ constructor(
7322
+ /**
7323
+ * ID of the component's parent view data.
7324
+ */
7325
+ lViewId,
7326
+ /**
7327
+ * The index instance of the node.
7328
+ */
7329
+ nodeIndex,
7330
+ /**
7331
+ * The instance of the DOM node that is attached to the lNode.
7332
+ */
7333
+ native) {
7334
+ this.lViewId = lViewId;
7335
+ this.nodeIndex = nodeIndex;
7336
+ this.native = native;
7337
+ }
7338
+ /** Component's parent view data. */
7339
+ get lView() {
7340
+ return getLViewById(this.lViewId);
7341
+ }
7342
+ }
7296
7343
 
7297
7344
  /**
7298
7345
  * @license
@@ -7301,443 +7348,305 @@ const NO_ERRORS_SCHEMA = {
7301
7348
  * Use of this source code is governed by an MIT-style license that can be
7302
7349
  * found in the LICENSE file at https://angular.io/license
7303
7350
  */
7304
- let shouldThrowErrorOnUnknownElement = false;
7305
- /**
7306
- * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
7307
- * instead of just logging the error.
7308
- * (for AOT-compiled ones this check happens at build time).
7309
- */
7310
- function ɵsetUnknownElementStrictMode(shouldThrow) {
7311
- shouldThrowErrorOnUnknownElement = shouldThrow;
7312
- }
7313
- /**
7314
- * Gets the current value of the strict mode.
7315
- */
7316
- function ɵgetUnknownElementStrictMode() {
7317
- return shouldThrowErrorOnUnknownElement;
7318
- }
7319
- let shouldThrowErrorOnUnknownProperty = false;
7320
- /**
7321
- * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
7322
- * instead of just logging the error.
7323
- * (for AOT-compiled ones this check happens at build time).
7324
- */
7325
- function ɵsetUnknownPropertyStrictMode(shouldThrow) {
7326
- shouldThrowErrorOnUnknownProperty = shouldThrow;
7327
- }
7328
- /**
7329
- * Gets the current value of the strict mode.
7330
- */
7331
- function ɵgetUnknownPropertyStrictMode() {
7332
- return shouldThrowErrorOnUnknownProperty;
7333
- }
7334
7351
  /**
7335
- * Validates that the element is known at runtime and produces
7336
- * an error if it's not the case.
7337
- * This check is relevant for JIT-compiled components (for AOT-compiled
7338
- * ones this check happens at build time).
7352
+ * Returns the matching `LContext` data for a given DOM node, directive or component instance.
7339
7353
  *
7340
- * The element is considered known if either:
7341
- * - it's a known HTML element
7342
- * - it's a known custom element
7343
- * - the element matches any directive
7344
- * - the element is allowed by one of the schemas
7354
+ * This function will examine the provided DOM element, component, or directive instance\'s
7355
+ * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched
7356
+ * value will be that of the newly created `LContext`.
7345
7357
  *
7346
- * @param element Element to validate
7347
- * @param lView An `LView` that represents a current component that is being rendered
7348
- * @param tagName Name of the tag to check
7349
- * @param schemas Array of schemas
7350
- * @param hasDirectives Boolean indicating that the element matches any directive
7358
+ * If the monkey-patched value is the `LView` instance then the context value for that
7359
+ * target will be created and the monkey-patch reference will be updated. Therefore when this
7360
+ * function is called it may mutate the provided element\'s, component\'s or any of the associated
7361
+ * directive\'s monkey-patch values.
7362
+ *
7363
+ * If the monkey-patch value is not detected then the code will walk up the DOM until an element
7364
+ * is found which contains a monkey-patch reference. When that occurs then the provided element
7365
+ * will be updated with a new context (which is then returned). If the monkey-patch value is not
7366
+ * detected for a component/directive instance then it will throw an error (all components and
7367
+ * directives should be automatically monkey-patched by ivy).
7368
+ *
7369
+ * @param target Component, Directive or DOM Node.
7351
7370
  */
7352
- function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
7353
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7354
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7355
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7356
- // execute the check below.
7357
- if (schemas === null)
7358
- return;
7359
- // If the element matches any directive, it's considered as valid.
7360
- if (!hasDirectives && tagName !== null) {
7361
- // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
7362
- // as a custom element. Note that unknown elements with a dash in their name won't be instances
7363
- // of HTMLUnknownElement in browsers that support web components.
7364
- const isUnknown =
7365
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
7366
- // because while most browsers return 'function', IE returns 'object'.
7367
- (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
7368
- element instanceof HTMLUnknownElement) ||
7369
- (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
7370
- !customElements.get(tagName));
7371
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
7372
- const isHostStandalone = isHostComponentStandalone(lView);
7373
- const templateLocation = getTemplateLocationDetails(lView);
7374
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
7375
- let message = `'${tagName}' is not a known element${templateLocation}:\n`;
7376
- message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
7377
- 'a part of an @NgModule where this component is declared'}.\n`;
7378
- if (tagName && tagName.indexOf('-') > -1) {
7379
- message +=
7380
- `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
7371
+ function getLContext(target) {
7372
+ let mpValue = readPatchedData(target);
7373
+ if (mpValue) {
7374
+ // only when it's an array is it considered an LView instance
7375
+ // ... otherwise it's an already constructed LContext instance
7376
+ if (isLView(mpValue)) {
7377
+ const lView = mpValue;
7378
+ let nodeIndex;
7379
+ let component = undefined;
7380
+ let directives = undefined;
7381
+ if (isComponentInstance(target)) {
7382
+ nodeIndex = findViaComponent(lView, target);
7383
+ if (nodeIndex == -1) {
7384
+ throw new Error('The provided component was not found in the application');
7385
+ }
7386
+ component = target;
7387
+ }
7388
+ else if (isDirectiveInstance(target)) {
7389
+ nodeIndex = findViaDirective(lView, target);
7390
+ if (nodeIndex == -1) {
7391
+ throw new Error('The provided directive was not found in the application');
7392
+ }
7393
+ directives = getDirectivesAtNodeIndex(nodeIndex, lView);
7381
7394
  }
7382
7395
  else {
7383
- message +=
7384
- `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
7396
+ nodeIndex = findViaNativeElement(lView, target);
7397
+ if (nodeIndex == -1) {
7398
+ return null;
7399
+ }
7385
7400
  }
7386
- if (shouldThrowErrorOnUnknownElement) {
7387
- throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
7401
+ // the goal is not to fill the entire context full of data because the lookups
7402
+ // are expensive. Instead, only the target data (the element, component, container, ICU
7403
+ // expression or directive details) are filled into the context. If called multiple times
7404
+ // with different target values then the missing target data will be filled in.
7405
+ const native = unwrapRNode(lView[nodeIndex]);
7406
+ const existingCtx = readPatchedData(native);
7407
+ const context = (existingCtx && !Array.isArray(existingCtx)) ?
7408
+ existingCtx :
7409
+ createLContext(lView, nodeIndex, native);
7410
+ // only when the component has been discovered then update the monkey-patch
7411
+ if (component && context.component === undefined) {
7412
+ context.component = component;
7413
+ attachPatchData(context.component, context);
7388
7414
  }
7389
- else {
7390
- console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
7415
+ // only when the directives have been discovered then update the monkey-patch
7416
+ if (directives && context.directives === undefined) {
7417
+ context.directives = directives;
7418
+ for (let i = 0; i < directives.length; i++) {
7419
+ attachPatchData(directives[i], context);
7420
+ }
7391
7421
  }
7422
+ attachPatchData(context.native, context);
7423
+ mpValue = context;
7392
7424
  }
7393
7425
  }
7394
- }
7395
- /**
7396
- * Validates that the property of the element is known at runtime and returns
7397
- * false if it's not the case.
7398
- * This check is relevant for JIT-compiled components (for AOT-compiled
7399
- * ones this check happens at build time).
7400
- *
7401
- * The property is considered known if either:
7402
- * - it's a known property of the element
7403
- * - the element is allowed by one of the schemas
7404
- * - the property is used for animations
7405
- *
7406
- * @param element Element to validate
7407
- * @param propName Name of the property to check
7408
- * @param tagName Name of the tag hosting the property
7409
- * @param schemas Array of schemas
7410
- */
7411
- function isPropertyValid(element, propName, tagName, schemas) {
7412
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7413
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7414
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7415
- // execute the check below.
7416
- if (schemas === null)
7417
- return true;
7418
- // The property is considered valid if the element matches the schema, it exists on the element,
7419
- // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
7420
- if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
7421
- return true;
7422
- }
7423
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
7424
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
7425
- return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
7426
- }
7427
- /**
7428
- * Logs or throws an error that a property is not supported on an element.
7429
- *
7430
- * @param propName Name of the invalid property
7431
- * @param tagName Name of the tag hosting the property
7432
- * @param nodeType Type of the node hosting the property
7433
- * @param lView An `LView` that represents a current component
7434
- */
7435
- function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
7436
- // Special-case a situation when a structural directive is applied to
7437
- // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
7438
- // In this case the compiler generates the `ɵɵtemplate` instruction with
7439
- // the `null` as the tagName. The directive matching logic at runtime relies
7440
- // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
7441
- // a default value of the `tNode.value` is not feasible at this moment.
7442
- if (!tagName && nodeType === 4 /* TNodeType.Container */) {
7443
- tagName = 'ng-template';
7444
- }
7445
- const isHostStandalone = isHostComponentStandalone(lView);
7446
- const templateLocation = getTemplateLocationDetails(lView);
7447
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
7448
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
7449
- const importLocation = isHostStandalone ?
7450
- 'included in the \'@Component.imports\' of this component' :
7451
- 'a part of an @NgModule where this component is declared';
7452
- if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
7453
- // Most likely this is a control flow directive (such as `*ngIf`) used in
7454
- // a template, but the directive or the `CommonModule` is not imported.
7455
- const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
7456
- message += `\nIf the '${propName}' is an Angular control flow directive, ` +
7457
- `please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
7458
- }
7459
7426
  else {
7460
- // May be an Angular component, which is not imported/declared?
7461
- message += `\n1. If '${tagName}' is an Angular component and it has the ` +
7462
- `'${propName}' input, then verify that it is ${importLocation}.`;
7463
- // May be a Web Component?
7464
- if (tagName && tagName.indexOf('-') > -1) {
7465
- message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
7466
- `to the ${schemas} of this component to suppress this message.`;
7467
- message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
7468
- `the ${schemas} of this component.`;
7469
- }
7470
- else {
7471
- // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
7472
- message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
7473
- `the ${schemas} of this component.`;
7427
+ const rElement = target;
7428
+ ngDevMode && assertDomNode(rElement);
7429
+ // if the context is not found then we need to traverse upwards up the DOM
7430
+ // to find the nearest element that has already been monkey patched with data
7431
+ let parent = rElement;
7432
+ while (parent = parent.parentNode) {
7433
+ const parentContext = readPatchedData(parent);
7434
+ if (parentContext) {
7435
+ const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
7436
+ // the edge of the app was also reached here through another means
7437
+ // (maybe because the DOM was changed manually).
7438
+ if (!lView) {
7439
+ return null;
7440
+ }
7441
+ const index = findViaNativeElement(lView, rElement);
7442
+ if (index >= 0) {
7443
+ const native = unwrapRNode(lView[index]);
7444
+ const context = createLContext(lView, index, native);
7445
+ attachPatchData(native, context);
7446
+ mpValue = context;
7447
+ break;
7448
+ }
7449
+ }
7474
7450
  }
7475
7451
  }
7476
- reportUnknownPropertyError(message);
7477
- }
7478
- function reportUnknownPropertyError(message) {
7479
- if (shouldThrowErrorOnUnknownProperty) {
7480
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
7481
- }
7482
- else {
7483
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
7484
- }
7485
- }
7486
- /**
7487
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7488
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7489
- * be too slow for production mode and also it relies on the constructor function being available.
7490
- *
7491
- * Gets a reference to the host component def (where a current component is declared).
7492
- *
7493
- * @param lView An `LView` that represents a current component that is being rendered.
7494
- */
7495
- function getDeclarationComponentDef(lView) {
7496
- !ngDevMode && throwError('Must never be called in production mode');
7497
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
7498
- const context = declarationLView[CONTEXT];
7499
- // Unable to obtain a context.
7500
- if (!context)
7501
- return null;
7502
- return context.constructor ? getComponentDef(context.constructor) : null;
7452
+ return mpValue || null;
7503
7453
  }
7504
7454
  /**
7505
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7506
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7507
- * be too slow for production mode.
7508
- *
7509
- * Checks if the current component is declared inside of a standalone component template.
7510
- *
7511
- * @param lView An `LView` that represents a current component that is being rendered.
7455
+ * Creates an empty instance of a `LContext` context
7512
7456
  */
7513
- function isHostComponentStandalone(lView) {
7514
- !ngDevMode && throwError('Must never be called in production mode');
7515
- const componentDef = getDeclarationComponentDef(lView);
7516
- // Treat host component as non-standalone if we can't obtain the def.
7517
- return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
7457
+ function createLContext(lView, nodeIndex, native) {
7458
+ return new LContext(lView[ID], nodeIndex, native);
7518
7459
  }
7519
7460
  /**
7520
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7521
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7522
- * be too slow for production mode.
7523
- *
7524
- * Constructs a string describing the location of the host component template. The function is used
7525
- * in dev mode to produce error messages.
7461
+ * Takes a component instance and returns the view for that component.
7526
7462
  *
7527
- * @param lView An `LView` that represents a current component that is being rendered.
7463
+ * @param componentInstance
7464
+ * @returns The component's view
7528
7465
  */
7529
- function getTemplateLocationDetails(lView) {
7530
- var _a;
7531
- !ngDevMode && throwError('Must never be called in production mode');
7532
- const hostComponentDef = getDeclarationComponentDef(lView);
7533
- const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
7534
- return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
7466
+ function getComponentViewByInstance(componentInstance) {
7467
+ let patchedData = readPatchedData(componentInstance);
7468
+ let lView;
7469
+ if (isLView(patchedData)) {
7470
+ const contextLView = patchedData;
7471
+ const nodeIndex = findViaComponent(contextLView, componentInstance);
7472
+ lView = getComponentLViewByIndex(nodeIndex, contextLView);
7473
+ const context = createLContext(contextLView, nodeIndex, lView[HOST]);
7474
+ context.component = componentInstance;
7475
+ attachPatchData(componentInstance, context);
7476
+ attachPatchData(context.native, context);
7477
+ }
7478
+ else {
7479
+ const context = patchedData;
7480
+ const contextLView = context.lView;
7481
+ ngDevMode && assertLView(contextLView);
7482
+ lView = getComponentLViewByIndex(context.nodeIndex, contextLView);
7483
+ }
7484
+ return lView;
7535
7485
  }
7536
7486
  /**
7537
- * The set of known control flow directives and their corresponding imports.
7538
- * We use this set to produce a more precises error message with a note
7539
- * that the `CommonModule` should also be included.
7487
+ * This property will be monkey-patched on elements, components and directives.
7540
7488
  */
7541
- const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
7542
- ['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
7543
- ['ngSwitchDefault', 'NgSwitchDefault']
7544
- ]);
7489
+ const MONKEY_PATCH_KEY_NAME = '__ngContext__';
7545
7490
  /**
7546
- * Returns true if the tag name is allowed by specified schemas.
7547
- * @param schemas Array of schemas
7548
- * @param tagName Name of the tag
7491
+ * Assigns the given data to the given target (which could be a component,
7492
+ * directive or DOM node instance) using monkey-patching.
7549
7493
  */
7550
- function matchingSchemas(schemas, tagName) {
7551
- if (schemas !== null) {
7552
- for (let i = 0; i < schemas.length; i++) {
7553
- const schema = schemas[i];
7554
- if (schema === NO_ERRORS_SCHEMA ||
7555
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
7556
- return true;
7557
- }
7558
- }
7494
+ function attachPatchData(target, data) {
7495
+ ngDevMode && assertDefined(target, 'Target expected');
7496
+ // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this
7497
+ // for `LView`, because we have control over when an `LView` is created and destroyed, whereas
7498
+ // we can't know when to remove an `LContext`.
7499
+ if (isLView(data)) {
7500
+ target[MONKEY_PATCH_KEY_NAME] = data[ID];
7501
+ registerLView(data);
7502
+ }
7503
+ else {
7504
+ target[MONKEY_PATCH_KEY_NAME] = data;
7559
7505
  }
7560
- return false;
7561
7506
  }
7562
-
7563
7507
  /**
7564
- * @license
7565
- * Copyright Google LLC All Rights Reserved.
7566
- *
7567
- * Use of this source code is governed by an MIT-style license that can be
7568
- * found in the LICENSE file at https://angular.io/license
7508
+ * Returns the monkey-patch value data present on the target (which could be
7509
+ * a component, directive or a DOM node).
7569
7510
  */
7570
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
7571
- function wrappedError(message, originalError) {
7572
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
7573
- const error = Error(msg);
7574
- error[ERROR_ORIGINAL_ERROR] = originalError;
7575
- return error;
7511
+ function readPatchedData(target) {
7512
+ ngDevMode && assertDefined(target, 'Target expected');
7513
+ const data = target[MONKEY_PATCH_KEY_NAME];
7514
+ return (typeof data === 'number') ? getLViewById(data) : data || null;
7576
7515
  }
7577
- function getOriginalError(error) {
7578
- return error[ERROR_ORIGINAL_ERROR];
7516
+ function readPatchedLView(target) {
7517
+ const value = readPatchedData(target);
7518
+ if (value) {
7519
+ return (isLView(value) ? value : value.lView);
7520
+ }
7521
+ return null;
7522
+ }
7523
+ function isComponentInstance(instance) {
7524
+ return instance && instance.constructor && instance.constructor.ɵcmp;
7525
+ }
7526
+ function isDirectiveInstance(instance) {
7527
+ return instance && instance.constructor && instance.constructor.ɵdir;
7579
7528
  }
7580
-
7581
7529
  /**
7582
- * @license
7583
- * Copyright Google LLC All Rights Reserved.
7584
- *
7585
- * Use of this source code is governed by an MIT-style license that can be
7586
- * found in the LICENSE file at https://angular.io/license
7530
+ * Locates the element within the given LView and returns the matching index
7587
7531
  */
7532
+ function findViaNativeElement(lView, target) {
7533
+ const tView = lView[TVIEW];
7534
+ for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
7535
+ if (unwrapRNode(lView[i]) === target) {
7536
+ return i;
7537
+ }
7538
+ }
7539
+ return -1;
7540
+ }
7588
7541
  /**
7589
- * Provides a hook for centralized exception handling.
7590
- *
7591
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
7592
- * intercept error handling, write a custom exception handler that replaces this default as
7593
- * appropriate for your app.
7594
- *
7595
- * @usageNotes
7596
- * ### Example
7597
- *
7598
- * ```
7599
- * class MyErrorHandler implements ErrorHandler {
7600
- * handleError(error) {
7601
- * // do something with the exception
7602
- * }
7603
- * }
7604
- *
7605
- * @NgModule({
7606
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
7607
- * })
7608
- * class MyModule {}
7609
- * ```
7610
- *
7611
- * @publicApi
7542
+ * Locates the next tNode (child, sibling or parent).
7612
7543
  */
7613
- class ErrorHandler {
7614
- constructor() {
7615
- /**
7616
- * @internal
7617
- */
7618
- this._console = console;
7544
+ function traverseNextElement(tNode) {
7545
+ if (tNode.child) {
7546
+ return tNode.child;
7619
7547
  }
7620
- handleError(error) {
7621
- const originalError = this._findOriginalError(error);
7622
- this._console.error('ERROR', error);
7623
- if (originalError) {
7624
- this._console.error('ORIGINAL ERROR', originalError);
7625
- }
7548
+ else if (tNode.next) {
7549
+ return tNode.next;
7626
7550
  }
7627
- /** @internal */
7628
- _findOriginalError(error) {
7629
- let e = error && getOriginalError(error);
7630
- while (e && getOriginalError(e)) {
7631
- e = getOriginalError(e);
7551
+ else {
7552
+ // Let's take the following template: <div><span>text</span></div><component/>
7553
+ // After checking the text node, we need to find the next parent that has a "next" TNode,
7554
+ // in this case the parent `div`, so that we can find the component.
7555
+ while (tNode.parent && !tNode.parent.next) {
7556
+ tNode = tNode.parent;
7632
7557
  }
7633
- return e || null;
7558
+ return tNode.parent && tNode.parent.next;
7634
7559
  }
7635
7560
  }
7636
-
7637
- /**
7638
- * @license
7639
- * Copyright Google LLC All Rights Reserved.
7640
- *
7641
- * Use of this source code is governed by an MIT-style license that can be
7642
- * found in the LICENSE file at https://angular.io/license
7643
- */
7644
- /**
7645
- * Disallowed strings in the comment.
7646
- *
7647
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
7648
- */
7649
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
7650
- /**
7651
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
7652
- */
7653
- const COMMENT_DELIMITER = /(<|>)/;
7654
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
7655
7561
  /**
7656
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
7657
- *
7658
- * The issue is that HTML does not specify any way to escape comment end text inside the comment.
7659
- * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
7660
- * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
7661
- * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
7662
- *
7663
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
7664
- *
7665
- * ```
7666
- * div.innerHTML = div.innerHTML
7667
- * ```
7668
- *
7669
- * One would expect that the above code would be safe to do, but it turns out that because comment
7670
- * text is not escaped, the comment may contain text which will prematurely close the comment
7671
- * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
7672
- * may contain such text and expect them to be safe.)
7673
- *
7674
- * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
7675
- * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
7676
- * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
7677
- * text it will render normally but it will not cause the HTML parser to close/open the comment.
7678
- *
7679
- * @param value text to make safe for comment node by escaping the comment open/close character
7680
- * sequence.
7562
+ * Locates the component within the given LView and returns the matching index
7681
7563
  */
7682
- function escapeCommentText(value) {
7683
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
7564
+ function findViaComponent(lView, componentInstance) {
7565
+ const componentIndices = lView[TVIEW].components;
7566
+ if (componentIndices) {
7567
+ for (let i = 0; i < componentIndices.length; i++) {
7568
+ const elementComponentIndex = componentIndices[i];
7569
+ const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
7570
+ if (componentView[CONTEXT] === componentInstance) {
7571
+ return elementComponentIndex;
7572
+ }
7573
+ }
7574
+ }
7575
+ else {
7576
+ const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
7577
+ const rootComponent = rootComponentView[CONTEXT];
7578
+ if (rootComponent === componentInstance) {
7579
+ // we are dealing with the root element here therefore we know that the
7580
+ // element is the very first element after the HEADER data in the lView
7581
+ return HEADER_OFFSET;
7582
+ }
7583
+ }
7584
+ return -1;
7684
7585
  }
7685
-
7686
7586
  /**
7687
- * @license
7688
- * Copyright Google LLC All Rights Reserved.
7689
- *
7690
- * Use of this source code is governed by an MIT-style license that can be
7691
- * found in the LICENSE file at https://angular.io/license
7587
+ * Locates the directive within the given LView and returns the matching index
7692
7588
  */
7693
- function normalizeDebugBindingName(name) {
7694
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
7695
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
7696
- return `ng-reflect-${name}`;
7697
- }
7698
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
7699
- function camelCaseToDashCase(input) {
7700
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
7701
- }
7702
- function normalizeDebugBindingValue(value) {
7703
- try {
7704
- // Limit the size of the value as otherwise the DOM just gets polluted.
7705
- return value != null ? value.toString().slice(0, 30) : value;
7706
- }
7707
- catch (e) {
7708
- return '[ERROR] Exception while trying to serialize the value';
7589
+ function findViaDirective(lView, directiveInstance) {
7590
+ // if a directive is monkey patched then it will (by default)
7591
+ // have a reference to the LView of the current view. The
7592
+ // element bound to the directive being search lives somewhere
7593
+ // in the view data. We loop through the nodes and check their
7594
+ // list of directives for the instance.
7595
+ let tNode = lView[TVIEW].firstChild;
7596
+ while (tNode) {
7597
+ const directiveIndexStart = tNode.directiveStart;
7598
+ const directiveIndexEnd = tNode.directiveEnd;
7599
+ for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
7600
+ if (lView[i] === directiveInstance) {
7601
+ return tNode.index;
7602
+ }
7603
+ }
7604
+ tNode = traverseNextElement(tNode);
7709
7605
  }
7606
+ return -1;
7710
7607
  }
7711
-
7712
7608
  /**
7713
- * @license
7714
- * Copyright Google LLC All Rights Reserved.
7609
+ * Returns a list of directives applied to a node at a specific index. The list includes
7610
+ * directives matched by selector and any host directives, but it excludes components.
7611
+ * Use `getComponentAtNodeIndex` to find the component applied to a node.
7715
7612
  *
7716
- * Use of this source code is governed by an MIT-style license that can be
7717
- * found in the LICENSE file at https://angular.io/license
7613
+ * @param nodeIndex The node index
7614
+ * @param lView The target view data
7718
7615
  */
7719
- // Keeps track of the currently-active LViews.
7720
- const TRACKED_LVIEWS = new Map();
7721
- // Used for generating unique IDs for LViews.
7722
- let uniqueIdCounter = 0;
7723
- /** Gets a unique ID that can be assigned to an LView. */
7724
- function getUniqueLViewId() {
7725
- return uniqueIdCounter++;
7726
- }
7727
- /** Starts tracking an LView. */
7728
- function registerLView(lView) {
7729
- ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');
7730
- TRACKED_LVIEWS.set(lView[ID], lView);
7616
+ function getDirectivesAtNodeIndex(nodeIndex, lView) {
7617
+ const tNode = lView[TVIEW].data[nodeIndex];
7618
+ if (tNode.directiveStart === 0)
7619
+ return EMPTY_ARRAY;
7620
+ const results = [];
7621
+ for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
7622
+ const directiveInstance = lView[i];
7623
+ if (!isComponentInstance(directiveInstance)) {
7624
+ results.push(directiveInstance);
7625
+ }
7626
+ }
7627
+ return results;
7731
7628
  }
7732
- /** Gets an LView by its unique ID. */
7733
- function getLViewById(id) {
7734
- ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');
7735
- return TRACKED_LVIEWS.get(id) || null;
7629
+ function getComponentAtNodeIndex(nodeIndex, lView) {
7630
+ const tNode = lView[TVIEW].data[nodeIndex];
7631
+ const { directiveStart, componentOffset } = tNode;
7632
+ return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
7736
7633
  }
7737
- /** Stops tracking an LView. */
7738
- function unregisterLView(lView) {
7739
- ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');
7740
- TRACKED_LVIEWS.delete(lView[ID]);
7634
+ /**
7635
+ * Returns a map of local references (local reference name => element or directive instance) that
7636
+ * exist on a given element.
7637
+ */
7638
+ function discoverLocalRefs(lView, nodeIndex) {
7639
+ const tNode = lView[TVIEW].data[nodeIndex];
7640
+ if (tNode && tNode.localNames) {
7641
+ const result = {};
7642
+ let localIndex = tNode.index + 1;
7643
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
7644
+ result[tNode.localNames[i]] = lView[localIndex];
7645
+ localIndex++;
7646
+ }
7647
+ return result;
7648
+ }
7649
+ return null;
7741
7650
  }
7742
7651
 
7743
7652
  /**
@@ -7748,38 +7657,28 @@ function unregisterLView(lView) {
7748
7657
  * found in the LICENSE file at https://angular.io/license
7749
7658
  */
7750
7659
  /**
7751
- * The internal view context which is specific to a given DOM element, directive or
7752
- * component instance. Each value in here (besides the LView and element node details)
7753
- * can be present, null or undefined. If undefined then it implies the value has not been
7754
- * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.
7660
+ * Defines a schema that allows an NgModule to contain the following:
7661
+ * - Non-Angular elements named with dash case (`-`).
7662
+ * - Element properties named with dash case (`-`).
7663
+ * Dash case is the naming convention for custom elements.
7755
7664
  *
7756
- * Each value will get filled when the respective value is examined within the getContext
7757
- * function. The component, element and each directive instance will share the same instance
7758
- * of the context.
7665
+ * @publicApi
7759
7666
  */
7760
- class LContext {
7761
- constructor(
7762
- /**
7763
- * ID of the component's parent view data.
7764
- */
7765
- lViewId,
7766
- /**
7767
- * The index instance of the node.
7768
- */
7769
- nodeIndex,
7770
- /**
7771
- * The instance of the DOM node that is attached to the lNode.
7772
- */
7773
- native) {
7774
- this.lViewId = lViewId;
7775
- this.nodeIndex = nodeIndex;
7776
- this.native = native;
7777
- }
7778
- /** Component's parent view data. */
7779
- get lView() {
7780
- return getLViewById(this.lViewId);
7781
- }
7782
- }
7667
+ const CUSTOM_ELEMENTS_SCHEMA = {
7668
+ name: 'custom-elements'
7669
+ };
7670
+ /**
7671
+ * Defines a schema that allows any property on any element.
7672
+ *
7673
+ * This schema allows you to ignore the errors related to any unknown elements or properties in a
7674
+ * template. The usage of this schema is generally discouraged because it prevents useful validation
7675
+ * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
7676
+ *
7677
+ * @publicApi
7678
+ */
7679
+ const NO_ERRORS_SCHEMA = {
7680
+ name: 'no-errors-schema'
7681
+ };
7783
7682
 
7784
7683
  /**
7785
7684
  * @license
@@ -7788,302 +7687,412 @@ class LContext {
7788
7687
  * Use of this source code is governed by an MIT-style license that can be
7789
7688
  * found in the LICENSE file at https://angular.io/license
7790
7689
  */
7690
+ let shouldThrowErrorOnUnknownElement = false;
7791
7691
  /**
7792
- * Returns the matching `LContext` data for a given DOM node, directive or component instance.
7793
- *
7794
- * This function will examine the provided DOM element, component, or directive instance\'s
7795
- * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched
7796
- * value will be that of the newly created `LContext`.
7797
- *
7798
- * If the monkey-patched value is the `LView` instance then the context value for that
7799
- * target will be created and the monkey-patch reference will be updated. Therefore when this
7800
- * function is called it may mutate the provided element\'s, component\'s or any of the associated
7801
- * directive\'s monkey-patch values.
7692
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
7693
+ * instead of just logging the error.
7694
+ * (for AOT-compiled ones this check happens at build time).
7695
+ */
7696
+ function ɵsetUnknownElementStrictMode(shouldThrow) {
7697
+ shouldThrowErrorOnUnknownElement = shouldThrow;
7698
+ }
7699
+ /**
7700
+ * Gets the current value of the strict mode.
7701
+ */
7702
+ function ɵgetUnknownElementStrictMode() {
7703
+ return shouldThrowErrorOnUnknownElement;
7704
+ }
7705
+ let shouldThrowErrorOnUnknownProperty = false;
7706
+ /**
7707
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
7708
+ * instead of just logging the error.
7709
+ * (for AOT-compiled ones this check happens at build time).
7710
+ */
7711
+ function ɵsetUnknownPropertyStrictMode(shouldThrow) {
7712
+ shouldThrowErrorOnUnknownProperty = shouldThrow;
7713
+ }
7714
+ /**
7715
+ * Gets the current value of the strict mode.
7716
+ */
7717
+ function ɵgetUnknownPropertyStrictMode() {
7718
+ return shouldThrowErrorOnUnknownProperty;
7719
+ }
7720
+ /**
7721
+ * Validates that the element is known at runtime and produces
7722
+ * an error if it's not the case.
7723
+ * This check is relevant for JIT-compiled components (for AOT-compiled
7724
+ * ones this check happens at build time).
7802
7725
  *
7803
- * If the monkey-patch value is not detected then the code will walk up the DOM until an element
7804
- * is found which contains a monkey-patch reference. When that occurs then the provided element
7805
- * will be updated with a new context (which is then returned). If the monkey-patch value is not
7806
- * detected for a component/directive instance then it will throw an error (all components and
7807
- * directives should be automatically monkey-patched by ivy).
7726
+ * The element is considered known if either:
7727
+ * - it's a known HTML element
7728
+ * - it's a known custom element
7729
+ * - the element matches any directive
7730
+ * - the element is allowed by one of the schemas
7808
7731
  *
7809
- * @param target Component, Directive or DOM Node.
7732
+ * @param element Element to validate
7733
+ * @param lView An `LView` that represents a current component that is being rendered
7734
+ * @param tagName Name of the tag to check
7735
+ * @param schemas Array of schemas
7736
+ * @param hasDirectives Boolean indicating that the element matches any directive
7810
7737
  */
7811
- function getLContext(target) {
7812
- let mpValue = readPatchedData(target);
7813
- if (mpValue) {
7814
- // only when it's an array is it considered an LView instance
7815
- // ... otherwise it's an already constructed LContext instance
7816
- if (isLView(mpValue)) {
7817
- const lView = mpValue;
7818
- let nodeIndex;
7819
- let component = undefined;
7820
- let directives = undefined;
7821
- if (isComponentInstance(target)) {
7822
- nodeIndex = findViaComponent(lView, target);
7823
- if (nodeIndex == -1) {
7824
- throw new Error('The provided component was not found in the application');
7825
- }
7826
- component = target;
7827
- }
7828
- else if (isDirectiveInstance(target)) {
7829
- nodeIndex = findViaDirective(lView, target);
7830
- if (nodeIndex == -1) {
7831
- throw new Error('The provided directive was not found in the application');
7832
- }
7833
- directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
7738
+ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
7739
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7740
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7741
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7742
+ // execute the check below.
7743
+ if (schemas === null)
7744
+ return;
7745
+ // If the element matches any directive, it's considered as valid.
7746
+ if (!hasDirectives && tagName !== null) {
7747
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
7748
+ // as a custom element. Note that unknown elements with a dash in their name won't be instances
7749
+ // of HTMLUnknownElement in browsers that support web components.
7750
+ const isUnknown =
7751
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
7752
+ // because while most browsers return 'function', IE returns 'object'.
7753
+ (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
7754
+ element instanceof HTMLUnknownElement) ||
7755
+ (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
7756
+ !customElements.get(tagName));
7757
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
7758
+ const isHostStandalone = isHostComponentStandalone(lView);
7759
+ const templateLocation = getTemplateLocationDetails(lView);
7760
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
7761
+ let message = `'${tagName}' is not a known element${templateLocation}:\n`;
7762
+ message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
7763
+ 'a part of an @NgModule where this component is declared'}.\n`;
7764
+ if (tagName && tagName.indexOf('-') > -1) {
7765
+ message +=
7766
+ `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
7834
7767
  }
7835
7768
  else {
7836
- nodeIndex = findViaNativeElement(lView, target);
7837
- if (nodeIndex == -1) {
7838
- return null;
7839
- }
7840
- }
7841
- // the goal is not to fill the entire context full of data because the lookups
7842
- // are expensive. Instead, only the target data (the element, component, container, ICU
7843
- // expression or directive details) are filled into the context. If called multiple times
7844
- // with different target values then the missing target data will be filled in.
7845
- const native = unwrapRNode(lView[nodeIndex]);
7846
- const existingCtx = readPatchedData(native);
7847
- const context = (existingCtx && !Array.isArray(existingCtx)) ?
7848
- existingCtx :
7849
- createLContext(lView, nodeIndex, native);
7850
- // only when the component has been discovered then update the monkey-patch
7851
- if (component && context.component === undefined) {
7852
- context.component = component;
7853
- attachPatchData(context.component, context);
7769
+ message +=
7770
+ `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
7854
7771
  }
7855
- // only when the directives have been discovered then update the monkey-patch
7856
- if (directives && context.directives === undefined) {
7857
- context.directives = directives;
7858
- for (let i = 0; i < directives.length; i++) {
7859
- attachPatchData(directives[i], context);
7860
- }
7772
+ if (shouldThrowErrorOnUnknownElement) {
7773
+ throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
7861
7774
  }
7862
- attachPatchData(context.native, context);
7863
- mpValue = context;
7864
- }
7865
- }
7866
- else {
7867
- const rElement = target;
7868
- ngDevMode && assertDomNode(rElement);
7869
- // if the context is not found then we need to traverse upwards up the DOM
7870
- // to find the nearest element that has already been monkey patched with data
7871
- let parent = rElement;
7872
- while (parent = parent.parentNode) {
7873
- const parentContext = readPatchedData(parent);
7874
- if (parentContext) {
7875
- const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
7876
- // the edge of the app was also reached here through another means
7877
- // (maybe because the DOM was changed manually).
7878
- if (!lView) {
7879
- return null;
7880
- }
7881
- const index = findViaNativeElement(lView, rElement);
7882
- if (index >= 0) {
7883
- const native = unwrapRNode(lView[index]);
7884
- const context = createLContext(lView, index, native);
7885
- attachPatchData(native, context);
7886
- mpValue = context;
7887
- break;
7888
- }
7775
+ else {
7776
+ console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
7889
7777
  }
7890
7778
  }
7891
7779
  }
7892
- return mpValue || null;
7893
7780
  }
7894
7781
  /**
7895
- * Creates an empty instance of a `LContext` context
7782
+ * Validates that the property of the element is known at runtime and returns
7783
+ * false if it's not the case.
7784
+ * This check is relevant for JIT-compiled components (for AOT-compiled
7785
+ * ones this check happens at build time).
7786
+ *
7787
+ * The property is considered known if either:
7788
+ * - it's a known property of the element
7789
+ * - the element is allowed by one of the schemas
7790
+ * - the property is used for animations
7791
+ *
7792
+ * @param element Element to validate
7793
+ * @param propName Name of the property to check
7794
+ * @param tagName Name of the tag hosting the property
7795
+ * @param schemas Array of schemas
7896
7796
  */
7897
- function createLContext(lView, nodeIndex, native) {
7898
- return new LContext(lView[ID], nodeIndex, native);
7797
+ function isPropertyValid(element, propName, tagName, schemas) {
7798
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
7799
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
7800
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
7801
+ // execute the check below.
7802
+ if (schemas === null)
7803
+ return true;
7804
+ // The property is considered valid if the element matches the schema, it exists on the element,
7805
+ // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
7806
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
7807
+ return true;
7808
+ }
7809
+ // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
7810
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
7811
+ return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
7899
7812
  }
7900
7813
  /**
7901
- * Takes a component instance and returns the view for that component.
7814
+ * Logs or throws an error that a property is not supported on an element.
7902
7815
  *
7903
- * @param componentInstance
7904
- * @returns The component's view
7816
+ * @param propName Name of the invalid property
7817
+ * @param tagName Name of the tag hosting the property
7818
+ * @param nodeType Type of the node hosting the property
7819
+ * @param lView An `LView` that represents a current component
7905
7820
  */
7906
- function getComponentViewByInstance(componentInstance) {
7907
- let patchedData = readPatchedData(componentInstance);
7908
- let lView;
7909
- if (isLView(patchedData)) {
7910
- const contextLView = patchedData;
7911
- const nodeIndex = findViaComponent(contextLView, componentInstance);
7912
- lView = getComponentLViewByIndex(nodeIndex, contextLView);
7913
- const context = createLContext(contextLView, nodeIndex, lView[HOST]);
7914
- context.component = componentInstance;
7915
- attachPatchData(componentInstance, context);
7916
- attachPatchData(context.native, context);
7821
+ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
7822
+ // Special-case a situation when a structural directive is applied to
7823
+ // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
7824
+ // In this case the compiler generates the `ɵɵtemplate` instruction with
7825
+ // the `null` as the tagName. The directive matching logic at runtime relies
7826
+ // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
7827
+ // a default value of the `tNode.value` is not feasible at this moment.
7828
+ if (!tagName && nodeType === 4 /* TNodeType.Container */) {
7829
+ tagName = 'ng-template';
7830
+ }
7831
+ const isHostStandalone = isHostComponentStandalone(lView);
7832
+ const templateLocation = getTemplateLocationDetails(lView);
7833
+ let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
7834
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
7835
+ const importLocation = isHostStandalone ?
7836
+ 'included in the \'@Component.imports\' of this component' :
7837
+ 'a part of an @NgModule where this component is declared';
7838
+ if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
7839
+ // Most likely this is a control flow directive (such as `*ngIf`) used in
7840
+ // a template, but the directive or the `CommonModule` is not imported.
7841
+ const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
7842
+ message += `\nIf the '${propName}' is an Angular control flow directive, ` +
7843
+ `please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
7917
7844
  }
7918
7845
  else {
7919
- const context = patchedData;
7920
- const contextLView = context.lView;
7921
- ngDevMode && assertLView(contextLView);
7922
- lView = getComponentLViewByIndex(context.nodeIndex, contextLView);
7846
+ // May be an Angular component, which is not imported/declared?
7847
+ message += `\n1. If '${tagName}' is an Angular component and it has the ` +
7848
+ `'${propName}' input, then verify that it is ${importLocation}.`;
7849
+ // May be a Web Component?
7850
+ if (tagName && tagName.indexOf('-') > -1) {
7851
+ message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
7852
+ `to the ${schemas} of this component to suppress this message.`;
7853
+ message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
7854
+ `the ${schemas} of this component.`;
7855
+ }
7856
+ else {
7857
+ // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
7858
+ message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
7859
+ `the ${schemas} of this component.`;
7860
+ }
7923
7861
  }
7924
- return lView;
7862
+ reportUnknownPropertyError(message);
7925
7863
  }
7926
- /**
7927
- * This property will be monkey-patched on elements, components and directives.
7928
- */
7929
- const MONKEY_PATCH_KEY_NAME = '__ngContext__';
7930
- /**
7931
- * Assigns the given data to the given target (which could be a component,
7932
- * directive or DOM node instance) using monkey-patching.
7933
- */
7934
- function attachPatchData(target, data) {
7935
- ngDevMode && assertDefined(target, 'Target expected');
7936
- // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this
7937
- // for `LView`, because we have control over when an `LView` is created and destroyed, whereas
7938
- // we can't know when to remove an `LContext`.
7939
- if (isLView(data)) {
7940
- target[MONKEY_PATCH_KEY_NAME] = data[ID];
7941
- registerLView(data);
7864
+ function reportUnknownPropertyError(message) {
7865
+ if (shouldThrowErrorOnUnknownProperty) {
7866
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
7942
7867
  }
7943
7868
  else {
7944
- target[MONKEY_PATCH_KEY_NAME] = data;
7869
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
7945
7870
  }
7946
7871
  }
7947
7872
  /**
7948
- * Returns the monkey-patch value data present on the target (which could be
7949
- * a component, directive or a DOM node).
7873
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7874
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7875
+ * be too slow for production mode and also it relies on the constructor function being available.
7876
+ *
7877
+ * Gets a reference to the host component def (where a current component is declared).
7878
+ *
7879
+ * @param lView An `LView` that represents a current component that is being rendered.
7950
7880
  */
7951
- function readPatchedData(target) {
7952
- ngDevMode && assertDefined(target, 'Target expected');
7953
- const data = target[MONKEY_PATCH_KEY_NAME];
7954
- return (typeof data === 'number') ? getLViewById(data) : data || null;
7955
- }
7956
- function readPatchedLView(target) {
7957
- const value = readPatchedData(target);
7958
- if (value) {
7959
- return (isLView(value) ? value : value.lView);
7960
- }
7961
- return null;
7881
+ function getDeclarationComponentDef(lView) {
7882
+ !ngDevMode && throwError('Must never be called in production mode');
7883
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
7884
+ const context = declarationLView[CONTEXT];
7885
+ // Unable to obtain a context.
7886
+ if (!context)
7887
+ return null;
7888
+ return context.constructor ? getComponentDef(context.constructor) : null;
7962
7889
  }
7963
- function isComponentInstance(instance) {
7964
- return instance && instance.constructor && instance.constructor.ɵcmp;
7890
+ /**
7891
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
7892
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
7893
+ * be too slow for production mode.
7894
+ *
7895
+ * Checks if the current component is declared inside of a standalone component template.
7896
+ *
7897
+ * @param lView An `LView` that represents a current component that is being rendered.
7898
+ */
7899
+ function isHostComponentStandalone(lView) {
7900
+ !ngDevMode && throwError('Must never be called in production mode');
7901
+ const componentDef = getDeclarationComponentDef(lView);
7902
+ // Treat host component as non-standalone if we can't obtain the def.
7903
+ return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
7965
7904
  }
7966
- function isDirectiveInstance(instance) {
7967
- return instance && instance.constructor && instance.constructor.ɵdir;
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
+ * Constructs a string describing the location of the host component template. The function is used
7911
+ * in dev mode to produce error messages.
7912
+ *
7913
+ * @param lView An `LView` that represents a current component that is being rendered.
7914
+ */
7915
+ function getTemplateLocationDetails(lView) {
7916
+ var _a;
7917
+ !ngDevMode && throwError('Must never be called in production mode');
7918
+ const hostComponentDef = getDeclarationComponentDef(lView);
7919
+ const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
7920
+ return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
7968
7921
  }
7969
7922
  /**
7970
- * Locates the element within the given LView and returns the matching index
7923
+ * The set of known control flow directives and their corresponding imports.
7924
+ * We use this set to produce a more precises error message with a note
7925
+ * that the `CommonModule` should also be included.
7971
7926
  */
7972
- function findViaNativeElement(lView, target) {
7973
- const tView = lView[TVIEW];
7974
- for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
7975
- if (unwrapRNode(lView[i]) === target) {
7976
- return i;
7927
+ const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
7928
+ ['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
7929
+ ['ngSwitchDefault', 'NgSwitchDefault']
7930
+ ]);
7931
+ /**
7932
+ * Returns true if the tag name is allowed by specified schemas.
7933
+ * @param schemas Array of schemas
7934
+ * @param tagName Name of the tag
7935
+ */
7936
+ function matchingSchemas(schemas, tagName) {
7937
+ if (schemas !== null) {
7938
+ for (let i = 0; i < schemas.length; i++) {
7939
+ const schema = schemas[i];
7940
+ if (schema === NO_ERRORS_SCHEMA ||
7941
+ schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
7942
+ return true;
7943
+ }
7977
7944
  }
7978
7945
  }
7979
- return -1;
7946
+ return false;
7980
7947
  }
7948
+
7981
7949
  /**
7982
- * Locates the next tNode (child, sibling or parent).
7950
+ * @license
7951
+ * Copyright Google LLC All Rights Reserved.
7952
+ *
7953
+ * Use of this source code is governed by an MIT-style license that can be
7954
+ * found in the LICENSE file at https://angular.io/license
7983
7955
  */
7984
- function traverseNextElement(tNode) {
7985
- if (tNode.child) {
7986
- return tNode.child;
7987
- }
7988
- else if (tNode.next) {
7989
- return tNode.next;
7990
- }
7991
- else {
7992
- // Let's take the following template: <div><span>text</span></div><component/>
7993
- // After checking the text node, we need to find the next parent that has a "next" TNode,
7994
- // in this case the parent `div`, so that we can find the component.
7995
- while (tNode.parent && !tNode.parent.next) {
7996
- tNode = tNode.parent;
7997
- }
7998
- return tNode.parent && tNode.parent.next;
7999
- }
7956
+ const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
7957
+ function wrappedError(message, originalError) {
7958
+ const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
7959
+ const error = Error(msg);
7960
+ error[ERROR_ORIGINAL_ERROR] = originalError;
7961
+ return error;
7962
+ }
7963
+ function getOriginalError(error) {
7964
+ return error[ERROR_ORIGINAL_ERROR];
8000
7965
  }
7966
+
8001
7967
  /**
8002
- * Locates the component within the given LView and returns the matching index
7968
+ * @license
7969
+ * Copyright Google LLC All Rights Reserved.
7970
+ *
7971
+ * Use of this source code is governed by an MIT-style license that can be
7972
+ * found in the LICENSE file at https://angular.io/license
8003
7973
  */
8004
- function findViaComponent(lView, componentInstance) {
8005
- const componentIndices = lView[TVIEW].components;
8006
- if (componentIndices) {
8007
- for (let i = 0; i < componentIndices.length; i++) {
8008
- const elementComponentIndex = componentIndices[i];
8009
- const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
8010
- if (componentView[CONTEXT] === componentInstance) {
8011
- return elementComponentIndex;
8012
- }
7974
+ /**
7975
+ * Provides a hook for centralized exception handling.
7976
+ *
7977
+ * The default implementation of `ErrorHandler` prints error messages to the `console`. To
7978
+ * intercept error handling, write a custom exception handler that replaces this default as
7979
+ * appropriate for your app.
7980
+ *
7981
+ * @usageNotes
7982
+ * ### Example
7983
+ *
7984
+ * ```
7985
+ * class MyErrorHandler implements ErrorHandler {
7986
+ * handleError(error) {
7987
+ * // do something with the exception
7988
+ * }
7989
+ * }
7990
+ *
7991
+ * @NgModule({
7992
+ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
7993
+ * })
7994
+ * class MyModule {}
7995
+ * ```
7996
+ *
7997
+ * @publicApi
7998
+ */
7999
+ class ErrorHandler {
8000
+ constructor() {
8001
+ /**
8002
+ * @internal
8003
+ */
8004
+ this._console = console;
8005
+ }
8006
+ handleError(error) {
8007
+ const originalError = this._findOriginalError(error);
8008
+ this._console.error('ERROR', error);
8009
+ if (originalError) {
8010
+ this._console.error('ORIGINAL ERROR', originalError);
8013
8011
  }
8014
8012
  }
8015
- else {
8016
- const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
8017
- const rootComponent = rootComponentView[CONTEXT];
8018
- if (rootComponent === componentInstance) {
8019
- // we are dealing with the root element here therefore we know that the
8020
- // element is the very first element after the HEADER data in the lView
8021
- return HEADER_OFFSET;
8013
+ /** @internal */
8014
+ _findOriginalError(error) {
8015
+ let e = error && getOriginalError(error);
8016
+ while (e && getOriginalError(e)) {
8017
+ e = getOriginalError(e);
8022
8018
  }
8019
+ return e || null;
8023
8020
  }
8024
- return -1;
8025
8021
  }
8022
+
8026
8023
  /**
8027
- * Locates the directive within the given LView and returns the matching index
8024
+ * @license
8025
+ * Copyright Google LLC All Rights Reserved.
8026
+ *
8027
+ * Use of this source code is governed by an MIT-style license that can be
8028
+ * found in the LICENSE file at https://angular.io/license
8028
8029
  */
8029
- function findViaDirective(lView, directiveInstance) {
8030
- // if a directive is monkey patched then it will (by default)
8031
- // have a reference to the LView of the current view. The
8032
- // element bound to the directive being search lives somewhere
8033
- // in the view data. We loop through the nodes and check their
8034
- // list of directives for the instance.
8035
- let tNode = lView[TVIEW].firstChild;
8036
- while (tNode) {
8037
- const directiveIndexStart = tNode.directiveStart;
8038
- const directiveIndexEnd = tNode.directiveEnd;
8039
- for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
8040
- if (lView[i] === directiveInstance) {
8041
- return tNode.index;
8042
- }
8043
- }
8044
- tNode = traverseNextElement(tNode);
8045
- }
8046
- return -1;
8047
- }
8048
8030
  /**
8049
- * Returns a list of directives extracted from the given view based on the
8050
- * provided list of directive index values.
8031
+ * Disallowed strings in the comment.
8051
8032
  *
8052
- * @param nodeIndex The node index
8053
- * @param lView The target view data
8054
- * @param includeComponents Whether or not to include components in returned directives
8033
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
8055
8034
  */
8056
- function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
8057
- const tNode = lView[TVIEW].data[nodeIndex];
8058
- let directiveStartIndex = tNode.directiveStart;
8059
- if (directiveStartIndex == 0)
8060
- return EMPTY_ARRAY;
8061
- const directiveEndIndex = tNode.directiveEnd;
8062
- if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
8063
- directiveStartIndex++;
8064
- return lView.slice(directiveStartIndex, directiveEndIndex);
8065
- }
8066
- function getComponentAtNodeIndex(nodeIndex, lView) {
8067
- const tNode = lView[TVIEW].data[nodeIndex];
8068
- let directiveStartIndex = tNode.directiveStart;
8069
- return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
8035
+ const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
8036
+ /**
8037
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
8038
+ */
8039
+ const COMMENT_DELIMITER = /(<|>)/;
8040
+ const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
8041
+ /**
8042
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
8043
+ *
8044
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
8045
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
8046
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
8047
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
8048
+ *
8049
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
8050
+ *
8051
+ * ```
8052
+ * div.innerHTML = div.innerHTML
8053
+ * ```
8054
+ *
8055
+ * One would expect that the above code would be safe to do, but it turns out that because comment
8056
+ * text is not escaped, the comment may contain text which will prematurely close the comment
8057
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
8058
+ * may contain such text and expect them to be safe.)
8059
+ *
8060
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
8061
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
8062
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
8063
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
8064
+ *
8065
+ * @param value text to make safe for comment node by escaping the comment open/close character
8066
+ * sequence.
8067
+ */
8068
+ function escapeCommentText(value) {
8069
+ return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
8070
8070
  }
8071
+
8071
8072
  /**
8072
- * Returns a map of local references (local reference name => element or directive instance) that
8073
- * exist on a given element.
8073
+ * @license
8074
+ * Copyright Google LLC All Rights Reserved.
8075
+ *
8076
+ * Use of this source code is governed by an MIT-style license that can be
8077
+ * found in the LICENSE file at https://angular.io/license
8074
8078
  */
8075
- function discoverLocalRefs(lView, nodeIndex) {
8076
- const tNode = lView[TVIEW].data[nodeIndex];
8077
- if (tNode && tNode.localNames) {
8078
- const result = {};
8079
- let localIndex = tNode.index + 1;
8080
- for (let i = 0; i < tNode.localNames.length; i += 2) {
8081
- result[tNode.localNames[i]] = lView[localIndex];
8082
- localIndex++;
8083
- }
8084
- return result;
8079
+ function normalizeDebugBindingName(name) {
8080
+ // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
8081
+ name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
8082
+ return `ng-reflect-${name}`;
8083
+ }
8084
+ const CAMEL_CASE_REGEXP = /([A-Z])/g;
8085
+ function camelCaseToDashCase(input) {
8086
+ return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
8087
+ }
8088
+ function normalizeDebugBindingValue(value) {
8089
+ try {
8090
+ // Limit the size of the value as otherwise the DOM just gets polluted.
8091
+ return value != null ? value.toString().slice(0, 30) : value;
8092
+ }
8093
+ catch (e) {
8094
+ return '[ERROR] Exception while trying to serialize the value';
8085
8095
  }
8086
- return null;
8087
8096
  }
8088
8097
 
8089
8098
  /**
@@ -8869,9 +8878,10 @@ function getClosestRElement(tView, tNode, lView) {
8869
8878
  }
8870
8879
  else {
8871
8880
  ngDevMode && assertTNodeType(parentTNode, 3 /* TNodeType.AnyRNode */ | 4 /* TNodeType.Container */);
8872
- if (parentTNode.flags & 2 /* TNodeFlags.isComponentHost */) {
8881
+ const { componentOffset } = parentTNode;
8882
+ if (componentOffset > -1) {
8873
8883
  ngDevMode && assertTNodeForLView(parentTNode, lView);
8874
- const encapsulation = tView.data[parentTNode.directiveStart].encapsulation;
8884
+ const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
8875
8885
  // We've got a parent which is an element in the current view. We just need to verify if the
8876
8886
  // parent element is not a component. Component's content nodes are not inserted immediately
8877
8887
  // because they will be projected, and so doing insert at this point would be wasteful.
@@ -9104,10 +9114,10 @@ function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode,
9104
9114
  if (isProjection) {
9105
9115
  if (action === 0 /* WalkTNodeTreeAction.Create */) {
9106
9116
  rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
9107
- tNode.flags |= 4 /* TNodeFlags.isProjected */;
9117
+ tNode.flags |= 2 /* TNodeFlags.isProjected */;
9108
9118
  }
9109
9119
  }
9110
- if ((tNode.flags & 64 /* TNodeFlags.isDetached */) !== 64 /* TNodeFlags.isDetached */) {
9120
+ if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
9111
9121
  if (tNodeType & 8 /* TNodeType.ElementContainer */) {
9112
9122
  applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
9113
9123
  applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
@@ -9301,6 +9311,19 @@ function writeDirectClass(renderer, element, newValue) {
9301
9311
  }
9302
9312
  ngDevMode && ngDevMode.rendererSetClassName++;
9303
9313
  }
9314
+ /** Sets up the static DOM attributes on an `RNode`. */
9315
+ function setupStaticAttributes(renderer, element, tNode) {
9316
+ const { mergedAttrs, classes, styles } = tNode;
9317
+ if (mergedAttrs !== null) {
9318
+ setUpAttributes(renderer, element, mergedAttrs);
9319
+ }
9320
+ if (classes !== null) {
9321
+ writeDirectClass(renderer, element, classes);
9322
+ }
9323
+ if (styles !== null) {
9324
+ writeDirectStyle(renderer, element, styles);
9325
+ }
9326
+ }
9304
9327
 
9305
9328
  /**
9306
9329
  * @license
@@ -11162,6 +11185,7 @@ class TNode {
11162
11185
  index, //
11163
11186
  insertBeforeIndex, //
11164
11187
  injectorIndex, //
11188
+ componentOffset, //
11165
11189
  directiveStart, //
11166
11190
  directiveEnd, //
11167
11191
  directiveStylingLast, //
@@ -11194,6 +11218,7 @@ class TNode {
11194
11218
  this.index = index;
11195
11219
  this.insertBeforeIndex = insertBeforeIndex;
11196
11220
  this.injectorIndex = injectorIndex;
11221
+ this.componentOffset = componentOffset;
11197
11222
  this.directiveStart = directiveStart;
11198
11223
  this.directiveEnd = directiveEnd;
11199
11224
  this.directiveStylingLast = directiveStylingLast;
@@ -11271,21 +11296,19 @@ class TNode {
11271
11296
  }
11272
11297
  get flags_() {
11273
11298
  const flags = [];
11274
- if (this.flags & 16 /* TNodeFlags.hasClassInput */)
11299
+ if (this.flags & 8 /* TNodeFlags.hasClassInput */)
11275
11300
  flags.push('TNodeFlags.hasClassInput');
11276
- if (this.flags & 8 /* TNodeFlags.hasContentQuery */)
11301
+ if (this.flags & 4 /* TNodeFlags.hasContentQuery */)
11277
11302
  flags.push('TNodeFlags.hasContentQuery');
11278
- if (this.flags & 32 /* TNodeFlags.hasStyleInput */)
11303
+ if (this.flags & 16 /* TNodeFlags.hasStyleInput */)
11279
11304
  flags.push('TNodeFlags.hasStyleInput');
11280
- if (this.flags & 128 /* TNodeFlags.hasHostBindings */)
11305
+ if (this.flags & 64 /* TNodeFlags.hasHostBindings */)
11281
11306
  flags.push('TNodeFlags.hasHostBindings');
11282
- if (this.flags & 2 /* TNodeFlags.isComponentHost */)
11283
- flags.push('TNodeFlags.isComponentHost');
11284
11307
  if (this.flags & 1 /* TNodeFlags.isDirectiveHost */)
11285
11308
  flags.push('TNodeFlags.isDirectiveHost');
11286
- if (this.flags & 64 /* TNodeFlags.isDetached */)
11309
+ if (this.flags & 32 /* TNodeFlags.isDetached */)
11287
11310
  flags.push('TNodeFlags.isDetached');
11288
- if (this.flags & 4 /* TNodeFlags.isProjected */)
11311
+ if (this.flags & 2 /* TNodeFlags.isProjected */)
11289
11312
  flags.push('TNodeFlags.isProjected');
11290
11313
  return flags.join('|');
11291
11314
  }
@@ -11795,7 +11818,7 @@ function getOrCreateTNode(tView, index, type, name, attrs) {
11795
11818
  // See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
11796
11819
  // If the `TNode` was not pre-declared than it means it was not mentioned which means it was
11797
11820
  // removed, so we mark it as detached.
11798
- tNode.flags |= 64 /* TNodeFlags.isDetached */;
11821
+ tNode.flags |= 32 /* TNodeFlags.isDetached */;
11799
11822
  }
11800
11823
  }
11801
11824
  else if (tNode.type & 64 /* TNodeType.Placeholder */) {
@@ -12099,7 +12122,7 @@ function createDirectivesInstances(tView, lView, tNode) {
12099
12122
  if (!getBindingsEnabled())
12100
12123
  return;
12101
12124
  instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
12102
- if ((tNode.flags & 128 /* TNodeFlags.hasHostBindings */) === 128 /* TNodeFlags.hasHostBindings */) {
12125
+ if ((tNode.flags & 64 /* TNodeFlags.hasHostBindings */) === 64 /* TNodeFlags.hasHostBindings */) {
12103
12126
  invokeDirectivesHostBindings(tView, lView, tNode);
12104
12127
  }
12105
12128
  }
@@ -12299,6 +12322,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
12299
12322
  index, // index: number
12300
12323
  null, // insertBeforeIndex: null|-1|number|number[]
12301
12324
  injectorIndex, // injectorIndex: number
12325
+ -1, // componentOffset: number
12302
12326
  -1, // directiveStart: number
12303
12327
  -1, // directiveEnd: number
12304
12328
  -1, // directiveStylingLast: number
@@ -12334,6 +12358,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
12334
12358
  directiveStart: -1,
12335
12359
  directiveEnd: -1,
12336
12360
  directiveStylingLast: -1,
12361
+ componentOffset: -1,
12337
12362
  propertyBindings: null,
12338
12363
  flags: 0,
12339
12364
  providerIndexes: 0,
@@ -12397,24 +12422,23 @@ function initializeInputAndOutputAliases(tView, tNode) {
12397
12422
  let outputsStore = null;
12398
12423
  for (let i = start; i < end; i++) {
12399
12424
  const directiveDef = tViewData[i];
12400
- const directiveInputs = directiveDef.inputs;
12425
+ inputsStore = generatePropertyAliases(directiveDef.inputs, i, inputsStore);
12426
+ outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
12401
12427
  // Do not use unbound attributes as inputs to structural directives, since structural
12402
12428
  // directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
12403
12429
  // TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
12404
12430
  // should be set for inline templates.
12405
- const initialInputs = (tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
12406
- generateInitialInputs(directiveInputs, tNodeAttrs) :
12431
+ const initialInputs = (inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
12432
+ generateInitialInputs(inputsStore, i, tNodeAttrs) :
12407
12433
  null;
12408
12434
  inputsFromAttrs.push(initialInputs);
12409
- inputsStore = generatePropertyAliases(directiveInputs, i, inputsStore);
12410
- outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
12411
12435
  }
12412
12436
  if (inputsStore !== null) {
12413
12437
  if (inputsStore.hasOwnProperty('class')) {
12414
- tNode.flags |= 16 /* TNodeFlags.hasClassInput */;
12438
+ tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
12415
12439
  }
12416
12440
  if (inputsStore.hasOwnProperty('style')) {
12417
- tNode.flags |= 32 /* TNodeFlags.hasStyleInput */;
12441
+ tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
12418
12442
  }
12419
12443
  }
12420
12444
  tNode.initialInputs = inputsFromAttrs;
@@ -12521,28 +12545,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12521
12545
  }
12522
12546
  }
12523
12547
  }
12524
- /**
12525
- * Instantiate a root component.
12526
- */
12527
- function instantiateRootComponent(tView, lView, def) {
12528
- const rootTNode = getCurrentTNode();
12529
- if (tView.firstCreatePass) {
12530
- if (def.providersResolver)
12531
- def.providersResolver(def);
12532
- const directiveIndex = allocExpando(tView, lView, 1, null);
12533
- ngDevMode &&
12534
- assertEqual(directiveIndex, rootTNode.directiveStart, 'Because this is a root component the allocated expando should match the TNode component.');
12535
- configureViewWithDirective(tView, rootTNode, lView, directiveIndex, def);
12536
- initializeInputAndOutputAliases(tView, rootTNode);
12537
- }
12538
- const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart, rootTNode);
12539
- attachPatchData(directive, lView);
12540
- const native = getNativeByTNode(rootTNode, lView);
12541
- if (native) {
12542
- attachPatchData(native, lView);
12543
- }
12544
- return directive;
12545
- }
12546
12548
  /**
12547
12549
  * Resolve the matched directives on a node.
12548
12550
  */
@@ -12555,53 +12557,13 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
12555
12557
  const directiveDefs = findDirectiveDefMatches(tView, lView, tNode);
12556
12558
  const exportsMap = localRefs === null ? null : { '': -1 };
12557
12559
  if (directiveDefs !== null) {
12558
- hasDirectives = true;
12559
- initTNodeFlags(tNode, tView.data.length, directiveDefs.length);
12560
- // When the same token is provided by several directives on the same node, some rules apply in
12561
- // the viewEngine:
12562
- // - viewProviders have priority over providers
12563
- // - the last directive in NgModule.declarations has priority over the previous one
12564
- // So to match these rules, the order in which providers are added in the arrays is very
12565
- // important.
12566
- for (let i = 0; i < directiveDefs.length; i++) {
12567
- const def = directiveDefs[i];
12568
- if (def.providersResolver)
12569
- def.providersResolver(def);
12570
- }
12571
- let preOrderHooksFound = false;
12572
- let preOrderCheckHooksFound = false;
12573
- let directiveIdx = allocExpando(tView, lView, directiveDefs.length, null);
12574
- ngDevMode &&
12575
- assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
12560
+ // Publishes the directive types to DI so they can be injected. Needs to
12561
+ // happen in a separate pass before the TNode flags have been initialized.
12576
12562
  for (let i = 0; i < directiveDefs.length; i++) {
12577
- const def = directiveDefs[i];
12578
- // Merge the attrs in the order of matches. This assumes that the first directive is the
12579
- // component itself, so that the component has the least priority.
12580
- tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
12581
- configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
12582
- saveNameToExportMap(directiveIdx, def, exportsMap);
12583
- if (def.contentQueries !== null)
12584
- tNode.flags |= 8 /* TNodeFlags.hasContentQuery */;
12585
- if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
12586
- tNode.flags |= 128 /* TNodeFlags.hasHostBindings */;
12587
- const lifeCycleHooks = def.type.prototype;
12588
- // Only push a node index into the preOrderHooks array if this is the first
12589
- // pre-order hook found on this node.
12590
- if (!preOrderHooksFound &&
12591
- (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
12592
- // We will push the actual hook function into this array later during dir instantiation.
12593
- // We cannot do it now because we must ensure hooks are registered in the same
12594
- // order that directives are created (i.e. injection order).
12595
- (tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index);
12596
- preOrderHooksFound = true;
12597
- }
12598
- if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
12599
- (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(tNode.index);
12600
- preOrderCheckHooksFound = true;
12601
- }
12602
- directiveIdx++;
12563
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directiveDefs[i].type);
12603
12564
  }
12604
- initializeInputAndOutputAliases(tView, tNode);
12565
+ hasDirectives = true;
12566
+ initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap);
12605
12567
  }
12606
12568
  if (exportsMap)
12607
12569
  cacheMatchingLocalNames(tNode, localRefs, exportsMap);
@@ -12610,17 +12572,66 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
12610
12572
  tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
12611
12573
  return hasDirectives;
12612
12574
  }
12575
+ /** Initializes the data structures necessary for a list of directives to be instantiated. */
12576
+ function initializeDirectives(tView, lView, tNode, directives, exportsMap) {
12577
+ ngDevMode && assertFirstCreatePass(tView);
12578
+ initTNodeFlags(tNode, tView.data.length, directives.length);
12579
+ // When the same token is provided by several directives on the same node, some rules apply in
12580
+ // the viewEngine:
12581
+ // - viewProviders have priority over providers
12582
+ // - the last directive in NgModule.declarations has priority over the previous one
12583
+ // So to match these rules, the order in which providers are added in the arrays is very
12584
+ // important.
12585
+ for (let i = 0; i < directives.length; i++) {
12586
+ const def = directives[i];
12587
+ if (def.providersResolver)
12588
+ def.providersResolver(def);
12589
+ }
12590
+ let preOrderHooksFound = false;
12591
+ let preOrderCheckHooksFound = false;
12592
+ let directiveIdx = allocExpando(tView, lView, directives.length, null);
12593
+ ngDevMode &&
12594
+ assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
12595
+ for (let i = 0; i < directives.length; i++) {
12596
+ const def = directives[i];
12597
+ // Merge the attrs in the order of matches. This assumes that the first directive is the
12598
+ // component itself, so that the component has the least priority.
12599
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
12600
+ configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
12601
+ saveNameToExportMap(directiveIdx, def, exportsMap);
12602
+ if (def.contentQueries !== null)
12603
+ tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
12604
+ if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
12605
+ tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
12606
+ const lifeCycleHooks = def.type.prototype;
12607
+ // Only push a node index into the preOrderHooks array if this is the first
12608
+ // pre-order hook found on this node.
12609
+ if (!preOrderHooksFound &&
12610
+ (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
12611
+ // We will push the actual hook function into this array later during dir instantiation.
12612
+ // We cannot do it now because we must ensure hooks are registered in the same
12613
+ // order that directives are created (i.e. injection order).
12614
+ (tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index);
12615
+ preOrderHooksFound = true;
12616
+ }
12617
+ if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
12618
+ (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(tNode.index);
12619
+ preOrderCheckHooksFound = true;
12620
+ }
12621
+ directiveIdx++;
12622
+ }
12623
+ initializeInputAndOutputAliases(tView, tNode);
12624
+ }
12613
12625
  /**
12614
12626
  * Add `hostBindings` to the `TView.hostBindingOpCodes`.
12615
12627
  *
12616
12628
  * @param tView `TView` to which the `hostBindings` should be added.
12617
12629
  * @param tNode `TNode` the element which contains the directive
12618
- * @param lView `LView` current `LView`
12619
12630
  * @param directiveIdx Directive index in view.
12620
12631
  * @param directiveVarsIdx Where will the directive's vars be stored
12621
12632
  * @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
12622
12633
  */
12623
- function registerHostBindingOpCodes(tView, tNode, lView, directiveIdx, directiveVarsIdx, def) {
12634
+ function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
12624
12635
  ngDevMode && assertFirstCreatePass(tView);
12625
12636
  const hostBindings = def.hostBindings;
12626
12637
  if (hostBindings) {
@@ -12721,7 +12732,7 @@ function invokeHostBindingsInCreationMode(def, directive) {
12721
12732
  * Matches the current node against all available selectors.
12722
12733
  * If a component is matched (at most one), it is returned in first position in the array.
12723
12734
  */
12724
- function findDirectiveDefMatches(tView, viewData, tNode) {
12735
+ function findDirectiveDefMatches(tView, lView, tNode) {
12725
12736
  var _a;
12726
12737
  ngDevMode && assertFirstCreatePass(tView);
12727
12738
  ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
@@ -12732,25 +12743,47 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
12732
12743
  const def = registry[i];
12733
12744
  if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
12734
12745
  matches || (matches = ngDevMode ? new MatchesArray() : []);
12735
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type);
12736
12746
  if (isComponentDef(def)) {
12737
12747
  if (ngDevMode) {
12738
12748
  assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
12739
12749
  `Please use a different tag to activate the ${stringify(def.type)} component.`);
12740
- if (tNode.flags & 2 /* TNodeFlags.isComponentHost */) {
12741
- // If another component has been matched previously, it's the first element in the
12742
- // `matches` array, see how we store components/directives in `matches` below.
12743
- throwMultipleComponentError(tNode, matches[0].type, def.type);
12750
+ if (isComponentHost(tNode)) {
12751
+ throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
12744
12752
  }
12745
12753
  }
12746
- markAsComponentHost(tView, tNode);
12747
- // The component is always stored first with directives after.
12748
- matches.unshift(def);
12754
+ // Components are inserted at the front of the matches array so that their lifecycle
12755
+ // hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
12756
+ // compatibility. This logic doesn't make sense with host directives, because it
12757
+ // would allow the host directives to undo any overrides the host may have made.
12758
+ // To handle this case, the host directives of components are inserted at the beginning
12759
+ // of the array, followed by the component. As such, the insertion order is as follows:
12760
+ // 1. Host directives belonging to the selector-matched component.
12761
+ // 2. Selector-matched component.
12762
+ // 3. Host directives belonging to selector-matched directives.
12763
+ // 4. Selector-matched directives.
12764
+ if (def.findHostDirectiveDefs !== null) {
12765
+ const hostDirectiveMatches = [];
12766
+ def.findHostDirectiveDefs(hostDirectiveMatches, def, tView, lView, tNode);
12767
+ // Add all host directives declared on this component, followed by the component itself.
12768
+ // Host directives should execute first so the host has a chance to override changes
12769
+ // to the DOM made by them.
12770
+ matches.unshift(...hostDirectiveMatches, def);
12771
+ // Component is offset starting from the beginning of the host directives array.
12772
+ const componentOffset = hostDirectiveMatches.length;
12773
+ markAsComponentHost(tView, tNode, componentOffset);
12774
+ }
12775
+ else {
12776
+ // No host directives on this component, just add the
12777
+ // component def to the beginning of the matches.
12778
+ matches.unshift(def);
12779
+ markAsComponentHost(tView, tNode, 0);
12780
+ }
12749
12781
  }
12750
12782
  else {
12783
+ // Append any host directives to the matches first.
12784
+ (_a = def.findHostDirectiveDefs) === null || _a === void 0 ? void 0 : _a.call(def, matches, def, tView, lView, tNode);
12751
12785
  matches.push(def);
12752
12786
  }
12753
- (_a = def.applyHostDirectives) === null || _a === void 0 ? void 0 : _a.call(def, tView, viewData, tNode, matches);
12754
12787
  }
12755
12788
  }
12756
12789
  }
@@ -12758,12 +12791,13 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
12758
12791
  }
12759
12792
  /**
12760
12793
  * Marks a given TNode as a component's host. This consists of:
12761
- * - setting appropriate TNode flags;
12794
+ * - setting the component offset on the TNode.
12762
12795
  * - storing index of component's host element so it will be queued for view refresh during CD.
12763
12796
  */
12764
- function markAsComponentHost(tView, hostTNode) {
12797
+ function markAsComponentHost(tView, hostTNode, componentOffset) {
12765
12798
  ngDevMode && assertFirstCreatePass(tView);
12766
- hostTNode.flags |= 2 /* TNodeFlags.isComponentHost */;
12799
+ ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
12800
+ hostTNode.componentOffset = componentOffset;
12767
12801
  (tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
12768
12802
  .push(hostTNode.index);
12769
12803
  }
@@ -12834,7 +12868,7 @@ function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
12834
12868
  const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
12835
12869
  tView.blueprint[directiveIndex] = nodeInjectorFactory;
12836
12870
  lView[directiveIndex] = nodeInjectorFactory;
12837
- registerHostBindingOpCodes(tView, tNode, lView, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
12871
+ registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
12838
12872
  }
12839
12873
  function addComponentLogic(lView, hostTNode, def) {
12840
12874
  const native = getNativeByTNode(hostTNode, lView);
@@ -12909,10 +12943,11 @@ function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initial
12909
12943
  *
12910
12944
  * <my-component name="Bess"></my-component>
12911
12945
  *
12912
- * @param inputs The list of inputs from the directive def
12913
- * @param attrs The static attrs on this node
12946
+ * @param inputs Input alias map that was generated from the directive def inputs.
12947
+ * @param directiveIndex Index of the directive that is currently being processed.
12948
+ * @param attrs Static attrs on this node.
12914
12949
  */
12915
- function generateInitialInputs(inputs, attrs) {
12950
+ function generateInitialInputs(inputs, directiveIndex, attrs) {
12916
12951
  let inputsToStore = null;
12917
12952
  let i = 0;
12918
12953
  while (i < attrs.length) {
@@ -12933,7 +12968,17 @@ function generateInitialInputs(inputs, attrs) {
12933
12968
  if (inputs.hasOwnProperty(attrName)) {
12934
12969
  if (inputsToStore === null)
12935
12970
  inputsToStore = [];
12936
- inputsToStore.push(attrName, inputs[attrName], attrs[i + 1]);
12971
+ // Find the input's public name from the input store. Note that we can be found easier
12972
+ // through the directive def, but we want to do it using the inputs store so that it can
12973
+ // account for host directive aliases.
12974
+ const inputConfig = inputs[attrName];
12975
+ for (let j = 0; j < inputConfig.length; j += 2) {
12976
+ if (inputConfig[j] === directiveIndex) {
12977
+ inputsToStore.push(attrName, inputConfig[j + 1], attrs[i + 1]);
12978
+ // A directive can't have multiple inputs with the same name so we can break here.
12979
+ break;
12980
+ }
12981
+ }
12937
12982
  }
12938
12983
  i += 2;
12939
12984
  }
@@ -13746,6 +13791,7 @@ class ChainedInjector {
13746
13791
  this.parentInjector = parentInjector;
13747
13792
  }
13748
13793
  get(token, notFoundValue, flags) {
13794
+ flags = convertToBitFlags(flags);
13749
13795
  const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
13750
13796
  if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
13751
13797
  notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
@@ -13822,42 +13868,23 @@ class ComponentFactory extends ComponentFactory$1 {
13822
13868
  let component;
13823
13869
  let tElementNode;
13824
13870
  try {
13825
- const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
13871
+ const rootDirectives = [this.componentDef];
13872
+ const hostTNode = createRootComponentTNode(rootLView, hostRNode);
13873
+ const componentView = createRootComponentView(hostTNode, hostRNode, this.componentDef, rootDirectives, rootLView, rendererFactory, hostRenderer);
13874
+ tElementNode = getTNode(rootTView, HEADER_OFFSET);
13875
+ // TODO(crisbeto): in practice `hostRNode` should always be defined, but there are some tests
13876
+ // where the renderer is mocked out and `undefined` is returned. We should update the tests so
13877
+ // that this check can be removed.
13826
13878
  if (hostRNode) {
13827
- if (rootSelectorOrNode) {
13828
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
13829
- }
13830
- else {
13831
- // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
13832
- // is not defined), also apply attributes and classes extracted from component selector.
13833
- // Extract attributes and classes from the first selector only to match VE behavior.
13834
- const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
13835
- if (attrs) {
13836
- setUpAttributes(hostRenderer, hostRNode, attrs);
13837
- }
13838
- if (classes && classes.length > 0) {
13839
- writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
13840
- }
13841
- }
13879
+ setRootNodeAttributes(hostRenderer, this.componentDef, hostRNode, rootSelectorOrNode);
13842
13880
  }
13843
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
13844
13881
  if (projectableNodes !== undefined) {
13845
- const projection = tElementNode.projection = [];
13846
- for (let i = 0; i < this.ngContentSelectors.length; i++) {
13847
- const nodesforSlot = projectableNodes[i];
13848
- // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
13849
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
13850
- // complex checks down the line.
13851
- // We also normalize the length of the passed in projectable nodes (to match the number of
13852
- // <ng-container> slots defined by a component).
13853
- projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
13854
- }
13882
+ projectNodes(tElementNode, this.ngContentSelectors, projectableNodes);
13855
13883
  }
13856
13884
  // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
13857
13885
  // executed here?
13858
13886
  // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
13859
- component =
13860
- createRootComponent(componentView, this.componentDef, rootLView, [LifecycleHooksFeature]);
13887
+ component = createRootComponent(componentView, this.componentDef, rootDirectives, rootLView, [LifecycleHooksFeature]);
13861
13888
  renderView(rootTView, rootLView, null);
13862
13889
  }
13863
13890
  finally {
@@ -13928,11 +13955,22 @@ const NULL_INJECTOR = {
13928
13955
  throwProviderNotFoundError(token, 'NullInjector');
13929
13956
  }
13930
13957
  };
13958
+ /** Creates a TNode that can be used to instantiate a root component. */
13959
+ function createRootComponentTNode(lView, rNode) {
13960
+ const tView = lView[TVIEW];
13961
+ const index = HEADER_OFFSET;
13962
+ ngDevMode && assertIndexInRange(lView, index);
13963
+ lView[index] = rNode;
13964
+ // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13965
+ // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13966
+ // representing a host element.
13967
+ return getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13968
+ }
13931
13969
  /**
13932
13970
  * Creates the root component view and the root component node.
13933
13971
  *
13934
13972
  * @param rNode Render host element.
13935
- * @param def ComponentDef
13973
+ * @param rootComponentDef ComponentDef
13936
13974
  * @param rootView The parent view where the host node is stored
13937
13975
  * @param rendererFactory Factory to be used for creating child renderers.
13938
13976
  * @param hostRenderer The current renderer
@@ -13940,72 +13978,96 @@ const NULL_INJECTOR = {
13940
13978
  *
13941
13979
  * @returns Component view created
13942
13980
  */
13943
- function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13981
+ function createRootComponentView(tNode, rNode, rootComponentDef, rootDirectives, rootView, rendererFactory, hostRenderer, sanitizer) {
13944
13982
  const tView = rootView[TVIEW];
13945
- const index = HEADER_OFFSET;
13946
- ngDevMode && assertIndexInRange(rootView, index);
13947
- rootView[index] = rNode;
13948
- // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13949
- // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13950
- // representing a host element.
13951
- const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13952
- const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13953
- if (mergedAttrs !== null) {
13954
- computeStaticStyling(tNode, mergedAttrs, true);
13955
- if (rNode !== null) {
13956
- setUpAttributes(hostRenderer, rNode, mergedAttrs);
13957
- if (tNode.classes !== null) {
13958
- writeDirectClass(hostRenderer, rNode, tNode.classes);
13959
- }
13960
- if (tNode.styles !== null) {
13961
- writeDirectStyle(hostRenderer, rNode, tNode.styles);
13962
- }
13963
- }
13964
- }
13965
- const viewRenderer = rendererFactory.createRenderer(rNode, def);
13966
- const componentView = createLView(rootView, getOrCreateComponentTView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13983
+ applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer);
13984
+ const viewRenderer = rendererFactory.createRenderer(rNode, rootComponentDef);
13985
+ 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);
13967
13986
  if (tView.firstCreatePass) {
13968
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13969
- markAsComponentHost(tView, tNode);
13970
- initTNodeFlags(tNode, rootView.length, 1);
13987
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, rootComponentDef.type);
13988
+ markAsComponentHost(tView, tNode, 0);
13971
13989
  }
13972
13990
  addToViewTree(rootView, componentView);
13973
13991
  // Store component view at node index, with node as the HOST
13974
- return rootView[index] = componentView;
13992
+ return rootView[tNode.index] = componentView;
13993
+ }
13994
+ /** Sets up the styling information on a root component. */
13995
+ function applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer) {
13996
+ for (const def of rootDirectives) {
13997
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
13998
+ }
13999
+ if (tNode.mergedAttrs !== null) {
14000
+ computeStaticStyling(tNode, tNode.mergedAttrs, true);
14001
+ if (rNode !== null) {
14002
+ setupStaticAttributes(hostRenderer, rNode, tNode);
14003
+ }
14004
+ }
13975
14005
  }
13976
14006
  /**
13977
14007
  * Creates a root component and sets it up with features and host bindings.Shared by
13978
14008
  * renderComponent() and ViewContainerRef.createComponent().
13979
14009
  */
13980
- function createRootComponent(componentView, componentDef, rootLView, hostFeatures) {
14010
+ function createRootComponent(componentView, rootComponentDef, rootDirectives, rootLView, hostFeatures) {
14011
+ const rootTNode = getCurrentTNode();
14012
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13981
14013
  const tView = rootLView[TVIEW];
13982
- // Create directive instance with factory() and store at next index in viewData
13983
- const component = instantiateRootComponent(tView, rootLView, componentDef);
13984
- // Root view only contains an instance of this component,
13985
- // so we use a reference to that component instance as a context.
14014
+ const native = getNativeByTNode(rootTNode, rootLView);
14015
+ initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null);
14016
+ for (let i = 0; i < rootDirectives.length; i++) {
14017
+ const directiveIndex = rootTNode.directiveStart + i;
14018
+ const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode);
14019
+ attachPatchData(directiveInstance, rootLView);
14020
+ }
14021
+ invokeDirectivesHostBindings(tView, rootLView, rootTNode);
14022
+ if (native) {
14023
+ attachPatchData(native, rootLView);
14024
+ }
14025
+ // We're guaranteed for the `componentOffset` to be positive here
14026
+ // since a root component always matches a component def.
14027
+ ngDevMode &&
14028
+ assertGreaterThan(rootTNode.componentOffset, -1, 'componentOffset must be great than -1');
14029
+ const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
13986
14030
  componentView[CONTEXT] = rootLView[CONTEXT] = component;
13987
14031
  if (hostFeatures !== null) {
13988
14032
  for (const feature of hostFeatures) {
13989
- feature(component, componentDef);
14033
+ feature(component, rootComponentDef);
13990
14034
  }
13991
14035
  }
13992
14036
  // We want to generate an empty QueryList for root content queries for backwards
13993
14037
  // compatibility with ViewEngine.
13994
- if (componentDef.contentQueries) {
13995
- const tNode = getCurrentTNode();
13996
- ngDevMode && assertDefined(tNode, 'TNode expected');
13997
- componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
14038
+ executeContentQueries(tView, rootTNode, componentView);
14039
+ return component;
14040
+ }
14041
+ /** Sets the static attributes on a root component. */
14042
+ function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
14043
+ if (rootSelectorOrNode) {
14044
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
13998
14045
  }
13999
- const rootTNode = getCurrentTNode();
14000
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
14001
- if (tView.firstCreatePass &&
14002
- (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
14003
- setSelectedIndex(rootTNode.index);
14004
- const rootTView = rootLView[TVIEW];
14005
- registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
14006
- invokeHostBindingsInCreationMode(componentDef, component);
14046
+ else {
14047
+ // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
14048
+ // is not defined), also apply attributes and classes extracted from component selector.
14049
+ // Extract attributes and classes from the first selector only to match VE behavior.
14050
+ const { attrs, classes } = extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
14051
+ if (attrs) {
14052
+ setUpAttributes(hostRenderer, hostRNode, attrs);
14053
+ }
14054
+ if (classes && classes.length > 0) {
14055
+ writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
14056
+ }
14057
+ }
14058
+ }
14059
+ /** Projects the `projectableNodes` that were specified when creating a root component. */
14060
+ function projectNodes(tNode, ngContentSelectors, projectableNodes) {
14061
+ const projection = tNode.projection = [];
14062
+ for (let i = 0; i < ngContentSelectors.length; i++) {
14063
+ const nodesforSlot = projectableNodes[i];
14064
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
14065
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
14066
+ // complex checks down the line.
14067
+ // We also normalize the length of the passed in projectable nodes (to match the number of
14068
+ // <ng-container> slots defined by a component).
14069
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
14007
14070
  }
14008
- return component;
14009
14071
  }
14010
14072
  /**
14011
14073
  * Used to enable lifecycle hooks on the root component.
@@ -14263,6 +14325,13 @@ function ɵɵCopyDefinitionFeature(definition) {
14263
14325
  }
14264
14326
  }
14265
14327
 
14328
+ /**
14329
+ * @license
14330
+ * Copyright Google LLC All Rights Reserved.
14331
+ *
14332
+ * Use of this source code is governed by an MIT-style license that can be
14333
+ * found in the LICENSE file at https://angular.io/license
14334
+ */
14266
14335
  /**
14267
14336
  * This feature add the host directives behavior to a directive definition by patching a
14268
14337
  * function onto it. The expectation is that the runtime will invoke the function during
@@ -14284,29 +14353,42 @@ function ɵɵCopyDefinitionFeature(definition) {
14284
14353
  * @codeGenApi
14285
14354
  */
14286
14355
  function ɵɵHostDirectivesFeature(rawHostDirectives) {
14287
- const unwrappedHostDirectives = Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives();
14288
- const hostDirectives = unwrappedHostDirectives.map(dir => typeof dir === 'function' ? { directive: dir, inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } : {
14289
- directive: dir.directive,
14290
- inputs: bindingArrayToMap(dir.inputs),
14291
- outputs: bindingArrayToMap(dir.outputs)
14292
- });
14293
14356
  return (definition) => {
14294
- // TODO(crisbeto): implement host directive matching logic.
14295
- definition.applyHostDirectives =
14296
- (tView, viewData, tNode, matches) => { };
14357
+ definition.findHostDirectiveDefs = findHostDirectiveDefs;
14358
+ definition.hostDirectives =
14359
+ (Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives()).map(dir => {
14360
+ return typeof dir === 'function' ?
14361
+ { directive: resolveForwardRef(dir), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } :
14362
+ {
14363
+ directive: resolveForwardRef(dir.directive),
14364
+ inputs: bindingArrayToMap(dir.inputs),
14365
+ outputs: bindingArrayToMap(dir.outputs)
14366
+ };
14367
+ });
14297
14368
  };
14298
14369
  }
14370
+ function findHostDirectiveDefs(matches, def, tView, lView, tNode) {
14371
+ if (def.hostDirectives !== null) {
14372
+ for (const hostDirectiveConfig of def.hostDirectives) {
14373
+ const hostDirectiveDef = getDirectiveDef(hostDirectiveConfig.directive);
14374
+ // TODO(crisbeto): assert that the def exists.
14375
+ // Host directives execute before the host so that its host bindings can be overwritten.
14376
+ findHostDirectiveDefs(matches, hostDirectiveDef, tView, lView, tNode);
14377
+ matches.push(hostDirectiveDef);
14378
+ }
14379
+ }
14380
+ }
14299
14381
  /**
14300
14382
  * Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
14301
14383
  * a map in the form of `{publicName: 'alias', otherPublicName: 'otherAlias'}`.
14302
14384
  */
14303
14385
  function bindingArrayToMap(bindings) {
14304
- if (!bindings || bindings.length === 0) {
14386
+ if (bindings === undefined || bindings.length === 0) {
14305
14387
  return EMPTY_OBJ;
14306
14388
  }
14307
14389
  const result = {};
14308
- for (let i = 1; i < bindings.length; i += 2) {
14309
- result[bindings[i - 1]] = bindings[i];
14390
+ for (let i = 0; i < bindings.length; i += 2) {
14391
+ result[bindings[i]] = bindings[i + 1];
14310
14392
  }
14311
14393
  return result;
14312
14394
  }
@@ -15253,19 +15335,8 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
15253
15335
  elementStartFirstCreatePass(adjustedIndex, tView, lView, native, name, attrsIndex, localRefsIndex) :
15254
15336
  tView.data[adjustedIndex];
15255
15337
  setCurrentTNode(tNode, true);
15256
- const mergedAttrs = tNode.mergedAttrs;
15257
- if (mergedAttrs !== null) {
15258
- setUpAttributes(renderer, native, mergedAttrs);
15259
- }
15260
- const classes = tNode.classes;
15261
- if (classes !== null) {
15262
- writeDirectClass(renderer, native, classes);
15263
- }
15264
- const styles = tNode.styles;
15265
- if (styles !== null) {
15266
- writeDirectStyle(renderer, native, styles);
15267
- }
15268
- if ((tNode.flags & 64 /* TNodeFlags.isDetached */) !== 64 /* TNodeFlags.isDetached */) {
15338
+ setupStaticAttributes(renderer, native, tNode);
15339
+ if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
15269
15340
  // In the i18n case, the translation may have removed this element, so only add it if it is not
15270
15341
  // detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
15271
15342
  appendChild(tView, lView, native, tNode);
@@ -15703,9 +15774,7 @@ function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault)
15703
15774
  }
15704
15775
  // In order to be backwards compatible with View Engine, events on component host nodes
15705
15776
  // must also mark the component view itself dirty (i.e. the view that it owns).
15706
- const startView = tNode.flags & 2 /* TNodeFlags.isComponentHost */ ?
15707
- getComponentLViewByIndex(tNode.index, lView) :
15708
- lView;
15777
+ const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
15709
15778
  markViewDirty(startView);
15710
15779
  let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
15711
15780
  // A just-invoked listener function might have coalesced listeners so we need to check for
@@ -15862,7 +15931,7 @@ function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
15862
15931
  tProjectionNode.projection = selectorIndex;
15863
15932
  // `<ng-content>` has no content
15864
15933
  setCurrentTNodeAsNotParent();
15865
- if ((tProjectionNode.flags & 64 /* TNodeFlags.isDetached */) !== 64 /* TNodeFlags.isDetached */) {
15934
+ if ((tProjectionNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
15866
15935
  // re-distribution of projectable nodes is stored on a component's view level
15867
15936
  applyProjection(tView, lView, tProjectionNode);
15868
15937
  }
@@ -17776,7 +17845,7 @@ function normalizeSuffix(value, suffix) {
17776
17845
  * @param isClassBased `true` if `class` (`false` if `style`)
17777
17846
  */
17778
17847
  function hasStylingInputShadow(tNode, isClassBased) {
17779
- return (tNode.flags & (isClassBased ? 16 /* TNodeFlags.hasClassInput */ : 32 /* TNodeFlags.hasStyleInput */)) !== 0;
17848
+ return (tNode.flags & (isClassBased ? 8 /* TNodeFlags.hasClassInput */ : 16 /* TNodeFlags.hasStyleInput */)) !== 0;
17780
17849
  }
17781
17850
 
17782
17851
  /**
@@ -19468,7 +19537,7 @@ function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parent
19468
19537
  anchorRNode = i18nParent;
19469
19538
  i18nParent = parentRElement;
19470
19539
  }
19471
- if (i18nParent !== null && (childTNode.flags & 2 /* TNodeFlags.isComponentHost */) === 0) {
19540
+ if (i18nParent !== null && childTNode.componentOffset === -1) {
19472
19541
  for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
19473
19542
  // No need to `unwrapRNode` because all of the indexes point to i18n text nodes.
19474
19543
  // see `assertDomNode` below.
@@ -21956,7 +22025,7 @@ function getDirectives(node) {
21956
22025
  return [];
21957
22026
  }
21958
22027
  if (context.directives === undefined) {
21959
- context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
22028
+ context.directives = getDirectivesAtNodeIndex(nodeIndex, lView);
21960
22029
  }
21961
22030
  // The `directives` in this case are a named array called `LComponentView`. Clone the
21962
22031
  // result so we don't expose an internal data structure in the user's console.
@@ -24939,6 +25008,7 @@ function extendsDirectlyFromObject(type) {
24939
25008
  * `Component`).
24940
25009
  */
24941
25010
  function directiveMetadata(type, metadata) {
25011
+ var _a;
24942
25012
  // Reflect inputs and outputs.
24943
25013
  const reflect = getReflect();
24944
25014
  const propMetadata = reflect.ownPropMetadata(type);
@@ -24958,7 +25028,12 @@ function directiveMetadata(type, metadata) {
24958
25028
  providers: metadata.providers || null,
24959
25029
  viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery),
24960
25030
  isStandalone: !!metadata.standalone,
24961
- hostDirectives: null,
25031
+ hostDirectives:
25032
+ // TODO(crisbeto): remove the `as any` usage here and down in the `map` call once
25033
+ // host directives are exposed in the public API.
25034
+ ((_a = metadata
25035
+ .hostDirectives) === null || _a === void 0 ? void 0 : _a.map((directive) => typeof directive === 'function' ? { directive } : directive)) ||
25036
+ null
24962
25037
  };
24963
25038
  }
24964
25039
  /**
@@ -25949,6 +26024,35 @@ function getNativeRequestAnimationFrame() {
25949
26024
  return { nativeRequestAnimationFrame, nativeCancelAnimationFrame };
25950
26025
  }
25951
26026
 
26027
+ /**
26028
+ * @license
26029
+ * Copyright Google LLC All Rights Reserved.
26030
+ *
26031
+ * Use of this source code is governed by an MIT-style license that can be
26032
+ * found in the LICENSE file at https://angular.io/license
26033
+ */
26034
+ class AsyncStackTaggingZoneSpec {
26035
+ constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
26036
+ var _a;
26037
+ this.name = 'asyncStackTagging for ' + namePrefix;
26038
+ this.createTask = (_a = consoleAsyncStackTaggingImpl === null || consoleAsyncStackTaggingImpl === void 0 ? void 0 : consoleAsyncStackTaggingImpl.createTask) !== null && _a !== void 0 ? _a : (() => null);
26039
+ }
26040
+ onScheduleTask(delegate, _current, target, task) {
26041
+ task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
26042
+ return delegate.scheduleTask(target, task);
26043
+ }
26044
+ onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
26045
+ let ret;
26046
+ if (task.consoleTask) {
26047
+ ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
26048
+ }
26049
+ else {
26050
+ ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
26051
+ }
26052
+ return ret;
26053
+ }
26054
+ }
26055
+
25952
26056
  /**
25953
26057
  * @license
25954
26058
  * Copyright Google LLC All Rights Reserved.
@@ -26065,8 +26169,12 @@ class NgZone {
26065
26169
  const self = this;
26066
26170
  self._nesting = 0;
26067
26171
  self._outer = self._inner = Zone.current;
26068
- if (Zone['AsyncStackTaggingZoneSpec']) {
26069
- const AsyncStackTaggingZoneSpec = Zone['AsyncStackTaggingZoneSpec'];
26172
+ // AsyncStackTaggingZoneSpec provides `linked stack traces` to show
26173
+ // where the async operation is scheduled. For more details, refer
26174
+ // to this article, https://developer.chrome.com/blog/devtools-better-angular-debugging/
26175
+ // And we only import this AsyncStackTaggingZoneSpec in development mode,
26176
+ // in the production mode, the AsyncStackTaggingZoneSpec will be tree shaken away.
26177
+ if (ngDevMode) {
26070
26178
  self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));
26071
26179
  }
26072
26180
  if (Zone['TaskTrackingZoneSpec']) {
@@ -27513,24 +27621,16 @@ function _mergeArrays(parts) {
27513
27621
  * found in the LICENSE file at https://angular.io/license
27514
27622
  */
27515
27623
  /**
27516
- * This file is used to control if the default rendering pipeline should be `ViewEngine` or `Ivy`.
27517
- *
27518
- * For more information on how to run and debug tests with either Ivy or View Engine (legacy),
27519
- * please see [BAZEL.md](./docs/BAZEL.md).
27520
- */
27521
- let _devMode = true;
27522
- let _runModeLocked = false;
27523
- /**
27524
- * Returns whether Angular is in development mode. After called once,
27525
- * the value is locked and won't change any more.
27624
+ * Returns whether Angular is in development mode.
27526
27625
  *
27527
- * By default, this is true, unless a user calls `enableProdMode` before calling this.
27626
+ * By default, this is true, unless `enableProdMode` is invoked prior to calling this method or the
27627
+ * application is built using the Angular CLI with the `optimization` option.
27628
+ * @see {@link cli/build ng build}
27528
27629
  *
27529
27630
  * @publicApi
27530
27631
  */
27531
27632
  function isDevMode() {
27532
- _runModeLocked = true;
27533
- return _devMode;
27633
+ return typeof ngDevMode === 'undefined' || !!ngDevMode;
27534
27634
  }
27535
27635
  /**
27536
27636
  * Disable Angular's development mode, which turns off assertions and other
@@ -27540,18 +27640,18 @@ function isDevMode() {
27540
27640
  * does not result in additional changes to any bindings (also known as
27541
27641
  * unidirectional data flow).
27542
27642
  *
27643
+ * Using this method is discouraged as the Angular CLI will set production mode when using the
27644
+ * `optimization` option.
27645
+ * @see {@link cli/build ng build}
27646
+ *
27543
27647
  * @publicApi
27544
27648
  */
27545
27649
  function enableProdMode() {
27546
- if (_runModeLocked) {
27547
- throw new Error('Cannot enable prod mode after platform setup.');
27548
- }
27549
27650
  // The below check is there so when ngDevMode is set via terser
27550
27651
  // `global['ngDevMode'] = false;` is also dropped.
27551
- if (typeof ngDevMode === undefined || !!ngDevMode) {
27652
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
27552
27653
  _global['ngDevMode'] = false;
27553
27654
  }
27554
- _devMode = false;
27555
27655
  }
27556
27656
 
27557
27657
  /**
@@ -28225,7 +28325,7 @@ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, root
28225
28325
  if (rootNativeNode !== nativeNode) {
28226
28326
  // To determine the next node to be processed, we need to use the next or the projectionNext
28227
28327
  // link, depending on whether the current node has been projected.
28228
- const nextTNode = (tNode.flags & 4 /* TNodeFlags.isProjected */) ? tNode.projectionNext : tNode.next;
28328
+ const nextTNode = (tNode.flags & 2 /* TNodeFlags.isProjected */) ? tNode.projectionNext : tNode.next;
28229
28329
  if (nextTNode) {
28230
28330
  _queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
28231
28331
  }
@@ -29793,5 +29893,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29793
29893
  * Generated bundle index. Do not edit.
29794
29894
  */
29795
29895
 
29796
- 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 };
29896
+ 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 };
29797
29897
  //# sourceMappingURL=core.mjs.map