@angular/core 9.1.3 → 9.1.4

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 (36) hide show
  1. package/bundles/core-testing.umd.js +1 -1
  2. package/bundles/core-testing.umd.min.js +1 -1
  3. package/bundles/core-testing.umd.min.js.map +1 -1
  4. package/bundles/core.umd.js +68 -28
  5. package/bundles/core.umd.js.map +1 -1
  6. package/bundles/core.umd.min.js +126 -126
  7. package/bundles/core.umd.min.js.map +1 -1
  8. package/core.d.ts +8 -3
  9. package/core.metadata.json +1 -1
  10. package/esm2015/src/render3/instructions/all.js +2 -2
  11. package/esm2015/src/render3/instructions/host_property.js +6 -4
  12. package/esm2015/src/render3/instructions/listener.js +7 -5
  13. package/esm2015/src/render3/instructions/lview_debug.js +6 -2
  14. package/esm2015/src/render3/instructions/shared.js +41 -12
  15. package/esm2015/src/render3/instructions/styling.js +3 -15
  16. package/esm2015/src/render3/interfaces/view.js +7 -1
  17. package/esm2015/src/render3/state.js +23 -2
  18. package/esm2015/src/version.js +1 -1
  19. package/esm5/src/render3/instructions/host_property.js +5 -4
  20. package/esm5/src/render3/instructions/listener.js +5 -4
  21. package/esm5/src/render3/instructions/lview_debug.js +5 -2
  22. package/esm5/src/render3/instructions/shared.js +38 -11
  23. package/esm5/src/render3/instructions/styling.js +3 -13
  24. package/esm5/src/render3/interfaces/view.js +1 -1
  25. package/esm5/src/render3/state.js +20 -2
  26. package/esm5/src/version.js +1 -1
  27. package/fesm2015/core.js +84 -32
  28. package/fesm2015/core.js.map +1 -1
  29. package/fesm2015/testing.js +1 -1
  30. package/fesm5/core.js +68 -28
  31. package/fesm5/core.js.map +1 -1
  32. package/fesm5/testing.js +1 -1
  33. package/package.json +1 -1
  34. package/src/r3_symbols.d.ts +1 -1
  35. package/testing/testing.d.ts +1 -1
  36. package/testing.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v9.1.3
2
+ * @license Angular v9.1.4
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/fesm5/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v9.1.3
2
+ * @license Angular v9.1.4
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2493,7 +2493,7 @@ function incrementBindingIndex(count) {
2493
2493
  function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
2494
2494
  var lFrame = instructionState.lFrame;
2495
2495
  lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
2496
- lFrame.currentDirectiveIndex = currentDirectiveIndex;
2496
+ setCurrentDirectiveIndex(currentDirectiveIndex);
2497
2497
  }
2498
2498
  /**
2499
2499
  * When host binding is executing this points to the directive index.
@@ -2503,6 +2503,24 @@ function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex)
2503
2503
  function getCurrentDirectiveIndex() {
2504
2504
  return instructionState.lFrame.currentDirectiveIndex;
2505
2505
  }
2506
+ /**
2507
+ * Sets an index of a directive whose `hostBindings` are being processed.
2508
+ *
2509
+ * @param currentDirectiveIndex `TData` index where current directive instance can be found.
2510
+ */
2511
+ function setCurrentDirectiveIndex(currentDirectiveIndex) {
2512
+ instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
2513
+ }
2514
+ /**
2515
+ * Retrieve the current `DirectiveDef` which is active when `hostBindings` instruction is being
2516
+ * executed.
2517
+ *
2518
+ * @param tData Current `TData` where the `DirectiveDef` will be looked up at.
2519
+ */
2520
+ function getCurrentDirectiveDef(tData) {
2521
+ var currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
2522
+ return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
2523
+ }
2506
2524
  function getCurrentQueryIndex() {
2507
2525
  return instructionState.lFrame.currentQueryIndex;
2508
2526
  }
@@ -6485,7 +6503,9 @@ var TViewConstructor = /** @class */ (function () {
6485
6503
  pipeRegistry, //
6486
6504
  firstChild, //
6487
6505
  schemas, //
6488
- consts) {
6506
+ consts, //
6507
+ incompleteFirstPass //
6508
+ ) {
6489
6509
  this.type = type;
6490
6510
  this.id = id;
6491
6511
  this.blueprint = blueprint;
@@ -6516,6 +6536,7 @@ var TViewConstructor = /** @class */ (function () {
6516
6536
  this.firstChild = firstChild;
6517
6537
  this.schemas = schemas;
6518
6538
  this.consts = consts;
6539
+ this.incompleteFirstPass = incompleteFirstPass;
6519
6540
  }
6520
6541
  Object.defineProperty(TView.prototype, "template_", {
6521
6542
  get: function () {
@@ -7527,6 +7548,14 @@ function renderView(tView, lView, context) {
7527
7548
  renderChildComponents(lView, components);
7528
7549
  }
7529
7550
  }
7551
+ catch (error) {
7552
+ // If we didn't manage to get past the first template pass due to
7553
+ // an error, mark the view as corrupted so we can try to recover.
7554
+ if (tView.firstCreatePass) {
7555
+ tView.incompleteFirstPass = true;
7556
+ }
7557
+ throw error;
7558
+ }
7530
7559
  finally {
7531
7560
  lView[FLAGS] &= ~4 /* CreationMode */;
7532
7561
  leaveView();
@@ -7732,8 +7761,13 @@ function saveResolvedLocalsInData(viewData, tNode, localRefExtractor) {
7732
7761
  * @returns TView
7733
7762
  */
7734
7763
  function getOrCreateTComponentView(def) {
7735
- return def.tView ||
7736
- (def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts));
7764
+ var tView = def.tView;
7765
+ // Create a TView if there isn't one, or recreate it if the first create pass didn't
7766
+ // complete successfuly since we can't know for sure whether it's in a usable shape.
7767
+ if (tView === null || tView.incompleteFirstPass) {
7768
+ return def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
7769
+ }
7770
+ return tView;
7737
7771
  }
7738
7772
  /**
7739
7773
  * Creates a TView instance
@@ -7786,7 +7820,9 @@ function createTView(type, viewIndex, templateFn, decls, vars, directives, pipes
7786
7820
  typeof pipes === 'function' ? pipes() : pipes, // pipeRegistry: PipeDefList|null,
7787
7821
  null, // firstChild: TNode|null,
7788
7822
  schemas, // schemas: SchemaMetadata[]|null,
7789
- consts) : // consts: TConstants|null
7823
+ consts, // consts: TConstants|null
7824
+ false // incompleteFirstPass: boolean
7825
+ ) :
7790
7826
  {
7791
7827
  type: type,
7792
7828
  id: viewIndex,
@@ -7818,6 +7854,7 @@ function createTView(type, viewIndex, templateFn, decls, vars, directives, pipes
7818
7854
  firstChild: null,
7819
7855
  schemas: schemas,
7820
7856
  consts: consts,
7857
+ incompleteFirstPass: false
7821
7858
  };
7822
7859
  }
7823
7860
  function createViewBlueprint(bindingStartIndex, initialViewLength) {
@@ -8339,11 +8376,13 @@ function invokeDirectivesHostBindings(tView, lView, tNode) {
8339
8376
  var expando = tView.expandoInstructions;
8340
8377
  var firstCreatePass = tView.firstCreatePass;
8341
8378
  var elementIndex = tNode.index - HEADER_OFFSET;
8379
+ var currentDirectiveIndex = getCurrentDirectiveIndex();
8342
8380
  try {
8343
8381
  setSelectedIndex(elementIndex);
8344
- for (var i = start; i < end; i++) {
8345
- var def = tView.data[i];
8346
- var directive = lView[i];
8382
+ for (var dirIndex = start; dirIndex < end; dirIndex++) {
8383
+ var def = tView.data[dirIndex];
8384
+ var directive = lView[dirIndex];
8385
+ setCurrentDirectiveIndex(dirIndex);
8347
8386
  if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) {
8348
8387
  invokeHostBindingsInCreationMode(def, directive);
8349
8388
  }
@@ -8354,6 +8393,7 @@ function invokeDirectivesHostBindings(tView, lView, tNode) {
8354
8393
  }
8355
8394
  finally {
8356
8395
  setSelectedIndex(-1);
8396
+ setCurrentDirectiveIndex(currentDirectiveIndex);
8357
8397
  }
8358
8398
  }
8359
8399
  /**
@@ -8945,9 +8985,17 @@ function getTViewCleanup(tView) {
8945
8985
  * There are cases where the sub component's renderer needs to be included
8946
8986
  * instead of the current renderer (see the componentSyntheticHost* instructions).
8947
8987
  */
8948
- function loadComponentRenderer(tNode, lView) {
8949
- var componentLView = unwrapLView(lView[tNode.index]);
8950
- return componentLView[RENDERER];
8988
+ function loadComponentRenderer(currentDef, tNode, lView) {
8989
+ // TODO(FW-2043): the `currentDef` is null when host bindings are invoked while creating root
8990
+ // component (see packages/core/src/render3/component.ts). This is not consistent with the process
8991
+ // of creating inner components, when current directive index is available in the state. In order
8992
+ // to avoid relying on current def being `null` (thus special-casing root component creation), the
8993
+ // process of creating root component should be unified with the process of creating inner
8994
+ // components.
8995
+ if (currentDef === null || isComponentDef(currentDef)) {
8996
+ lView = unwrapLView(lView[tNode.index]);
8997
+ }
8998
+ return lView[RENDERER];
8951
8999
  }
8952
9000
  /** Handles an error thrown in an LView. */
8953
9001
  function handleError(lView, error) {
@@ -14865,7 +14913,7 @@ function ɵɵlistener(eventName, listenerFn, useCapture, eventTargetResolver) {
14865
14913
  return ɵɵlistener;
14866
14914
  }
14867
14915
  /**
14868
- * Registers a synthetic host listener (e.g. `(@foo.start)`) on a component.
14916
+ * Registers a synthetic host listener (e.g. `(@foo.start)`) on a component or directive.
14869
14917
  *
14870
14918
  * This instruction is for compatibility purposes and is designed to ensure that a
14871
14919
  * synthetic host listener (e.g. `@HostListener('@foo.start')`) properly gets rendered
@@ -14889,8 +14937,9 @@ function ɵɵcomponentHostSyntheticListener(eventName, listenerFn, useCapture, e
14889
14937
  if (useCapture === void 0) { useCapture = false; }
14890
14938
  var tNode = getPreviousOrParentTNode();
14891
14939
  var lView = getLView();
14892
- var renderer = loadComponentRenderer(tNode, lView);
14893
14940
  var tView = getTView();
14941
+ var currentDef = getCurrentDirectiveDef(tView.data);
14942
+ var renderer = loadComponentRenderer(currentDef, tNode, lView);
14894
14943
  listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, useCapture, eventTargetResolver);
14895
14944
  return ɵɵcomponentHostSyntheticListener;
14896
14945
  }
@@ -16666,7 +16715,7 @@ function stylingFirstUpdatePass(tView, tStylingKey, bindingIndex, isClassBased)
16666
16715
  * @param isClassBased `true` if `class` (`false` if `style`)
16667
16716
  */
16668
16717
  function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
16669
- var hostDirectiveDef = getHostDirectiveDef(tData);
16718
+ var hostDirectiveDef = getCurrentDirectiveDef(tData);
16670
16719
  var residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
16671
16720
  if (hostDirectiveDef === null) {
16672
16721
  // We are in template node.
@@ -16895,16 +16944,6 @@ function collectStylingFromTAttrs(stylingKey, attrs, isClassBased) {
16895
16944
  }
16896
16945
  return stylingKey === undefined ? null : stylingKey;
16897
16946
  }
16898
- /**
16899
- * Retrieve the current `DirectiveDef` which is active when `hostBindings` style instruction is
16900
- * being executed (or `null` if we are in `template`.)
16901
- *
16902
- * @param tData Current `TData` where the `DirectiveDef` will be looked up at.
16903
- */
16904
- function getHostDirectiveDef(tData) {
16905
- var currentDirectiveIndex = getCurrentDirectiveIndex();
16906
- return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
16907
- }
16908
16947
  /**
16909
16948
  * Convert user input to `KeyValueArray`.
16910
16949
  *
@@ -18542,7 +18581,7 @@ function ɵɵhostProperty(propName, value, sanitizer) {
18542
18581
  return ɵɵhostProperty;
18543
18582
  }
18544
18583
  /**
18545
- * Updates a synthetic host binding (e.g. `[@foo]`) on a component.
18584
+ * Updates a synthetic host binding (e.g. `[@foo]`) on a component or directive.
18546
18585
  *
18547
18586
  * This instruction is for compatibility purposes and is designed to ensure that a
18548
18587
  * synthetic host binding (e.g. `@HostBinding('@foo')`) properly gets rendered in
@@ -18568,7 +18607,8 @@ function ɵɵupdateSyntheticHostBinding(propName, value, sanitizer) {
18568
18607
  if (bindingUpdated(lView, bindingIndex, value)) {
18569
18608
  var tView = getTView();
18570
18609
  var tNode = getSelectedTNode();
18571
- var renderer = loadComponentRenderer(tNode, lView);
18610
+ var currentDef = getCurrentDirectiveDef(tView.data);
18611
+ var renderer = loadComponentRenderer(currentDef, tNode, lView);
18572
18612
  elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true);
18573
18613
  ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
18574
18614
  }
@@ -20149,7 +20189,7 @@ var Version = /** @class */ (function () {
20149
20189
  /**
20150
20190
  * @publicApi
20151
20191
  */
20152
- var VERSION = new Version('9.1.3');
20192
+ var VERSION = new Version('9.1.4');
20153
20193
 
20154
20194
  /**
20155
20195
  * @license