@angular/core 14.0.0-next.10 → 14.0.0-next.13

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 (39) hide show
  1. package/core.d.ts +1 -2
  2. package/esm2020/src/application_ref.mjs +10 -11
  3. package/esm2020/src/application_tokens.mjs +5 -2
  4. package/esm2020/src/change_detection/change_detection.mjs +2 -2
  5. package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +2 -2
  6. package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +2 -2
  7. package/esm2020/src/console.mjs +4 -3
  8. package/esm2020/src/core_private_export.mjs +3 -2
  9. package/esm2020/src/platform_core_providers.mjs +3 -14
  10. package/esm2020/src/render3/bindings.mjs +2 -2
  11. package/esm2020/src/render3/instructions/element.mjs +22 -7
  12. package/esm2020/src/render3/instructions/shared.mjs +35 -15
  13. package/esm2020/src/testability/testability.mjs +4 -3
  14. package/esm2020/src/version.mjs +1 -1
  15. package/esm2020/testing/src/logger.mjs +3 -3
  16. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  17. package/esm2020/testing/src/r3_test_bed.mjs +5 -8
  18. package/esm2020/testing/src/test_bed.mjs +1 -1
  19. package/esm2020/testing/src/test_bed_common.mjs +1 -1
  20. package/fesm2015/core.mjs +103 -59
  21. package/fesm2015/core.mjs.map +1 -1
  22. package/fesm2015/testing.mjs +5 -8
  23. package/fesm2015/testing.mjs.map +1 -1
  24. package/fesm2020/core.mjs +103 -59
  25. package/fesm2020/core.mjs.map +1 -1
  26. package/fesm2020/testing.mjs +5 -8
  27. package/fesm2020/testing.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/schematics/migrations/path-match-type/index.d.ts +11 -0
  30. package/schematics/migrations/path-match-type/index.js +95 -0
  31. package/schematics/migrations/path-match-type/transform.d.ts +19 -0
  32. package/schematics/migrations/path-match-type/transform.js +48 -0
  33. package/schematics/migrations/path-match-type/update_recorder.d.ts +18 -0
  34. package/schematics/migrations/path-match-type/update_recorder.js +20 -0
  35. package/schematics/migrations/path-match-type/util.d.ts +11 -0
  36. package/schematics/migrations/path-match-type/util.js +106 -0
  37. package/schematics/migrations.json +8 -3
  38. package/testing/testing.d.ts +1 -42
  39. package/esm2020/src/change_detection/change_detection_util.mjs +0 -64
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.10
2
+ * @license Angular v14.0.0-next.13
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -10237,9 +10237,9 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
10237
10237
  propName = mapPropName(propName);
10238
10238
  if (ngDevMode) {
10239
10239
  validateAgainstEventProperties(propName);
10240
- if (!validateProperty(tView, element, propName, tNode)) {
10240
+ if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
10241
10241
  // Return here since we only log warnings for unknown properties.
10242
- logUnknownPropertyError(propName, tNode);
10242
+ logUnknownPropertyError(propName, tNode.value);
10243
10243
  return;
10244
10244
  }
10245
10245
  ngDevMode.rendererSetProperty++;
@@ -10258,8 +10258,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
10258
10258
  else if (tNode.type & 12 /* AnyContainer */) {
10259
10259
  // If the node is a container and the property didn't
10260
10260
  // match any of the inputs or schemas we should throw.
10261
- if (ngDevMode && !matchingSchemas(tView, tNode.value)) {
10262
- logUnknownPropertyError(propName, tNode);
10261
+ if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
10262
+ logUnknownPropertyError(propName, tNode.value);
10263
10263
  }
10264
10264
  }
10265
10265
  }
@@ -10311,24 +10311,44 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
10311
10311
  }
10312
10312
  }
10313
10313
  }
10314
- function validateProperty(tView, element, propName, tNode) {
10314
+ /**
10315
+ * Validates that the property of the element is known at runtime and returns
10316
+ * false if it's not the case.
10317
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10318
+ * ones this check happens at build time).
10319
+ *
10320
+ * The property is considered known if either:
10321
+ * - it's a known property of the element
10322
+ * - the element is allowed by one of the schemas
10323
+ * - the property is used for animations
10324
+ *
10325
+ * @param element Element to validate
10326
+ * @param tagName Name of the tag to check
10327
+ * @param propName Name of the property to check
10328
+ * @param schemas Array of schemas
10329
+ */
10330
+ function validateProperty(element, tagName, propName, schemas) {
10315
10331
  // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10316
10332
  // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10317
10333
  // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10318
10334
  // execute the check below.
10319
- if (tView.schemas === null)
10335
+ if (schemas === null)
10320
10336
  return true;
10321
- // The property is considered valid if the element matches the schema, it exists on the element
10337
+ // The property is considered valid if the element matches the schema, it exists on the element,
10322
10338
  // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
10323
- if (matchingSchemas(tView, tNode.value) || propName in element || isAnimationProp(propName)) {
10339
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
10324
10340
  return true;
10325
10341
  }
10326
10342
  // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
10327
- // need to account for both here, while being careful for `typeof null` also returning 'object'.
10343
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
10328
10344
  return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
10329
10345
  }
10330
- function matchingSchemas(tView, tagName) {
10331
- const schemas = tView.schemas;
10346
+ /**
10347
+ * Returns true if the tag name is allowed by specified schemas.
10348
+ * @param schemas Array of schemas
10349
+ * @param tagName Name of the tag
10350
+ */
10351
+ function matchingSchemas(schemas, tagName) {
10332
10352
  if (schemas !== null) {
10333
10353
  for (let i = 0; i < schemas.length; i++) {
10334
10354
  const schema = schemas[i];
@@ -10343,10 +10363,10 @@ function matchingSchemas(tView, tagName) {
10343
10363
  /**
10344
10364
  * Logs an error that a property is not supported on an element.
10345
10365
  * @param propName Name of the invalid property.
10346
- * @param tNode Node on which we encountered the property.
10366
+ * @param tagName Name of the node on which we encountered the property.
10347
10367
  */
10348
- function logUnknownPropertyError(propName, tNode) {
10349
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tNode.value}'.`;
10368
+ function logUnknownPropertyError(propName, tagName) {
10369
+ const message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'.`;
10350
10370
  console.error(formatRuntimeError(303 /* UNKNOWN_BINDING */, message));
10351
10371
  }
10352
10372
  /**
@@ -12823,22 +12843,8 @@ function getSymbolIterator() {
12823
12843
  * Use of this source code is governed by an MIT-style license that can be
12824
12844
  * found in the LICENSE file at https://angular.io/license
12825
12845
  */
12826
- function devModeEqual(a, b) {
12827
- const isListLikeIterableA = isListLikeIterable(a);
12828
- const isListLikeIterableB = isListLikeIterable(b);
12829
- if (isListLikeIterableA && isListLikeIterableB) {
12830
- return areIterablesEqual(a, b, devModeEqual);
12831
- }
12832
- else {
12833
- const isAObject = a && (typeof a === 'object' || typeof a === 'function');
12834
- const isBObject = b && (typeof b === 'object' || typeof b === 'function');
12835
- if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
12836
- return true;
12837
- }
12838
- else {
12839
- return Object.is(a, b);
12840
- }
12841
- }
12846
+ function isIterable(obj) {
12847
+ return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
12842
12848
  }
12843
12849
  function isListLikeIterable(obj) {
12844
12850
  if (!isJsObject(obj))
@@ -12879,6 +12885,31 @@ function isJsObject(o) {
12879
12885
  return o !== null && (typeof o === 'function' || typeof o === 'object');
12880
12886
  }
12881
12887
 
12888
+ /**
12889
+ * @license
12890
+ * Copyright Google LLC All Rights Reserved.
12891
+ *
12892
+ * Use of this source code is governed by an MIT-style license that can be
12893
+ * found in the LICENSE file at https://angular.io/license
12894
+ */
12895
+ function devModeEqual(a, b) {
12896
+ const isListLikeIterableA = isListLikeIterable(a);
12897
+ const isListLikeIterableB = isListLikeIterable(b);
12898
+ if (isListLikeIterableA && isListLikeIterableB) {
12899
+ return areIterablesEqual(a, b, devModeEqual);
12900
+ }
12901
+ else {
12902
+ const isAObject = a && (typeof a === 'object' || typeof a === 'function');
12903
+ const isBObject = b && (typeof b === 'object' || typeof b === 'function');
12904
+ if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
12905
+ return true;
12906
+ }
12907
+ else {
12908
+ return Object.is(a, b);
12909
+ }
12910
+ }
12911
+ }
12912
+
12882
12913
  /**
12883
12914
  * @license
12884
12915
  * Copyright Google LLC All Rights Reserved.
@@ -14623,7 +14654,7 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
14623
14654
  const attrs = getConstant(tViewConsts, attrsIndex);
14624
14655
  const tNode = getOrCreateTNode(tView, index, 2 /* Element */, name, attrs);
14625
14656
  const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
14626
- ngDevMode && logUnknownElementError(tView, native, tNode, hasDirectives);
14657
+ ngDevMode && validateElementIsKnown(native, tNode.value, tView.schemas, hasDirectives);
14627
14658
  if (tNode.attrs !== null) {
14628
14659
  computeStaticStyling(tNode, tNode.attrs, false);
14629
14660
  }
@@ -14747,18 +14778,33 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
14747
14778
  ɵɵelementEnd();
14748
14779
  return ɵɵelement;
14749
14780
  }
14750
- function logUnknownElementError(tView, element, tNode, hasDirectives) {
14751
- const schemas = tView.schemas;
14781
+ /**
14782
+ * Validates that the element is known at runtime and produces
14783
+ * an error if it's not the case.
14784
+ * This check is relevant for JIT-compiled components (for AOT-compiled
14785
+ * ones this check happens at build time).
14786
+ *
14787
+ * The element is considered known if either:
14788
+ * - it's a known HTML element
14789
+ * - it's a known custom element
14790
+ * - the element matches any directive
14791
+ * - the element is allowed by one of the schemas
14792
+ *
14793
+ * @param element Element to validate
14794
+ * @param tagName Name of the tag to check
14795
+ * @param schemas Array of schemas
14796
+ * @param hasDirectives Boolean indicating that the element matches any directive
14797
+ */
14798
+ function validateElementIsKnown(element, tagName, schemas, hasDirectives) {
14752
14799
  // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
14753
14800
  // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
14754
14801
  // defined as an array (as an empty array in case `schemas` field is not defined) and we should
14755
14802
  // execute the check below.
14756
14803
  if (schemas === null)
14757
14804
  return;
14758
- const tagName = tNode.value;
14759
14805
  // If the element matches any directive, it's considered as valid.
14760
14806
  if (!hasDirectives && tagName !== null) {
14761
- // The element is unknown if it's an instance of HTMLUnknownElement or it isn't registered
14807
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
14762
14808
  // as a custom element. Note that unknown elements with a dash in their name won't be instances
14763
14809
  // of HTMLUnknownElement in browsers that support web components.
14764
14810
  const isUnknown =
@@ -14768,7 +14814,7 @@ function logUnknownElementError(tView, element, tNode, hasDirectives) {
14768
14814
  element instanceof HTMLUnknownElement) ||
14769
14815
  (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
14770
14816
  !customElements.get(tagName));
14771
- if (isUnknown && !matchingSchemas(tView, tagName)) {
14817
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
14772
14818
  let message = `'${tagName}' is not a known element:\n`;
14773
14819
  message += `1. If '${tagName}' is an Angular component, then verify that it is part of this module.\n`;
14774
14820
  if (tagName && tagName.indexOf('-') > -1) {
@@ -21238,7 +21284,7 @@ class Version {
21238
21284
  /**
21239
21285
  * @publicApi
21240
21286
  */
21241
- const VERSION = new Version('14.0.0-next.10');
21287
+ const VERSION = new Version('14.0.0-next.13');
21242
21288
 
21243
21289
  /**
21244
21290
  * @license
@@ -24962,7 +25008,10 @@ const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
24962
25008
  * A token that indicates an opaque platform ID.
24963
25009
  * @publicApi
24964
25010
  */
24965
- const PLATFORM_ID = new InjectionToken('Platform ID');
25011
+ const PLATFORM_ID = new InjectionToken('Platform ID', {
25012
+ providedIn: 'platform',
25013
+ factory: () => 'unknown', // set a default platform name, when none set explicitly
25014
+ });
24966
25015
  /**
24967
25016
  * A [DI token](guide/glossary#di-token "DI token definition") that provides a set of callbacks to
24968
25017
  * be called for every component that is bootstrapped.
@@ -25009,10 +25058,11 @@ class Console {
25009
25058
  }
25010
25059
  }
25011
25060
  Console.ɵfac = function Console_Factory(t) { return new (t || Console)(); };
25012
- Console.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: Console, factory: Console.ɵfac });
25061
+ Console.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: Console, factory: Console.ɵfac, providedIn: 'platform' });
25013
25062
  (function () {
25014
25063
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Console, [{
25015
- type: Injectable
25064
+ type: Injectable,
25065
+ args: [{ providedIn: 'platform' }]
25016
25066
  }], null, null);
25017
25067
  })();
25018
25068
 
@@ -25975,10 +26025,11 @@ class TestabilityRegistry {
25975
26025
  }
25976
26026
  }
25977
26027
  TestabilityRegistry.ɵfac = function TestabilityRegistry_Factory(t) { return new (t || TestabilityRegistry)(); };
25978
- TestabilityRegistry.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: TestabilityRegistry, factory: TestabilityRegistry.ɵfac });
26028
+ TestabilityRegistry.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: TestabilityRegistry, factory: TestabilityRegistry.ɵfac, providedIn: 'platform' });
25979
26029
  (function () {
25980
26030
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TestabilityRegistry, [{
25981
- type: Injectable
26031
+ type: Injectable,
26032
+ args: [{ providedIn: 'platform' }]
25982
26033
  }], function () { return []; }, null);
25983
26034
  })();
25984
26035
  class _NoopGetTestability {
@@ -26291,10 +26342,11 @@ class PlatformRef {
26291
26342
  }
26292
26343
  }
26293
26344
  PlatformRef.ɵfac = function PlatformRef_Factory(t) { return new (t || PlatformRef)(ɵɵinject(Injector)); };
26294
- PlatformRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PlatformRef, factory: PlatformRef.ɵfac });
26345
+ PlatformRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PlatformRef, factory: PlatformRef.ɵfac, providedIn: 'platform' });
26295
26346
  (function () {
26296
26347
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformRef, [{
26297
- type: Injectable
26348
+ type: Injectable,
26349
+ args: [{ providedIn: 'platform' }]
26298
26350
  }], function () { return [{ type: Injector }]; }, null);
26299
26351
  })();
26300
26352
  function getNgZone(ngZoneOption, extra) {
@@ -26433,11 +26485,10 @@ function optionsReducer(dst, objs) {
26433
26485
  */
26434
26486
  class ApplicationRef {
26435
26487
  /** @internal */
26436
- constructor(_zone, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
26488
+ constructor(_zone, _injector, _exceptionHandler, _initStatus) {
26437
26489
  this._zone = _zone;
26438
26490
  this._injector = _injector;
26439
26491
  this._exceptionHandler = _exceptionHandler;
26440
- this._componentFactoryResolver = _componentFactoryResolver;
26441
26492
  this._initStatus = _initStatus;
26442
26493
  /** @internal */
26443
26494
  this._bootstrapListeners = [];
@@ -26553,8 +26604,8 @@ class ApplicationRef {
26553
26604
  componentFactory = componentOrFactory;
26554
26605
  }
26555
26606
  else {
26556
- componentFactory =
26557
- this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
26607
+ const resolver = this._injector.get(ComponentFactoryResolver$1);
26608
+ componentFactory = resolver.resolveComponentFactory(componentOrFactory);
26558
26609
  }
26559
26610
  this.componentTypes.push(componentFactory.componentType);
26560
26611
  // Create a factory associated with the current module if it's not bound to some other
@@ -26655,13 +26706,13 @@ class ApplicationRef {
26655
26706
  return this._views.length;
26656
26707
  }
26657
26708
  }
26658
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ComponentFactoryResolver$1), ɵɵinject(ApplicationInitStatus)); };
26709
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
26659
26710
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
26660
26711
  (function () {
26661
26712
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
26662
26713
  type: Injectable,
26663
26714
  args: [{ providedIn: 'root' }]
26664
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ComponentFactoryResolver$1 }, { type: ApplicationInitStatus }]; }, null);
26715
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null);
26665
26716
  })();
26666
26717
  function remove(list, el) {
26667
26718
  const index = list.indexOf(el);
@@ -28645,19 +28696,12 @@ const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
28645
28696
  * Use of this source code is governed by an MIT-style license that can be
28646
28697
  * found in the LICENSE file at https://angular.io/license
28647
28698
  */
28648
- const _CORE_PLATFORM_PROVIDERS = [
28649
- // Set a default platform name for platforms that don't set it explicitly.
28650
- { provide: PLATFORM_ID, useValue: 'unknown' },
28651
- { provide: PlatformRef, deps: [Injector] },
28652
- { provide: TestabilityRegistry, deps: [] },
28653
- { provide: Console, deps: [] },
28654
- ];
28655
28699
  /**
28656
28700
  * This platform has to be included in any other platform
28657
28701
  *
28658
28702
  * @publicApi
28659
28703
  */
28660
- const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
28704
+ const platformCore = createPlatformFactory(null, 'core', []);
28661
28705
 
28662
28706
  /**
28663
28707
  * Re-exported by `BrowserModule`, which is included automatically in the root