@angular/core 9.1.3 → 9.1.7

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 (68) 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 +251 -360
  5. package/bundles/core.umd.js.map +1 -1
  6. package/bundles/core.umd.min.js +109 -117
  7. package/bundles/core.umd.min.js.map +1 -1
  8. package/core.d.ts +37 -70
  9. package/core.metadata.json +1 -1
  10. package/esm2015/index.js +2 -2
  11. package/esm2015/public_api.js +2 -2
  12. package/esm2015/src/core.js +2 -2
  13. package/esm2015/src/core_render3_private_export.js +2 -2
  14. package/esm2015/src/i18n/localization.js +7 -16
  15. package/esm2015/src/render3/assert.js +1 -8
  16. package/esm2015/src/render3/component_ref.js +15 -13
  17. package/esm2015/src/render3/hooks.js +3 -3
  18. package/esm2015/src/render3/index.js +2 -2
  19. package/esm2015/src/render3/instructions/all.js +3 -4
  20. package/esm2015/src/render3/instructions/host_property.js +6 -4
  21. package/esm2015/src/render3/instructions/listener.js +7 -5
  22. package/esm2015/src/render3/instructions/lview_debug.js +7 -3
  23. package/esm2015/src/render3/instructions/shared.js +166 -76
  24. package/esm2015/src/render3/instructions/styling.js +3 -15
  25. package/esm2015/src/render3/instructions/template.js +100 -0
  26. package/esm2015/src/render3/interfaces/container.js +8 -11
  27. package/esm2015/src/render3/interfaces/view.js +22 -7
  28. package/esm2015/src/render3/jit/environment.js +1 -6
  29. package/esm2015/src/render3/node_manipulation.js +20 -16
  30. package/esm2015/src/render3/state.js +23 -2
  31. package/esm2015/src/render3/util/view_utils.js +26 -2
  32. package/esm2015/src/render3/view_ref.js +15 -5
  33. package/esm2015/src/version.js +1 -1
  34. package/esm5/src/core_render3_private_export.js +2 -2
  35. package/esm5/src/i18n/localization.js +5 -16
  36. package/esm5/src/render3/assert.js +1 -4
  37. package/esm5/src/render3/component_ref.js +13 -9
  38. package/esm5/src/render3/hooks.js +3 -3
  39. package/esm5/src/render3/index.js +2 -2
  40. package/esm5/src/render3/instructions/all.js +2 -3
  41. package/esm5/src/render3/instructions/host_property.js +5 -4
  42. package/esm5/src/render3/instructions/listener.js +5 -4
  43. package/esm5/src/render3/instructions/lview_debug.js +6 -3
  44. package/esm5/src/render3/instructions/shared.js +148 -67
  45. package/esm5/src/render3/instructions/styling.js +3 -13
  46. package/esm5/src/render3/instructions/template.js +73 -0
  47. package/esm5/src/render3/interfaces/container.js +5 -5
  48. package/esm5/src/render3/interfaces/view.js +4 -3
  49. package/esm5/src/render3/jit/environment.js +1 -6
  50. package/esm5/src/render3/node_manipulation.js +19 -15
  51. package/esm5/src/render3/state.js +20 -2
  52. package/esm5/src/render3/util/view_utils.js +21 -2
  53. package/esm5/src/render3/view_ref.js +15 -6
  54. package/esm5/src/version.js +1 -1
  55. package/fesm2015/core.js +309 -431
  56. package/fesm2015/core.js.map +1 -1
  57. package/fesm2015/testing.js +1 -1
  58. package/fesm5/core.js +252 -356
  59. package/fesm5/core.js.map +1 -1
  60. package/fesm5/testing.js +1 -1
  61. package/package.json +1 -1
  62. package/src/r3_symbols.d.ts +1 -1
  63. package/testing/testing.d.ts +1 -1
  64. package/testing.d.ts +1 -1
  65. package/esm2015/src/render3/instructions/container.js +0 -227
  66. package/esm2015/src/render3/instructions/embedded_view.js +0 -151
  67. package/esm5/src/render3/instructions/container.js +0 -173
  68. package/esm5/src/render3/instructions/embedded_view.js +0 -127
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v9.1.3
2
+ * @license Angular v9.1.7
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2087,7 +2087,7 @@
2087
2087
  var FLAGS = 2;
2088
2088
  var PARENT = 3;
2089
2089
  var NEXT = 4;
2090
- var QUERIES = 5;
2090
+ var TRANSPLANTED_VIEWS_TO_REFRESH = 5;
2091
2091
  var T_HOST = 6;
2092
2092
  var CLEANUP = 7;
2093
2093
  var CONTEXT = 8;
@@ -2101,8 +2101,9 @@
2101
2101
  var DECLARATION_COMPONENT_VIEW = 16;
2102
2102
  var DECLARATION_LCONTAINER = 17;
2103
2103
  var PREORDER_HOOK_FLAGS = 18;
2104
+ var QUERIES = 19;
2104
2105
  /** Size of LView's header. Necessary to adjust for it when setting slots. */
2105
- var HEADER_OFFSET = 19;
2106
+ var HEADER_OFFSET = 20;
2106
2107
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2107
2108
  // failure based on types.
2108
2109
  var unusedValueExportToPlacateAjd = 1;
@@ -2126,20 +2127,20 @@
2126
2127
  * Uglify will inline these when minifying so there shouldn't be a cost.
2127
2128
  */
2128
2129
  var ACTIVE_INDEX = 2;
2129
- // PARENT and NEXT are indices 3 and 4
2130
+ // PARENT, NEXT, TRANSPLANTED_VIEWS_TO_REFRESH are indices 3, 4, and 5
2130
2131
  // As we already have these constants in LView, we don't need to re-create them.
2131
- var MOVED_VIEWS = 5;
2132
2132
  // T_HOST is index 6
2133
2133
  // We already have this constants in LView, we don't need to re-create it.
2134
2134
  var NATIVE = 7;
2135
2135
  var VIEW_REFS = 8;
2136
+ var MOVED_VIEWS = 9;
2136
2137
  /**
2137
2138
  * Size of LContainer's header. Represents the index after which all views in the
2138
2139
  * container will be inserted. We need to keep a record of current views so we know
2139
2140
  * which views are already in the DOM (and don't need to be re-added) and so we can
2140
2141
  * remove views from the DOM when they are no longer required.
2141
2142
  */
2142
- var CONTAINER_HEADER_OFFSET = 9;
2143
+ var CONTAINER_HEADER_OFFSET = 10;
2143
2144
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2144
2145
  // failure based on types.
2145
2146
  var unusedValueExportToPlacateAjd$1 = 1;
@@ -2218,9 +2219,6 @@
2218
2219
  arr = lView;
2219
2220
  assertEqual(arr.length, index, "index " + index + " expected to be at the end of arr (length " + arr.length + ")");
2220
2221
  }
2221
- function assertLContainerOrUndefined(value) {
2222
- value && assertEqual(isLContainer(value), true, 'Expecting LContainer or undefined or null');
2223
- }
2224
2222
  function assertLContainer(value) {
2225
2223
  assertDefined(value, 'LContainer must be defined');
2226
2224
  assertEqual(isLContainer(value), true, 'Expecting LContainer');
@@ -2519,6 +2517,25 @@
2519
2517
  function setLContainerActiveIndex(lContainer, index) {
2520
2518
  lContainer[ACTIVE_INDEX] = index << 1 /* SHIFT */;
2521
2519
  }
2520
+ /**
2521
+ * Updates the `TRANSPLANTED_VIEWS_TO_REFRESH` counter on the `LContainer` as well as the parents
2522
+ * whose
2523
+ * 1. counter goes from 0 to 1, indicating that there is a new child that has a view to refresh
2524
+ * or
2525
+ * 2. counter goes from 1 to 0, indicating there are no more descendant views to refresh
2526
+ */
2527
+ function updateTransplantedViewCount(lContainer, amount) {
2528
+ lContainer[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
2529
+ var viewOrContainer = lContainer;
2530
+ var parent = lContainer[PARENT];
2531
+ while (parent !== null &&
2532
+ ((amount === 1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 1) ||
2533
+ (amount === -1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 0))) {
2534
+ parent[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
2535
+ viewOrContainer = parent;
2536
+ parent = parent[PARENT];
2537
+ }
2538
+ }
2522
2539
 
2523
2540
  /**
2524
2541
  * @license
@@ -2678,7 +2695,7 @@
2678
2695
  function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
2679
2696
  var lFrame = instructionState.lFrame;
2680
2697
  lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
2681
- lFrame.currentDirectiveIndex = currentDirectiveIndex;
2698
+ setCurrentDirectiveIndex(currentDirectiveIndex);
2682
2699
  }
2683
2700
  /**
2684
2701
  * When host binding is executing this points to the directive index.
@@ -2688,6 +2705,24 @@
2688
2705
  function getCurrentDirectiveIndex() {
2689
2706
  return instructionState.lFrame.currentDirectiveIndex;
2690
2707
  }
2708
+ /**
2709
+ * Sets an index of a directive whose `hostBindings` are being processed.
2710
+ *
2711
+ * @param currentDirectiveIndex `TData` index where current directive instance can be found.
2712
+ */
2713
+ function setCurrentDirectiveIndex(currentDirectiveIndex) {
2714
+ instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
2715
+ }
2716
+ /**
2717
+ * Retrieve the current `DirectiveDef` which is active when `hostBindings` instruction is being
2718
+ * executed.
2719
+ *
2720
+ * @param tData Current `TData` where the `DirectiveDef` will be looked up at.
2721
+ */
2722
+ function getCurrentDirectiveDef(tData) {
2723
+ var currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
2724
+ return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
2725
+ }
2691
2726
  function getCurrentQueryIndex() {
2692
2727
  return instructionState.lFrame.currentQueryIndex;
2693
2728
  }
@@ -3045,7 +3080,7 @@
3045
3080
  assertNotEqual(initPhase, 3 /* InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');
3046
3081
  var flags = lView[FLAGS];
3047
3082
  if ((flags & 3 /* InitPhaseStateMask */) === initPhase) {
3048
- flags &= 1023 /* IndexWithinInitPhaseReset */;
3083
+ flags &= 2047 /* IndexWithinInitPhaseReset */;
3049
3084
  flags += 1 /* InitPhaseStateIncrementer */;
3050
3085
  lView[FLAGS] = flags;
3051
3086
  }
@@ -3108,13 +3143,13 @@
3108
3143
  var directiveIndex = isInitHook ? -arr[i] : arr[i];
3109
3144
  var directive = currentView[directiveIndex];
3110
3145
  if (isInitHook) {
3111
- var indexWithintInitPhase = currentView[FLAGS] >> 10 /* IndexWithinInitPhaseShift */;
3146
+ var indexWithintInitPhase = currentView[FLAGS] >> 11 /* IndexWithinInitPhaseShift */;
3112
3147
  // The init phase state must be always checked here as it may have been recursively
3113
3148
  // updated
3114
3149
  if (indexWithintInitPhase <
3115
3150
  (currentView[PREORDER_HOOK_FLAGS] >> 16 /* NumberOfInitHooksCalledShift */) &&
3116
3151
  (currentView[FLAGS] & 3 /* InitPhaseStateMask */) === initPhase) {
3117
- currentView[FLAGS] += 1024 /* IndexWithinInitPhaseIncrementer */;
3152
+ currentView[FLAGS] += 2048 /* IndexWithinInitPhaseIncrementer */;
3118
3153
  hook.call(directive);
3119
3154
  }
3120
3155
  }
@@ -6660,7 +6695,9 @@
6660
6695
  pipeRegistry, //
6661
6696
  firstChild, //
6662
6697
  schemas, //
6663
- consts) {
6698
+ consts, //
6699
+ incompleteFirstPass //
6700
+ ) {
6664
6701
  this.type = type;
6665
6702
  this.id = id;
6666
6703
  this.blueprint = blueprint;
@@ -6691,6 +6728,7 @@
6691
6728
  this.firstChild = firstChild;
6692
6729
  this.schemas = schemas;
6693
6730
  this.consts = consts;
6731
+ this.incompleteFirstPass = incompleteFirstPass;
6694
6732
  }
6695
6733
  Object.defineProperty(TView.prototype, "template_", {
6696
6734
  get: function () {
@@ -6967,7 +7005,7 @@
6967
7005
  attached: !!(flags & 128 /* Attached */),
6968
7006
  destroyed: !!(flags & 256 /* Destroyed */),
6969
7007
  isRoot: !!(flags & 512 /* IsRoot */),
6970
- indexWithinInitPhase: flags >> 10 /* IndexWithinInitPhaseShift */,
7008
+ indexWithinInitPhase: flags >> 11 /* IndexWithinInitPhaseShift */,
6971
7009
  };
6972
7010
  },
6973
7011
  enumerable: true,
@@ -7702,6 +7740,14 @@
7702
7740
  renderChildComponents(lView, components);
7703
7741
  }
7704
7742
  }
7743
+ catch (error) {
7744
+ // If we didn't manage to get past the first template pass due to
7745
+ // an error, mark the view as corrupted so we can try to recover.
7746
+ if (tView.firstCreatePass) {
7747
+ tView.incompleteFirstPass = true;
7748
+ }
7749
+ throw error;
7750
+ }
7705
7751
  finally {
7706
7752
  lView[FLAGS] &= ~4 /* CreationMode */;
7707
7753
  leaveView();
@@ -7746,6 +7792,10 @@
7746
7792
  incrementInitPhaseFlags(lView, 0 /* OnInitHooksToBeRun */);
7747
7793
  }
7748
7794
  }
7795
+ // First mark transplanted views that are declared in this lView as needing a refresh at their
7796
+ // insertion points. This is needed to avoid the situation where the template is defined in this
7797
+ // `LView` but its declaration appears after the insertion component.
7798
+ markTransplantedViewsForRefresh(lView);
7749
7799
  refreshDynamicEmbeddedViews(lView);
7750
7800
  // Content query results must be refreshed before content hooks are called.
7751
7801
  if (tView.contentQueries !== null) {
@@ -7816,6 +7866,10 @@
7816
7866
  if (!checkNoChangesMode) {
7817
7867
  lView[FLAGS] &= ~(64 /* Dirty */ | 8 /* FirstLViewPass */);
7818
7868
  }
7869
+ if (lView[FLAGS] & 1024 /* RefreshTransplantedView */) {
7870
+ lView[FLAGS] &= ~1024 /* RefreshTransplantedView */;
7871
+ updateTransplantedViewCount(lView[PARENT], -1);
7872
+ }
7819
7873
  }
7820
7874
  finally {
7821
7875
  leaveView();
@@ -7907,8 +7961,13 @@
7907
7961
  * @returns TView
7908
7962
  */
7909
7963
  function getOrCreateTComponentView(def) {
7910
- return def.tView ||
7911
- (def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts));
7964
+ var tView = def.tView;
7965
+ // Create a TView if there isn't one, or recreate it if the first create pass didn't
7966
+ // complete successfuly since we can't know for sure whether it's in a usable shape.
7967
+ if (tView === null || tView.incompleteFirstPass) {
7968
+ return def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
7969
+ }
7970
+ return tView;
7912
7971
  }
7913
7972
  /**
7914
7973
  * Creates a TView instance
@@ -7961,7 +8020,9 @@
7961
8020
  typeof pipes === 'function' ? pipes() : pipes, // pipeRegistry: PipeDefList|null,
7962
8021
  null, // firstChild: TNode|null,
7963
8022
  schemas, // schemas: SchemaMetadata[]|null,
7964
- consts) : // consts: TConstants|null
8023
+ consts, // consts: TConstants|null
8024
+ false // incompleteFirstPass: boolean
8025
+ ) :
7965
8026
  {
7966
8027
  type: type,
7967
8028
  id: viewIndex,
@@ -7993,6 +8054,7 @@
7993
8054
  firstChild: null,
7994
8055
  schemas: schemas,
7995
8056
  consts: consts,
8057
+ incompleteFirstPass: false
7996
8058
  };
7997
8059
  }
7998
8060
  function createViewBlueprint(bindingStartIndex, initialViewLength) {
@@ -8514,11 +8576,13 @@
8514
8576
  var expando = tView.expandoInstructions;
8515
8577
  var firstCreatePass = tView.firstCreatePass;
8516
8578
  var elementIndex = tNode.index - HEADER_OFFSET;
8579
+ var currentDirectiveIndex = getCurrentDirectiveIndex();
8517
8580
  try {
8518
8581
  setSelectedIndex(elementIndex);
8519
- for (var i = start; i < end; i++) {
8520
- var def = tView.data[i];
8521
- var directive = lView[i];
8582
+ for (var dirIndex = start; dirIndex < end; dirIndex++) {
8583
+ var def = tView.data[dirIndex];
8584
+ var directive = lView[dirIndex];
8585
+ setCurrentDirectiveIndex(dirIndex);
8522
8586
  if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) {
8523
8587
  invokeHostBindingsInCreationMode(def, directive);
8524
8588
  }
@@ -8529,6 +8593,7 @@
8529
8593
  }
8530
8594
  finally {
8531
8595
  setSelectedIndex(-1);
8596
+ setCurrentDirectiveIndex(currentDirectiveIndex);
8532
8597
  }
8533
8598
  }
8534
8599
  /**
@@ -8782,10 +8847,13 @@
8782
8847
  -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */ << 1 /* SHIFT */, // active index
8783
8848
  currentView, // parent
8784
8849
  null, // next
8785
- null, // queries
8850
+ 0, // transplanted views to refresh count
8786
8851
  tNode, // t_host
8787
8852
  native, // native,
8853
+ null, // view refs
8788
8854
  null);
8855
+ ngDevMode &&
8856
+ assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, 'Should allocate correct number of slots for LContainer header.');
8789
8857
  ngDevMode && attachLContainerDebug(lContainer);
8790
8858
  return lContainer;
8791
8859
  }
@@ -8794,66 +8862,70 @@
8794
8862
  * them by executing an associated template function.
8795
8863
  */
8796
8864
  function refreshDynamicEmbeddedViews(lView) {
8797
- var viewOrContainer = lView[CHILD_HEAD];
8798
- while (viewOrContainer !== null) {
8799
- // Note: viewOrContainer can be an LView or an LContainer instance, but here we are only
8800
- // interested in LContainer
8801
- var activeIndexFlag = void 0;
8802
- if (isLContainer(viewOrContainer) &&
8803
- (activeIndexFlag = viewOrContainer[ACTIVE_INDEX]) >> 1 /* SHIFT */ ===
8804
- -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */) {
8805
- for (var i = CONTAINER_HEADER_OFFSET; i < viewOrContainer.length; i++) {
8806
- var embeddedLView = viewOrContainer[i];
8807
- var embeddedTView = embeddedLView[TVIEW];
8808
- ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
8809
- if (viewAttachedToChangeDetector(embeddedLView)) {
8810
- refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
8811
- }
8812
- }
8813
- if ((activeIndexFlag & 1 /* HAS_TRANSPLANTED_VIEWS */) !== 0) {
8814
- // We should only CD moved views if the component where they were inserted does not match
8815
- // the component where they were declared and insertion is on-push. Moved views also
8816
- // contains intra component moves, or check-always which need to be skipped.
8817
- refreshTransplantedViews(viewOrContainer, lView[DECLARATION_COMPONENT_VIEW]);
8865
+ for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
8866
+ for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
8867
+ var embeddedLView = lContainer[i];
8868
+ var embeddedTView = embeddedLView[TVIEW];
8869
+ ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
8870
+ if (viewAttachedToChangeDetector(embeddedLView)) {
8871
+ refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
8818
8872
  }
8819
8873
  }
8874
+ }
8875
+ }
8876
+ /**
8877
+ * Gets the first `LContainer` in the LView or `null` if none exists.
8878
+ */
8879
+ function getFirstLContainer(lView) {
8880
+ var viewOrContainer = lView[CHILD_HEAD];
8881
+ while (viewOrContainer !== null &&
8882
+ !(isLContainer(viewOrContainer) &&
8883
+ viewOrContainer[ACTIVE_INDEX] >> 1 /* SHIFT */ ===
8884
+ -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */)) {
8820
8885
  viewOrContainer = viewOrContainer[NEXT];
8821
8886
  }
8887
+ return viewOrContainer;
8822
8888
  }
8823
8889
  /**
8824
- * Refresh transplanted LViews.
8890
+ * Gets the next `LContainer` that is a sibling of the given container.
8891
+ */
8892
+ function getNextLContainer(container) {
8893
+ var viewOrContainer = container[NEXT];
8894
+ while (viewOrContainer !== null &&
8895
+ !(isLContainer(viewOrContainer) &&
8896
+ viewOrContainer[ACTIVE_INDEX] >> 1 /* SHIFT */ ===
8897
+ -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */)) {
8898
+ viewOrContainer = viewOrContainer[NEXT];
8899
+ }
8900
+ return viewOrContainer;
8901
+ }
8902
+ /**
8903
+ * Mark transplanted views as needing to be refreshed at their insertion points.
8825
8904
  *
8826
8905
  * See: `ActiveIndexFlag.HAS_TRANSPLANTED_VIEWS` and `LView[DECLARATION_COMPONENT_VIEW]` for
8827
8906
  * explanation of transplanted views.
8828
8907
  *
8829
- * @param lContainer The `LContainer` which has transplanted views.
8830
- * @param declaredComponentLView The `lContainer` parent component `LView`.
8831
- */
8832
- function refreshTransplantedViews(lContainer, declaredComponentLView) {
8833
- var movedViews = lContainer[MOVED_VIEWS];
8834
- ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
8835
- for (var i = 0; i < movedViews.length; i++) {
8836
- var movedLView = movedViews[i];
8837
- var insertionLContainer = movedLView[PARENT];
8838
- ngDevMode && assertLContainer(insertionLContainer);
8839
- var insertedComponentLView = insertionLContainer[PARENT][DECLARATION_COMPONENT_VIEW];
8840
- ngDevMode && assertDefined(insertedComponentLView, 'Missing LView');
8841
- // Check if we have a transplanted view by compering declaration and insertion location.
8842
- if (insertedComponentLView !== declaredComponentLView) {
8843
- // Yes the `LView` is transplanted.
8844
- // Here we would like to know if the component is `OnPush`. We don't have
8845
- // explicit `OnPush` flag instead we set `CheckAlways` to false (which is `OnPush`)
8846
- // Not to be confused with `ManualOnPush` which is used with wether a DOM event
8847
- // should automatically mark a view as dirty.
8848
- var insertionComponentIsOnPush = (insertedComponentLView[FLAGS] & 16 /* CheckAlways */) === 0;
8849
- if (insertionComponentIsOnPush) {
8850
- // Here we know that the template has been transplanted across components and is
8851
- // on-push (not just moved within a component). If the insertion is marked dirty, then
8852
- // there is no need to CD here as we will do it again later when we get to insertion
8853
- // point.
8854
- var movedTView = movedLView[TVIEW];
8855
- ngDevMode && assertDefined(movedTView, 'TView must be allocated');
8856
- refreshView(movedTView, movedLView, movedTView.template, movedLView[CONTEXT]);
8908
+ * @param lView The `LView` that may have transplanted views.
8909
+ */
8910
+ function markTransplantedViewsForRefresh(lView) {
8911
+ for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
8912
+ if ((lContainer[ACTIVE_INDEX] & 1 /* HAS_TRANSPLANTED_VIEWS */) !== 0) {
8913
+ var movedViews = lContainer[MOVED_VIEWS];
8914
+ ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
8915
+ for (var i = 0; i < movedViews.length; i++) {
8916
+ var movedLView = movedViews[i];
8917
+ var insertionLContainer = movedLView[PARENT];
8918
+ ngDevMode && assertLContainer(insertionLContainer);
8919
+ // We don't want to increment the counter if the moved LView was already marked for
8920
+ // refresh.
8921
+ if ((movedLView[FLAGS] & 1024 /* RefreshTransplantedView */) === 0) {
8922
+ updateTransplantedViewCount(insertionLContainer, 1);
8923
+ }
8924
+ // Note, it is possible that the `movedViews` is tracking views that are transplanted *and*
8925
+ // those that aren't (declaration component === insertion component). In the latter case,
8926
+ // it's fine to add the flag, as we will clear it immediately in
8927
+ // `refreshDynamicEmbeddedViews` for the view currently being refreshed.
8928
+ movedLView[FLAGS] |= 1024 /* RefreshTransplantedView */;
8857
8929
  }
8858
8930
  }
8859
8931
  }
@@ -8868,10 +8940,49 @@
8868
8940
  ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode');
8869
8941
  var componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
8870
8942
  // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
8871
- if (viewAttachedToChangeDetector(componentView) &&
8872
- componentView[FLAGS] & (16 /* CheckAlways */ | 64 /* Dirty */)) {
8873
- var componentTView = componentView[TVIEW];
8874
- refreshView(componentTView, componentView, componentTView.template, componentView[CONTEXT]);
8943
+ if (viewAttachedToChangeDetector(componentView)) {
8944
+ var tView = componentView[TVIEW];
8945
+ if (componentView[FLAGS] & (16 /* CheckAlways */ | 64 /* Dirty */)) {
8946
+ refreshView(tView, componentView, tView.template, componentView[CONTEXT]);
8947
+ }
8948
+ else if (componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
8949
+ // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
8950
+ refreshContainsDirtyView(componentView);
8951
+ }
8952
+ }
8953
+ }
8954
+ /**
8955
+ * Refreshes all transplanted views marked with `LViewFlags.RefreshTransplantedView` that are
8956
+ * children or descendants of the given lView.
8957
+ *
8958
+ * @param lView The lView which contains descendant transplanted views that need to be refreshed.
8959
+ */
8960
+ function refreshContainsDirtyView(lView) {
8961
+ for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
8962
+ for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
8963
+ var embeddedLView = lContainer[i];
8964
+ if (embeddedLView[FLAGS] & 1024 /* RefreshTransplantedView */) {
8965
+ var embeddedTView = embeddedLView[TVIEW];
8966
+ ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
8967
+ refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
8968
+ }
8969
+ else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
8970
+ refreshContainsDirtyView(embeddedLView);
8971
+ }
8972
+ }
8973
+ }
8974
+ var tView = lView[TVIEW];
8975
+ // Refresh child component views.
8976
+ var components = tView.components;
8977
+ if (components !== null) {
8978
+ for (var i = 0; i < components.length; i++) {
8979
+ var componentView = getComponentLViewByIndex(components[i], lView);
8980
+ // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
8981
+ if (viewAttachedToChangeDetector(componentView) &&
8982
+ componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
8983
+ refreshContainsDirtyView(componentView);
8984
+ }
8985
+ }
8875
8986
  }
8876
8987
  }
8877
8988
  function renderComponent(hostLView, componentHostIdx) {
@@ -9120,9 +9231,17 @@
9120
9231
  * There are cases where the sub component's renderer needs to be included
9121
9232
  * instead of the current renderer (see the componentSyntheticHost* instructions).
9122
9233
  */
9123
- function loadComponentRenderer(tNode, lView) {
9124
- var componentLView = unwrapLView(lView[tNode.index]);
9125
- return componentLView[RENDERER];
9234
+ function loadComponentRenderer(currentDef, tNode, lView) {
9235
+ // TODO(FW-2043): the `currentDef` is null when host bindings are invoked while creating root
9236
+ // component (see packages/core/src/render3/component.ts). This is not consistent with the process
9237
+ // of creating inner components, when current directive index is available in the state. In order
9238
+ // to avoid relying on current def being `null` (thus special-casing root component creation), the
9239
+ // process of creating root component should be unified with the process of creating inner
9240
+ // components.
9241
+ if (currentDef === null || isComponentDef(currentDef)) {
9242
+ lView = unwrapLView(lView[tNode.index]);
9243
+ }
9244
+ return lView[RENDERER];
9126
9245
  }
9127
9246
  /** Handles an error thrown in an LView. */
9128
9247
  function handleError(lView, error) {
@@ -9372,17 +9491,13 @@
9372
9491
  ngDevMode && assertLContainer(insertedLContainer);
9373
9492
  var insertedComponentLView = insertedLContainer[PARENT][DECLARATION_COMPONENT_VIEW];
9374
9493
  ngDevMode && assertDefined(insertedComponentLView, 'Missing insertedComponentLView');
9375
- var insertedComponentIsOnPush = (insertedComponentLView[FLAGS] & 16 /* CheckAlways */) !== 16 /* CheckAlways */;
9376
- if (insertedComponentIsOnPush) {
9377
- var declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW];
9378
- ngDevMode && assertDefined(declaredComponentLView, 'Missing declaredComponentLView');
9379
- if (declaredComponentLView !== insertedComponentLView) {
9380
- // At this point the declaration-component is not same as insertion-component and we are in
9381
- // on-push mode, this means that this is a transplanted view. Mark the declared lView as
9382
- // having
9383
- // transplanted views so that those views can participate in CD.
9384
- declarationContainer[ACTIVE_INDEX] |= 1 /* HAS_TRANSPLANTED_VIEWS */;
9385
- }
9494
+ var declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW];
9495
+ ngDevMode && assertDefined(declaredComponentLView, 'Missing declaredComponentLView');
9496
+ if (declaredComponentLView !== insertedComponentLView) {
9497
+ // At this point the declaration-component is not same as insertion-component; this means that
9498
+ // this is a transplanted view. Mark the declared lView as having transplanted views so that
9499
+ // those views can participate in CD.
9500
+ declarationContainer[ACTIVE_INDEX] |= 1 /* HAS_TRANSPLANTED_VIEWS */;
9386
9501
  }
9387
9502
  if (movedViews === null) {
9388
9503
  declarationContainer[MOVED_VIEWS] = [lView];
@@ -9396,8 +9511,16 @@
9396
9511
  ngDevMode &&
9397
9512
  assertDefined(declarationContainer[MOVED_VIEWS], 'A projected view should belong to a non-empty projected views collection');
9398
9513
  var movedViews = declarationContainer[MOVED_VIEWS];
9399
- var declaredViewIndex = movedViews.indexOf(lView);
9400
- movedViews.splice(declaredViewIndex, 1);
9514
+ var declarationViewIndex = movedViews.indexOf(lView);
9515
+ var insertionLContainer = lView[PARENT];
9516
+ ngDevMode && assertLContainer(insertionLContainer);
9517
+ // If the view was marked for refresh but then detached before it was checked (where the flag
9518
+ // would be cleared and the counter decremented), we need to decrement the view counter here
9519
+ // instead.
9520
+ if (lView[FLAGS] & 1024 /* RefreshTransplantedView */) {
9521
+ updateTransplantedViewCount(insertionLContainer, -1);
9522
+ }
9523
+ movedViews.splice(declarationViewIndex, 1);
9401
9524
  }
9402
9525
  /**
9403
9526
  * Detaches a view from a container.
@@ -10464,10 +10587,18 @@
10464
10587
  else if (tNodeType === 1 /* Projection */) {
10465
10588
  var componentView = lView[DECLARATION_COMPONENT_VIEW];
10466
10589
  var componentHost = componentView[T_HOST];
10467
- var parentView = getLViewParent(componentView);
10468
- var firstProjectedNode = componentHost.projection[tNode.projection];
10469
- if (firstProjectedNode !== null && parentView !== null) {
10470
- collectNativeNodes(parentView[TVIEW], parentView, firstProjectedNode, result, true);
10590
+ var slotIdx = tNode.projection;
10591
+ ngDevMode &&
10592
+ assertDefined(componentHost.projection, 'Components with projection nodes (<ng-content>) must have projection slots defined.');
10593
+ var nodesInSlot = componentHost.projection[slotIdx];
10594
+ if (Array.isArray(nodesInSlot)) {
10595
+ result.push.apply(result, __spread(nodesInSlot));
10596
+ }
10597
+ else {
10598
+ var parentView = getLViewParent(componentView);
10599
+ ngDevMode &&
10600
+ assertDefined(parentView, 'Component views should always have a parent view (component\'s host view)');
10601
+ collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
10471
10602
  }
10472
10603
  }
10473
10604
  tNode = isProjection ? tNode.projectionNext : tNode.next;
@@ -14316,26 +14447,6 @@
14316
14447
  * Use of this source code is governed by an MIT-style license that can be
14317
14448
  * found in the LICENSE file at https://angular.io/license
14318
14449
  */
14319
- /**
14320
- * Creates an LContainer for inline views, e.g.
14321
- *
14322
- * % if (showing) {
14323
- * <div></div>
14324
- * % }
14325
- *
14326
- * @param index The index of the container in the data array
14327
- *
14328
- * @codeGenApi
14329
- */
14330
- function ɵɵcontainer(index) {
14331
- var lView = getLView();
14332
- var tView = getTView();
14333
- var tNode = containerInternal(tView, lView, index, null, null);
14334
- if (tView.firstCreatePass) {
14335
- tNode.tViews = [];
14336
- }
14337
- setIsNotParent();
14338
- }
14339
14450
  function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
14340
14451
  ngDevMode && assertFirstCreatePass(tView);
14341
14452
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -14392,83 +14503,6 @@
14392
14503
  saveResolvedLocalsInData(lView, tNode, localRefExtractor);
14393
14504
  }
14394
14505
  }
14395
- /**
14396
- * Sets a container up to receive views.
14397
- *
14398
- * @param index The index of the container in the data array
14399
- *
14400
- * @codeGenApi
14401
- */
14402
- function ɵɵcontainerRefreshStart(index) {
14403
- var lView = getLView();
14404
- var tView = getTView();
14405
- var previousOrParentTNode = load(tView.data, index);
14406
- ngDevMode && assertNodeType(previousOrParentTNode, 0 /* Container */);
14407
- setPreviousOrParentTNode(previousOrParentTNode, true);
14408
- lView[index + HEADER_OFFSET][ACTIVE_INDEX] = 0;
14409
- // We need to execute init hooks here so ngOnInit hooks are called in top level views
14410
- // before they are called in embedded views (for backwards compatibility).
14411
- if (!getCheckNoChangesMode()) {
14412
- var hooksInitPhaseCompleted = (lView[FLAGS] & 3 /* InitPhaseStateMask */) === 3 /* InitPhaseCompleted */;
14413
- if (hooksInitPhaseCompleted) {
14414
- var preOrderCheckHooks = tView.preOrderCheckHooks;
14415
- if (preOrderCheckHooks !== null) {
14416
- executeCheckHooks(lView, preOrderCheckHooks, null);
14417
- }
14418
- }
14419
- else {
14420
- var preOrderHooks = tView.preOrderHooks;
14421
- if (preOrderHooks !== null) {
14422
- executeInitAndCheckHooks(lView, preOrderHooks, 0 /* OnInitHooksToBeRun */, null);
14423
- }
14424
- incrementInitPhaseFlags(lView, 0 /* OnInitHooksToBeRun */);
14425
- }
14426
- }
14427
- }
14428
- /**
14429
- * Marks the end of the LContainer.
14430
- *
14431
- * Marking the end of LContainer is the time when to child views get inserted or removed.
14432
- *
14433
- * @codeGenApi
14434
- */
14435
- function ɵɵcontainerRefreshEnd() {
14436
- var previousOrParentTNode = getPreviousOrParentTNode();
14437
- if (getIsParent()) {
14438
- setIsNotParent();
14439
- }
14440
- else {
14441
- ngDevMode && assertNodeType(previousOrParentTNode, 2 /* View */);
14442
- ngDevMode && assertHasParent(previousOrParentTNode);
14443
- previousOrParentTNode = previousOrParentTNode.parent;
14444
- setPreviousOrParentTNode(previousOrParentTNode, false);
14445
- }
14446
- ngDevMode && assertNodeType(previousOrParentTNode, 0 /* Container */);
14447
- var lContainer = getLView()[previousOrParentTNode.index];
14448
- var nextIndex = getLContainerActiveIndex(lContainer);
14449
- // remove extra views at the end of the container
14450
- while (nextIndex < lContainer.length - CONTAINER_HEADER_OFFSET) {
14451
- removeView(lContainer, nextIndex);
14452
- }
14453
- }
14454
- function containerInternal(tView, lView, nodeIndex, tagName, attrs) {
14455
- ngDevMode &&
14456
- assertEqual(getBindingIndex(), tView.bindingStartIndex, 'container nodes should be created before any bindings');
14457
- var adjustedIndex = nodeIndex + HEADER_OFFSET;
14458
- ngDevMode && assertDataInRange(lView, nodeIndex + HEADER_OFFSET);
14459
- ngDevMode && ngDevMode.rendererCreateComment++;
14460
- var comment = lView[adjustedIndex] =
14461
- lView[RENDERER].createComment(ngDevMode ? 'container' : '');
14462
- var tNode = getOrCreateTNode(tView, lView[T_HOST], nodeIndex, 0 /* Container */, tagName, attrs);
14463
- var lContainer = lView[adjustedIndex] = createLContainer(comment, lView, comment, tNode);
14464
- appendChild(tView, lView, comment, tNode);
14465
- attachPatchData(comment, lView);
14466
- // Containers are added to the current view tree instead of their embedded views
14467
- // because views can be removed and re-inserted.
14468
- addToViewTree(lView, lContainer);
14469
- ngDevMode && assertNodeType(getPreviousOrParentTNode(), 0 /* Container */);
14470
- return tNode;
14471
- }
14472
14506
 
14473
14507
  /**
14474
14508
  * @license
@@ -14855,124 +14889,6 @@
14855
14889
  ɵɵelementContainerEnd();
14856
14890
  }
14857
14891
 
14858
- /**
14859
- * @license
14860
- * Copyright Google Inc. All Rights Reserved.
14861
- *
14862
- * Use of this source code is governed by an MIT-style license that can be
14863
- * found in the LICENSE file at https://angular.io/license
14864
- */
14865
- /**
14866
- * Marks the start of an embedded view.
14867
- *
14868
- * @param viewBlockId The ID of this view
14869
- * @return boolean Whether or not this view is in creation mode
14870
- *
14871
- * @codeGenApi
14872
- */
14873
- function ɵɵembeddedViewStart(viewBlockId, decls, vars) {
14874
- var lView = getLView();
14875
- var previousOrParentTNode = getPreviousOrParentTNode();
14876
- // The previous node can be a view node if we are processing an inline for loop
14877
- var containerTNode = previousOrParentTNode.type === 2 /* View */ ?
14878
- previousOrParentTNode.parent :
14879
- previousOrParentTNode;
14880
- var lContainer = lView[containerTNode.index];
14881
- ngDevMode && assertNodeType(containerTNode, 0 /* Container */);
14882
- var viewToRender = scanForView(lContainer, getLContainerActiveIndex(lContainer), viewBlockId);
14883
- if (viewToRender) {
14884
- setIsParent();
14885
- enterView(viewToRender, viewToRender[TVIEW].node);
14886
- }
14887
- else {
14888
- // When we create a new LView, we always reset the state of the instructions.
14889
- viewToRender = createLView(lView, getOrCreateEmbeddedTView(viewBlockId, decls, vars, containerTNode), null, 16 /* CheckAlways */, null, null);
14890
- var tParentNode = getIsParent() ? previousOrParentTNode :
14891
- previousOrParentTNode && previousOrParentTNode.parent;
14892
- assignTViewNodeToLView(viewToRender[TVIEW], tParentNode, viewBlockId, viewToRender);
14893
- enterView(viewToRender, viewToRender[TVIEW].node);
14894
- }
14895
- if (lContainer) {
14896
- if (isCreationMode(viewToRender)) {
14897
- // it is a new view, insert it into collection of views for a given container
14898
- insertView(viewToRender[TVIEW], viewToRender, lContainer, getLContainerActiveIndex(lContainer));
14899
- }
14900
- lContainer[ACTIVE_INDEX] += 2 /* INCREMENT */;
14901
- }
14902
- return isCreationMode(viewToRender) ? 1 /* Create */ | 2 /* Update */ :
14903
- 2 /* Update */;
14904
- }
14905
- /**
14906
- * Initialize the TView (e.g. static data) for the active embedded view.
14907
- *
14908
- * Each embedded view block must create or retrieve its own TView. Otherwise, the embedded view's
14909
- * static data for a particular node would overwrite the static data for a node in the view above
14910
- * it with the same index (since it's in the same template).
14911
- *
14912
- * @param viewIndex The index of the TView in TNode.tViews
14913
- * @param decls The number of nodes, local refs, and pipes in this template
14914
- * @param vars The number of bindings and pure function bindings in this template
14915
- * @param container The parent container in which to look for the view's static data
14916
- * @returns TView
14917
- */
14918
- function getOrCreateEmbeddedTView(viewIndex, decls, vars, parent) {
14919
- var tView = getLView()[TVIEW];
14920
- ngDevMode && assertNodeType(parent, 0 /* Container */);
14921
- var containerTViews = parent.tViews;
14922
- ngDevMode && assertDefined(containerTViews, 'TView expected');
14923
- ngDevMode && assertEqual(Array.isArray(containerTViews), true, 'TViews should be in an array');
14924
- if (viewIndex >= containerTViews.length || containerTViews[viewIndex] == null) {
14925
- containerTViews[viewIndex] = createTView(2 /* Embedded */, viewIndex, null, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, null, tView.consts);
14926
- }
14927
- return containerTViews[viewIndex];
14928
- }
14929
- /**
14930
- * Looks for a view with a given view block id inside a provided LContainer.
14931
- * Removes views that need to be deleted in the process.
14932
- *
14933
- * @param lContainer to search for views
14934
- * @param startIdx starting index in the views array to search from
14935
- * @param viewBlockId exact view block id to look for
14936
- */
14937
- function scanForView(lContainer, startIdx, viewBlockId) {
14938
- for (var i = startIdx + CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
14939
- var viewAtPositionId = lContainer[i][TVIEW].id;
14940
- if (viewAtPositionId === viewBlockId) {
14941
- return lContainer[i];
14942
- }
14943
- else if (viewAtPositionId < viewBlockId) {
14944
- // found a view that should not be at this position - remove
14945
- removeView(lContainer, i - CONTAINER_HEADER_OFFSET);
14946
- }
14947
- else {
14948
- // found a view with id greater than the one we are searching for
14949
- // which means that required view doesn't exist and can't be found at
14950
- // later positions in the views array - stop the searchdef.cont here
14951
- break;
14952
- }
14953
- }
14954
- return null;
14955
- }
14956
- /**
14957
- * Marks the end of an embedded view.
14958
- *
14959
- * @codeGenApi
14960
- */
14961
- function ɵɵembeddedViewEnd() {
14962
- var lView = getLView();
14963
- var tView = getTView();
14964
- var viewHost = lView[T_HOST];
14965
- var context = lView[CONTEXT];
14966
- if (isCreationMode(lView)) {
14967
- renderView(tView, lView, context); // creation mode pass
14968
- }
14969
- refreshView(tView, lView, tView.template, context); // update mode pass
14970
- var lContainer = lView[PARENT];
14971
- ngDevMode && assertLContainerOrUndefined(lContainer);
14972
- leaveView();
14973
- setPreviousOrParentTNode(viewHost, false);
14974
- }
14975
-
14976
14892
  /**
14977
14893
  * Returns the current OpaqueViewState instance.
14978
14894
  *
@@ -15040,7 +14956,7 @@
15040
14956
  return ɵɵlistener;
15041
14957
  }
15042
14958
  /**
15043
- * Registers a synthetic host listener (e.g. `(@foo.start)`) on a component.
14959
+ * Registers a synthetic host listener (e.g. `(@foo.start)`) on a component or directive.
15044
14960
  *
15045
14961
  * This instruction is for compatibility purposes and is designed to ensure that a
15046
14962
  * synthetic host listener (e.g. `@HostListener('@foo.start')`) properly gets rendered
@@ -15064,8 +14980,9 @@
15064
14980
  if (useCapture === void 0) { useCapture = false; }
15065
14981
  var tNode = getPreviousOrParentTNode();
15066
14982
  var lView = getLView();
15067
- var renderer = loadComponentRenderer(tNode, lView);
15068
14983
  var tView = getTView();
14984
+ var currentDef = getCurrentDirectiveDef(tView.data);
14985
+ var renderer = loadComponentRenderer(currentDef, tNode, lView);
15069
14986
  listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, useCapture, eventTargetResolver);
15070
14987
  return ɵɵcomponentHostSyntheticListener;
15071
14988
  }
@@ -16841,7 +16758,7 @@
16841
16758
  * @param isClassBased `true` if `class` (`false` if `style`)
16842
16759
  */
16843
16760
  function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
16844
- var hostDirectiveDef = getHostDirectiveDef(tData);
16761
+ var hostDirectiveDef = getCurrentDirectiveDef(tData);
16845
16762
  var residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
16846
16763
  if (hostDirectiveDef === null) {
16847
16764
  // We are in template node.
@@ -17070,16 +16987,6 @@
17070
16987
  }
17071
16988
  return stylingKey === undefined ? null : stylingKey;
17072
16989
  }
17073
- /**
17074
- * Retrieve the current `DirectiveDef` which is active when `hostBindings` style instruction is
17075
- * being executed (or `null` if we are in `template`.)
17076
- *
17077
- * @param tData Current `TData` where the `DirectiveDef` will be looked up at.
17078
- */
17079
- function getHostDirectiveDef(tData) {
17080
- var currentDirectiveIndex = getCurrentDirectiveIndex();
17081
- return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
17082
- }
17083
16990
  /**
17084
16991
  * Convert user input to `KeyValueArray`.
17085
16992
  *
@@ -18717,7 +18624,7 @@
18717
18624
  return ɵɵhostProperty;
18718
18625
  }
18719
18626
  /**
18720
- * Updates a synthetic host binding (e.g. `[@foo]`) on a component.
18627
+ * Updates a synthetic host binding (e.g. `[@foo]`) on a component or directive.
18721
18628
  *
18722
18629
  * This instruction is for compatibility purposes and is designed to ensure that a
18723
18630
  * synthetic host binding (e.g. `@HostBinding('@foo')`) properly gets rendered in
@@ -18743,7 +18650,8 @@
18743
18650
  if (bindingUpdated(lView, bindingIndex, value)) {
18744
18651
  var tView = getTView();
18745
18652
  var tNode = getSelectedTNode();
18746
- var renderer = loadComponentRenderer(tNode, lView);
18653
+ var currentDef = getCurrentDirectiveDef(tView.data);
18654
+ var renderer = loadComponentRenderer(currentDef, tNode, lView);
18747
18655
  elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true);
18748
18656
  ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
18749
18657
  }
@@ -20319,7 +20227,7 @@
20319
20227
  /**
20320
20228
  * @publicApi
20321
20229
  */
20322
- var VERSION = new Version('9.1.3');
20230
+ var VERSION = new Version('9.1.7');
20323
20231
 
20324
20232
  /**
20325
20233
  * @license
@@ -23419,14 +23327,18 @@
23419
23327
  }
23420
23328
  }
23421
23329
  }
23422
- tElementNode = getTNode(rootLView[TVIEW], 0);
23423
- if (projectableNodes) {
23424
- // projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
23425
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
23426
- // complex checks down the line.
23427
- tElementNode.projection = projectableNodes.map(function (nodesforSlot) {
23428
- return Array.from(nodesforSlot);
23429
- });
23330
+ tElementNode = getTNode(rootTView, 0);
23331
+ if (projectableNodes !== undefined) {
23332
+ var projection = tElementNode.projection = [];
23333
+ for (var i = 0; i < this.ngContentSelectors.length; i++) {
23334
+ var nodesforSlot = projectableNodes[i];
23335
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
23336
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
23337
+ // complex checks down the line.
23338
+ // We also normalize the length of the passed in projectable nodes (to match the number of
23339
+ // <ng-container> slots defined by a component).
23340
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
23341
+ }
23430
23342
  }
23431
23343
  // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
23432
23344
  // executed here?
@@ -23709,25 +23621,14 @@
23709
23621
  * Use of this source code is governed by an MIT-style license that can be
23710
23622
  * found in the LICENSE file at https://angular.io/license
23711
23623
  */
23624
+ var pluralMapping = ['zero', 'one', 'two', 'few', 'many'];
23712
23625
  /**
23713
23626
  * Returns the plural case based on the locale
23714
23627
  */
23715
23628
  function getPluralCase(value, locale) {
23716
- var plural = getLocalePluralCase(locale)(value);
23717
- switch (plural) {
23718
- case 0:
23719
- return 'zero';
23720
- case 1:
23721
- return 'one';
23722
- case 2:
23723
- return 'two';
23724
- case 3:
23725
- return 'few';
23726
- case 4:
23727
- return 'many';
23728
- default:
23729
- return 'other';
23730
- }
23629
+ var plural = getLocalePluralCase(locale)(parseInt(value, 10));
23630
+ var result = pluralMapping[plural];
23631
+ return (result !== undefined) ? result : 'other';
23731
23632
  }
23732
23633
  /**
23733
23634
  * The locale id that the application is using by default (for translations and ICU expressions).
@@ -26558,10 +26459,7 @@
26558
26459
  'ɵɵProvidersFeature': ɵɵProvidersFeature,
26559
26460
  'ɵɵCopyDefinitionFeature': ɵɵCopyDefinitionFeature,
26560
26461
  'ɵɵInheritDefinitionFeature': ɵɵInheritDefinitionFeature,
26561
- 'ɵɵcontainer': ɵɵcontainer,
26562
26462
  'ɵɵnextContext': ɵɵnextContext,
26563
- 'ɵɵcontainerRefreshStart': ɵɵcontainerRefreshStart,
26564
- 'ɵɵcontainerRefreshEnd': ɵɵcontainerRefreshEnd,
26565
26463
  'ɵɵnamespaceHTML': ɵɵnamespaceHTML,
26566
26464
  'ɵɵnamespaceMathML': ɵɵnamespaceMathML,
26567
26465
  'ɵɵnamespaceSVG': ɵɵnamespaceSVG,
@@ -26661,8 +26559,6 @@
26661
26559
  'ɵɵtextInterpolate7': ɵɵtextInterpolate7,
26662
26560
  'ɵɵtextInterpolate8': ɵɵtextInterpolate8,
26663
26561
  'ɵɵtextInterpolateV': ɵɵtextInterpolateV,
26664
- 'ɵɵembeddedViewStart': ɵɵembeddedViewStart,
26665
- 'ɵɵembeddedViewEnd': ɵɵembeddedViewEnd,
26666
26562
  'ɵɵi18n': ɵɵi18n,
26667
26563
  'ɵɵi18nAttributes': ɵɵi18nAttributes,
26668
26564
  'ɵɵi18nExp': ɵɵi18nExp,
@@ -33210,9 +33106,6 @@
33210
33106
  exports.ɵɵclassMapInterpolateV = ɵɵclassMapInterpolateV;
33211
33107
  exports.ɵɵclassProp = ɵɵclassProp;
33212
33108
  exports.ɵɵcomponentHostSyntheticListener = ɵɵcomponentHostSyntheticListener;
33213
- exports.ɵɵcontainer = ɵɵcontainer;
33214
- exports.ɵɵcontainerRefreshEnd = ɵɵcontainerRefreshEnd;
33215
- exports.ɵɵcontainerRefreshStart = ɵɵcontainerRefreshStart;
33216
33109
  exports.ɵɵcontentQuery = ɵɵcontentQuery;
33217
33110
  exports.ɵɵdefaultStyleSanitizer = ɵɵdefaultStyleSanitizer;
33218
33111
  exports.ɵɵdefineComponent = ɵɵdefineComponent;
@@ -33229,8 +33122,6 @@
33229
33122
  exports.ɵɵelementContainerStart = ɵɵelementContainerStart;
33230
33123
  exports.ɵɵelementEnd = ɵɵelementEnd;
33231
33124
  exports.ɵɵelementStart = ɵɵelementStart;
33232
- exports.ɵɵembeddedViewEnd = ɵɵembeddedViewEnd;
33233
- exports.ɵɵembeddedViewStart = ɵɵembeddedViewStart;
33234
33125
  exports.ɵɵenableBindings = ɵɵenableBindings;
33235
33126
  exports.ɵɵgetCurrentView = ɵɵgetCurrentView;
33236
33127
  exports.ɵɵgetFactoryOf = ɵɵgetFactoryOf;