@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
@@ -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
  */
package/fesm2020/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
  */
@@ -1559,8 +1559,15 @@ const profiler = function (event, instance, hookOrListener) {
1559
1559
  * Use of this source code is governed by an MIT-style license that can be
1560
1560
  * found in the LICENSE file at https://angular.io/license
1561
1561
  */
1562
- const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1563
- 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
+ }
1564
1571
 
1565
1572
  /**
1566
1573
  * @license
@@ -4471,7 +4478,7 @@ const ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{
4471
4478
  * Regular expression that detects ES2015 classes which extend from other classes
4472
4479
  * and inherit a constructor.
4473
4480
  */
4474
- 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\)/;
4475
4482
  /**
4476
4483
  * Determine whether a stringified type is a class which delegates its constructor
4477
4484
  * to its parent.
@@ -4750,7 +4757,10 @@ function setCurrentInjector(injector) {
4750
4757
  }
4751
4758
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4752
4759
  if (_currentInjector === undefined) {
4753
- 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);
4754
4764
  }
4755
4765
  else if (_currentInjector === null) {
4756
4766
  return injectRootLimpMode(token, undefined, flags);
@@ -4814,7 +4824,10 @@ function injectArgs(types) {
4814
4824
  const arg = resolveForwardRef(types[i]);
4815
4825
  if (Array.isArray(arg)) {
4816
4826
  if (arg.length === 0) {
4817
- 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);
4818
4831
  }
4819
4832
  let type = undefined;
4820
4833
  let flags = InjectFlags.Default;
@@ -6005,7 +6018,10 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6005
6018
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* ResourceUrl */)) {
6006
6019
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6007
6020
  }
6008
- 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);
6009
6025
  }
6010
6026
  /**
6011
6027
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6027,7 +6043,10 @@ function ɵɵsanitizeScript(unsafeScript) {
6027
6043
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* Script */)) {
6028
6044
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6029
6045
  }
6030
- 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);
6031
6050
  }
6032
6051
  /**
6033
6052
  * A template tag function for promoting the associated constant literal to a
@@ -6115,18 +6134,18 @@ function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
6115
6134
  }
6116
6135
  function validateAgainstEventProperties(name) {
6117
6136
  if (name.toLowerCase().startsWith('on')) {
6118
- 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, ` +
6119
6138
  `please use (${name.slice(2)})=...` +
6120
6139
  `\nIf '${name}' is a directive input, make sure the directive is imported by the` +
6121
6140
  ` current module.`;
6122
- throw new Error(msg);
6141
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6123
6142
  }
6124
6143
  }
6125
6144
  function validateAgainstEventAttributes(name) {
6126
6145
  if (name.toLowerCase().startsWith('on')) {
6127
- 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, ` +
6128
6147
  `please use (${name.slice(2)})=...`;
6129
- throw new Error(msg);
6148
+ throw new RuntimeError(306 /* INVALID_EVENT_BINDING */, errorMessage);
6130
6149
  }
6131
6150
  }
6132
6151
  function getSanitizer() {
@@ -6976,8 +6995,9 @@ function createElementNode(renderer, name, namespace) {
6976
6995
  return renderer.createElement(name, namespace);
6977
6996
  }
6978
6997
  else {
6979
- return namespace === null ? renderer.createElement(name) :
6980
- renderer.createElementNS(namespace, name);
6998
+ const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
6999
+ return namespaceUri === null ? renderer.createElement(name) :
7000
+ renderer.createElementNS(namespaceUri, name);
6981
7001
  }
6982
7002
  }
6983
7003
  /**
@@ -11298,7 +11318,10 @@ class R3Injector {
11298
11318
  }
11299
11319
  assertNotDestroyed() {
11300
11320
  if (this._destroyed) {
11301
- 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);
11302
11325
  }
11303
11326
  }
11304
11327
  /**
@@ -11462,21 +11485,28 @@ function injectableDefOrInjectorDefFactory(token) {
11462
11485
  // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.
11463
11486
  // If it's missing that, it's an error.
11464
11487
  if (token instanceof InjectionToken) {
11465
- 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);
11466
11492
  }
11467
11493
  // Undecorated types can sometimes be created if they have no constructor arguments.
11468
11494
  if (token instanceof Function) {
11469
11495
  return getUndecoratedInjectableFactory(token);
11470
11496
  }
11471
11497
  // There was no way to resolve a factory for this token.
11472
- throw new Error('unreachable');
11498
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'unreachable' : '';
11499
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11473
11500
  }
11474
11501
  function getUndecoratedInjectableFactory(token) {
11475
11502
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
11476
11503
  const paramLength = token.length;
11477
11504
  if (paramLength > 0) {
11478
11505
  const args = newArray(paramLength, '?');
11479
- 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);
11480
11510
  }
11481
11511
  // The constructor function appears to have no parameters.
11482
11512
  // This might be because it inherits from a super-class. In which case, use an injectable
@@ -12334,7 +12364,10 @@ function ɵɵInheritDefinitionFeature(definition) {
12334
12364
  }
12335
12365
  else {
12336
12366
  if (superType.ɵcmp) {
12337
- 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);
12338
12371
  }
12339
12372
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
12340
12373
  superDef = superType.ɵdir;
@@ -19115,7 +19148,9 @@ function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
19115
19148
  setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
19116
19149
  break;
19117
19150
  default:
19118
- 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
+ }
19119
19154
  }
19120
19155
  }
19121
19156
  else {
@@ -20842,6 +20877,9 @@ class ComponentRef$1 {
20842
20877
  * @see [Dynamic Components](guide/dynamic-component-loader)
20843
20878
  *
20844
20879
  * @publicApi
20880
+ *
20881
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20882
+ * Component class can be used directly.
20845
20883
  */
20846
20884
  class ComponentFactory$1 {
20847
20885
  }
@@ -20878,6 +20916,9 @@ class _NullComponentFactoryResolver {
20878
20916
  * does **not** require resolving component factory: component class can be used directly.
20879
20917
  *
20880
20918
  * @publicApi
20919
+ *
20920
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20921
+ * Component class can be used directly.
20881
20922
  */
20882
20923
  class ComponentFactoryResolver$1 {
20883
20924
  }
@@ -21042,7 +21083,7 @@ class Version {
21042
21083
  /**
21043
21084
  * @publicApi
21044
21085
  */
21045
- const VERSION = new Version('13.2.0-next.2');
21086
+ const VERSION = new Version('14.0.0-next.0');
21046
21087
 
21047
21088
  /**
21048
21089
  * @license
@@ -21378,7 +21419,8 @@ class ViewRef$1 {
21378
21419
  }
21379
21420
  attachToViewContainerRef() {
21380
21421
  if (this._appRef) {
21381
- throw new Error('This view is already attached directly to the ApplicationRef!');
21422
+ const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
21423
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21382
21424
  }
21383
21425
  this._attachedToViewContainer = true;
21384
21426
  }
@@ -21388,7 +21430,8 @@ class ViewRef$1 {
21388
21430
  }
21389
21431
  attachToAppRef(appRef) {
21390
21432
  if (this._attachedToViewContainer) {
21391
- throw new Error('This view is already attached to a ViewContainer!');
21433
+ const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
21434
+ throw new RuntimeError(902 /* VIEW_ALREADY_ATTACHED */, errorMessage);
21392
21435
  }
21393
21436
  this._appRef = appRef;
21394
21437
  }
@@ -25280,7 +25323,8 @@ class NgZone {
25280
25323
  forkInnerZoneWithAngularBehavior(self);
25281
25324
  }
25282
25325
  static isInAngularZone() {
25283
- return Zone.current.get('isAngularZone') === true;
25326
+ // Zone needs to be checked, because this method might be called even when NoopNgZone is used.
25327
+ return typeof Zone !== 'undefined' && Zone.current.get('isAngularZone') === true;
25284
25328
  }
25285
25329
  static assertInAngularZone() {
25286
25330
  if (!NgZone.isInAngularZone()) {
@@ -27390,7 +27434,10 @@ class DefaultIterableDiffer {
27390
27434
  if (collection == null)
27391
27435
  collection = [];
27392
27436
  if (!isListLikeIterable(collection)) {
27393
- throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
27437
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27438
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
27439
+ '';
27440
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27394
27441
  }
27395
27442
  if (this.check(collection)) {
27396
27443
  return this;
@@ -27991,7 +28038,10 @@ class DefaultKeyValueDiffer {
27991
28038
  map = new Map();
27992
28039
  }
27993
28040
  else if (!(map instanceof Map || isJsObject(map))) {
27994
- throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
28041
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28042
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
28043
+ '';
28044
+ throw new RuntimeError(900 /* INVALID_DIFFER_INPUT */, errorMessage);
27995
28045
  }
27996
28046
  return this.check(map) ? this : null;
27997
28047
  }
@@ -28238,7 +28288,10 @@ class IterableDiffers {
28238
28288
  return factory;
28239
28289
  }
28240
28290
  else {
28241
- throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
28291
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28292
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
28293
+ '';
28294
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28242
28295
  }
28243
28296
  }
28244
28297
  }
@@ -28312,7 +28365,10 @@ class KeyValueDiffers {
28312
28365
  if (factory) {
28313
28366
  return factory;
28314
28367
  }
28315
- throw new Error(`Cannot find a differ supporting object '${kv}'`);
28368
+ const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28369
+ `Cannot find a differ supporting object '${kv}'` :
28370
+ '';
28371
+ throw new RuntimeError(901 /* NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
28316
28372
  }
28317
28373
  }
28318
28374
  /** @nocollapse */