@angular/core 14.0.0-rc.3 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/esm2020/src/di/interface/provider.mjs +1 -1
  2. package/esm2020/src/di/provider_collection.mjs +32 -2
  3. package/esm2020/src/di/r3_injector.mjs +3 -1
  4. package/esm2020/src/error_handler.mjs +4 -7
  5. package/esm2020/src/errors.mjs +6 -3
  6. package/esm2020/src/metadata/directives.mjs +1 -1
  7. package/esm2020/src/render3/component.mjs +9 -9
  8. package/esm2020/src/render3/definition.mjs +4 -4
  9. package/esm2020/src/render3/features/standalone_feature.mjs +4 -4
  10. package/esm2020/src/render3/instructions/all.mjs +2 -2
  11. package/esm2020/src/render3/instructions/element.mjs +3 -79
  12. package/esm2020/src/render3/instructions/element_validation.mjs +264 -0
  13. package/esm2020/src/render3/instructions/shared.mjs +7 -184
  14. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  15. package/esm2020/src/render3/jit/module.mjs +3 -2
  16. package/esm2020/src/render3/ng_module_ref.mjs +2 -1
  17. package/esm2020/src/render3/pipe.mjs +20 -6
  18. package/esm2020/src/render3/state.mjs +1 -3
  19. package/esm2020/src/util/errors.mjs +1 -8
  20. package/esm2020/src/version.mjs +1 -1
  21. package/esm2020/testing/src/logger.mjs +3 -3
  22. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  23. package/fesm2015/core.mjs +631 -586
  24. package/fesm2015/core.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +632 -587
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/core.mjs +632 -587
  28. package/fesm2020/core.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +633 -588
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/index.d.ts +48 -7
  32. package/package.json +1 -1
  33. package/testing/index.d.ts +1 -1
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-rc.3
2
+ * @license Angular v14.0.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -181,9 +181,12 @@ function formatRuntimeError(code, message) {
181
181
  // Error code might be a negative number, which is a special marker that instructs the logic to
182
182
  // generate a link to the error details page on angular.io.
183
183
  const fullCode = `NG0${Math.abs(code)}`;
184
- let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
184
+ let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
185
185
  if (ngDevMode && code < 0) {
186
- errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
186
+ const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
187
+ const separator = addPeriodSeparator ? '.' : '';
188
+ errorMessage =
189
+ `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
187
190
  }
188
191
  return errorMessage;
189
192
  }
@@ -864,7 +867,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
864
867
  * Use of this source code is governed by an MIT-style license that can be
865
868
  * found in the LICENSE file at https://angular.io/license
866
869
  */
867
- let _renderCompCount = 0;
870
+ /** Counter used to generate unique IDs for component definitions. */
871
+ let componentDefCount = 0;
868
872
  /**
869
873
  * Create a component definition object.
870
874
  *
@@ -917,7 +921,7 @@ function ɵɵdefineComponent(componentDefinition) {
917
921
  features: componentDefinition.features || null,
918
922
  data: componentDefinition.data || {},
919
923
  encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
920
- id: 'c',
924
+ id: `c${componentDefCount++}`,
921
925
  styles: componentDefinition.styles || EMPTY_ARRAY,
922
926
  _: null,
923
927
  setInput: null,
@@ -926,7 +930,6 @@ function ɵɵdefineComponent(componentDefinition) {
926
930
  };
927
931
  const dependencies = componentDefinition.dependencies;
928
932
  const feature = componentDefinition.features;
929
- def.id += _renderCompCount++;
930
933
  def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
931
934
  def.outputs = invertObject(componentDefinition.outputs),
932
935
  feature && feature.forEach((fn) => fn(def));
@@ -1933,7 +1936,6 @@ function getLView() {
1933
1936
  function getTView() {
1934
1937
  return instructionState.lFrame.tView;
1935
1938
  }
1936
- // TODO(crisbeto): revert the @noinline once Closure issue is resolved.
1937
1939
  /**
1938
1940
  * Restores `contextViewData` to the given OpaqueViewState instance.
1939
1941
  *
@@ -1945,7 +1947,6 @@ function getTView() {
1945
1947
  * @returns Context of the restored OpaqueViewState instance.
1946
1948
  *
1947
1949
  * @codeGenApi
1948
- * @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
1949
1950
  */
1950
1951
  function ɵɵrestoreView(viewToRestore) {
1951
1952
  instructionState.lFrame.contextLView = viewToRestore;
@@ -6334,6 +6335,155 @@ function getSanitizer() {
6334
6335
  return lView && lView[SANITIZER];
6335
6336
  }
6336
6337
 
6338
+ /**
6339
+ * @license
6340
+ * Copyright Google LLC All Rights Reserved.
6341
+ *
6342
+ * Use of this source code is governed by an MIT-style license that can be
6343
+ * found in the LICENSE file at https://angular.io/license
6344
+ */
6345
+ const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6346
+ function wrappedError(message, originalError) {
6347
+ const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6348
+ const error = Error(msg);
6349
+ error[ERROR_ORIGINAL_ERROR] = originalError;
6350
+ return error;
6351
+ }
6352
+ function getOriginalError(error) {
6353
+ return error[ERROR_ORIGINAL_ERROR];
6354
+ }
6355
+
6356
+ /**
6357
+ * @license
6358
+ * Copyright Google LLC All Rights Reserved.
6359
+ *
6360
+ * Use of this source code is governed by an MIT-style license that can be
6361
+ * found in the LICENSE file at https://angular.io/license
6362
+ */
6363
+ /**
6364
+ * Provides a hook for centralized exception handling.
6365
+ *
6366
+ * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6367
+ * intercept error handling, write a custom exception handler that replaces this default as
6368
+ * appropriate for your app.
6369
+ *
6370
+ * @usageNotes
6371
+ * ### Example
6372
+ *
6373
+ * ```
6374
+ * class MyErrorHandler implements ErrorHandler {
6375
+ * handleError(error) {
6376
+ * // do something with the exception
6377
+ * }
6378
+ * }
6379
+ *
6380
+ * @NgModule({
6381
+ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6382
+ * })
6383
+ * class MyModule {}
6384
+ * ```
6385
+ *
6386
+ * @publicApi
6387
+ */
6388
+ class ErrorHandler {
6389
+ constructor() {
6390
+ /**
6391
+ * @internal
6392
+ */
6393
+ this._console = console;
6394
+ }
6395
+ handleError(error) {
6396
+ const originalError = this._findOriginalError(error);
6397
+ this._console.error('ERROR', error);
6398
+ if (originalError) {
6399
+ this._console.error('ORIGINAL ERROR', originalError);
6400
+ }
6401
+ }
6402
+ /** @internal */
6403
+ _findOriginalError(error) {
6404
+ let e = error && getOriginalError(error);
6405
+ while (e && getOriginalError(e)) {
6406
+ e = getOriginalError(e);
6407
+ }
6408
+ return e || null;
6409
+ }
6410
+ }
6411
+
6412
+ /**
6413
+ * @license
6414
+ * Copyright Google LLC All Rights Reserved.
6415
+ *
6416
+ * Use of this source code is governed by an MIT-style license that can be
6417
+ * found in the LICENSE file at https://angular.io/license
6418
+ */
6419
+ /**
6420
+ * Disallowed strings in the comment.
6421
+ *
6422
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6423
+ */
6424
+ const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6425
+ /**
6426
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6427
+ */
6428
+ const COMMENT_DELIMITER = /(<|>)/;
6429
+ const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6430
+ /**
6431
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
6432
+ *
6433
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6434
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6435
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6436
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6437
+ *
6438
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6439
+ *
6440
+ * ```
6441
+ * div.innerHTML = div.innerHTML
6442
+ * ```
6443
+ *
6444
+ * One would expect that the above code would be safe to do, but it turns out that because comment
6445
+ * text is not escaped, the comment may contain text which will prematurely close the comment
6446
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6447
+ * may contain such text and expect them to be safe.)
6448
+ *
6449
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6450
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6451
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6452
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
6453
+ *
6454
+ * @param value text to make safe for comment node by escaping the comment open/close character
6455
+ * sequence.
6456
+ */
6457
+ function escapeCommentText(value) {
6458
+ return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6459
+ }
6460
+
6461
+ /**
6462
+ * @license
6463
+ * Copyright Google LLC All Rights Reserved.
6464
+ *
6465
+ * Use of this source code is governed by an MIT-style license that can be
6466
+ * found in the LICENSE file at https://angular.io/license
6467
+ */
6468
+ function normalizeDebugBindingName(name) {
6469
+ // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6470
+ name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6471
+ return `ng-reflect-${name}`;
6472
+ }
6473
+ const CAMEL_CASE_REGEXP = /([A-Z])/g;
6474
+ function camelCaseToDashCase(input) {
6475
+ return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6476
+ }
6477
+ function normalizeDebugBindingValue(value) {
6478
+ try {
6479
+ // Limit the size of the value as otherwise the DOM just gets polluted.
6480
+ return value != null ? value.toString().slice(0, 30) : value;
6481
+ }
6482
+ catch (e) {
6483
+ return '[ERROR] Exception while trying to serialize the value';
6484
+ }
6485
+ }
6486
+
6337
6487
  /**
6338
6488
  * @license
6339
6489
  * Copyright Google LLC All Rights Reserved.
@@ -6690,215 +6840,25 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
6690
6840
  }
6691
6841
  function getComponentAtNodeIndex(nodeIndex, lView) {
6692
6842
  const tNode = lView[TVIEW].data[nodeIndex];
6693
- let directiveStartIndex = tNode.directiveStart;
6694
- return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6695
- }
6696
- /**
6697
- * Returns a map of local references (local reference name => element or directive instance) that
6698
- * exist on a given element.
6699
- */
6700
- function discoverLocalRefs(lView, nodeIndex) {
6701
- const tNode = lView[TVIEW].data[nodeIndex];
6702
- if (tNode && tNode.localNames) {
6703
- const result = {};
6704
- let localIndex = tNode.index + 1;
6705
- for (let i = 0; i < tNode.localNames.length; i += 2) {
6706
- result[tNode.localNames[i]] = lView[localIndex];
6707
- localIndex++;
6708
- }
6709
- return result;
6710
- }
6711
- return null;
6712
- }
6713
-
6714
- /**
6715
- * @license
6716
- * Copyright Google LLC All Rights Reserved.
6717
- *
6718
- * Use of this source code is governed by an MIT-style license that can be
6719
- * found in the LICENSE file at https://angular.io/license
6720
- */
6721
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6722
- const ERROR_LOGGER = 'ngErrorLogger';
6723
- function wrappedError(message, originalError) {
6724
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6725
- const error = Error(msg);
6726
- error[ERROR_ORIGINAL_ERROR] = originalError;
6727
- return error;
6728
- }
6729
- function getOriginalError(error) {
6730
- return error[ERROR_ORIGINAL_ERROR];
6731
- }
6732
- function getErrorLogger(error) {
6733
- return error && error[ERROR_LOGGER] || defaultErrorLogger;
6734
- }
6735
- function defaultErrorLogger(console, ...values) {
6736
- console.error(...values);
6737
- }
6738
-
6739
- /**
6740
- * @license
6741
- * Copyright Google LLC All Rights Reserved.
6742
- *
6743
- * Use of this source code is governed by an MIT-style license that can be
6744
- * found in the LICENSE file at https://angular.io/license
6745
- */
6746
- /**
6747
- * Provides a hook for centralized exception handling.
6748
- *
6749
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6750
- * intercept error handling, write a custom exception handler that replaces this default as
6751
- * appropriate for your app.
6752
- *
6753
- * @usageNotes
6754
- * ### Example
6755
- *
6756
- * ```
6757
- * class MyErrorHandler implements ErrorHandler {
6758
- * handleError(error) {
6759
- * // do something with the exception
6760
- * }
6761
- * }
6762
- *
6763
- * @NgModule({
6764
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6765
- * })
6766
- * class MyModule {}
6767
- * ```
6768
- *
6769
- * @publicApi
6770
- */
6771
- class ErrorHandler {
6772
- constructor() {
6773
- /**
6774
- * @internal
6775
- */
6776
- this._console = console;
6777
- }
6778
- handleError(error) {
6779
- const originalError = this._findOriginalError(error);
6780
- // Note: Browser consoles show the place from where console.error was called.
6781
- // We can use this to give users additional information about the error.
6782
- const errorLogger = getErrorLogger(error);
6783
- errorLogger(this._console, `ERROR`, error);
6784
- if (originalError) {
6785
- errorLogger(this._console, `ORIGINAL ERROR`, originalError);
6786
- }
6787
- }
6788
- /** @internal */
6789
- _findOriginalError(error) {
6790
- let e = error && getOriginalError(error);
6791
- while (e && getOriginalError(e)) {
6792
- e = getOriginalError(e);
6793
- }
6794
- return e || null;
6795
- }
6796
- }
6797
-
6798
- /**
6799
- * @license
6800
- * Copyright Google LLC All Rights Reserved.
6801
- *
6802
- * Use of this source code is governed by an MIT-style license that can be
6803
- * found in the LICENSE file at https://angular.io/license
6804
- */
6805
- /**
6806
- * Defines a schema that allows an NgModule to contain the following:
6807
- * - Non-Angular elements named with dash case (`-`).
6808
- * - Element properties named with dash case (`-`).
6809
- * Dash case is the naming convention for custom elements.
6810
- *
6811
- * @publicApi
6812
- */
6813
- const CUSTOM_ELEMENTS_SCHEMA = {
6814
- name: 'custom-elements'
6815
- };
6816
- /**
6817
- * Defines a schema that allows any property on any element.
6818
- *
6819
- * This schema allows you to ignore the errors related to any unknown elements or properties in a
6820
- * template. The usage of this schema is generally discouraged because it prevents useful validation
6821
- * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
6822
- *
6823
- * @publicApi
6824
- */
6825
- const NO_ERRORS_SCHEMA = {
6826
- name: 'no-errors-schema'
6827
- };
6828
-
6829
- /**
6830
- * @license
6831
- * Copyright Google LLC All Rights Reserved.
6832
- *
6833
- * Use of this source code is governed by an MIT-style license that can be
6834
- * found in the LICENSE file at https://angular.io/license
6835
- */
6836
- /**
6837
- * Disallowed strings in the comment.
6838
- *
6839
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6840
- */
6841
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6842
- /**
6843
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6844
- */
6845
- const COMMENT_DELIMITER = /(<|>)/;
6846
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6847
- /**
6848
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
6849
- *
6850
- * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6851
- * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6852
- * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6853
- * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6854
- *
6855
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6856
- *
6857
- * ```
6858
- * div.innerHTML = div.innerHTML
6859
- * ```
6860
- *
6861
- * One would expect that the above code would be safe to do, but it turns out that because comment
6862
- * text is not escaped, the comment may contain text which will prematurely close the comment
6863
- * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6864
- * may contain such text and expect them to be safe.)
6865
- *
6866
- * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6867
- * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6868
- * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6869
- * text it will render normally but it will not cause the HTML parser to close/open the comment.
6870
- *
6871
- * @param value text to make safe for comment node by escaping the comment open/close character
6872
- * sequence.
6873
- */
6874
- function escapeCommentText(value) {
6875
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6876
- }
6877
-
6878
- /**
6879
- * @license
6880
- * Copyright Google LLC All Rights Reserved.
6881
- *
6882
- * Use of this source code is governed by an MIT-style license that can be
6883
- * found in the LICENSE file at https://angular.io/license
6884
- */
6885
- function normalizeDebugBindingName(name) {
6886
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6887
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6888
- return `ng-reflect-${name}`;
6889
- }
6890
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
6891
- function camelCaseToDashCase(input) {
6892
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6893
- }
6894
- function normalizeDebugBindingValue(value) {
6895
- try {
6896
- // Limit the size of the value as otherwise the DOM just gets polluted.
6897
- return value != null ? value.toString().slice(0, 30) : value;
6898
- }
6899
- catch (e) {
6900
- return '[ERROR] Exception while trying to serialize the value';
6843
+ let directiveStartIndex = tNode.directiveStart;
6844
+ return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6845
+ }
6846
+ /**
6847
+ * Returns a map of local references (local reference name => element or directive instance) that
6848
+ * exist on a given element.
6849
+ */
6850
+ function discoverLocalRefs(lView, nodeIndex) {
6851
+ const tNode = lView[TVIEW].data[nodeIndex];
6852
+ if (tNode && tNode.localNames) {
6853
+ const result = {};
6854
+ let localIndex = tNode.index + 1;
6855
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
6856
+ result[tNode.localNames[i]] = lView[localIndex];
6857
+ localIndex++;
6858
+ }
6859
+ return result;
6901
6860
  }
6861
+ return null;
6902
6862
  }
6903
6863
 
6904
6864
  /**
@@ -8858,8 +8818,38 @@ const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
8858
8818
  * another environment injector (such as a route injector). They should not be used in component
8859
8819
  * providers.
8860
8820
  *
8861
- * @returns The collected providers from the specified list of types.
8821
+ * More information about standalone components can be found in [this
8822
+ * guide](guide/standalone-components).
8823
+ *
8824
+ * @usageNotes
8825
+ * The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:
8826
+ *
8827
+ * ```typescript
8828
+ * await bootstrapApplication(RootComponent, {
8829
+ * providers: [
8830
+ * importProvidersFrom(NgModuleOne, NgModuleTwo)
8831
+ * ]
8832
+ * });
8833
+ * ```
8834
+ *
8835
+ * You can also use the `importProvidersFrom` results in the `providers` field of a route, when a
8836
+ * standalone component is used:
8837
+ *
8838
+ * ```typescript
8839
+ * export const ROUTES: Route[] = [
8840
+ * {
8841
+ * path: 'foo',
8842
+ * providers: [
8843
+ * importProvidersFrom(NgModuleOne, NgModuleTwo)
8844
+ * ],
8845
+ * component: YourStandaloneComponent
8846
+ * }
8847
+ * ];
8848
+ * ```
8849
+ *
8850
+ * @returns Collected providers from the specified list of types.
8862
8851
  * @publicApi
8852
+ * @developerPreview
8863
8853
  */
8864
8854
  function importProvidersFrom(...sources) {
8865
8855
  return { ɵproviders: internalImportProvidersFrom(true, sources) };
@@ -9137,6 +9127,8 @@ function getNullInjector() {
9137
9127
  /**
9138
9128
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
9139
9129
  * component tree.
9130
+ *
9131
+ * @developerPreview
9140
9132
  */
9141
9133
  class EnvironmentInjector {
9142
9134
  }
@@ -10308,113 +10300,403 @@ class ReflectiveInjector_ {
10308
10300
  return this.objs[i];
10309
10301
  }
10310
10302
  }
10311
- return UNDEFINED;
10303
+ return UNDEFINED;
10304
+ }
10305
+ /** @internal */
10306
+ _throwOrNull(key, notFoundValue) {
10307
+ if (notFoundValue !== THROW_IF_NOT_FOUND) {
10308
+ return notFoundValue;
10309
+ }
10310
+ else {
10311
+ throw noProviderError(this, key);
10312
+ }
10313
+ }
10314
+ /** @internal */
10315
+ _getByKeySelf(key, notFoundValue) {
10316
+ const obj = this._getObjByKeyId(key.id);
10317
+ return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10318
+ }
10319
+ /** @internal */
10320
+ _getByKeyDefault(key, notFoundValue, visibility) {
10321
+ let inj;
10322
+ if (visibility instanceof SkipSelf) {
10323
+ inj = this.parent;
10324
+ }
10325
+ else {
10326
+ inj = this;
10327
+ }
10328
+ while (inj instanceof ReflectiveInjector_) {
10329
+ const inj_ = inj;
10330
+ const obj = inj_._getObjByKeyId(key.id);
10331
+ if (obj !== UNDEFINED)
10332
+ return obj;
10333
+ inj = inj_.parent;
10334
+ }
10335
+ if (inj !== null) {
10336
+ return inj.get(key.token, notFoundValue);
10337
+ }
10338
+ else {
10339
+ return this._throwOrNull(key, notFoundValue);
10340
+ }
10341
+ }
10342
+ get displayName() {
10343
+ const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10344
+ .join(', ');
10345
+ return `ReflectiveInjector(providers: [${providers}])`;
10346
+ }
10347
+ toString() {
10348
+ return this.displayName;
10349
+ }
10350
+ }
10351
+ ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10352
+ function _mapProviders(injector, fn) {
10353
+ const res = [];
10354
+ for (let i = 0; i < injector._providers.length; ++i) {
10355
+ res[i] = fn(injector.getProviderAtIndex(i));
10356
+ }
10357
+ return res;
10358
+ }
10359
+
10360
+ /**
10361
+ * @license
10362
+ * Copyright Google LLC All Rights Reserved.
10363
+ *
10364
+ * Use of this source code is governed by an MIT-style license that can be
10365
+ * found in the LICENSE file at https://angular.io/license
10366
+ */
10367
+
10368
+ /**
10369
+ * @license
10370
+ * Copyright Google LLC All Rights Reserved.
10371
+ *
10372
+ * Use of this source code is governed by an MIT-style license that can be
10373
+ * found in the LICENSE file at https://angular.io/license
10374
+ */
10375
+
10376
+ /**
10377
+ * @license
10378
+ * Copyright Google LLC All Rights Reserved.
10379
+ *
10380
+ * Use of this source code is governed by an MIT-style license that can be
10381
+ * found in the LICENSE file at https://angular.io/license
10382
+ */
10383
+ function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10384
+ const lView = getLView();
10385
+ // Fall back to inject() if view hasn't been created. This situation can happen in tests
10386
+ // if inject utilities are used before bootstrapping.
10387
+ if (lView === null) {
10388
+ // Verify that we will not get into infinite loop.
10389
+ ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10390
+ return ɵɵinject(token, flags);
10391
+ }
10392
+ const tNode = getCurrentTNode();
10393
+ return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10394
+ }
10395
+ /**
10396
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
10397
+ * particular class.
10398
+ *
10399
+ * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10400
+ * off, saving bytes of generated code while still providing a good experience in dev mode.
10401
+ *
10402
+ * The name of the class is not mentioned here, but will be in the generated factory function name
10403
+ * and thus in the stack trace.
10404
+ *
10405
+ * @codeGenApi
10406
+ */
10407
+ function ɵɵinvalidFactory() {
10408
+ const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10409
+ throw new Error(msg);
10410
+ }
10411
+
10412
+ /**
10413
+ * @license
10414
+ * Copyright Google LLC All Rights Reserved.
10415
+ *
10416
+ * Use of this source code is governed by an MIT-style license that can be
10417
+ * found in the LICENSE file at https://angular.io/license
10418
+ */
10419
+ /**
10420
+ * Defines a schema that allows an NgModule to contain the following:
10421
+ * - Non-Angular elements named with dash case (`-`).
10422
+ * - Element properties named with dash case (`-`).
10423
+ * Dash case is the naming convention for custom elements.
10424
+ *
10425
+ * @publicApi
10426
+ */
10427
+ const CUSTOM_ELEMENTS_SCHEMA = {
10428
+ name: 'custom-elements'
10429
+ };
10430
+ /**
10431
+ * Defines a schema that allows any property on any element.
10432
+ *
10433
+ * This schema allows you to ignore the errors related to any unknown elements or properties in a
10434
+ * template. The usage of this schema is generally discouraged because it prevents useful validation
10435
+ * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
10436
+ *
10437
+ * @publicApi
10438
+ */
10439
+ const NO_ERRORS_SCHEMA = {
10440
+ name: 'no-errors-schema'
10441
+ };
10442
+
10443
+ /**
10444
+ * @license
10445
+ * Copyright Google LLC All Rights Reserved.
10446
+ *
10447
+ * Use of this source code is governed by an MIT-style license that can be
10448
+ * found in the LICENSE file at https://angular.io/license
10449
+ */
10450
+ let shouldThrowErrorOnUnknownElement = false;
10451
+ /**
10452
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
10453
+ * instead of just logging the error.
10454
+ * (for AOT-compiled ones this check happens at build time).
10455
+ */
10456
+ function ɵsetUnknownElementStrictMode(shouldThrow) {
10457
+ shouldThrowErrorOnUnknownElement = shouldThrow;
10458
+ }
10459
+ /**
10460
+ * Gets the current value of the strict mode.
10461
+ */
10462
+ function ɵgetUnknownElementStrictMode() {
10463
+ return shouldThrowErrorOnUnknownElement;
10464
+ }
10465
+ let shouldThrowErrorOnUnknownProperty = false;
10466
+ /**
10467
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
10468
+ * instead of just logging the error.
10469
+ * (for AOT-compiled ones this check happens at build time).
10470
+ */
10471
+ function ɵsetUnknownPropertyStrictMode(shouldThrow) {
10472
+ shouldThrowErrorOnUnknownProperty = shouldThrow;
10473
+ }
10474
+ /**
10475
+ * Gets the current value of the strict mode.
10476
+ */
10477
+ function ɵgetUnknownPropertyStrictMode() {
10478
+ return shouldThrowErrorOnUnknownProperty;
10479
+ }
10480
+ /**
10481
+ * Validates that the element is known at runtime and produces
10482
+ * an error if it's not the case.
10483
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10484
+ * ones this check happens at build time).
10485
+ *
10486
+ * The element is considered known if either:
10487
+ * - it's a known HTML element
10488
+ * - it's a known custom element
10489
+ * - the element matches any directive
10490
+ * - the element is allowed by one of the schemas
10491
+ *
10492
+ * @param element Element to validate
10493
+ * @param lView An `LView` that represents a current component that is being rendered
10494
+ * @param tagName Name of the tag to check
10495
+ * @param schemas Array of schemas
10496
+ * @param hasDirectives Boolean indicating that the element matches any directive
10497
+ */
10498
+ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
10499
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10500
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10501
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10502
+ // execute the check below.
10503
+ if (schemas === null)
10504
+ return;
10505
+ // If the element matches any directive, it's considered as valid.
10506
+ if (!hasDirectives && tagName !== null) {
10507
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
10508
+ // as a custom element. Note that unknown elements with a dash in their name won't be instances
10509
+ // of HTMLUnknownElement in browsers that support web components.
10510
+ const isUnknown =
10511
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
10512
+ // because while most browsers return 'function', IE returns 'object'.
10513
+ (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
10514
+ element instanceof HTMLUnknownElement) ||
10515
+ (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
10516
+ !customElements.get(tagName));
10517
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
10518
+ const isHostStandalone = isHostComponentStandalone(lView);
10519
+ const templateLocation = getTemplateLocationDetails(lView);
10520
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10521
+ let message = `'${tagName}' is not a known element${templateLocation}:\n`;
10522
+ message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
10523
+ 'a part of an @NgModule where this component is declared'}.\n`;
10524
+ if (tagName && tagName.indexOf('-') > -1) {
10525
+ message +=
10526
+ `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
10527
+ }
10528
+ else {
10529
+ message +=
10530
+ `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
10531
+ }
10532
+ if (shouldThrowErrorOnUnknownElement) {
10533
+ throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
10534
+ }
10535
+ else {
10536
+ console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
10537
+ }
10538
+ }
10312
10539
  }
10313
- /** @internal */
10314
- _throwOrNull(key, notFoundValue) {
10315
- if (notFoundValue !== THROW_IF_NOT_FOUND) {
10316
- return notFoundValue;
10317
- }
10318
- else {
10319
- throw noProviderError(this, key);
10320
- }
10540
+ }
10541
+ /**
10542
+ * Validates that the property of the element is known at runtime and returns
10543
+ * false if it's not the case.
10544
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10545
+ * ones this check happens at build time).
10546
+ *
10547
+ * The property is considered known if either:
10548
+ * - it's a known property of the element
10549
+ * - the element is allowed by one of the schemas
10550
+ * - the property is used for animations
10551
+ *
10552
+ * @param element Element to validate
10553
+ * @param propName Name of the property to check
10554
+ * @param tagName Name of the tag hosting the property
10555
+ * @param schemas Array of schemas
10556
+ */
10557
+ function isPropertyValid(element, propName, tagName, schemas) {
10558
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10559
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10560
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10561
+ // execute the check below.
10562
+ if (schemas === null)
10563
+ return true;
10564
+ // The property is considered valid if the element matches the schema, it exists on the element,
10565
+ // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
10566
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
10567
+ return true;
10321
10568
  }
10322
- /** @internal */
10323
- _getByKeySelf(key, notFoundValue) {
10324
- const obj = this._getObjByKeyId(key.id);
10325
- return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10569
+ // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
10570
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
10571
+ return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
10572
+ }
10573
+ /**
10574
+ * Logs or throws an error that a property is not supported on an element.
10575
+ *
10576
+ * @param propName Name of the invalid property
10577
+ * @param tagName Name of the tag hosting the property
10578
+ * @param nodeType Type of the node hosting the property
10579
+ * @param lView An `LView` that represents a current component
10580
+ */
10581
+ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
10582
+ // Special-case a situation when a structural directive is applied to
10583
+ // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
10584
+ // In this case the compiler generates the `ɵɵtemplate` instruction with
10585
+ // the `null` as the tagName. The directive matching logic at runtime relies
10586
+ // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
10587
+ // a default value of the `tNode.value` is not feasible at this moment.
10588
+ if (!tagName && nodeType === 4 /* TNodeType.Container */) {
10589
+ tagName = 'ng-template';
10326
10590
  }
10327
- /** @internal */
10328
- _getByKeyDefault(key, notFoundValue, visibility) {
10329
- let inj;
10330
- if (visibility instanceof SkipSelf) {
10331
- inj = this.parent;
10332
- }
10333
- else {
10334
- inj = this;
10335
- }
10336
- while (inj instanceof ReflectiveInjector_) {
10337
- const inj_ = inj;
10338
- const obj = inj_._getObjByKeyId(key.id);
10339
- if (obj !== UNDEFINED)
10340
- return obj;
10341
- inj = inj_.parent;
10342
- }
10343
- if (inj !== null) {
10344
- return inj.get(key.token, notFoundValue);
10591
+ const isHostStandalone = isHostComponentStandalone(lView);
10592
+ const templateLocation = getTemplateLocationDetails(lView);
10593
+ let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
10594
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10595
+ const importLocation = isHostStandalone ?
10596
+ 'included in the \'@Component.imports\' of this component' :
10597
+ 'a part of an @NgModule where this component is declared';
10598
+ if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
10599
+ // Most likely this is a control flow directive (such as `*ngIf`) used in
10600
+ // a template, but the `CommonModule` is not imported.
10601
+ message += `\nIf the '${propName}' is an Angular control flow directive, ` +
10602
+ `please make sure that the 'CommonModule' is ${importLocation}.`;
10603
+ }
10604
+ else {
10605
+ // May be an Angular component, which is not imported/declared?
10606
+ message += `\n1. If '${tagName}' is an Angular component and it has the ` +
10607
+ `'${propName}' input, then verify that it is ${importLocation}.`;
10608
+ // May be a Web Component?
10609
+ if (tagName && tagName.indexOf('-') > -1) {
10610
+ message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
10611
+ `to the ${schemas} of this component to suppress this message.`;
10612
+ message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10613
+ `the ${schemas} of this component.`;
10345
10614
  }
10346
10615
  else {
10347
- return this._throwOrNull(key, notFoundValue);
10616
+ // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
10617
+ message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10618
+ `the ${schemas} of this component.`;
10348
10619
  }
10349
10620
  }
10350
- get displayName() {
10351
- const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10352
- .join(', ');
10353
- return `ReflectiveInjector(providers: [${providers}])`;
10354
- }
10355
- toString() {
10356
- return this.displayName;
10621
+ if (shouldThrowErrorOnUnknownProperty) {
10622
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
10357
10623
  }
10358
- }
10359
- ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10360
- function _mapProviders(injector, fn) {
10361
- const res = [];
10362
- for (let i = 0; i < injector._providers.length; ++i) {
10363
- res[i] = fn(injector.getProviderAtIndex(i));
10624
+ else {
10625
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
10364
10626
  }
10365
- return res;
10366
10627
  }
10367
-
10368
10628
  /**
10369
- * @license
10370
- * Copyright Google LLC All Rights Reserved.
10629
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10630
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10631
+ * be too slow for production mode and also it relies on the constructor function being available.
10371
10632
  *
10372
- * Use of this source code is governed by an MIT-style license that can be
10373
- * found in the LICENSE file at https://angular.io/license
10374
- */
10375
-
10376
- /**
10377
- * @license
10378
- * Copyright Google LLC All Rights Reserved.
10633
+ * Gets a reference to the host component def (where a current component is declared).
10379
10634
  *
10380
- * Use of this source code is governed by an MIT-style license that can be
10381
- * found in the LICENSE file at https://angular.io/license
10635
+ * @param lView An `LView` that represents a current component that is being rendered.
10382
10636
  */
10383
-
10637
+ function getDeclarationComponentDef(lView) {
10638
+ !ngDevMode && throwError('Must never be called in production mode');
10639
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
10640
+ const context = declarationLView[CONTEXT];
10641
+ // Unable to obtain a context.
10642
+ if (!context)
10643
+ return null;
10644
+ return context.constructor ? getComponentDef(context.constructor) : null;
10645
+ }
10384
10646
  /**
10385
- * @license
10386
- * Copyright Google LLC All Rights Reserved.
10647
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10648
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10649
+ * be too slow for production mode.
10387
10650
  *
10388
- * Use of this source code is governed by an MIT-style license that can be
10389
- * found in the LICENSE file at https://angular.io/license
10651
+ * Checks if the current component is declared inside of a standalone component template.
10652
+ *
10653
+ * @param lView An `LView` that represents a current component that is being rendered.
10390
10654
  */
10391
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10392
- const lView = getLView();
10393
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
10394
- // if inject utilities are used before bootstrapping.
10395
- if (lView === null) {
10396
- // Verify that we will not get into infinite loop.
10397
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10398
- return ɵɵinject(token, flags);
10399
- }
10400
- const tNode = getCurrentTNode();
10401
- return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10655
+ function isHostComponentStandalone(lView) {
10656
+ !ngDevMode && throwError('Must never be called in production mode');
10657
+ const componentDef = getDeclarationComponentDef(lView);
10658
+ // Treat host component as non-standalone if we can't obtain the def.
10659
+ return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
10402
10660
  }
10403
10661
  /**
10404
- * Throws an error indicating that a factory function could not be generated by the compiler for a
10405
- * particular class.
10406
- *
10407
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10408
- * off, saving bytes of generated code while still providing a good experience in dev mode.
10662
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10663
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10664
+ * be too slow for production mode.
10409
10665
  *
10410
- * The name of the class is not mentioned here, but will be in the generated factory function name
10411
- * and thus in the stack trace.
10666
+ * Constructs a string describing the location of the host component template. The function is used
10667
+ * in dev mode to produce error messages.
10412
10668
  *
10413
- * @codeGenApi
10669
+ * @param lView An `LView` that represents a current component that is being rendered.
10414
10670
  */
10415
- function ɵɵinvalidFactory() {
10416
- const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10417
- throw new Error(msg);
10671
+ function getTemplateLocationDetails(lView) {
10672
+ var _a;
10673
+ !ngDevMode && throwError('Must never be called in production mode');
10674
+ const hostComponentDef = getDeclarationComponentDef(lView);
10675
+ const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
10676
+ return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
10677
+ }
10678
+ /**
10679
+ * The set of known control flow directives.
10680
+ * We use this set to produce a more precises error message with a note
10681
+ * that the `CommonModule` should also be included.
10682
+ */
10683
+ const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
10684
+ /**
10685
+ * Returns true if the tag name is allowed by specified schemas.
10686
+ * @param schemas Array of schemas
10687
+ * @param tagName Name of the tag
10688
+ */
10689
+ function matchingSchemas(schemas, tagName) {
10690
+ if (schemas !== null) {
10691
+ for (let i = 0; i < schemas.length; i++) {
10692
+ const schema = schemas[i];
10693
+ if (schema === NO_ERRORS_SCHEMA ||
10694
+ schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
10695
+ return true;
10696
+ }
10697
+ }
10698
+ }
10699
+ return false;
10418
10700
  }
10419
10701
 
10420
10702
  /**
@@ -11210,34 +11492,19 @@ class LContainerDebug {
11210
11492
  return toDebug(this._raw_lContainer[PARENT]);
11211
11493
  }
11212
11494
  get movedViews() {
11213
- return this._raw_lContainer[MOVED_VIEWS];
11214
- }
11215
- get host() {
11216
- return this._raw_lContainer[HOST];
11217
- }
11218
- get native() {
11219
- return this._raw_lContainer[NATIVE];
11220
- }
11221
- get next() {
11222
- return toDebug(this._raw_lContainer[NEXT]);
11223
- }
11224
- }
11225
-
11226
- let shouldThrowErrorOnUnknownProperty = false;
11227
- /**
11228
- * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
11229
- * instead of just logging the error.
11230
- * (for AOT-compiled ones this check happens at build time).
11231
- */
11232
- function ɵsetUnknownPropertyStrictMode(shouldThrow) {
11233
- shouldThrowErrorOnUnknownProperty = shouldThrow;
11234
- }
11235
- /**
11236
- * Gets the current value of the strict mode.
11237
- */
11238
- function ɵgetUnknownPropertyStrictMode() {
11239
- return shouldThrowErrorOnUnknownProperty;
11495
+ return this._raw_lContainer[MOVED_VIEWS];
11496
+ }
11497
+ get host() {
11498
+ return this._raw_lContainer[HOST];
11499
+ }
11500
+ get native() {
11501
+ return this._raw_lContainer[NATIVE];
11502
+ }
11503
+ get next() {
11504
+ return toDebug(this._raw_lContainer[NEXT]);
11505
+ }
11240
11506
  }
11507
+
11241
11508
  /**
11242
11509
  * A permanent marker promise which signifies that the current CD tree is
11243
11510
  * clean.
@@ -11396,56 +11663,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
11396
11663
  }
11397
11664
  return tNode;
11398
11665
  }
11399
- /**
11400
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11401
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11402
- * be too slow for production mode and also it relies on the constructor function being available.
11403
- *
11404
- * Gets a reference to the host component def (where a current component is declared).
11405
- *
11406
- * @param lView An `LView` that represents a current component that is being rendered.
11407
- */
11408
- function getDeclarationComponentDef(lView) {
11409
- !ngDevMode && throwError('Must never be called in production mode');
11410
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
11411
- const context = declarationLView[CONTEXT];
11412
- // Unable to obtain a context.
11413
- if (!context)
11414
- return null;
11415
- return context.constructor ? getComponentDef(context.constructor) : null;
11416
- }
11417
- /**
11418
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11419
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11420
- * be too slow for production mode.
11421
- *
11422
- * Checks if the current component is declared inside of a standalone component template.
11423
- *
11424
- * @param lView An `LView` that represents a current component that is being rendered.
11425
- */
11426
- function isHostComponentStandalone(lView) {
11427
- !ngDevMode && throwError('Must never be called in production mode');
11428
- const componentDef = getDeclarationComponentDef(lView);
11429
- // Treat host component as non-standalone if we can't obtain the def.
11430
- return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
11431
- }
11432
- /**
11433
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11434
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11435
- * be too slow for production mode.
11436
- *
11437
- * Constructs a string describing the location of the host component template. The function is used
11438
- * in dev mode to produce error messages.
11439
- *
11440
- * @param lView An `LView` that represents a current component that is being rendered.
11441
- */
11442
- function getTemplateLocationDetails(lView) {
11443
- var _a;
11444
- !ngDevMode && throwError('Must never be called in production mode');
11445
- const hostComponentDef = getDeclarationComponentDef(lView);
11446
- const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
11447
- return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
11448
- }
11449
11666
  /**
11450
11667
  * When elements are created dynamically after a view blueprint is created (e.g. through
11451
11668
  * i18nApply()), we need to adjust the blueprint for future
@@ -12112,10 +12329,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12112
12329
  propName = mapPropName(propName);
12113
12330
  if (ngDevMode) {
12114
12331
  validateAgainstEventProperties(propName);
12115
- if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
12116
- // Return here since we only log warnings for unknown properties.
12117
- handleUnknownPropertyError(propName, tNode, lView);
12118
- return;
12332
+ if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
12333
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12119
12334
  }
12120
12335
  ngDevMode.rendererSetProperty++;
12121
12336
  }
@@ -12134,7 +12349,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12134
12349
  // If the node is a container and the property didn't
12135
12350
  // match any of the inputs or schemas we should throw.
12136
12351
  if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
12137
- handleUnknownPropertyError(propName, tNode, lView);
12352
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12138
12353
  }
12139
12354
  }
12140
12355
  }
@@ -12186,116 +12401,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12186
12401
  }
12187
12402
  }
12188
12403
  }
12189
- /**
12190
- * Validates that the property of the element is known at runtime and returns
12191
- * false if it's not the case.
12192
- * This check is relevant for JIT-compiled components (for AOT-compiled
12193
- * ones this check happens at build time).
12194
- *
12195
- * The property is considered known if either:
12196
- * - it's a known property of the element
12197
- * - the element is allowed by one of the schemas
12198
- * - the property is used for animations
12199
- *
12200
- * @param element Element to validate
12201
- * @param tagName Name of the tag to check
12202
- * @param propName Name of the property to check
12203
- * @param schemas Array of schemas
12204
- */
12205
- function validateProperty(element, tagName, propName, schemas) {
12206
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
12207
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
12208
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
12209
- // execute the check below.
12210
- if (schemas === null)
12211
- return true;
12212
- // The property is considered valid if the element matches the schema, it exists on the element,
12213
- // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
12214
- if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
12215
- return true;
12216
- }
12217
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
12218
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
12219
- return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
12220
- }
12221
- /**
12222
- * Returns true if the tag name is allowed by specified schemas.
12223
- * @param schemas Array of schemas
12224
- * @param tagName Name of the tag
12225
- */
12226
- function matchingSchemas(schemas, tagName) {
12227
- if (schemas !== null) {
12228
- for (let i = 0; i < schemas.length; i++) {
12229
- const schema = schemas[i];
12230
- if (schema === NO_ERRORS_SCHEMA ||
12231
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
12232
- return true;
12233
- }
12234
- }
12235
- }
12236
- return false;
12237
- }
12238
- /**
12239
- * The set of known control flow directives.
12240
- * We use this set to produce a more precises error message with a note
12241
- * that the `CommonModule` should also be included.
12242
- */
12243
- const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
12244
- /**
12245
- * Logs or throws an error that a property is not supported on an element.
12246
- *
12247
- * @param propName Name of the invalid property.
12248
- * @param tNode A `TNode` that represents a current component that is being rendered.
12249
- * @param lView An `LView` that represents a current component that is being rendered.
12250
- */
12251
- function handleUnknownPropertyError(propName, tNode, lView) {
12252
- let tagName = tNode.value;
12253
- // Special-case a situation when a structural directive is applied to
12254
- // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
12255
- // In this case the compiler generates the `ɵɵtemplate` instruction with
12256
- // the `null` as the tagName. The directive matching logic at runtime relies
12257
- // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
12258
- // a default value of the `tNode.value` is not feasible at this moment.
12259
- if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
12260
- tagName = 'ng-template';
12261
- }
12262
- const isHostStandalone = isHostComponentStandalone(lView);
12263
- const templateLocation = getTemplateLocationDetails(lView);
12264
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
12265
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
12266
- const importLocation = isHostStandalone ?
12267
- 'included in the \'@Component.imports\' of this component' :
12268
- 'a part of an @NgModule where this component is declared';
12269
- if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
12270
- // Most likely this is a control flow directive (such as `*ngIf`) used in
12271
- // a template, but the `CommonModule` is not imported.
12272
- message += `\nIf the '${propName}' is an Angular control flow directive, ` +
12273
- `please make sure that the 'CommonModule' is ${importLocation}.`;
12274
- }
12275
- else {
12276
- // May be an Angular component, which is not imported/declared?
12277
- message += `\n1. If '${tagName}' is an Angular component and it has the ` +
12278
- `'${propName}' input, then verify that it is ${importLocation}.`;
12279
- // May be a Web Component?
12280
- if (tagName && tagName.indexOf('-') > -1) {
12281
- message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
12282
- `to the ${schemas} of this component to suppress this message.`;
12283
- message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12284
- `the ${schemas} of this component.`;
12285
- }
12286
- else {
12287
- // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
12288
- message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12289
- `the ${schemas} of this component.`;
12290
- }
12291
- }
12292
- if (shouldThrowErrorOnUnknownProperty) {
12293
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
12294
- }
12295
- else {
12296
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
12297
- }
12298
- }
12299
12404
  /**
12300
12405
  * Instantiate a root component.
12301
12406
  */
@@ -13869,7 +13974,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
13869
13974
  const component = instantiateRootComponent(tView, rootLView, componentDef);
13870
13975
  rootContext.components.push(component);
13871
13976
  componentView[CONTEXT] = component;
13872
- hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
13977
+ if (hostFeatures !== null) {
13978
+ for (const feature of hostFeatures) {
13979
+ feature(component, componentDef);
13980
+ }
13981
+ }
13873
13982
  // We want to generate an empty QueryList for root content queries for backwards
13874
13983
  // compatibility with ViewEngine.
13875
13984
  if (componentDef.contentQueries) {
@@ -13910,13 +14019,10 @@ function createRootContext(scheduler, playerHandler) {
13910
14019
  * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13911
14020
  * ```
13912
14021
  */
13913
- function LifecycleHooksFeature(component, def) {
13914
- const lView = readPatchedLView(component);
13915
- ngDevMode && assertDefined(lView, 'LView is required');
13916
- const tView = lView[TVIEW];
14022
+ function LifecycleHooksFeature() {
13917
14023
  const tNode = getCurrentTNode();
13918
14024
  ngDevMode && assertDefined(tNode, 'TNode is required');
13919
- registerPostOrderHooks(tView, tNode);
14025
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13920
14026
  }
13921
14027
  /**
13922
14028
  * Wait on component until it is rendered.
@@ -15051,21 +15157,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
15051
15157
  * Use of this source code is governed by an MIT-style license that can be
15052
15158
  * found in the LICENSE file at https://angular.io/license
15053
15159
  */
15054
- let shouldThrowErrorOnUnknownElement = false;
15055
- /**
15056
- * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
15057
- * instead of just logging the error.
15058
- * (for AOT-compiled ones this check happens at build time).
15059
- */
15060
- function ɵsetUnknownElementStrictMode(shouldThrow) {
15061
- shouldThrowErrorOnUnknownElement = shouldThrow;
15062
- }
15063
- /**
15064
- * Gets the current value of the strict mode.
15065
- */
15066
- function ɵgetUnknownElementStrictMode() {
15067
- return shouldThrowErrorOnUnknownElement;
15068
- }
15069
15160
  function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
15070
15161
  ngDevMode && assertFirstCreatePass(tView);
15071
15162
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -15199,67 +15290,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
15199
15290
  ɵɵelementEnd();
15200
15291
  return ɵɵelement;
15201
15292
  }
15202
- /**
15203
- * Validates that the element is known at runtime and produces
15204
- * an error if it's not the case.
15205
- * This check is relevant for JIT-compiled components (for AOT-compiled
15206
- * ones this check happens at build time).
15207
- *
15208
- * The element is considered known if either:
15209
- * - it's a known HTML element
15210
- * - it's a known custom element
15211
- * - the element matches any directive
15212
- * - the element is allowed by one of the schemas
15213
- *
15214
- * @param element Element to validate
15215
- * @param lView An `LView` that represents a current component that is being rendered.
15216
- * @param tagName Name of the tag to check
15217
- * @param schemas Array of schemas
15218
- * @param hasDirectives Boolean indicating that the element matches any directive
15219
- */
15220
- function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
15221
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
15222
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
15223
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
15224
- // execute the check below.
15225
- if (schemas === null)
15226
- return;
15227
- // If the element matches any directive, it's considered as valid.
15228
- if (!hasDirectives && tagName !== null) {
15229
- // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
15230
- // as a custom element. Note that unknown elements with a dash in their name won't be instances
15231
- // of HTMLUnknownElement in browsers that support web components.
15232
- const isUnknown =
15233
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
15234
- // because while most browsers return 'function', IE returns 'object'.
15235
- (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
15236
- element instanceof HTMLUnknownElement) ||
15237
- (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
15238
- !customElements.get(tagName));
15239
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
15240
- const isHostStandalone = isHostComponentStandalone(lView);
15241
- const templateLocation = getTemplateLocationDetails(lView);
15242
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
15243
- let message = `'${tagName}' is not a known element${templateLocation}:\n`;
15244
- message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
15245
- 'a part of an @NgModule where this component is declared'}.\n`;
15246
- if (tagName && tagName.indexOf('-') > -1) {
15247
- message +=
15248
- `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
15249
- }
15250
- else {
15251
- message +=
15252
- `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
15253
- }
15254
- if (shouldThrowErrorOnUnknownElement) {
15255
- throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
15256
- }
15257
- else {
15258
- console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
15259
- }
15260
- }
15261
- }
15262
- }
15263
15293
 
15264
15294
  /**
15265
15295
  * @license
@@ -21742,7 +21772,7 @@ class Version {
21742
21772
  /**
21743
21773
  * @publicApi
21744
21774
  */
21745
- const VERSION = new Version('14.0.0-rc.3');
21775
+ const VERSION = new Version('14.0.2');
21746
21776
 
21747
21777
  /**
21748
21778
  * @license
@@ -22414,6 +22444,7 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22414
22444
  * Create a new environment injector.
22415
22445
  *
22416
22446
  * @publicApi
22447
+ * @developerPreview
22417
22448
  */
22418
22449
  function createEnvironmentInjector(providers, parent = null, debugName = null) {
22419
22450
  const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
@@ -22441,14 +22472,14 @@ class StandaloneService {
22441
22472
  if (!componentDef.standalone) {
22442
22473
  return null;
22443
22474
  }
22444
- if (!this.cachedInjectors.has(componentDef)) {
22475
+ if (!this.cachedInjectors.has(componentDef.id)) {
22445
22476
  const providers = internalImportProvidersFrom(false, componentDef.type);
22446
22477
  const standaloneInjector = providers.length > 0 ?
22447
22478
  createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22448
22479
  null;
22449
- this.cachedInjectors.set(componentDef, standaloneInjector);
22480
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
22450
22481
  }
22451
- return this.cachedInjectors.get(componentDef);
22482
+ return this.cachedInjectors.get(componentDef.id);
22452
22483
  }
22453
22484
  ngOnDestroy() {
22454
22485
  try {
@@ -22948,13 +22979,26 @@ function getPipeDef(name, registry) {
22948
22979
  }
22949
22980
  }
22950
22981
  if (ngDevMode) {
22951
- const lView = getLView();
22952
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22953
- const context = declarationLView[CONTEXT];
22954
- const component = context ? ` in the '${context.constructor.name}' component` : '';
22955
- throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22982
+ throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
22956
22983
  }
22957
22984
  }
22985
+ /**
22986
+ * Generates a helpful error message for the user when a pipe is not found.
22987
+ *
22988
+ * @param name Name of the missing pipe
22989
+ * @returns The error message
22990
+ */
22991
+ function getPipeNotFoundErrorMessage(name) {
22992
+ const lView = getLView();
22993
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22994
+ const context = declarationLView[CONTEXT];
22995
+ const hostIsStandalone = isHostComponentStandalone(lView);
22996
+ const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
22997
+ const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
22998
+ 'declared or imported in this module'}`;
22999
+ const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
23000
+ return errorMessage;
23001
+ }
22958
23002
  /**
22959
23003
  * Invokes a pipe with 1 arguments.
22960
23004
  *
@@ -24769,6 +24813,7 @@ function setScopeOnDeclaredComponents(moduleType, ngModule) {
24769
24813
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
24770
24814
  const transitiveScopes = transitiveScopesFor(moduleType);
24771
24815
  declarations.forEach(declaration => {
24816
+ declaration = resolveForwardRef(declaration);
24772
24817
  if (declaration.hasOwnProperty(NG_COMP_DEF)) {
24773
24818
  // A `ɵcmp` field exists - go ahead and patch the component directly.
24774
24819
  const component = declaration;
@@ -24799,7 +24844,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
24799
24844
  }
24800
24845
  /**
24801
24846
  * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
24802
- * (eaither a NgModule or a standalone component / directive / pipe).
24847
+ * (either a NgModule or a standalone component / directive / pipe).
24803
24848
  */
24804
24849
  function transitiveScopesFor(type) {
24805
24850
  if (isNgModule(type)) {