@angular/core 15.2.1 → 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.
Files changed (33) hide show
  1. package/esm2020/src/application_ref.mjs +14 -3
  2. package/esm2020/src/application_tokens.mjs +1 -12
  3. package/esm2020/src/change_detection/change_detection.mjs +2 -2
  4. package/esm2020/src/change_detection/constants.mjs +1 -49
  5. package/esm2020/src/core.mjs +3 -3
  6. package/esm2020/src/core_private_export.mjs +1 -5
  7. package/esm2020/src/linker/template_ref.mjs +3 -3
  8. package/esm2020/src/render3/definition.mjs +53 -42
  9. package/esm2020/src/render3/i18n/i18n_util.mjs +3 -3
  10. package/esm2020/src/render3/instructions/shared.mjs +2 -2
  11. package/esm2020/src/render3/instructions/template.mjs +2 -2
  12. package/esm2020/src/render3/interfaces/node.mjs +1 -1
  13. package/esm2020/src/render3/interfaces/type_checks.mjs +2 -2
  14. package/esm2020/src/render3/jit/directive.mjs +1 -2
  15. package/esm2020/src/render3/util/discovery_utils.mjs +3 -2
  16. package/esm2020/src/version.mjs +1 -1
  17. package/esm2020/testing/src/logger.mjs +3 -3
  18. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  19. package/fesm2015/core.mjs +76 -133
  20. package/fesm2015/core.mjs.map +1 -1
  21. package/fesm2015/testing.mjs +62 -116
  22. package/fesm2015/testing.mjs.map +1 -1
  23. package/fesm2020/core.mjs +76 -116
  24. package/fesm2020/core.mjs.map +1 -1
  25. package/fesm2020/testing.mjs +63 -99
  26. package/fesm2020/testing.mjs.map +1 -1
  27. package/index.d.ts +248 -422
  28. package/package.json +1 -1
  29. package/schematics/migrations/relative-link-resolution/bundle.js +7 -7
  30. package/schematics/migrations/router-link-with-href/bundle.js +10 -10
  31. package/schematics/ng-generate/standalone-migration/bundle.js +699 -674
  32. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  33. package/testing/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.2.1
2
+ * @license Angular v15.2.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2115,54 +2115,6 @@ var ChangeDetectionStrategy;
2115
2115
  */
2116
2116
  ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
2117
2117
  })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
2118
- /**
2119
- * Defines the possible states of the default change detector.
2120
- * @see `ChangeDetectorRef`
2121
- */
2122
- var ChangeDetectorStatus;
2123
- (function (ChangeDetectorStatus) {
2124
- /**
2125
- * A state in which, after calling `detectChanges()`, the change detector
2126
- * state becomes `Checked`, and must be explicitly invoked or reactivated.
2127
- */
2128
- ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
2129
- /**
2130
- * A state in which change detection is skipped until the change detector mode
2131
- * becomes `CheckOnce`.
2132
- */
2133
- ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
2134
- /**
2135
- * A state in which change detection continues automatically until explicitly
2136
- * deactivated.
2137
- */
2138
- ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
2139
- /**
2140
- * A state in which a change detector sub tree is not a part of the main tree and
2141
- * should be skipped.
2142
- */
2143
- ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
2144
- /**
2145
- * Indicates that the change detector encountered an error checking a binding
2146
- * or calling a directive lifecycle method and is now in an inconsistent state. Change
2147
- * detectors in this state do not detect changes.
2148
- */
2149
- ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
2150
- /**
2151
- * Indicates that the change detector has been destroyed.
2152
- */
2153
- ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
2154
- })(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
2155
- /**
2156
- * Reports whether a given strategy is currently the default for change detection.
2157
- * @param changeDetectionStrategy The strategy to check.
2158
- * @returns True if the given strategy is the current default, false otherwise.
2159
- * @see `ChangeDetectorStatus`
2160
- * @see `ChangeDetectorRef`
2161
- */
2162
- function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
2163
- return changeDetectionStrategy == null ||
2164
- changeDetectionStrategy === ChangeDetectionStrategy.Default;
2165
- }
2166
2118
 
2167
2119
  /**
2168
2120
  * Defines the CSS styles encapsulation policies for the {@link Component} decorator's
@@ -2243,7 +2195,7 @@ let componentDefCount = 0;
2243
2195
  *
2244
2196
  * # Example
2245
2197
  * ```
2246
- * class MyDirective {
2198
+ * class MyComponent {
2247
2199
  * // Generated by Angular Template Compiler
2248
2200
  * // [Symbol] syntax will not be supported by TypeScript until v2.7
2249
2201
  * static ɵcmp = defineComponent({
@@ -2258,61 +2210,12 @@ function ɵɵdefineComponent(componentDefinition) {
2258
2210
  // Initialize ngDevMode. This must be the first statement in ɵɵdefineComponent.
2259
2211
  // See the `initNgDevMode` docstring for more information.
2260
2212
  (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
2261
- const type = componentDefinition.type;
2262
- const standalone = componentDefinition.standalone === true;
2263
- const declaredInputs = {};
2264
- const def = {
2265
- type: type,
2266
- providersResolver: null,
2267
- decls: componentDefinition.decls,
2268
- vars: componentDefinition.vars,
2269
- factory: null,
2270
- template: componentDefinition.template || null,
2271
- consts: componentDefinition.consts || null,
2272
- ngContentSelectors: componentDefinition.ngContentSelectors,
2273
- hostBindings: componentDefinition.hostBindings || null,
2274
- hostVars: componentDefinition.hostVars || 0,
2275
- hostAttrs: componentDefinition.hostAttrs || null,
2276
- contentQueries: componentDefinition.contentQueries || null,
2277
- declaredInputs: declaredInputs,
2278
- inputs: null,
2279
- outputs: null,
2280
- exportAs: componentDefinition.exportAs || null,
2281
- onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
2282
- directiveDefs: null,
2283
- pipeDefs: null,
2284
- standalone,
2285
- dependencies: standalone && componentDefinition.dependencies || null,
2286
- getStandaloneInjector: null,
2287
- selectors: componentDefinition.selectors || EMPTY_ARRAY,
2288
- viewQuery: componentDefinition.viewQuery || null,
2289
- features: componentDefinition.features || null,
2290
- data: componentDefinition.data || {},
2291
- encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
2292
- id: `c${componentDefCount++}`,
2293
- styles: componentDefinition.styles || EMPTY_ARRAY,
2294
- _: null,
2295
- setInput: null,
2296
- schemas: componentDefinition.schemas || null,
2297
- tView: null,
2298
- findHostDirectiveDefs: null,
2299
- hostDirectives: null,
2300
- };
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);
2301
2216
  const dependencies = componentDefinition.dependencies;
2302
- const feature = componentDefinition.features;
2303
- def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
2304
- def.outputs = invertObject(componentDefinition.outputs),
2305
- feature && feature.forEach((fn) => fn(def));
2306
- def.directiveDefs = dependencies ?
2307
- (() => (typeof dependencies === 'function' ? dependencies() : dependencies)
2308
- .map(extractDirectiveDef)
2309
- .filter(nonNull)) :
2310
- null;
2311
- def.pipeDefs = dependencies ?
2312
- (() => (typeof dependencies === 'function' ? dependencies() : dependencies)
2313
- .map(getPipeDef$1)
2314
- .filter(nonNull)) :
2315
- null;
2217
+ def.directiveDefs = extractDefListOrFactory(dependencies, /* pipeDef */ false);
2218
+ def.pipeDefs = extractDefListOrFactory(dependencies, /* pipeDef */ true);
2316
2219
  return def;
2317
2220
  });
2318
2221
  }
@@ -2327,8 +2230,8 @@ function ɵɵdefineComponent(componentDefinition) {
2327
2230
  */
2328
2231
  function ɵɵsetComponentScope(type, directives, pipes) {
2329
2232
  const def = type.ɵcmp;
2330
- def.directiveDefs = () => (typeof directives === 'function' ? directives() : directives).map(extractDirectiveDef);
2331
- def.pipeDefs = () => (typeof pipes === 'function' ? pipes() : pipes).map(getPipeDef$1);
2233
+ def.directiveDefs = extractDefListOrFactory(directives, /* pipeDef */ false);
2234
+ def.pipeDefs = extractDefListOrFactory(pipes, /* pipeDef */ true);
2332
2235
  }
2333
2236
  function extractDirectiveDef(type) {
2334
2237
  return getComponentDef$1(type) || getDirectiveDef(type);
@@ -2463,7 +2366,13 @@ function invertObject(obj, secondary) {
2463
2366
  *
2464
2367
  * @codeGenApi
2465
2368
  */
2466
- const ɵɵdefineDirective = ɵɵdefineComponent;
2369
+ function ɵɵdefineDirective(directiveDefinition) {
2370
+ return noSideEffects(() => {
2371
+ const def = getNgDirectiveDef(directiveDefinition);
2372
+ initFeatures(def);
2373
+ return def;
2374
+ });
2375
+ }
2467
2376
  /**
2468
2377
  * Create a pipe definition object.
2469
2378
  *
@@ -2523,6 +2432,42 @@ function getNgModuleDef(type, throwNotFound) {
2523
2432
  }
2524
2433
  return ngModuleDef;
2525
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
+ }
2526
2471
 
2527
2472
  /**
2528
2473
  * Special location which allows easy identification of type. If we have an array which was
@@ -2624,7 +2569,7 @@ function isDirectiveHost(tNode) {
2624
2569
  return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
2625
2570
  }
2626
2571
  function isComponentDef(def) {
2627
- return def.template !== null;
2572
+ return !!def.template;
2628
2573
  }
2629
2574
  function isRootView(target) {
2630
2575
  return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
@@ -8750,7 +8695,7 @@ class Version {
8750
8695
  /**
8751
8696
  * @publicApi
8752
8697
  */
8753
- const VERSION = new Version('15.2.1');
8698
+ const VERSION = new Version('15.2.3');
8754
8699
 
8755
8700
  // This default value is when checking the hierarchy for a token.
8756
8701
  //
@@ -11003,7 +10948,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
11003
10948
  initialInputs: undefined,
11004
10949
  inputs: null,
11005
10950
  outputs: null,
11006
- tViews: null,
10951
+ tView: null,
11007
10952
  next: null,
11008
10953
  prev: null,
11009
10954
  projectionNext: null,
@@ -13784,7 +13729,7 @@ function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, t
13784
13729
  const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, getConstant(tViewConsts, attrsIndex));
13785
13730
  resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
13786
13731
  registerPostOrderHooks(tView, tNode);
13787
- const embeddedTView = tNode.tViews = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
13732
+ const embeddedTView = tNode.tView = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
13788
13733
  if (tView.queries !== null) {
13789
13734
  tView.queries.template(tView, tNode);
13790
13735
  embeddedTView.queries = tView.queries.embeddedTView(tNode);
@@ -18143,7 +18088,7 @@ function getTIcu(tView, index) {
18143
18088
  if (value === null || typeof value === 'string')
18144
18089
  return null;
18145
18090
  if (ngDevMode &&
18146
- !(value.hasOwnProperty('tViews') || value.hasOwnProperty('currentCaseLViewIndex'))) {
18091
+ !(value.hasOwnProperty('tView') || value.hasOwnProperty('currentCaseLViewIndex'))) {
18147
18092
  throwError('We expect to get \'null\'|\'TIcu\'|\'TIcuContainer\', but got: ' + value);
18148
18093
  }
18149
18094
  // Here the `value.hasOwnProperty('currentCaseLViewIndex')` is a polymorphic read as it can be
@@ -18172,7 +18117,7 @@ function getTIcu(tView, index) {
18172
18117
  function setTIcu(tView, index, tIcu) {
18173
18118
  const tNode = tView.data[index];
18174
18119
  ngDevMode &&
18175
- assertEqual(tNode === null || tNode.hasOwnProperty('tViews'), true, 'We expect to get \'null\'|\'TIcuContainer\'');
18120
+ assertEqual(tNode === null || tNode.hasOwnProperty('tView'), true, 'We expect to get \'null\'|\'TIcuContainer\'');
18176
18121
  if (tNode === null) {
18177
18122
  tView.data[index] = tIcu;
18178
18123
  }
@@ -20629,7 +20574,8 @@ function sortListeners(a, b) {
20629
20574
  * See call site for more info.
20630
20575
  */
20631
20576
  function isDirectiveDefHack(obj) {
20632
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
20577
+ return obj.type !== undefined && obj.declaredInputs !== undefined &&
20578
+ obj.findHostDirectiveDefs !== undefined;
20633
20579
  }
20634
20580
  /**
20635
20581
  * Retrieve the component `LView` from component/element.
@@ -21468,7 +21414,7 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
21468
21414
  this.elementRef = elementRef;
21469
21415
  }
21470
21416
  createEmbeddedView(context, injector) {
21471
- const embeddedTView = this._declarationTContainer.tViews;
21417
+ const embeddedTView = this._declarationTContainer.tView;
21472
21418
  const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* LViewFlags.CheckAlways */, null, embeddedTView.declTNode, null, null, null, null, injector || null);
21473
21419
  const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
21474
21420
  ngDevMode && assertLContainer(declarationLContainer);
@@ -21498,7 +21444,7 @@ function injectTemplateRef() {
21498
21444
  */
21499
21445
  function createTemplateRef(hostTNode, hostLView) {
21500
21446
  if (hostTNode.type & 4 /* TNodeType.Container */) {
21501
- ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated');
21447
+ ngDevMode && assertDefined(hostTNode.tView, 'TView must be allocated');
21502
21448
  return new R3TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView));
21503
21449
  }
21504
21450
  return null;