@angular/core 14.0.4 → 14.0.5

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 +1 -1
  2. package/esm2020/src/core.mjs +1 -1
  3. package/esm2020/src/core_render3_private_export.mjs +2 -2
  4. package/esm2020/src/debug/debug_node.mjs +2 -3
  5. package/esm2020/src/errors.mjs +1 -1
  6. package/esm2020/src/render/api.mjs +2 -11
  7. package/esm2020/src/render3/component.mjs +3 -58
  8. package/esm2020/src/render3/component_ref.mjs +9 -3
  9. package/esm2020/src/render3/index.mjs +3 -3
  10. package/esm2020/src/render3/instructions/listener.mjs +34 -44
  11. package/esm2020/src/render3/instructions/lview_debug.mjs +1 -1
  12. package/esm2020/src/render3/instructions/shared.mjs +19 -57
  13. package/esm2020/src/render3/instructions/styling.mjs +2 -2
  14. package/esm2020/src/render3/interfaces/renderer.mjs +1 -26
  15. package/esm2020/src/render3/interfaces/view.mjs +1 -1
  16. package/esm2020/src/render3/node_manipulation.mjs +24 -87
  17. package/esm2020/src/render3/node_manipulation_i18n.mjs +1 -1
  18. package/esm2020/src/render3/util/attrs_utils.mjs +4 -12
  19. package/esm2020/src/render3/util/view_utils.mjs +3 -6
  20. package/esm2020/src/version.mjs +1 -1
  21. package/esm2020/testing/src/logger.mjs +3 -3
  22. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  23. package/fesm2015/core.mjs +1751 -1946
  24. package/fesm2015/core.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +1625 -1912
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/core.mjs +1751 -1946
  28. package/fesm2020/core.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +1625 -1912
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/index.d.ts +55 -128
  32. package/package.json +1 -1
  33. package/testing/index.d.ts +1 -1
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.4
2
+ * @license Angular v14.0.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1593,96 +1593,6 @@ function getNamespaceUri(namespace) {
1593
1593
  (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
1594
1594
  }
1595
1595
 
1596
- /**
1597
- * @license
1598
- * Copyright Google LLC All Rights Reserved.
1599
- *
1600
- * Use of this source code is governed by an MIT-style license that can be
1601
- * found in the LICENSE file at https://angular.io/license
1602
- */
1603
- /**
1604
- * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
1605
- * inject the `DOCUMENT` token and are done.
1606
- *
1607
- * Ivy is special because it does not rely upon the DI and must get hold of the document some other
1608
- * way.
1609
- *
1610
- * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
1611
- * Wherever ivy needs the global document, it calls `getDocument()` instead.
1612
- *
1613
- * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
1614
- * tell ivy what the global `document` is.
1615
- *
1616
- * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
1617
- * by calling `setDocument()` when providing the `DOCUMENT` token.
1618
- */
1619
- let DOCUMENT = undefined;
1620
- /**
1621
- * Tell ivy what the `document` is for this platform.
1622
- *
1623
- * It is only necessary to call this if the current platform is not a browser.
1624
- *
1625
- * @param document The object representing the global `document` in this environment.
1626
- */
1627
- function setDocument(document) {
1628
- DOCUMENT = document;
1629
- }
1630
- /**
1631
- * Access the object that represents the `document` for this platform.
1632
- *
1633
- * Ivy calls this whenever it needs to access the `document` object.
1634
- * For example to create the renderer or to do sanitization.
1635
- */
1636
- function getDocument() {
1637
- if (DOCUMENT !== undefined) {
1638
- return DOCUMENT;
1639
- }
1640
- else if (typeof document !== 'undefined') {
1641
- return document;
1642
- }
1643
- // No "document" can be found. This should only happen if we are running ivy outside Angular and
1644
- // the current platform is not a browser. Since this is not a supported scenario at the moment
1645
- // this should not happen in Angular apps.
1646
- // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
1647
- // public API. Meanwhile we just return `undefined` and let the application fail.
1648
- return undefined;
1649
- }
1650
-
1651
- /**
1652
- * @license
1653
- * Copyright Google LLC All Rights Reserved.
1654
- *
1655
- * Use of this source code is governed by an MIT-style license that can be
1656
- * found in the LICENSE file at https://angular.io/license
1657
- */
1658
- // TODO: cleanup once the code is merged in angular/angular
1659
- var RendererStyleFlags3;
1660
- (function (RendererStyleFlags3) {
1661
- RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
1662
- RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
1663
- })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
1664
- /** Returns whether the `renderer` is a `ProceduralRenderer3` */
1665
- function isProceduralRenderer(renderer) {
1666
- return !!(renderer.listen);
1667
- }
1668
- let renderer3Enabled = false;
1669
- function enableRenderer3() {
1670
- renderer3Enabled = true;
1671
- }
1672
- const domRendererFactory3 = {
1673
- createRenderer: (hostElement, rendererType) => {
1674
- if (!renderer3Enabled) {
1675
- throw new Error(ngDevMode ?
1676
- `Renderer3 is not supported. This problem is likely caused by some component in the hierarchy was constructed without a correct parent injector.` :
1677
- 'Renderer3 disabled');
1678
- }
1679
- return getDocument();
1680
- }
1681
- };
1682
- // Note: This hack is necessary so we don't erroneously get a circular dependency
1683
- // failure based on types.
1684
- const unusedValueExportToPlacateAjd$6 = 1;
1685
-
1686
1596
  /**
1687
1597
  * @license
1688
1598
  * Copyright Google LLC All Rights Reserved.
@@ -1765,7 +1675,6 @@ function getNativeByTNode(tNode, lView) {
1765
1675
  ngDevMode && assertTNodeForLView(tNode, lView);
1766
1676
  ngDevMode && assertIndexInRange(lView, tNode.index);
1767
1677
  const node = unwrapRNode(lView[tNode.index]);
1768
- ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1769
1678
  return node;
1770
1679
  }
1771
1680
  /**
@@ -1781,7 +1690,6 @@ function getNativeByTNodeOrNull(tNode, lView) {
1781
1690
  if (index !== -1) {
1782
1691
  ngDevMode && assertTNodeForLView(tNode, lView);
1783
1692
  const node = unwrapRNode(lView[index]);
1784
- ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1785
1693
  return node;
1786
1694
  }
1787
1695
  return null;
@@ -2730,7 +2638,7 @@ function isFactory(obj) {
2730
2638
  }
2731
2639
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2732
2640
  // failure based on types.
2733
- const unusedValueExportToPlacateAjd$5 = 1;
2641
+ const unusedValueExportToPlacateAjd$6 = 1;
2734
2642
 
2735
2643
  /**
2736
2644
  * Converts `TNodeType` into human readable text.
@@ -2749,7 +2657,7 @@ function toTNodeTypeAsString(tNodeType) {
2749
2657
  }
2750
2658
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2751
2659
  // failure based on types.
2752
- const unusedValueExportToPlacateAjd$4 = 1;
2660
+ const unusedValueExportToPlacateAjd$5 = 1;
2753
2661
  /**
2754
2662
  * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.
2755
2663
  *
@@ -2853,7 +2761,6 @@ function assertPureTNodeType(type) {
2853
2761
  * @returns the index value that was last accessed in the attributes array
2854
2762
  */
2855
2763
  function setUpAttributes(renderer, native, attrs) {
2856
- const isProc = isProceduralRenderer(renderer);
2857
2764
  let i = 0;
2858
2765
  while (i < attrs.length) {
2859
2766
  const value = attrs[i];
@@ -2870,9 +2777,7 @@ function setUpAttributes(renderer, native, attrs) {
2870
2777
  const attrName = attrs[i++];
2871
2778
  const attrVal = attrs[i++];
2872
2779
  ngDevMode && ngDevMode.rendererSetAttribute++;
2873
- isProc ?
2874
- renderer.setAttribute(native, attrName, attrVal, namespaceURI) :
2875
- native.setAttributeNS(namespaceURI, attrName, attrVal);
2780
+ renderer.setAttribute(native, attrName, attrVal, namespaceURI);
2876
2781
  }
2877
2782
  else {
2878
2783
  // attrName is string;
@@ -2881,14 +2786,10 @@ function setUpAttributes(renderer, native, attrs) {
2881
2786
  // Standard attributes
2882
2787
  ngDevMode && ngDevMode.rendererSetAttribute++;
2883
2788
  if (isAnimationProp(attrName)) {
2884
- if (isProc) {
2885
- renderer.setProperty(native, attrName, attrVal);
2886
- }
2789
+ renderer.setProperty(native, attrName, attrVal);
2887
2790
  }
2888
2791
  else {
2889
- isProc ?
2890
- renderer.setAttribute(native, attrName, attrVal) :
2891
- native.setAttribute(attrName, attrVal);
2792
+ renderer.setAttribute(native, attrName, attrVal);
2892
2793
  }
2893
2794
  i++;
2894
2795
  }
@@ -5344,6 +5245,61 @@ function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
5344
5245
  checkForDuplicateNgModules = !allowDuplicates;
5345
5246
  }
5346
5247
 
5248
+ /**
5249
+ * @license
5250
+ * Copyright Google LLC All Rights Reserved.
5251
+ *
5252
+ * Use of this source code is governed by an MIT-style license that can be
5253
+ * found in the LICENSE file at https://angular.io/license
5254
+ */
5255
+ /**
5256
+ * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
5257
+ * inject the `DOCUMENT` token and are done.
5258
+ *
5259
+ * Ivy is special because it does not rely upon the DI and must get hold of the document some other
5260
+ * way.
5261
+ *
5262
+ * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
5263
+ * Wherever ivy needs the global document, it calls `getDocument()` instead.
5264
+ *
5265
+ * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
5266
+ * tell ivy what the global `document` is.
5267
+ *
5268
+ * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
5269
+ * by calling `setDocument()` when providing the `DOCUMENT` token.
5270
+ */
5271
+ let DOCUMENT = undefined;
5272
+ /**
5273
+ * Tell ivy what the `document` is for this platform.
5274
+ *
5275
+ * It is only necessary to call this if the current platform is not a browser.
5276
+ *
5277
+ * @param document The object representing the global `document` in this environment.
5278
+ */
5279
+ function setDocument(document) {
5280
+ DOCUMENT = document;
5281
+ }
5282
+ /**
5283
+ * Access the object that represents the `document` for this platform.
5284
+ *
5285
+ * Ivy calls this whenever it needs to access the `document` object.
5286
+ * For example to create the renderer or to do sanitization.
5287
+ */
5288
+ function getDocument() {
5289
+ if (DOCUMENT !== undefined) {
5290
+ return DOCUMENT;
5291
+ }
5292
+ else if (typeof document !== 'undefined') {
5293
+ return document;
5294
+ }
5295
+ // No "document" can be found. This should only happen if we are running ivy outside Angular and
5296
+ // the current platform is not a browser. Since this is not a supported scenario at the moment
5297
+ // this should not happen in Angular apps.
5298
+ // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
5299
+ // public API. Meanwhile we just return `undefined` and let the application fail.
5300
+ return undefined;
5301
+ }
5302
+
5347
5303
  /**
5348
5304
  * @license
5349
5305
  * Copyright Google LLC All Rights Reserved.
@@ -7073,6 +7029,17 @@ function ensureIcuContainerVisitorLoaded(loader) {
7073
7029
  }
7074
7030
  }
7075
7031
 
7032
+ /**
7033
+ * @license
7034
+ * Copyright Google LLC All Rights Reserved.
7035
+ *
7036
+ * Use of this source code is governed by an MIT-style license that can be
7037
+ * found in the LICENSE file at https://angular.io/license
7038
+ */
7039
+ // Note: This hack is necessary so we don't erroneously get a circular dependency
7040
+ // failure based on types.
7041
+ const unusedValueExportToPlacateAjd$4 = 1;
7042
+
7076
7043
  /**
7077
7044
  * @license
7078
7045
  * Copyright Google LLC All Rights Reserved.
@@ -7155,7 +7122,7 @@ function getNearestLContainer(viewOrContainer) {
7155
7122
  * Use of this source code is governed by an MIT-style license that can be
7156
7123
  * found in the LICENSE file at https://angular.io/license
7157
7124
  */
7158
- const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$8;
7125
+ const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$8;
7159
7126
  /**
7160
7127
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
7161
7128
  * being passed as an argument.
@@ -7180,7 +7147,6 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7180
7147
  lNodeToHandle = lNodeToHandle[HOST];
7181
7148
  }
7182
7149
  const rNode = unwrapRNode(lNodeToHandle);
7183
- ngDevMode && !isProceduralRenderer(renderer) && assertDomNode(rNode);
7184
7150
  if (action === 0 /* WalkTNodeTreeAction.Create */ && parent !== null) {
7185
7151
  if (beforeNode == null) {
7186
7152
  nativeAppendChild(renderer, parent, rNode);
@@ -7207,17 +7173,14 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7207
7173
  function createTextNode(renderer, value) {
7208
7174
  ngDevMode && ngDevMode.rendererCreateTextNode++;
7209
7175
  ngDevMode && ngDevMode.rendererSetText++;
7210
- return isProceduralRenderer(renderer) ? renderer.createText(value) :
7211
- renderer.createTextNode(value);
7176
+ return renderer.createText(value);
7212
7177
  }
7213
7178
  function updateTextNode(renderer, rNode, value) {
7214
7179
  ngDevMode && ngDevMode.rendererSetText++;
7215
- isProceduralRenderer(renderer) ? renderer.setValue(rNode, value) : rNode.textContent = value;
7180
+ renderer.setValue(rNode, value);
7216
7181
  }
7217
7182
  function createCommentNode(renderer, value) {
7218
7183
  ngDevMode && ngDevMode.rendererCreateComment++;
7219
- // isProceduralRenderer check is not needed because both `Renderer2` and `Renderer3` have the same
7220
- // method name.
7221
7184
  return renderer.createComment(escapeCommentText(value));
7222
7185
  }
7223
7186
  /**
@@ -7229,14 +7192,7 @@ function createCommentNode(renderer, value) {
7229
7192
  */
7230
7193
  function createElementNode(renderer, name, namespace) {
7231
7194
  ngDevMode && ngDevMode.rendererCreateElement++;
7232
- if (isProceduralRenderer(renderer)) {
7233
- return renderer.createElement(name, namespace);
7234
- }
7235
- else {
7236
- const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
7237
- return namespaceUri === null ? renderer.createElement(name) :
7238
- renderer.createElementNS(namespaceUri, name);
7239
- }
7195
+ return renderer.createElement(name, namespace);
7240
7196
  }
7241
7197
  /**
7242
7198
  * Removes all DOM elements associated with a view.
@@ -7468,7 +7424,7 @@ function detachView(lContainer, removeIndex) {
7468
7424
  function destroyLView(tView, lView) {
7469
7425
  if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7470
7426
  const renderer = lView[RENDERER];
7471
- if (isProceduralRenderer(renderer) && renderer.destroyNode) {
7427
+ if (renderer.destroyNode) {
7472
7428
  applyView(tView, lView, renderer, 3 /* WalkTNodeTreeAction.Destroy */, null, null);
7473
7429
  }
7474
7430
  destroyViewTree(lView);
@@ -7496,7 +7452,7 @@ function cleanUpView(tView, lView) {
7496
7452
  executeOnDestroys(tView, lView);
7497
7453
  processCleanups(tView, lView);
7498
7454
  // For component views only, the local renderer is destroyed at clean up time.
7499
- if (lView[TVIEW].type === 1 /* TViewType.Component */ && isProceduralRenderer(lView[RENDERER])) {
7455
+ if (lView[TVIEW].type === 1 /* TViewType.Component */) {
7500
7456
  ngDevMode && ngDevMode.rendererDestroy++;
7501
7457
  lView[RENDERER].destroy();
7502
7458
  }
@@ -7672,30 +7628,17 @@ function getClosestRElement(tView, tNode, lView) {
7672
7628
  }
7673
7629
  }
7674
7630
  /**
7675
- * Inserts a native node before another native node for a given parent using {@link Renderer3}.
7676
- * This is a utility function that can be used when native nodes were determined - it abstracts an
7677
- * actual renderer being used.
7631
+ * Inserts a native node before another native node for a given parent.
7632
+ * This is a utility function that can be used when native nodes were determined.
7678
7633
  */
7679
7634
  function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
7680
7635
  ngDevMode && ngDevMode.rendererInsertBefore++;
7681
- if (isProceduralRenderer(renderer)) {
7682
- renderer.insertBefore(parent, child, beforeNode, isMove);
7683
- }
7684
- else {
7685
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7686
- targetParent.insertBefore(child, beforeNode, isMove);
7687
- }
7636
+ renderer.insertBefore(parent, child, beforeNode, isMove);
7688
7637
  }
7689
7638
  function nativeAppendChild(renderer, parent, child) {
7690
7639
  ngDevMode && ngDevMode.rendererAppendChild++;
7691
7640
  ngDevMode && assertDefined(parent, 'parent node must be defined');
7692
- if (isProceduralRenderer(renderer)) {
7693
- renderer.appendChild(parent, child);
7694
- }
7695
- else {
7696
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7697
- targetParent.appendChild(child);
7698
- }
7641
+ renderer.appendChild(parent, child);
7699
7642
  }
7700
7643
  function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
7701
7644
  if (beforeNode !== null) {
@@ -7707,12 +7650,7 @@ function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove)
7707
7650
  }
7708
7651
  /** Removes a node from the DOM given its native parent. */
7709
7652
  function nativeRemoveChild(renderer, parent, child, isHostElement) {
7710
- if (isProceduralRenderer(renderer)) {
7711
- renderer.removeChild(parent, child, isHostElement);
7712
- }
7713
- else {
7714
- parent.removeChild(child);
7715
- }
7653
+ renderer.removeChild(parent, child, isHostElement);
7716
7654
  }
7717
7655
  /** Checks if an element is a `<template>` node. */
7718
7656
  function isTemplateNode(node) {
@@ -7722,13 +7660,13 @@ function isTemplateNode(node) {
7722
7660
  * Returns a native parent of a given native node.
7723
7661
  */
7724
7662
  function nativeParentNode(renderer, node) {
7725
- return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode);
7663
+ return renderer.parentNode(node);
7726
7664
  }
7727
7665
  /**
7728
7666
  * Returns a native sibling of a given native node.
7729
7667
  */
7730
7668
  function nativeNextSibling(renderer, node) {
7731
- return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
7669
+ return renderer.nextSibling(node);
7732
7670
  }
7733
7671
  /**
7734
7672
  * Find a node in front of which `currentTNode` should be inserted.
@@ -8037,39 +7975,22 @@ function applyContainer(renderer, action, lContainer, parentRElement, beforeNode
8037
7975
  * otherwise).
8038
7976
  */
8039
7977
  function applyStyling(renderer, isClassBased, rNode, prop, value) {
8040
- const isProcedural = isProceduralRenderer(renderer);
8041
7978
  if (isClassBased) {
8042
7979
  // We actually want JS true/false here because any truthy value should add the class
8043
7980
  if (!value) {
8044
7981
  ngDevMode && ngDevMode.rendererRemoveClass++;
8045
- if (isProcedural) {
8046
- renderer.removeClass(rNode, prop);
8047
- }
8048
- else {
8049
- rNode.classList.remove(prop);
8050
- }
7982
+ renderer.removeClass(rNode, prop);
8051
7983
  }
8052
7984
  else {
8053
7985
  ngDevMode && ngDevMode.rendererAddClass++;
8054
- if (isProcedural) {
8055
- renderer.addClass(rNode, prop);
8056
- }
8057
- else {
8058
- ngDevMode && assertDefined(rNode.classList, 'HTMLElement expected');
8059
- rNode.classList.add(prop);
8060
- }
7986
+ renderer.addClass(rNode, prop);
8061
7987
  }
8062
7988
  }
8063
7989
  else {
8064
7990
  let flags = prop.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase;
8065
7991
  if (value == null /** || value === undefined */) {
8066
7992
  ngDevMode && ngDevMode.rendererRemoveStyle++;
8067
- if (isProcedural) {
8068
- renderer.removeStyle(rNode, prop, flags);
8069
- }
8070
- else {
8071
- rNode.style.removeProperty(prop);
8072
- }
7993
+ renderer.removeStyle(rNode, prop, flags);
8073
7994
  }
8074
7995
  else {
8075
7996
  // A value is important if it ends with `!important`. The style
@@ -8081,13 +8002,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8081
8002
  flags |= RendererStyleFlags2.Important;
8082
8003
  }
8083
8004
  ngDevMode && ngDevMode.rendererSetStyle++;
8084
- if (isProcedural) {
8085
- renderer.setStyle(rNode, prop, value, flags);
8086
- }
8087
- else {
8088
- ngDevMode && assertDefined(rNode.style, 'HTMLElement expected');
8089
- rNode.style.setProperty(prop, value, isImportant ? 'important' : '');
8090
- }
8005
+ renderer.setStyle(rNode, prop, value, flags);
8091
8006
  }
8092
8007
  }
8093
8008
  }
@@ -8103,12 +8018,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8103
8018
  */
8104
8019
  function writeDirectStyle(renderer, element, newValue) {
8105
8020
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8106
- if (isProceduralRenderer(renderer)) {
8107
- renderer.setAttribute(element, 'style', newValue);
8108
- }
8109
- else {
8110
- element.style.cssText = newValue;
8111
- }
8021
+ renderer.setAttribute(element, 'style', newValue);
8112
8022
  ngDevMode && ngDevMode.rendererSetStyle++;
8113
8023
  }
8114
8024
  /**
@@ -8123,17 +8033,12 @@ function writeDirectStyle(renderer, element, newValue) {
8123
8033
  */
8124
8034
  function writeDirectClass(renderer, element, newValue) {
8125
8035
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8126
- if (isProceduralRenderer(renderer)) {
8127
- if (newValue === '') {
8128
- // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8129
- renderer.removeAttribute(element, 'class');
8130
- }
8131
- else {
8132
- renderer.setAttribute(element, 'class', newValue);
8133
- }
8036
+ if (newValue === '') {
8037
+ // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8038
+ renderer.removeAttribute(element, 'class');
8134
8039
  }
8135
8040
  else {
8136
- element.className = newValue;
8041
+ renderer.setAttribute(element, 'class', newValue);
8137
8042
  }
8138
8043
  ngDevMode && ngDevMode.rendererSetClassName++;
8139
8044
  }
@@ -8183,7 +8088,7 @@ function classIndexOf(className, classToSearch, startingIndex) {
8183
8088
  * Use of this source code is governed by an MIT-style license that can be
8184
8089
  * found in the LICENSE file at https://angular.io/license
8185
8090
  */
8186
- const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3;
8091
+ const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4;
8187
8092
  const NG_TEMPLATE_SELECTOR = 'ng-template';
8188
8093
  /**
8189
8094
  * Search the `TAttributes` to see if it contains `cssClassToMatch` (case insensitive)
@@ -11512,6 +11417,13 @@ class LContainerDebug {
11512
11417
  }
11513
11418
  }
11514
11419
 
11420
+ /**
11421
+ * @license
11422
+ * Copyright Google LLC All Rights Reserved.
11423
+ *
11424
+ * Use of this source code is governed by an MIT-style license that can be
11425
+ * found in the LICENSE file at https://angular.io/license
11426
+ */
11515
11427
  /**
11516
11428
  * A permanent marker promise which signifies that the current CD tree is
11517
11429
  * clean.
@@ -11579,7 +11491,7 @@ function refreshChildComponents(hostLView, components) {
11579
11491
  /** Renders child components in the current view (creation mode). */
11580
11492
  function renderChildComponents(hostLView, components) {
11581
11493
  for (let i = 0; i < components.length; i++) {
11582
- renderComponent$1(hostLView, components[i]);
11494
+ renderComponent(hostLView, components[i]);
11583
11495
  }
11584
11496
  }
11585
11497
  function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
@@ -12097,16 +12009,6 @@ function createViewBlueprint(bindingStartIndex, initialViewLength) {
12097
12009
  function createError(text, token) {
12098
12010
  return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
12099
12011
  }
12100
- function assertHostNodeExists(rElement, elementOrSelector) {
12101
- if (!rElement) {
12102
- if (typeof elementOrSelector === 'string') {
12103
- throw createError('Host node with selector not found:', elementOrSelector);
12104
- }
12105
- else {
12106
- throw createError('Host node is required:', elementOrSelector);
12107
- }
12108
- }
12109
- }
12110
12012
  /**
12111
12013
  * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
12112
12014
  *
@@ -12115,21 +12017,9 @@ function assertHostNodeExists(rElement, elementOrSelector) {
12115
12017
  * @param encapsulation View Encapsulation defined for component that requests host element.
12116
12018
  */
12117
12019
  function locateHostElement(renderer, elementOrSelector, encapsulation) {
12118
- if (isProceduralRenderer(renderer)) {
12119
- // When using native Shadow DOM, do not clear host element to allow native slot projection
12120
- const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12121
- return renderer.selectRootElement(elementOrSelector, preserveContent);
12122
- }
12123
- let rElement = typeof elementOrSelector === 'string' ?
12124
- renderer.querySelector(elementOrSelector) :
12125
- elementOrSelector;
12126
- ngDevMode && assertHostNodeExists(rElement, elementOrSelector);
12127
- // Always clear host element's content when Renderer3 is in use. For procedural renderer case we
12128
- // make it depend on whether ShadowDom encapsulation is used (in which case the content should be
12129
- // preserved to allow native slot projection). ShadowDom encapsulation requires procedural
12130
- // renderer, and procedural renderer case is handled above.
12131
- rElement.textContent = '';
12132
- return rElement;
12020
+ // When using native Shadow DOM, do not clear host element to allow native slot projection
12021
+ const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12022
+ return renderer.selectRootElement(elementOrSelector, preserveContent);
12133
12023
  }
12134
12024
  /**
12135
12025
  * Saves context for this cleanup function in LView.cleanupInstances.
@@ -12344,13 +12234,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12344
12234
  // It is assumed that the sanitizer is only added when the compiler determines that the
12345
12235
  // property is risky, so sanitization can be done without further checks.
12346
12236
  value = sanitizer != null ? sanitizer(value, tNode.value || '', propName) : value;
12347
- if (isProceduralRenderer(renderer)) {
12348
- renderer.setProperty(element, propName, value);
12349
- }
12350
- else if (!isAnimationProp(propName)) {
12351
- element.setProperty ? element.setProperty(propName, value) :
12352
- element[propName] = value;
12353
- }
12237
+ renderer.setProperty(element, propName, value);
12354
12238
  }
12355
12239
  else if (tNode.type & 12 /* TNodeType.AnyContainer */) {
12356
12240
  // If the node is a container and the property didn't
@@ -12374,23 +12258,15 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
12374
12258
  const debugValue = normalizeDebugBindingValue(value);
12375
12259
  if (type & 3 /* TNodeType.AnyRNode */) {
12376
12260
  if (value == null) {
12377
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, attrName) :
12378
- element.removeAttribute(attrName);
12261
+ renderer.removeAttribute(element, attrName);
12379
12262
  }
12380
12263
  else {
12381
- isProceduralRenderer(renderer) ?
12382
- renderer.setAttribute(element, attrName, debugValue) :
12383
- element.setAttribute(attrName, debugValue);
12264
+ renderer.setAttribute(element, attrName, debugValue);
12384
12265
  }
12385
12266
  }
12386
12267
  else {
12387
12268
  const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
12388
- if (isProceduralRenderer(renderer)) {
12389
- renderer.setValue(element, textContent);
12390
- }
12391
- else {
12392
- element.textContent = textContent;
12393
- }
12269
+ renderer.setValue(element, textContent);
12394
12270
  }
12395
12271
  }
12396
12272
  function setNgReflectProperties(lView, element, type, dataValue, value) {
@@ -12744,19 +12620,12 @@ function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespac
12744
12620
  function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) {
12745
12621
  if (value == null) {
12746
12622
  ngDevMode && ngDevMode.rendererRemoveAttribute++;
12747
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) :
12748
- element.removeAttribute(name);
12623
+ renderer.removeAttribute(element, name, namespace);
12749
12624
  }
12750
12625
  else {
12751
12626
  ngDevMode && ngDevMode.rendererSetAttribute++;
12752
12627
  const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || '', name);
12753
- if (isProceduralRenderer(renderer)) {
12754
- renderer.setAttribute(element, name, strValue, namespace);
12755
- }
12756
- else {
12757
- namespace ? element.setAttributeNS(namespace, name, strValue) :
12758
- element.setAttribute(name, strValue);
12759
- }
12628
+ renderer.setAttribute(element, name, strValue, namespace);
12760
12629
  }
12761
12630
  }
12762
12631
  /**
@@ -12848,7 +12717,6 @@ const LContainerArray = class LContainer extends Array {
12848
12717
  */
12849
12718
  function createLContainer(hostNative, currentView, native, tNode) {
12850
12719
  ngDevMode && assertLView(currentView);
12851
- ngDevMode && !isProceduralRenderer(currentView[RENDERER]) && assertDomNode(native);
12852
12720
  // https://jsperf.com/array-literal-vs-new-array-really
12853
12721
  const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative, // host native
12854
12722
  true, // Boolean `true` in this position signifies that this is an `LContainer`
@@ -12964,7 +12832,7 @@ function refreshContainsDirtyView(lView) {
12964
12832
  }
12965
12833
  }
12966
12834
  }
12967
- function renderComponent$1(hostLView, componentHostIdx) {
12835
+ function renderComponent(hostLView, componentHostIdx) {
12968
12836
  ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
12969
12837
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
12970
12838
  const componentTView = componentView[TVIEW];
@@ -13316,48 +13184,135 @@ function computeStaticStyling(tNode, attrs, writeToHost) {
13316
13184
  * Use of this source code is governed by an MIT-style license that can be
13317
13185
  * found in the LICENSE file at https://angular.io/license
13318
13186
  */
13187
+ // TODO: A hack to not pull in the NullInjector from @angular/core.
13188
+ const NULL_INJECTOR = {
13189
+ get: (token, notFoundValue) => {
13190
+ throwProviderNotFoundError(token, 'NullInjector');
13191
+ }
13192
+ };
13319
13193
  /**
13320
- * Synchronously perform change detection on a component (and possibly its sub-components).
13194
+ * Creates the root component view and the root component node.
13321
13195
  *
13322
- * This function triggers change detection in a synchronous way on a component.
13196
+ * @param rNode Render host element.
13197
+ * @param def ComponentDef
13198
+ * @param rootView The parent view where the host node is stored
13199
+ * @param rendererFactory Factory to be used for creating child renderers.
13200
+ * @param hostRenderer The current renderer
13201
+ * @param sanitizer The sanitizer, if provided
13323
13202
  *
13324
- * @param component The component which the change detection should be performed on.
13203
+ * @returns Component view created
13325
13204
  */
13326
- function detectChanges(component) {
13327
- const view = getComponentViewByInstance(component);
13328
- detectChangesInternal(view[TVIEW], view, component);
13205
+ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13206
+ const tView = rootView[TVIEW];
13207
+ const index = HEADER_OFFSET;
13208
+ ngDevMode && assertIndexInRange(rootView, index);
13209
+ rootView[index] = rNode;
13210
+ // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13211
+ // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13212
+ // representing a host element.
13213
+ const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13214
+ const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13215
+ if (mergedAttrs !== null) {
13216
+ computeStaticStyling(tNode, mergedAttrs, true);
13217
+ if (rNode !== null) {
13218
+ setUpAttributes(hostRenderer, rNode, mergedAttrs);
13219
+ if (tNode.classes !== null) {
13220
+ writeDirectClass(hostRenderer, rNode, tNode.classes);
13221
+ }
13222
+ if (tNode.styles !== null) {
13223
+ writeDirectStyle(hostRenderer, rNode, tNode.styles);
13224
+ }
13225
+ }
13226
+ }
13227
+ const viewRenderer = rendererFactory.createRenderer(rNode, def);
13228
+ const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13229
+ if (tView.firstCreatePass) {
13230
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13231
+ markAsComponentHost(tView, tNode);
13232
+ initTNodeFlags(tNode, rootView.length, 1);
13233
+ }
13234
+ addToViewTree(rootView, componentView);
13235
+ // Store component view at node index, with node as the HOST
13236
+ return rootView[index] = componentView;
13329
13237
  }
13330
13238
  /**
13331
- * Marks the component as dirty (needing change detection). Marking a component dirty will
13332
- * schedule a change detection on it at some point in the future.
13333
- *
13334
- * Marking an already dirty component as dirty won't do anything. Only one outstanding change
13335
- * detection can be scheduled per component tree.
13336
- *
13337
- * @param component Component to mark as dirty.
13239
+ * Creates a root component and sets it up with features and host bindings. Shared by
13240
+ * renderComponent() and ViewContainerRef.createComponent().
13338
13241
  */
13339
- function markDirty(component) {
13340
- ngDevMode && assertDefined(component, 'component');
13341
- const rootView = markViewDirty(getComponentViewByInstance(component));
13342
- ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
13343
- scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
13344
- }
13242
+ function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13243
+ const tView = rootLView[TVIEW];
13244
+ // Create directive instance with factory() and store at next index in viewData
13245
+ const component = instantiateRootComponent(tView, rootLView, componentDef);
13246
+ rootContext.components.push(component);
13247
+ componentView[CONTEXT] = component;
13248
+ if (hostFeatures !== null) {
13249
+ for (const feature of hostFeatures) {
13250
+ feature(component, componentDef);
13251
+ }
13252
+ }
13253
+ // We want to generate an empty QueryList for root content queries for backwards
13254
+ // compatibility with ViewEngine.
13255
+ if (componentDef.contentQueries) {
13256
+ const tNode = getCurrentTNode();
13257
+ ngDevMode && assertDefined(tNode, 'TNode expected');
13258
+ componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13259
+ }
13260
+ const rootTNode = getCurrentTNode();
13261
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13262
+ if (tView.firstCreatePass &&
13263
+ (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13264
+ setSelectedIndex(rootTNode.index);
13265
+ const rootTView = rootLView[TVIEW];
13266
+ registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13267
+ invokeHostBindingsInCreationMode(componentDef, component);
13268
+ }
13269
+ return component;
13270
+ }
13271
+ function createRootContext(scheduler, playerHandler) {
13272
+ return {
13273
+ components: [],
13274
+ scheduler: scheduler || defaultScheduler,
13275
+ clean: CLEAN_PROMISE,
13276
+ playerHandler: playerHandler || null,
13277
+ flags: 0 /* RootContextFlags.Empty */
13278
+ };
13279
+ }
13345
13280
  /**
13346
- * Used to perform change detection on the whole application.
13281
+ * Used to enable lifecycle hooks on the root component.
13347
13282
  *
13348
- * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick`
13349
- * executes lifecycle hooks and conditionally checks components based on their
13350
- * `ChangeDetectionStrategy` and dirtiness.
13283
+ * Include this feature when calling `renderComponent` if the root component
13284
+ * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
13285
+ * be called properly.
13351
13286
  *
13352
- * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally
13353
- * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a
13354
- * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can
13355
- * be changed when calling `renderComponent` and providing the `scheduler` option.
13287
+ * Example:
13288
+ *
13289
+ * ```
13290
+ * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13291
+ * ```
13356
13292
  */
13357
- function tick(component) {
13358
- const rootView = getRootView(component);
13359
- const rootContext = rootView[CONTEXT];
13360
- tickRootContext(rootContext);
13293
+ function LifecycleHooksFeature() {
13294
+ const tNode = getCurrentTNode();
13295
+ ngDevMode && assertDefined(tNode, 'TNode is required');
13296
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13297
+ }
13298
+ /**
13299
+ * Wait on component until it is rendered.
13300
+ *
13301
+ * This function returns a `Promise` which is resolved when the component's
13302
+ * change detection is executed. This is determined by finding the scheduler
13303
+ * associated with the `component`'s render tree and waiting until the scheduler
13304
+ * flushes. If nothing is scheduled, the function returns a resolved promise.
13305
+ *
13306
+ * Example:
13307
+ * ```
13308
+ * await whenRendered(myComponent);
13309
+ * ```
13310
+ *
13311
+ * @param component Component to wait upon
13312
+ * @returns Promise which resolves when the component is rendered.
13313
+ */
13314
+ function whenRendered(component) {
13315
+ return getRootContext(component).clean;
13361
13316
  }
13362
13317
 
13363
13318
  /**
@@ -13367,407 +13322,312 @@ function tick(component) {
13367
13322
  * Use of this source code is governed by an MIT-style license that can be
13368
13323
  * found in the LICENSE file at https://angular.io/license
13369
13324
  */
13325
+ function getSuperType(type) {
13326
+ return Object.getPrototypeOf(type.prototype).constructor;
13327
+ }
13370
13328
  /**
13371
- * Retrieves the component instance associated with a given DOM element.
13372
- *
13373
- * @usageNotes
13374
- * Given the following DOM structure:
13375
- *
13376
- * ```html
13377
- * <app-root>
13378
- * <div>
13379
- * <child-comp></child-comp>
13380
- * </div>
13381
- * </app-root>
13382
- * ```
13383
- *
13384
- * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
13385
- * associated with this DOM element.
13386
- *
13387
- * Calling the function on `<app-root>` will return the `MyApp` instance.
13388
- *
13389
- *
13390
- * @param element DOM element from which the component should be retrieved.
13391
- * @returns Component instance associated with the element or `null` if there
13392
- * is no component associated with it.
13329
+ * Merges the definition from a super class to a sub class.
13330
+ * @param definition The definition that is a SubClass of another directive of component
13393
13331
  *
13394
- * @publicApi
13395
- * @globalApi ng
13332
+ * @codeGenApi
13396
13333
  */
13397
- function getComponent$1(element) {
13398
- ngDevMode && assertDomElement(element);
13399
- const context = getLContext(element);
13400
- if (context === null)
13401
- return null;
13402
- if (context.component === undefined) {
13403
- const lView = context.lView;
13404
- if (lView === null) {
13405
- return null;
13334
+ function ɵɵInheritDefinitionFeature(definition) {
13335
+ let superType = getSuperType(definition.type);
13336
+ let shouldInheritFields = true;
13337
+ const inheritanceChain = [definition];
13338
+ while (superType) {
13339
+ let superDef = undefined;
13340
+ if (isComponentDef(definition)) {
13341
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13342
+ superDef = superType.ɵcmp || superType.ɵdir;
13406
13343
  }
13407
- context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
13344
+ else {
13345
+ if (superType.ɵcmp) {
13346
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
13347
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
13348
+ }
13349
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13350
+ superDef = superType.ɵdir;
13351
+ }
13352
+ if (superDef) {
13353
+ if (shouldInheritFields) {
13354
+ inheritanceChain.push(superDef);
13355
+ // Some fields in the definition may be empty, if there were no values to put in them that
13356
+ // would've justified object creation. Unwrap them if necessary.
13357
+ const writeableDef = definition;
13358
+ writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
13359
+ writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
13360
+ writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
13361
+ // Merge hostBindings
13362
+ const superHostBindings = superDef.hostBindings;
13363
+ superHostBindings && inheritHostBindings(definition, superHostBindings);
13364
+ // Merge queries
13365
+ const superViewQuery = superDef.viewQuery;
13366
+ const superContentQueries = superDef.contentQueries;
13367
+ superViewQuery && inheritViewQuery(definition, superViewQuery);
13368
+ superContentQueries && inheritContentQueries(definition, superContentQueries);
13369
+ // Merge inputs and outputs
13370
+ fillProperties(definition.inputs, superDef.inputs);
13371
+ fillProperties(definition.declaredInputs, superDef.declaredInputs);
13372
+ fillProperties(definition.outputs, superDef.outputs);
13373
+ // Merge animations metadata.
13374
+ // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
13375
+ if (isComponentDef(superDef) && superDef.data.animation) {
13376
+ // If super def is a Component, the `definition` is also a Component, since Directives can
13377
+ // not inherit Components (we throw an error above and cannot reach this code).
13378
+ const defData = definition.data;
13379
+ defData.animation = (defData.animation || []).concat(superDef.data.animation);
13380
+ }
13381
+ }
13382
+ // Run parent features
13383
+ const features = superDef.features;
13384
+ if (features) {
13385
+ for (let i = 0; i < features.length; i++) {
13386
+ const feature = features[i];
13387
+ if (feature && feature.ngInherit) {
13388
+ feature(definition);
13389
+ }
13390
+ // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
13391
+ // def already has all the necessary information inherited from its super class(es), so we
13392
+ // can stop merging fields from super classes. However we need to iterate through the
13393
+ // prototype chain to look for classes that might contain other "features" (like
13394
+ // NgOnChanges), which we should invoke for the original `definition`. We set the
13395
+ // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
13396
+ // logic and only invoking functions from the "features" list.
13397
+ if (feature === ɵɵInheritDefinitionFeature) {
13398
+ shouldInheritFields = false;
13399
+ }
13400
+ }
13401
+ }
13402
+ }
13403
+ superType = Object.getPrototypeOf(superType);
13408
13404
  }
13409
- return context.component;
13405
+ mergeHostAttrsAcrossInheritance(inheritanceChain);
13410
13406
  }
13411
13407
  /**
13412
- * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
13413
- * view that the element is part of. Otherwise retrieves the instance of the component whose view
13414
- * owns the element (in this case, the result is the same as calling `getOwningComponent`).
13415
- *
13416
- * @param element Element for which to get the surrounding component instance.
13417
- * @returns Instance of the component that is around the element or null if the element isn't
13418
- * inside any component.
13408
+ * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
13419
13409
  *
13420
- * @publicApi
13421
- * @globalApi ng
13410
+ * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
13411
+ * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
13412
+ * type.
13422
13413
  */
13423
- function getContext(element) {
13424
- assertDomElement(element);
13425
- const context = getLContext(element);
13426
- const lView = context ? context.lView : null;
13427
- return lView === null ? null : lView[CONTEXT];
13414
+ function mergeHostAttrsAcrossInheritance(inheritanceChain) {
13415
+ let hostVars = 0;
13416
+ let hostAttrs = null;
13417
+ // We process the inheritance order from the base to the leaves here.
13418
+ for (let i = inheritanceChain.length - 1; i >= 0; i--) {
13419
+ const def = inheritanceChain[i];
13420
+ // For each `hostVars`, we need to add the superclass amount.
13421
+ def.hostVars = (hostVars += def.hostVars);
13422
+ // for each `hostAttrs` we need to merge it with superclass.
13423
+ def.hostAttrs =
13424
+ mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
13425
+ }
13428
13426
  }
13429
- /**
13430
- * Retrieves the component instance whose view contains the DOM element.
13431
- *
13432
- * For example, if `<child-comp>` is used in the template of `<app-comp>`
13433
- * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
13434
- * would return `<app-comp>`.
13435
- *
13436
- * @param elementOrDir DOM element, component or directive instance
13437
- * for which to retrieve the root components.
13438
- * @returns Component instance whose view owns the DOM element or null if the element is not
13439
- * part of a component view.
13440
- *
13441
- * @publicApi
13442
- * @globalApi ng
13443
- */
13444
- function getOwningComponent(elementOrDir) {
13445
- const context = getLContext(elementOrDir);
13446
- let lView = context ? context.lView : null;
13447
- if (lView === null)
13448
- return null;
13449
- let parent;
13450
- while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
13451
- lView = parent;
13427
+ function maybeUnwrapEmpty(value) {
13428
+ if (value === EMPTY_OBJ) {
13429
+ return {};
13430
+ }
13431
+ else if (value === EMPTY_ARRAY) {
13432
+ return [];
13433
+ }
13434
+ else {
13435
+ return value;
13452
13436
  }
13453
- return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
13454
13437
  }
13455
- /**
13456
- * Retrieves all root components associated with a DOM element, directive or component instance.
13457
- * Root components are those which have been bootstrapped by Angular.
13458
- *
13459
- * @param elementOrDir DOM element, component or directive instance
13460
- * for which to retrieve the root components.
13461
- * @returns Root components associated with the target object.
13462
- *
13463
- * @publicApi
13464
- * @globalApi ng
13465
- */
13466
- function getRootComponents(elementOrDir) {
13467
- const lView = readPatchedLView(elementOrDir);
13468
- return lView !== null ? [...getRootContext(lView).components] : [];
13438
+ function inheritViewQuery(definition, superViewQuery) {
13439
+ const prevViewQuery = definition.viewQuery;
13440
+ if (prevViewQuery) {
13441
+ definition.viewQuery = (rf, ctx) => {
13442
+ superViewQuery(rf, ctx);
13443
+ prevViewQuery(rf, ctx);
13444
+ };
13445
+ }
13446
+ else {
13447
+ definition.viewQuery = superViewQuery;
13448
+ }
13449
+ }
13450
+ function inheritContentQueries(definition, superContentQueries) {
13451
+ const prevContentQueries = definition.contentQueries;
13452
+ if (prevContentQueries) {
13453
+ definition.contentQueries = (rf, ctx, directiveIndex) => {
13454
+ superContentQueries(rf, ctx, directiveIndex);
13455
+ prevContentQueries(rf, ctx, directiveIndex);
13456
+ };
13457
+ }
13458
+ else {
13459
+ definition.contentQueries = superContentQueries;
13460
+ }
13461
+ }
13462
+ function inheritHostBindings(definition, superHostBindings) {
13463
+ const prevHostBindings = definition.hostBindings;
13464
+ if (prevHostBindings) {
13465
+ definition.hostBindings = (rf, ctx) => {
13466
+ superHostBindings(rf, ctx);
13467
+ prevHostBindings(rf, ctx);
13468
+ };
13469
+ }
13470
+ else {
13471
+ definition.hostBindings = superHostBindings;
13472
+ }
13469
13473
  }
13474
+
13470
13475
  /**
13471
- * Retrieves an `Injector` associated with an element, component or directive instance.
13472
- *
13473
- * @param elementOrDir DOM element, component or directive instance for which to
13474
- * retrieve the injector.
13475
- * @returns Injector associated with the element, component or directive instance.
13476
+ * @license
13477
+ * Copyright Google LLC All Rights Reserved.
13476
13478
  *
13477
- * @publicApi
13478
- * @globalApi ng
13479
+ * Use of this source code is governed by an MIT-style license that can be
13480
+ * found in the LICENSE file at https://angular.io/license
13479
13481
  */
13480
- function getInjector(elementOrDir) {
13481
- const context = getLContext(elementOrDir);
13482
- const lView = context ? context.lView : null;
13483
- if (lView === null)
13484
- return Injector.NULL;
13485
- const tNode = lView[TVIEW].data[context.nodeIndex];
13486
- return new NodeInjector(tNode, lView);
13487
- }
13488
13482
  /**
13489
- * Retrieve a set of injection tokens at a given DOM node.
13490
- *
13491
- * @param element Element for which the injection tokens should be retrieved.
13483
+ * Fields which exist on either directive or component definitions, and need to be copied from
13484
+ * parent to child classes by the `ɵɵCopyDefinitionFeature`.
13492
13485
  */
13493
- function getInjectionTokens(element) {
13494
- const context = getLContext(element);
13495
- const lView = context ? context.lView : null;
13496
- if (lView === null)
13497
- return [];
13498
- const tView = lView[TVIEW];
13499
- const tNode = tView.data[context.nodeIndex];
13500
- const providerTokens = [];
13501
- const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
13502
- const endIndex = tNode.directiveEnd;
13503
- for (let i = startIndex; i < endIndex; i++) {
13504
- let value = tView.data[i];
13505
- if (isDirectiveDefHack(value)) {
13506
- // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
13507
- // design flaw. We should always store same type so that we can be monomorphic. The issue
13508
- // is that for Components/Directives we store the def instead the type. The correct behavior
13509
- // is that we should always be storing injectable type in this location.
13510
- value = value.type;
13511
- }
13512
- providerTokens.push(value);
13513
- }
13514
- return providerTokens;
13515
- }
13486
+ const COPY_DIRECTIVE_FIELDS = [
13487
+ // The child class should use the providers of its parent.
13488
+ 'providersResolver',
13489
+ // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
13490
+ // as inputs, outputs, and host binding functions.
13491
+ ];
13516
13492
  /**
13517
- * Retrieves directive instances associated with a given DOM node. Does not include
13518
- * component instances.
13519
- *
13520
- * @usageNotes
13521
- * Given the following DOM structure:
13493
+ * Fields which exist only on component definitions, and need to be copied from parent to child
13494
+ * classes by the `ɵɵCopyDefinitionFeature`.
13522
13495
  *
13523
- * ```html
13524
- * <app-root>
13525
- * <button my-button></button>
13526
- * <my-comp></my-comp>
13527
- * </app-root>
13528
- * ```
13496
+ * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
13497
+ * since those should go in `COPY_DIRECTIVE_FIELDS` above.
13498
+ */
13499
+ const COPY_COMPONENT_FIELDS = [
13500
+ // The child class should use the template function of its parent, including all template
13501
+ // semantics.
13502
+ 'template',
13503
+ 'decls',
13504
+ 'consts',
13505
+ 'vars',
13506
+ 'onPush',
13507
+ 'ngContentSelectors',
13508
+ // The child class should use the CSS styles of its parent, including all styling semantics.
13509
+ 'styles',
13510
+ 'encapsulation',
13511
+ // The child class should be checked by the runtime in the same way as its parent.
13512
+ 'schemas',
13513
+ ];
13514
+ /**
13515
+ * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
13516
+ * definition.
13529
13517
  *
13530
- * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
13531
- * directive that is associated with the DOM node.
13518
+ * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
13519
+ * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
13520
+ * generates a skeleton definition on the child class, and applies this feature.
13532
13521
  *
13533
- * Calling `getDirectives` on `<my-comp>` will return an empty array.
13522
+ * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
13523
+ * including things like the component template function.
13534
13524
  *
13535
- * @param node DOM node for which to get the directives.
13536
- * @returns Array of directives associated with the node.
13525
+ * @param definition The definition of a child class which inherits from a parent class with its
13526
+ * own definition.
13537
13527
  *
13538
- * @publicApi
13539
- * @globalApi ng
13528
+ * @codeGenApi
13540
13529
  */
13541
- function getDirectives(node) {
13542
- // Skip text nodes because we can't have directives associated with them.
13543
- if (node instanceof Text) {
13544
- return [];
13530
+ function ɵɵCopyDefinitionFeature(definition) {
13531
+ let superType = getSuperType(definition.type);
13532
+ let superDef = undefined;
13533
+ if (isComponentDef(definition)) {
13534
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13535
+ superDef = superType.ɵcmp;
13545
13536
  }
13546
- const context = getLContext(node);
13547
- const lView = context ? context.lView : null;
13548
- if (lView === null) {
13549
- return [];
13537
+ else {
13538
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13539
+ superDef = superType.ɵdir;
13550
13540
  }
13551
- const tView = lView[TVIEW];
13552
- const nodeIndex = context.nodeIndex;
13553
- if (!tView?.data[nodeIndex]) {
13554
- return [];
13541
+ // Needed because `definition` fields are readonly.
13542
+ const defAny = definition;
13543
+ // Copy over any fields that apply to either directives or components.
13544
+ for (const field of COPY_DIRECTIVE_FIELDS) {
13545
+ defAny[field] = superDef[field];
13555
13546
  }
13556
- if (context.directives === undefined) {
13557
- context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
13547
+ if (isComponentDef(superDef)) {
13548
+ // Copy over any component-specific fields.
13549
+ for (const field of COPY_COMPONENT_FIELDS) {
13550
+ defAny[field] = superDef[field];
13551
+ }
13558
13552
  }
13559
- // The `directives` in this case are a named array called `LComponentView`. Clone the
13560
- // result so we don't expose an internal data structure in the user's console.
13561
- return context.directives === null ? [] : [...context.directives];
13562
13553
  }
13554
+
13563
13555
  /**
13564
- * Returns the debug (partial) metadata for a particular directive or component instance.
13565
- * The function accepts an instance of a directive or component and returns the corresponding
13566
- * metadata.
13567
- *
13568
- * @param directiveOrComponentInstance Instance of a directive or component
13569
- * @returns metadata of the passed directive or component
13556
+ * @license
13557
+ * Copyright Google LLC All Rights Reserved.
13570
13558
  *
13571
- * @publicApi
13572
- * @globalApi ng
13559
+ * Use of this source code is governed by an MIT-style license that can be
13560
+ * found in the LICENSE file at https://angular.io/license
13573
13561
  */
13574
- function getDirectiveMetadata$1(directiveOrComponentInstance) {
13575
- const { constructor } = directiveOrComponentInstance;
13576
- if (!constructor) {
13577
- throw new Error('Unable to find the instance constructor');
13578
- }
13579
- // In case a component inherits from a directive, we may have component and directive metadata
13580
- // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
13581
- const componentDef = getComponentDef(constructor);
13582
- if (componentDef) {
13583
- return {
13584
- inputs: componentDef.inputs,
13585
- outputs: componentDef.outputs,
13586
- encapsulation: componentDef.encapsulation,
13587
- changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
13588
- ChangeDetectionStrategy.Default
13589
- };
13590
- }
13591
- const directiveDef = getDirectiveDef(constructor);
13592
- if (directiveDef) {
13593
- return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
13562
+ let _symbolIterator = null;
13563
+ function getSymbolIterator() {
13564
+ if (!_symbolIterator) {
13565
+ const Symbol = _global['Symbol'];
13566
+ if (Symbol && Symbol.iterator) {
13567
+ _symbolIterator = Symbol.iterator;
13568
+ }
13569
+ else {
13570
+ // es6-shim specific logic
13571
+ const keys = Object.getOwnPropertyNames(Map.prototype);
13572
+ for (let i = 0; i < keys.length; ++i) {
13573
+ const key = keys[i];
13574
+ if (key !== 'entries' && key !== 'size' &&
13575
+ Map.prototype[key] === Map.prototype['entries']) {
13576
+ _symbolIterator = key;
13577
+ }
13578
+ }
13579
+ }
13594
13580
  }
13595
- return null;
13581
+ return _symbolIterator;
13596
13582
  }
13583
+
13597
13584
  /**
13598
- * Retrieve map of local references.
13599
- *
13600
- * The references are retrieved as a map of local reference name to element or directive instance.
13585
+ * @license
13586
+ * Copyright Google LLC All Rights Reserved.
13601
13587
  *
13602
- * @param target DOM element, component or directive instance for which to retrieve
13603
- * the local references.
13588
+ * Use of this source code is governed by an MIT-style license that can be
13589
+ * found in the LICENSE file at https://angular.io/license
13604
13590
  */
13605
- function getLocalRefs(target) {
13606
- const context = getLContext(target);
13607
- if (context === null)
13608
- return {};
13609
- if (context.localRefs === undefined) {
13610
- const lView = context.lView;
13611
- if (lView === null) {
13612
- return {};
13613
- }
13614
- context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
13615
- }
13616
- return context.localRefs || {};
13617
- }
13618
- /**
13619
- * Retrieves the host element of a component or directive instance.
13620
- * The host element is the DOM element that matched the selector of the directive.
13621
- *
13622
- * @param componentOrDirective Component or directive instance for which the host
13623
- * element should be retrieved.
13624
- * @returns Host element of the target.
13625
- *
13626
- * @publicApi
13627
- * @globalApi ng
13628
- */
13629
- function getHostElement(componentOrDirective) {
13630
- return getLContext(componentOrDirective).native;
13591
+ function isIterable(obj) {
13592
+ return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
13631
13593
  }
13632
- /**
13633
- * Retrieves the rendered text for a given component.
13634
- *
13635
- * This function retrieves the host element of a component and
13636
- * and then returns the `textContent` for that element. This implies
13637
- * that the text returned will include re-projected content of
13638
- * the component as well.
13639
- *
13640
- * @param component The component to return the content text for.
13641
- */
13642
- function getRenderedText(component) {
13643
- const hostElement = getHostElement(component);
13644
- return hostElement.textContent || '';
13594
+ function isListLikeIterable(obj) {
13595
+ if (!isJsObject(obj))
13596
+ return false;
13597
+ return Array.isArray(obj) ||
13598
+ (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
13599
+ getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
13645
13600
  }
13646
- /**
13647
- * Retrieves a list of event listeners associated with a DOM element. The list does include host
13648
- * listeners, but it does not include event listeners defined outside of the Angular context
13649
- * (e.g. through `addEventListener`).
13650
- *
13651
- * @usageNotes
13652
- * Given the following DOM structure:
13653
- *
13654
- * ```html
13655
- * <app-root>
13656
- * <div (click)="doSomething()"></div>
13657
- * </app-root>
13658
- * ```
13659
- *
13660
- * Calling `getListeners` on `<div>` will return an object that looks as follows:
13661
- *
13662
- * ```ts
13663
- * {
13664
- * name: 'click',
13665
- * element: <div>,
13666
- * callback: () => doSomething(),
13667
- * useCapture: false
13668
- * }
13669
- * ```
13670
- *
13671
- * @param element Element for which the DOM listeners should be retrieved.
13672
- * @returns Array of event listeners on the DOM element.
13673
- *
13674
- * @publicApi
13675
- * @globalApi ng
13676
- */
13677
- function getListeners(element) {
13678
- ngDevMode && assertDomElement(element);
13679
- const lContext = getLContext(element);
13680
- const lView = lContext === null ? null : lContext.lView;
13681
- if (lView === null)
13682
- return [];
13683
- const tView = lView[TVIEW];
13684
- const lCleanup = lView[CLEANUP];
13685
- const tCleanup = tView.cleanup;
13686
- const listeners = [];
13687
- if (tCleanup && lCleanup) {
13688
- for (let i = 0; i < tCleanup.length;) {
13689
- const firstParam = tCleanup[i++];
13690
- const secondParam = tCleanup[i++];
13691
- if (typeof firstParam === 'string') {
13692
- const name = firstParam;
13693
- const listenerElement = unwrapRNode(lView[secondParam]);
13694
- const callback = lCleanup[tCleanup[i++]];
13695
- const useCaptureOrIndx = tCleanup[i++];
13696
- // if useCaptureOrIndx is boolean then report it as is.
13697
- // if useCaptureOrIndx is positive number then it in unsubscribe method
13698
- // if useCaptureOrIndx is negative number then it is a Subscription
13699
- const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
13700
- const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
13701
- if (element == listenerElement) {
13702
- listeners.push({ element, name, callback, useCapture, type });
13703
- }
13704
- }
13705
- }
13601
+ function areIterablesEqual(a, b, comparator) {
13602
+ const iterator1 = a[getSymbolIterator()]();
13603
+ const iterator2 = b[getSymbolIterator()]();
13604
+ while (true) {
13605
+ const item1 = iterator1.next();
13606
+ const item2 = iterator2.next();
13607
+ if (item1.done && item2.done)
13608
+ return true;
13609
+ if (item1.done || item2.done)
13610
+ return false;
13611
+ if (!comparator(item1.value, item2.value))
13612
+ return false;
13706
13613
  }
13707
- listeners.sort(sortListeners);
13708
- return listeners;
13709
- }
13710
- function sortListeners(a, b) {
13711
- if (a.name == b.name)
13712
- return 0;
13713
- return a.name < b.name ? -1 : 1;
13714
- }
13715
- /**
13716
- * This function should not exist because it is megamorphic and only mostly correct.
13717
- *
13718
- * See call site for more info.
13719
- */
13720
- function isDirectiveDefHack(obj) {
13721
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
13722
13614
  }
13723
- /**
13724
- * Returns the attached `DebugNode` instance for an element in the DOM.
13725
- *
13726
- * @param element DOM element which is owned by an existing component's view.
13727
- */
13728
- function getDebugNode$1(element) {
13729
- if (ngDevMode && !(element instanceof Node)) {
13730
- throw new Error('Expecting instance of DOM Element');
13731
- }
13732
- const lContext = getLContext(element);
13733
- const lView = lContext ? lContext.lView : null;
13734
- if (lView === null) {
13735
- return null;
13615
+ function iterateListLike(obj, fn) {
13616
+ if (Array.isArray(obj)) {
13617
+ for (let i = 0; i < obj.length; i++) {
13618
+ fn(obj[i]);
13619
+ }
13736
13620
  }
13737
- const nodeIndex = lContext.nodeIndex;
13738
- if (nodeIndex !== -1) {
13739
- const valueInLView = lView[nodeIndex];
13740
- // this means that value in the lView is a component with its own
13741
- // data. In this situation the TNode is not accessed at the same spot.
13742
- const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
13743
- ngDevMode &&
13744
- assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
13745
- return buildDebugNode(tNode, lView);
13621
+ else {
13622
+ const iterator = obj[getSymbolIterator()]();
13623
+ let item;
13624
+ while (!((item = iterator.next()).done)) {
13625
+ fn(item.value);
13626
+ }
13746
13627
  }
13747
- return null;
13748
- }
13749
- /**
13750
- * Retrieve the component `LView` from component/element.
13751
- *
13752
- * NOTE: `LView` is a private and should not be leaked outside.
13753
- * Don't export this method to `ng.*` on window.
13754
- *
13755
- * @param target DOM element or component instance for which to retrieve the LView.
13756
- */
13757
- function getComponentLView(target) {
13758
- const lContext = getLContext(target);
13759
- const nodeIndx = lContext.nodeIndex;
13760
- const lView = lContext.lView;
13761
- ngDevMode && assertLView(lView);
13762
- const componentLView = lView[nodeIndx];
13763
- ngDevMode && assertLView(componentLView);
13764
- return componentLView;
13765
13628
  }
13766
- /** Asserts that a value is a DOM Element. */
13767
- function assertDomElement(value) {
13768
- if (typeof Element !== 'undefined' && !(value instanceof Element)) {
13769
- throw new Error('Expecting instance of DOM Element');
13770
- }
13629
+ function isJsObject(o) {
13630
+ return o !== null && (typeof o === 'function' || typeof o === 'object');
13771
13631
  }
13772
13632
 
13773
13633
  /**
@@ -13777,18 +13637,22 @@ function assertDomElement(value) {
13777
13637
  * Use of this source code is governed by an MIT-style license that can be
13778
13638
  * found in the LICENSE file at https://angular.io/license
13779
13639
  */
13780
- /**
13781
- * Marks a component for check (in case of OnPush components) and synchronously
13782
- * performs change detection on the application this component belongs to.
13783
- *
13784
- * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
13785
- *
13786
- * @publicApi
13787
- * @globalApi ng
13788
- */
13789
- function applyChanges(component) {
13790
- markDirty(component);
13791
- getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
13640
+ function devModeEqual(a, b) {
13641
+ const isListLikeIterableA = isListLikeIterable(a);
13642
+ const isListLikeIterableB = isListLikeIterable(b);
13643
+ if (isListLikeIterableA && isListLikeIterableB) {
13644
+ return areIterablesEqual(a, b, devModeEqual);
13645
+ }
13646
+ else {
13647
+ const isAObject = a && (typeof a === 'object' || typeof a === 'function');
13648
+ const isBObject = b && (typeof b === 'object' || typeof b === 'function');
13649
+ if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
13650
+ return true;
13651
+ }
13652
+ else {
13653
+ return Object.is(a, b);
13654
+ }
13655
+ }
13792
13656
  }
13793
13657
 
13794
13658
  /**
@@ -13798,70 +13662,73 @@ function applyChanges(component) {
13798
13662
  * Use of this source code is governed by an MIT-style license that can be
13799
13663
  * found in the LICENSE file at https://angular.io/license
13800
13664
  */
13665
+ // TODO(misko): consider inlining
13666
+ /** Updates binding and returns the value. */
13667
+ function updateBinding(lView, bindingIndex, value) {
13668
+ return lView[bindingIndex] = value;
13669
+ }
13670
+ /** Gets the current binding value. */
13671
+ function getBinding(lView, bindingIndex) {
13672
+ ngDevMode && assertIndexInRange(lView, bindingIndex);
13673
+ ngDevMode &&
13674
+ assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
13675
+ return lView[bindingIndex];
13676
+ }
13801
13677
  /**
13802
- * This file introduces series of globally accessible debug tools
13803
- * to allow for the Angular debugging story to function.
13804
- *
13805
- * To see this in action run the following command:
13806
- *
13807
- * bazel run //packages/core/test/bundling/todo:devserver
13678
+ * Updates binding if changed, then returns whether it was updated.
13808
13679
  *
13809
- * Then load `localhost:5432` and start using the console tools.
13810
- */
13811
- /**
13812
- * This value reflects the property on the window where the dev
13813
- * tools are patched (window.ng).
13814
- * */
13815
- const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
13816
- let _published = false;
13817
- /**
13818
- * Publishes a collection of default debug tools onto`window.ng`.
13680
+ * This function also checks the `CheckNoChangesMode` and throws if changes are made.
13681
+ * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
13682
+ * behavior.
13819
13683
  *
13820
- * These functions are available globally when Angular is in development
13821
- * mode and are automatically stripped away from prod mode is on.
13684
+ * @param lView current `LView`
13685
+ * @param bindingIndex The binding in the `LView` to check
13686
+ * @param value New value to check against `lView[bindingIndex]`
13687
+ * @returns `true` if the bindings has changed. (Throws if binding has changed during
13688
+ * `CheckNoChangesMode`)
13822
13689
  */
13823
- function publishDefaultGlobalUtils$1() {
13824
- if (!_published) {
13825
- _published = true;
13826
- /**
13827
- * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
13828
- * The contract of the function might be changed in any release and/or the function can be
13829
- * removed completely.
13830
- */
13831
- publishGlobalUtil('ɵsetProfiler', setProfiler);
13832
- publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
13833
- publishGlobalUtil('getComponent', getComponent$1);
13834
- publishGlobalUtil('getContext', getContext);
13835
- publishGlobalUtil('getListeners', getListeners);
13836
- publishGlobalUtil('getOwningComponent', getOwningComponent);
13837
- publishGlobalUtil('getHostElement', getHostElement);
13838
- publishGlobalUtil('getInjector', getInjector);
13839
- publishGlobalUtil('getRootComponents', getRootComponents);
13840
- publishGlobalUtil('getDirectives', getDirectives);
13841
- publishGlobalUtil('applyChanges', applyChanges);
13690
+ function bindingUpdated(lView, bindingIndex, value) {
13691
+ ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
13692
+ ngDevMode &&
13693
+ assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
13694
+ const oldValue = lView[bindingIndex];
13695
+ if (Object.is(oldValue, value)) {
13696
+ return false;
13842
13697
  }
13843
- }
13844
- /**
13845
- * Publishes the given function to `window.ng` so that it can be
13846
- * used from the browser console when an application is not in production.
13847
- */
13848
- function publishGlobalUtil(name, fn) {
13849
- if (typeof COMPILED === 'undefined' || !COMPILED) {
13850
- // Note: we can't export `ng` when using closure enhanced optimization as:
13851
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
13852
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
13853
- // for typings for AngularJS (via `goog.provide('ng....')`).
13854
- const w = _global;
13855
- ngDevMode && assertDefined(fn, 'function not defined');
13856
- if (w) {
13857
- let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
13858
- if (!container) {
13859
- container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
13698
+ else {
13699
+ if (ngDevMode && isInCheckNoChangesMode()) {
13700
+ // View engine didn't report undefined values as changed on the first checkNoChanges pass
13701
+ // (before the change detection was run).
13702
+ const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
13703
+ if (!devModeEqual(oldValueToCompare, value)) {
13704
+ const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
13705
+ throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
13860
13706
  }
13861
- container[name] = fn;
13707
+ // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
13708
+ // For this reason we exit as if no change. The early exit is needed to prevent the changed
13709
+ // value to be written into `LView` (If we would write the new value that we would not see it
13710
+ // as change on next CD.)
13711
+ return false;
13862
13712
  }
13713
+ lView[bindingIndex] = value;
13714
+ return true;
13863
13715
  }
13864
13716
  }
13717
+ /** Updates 2 bindings if changed, then returns whether either was updated. */
13718
+ function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
13719
+ const different = bindingUpdated(lView, bindingIndex, exp1);
13720
+ return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
13721
+ }
13722
+ /** Updates 3 bindings if changed, then returns whether any was updated. */
13723
+ function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
13724
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13725
+ return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
13726
+ }
13727
+ /** Updates 4 bindings if changed, then returns whether any was updated. */
13728
+ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
13729
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13730
+ return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
13731
+ }
13865
13732
 
13866
13733
  /**
13867
13734
  * @license
@@ -13870,981 +13737,377 @@ function publishGlobalUtil(name, fn) {
13870
13737
  * Use of this source code is governed by an MIT-style license that can be
13871
13738
  * found in the LICENSE file at https://angular.io/license
13872
13739
  */
13873
- // TODO: A hack to not pull in the NullInjector from @angular/core.
13874
- const NULL_INJECTOR = {
13875
- get: (token, notFoundValue) => {
13876
- throwProviderNotFoundError(token, 'NullInjector');
13877
- }
13878
- };
13879
13740
  /**
13880
- * Bootstraps a Component into an existing host element and returns an instance
13881
- * of the component.
13741
+ * Updates the value of or removes a bound attribute on an Element.
13742
+ *
13743
+ * Used in the case of `[attr.title]="value"`
13882
13744
  *
13883
- * Use this function to bootstrap a component into the DOM tree. Each invocation
13884
- * of this function will create a separate tree of components, injectors and
13885
- * change detection cycles and lifetimes. To dynamically insert a new component
13886
- * into an existing tree such that it shares the same injection, change detection
13887
- * and object lifetime, use {@link ViewContainer#createComponent}.
13745
+ * @param name name The name of the attribute.
13746
+ * @param value value The attribute is removed when value is `null` or `undefined`.
13747
+ * Otherwise the attribute value is set to the stringified value.
13748
+ * @param sanitizer An optional function used to sanitize the value.
13749
+ * @param namespace Optional namespace to use when setting the attribute.
13888
13750
  *
13889
- * @param componentType Component to bootstrap
13890
- * @param options Optional parameters which control bootstrapping
13751
+ * @codeGenApi
13891
13752
  */
13892
- function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13893
- ngDevMode && publishDefaultGlobalUtils$1();
13894
- ngDevMode && assertComponentType(componentType);
13895
- enableRenderer3();
13896
- const rendererFactory = opts.rendererFactory || domRendererFactory3;
13897
- const sanitizer = opts.sanitizer || null;
13898
- const componentDef = getComponentDef(componentType);
13899
- if (componentDef.type != componentType)
13900
- componentDef.type = componentType;
13901
- // The first index of the first selector is the tag name.
13902
- const componentTag = componentDef.selectors[0][0];
13903
- const hostRenderer = rendererFactory.createRenderer(null, null);
13904
- const hostRNode = locateHostElement(hostRenderer, opts.host || componentTag, componentDef.encapsulation);
13905
- const rootFlags = componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
13906
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13907
- const rootContext = createRootContext(opts.scheduler, opts.playerHandler);
13908
- const renderer = rendererFactory.createRenderer(hostRNode, componentDef);
13909
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
13910
- const rootView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, null, opts.injector || null, null);
13911
- enterView(rootView);
13912
- let component;
13913
- try {
13914
- if (rendererFactory.begin)
13915
- rendererFactory.begin();
13916
- const componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer);
13917
- component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
13918
- // create mode pass
13919
- renderView(rootTView, rootView, null);
13920
- // update mode pass
13921
- refreshView(rootTView, rootView, null, null);
13922
- }
13923
- finally {
13924
- leaveView();
13925
- if (rendererFactory.end)
13926
- rendererFactory.end();
13753
+ function ɵɵattribute(name, value, sanitizer, namespace) {
13754
+ const lView = getLView();
13755
+ const bindingIndex = nextBindingIndex();
13756
+ if (bindingUpdated(lView, bindingIndex, value)) {
13757
+ const tView = getTView();
13758
+ const tNode = getSelectedTNode();
13759
+ elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
13760
+ ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
13927
13761
  }
13928
- return component;
13762
+ return ɵɵattribute;
13929
13763
  }
13764
+
13930
13765
  /**
13931
- * Creates the root component view and the root component node.
13932
- *
13933
- * @param rNode Render host element.
13934
- * @param def ComponentDef
13935
- * @param rootView The parent view where the host node is stored
13936
- * @param rendererFactory Factory to be used for creating child renderers.
13937
- * @param hostRenderer The current renderer
13938
- * @param sanitizer The sanitizer, if provided
13766
+ * @license
13767
+ * Copyright Google LLC All Rights Reserved.
13939
13768
  *
13940
- * @returns Component view created
13769
+ * Use of this source code is governed by an MIT-style license that can be
13770
+ * found in the LICENSE file at https://angular.io/license
13941
13771
  */
13942
- function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13943
- const tView = rootView[TVIEW];
13944
- const index = HEADER_OFFSET;
13945
- ngDevMode && assertIndexInRange(rootView, index);
13946
- rootView[index] = rNode;
13947
- // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13948
- // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13949
- // representing a host element.
13950
- const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13951
- const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13952
- if (mergedAttrs !== null) {
13953
- computeStaticStyling(tNode, mergedAttrs, true);
13954
- if (rNode !== null) {
13955
- setUpAttributes(hostRenderer, rNode, mergedAttrs);
13956
- if (tNode.classes !== null) {
13957
- writeDirectClass(hostRenderer, rNode, tNode.classes);
13958
- }
13959
- if (tNode.styles !== null) {
13960
- writeDirectStyle(hostRenderer, rNode, tNode.styles);
13961
- }
13962
- }
13963
- }
13964
- const viewRenderer = rendererFactory.createRenderer(rNode, def);
13965
- const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13966
- if (tView.firstCreatePass) {
13967
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13968
- markAsComponentHost(tView, tNode);
13969
- initTNodeFlags(tNode, rootView.length, 1);
13970
- }
13971
- addToViewTree(rootView, componentView);
13972
- // Store component view at node index, with node as the HOST
13973
- return rootView[index] = componentView;
13974
- }
13975
13772
  /**
13976
- * Creates a root component and sets it up with features and host bindings. Shared by
13977
- * renderComponent() and ViewContainerRef.createComponent().
13773
+ * Create interpolation bindings with a variable number of expressions.
13774
+ *
13775
+ * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
13776
+ * Those are faster because there is no need to create an array of expressions and iterate over it.
13777
+ *
13778
+ * `values`:
13779
+ * - has static text at even indexes,
13780
+ * - has evaluated expressions at odd indexes.
13781
+ *
13782
+ * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
13978
13783
  */
13979
- function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13980
- const tView = rootLView[TVIEW];
13981
- // Create directive instance with factory() and store at next index in viewData
13982
- const component = instantiateRootComponent(tView, rootLView, componentDef);
13983
- rootContext.components.push(component);
13984
- componentView[CONTEXT] = component;
13985
- if (hostFeatures !== null) {
13986
- for (const feature of hostFeatures) {
13987
- feature(component, componentDef);
13988
- }
13784
+ function interpolationV(lView, values) {
13785
+ ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
13786
+ ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
13787
+ let isBindingUpdated = false;
13788
+ let bindingIndex = getBindingIndex();
13789
+ for (let i = 1; i < values.length; i += 2) {
13790
+ // Check if bindings (odd indexes) have changed
13791
+ isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
13989
13792
  }
13990
- // We want to generate an empty QueryList for root content queries for backwards
13991
- // compatibility with ViewEngine.
13992
- if (componentDef.contentQueries) {
13993
- const tNode = getCurrentTNode();
13994
- ngDevMode && assertDefined(tNode, 'TNode expected');
13995
- componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13793
+ setBindingIndex(bindingIndex);
13794
+ if (!isBindingUpdated) {
13795
+ return NO_CHANGE;
13996
13796
  }
13997
- const rootTNode = getCurrentTNode();
13998
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13999
- if (tView.firstCreatePass &&
14000
- (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
14001
- setSelectedIndex(rootTNode.index);
14002
- const rootTView = rootLView[TVIEW];
14003
- registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
14004
- invokeHostBindingsInCreationMode(componentDef, component);
13797
+ // Build the updated content
13798
+ let content = values[0];
13799
+ for (let i = 1; i < values.length; i += 2) {
13800
+ content += renderStringify(values[i]) + values[i + 1];
14005
13801
  }
14006
- return component;
14007
- }
14008
- function createRootContext(scheduler, playerHandler) {
14009
- return {
14010
- components: [],
14011
- scheduler: scheduler || defaultScheduler,
14012
- clean: CLEAN_PROMISE,
14013
- playerHandler: playerHandler || null,
14014
- flags: 0 /* RootContextFlags.Empty */
14015
- };
13802
+ return content;
14016
13803
  }
14017
13804
  /**
14018
- * Used to enable lifecycle hooks on the root component.
14019
- *
14020
- * Include this feature when calling `renderComponent` if the root component
14021
- * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
14022
- * be called properly.
14023
- *
14024
- * Example:
13805
+ * Creates an interpolation binding with 1 expression.
14025
13806
  *
14026
- * ```
14027
- * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
14028
- * ```
13807
+ * @param prefix static value used for concatenation only.
13808
+ * @param v0 value checked for change.
13809
+ * @param suffix static value used for concatenation only.
14029
13810
  */
14030
- function LifecycleHooksFeature() {
14031
- const tNode = getCurrentTNode();
14032
- ngDevMode && assertDefined(tNode, 'TNode is required');
14033
- registerPostOrderHooks(getLView()[TVIEW], tNode);
13811
+ function interpolation1(lView, prefix, v0, suffix) {
13812
+ const different = bindingUpdated(lView, nextBindingIndex(), v0);
13813
+ return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
14034
13814
  }
14035
13815
  /**
14036
- * Wait on component until it is rendered.
14037
- *
14038
- * This function returns a `Promise` which is resolved when the component's
14039
- * change detection is executed. This is determined by finding the scheduler
14040
- * associated with the `component`'s render tree and waiting until the scheduler
14041
- * flushes. If nothing is scheduled, the function returns a resolved promise.
14042
- *
14043
- * Example:
14044
- * ```
14045
- * await whenRendered(myComponent);
14046
- * ```
14047
- *
14048
- * @param component Component to wait upon
14049
- * @returns Promise which resolves when the component is rendered.
13816
+ * Creates an interpolation binding with 2 expressions.
14050
13817
  */
14051
- function whenRendered(component) {
14052
- return getRootContext(component).clean;
13818
+ function interpolation2(lView, prefix, v0, i0, v1, suffix) {
13819
+ const bindingIndex = getBindingIndex();
13820
+ const different = bindingUpdated2(lView, bindingIndex, v0, v1);
13821
+ incrementBindingIndex(2);
13822
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14053
13823
  }
14054
-
14055
13824
  /**
14056
- * @license
14057
- * Copyright Google LLC All Rights Reserved.
14058
- *
14059
- * Use of this source code is governed by an MIT-style license that can be
14060
- * found in the LICENSE file at https://angular.io/license
13825
+ * Creates an interpolation binding with 3 expressions.
14061
13826
  */
14062
- function getSuperType(type) {
14063
- return Object.getPrototypeOf(type.prototype).constructor;
13827
+ function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
13828
+ const bindingIndex = getBindingIndex();
13829
+ const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
13830
+ incrementBindingIndex(3);
13831
+ return different ?
13832
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
13833
+ NO_CHANGE;
14064
13834
  }
14065
13835
  /**
14066
- * Merges the definition from a super class to a sub class.
14067
- * @param definition The definition that is a SubClass of another directive of component
14068
- *
14069
- * @codeGenApi
13836
+ * Create an interpolation binding with 4 expressions.
14070
13837
  */
14071
- function ɵɵInheritDefinitionFeature(definition) {
14072
- let superType = getSuperType(definition.type);
14073
- let shouldInheritFields = true;
14074
- const inheritanceChain = [definition];
14075
- while (superType) {
14076
- let superDef = undefined;
14077
- if (isComponentDef(definition)) {
14078
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14079
- superDef = superType.ɵcmp || superType.ɵdir;
14080
- }
14081
- else {
14082
- if (superType.ɵcmp) {
14083
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14084
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14085
- }
14086
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14087
- superDef = superType.ɵdir;
14088
- }
14089
- if (superDef) {
14090
- if (shouldInheritFields) {
14091
- inheritanceChain.push(superDef);
14092
- // Some fields in the definition may be empty, if there were no values to put in them that
14093
- // would've justified object creation. Unwrap them if necessary.
14094
- const writeableDef = definition;
14095
- writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
14096
- writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
14097
- writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
14098
- // Merge hostBindings
14099
- const superHostBindings = superDef.hostBindings;
14100
- superHostBindings && inheritHostBindings(definition, superHostBindings);
14101
- // Merge queries
14102
- const superViewQuery = superDef.viewQuery;
14103
- const superContentQueries = superDef.contentQueries;
14104
- superViewQuery && inheritViewQuery(definition, superViewQuery);
14105
- superContentQueries && inheritContentQueries(definition, superContentQueries);
14106
- // Merge inputs and outputs
14107
- fillProperties(definition.inputs, superDef.inputs);
14108
- fillProperties(definition.declaredInputs, superDef.declaredInputs);
14109
- fillProperties(definition.outputs, superDef.outputs);
14110
- // Merge animations metadata.
14111
- // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
14112
- if (isComponentDef(superDef) && superDef.data.animation) {
14113
- // If super def is a Component, the `definition` is also a Component, since Directives can
14114
- // not inherit Components (we throw an error above and cannot reach this code).
14115
- const defData = definition.data;
14116
- defData.animation = (defData.animation || []).concat(superDef.data.animation);
14117
- }
14118
- }
14119
- // Run parent features
14120
- const features = superDef.features;
14121
- if (features) {
14122
- for (let i = 0; i < features.length; i++) {
14123
- const feature = features[i];
14124
- if (feature && feature.ngInherit) {
14125
- feature(definition);
14126
- }
14127
- // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
14128
- // def already has all the necessary information inherited from its super class(es), so we
14129
- // can stop merging fields from super classes. However we need to iterate through the
14130
- // prototype chain to look for classes that might contain other "features" (like
14131
- // NgOnChanges), which we should invoke for the original `definition`. We set the
14132
- // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
14133
- // logic and only invoking functions from the "features" list.
14134
- if (feature === ɵɵInheritDefinitionFeature) {
14135
- shouldInheritFields = false;
14136
- }
14137
- }
14138
- }
14139
- }
14140
- superType = Object.getPrototypeOf(superType);
14141
- }
14142
- mergeHostAttrsAcrossInheritance(inheritanceChain);
13838
+ function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
13839
+ const bindingIndex = getBindingIndex();
13840
+ const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13841
+ incrementBindingIndex(4);
13842
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13843
+ renderStringify(v2) + i2 + renderStringify(v3) + suffix :
13844
+ NO_CHANGE;
14143
13845
  }
14144
13846
  /**
14145
- * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
14146
- *
14147
- * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
14148
- * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
14149
- * type.
13847
+ * Creates an interpolation binding with 5 expressions.
14150
13848
  */
14151
- function mergeHostAttrsAcrossInheritance(inheritanceChain) {
14152
- let hostVars = 0;
14153
- let hostAttrs = null;
14154
- // We process the inheritance order from the base to the leaves here.
14155
- for (let i = inheritanceChain.length - 1; i >= 0; i--) {
14156
- const def = inheritanceChain[i];
14157
- // For each `hostVars`, we need to add the superclass amount.
14158
- def.hostVars = (hostVars += def.hostVars);
14159
- // for each `hostAttrs` we need to merge it with superclass.
14160
- def.hostAttrs =
14161
- mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
14162
- }
14163
- }
14164
- function maybeUnwrapEmpty(value) {
14165
- if (value === EMPTY_OBJ) {
14166
- return {};
14167
- }
14168
- else if (value === EMPTY_ARRAY) {
14169
- return [];
14170
- }
14171
- else {
14172
- return value;
14173
- }
14174
- }
14175
- function inheritViewQuery(definition, superViewQuery) {
14176
- const prevViewQuery = definition.viewQuery;
14177
- if (prevViewQuery) {
14178
- definition.viewQuery = (rf, ctx) => {
14179
- superViewQuery(rf, ctx);
14180
- prevViewQuery(rf, ctx);
14181
- };
14182
- }
14183
- else {
14184
- definition.viewQuery = superViewQuery;
14185
- }
14186
- }
14187
- function inheritContentQueries(definition, superContentQueries) {
14188
- const prevContentQueries = definition.contentQueries;
14189
- if (prevContentQueries) {
14190
- definition.contentQueries = (rf, ctx, directiveIndex) => {
14191
- superContentQueries(rf, ctx, directiveIndex);
14192
- prevContentQueries(rf, ctx, directiveIndex);
14193
- };
14194
- }
14195
- else {
14196
- definition.contentQueries = superContentQueries;
14197
- }
14198
- }
14199
- function inheritHostBindings(definition, superHostBindings) {
14200
- const prevHostBindings = definition.hostBindings;
14201
- if (prevHostBindings) {
14202
- definition.hostBindings = (rf, ctx) => {
14203
- superHostBindings(rf, ctx);
14204
- prevHostBindings(rf, ctx);
14205
- };
14206
- }
14207
- else {
14208
- definition.hostBindings = superHostBindings;
14209
- }
13849
+ function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
13850
+ const bindingIndex = getBindingIndex();
13851
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13852
+ different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
13853
+ incrementBindingIndex(5);
13854
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13855
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
13856
+ NO_CHANGE;
14210
13857
  }
14211
-
14212
13858
  /**
14213
- * @license
14214
- * Copyright Google LLC All Rights Reserved.
14215
- *
14216
- * Use of this source code is governed by an MIT-style license that can be
14217
- * found in the LICENSE file at https://angular.io/license
13859
+ * Creates an interpolation binding with 6 expressions.
14218
13860
  */
13861
+ function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
13862
+ const bindingIndex = getBindingIndex();
13863
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13864
+ different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
13865
+ incrementBindingIndex(6);
13866
+ return different ?
13867
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
13868
+ renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
13869
+ NO_CHANGE;
13870
+ }
14219
13871
  /**
14220
- * Fields which exist on either directive or component definitions, and need to be copied from
14221
- * parent to child classes by the `ɵɵCopyDefinitionFeature`.
13872
+ * Creates an interpolation binding with 7 expressions.
14222
13873
  */
14223
- const COPY_DIRECTIVE_FIELDS = [
14224
- // The child class should use the providers of its parent.
14225
- 'providersResolver',
14226
- // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
14227
- // as inputs, outputs, and host binding functions.
14228
- ];
13874
+ function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
13875
+ const bindingIndex = getBindingIndex();
13876
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13877
+ different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
13878
+ incrementBindingIndex(7);
13879
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13880
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13881
+ renderStringify(v5) + i5 + renderStringify(v6) + suffix :
13882
+ NO_CHANGE;
13883
+ }
14229
13884
  /**
14230
- * Fields which exist only on component definitions, and need to be copied from parent to child
14231
- * classes by the `ɵɵCopyDefinitionFeature`.
14232
- *
14233
- * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
14234
- * since those should go in `COPY_DIRECTIVE_FIELDS` above.
13885
+ * Creates an interpolation binding with 8 expressions.
14235
13886
  */
14236
- const COPY_COMPONENT_FIELDS = [
14237
- // The child class should use the template function of its parent, including all template
14238
- // semantics.
14239
- 'template',
14240
- 'decls',
14241
- 'consts',
14242
- 'vars',
14243
- 'onPush',
14244
- 'ngContentSelectors',
14245
- // The child class should use the CSS styles of its parent, including all styling semantics.
14246
- 'styles',
14247
- 'encapsulation',
14248
- // The child class should be checked by the runtime in the same way as its parent.
14249
- 'schemas',
14250
- ];
13887
+ function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
13888
+ const bindingIndex = getBindingIndex();
13889
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13890
+ different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
13891
+ incrementBindingIndex(8);
13892
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13893
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13894
+ renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
13895
+ NO_CHANGE;
13896
+ }
13897
+
14251
13898
  /**
14252
- * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
14253
- * definition.
14254
13899
  *
14255
- * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
14256
- * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
14257
- * generates a skeleton definition on the child class, and applies this feature.
13900
+ * Update an interpolated attribute on an element with single bound value surrounded by text.
14258
13901
  *
14259
- * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
14260
- * including things like the component template function.
13902
+ * Used when the value passed to a property has 1 interpolated value in it:
14261
13903
  *
14262
- * @param definition The definition of a child class which inherits from a parent class with its
14263
- * own definition.
13904
+ * ```html
13905
+ * <div attr.title="prefix{{v0}}suffix"></div>
13906
+ * ```
14264
13907
  *
14265
- * @codeGenApi
14266
- */
14267
- function ɵɵCopyDefinitionFeature(definition) {
14268
- let superType = getSuperType(definition.type);
14269
- let superDef = undefined;
14270
- if (isComponentDef(definition)) {
14271
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14272
- superDef = superType.ɵcmp;
14273
- }
14274
- else {
14275
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14276
- superDef = superType.ɵdir;
14277
- }
14278
- // Needed because `definition` fields are readonly.
14279
- const defAny = definition;
14280
- // Copy over any fields that apply to either directives or components.
14281
- for (const field of COPY_DIRECTIVE_FIELDS) {
14282
- defAny[field] = superDef[field];
14283
- }
14284
- if (isComponentDef(superDef)) {
14285
- // Copy over any component-specific fields.
14286
- for (const field of COPY_COMPONENT_FIELDS) {
14287
- defAny[field] = superDef[field];
14288
- }
14289
- }
14290
- }
14291
-
14292
- /**
14293
- * @license
14294
- * Copyright Google LLC All Rights Reserved.
13908
+ * Its compiled representation is::
14295
13909
  *
14296
- * Use of this source code is governed by an MIT-style license that can be
14297
- * found in the LICENSE file at https://angular.io/license
13910
+ * ```ts
13911
+ * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
13912
+ * ```
13913
+ *
13914
+ * @param attrName The name of the attribute to update
13915
+ * @param prefix Static value used for concatenation only.
13916
+ * @param v0 Value checked for change.
13917
+ * @param suffix Static value used for concatenation only.
13918
+ * @param sanitizer An optional sanitizer function
13919
+ * @returns itself, so that it may be chained.
13920
+ * @codeGenApi
14298
13921
  */
14299
- let _symbolIterator = null;
14300
- function getSymbolIterator() {
14301
- if (!_symbolIterator) {
14302
- const Symbol = _global['Symbol'];
14303
- if (Symbol && Symbol.iterator) {
14304
- _symbolIterator = Symbol.iterator;
14305
- }
14306
- else {
14307
- // es6-shim specific logic
14308
- const keys = Object.getOwnPropertyNames(Map.prototype);
14309
- for (let i = 0; i < keys.length; ++i) {
14310
- const key = keys[i];
14311
- if (key !== 'entries' && key !== 'size' &&
14312
- Map.prototype[key] === Map.prototype['entries']) {
14313
- _symbolIterator = key;
14314
- }
14315
- }
14316
- }
13922
+ function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
13923
+ const lView = getLView();
13924
+ const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
13925
+ if (interpolatedValue !== NO_CHANGE) {
13926
+ const tNode = getSelectedTNode();
13927
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13928
+ ngDevMode &&
13929
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14317
13930
  }
14318
- return _symbolIterator;
13931
+ return ɵɵattributeInterpolate1;
14319
13932
  }
14320
-
14321
13933
  /**
14322
- * @license
14323
- * Copyright Google LLC All Rights Reserved.
14324
13934
  *
14325
- * Use of this source code is governed by an MIT-style license that can be
14326
- * found in the LICENSE file at https://angular.io/license
13935
+ * Update an interpolated attribute on an element with 2 bound values surrounded by text.
13936
+ *
13937
+ * Used when the value passed to a property has 2 interpolated values in it:
13938
+ *
13939
+ * ```html
13940
+ * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
13941
+ * ```
13942
+ *
13943
+ * Its compiled representation is::
13944
+ *
13945
+ * ```ts
13946
+ * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
13947
+ * ```
13948
+ *
13949
+ * @param attrName The name of the attribute to update
13950
+ * @param prefix Static value used for concatenation only.
13951
+ * @param v0 Value checked for change.
13952
+ * @param i0 Static value used for concatenation only.
13953
+ * @param v1 Value checked for change.
13954
+ * @param suffix Static value used for concatenation only.
13955
+ * @param sanitizer An optional sanitizer function
13956
+ * @returns itself, so that it may be chained.
13957
+ * @codeGenApi
14327
13958
  */
14328
- function isIterable(obj) {
14329
- return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
14330
- }
14331
- function isListLikeIterable(obj) {
14332
- if (!isJsObject(obj))
14333
- return false;
14334
- return Array.isArray(obj) ||
14335
- (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
14336
- getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
14337
- }
14338
- function areIterablesEqual(a, b, comparator) {
14339
- const iterator1 = a[getSymbolIterator()]();
14340
- const iterator2 = b[getSymbolIterator()]();
14341
- while (true) {
14342
- const item1 = iterator1.next();
14343
- const item2 = iterator2.next();
14344
- if (item1.done && item2.done)
14345
- return true;
14346
- if (item1.done || item2.done)
14347
- return false;
14348
- if (!comparator(item1.value, item2.value))
14349
- return false;
14350
- }
14351
- }
14352
- function iterateListLike(obj, fn) {
14353
- if (Array.isArray(obj)) {
14354
- for (let i = 0; i < obj.length; i++) {
14355
- fn(obj[i]);
14356
- }
14357
- }
14358
- else {
14359
- const iterator = obj[getSymbolIterator()]();
14360
- let item;
14361
- while (!((item = iterator.next()).done)) {
14362
- fn(item.value);
14363
- }
13959
+ function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
13960
+ const lView = getLView();
13961
+ const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
13962
+ if (interpolatedValue !== NO_CHANGE) {
13963
+ const tNode = getSelectedTNode();
13964
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13965
+ ngDevMode &&
13966
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14364
13967
  }
13968
+ return ɵɵattributeInterpolate2;
14365
13969
  }
14366
- function isJsObject(o) {
14367
- return o !== null && (typeof o === 'function' || typeof o === 'object');
14368
- }
14369
-
14370
13970
  /**
14371
- * @license
14372
- * Copyright Google LLC All Rights Reserved.
14373
13971
  *
14374
- * Use of this source code is governed by an MIT-style license that can be
14375
- * found in the LICENSE file at https://angular.io/license
13972
+ * Update an interpolated attribute on an element with 3 bound values surrounded by text.
13973
+ *
13974
+ * Used when the value passed to a property has 3 interpolated values in it:
13975
+ *
13976
+ * ```html
13977
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
13978
+ * ```
13979
+ *
13980
+ * Its compiled representation is::
13981
+ *
13982
+ * ```ts
13983
+ * ɵɵattributeInterpolate3(
13984
+ * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
13985
+ * ```
13986
+ *
13987
+ * @param attrName The name of the attribute to update
13988
+ * @param prefix Static value used for concatenation only.
13989
+ * @param v0 Value checked for change.
13990
+ * @param i0 Static value used for concatenation only.
13991
+ * @param v1 Value checked for change.
13992
+ * @param i1 Static value used for concatenation only.
13993
+ * @param v2 Value checked for change.
13994
+ * @param suffix Static value used for concatenation only.
13995
+ * @param sanitizer An optional sanitizer function
13996
+ * @returns itself, so that it may be chained.
13997
+ * @codeGenApi
14376
13998
  */
14377
- function devModeEqual(a, b) {
14378
- const isListLikeIterableA = isListLikeIterable(a);
14379
- const isListLikeIterableB = isListLikeIterable(b);
14380
- if (isListLikeIterableA && isListLikeIterableB) {
14381
- return areIterablesEqual(a, b, devModeEqual);
14382
- }
14383
- else {
14384
- const isAObject = a && (typeof a === 'object' || typeof a === 'function');
14385
- const isBObject = b && (typeof b === 'object' || typeof b === 'function');
14386
- if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
14387
- return true;
14388
- }
14389
- else {
14390
- return Object.is(a, b);
14391
- }
13999
+ function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14000
+ const lView = getLView();
14001
+ const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
14002
+ if (interpolatedValue !== NO_CHANGE) {
14003
+ const tNode = getSelectedTNode();
14004
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14005
+ ngDevMode &&
14006
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
14392
14007
  }
14008
+ return ɵɵattributeInterpolate3;
14393
14009
  }
14394
-
14395
14010
  /**
14396
- * @license
14397
- * Copyright Google LLC All Rights Reserved.
14398
14011
  *
14399
- * Use of this source code is governed by an MIT-style license that can be
14400
- * found in the LICENSE file at https://angular.io/license
14012
+ * Update an interpolated attribute on an element with 4 bound values surrounded by text.
14013
+ *
14014
+ * Used when the value passed to a property has 4 interpolated values in it:
14015
+ *
14016
+ * ```html
14017
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div>
14018
+ * ```
14019
+ *
14020
+ * Its compiled representation is::
14021
+ *
14022
+ * ```ts
14023
+ * ɵɵattributeInterpolate4(
14024
+ * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix');
14025
+ * ```
14026
+ *
14027
+ * @param attrName The name of the attribute to update
14028
+ * @param prefix Static value used for concatenation only.
14029
+ * @param v0 Value checked for change.
14030
+ * @param i0 Static value used for concatenation only.
14031
+ * @param v1 Value checked for change.
14032
+ * @param i1 Static value used for concatenation only.
14033
+ * @param v2 Value checked for change.
14034
+ * @param i2 Static value used for concatenation only.
14035
+ * @param v3 Value checked for change.
14036
+ * @param suffix Static value used for concatenation only.
14037
+ * @param sanitizer An optional sanitizer function
14038
+ * @returns itself, so that it may be chained.
14039
+ * @codeGenApi
14401
14040
  */
14402
- // TODO(misko): consider inlining
14403
- /** Updates binding and returns the value. */
14404
- function updateBinding(lView, bindingIndex, value) {
14405
- return lView[bindingIndex] = value;
14406
- }
14407
- /** Gets the current binding value. */
14408
- function getBinding(lView, bindingIndex) {
14409
- ngDevMode && assertIndexInRange(lView, bindingIndex);
14410
- ngDevMode &&
14411
- assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
14412
- return lView[bindingIndex];
14041
+ function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
14042
+ const lView = getLView();
14043
+ const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
14044
+ if (interpolatedValue !== NO_CHANGE) {
14045
+ const tNode = getSelectedTNode();
14046
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14047
+ ngDevMode &&
14048
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
14049
+ }
14050
+ return ɵɵattributeInterpolate4;
14413
14051
  }
14414
14052
  /**
14415
- * Updates binding if changed, then returns whether it was updated.
14416
14053
  *
14417
- * This function also checks the `CheckNoChangesMode` and throws if changes are made.
14418
- * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
14419
- * behavior.
14420
- *
14421
- * @param lView current `LView`
14422
- * @param bindingIndex The binding in the `LView` to check
14423
- * @param value New value to check against `lView[bindingIndex]`
14424
- * @returns `true` if the bindings has changed. (Throws if binding has changed during
14425
- * `CheckNoChangesMode`)
14426
- */
14427
- function bindingUpdated(lView, bindingIndex, value) {
14428
- ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
14429
- ngDevMode &&
14430
- assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
14431
- const oldValue = lView[bindingIndex];
14432
- if (Object.is(oldValue, value)) {
14433
- return false;
14434
- }
14435
- else {
14436
- if (ngDevMode && isInCheckNoChangesMode()) {
14437
- // View engine didn't report undefined values as changed on the first checkNoChanges pass
14438
- // (before the change detection was run).
14439
- const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
14440
- if (!devModeEqual(oldValueToCompare, value)) {
14441
- const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
14442
- throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
14443
- }
14444
- // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
14445
- // For this reason we exit as if no change. The early exit is needed to prevent the changed
14446
- // value to be written into `LView` (If we would write the new value that we would not see it
14447
- // as change on next CD.)
14448
- return false;
14449
- }
14450
- lView[bindingIndex] = value;
14451
- return true;
14452
- }
14453
- }
14454
- /** Updates 2 bindings if changed, then returns whether either was updated. */
14455
- function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
14456
- const different = bindingUpdated(lView, bindingIndex, exp1);
14457
- return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
14458
- }
14459
- /** Updates 3 bindings if changed, then returns whether any was updated. */
14460
- function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
14461
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14462
- return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
14463
- }
14464
- /** Updates 4 bindings if changed, then returns whether any was updated. */
14465
- function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
14466
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14467
- return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
14468
- }
14469
-
14470
- /**
14471
- * @license
14472
- * Copyright Google LLC All Rights Reserved.
14473
- *
14474
- * Use of this source code is governed by an MIT-style license that can be
14475
- * found in the LICENSE file at https://angular.io/license
14476
- */
14477
- /**
14478
- * Updates the value of or removes a bound attribute on an Element.
14479
- *
14480
- * Used in the case of `[attr.title]="value"`
14481
- *
14482
- * @param name name The name of the attribute.
14483
- * @param value value The attribute is removed when value is `null` or `undefined`.
14484
- * Otherwise the attribute value is set to the stringified value.
14485
- * @param sanitizer An optional function used to sanitize the value.
14486
- * @param namespace Optional namespace to use when setting the attribute.
14487
- *
14488
- * @codeGenApi
14489
- */
14490
- function ɵɵattribute(name, value, sanitizer, namespace) {
14491
- const lView = getLView();
14492
- const bindingIndex = nextBindingIndex();
14493
- if (bindingUpdated(lView, bindingIndex, value)) {
14494
- const tView = getTView();
14495
- const tNode = getSelectedTNode();
14496
- elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
14497
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
14498
- }
14499
- return ɵɵattribute;
14500
- }
14501
-
14502
- /**
14503
- * @license
14504
- * Copyright Google LLC All Rights Reserved.
14505
- *
14506
- * Use of this source code is governed by an MIT-style license that can be
14507
- * found in the LICENSE file at https://angular.io/license
14508
- */
14509
- /**
14510
- * Create interpolation bindings with a variable number of expressions.
14511
- *
14512
- * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
14513
- * Those are faster because there is no need to create an array of expressions and iterate over it.
14514
- *
14515
- * `values`:
14516
- * - has static text at even indexes,
14517
- * - has evaluated expressions at odd indexes.
14518
- *
14519
- * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
14520
- */
14521
- function interpolationV(lView, values) {
14522
- ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
14523
- ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
14524
- let isBindingUpdated = false;
14525
- let bindingIndex = getBindingIndex();
14526
- for (let i = 1; i < values.length; i += 2) {
14527
- // Check if bindings (odd indexes) have changed
14528
- isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
14529
- }
14530
- setBindingIndex(bindingIndex);
14531
- if (!isBindingUpdated) {
14532
- return NO_CHANGE;
14533
- }
14534
- // Build the updated content
14535
- let content = values[0];
14536
- for (let i = 1; i < values.length; i += 2) {
14537
- content += renderStringify(values[i]) + values[i + 1];
14538
- }
14539
- return content;
14540
- }
14541
- /**
14542
- * Creates an interpolation binding with 1 expression.
14543
- *
14544
- * @param prefix static value used for concatenation only.
14545
- * @param v0 value checked for change.
14546
- * @param suffix static value used for concatenation only.
14547
- */
14548
- function interpolation1(lView, prefix, v0, suffix) {
14549
- const different = bindingUpdated(lView, nextBindingIndex(), v0);
14550
- return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
14551
- }
14552
- /**
14553
- * Creates an interpolation binding with 2 expressions.
14554
- */
14555
- function interpolation2(lView, prefix, v0, i0, v1, suffix) {
14556
- const bindingIndex = getBindingIndex();
14557
- const different = bindingUpdated2(lView, bindingIndex, v0, v1);
14558
- incrementBindingIndex(2);
14559
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14560
- }
14561
- /**
14562
- * Creates an interpolation binding with 3 expressions.
14563
- */
14564
- function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
14565
- const bindingIndex = getBindingIndex();
14566
- const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
14567
- incrementBindingIndex(3);
14568
- return different ?
14569
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
14570
- NO_CHANGE;
14571
- }
14572
- /**
14573
- * Create an interpolation binding with 4 expressions.
14574
- */
14575
- function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
14576
- const bindingIndex = getBindingIndex();
14577
- const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14578
- incrementBindingIndex(4);
14579
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14580
- renderStringify(v2) + i2 + renderStringify(v3) + suffix :
14581
- NO_CHANGE;
14582
- }
14583
- /**
14584
- * Creates an interpolation binding with 5 expressions.
14585
- */
14586
- function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
14587
- const bindingIndex = getBindingIndex();
14588
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14589
- different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
14590
- incrementBindingIndex(5);
14591
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14592
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
14593
- NO_CHANGE;
14594
- }
14595
- /**
14596
- * Creates an interpolation binding with 6 expressions.
14597
- */
14598
- function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
14599
- const bindingIndex = getBindingIndex();
14600
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14601
- different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
14602
- incrementBindingIndex(6);
14603
- return different ?
14604
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
14605
- renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
14606
- NO_CHANGE;
14607
- }
14608
- /**
14609
- * Creates an interpolation binding with 7 expressions.
14610
- */
14611
- function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
14612
- const bindingIndex = getBindingIndex();
14613
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14614
- different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
14615
- incrementBindingIndex(7);
14616
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14617
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14618
- renderStringify(v5) + i5 + renderStringify(v6) + suffix :
14619
- NO_CHANGE;
14620
- }
14621
- /**
14622
- * Creates an interpolation binding with 8 expressions.
14623
- */
14624
- function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
14625
- const bindingIndex = getBindingIndex();
14626
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14627
- different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
14628
- incrementBindingIndex(8);
14629
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14630
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14631
- renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
14632
- NO_CHANGE;
14633
- }
14634
-
14635
- /**
14636
- *
14637
- * Update an interpolated attribute on an element with single bound value surrounded by text.
14054
+ * Update an interpolated attribute on an element with 5 bound values surrounded by text.
14638
14055
  *
14639
- * Used when the value passed to a property has 1 interpolated value in it:
14056
+ * Used when the value passed to a property has 5 interpolated values in it:
14640
14057
  *
14641
14058
  * ```html
14642
- * <div attr.title="prefix{{v0}}suffix"></div>
14059
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div>
14643
14060
  * ```
14644
14061
  *
14645
14062
  * Its compiled representation is::
14646
14063
  *
14647
14064
  * ```ts
14648
- * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
14065
+ * ɵɵattributeInterpolate5(
14066
+ * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix');
14649
14067
  * ```
14650
14068
  *
14651
14069
  * @param attrName The name of the attribute to update
14652
14070
  * @param prefix Static value used for concatenation only.
14653
14071
  * @param v0 Value checked for change.
14072
+ * @param i0 Static value used for concatenation only.
14073
+ * @param v1 Value checked for change.
14074
+ * @param i1 Static value used for concatenation only.
14075
+ * @param v2 Value checked for change.
14076
+ * @param i2 Static value used for concatenation only.
14077
+ * @param v3 Value checked for change.
14078
+ * @param i3 Static value used for concatenation only.
14079
+ * @param v4 Value checked for change.
14654
14080
  * @param suffix Static value used for concatenation only.
14655
14081
  * @param sanitizer An optional sanitizer function
14656
14082
  * @returns itself, so that it may be chained.
14657
14083
  * @codeGenApi
14658
14084
  */
14659
- function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
14085
+ function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
14660
14086
  const lView = getLView();
14661
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
14087
+ const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
14662
14088
  if (interpolatedValue !== NO_CHANGE) {
14663
14089
  const tNode = getSelectedTNode();
14664
14090
  elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14665
14091
  ngDevMode &&
14666
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14092
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
14667
14093
  }
14668
- return ɵɵattributeInterpolate1;
14094
+ return ɵɵattributeInterpolate5;
14669
14095
  }
14670
14096
  /**
14671
14097
  *
14672
- * Update an interpolated attribute on an element with 2 bound values surrounded by text.
14098
+ * Update an interpolated attribute on an element with 6 bound values surrounded by text.
14673
14099
  *
14674
- * Used when the value passed to a property has 2 interpolated values in it:
14100
+ * Used when the value passed to a property has 6 interpolated values in it:
14675
14101
  *
14676
14102
  * ```html
14677
- * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
14103
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div>
14678
14104
  * ```
14679
14105
  *
14680
14106
  * Its compiled representation is::
14681
14107
  *
14682
14108
  * ```ts
14683
- * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
14684
- * ```
14685
- *
14686
- * @param attrName The name of the attribute to update
14687
- * @param prefix Static value used for concatenation only.
14688
- * @param v0 Value checked for change.
14689
- * @param i0 Static value used for concatenation only.
14690
- * @param v1 Value checked for change.
14691
- * @param suffix Static value used for concatenation only.
14692
- * @param sanitizer An optional sanitizer function
14693
- * @returns itself, so that it may be chained.
14694
- * @codeGenApi
14695
- */
14696
- function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
14697
- const lView = getLView();
14698
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
14699
- if (interpolatedValue !== NO_CHANGE) {
14700
- const tNode = getSelectedTNode();
14701
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14702
- ngDevMode &&
14703
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14704
- }
14705
- return ɵɵattributeInterpolate2;
14706
- }
14707
- /**
14708
- *
14709
- * Update an interpolated attribute on an element with 3 bound values surrounded by text.
14710
- *
14711
- * Used when the value passed to a property has 3 interpolated values in it:
14712
- *
14713
- * ```html
14714
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
14715
- * ```
14716
- *
14717
- * Its compiled representation is::
14718
- *
14719
- * ```ts
14720
- * ɵɵattributeInterpolate3(
14721
- * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
14722
- * ```
14723
- *
14724
- * @param attrName The name of the attribute to update
14725
- * @param prefix Static value used for concatenation only.
14726
- * @param v0 Value checked for change.
14727
- * @param i0 Static value used for concatenation only.
14728
- * @param v1 Value checked for change.
14729
- * @param i1 Static value used for concatenation only.
14730
- * @param v2 Value checked for change.
14731
- * @param suffix Static value used for concatenation only.
14732
- * @param sanitizer An optional sanitizer function
14733
- * @returns itself, so that it may be chained.
14734
- * @codeGenApi
14735
- */
14736
- function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14737
- const lView = getLView();
14738
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
14739
- if (interpolatedValue !== NO_CHANGE) {
14740
- const tNode = getSelectedTNode();
14741
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14742
- ngDevMode &&
14743
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
14744
- }
14745
- return ɵɵattributeInterpolate3;
14746
- }
14747
- /**
14748
- *
14749
- * Update an interpolated attribute on an element with 4 bound values surrounded by text.
14750
- *
14751
- * Used when the value passed to a property has 4 interpolated values in it:
14752
- *
14753
- * ```html
14754
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div>
14755
- * ```
14756
- *
14757
- * Its compiled representation is::
14758
- *
14759
- * ```ts
14760
- * ɵɵattributeInterpolate4(
14761
- * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix');
14762
- * ```
14763
- *
14764
- * @param attrName The name of the attribute to update
14765
- * @param prefix Static value used for concatenation only.
14766
- * @param v0 Value checked for change.
14767
- * @param i0 Static value used for concatenation only.
14768
- * @param v1 Value checked for change.
14769
- * @param i1 Static value used for concatenation only.
14770
- * @param v2 Value checked for change.
14771
- * @param i2 Static value used for concatenation only.
14772
- * @param v3 Value checked for change.
14773
- * @param suffix Static value used for concatenation only.
14774
- * @param sanitizer An optional sanitizer function
14775
- * @returns itself, so that it may be chained.
14776
- * @codeGenApi
14777
- */
14778
- function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
14779
- const lView = getLView();
14780
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
14781
- if (interpolatedValue !== NO_CHANGE) {
14782
- const tNode = getSelectedTNode();
14783
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14784
- ngDevMode &&
14785
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
14786
- }
14787
- return ɵɵattributeInterpolate4;
14788
- }
14789
- /**
14790
- *
14791
- * Update an interpolated attribute on an element with 5 bound values surrounded by text.
14792
- *
14793
- * Used when the value passed to a property has 5 interpolated values in it:
14794
- *
14795
- * ```html
14796
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div>
14797
- * ```
14798
- *
14799
- * Its compiled representation is::
14800
- *
14801
- * ```ts
14802
- * ɵɵattributeInterpolate5(
14803
- * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix');
14804
- * ```
14805
- *
14806
- * @param attrName The name of the attribute to update
14807
- * @param prefix Static value used for concatenation only.
14808
- * @param v0 Value checked for change.
14809
- * @param i0 Static value used for concatenation only.
14810
- * @param v1 Value checked for change.
14811
- * @param i1 Static value used for concatenation only.
14812
- * @param v2 Value checked for change.
14813
- * @param i2 Static value used for concatenation only.
14814
- * @param v3 Value checked for change.
14815
- * @param i3 Static value used for concatenation only.
14816
- * @param v4 Value checked for change.
14817
- * @param suffix Static value used for concatenation only.
14818
- * @param sanitizer An optional sanitizer function
14819
- * @returns itself, so that it may be chained.
14820
- * @codeGenApi
14821
- */
14822
- function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
14823
- const lView = getLView();
14824
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
14825
- if (interpolatedValue !== NO_CHANGE) {
14826
- const tNode = getSelectedTNode();
14827
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14828
- ngDevMode &&
14829
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
14830
- }
14831
- return ɵɵattributeInterpolate5;
14832
- }
14833
- /**
14834
- *
14835
- * Update an interpolated attribute on an element with 6 bound values surrounded by text.
14836
- *
14837
- * Used when the value passed to a property has 6 interpolated values in it:
14838
- *
14839
- * ```html
14840
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div>
14841
- * ```
14842
- *
14843
- * Its compiled representation is::
14844
- *
14845
- * ```ts
14846
- * ɵɵattributeInterpolate6(
14847
- * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix');
14109
+ * ɵɵattributeInterpolate6(
14110
+ * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix');
14848
14111
  * ```
14849
14112
  *
14850
14113
  * @param attrName The name of the attribute to update
@@ -15017,6 +14280,57 @@ function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
15017
14280
  return ɵɵattributeInterpolateV;
15018
14281
  }
15019
14282
 
14283
+ /**
14284
+ * @license
14285
+ * Copyright Google LLC All Rights Reserved.
14286
+ *
14287
+ * Use of this source code is governed by an MIT-style license that can be
14288
+ * found in the LICENSE file at https://angular.io/license
14289
+ */
14290
+ /**
14291
+ * Synchronously perform change detection on a component (and possibly its sub-components).
14292
+ *
14293
+ * This function triggers change detection in a synchronous way on a component.
14294
+ *
14295
+ * @param component The component which the change detection should be performed on.
14296
+ */
14297
+ function detectChanges(component) {
14298
+ const view = getComponentViewByInstance(component);
14299
+ detectChangesInternal(view[TVIEW], view, component);
14300
+ }
14301
+ /**
14302
+ * Marks the component as dirty (needing change detection). Marking a component dirty will
14303
+ * schedule a change detection on it at some point in the future.
14304
+ *
14305
+ * Marking an already dirty component as dirty won't do anything. Only one outstanding change
14306
+ * detection can be scheduled per component tree.
14307
+ *
14308
+ * @param component Component to mark as dirty.
14309
+ */
14310
+ function markDirty(component) {
14311
+ ngDevMode && assertDefined(component, 'component');
14312
+ const rootView = markViewDirty(getComponentViewByInstance(component));
14313
+ ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
14314
+ scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
14315
+ }
14316
+ /**
14317
+ * Used to perform change detection on the whole application.
14318
+ *
14319
+ * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick`
14320
+ * executes lifecycle hooks and conditionally checks components based on their
14321
+ * `ChangeDetectionStrategy` and dirtiness.
14322
+ *
14323
+ * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally
14324
+ * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a
14325
+ * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can
14326
+ * be changed when calling `renderComponent` and providing the `scheduler` option.
14327
+ */
14328
+ function tick(component) {
14329
+ const rootView = getRootView(component);
14330
+ const rootContext = rootView[CONTEXT];
14331
+ tickRootContext(rootContext);
14332
+ }
14333
+
15020
14334
  /**
15021
14335
  * @license
15022
14336
  * Copyright Google LLC All Rights Reserved.
@@ -15561,51 +14875,42 @@ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
15561
14875
  tNode.index;
15562
14876
  // In order to match current behavior, native DOM event listeners must be added for all
15563
14877
  // events (including outputs).
15564
- if (isProceduralRenderer(renderer)) {
15565
- // There might be cases where multiple directives on the same element try to register an event
15566
- // handler function for the same event. In this situation we want to avoid registration of
15567
- // several native listeners as each registration would be intercepted by NgZone and
15568
- // trigger change detection. This would mean that a single user action would result in several
15569
- // change detections being invoked. To avoid this situation we want to have only one call to
15570
- // native handler registration (for the same element and same type of event).
15571
- //
15572
- // In order to have just one native event handler in presence of multiple handler functions,
15573
- // we just register a first handler function as a native event listener and then chain
15574
- // (coalesce) other handler functions on top of the first native handler function.
15575
- let existingListener = null;
15576
- // Please note that the coalescing described here doesn't happen for events specifying an
15577
- // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
15578
- // view engine.
15579
- // Also, we don't have to search for existing listeners is there are no directives
15580
- // matching on a given node as we can't register multiple event handlers for the same event in
15581
- // a template (this would mean having duplicate attributes).
15582
- if (!eventTargetResolver && isTNodeDirectiveHost) {
15583
- existingListener = findExistingListener(tView, lView, eventName, tNode.index);
15584
- }
15585
- if (existingListener !== null) {
15586
- // Attach a new listener to coalesced listeners list, maintaining the order in which
15587
- // listeners are registered. For performance reasons, we keep a reference to the last
15588
- // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
15589
- // the entire set each time we need to add a new listener.
15590
- const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
15591
- lastListenerFn.__ngNextListenerFn__ = listenerFn;
15592
- existingListener.__ngLastListenerFn__ = listenerFn;
15593
- processOutputs = false;
15594
- }
15595
- else {
15596
- listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
15597
- const cleanupFn = renderer.listen(target, eventName, listenerFn);
15598
- ngDevMode && ngDevMode.rendererAddEventListener++;
15599
- lCleanup.push(listenerFn, cleanupFn);
15600
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15601
- }
14878
+ // There might be cases where multiple directives on the same element try to register an event
14879
+ // handler function for the same event. In this situation we want to avoid registration of
14880
+ // several native listeners as each registration would be intercepted by NgZone and
14881
+ // trigger change detection. This would mean that a single user action would result in several
14882
+ // change detections being invoked. To avoid this situation we want to have only one call to
14883
+ // native handler registration (for the same element and same type of event).
14884
+ //
14885
+ // In order to have just one native event handler in presence of multiple handler functions,
14886
+ // we just register a first handler function as a native event listener and then chain
14887
+ // (coalesce) other handler functions on top of the first native handler function.
14888
+ let existingListener = null;
14889
+ // Please note that the coalescing described here doesn't happen for events specifying an
14890
+ // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
14891
+ // view engine.
14892
+ // Also, we don't have to search for existing listeners is there are no directives
14893
+ // matching on a given node as we can't register multiple event handlers for the same event in
14894
+ // a template (this would mean having duplicate attributes).
14895
+ if (!eventTargetResolver && isTNodeDirectiveHost) {
14896
+ existingListener = findExistingListener(tView, lView, eventName, tNode.index);
14897
+ }
14898
+ if (existingListener !== null) {
14899
+ // Attach a new listener to coalesced listeners list, maintaining the order in which
14900
+ // listeners are registered. For performance reasons, we keep a reference to the last
14901
+ // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
14902
+ // the entire set each time we need to add a new listener.
14903
+ const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
14904
+ lastListenerFn.__ngNextListenerFn__ = listenerFn;
14905
+ existingListener.__ngLastListenerFn__ = listenerFn;
14906
+ processOutputs = false;
15602
14907
  }
15603
14908
  else {
15604
- listenerFn = wrapListener(tNode, lView, context, listenerFn, true /** preventDefault */);
15605
- target.addEventListener(eventName, listenerFn, useCapture);
14909
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
14910
+ const cleanupFn = renderer.listen(target, eventName, listenerFn);
15606
14911
  ngDevMode && ngDevMode.rendererAddEventListener++;
15607
- lCleanup.push(listenerFn);
15608
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture);
14912
+ lCleanup.push(listenerFn, cleanupFn);
14913
+ tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15609
14914
  }
15610
14915
  }
15611
14916
  else {
@@ -17679,7 +16984,7 @@ function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
17679
16984
  valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : undefined;
17680
16985
  }
17681
16986
  let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
17682
- key === prop ? valueAtLViewIndex : undefined;
16987
+ (key === prop ? valueAtLViewIndex : undefined);
17683
16988
  if (containsStatics && !isStylingValuePresent(currentValue)) {
17684
16989
  currentValue = keyValueArrayGet(rawKey, prop);
17685
16990
  }
@@ -21532,7 +20837,7 @@ function noComponentFactoryError(component) {
21532
20837
  return error;
21533
20838
  }
21534
20839
  const ERROR_COMPONENT = 'ngComponent';
21535
- function getComponent(error) {
20840
+ function getComponent$1(error) {
21536
20841
  return error[ERROR_COMPONENT];
21537
20842
  }
21538
20843
  class _NullComponentFactoryResolver {
@@ -21716,14 +21021,6 @@ class Renderer2 {
21716
21021
  * @nocollapse
21717
21022
  */
21718
21023
  Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
21719
- /** Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) */
21720
- function getOrCreateRenderer2(lView) {
21721
- const renderer = lView[RENDERER];
21722
- if (ngDevMode && !isProceduralRenderer(renderer)) {
21723
- throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
21724
- }
21725
- return renderer;
21726
- }
21727
21024
  /** Injects a Renderer2 for the current component. */
21728
21025
  function injectRenderer2() {
21729
21026
  // We need the Renderer to be based on the component that it's being injected into, however since
@@ -21731,7 +21028,7 @@ function injectRenderer2() {
21731
21028
  const lView = getLView();
21732
21029
  const tNode = getCurrentTNode();
21733
21030
  const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
21734
- return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
21031
+ return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
21735
21032
  }
21736
21033
 
21737
21034
  /**
@@ -21778,7 +21075,7 @@ class Version {
21778
21075
  /**
21779
21076
  * @publicApi
21780
21077
  */
21781
- const VERSION = new Version('14.0.4');
21078
+ const VERSION = new Version('14.0.5');
21782
21079
 
21783
21080
  /**
21784
21081
  * @license
@@ -22157,367 +21454,783 @@ class RootViewRef extends ViewRef$1 {
22157
21454
  * Use of this source code is governed by an MIT-style license that can be
22158
21455
  * found in the LICENSE file at https://angular.io/license
22159
21456
  */
22160
- class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
22161
- /**
22162
- * @param ngModule The NgModuleRef to which all resolved factories are bound.
22163
- */
22164
- constructor(ngModule) {
22165
- super();
22166
- this.ngModule = ngModule;
22167
- }
22168
- resolveComponentFactory(component) {
22169
- ngDevMode && assertComponentType(component);
22170
- const componentDef = getComponentDef(component);
22171
- return new ComponentFactory(componentDef, this.ngModule);
22172
- }
22173
- }
22174
- function toRefArray(map) {
22175
- const array = [];
22176
- for (let nonMinified in map) {
22177
- if (map.hasOwnProperty(nonMinified)) {
22178
- const minified = map[nonMinified];
22179
- array.push({ propName: minified, templateName: nonMinified });
21457
+ class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
21458
+ /**
21459
+ * @param ngModule The NgModuleRef to which all resolved factories are bound.
21460
+ */
21461
+ constructor(ngModule) {
21462
+ super();
21463
+ this.ngModule = ngModule;
21464
+ }
21465
+ resolveComponentFactory(component) {
21466
+ ngDevMode && assertComponentType(component);
21467
+ const componentDef = getComponentDef(component);
21468
+ return new ComponentFactory(componentDef, this.ngModule);
21469
+ }
21470
+ }
21471
+ function toRefArray(map) {
21472
+ const array = [];
21473
+ for (let nonMinified in map) {
21474
+ if (map.hasOwnProperty(nonMinified)) {
21475
+ const minified = map[nonMinified];
21476
+ array.push({ propName: minified, templateName: nonMinified });
21477
+ }
21478
+ }
21479
+ return array;
21480
+ }
21481
+ function getNamespace(elementName) {
21482
+ const name = elementName.toLowerCase();
21483
+ return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21484
+ }
21485
+ /**
21486
+ * Injector that looks up a value using a specific injector, before falling back to the module
21487
+ * injector. Used primarily when creating components or embedded views dynamically.
21488
+ */
21489
+ class ChainedInjector {
21490
+ constructor(injector, parentInjector) {
21491
+ this.injector = injector;
21492
+ this.parentInjector = parentInjector;
21493
+ }
21494
+ get(token, notFoundValue, flags) {
21495
+ const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21496
+ if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21497
+ notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21498
+ // Return the value from the root element injector when
21499
+ // - it provides it
21500
+ // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21501
+ // - the module injector should not be checked
21502
+ // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21503
+ return value;
21504
+ }
21505
+ return this.parentInjector.get(token, notFoundValue, flags);
21506
+ }
21507
+ }
21508
+ /**
21509
+ * Render3 implementation of {@link viewEngine_ComponentFactory}.
21510
+ */
21511
+ class ComponentFactory extends ComponentFactory$1 {
21512
+ /**
21513
+ * @param componentDef The component definition.
21514
+ * @param ngModule The NgModuleRef to which the factory is bound.
21515
+ */
21516
+ constructor(componentDef, ngModule) {
21517
+ super();
21518
+ this.componentDef = componentDef;
21519
+ this.ngModule = ngModule;
21520
+ this.componentType = componentDef.type;
21521
+ this.selector = stringifyCSSSelectorList(componentDef.selectors);
21522
+ this.ngContentSelectors =
21523
+ componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
21524
+ this.isBoundToModule = !!ngModule;
21525
+ }
21526
+ get inputs() {
21527
+ return toRefArray(this.componentDef.inputs);
21528
+ }
21529
+ get outputs() {
21530
+ return toRefArray(this.componentDef.outputs);
21531
+ }
21532
+ create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
21533
+ environmentInjector = environmentInjector || this.ngModule;
21534
+ let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
21535
+ environmentInjector :
21536
+ environmentInjector?.injector;
21537
+ if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
21538
+ realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
21539
+ realEnvironmentInjector;
21540
+ }
21541
+ const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
21542
+ const rendererFactory = rootViewInjector.get(RendererFactory2, null);
21543
+ if (rendererFactory === null) {
21544
+ throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
21545
+ 'Angular was not able to inject a renderer (RendererFactory2). ' +
21546
+ 'Likely this is due to a broken DI hierarchy. ' +
21547
+ 'Make sure that any injector used to create this component has a correct parent.');
21548
+ }
21549
+ const sanitizer = rootViewInjector.get(Sanitizer, null);
21550
+ const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
21551
+ // Determine a tag name used for creating host elements when this component is created
21552
+ // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
21553
+ const elementName = this.componentDef.selectors[0][0] || 'div';
21554
+ const hostRNode = rootSelectorOrNode ?
21555
+ locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
21556
+ createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
21557
+ const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
21558
+ 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
21559
+ const rootContext = createRootContext();
21560
+ // Create the root view. Uses empty TView and ContentTemplate.
21561
+ const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
21562
+ const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
21563
+ // rootView is the parent when bootstrapping
21564
+ // TODO(misko): it looks like we are entering view here but we don't really need to as
21565
+ // `renderView` does that. However as the code is written it is needed because
21566
+ // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
21567
+ // issues would allow us to drop this.
21568
+ enterView(rootLView);
21569
+ let component;
21570
+ let tElementNode;
21571
+ try {
21572
+ const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
21573
+ if (hostRNode) {
21574
+ if (rootSelectorOrNode) {
21575
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
21576
+ }
21577
+ else {
21578
+ // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
21579
+ // is not defined), also apply attributes and classes extracted from component selector.
21580
+ // Extract attributes and classes from the first selector only to match VE behavior.
21581
+ const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
21582
+ if (attrs) {
21583
+ setUpAttributes(hostRenderer, hostRNode, attrs);
21584
+ }
21585
+ if (classes && classes.length > 0) {
21586
+ writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
21587
+ }
21588
+ }
21589
+ }
21590
+ tElementNode = getTNode(rootTView, HEADER_OFFSET);
21591
+ if (projectableNodes !== undefined) {
21592
+ const projection = tElementNode.projection = [];
21593
+ for (let i = 0; i < this.ngContentSelectors.length; i++) {
21594
+ const nodesforSlot = projectableNodes[i];
21595
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
21596
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
21597
+ // complex checks down the line.
21598
+ // We also normalize the length of the passed in projectable nodes (to match the number of
21599
+ // <ng-container> slots defined by a component).
21600
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
21601
+ }
21602
+ }
21603
+ // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
21604
+ // executed here?
21605
+ // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
21606
+ component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
21607
+ renderView(rootTView, rootLView, null);
21608
+ }
21609
+ finally {
21610
+ leaveView();
21611
+ }
21612
+ return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21613
+ }
21614
+ }
21615
+ const componentFactoryResolver = new ComponentFactoryResolver();
21616
+ /**
21617
+ * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
21618
+ * ComponentFactoryResolver
21619
+ * already exists, retrieves the existing ComponentFactoryResolver.
21620
+ *
21621
+ * @returns The ComponentFactoryResolver instance to use
21622
+ */
21623
+ function injectComponentFactoryResolver() {
21624
+ return componentFactoryResolver;
21625
+ }
21626
+ /**
21627
+ * Represents an instance of a Component created via a {@link ComponentFactory}.
21628
+ *
21629
+ * `ComponentRef` provides access to the Component Instance as well other objects related to this
21630
+ * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
21631
+ * method.
21632
+ *
21633
+ */
21634
+ class ComponentRef extends ComponentRef$1 {
21635
+ constructor(componentType, instance, location, _rootLView, _tNode) {
21636
+ super();
21637
+ this.location = location;
21638
+ this._rootLView = _rootLView;
21639
+ this._tNode = _tNode;
21640
+ this.instance = instance;
21641
+ this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
21642
+ this.componentType = componentType;
21643
+ }
21644
+ get injector() {
21645
+ return new NodeInjector(this._tNode, this._rootLView);
21646
+ }
21647
+ destroy() {
21648
+ this.hostView.destroy();
21649
+ }
21650
+ onDestroy(callback) {
21651
+ this.hostView.onDestroy(callback);
21652
+ }
21653
+ }
21654
+
21655
+ /**
21656
+ * @license
21657
+ * Copyright Google LLC All Rights Reserved.
21658
+ *
21659
+ * Use of this source code is governed by an MIT-style license that can be
21660
+ * found in the LICENSE file at https://angular.io/license
21661
+ */
21662
+ /**
21663
+ * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
21664
+ * @param ngModule NgModule class.
21665
+ * @param parentInjector Optional injector instance to use as a parent for the module injector. If
21666
+ * not provided, `NullInjector` will be used instead.
21667
+ * @publicApi
21668
+ */
21669
+ function createNgModuleRef(ngModule, parentInjector) {
21670
+ return new NgModuleRef(ngModule, parentInjector ?? null);
21671
+ }
21672
+ class NgModuleRef extends NgModuleRef$1 {
21673
+ constructor(ngModuleType, _parent) {
21674
+ super();
21675
+ this._parent = _parent;
21676
+ // tslint:disable-next-line:require-internal-with-underscore
21677
+ this._bootstrapComponents = [];
21678
+ this.injector = this;
21679
+ this.destroyCbs = [];
21680
+ // When bootstrapping a module we have a dependency graph that looks like this:
21681
+ // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
21682
+ // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
21683
+ // circular dependency which will result in a runtime error, because the injector doesn't
21684
+ // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
21685
+ // and providing it, rather than letting the injector resolve it.
21686
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21687
+ const ngModuleDef = getNgModuleDef(ngModuleType);
21688
+ ngDevMode &&
21689
+ assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
21690
+ this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
21691
+ this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
21692
+ { provide: NgModuleRef$1, useValue: this }, {
21693
+ provide: ComponentFactoryResolver$1,
21694
+ useValue: this.componentFactoryResolver
21695
+ }
21696
+ ], stringify(ngModuleType), new Set(['environment']));
21697
+ // We need to resolve the injector types separately from the injector creation, because
21698
+ // the module might be trying to use this ref in its constructor for DI which will cause a
21699
+ // circular error that will eventually error out, because the injector isn't created yet.
21700
+ this._r3Injector.resolveInjectorInitializers();
21701
+ this.instance = this.get(ngModuleType);
21702
+ }
21703
+ get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
21704
+ if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
21705
+ return this;
21706
+ }
21707
+ return this._r3Injector.get(token, notFoundValue, injectFlags);
21708
+ }
21709
+ destroy() {
21710
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21711
+ const injector = this._r3Injector;
21712
+ !injector.destroyed && injector.destroy();
21713
+ this.destroyCbs.forEach(fn => fn());
21714
+ this.destroyCbs = null;
21715
+ }
21716
+ onDestroy(callback) {
21717
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21718
+ this.destroyCbs.push(callback);
21719
+ }
21720
+ }
21721
+ class NgModuleFactory extends NgModuleFactory$1 {
21722
+ constructor(moduleType) {
21723
+ super();
21724
+ this.moduleType = moduleType;
21725
+ }
21726
+ create(parentInjector) {
21727
+ return new NgModuleRef(this.moduleType, parentInjector);
21728
+ }
21729
+ }
21730
+ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
21731
+ constructor(providers, parent, source) {
21732
+ super();
21733
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21734
+ this.instance = null;
21735
+ const injector = new R3Injector([
21736
+ ...providers,
21737
+ { provide: NgModuleRef$1, useValue: this },
21738
+ { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
21739
+ ], parent || getNullInjector(), source, new Set(['environment']));
21740
+ this.injector = injector;
21741
+ injector.resolveInjectorInitializers();
21742
+ }
21743
+ destroy() {
21744
+ this.injector.destroy();
21745
+ }
21746
+ onDestroy(callback) {
21747
+ this.injector.onDestroy(callback);
21748
+ }
21749
+ }
21750
+ /**
21751
+ * Create a new environment injector.
21752
+ *
21753
+ * @publicApi
21754
+ * @developerPreview
21755
+ */
21756
+ function createEnvironmentInjector(providers, parent = null, debugName = null) {
21757
+ const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
21758
+ return adapter.injector;
21759
+ }
21760
+
21761
+ /**
21762
+ * @license
21763
+ * Copyright Google LLC All Rights Reserved.
21764
+ *
21765
+ * Use of this source code is governed by an MIT-style license that can be
21766
+ * found in the LICENSE file at https://angular.io/license
21767
+ */
21768
+ /**
21769
+ * A service used by the framework to create instances of standalone injectors. Those injectors are
21770
+ * created on demand in case of dynamic component instantiation and contain ambient providers
21771
+ * collected from the imports graph rooted at a given standalone component.
21772
+ */
21773
+ class StandaloneService {
21774
+ constructor(_injector) {
21775
+ this._injector = _injector;
21776
+ this.cachedInjectors = new Map();
21777
+ }
21778
+ getOrCreateStandaloneInjector(componentDef) {
21779
+ if (!componentDef.standalone) {
21780
+ return null;
21781
+ }
21782
+ if (!this.cachedInjectors.has(componentDef.id)) {
21783
+ const providers = internalImportProvidersFrom(false, componentDef.type);
21784
+ const standaloneInjector = providers.length > 0 ?
21785
+ createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
21786
+ null;
21787
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
21788
+ }
21789
+ return this.cachedInjectors.get(componentDef.id);
21790
+ }
21791
+ ngOnDestroy() {
21792
+ try {
21793
+ for (const injector of this.cachedInjectors.values()) {
21794
+ if (injector !== null) {
21795
+ injector.destroy();
21796
+ }
21797
+ }
21798
+ }
21799
+ finally {
21800
+ this.cachedInjectors.clear();
21801
+ }
21802
+ }
21803
+ }
21804
+ /** @nocollapse */
21805
+ StandaloneService.ɵprov = ɵɵdefineInjectable({
21806
+ token: StandaloneService,
21807
+ providedIn: 'environment',
21808
+ factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
21809
+ });
21810
+ /**
21811
+ * A feature that acts as a setup code for the {@link StandaloneService}.
21812
+ *
21813
+ * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
21814
+ * function (an entry points to a standalone injector creation) on a component definition object. We
21815
+ * go through the features infrastructure to make sure that the standalone injector creation logic
21816
+ * is tree-shakable and not included in applications that don't use standalone components.
21817
+ *
21818
+ * @codeGenApi
21819
+ */
21820
+ function ɵɵStandaloneFeature(definition) {
21821
+ definition.getStandaloneInjector = (parentInjector) => {
21822
+ return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
21823
+ };
21824
+ }
21825
+
21826
+ /**
21827
+ * @license
21828
+ * Copyright Google LLC All Rights Reserved.
21829
+ *
21830
+ * Use of this source code is governed by an MIT-style license that can be
21831
+ * found in the LICENSE file at https://angular.io/license
21832
+ */
21833
+ /**
21834
+ * Retrieves the component instance associated with a given DOM element.
21835
+ *
21836
+ * @usageNotes
21837
+ * Given the following DOM structure:
21838
+ *
21839
+ * ```html
21840
+ * <app-root>
21841
+ * <div>
21842
+ * <child-comp></child-comp>
21843
+ * </div>
21844
+ * </app-root>
21845
+ * ```
21846
+ *
21847
+ * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
21848
+ * associated with this DOM element.
21849
+ *
21850
+ * Calling the function on `<app-root>` will return the `MyApp` instance.
21851
+ *
21852
+ *
21853
+ * @param element DOM element from which the component should be retrieved.
21854
+ * @returns Component instance associated with the element or `null` if there
21855
+ * is no component associated with it.
21856
+ *
21857
+ * @publicApi
21858
+ * @globalApi ng
21859
+ */
21860
+ function getComponent(element) {
21861
+ ngDevMode && assertDomElement(element);
21862
+ const context = getLContext(element);
21863
+ if (context === null)
21864
+ return null;
21865
+ if (context.component === undefined) {
21866
+ const lView = context.lView;
21867
+ if (lView === null) {
21868
+ return null;
22180
21869
  }
21870
+ context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
22181
21871
  }
22182
- return array;
21872
+ return context.component;
22183
21873
  }
22184
- function getNamespace(elementName) {
22185
- const name = elementName.toLowerCase();
22186
- return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21874
+ /**
21875
+ * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
21876
+ * view that the element is part of. Otherwise retrieves the instance of the component whose view
21877
+ * owns the element (in this case, the result is the same as calling `getOwningComponent`).
21878
+ *
21879
+ * @param element Element for which to get the surrounding component instance.
21880
+ * @returns Instance of the component that is around the element or null if the element isn't
21881
+ * inside any component.
21882
+ *
21883
+ * @publicApi
21884
+ * @globalApi ng
21885
+ */
21886
+ function getContext(element) {
21887
+ assertDomElement(element);
21888
+ const context = getLContext(element);
21889
+ const lView = context ? context.lView : null;
21890
+ return lView === null ? null : lView[CONTEXT];
22187
21891
  }
22188
21892
  /**
22189
- * Injector that looks up a value using a specific injector, before falling back to the module
22190
- * injector. Used primarily when creating components or embedded views dynamically.
21893
+ * Retrieves the component instance whose view contains the DOM element.
21894
+ *
21895
+ * For example, if `<child-comp>` is used in the template of `<app-comp>`
21896
+ * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
21897
+ * would return `<app-comp>`.
21898
+ *
21899
+ * @param elementOrDir DOM element, component or directive instance
21900
+ * for which to retrieve the root components.
21901
+ * @returns Component instance whose view owns the DOM element or null if the element is not
21902
+ * part of a component view.
21903
+ *
21904
+ * @publicApi
21905
+ * @globalApi ng
22191
21906
  */
22192
- class ChainedInjector {
22193
- constructor(injector, parentInjector) {
22194
- this.injector = injector;
22195
- this.parentInjector = parentInjector;
22196
- }
22197
- get(token, notFoundValue, flags) {
22198
- const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
22199
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
22200
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
22201
- // Return the value from the root element injector when
22202
- // - it provides it
22203
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22204
- // - the module injector should not be checked
22205
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22206
- return value;
22207
- }
22208
- return this.parentInjector.get(token, notFoundValue, flags);
21907
+ function getOwningComponent(elementOrDir) {
21908
+ const context = getLContext(elementOrDir);
21909
+ let lView = context ? context.lView : null;
21910
+ if (lView === null)
21911
+ return null;
21912
+ let parent;
21913
+ while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
21914
+ lView = parent;
22209
21915
  }
21916
+ return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
22210
21917
  }
22211
21918
  /**
22212
- * Render3 implementation of {@link viewEngine_ComponentFactory}.
21919
+ * Retrieves all root components associated with a DOM element, directive or component instance.
21920
+ * Root components are those which have been bootstrapped by Angular.
21921
+ *
21922
+ * @param elementOrDir DOM element, component or directive instance
21923
+ * for which to retrieve the root components.
21924
+ * @returns Root components associated with the target object.
21925
+ *
21926
+ * @publicApi
21927
+ * @globalApi ng
22213
21928
  */
22214
- class ComponentFactory extends ComponentFactory$1 {
22215
- /**
22216
- * @param componentDef The component definition.
22217
- * @param ngModule The NgModuleRef to which the factory is bound.
22218
- */
22219
- constructor(componentDef, ngModule) {
22220
- super();
22221
- this.componentDef = componentDef;
22222
- this.ngModule = ngModule;
22223
- this.componentType = componentDef.type;
22224
- this.selector = stringifyCSSSelectorList(componentDef.selectors);
22225
- this.ngContentSelectors =
22226
- componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
22227
- this.isBoundToModule = !!ngModule;
22228
- }
22229
- get inputs() {
22230
- return toRefArray(this.componentDef.inputs);
22231
- }
22232
- get outputs() {
22233
- return toRefArray(this.componentDef.outputs);
22234
- }
22235
- create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
22236
- environmentInjector = environmentInjector || this.ngModule;
22237
- let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
22238
- environmentInjector :
22239
- environmentInjector?.injector;
22240
- if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
22241
- realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
22242
- realEnvironmentInjector;
22243
- }
22244
- const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
22245
- const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
22246
- const sanitizer = rootViewInjector.get(Sanitizer, null);
22247
- const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
22248
- // Determine a tag name used for creating host elements when this component is created
22249
- // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
22250
- const elementName = this.componentDef.selectors[0][0] || 'div';
22251
- const hostRNode = rootSelectorOrNode ?
22252
- locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
22253
- createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
22254
- const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
22255
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
22256
- const rootContext = createRootContext();
22257
- // Create the root view. Uses empty TView and ContentTemplate.
22258
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
22259
- const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
22260
- // rootView is the parent when bootstrapping
22261
- // TODO(misko): it looks like we are entering view here but we don't really need to as
22262
- // `renderView` does that. However as the code is written it is needed because
22263
- // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
22264
- // issues would allow us to drop this.
22265
- enterView(rootLView);
22266
- let component;
22267
- let tElementNode;
22268
- try {
22269
- const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
22270
- if (hostRNode) {
22271
- if (rootSelectorOrNode) {
22272
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
22273
- }
22274
- else {
22275
- // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
22276
- // is not defined), also apply attributes and classes extracted from component selector.
22277
- // Extract attributes and classes from the first selector only to match VE behavior.
22278
- const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
22279
- if (attrs) {
22280
- setUpAttributes(hostRenderer, hostRNode, attrs);
22281
- }
22282
- if (classes && classes.length > 0) {
22283
- writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
22284
- }
22285
- }
22286
- }
22287
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
22288
- if (projectableNodes !== undefined) {
22289
- const projection = tElementNode.projection = [];
22290
- for (let i = 0; i < this.ngContentSelectors.length; i++) {
22291
- const nodesforSlot = projectableNodes[i];
22292
- // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
22293
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
22294
- // complex checks down the line.
22295
- // We also normalize the length of the passed in projectable nodes (to match the number of
22296
- // <ng-container> slots defined by a component).
22297
- projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
22298
- }
22299
- }
22300
- // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
22301
- // executed here?
22302
- // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
22303
- component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
22304
- renderView(rootTView, rootLView, null);
22305
- }
22306
- finally {
22307
- leaveView();
21929
+ function getRootComponents(elementOrDir) {
21930
+ const lView = readPatchedLView(elementOrDir);
21931
+ return lView !== null ? [...getRootContext(lView).components] : [];
21932
+ }
21933
+ /**
21934
+ * Retrieves an `Injector` associated with an element, component or directive instance.
21935
+ *
21936
+ * @param elementOrDir DOM element, component or directive instance for which to
21937
+ * retrieve the injector.
21938
+ * @returns Injector associated with the element, component or directive instance.
21939
+ *
21940
+ * @publicApi
21941
+ * @globalApi ng
21942
+ */
21943
+ function getInjector(elementOrDir) {
21944
+ const context = getLContext(elementOrDir);
21945
+ const lView = context ? context.lView : null;
21946
+ if (lView === null)
21947
+ return Injector.NULL;
21948
+ const tNode = lView[TVIEW].data[context.nodeIndex];
21949
+ return new NodeInjector(tNode, lView);
21950
+ }
21951
+ /**
21952
+ * Retrieve a set of injection tokens at a given DOM node.
21953
+ *
21954
+ * @param element Element for which the injection tokens should be retrieved.
21955
+ */
21956
+ function getInjectionTokens(element) {
21957
+ const context = getLContext(element);
21958
+ const lView = context ? context.lView : null;
21959
+ if (lView === null)
21960
+ return [];
21961
+ const tView = lView[TVIEW];
21962
+ const tNode = tView.data[context.nodeIndex];
21963
+ const providerTokens = [];
21964
+ const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
21965
+ const endIndex = tNode.directiveEnd;
21966
+ for (let i = startIndex; i < endIndex; i++) {
21967
+ let value = tView.data[i];
21968
+ if (isDirectiveDefHack(value)) {
21969
+ // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
21970
+ // design flaw. We should always store same type so that we can be monomorphic. The issue
21971
+ // is that for Components/Directives we store the def instead the type. The correct behavior
21972
+ // is that we should always be storing injectable type in this location.
21973
+ value = value.type;
22308
21974
  }
22309
- return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21975
+ providerTokens.push(value);
22310
21976
  }
21977
+ return providerTokens;
22311
21978
  }
22312
- const componentFactoryResolver = new ComponentFactoryResolver();
22313
21979
  /**
22314
- * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
22315
- * ComponentFactoryResolver
22316
- * already exists, retrieves the existing ComponentFactoryResolver.
21980
+ * Retrieves directive instances associated with a given DOM node. Does not include
21981
+ * component instances.
22317
21982
  *
22318
- * @returns The ComponentFactoryResolver instance to use
21983
+ * @usageNotes
21984
+ * Given the following DOM structure:
21985
+ *
21986
+ * ```html
21987
+ * <app-root>
21988
+ * <button my-button></button>
21989
+ * <my-comp></my-comp>
21990
+ * </app-root>
21991
+ * ```
21992
+ *
21993
+ * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
21994
+ * directive that is associated with the DOM node.
21995
+ *
21996
+ * Calling `getDirectives` on `<my-comp>` will return an empty array.
21997
+ *
21998
+ * @param node DOM node for which to get the directives.
21999
+ * @returns Array of directives associated with the node.
22000
+ *
22001
+ * @publicApi
22002
+ * @globalApi ng
22319
22003
  */
22320
- function injectComponentFactoryResolver() {
22321
- return componentFactoryResolver;
22004
+ function getDirectives(node) {
22005
+ // Skip text nodes because we can't have directives associated with them.
22006
+ if (node instanceof Text) {
22007
+ return [];
22008
+ }
22009
+ const context = getLContext(node);
22010
+ const lView = context ? context.lView : null;
22011
+ if (lView === null) {
22012
+ return [];
22013
+ }
22014
+ const tView = lView[TVIEW];
22015
+ const nodeIndex = context.nodeIndex;
22016
+ if (!tView?.data[nodeIndex]) {
22017
+ return [];
22018
+ }
22019
+ if (context.directives === undefined) {
22020
+ context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
22021
+ }
22022
+ // The `directives` in this case are a named array called `LComponentView`. Clone the
22023
+ // result so we don't expose an internal data structure in the user's console.
22024
+ return context.directives === null ? [] : [...context.directives];
22322
22025
  }
22323
22026
  /**
22324
- * Represents an instance of a Component created via a {@link ComponentFactory}.
22027
+ * Returns the debug (partial) metadata for a particular directive or component instance.
22028
+ * The function accepts an instance of a directive or component and returns the corresponding
22029
+ * metadata.
22325
22030
  *
22326
- * `ComponentRef` provides access to the Component Instance as well other objects related to this
22327
- * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
22328
- * method.
22031
+ * @param directiveOrComponentInstance Instance of a directive or component
22032
+ * @returns metadata of the passed directive or component
22329
22033
  *
22034
+ * @publicApi
22035
+ * @globalApi ng
22330
22036
  */
22331
- class ComponentRef extends ComponentRef$1 {
22332
- constructor(componentType, instance, location, _rootLView, _tNode) {
22333
- super();
22334
- this.location = location;
22335
- this._rootLView = _rootLView;
22336
- this._tNode = _tNode;
22337
- this.instance = instance;
22338
- this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
22339
- this.componentType = componentType;
22340
- }
22341
- get injector() {
22342
- return new NodeInjector(this._tNode, this._rootLView);
22037
+ function getDirectiveMetadata$1(directiveOrComponentInstance) {
22038
+ const { constructor } = directiveOrComponentInstance;
22039
+ if (!constructor) {
22040
+ throw new Error('Unable to find the instance constructor');
22343
22041
  }
22344
- destroy() {
22345
- this.hostView.destroy();
22042
+ // In case a component inherits from a directive, we may have component and directive metadata
22043
+ // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
22044
+ const componentDef = getComponentDef(constructor);
22045
+ if (componentDef) {
22046
+ return {
22047
+ inputs: componentDef.inputs,
22048
+ outputs: componentDef.outputs,
22049
+ encapsulation: componentDef.encapsulation,
22050
+ changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
22051
+ ChangeDetectionStrategy.Default
22052
+ };
22346
22053
  }
22347
- onDestroy(callback) {
22348
- this.hostView.onDestroy(callback);
22054
+ const directiveDef = getDirectiveDef(constructor);
22055
+ if (directiveDef) {
22056
+ return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
22349
22057
  }
22058
+ return null;
22350
22059
  }
22351
-
22352
22060
  /**
22353
- * @license
22354
- * Copyright Google LLC All Rights Reserved.
22061
+ * Retrieve map of local references.
22355
22062
  *
22356
- * Use of this source code is governed by an MIT-style license that can be
22357
- * found in the LICENSE file at https://angular.io/license
22063
+ * The references are retrieved as a map of local reference name to element or directive instance.
22064
+ *
22065
+ * @param target DOM element, component or directive instance for which to retrieve
22066
+ * the local references.
22358
22067
  */
22068
+ function getLocalRefs(target) {
22069
+ const context = getLContext(target);
22070
+ if (context === null)
22071
+ return {};
22072
+ if (context.localRefs === undefined) {
22073
+ const lView = context.lView;
22074
+ if (lView === null) {
22075
+ return {};
22076
+ }
22077
+ context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
22078
+ }
22079
+ return context.localRefs || {};
22080
+ }
22359
22081
  /**
22360
- * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
22361
- * @param ngModule NgModule class.
22362
- * @param parentInjector Optional injector instance to use as a parent for the module injector. If
22363
- * not provided, `NullInjector` will be used instead.
22082
+ * Retrieves the host element of a component or directive instance.
22083
+ * The host element is the DOM element that matched the selector of the directive.
22084
+ *
22085
+ * @param componentOrDirective Component or directive instance for which the host
22086
+ * element should be retrieved.
22087
+ * @returns Host element of the target.
22088
+ *
22364
22089
  * @publicApi
22090
+ * @globalApi ng
22365
22091
  */
22366
- function createNgModuleRef(ngModule, parentInjector) {
22367
- return new NgModuleRef(ngModule, parentInjector ?? null);
22092
+ function getHostElement(componentOrDirective) {
22093
+ return getLContext(componentOrDirective).native;
22368
22094
  }
22369
- class NgModuleRef extends NgModuleRef$1 {
22370
- constructor(ngModuleType, _parent) {
22371
- super();
22372
- this._parent = _parent;
22373
- // tslint:disable-next-line:require-internal-with-underscore
22374
- this._bootstrapComponents = [];
22375
- this.injector = this;
22376
- this.destroyCbs = [];
22377
- // When bootstrapping a module we have a dependency graph that looks like this:
22378
- // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
22379
- // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
22380
- // circular dependency which will result in a runtime error, because the injector doesn't
22381
- // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
22382
- // and providing it, rather than letting the injector resolve it.
22383
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22384
- const ngModuleDef = getNgModuleDef(ngModuleType);
22385
- ngDevMode &&
22386
- assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
22387
- this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
22388
- this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
22389
- { provide: NgModuleRef$1, useValue: this }, {
22390
- provide: ComponentFactoryResolver$1,
22391
- useValue: this.componentFactoryResolver
22095
+ /**
22096
+ * Retrieves the rendered text for a given component.
22097
+ *
22098
+ * This function retrieves the host element of a component and
22099
+ * and then returns the `textContent` for that element. This implies
22100
+ * that the text returned will include re-projected content of
22101
+ * the component as well.
22102
+ *
22103
+ * @param component The component to return the content text for.
22104
+ */
22105
+ function getRenderedText(component) {
22106
+ const hostElement = getHostElement(component);
22107
+ return hostElement.textContent || '';
22108
+ }
22109
+ /**
22110
+ * Retrieves a list of event listeners associated with a DOM element. The list does include host
22111
+ * listeners, but it does not include event listeners defined outside of the Angular context
22112
+ * (e.g. through `addEventListener`).
22113
+ *
22114
+ * @usageNotes
22115
+ * Given the following DOM structure:
22116
+ *
22117
+ * ```html
22118
+ * <app-root>
22119
+ * <div (click)="doSomething()"></div>
22120
+ * </app-root>
22121
+ * ```
22122
+ *
22123
+ * Calling `getListeners` on `<div>` will return an object that looks as follows:
22124
+ *
22125
+ * ```ts
22126
+ * {
22127
+ * name: 'click',
22128
+ * element: <div>,
22129
+ * callback: () => doSomething(),
22130
+ * useCapture: false
22131
+ * }
22132
+ * ```
22133
+ *
22134
+ * @param element Element for which the DOM listeners should be retrieved.
22135
+ * @returns Array of event listeners on the DOM element.
22136
+ *
22137
+ * @publicApi
22138
+ * @globalApi ng
22139
+ */
22140
+ function getListeners(element) {
22141
+ ngDevMode && assertDomElement(element);
22142
+ const lContext = getLContext(element);
22143
+ const lView = lContext === null ? null : lContext.lView;
22144
+ if (lView === null)
22145
+ return [];
22146
+ const tView = lView[TVIEW];
22147
+ const lCleanup = lView[CLEANUP];
22148
+ const tCleanup = tView.cleanup;
22149
+ const listeners = [];
22150
+ if (tCleanup && lCleanup) {
22151
+ for (let i = 0; i < tCleanup.length;) {
22152
+ const firstParam = tCleanup[i++];
22153
+ const secondParam = tCleanup[i++];
22154
+ if (typeof firstParam === 'string') {
22155
+ const name = firstParam;
22156
+ const listenerElement = unwrapRNode(lView[secondParam]);
22157
+ const callback = lCleanup[tCleanup[i++]];
22158
+ const useCaptureOrIndx = tCleanup[i++];
22159
+ // if useCaptureOrIndx is boolean then report it as is.
22160
+ // if useCaptureOrIndx is positive number then it in unsubscribe method
22161
+ // if useCaptureOrIndx is negative number then it is a Subscription
22162
+ const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
22163
+ const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
22164
+ if (element == listenerElement) {
22165
+ listeners.push({ element, name, callback, useCapture, type });
22166
+ }
22392
22167
  }
22393
- ], stringify(ngModuleType), new Set(['environment']));
22394
- // We need to resolve the injector types separately from the injector creation, because
22395
- // the module might be trying to use this ref in its constructor for DI which will cause a
22396
- // circular error that will eventually error out, because the injector isn't created yet.
22397
- this._r3Injector.resolveInjectorInitializers();
22398
- this.instance = this.get(ngModuleType);
22399
- }
22400
- get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
22401
- if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
22402
- return this;
22403
22168
  }
22404
- return this._r3Injector.get(token, notFoundValue, injectFlags);
22405
- }
22406
- destroy() {
22407
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22408
- const injector = this._r3Injector;
22409
- !injector.destroyed && injector.destroy();
22410
- this.destroyCbs.forEach(fn => fn());
22411
- this.destroyCbs = null;
22412
- }
22413
- onDestroy(callback) {
22414
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22415
- this.destroyCbs.push(callback);
22416
- }
22417
- }
22418
- class NgModuleFactory extends NgModuleFactory$1 {
22419
- constructor(moduleType) {
22420
- super();
22421
- this.moduleType = moduleType;
22422
- }
22423
- create(parentInjector) {
22424
- return new NgModuleRef(this.moduleType, parentInjector);
22425
22169
  }
22170
+ listeners.sort(sortListeners);
22171
+ return listeners;
22426
22172
  }
22427
- class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22428
- constructor(providers, parent, source) {
22429
- super();
22430
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22431
- this.instance = null;
22432
- const injector = new R3Injector([
22433
- ...providers,
22434
- { provide: NgModuleRef$1, useValue: this },
22435
- { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
22436
- ], parent || getNullInjector(), source, new Set(['environment']));
22437
- this.injector = injector;
22438
- injector.resolveInjectorInitializers();
22439
- }
22440
- destroy() {
22441
- this.injector.destroy();
22442
- }
22443
- onDestroy(callback) {
22444
- this.injector.onDestroy(callback);
22445
- }
22173
+ function sortListeners(a, b) {
22174
+ if (a.name == b.name)
22175
+ return 0;
22176
+ return a.name < b.name ? -1 : 1;
22446
22177
  }
22447
22178
  /**
22448
- * Create a new environment injector.
22179
+ * This function should not exist because it is megamorphic and only mostly correct.
22449
22180
  *
22450
- * @publicApi
22451
- * @developerPreview
22181
+ * See call site for more info.
22452
22182
  */
22453
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22454
- const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22455
- return adapter.injector;
22183
+ function isDirectiveDefHack(obj) {
22184
+ return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
22456
22185
  }
22457
-
22458
22186
  /**
22459
- * @license
22460
- * Copyright Google LLC All Rights Reserved.
22187
+ * Returns the attached `DebugNode` instance for an element in the DOM.
22461
22188
  *
22462
- * Use of this source code is governed by an MIT-style license that can be
22463
- * found in the LICENSE file at https://angular.io/license
22464
- */
22465
- /**
22466
- * A service used by the framework to create instances of standalone injectors. Those injectors are
22467
- * created on demand in case of dynamic component instantiation and contain ambient providers
22468
- * collected from the imports graph rooted at a given standalone component.
22189
+ * @param element DOM element which is owned by an existing component's view.
22469
22190
  */
22470
- class StandaloneService {
22471
- constructor(_injector) {
22472
- this._injector = _injector;
22473
- this.cachedInjectors = new Map();
22191
+ function getDebugNode$1(element) {
22192
+ if (ngDevMode && !(element instanceof Node)) {
22193
+ throw new Error('Expecting instance of DOM Element');
22474
22194
  }
22475
- getOrCreateStandaloneInjector(componentDef) {
22476
- if (!componentDef.standalone) {
22477
- return null;
22478
- }
22479
- if (!this.cachedInjectors.has(componentDef.id)) {
22480
- const providers = internalImportProvidersFrom(false, componentDef.type);
22481
- const standaloneInjector = providers.length > 0 ?
22482
- createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22483
- null;
22484
- this.cachedInjectors.set(componentDef.id, standaloneInjector);
22485
- }
22486
- return this.cachedInjectors.get(componentDef.id);
22195
+ const lContext = getLContext(element);
22196
+ const lView = lContext ? lContext.lView : null;
22197
+ if (lView === null) {
22198
+ return null;
22487
22199
  }
22488
- ngOnDestroy() {
22489
- try {
22490
- for (const injector of this.cachedInjectors.values()) {
22491
- if (injector !== null) {
22492
- injector.destroy();
22493
- }
22494
- }
22495
- }
22496
- finally {
22497
- this.cachedInjectors.clear();
22498
- }
22200
+ const nodeIndex = lContext.nodeIndex;
22201
+ if (nodeIndex !== -1) {
22202
+ const valueInLView = lView[nodeIndex];
22203
+ // this means that value in the lView is a component with its own
22204
+ // data. In this situation the TNode is not accessed at the same spot.
22205
+ const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
22206
+ ngDevMode &&
22207
+ assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
22208
+ return buildDebugNode(tNode, lView);
22499
22209
  }
22210
+ return null;
22500
22211
  }
22501
- /** @nocollapse */
22502
- StandaloneService.ɵprov = ɵɵdefineInjectable({
22503
- token: StandaloneService,
22504
- providedIn: 'environment',
22505
- factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
22506
- });
22507
22212
  /**
22508
- * A feature that acts as a setup code for the {@link StandaloneService}.
22213
+ * Retrieve the component `LView` from component/element.
22509
22214
  *
22510
- * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
22511
- * function (an entry points to a standalone injector creation) on a component definition object. We
22512
- * go through the features infrastructure to make sure that the standalone injector creation logic
22513
- * is tree-shakable and not included in applications that don't use standalone components.
22215
+ * NOTE: `LView` is a private and should not be leaked outside.
22216
+ * Don't export this method to `ng.*` on window.
22514
22217
  *
22515
- * @codeGenApi
22218
+ * @param target DOM element or component instance for which to retrieve the LView.
22516
22219
  */
22517
- function ɵɵStandaloneFeature(definition) {
22518
- definition.getStandaloneInjector = (parentInjector) => {
22519
- return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
22520
- };
22220
+ function getComponentLView(target) {
22221
+ const lContext = getLContext(target);
22222
+ const nodeIndx = lContext.nodeIndex;
22223
+ const lView = lContext.lView;
22224
+ ngDevMode && assertLView(lView);
22225
+ const componentLView = lView[nodeIndx];
22226
+ ngDevMode && assertLView(componentLView);
22227
+ return componentLView;
22228
+ }
22229
+ /** Asserts that a value is a DOM Element. */
22230
+ function assertDomElement(value) {
22231
+ if (typeof Element !== 'undefined' && !(value instanceof Element)) {
22232
+ throw new Error('Expecting instance of DOM Element');
22233
+ }
22521
22234
  }
22522
22235
 
22523
22236
  /**
@@ -23737,7 +23450,7 @@ const unusedValueExportToPlacateAjd = 1;
23737
23450
  * Use of this source code is governed by an MIT-style license that can be
23738
23451
  * found in the LICENSE file at https://angular.io/license
23739
23452
  */
23740
- const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd;
23453
+ const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd;
23741
23454
  class LQuery_ {
23742
23455
  constructor(queryList) {
23743
23456
  this.queryList = queryList;
@@ -26171,6 +25884,99 @@ const COMPILER_OPTIONS = new InjectionToken('compilerOptions');
26171
25884
  class CompilerFactory {
26172
25885
  }
26173
25886
 
25887
+ /**
25888
+ * @license
25889
+ * Copyright Google LLC All Rights Reserved.
25890
+ *
25891
+ * Use of this source code is governed by an MIT-style license that can be
25892
+ * found in the LICENSE file at https://angular.io/license
25893
+ */
25894
+ /**
25895
+ * Marks a component for check (in case of OnPush components) and synchronously
25896
+ * performs change detection on the application this component belongs to.
25897
+ *
25898
+ * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
25899
+ *
25900
+ * @publicApi
25901
+ * @globalApi ng
25902
+ */
25903
+ function applyChanges(component) {
25904
+ markDirty(component);
25905
+ getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
25906
+ }
25907
+
25908
+ /**
25909
+ * @license
25910
+ * Copyright Google LLC All Rights Reserved.
25911
+ *
25912
+ * Use of this source code is governed by an MIT-style license that can be
25913
+ * found in the LICENSE file at https://angular.io/license
25914
+ */
25915
+ /**
25916
+ * This file introduces series of globally accessible debug tools
25917
+ * to allow for the Angular debugging story to function.
25918
+ *
25919
+ * To see this in action run the following command:
25920
+ *
25921
+ * bazel run //packages/core/test/bundling/todo:devserver
25922
+ *
25923
+ * Then load `localhost:5432` and start using the console tools.
25924
+ */
25925
+ /**
25926
+ * This value reflects the property on the window where the dev
25927
+ * tools are patched (window.ng).
25928
+ * */
25929
+ const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
25930
+ let _published = false;
25931
+ /**
25932
+ * Publishes a collection of default debug tools onto`window.ng`.
25933
+ *
25934
+ * These functions are available globally when Angular is in development
25935
+ * mode and are automatically stripped away from prod mode is on.
25936
+ */
25937
+ function publishDefaultGlobalUtils$1() {
25938
+ if (!_published) {
25939
+ _published = true;
25940
+ /**
25941
+ * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
25942
+ * The contract of the function might be changed in any release and/or the function can be
25943
+ * removed completely.
25944
+ */
25945
+ publishGlobalUtil('ɵsetProfiler', setProfiler);
25946
+ publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
25947
+ publishGlobalUtil('getComponent', getComponent);
25948
+ publishGlobalUtil('getContext', getContext);
25949
+ publishGlobalUtil('getListeners', getListeners);
25950
+ publishGlobalUtil('getOwningComponent', getOwningComponent);
25951
+ publishGlobalUtil('getHostElement', getHostElement);
25952
+ publishGlobalUtil('getInjector', getInjector);
25953
+ publishGlobalUtil('getRootComponents', getRootComponents);
25954
+ publishGlobalUtil('getDirectives', getDirectives);
25955
+ publishGlobalUtil('applyChanges', applyChanges);
25956
+ }
25957
+ }
25958
+ /**
25959
+ * Publishes the given function to `window.ng` so that it can be
25960
+ * used from the browser console when an application is not in production.
25961
+ */
25962
+ function publishGlobalUtil(name, fn) {
25963
+ if (typeof COMPILED === 'undefined' || !COMPILED) {
25964
+ // Note: we can't export `ng` when using closure enhanced optimization as:
25965
+ // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
25966
+ // - we can't declare a closure extern as the namespace `ng` is already used within Google
25967
+ // for typings for AngularJS (via `goog.provide('ng....')`).
25968
+ const w = _global;
25969
+ ngDevMode && assertDefined(fn, 'function not defined');
25970
+ if (w) {
25971
+ let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
25972
+ if (!container) {
25973
+ container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
25974
+ }
25975
+ container[name] = fn;
25976
+ }
25977
+ }
25978
+ }
25979
+
26174
25980
  /**
26175
25981
  * @license
26176
25982
  * Copyright Google LLC All Rights Reserved.
@@ -28074,7 +27880,7 @@ class DebugNode {
28074
27880
  get componentInstance() {
28075
27881
  const nativeElement = this.nativeNode;
28076
27882
  return nativeElement &&
28077
- (getComponent$1(nativeElement) || getOwningComponent(nativeElement));
27883
+ (getComponent(nativeElement) || getOwningComponent(nativeElement));
28078
27884
  }
28079
27885
  /**
28080
27886
  * An object that provides parent context for this element. Often an ancestor component instance
@@ -28085,7 +27891,7 @@ class DebugNode {
28085
27891
  * of heroes"`.
28086
27892
  */
28087
27893
  get context() {
28088
- return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
27894
+ return getComponent(this.nativeNode) || getContext(this.nativeNode);
28089
27895
  }
28090
27896
  /**
28091
27897
  * The callbacks attached to the component's @Output properties and/or the element's event
@@ -28425,8 +28231,7 @@ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, root
28425
28231
  // Renderer2, however that's not the case in Ivy. This approach is being used because:
28426
28232
  // 1. Matching the ViewEngine behavior would mean potentially introducing a depedency
28427
28233
  // from `Renderer2` to Ivy which could bring Ivy code into ViewEngine.
28428
- // 2. We would have to make `Renderer3` "know" about debug nodes.
28429
- // 3. It allows us to capture nodes that were inserted directly via the DOM.
28234
+ // 2. It allows us to capture nodes that were inserted directly via the DOM.
28430
28235
  nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
28431
28236
  }
28432
28237
  // In all cases, if a dynamic container exists for this node, each view inside it has to be
@@ -29902,5 +29707,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29902
29707
  * Generated bundle index. Do not edit.
29903
29708
  */
29904
29709
 
29905
- export { ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, createEnvironmentInjector, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, platformCore, resolveForwardRef, setTestabilityGetter, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ChangeDetectorStatus as ɵChangeDetectorStatus, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, ViewRef$1 as ɵViewRef, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, getDebugNode as ɵgetDebugNode, getDebugNodeR2 as ɵgetDebugNodeR2, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalBootstrapApplication as ɵinternalBootstrapApplication, isBoundToModule as ɵisBoundToModule, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy, isListLikeIterable as ɵisListLikeIterable, isObservable as ɵisObservable, isPromise as ɵisPromise, isStandalone as ɵisStandalone, isSubscribable as ɵisSubscribable, ɵivyEnabled, makeDecorator as ɵmakeDecorator, markDirty as ɵmarkDirty, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, renderComponent as ɵrenderComponent, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, whenRendered as ɵwhenRendered, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵviewQuery };
29710
+ export { ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, createEnvironmentInjector, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, platformCore, resolveForwardRef, setTestabilityGetter, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ChangeDetectorStatus as ɵChangeDetectorStatus, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, ViewRef$1 as ɵViewRef, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, getDebugNode as ɵgetDebugNode, getDebugNodeR2 as ɵgetDebugNodeR2, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalBootstrapApplication as ɵinternalBootstrapApplication, isBoundToModule as ɵisBoundToModule, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy, isListLikeIterable as ɵisListLikeIterable, isObservable as ɵisObservable, isPromise as ɵisPromise, isStandalone as ɵisStandalone, isSubscribable as ɵisSubscribable, ɵivyEnabled, makeDecorator as ɵmakeDecorator, markDirty as ɵmarkDirty, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, whenRendered as ɵwhenRendered, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵviewQuery };
29906
29711
  //# sourceMappingURL=core.mjs.map