@angular/core 14.0.0-rc.2 → 14.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/esm2020/src/di/injector_compatibility.mjs +57 -15
  2. package/esm2020/src/di/interface/provider.mjs +1 -1
  3. package/esm2020/src/di/provider_collection.mjs +32 -2
  4. package/esm2020/src/di/r3_injector.mjs +3 -1
  5. package/esm2020/src/error_handler.mjs +4 -7
  6. package/esm2020/src/errors.mjs +6 -3
  7. package/esm2020/src/metadata/directives.mjs +1 -1
  8. package/esm2020/src/render3/component.mjs +9 -9
  9. package/esm2020/src/render3/definition.mjs +6 -6
  10. package/esm2020/src/render3/features/standalone_feature.mjs +4 -4
  11. package/esm2020/src/render3/instructions/all.mjs +2 -2
  12. package/esm2020/src/render3/instructions/element.mjs +4 -79
  13. package/esm2020/src/render3/instructions/element_validation.mjs +264 -0
  14. package/esm2020/src/render3/instructions/shared.mjs +7 -113
  15. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  16. package/esm2020/src/render3/jit/module.mjs +2 -2
  17. package/esm2020/src/render3/ng_module_ref.mjs +2 -1
  18. package/esm2020/src/render3/pipe.mjs +20 -6
  19. package/esm2020/src/render3/state.mjs +1 -3
  20. package/esm2020/src/util/errors.mjs +1 -8
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/logger.mjs +3 -3
  23. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  24. package/esm2020/testing/src/test_bed.mjs +5 -2
  25. package/fesm2015/core.mjs +630 -471
  26. package/fesm2015/core.mjs.map +1 -1
  27. package/fesm2015/testing.mjs +696 -534
  28. package/fesm2015/testing.mjs.map +1 -1
  29. package/fesm2020/core.mjs +626 -468
  30. package/fesm2020/core.mjs.map +1 -1
  31. package/fesm2020/testing.mjs +701 -540
  32. package/fesm2020/testing.mjs.map +1 -1
  33. package/index.d.ts +80 -33
  34. package/package.json +1 -1
  35. package/testing/index.d.ts +5 -2
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-rc.2
2
+ * @license Angular v14.0.1
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));
@@ -954,8 +957,8 @@ function ɵɵdefineComponent(componentDefinition) {
954
957
  */
955
958
  function ɵɵsetComponentScope(type, directives, pipes) {
956
959
  const def = type.ɵcmp;
957
- def.directiveDefs = () => directives.map(extractDirectiveDef);
958
- def.pipeDefs = () => pipes.map(getPipeDef$1);
960
+ def.directiveDefs = () => (typeof directives === 'function' ? directives() : directives).map(extractDirectiveDef);
961
+ def.pipeDefs = () => (typeof pipes === 'function' ? pipes() : pipes).map(getPipeDef$1);
959
962
  }
960
963
  function extractDirectiveDef(type) {
961
964
  return getComponentDef(type) || getDirectiveDef(type);
@@ -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;
@@ -4858,9 +4859,9 @@ function setCurrentInjector(injector) {
4858
4859
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4859
4860
  if (_currentInjector === undefined) {
4860
4861
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4861
- `inject() must be called from an injection context` :
4862
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
4862
4863
  '';
4863
- throw new RuntimeError(203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4864
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4864
4865
  }
4865
4866
  else if (_currentInjector === null) {
4866
4867
  return injectRootLimpMode(token, undefined, flags);
@@ -4895,29 +4896,71 @@ Please check that 1) the type for the parameter at index ${index} is correct and
4895
4896
  }
4896
4897
  /**
4897
4898
  * Injects a token from the currently active injector.
4898
- *
4899
- * Must be used in the context of a factory function such as one defined for an
4900
- * `InjectionToken`. Throws an error if not called from such a context.
4901
- *
4902
- * Within such a factory function, using this function to request injection of a dependency
4903
- * is faster and more type-safe than providing an additional array of dependencies
4904
- * (as has been common with `useFactory` providers).
4905
- *
4906
- * @param token The injection token for the dependency to be injected.
4899
+ * `inject` is only supported during instantiation of a dependency by the DI system. It can be used
4900
+ * during:
4901
+ * - Construction (via the `constructor`) of a class being instantiated by the DI system, such
4902
+ * as an `@Injectable` or `@Component`.
4903
+ * - In the initializer for fields of such classes.
4904
+ * - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.
4905
+ * - In the `factory` function specified for an `InjectionToken`.
4906
+ *
4907
+ * @param token A token that represents a dependency that should be injected.
4907
4908
  * @param flags Optional flags that control how injection is executed.
4908
4909
  * The flags correspond to injection strategies that can be specified with
4909
4910
  * parameter decorators `@Host`, `@Self`, `@SkipSef`, and `@Optional`.
4910
- * @returns the injected value if injection is successful, `null` otherwise.
4911
+ * @returns the injected value if operation is successful, `null` otherwise.
4912
+ * @throws if called outside of a supported context.
4911
4913
  *
4912
4914
  * @usageNotes
4915
+ * In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a
4916
+ * field initializer:
4913
4917
  *
4914
- * ### Example
4918
+ * ```typescript
4919
+ * @Injectable({providedIn: 'root'})
4920
+ * export class Car {
4921
+ * radio: Radio|undefined;
4922
+ * // OK: field initializer
4923
+ * spareTyre = inject(Tyre);
4915
4924
  *
4916
- * {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
4925
+ * constructor() {
4926
+ * // OK: constructor body
4927
+ * this.radio = inject(Radio);
4928
+ * }
4929
+ * }
4930
+ * ```
4931
+ *
4932
+ * It is also legal to call `inject` from a provider's factory:
4933
+ *
4934
+ * ```typescript
4935
+ * providers: [
4936
+ * {provide: Car, useFactory: () => {
4937
+ * // OK: a class factory
4938
+ * const engine = inject(Engine);
4939
+ * return new Car(engine);
4940
+ * }}
4941
+ * ]
4942
+ * ```
4943
+ *
4944
+ * Calls to the `inject()` function outside of the class creation context will result in error. Most
4945
+ * notably, calls to `inject()` are disallowed after a class instance was created, in methods
4946
+ * (including lifecycle hooks):
4947
+ *
4948
+ * ```typescript
4949
+ * @Component({ ... })
4950
+ * export class CarComponent {
4951
+ * ngOnInit() {
4952
+ * // ERROR: too late, the component instance was already created
4953
+ * const engine = inject(Engine);
4954
+ * engine.start();
4955
+ * }
4956
+ * }
4957
+ * ```
4917
4958
  *
4918
4959
  * @publicApi
4919
4960
  */
4920
- const inject = ɵɵinject;
4961
+ function inject(token, flags = InjectFlags.Default) {
4962
+ return ɵɵinject(token, flags);
4963
+ }
4921
4964
  function injectArgs(types) {
4922
4965
  const args = [];
4923
4966
  for (let i = 0; i < types.length; i++) {
@@ -6307,6 +6350,155 @@ function getSanitizer() {
6307
6350
  return lView && lView[SANITIZER];
6308
6351
  }
6309
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
+
6310
6502
  /**
6311
6503
  * @license
6312
6504
  * Copyright Google LLC All Rights Reserved.
@@ -6675,203 +6867,13 @@ function discoverLocalRefs(lView, nodeIndex) {
6675
6867
  if (tNode && tNode.localNames) {
6676
6868
  const result = {};
6677
6869
  let localIndex = tNode.index + 1;
6678
- for (let i = 0; i < tNode.localNames.length; i += 2) {
6679
- result[tNode.localNames[i]] = lView[localIndex];
6680
- localIndex++;
6681
- }
6682
- return result;
6683
- }
6684
- return null;
6685
- }
6686
-
6687
- /**
6688
- * @license
6689
- * Copyright Google LLC All Rights Reserved.
6690
- *
6691
- * Use of this source code is governed by an MIT-style license that can be
6692
- * found in the LICENSE file at https://angular.io/license
6693
- */
6694
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6695
- const ERROR_LOGGER = 'ngErrorLogger';
6696
- function wrappedError(message, originalError) {
6697
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6698
- const error = Error(msg);
6699
- error[ERROR_ORIGINAL_ERROR] = originalError;
6700
- return error;
6701
- }
6702
- function getOriginalError(error) {
6703
- return error[ERROR_ORIGINAL_ERROR];
6704
- }
6705
- function getErrorLogger(error) {
6706
- return error && error[ERROR_LOGGER] || defaultErrorLogger;
6707
- }
6708
- function defaultErrorLogger(console, ...values) {
6709
- console.error(...values);
6710
- }
6711
-
6712
- /**
6713
- * @license
6714
- * Copyright Google LLC All Rights Reserved.
6715
- *
6716
- * Use of this source code is governed by an MIT-style license that can be
6717
- * found in the LICENSE file at https://angular.io/license
6718
- */
6719
- /**
6720
- * Provides a hook for centralized exception handling.
6721
- *
6722
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6723
- * intercept error handling, write a custom exception handler that replaces this default as
6724
- * appropriate for your app.
6725
- *
6726
- * @usageNotes
6727
- * ### Example
6728
- *
6729
- * ```
6730
- * class MyErrorHandler implements ErrorHandler {
6731
- * handleError(error) {
6732
- * // do something with the exception
6733
- * }
6734
- * }
6735
- *
6736
- * @NgModule({
6737
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6738
- * })
6739
- * class MyModule {}
6740
- * ```
6741
- *
6742
- * @publicApi
6743
- */
6744
- class ErrorHandler {
6745
- constructor() {
6746
- /**
6747
- * @internal
6748
- */
6749
- this._console = console;
6750
- }
6751
- handleError(error) {
6752
- const originalError = this._findOriginalError(error);
6753
- // Note: Browser consoles show the place from where console.error was called.
6754
- // We can use this to give users additional information about the error.
6755
- const errorLogger = getErrorLogger(error);
6756
- errorLogger(this._console, `ERROR`, error);
6757
- if (originalError) {
6758
- errorLogger(this._console, `ORIGINAL ERROR`, originalError);
6759
- }
6760
- }
6761
- /** @internal */
6762
- _findOriginalError(error) {
6763
- let e = error && getOriginalError(error);
6764
- while (e && getOriginalError(e)) {
6765
- e = getOriginalError(e);
6766
- }
6767
- return e || null;
6768
- }
6769
- }
6770
-
6771
- /**
6772
- * @license
6773
- * Copyright Google LLC All Rights Reserved.
6774
- *
6775
- * Use of this source code is governed by an MIT-style license that can be
6776
- * found in the LICENSE file at https://angular.io/license
6777
- */
6778
- /**
6779
- * Defines a schema that allows an NgModule to contain the following:
6780
- * - Non-Angular elements named with dash case (`-`).
6781
- * - Element properties named with dash case (`-`).
6782
- * Dash case is the naming convention for custom elements.
6783
- *
6784
- * @publicApi
6785
- */
6786
- const CUSTOM_ELEMENTS_SCHEMA = {
6787
- name: 'custom-elements'
6788
- };
6789
- /**
6790
- * Defines a schema that allows any property on any element.
6791
- *
6792
- * This schema allows you to ignore the errors related to any unknown elements or properties in a
6793
- * template. The usage of this schema is generally discouraged because it prevents useful validation
6794
- * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
6795
- *
6796
- * @publicApi
6797
- */
6798
- const NO_ERRORS_SCHEMA = {
6799
- name: 'no-errors-schema'
6800
- };
6801
-
6802
- /**
6803
- * @license
6804
- * Copyright Google LLC All Rights Reserved.
6805
- *
6806
- * Use of this source code is governed by an MIT-style license that can be
6807
- * found in the LICENSE file at https://angular.io/license
6808
- */
6809
- /**
6810
- * Disallowed strings in the comment.
6811
- *
6812
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6813
- */
6814
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6815
- /**
6816
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6817
- */
6818
- const COMMENT_DELIMITER = /(<|>)/;
6819
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6820
- /**
6821
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
6822
- *
6823
- * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6824
- * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6825
- * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6826
- * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6827
- *
6828
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6829
- *
6830
- * ```
6831
- * div.innerHTML = div.innerHTML
6832
- * ```
6833
- *
6834
- * One would expect that the above code would be safe to do, but it turns out that because comment
6835
- * text is not escaped, the comment may contain text which will prematurely close the comment
6836
- * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6837
- * may contain such text and expect them to be safe.)
6838
- *
6839
- * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6840
- * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6841
- * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6842
- * text it will render normally but it will not cause the HTML parser to close/open the comment.
6843
- *
6844
- * @param value text to make safe for comment node by escaping the comment open/close character
6845
- * sequence.
6846
- */
6847
- function escapeCommentText(value) {
6848
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6849
- }
6850
-
6851
- /**
6852
- * @license
6853
- * Copyright Google LLC All Rights Reserved.
6854
- *
6855
- * Use of this source code is governed by an MIT-style license that can be
6856
- * found in the LICENSE file at https://angular.io/license
6857
- */
6858
- function normalizeDebugBindingName(name) {
6859
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6860
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6861
- return `ng-reflect-${name}`;
6862
- }
6863
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
6864
- function camelCaseToDashCase(input) {
6865
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6866
- }
6867
- function normalizeDebugBindingValue(value) {
6868
- try {
6869
- // Limit the size of the value as otherwise the DOM just gets polluted.
6870
- return value != null ? value.toString().slice(0, 30) : value;
6871
- }
6872
- catch (e) {
6873
- return '[ERROR] Exception while trying to serialize the value';
6870
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
6871
+ result[tNode.localNames[i]] = lView[localIndex];
6872
+ localIndex++;
6873
+ }
6874
+ return result;
6874
6875
  }
6876
+ return null;
6875
6877
  }
6876
6878
 
6877
6879
  /**
@@ -8831,8 +8833,38 @@ const INJECTOR_DEF_TYPES = new InjectionToken('INJECTOR_DEF_TYPES');
8831
8833
  * another environment injector (such as a route injector). They should not be used in component
8832
8834
  * providers.
8833
8835
  *
8834
- * @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.
8835
8866
  * @publicApi
8867
+ * @developerPreview
8836
8868
  */
8837
8869
  function importProvidersFrom(...sources) {
8838
8870
  return { ɵproviders: internalImportProvidersFrom(true, sources) };
@@ -9110,6 +9142,8 @@ function getNullInjector() {
9110
9142
  /**
9111
9143
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
9112
9144
  * component tree.
9145
+ *
9146
+ * @developerPreview
9113
9147
  */
9114
9148
  class EnvironmentInjector {
9115
9149
  }
@@ -10327,66 +10361,355 @@ class ReflectiveInjector_ {
10327
10361
  toString() {
10328
10362
  return this.displayName;
10329
10363
  }
10330
- }
10331
- ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10332
- function _mapProviders(injector, fn) {
10333
- const res = [];
10334
- for (let i = 0; i < injector._providers.length; ++i) {
10335
- res[i] = fn(injector.getProviderAtIndex(i));
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
+ }
10553
+ }
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;
10582
+ }
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';
10604
+ }
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.`;
10628
+ }
10629
+ else {
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.`;
10633
+ }
10634
+ }
10635
+ if (shouldThrowErrorOnUnknownProperty) {
10636
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
10637
+ }
10638
+ else {
10639
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
10336
10640
  }
10337
- return res;
10338
10641
  }
10339
-
10340
10642
  /**
10341
- * @license
10342
- * 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.
10343
10646
  *
10344
- * Use of this source code is governed by an MIT-style license that can be
10345
- * found in the LICENSE file at https://angular.io/license
10346
- */
10347
-
10348
- /**
10349
- * @license
10350
- * Copyright Google LLC All Rights Reserved.
10647
+ * Gets a reference to the host component def (where a current component is declared).
10351
10648
  *
10352
- * Use of this source code is governed by an MIT-style license that can be
10353
- * found in the LICENSE file at https://angular.io/license
10649
+ * @param lView An `LView` that represents a current component that is being rendered.
10354
10650
  */
10355
-
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
+ }
10356
10660
  /**
10357
- * @license
10358
- * 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.
10359
10664
  *
10360
- * Use of this source code is governed by an MIT-style license that can be
10361
- * 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.
10362
10668
  */
10363
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10364
- const lView = getLView();
10365
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
10366
- // if inject utilities are used before bootstrapping.
10367
- if (lView === null) {
10368
- // Verify that we will not get into infinite loop.
10369
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10370
- return ɵɵinject(token, flags);
10371
- }
10372
- const tNode = getCurrentTNode();
10373
- 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;
10374
10674
  }
10375
10675
  /**
10376
- * Throws an error indicating that a factory function could not be generated by the compiler for a
10377
- * particular class.
10378
- *
10379
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10380
- * 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.
10381
10679
  *
10382
- * The name of the class is not mentioned here, but will be in the generated factory function name
10383
- * 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.
10384
10682
  *
10385
- * @codeGenApi
10683
+ * @param lView An `LView` that represents a current component that is being rendered.
10386
10684
  */
10387
- function ɵɵinvalidFactory() {
10388
- const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10389
- 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;
10390
10713
  }
10391
10714
 
10392
10715
  /**
@@ -11195,21 +11518,6 @@ class LContainerDebug {
11195
11518
  }
11196
11519
  }
11197
11520
 
11198
- let shouldThrowErrorOnUnknownProperty = false;
11199
- /**
11200
- * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
11201
- * instead of just logging the error.
11202
- * (for AOT-compiled ones this check happens at build time).
11203
- */
11204
- function ɵsetUnknownPropertyStrictMode(shouldThrow) {
11205
- shouldThrowErrorOnUnknownProperty = shouldThrow;
11206
- }
11207
- /**
11208
- * Gets the current value of the strict mode.
11209
- */
11210
- function ɵgetUnknownPropertyStrictMode() {
11211
- return shouldThrowErrorOnUnknownProperty;
11212
- }
11213
11521
  /**
11214
11522
  * A permanent marker promise which signifies that the current CD tree is
11215
11523
  * clean.
@@ -11368,21 +11676,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
11368
11676
  }
11369
11677
  return tNode;
11370
11678
  }
11371
- /**
11372
- * Checks if the current component is declared inside of a standalone component template.
11373
- *
11374
- * @param lView An `LView` that represents a current component that is being rendered.
11375
- */
11376
- function isHostComponentStandalone(lView) {
11377
- !ngDevMode && throwError('Must never be called in production mode');
11378
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
11379
- const context = declarationLView[CONTEXT];
11380
- // Unable to obtain a context, fall back to the non-standalone scenario.
11381
- if (!context)
11382
- return false;
11383
- const componentDef = getComponentDef(context.constructor);
11384
- return !!(componentDef?.standalone);
11385
- }
11386
11679
  /**
11387
11680
  * When elements are created dynamically after a view blueprint is created (e.g. through
11388
11681
  * i18nApply()), we need to adjust the blueprint for future
@@ -12049,10 +12342,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12049
12342
  propName = mapPropName(propName);
12050
12343
  if (ngDevMode) {
12051
12344
  validateAgainstEventProperties(propName);
12052
- if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
12053
- // Return here since we only log warnings for unknown properties.
12054
- handleUnknownPropertyError(propName, tNode);
12055
- return;
12345
+ if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
12346
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12056
12347
  }
12057
12348
  ngDevMode.rendererSetProperty++;
12058
12349
  }
@@ -12071,7 +12362,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12071
12362
  // If the node is a container and the property didn't
12072
12363
  // match any of the inputs or schemas we should throw.
12073
12364
  if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
12074
- handleUnknownPropertyError(propName, tNode);
12365
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12075
12366
  }
12076
12367
  }
12077
12368
  }
@@ -12123,79 +12414,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12123
12414
  }
12124
12415
  }
12125
12416
  }
12126
- /**
12127
- * Validates that the property of the element is known at runtime and returns
12128
- * false if it's not the case.
12129
- * This check is relevant for JIT-compiled components (for AOT-compiled
12130
- * ones this check happens at build time).
12131
- *
12132
- * The property is considered known if either:
12133
- * - it's a known property of the element
12134
- * - the element is allowed by one of the schemas
12135
- * - the property is used for animations
12136
- *
12137
- * @param element Element to validate
12138
- * @param tagName Name of the tag to check
12139
- * @param propName Name of the property to check
12140
- * @param schemas Array of schemas
12141
- */
12142
- function validateProperty(element, tagName, propName, schemas) {
12143
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
12144
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
12145
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
12146
- // execute the check below.
12147
- if (schemas === null)
12148
- return true;
12149
- // The property is considered valid if the element matches the schema, it exists on the element,
12150
- // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
12151
- if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
12152
- return true;
12153
- }
12154
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
12155
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
12156
- return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
12157
- }
12158
- /**
12159
- * Returns true if the tag name is allowed by specified schemas.
12160
- * @param schemas Array of schemas
12161
- * @param tagName Name of the tag
12162
- */
12163
- function matchingSchemas(schemas, tagName) {
12164
- if (schemas !== null) {
12165
- for (let i = 0; i < schemas.length; i++) {
12166
- const schema = schemas[i];
12167
- if (schema === NO_ERRORS_SCHEMA ||
12168
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
12169
- return true;
12170
- }
12171
- }
12172
- }
12173
- return false;
12174
- }
12175
- /**
12176
- * Logs or throws an error that a property is not supported on an element.
12177
- * @param propName Name of the invalid property.
12178
- * @param tagName Name of the node on which we encountered the property.
12179
- */
12180
- function handleUnknownPropertyError(propName, tNode) {
12181
- let tagName = tNode.value;
12182
- // Special-case a situation when a structural directive is applied to
12183
- // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
12184
- // In this case the compiler generates the `ɵɵtemplate` instruction with
12185
- // the `null` as the tagName. The directive matching logic at runtime relies
12186
- // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
12187
- // a default value of the `tNode.value` is not feasible at this moment.
12188
- if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
12189
- tagName = 'ng-template';
12190
- }
12191
- const message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'.`;
12192
- if (shouldThrowErrorOnUnknownProperty) {
12193
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
12194
- }
12195
- else {
12196
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
12197
- }
12198
- }
12199
12417
  /**
12200
12418
  * Instantiate a root component.
12201
12419
  */
@@ -13769,7 +13987,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
13769
13987
  const component = instantiateRootComponent(tView, rootLView, componentDef);
13770
13988
  rootContext.components.push(component);
13771
13989
  componentView[CONTEXT] = component;
13772
- hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
13990
+ if (hostFeatures !== null) {
13991
+ for (const feature of hostFeatures) {
13992
+ feature(component, componentDef);
13993
+ }
13994
+ }
13773
13995
  // We want to generate an empty QueryList for root content queries for backwards
13774
13996
  // compatibility with ViewEngine.
13775
13997
  if (componentDef.contentQueries) {
@@ -13810,13 +14032,10 @@ function createRootContext(scheduler, playerHandler) {
13810
14032
  * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13811
14033
  * ```
13812
14034
  */
13813
- function LifecycleHooksFeature(component, def) {
13814
- const lView = readPatchedLView(component);
13815
- ngDevMode && assertDefined(lView, 'LView is required');
13816
- const tView = lView[TVIEW];
14035
+ function LifecycleHooksFeature() {
13817
14036
  const tNode = getCurrentTNode();
13818
14037
  ngDevMode && assertDefined(tNode, 'TNode is required');
13819
- registerPostOrderHooks(tView, tNode);
14038
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13820
14039
  }
13821
14040
  /**
13822
14041
  * Wait on component until it is rendered.
@@ -14951,21 +15170,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
14951
15170
  * Use of this source code is governed by an MIT-style license that can be
14952
15171
  * found in the LICENSE file at https://angular.io/license
14953
15172
  */
14954
- let shouldThrowErrorOnUnknownElement = false;
14955
- /**
14956
- * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
14957
- * instead of just logging the error.
14958
- * (for AOT-compiled ones this check happens at build time).
14959
- */
14960
- function ɵsetUnknownElementStrictMode(shouldThrow) {
14961
- shouldThrowErrorOnUnknownElement = shouldThrow;
14962
- }
14963
- /**
14964
- * Gets the current value of the strict mode.
14965
- */
14966
- function ɵgetUnknownElementStrictMode() {
14967
- return shouldThrowErrorOnUnknownElement;
14968
- }
14969
15173
  function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
14970
15174
  ngDevMode && assertFirstCreatePass(tView);
14971
15175
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -14974,8 +15178,7 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
14974
15178
  const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
14975
15179
  const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
14976
15180
  if (ngDevMode) {
14977
- const hostIsStandalone = isHostComponentStandalone(lView);
14978
- validateElementIsKnown(native, tNode.value, tView.schemas, hasDirectives, hostIsStandalone);
15181
+ validateElementIsKnown(native, lView, tNode.value, tView.schemas, hasDirectives);
14979
15182
  }
14980
15183
  if (tNode.attrs !== null) {
14981
15184
  computeStaticStyling(tNode, tNode.attrs, false);
@@ -15100,65 +15303,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
15100
15303
  ɵɵelementEnd();
15101
15304
  return ɵɵelement;
15102
15305
  }
15103
- /**
15104
- * Validates that the element is known at runtime and produces
15105
- * an error if it's not the case.
15106
- * This check is relevant for JIT-compiled components (for AOT-compiled
15107
- * ones this check happens at build time).
15108
- *
15109
- * The element is considered known if either:
15110
- * - it's a known HTML element
15111
- * - it's a known custom element
15112
- * - the element matches any directive
15113
- * - the element is allowed by one of the schemas
15114
- *
15115
- * @param element Element to validate
15116
- * @param tagName Name of the tag to check
15117
- * @param schemas Array of schemas
15118
- * @param hasDirectives Boolean indicating that the element matches any directive
15119
- * @param hostIsStandalone Boolean indicating whether the host is a standalone component
15120
- */
15121
- function validateElementIsKnown(element, tagName, schemas, hasDirectives, hostIsStandalone) {
15122
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
15123
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
15124
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
15125
- // execute the check below.
15126
- if (schemas === null)
15127
- return;
15128
- // If the element matches any directive, it's considered as valid.
15129
- if (!hasDirectives && tagName !== null) {
15130
- // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
15131
- // as a custom element. Note that unknown elements with a dash in their name won't be instances
15132
- // of HTMLUnknownElement in browsers that support web components.
15133
- const isUnknown =
15134
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
15135
- // because while most browsers return 'function', IE returns 'object'.
15136
- (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
15137
- element instanceof HTMLUnknownElement) ||
15138
- (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
15139
- !customElements.get(tagName));
15140
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
15141
- const schemas = `'${hostIsStandalone ? '@Component' : '@NgModule'}.schemas'`;
15142
- let message = `'${tagName}' is not a known element:\n`;
15143
- message += `1. If '${tagName}' is an Angular component, then verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
15144
- 'a part of this module'}.\n`;
15145
- if (tagName && tagName.indexOf('-') > -1) {
15146
- message +=
15147
- `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
15148
- }
15149
- else {
15150
- message +=
15151
- `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
15152
- }
15153
- if (shouldThrowErrorOnUnknownElement) {
15154
- throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
15155
- }
15156
- else {
15157
- console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
15158
- }
15159
- }
15160
- }
15161
- }
15162
15306
 
15163
15307
  /**
15164
15308
  * @license
@@ -21641,7 +21785,7 @@ class Version {
21641
21785
  /**
21642
21786
  * @publicApi
21643
21787
  */
21644
- const VERSION = new Version('14.0.0-rc.2');
21788
+ const VERSION = new Version('14.0.1');
21645
21789
 
21646
21790
  /**
21647
21791
  * @license
@@ -22313,6 +22457,7 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22313
22457
  * Create a new environment injector.
22314
22458
  *
22315
22459
  * @publicApi
22460
+ * @developerPreview
22316
22461
  */
22317
22462
  function createEnvironmentInjector(providers, parent = null, debugName = null) {
22318
22463
  const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
@@ -22340,14 +22485,14 @@ class StandaloneService {
22340
22485
  if (!componentDef.standalone) {
22341
22486
  return null;
22342
22487
  }
22343
- if (!this.cachedInjectors.has(componentDef)) {
22488
+ if (!this.cachedInjectors.has(componentDef.id)) {
22344
22489
  const providers = internalImportProvidersFrom(false, componentDef.type);
22345
22490
  const standaloneInjector = providers.length > 0 ?
22346
22491
  createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22347
22492
  null;
22348
- this.cachedInjectors.set(componentDef, standaloneInjector);
22493
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
22349
22494
  }
22350
- return this.cachedInjectors.get(componentDef);
22495
+ return this.cachedInjectors.get(componentDef.id);
22351
22496
  }
22352
22497
  ngOnDestroy() {
22353
22498
  try {
@@ -22847,13 +22992,26 @@ function getPipeDef(name, registry) {
22847
22992
  }
22848
22993
  }
22849
22994
  if (ngDevMode) {
22850
- const lView = getLView();
22851
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22852
- const context = declarationLView[CONTEXT];
22853
- const component = context ? ` in the '${context.constructor.name}' component` : '';
22854
- 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));
22855
22996
  }
22856
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
+ }
22857
23015
  /**
22858
23016
  * Invokes a pipe with 1 arguments.
22859
23017
  *
@@ -24697,7 +24855,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
24697
24855
  }
24698
24856
  /**
24699
24857
  * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
24700
- * (eaither a NgModule or a standalone component / directive / pipe).
24858
+ * (either a NgModule or a standalone component / directive / pipe).
24701
24859
  */
24702
24860
  function transitiveScopesFor(type) {
24703
24861
  if (isNgModule(type)) {