@angular/core 14.0.0 → 14.0.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0
2
+ * @license Angular v14.0.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1843,9 +1843,12 @@ function formatRuntimeError(code, message) {
1843
1843
  // Error code might be a negative number, which is a special marker that instructs the logic to
1844
1844
  // generate a link to the error details page on angular.io.
1845
1845
  const fullCode = `NG0${Math.abs(code)}`;
1846
- let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
1846
+ let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
1847
1847
  if (ngDevMode && code < 0) {
1848
- errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
1848
+ const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
1849
+ const separator = addPeriodSeparator ? '.' : '';
1850
+ errorMessage =
1851
+ `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
1849
1852
  }
1850
1853
  return errorMessage;
1851
1854
  }
@@ -2471,7 +2474,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
2471
2474
  * Use of this source code is governed by an MIT-style license that can be
2472
2475
  * found in the LICENSE file at https://angular.io/license
2473
2476
  */
2474
- let _renderCompCount = 0;
2477
+ /** Counter used to generate unique IDs for component definitions. */
2478
+ let componentDefCount = 0;
2475
2479
  /**
2476
2480
  * Create a component definition object.
2477
2481
  *
@@ -2524,7 +2528,7 @@ function ɵɵdefineComponent(componentDefinition) {
2524
2528
  features: componentDefinition.features || null,
2525
2529
  data: componentDefinition.data || {},
2526
2530
  encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
2527
- id: 'c',
2531
+ id: `c${componentDefCount++}`,
2528
2532
  styles: componentDefinition.styles || EMPTY_ARRAY,
2529
2533
  _: null,
2530
2534
  setInput: null,
@@ -2533,7 +2537,6 @@ function ɵɵdefineComponent(componentDefinition) {
2533
2537
  };
2534
2538
  const dependencies = componentDefinition.dependencies;
2535
2539
  const feature = componentDefinition.features;
2536
- def.id += _renderCompCount++;
2537
2540
  def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
2538
2541
  def.outputs = invertObject(componentDefinition.outputs),
2539
2542
  feature && feature.forEach((fn) => fn(def));
@@ -3540,7 +3543,6 @@ function getLView() {
3540
3543
  function getTView() {
3541
3544
  return instructionState.lFrame.tView;
3542
3545
  }
3543
- // TODO(crisbeto): revert the @noinline once Closure issue is resolved.
3544
3546
  /**
3545
3547
  * Restores `contextViewData` to the given OpaqueViewState instance.
3546
3548
  *
@@ -3552,7 +3554,6 @@ function getTView() {
3552
3554
  * @returns Context of the restored OpaqueViewState instance.
3553
3555
  *
3554
3556
  * @codeGenApi
3555
- * @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
3556
3557
  */
3557
3558
  function ɵɵrestoreView(viewToRestore) {
3558
3559
  instructionState.lFrame.contextLView = viewToRestore;
@@ -6623,6 +6624,155 @@ function getSanitizer() {
6623
6624
  return lView && lView[SANITIZER];
6624
6625
  }
6625
6626
 
6627
+ /**
6628
+ * @license
6629
+ * Copyright Google LLC All Rights Reserved.
6630
+ *
6631
+ * Use of this source code is governed by an MIT-style license that can be
6632
+ * found in the LICENSE file at https://angular.io/license
6633
+ */
6634
+ const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6635
+ function wrappedError(message, originalError) {
6636
+ const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6637
+ const error = Error(msg);
6638
+ error[ERROR_ORIGINAL_ERROR] = originalError;
6639
+ return error;
6640
+ }
6641
+ function getOriginalError(error) {
6642
+ return error[ERROR_ORIGINAL_ERROR];
6643
+ }
6644
+
6645
+ /**
6646
+ * @license
6647
+ * Copyright Google LLC All Rights Reserved.
6648
+ *
6649
+ * Use of this source code is governed by an MIT-style license that can be
6650
+ * found in the LICENSE file at https://angular.io/license
6651
+ */
6652
+ /**
6653
+ * Provides a hook for centralized exception handling.
6654
+ *
6655
+ * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6656
+ * intercept error handling, write a custom exception handler that replaces this default as
6657
+ * appropriate for your app.
6658
+ *
6659
+ * @usageNotes
6660
+ * ### Example
6661
+ *
6662
+ * ```
6663
+ * class MyErrorHandler implements ErrorHandler {
6664
+ * handleError(error) {
6665
+ * // do something with the exception
6666
+ * }
6667
+ * }
6668
+ *
6669
+ * @NgModule({
6670
+ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6671
+ * })
6672
+ * class MyModule {}
6673
+ * ```
6674
+ *
6675
+ * @publicApi
6676
+ */
6677
+ class ErrorHandler {
6678
+ constructor() {
6679
+ /**
6680
+ * @internal
6681
+ */
6682
+ this._console = console;
6683
+ }
6684
+ handleError(error) {
6685
+ const originalError = this._findOriginalError(error);
6686
+ this._console.error('ERROR', error);
6687
+ if (originalError) {
6688
+ this._console.error('ORIGINAL ERROR', originalError);
6689
+ }
6690
+ }
6691
+ /** @internal */
6692
+ _findOriginalError(error) {
6693
+ let e = error && getOriginalError(error);
6694
+ while (e && getOriginalError(e)) {
6695
+ e = getOriginalError(e);
6696
+ }
6697
+ return e || null;
6698
+ }
6699
+ }
6700
+
6701
+ /**
6702
+ * @license
6703
+ * Copyright Google LLC All Rights Reserved.
6704
+ *
6705
+ * Use of this source code is governed by an MIT-style license that can be
6706
+ * found in the LICENSE file at https://angular.io/license
6707
+ */
6708
+ /**
6709
+ * Disallowed strings in the comment.
6710
+ *
6711
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6712
+ */
6713
+ const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6714
+ /**
6715
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6716
+ */
6717
+ const COMMENT_DELIMITER = /(<|>)/;
6718
+ const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6719
+ /**
6720
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
6721
+ *
6722
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6723
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6724
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6725
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6726
+ *
6727
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6728
+ *
6729
+ * ```
6730
+ * div.innerHTML = div.innerHTML
6731
+ * ```
6732
+ *
6733
+ * One would expect that the above code would be safe to do, but it turns out that because comment
6734
+ * text is not escaped, the comment may contain text which will prematurely close the comment
6735
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6736
+ * may contain such text and expect them to be safe.)
6737
+ *
6738
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6739
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6740
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6741
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
6742
+ *
6743
+ * @param value text to make safe for comment node by escaping the comment open/close character
6744
+ * sequence.
6745
+ */
6746
+ function escapeCommentText(value) {
6747
+ return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6748
+ }
6749
+
6750
+ /**
6751
+ * @license
6752
+ * Copyright Google LLC All Rights Reserved.
6753
+ *
6754
+ * Use of this source code is governed by an MIT-style license that can be
6755
+ * found in the LICENSE file at https://angular.io/license
6756
+ */
6757
+ function normalizeDebugBindingName(name) {
6758
+ // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6759
+ name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6760
+ return `ng-reflect-${name}`;
6761
+ }
6762
+ const CAMEL_CASE_REGEXP = /([A-Z])/g;
6763
+ function camelCaseToDashCase(input) {
6764
+ return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6765
+ }
6766
+ function normalizeDebugBindingValue(value) {
6767
+ try {
6768
+ // Limit the size of the value as otherwise the DOM just gets polluted.
6769
+ return value != null ? value.toString().slice(0, 30) : value;
6770
+ }
6771
+ catch (e) {
6772
+ return '[ERROR] Exception while trying to serialize the value';
6773
+ }
6774
+ }
6775
+
6626
6776
  /**
6627
6777
  * @license
6628
6778
  * Copyright Google LLC All Rights Reserved.
@@ -6971,223 +7121,33 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
6971
7121
  const tNode = lView[TVIEW].data[nodeIndex];
6972
7122
  let directiveStartIndex = tNode.directiveStart;
6973
7123
  if (directiveStartIndex == 0)
6974
- return EMPTY_ARRAY;
6975
- const directiveEndIndex = tNode.directiveEnd;
6976
- if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
6977
- directiveStartIndex++;
6978
- return lView.slice(directiveStartIndex, directiveEndIndex);
6979
- }
6980
- function getComponentAtNodeIndex(nodeIndex, lView) {
6981
- const tNode = lView[TVIEW].data[nodeIndex];
6982
- let directiveStartIndex = tNode.directiveStart;
6983
- return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6984
- }
6985
- /**
6986
- * Returns a map of local references (local reference name => element or directive instance) that
6987
- * exist on a given element.
6988
- */
6989
- function discoverLocalRefs(lView, nodeIndex) {
6990
- const tNode = lView[TVIEW].data[nodeIndex];
6991
- if (tNode && tNode.localNames) {
6992
- const result = {};
6993
- let localIndex = tNode.index + 1;
6994
- for (let i = 0; i < tNode.localNames.length; i += 2) {
6995
- result[tNode.localNames[i]] = lView[localIndex];
6996
- localIndex++;
6997
- }
6998
- return result;
6999
- }
7000
- return null;
7001
- }
7002
-
7003
- /**
7004
- * @license
7005
- * Copyright Google LLC All Rights Reserved.
7006
- *
7007
- * Use of this source code is governed by an MIT-style license that can be
7008
- * found in the LICENSE file at https://angular.io/license
7009
- */
7010
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
7011
- const ERROR_LOGGER = 'ngErrorLogger';
7012
- function wrappedError(message, originalError) {
7013
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
7014
- const error = Error(msg);
7015
- error[ERROR_ORIGINAL_ERROR] = originalError;
7016
- return error;
7017
- }
7018
- function getOriginalError(error) {
7019
- return error[ERROR_ORIGINAL_ERROR];
7020
- }
7021
- function getErrorLogger(error) {
7022
- return error && error[ERROR_LOGGER] || defaultErrorLogger;
7023
- }
7024
- function defaultErrorLogger(console, ...values) {
7025
- console.error(...values);
7026
- }
7027
-
7028
- /**
7029
- * @license
7030
- * Copyright Google LLC All Rights Reserved.
7031
- *
7032
- * Use of this source code is governed by an MIT-style license that can be
7033
- * found in the LICENSE file at https://angular.io/license
7034
- */
7035
- /**
7036
- * Provides a hook for centralized exception handling.
7037
- *
7038
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
7039
- * intercept error handling, write a custom exception handler that replaces this default as
7040
- * appropriate for your app.
7041
- *
7042
- * @usageNotes
7043
- * ### Example
7044
- *
7045
- * ```
7046
- * class MyErrorHandler implements ErrorHandler {
7047
- * handleError(error) {
7048
- * // do something with the exception
7049
- * }
7050
- * }
7051
- *
7052
- * @NgModule({
7053
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
7054
- * })
7055
- * class MyModule {}
7056
- * ```
7057
- *
7058
- * @publicApi
7059
- */
7060
- class ErrorHandler {
7061
- constructor() {
7062
- /**
7063
- * @internal
7064
- */
7065
- this._console = console;
7066
- }
7067
- handleError(error) {
7068
- const originalError = this._findOriginalError(error);
7069
- // Note: Browser consoles show the place from where console.error was called.
7070
- // We can use this to give users additional information about the error.
7071
- const errorLogger = getErrorLogger(error);
7072
- errorLogger(this._console, `ERROR`, error);
7073
- if (originalError) {
7074
- errorLogger(this._console, `ORIGINAL ERROR`, originalError);
7075
- }
7076
- }
7077
- /** @internal */
7078
- _findOriginalError(error) {
7079
- let e = error && getOriginalError(error);
7080
- while (e && getOriginalError(e)) {
7081
- e = getOriginalError(e);
7082
- }
7083
- return e || null;
7084
- }
7085
- }
7086
-
7087
- /**
7088
- * @license
7089
- * Copyright Google LLC All Rights Reserved.
7090
- *
7091
- * Use of this source code is governed by an MIT-style license that can be
7092
- * found in the LICENSE file at https://angular.io/license
7093
- */
7094
- /**
7095
- * Defines a schema that allows an NgModule to contain the following:
7096
- * - Non-Angular elements named with dash case (`-`).
7097
- * - Element properties named with dash case (`-`).
7098
- * Dash case is the naming convention for custom elements.
7099
- *
7100
- * @publicApi
7101
- */
7102
- const CUSTOM_ELEMENTS_SCHEMA = {
7103
- name: 'custom-elements'
7104
- };
7105
- /**
7106
- * Defines a schema that allows any property on any element.
7107
- *
7108
- * This schema allows you to ignore the errors related to any unknown elements or properties in a
7109
- * template. The usage of this schema is generally discouraged because it prevents useful validation
7110
- * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
7111
- *
7112
- * @publicApi
7113
- */
7114
- const NO_ERRORS_SCHEMA = {
7115
- name: 'no-errors-schema'
7116
- };
7117
-
7118
- /**
7119
- * @license
7120
- * Copyright Google LLC All Rights Reserved.
7121
- *
7122
- * Use of this source code is governed by an MIT-style license that can be
7123
- * found in the LICENSE file at https://angular.io/license
7124
- */
7125
- /**
7126
- * Disallowed strings in the comment.
7127
- *
7128
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
7129
- */
7130
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
7131
- /**
7132
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
7133
- */
7134
- const COMMENT_DELIMITER = /(<|>)/;
7135
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
7136
- /**
7137
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
7138
- *
7139
- * The issue is that HTML does not specify any way to escape comment end text inside the comment.
7140
- * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
7141
- * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
7142
- * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
7143
- *
7144
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
7145
- *
7146
- * ```
7147
- * div.innerHTML = div.innerHTML
7148
- * ```
7149
- *
7150
- * One would expect that the above code would be safe to do, but it turns out that because comment
7151
- * text is not escaped, the comment may contain text which will prematurely close the comment
7152
- * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
7153
- * may contain such text and expect them to be safe.)
7154
- *
7155
- * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
7156
- * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
7157
- * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
7158
- * text it will render normally but it will not cause the HTML parser to close/open the comment.
7159
- *
7160
- * @param value text to make safe for comment node by escaping the comment open/close character
7161
- * sequence.
7162
- */
7163
- function escapeCommentText(value) {
7164
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
7165
- }
7166
-
7167
- /**
7168
- * @license
7169
- * Copyright Google LLC All Rights Reserved.
7170
- *
7171
- * Use of this source code is governed by an MIT-style license that can be
7172
- * found in the LICENSE file at https://angular.io/license
7173
- */
7174
- function normalizeDebugBindingName(name) {
7175
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
7176
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
7177
- return `ng-reflect-${name}`;
7124
+ return EMPTY_ARRAY;
7125
+ const directiveEndIndex = tNode.directiveEnd;
7126
+ if (!includeComponents && tNode.flags & 2 /* TNodeFlags.isComponentHost */)
7127
+ directiveStartIndex++;
7128
+ return lView.slice(directiveStartIndex, directiveEndIndex);
7178
7129
  }
7179
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
7180
- function camelCaseToDashCase(input) {
7181
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
7130
+ function getComponentAtNodeIndex(nodeIndex, lView) {
7131
+ const tNode = lView[TVIEW].data[nodeIndex];
7132
+ let directiveStartIndex = tNode.directiveStart;
7133
+ return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
7182
7134
  }
7183
- function normalizeDebugBindingValue(value) {
7184
- try {
7185
- // Limit the size of the value as otherwise the DOM just gets polluted.
7186
- return value != null ? value.toString().slice(0, 30) : value;
7187
- }
7188
- catch (e) {
7189
- return '[ERROR] Exception while trying to serialize the value';
7135
+ /**
7136
+ * Returns a map of local references (local reference name => element or directive instance) that
7137
+ * exist on a given element.
7138
+ */
7139
+ function discoverLocalRefs(lView, nodeIndex) {
7140
+ const tNode = lView[TVIEW].data[nodeIndex];
7141
+ if (tNode && tNode.localNames) {
7142
+ const result = {};
7143
+ let localIndex = tNode.index + 1;
7144
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
7145
+ result[tNode.localNames[i]] = lView[localIndex];
7146
+ localIndex++;
7147
+ }
7148
+ return result;
7190
7149
  }
7150
+ return null;
7191
7151
  }
7192
7152
 
7193
7153
  /**
@@ -10655,113 +10615,403 @@ class ReflectiveInjector_ {
10655
10615
  return this.objs[i];
10656
10616
  }
10657
10617
  }
10658
- return UNDEFINED;
10618
+ return UNDEFINED;
10619
+ }
10620
+ /** @internal */
10621
+ _throwOrNull(key, notFoundValue) {
10622
+ if (notFoundValue !== THROW_IF_NOT_FOUND) {
10623
+ return notFoundValue;
10624
+ }
10625
+ else {
10626
+ throw noProviderError(this, key);
10627
+ }
10628
+ }
10629
+ /** @internal */
10630
+ _getByKeySelf(key, notFoundValue) {
10631
+ const obj = this._getObjByKeyId(key.id);
10632
+ return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10633
+ }
10634
+ /** @internal */
10635
+ _getByKeyDefault(key, notFoundValue, visibility) {
10636
+ let inj;
10637
+ if (visibility instanceof SkipSelf) {
10638
+ inj = this.parent;
10639
+ }
10640
+ else {
10641
+ inj = this;
10642
+ }
10643
+ while (inj instanceof ReflectiveInjector_) {
10644
+ const inj_ = inj;
10645
+ const obj = inj_._getObjByKeyId(key.id);
10646
+ if (obj !== UNDEFINED)
10647
+ return obj;
10648
+ inj = inj_.parent;
10649
+ }
10650
+ if (inj !== null) {
10651
+ return inj.get(key.token, notFoundValue);
10652
+ }
10653
+ else {
10654
+ return this._throwOrNull(key, notFoundValue);
10655
+ }
10656
+ }
10657
+ get displayName() {
10658
+ const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10659
+ .join(', ');
10660
+ return `ReflectiveInjector(providers: [${providers}])`;
10661
+ }
10662
+ toString() {
10663
+ return this.displayName;
10664
+ }
10665
+ }
10666
+ ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10667
+ function _mapProviders(injector, fn) {
10668
+ const res = [];
10669
+ for (let i = 0; i < injector._providers.length; ++i) {
10670
+ res[i] = fn(injector.getProviderAtIndex(i));
10671
+ }
10672
+ return res;
10673
+ }
10674
+
10675
+ /**
10676
+ * @license
10677
+ * Copyright Google LLC All Rights Reserved.
10678
+ *
10679
+ * Use of this source code is governed by an MIT-style license that can be
10680
+ * found in the LICENSE file at https://angular.io/license
10681
+ */
10682
+
10683
+ /**
10684
+ * @license
10685
+ * Copyright Google LLC All Rights Reserved.
10686
+ *
10687
+ * Use of this source code is governed by an MIT-style license that can be
10688
+ * found in the LICENSE file at https://angular.io/license
10689
+ */
10690
+
10691
+ /**
10692
+ * @license
10693
+ * Copyright Google LLC All Rights Reserved.
10694
+ *
10695
+ * Use of this source code is governed by an MIT-style license that can be
10696
+ * found in the LICENSE file at https://angular.io/license
10697
+ */
10698
+ function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10699
+ const lView = getLView();
10700
+ // Fall back to inject() if view hasn't been created. This situation can happen in tests
10701
+ // if inject utilities are used before bootstrapping.
10702
+ if (lView === null) {
10703
+ // Verify that we will not get into infinite loop.
10704
+ ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10705
+ return ɵɵinject(token, flags);
10706
+ }
10707
+ const tNode = getCurrentTNode();
10708
+ return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10709
+ }
10710
+ /**
10711
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
10712
+ * particular class.
10713
+ *
10714
+ * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10715
+ * off, saving bytes of generated code while still providing a good experience in dev mode.
10716
+ *
10717
+ * The name of the class is not mentioned here, but will be in the generated factory function name
10718
+ * and thus in the stack trace.
10719
+ *
10720
+ * @codeGenApi
10721
+ */
10722
+ function ɵɵinvalidFactory() {
10723
+ const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10724
+ throw new Error(msg);
10725
+ }
10726
+
10727
+ /**
10728
+ * @license
10729
+ * Copyright Google LLC All Rights Reserved.
10730
+ *
10731
+ * Use of this source code is governed by an MIT-style license that can be
10732
+ * found in the LICENSE file at https://angular.io/license
10733
+ */
10734
+ /**
10735
+ * Defines a schema that allows an NgModule to contain the following:
10736
+ * - Non-Angular elements named with dash case (`-`).
10737
+ * - Element properties named with dash case (`-`).
10738
+ * Dash case is the naming convention for custom elements.
10739
+ *
10740
+ * @publicApi
10741
+ */
10742
+ const CUSTOM_ELEMENTS_SCHEMA = {
10743
+ name: 'custom-elements'
10744
+ };
10745
+ /**
10746
+ * Defines a schema that allows any property on any element.
10747
+ *
10748
+ * This schema allows you to ignore the errors related to any unknown elements or properties in a
10749
+ * template. The usage of this schema is generally discouraged because it prevents useful validation
10750
+ * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
10751
+ *
10752
+ * @publicApi
10753
+ */
10754
+ const NO_ERRORS_SCHEMA = {
10755
+ name: 'no-errors-schema'
10756
+ };
10757
+
10758
+ /**
10759
+ * @license
10760
+ * Copyright Google LLC All Rights Reserved.
10761
+ *
10762
+ * Use of this source code is governed by an MIT-style license that can be
10763
+ * found in the LICENSE file at https://angular.io/license
10764
+ */
10765
+ let shouldThrowErrorOnUnknownElement = false;
10766
+ /**
10767
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
10768
+ * instead of just logging the error.
10769
+ * (for AOT-compiled ones this check happens at build time).
10770
+ */
10771
+ function ɵsetUnknownElementStrictMode(shouldThrow) {
10772
+ shouldThrowErrorOnUnknownElement = shouldThrow;
10773
+ }
10774
+ /**
10775
+ * Gets the current value of the strict mode.
10776
+ */
10777
+ function ɵgetUnknownElementStrictMode() {
10778
+ return shouldThrowErrorOnUnknownElement;
10779
+ }
10780
+ let shouldThrowErrorOnUnknownProperty = false;
10781
+ /**
10782
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
10783
+ * instead of just logging the error.
10784
+ * (for AOT-compiled ones this check happens at build time).
10785
+ */
10786
+ function ɵsetUnknownPropertyStrictMode(shouldThrow) {
10787
+ shouldThrowErrorOnUnknownProperty = shouldThrow;
10788
+ }
10789
+ /**
10790
+ * Gets the current value of the strict mode.
10791
+ */
10792
+ function ɵgetUnknownPropertyStrictMode() {
10793
+ return shouldThrowErrorOnUnknownProperty;
10794
+ }
10795
+ /**
10796
+ * Validates that the element is known at runtime and produces
10797
+ * an error if it's not the case.
10798
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10799
+ * ones this check happens at build time).
10800
+ *
10801
+ * The element is considered known if either:
10802
+ * - it's a known HTML element
10803
+ * - it's a known custom element
10804
+ * - the element matches any directive
10805
+ * - the element is allowed by one of the schemas
10806
+ *
10807
+ * @param element Element to validate
10808
+ * @param lView An `LView` that represents a current component that is being rendered
10809
+ * @param tagName Name of the tag to check
10810
+ * @param schemas Array of schemas
10811
+ * @param hasDirectives Boolean indicating that the element matches any directive
10812
+ */
10813
+ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
10814
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10815
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10816
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10817
+ // execute the check below.
10818
+ if (schemas === null)
10819
+ return;
10820
+ // If the element matches any directive, it's considered as valid.
10821
+ if (!hasDirectives && tagName !== null) {
10822
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
10823
+ // as a custom element. Note that unknown elements with a dash in their name won't be instances
10824
+ // of HTMLUnknownElement in browsers that support web components.
10825
+ const isUnknown =
10826
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
10827
+ // because while most browsers return 'function', IE returns 'object'.
10828
+ (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
10829
+ element instanceof HTMLUnknownElement) ||
10830
+ (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
10831
+ !customElements.get(tagName));
10832
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
10833
+ const isHostStandalone = isHostComponentStandalone(lView);
10834
+ const templateLocation = getTemplateLocationDetails(lView);
10835
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10836
+ let message = `'${tagName}' is not a known element${templateLocation}:\n`;
10837
+ message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
10838
+ 'a part of an @NgModule where this component is declared'}.\n`;
10839
+ if (tagName && tagName.indexOf('-') > -1) {
10840
+ message +=
10841
+ `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
10842
+ }
10843
+ else {
10844
+ message +=
10845
+ `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
10846
+ }
10847
+ if (shouldThrowErrorOnUnknownElement) {
10848
+ throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
10849
+ }
10850
+ else {
10851
+ console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
10852
+ }
10853
+ }
10659
10854
  }
10660
- /** @internal */
10661
- _throwOrNull(key, notFoundValue) {
10662
- if (notFoundValue !== THROW_IF_NOT_FOUND) {
10663
- return notFoundValue;
10664
- }
10665
- else {
10666
- throw noProviderError(this, key);
10667
- }
10855
+ }
10856
+ /**
10857
+ * Validates that the property of the element is known at runtime and returns
10858
+ * false if it's not the case.
10859
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10860
+ * ones this check happens at build time).
10861
+ *
10862
+ * The property is considered known if either:
10863
+ * - it's a known property of the element
10864
+ * - the element is allowed by one of the schemas
10865
+ * - the property is used for animations
10866
+ *
10867
+ * @param element Element to validate
10868
+ * @param propName Name of the property to check
10869
+ * @param tagName Name of the tag hosting the property
10870
+ * @param schemas Array of schemas
10871
+ */
10872
+ function isPropertyValid(element, propName, tagName, schemas) {
10873
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10874
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10875
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10876
+ // execute the check below.
10877
+ if (schemas === null)
10878
+ return true;
10879
+ // The property is considered valid if the element matches the schema, it exists on the element,
10880
+ // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
10881
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
10882
+ return true;
10668
10883
  }
10669
- /** @internal */
10670
- _getByKeySelf(key, notFoundValue) {
10671
- const obj = this._getObjByKeyId(key.id);
10672
- return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10884
+ // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
10885
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
10886
+ return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
10887
+ }
10888
+ /**
10889
+ * Logs or throws an error that a property is not supported on an element.
10890
+ *
10891
+ * @param propName Name of the invalid property
10892
+ * @param tagName Name of the tag hosting the property
10893
+ * @param nodeType Type of the node hosting the property
10894
+ * @param lView An `LView` that represents a current component
10895
+ */
10896
+ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
10897
+ // Special-case a situation when a structural directive is applied to
10898
+ // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
10899
+ // In this case the compiler generates the `ɵɵtemplate` instruction with
10900
+ // the `null` as the tagName. The directive matching logic at runtime relies
10901
+ // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
10902
+ // a default value of the `tNode.value` is not feasible at this moment.
10903
+ if (!tagName && nodeType === 4 /* TNodeType.Container */) {
10904
+ tagName = 'ng-template';
10673
10905
  }
10674
- /** @internal */
10675
- _getByKeyDefault(key, notFoundValue, visibility) {
10676
- let inj;
10677
- if (visibility instanceof SkipSelf) {
10678
- inj = this.parent;
10679
- }
10680
- else {
10681
- inj = this;
10682
- }
10683
- while (inj instanceof ReflectiveInjector_) {
10684
- const inj_ = inj;
10685
- const obj = inj_._getObjByKeyId(key.id);
10686
- if (obj !== UNDEFINED)
10687
- return obj;
10688
- inj = inj_.parent;
10689
- }
10690
- if (inj !== null) {
10691
- return inj.get(key.token, notFoundValue);
10906
+ const isHostStandalone = isHostComponentStandalone(lView);
10907
+ const templateLocation = getTemplateLocationDetails(lView);
10908
+ let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
10909
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10910
+ const importLocation = isHostStandalone ?
10911
+ 'included in the \'@Component.imports\' of this component' :
10912
+ 'a part of an @NgModule where this component is declared';
10913
+ if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
10914
+ // Most likely this is a control flow directive (such as `*ngIf`) used in
10915
+ // a template, but the `CommonModule` is not imported.
10916
+ message += `\nIf the '${propName}' is an Angular control flow directive, ` +
10917
+ `please make sure that the 'CommonModule' is ${importLocation}.`;
10918
+ }
10919
+ else {
10920
+ // May be an Angular component, which is not imported/declared?
10921
+ message += `\n1. If '${tagName}' is an Angular component and it has the ` +
10922
+ `'${propName}' input, then verify that it is ${importLocation}.`;
10923
+ // May be a Web Component?
10924
+ if (tagName && tagName.indexOf('-') > -1) {
10925
+ message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
10926
+ `to the ${schemas} of this component to suppress this message.`;
10927
+ message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10928
+ `the ${schemas} of this component.`;
10692
10929
  }
10693
10930
  else {
10694
- return this._throwOrNull(key, notFoundValue);
10931
+ // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
10932
+ message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10933
+ `the ${schemas} of this component.`;
10695
10934
  }
10696
10935
  }
10697
- get displayName() {
10698
- const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10699
- .join(', ');
10700
- return `ReflectiveInjector(providers: [${providers}])`;
10701
- }
10702
- toString() {
10703
- return this.displayName;
10936
+ if (shouldThrowErrorOnUnknownProperty) {
10937
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
10704
10938
  }
10705
- }
10706
- ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10707
- function _mapProviders(injector, fn) {
10708
- const res = [];
10709
- for (let i = 0; i < injector._providers.length; ++i) {
10710
- res[i] = fn(injector.getProviderAtIndex(i));
10939
+ else {
10940
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
10711
10941
  }
10712
- return res;
10713
10942
  }
10714
-
10715
10943
  /**
10716
- * @license
10717
- * Copyright Google LLC All Rights Reserved.
10944
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10945
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10946
+ * be too slow for production mode and also it relies on the constructor function being available.
10718
10947
  *
10719
- * Use of this source code is governed by an MIT-style license that can be
10720
- * found in the LICENSE file at https://angular.io/license
10721
- */
10722
-
10723
- /**
10724
- * @license
10725
- * Copyright Google LLC All Rights Reserved.
10948
+ * Gets a reference to the host component def (where a current component is declared).
10726
10949
  *
10727
- * Use of this source code is governed by an MIT-style license that can be
10728
- * found in the LICENSE file at https://angular.io/license
10950
+ * @param lView An `LView` that represents a current component that is being rendered.
10729
10951
  */
10730
-
10952
+ function getDeclarationComponentDef(lView) {
10953
+ !ngDevMode && throwError('Must never be called in production mode');
10954
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
10955
+ const context = declarationLView[CONTEXT];
10956
+ // Unable to obtain a context.
10957
+ if (!context)
10958
+ return null;
10959
+ return context.constructor ? getComponentDef$1(context.constructor) : null;
10960
+ }
10731
10961
  /**
10732
- * @license
10733
- * Copyright Google LLC All Rights Reserved.
10962
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10963
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10964
+ * be too slow for production mode.
10734
10965
  *
10735
- * Use of this source code is governed by an MIT-style license that can be
10736
- * found in the LICENSE file at https://angular.io/license
10966
+ * Checks if the current component is declared inside of a standalone component template.
10967
+ *
10968
+ * @param lView An `LView` that represents a current component that is being rendered.
10737
10969
  */
10738
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10739
- const lView = getLView();
10740
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
10741
- // if inject utilities are used before bootstrapping.
10742
- if (lView === null) {
10743
- // Verify that we will not get into infinite loop.
10744
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10745
- return ɵɵinject(token, flags);
10746
- }
10747
- const tNode = getCurrentTNode();
10748
- return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10970
+ function isHostComponentStandalone(lView) {
10971
+ !ngDevMode && throwError('Must never be called in production mode');
10972
+ const componentDef = getDeclarationComponentDef(lView);
10973
+ // Treat host component as non-standalone if we can't obtain the def.
10974
+ return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
10749
10975
  }
10750
10976
  /**
10751
- * Throws an error indicating that a factory function could not be generated by the compiler for a
10752
- * particular class.
10753
- *
10754
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10755
- * off, saving bytes of generated code while still providing a good experience in dev mode.
10977
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10978
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10979
+ * be too slow for production mode.
10756
10980
  *
10757
- * The name of the class is not mentioned here, but will be in the generated factory function name
10758
- * and thus in the stack trace.
10981
+ * Constructs a string describing the location of the host component template. The function is used
10982
+ * in dev mode to produce error messages.
10759
10983
  *
10760
- * @codeGenApi
10984
+ * @param lView An `LView` that represents a current component that is being rendered.
10761
10985
  */
10762
- function ɵɵinvalidFactory() {
10763
- const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10764
- throw new Error(msg);
10986
+ function getTemplateLocationDetails(lView) {
10987
+ var _a;
10988
+ !ngDevMode && throwError('Must never be called in production mode');
10989
+ const hostComponentDef = getDeclarationComponentDef(lView);
10990
+ const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
10991
+ return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
10992
+ }
10993
+ /**
10994
+ * The set of known control flow directives.
10995
+ * We use this set to produce a more precises error message with a note
10996
+ * that the `CommonModule` should also be included.
10997
+ */
10998
+ const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
10999
+ /**
11000
+ * Returns true if the tag name is allowed by specified schemas.
11001
+ * @param schemas Array of schemas
11002
+ * @param tagName Name of the tag
11003
+ */
11004
+ function matchingSchemas(schemas, tagName) {
11005
+ if (schemas !== null) {
11006
+ for (let i = 0; i < schemas.length; i++) {
11007
+ const schema = schemas[i];
11008
+ if (schema === NO_ERRORS_SCHEMA ||
11009
+ schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
11010
+ return true;
11011
+ }
11012
+ }
11013
+ }
11014
+ return false;
10765
11015
  }
10766
11016
 
10767
11017
  /**
@@ -11557,34 +11807,19 @@ class LContainerDebug {
11557
11807
  return toDebug(this._raw_lContainer[PARENT]);
11558
11808
  }
11559
11809
  get movedViews() {
11560
- return this._raw_lContainer[MOVED_VIEWS];
11561
- }
11562
- get host() {
11563
- return this._raw_lContainer[HOST];
11564
- }
11565
- get native() {
11566
- return this._raw_lContainer[NATIVE];
11567
- }
11568
- get next() {
11569
- return toDebug(this._raw_lContainer[NEXT]);
11570
- }
11571
- }
11572
-
11573
- let shouldThrowErrorOnUnknownProperty = false;
11574
- /**
11575
- * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
11576
- * instead of just logging the error.
11577
- * (for AOT-compiled ones this check happens at build time).
11578
- */
11579
- function ɵsetUnknownPropertyStrictMode(shouldThrow) {
11580
- shouldThrowErrorOnUnknownProperty = shouldThrow;
11581
- }
11582
- /**
11583
- * Gets the current value of the strict mode.
11584
- */
11585
- function ɵgetUnknownPropertyStrictMode() {
11586
- return shouldThrowErrorOnUnknownProperty;
11810
+ return this._raw_lContainer[MOVED_VIEWS];
11811
+ }
11812
+ get host() {
11813
+ return this._raw_lContainer[HOST];
11814
+ }
11815
+ get native() {
11816
+ return this._raw_lContainer[NATIVE];
11817
+ }
11818
+ get next() {
11819
+ return toDebug(this._raw_lContainer[NEXT]);
11820
+ }
11587
11821
  }
11822
+
11588
11823
  /**
11589
11824
  * A permanent marker promise which signifies that the current CD tree is
11590
11825
  * clean.
@@ -11743,56 +11978,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
11743
11978
  }
11744
11979
  return tNode;
11745
11980
  }
11746
- /**
11747
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11748
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11749
- * be too slow for production mode and also it relies on the constructor function being available.
11750
- *
11751
- * Gets a reference to the host component def (where a current component is declared).
11752
- *
11753
- * @param lView An `LView` that represents a current component that is being rendered.
11754
- */
11755
- function getDeclarationComponentDef(lView) {
11756
- !ngDevMode && throwError('Must never be called in production mode');
11757
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
11758
- const context = declarationLView[CONTEXT];
11759
- // Unable to obtain a context.
11760
- if (!context)
11761
- return null;
11762
- return context.constructor ? getComponentDef$1(context.constructor) : null;
11763
- }
11764
- /**
11765
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11766
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11767
- * be too slow for production mode.
11768
- *
11769
- * Checks if the current component is declared inside of a standalone component template.
11770
- *
11771
- * @param lView An `LView` that represents a current component that is being rendered.
11772
- */
11773
- function isHostComponentStandalone(lView) {
11774
- !ngDevMode && throwError('Must never be called in production mode');
11775
- const componentDef = getDeclarationComponentDef(lView);
11776
- // Treat host component as non-standalone if we can't obtain the def.
11777
- return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
11778
- }
11779
- /**
11780
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11781
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11782
- * be too slow for production mode.
11783
- *
11784
- * Constructs a string describing the location of the host component template. The function is used
11785
- * in dev mode to produce error messages.
11786
- *
11787
- * @param lView An `LView` that represents a current component that is being rendered.
11788
- */
11789
- function getTemplateLocationDetails(lView) {
11790
- var _a;
11791
- !ngDevMode && throwError('Must never be called in production mode');
11792
- const hostComponentDef = getDeclarationComponentDef(lView);
11793
- const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
11794
- return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
11795
- }
11796
11981
  /**
11797
11982
  * When elements are created dynamically after a view blueprint is created (e.g. through
11798
11983
  * i18nApply()), we need to adjust the blueprint for future
@@ -12459,10 +12644,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12459
12644
  propName = mapPropName(propName);
12460
12645
  if (ngDevMode) {
12461
12646
  validateAgainstEventProperties(propName);
12462
- if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
12463
- // Return here since we only log warnings for unknown properties.
12464
- handleUnknownPropertyError(propName, tNode, lView);
12465
- return;
12647
+ if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
12648
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12466
12649
  }
12467
12650
  ngDevMode.rendererSetProperty++;
12468
12651
  }
@@ -12481,7 +12664,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12481
12664
  // If the node is a container and the property didn't
12482
12665
  // match any of the inputs or schemas we should throw.
12483
12666
  if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
12484
- handleUnknownPropertyError(propName, tNode, lView);
12667
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12485
12668
  }
12486
12669
  }
12487
12670
  }
@@ -12533,116 +12716,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12533
12716
  }
12534
12717
  }
12535
12718
  }
12536
- /**
12537
- * Validates that the property of the element is known at runtime and returns
12538
- * false if it's not the case.
12539
- * This check is relevant for JIT-compiled components (for AOT-compiled
12540
- * ones this check happens at build time).
12541
- *
12542
- * The property is considered known if either:
12543
- * - it's a known property of the element
12544
- * - the element is allowed by one of the schemas
12545
- * - the property is used for animations
12546
- *
12547
- * @param element Element to validate
12548
- * @param tagName Name of the tag to check
12549
- * @param propName Name of the property to check
12550
- * @param schemas Array of schemas
12551
- */
12552
- function validateProperty(element, tagName, propName, schemas) {
12553
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
12554
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
12555
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
12556
- // execute the check below.
12557
- if (schemas === null)
12558
- return true;
12559
- // The property is considered valid if the element matches the schema, it exists on the element,
12560
- // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
12561
- if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
12562
- return true;
12563
- }
12564
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
12565
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
12566
- return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
12567
- }
12568
- /**
12569
- * Returns true if the tag name is allowed by specified schemas.
12570
- * @param schemas Array of schemas
12571
- * @param tagName Name of the tag
12572
- */
12573
- function matchingSchemas(schemas, tagName) {
12574
- if (schemas !== null) {
12575
- for (let i = 0; i < schemas.length; i++) {
12576
- const schema = schemas[i];
12577
- if (schema === NO_ERRORS_SCHEMA ||
12578
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
12579
- return true;
12580
- }
12581
- }
12582
- }
12583
- return false;
12584
- }
12585
- /**
12586
- * The set of known control flow directives.
12587
- * We use this set to produce a more precises error message with a note
12588
- * that the `CommonModule` should also be included.
12589
- */
12590
- const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
12591
- /**
12592
- * Logs or throws an error that a property is not supported on an element.
12593
- *
12594
- * @param propName Name of the invalid property.
12595
- * @param tNode A `TNode` that represents a current component that is being rendered.
12596
- * @param lView An `LView` that represents a current component that is being rendered.
12597
- */
12598
- function handleUnknownPropertyError(propName, tNode, lView) {
12599
- let tagName = tNode.value;
12600
- // Special-case a situation when a structural directive is applied to
12601
- // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
12602
- // In this case the compiler generates the `ɵɵtemplate` instruction with
12603
- // the `null` as the tagName. The directive matching logic at runtime relies
12604
- // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
12605
- // a default value of the `tNode.value` is not feasible at this moment.
12606
- if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
12607
- tagName = 'ng-template';
12608
- }
12609
- const isHostStandalone = isHostComponentStandalone(lView);
12610
- const templateLocation = getTemplateLocationDetails(lView);
12611
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
12612
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
12613
- const importLocation = isHostStandalone ?
12614
- 'included in the \'@Component.imports\' of this component' :
12615
- 'a part of an @NgModule where this component is declared';
12616
- if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
12617
- // Most likely this is a control flow directive (such as `*ngIf`) used in
12618
- // a template, but the `CommonModule` is not imported.
12619
- message += `\nIf the '${propName}' is an Angular control flow directive, ` +
12620
- `please make sure that the 'CommonModule' is ${importLocation}.`;
12621
- }
12622
- else {
12623
- // May be an Angular component, which is not imported/declared?
12624
- message += `\n1. If '${tagName}' is an Angular component and it has the ` +
12625
- `'${propName}' input, then verify that it is ${importLocation}.`;
12626
- // May be a Web Component?
12627
- if (tagName && tagName.indexOf('-') > -1) {
12628
- message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
12629
- `to the ${schemas} of this component to suppress this message.`;
12630
- message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12631
- `the ${schemas} of this component.`;
12632
- }
12633
- else {
12634
- // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
12635
- message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12636
- `the ${schemas} of this component.`;
12637
- }
12638
- }
12639
- if (shouldThrowErrorOnUnknownProperty) {
12640
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
12641
- }
12642
- else {
12643
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
12644
- }
12645
- }
12646
12719
  /**
12647
12720
  * Instantiate a root component.
12648
12721
  */
@@ -14216,7 +14289,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
14216
14289
  const component = instantiateRootComponent(tView, rootLView, componentDef);
14217
14290
  rootContext.components.push(component);
14218
14291
  componentView[CONTEXT] = component;
14219
- hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
14292
+ if (hostFeatures !== null) {
14293
+ for (const feature of hostFeatures) {
14294
+ feature(component, componentDef);
14295
+ }
14296
+ }
14220
14297
  // We want to generate an empty QueryList for root content queries for backwards
14221
14298
  // compatibility with ViewEngine.
14222
14299
  if (componentDef.contentQueries) {
@@ -14257,13 +14334,10 @@ function createRootContext(scheduler, playerHandler) {
14257
14334
  * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
14258
14335
  * ```
14259
14336
  */
14260
- function LifecycleHooksFeature(component, def) {
14261
- const lView = readPatchedLView(component);
14262
- ngDevMode && assertDefined(lView, 'LView is required');
14263
- const tView = lView[TVIEW];
14337
+ function LifecycleHooksFeature() {
14264
14338
  const tNode = getCurrentTNode();
14265
14339
  ngDevMode && assertDefined(tNode, 'TNode is required');
14266
- registerPostOrderHooks(tView, tNode);
14340
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
14267
14341
  }
14268
14342
  /**
14269
14343
  * Wait on component until it is rendered.
@@ -15398,21 +15472,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
15398
15472
  * Use of this source code is governed by an MIT-style license that can be
15399
15473
  * found in the LICENSE file at https://angular.io/license
15400
15474
  */
15401
- let shouldThrowErrorOnUnknownElement = false;
15402
- /**
15403
- * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
15404
- * instead of just logging the error.
15405
- * (for AOT-compiled ones this check happens at build time).
15406
- */
15407
- function ɵsetUnknownElementStrictMode(shouldThrow) {
15408
- shouldThrowErrorOnUnknownElement = shouldThrow;
15409
- }
15410
- /**
15411
- * Gets the current value of the strict mode.
15412
- */
15413
- function ɵgetUnknownElementStrictMode() {
15414
- return shouldThrowErrorOnUnknownElement;
15415
- }
15416
15475
  function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
15417
15476
  ngDevMode && assertFirstCreatePass(tView);
15418
15477
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -15546,67 +15605,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
15546
15605
  ɵɵelementEnd();
15547
15606
  return ɵɵelement;
15548
15607
  }
15549
- /**
15550
- * Validates that the element is known at runtime and produces
15551
- * an error if it's not the case.
15552
- * This check is relevant for JIT-compiled components (for AOT-compiled
15553
- * ones this check happens at build time).
15554
- *
15555
- * The element is considered known if either:
15556
- * - it's a known HTML element
15557
- * - it's a known custom element
15558
- * - the element matches any directive
15559
- * - the element is allowed by one of the schemas
15560
- *
15561
- * @param element Element to validate
15562
- * @param lView An `LView` that represents a current component that is being rendered.
15563
- * @param tagName Name of the tag to check
15564
- * @param schemas Array of schemas
15565
- * @param hasDirectives Boolean indicating that the element matches any directive
15566
- */
15567
- function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
15568
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
15569
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
15570
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
15571
- // execute the check below.
15572
- if (schemas === null)
15573
- return;
15574
- // If the element matches any directive, it's considered as valid.
15575
- if (!hasDirectives && tagName !== null) {
15576
- // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
15577
- // as a custom element. Note that unknown elements with a dash in their name won't be instances
15578
- // of HTMLUnknownElement in browsers that support web components.
15579
- const isUnknown =
15580
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
15581
- // because while most browsers return 'function', IE returns 'object'.
15582
- (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
15583
- element instanceof HTMLUnknownElement) ||
15584
- (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
15585
- !customElements.get(tagName));
15586
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
15587
- const isHostStandalone = isHostComponentStandalone(lView);
15588
- const templateLocation = getTemplateLocationDetails(lView);
15589
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
15590
- let message = `'${tagName}' is not a known element${templateLocation}:\n`;
15591
- message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
15592
- 'a part of an @NgModule where this component is declared'}.\n`;
15593
- if (tagName && tagName.indexOf('-') > -1) {
15594
- message +=
15595
- `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
15596
- }
15597
- else {
15598
- message +=
15599
- `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
15600
- }
15601
- if (shouldThrowErrorOnUnknownElement) {
15602
- throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
15603
- }
15604
- else {
15605
- console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
15606
- }
15607
- }
15608
- }
15609
- }
15610
15608
 
15611
15609
  /**
15612
15610
  * @license
@@ -22089,7 +22087,7 @@ class Version {
22089
22087
  /**
22090
22088
  * @publicApi
22091
22089
  */
22092
- const VERSION = new Version('14.0.0');
22090
+ const VERSION = new Version('14.0.1');
22093
22091
 
22094
22092
  /**
22095
22093
  * @license
@@ -22789,14 +22787,14 @@ class StandaloneService {
22789
22787
  if (!componentDef.standalone) {
22790
22788
  return null;
22791
22789
  }
22792
- if (!this.cachedInjectors.has(componentDef)) {
22790
+ if (!this.cachedInjectors.has(componentDef.id)) {
22793
22791
  const providers = internalImportProvidersFrom(false, componentDef.type);
22794
22792
  const standaloneInjector = providers.length > 0 ?
22795
22793
  createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22796
22794
  null;
22797
- this.cachedInjectors.set(componentDef, standaloneInjector);
22795
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
22798
22796
  }
22799
- return this.cachedInjectors.get(componentDef);
22797
+ return this.cachedInjectors.get(componentDef.id);
22800
22798
  }
22801
22799
  ngOnDestroy() {
22802
22800
  try {
@@ -23296,13 +23294,26 @@ function getPipeDef(name, registry) {
23296
23294
  }
23297
23295
  }
23298
23296
  if (ngDevMode) {
23299
- const lView = getLView();
23300
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
23301
- const context = declarationLView[CONTEXT];
23302
- const component = context ? ` in the '${context.constructor.name}' component` : '';
23303
- throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
23297
+ throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
23304
23298
  }
23305
23299
  }
23300
+ /**
23301
+ * Generates a helpful error message for the user when a pipe is not found.
23302
+ *
23303
+ * @param name Name of the missing pipe
23304
+ * @returns The error message
23305
+ */
23306
+ function getPipeNotFoundErrorMessage(name) {
23307
+ const lView = getLView();
23308
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
23309
+ const context = declarationLView[CONTEXT];
23310
+ const hostIsStandalone = isHostComponentStandalone(lView);
23311
+ const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
23312
+ const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
23313
+ 'declared or imported in this module'}`;
23314
+ const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
23315
+ return errorMessage;
23316
+ }
23306
23317
  /**
23307
23318
  * Invokes a pipe with 1 arguments.
23308
23319
  *
@@ -25124,7 +25135,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
25124
25135
  }
25125
25136
  /**
25126
25137
  * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
25127
- * (eaither a NgModule or a standalone component / directive / pipe).
25138
+ * (either a NgModule or a standalone component / directive / pipe).
25128
25139
  */
25129
25140
  function transitiveScopesFor(type) {
25130
25141
  if (isNgModule(type)) {