@angular/core 13.2.0-next.0 → 13.2.0-rc.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 (58) hide show
  1. package/core.d.ts +87 -29
  2. package/esm2020/src/application_ref.mjs +10 -10
  3. package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +6 -2
  4. package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +6 -2
  5. package/esm2020/src/change_detection/differs/iterable_differs.mjs +6 -2
  6. package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +6 -2
  7. package/esm2020/src/core_private_export.mjs +2 -2
  8. package/esm2020/src/di/injector_compatibility.mjs +10 -3
  9. package/esm2020/src/di/r3_injector.mjs +16 -5
  10. package/esm2020/src/error_details_base_url.mjs +16 -0
  11. package/esm2020/src/error_handler.mjs +2 -2
  12. package/esm2020/src/errors.mjs +18 -12
  13. package/esm2020/src/linker/compiler.mjs +1 -1
  14. package/esm2020/src/linker/component_factory.mjs +4 -1
  15. package/esm2020/src/linker/component_factory_resolver.mjs +4 -1
  16. package/esm2020/src/linker/ng_module_factory.mjs +1 -1
  17. package/esm2020/src/linker/template_ref.mjs +13 -4
  18. package/esm2020/src/linker/view_container_ref.mjs +12 -3
  19. package/esm2020/src/metadata/directives.mjs +2 -2
  20. package/esm2020/src/reflection/reflection_capabilities.mjs +2 -2
  21. package/esm2020/src/render3/chained_injector.mjs +32 -0
  22. package/esm2020/src/render3/component_ref.mjs +3 -20
  23. package/esm2020/src/render3/errors.mjs +4 -6
  24. package/esm2020/src/render3/errors_di.mjs +11 -4
  25. package/esm2020/src/render3/features/inherit_definition_feature.mjs +6 -2
  26. package/esm2020/src/render3/i18n/i18n_apply.mjs +5 -2
  27. package/esm2020/src/render3/i18n/i18n_parse.mjs +2 -2
  28. package/esm2020/src/render3/instructions/element.mjs +3 -3
  29. package/esm2020/src/render3/instructions/shared.mjs +4 -4
  30. package/esm2020/src/render3/interfaces/injector.mjs +1 -1
  31. package/esm2020/src/render3/namespaces.mjs +10 -3
  32. package/esm2020/src/render3/ng_module_ref.mjs +2 -2
  33. package/esm2020/src/render3/node_manipulation.mjs +5 -3
  34. package/esm2020/src/render3/pipe.mjs +3 -3
  35. package/esm2020/src/render3/view_ref.mjs +6 -3
  36. package/esm2020/src/sanitization/sanitization.mjs +14 -7
  37. package/esm2020/src/util/errors.mjs +10 -2
  38. package/esm2020/src/version.mjs +1 -1
  39. package/esm2020/testing/src/logger.mjs +3 -3
  40. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  41. package/fesm2015/core.mjs +170 -106
  42. package/fesm2015/core.mjs.map +1 -1
  43. package/fesm2015/testing.mjs +2 -2
  44. package/fesm2020/core.mjs +170 -106
  45. package/fesm2020/core.mjs.map +1 -1
  46. package/fesm2020/testing.mjs +2 -2
  47. package/package.json +1 -1
  48. package/schematics/migrations/typed-forms/index.d.ts +14 -0
  49. package/schematics/migrations/typed-forms/index.js +90 -0
  50. package/schematics/migrations/typed-forms/util.d.ts +21 -0
  51. package/schematics/migrations/typed-forms/util.js +87 -0
  52. package/schematics/migrations.json +5 -0
  53. package/schematics/utils/import_manager.d.ts +0 -5
  54. package/schematics/utils/import_manager.js +3 -7
  55. package/schematics/utils/typescript/imports.js +2 -5
  56. package/testing/testing.d.ts +2 -2
  57. package/esm2020/src/render3/error_code.mjs +0 -42
  58. package/esm2020/src/render3/error_details_base_url.mjs +0 -16
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v13.2.0-next.0
3
- * (c) 2010-2021 Google LLC. https://angular.io/
2
+ * @license Angular v13.2.0-rc.1
3
+ * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
package/fesm2020/core.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v13.2.0-next.0
3
- * (c) 2010-2021 Google LLC. https://angular.io/
2
+ * @license Angular v13.2.0-rc.1
3
+ * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
@@ -141,7 +141,7 @@ function isForwardRef(fn) {
141
141
  *
142
142
  * Keep the files below in full sync:
143
143
  * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
144
- * - packages/core/src/render3/error_details_base_url.ts
144
+ * - packages/core/src/error_details_base_url.ts
145
145
  */
146
146
  const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
147
147
 
@@ -158,30 +158,15 @@ class RuntimeError extends Error {
158
158
  this.code = code;
159
159
  }
160
160
  }
161
- // Contains a set of error messages that have details guides at angular.io.
162
- // Full list of available error guides can be found at https://angular.io/errors
163
- /* tslint:disable:no-toplevel-property-access */
164
- const RUNTIME_ERRORS_WITH_GUIDES = new Set([
165
- "100" /* EXPRESSION_CHANGED_AFTER_CHECKED */,
166
- "200" /* CYCLIC_DI_DEPENDENCY */,
167
- "201" /* PROVIDER_NOT_FOUND */,
168
- "300" /* MULTIPLE_COMPONENTS_MATCH */,
169
- "301" /* EXPORT_NOT_FOUND */,
170
- "302" /* PIPE_NOT_FOUND */,
171
- ]);
172
- /* tslint:enable:no-toplevel-property-access */
173
161
  /** Called to format a runtime error */
174
162
  function formatRuntimeError(code, message) {
175
- const fullCode = code ? `NG0${code}: ` : '';
176
- let errorMessage = `${fullCode}${message}`;
177
- // Some runtime errors are still thrown without `ngDevMode` (for example
178
- // `throwProviderNotFoundError`), so we add `ngDevMode` check here to avoid pulling
179
- // `RUNTIME_ERRORS_WITH_GUIDES` symbol into prod bundles.
180
- // TODO: revisit all instances where `RuntimeError` is thrown and see if `ngDevMode` can be added
181
- // there instead to tree-shake more devmode-only code (and eventually remove `ngDevMode` check
182
- // from this code).
183
- if (ngDevMode && RUNTIME_ERRORS_WITH_GUIDES.has(code)) {
184
- errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0${code}`;
163
+ const codeAsNumber = code;
164
+ // Error code might be a negative number, which is a special marker that instructs the logic to
165
+ // generate a link to the error details page on angular.io.
166
+ const fullCode = `NG0${Math.abs(codeAsNumber)}`;
167
+ let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
168
+ if (ngDevMode && codeAsNumber < 0) {
169
+ errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
185
170
  }
186
171
  return errorMessage;
187
172
  }
@@ -222,10 +207,17 @@ function stringifyForError(value) {
222
207
  return renderStringify(value);
223
208
  }
224
209
 
210
+ /**
211
+ * @license
212
+ * Copyright Google LLC All Rights Reserved.
213
+ *
214
+ * Use of this source code is governed by an MIT-style license that can be
215
+ * found in the LICENSE file at https://angular.io/license
216
+ */
225
217
  /** Called when directives inject each other (creating a circular dependency) */
226
218
  function throwCyclicDependencyError(token, path) {
227
219
  const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
228
- throw new RuntimeError("200" /* CYCLIC_DI_DEPENDENCY */, `Circular dependency in DI detected for ${token}${depPath}`);
220
+ throw new RuntimeError(-200 /* CYCLIC_DI_DEPENDENCY */, `Circular dependency in DI detected for ${token}${depPath}`);
229
221
  }
230
222
  function throwMixedMultiProviderError() {
231
223
  throw new Error(`Cannot mix multi providers and regular providers`);
@@ -242,7 +234,7 @@ function throwInvalidProviderError(ngModuleType, providers, provider) {
242
234
  /** Throws an error when a token is not found in DI. */
243
235
  function throwProviderNotFoundError(token, injectorName) {
244
236
  const injectorDetails = injectorName ? ` in ${injectorName}` : '';
245
- throw new RuntimeError("201" /* PROVIDER_NOT_FOUND */, `No provider for ${stringifyForError(token)} found${injectorDetails}`);
237
+ throw new RuntimeError(-201 /* PROVIDER_NOT_FOUND */, `No provider for ${stringifyForError(token)} found${injectorDetails}`);
246
238
  }
247
239
 
248
240
  /**
@@ -1567,8 +1559,15 @@ const profiler = function (event, instance, hookOrListener) {
1567
1559
  * Use of this source code is governed by an MIT-style license that can be
1568
1560
  * found in the LICENSE file at https://angular.io/license
1569
1561
  */
1570
- const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1571
- const MATH_ML_NAMESPACE = 'http://www.w3.org/1998/MathML/';
1562
+ const SVG_NAMESPACE = 'svg';
1563
+ const SVG_NAMESPACE_URI = 'http://www.w3.org/2000/svg';
1564
+ const MATH_ML_NAMESPACE = 'math';
1565
+ const MATH_ML_NAMESPACE_URI = 'http://www.w3.org/1998/MathML/';
1566
+ function getNamespaceUri(namespace) {
1567
+ const name = namespace.toLowerCase();
1568
+ return name === SVG_NAMESPACE ? SVG_NAMESPACE_URI :
1569
+ (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
1570
+ }
1572
1571
 
1573
1572
  /**
1574
1573
  * @license
@@ -4479,7 +4478,7 @@ const ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{
4479
4478
  * Regular expression that detects ES2015 classes which extend from other classes
4480
4479
  * and inherit a constructor.
4481
4480
  */
4482
- const ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{\s*super\(\.\.\.arguments\)/;
4481
+ const ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/;
4483
4482
  /**
4484
4483
  * Determine whether a stringified type is a class which delegates its constructor
4485
4484
  * to its parent.
@@ -4758,7 +4757,10 @@ function setCurrentInjector(injector) {
4758
4757
  }
4759
4758
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4760
4759
  if (_currentInjector === undefined) {
4761
- throw new Error(`inject() must be called from an injection context`);
4760
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4761
+ `inject() must be called from an injection context` :
4762
+ '';
4763
+ throw new RuntimeError(203 /* MISSING_INJECTION_CONTEXT */, errorMessage);
4762
4764
  }
4763
4765
  else if (_currentInjector === null) {
4764
4766
  return injectRootLimpMode(token, undefined, flags);
@@ -4822,7 +4824,10 @@ function injectArgs(types) {
4822
4824
  const arg = resolveForwardRef(types[i]);
4823
4825
  if (Array.isArray(arg)) {
4824
4826
  if (arg.length === 0) {
4825
- throw new Error('Arguments array must have arguments.');
4827
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4828
+ 'Arguments array must have arguments.' :
4829
+ '';
4830
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
4826
4831
  }
4827
4832
  let type = undefined;
4828
4833
  let flags = InjectFlags.Default;
@@ -6013,7 +6018,10 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6013
6018
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* ResourceUrl */)) {
6014
6019
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6015
6020
  }
6016
- throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6021
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6022
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6023
+ '';
6024
+ throw new RuntimeError(904 /* UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6017
6025
  }
6018
6026
  /**
6019
6027
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6035,7 +6043,10 @@ function ɵɵsanitizeScript(unsafeScript) {
6035
6043
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* Script */)) {
6036
6044
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6037
6045
  }
6038
- throw new Error('unsafe value used in a script context');
6046
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6047
+ 'unsafe value used in a script context' :
6048
+ '';
6049
+ throw new RuntimeError(905 /* UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6039
6050
  }
6040
6051
  /**
6041
6052
  * A template tag function for promoting the associated constant literal to a
@@ -6123,18 +6134,18 @@ function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
6123
6134
  }
6124
6135
  function validateAgainstEventProperties(name) {
6125
6136
  if (name.toLowerCase().startsWith('on')) {
6126
- const msg = `Binding to event property '${name}' is disallowed for security reasons, ` +
6137
+ const errorMessage = `Binding to event property '${name}' is disallowed for security reasons, ` +
6127
6138
  `please use (${name.slice(2)})=...` +
6128
6139
  `\nIf '${name}' is a directive input, make sure the directive is imported by the` +
6129
6140
  ` current module.`;
6130
- throw new Error(msg);
6141
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6131
6142
  }
6132
6143
  }
6133
6144
  function validateAgainstEventAttributes(name) {
6134
6145
  if (name.toLowerCase().startsWith('on')) {
6135
- const msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
6146
+ const errorMessage = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
6136
6147
  `please use (${name.slice(2)})=...`;
6137
- throw new Error(msg);
6148
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6138
6149
  }
6139
6150
  }
6140
6151
  function getSanitizer() {
@@ -6454,7 +6465,6 @@ function discoverLocalRefs(lView, nodeIndex) {
6454
6465
  * Use of this source code is governed by an MIT-style license that can be
6455
6466
  * found in the LICENSE file at https://angular.io/license
6456
6467
  */
6457
- const ERROR_TYPE = 'ngType';
6458
6468
  const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6459
6469
  const ERROR_LOGGER = 'ngErrorLogger';
6460
6470
  function wrappedError(message, originalError) {
@@ -6463,17 +6473,6 @@ function wrappedError(message, originalError) {
6463
6473
  error[ERROR_ORIGINAL_ERROR] = originalError;
6464
6474
  return error;
6465
6475
  }
6466
-
6467
- /**
6468
- * @license
6469
- * Copyright Google LLC All Rights Reserved.
6470
- *
6471
- * Use of this source code is governed by an MIT-style license that can be
6472
- * found in the LICENSE file at https://angular.io/license
6473
- */
6474
- function getType(error) {
6475
- return error[ERROR_TYPE];
6476
- }
6477
6476
  function getOriginalError(error) {
6478
6477
  return error[ERROR_ORIGINAL_ERROR];
6479
6478
  }
@@ -6718,7 +6717,7 @@ function maybeUnwrapFn(value) {
6718
6717
  */
6719
6718
  /** Called when there are multiple component selectors that match a given node */
6720
6719
  function throwMultipleComponentError(tNode) {
6721
- throw new RuntimeError("300" /* MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}`);
6720
+ throw new RuntimeError(-300 /* MULTIPLE_COMPONENTS_MATCH */, `Multiple components match node with tagname ${tNode.value}`);
6722
6721
  }
6723
6722
  /** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
6724
6723
  function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
@@ -6729,9 +6728,7 @@ function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName)
6729
6728
  ` It seems like the view has been created after its parent and its children have been dirty checked.` +
6730
6729
  ` Has it been created in a change detection hook?`;
6731
6730
  }
6732
- // TODO: include debug context, see `viewDebugError` function in
6733
- // `packages/core/src/view/errors.ts` for reference.
6734
- throw new RuntimeError("100" /* EXPRESSION_CHANGED_AFTER_CHECKED */, msg);
6731
+ throw new RuntimeError(-100 /* EXPRESSION_CHANGED_AFTER_CHECKED */, msg);
6735
6732
  }
6736
6733
  function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
6737
6734
  const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
@@ -6998,8 +6995,9 @@ function createElementNode(renderer, name, namespace) {
6998
6995
  return renderer.createElement(name, namespace);
6999
6996
  }
7000
6997
  else {
7001
- return namespace === null ? renderer.createElement(name) :
7002
- renderer.createElementNS(namespace, name);
6998
+ const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
6999
+ return namespaceUri === null ? renderer.createElement(name) :
7000
+ renderer.createElementNS(namespaceUri, name);
7003
7001
  }
7004
7002
  }
7005
7003
  /**
@@ -10141,7 +10139,7 @@ function matchingSchemas(tView, tagName) {
10141
10139
  */
10142
10140
  function logUnknownPropertyError(propName, tNode) {
10143
10141
  let message = `Can't bind to '${propName}' since it isn't a known property of '${tNode.value}'.`;
10144
- console.error(formatRuntimeError("303" /* UNKNOWN_BINDING */, message));
10142
+ console.error(formatRuntimeError(303 /* UNKNOWN_BINDING */, message));
10145
10143
  }
10146
10144
  /**
10147
10145
  * Instantiate a root component.
@@ -10394,7 +10392,7 @@ function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
10394
10392
  for (let i = 0; i < localRefs.length; i += 2) {
10395
10393
  const index = exportsMap[localRefs[i + 1]];
10396
10394
  if (index == null)
10397
- throw new RuntimeError("301" /* EXPORT_NOT_FOUND */, `Export of name '${localRefs[i + 1]}' not found!`);
10395
+ throw new RuntimeError(-301 /* EXPORT_NOT_FOUND */, `Export of name '${localRefs[i + 1]}' not found!`);
10398
10396
  localNames.push(localRefs[i], index);
10399
10397
  }
10400
10398
  }
@@ -11320,7 +11318,10 @@ class R3Injector {
11320
11318
  }
11321
11319
  assertNotDestroyed() {
11322
11320
  if (this._destroyed) {
11323
- throw new Error('Injector has already been destroyed.');
11321
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11322
+ 'Injector has already been destroyed.' :
11323
+ '';
11324
+ throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, errorMessage);
11324
11325
  }
11325
11326
  }
11326
11327
  /**
@@ -11484,21 +11485,28 @@ function injectableDefOrInjectorDefFactory(token) {
11484
11485
  // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.
11485
11486
  // If it's missing that, it's an error.
11486
11487
  if (token instanceof InjectionToken) {
11487
- throw new Error(`Token ${stringify(token)} is missing a ɵprov definition.`);
11488
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11489
+ `Token ${stringify(token)} is missing a ɵprov definition.` :
11490
+ '';
11491
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11488
11492
  }
11489
11493
  // Undecorated types can sometimes be created if they have no constructor arguments.
11490
11494
  if (token instanceof Function) {
11491
11495
  return getUndecoratedInjectableFactory(token);
11492
11496
  }
11493
11497
  // There was no way to resolve a factory for this token.
11494
- throw new Error('unreachable');
11498
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'unreachable' : '';
11499
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11495
11500
  }
11496
11501
  function getUndecoratedInjectableFactory(token) {
11497
11502
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
11498
11503
  const paramLength = token.length;
11499
11504
  if (paramLength > 0) {
11500
11505
  const args = newArray(paramLength, '?');
11501
- throw new Error(`Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
11506
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11507
+ `Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).` :
11508
+ '';
11509
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11502
11510
  }
11503
11511
  // The constructor function appears to have no parameters.
11504
11512
  // This might be because it inherits from a super-class. In which case, use an injectable
@@ -12356,7 +12364,10 @@ function ɵɵInheritDefinitionFeature(definition) {
12356
12364
  }
12357
12365
  else {
12358
12366
  if (superType.ɵcmp) {
12359
- throw new Error('Directives cannot inherit Components');
12367
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
12368
+ 'Directives cannot inherit Components' :
12369
+ '';
12370
+ throw new RuntimeError(903 /* INVALID_INHERITANCE */, errorMessage);
12360
12371
  }
12361
12372
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
12362
12373
  superDef = superType.ɵdir;
@@ -14618,7 +14629,7 @@ function logUnknownElementError(tView, element, tNode, hasDirectives) {
14618
14629
  message +=
14619
14630
  `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
14620
14631
  }
14621
- console.error(formatRuntimeError("304" /* UNKNOWN_ELEMENT */, message));
14632
+ console.error(formatRuntimeError(304 /* UNKNOWN_ELEMENT */, message));
14622
14633
  }
14623
14634
  }
14624
14635
  }
@@ -19137,7 +19148,9 @@ function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
19137
19148
  setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
19138
19149
  break;
19139
19150
  default:
19140
- throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
19151
+ if (ngDevMode) {
19152
+ throw new RuntimeError(700 /* INVALID_I18N_STRUCTURE */, `Unable to determine the type of mutate operation for "${opCode}"`);
19153
+ }
19141
19154
  }
19142
19155
  }
19143
19156
  else {
@@ -19763,7 +19776,7 @@ function i18nStartFirstCreatePass(tView, parentTNodeIndex, lView, index, message
19763
19776
  };
19764
19777
  }
19765
19778
  /**
19766
- * Allocate space in i18n Range add create OpCode instruction to crete a text or comment node.
19779
+ * Allocate space in i18n Range add create OpCode instruction to create a text or comment node.
19767
19780
  *
19768
19781
  * @param tView Current `TView` needed to allocate space in i18n range.
19769
19782
  * @param rootTNode Root `TNode` of the i18n block. This node determines if the new TNode will be
@@ -20864,6 +20877,9 @@ class ComponentRef$1 {
20864
20877
  * @see [Dynamic Components](guide/dynamic-component-loader)
20865
20878
  *
20866
20879
  * @publicApi
20880
+ *
20881
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20882
+ * Component class can be used directly.
20867
20883
  */
20868
20884
  class ComponentFactory$1 {
20869
20885
  }
@@ -20900,6 +20916,9 @@ class _NullComponentFactoryResolver {
20900
20916
  * does **not** require resolving component factory: component class can be used directly.
20901
20917
  *
20902
20918
  * @publicApi
20919
+ *
20920
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20921
+ * Component class can be used directly.
20903
20922
  */
20904
20923
  class ComponentFactoryResolver$1 {
20905
20924
  }
@@ -21064,7 +21083,7 @@ class Version {
21064
21083
  /**
21065
21084
  * @publicApi
21066
21085
  */
21067
- const VERSION = new Version('13.2.0-next.0');
21086
+ const VERSION = new Version('13.2.0-rc.1');
21068
21087
 
21069
21088
  /**
21070
21089
  * @license
@@ -21092,6 +21111,37 @@ const VERSION = new Version('13.2.0-next.0');
21092
21111
  // - mod2.injector.get(token, default)
21093
21112
  const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
21094
21113
 
21114
+ /**
21115
+ * @license
21116
+ * Copyright Google LLC All Rights Reserved.
21117
+ *
21118
+ * Use of this source code is governed by an MIT-style license that can be
21119
+ * found in the LICENSE file at https://angular.io/license
21120
+ */
21121
+ /**
21122
+ * Injector that looks up a value using a specific injector, before falling back to the module
21123
+ * injector. Used primarily when creating components or embedded views dynamically.
21124
+ */
21125
+ class ChainedInjector {
21126
+ constructor(injector, parentInjector) {
21127
+ this.injector = injector;
21128
+ this.parentInjector = parentInjector;
21129
+ }
21130
+ get(token, notFoundValue, flags) {
21131
+ const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21132
+ if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21133
+ notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21134
+ // Return the value from the root element injector when
21135
+ // - it provides it
21136
+ // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21137
+ // - the module injector should not be checked
21138
+ // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21139
+ return value;
21140
+ }
21141
+ return this.parentInjector.get(token, notFoundValue, flags);
21142
+ }
21143
+ }
21144
+
21095
21145
  /**
21096
21146
  * @license
21097
21147
  * Copyright Google LLC All Rights Reserved.
@@ -21400,7 +21450,8 @@ class ViewRef$1 {
21400
21450
  }
21401
21451
  attachToViewContainerRef() {
21402
21452
  if (this._appRef) {
21403
- throw new Error('This view is already attached directly to the ApplicationRef!');
21453
+ const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
21454
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21404
21455
  }
21405
21456
  this._attachedToViewContainer = true;
21406
21457
  }
@@ -21410,7 +21461,8 @@ class ViewRef$1 {
21410
21461
  }
21411
21462
  attachToAppRef(appRef) {
21412
21463
  if (this._attachedToViewContainer) {
21413
- throw new Error('This view is already attached to a ViewContainer!');
21464
+ const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
21465
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21414
21466
  }
21415
21467
  this._appRef = appRef;
21416
21468
  }
@@ -21475,23 +21527,6 @@ const SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', {
21475
21527
  providedIn: 'root',
21476
21528
  factory: () => defaultScheduler,
21477
21529
  });
21478
- function createChainedInjector(rootViewInjector, moduleInjector) {
21479
- return {
21480
- get: (token, notFoundValue, flags) => {
21481
- const value = rootViewInjector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21482
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21483
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21484
- // Return the value from the root element injector when
21485
- // - it provides it
21486
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21487
- // - the module injector should not be checked
21488
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21489
- return value;
21490
- }
21491
- return moduleInjector.get(token, notFoundValue, flags);
21492
- }
21493
- };
21494
- }
21495
21530
  /**
21496
21531
  * Render3 implementation of {@link viewEngine_ComponentFactory}.
21497
21532
  */
@@ -21518,7 +21553,7 @@ class ComponentFactory extends ComponentFactory$1 {
21518
21553
  }
21519
21554
  create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
21520
21555
  ngModule = ngModule || this.ngModule;
21521
- const rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector;
21556
+ const rootViewInjector = ngModule ? new ChainedInjector(injector, ngModule.injector) : injector;
21522
21557
  const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
21523
21558
  const sanitizer = rootViewInjector.get(Sanitizer, null);
21524
21559
  const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
@@ -21802,7 +21837,7 @@ class NgModuleRef extends NgModuleRef$1 {
21802
21837
  }
21803
21838
  ], stringify(ngModuleType));
21804
21839
  // We need to resolve the injector types separately from the injector creation, because
21805
- // the module might be trying to use this ref in its contructor for DI which will cause a
21840
+ // the module might be trying to use this ref in its constructor for DI which will cause a
21806
21841
  // circular error that will eventually error out, because the injector isn't created yet.
21807
21842
  this._r3Injector._resolveInjectorDefTypes();
21808
21843
  this.instance = this.get(ngModuleType);
@@ -22281,7 +22316,7 @@ function getPipeDef(name, registry) {
22281
22316
  const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22282
22317
  const context = declarationLView[CONTEXT];
22283
22318
  const component = context ? ` in the '${context.constructor.name}' component` : '';
22284
- throw new RuntimeError("302" /* PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22319
+ throw new RuntimeError(-302 /* PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22285
22320
  }
22286
22321
  }
22287
22322
  /**
@@ -22653,9 +22688,9 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
22653
22688
  this._declarationTContainer = _declarationTContainer;
22654
22689
  this.elementRef = elementRef;
22655
22690
  }
22656
- createEmbeddedView(context) {
22691
+ createEmbeddedView(context, injector) {
22657
22692
  const embeddedTView = this._declarationTContainer.tViews;
22658
- const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* CheckAlways */, null, embeddedTView.declTNode, null, null, null, null);
22693
+ const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* CheckAlways */, null, embeddedTView.declTNode, null, null, null, createEmbeddedViewInjector(injector, this._declarationLView[INJECTOR$1]));
22659
22694
  const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
22660
22695
  ngDevMode && assertLContainer(declarationLContainer);
22661
22696
  embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
@@ -22667,6 +22702,14 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
22667
22702
  return new ViewRef$1(embeddedLView);
22668
22703
  }
22669
22704
  };
22705
+ function createEmbeddedViewInjector(embeddedViewInjector, declarationViewInjector) {
22706
+ if (!embeddedViewInjector) {
22707
+ return null;
22708
+ }
22709
+ return declarationViewInjector ?
22710
+ new ChainedInjector(embeddedViewInjector, declarationViewInjector) :
22711
+ embeddedViewInjector;
22712
+ }
22670
22713
  /**
22671
22714
  * Creates a TemplateRef given a node.
22672
22715
  *
@@ -22771,8 +22814,17 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
22771
22814
  get length() {
22772
22815
  return this._lContainer.length - CONTAINER_HEADER_OFFSET;
22773
22816
  }
22774
- createEmbeddedView(templateRef, context, index) {
22775
- const viewRef = templateRef.createEmbeddedView(context || {});
22817
+ createEmbeddedView(templateRef, context, indexOrOptions) {
22818
+ let index;
22819
+ let injector;
22820
+ if (typeof indexOrOptions === 'number') {
22821
+ index = indexOrOptions;
22822
+ }
22823
+ else if (indexOrOptions != null) {
22824
+ index = indexOrOptions.index;
22825
+ injector = indexOrOptions.injector;
22826
+ }
22827
+ const viewRef = templateRef.createEmbeddedView(context || {}, injector);
22776
22828
  this.insert(viewRef, index);
22777
22829
  return viewRef;
22778
22830
  }
@@ -24542,7 +24594,7 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
24542
24594
  * @HostListener('click', ['$event.target'])
24543
24595
  * onClick(btn) {
24544
24596
  * console.log('button', btn, 'number of clicks:', this.numberOfClicks++);
24545
- * }
24597
+ * }
24546
24598
  * }
24547
24599
  *
24548
24600
  * @Component({
@@ -25882,7 +25934,7 @@ function createPlatform(injector) {
25882
25934
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
25883
25935
  'There can be only one platform. Destroy the previous one to create a new one.' :
25884
25936
  '';
25885
- throw new RuntimeError("400" /* MULTIPLE_PLATFORMS */, errorMessage);
25937
+ throw new RuntimeError(400 /* MULTIPLE_PLATFORMS */, errorMessage);
25886
25938
  }
25887
25939
  publishDefaultGlobalUtils();
25888
25940
  _platform = injector.get(PlatformRef);
@@ -25931,11 +25983,11 @@ function assertPlatform(requiredToken) {
25931
25983
  const platform = getPlatform();
25932
25984
  if (!platform) {
25933
25985
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
25934
- throw new RuntimeError("401" /* PLATFORM_NOT_FOUND */, errorMessage);
25986
+ throw new RuntimeError(401 /* PLATFORM_NOT_FOUND */, errorMessage);
25935
25987
  }
25936
25988
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
25937
25989
  !platform.injector.get(requiredToken, null)) {
25938
- throw new RuntimeError("400" /* MULTIPLE_PLATFORMS */, 'A platform with a different configuration has been created. Please destroy it first.');
25990
+ throw new RuntimeError(400 /* MULTIPLE_PLATFORMS */, 'A platform with a different configuration has been created. Please destroy it first.');
25939
25991
  }
25940
25992
  return platform;
25941
25993
  }
@@ -26022,7 +26074,7 @@ class PlatformRef {
26022
26074
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26023
26075
  'No ErrorHandler. Is platform module (BrowserModule) included?' :
26024
26076
  '';
26025
- throw new RuntimeError("402" /* ERROR_HANDLER_NOT_FOUND */, errorMessage);
26077
+ throw new RuntimeError(402 /* ERROR_HANDLER_NOT_FOUND */, errorMessage);
26026
26078
  }
26027
26079
  ngZone.runOutsideAngular(() => {
26028
26080
  const subscription = ngZone.onError.subscribe({
@@ -26083,7 +26135,7 @@ class PlatformRef {
26083
26135
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
26084
26136
  `Please define one of these.` :
26085
26137
  '';
26086
- throw new RuntimeError("403" /* BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
26138
+ throw new RuntimeError(403 /* BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
26087
26139
  }
26088
26140
  this._modules.push(moduleRef);
26089
26141
  }
@@ -26109,7 +26161,7 @@ class PlatformRef {
26109
26161
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26110
26162
  'The platform has already been destroyed!' :
26111
26163
  '';
26112
- throw new RuntimeError("404" /* ALREADY_DESTROYED_PLATFORM */, errorMessage);
26164
+ throw new RuntimeError(404 /* ALREADY_DESTROYED_PLATFORM */, errorMessage);
26113
26165
  }
26114
26166
  this._modules.slice().forEach(module => module.destroy());
26115
26167
  this._destroyListeners.forEach(listener => listener());
@@ -26373,7 +26425,7 @@ class ApplicationRef {
26373
26425
  'Cannot bootstrap as there are still asynchronous initializers running. ' +
26374
26426
  'Bootstrap components in the `ngDoBootstrap` method of the root module.' :
26375
26427
  '';
26376
- throw new RuntimeError("405" /* ASYNC_INITIALIZERS_STILL_RUNNING */, errorMessage);
26428
+ throw new RuntimeError(405 /* ASYNC_INITIALIZERS_STILL_RUNNING */, errorMessage);
26377
26429
  }
26378
26430
  let componentFactory;
26379
26431
  if (componentOrFactory instanceof ComponentFactory$1) {
@@ -26423,7 +26475,7 @@ class ApplicationRef {
26423
26475
  const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26424
26476
  'ApplicationRef.tick is called recursively' :
26425
26477
  '';
26426
- throw new RuntimeError("101" /* RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
26478
+ throw new RuntimeError(101 /* RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
26427
26479
  }
26428
26480
  try {
26429
26481
  this._runningTick = true;
@@ -27412,7 +27464,10 @@ class DefaultIterableDiffer {
27412
27464
  if (collection == null)
27413
27465
  collection = [];
27414
27466
  if (!isListLikeIterable(collection)) {
27415
- throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
27467
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27468
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
27469
+ '';
27470
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27416
27471
  }
27417
27472
  if (this.check(collection)) {
27418
27473
  return this;
@@ -28013,7 +28068,10 @@ class DefaultKeyValueDiffer {
28013
28068
  map = new Map();
28014
28069
  }
28015
28070
  else if (!(map instanceof Map || isJsObject(map))) {
28016
- throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
28071
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28072
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
28073
+ '';
28074
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
28017
28075
  }
28018
28076
  return this.check(map) ? this : null;
28019
28077
  }
@@ -28260,7 +28318,10 @@ class IterableDiffers {
28260
28318
  return factory;
28261
28319
  }
28262
28320
  else {
28263
- throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
28321
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28322
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
28323
+ '';
28324
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28264
28325
  }
28265
28326
  }
28266
28327
  }
@@ -28334,7 +28395,10 @@ class KeyValueDiffers {
28334
28395
  if (factory) {
28335
28396
  return factory;
28336
28397
  }
28337
- throw new Error(`Cannot find a differ supporting object '${kv}'`);
28398
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28399
+ `Cannot find a differ supporting object '${kv}'` :
28400
+ '';
28401
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28338
28402
  }
28339
28403
  }
28340
28404
  /** @nocollapse */