@angular/core 18.2.10 → 18.2.12

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.
package/fesm2022/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.10
2
+ * @license Angular v18.2.12
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -16940,7 +16940,7 @@ function createRootComponent(componentView, rootComponentDef, rootDirectives, ho
16940
16940
  function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
16941
16941
  if (rootSelectorOrNode) {
16942
16942
  // The placeholder will be replaced with the actual version at build time.
16943
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', '18.2.10']);
16943
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', '18.2.12']);
16944
16944
  }
16945
16945
  else {
16946
16946
  // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
@@ -18764,21 +18764,18 @@ function ɵɵCopyDefinitionFeature(definition) {
18764
18764
  */
18765
18765
  function ɵɵHostDirectivesFeature(rawHostDirectives) {
18766
18766
  const feature = (definition) => {
18767
- const resolved = (Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives()).map((dir) => {
18768
- return typeof dir === 'function'
18769
- ? { directive: resolveForwardRef(dir), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ }
18770
- : {
18771
- directive: resolveForwardRef(dir.directive),
18772
- inputs: bindingArrayToMap(dir.inputs),
18773
- outputs: bindingArrayToMap(dir.outputs),
18774
- };
18775
- });
18767
+ const isEager = Array.isArray(rawHostDirectives);
18776
18768
  if (definition.hostDirectives === null) {
18777
18769
  definition.findHostDirectiveDefs = findHostDirectiveDefs;
18778
- definition.hostDirectives = resolved;
18770
+ definition.hostDirectives = isEager
18771
+ ? rawHostDirectives.map(createHostDirectiveDef)
18772
+ : [rawHostDirectives];
18773
+ }
18774
+ else if (isEager) {
18775
+ definition.hostDirectives.unshift(...rawHostDirectives.map(createHostDirectiveDef));
18779
18776
  }
18780
18777
  else {
18781
- definition.hostDirectives.unshift(...resolved);
18778
+ definition.hostDirectives.unshift(rawHostDirectives);
18782
18779
  }
18783
18780
  };
18784
18781
  feature.ngInherit = true;
@@ -18786,21 +18783,43 @@ function ɵɵHostDirectivesFeature(rawHostDirectives) {
18786
18783
  }
18787
18784
  function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs) {
18788
18785
  if (currentDef.hostDirectives !== null) {
18789
- for (const hostDirectiveConfig of currentDef.hostDirectives) {
18790
- const hostDirectiveDef = getDirectiveDef(hostDirectiveConfig.directive);
18791
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
18792
- validateHostDirective(hostDirectiveConfig, hostDirectiveDef);
18786
+ for (const configOrFn of currentDef.hostDirectives) {
18787
+ if (typeof configOrFn === 'function') {
18788
+ const resolved = configOrFn();
18789
+ for (const config of resolved) {
18790
+ trackHostDirectiveDef(createHostDirectiveDef(config), matchedDefs, hostDirectiveDefs);
18791
+ }
18792
+ }
18793
+ else {
18794
+ trackHostDirectiveDef(configOrFn, matchedDefs, hostDirectiveDefs);
18793
18795
  }
18794
- // We need to patch the `declaredInputs` so that
18795
- // `ngOnChanges` can map the properties correctly.
18796
- patchDeclaredInputs(hostDirectiveDef.declaredInputs, hostDirectiveConfig.inputs);
18797
- // Host directives execute before the host so that its host bindings can be overwritten.
18798
- findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
18799
- hostDirectiveDefs.set(hostDirectiveDef, hostDirectiveConfig);
18800
- matchedDefs.push(hostDirectiveDef);
18801
18796
  }
18802
18797
  }
18803
18798
  }
18799
+ /** Tracks a single host directive during directive matching. */
18800
+ function trackHostDirectiveDef(def, matchedDefs, hostDirectiveDefs) {
18801
+ const hostDirectiveDef = getDirectiveDef(def.directive);
18802
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
18803
+ validateHostDirective(def, hostDirectiveDef);
18804
+ }
18805
+ // We need to patch the `declaredInputs` so that
18806
+ // `ngOnChanges` can map the properties correctly.
18807
+ patchDeclaredInputs(hostDirectiveDef.declaredInputs, def.inputs);
18808
+ // Host directives execute before the host so that its host bindings can be overwritten.
18809
+ findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
18810
+ hostDirectiveDefs.set(hostDirectiveDef, def);
18811
+ matchedDefs.push(hostDirectiveDef);
18812
+ }
18813
+ /** Creates a `HostDirectiveDef` from a used-defined host directive configuration. */
18814
+ function createHostDirectiveDef(config) {
18815
+ return typeof config === 'function'
18816
+ ? { directive: resolveForwardRef(config), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ }
18817
+ : {
18818
+ directive: resolveForwardRef(config.directive),
18819
+ inputs: bindingArrayToMap(config.inputs),
18820
+ outputs: bindingArrayToMap(config.outputs),
18821
+ };
18822
+ }
18804
18823
  /**
18805
18824
  * Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
18806
18825
  * a map in the form of `{publicName: 'alias', otherPublicName: 'otherAlias'}`.
@@ -23929,8 +23948,11 @@ class UniqueValueMultiKeyMap {
23929
23948
  set(key, value) {
23930
23949
  if (this.kvMap.has(key)) {
23931
23950
  let prevValue = this.kvMap.get(key);
23932
- ngDevMode &&
23933
- assertNotSame(prevValue, value, `Detected a duplicated value ${value} for the key ${key}`);
23951
+ // Note: we don't use `assertNotSame`, because the value needs to be stringified even if
23952
+ // there is no error which can freeze the browser for large values (see #58509).
23953
+ if (ngDevMode && prevValue === value) {
23954
+ throw new Error(`Detected a duplicated value ${value} for the key ${key}`);
23955
+ }
23934
23956
  if (this._vMap === undefined) {
23935
23957
  this._vMap = new Map();
23936
23958
  }
@@ -31034,7 +31056,7 @@ class Version {
31034
31056
  /**
31035
31057
  * @publicApi
31036
31058
  */
31037
- const VERSION = new Version('18.2.10');
31059
+ const VERSION = new Version('18.2.12');
31038
31060
 
31039
31061
  /*
31040
31062
  * This file exists to support compilation of @angular/core in Ivy mode.