@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/fesm2020/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));
@@ -1940,7 +1943,6 @@ function getLView() {
1940
1943
  function getTView() {
1941
1944
  return instructionState.lFrame.tView;
1942
1945
  }
1943
- // TODO(crisbeto): revert the @noinline once Closure issue is resolved.
1944
1946
  /**
1945
1947
  * Restores `contextViewData` to the given OpaqueViewState instance.
1946
1948
  *
@@ -1952,7 +1954,6 @@ function getTView() {
1952
1954
  * @returns Context of the restored OpaqueViewState instance.
1953
1955
  *
1954
1956
  * @codeGenApi
1955
- * @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
1956
1957
  */
1957
1958
  function ɵɵrestoreView(viewToRestore) {
1958
1959
  instructionState.lFrame.contextLView = viewToRestore;
@@ -6349,6 +6350,155 @@ function getSanitizer() {
6349
6350
  return lView && lView[SANITIZER];
6350
6351
  }
6351
6352
 
6353
+ /**
6354
+ * @license
6355
+ * Copyright Google LLC All Rights Reserved.
6356
+ *
6357
+ * Use of this source code is governed by an MIT-style license that can be
6358
+ * found in the LICENSE file at https://angular.io/license
6359
+ */
6360
+ const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6361
+ function wrappedError(message, originalError) {
6362
+ const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6363
+ const error = Error(msg);
6364
+ error[ERROR_ORIGINAL_ERROR] = originalError;
6365
+ return error;
6366
+ }
6367
+ function getOriginalError(error) {
6368
+ return error[ERROR_ORIGINAL_ERROR];
6369
+ }
6370
+
6371
+ /**
6372
+ * @license
6373
+ * Copyright Google LLC All Rights Reserved.
6374
+ *
6375
+ * Use of this source code is governed by an MIT-style license that can be
6376
+ * found in the LICENSE file at https://angular.io/license
6377
+ */
6378
+ /**
6379
+ * Provides a hook for centralized exception handling.
6380
+ *
6381
+ * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6382
+ * intercept error handling, write a custom exception handler that replaces this default as
6383
+ * appropriate for your app.
6384
+ *
6385
+ * @usageNotes
6386
+ * ### Example
6387
+ *
6388
+ * ```
6389
+ * class MyErrorHandler implements ErrorHandler {
6390
+ * handleError(error) {
6391
+ * // do something with the exception
6392
+ * }
6393
+ * }
6394
+ *
6395
+ * @NgModule({
6396
+ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6397
+ * })
6398
+ * class MyModule {}
6399
+ * ```
6400
+ *
6401
+ * @publicApi
6402
+ */
6403
+ class ErrorHandler {
6404
+ constructor() {
6405
+ /**
6406
+ * @internal
6407
+ */
6408
+ this._console = console;
6409
+ }
6410
+ handleError(error) {
6411
+ const originalError = this._findOriginalError(error);
6412
+ this._console.error('ERROR', error);
6413
+ if (originalError) {
6414
+ this._console.error('ORIGINAL ERROR', originalError);
6415
+ }
6416
+ }
6417
+ /** @internal */
6418
+ _findOriginalError(error) {
6419
+ let e = error && getOriginalError(error);
6420
+ while (e && getOriginalError(e)) {
6421
+ e = getOriginalError(e);
6422
+ }
6423
+ return e || null;
6424
+ }
6425
+ }
6426
+
6427
+ /**
6428
+ * @license
6429
+ * Copyright Google LLC All Rights Reserved.
6430
+ *
6431
+ * Use of this source code is governed by an MIT-style license that can be
6432
+ * found in the LICENSE file at https://angular.io/license
6433
+ */
6434
+ /**
6435
+ * Disallowed strings in the comment.
6436
+ *
6437
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6438
+ */
6439
+ const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6440
+ /**
6441
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6442
+ */
6443
+ const COMMENT_DELIMITER = /(<|>)/;
6444
+ const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6445
+ /**
6446
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
6447
+ *
6448
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6449
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6450
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6451
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6452
+ *
6453
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6454
+ *
6455
+ * ```
6456
+ * div.innerHTML = div.innerHTML
6457
+ * ```
6458
+ *
6459
+ * One would expect that the above code would be safe to do, but it turns out that because comment
6460
+ * text is not escaped, the comment may contain text which will prematurely close the comment
6461
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6462
+ * may contain such text and expect them to be safe.)
6463
+ *
6464
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6465
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6466
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6467
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
6468
+ *
6469
+ * @param value text to make safe for comment node by escaping the comment open/close character
6470
+ * sequence.
6471
+ */
6472
+ function escapeCommentText(value) {
6473
+ return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6474
+ }
6475
+
6476
+ /**
6477
+ * @license
6478
+ * Copyright Google LLC All Rights Reserved.
6479
+ *
6480
+ * Use of this source code is governed by an MIT-style license that can be
6481
+ * found in the LICENSE file at https://angular.io/license
6482
+ */
6483
+ function normalizeDebugBindingName(name) {
6484
+ // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6485
+ name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6486
+ return `ng-reflect-${name}`;
6487
+ }
6488
+ const CAMEL_CASE_REGEXP = /([A-Z])/g;
6489
+ function camelCaseToDashCase(input) {
6490
+ return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6491
+ }
6492
+ function normalizeDebugBindingValue(value) {
6493
+ try {
6494
+ // Limit the size of the value as otherwise the DOM just gets polluted.
6495
+ return value != null ? value.toString().slice(0, 30) : value;
6496
+ }
6497
+ catch (e) {
6498
+ return '[ERROR] Exception while trying to serialize the value';
6499
+ }
6500
+ }
6501
+
6352
6502
  /**
6353
6503
  * @license
6354
6504
  * Copyright Google LLC All Rights Reserved.
@@ -6705,215 +6855,25 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
6705
6855
  }
6706
6856
  function getComponentAtNodeIndex(nodeIndex, lView) {
6707
6857
  const tNode = lView[TVIEW].data[nodeIndex];
6708
- let directiveStartIndex = tNode.directiveStart;
6709
- return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6710
- }
6711
- /**
6712
- * Returns a map of local references (local reference name => element or directive instance) that
6713
- * exist on a given element.
6714
- */
6715
- function discoverLocalRefs(lView, nodeIndex) {
6716
- const tNode = lView[TVIEW].data[nodeIndex];
6717
- if (tNode && tNode.localNames) {
6718
- const result = {};
6719
- let localIndex = tNode.index + 1;
6720
- for (let i = 0; i < tNode.localNames.length; i += 2) {
6721
- result[tNode.localNames[i]] = lView[localIndex];
6722
- localIndex++;
6723
- }
6724
- return result;
6725
- }
6726
- return null;
6727
- }
6728
-
6729
- /**
6730
- * @license
6731
- * Copyright Google LLC All Rights Reserved.
6732
- *
6733
- * Use of this source code is governed by an MIT-style license that can be
6734
- * found in the LICENSE file at https://angular.io/license
6735
- */
6736
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6737
- const ERROR_LOGGER = 'ngErrorLogger';
6738
- function wrappedError(message, originalError) {
6739
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6740
- const error = Error(msg);
6741
- error[ERROR_ORIGINAL_ERROR] = originalError;
6742
- return error;
6743
- }
6744
- function getOriginalError(error) {
6745
- return error[ERROR_ORIGINAL_ERROR];
6746
- }
6747
- function getErrorLogger(error) {
6748
- return error && error[ERROR_LOGGER] || defaultErrorLogger;
6749
- }
6750
- function defaultErrorLogger(console, ...values) {
6751
- console.error(...values);
6752
- }
6753
-
6754
- /**
6755
- * @license
6756
- * Copyright Google LLC All Rights Reserved.
6757
- *
6758
- * Use of this source code is governed by an MIT-style license that can be
6759
- * found in the LICENSE file at https://angular.io/license
6760
- */
6761
- /**
6762
- * Provides a hook for centralized exception handling.
6763
- *
6764
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6765
- * intercept error handling, write a custom exception handler that replaces this default as
6766
- * appropriate for your app.
6767
- *
6768
- * @usageNotes
6769
- * ### Example
6770
- *
6771
- * ```
6772
- * class MyErrorHandler implements ErrorHandler {
6773
- * handleError(error) {
6774
- * // do something with the exception
6775
- * }
6776
- * }
6777
- *
6778
- * @NgModule({
6779
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6780
- * })
6781
- * class MyModule {}
6782
- * ```
6783
- *
6784
- * @publicApi
6785
- */
6786
- class ErrorHandler {
6787
- constructor() {
6788
- /**
6789
- * @internal
6790
- */
6791
- this._console = console;
6792
- }
6793
- handleError(error) {
6794
- const originalError = this._findOriginalError(error);
6795
- // Note: Browser consoles show the place from where console.error was called.
6796
- // We can use this to give users additional information about the error.
6797
- const errorLogger = getErrorLogger(error);
6798
- errorLogger(this._console, `ERROR`, error);
6799
- if (originalError) {
6800
- errorLogger(this._console, `ORIGINAL ERROR`, originalError);
6801
- }
6802
- }
6803
- /** @internal */
6804
- _findOriginalError(error) {
6805
- let e = error && getOriginalError(error);
6806
- while (e && getOriginalError(e)) {
6807
- e = getOriginalError(e);
6808
- }
6809
- return e || null;
6810
- }
6811
- }
6812
-
6813
- /**
6814
- * @license
6815
- * Copyright Google LLC All Rights Reserved.
6816
- *
6817
- * Use of this source code is governed by an MIT-style license that can be
6818
- * found in the LICENSE file at https://angular.io/license
6819
- */
6820
- /**
6821
- * Defines a schema that allows an NgModule to contain the following:
6822
- * - Non-Angular elements named with dash case (`-`).
6823
- * - Element properties named with dash case (`-`).
6824
- * Dash case is the naming convention for custom elements.
6825
- *
6826
- * @publicApi
6827
- */
6828
- const CUSTOM_ELEMENTS_SCHEMA = {
6829
- name: 'custom-elements'
6830
- };
6831
- /**
6832
- * Defines a schema that allows any property on any element.
6833
- *
6834
- * This schema allows you to ignore the errors related to any unknown elements or properties in a
6835
- * template. The usage of this schema is generally discouraged because it prevents useful validation
6836
- * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
6837
- *
6838
- * @publicApi
6839
- */
6840
- const NO_ERRORS_SCHEMA = {
6841
- name: 'no-errors-schema'
6842
- };
6843
-
6844
- /**
6845
- * @license
6846
- * Copyright Google LLC All Rights Reserved.
6847
- *
6848
- * Use of this source code is governed by an MIT-style license that can be
6849
- * found in the LICENSE file at https://angular.io/license
6850
- */
6851
- /**
6852
- * Disallowed strings in the comment.
6853
- *
6854
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6855
- */
6856
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6857
- /**
6858
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6859
- */
6860
- const COMMENT_DELIMITER = /(<|>)/;
6861
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6862
- /**
6863
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
6864
- *
6865
- * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6866
- * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6867
- * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6868
- * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6869
- *
6870
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6871
- *
6872
- * ```
6873
- * div.innerHTML = div.innerHTML
6874
- * ```
6875
- *
6876
- * One would expect that the above code would be safe to do, but it turns out that because comment
6877
- * text is not escaped, the comment may contain text which will prematurely close the comment
6878
- * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6879
- * may contain such text and expect them to be safe.)
6880
- *
6881
- * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6882
- * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6883
- * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6884
- * text it will render normally but it will not cause the HTML parser to close/open the comment.
6885
- *
6886
- * @param value text to make safe for comment node by escaping the comment open/close character
6887
- * sequence.
6888
- */
6889
- function escapeCommentText(value) {
6890
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6891
- }
6892
-
6893
- /**
6894
- * @license
6895
- * Copyright Google LLC All Rights Reserved.
6896
- *
6897
- * Use of this source code is governed by an MIT-style license that can be
6898
- * found in the LICENSE file at https://angular.io/license
6899
- */
6900
- function normalizeDebugBindingName(name) {
6901
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6902
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6903
- return `ng-reflect-${name}`;
6904
- }
6905
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
6906
- function camelCaseToDashCase(input) {
6907
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6908
- }
6909
- function normalizeDebugBindingValue(value) {
6910
- try {
6911
- // Limit the size of the value as otherwise the DOM just gets polluted.
6912
- return value != null ? value.toString().slice(0, 30) : value;
6913
- }
6914
- catch (e) {
6915
- return '[ERROR] Exception while trying to serialize the value';
6858
+ let directiveStartIndex = tNode.directiveStart;
6859
+ return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6860
+ }
6861
+ /**
6862
+ * Returns a map of local references (local reference name => element or directive instance) that
6863
+ * exist on a given element.
6864
+ */
6865
+ function discoverLocalRefs(lView, nodeIndex) {
6866
+ const tNode = lView[TVIEW].data[nodeIndex];
6867
+ if (tNode && tNode.localNames) {
6868
+ const result = {};
6869
+ let localIndex = tNode.index + 1;
6870
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
6871
+ result[tNode.localNames[i]] = lView[localIndex];
6872
+ localIndex++;
6873
+ }
6874
+ return result;
6916
6875
  }
6876
+ return null;
6917
6877
  }
6918
6878
 
6919
6879
  /**
@@ -8873,8 +8833,38 @@ const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
8873
8833
  * another environment injector (such as a route injector). They should not be used in component
8874
8834
  * providers.
8875
8835
  *
8876
- * @returns The collected providers from the specified list of types.
8836
+ * More information about standalone components can be found in [this
8837
+ * guide](guide/standalone-components).
8838
+ *
8839
+ * @usageNotes
8840
+ * The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:
8841
+ *
8842
+ * ```typescript
8843
+ * await bootstrapApplication(RootComponent, {
8844
+ * providers: [
8845
+ * importProvidersFrom(NgModuleOne, NgModuleTwo)
8846
+ * ]
8847
+ * });
8848
+ * ```
8849
+ *
8850
+ * You can also use the `importProvidersFrom` results in the `providers` field of a route, when a
8851
+ * standalone component is used:
8852
+ *
8853
+ * ```typescript
8854
+ * export const ROUTES: Route[] = [
8855
+ * {
8856
+ * path: 'foo',
8857
+ * providers: [
8858
+ * importProvidersFrom(NgModuleOne, NgModuleTwo)
8859
+ * ],
8860
+ * component: YourStandaloneComponent
8861
+ * }
8862
+ * ];
8863
+ * ```
8864
+ *
8865
+ * @returns Collected providers from the specified list of types.
8877
8866
  * @publicApi
8867
+ * @developerPreview
8878
8868
  */
8879
8869
  function importProvidersFrom(...sources) {
8880
8870
  return { ɵproviders: internalImportProvidersFrom(true, sources) };
@@ -9152,6 +9142,8 @@ function getNullInjector() {
9152
9142
  /**
9153
9143
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
9154
9144
  * component tree.
9145
+ *
9146
+ * @developerPreview
9155
9147
  */
9156
9148
  class EnvironmentInjector {
9157
9149
  }
@@ -10322,113 +10314,402 @@ class ReflectiveInjector_ {
10322
10314
  return this.objs[i];
10323
10315
  }
10324
10316
  }
10325
- return UNDEFINED;
10317
+ return UNDEFINED;
10318
+ }
10319
+ /** @internal */
10320
+ _throwOrNull(key, notFoundValue) {
10321
+ if (notFoundValue !== THROW_IF_NOT_FOUND) {
10322
+ return notFoundValue;
10323
+ }
10324
+ else {
10325
+ throw noProviderError(this, key);
10326
+ }
10327
+ }
10328
+ /** @internal */
10329
+ _getByKeySelf(key, notFoundValue) {
10330
+ const obj = this._getObjByKeyId(key.id);
10331
+ return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10332
+ }
10333
+ /** @internal */
10334
+ _getByKeyDefault(key, notFoundValue, visibility) {
10335
+ let inj;
10336
+ if (visibility instanceof SkipSelf) {
10337
+ inj = this.parent;
10338
+ }
10339
+ else {
10340
+ inj = this;
10341
+ }
10342
+ while (inj instanceof ReflectiveInjector_) {
10343
+ const inj_ = inj;
10344
+ const obj = inj_._getObjByKeyId(key.id);
10345
+ if (obj !== UNDEFINED)
10346
+ return obj;
10347
+ inj = inj_.parent;
10348
+ }
10349
+ if (inj !== null) {
10350
+ return inj.get(key.token, notFoundValue);
10351
+ }
10352
+ else {
10353
+ return this._throwOrNull(key, notFoundValue);
10354
+ }
10355
+ }
10356
+ get displayName() {
10357
+ const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10358
+ .join(', ');
10359
+ return `ReflectiveInjector(providers: [${providers}])`;
10360
+ }
10361
+ toString() {
10362
+ return this.displayName;
10363
+ }
10364
+ }
10365
+ ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10366
+ function _mapProviders(injector, fn) {
10367
+ const res = [];
10368
+ for (let i = 0; i < injector._providers.length; ++i) {
10369
+ res[i] = fn(injector.getProviderAtIndex(i));
10370
+ }
10371
+ return res;
10372
+ }
10373
+
10374
+ /**
10375
+ * @license
10376
+ * Copyright Google LLC All Rights Reserved.
10377
+ *
10378
+ * Use of this source code is governed by an MIT-style license that can be
10379
+ * found in the LICENSE file at https://angular.io/license
10380
+ */
10381
+
10382
+ /**
10383
+ * @license
10384
+ * Copyright Google LLC All Rights Reserved.
10385
+ *
10386
+ * Use of this source code is governed by an MIT-style license that can be
10387
+ * found in the LICENSE file at https://angular.io/license
10388
+ */
10389
+
10390
+ /**
10391
+ * @license
10392
+ * Copyright Google LLC All Rights Reserved.
10393
+ *
10394
+ * Use of this source code is governed by an MIT-style license that can be
10395
+ * found in the LICENSE file at https://angular.io/license
10396
+ */
10397
+ function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10398
+ const lView = getLView();
10399
+ // Fall back to inject() if view hasn't been created. This situation can happen in tests
10400
+ // if inject utilities are used before bootstrapping.
10401
+ if (lView === null) {
10402
+ // Verify that we will not get into infinite loop.
10403
+ ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10404
+ return ɵɵinject(token, flags);
10405
+ }
10406
+ const tNode = getCurrentTNode();
10407
+ return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10408
+ }
10409
+ /**
10410
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
10411
+ * particular class.
10412
+ *
10413
+ * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10414
+ * off, saving bytes of generated code while still providing a good experience in dev mode.
10415
+ *
10416
+ * The name of the class is not mentioned here, but will be in the generated factory function name
10417
+ * and thus in the stack trace.
10418
+ *
10419
+ * @codeGenApi
10420
+ */
10421
+ function ɵɵinvalidFactory() {
10422
+ const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10423
+ throw new Error(msg);
10424
+ }
10425
+
10426
+ /**
10427
+ * @license
10428
+ * Copyright Google LLC All Rights Reserved.
10429
+ *
10430
+ * Use of this source code is governed by an MIT-style license that can be
10431
+ * found in the LICENSE file at https://angular.io/license
10432
+ */
10433
+ /**
10434
+ * Defines a schema that allows an NgModule to contain the following:
10435
+ * - Non-Angular elements named with dash case (`-`).
10436
+ * - Element properties named with dash case (`-`).
10437
+ * Dash case is the naming convention for custom elements.
10438
+ *
10439
+ * @publicApi
10440
+ */
10441
+ const CUSTOM_ELEMENTS_SCHEMA = {
10442
+ name: 'custom-elements'
10443
+ };
10444
+ /**
10445
+ * Defines a schema that allows any property on any element.
10446
+ *
10447
+ * This schema allows you to ignore the errors related to any unknown elements or properties in a
10448
+ * template. The usage of this schema is generally discouraged because it prevents useful validation
10449
+ * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
10450
+ *
10451
+ * @publicApi
10452
+ */
10453
+ const NO_ERRORS_SCHEMA = {
10454
+ name: 'no-errors-schema'
10455
+ };
10456
+
10457
+ /**
10458
+ * @license
10459
+ * Copyright Google LLC All Rights Reserved.
10460
+ *
10461
+ * Use of this source code is governed by an MIT-style license that can be
10462
+ * found in the LICENSE file at https://angular.io/license
10463
+ */
10464
+ let shouldThrowErrorOnUnknownElement = false;
10465
+ /**
10466
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
10467
+ * instead of just logging the error.
10468
+ * (for AOT-compiled ones this check happens at build time).
10469
+ */
10470
+ function ɵsetUnknownElementStrictMode(shouldThrow) {
10471
+ shouldThrowErrorOnUnknownElement = shouldThrow;
10472
+ }
10473
+ /**
10474
+ * Gets the current value of the strict mode.
10475
+ */
10476
+ function ɵgetUnknownElementStrictMode() {
10477
+ return shouldThrowErrorOnUnknownElement;
10478
+ }
10479
+ let shouldThrowErrorOnUnknownProperty = false;
10480
+ /**
10481
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
10482
+ * instead of just logging the error.
10483
+ * (for AOT-compiled ones this check happens at build time).
10484
+ */
10485
+ function ɵsetUnknownPropertyStrictMode(shouldThrow) {
10486
+ shouldThrowErrorOnUnknownProperty = shouldThrow;
10487
+ }
10488
+ /**
10489
+ * Gets the current value of the strict mode.
10490
+ */
10491
+ function ɵgetUnknownPropertyStrictMode() {
10492
+ return shouldThrowErrorOnUnknownProperty;
10493
+ }
10494
+ /**
10495
+ * Validates that the element is known at runtime and produces
10496
+ * an error if it's not the case.
10497
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10498
+ * ones this check happens at build time).
10499
+ *
10500
+ * The element is considered known if either:
10501
+ * - it's a known HTML element
10502
+ * - it's a known custom element
10503
+ * - the element matches any directive
10504
+ * - the element is allowed by one of the schemas
10505
+ *
10506
+ * @param element Element to validate
10507
+ * @param lView An `LView` that represents a current component that is being rendered
10508
+ * @param tagName Name of the tag to check
10509
+ * @param schemas Array of schemas
10510
+ * @param hasDirectives Boolean indicating that the element matches any directive
10511
+ */
10512
+ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
10513
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10514
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10515
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10516
+ // execute the check below.
10517
+ if (schemas === null)
10518
+ return;
10519
+ // If the element matches any directive, it's considered as valid.
10520
+ if (!hasDirectives && tagName !== null) {
10521
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
10522
+ // as a custom element. Note that unknown elements with a dash in their name won't be instances
10523
+ // of HTMLUnknownElement in browsers that support web components.
10524
+ const isUnknown =
10525
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
10526
+ // because while most browsers return 'function', IE returns 'object'.
10527
+ (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
10528
+ element instanceof HTMLUnknownElement) ||
10529
+ (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
10530
+ !customElements.get(tagName));
10531
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
10532
+ const isHostStandalone = isHostComponentStandalone(lView);
10533
+ const templateLocation = getTemplateLocationDetails(lView);
10534
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10535
+ let message = `'${tagName}' is not a known element${templateLocation}:\n`;
10536
+ message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
10537
+ 'a part of an @NgModule where this component is declared'}.\n`;
10538
+ if (tagName && tagName.indexOf('-') > -1) {
10539
+ message +=
10540
+ `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
10541
+ }
10542
+ else {
10543
+ message +=
10544
+ `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
10545
+ }
10546
+ if (shouldThrowErrorOnUnknownElement) {
10547
+ throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
10548
+ }
10549
+ else {
10550
+ console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
10551
+ }
10552
+ }
10326
10553
  }
10327
- /** @internal */
10328
- _throwOrNull(key, notFoundValue) {
10329
- if (notFoundValue !== THROW_IF_NOT_FOUND) {
10330
- return notFoundValue;
10331
- }
10332
- else {
10333
- throw noProviderError(this, key);
10334
- }
10554
+ }
10555
+ /**
10556
+ * Validates that the property of the element is known at runtime and returns
10557
+ * false if it's not the case.
10558
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10559
+ * ones this check happens at build time).
10560
+ *
10561
+ * The property is considered known if either:
10562
+ * - it's a known property of the element
10563
+ * - the element is allowed by one of the schemas
10564
+ * - the property is used for animations
10565
+ *
10566
+ * @param element Element to validate
10567
+ * @param propName Name of the property to check
10568
+ * @param tagName Name of the tag hosting the property
10569
+ * @param schemas Array of schemas
10570
+ */
10571
+ function isPropertyValid(element, propName, tagName, schemas) {
10572
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10573
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10574
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10575
+ // execute the check below.
10576
+ if (schemas === null)
10577
+ return true;
10578
+ // The property is considered valid if the element matches the schema, it exists on the element,
10579
+ // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
10580
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
10581
+ return true;
10335
10582
  }
10336
- /** @internal */
10337
- _getByKeySelf(key, notFoundValue) {
10338
- const obj = this._getObjByKeyId(key.id);
10339
- return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10583
+ // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
10584
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
10585
+ return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
10586
+ }
10587
+ /**
10588
+ * Logs or throws an error that a property is not supported on an element.
10589
+ *
10590
+ * @param propName Name of the invalid property
10591
+ * @param tagName Name of the tag hosting the property
10592
+ * @param nodeType Type of the node hosting the property
10593
+ * @param lView An `LView` that represents a current component
10594
+ */
10595
+ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
10596
+ // Special-case a situation when a structural directive is applied to
10597
+ // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
10598
+ // In this case the compiler generates the `ɵɵtemplate` instruction with
10599
+ // the `null` as the tagName. The directive matching logic at runtime relies
10600
+ // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
10601
+ // a default value of the `tNode.value` is not feasible at this moment.
10602
+ if (!tagName && nodeType === 4 /* TNodeType.Container */) {
10603
+ tagName = 'ng-template';
10340
10604
  }
10341
- /** @internal */
10342
- _getByKeyDefault(key, notFoundValue, visibility) {
10343
- let inj;
10344
- if (visibility instanceof SkipSelf) {
10345
- inj = this.parent;
10346
- }
10347
- else {
10348
- inj = this;
10349
- }
10350
- while (inj instanceof ReflectiveInjector_) {
10351
- const inj_ = inj;
10352
- const obj = inj_._getObjByKeyId(key.id);
10353
- if (obj !== UNDEFINED)
10354
- return obj;
10355
- inj = inj_.parent;
10356
- }
10357
- if (inj !== null) {
10358
- return inj.get(key.token, notFoundValue);
10605
+ const isHostStandalone = isHostComponentStandalone(lView);
10606
+ const templateLocation = getTemplateLocationDetails(lView);
10607
+ let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
10608
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10609
+ const importLocation = isHostStandalone ?
10610
+ 'included in the \'@Component.imports\' of this component' :
10611
+ 'a part of an @NgModule where this component is declared';
10612
+ if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
10613
+ // Most likely this is a control flow directive (such as `*ngIf`) used in
10614
+ // a template, but the `CommonModule` is not imported.
10615
+ message += `\nIf the '${propName}' is an Angular control flow directive, ` +
10616
+ `please make sure that the 'CommonModule' is ${importLocation}.`;
10617
+ }
10618
+ else {
10619
+ // May be an Angular component, which is not imported/declared?
10620
+ message += `\n1. If '${tagName}' is an Angular component and it has the ` +
10621
+ `'${propName}' input, then verify that it is ${importLocation}.`;
10622
+ // May be a Web Component?
10623
+ if (tagName && tagName.indexOf('-') > -1) {
10624
+ message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
10625
+ `to the ${schemas} of this component to suppress this message.`;
10626
+ message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10627
+ `the ${schemas} of this component.`;
10359
10628
  }
10360
10629
  else {
10361
- return this._throwOrNull(key, notFoundValue);
10630
+ // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
10631
+ message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10632
+ `the ${schemas} of this component.`;
10362
10633
  }
10363
10634
  }
10364
- get displayName() {
10365
- const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10366
- .join(', ');
10367
- return `ReflectiveInjector(providers: [${providers}])`;
10368
- }
10369
- toString() {
10370
- return this.displayName;
10635
+ if (shouldThrowErrorOnUnknownProperty) {
10636
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
10371
10637
  }
10372
- }
10373
- ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10374
- function _mapProviders(injector, fn) {
10375
- const res = [];
10376
- for (let i = 0; i < injector._providers.length; ++i) {
10377
- res[i] = fn(injector.getProviderAtIndex(i));
10638
+ else {
10639
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
10378
10640
  }
10379
- return res;
10380
10641
  }
10381
-
10382
10642
  /**
10383
- * @license
10384
- * Copyright Google LLC All Rights Reserved.
10643
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10644
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10645
+ * be too slow for production mode and also it relies on the constructor function being available.
10385
10646
  *
10386
- * Use of this source code is governed by an MIT-style license that can be
10387
- * found in the LICENSE file at https://angular.io/license
10388
- */
10389
-
10390
- /**
10391
- * @license
10392
- * Copyright Google LLC All Rights Reserved.
10647
+ * Gets a reference to the host component def (where a current component is declared).
10393
10648
  *
10394
- * Use of this source code is governed by an MIT-style license that can be
10395
- * found in the LICENSE file at https://angular.io/license
10649
+ * @param lView An `LView` that represents a current component that is being rendered.
10396
10650
  */
10397
-
10651
+ function getDeclarationComponentDef(lView) {
10652
+ !ngDevMode && throwError('Must never be called in production mode');
10653
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
10654
+ const context = declarationLView[CONTEXT];
10655
+ // Unable to obtain a context.
10656
+ if (!context)
10657
+ return null;
10658
+ return context.constructor ? getComponentDef(context.constructor) : null;
10659
+ }
10398
10660
  /**
10399
- * @license
10400
- * Copyright Google LLC All Rights Reserved.
10661
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10662
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10663
+ * be too slow for production mode.
10401
10664
  *
10402
- * Use of this source code is governed by an MIT-style license that can be
10403
- * found in the LICENSE file at https://angular.io/license
10665
+ * Checks if the current component is declared inside of a standalone component template.
10666
+ *
10667
+ * @param lView An `LView` that represents a current component that is being rendered.
10404
10668
  */
10405
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10406
- const lView = getLView();
10407
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
10408
- // if inject utilities are used before bootstrapping.
10409
- if (lView === null) {
10410
- // Verify that we will not get into infinite loop.
10411
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10412
- return ɵɵinject(token, flags);
10413
- }
10414
- const tNode = getCurrentTNode();
10415
- return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10669
+ function isHostComponentStandalone(lView) {
10670
+ !ngDevMode && throwError('Must never be called in production mode');
10671
+ const componentDef = getDeclarationComponentDef(lView);
10672
+ // Treat host component as non-standalone if we can't obtain the def.
10673
+ return !!componentDef?.standalone;
10416
10674
  }
10417
10675
  /**
10418
- * Throws an error indicating that a factory function could not be generated by the compiler for a
10419
- * particular class.
10420
- *
10421
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10422
- * off, saving bytes of generated code while still providing a good experience in dev mode.
10676
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10677
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10678
+ * be too slow for production mode.
10423
10679
  *
10424
- * The name of the class is not mentioned here, but will be in the generated factory function name
10425
- * and thus in the stack trace.
10680
+ * Constructs a string describing the location of the host component template. The function is used
10681
+ * in dev mode to produce error messages.
10426
10682
  *
10427
- * @codeGenApi
10683
+ * @param lView An `LView` that represents a current component that is being rendered.
10428
10684
  */
10429
- function ɵɵinvalidFactory() {
10430
- const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10431
- throw new Error(msg);
10685
+ function getTemplateLocationDetails(lView) {
10686
+ !ngDevMode && throwError('Must never be called in production mode');
10687
+ const hostComponentDef = getDeclarationComponentDef(lView);
10688
+ const componentClassName = hostComponentDef?.type?.name;
10689
+ return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
10690
+ }
10691
+ /**
10692
+ * The set of known control flow directives.
10693
+ * We use this set to produce a more precises error message with a note
10694
+ * that the `CommonModule` should also be included.
10695
+ */
10696
+ const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
10697
+ /**
10698
+ * Returns true if the tag name is allowed by specified schemas.
10699
+ * @param schemas Array of schemas
10700
+ * @param tagName Name of the tag
10701
+ */
10702
+ function matchingSchemas(schemas, tagName) {
10703
+ if (schemas !== null) {
10704
+ for (let i = 0; i < schemas.length; i++) {
10705
+ const schema = schemas[i];
10706
+ if (schema === NO_ERRORS_SCHEMA ||
10707
+ schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
10708
+ return true;
10709
+ }
10710
+ }
10711
+ }
10712
+ return false;
10432
10713
  }
10433
10714
 
10434
10715
  /**
@@ -11222,36 +11503,21 @@ class LContainerDebug {
11222
11503
  }
11223
11504
  get parent() {
11224
11505
  return toDebug(this._raw_lContainer[PARENT]);
11225
- }
11226
- get movedViews() {
11227
- return this._raw_lContainer[MOVED_VIEWS];
11228
- }
11229
- get host() {
11230
- return this._raw_lContainer[HOST];
11231
- }
11232
- get native() {
11233
- return this._raw_lContainer[NATIVE];
11234
- }
11235
- get next() {
11236
- return toDebug(this._raw_lContainer[NEXT]);
11237
- }
11238
- }
11239
-
11240
- let shouldThrowErrorOnUnknownProperty = false;
11241
- /**
11242
- * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
11243
- * instead of just logging the error.
11244
- * (for AOT-compiled ones this check happens at build time).
11245
- */
11246
- function ɵsetUnknownPropertyStrictMode(shouldThrow) {
11247
- shouldThrowErrorOnUnknownProperty = shouldThrow;
11248
- }
11249
- /**
11250
- * Gets the current value of the strict mode.
11251
- */
11252
- function ɵgetUnknownPropertyStrictMode() {
11253
- return shouldThrowErrorOnUnknownProperty;
11506
+ }
11507
+ get movedViews() {
11508
+ return this._raw_lContainer[MOVED_VIEWS];
11509
+ }
11510
+ get host() {
11511
+ return this._raw_lContainer[HOST];
11512
+ }
11513
+ get native() {
11514
+ return this._raw_lContainer[NATIVE];
11515
+ }
11516
+ get next() {
11517
+ return toDebug(this._raw_lContainer[NEXT]);
11518
+ }
11254
11519
  }
11520
+
11255
11521
  /**
11256
11522
  * A permanent marker promise which signifies that the current CD tree is
11257
11523
  * clean.
@@ -11410,55 +11676,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
11410
11676
  }
11411
11677
  return tNode;
11412
11678
  }
11413
- /**
11414
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11415
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11416
- * be too slow for production mode and also it relies on the constructor function being available.
11417
- *
11418
- * Gets a reference to the host component def (where a current component is declared).
11419
- *
11420
- * @param lView An `LView` that represents a current component that is being rendered.
11421
- */
11422
- function getDeclarationComponentDef(lView) {
11423
- !ngDevMode && throwError('Must never be called in production mode');
11424
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
11425
- const context = declarationLView[CONTEXT];
11426
- // Unable to obtain a context.
11427
- if (!context)
11428
- return null;
11429
- return context.constructor ? getComponentDef(context.constructor) : null;
11430
- }
11431
- /**
11432
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11433
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11434
- * be too slow for production mode.
11435
- *
11436
- * Checks if the current component is declared inside of a standalone component template.
11437
- *
11438
- * @param lView An `LView` that represents a current component that is being rendered.
11439
- */
11440
- function isHostComponentStandalone(lView) {
11441
- !ngDevMode && throwError('Must never be called in production mode');
11442
- const componentDef = getDeclarationComponentDef(lView);
11443
- // Treat host component as non-standalone if we can't obtain the def.
11444
- return !!(componentDef?.standalone);
11445
- }
11446
- /**
11447
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11448
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11449
- * be too slow for production mode.
11450
- *
11451
- * Constructs a string describing the location of the host component template. The function is used
11452
- * in dev mode to produce error messages.
11453
- *
11454
- * @param lView An `LView` that represents a current component that is being rendered.
11455
- */
11456
- function getTemplateLocationDetails(lView) {
11457
- !ngDevMode && throwError('Must never be called in production mode');
11458
- const hostComponentDef = getDeclarationComponentDef(lView);
11459
- const componentClassName = hostComponentDef?.type?.name;
11460
- return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
11461
- }
11462
11679
  /**
11463
11680
  * When elements are created dynamically after a view blueprint is created (e.g. through
11464
11681
  * i18nApply()), we need to adjust the blueprint for future
@@ -12125,10 +12342,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12125
12342
  propName = mapPropName(propName);
12126
12343
  if (ngDevMode) {
12127
12344
  validateAgainstEventProperties(propName);
12128
- if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
12129
- // Return here since we only log warnings for unknown properties.
12130
- handleUnknownPropertyError(propName, tNode, lView);
12131
- return;
12345
+ if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
12346
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12132
12347
  }
12133
12348
  ngDevMode.rendererSetProperty++;
12134
12349
  }
@@ -12147,7 +12362,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12147
12362
  // If the node is a container and the property didn't
12148
12363
  // match any of the inputs or schemas we should throw.
12149
12364
  if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
12150
- handleUnknownPropertyError(propName, tNode, lView);
12365
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12151
12366
  }
12152
12367
  }
12153
12368
  }
@@ -12199,116 +12414,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12199
12414
  }
12200
12415
  }
12201
12416
  }
12202
- /**
12203
- * Validates that the property of the element is known at runtime and returns
12204
- * false if it's not the case.
12205
- * This check is relevant for JIT-compiled components (for AOT-compiled
12206
- * ones this check happens at build time).
12207
- *
12208
- * The property is considered known if either:
12209
- * - it's a known property of the element
12210
- * - the element is allowed by one of the schemas
12211
- * - the property is used for animations
12212
- *
12213
- * @param element Element to validate
12214
- * @param tagName Name of the tag to check
12215
- * @param propName Name of the property to check
12216
- * @param schemas Array of schemas
12217
- */
12218
- function validateProperty(element, tagName, propName, schemas) {
12219
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
12220
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
12221
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
12222
- // execute the check below.
12223
- if (schemas === null)
12224
- return true;
12225
- // The property is considered valid if the element matches the schema, it exists on the element,
12226
- // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
12227
- if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
12228
- return true;
12229
- }
12230
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
12231
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
12232
- return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
12233
- }
12234
- /**
12235
- * Returns true if the tag name is allowed by specified schemas.
12236
- * @param schemas Array of schemas
12237
- * @param tagName Name of the tag
12238
- */
12239
- function matchingSchemas(schemas, tagName) {
12240
- if (schemas !== null) {
12241
- for (let i = 0; i < schemas.length; i++) {
12242
- const schema = schemas[i];
12243
- if (schema === NO_ERRORS_SCHEMA ||
12244
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
12245
- return true;
12246
- }
12247
- }
12248
- }
12249
- return false;
12250
- }
12251
- /**
12252
- * The set of known control flow directives.
12253
- * We use this set to produce a more precises error message with a note
12254
- * that the `CommonModule` should also be included.
12255
- */
12256
- const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
12257
- /**
12258
- * Logs or throws an error that a property is not supported on an element.
12259
- *
12260
- * @param propName Name of the invalid property.
12261
- * @param tNode A `TNode` that represents a current component that is being rendered.
12262
- * @param lView An `LView` that represents a current component that is being rendered.
12263
- */
12264
- function handleUnknownPropertyError(propName, tNode, lView) {
12265
- let tagName = tNode.value;
12266
- // Special-case a situation when a structural directive is applied to
12267
- // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
12268
- // In this case the compiler generates the `ɵɵtemplate` instruction with
12269
- // the `null` as the tagName. The directive matching logic at runtime relies
12270
- // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
12271
- // a default value of the `tNode.value` is not feasible at this moment.
12272
- if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
12273
- tagName = 'ng-template';
12274
- }
12275
- const isHostStandalone = isHostComponentStandalone(lView);
12276
- const templateLocation = getTemplateLocationDetails(lView);
12277
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
12278
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
12279
- const importLocation = isHostStandalone ?
12280
- 'included in the \'@Component.imports\' of this component' :
12281
- 'a part of an @NgModule where this component is declared';
12282
- if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
12283
- // Most likely this is a control flow directive (such as `*ngIf`) used in
12284
- // a template, but the `CommonModule` is not imported.
12285
- message += `\nIf the '${propName}' is an Angular control flow directive, ` +
12286
- `please make sure that the 'CommonModule' is ${importLocation}.`;
12287
- }
12288
- else {
12289
- // May be an Angular component, which is not imported/declared?
12290
- message += `\n1. If '${tagName}' is an Angular component and it has the ` +
12291
- `'${propName}' input, then verify that it is ${importLocation}.`;
12292
- // May be a Web Component?
12293
- if (tagName && tagName.indexOf('-') > -1) {
12294
- message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
12295
- `to the ${schemas} of this component to suppress this message.`;
12296
- message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12297
- `the ${schemas} of this component.`;
12298
- }
12299
- else {
12300
- // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
12301
- message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12302
- `the ${schemas} of this component.`;
12303
- }
12304
- }
12305
- if (shouldThrowErrorOnUnknownProperty) {
12306
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
12307
- }
12308
- else {
12309
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
12310
- }
12311
- }
12312
12417
  /**
12313
12418
  * Instantiate a root component.
12314
12419
  */
@@ -13882,7 +13987,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
13882
13987
  const component = instantiateRootComponent(tView, rootLView, componentDef);
13883
13988
  rootContext.components.push(component);
13884
13989
  componentView[CONTEXT] = component;
13885
- hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
13990
+ if (hostFeatures !== null) {
13991
+ for (const feature of hostFeatures) {
13992
+ feature(component, componentDef);
13993
+ }
13994
+ }
13886
13995
  // We want to generate an empty QueryList for root content queries for backwards
13887
13996
  // compatibility with ViewEngine.
13888
13997
  if (componentDef.contentQueries) {
@@ -13923,13 +14032,10 @@ function createRootContext(scheduler, playerHandler) {
13923
14032
  * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13924
14033
  * ```
13925
14034
  */
13926
- function LifecycleHooksFeature(component, def) {
13927
- const lView = readPatchedLView(component);
13928
- ngDevMode && assertDefined(lView, 'LView is required');
13929
- const tView = lView[TVIEW];
14035
+ function LifecycleHooksFeature() {
13930
14036
  const tNode = getCurrentTNode();
13931
14037
  ngDevMode && assertDefined(tNode, 'TNode is required');
13932
- registerPostOrderHooks(tView, tNode);
14038
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13933
14039
  }
13934
14040
  /**
13935
14041
  * Wait on component until it is rendered.
@@ -15064,21 +15170,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
15064
15170
  * Use of this source code is governed by an MIT-style license that can be
15065
15171
  * found in the LICENSE file at https://angular.io/license
15066
15172
  */
15067
- let shouldThrowErrorOnUnknownElement = false;
15068
- /**
15069
- * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
15070
- * instead of just logging the error.
15071
- * (for AOT-compiled ones this check happens at build time).
15072
- */
15073
- function ɵsetUnknownElementStrictMode(shouldThrow) {
15074
- shouldThrowErrorOnUnknownElement = shouldThrow;
15075
- }
15076
- /**
15077
- * Gets the current value of the strict mode.
15078
- */
15079
- function ɵgetUnknownElementStrictMode() {
15080
- return shouldThrowErrorOnUnknownElement;
15081
- }
15082
15173
  function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
15083
15174
  ngDevMode && assertFirstCreatePass(tView);
15084
15175
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -15212,67 +15303,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
15212
15303
  ɵɵelementEnd();
15213
15304
  return ɵɵelement;
15214
15305
  }
15215
- /**
15216
- * Validates that the element is known at runtime and produces
15217
- * an error if it's not the case.
15218
- * This check is relevant for JIT-compiled components (for AOT-compiled
15219
- * ones this check happens at build time).
15220
- *
15221
- * The element is considered known if either:
15222
- * - it's a known HTML element
15223
- * - it's a known custom element
15224
- * - the element matches any directive
15225
- * - the element is allowed by one of the schemas
15226
- *
15227
- * @param element Element to validate
15228
- * @param lView An `LView` that represents a current component that is being rendered.
15229
- * @param tagName Name of the tag to check
15230
- * @param schemas Array of schemas
15231
- * @param hasDirectives Boolean indicating that the element matches any directive
15232
- */
15233
- function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
15234
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
15235
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
15236
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
15237
- // execute the check below.
15238
- if (schemas === null)
15239
- return;
15240
- // If the element matches any directive, it's considered as valid.
15241
- if (!hasDirectives && tagName !== null) {
15242
- // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
15243
- // as a custom element. Note that unknown elements with a dash in their name won't be instances
15244
- // of HTMLUnknownElement in browsers that support web components.
15245
- const isUnknown =
15246
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
15247
- // because while most browsers return 'function', IE returns 'object'.
15248
- (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
15249
- element instanceof HTMLUnknownElement) ||
15250
- (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
15251
- !customElements.get(tagName));
15252
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
15253
- const isHostStandalone = isHostComponentStandalone(lView);
15254
- const templateLocation = getTemplateLocationDetails(lView);
15255
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
15256
- let message = `'${tagName}' is not a known element${templateLocation}:\n`;
15257
- message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
15258
- 'a part of an @NgModule where this component is declared'}.\n`;
15259
- if (tagName && tagName.indexOf('-') > -1) {
15260
- message +=
15261
- `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
15262
- }
15263
- else {
15264
- message +=
15265
- `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
15266
- }
15267
- if (shouldThrowErrorOnUnknownElement) {
15268
- throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
15269
- }
15270
- else {
15271
- console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
15272
- }
15273
- }
15274
- }
15275
- }
15276
15306
 
15277
15307
  /**
15278
15308
  * @license
@@ -21755,7 +21785,7 @@ class Version {
21755
21785
  /**
21756
21786
  * @publicApi
21757
21787
  */
21758
- const VERSION = new Version('14.0.0-rc.3');
21788
+ const VERSION = new Version('14.0.2');
21759
21789
 
21760
21790
  /**
21761
21791
  * @license
@@ -22427,6 +22457,7 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22427
22457
  * Create a new environment injector.
22428
22458
  *
22429
22459
  * @publicApi
22460
+ * @developerPreview
22430
22461
  */
22431
22462
  function createEnvironmentInjector(providers, parent = null, debugName = null) {
22432
22463
  const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
@@ -22454,14 +22485,14 @@ class StandaloneService {
22454
22485
  if (!componentDef.standalone) {
22455
22486
  return null;
22456
22487
  }
22457
- if (!this.cachedInjectors.has(componentDef)) {
22488
+ if (!this.cachedInjectors.has(componentDef.id)) {
22458
22489
  const providers = internalImportProvidersFrom(false, componentDef.type);
22459
22490
  const standaloneInjector = providers.length > 0 ?
22460
22491
  createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22461
22492
  null;
22462
- this.cachedInjectors.set(componentDef, standaloneInjector);
22493
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
22463
22494
  }
22464
- return this.cachedInjectors.get(componentDef);
22495
+ return this.cachedInjectors.get(componentDef.id);
22465
22496
  }
22466
22497
  ngOnDestroy() {
22467
22498
  try {
@@ -22961,13 +22992,26 @@ function getPipeDef(name, registry) {
22961
22992
  }
22962
22993
  }
22963
22994
  if (ngDevMode) {
22964
- const lView = getLView();
22965
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22966
- const context = declarationLView[CONTEXT];
22967
- const component = context ? ` in the '${context.constructor.name}' component` : '';
22968
- throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22995
+ throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
22969
22996
  }
22970
22997
  }
22998
+ /**
22999
+ * Generates a helpful error message for the user when a pipe is not found.
23000
+ *
23001
+ * @param name Name of the missing pipe
23002
+ * @returns The error message
23003
+ */
23004
+ function getPipeNotFoundErrorMessage(name) {
23005
+ const lView = getLView();
23006
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
23007
+ const context = declarationLView[CONTEXT];
23008
+ const hostIsStandalone = isHostComponentStandalone(lView);
23009
+ const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
23010
+ const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
23011
+ 'declared or imported in this module'}`;
23012
+ const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
23013
+ return errorMessage;
23014
+ }
22971
23015
  /**
22972
23016
  * Invokes a pipe with 1 arguments.
22973
23017
  *
@@ -24781,6 +24825,7 @@ function setScopeOnDeclaredComponents(moduleType, ngModule) {
24781
24825
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
24782
24826
  const transitiveScopes = transitiveScopesFor(moduleType);
24783
24827
  declarations.forEach(declaration => {
24828
+ declaration = resolveForwardRef(declaration);
24784
24829
  if (declaration.hasOwnProperty(NG_COMP_DEF)) {
24785
24830
  // A `ɵcmp` field exists - go ahead and patch the component directly.
24786
24831
  const component = declaration;
@@ -24811,7 +24856,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
24811
24856
  }
24812
24857
  /**
24813
24858
  * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
24814
- * (eaither a NgModule or a standalone component / directive / pipe).
24859
+ * (either a NgModule or a standalone component / directive / pipe).
24815
24860
  */
24816
24861
  function transitiveScopesFor(type) {
24817
24862
  if (isNgModule(type)) {