@angular/core 14.0.0-next.0 → 14.0.0-next.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 (33) hide show
  1. package/core.d.ts +31 -7
  2. package/esm2020/src/di/r3_injector.mjs +5 -15
  3. package/esm2020/src/di/reflective_injector.mjs +1 -1
  4. package/esm2020/src/errors.mjs +22 -5
  5. package/esm2020/src/metadata/directives.mjs +14 -5
  6. package/esm2020/src/render3/instructions/shared.mjs +2 -2
  7. package/esm2020/src/version.mjs +1 -1
  8. package/esm2020/testing/src/logger.mjs +3 -3
  9. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  10. package/esm2020/testing/src/r3_test_bed.mjs +6 -1
  11. package/fesm2015/core.mjs +41 -25
  12. package/fesm2015/core.mjs.map +1 -1
  13. package/fesm2015/testing.mjs +6 -1
  14. package/fesm2015/testing.mjs.map +1 -1
  15. package/fesm2020/core.mjs +41 -25
  16. package/fesm2020/core.mjs.map +1 -1
  17. package/fesm2020/testing.mjs +6 -1
  18. package/fesm2020/testing.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/schematics/migrations/typed-forms/index.js +2 -2
  21. package/schematics/migrations/typed-forms/util.js +3 -8
  22. package/schematics/migrations.json +6 -16
  23. package/testing/testing.d.ts +1 -1
  24. package/schematics/migrations/router-link-empty-expression/analyze_template.d.ts +0 -11
  25. package/schematics/migrations/router-link-empty-expression/analyze_template.js +0 -34
  26. package/schematics/migrations/router-link-empty-expression/angular/html_routerlink_empty_expr_visitor.d.ts +0 -20
  27. package/schematics/migrations/router-link-empty-expression/angular/html_routerlink_empty_expr_visitor.js +0 -47
  28. package/schematics/migrations/router-link-empty-expression/index.d.ts +0 -11
  29. package/schematics/migrations/router-link-empty-expression/index.js +0 -170
  30. package/schematics/migrations/testbed-teardown/index.d.ts +0 -11
  31. package/schematics/migrations/testbed-teardown/index.js +0 -92
  32. package/schematics/migrations/testbed-teardown/util.d.ts +0 -35
  33. package/schematics/migrations/testbed-teardown/util.js +0 -188
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.0
2
+ * @license Angular v14.0.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -152,20 +152,37 @@ const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
152
152
  * Use of this source code is governed by an MIT-style license that can be
153
153
  * found in the LICENSE file at https://angular.io/license
154
154
  */
155
+ /**
156
+ * Class that represents a runtime error.
157
+ * Formats and outputs the error message in a consistent way.
158
+ *
159
+ * Example:
160
+ * ```
161
+ * throw new RuntimeError(
162
+ * RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
163
+ * ngDevMode && 'Injector has already been destroyed.');
164
+ * ```
165
+ *
166
+ * Note: the `message` argument contains a descriptive error message as a string in development
167
+ * mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the
168
+ * `message` argument becomes `false`, thus we account for it in the typings and the runtime logic.
169
+ */
155
170
  class RuntimeError extends Error {
156
171
  constructor(code, message) {
157
172
  super(formatRuntimeError(code, message));
158
173
  this.code = code;
159
174
  }
160
175
  }
161
- /** Called to format a runtime error */
176
+ /**
177
+ * Called to format a runtime error.
178
+ * See additional info on the `message` argument type in the `RuntimeError` class description.
179
+ */
162
180
  function formatRuntimeError(code, message) {
163
- const codeAsNumber = code;
164
181
  // Error code might be a negative number, which is a special marker that instructs the logic to
165
182
  // generate a link to the error details page on angular.io.
166
- const fullCode = `NG0${Math.abs(codeAsNumber)}`;
183
+ const fullCode = `NG0${Math.abs(code)}`;
167
184
  let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
168
- if (ngDevMode && codeAsNumber < 0) {
185
+ if (ngDevMode && code < 0) {
169
186
  errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
170
187
  }
171
188
  return errorMessage;
@@ -10392,7 +10409,7 @@ function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
10392
10409
  for (let i = 0; i < localRefs.length; i += 2) {
10393
10410
  const index = exportsMap[localRefs[i + 1]];
10394
10411
  if (index == null)
10395
- throw new RuntimeError(-301 /* EXPORT_NOT_FOUND */, `Export of name '${localRefs[i + 1]}' not found!`);
10412
+ throw new RuntimeError(-301 /* EXPORT_NOT_FOUND */, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
10396
10413
  localNames.push(localRefs[i], index);
10397
10414
  }
10398
10415
  }
@@ -11318,10 +11335,7 @@ class R3Injector {
11318
11335
  }
11319
11336
  assertNotDestroyed() {
11320
11337
  if (this._destroyed) {
11321
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
11322
- 'Injector has already been destroyed.' :
11323
- '';
11324
- throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, errorMessage);
11338
+ throw new RuntimeError(205 /* INJECTOR_ALREADY_DESTROYED */, ngDevMode && 'Injector has already been destroyed.');
11325
11339
  }
11326
11340
  }
11327
11341
  /**
@@ -11485,28 +11499,21 @@ function injectableDefOrInjectorDefFactory(token) {
11485
11499
  // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.
11486
11500
  // If it's missing that, it's an error.
11487
11501
  if (token instanceof InjectionToken) {
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);
11502
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);
11492
11503
  }
11493
11504
  // Undecorated types can sometimes be created if they have no constructor arguments.
11494
11505
  if (token instanceof Function) {
11495
11506
  return getUndecoratedInjectableFactory(token);
11496
11507
  }
11497
11508
  // There was no way to resolve a factory for this token.
11498
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'unreachable' : '';
11499
- throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, errorMessage);
11509
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, ngDevMode && 'unreachable');
11500
11510
  }
11501
11511
  function getUndecoratedInjectableFactory(token) {
11502
11512
  // If the token has parameters then it has dependencies that we cannot resolve implicitly.
11503
11513
  const paramLength = token.length;
11504
11514
  if (paramLength > 0) {
11505
11515
  const args = newArray(paramLength, '?');
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);
11516
+ throw new RuntimeError(204 /* INVALID_INJECTION_TOKEN */, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
11510
11517
  }
11511
11518
  // The constructor function appears to have no parameters.
11512
11519
  // This might be because it inherits from a super-class. In which case, use an injectable
@@ -21083,7 +21090,7 @@ class Version {
21083
21090
  /**
21084
21091
  * @publicApi
21085
21092
  */
21086
- const VERSION = new Version('14.0.0-next.0');
21093
+ const VERSION = new Version('14.0.0-next.1');
21087
21094
 
21088
21095
  /**
21089
21096
  * @license
@@ -24574,19 +24581,20 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
24574
24581
  *
24575
24582
  * ```
24576
24583
  *
24577
- * The following example registers another DOM event handler that listens for key-press events.
24584
+ * The following example registers another DOM event handler that listens for `Enter` key-press
24585
+ * events on the global `window`.
24578
24586
  * ``` ts
24579
24587
  * import { HostListener, Component } from "@angular/core";
24580
24588
  *
24581
24589
  * @Component({
24582
24590
  * selector: 'app',
24583
- * template: `<h1>Hello, you have pressed keys {{counter}} number of times!</h1> Press any key to
24584
- * increment the counter.
24591
+ * template: `<h1>Hello, you have pressed enter {{counter}} number of times!</h1> Press enter key
24592
+ * to increment the counter.
24585
24593
  * <button (click)="resetCounter()">Reset Counter</button>`
24586
24594
  * })
24587
24595
  * class AppComponent {
24588
24596
  * counter = 0;
24589
- * @HostListener('window:keydown', ['$event'])
24597
+ * @HostListener('window:keydown.enter', ['$event'])
24590
24598
  * handleKeyDown(event: KeyboardEvent) {
24591
24599
  * this.counter++;
24592
24600
  * }
@@ -24595,6 +24603,14 @@ const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ ho
24595
24603
  * }
24596
24604
  * }
24597
24605
  * ```
24606
+ * The list of valid key names for `keydown` and `keyup` events
24607
+ * can be found here:
24608
+ * https://www.w3.org/TR/DOM-Level-3-Events-key/#named-key-attribute-values
24609
+ *
24610
+ * Note that keys can also be combined, e.g. `@HostListener('keydown.shift.a')`.
24611
+ *
24612
+ * The global target names that can be used to prefix an event name are
24613
+ * `document:`, `window:` and `body:`.
24598
24614
  *
24599
24615
  * @Annotation
24600
24616
  * @publicApi