@angular/core 15.2.2 → 15.2.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.
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.2.2
2
+ * @license Angular v15.2.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -935,7 +935,7 @@ let componentDefCount = 0;
935
935
  *
936
936
  * # Example
937
937
  * ```
938
- * class MyDirective {
938
+ * class MyComponent {
939
939
  * // Generated by Angular Template Compiler
940
940
  * // [Symbol] syntax will not be supported by TypeScript until v2.7
941
941
  * static ɵcmp = defineComponent({
@@ -950,61 +950,12 @@ function ɵɵdefineComponent(componentDefinition) {
950
950
  // Initialize ngDevMode. This must be the first statement in ɵɵdefineComponent.
951
951
  // See the `initNgDevMode` docstring for more information.
952
952
  (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
953
- const type = componentDefinition.type;
954
- const standalone = componentDefinition.standalone === true;
955
- const declaredInputs = {};
956
- const def = {
957
- type: type,
958
- providersResolver: null,
959
- decls: componentDefinition.decls,
960
- vars: componentDefinition.vars,
961
- factory: null,
962
- template: componentDefinition.template || null,
963
- consts: componentDefinition.consts || null,
964
- ngContentSelectors: componentDefinition.ngContentSelectors,
965
- hostBindings: componentDefinition.hostBindings || null,
966
- hostVars: componentDefinition.hostVars || 0,
967
- hostAttrs: componentDefinition.hostAttrs || null,
968
- contentQueries: componentDefinition.contentQueries || null,
969
- declaredInputs: declaredInputs,
970
- inputs: null,
971
- outputs: null,
972
- exportAs: componentDefinition.exportAs || null,
973
- onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
974
- directiveDefs: null,
975
- pipeDefs: null,
976
- standalone,
977
- dependencies: standalone && componentDefinition.dependencies || null,
978
- getStandaloneInjector: null,
979
- selectors: componentDefinition.selectors || EMPTY_ARRAY,
980
- viewQuery: componentDefinition.viewQuery || null,
981
- features: componentDefinition.features || null,
982
- data: componentDefinition.data || {},
983
- encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
984
- id: `c${componentDefCount++}`,
985
- styles: componentDefinition.styles || EMPTY_ARRAY,
986
- _: null,
987
- setInput: null,
988
- schemas: componentDefinition.schemas || null,
989
- tView: null,
990
- findHostDirectiveDefs: null,
991
- hostDirectives: null,
992
- };
953
+ const baseDef = getNgDirectiveDef(componentDefinition);
954
+ const def = Object.assign(Object.assign({}, baseDef), { decls: componentDefinition.decls, vars: componentDefinition.vars, template: componentDefinition.template, consts: componentDefinition.consts || null, ngContentSelectors: componentDefinition.ngContentSelectors, onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush, directiveDefs: null, pipeDefs: null, dependencies: baseDef.standalone && componentDefinition.dependencies || null, getStandaloneInjector: null, data: componentDefinition.data || {}, encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated, id: `c${componentDefCount++}`, styles: componentDefinition.styles || EMPTY_ARRAY, _: null, schemas: componentDefinition.schemas || null, tView: null });
955
+ initFeatures(def);
993
956
  const dependencies = componentDefinition.dependencies;
994
- const feature = componentDefinition.features;
995
- def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
996
- def.outputs = invertObject(componentDefinition.outputs),
997
- feature && feature.forEach((fn) => fn(def));
998
- def.directiveDefs = dependencies ?
999
- (() => (typeof dependencies === 'function' ? dependencies() : dependencies)
1000
- .map(extractDirectiveDef)
1001
- .filter(nonNull)) :
1002
- null;
1003
- def.pipeDefs = dependencies ?
1004
- (() => (typeof dependencies === 'function' ? dependencies() : dependencies)
1005
- .map(getPipeDef$1)
1006
- .filter(nonNull)) :
1007
- null;
957
+ def.directiveDefs = extractDefListOrFactory(dependencies, /* pipeDef */ false);
958
+ def.pipeDefs = extractDefListOrFactory(dependencies, /* pipeDef */ true);
1008
959
  return def;
1009
960
  });
1010
961
  }
@@ -1019,8 +970,8 @@ function ɵɵdefineComponent(componentDefinition) {
1019
970
  */
1020
971
  function ɵɵsetComponentScope(type, directives, pipes) {
1021
972
  const def = type.ɵcmp;
1022
- def.directiveDefs = () => (typeof directives === 'function' ? directives() : directives).map(extractDirectiveDef);
1023
- def.pipeDefs = () => (typeof pipes === 'function' ? pipes() : pipes).map(getPipeDef$1);
973
+ def.directiveDefs = extractDefListOrFactory(directives, /* pipeDef */ false);
974
+ def.pipeDefs = extractDefListOrFactory(pipes, /* pipeDef */ true);
1024
975
  }
1025
976
  function extractDirectiveDef(type) {
1026
977
  return getComponentDef(type) || getDirectiveDef(type);
@@ -1155,7 +1106,13 @@ function invertObject(obj, secondary) {
1155
1106
  *
1156
1107
  * @codeGenApi
1157
1108
  */
1158
- const ɵɵdefineDirective = ɵɵdefineComponent;
1109
+ function ɵɵdefineDirective(directiveDefinition) {
1110
+ return noSideEffects(() => {
1111
+ const def = getNgDirectiveDef(directiveDefinition);
1112
+ initFeatures(def);
1113
+ return def;
1114
+ });
1115
+ }
1159
1116
  /**
1160
1117
  * Create a pipe definition object.
1161
1118
  *
@@ -1215,6 +1172,42 @@ function getNgModuleDef(type, throwNotFound) {
1215
1172
  }
1216
1173
  return ngModuleDef;
1217
1174
  }
1175
+ function getNgDirectiveDef(directiveDefinition) {
1176
+ const declaredInputs = {};
1177
+ return {
1178
+ type: directiveDefinition.type,
1179
+ providersResolver: null,
1180
+ factory: null,
1181
+ hostBindings: directiveDefinition.hostBindings || null,
1182
+ hostVars: directiveDefinition.hostVars || 0,
1183
+ hostAttrs: directiveDefinition.hostAttrs || null,
1184
+ contentQueries: directiveDefinition.contentQueries || null,
1185
+ declaredInputs,
1186
+ exportAs: directiveDefinition.exportAs || null,
1187
+ standalone: directiveDefinition.standalone === true,
1188
+ selectors: directiveDefinition.selectors || EMPTY_ARRAY,
1189
+ viewQuery: directiveDefinition.viewQuery || null,
1190
+ features: directiveDefinition.features || null,
1191
+ setInput: null,
1192
+ findHostDirectiveDefs: null,
1193
+ hostDirectives: null,
1194
+ inputs: invertObject(directiveDefinition.inputs, declaredInputs),
1195
+ outputs: invertObject(directiveDefinition.outputs),
1196
+ };
1197
+ }
1198
+ function initFeatures(definition) {
1199
+ var _a;
1200
+ (_a = definition.features) === null || _a === void 0 ? void 0 : _a.forEach((fn) => fn(definition));
1201
+ }
1202
+ function extractDefListOrFactory(dependencies, pipeDef) {
1203
+ if (!dependencies) {
1204
+ return null;
1205
+ }
1206
+ const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;
1207
+ return () => (typeof dependencies === 'function' ? dependencies() : dependencies)
1208
+ .map(dep => defExtractor(dep))
1209
+ .filter(nonNull);
1210
+ }
1218
1211
 
1219
1212
  /**
1220
1213
  * Special location which allows easy identification of type. If we have an array which was
@@ -1316,7 +1309,7 @@ function isDirectiveHost(tNode) {
1316
1309
  return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
1317
1310
  }
1318
1311
  function isComponentDef(def) {
1319
- return def.template !== null;
1312
+ return !!def.template;
1320
1313
  }
1321
1314
  function isRootView(target) {
1322
1315
  return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
@@ -8329,7 +8322,7 @@ class Version {
8329
8322
  /**
8330
8323
  * @publicApi
8331
8324
  */
8332
- const VERSION = new Version('15.2.2');
8325
+ const VERSION = new Version('15.2.3');
8333
8326
 
8334
8327
  // This default value is when checking the hierarchy for a token.
8335
8328
  //
@@ -20256,7 +20249,8 @@ function sortListeners(a, b) {
20256
20249
  * See call site for more info.
20257
20250
  */
20258
20251
  function isDirectiveDefHack(obj) {
20259
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
20252
+ return obj.type !== undefined && obj.declaredInputs !== undefined &&
20253
+ obj.findHostDirectiveDefs !== undefined;
20260
20254
  }
20261
20255
  /**
20262
20256
  * Retrieve the component `LView` from component/element.