@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.
@@ -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
  */
@@ -2195,7 +2195,7 @@ let componentDefCount = 0;
2195
2195
  *
2196
2196
  * # Example
2197
2197
  * ```
2198
- * class MyDirective {
2198
+ * class MyComponent {
2199
2199
  * // Generated by Angular Template Compiler
2200
2200
  * // [Symbol] syntax will not be supported by TypeScript until v2.7
2201
2201
  * static ɵcmp = defineComponent({
@@ -2210,61 +2210,12 @@ function ɵɵdefineComponent(componentDefinition) {
2210
2210
  // Initialize ngDevMode. This must be the first statement in ɵɵdefineComponent.
2211
2211
  // See the `initNgDevMode` docstring for more information.
2212
2212
  (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
2213
- const type = componentDefinition.type;
2214
- const standalone = componentDefinition.standalone === true;
2215
- const declaredInputs = {};
2216
- const def = {
2217
- type: type,
2218
- providersResolver: null,
2219
- decls: componentDefinition.decls,
2220
- vars: componentDefinition.vars,
2221
- factory: null,
2222
- template: componentDefinition.template || null,
2223
- consts: componentDefinition.consts || null,
2224
- ngContentSelectors: componentDefinition.ngContentSelectors,
2225
- hostBindings: componentDefinition.hostBindings || null,
2226
- hostVars: componentDefinition.hostVars || 0,
2227
- hostAttrs: componentDefinition.hostAttrs || null,
2228
- contentQueries: componentDefinition.contentQueries || null,
2229
- declaredInputs: declaredInputs,
2230
- inputs: null,
2231
- outputs: null,
2232
- exportAs: componentDefinition.exportAs || null,
2233
- onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
2234
- directiveDefs: null,
2235
- pipeDefs: null,
2236
- standalone,
2237
- dependencies: standalone && componentDefinition.dependencies || null,
2238
- getStandaloneInjector: null,
2239
- selectors: componentDefinition.selectors || EMPTY_ARRAY,
2240
- viewQuery: componentDefinition.viewQuery || null,
2241
- features: componentDefinition.features || null,
2242
- data: componentDefinition.data || {},
2243
- encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
2244
- id: `c${componentDefCount++}`,
2245
- styles: componentDefinition.styles || EMPTY_ARRAY,
2246
- _: null,
2247
- setInput: null,
2248
- schemas: componentDefinition.schemas || null,
2249
- tView: null,
2250
- findHostDirectiveDefs: null,
2251
- hostDirectives: null,
2252
- };
2213
+ const baseDef = getNgDirectiveDef(componentDefinition);
2214
+ 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.Emulated, id: `c${componentDefCount++}`, styles: componentDefinition.styles || EMPTY_ARRAY, _: null, schemas: componentDefinition.schemas || null, tView: null });
2215
+ initFeatures(def);
2253
2216
  const dependencies = componentDefinition.dependencies;
2254
- const feature = componentDefinition.features;
2255
- def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
2256
- def.outputs = invertObject(componentDefinition.outputs),
2257
- feature && feature.forEach((fn) => fn(def));
2258
- def.directiveDefs = dependencies ?
2259
- (() => (typeof dependencies === 'function' ? dependencies() : dependencies)
2260
- .map(extractDirectiveDef)
2261
- .filter(nonNull)) :
2262
- null;
2263
- def.pipeDefs = dependencies ?
2264
- (() => (typeof dependencies === 'function' ? dependencies() : dependencies)
2265
- .map(getPipeDef$1)
2266
- .filter(nonNull)) :
2267
- null;
2217
+ def.directiveDefs = extractDefListOrFactory(dependencies, /* pipeDef */ false);
2218
+ def.pipeDefs = extractDefListOrFactory(dependencies, /* pipeDef */ true);
2268
2219
  return def;
2269
2220
  });
2270
2221
  }
@@ -2279,8 +2230,8 @@ function ɵɵdefineComponent(componentDefinition) {
2279
2230
  */
2280
2231
  function ɵɵsetComponentScope(type, directives, pipes) {
2281
2232
  const def = type.ɵcmp;
2282
- def.directiveDefs = () => (typeof directives === 'function' ? directives() : directives).map(extractDirectiveDef);
2283
- def.pipeDefs = () => (typeof pipes === 'function' ? pipes() : pipes).map(getPipeDef$1);
2233
+ def.directiveDefs = extractDefListOrFactory(directives, /* pipeDef */ false);
2234
+ def.pipeDefs = extractDefListOrFactory(pipes, /* pipeDef */ true);
2284
2235
  }
2285
2236
  function extractDirectiveDef(type) {
2286
2237
  return getComponentDef$1(type) || getDirectiveDef(type);
@@ -2415,7 +2366,13 @@ function invertObject(obj, secondary) {
2415
2366
  *
2416
2367
  * @codeGenApi
2417
2368
  */
2418
- const ɵɵdefineDirective = ɵɵdefineComponent;
2369
+ function ɵɵdefineDirective(directiveDefinition) {
2370
+ return noSideEffects(() => {
2371
+ const def = getNgDirectiveDef(directiveDefinition);
2372
+ initFeatures(def);
2373
+ return def;
2374
+ });
2375
+ }
2419
2376
  /**
2420
2377
  * Create a pipe definition object.
2421
2378
  *
@@ -2475,6 +2432,42 @@ function getNgModuleDef(type, throwNotFound) {
2475
2432
  }
2476
2433
  return ngModuleDef;
2477
2434
  }
2435
+ function getNgDirectiveDef(directiveDefinition) {
2436
+ const declaredInputs = {};
2437
+ return {
2438
+ type: directiveDefinition.type,
2439
+ providersResolver: null,
2440
+ factory: null,
2441
+ hostBindings: directiveDefinition.hostBindings || null,
2442
+ hostVars: directiveDefinition.hostVars || 0,
2443
+ hostAttrs: directiveDefinition.hostAttrs || null,
2444
+ contentQueries: directiveDefinition.contentQueries || null,
2445
+ declaredInputs,
2446
+ exportAs: directiveDefinition.exportAs || null,
2447
+ standalone: directiveDefinition.standalone === true,
2448
+ selectors: directiveDefinition.selectors || EMPTY_ARRAY,
2449
+ viewQuery: directiveDefinition.viewQuery || null,
2450
+ features: directiveDefinition.features || null,
2451
+ setInput: null,
2452
+ findHostDirectiveDefs: null,
2453
+ hostDirectives: null,
2454
+ inputs: invertObject(directiveDefinition.inputs, declaredInputs),
2455
+ outputs: invertObject(directiveDefinition.outputs),
2456
+ };
2457
+ }
2458
+ function initFeatures(definition) {
2459
+ var _a;
2460
+ (_a = definition.features) === null || _a === void 0 ? void 0 : _a.forEach((fn) => fn(definition));
2461
+ }
2462
+ function extractDefListOrFactory(dependencies, pipeDef) {
2463
+ if (!dependencies) {
2464
+ return null;
2465
+ }
2466
+ const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;
2467
+ return () => (typeof dependencies === 'function' ? dependencies() : dependencies)
2468
+ .map(dep => defExtractor(dep))
2469
+ .filter(nonNull);
2470
+ }
2478
2471
 
2479
2472
  /**
2480
2473
  * Special location which allows easy identification of type. If we have an array which was
@@ -2576,7 +2569,7 @@ function isDirectiveHost(tNode) {
2576
2569
  return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
2577
2570
  }
2578
2571
  function isComponentDef(def) {
2579
- return def.template !== null;
2572
+ return !!def.template;
2580
2573
  }
2581
2574
  function isRootView(target) {
2582
2575
  return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
@@ -8702,7 +8695,7 @@ class Version {
8702
8695
  /**
8703
8696
  * @publicApi
8704
8697
  */
8705
- const VERSION = new Version('15.2.2');
8698
+ const VERSION = new Version('15.2.3');
8706
8699
 
8707
8700
  // This default value is when checking the hierarchy for a token.
8708
8701
  //
@@ -20581,7 +20574,8 @@ function sortListeners(a, b) {
20581
20574
  * See call site for more info.
20582
20575
  */
20583
20576
  function isDirectiveDefHack(obj) {
20584
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
20577
+ return obj.type !== undefined && obj.declaredInputs !== undefined &&
20578
+ obj.findHostDirectiveDefs !== undefined;
20585
20579
  }
20586
20580
  /**
20587
20581
  * Retrieve the component `LView` from component/element.