@angular/core 13.2.0-next.2 → 14.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/core.d.ts +33 -3
  2. package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +6 -2
  3. package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +6 -2
  4. package/esm2020/src/change_detection/differs/iterable_differs.mjs +6 -2
  5. package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +6 -2
  6. package/esm2020/src/di/injector_compatibility.mjs +10 -3
  7. package/esm2020/src/di/r3_injector.mjs +16 -5
  8. package/esm2020/src/errors.mjs +1 -1
  9. package/esm2020/src/linker/compiler.mjs +1 -1
  10. package/esm2020/src/linker/component_factory.mjs +4 -1
  11. package/esm2020/src/linker/component_factory_resolver.mjs +4 -1
  12. package/esm2020/src/linker/ng_module_factory.mjs +1 -1
  13. package/esm2020/src/reflection/reflection_capabilities.mjs +2 -2
  14. package/esm2020/src/render3/component_ref.mjs +1 -1
  15. package/esm2020/src/render3/features/inherit_definition_feature.mjs +6 -2
  16. package/esm2020/src/render3/i18n/i18n_apply.mjs +5 -2
  17. package/esm2020/src/render3/namespaces.mjs +10 -3
  18. package/esm2020/src/render3/node_manipulation.mjs +5 -3
  19. package/esm2020/src/render3/view_ref.mjs +6 -3
  20. package/esm2020/src/sanitization/sanitization.mjs +14 -7
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/src/zone/ng_zone.mjs +3 -2
  23. package/esm2020/testing/src/logger.mjs +3 -3
  24. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  25. package/fesm2015/core.mjs +84 -28
  26. package/fesm2015/core.mjs.map +1 -1
  27. package/fesm2015/testing.mjs +1 -1
  28. package/fesm2020/core.mjs +84 -28
  29. package/fesm2020/core.mjs.map +1 -1
  30. package/fesm2020/testing.mjs +1 -1
  31. package/package.json +1 -1
  32. package/schematics/migrations.json +0 -5
  33. package/testing/testing.d.ts +1 -1
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.2.0-next.2
2
+ * @license Angular v14.0.0-next.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1552,8 +1552,15 @@ const profiler = function (event, instance, hookOrListener) {
1552
1552
  * Use of this source code is governed by an MIT-style license that can be
1553
1553
  * found in the LICENSE file at https://angular.io/license
1554
1554
  */
1555
- const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1556
- const MATH_ML_NAMESPACE = 'http://www.w3.org/1998/MathML/';
1555
+ const SVG_NAMESPACE = 'svg';
1556
+ const SVG_NAMESPACE_URI = 'http://www.w3.org/2000/svg';
1557
+ const MATH_ML_NAMESPACE = 'math';
1558
+ const MATH_ML_NAMESPACE_URI = 'http://www.w3.org/1998/MathML/';
1559
+ function getNamespaceUri(namespace) {
1560
+ const name = namespace.toLowerCase();
1561
+ return name === SVG_NAMESPACE ? SVG_NAMESPACE_URI :
1562
+ (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
1563
+ }
1557
1564
 
1558
1565
  /**
1559
1566
  * @license
@@ -4450,7 +4457,7 @@ const ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{
4450
4457
  * Regular expression that detects ES2015 classes which extend from other classes
4451
4458
  * and inherit a constructor.
4452
4459
  */
4453
- const ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{\s*super\(\.\.\.arguments\)/;
4460
+ const ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/;
4454
4461
  /**
4455
4462
  * Determine whether a stringified type is a class which delegates its constructor
4456
4463
  * to its parent.
@@ -4729,7 +4736,10 @@ function setCurrentInjector(injector) {
4729
4736
  }
4730
4737
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4731
4738
  if (_currentInjector === undefined) {
4732
- throw new Error(`inject() must be called from an injection context`);
4739
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4740
+ `inject() must be called from an injection context` :
4741
+ '';
4742
+ throw new RuntimeError(203 /* MISSING_INJECTION_CONTEXT */, errorMessage);
4733
4743
  }
4734
4744
  else if (_currentInjector === null) {
4735
4745
  return injectRootLimpMode(token, undefined, flags);
@@ -4793,7 +4803,10 @@ function injectArgs(types) {
4793
4803
  const arg = resolveForwardRef(types[i]);
4794
4804
  if (Array.isArray(arg)) {
4795
4805
  if (arg.length === 0) {
4796
- throw new Error('Arguments array must have arguments.');
4806
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4807
+ 'Arguments array must have arguments.' :
4808
+ '';
4809
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
4797
4810
  }
4798
4811
  let type = undefined;
4799
4812
  let flags = InjectFlags.Default;
@@ -5990,7 +6003,10 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
5990
6003
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* ResourceUrl */)) {
5991
6004
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
5992
6005
  }
5993
- throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6006
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6007
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6008
+ '';
6009
+ throw new RuntimeError(904 /* UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
5994
6010
  }
5995
6011
  /**
5996
6012
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6012,7 +6028,10 @@ function ɵɵsanitizeScript(unsafeScript) {
6012
6028
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* Script */)) {
6013
6029
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6014
6030
  }
6015
- throw new Error('unsafe value used in a script context');
6031
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6032
+ 'unsafe value used in a script context' :
6033
+ '';
6034
+ throw new RuntimeError(905 /* UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6016
6035
  }
6017
6036
  /**
6018
6037
  * A template tag function for promoting the associated constant literal to a
@@ -6100,18 +6119,18 @@ function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
6100
6119
  }
6101
6120
  function validateAgainstEventProperties(name) {
6102
6121
  if (name.toLowerCase().startsWith('on')) {
6103
- const msg = `Binding to event property '${name}' is disallowed for security reasons, ` +
6122
+ const errorMessage = `Binding to event property '${name}' is disallowed for security reasons, ` +
6104
6123
  `please use (${name.slice(2)})=...` +
6105
6124
  `\nIf '${name}' is a directive input, make sure the directive is imported by the` +
6106
6125
  ` current module.`;
6107
- throw new Error(msg);
6126
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6108
6127
  }
6109
6128
  }
6110
6129
  function validateAgainstEventAttributes(name) {
6111
6130
  if (name.toLowerCase().startsWith('on')) {
6112
- const msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
6131
+ const errorMessage = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
6113
6132
  `please use (${name.slice(2)})=...`;
6114
- throw new Error(msg);
6133
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6115
6134
  }
6116
6135
  }
6117
6136
  function getSanitizer() {
@@ -6961,8 +6980,9 @@ function createElementNode(renderer, name, namespace) {
6961
6980
  return renderer.createElement(name, namespace);
6962
6981
  }
6963
6982
  else {
6964
- return namespace === null ? renderer.createElement(name) :
6965
- renderer.createElementNS(namespace, name);
6983
+ const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
6984
+ return namespaceUri === null ? renderer.createElement(name) :
6985
+ renderer.createElementNS(namespaceUri, name);
6966
6986
  }
6967
6987
  }
6968
6988
  /**
@@ -11283,7 +11303,10 @@ class R3Injector {
11283
11303
  }
11284
11304
  assertNotDestroyed() {
11285
11305
  if (this._destroyed) {
11286
- throw new Error('Injector has already been destroyed.');
11306
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11307
+ 'Injector has already been destroyed.' :
11308
+ '';
11309
+ throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, errorMessage);
11287
11310
  }
11288
11311
  }
11289
11312
  /**
@@ -11447,21 +11470,28 @@ function injectableDefOrInjectorDefFactory(token) {
11447
11470
  // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.
11448
11471
  // If it's missing that, it's an error.
11449
11472
  if (token instanceof InjectionToken) {
11450
- throw new Error(`Token ${stringify(token)} is missing a ɵprov definition.`);
11473
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11474
+ `Token ${stringify(token)} is missing a ɵprov definition.` :
11475
+ '';
11476
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11451
11477
  }
11452
11478
  // Undecorated types can sometimes be created if they have no constructor arguments.
11453
11479
  if (token instanceof Function) {
11454
11480
  return getUndecoratedInjectableFactory(token);
11455
11481
  }
11456
11482
  // There was no way to resolve a factory for this token.
11457
- throw new Error('unreachable');
11483
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'unreachable' : '';
11484
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11458
11485
  }
11459
11486
  function getUndecoratedInjectableFactory(token) {
11460
11487
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
11461
11488
  const paramLength = token.length;
11462
11489
  if (paramLength > 0) {
11463
11490
  const args = newArray(paramLength, '?');
11464
- throw new Error(`Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
11491
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11492
+ `Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).` :
11493
+ '';
11494
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11465
11495
  }
11466
11496
  // The constructor function appears to have no parameters.
11467
11497
  // This might be because it inherits from a super-class. In which case, use an injectable
@@ -12320,7 +12350,10 @@ function ɵɵInheritDefinitionFeature(definition) {
12320
12350
  }
12321
12351
  else {
12322
12352
  if (superType.ɵcmp) {
12323
- throw new Error('Directives cannot inherit Components');
12353
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
12354
+ 'Directives cannot inherit Components' :
12355
+ '';
12356
+ throw new RuntimeError(903 /* INVALID_INHERITANCE */, errorMessage);
12324
12357
  }
12325
12358
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
12326
12359
  superDef = superType.ɵdir;
@@ -19101,7 +19134,9 @@ function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
19101
19134
  setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
19102
19135
  break;
19103
19136
  default:
19104
- throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
19137
+ if (ngDevMode) {
19138
+ throw new RuntimeError(700 /* INVALID_I18N_STRUCTURE */, `Unable to determine the type of mutate operation for "${opCode}"`);
19139
+ }
19105
19140
  }
19106
19141
  }
19107
19142
  else {
@@ -20828,6 +20863,9 @@ class ComponentRef$1 {
20828
20863
  * @see [Dynamic Components](guide/dynamic-component-loader)
20829
20864
  *
20830
20865
  * @publicApi
20866
+ *
20867
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20868
+ * Component class can be used directly.
20831
20869
  */
20832
20870
  class ComponentFactory$1 {
20833
20871
  }
@@ -20864,6 +20902,9 @@ class _NullComponentFactoryResolver {
20864
20902
  * does **not** require resolving component factory: component class can be used directly.
20865
20903
  *
20866
20904
  * @publicApi
20905
+ *
20906
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20907
+ * Component class can be used directly.
20867
20908
  */
20868
20909
  class ComponentFactoryResolver$1 {
20869
20910
  }
@@ -21028,7 +21069,7 @@ class Version {
21028
21069
  /**
21029
21070
  * @publicApi
21030
21071
  */
21031
- const VERSION = new Version('13.2.0-next.2');
21072
+ const VERSION = new Version('14.0.0-next.0');
21032
21073
 
21033
21074
  /**
21034
21075
  * @license
@@ -21364,7 +21405,8 @@ class ViewRef$1 {
21364
21405
  }
21365
21406
  attachToViewContainerRef() {
21366
21407
  if (this._appRef) {
21367
- throw new Error('This view is already attached directly to the ApplicationRef!');
21408
+ const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
21409
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21368
21410
  }
21369
21411
  this._attachedToViewContainer = true;
21370
21412
  }
@@ -21374,7 +21416,8 @@ class ViewRef$1 {
21374
21416
  }
21375
21417
  attachToAppRef(appRef) {
21376
21418
  if (this._attachedToViewContainer) {
21377
- throw new Error('This view is already attached to a ViewContainer!');
21419
+ const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
21420
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21378
21421
  }
21379
21422
  this._appRef = appRef;
21380
21423
  }
@@ -25254,7 +25297,8 @@ class NgZone {
25254
25297
  forkInnerZoneWithAngularBehavior(self);
25255
25298
  }
25256
25299
  static isInAngularZone() {
25257
- return Zone.current.get('isAngularZone') === true;
25300
+ // Zone needs to be checked, because this method might be called even when NoopNgZone is used.
25301
+ return typeof Zone !== 'undefined' && Zone.current.get('isAngularZone') === true;
25258
25302
  }
25259
25303
  static assertInAngularZone() {
25260
25304
  if (!NgZone.isInAngularZone()) {
@@ -27372,7 +27416,10 @@ class DefaultIterableDiffer {
27372
27416
  if (collection == null)
27373
27417
  collection = [];
27374
27418
  if (!isListLikeIterable(collection)) {
27375
- throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
27419
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27420
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
27421
+ '';
27422
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27376
27423
  }
27377
27424
  if (this.check(collection)) {
27378
27425
  return this;
@@ -27973,7 +28020,10 @@ class DefaultKeyValueDiffer {
27973
28020
  map = new Map();
27974
28021
  }
27975
28022
  else if (!(map instanceof Map || isJsObject(map))) {
27976
- throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
28023
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28024
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
28025
+ '';
28026
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27977
28027
  }
27978
28028
  return this.check(map) ? this : null;
27979
28029
  }
@@ -28220,7 +28270,10 @@ class IterableDiffers {
28220
28270
  return factory;
28221
28271
  }
28222
28272
  else {
28223
- throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
28273
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28274
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
28275
+ '';
28276
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28224
28277
  }
28225
28278
  }
28226
28279
  }
@@ -28294,7 +28347,10 @@ class KeyValueDiffers {
28294
28347
  if (factory) {
28295
28348
  return factory;
28296
28349
  }
28297
- throw new Error(`Cannot find a differ supporting object '${kv}'`);
28350
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28351
+ `Cannot find a differ supporting object '${kv}'` :
28352
+ '';
28353
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28298
28354
  }
28299
28355
  }
28300
28356
  /** @nocollapse */