@angular/core 13.3.0 → 13.3.3

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.3.0
2
+ * @license Angular v13.3.3
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.3.0
2
+ * @license Angular v13.3.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -10046,9 +10046,9 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
10046
10046
  propName = mapPropName(propName);
10047
10047
  if (ngDevMode) {
10048
10048
  validateAgainstEventProperties(propName);
10049
- if (!validateProperty(tView, element, propName, tNode)) {
10049
+ if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
10050
10050
  // Return here since we only log warnings for unknown properties.
10051
- logUnknownPropertyError(propName, tNode);
10051
+ logUnknownPropertyError(propName, tNode.value);
10052
10052
  return;
10053
10053
  }
10054
10054
  ngDevMode.rendererSetProperty++;
@@ -10067,8 +10067,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
10067
10067
  else if (tNode.type & 12 /* AnyContainer */) {
10068
10068
  // If the node is a container and the property didn't
10069
10069
  // match any of the inputs or schemas we should throw.
10070
- if (ngDevMode && !matchingSchemas(tView, tNode.value)) {
10071
- logUnknownPropertyError(propName, tNode);
10070
+ if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
10071
+ logUnknownPropertyError(propName, tNode.value);
10072
10072
  }
10073
10073
  }
10074
10074
  }
@@ -10120,24 +10120,44 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
10120
10120
  }
10121
10121
  }
10122
10122
  }
10123
- function validateProperty(tView, element, propName, tNode) {
10123
+ /**
10124
+ * Validates that the property of the element is known at runtime and returns
10125
+ * false if it's not the case.
10126
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10127
+ * ones this check happens at build time).
10128
+ *
10129
+ * The property is considered known if either:
10130
+ * - it's a known property of the element
10131
+ * - the element is allowed by one of the schemas
10132
+ * - the property is used for animations
10133
+ *
10134
+ * @param element Element to validate
10135
+ * @param tagName Name of the tag to check
10136
+ * @param propName Name of the property to check
10137
+ * @param schemas Array of schemas
10138
+ */
10139
+ function validateProperty(element, tagName, propName, schemas) {
10124
10140
  // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10125
10141
  // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10126
10142
  // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10127
10143
  // execute the check below.
10128
- if (tView.schemas === null)
10144
+ if (schemas === null)
10129
10145
  return true;
10130
- // The property is considered valid if the element matches the schema, it exists on the element
10146
+ // The property is considered valid if the element matches the schema, it exists on the element,
10131
10147
  // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
10132
- if (matchingSchemas(tView, tNode.value) || propName in element || isAnimationProp(propName)) {
10148
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
10133
10149
  return true;
10134
10150
  }
10135
10151
  // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
10136
- // need to account for both here, while being careful for `typeof null` also returning 'object'.
10152
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
10137
10153
  return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
10138
10154
  }
10139
- function matchingSchemas(tView, tagName) {
10140
- const schemas = tView.schemas;
10155
+ /**
10156
+ * Returns true if the tag name is allowed by specified schemas.
10157
+ * @param schemas Array of schemas
10158
+ * @param tagName Name of the tag
10159
+ */
10160
+ function matchingSchemas(schemas, tagName) {
10141
10161
  if (schemas !== null) {
10142
10162
  for (let i = 0; i < schemas.length; i++) {
10143
10163
  const schema = schemas[i];
@@ -10152,10 +10172,10 @@ function matchingSchemas(tView, tagName) {
10152
10172
  /**
10153
10173
  * Logs an error that a property is not supported on an element.
10154
10174
  * @param propName Name of the invalid property.
10155
- * @param tNode Node on which we encountered the property.
10175
+ * @param tagName Name of the node on which we encountered the property.
10156
10176
  */
10157
- function logUnknownPropertyError(propName, tNode) {
10158
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tNode.value}'.`;
10177
+ function logUnknownPropertyError(propName, tagName) {
10178
+ const message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'.`;
10159
10179
  console.error(formatRuntimeError(303 /* UNKNOWN_BINDING */, message));
10160
10180
  }
10161
10181
  /**
@@ -14487,7 +14507,7 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
14487
14507
  const attrs = getConstant(tViewConsts, attrsIndex);
14488
14508
  const tNode = getOrCreateTNode(tView, index, 2 /* Element */, name, attrs);
14489
14509
  const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
14490
- ngDevMode && logUnknownElementError(tView, native, tNode, hasDirectives);
14510
+ ngDevMode && validateElementIsKnown(native, tNode.value, tView.schemas, hasDirectives);
14491
14511
  if (tNode.attrs !== null) {
14492
14512
  computeStaticStyling(tNode, tNode.attrs, false);
14493
14513
  }
@@ -14611,18 +14631,33 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
14611
14631
  ɵɵelementEnd();
14612
14632
  return ɵɵelement;
14613
14633
  }
14614
- function logUnknownElementError(tView, element, tNode, hasDirectives) {
14615
- const schemas = tView.schemas;
14634
+ /**
14635
+ * Validates that the element is known at runtime and produces
14636
+ * an error if it's not the case.
14637
+ * This check is relevant for JIT-compiled components (for AOT-compiled
14638
+ * ones this check happens at build time).
14639
+ *
14640
+ * The element is considered known if either:
14641
+ * - it's a known HTML element
14642
+ * - it's a known custom element
14643
+ * - the element matches any directive
14644
+ * - the element is allowed by one of the schemas
14645
+ *
14646
+ * @param element Element to validate
14647
+ * @param tagName Name of the tag to check
14648
+ * @param schemas Array of schemas
14649
+ * @param hasDirectives Boolean indicating that the element matches any directive
14650
+ */
14651
+ function validateElementIsKnown(element, tagName, schemas, hasDirectives) {
14616
14652
  // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
14617
14653
  // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
14618
14654
  // defined as an array (as an empty array in case `schemas` field is not defined) and we should
14619
14655
  // execute the check below.
14620
14656
  if (schemas === null)
14621
14657
  return;
14622
- const tagName = tNode.value;
14623
14658
  // If the element matches any directive, it's considered as valid.
14624
14659
  if (!hasDirectives && tagName !== null) {
14625
- // The element is unknown if it's an instance of HTMLUnknownElement or it isn't registered
14660
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
14626
14661
  // as a custom element. Note that unknown elements with a dash in their name won't be instances
14627
14662
  // of HTMLUnknownElement in browsers that support web components.
14628
14663
  const isUnknown =
@@ -14632,7 +14667,7 @@ function logUnknownElementError(tView, element, tNode, hasDirectives) {
14632
14667
  element instanceof HTMLUnknownElement) ||
14633
14668
  (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
14634
14669
  !customElements.get(tagName));
14635
- if (isUnknown && !matchingSchemas(tView, tagName)) {
14670
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
14636
14671
  let message = `'${tagName}' is not a known element:\n`;
14637
14672
  message += `1. If '${tagName}' is an Angular component, then verify that it is part of this module.\n`;
14638
14673
  if (tagName && tagName.indexOf('-') > -1) {
@@ -21102,7 +21137,7 @@ class Version {
21102
21137
  /**
21103
21138
  * @publicApi
21104
21139
  */
21105
- const VERSION = new Version('13.3.0');
21140
+ const VERSION = new Version('13.3.3');
21106
21141
 
21107
21142
  /**
21108
21143
  * @license
@@ -24887,7 +24922,10 @@ const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
24887
24922
  * A token that indicates an opaque platform ID.
24888
24923
  * @publicApi
24889
24924
  */
24890
- const PLATFORM_ID = new InjectionToken('Platform ID');
24925
+ const PLATFORM_ID = new InjectionToken('Platform ID', {
24926
+ providedIn: 'platform',
24927
+ factory: () => 'unknown', // set a default platform name, when none set explicitly
24928
+ });
24891
24929
  /**
24892
24930
  * A [DI token](guide/glossary#di-token "DI token definition") that provides a set of callbacks to
24893
24931
  * be called for every component that is bootstrapped.
@@ -24925,9 +24963,10 @@ class Console {
24925
24963
  }
24926
24964
  }
24927
24965
  Console.ɵfac = function Console_Factory(t) { return new (t || Console)(); };
24928
- Console.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: Console, factory: Console.ɵfac });
24966
+ Console.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: Console, factory: Console.ɵfac, providedIn: 'platform' });
24929
24967
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Console, [{
24930
- type: Injectable
24968
+ type: Injectable,
24969
+ args: [{ providedIn: 'platform' }]
24931
24970
  }], null, null); })();
24932
24971
 
24933
24972
  /**
@@ -25885,9 +25924,10 @@ class TestabilityRegistry {
25885
25924
  }
25886
25925
  }
25887
25926
  TestabilityRegistry.ɵfac = function TestabilityRegistry_Factory(t) { return new (t || TestabilityRegistry)(); };
25888
- TestabilityRegistry.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: TestabilityRegistry, factory: TestabilityRegistry.ɵfac });
25927
+ TestabilityRegistry.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: TestabilityRegistry, factory: TestabilityRegistry.ɵfac, providedIn: 'platform' });
25889
25928
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TestabilityRegistry, [{
25890
- type: Injectable
25929
+ type: Injectable,
25930
+ args: [{ providedIn: 'platform' }]
25891
25931
  }], function () { return []; }, null); })();
25892
25932
  class _NoopGetTestability {
25893
25933
  addToWindow(registry) { }
@@ -26199,9 +26239,10 @@ class PlatformRef {
26199
26239
  }
26200
26240
  }
26201
26241
  PlatformRef.ɵfac = function PlatformRef_Factory(t) { return new (t || PlatformRef)(ɵɵinject(Injector)); };
26202
- PlatformRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PlatformRef, factory: PlatformRef.ɵfac });
26242
+ PlatformRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PlatformRef, factory: PlatformRef.ɵfac, providedIn: 'platform' });
26203
26243
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformRef, [{
26204
- type: Injectable
26244
+ type: Injectable,
26245
+ args: [{ providedIn: 'platform' }]
26205
26246
  }], function () { return [{ type: Injector }]; }, null); })();
26206
26247
  function getNgZone(ngZoneOption, extra) {
26207
26248
  let ngZone;
@@ -26339,11 +26380,10 @@ function optionsReducer(dst, objs) {
26339
26380
  */
26340
26381
  class ApplicationRef {
26341
26382
  /** @internal */
26342
- constructor(_zone, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
26383
+ constructor(_zone, _injector, _exceptionHandler, _initStatus) {
26343
26384
  this._zone = _zone;
26344
26385
  this._injector = _injector;
26345
26386
  this._exceptionHandler = _exceptionHandler;
26346
- this._componentFactoryResolver = _componentFactoryResolver;
26347
26387
  this._initStatus = _initStatus;
26348
26388
  /** @internal */
26349
26389
  this._bootstrapListeners = [];
@@ -26459,8 +26499,8 @@ class ApplicationRef {
26459
26499
  componentFactory = componentOrFactory;
26460
26500
  }
26461
26501
  else {
26462
- componentFactory =
26463
- this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
26502
+ const resolver = this._injector.get(ComponentFactoryResolver$1);
26503
+ componentFactory = resolver.resolveComponentFactory(componentOrFactory);
26464
26504
  }
26465
26505
  this.componentTypes.push(componentFactory.componentType);
26466
26506
  // Create a factory associated with the current module if it's not bound to some other
@@ -26561,12 +26601,12 @@ class ApplicationRef {
26561
26601
  return this._views.length;
26562
26602
  }
26563
26603
  }
26564
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ComponentFactoryResolver$1), ɵɵinject(ApplicationInitStatus)); };
26604
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
26565
26605
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
26566
26606
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
26567
26607
  type: Injectable,
26568
26608
  args: [{ providedIn: 'root' }]
26569
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ComponentFactoryResolver$1 }, { type: ApplicationInitStatus }]; }, null); })();
26609
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null); })();
26570
26610
  function remove(list, el) {
26571
26611
  const index = list.indexOf(el);
26572
26612
  if (index > -1) {
@@ -28548,19 +28588,12 @@ const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
28548
28588
  * Use of this source code is governed by an MIT-style license that can be
28549
28589
  * found in the LICENSE file at https://angular.io/license
28550
28590
  */
28551
- const _CORE_PLATFORM_PROVIDERS = [
28552
- // Set a default platform name for platforms that don't set it explicitly.
28553
- { provide: PLATFORM_ID, useValue: 'unknown' },
28554
- { provide: PlatformRef, deps: [Injector] },
28555
- { provide: TestabilityRegistry, deps: [] },
28556
- { provide: Console, deps: [] },
28557
- ];
28558
28591
  /**
28559
28592
  * This platform has to be included in any other platform
28560
28593
  *
28561
28594
  * @publicApi
28562
28595
  */
28563
- const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
28596
+ const platformCore = createPlatformFactory(null, 'core', []);
28564
28597
 
28565
28598
  /**
28566
28599
  * @license