@angular/core 14.0.3 → 14.0.6

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 (41) hide show
  1. package/esm2020/src/application_ref.mjs +23 -13
  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/di/injector_compatibility.mjs +3 -8
  6. package/esm2020/src/di/jit/util.mjs +3 -2
  7. package/esm2020/src/di/reflective_key.mjs +3 -2
  8. package/esm2020/src/errors.mjs +1 -1
  9. package/esm2020/src/i18n/locale_data_api.mjs +3 -2
  10. package/esm2020/src/render/api.mjs +2 -11
  11. package/esm2020/src/render3/component.mjs +3 -57
  12. package/esm2020/src/render3/component_ref.mjs +9 -3
  13. package/esm2020/src/render3/index.mjs +4 -4
  14. package/esm2020/src/render3/instructions/change_detection.mjs +2 -20
  15. package/esm2020/src/render3/instructions/listener.mjs +34 -44
  16. package/esm2020/src/render3/instructions/lview_debug.mjs +1 -1
  17. package/esm2020/src/render3/instructions/shared.mjs +19 -57
  18. package/esm2020/src/render3/instructions/styling.mjs +2 -2
  19. package/esm2020/src/render3/interfaces/renderer.mjs +1 -17
  20. package/esm2020/src/render3/interfaces/view.mjs +1 -1
  21. package/esm2020/src/render3/node_manipulation.mjs +24 -87
  22. package/esm2020/src/render3/node_manipulation_i18n.mjs +1 -1
  23. package/esm2020/src/render3/util/attrs_utils.mjs +4 -12
  24. package/esm2020/src/render3/util/view_utils.mjs +3 -6
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/src/zone/ng_zone.mjs +5 -4
  27. package/esm2020/testing/src/logger.mjs +3 -3
  28. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  29. package/fesm2015/core.mjs +1693 -1889
  30. package/fesm2015/core.mjs.map +1 -1
  31. package/fesm2015/testing.mjs +2473 -2772
  32. package/fesm2015/testing.mjs.map +1 -1
  33. package/fesm2020/core.mjs +1693 -1889
  34. package/fesm2020/core.mjs.map +1 -1
  35. package/fesm2020/testing.mjs +2473 -2772
  36. package/fesm2020/testing.mjs.map +1 -1
  37. package/index.d.ts +61 -134
  38. package/package.json +1 -1
  39. package/testing/index.d.ts +1 -1
  40. package/schematics/utils/schematics_prompt.d.ts +0 -17
  41. package/schematics/utils/schematics_prompt.js +0 -45
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.3
2
+ * @license Angular v14.0.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1586,87 +1586,6 @@ function getNamespaceUri(namespace) {
1586
1586
  (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
1587
1587
  }
1588
1588
 
1589
- /**
1590
- * @license
1591
- * Copyright Google LLC All Rights Reserved.
1592
- *
1593
- * Use of this source code is governed by an MIT-style license that can be
1594
- * found in the LICENSE file at https://angular.io/license
1595
- */
1596
- /**
1597
- * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
1598
- * inject the `DOCUMENT` token and are done.
1599
- *
1600
- * Ivy is special because it does not rely upon the DI and must get hold of the document some other
1601
- * way.
1602
- *
1603
- * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
1604
- * Wherever ivy needs the global document, it calls `getDocument()` instead.
1605
- *
1606
- * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
1607
- * tell ivy what the global `document` is.
1608
- *
1609
- * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
1610
- * by calling `setDocument()` when providing the `DOCUMENT` token.
1611
- */
1612
- let DOCUMENT = undefined;
1613
- /**
1614
- * Tell ivy what the `document` is for this platform.
1615
- *
1616
- * It is only necessary to call this if the current platform is not a browser.
1617
- *
1618
- * @param document The object representing the global `document` in this environment.
1619
- */
1620
- function setDocument(document) {
1621
- DOCUMENT = document;
1622
- }
1623
- /**
1624
- * Access the object that represents the `document` for this platform.
1625
- *
1626
- * Ivy calls this whenever it needs to access the `document` object.
1627
- * For example to create the renderer or to do sanitization.
1628
- */
1629
- function getDocument() {
1630
- if (DOCUMENT !== undefined) {
1631
- return DOCUMENT;
1632
- }
1633
- else if (typeof document !== 'undefined') {
1634
- return document;
1635
- }
1636
- // No "document" can be found. This should only happen if we are running ivy outside Angular and
1637
- // the current platform is not a browser. Since this is not a supported scenario at the moment
1638
- // this should not happen in Angular apps.
1639
- // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
1640
- // public API. Meanwhile we just return `undefined` and let the application fail.
1641
- return undefined;
1642
- }
1643
-
1644
- /**
1645
- * @license
1646
- * Copyright Google LLC All Rights Reserved.
1647
- *
1648
- * Use of this source code is governed by an MIT-style license that can be
1649
- * found in the LICENSE file at https://angular.io/license
1650
- */
1651
- // TODO: cleanup once the code is merged in angular/angular
1652
- var RendererStyleFlags3;
1653
- (function (RendererStyleFlags3) {
1654
- RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
1655
- RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
1656
- })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
1657
- /** Returns whether the `renderer` is a `ProceduralRenderer3` */
1658
- function isProceduralRenderer(renderer) {
1659
- return !!(renderer.listen);
1660
- }
1661
- const domRendererFactory3 = {
1662
- createRenderer: (hostElement, rendererType) => {
1663
- return getDocument();
1664
- }
1665
- };
1666
- // Note: This hack is necessary so we don't erroneously get a circular dependency
1667
- // failure based on types.
1668
- const unusedValueExportToPlacateAjd$6 = 1;
1669
-
1670
1589
  /**
1671
1590
  * @license
1672
1591
  * Copyright Google LLC All Rights Reserved.
@@ -1749,7 +1668,6 @@ function getNativeByTNode(tNode, lView) {
1749
1668
  ngDevMode && assertTNodeForLView(tNode, lView);
1750
1669
  ngDevMode && assertIndexInRange(lView, tNode.index);
1751
1670
  const node = unwrapRNode(lView[tNode.index]);
1752
- ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1753
1671
  return node;
1754
1672
  }
1755
1673
  /**
@@ -1765,7 +1683,6 @@ function getNativeByTNodeOrNull(tNode, lView) {
1765
1683
  if (index !== -1) {
1766
1684
  ngDevMode && assertTNodeForLView(tNode, lView);
1767
1685
  const node = unwrapRNode(lView[index]);
1768
- ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1769
1686
  return node;
1770
1687
  }
1771
1688
  return null;
@@ -2714,7 +2631,7 @@ function isFactory(obj) {
2714
2631
  }
2715
2632
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2716
2633
  // failure based on types.
2717
- const unusedValueExportToPlacateAjd$5 = 1;
2634
+ const unusedValueExportToPlacateAjd$6 = 1;
2718
2635
 
2719
2636
  /**
2720
2637
  * Converts `TNodeType` into human readable text.
@@ -2733,7 +2650,7 @@ function toTNodeTypeAsString(tNodeType) {
2733
2650
  }
2734
2651
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2735
2652
  // failure based on types.
2736
- const unusedValueExportToPlacateAjd$4 = 1;
2653
+ const unusedValueExportToPlacateAjd$5 = 1;
2737
2654
  /**
2738
2655
  * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.
2739
2656
  *
@@ -2837,7 +2754,6 @@ function assertPureTNodeType(type) {
2837
2754
  * @returns the index value that was last accessed in the attributes array
2838
2755
  */
2839
2756
  function setUpAttributes(renderer, native, attrs) {
2840
- const isProc = isProceduralRenderer(renderer);
2841
2757
  let i = 0;
2842
2758
  while (i < attrs.length) {
2843
2759
  const value = attrs[i];
@@ -2854,9 +2770,7 @@ function setUpAttributes(renderer, native, attrs) {
2854
2770
  const attrName = attrs[i++];
2855
2771
  const attrVal = attrs[i++];
2856
2772
  ngDevMode && ngDevMode.rendererSetAttribute++;
2857
- isProc ?
2858
- renderer.setAttribute(native, attrName, attrVal, namespaceURI) :
2859
- native.setAttributeNS(namespaceURI, attrName, attrVal);
2773
+ renderer.setAttribute(native, attrName, attrVal, namespaceURI);
2860
2774
  }
2861
2775
  else {
2862
2776
  // attrName is string;
@@ -2865,14 +2779,10 @@ function setUpAttributes(renderer, native, attrs) {
2865
2779
  // Standard attributes
2866
2780
  ngDevMode && ngDevMode.rendererSetAttribute++;
2867
2781
  if (isAnimationProp(attrName)) {
2868
- if (isProc) {
2869
- renderer.setProperty(native, attrName, attrVal);
2870
- }
2782
+ renderer.setProperty(native, attrName, attrVal);
2871
2783
  }
2872
2784
  else {
2873
- isProc ?
2874
- renderer.setAttribute(native, attrName, attrVal) :
2875
- native.setAttribute(attrName, attrVal);
2785
+ renderer.setAttribute(native, attrName, attrVal);
2876
2786
  }
2877
2787
  i++;
2878
2788
  }
@@ -4854,22 +4764,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
4854
4764
  * Throws an error indicating that a factory function could not be generated by the compiler for a
4855
4765
  * particular class.
4856
4766
  *
4857
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
4858
- * off, saving bytes of generated code while still providing a good experience in dev mode.
4859
- *
4860
4767
  * The name of the class is not mentioned here, but will be in the generated factory function name
4861
4768
  * and thus in the stack trace.
4862
4769
  *
4863
4770
  * @codeGenApi
4864
4771
  */
4865
4772
  function ɵɵinvalidFactoryDep(index) {
4866
- const msg = ngDevMode ?
4773
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4867
4774
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4868
4775
  This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
4869
4776
 
4870
- Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.` :
4871
- 'invalid';
4872
- throw new Error(msg);
4777
+ Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
4873
4778
  }
4874
4779
  /**
4875
4780
  * Injects a token from the currently active injector.
@@ -5133,7 +5038,7 @@ function reflectDependency(dep) {
5133
5038
  }
5134
5039
  else if (param instanceof Attribute) {
5135
5040
  if (param.attributeName === undefined) {
5136
- throw new Error(`Attribute name must be defined.`);
5041
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5137
5042
  }
5138
5043
  meta.attribute = param.attributeName;
5139
5044
  }
@@ -5319,6 +5224,61 @@ function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
5319
5224
  checkForDuplicateNgModules = !allowDuplicates;
5320
5225
  }
5321
5226
 
5227
+ /**
5228
+ * @license
5229
+ * Copyright Google LLC All Rights Reserved.
5230
+ *
5231
+ * Use of this source code is governed by an MIT-style license that can be
5232
+ * found in the LICENSE file at https://angular.io/license
5233
+ */
5234
+ /**
5235
+ * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
5236
+ * inject the `DOCUMENT` token and are done.
5237
+ *
5238
+ * Ivy is special because it does not rely upon the DI and must get hold of the document some other
5239
+ * way.
5240
+ *
5241
+ * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
5242
+ * Wherever ivy needs the global document, it calls `getDocument()` instead.
5243
+ *
5244
+ * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
5245
+ * tell ivy what the global `document` is.
5246
+ *
5247
+ * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
5248
+ * by calling `setDocument()` when providing the `DOCUMENT` token.
5249
+ */
5250
+ let DOCUMENT = undefined;
5251
+ /**
5252
+ * Tell ivy what the `document` is for this platform.
5253
+ *
5254
+ * It is only necessary to call this if the current platform is not a browser.
5255
+ *
5256
+ * @param document The object representing the global `document` in this environment.
5257
+ */
5258
+ function setDocument(document) {
5259
+ DOCUMENT = document;
5260
+ }
5261
+ /**
5262
+ * Access the object that represents the `document` for this platform.
5263
+ *
5264
+ * Ivy calls this whenever it needs to access the `document` object.
5265
+ * For example to create the renderer or to do sanitization.
5266
+ */
5267
+ function getDocument() {
5268
+ if (DOCUMENT !== undefined) {
5269
+ return DOCUMENT;
5270
+ }
5271
+ else if (typeof document !== 'undefined') {
5272
+ return document;
5273
+ }
5274
+ // No "document" can be found. This should only happen if we are running ivy outside Angular and
5275
+ // the current platform is not a browser. Since this is not a supported scenario at the moment
5276
+ // this should not happen in Angular apps.
5277
+ // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
5278
+ // public API. Meanwhile we just return `undefined` and let the application fail.
5279
+ return undefined;
5280
+ }
5281
+
5322
5282
  /**
5323
5283
  * @license
5324
5284
  * Copyright Google LLC All Rights Reserved.
@@ -7054,6 +7014,17 @@ function ensureIcuContainerVisitorLoaded(loader) {
7054
7014
  }
7055
7015
  }
7056
7016
 
7017
+ /**
7018
+ * @license
7019
+ * Copyright Google LLC All Rights Reserved.
7020
+ *
7021
+ * Use of this source code is governed by an MIT-style license that can be
7022
+ * found in the LICENSE file at https://angular.io/license
7023
+ */
7024
+ // Note: This hack is necessary so we don't erroneously get a circular dependency
7025
+ // failure based on types.
7026
+ const unusedValueExportToPlacateAjd$4 = 1;
7027
+
7057
7028
  /**
7058
7029
  * @license
7059
7030
  * Copyright Google LLC All Rights Reserved.
@@ -7136,7 +7107,7 @@ function getNearestLContainer(viewOrContainer) {
7136
7107
  * Use of this source code is governed by an MIT-style license that can be
7137
7108
  * found in the LICENSE file at https://angular.io/license
7138
7109
  */
7139
- const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$8 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$7;
7110
+ const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$8 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$7;
7140
7111
  /**
7141
7112
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
7142
7113
  * being passed as an argument.
@@ -7161,7 +7132,6 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7161
7132
  lNodeToHandle = lNodeToHandle[HOST];
7162
7133
  }
7163
7134
  const rNode = unwrapRNode(lNodeToHandle);
7164
- ngDevMode && !isProceduralRenderer(renderer) && assertDomNode(rNode);
7165
7135
  if (action === 0 /* WalkTNodeTreeAction.Create */ && parent !== null) {
7166
7136
  if (beforeNode == null) {
7167
7137
  nativeAppendChild(renderer, parent, rNode);
@@ -7188,17 +7158,14 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7188
7158
  function createTextNode(renderer, value) {
7189
7159
  ngDevMode && ngDevMode.rendererCreateTextNode++;
7190
7160
  ngDevMode && ngDevMode.rendererSetText++;
7191
- return isProceduralRenderer(renderer) ? renderer.createText(value) :
7192
- renderer.createTextNode(value);
7161
+ return renderer.createText(value);
7193
7162
  }
7194
7163
  function updateTextNode(renderer, rNode, value) {
7195
7164
  ngDevMode && ngDevMode.rendererSetText++;
7196
- isProceduralRenderer(renderer) ? renderer.setValue(rNode, value) : rNode.textContent = value;
7165
+ renderer.setValue(rNode, value);
7197
7166
  }
7198
7167
  function createCommentNode(renderer, value) {
7199
7168
  ngDevMode && ngDevMode.rendererCreateComment++;
7200
- // isProceduralRenderer check is not needed because both `Renderer2` and `Renderer3` have the same
7201
- // method name.
7202
7169
  return renderer.createComment(escapeCommentText(value));
7203
7170
  }
7204
7171
  /**
@@ -7210,14 +7177,7 @@ function createCommentNode(renderer, value) {
7210
7177
  */
7211
7178
  function createElementNode(renderer, name, namespace) {
7212
7179
  ngDevMode && ngDevMode.rendererCreateElement++;
7213
- if (isProceduralRenderer(renderer)) {
7214
- return renderer.createElement(name, namespace);
7215
- }
7216
- else {
7217
- const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
7218
- return namespaceUri === null ? renderer.createElement(name) :
7219
- renderer.createElementNS(namespaceUri, name);
7220
- }
7180
+ return renderer.createElement(name, namespace);
7221
7181
  }
7222
7182
  /**
7223
7183
  * Removes all DOM elements associated with a view.
@@ -7449,7 +7409,7 @@ function detachView(lContainer, removeIndex) {
7449
7409
  function destroyLView(tView, lView) {
7450
7410
  if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7451
7411
  const renderer = lView[RENDERER];
7452
- if (isProceduralRenderer(renderer) && renderer.destroyNode) {
7412
+ if (renderer.destroyNode) {
7453
7413
  applyView(tView, lView, renderer, 3 /* WalkTNodeTreeAction.Destroy */, null, null);
7454
7414
  }
7455
7415
  destroyViewTree(lView);
@@ -7477,7 +7437,7 @@ function cleanUpView(tView, lView) {
7477
7437
  executeOnDestroys(tView, lView);
7478
7438
  processCleanups(tView, lView);
7479
7439
  // For component views only, the local renderer is destroyed at clean up time.
7480
- if (lView[TVIEW].type === 1 /* TViewType.Component */ && isProceduralRenderer(lView[RENDERER])) {
7440
+ if (lView[TVIEW].type === 1 /* TViewType.Component */) {
7481
7441
  ngDevMode && ngDevMode.rendererDestroy++;
7482
7442
  lView[RENDERER].destroy();
7483
7443
  }
@@ -7653,30 +7613,17 @@ function getClosestRElement(tView, tNode, lView) {
7653
7613
  }
7654
7614
  }
7655
7615
  /**
7656
- * Inserts a native node before another native node for a given parent using {@link Renderer3}.
7657
- * This is a utility function that can be used when native nodes were determined - it abstracts an
7658
- * actual renderer being used.
7616
+ * Inserts a native node before another native node for a given parent.
7617
+ * This is a utility function that can be used when native nodes were determined.
7659
7618
  */
7660
7619
  function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
7661
7620
  ngDevMode && ngDevMode.rendererInsertBefore++;
7662
- if (isProceduralRenderer(renderer)) {
7663
- renderer.insertBefore(parent, child, beforeNode, isMove);
7664
- }
7665
- else {
7666
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7667
- targetParent.insertBefore(child, beforeNode, isMove);
7668
- }
7621
+ renderer.insertBefore(parent, child, beforeNode, isMove);
7669
7622
  }
7670
7623
  function nativeAppendChild(renderer, parent, child) {
7671
7624
  ngDevMode && ngDevMode.rendererAppendChild++;
7672
7625
  ngDevMode && assertDefined(parent, 'parent node must be defined');
7673
- if (isProceduralRenderer(renderer)) {
7674
- renderer.appendChild(parent, child);
7675
- }
7676
- else {
7677
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7678
- targetParent.appendChild(child);
7679
- }
7626
+ renderer.appendChild(parent, child);
7680
7627
  }
7681
7628
  function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
7682
7629
  if (beforeNode !== null) {
@@ -7688,12 +7635,7 @@ function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove)
7688
7635
  }
7689
7636
  /** Removes a node from the DOM given its native parent. */
7690
7637
  function nativeRemoveChild(renderer, parent, child, isHostElement) {
7691
- if (isProceduralRenderer(renderer)) {
7692
- renderer.removeChild(parent, child, isHostElement);
7693
- }
7694
- else {
7695
- parent.removeChild(child);
7696
- }
7638
+ renderer.removeChild(parent, child, isHostElement);
7697
7639
  }
7698
7640
  /** Checks if an element is a `<template>` node. */
7699
7641
  function isTemplateNode(node) {
@@ -7703,13 +7645,13 @@ function isTemplateNode(node) {
7703
7645
  * Returns a native parent of a given native node.
7704
7646
  */
7705
7647
  function nativeParentNode(renderer, node) {
7706
- return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode);
7648
+ return renderer.parentNode(node);
7707
7649
  }
7708
7650
  /**
7709
7651
  * Returns a native sibling of a given native node.
7710
7652
  */
7711
7653
  function nativeNextSibling(renderer, node) {
7712
- return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
7654
+ return renderer.nextSibling(node);
7713
7655
  }
7714
7656
  /**
7715
7657
  * Find a node in front of which `currentTNode` should be inserted.
@@ -8018,39 +7960,22 @@ function applyContainer(renderer, action, lContainer, parentRElement, beforeNode
8018
7960
  * otherwise).
8019
7961
  */
8020
7962
  function applyStyling(renderer, isClassBased, rNode, prop, value) {
8021
- const isProcedural = isProceduralRenderer(renderer);
8022
7963
  if (isClassBased) {
8023
7964
  // We actually want JS true/false here because any truthy value should add the class
8024
7965
  if (!value) {
8025
7966
  ngDevMode && ngDevMode.rendererRemoveClass++;
8026
- if (isProcedural) {
8027
- renderer.removeClass(rNode, prop);
8028
- }
8029
- else {
8030
- rNode.classList.remove(prop);
8031
- }
7967
+ renderer.removeClass(rNode, prop);
8032
7968
  }
8033
7969
  else {
8034
7970
  ngDevMode && ngDevMode.rendererAddClass++;
8035
- if (isProcedural) {
8036
- renderer.addClass(rNode, prop);
8037
- }
8038
- else {
8039
- ngDevMode && assertDefined(rNode.classList, 'HTMLElement expected');
8040
- rNode.classList.add(prop);
8041
- }
7971
+ renderer.addClass(rNode, prop);
8042
7972
  }
8043
7973
  }
8044
7974
  else {
8045
7975
  let flags = prop.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase;
8046
7976
  if (value == null /** || value === undefined */) {
8047
7977
  ngDevMode && ngDevMode.rendererRemoveStyle++;
8048
- if (isProcedural) {
8049
- renderer.removeStyle(rNode, prop, flags);
8050
- }
8051
- else {
8052
- rNode.style.removeProperty(prop);
8053
- }
7978
+ renderer.removeStyle(rNode, prop, flags);
8054
7979
  }
8055
7980
  else {
8056
7981
  // A value is important if it ends with `!important`. The style
@@ -8062,13 +7987,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8062
7987
  flags |= RendererStyleFlags2.Important;
8063
7988
  }
8064
7989
  ngDevMode && ngDevMode.rendererSetStyle++;
8065
- if (isProcedural) {
8066
- renderer.setStyle(rNode, prop, value, flags);
8067
- }
8068
- else {
8069
- ngDevMode && assertDefined(rNode.style, 'HTMLElement expected');
8070
- rNode.style.setProperty(prop, value, isImportant ? 'important' : '');
8071
- }
7990
+ renderer.setStyle(rNode, prop, value, flags);
8072
7991
  }
8073
7992
  }
8074
7993
  }
@@ -8084,12 +8003,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8084
8003
  */
8085
8004
  function writeDirectStyle(renderer, element, newValue) {
8086
8005
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8087
- if (isProceduralRenderer(renderer)) {
8088
- renderer.setAttribute(element, 'style', newValue);
8089
- }
8090
- else {
8091
- element.style.cssText = newValue;
8092
- }
8006
+ renderer.setAttribute(element, 'style', newValue);
8093
8007
  ngDevMode && ngDevMode.rendererSetStyle++;
8094
8008
  }
8095
8009
  /**
@@ -8104,17 +8018,12 @@ function writeDirectStyle(renderer, element, newValue) {
8104
8018
  */
8105
8019
  function writeDirectClass(renderer, element, newValue) {
8106
8020
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8107
- if (isProceduralRenderer(renderer)) {
8108
- if (newValue === '') {
8109
- // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8110
- renderer.removeAttribute(element, 'class');
8111
- }
8112
- else {
8113
- renderer.setAttribute(element, 'class', newValue);
8114
- }
8021
+ if (newValue === '') {
8022
+ // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8023
+ renderer.removeAttribute(element, 'class');
8115
8024
  }
8116
8025
  else {
8117
- element.className = newValue;
8026
+ renderer.setAttribute(element, 'class', newValue);
8118
8027
  }
8119
8028
  ngDevMode && ngDevMode.rendererSetClassName++;
8120
8029
  }
@@ -8164,7 +8073,7 @@ function classIndexOf(className, classToSearch, startingIndex) {
8164
8073
  * Use of this source code is governed by an MIT-style license that can be
8165
8074
  * found in the LICENSE file at https://angular.io/license
8166
8075
  */
8167
- const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3;
8076
+ const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4;
8168
8077
  const NG_TEMPLATE_SELECTOR = 'ng-template';
8169
8078
  /**
8170
8079
  * Search the `TAttributes` to see if it contains `cssClassToMatch` (case insensitive)
@@ -9804,7 +9713,7 @@ class ReflectiveKey {
9804
9713
  this.token = token;
9805
9714
  this.id = id;
9806
9715
  if (!token) {
9807
- throw new Error('Token must be defined!');
9716
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
9808
9717
  }
9809
9718
  this.displayName = stringify(this.token);
9810
9719
  }
@@ -11495,6 +11404,13 @@ class LContainerDebug {
11495
11404
  }
11496
11405
  }
11497
11406
 
11407
+ /**
11408
+ * @license
11409
+ * Copyright Google LLC All Rights Reserved.
11410
+ *
11411
+ * Use of this source code is governed by an MIT-style license that can be
11412
+ * found in the LICENSE file at https://angular.io/license
11413
+ */
11498
11414
  /**
11499
11415
  * A permanent marker promise which signifies that the current CD tree is
11500
11416
  * clean.
@@ -11562,7 +11478,7 @@ function refreshChildComponents(hostLView, components) {
11562
11478
  /** Renders child components in the current view (creation mode). */
11563
11479
  function renderChildComponents(hostLView, components) {
11564
11480
  for (let i = 0; i < components.length; i++) {
11565
- renderComponent$1(hostLView, components[i]);
11481
+ renderComponent(hostLView, components[i]);
11566
11482
  }
11567
11483
  }
11568
11484
  function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
@@ -12080,16 +11996,6 @@ function createViewBlueprint(bindingStartIndex, initialViewLength) {
12080
11996
  function createError(text, token) {
12081
11997
  return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
12082
11998
  }
12083
- function assertHostNodeExists(rElement, elementOrSelector) {
12084
- if (!rElement) {
12085
- if (typeof elementOrSelector === 'string') {
12086
- throw createError('Host node with selector not found:', elementOrSelector);
12087
- }
12088
- else {
12089
- throw createError('Host node is required:', elementOrSelector);
12090
- }
12091
- }
12092
- }
12093
11999
  /**
12094
12000
  * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
12095
12001
  *
@@ -12098,21 +12004,9 @@ function assertHostNodeExists(rElement, elementOrSelector) {
12098
12004
  * @param encapsulation View Encapsulation defined for component that requests host element.
12099
12005
  */
12100
12006
  function locateHostElement(renderer, elementOrSelector, encapsulation) {
12101
- if (isProceduralRenderer(renderer)) {
12102
- // When using native Shadow DOM, do not clear host element to allow native slot projection
12103
- const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12104
- return renderer.selectRootElement(elementOrSelector, preserveContent);
12105
- }
12106
- let rElement = typeof elementOrSelector === 'string' ?
12107
- renderer.querySelector(elementOrSelector) :
12108
- elementOrSelector;
12109
- ngDevMode && assertHostNodeExists(rElement, elementOrSelector);
12110
- // Always clear host element's content when Renderer3 is in use. For procedural renderer case we
12111
- // make it depend on whether ShadowDom encapsulation is used (in which case the content should be
12112
- // preserved to allow native slot projection). ShadowDom encapsulation requires procedural
12113
- // renderer, and procedural renderer case is handled above.
12114
- rElement.textContent = '';
12115
- return rElement;
12007
+ // When using native Shadow DOM, do not clear host element to allow native slot projection
12008
+ const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12009
+ return renderer.selectRootElement(elementOrSelector, preserveContent);
12116
12010
  }
12117
12011
  /**
12118
12012
  * Saves context for this cleanup function in LView.cleanupInstances.
@@ -12327,13 +12221,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12327
12221
  // It is assumed that the sanitizer is only added when the compiler determines that the
12328
12222
  // property is risky, so sanitization can be done without further checks.
12329
12223
  value = sanitizer != null ? sanitizer(value, tNode.value || '', propName) : value;
12330
- if (isProceduralRenderer(renderer)) {
12331
- renderer.setProperty(element, propName, value);
12332
- }
12333
- else if (!isAnimationProp(propName)) {
12334
- element.setProperty ? element.setProperty(propName, value) :
12335
- element[propName] = value;
12336
- }
12224
+ renderer.setProperty(element, propName, value);
12337
12225
  }
12338
12226
  else if (tNode.type & 12 /* TNodeType.AnyContainer */) {
12339
12227
  // If the node is a container and the property didn't
@@ -12357,23 +12245,15 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
12357
12245
  const debugValue = normalizeDebugBindingValue(value);
12358
12246
  if (type & 3 /* TNodeType.AnyRNode */) {
12359
12247
  if (value == null) {
12360
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, attrName) :
12361
- element.removeAttribute(attrName);
12248
+ renderer.removeAttribute(element, attrName);
12362
12249
  }
12363
12250
  else {
12364
- isProceduralRenderer(renderer) ?
12365
- renderer.setAttribute(element, attrName, debugValue) :
12366
- element.setAttribute(attrName, debugValue);
12251
+ renderer.setAttribute(element, attrName, debugValue);
12367
12252
  }
12368
12253
  }
12369
12254
  else {
12370
12255
  const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
12371
- if (isProceduralRenderer(renderer)) {
12372
- renderer.setValue(element, textContent);
12373
- }
12374
- else {
12375
- element.textContent = textContent;
12376
- }
12256
+ renderer.setValue(element, textContent);
12377
12257
  }
12378
12258
  }
12379
12259
  function setNgReflectProperties(lView, element, type, dataValue, value) {
@@ -12727,19 +12607,12 @@ function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespac
12727
12607
  function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) {
12728
12608
  if (value == null) {
12729
12609
  ngDevMode && ngDevMode.rendererRemoveAttribute++;
12730
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) :
12731
- element.removeAttribute(name);
12610
+ renderer.removeAttribute(element, name, namespace);
12732
12611
  }
12733
12612
  else {
12734
12613
  ngDevMode && ngDevMode.rendererSetAttribute++;
12735
12614
  const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || '', name);
12736
- if (isProceduralRenderer(renderer)) {
12737
- renderer.setAttribute(element, name, strValue, namespace);
12738
- }
12739
- else {
12740
- namespace ? element.setAttributeNS(namespace, name, strValue) :
12741
- element.setAttribute(name, strValue);
12742
- }
12615
+ renderer.setAttribute(element, name, strValue, namespace);
12743
12616
  }
12744
12617
  }
12745
12618
  /**
@@ -12831,7 +12704,6 @@ const LContainerArray = class LContainer extends Array {
12831
12704
  */
12832
12705
  function createLContainer(hostNative, currentView, native, tNode) {
12833
12706
  ngDevMode && assertLView(currentView);
12834
- ngDevMode && !isProceduralRenderer(currentView[RENDERER]) && assertDomNode(native);
12835
12707
  // https://jsperf.com/array-literal-vs-new-array-really
12836
12708
  const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative, // host native
12837
12709
  true, // Boolean `true` in this position signifies that this is an `LContainer`
@@ -12947,7 +12819,7 @@ function refreshContainsDirtyView(lView) {
12947
12819
  }
12948
12820
  }
12949
12821
  }
12950
- function renderComponent$1(hostLView, componentHostIdx) {
12822
+ function renderComponent(hostLView, componentHostIdx) {
12951
12823
  ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
12952
12824
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
12953
12825
  const componentTView = componentView[TVIEW];
@@ -13299,457 +13171,474 @@ function computeStaticStyling(tNode, attrs, writeToHost) {
13299
13171
  * Use of this source code is governed by an MIT-style license that can be
13300
13172
  * found in the LICENSE file at https://angular.io/license
13301
13173
  */
13174
+ // TODO: A hack to not pull in the NullInjector from @angular/core.
13175
+ const NULL_INJECTOR = {
13176
+ get: (token, notFoundValue) => {
13177
+ throwProviderNotFoundError(token, 'NullInjector');
13178
+ }
13179
+ };
13302
13180
  /**
13303
- * Synchronously perform change detection on a component (and possibly its sub-components).
13181
+ * Creates the root component view and the root component node.
13304
13182
  *
13305
- * This function triggers change detection in a synchronous way on a component.
13183
+ * @param rNode Render host element.
13184
+ * @param def ComponentDef
13185
+ * @param rootView The parent view where the host node is stored
13186
+ * @param rendererFactory Factory to be used for creating child renderers.
13187
+ * @param hostRenderer The current renderer
13188
+ * @param sanitizer The sanitizer, if provided
13306
13189
  *
13307
- * @param component The component which the change detection should be performed on.
13190
+ * @returns Component view created
13308
13191
  */
13309
- function detectChanges(component) {
13310
- const view = getComponentViewByInstance(component);
13311
- detectChangesInternal(view[TVIEW], view, component);
13192
+ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13193
+ const tView = rootView[TVIEW];
13194
+ const index = HEADER_OFFSET;
13195
+ ngDevMode && assertIndexInRange(rootView, index);
13196
+ rootView[index] = rNode;
13197
+ // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13198
+ // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13199
+ // representing a host element.
13200
+ const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13201
+ const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13202
+ if (mergedAttrs !== null) {
13203
+ computeStaticStyling(tNode, mergedAttrs, true);
13204
+ if (rNode !== null) {
13205
+ setUpAttributes(hostRenderer, rNode, mergedAttrs);
13206
+ if (tNode.classes !== null) {
13207
+ writeDirectClass(hostRenderer, rNode, tNode.classes);
13208
+ }
13209
+ if (tNode.styles !== null) {
13210
+ writeDirectStyle(hostRenderer, rNode, tNode.styles);
13211
+ }
13212
+ }
13213
+ }
13214
+ const viewRenderer = rendererFactory.createRenderer(rNode, def);
13215
+ const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13216
+ if (tView.firstCreatePass) {
13217
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13218
+ markAsComponentHost(tView, tNode);
13219
+ initTNodeFlags(tNode, rootView.length, 1);
13220
+ }
13221
+ addToViewTree(rootView, componentView);
13222
+ // Store component view at node index, with node as the HOST
13223
+ return rootView[index] = componentView;
13312
13224
  }
13313
13225
  /**
13314
- * Marks the component as dirty (needing change detection). Marking a component dirty will
13315
- * schedule a change detection on it at some point in the future.
13316
- *
13317
- * Marking an already dirty component as dirty won't do anything. Only one outstanding change
13318
- * detection can be scheduled per component tree.
13319
- *
13320
- * @param component Component to mark as dirty.
13226
+ * Creates a root component and sets it up with features and host bindings. Shared by
13227
+ * renderComponent() and ViewContainerRef.createComponent().
13321
13228
  */
13322
- function markDirty(component) {
13323
- ngDevMode && assertDefined(component, 'component');
13324
- const rootView = markViewDirty(getComponentViewByInstance(component));
13325
- ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
13326
- scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
13229
+ function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13230
+ const tView = rootLView[TVIEW];
13231
+ // Create directive instance with factory() and store at next index in viewData
13232
+ const component = instantiateRootComponent(tView, rootLView, componentDef);
13233
+ rootContext.components.push(component);
13234
+ componentView[CONTEXT] = component;
13235
+ if (hostFeatures !== null) {
13236
+ for (const feature of hostFeatures) {
13237
+ feature(component, componentDef);
13238
+ }
13239
+ }
13240
+ // We want to generate an empty QueryList for root content queries for backwards
13241
+ // compatibility with ViewEngine.
13242
+ if (componentDef.contentQueries) {
13243
+ const tNode = getCurrentTNode();
13244
+ ngDevMode && assertDefined(tNode, 'TNode expected');
13245
+ componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13246
+ }
13247
+ const rootTNode = getCurrentTNode();
13248
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13249
+ if (tView.firstCreatePass &&
13250
+ (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13251
+ setSelectedIndex(rootTNode.index);
13252
+ const rootTView = rootLView[TVIEW];
13253
+ registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13254
+ invokeHostBindingsInCreationMode(componentDef, component);
13255
+ }
13256
+ return component;
13257
+ }
13258
+ function createRootContext(scheduler, playerHandler) {
13259
+ return {
13260
+ components: [],
13261
+ scheduler: scheduler || defaultScheduler,
13262
+ clean: CLEAN_PROMISE,
13263
+ playerHandler: playerHandler || null,
13264
+ flags: 0 /* RootContextFlags.Empty */
13265
+ };
13327
13266
  }
13328
13267
  /**
13329
- * Used to perform change detection on the whole application.
13268
+ * Used to enable lifecycle hooks on the root component.
13330
13269
  *
13331
- * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick`
13332
- * executes lifecycle hooks and conditionally checks components based on their
13333
- * `ChangeDetectionStrategy` and dirtiness.
13270
+ * Include this feature when calling `renderComponent` if the root component
13271
+ * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
13272
+ * be called properly.
13334
13273
  *
13335
- * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally
13336
- * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a
13337
- * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can
13338
- * be changed when calling `renderComponent` and providing the `scheduler` option.
13339
- */
13340
- function tick(component) {
13341
- const rootView = getRootView(component);
13342
- const rootContext = rootView[CONTEXT];
13343
- tickRootContext(rootContext);
13344
- }
13345
-
13346
- /**
13347
- * @license
13348
- * Copyright Google LLC All Rights Reserved.
13274
+ * Example:
13349
13275
  *
13350
- * Use of this source code is governed by an MIT-style license that can be
13351
- * found in the LICENSE file at https://angular.io/license
13276
+ * ```
13277
+ * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13278
+ * ```
13352
13279
  */
13280
+ function LifecycleHooksFeature() {
13281
+ const tNode = getCurrentTNode();
13282
+ ngDevMode && assertDefined(tNode, 'TNode is required');
13283
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13284
+ }
13353
13285
  /**
13354
- * Retrieves the component instance associated with a given DOM element.
13286
+ * Wait on component until it is rendered.
13355
13287
  *
13356
- * @usageNotes
13357
- * Given the following DOM structure:
13288
+ * This function returns a `Promise` which is resolved when the component's
13289
+ * change detection is executed. This is determined by finding the scheduler
13290
+ * associated with the `component`'s render tree and waiting until the scheduler
13291
+ * flushes. If nothing is scheduled, the function returns a resolved promise.
13358
13292
  *
13359
- * ```html
13360
- * <app-root>
13361
- * <div>
13362
- * <child-comp></child-comp>
13363
- * </div>
13364
- * </app-root>
13293
+ * Example:
13294
+ * ```
13295
+ * await whenRendered(myComponent);
13365
13296
  * ```
13366
13297
  *
13367
- * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
13368
- * associated with this DOM element.
13369
- *
13370
- * Calling the function on `<app-root>` will return the `MyApp` instance.
13371
- *
13372
- *
13373
- * @param element DOM element from which the component should be retrieved.
13374
- * @returns Component instance associated with the element or `null` if there
13375
- * is no component associated with it.
13376
- *
13377
- * @publicApi
13378
- * @globalApi ng
13298
+ * @param component Component to wait upon
13299
+ * @returns Promise which resolves when the component is rendered.
13379
13300
  */
13380
- function getComponent$1(element) {
13381
- ngDevMode && assertDomElement(element);
13382
- const context = getLContext(element);
13383
- if (context === null)
13384
- return null;
13385
- if (context.component === undefined) {
13386
- const lView = context.lView;
13387
- if (lView === null) {
13388
- return null;
13389
- }
13390
- context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
13391
- }
13392
- return context.component;
13301
+ function whenRendered(component) {
13302
+ return getRootContext(component).clean;
13393
13303
  }
13304
+
13394
13305
  /**
13395
- * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
13396
- * view that the element is part of. Otherwise retrieves the instance of the component whose view
13397
- * owns the element (in this case, the result is the same as calling `getOwningComponent`).
13398
- *
13399
- * @param element Element for which to get the surrounding component instance.
13400
- * @returns Instance of the component that is around the element or null if the element isn't
13401
- * inside any component.
13306
+ * @license
13307
+ * Copyright Google LLC All Rights Reserved.
13402
13308
  *
13403
- * @publicApi
13404
- * @globalApi ng
13309
+ * Use of this source code is governed by an MIT-style license that can be
13310
+ * found in the LICENSE file at https://angular.io/license
13405
13311
  */
13406
- function getContext(element) {
13407
- assertDomElement(element);
13408
- const context = getLContext(element);
13409
- const lView = context ? context.lView : null;
13410
- return lView === null ? null : lView[CONTEXT];
13312
+ function getSuperType(type) {
13313
+ return Object.getPrototypeOf(type.prototype).constructor;
13411
13314
  }
13412
13315
  /**
13413
- * Retrieves the component instance whose view contains the DOM element.
13414
- *
13415
- * For example, if `<child-comp>` is used in the template of `<app-comp>`
13416
- * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
13417
- * would return `<app-comp>`.
13418
- *
13419
- * @param elementOrDir DOM element, component or directive instance
13420
- * for which to retrieve the root components.
13421
- * @returns Component instance whose view owns the DOM element or null if the element is not
13422
- * part of a component view.
13316
+ * Merges the definition from a super class to a sub class.
13317
+ * @param definition The definition that is a SubClass of another directive of component
13423
13318
  *
13424
- * @publicApi
13425
- * @globalApi ng
13319
+ * @codeGenApi
13426
13320
  */
13427
- function getOwningComponent(elementOrDir) {
13428
- const context = getLContext(elementOrDir);
13429
- let lView = context ? context.lView : null;
13430
- if (lView === null)
13431
- return null;
13432
- let parent;
13433
- while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
13434
- lView = parent;
13321
+ function ɵɵInheritDefinitionFeature(definition) {
13322
+ let superType = getSuperType(definition.type);
13323
+ let shouldInheritFields = true;
13324
+ const inheritanceChain = [definition];
13325
+ while (superType) {
13326
+ let superDef = undefined;
13327
+ if (isComponentDef(definition)) {
13328
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13329
+ superDef = superType.ɵcmp || superType.ɵdir;
13330
+ }
13331
+ else {
13332
+ if (superType.ɵcmp) {
13333
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
13334
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
13335
+ }
13336
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13337
+ superDef = superType.ɵdir;
13338
+ }
13339
+ if (superDef) {
13340
+ if (shouldInheritFields) {
13341
+ inheritanceChain.push(superDef);
13342
+ // Some fields in the definition may be empty, if there were no values to put in them that
13343
+ // would've justified object creation. Unwrap them if necessary.
13344
+ const writeableDef = definition;
13345
+ writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
13346
+ writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
13347
+ writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
13348
+ // Merge hostBindings
13349
+ const superHostBindings = superDef.hostBindings;
13350
+ superHostBindings && inheritHostBindings(definition, superHostBindings);
13351
+ // Merge queries
13352
+ const superViewQuery = superDef.viewQuery;
13353
+ const superContentQueries = superDef.contentQueries;
13354
+ superViewQuery && inheritViewQuery(definition, superViewQuery);
13355
+ superContentQueries && inheritContentQueries(definition, superContentQueries);
13356
+ // Merge inputs and outputs
13357
+ fillProperties(definition.inputs, superDef.inputs);
13358
+ fillProperties(definition.declaredInputs, superDef.declaredInputs);
13359
+ fillProperties(definition.outputs, superDef.outputs);
13360
+ // Merge animations metadata.
13361
+ // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
13362
+ if (isComponentDef(superDef) && superDef.data.animation) {
13363
+ // If super def is a Component, the `definition` is also a Component, since Directives can
13364
+ // not inherit Components (we throw an error above and cannot reach this code).
13365
+ const defData = definition.data;
13366
+ defData.animation = (defData.animation || []).concat(superDef.data.animation);
13367
+ }
13368
+ }
13369
+ // Run parent features
13370
+ const features = superDef.features;
13371
+ if (features) {
13372
+ for (let i = 0; i < features.length; i++) {
13373
+ const feature = features[i];
13374
+ if (feature && feature.ngInherit) {
13375
+ feature(definition);
13376
+ }
13377
+ // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
13378
+ // def already has all the necessary information inherited from its super class(es), so we
13379
+ // can stop merging fields from super classes. However we need to iterate through the
13380
+ // prototype chain to look for classes that might contain other "features" (like
13381
+ // NgOnChanges), which we should invoke for the original `definition`. We set the
13382
+ // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
13383
+ // logic and only invoking functions from the "features" list.
13384
+ if (feature === ɵɵInheritDefinitionFeature) {
13385
+ shouldInheritFields = false;
13386
+ }
13387
+ }
13388
+ }
13389
+ }
13390
+ superType = Object.getPrototypeOf(superType);
13435
13391
  }
13436
- return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
13392
+ mergeHostAttrsAcrossInheritance(inheritanceChain);
13437
13393
  }
13438
13394
  /**
13439
- * Retrieves all root components associated with a DOM element, directive or component instance.
13440
- * Root components are those which have been bootstrapped by Angular.
13441
- *
13442
- * @param elementOrDir DOM element, component or directive instance
13443
- * for which to retrieve the root components.
13444
- * @returns Root components associated with the target object.
13395
+ * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
13445
13396
  *
13446
- * @publicApi
13447
- * @globalApi ng
13397
+ * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
13398
+ * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
13399
+ * type.
13448
13400
  */
13449
- function getRootComponents(elementOrDir) {
13450
- const lView = readPatchedLView(elementOrDir);
13451
- return lView !== null ? [...getRootContext(lView).components] : [];
13401
+ function mergeHostAttrsAcrossInheritance(inheritanceChain) {
13402
+ let hostVars = 0;
13403
+ let hostAttrs = null;
13404
+ // We process the inheritance order from the base to the leaves here.
13405
+ for (let i = inheritanceChain.length - 1; i >= 0; i--) {
13406
+ const def = inheritanceChain[i];
13407
+ // For each `hostVars`, we need to add the superclass amount.
13408
+ def.hostVars = (hostVars += def.hostVars);
13409
+ // for each `hostAttrs` we need to merge it with superclass.
13410
+ def.hostAttrs =
13411
+ mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
13412
+ }
13452
13413
  }
13453
- /**
13454
- * Retrieves an `Injector` associated with an element, component or directive instance.
13455
- *
13456
- * @param elementOrDir DOM element, component or directive instance for which to
13457
- * retrieve the injector.
13458
- * @returns Injector associated with the element, component or directive instance.
13459
- *
13460
- * @publicApi
13461
- * @globalApi ng
13462
- */
13463
- function getInjector(elementOrDir) {
13464
- const context = getLContext(elementOrDir);
13465
- const lView = context ? context.lView : null;
13466
- if (lView === null)
13467
- return Injector.NULL;
13468
- const tNode = lView[TVIEW].data[context.nodeIndex];
13469
- return new NodeInjector(tNode, lView);
13470
- }
13471
- /**
13472
- * Retrieve a set of injection tokens at a given DOM node.
13473
- *
13474
- * @param element Element for which the injection tokens should be retrieved.
13475
- */
13476
- function getInjectionTokens(element) {
13477
- const context = getLContext(element);
13478
- const lView = context ? context.lView : null;
13479
- if (lView === null)
13480
- return [];
13481
- const tView = lView[TVIEW];
13482
- const tNode = tView.data[context.nodeIndex];
13483
- const providerTokens = [];
13484
- const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
13485
- const endIndex = tNode.directiveEnd;
13486
- for (let i = startIndex; i < endIndex; i++) {
13487
- let value = tView.data[i];
13488
- if (isDirectiveDefHack(value)) {
13489
- // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
13490
- // design flaw. We should always store same type so that we can be monomorphic. The issue
13491
- // is that for Components/Directives we store the def instead the type. The correct behavior
13492
- // is that we should always be storing injectable type in this location.
13493
- value = value.type;
13494
- }
13495
- providerTokens.push(value);
13414
+ function maybeUnwrapEmpty(value) {
13415
+ if (value === EMPTY_OBJ) {
13416
+ return {};
13496
13417
  }
13497
- return providerTokens;
13498
- }
13499
- /**
13500
- * Retrieves directive instances associated with a given DOM node. Does not include
13501
- * component instances.
13502
- *
13503
- * @usageNotes
13504
- * Given the following DOM structure:
13505
- *
13506
- * ```html
13507
- * <app-root>
13508
- * <button my-button></button>
13509
- * <my-comp></my-comp>
13510
- * </app-root>
13511
- * ```
13512
- *
13513
- * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
13514
- * directive that is associated with the DOM node.
13515
- *
13516
- * Calling `getDirectives` on `<my-comp>` will return an empty array.
13517
- *
13518
- * @param node DOM node for which to get the directives.
13519
- * @returns Array of directives associated with the node.
13520
- *
13521
- * @publicApi
13522
- * @globalApi ng
13523
- */
13524
- function getDirectives(node) {
13525
- // Skip text nodes because we can't have directives associated with them.
13526
- if (node instanceof Text) {
13418
+ else if (value === EMPTY_ARRAY) {
13527
13419
  return [];
13528
13420
  }
13529
- const context = getLContext(node);
13530
- const lView = context ? context.lView : null;
13531
- if (lView === null) {
13532
- return [];
13421
+ else {
13422
+ return value;
13533
13423
  }
13534
- const tView = lView[TVIEW];
13535
- const nodeIndex = context.nodeIndex;
13536
- if (!(tView === null || tView === void 0 ? void 0 : tView.data[nodeIndex])) {
13537
- return [];
13424
+ }
13425
+ function inheritViewQuery(definition, superViewQuery) {
13426
+ const prevViewQuery = definition.viewQuery;
13427
+ if (prevViewQuery) {
13428
+ definition.viewQuery = (rf, ctx) => {
13429
+ superViewQuery(rf, ctx);
13430
+ prevViewQuery(rf, ctx);
13431
+ };
13538
13432
  }
13539
- if (context.directives === undefined) {
13540
- context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
13433
+ else {
13434
+ definition.viewQuery = superViewQuery;
13541
13435
  }
13542
- // The `directives` in this case are a named array called `LComponentView`. Clone the
13543
- // result so we don't expose an internal data structure in the user's console.
13544
- return context.directives === null ? [] : [...context.directives];
13545
13436
  }
13546
- /**
13547
- * Returns the debug (partial) metadata for a particular directive or component instance.
13548
- * The function accepts an instance of a directive or component and returns the corresponding
13549
- * metadata.
13550
- *
13551
- * @param directiveOrComponentInstance Instance of a directive or component
13552
- * @returns metadata of the passed directive or component
13553
- *
13554
- * @publicApi
13555
- * @globalApi ng
13556
- */
13557
- function getDirectiveMetadata$1(directiveOrComponentInstance) {
13558
- const { constructor } = directiveOrComponentInstance;
13559
- if (!constructor) {
13560
- throw new Error('Unable to find the instance constructor');
13437
+ function inheritContentQueries(definition, superContentQueries) {
13438
+ const prevContentQueries = definition.contentQueries;
13439
+ if (prevContentQueries) {
13440
+ definition.contentQueries = (rf, ctx, directiveIndex) => {
13441
+ superContentQueries(rf, ctx, directiveIndex);
13442
+ prevContentQueries(rf, ctx, directiveIndex);
13443
+ };
13561
13444
  }
13562
- // In case a component inherits from a directive, we may have component and directive metadata
13563
- // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
13564
- const componentDef = getComponentDef(constructor);
13565
- if (componentDef) {
13566
- return {
13567
- inputs: componentDef.inputs,
13568
- outputs: componentDef.outputs,
13569
- encapsulation: componentDef.encapsulation,
13570
- changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
13571
- ChangeDetectionStrategy.Default
13445
+ else {
13446
+ definition.contentQueries = superContentQueries;
13447
+ }
13448
+ }
13449
+ function inheritHostBindings(definition, superHostBindings) {
13450
+ const prevHostBindings = definition.hostBindings;
13451
+ if (prevHostBindings) {
13452
+ definition.hostBindings = (rf, ctx) => {
13453
+ superHostBindings(rf, ctx);
13454
+ prevHostBindings(rf, ctx);
13572
13455
  };
13573
13456
  }
13574
- const directiveDef = getDirectiveDef(constructor);
13575
- if (directiveDef) {
13576
- return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
13457
+ else {
13458
+ definition.hostBindings = superHostBindings;
13577
13459
  }
13578
- return null;
13579
13460
  }
13461
+
13580
13462
  /**
13581
- * Retrieve map of local references.
13582
- *
13583
- * The references are retrieved as a map of local reference name to element or directive instance.
13463
+ * @license
13464
+ * Copyright Google LLC All Rights Reserved.
13584
13465
  *
13585
- * @param target DOM element, component or directive instance for which to retrieve
13586
- * the local references.
13466
+ * Use of this source code is governed by an MIT-style license that can be
13467
+ * found in the LICENSE file at https://angular.io/license
13587
13468
  */
13588
- function getLocalRefs(target) {
13589
- const context = getLContext(target);
13590
- if (context === null)
13591
- return {};
13592
- if (context.localRefs === undefined) {
13593
- const lView = context.lView;
13594
- if (lView === null) {
13595
- return {};
13596
- }
13597
- context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
13598
- }
13599
- return context.localRefs || {};
13600
- }
13601
13469
  /**
13602
- * Retrieves the host element of a component or directive instance.
13603
- * The host element is the DOM element that matched the selector of the directive.
13604
- *
13605
- * @param componentOrDirective Component or directive instance for which the host
13606
- * element should be retrieved.
13607
- * @returns Host element of the target.
13608
- *
13609
- * @publicApi
13610
- * @globalApi ng
13470
+ * Fields which exist on either directive or component definitions, and need to be copied from
13471
+ * parent to child classes by the `ɵɵCopyDefinitionFeature`.
13611
13472
  */
13612
- function getHostElement(componentOrDirective) {
13613
- return getLContext(componentOrDirective).native;
13614
- }
13473
+ const COPY_DIRECTIVE_FIELDS = [
13474
+ // The child class should use the providers of its parent.
13475
+ 'providersResolver',
13476
+ // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
13477
+ // as inputs, outputs, and host binding functions.
13478
+ ];
13615
13479
  /**
13616
- * Retrieves the rendered text for a given component.
13617
- *
13618
- * This function retrieves the host element of a component and
13619
- * and then returns the `textContent` for that element. This implies
13620
- * that the text returned will include re-projected content of
13621
- * the component as well.
13480
+ * Fields which exist only on component definitions, and need to be copied from parent to child
13481
+ * classes by the `ɵɵCopyDefinitionFeature`.
13622
13482
  *
13623
- * @param component The component to return the content text for.
13483
+ * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
13484
+ * since those should go in `COPY_DIRECTIVE_FIELDS` above.
13624
13485
  */
13625
- function getRenderedText(component) {
13626
- const hostElement = getHostElement(component);
13627
- return hostElement.textContent || '';
13628
- }
13486
+ const COPY_COMPONENT_FIELDS = [
13487
+ // The child class should use the template function of its parent, including all template
13488
+ // semantics.
13489
+ 'template',
13490
+ 'decls',
13491
+ 'consts',
13492
+ 'vars',
13493
+ 'onPush',
13494
+ 'ngContentSelectors',
13495
+ // The child class should use the CSS styles of its parent, including all styling semantics.
13496
+ 'styles',
13497
+ 'encapsulation',
13498
+ // The child class should be checked by the runtime in the same way as its parent.
13499
+ 'schemas',
13500
+ ];
13629
13501
  /**
13630
- * Retrieves a list of event listeners associated with a DOM element. The list does include host
13631
- * listeners, but it does not include event listeners defined outside of the Angular context
13632
- * (e.g. through `addEventListener`).
13633
- *
13634
- * @usageNotes
13635
- * Given the following DOM structure:
13636
- *
13637
- * ```html
13638
- * <app-root>
13639
- * <div (click)="doSomething()"></div>
13640
- * </app-root>
13641
- * ```
13502
+ * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
13503
+ * definition.
13642
13504
  *
13643
- * Calling `getListeners` on `<div>` will return an object that looks as follows:
13505
+ * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
13506
+ * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
13507
+ * generates a skeleton definition on the child class, and applies this feature.
13644
13508
  *
13645
- * ```ts
13646
- * {
13647
- * name: 'click',
13648
- * element: <div>,
13649
- * callback: () => doSomething(),
13650
- * useCapture: false
13651
- * }
13652
- * ```
13509
+ * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
13510
+ * including things like the component template function.
13653
13511
  *
13654
- * @param element Element for which the DOM listeners should be retrieved.
13655
- * @returns Array of event listeners on the DOM element.
13512
+ * @param definition The definition of a child class which inherits from a parent class with its
13513
+ * own definition.
13656
13514
  *
13657
- * @publicApi
13658
- * @globalApi ng
13515
+ * @codeGenApi
13659
13516
  */
13660
- function getListeners(element) {
13661
- ngDevMode && assertDomElement(element);
13662
- const lContext = getLContext(element);
13663
- const lView = lContext === null ? null : lContext.lView;
13664
- if (lView === null)
13665
- return [];
13666
- const tView = lView[TVIEW];
13667
- const lCleanup = lView[CLEANUP];
13668
- const tCleanup = tView.cleanup;
13669
- const listeners = [];
13670
- if (tCleanup && lCleanup) {
13671
- for (let i = 0; i < tCleanup.length;) {
13672
- const firstParam = tCleanup[i++];
13673
- const secondParam = tCleanup[i++];
13674
- if (typeof firstParam === 'string') {
13675
- const name = firstParam;
13676
- const listenerElement = unwrapRNode(lView[secondParam]);
13677
- const callback = lCleanup[tCleanup[i++]];
13678
- const useCaptureOrIndx = tCleanup[i++];
13679
- // if useCaptureOrIndx is boolean then report it as is.
13680
- // if useCaptureOrIndx is positive number then it in unsubscribe method
13681
- // if useCaptureOrIndx is negative number then it is a Subscription
13682
- const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
13683
- const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
13684
- if (element == listenerElement) {
13685
- listeners.push({ element, name, callback, useCapture, type });
13686
- }
13687
- }
13517
+ function ɵɵCopyDefinitionFeature(definition) {
13518
+ let superType = getSuperType(definition.type);
13519
+ let superDef = undefined;
13520
+ if (isComponentDef(definition)) {
13521
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13522
+ superDef = superType.ɵcmp;
13523
+ }
13524
+ else {
13525
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13526
+ superDef = superType.ɵdir;
13527
+ }
13528
+ // Needed because `definition` fields are readonly.
13529
+ const defAny = definition;
13530
+ // Copy over any fields that apply to either directives or components.
13531
+ for (const field of COPY_DIRECTIVE_FIELDS) {
13532
+ defAny[field] = superDef[field];
13533
+ }
13534
+ if (isComponentDef(superDef)) {
13535
+ // Copy over any component-specific fields.
13536
+ for (const field of COPY_COMPONENT_FIELDS) {
13537
+ defAny[field] = superDef[field];
13688
13538
  }
13689
13539
  }
13690
- listeners.sort(sortListeners);
13691
- return listeners;
13692
- }
13693
- function sortListeners(a, b) {
13694
- if (a.name == b.name)
13695
- return 0;
13696
- return a.name < b.name ? -1 : 1;
13697
13540
  }
13541
+
13698
13542
  /**
13699
- * This function should not exist because it is megamorphic and only mostly correct.
13543
+ * @license
13544
+ * Copyright Google LLC All Rights Reserved.
13700
13545
  *
13701
- * See call site for more info.
13546
+ * Use of this source code is governed by an MIT-style license that can be
13547
+ * found in the LICENSE file at https://angular.io/license
13702
13548
  */
13703
- function isDirectiveDefHack(obj) {
13704
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
13549
+ let _symbolIterator = null;
13550
+ function getSymbolIterator() {
13551
+ if (!_symbolIterator) {
13552
+ const Symbol = _global['Symbol'];
13553
+ if (Symbol && Symbol.iterator) {
13554
+ _symbolIterator = Symbol.iterator;
13555
+ }
13556
+ else {
13557
+ // es6-shim specific logic
13558
+ const keys = Object.getOwnPropertyNames(Map.prototype);
13559
+ for (let i = 0; i < keys.length; ++i) {
13560
+ const key = keys[i];
13561
+ if (key !== 'entries' && key !== 'size' &&
13562
+ Map.prototype[key] === Map.prototype['entries']) {
13563
+ _symbolIterator = key;
13564
+ }
13565
+ }
13566
+ }
13567
+ }
13568
+ return _symbolIterator;
13705
13569
  }
13570
+
13706
13571
  /**
13707
- * Returns the attached `DebugNode` instance for an element in the DOM.
13572
+ * @license
13573
+ * Copyright Google LLC All Rights Reserved.
13708
13574
  *
13709
- * @param element DOM element which is owned by an existing component's view.
13575
+ * Use of this source code is governed by an MIT-style license that can be
13576
+ * found in the LICENSE file at https://angular.io/license
13710
13577
  */
13711
- function getDebugNode$1(element) {
13712
- if (ngDevMode && !(element instanceof Node)) {
13713
- throw new Error('Expecting instance of DOM Element');
13578
+ function isIterable(obj) {
13579
+ return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
13580
+ }
13581
+ function isListLikeIterable(obj) {
13582
+ if (!isJsObject(obj))
13583
+ return false;
13584
+ return Array.isArray(obj) ||
13585
+ (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
13586
+ getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
13587
+ }
13588
+ function areIterablesEqual(a, b, comparator) {
13589
+ const iterator1 = a[getSymbolIterator()]();
13590
+ const iterator2 = b[getSymbolIterator()]();
13591
+ while (true) {
13592
+ const item1 = iterator1.next();
13593
+ const item2 = iterator2.next();
13594
+ if (item1.done && item2.done)
13595
+ return true;
13596
+ if (item1.done || item2.done)
13597
+ return false;
13598
+ if (!comparator(item1.value, item2.value))
13599
+ return false;
13714
13600
  }
13715
- const lContext = getLContext(element);
13716
- const lView = lContext ? lContext.lView : null;
13717
- if (lView === null) {
13718
- return null;
13601
+ }
13602
+ function iterateListLike(obj, fn) {
13603
+ if (Array.isArray(obj)) {
13604
+ for (let i = 0; i < obj.length; i++) {
13605
+ fn(obj[i]);
13606
+ }
13719
13607
  }
13720
- const nodeIndex = lContext.nodeIndex;
13721
- if (nodeIndex !== -1) {
13722
- const valueInLView = lView[nodeIndex];
13723
- // this means that value in the lView is a component with its own
13724
- // data. In this situation the TNode is not accessed at the same spot.
13725
- const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
13726
- ngDevMode &&
13727
- assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
13728
- return buildDebugNode(tNode, lView);
13608
+ else {
13609
+ const iterator = obj[getSymbolIterator()]();
13610
+ let item;
13611
+ while (!((item = iterator.next()).done)) {
13612
+ fn(item.value);
13613
+ }
13729
13614
  }
13730
- return null;
13731
13615
  }
13616
+ function isJsObject(o) {
13617
+ return o !== null && (typeof o === 'function' || typeof o === 'object');
13618
+ }
13619
+
13732
13620
  /**
13733
- * Retrieve the component `LView` from component/element.
13734
- *
13735
- * NOTE: `LView` is a private and should not be leaked outside.
13736
- * Don't export this method to `ng.*` on window.
13621
+ * @license
13622
+ * Copyright Google LLC All Rights Reserved.
13737
13623
  *
13738
- * @param target DOM element or component instance for which to retrieve the LView.
13624
+ * Use of this source code is governed by an MIT-style license that can be
13625
+ * found in the LICENSE file at https://angular.io/license
13739
13626
  */
13740
- function getComponentLView(target) {
13741
- const lContext = getLContext(target);
13742
- const nodeIndx = lContext.nodeIndex;
13743
- const lView = lContext.lView;
13744
- ngDevMode && assertLView(lView);
13745
- const componentLView = lView[nodeIndx];
13746
- ngDevMode && assertLView(componentLView);
13747
- return componentLView;
13748
- }
13749
- /** Asserts that a value is a DOM Element. */
13750
- function assertDomElement(value) {
13751
- if (typeof Element !== 'undefined' && !(value instanceof Element)) {
13752
- throw new Error('Expecting instance of DOM Element');
13627
+ function devModeEqual(a, b) {
13628
+ const isListLikeIterableA = isListLikeIterable(a);
13629
+ const isListLikeIterableB = isListLikeIterable(b);
13630
+ if (isListLikeIterableA && isListLikeIterableB) {
13631
+ return areIterablesEqual(a, b, devModeEqual);
13632
+ }
13633
+ else {
13634
+ const isAObject = a && (typeof a === 'object' || typeof a === 'function');
13635
+ const isBObject = b && (typeof b === 'object' || typeof b === 'function');
13636
+ if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
13637
+ return true;
13638
+ }
13639
+ else {
13640
+ return Object.is(a, b);
13641
+ }
13753
13642
  }
13754
13643
  }
13755
13644
 
@@ -13760,18 +13649,72 @@ function assertDomElement(value) {
13760
13649
  * Use of this source code is governed by an MIT-style license that can be
13761
13650
  * found in the LICENSE file at https://angular.io/license
13762
13651
  */
13652
+ // TODO(misko): consider inlining
13653
+ /** Updates binding and returns the value. */
13654
+ function updateBinding(lView, bindingIndex, value) {
13655
+ return lView[bindingIndex] = value;
13656
+ }
13657
+ /** Gets the current binding value. */
13658
+ function getBinding(lView, bindingIndex) {
13659
+ ngDevMode && assertIndexInRange(lView, bindingIndex);
13660
+ ngDevMode &&
13661
+ assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
13662
+ return lView[bindingIndex];
13663
+ }
13763
13664
  /**
13764
- * Marks a component for check (in case of OnPush components) and synchronously
13765
- * performs change detection on the application this component belongs to.
13665
+ * Updates binding if changed, then returns whether it was updated.
13766
13666
  *
13767
- * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
13667
+ * This function also checks the `CheckNoChangesMode` and throws if changes are made.
13668
+ * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
13669
+ * behavior.
13768
13670
  *
13769
- * @publicApi
13770
- * @globalApi ng
13671
+ * @param lView current `LView`
13672
+ * @param bindingIndex The binding in the `LView` to check
13673
+ * @param value New value to check against `lView[bindingIndex]`
13674
+ * @returns `true` if the bindings has changed. (Throws if binding has changed during
13675
+ * `CheckNoChangesMode`)
13771
13676
  */
13772
- function applyChanges(component) {
13773
- markDirty(component);
13774
- getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
13677
+ function bindingUpdated(lView, bindingIndex, value) {
13678
+ ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
13679
+ ngDevMode &&
13680
+ assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
13681
+ const oldValue = lView[bindingIndex];
13682
+ if (Object.is(oldValue, value)) {
13683
+ return false;
13684
+ }
13685
+ else {
13686
+ if (ngDevMode && isInCheckNoChangesMode()) {
13687
+ // View engine didn't report undefined values as changed on the first checkNoChanges pass
13688
+ // (before the change detection was run).
13689
+ const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
13690
+ if (!devModeEqual(oldValueToCompare, value)) {
13691
+ const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
13692
+ throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
13693
+ }
13694
+ // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
13695
+ // For this reason we exit as if no change. The early exit is needed to prevent the changed
13696
+ // value to be written into `LView` (If we would write the new value that we would not see it
13697
+ // as change on next CD.)
13698
+ return false;
13699
+ }
13700
+ lView[bindingIndex] = value;
13701
+ return true;
13702
+ }
13703
+ }
13704
+ /** Updates 2 bindings if changed, then returns whether either was updated. */
13705
+ function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
13706
+ const different = bindingUpdated(lView, bindingIndex, exp1);
13707
+ return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
13708
+ }
13709
+ /** Updates 3 bindings if changed, then returns whether any was updated. */
13710
+ function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
13711
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13712
+ return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
13713
+ }
13714
+ /** Updates 4 bindings if changed, then returns whether any was updated. */
13715
+ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
13716
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13717
+ return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
13775
13718
  }
13776
13719
 
13777
13720
  /**
@@ -13782,68 +13725,28 @@ function applyChanges(component) {
13782
13725
  * found in the LICENSE file at https://angular.io/license
13783
13726
  */
13784
13727
  /**
13785
- * This file introduces series of globally accessible debug tools
13786
- * to allow for the Angular debugging story to function.
13728
+ * Updates the value of or removes a bound attribute on an Element.
13787
13729
  *
13788
- * To see this in action run the following command:
13730
+ * Used in the case of `[attr.title]="value"`
13789
13731
  *
13790
- * bazel run //packages/core/test/bundling/todo:devserver
13791
- *
13792
- * Then load `localhost:5432` and start using the console tools.
13793
- */
13794
- /**
13795
- * This value reflects the property on the window where the dev
13796
- * tools are patched (window.ng).
13797
- * */
13798
- const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
13799
- let _published = false;
13800
- /**
13801
- * Publishes a collection of default debug tools onto`window.ng`.
13732
+ * @param name name The name of the attribute.
13733
+ * @param value value The attribute is removed when value is `null` or `undefined`.
13734
+ * Otherwise the attribute value is set to the stringified value.
13735
+ * @param sanitizer An optional function used to sanitize the value.
13736
+ * @param namespace Optional namespace to use when setting the attribute.
13802
13737
  *
13803
- * These functions are available globally when Angular is in development
13804
- * mode and are automatically stripped away from prod mode is on.
13805
- */
13806
- function publishDefaultGlobalUtils$1() {
13807
- if (!_published) {
13808
- _published = true;
13809
- /**
13810
- * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
13811
- * The contract of the function might be changed in any release and/or the function can be
13812
- * removed completely.
13813
- */
13814
- publishGlobalUtil('ɵsetProfiler', setProfiler);
13815
- publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
13816
- publishGlobalUtil('getComponent', getComponent$1);
13817
- publishGlobalUtil('getContext', getContext);
13818
- publishGlobalUtil('getListeners', getListeners);
13819
- publishGlobalUtil('getOwningComponent', getOwningComponent);
13820
- publishGlobalUtil('getHostElement', getHostElement);
13821
- publishGlobalUtil('getInjector', getInjector);
13822
- publishGlobalUtil('getRootComponents', getRootComponents);
13823
- publishGlobalUtil('getDirectives', getDirectives);
13824
- publishGlobalUtil('applyChanges', applyChanges);
13825
- }
13826
- }
13827
- /**
13828
- * Publishes the given function to `window.ng` so that it can be
13829
- * used from the browser console when an application is not in production.
13738
+ * @codeGenApi
13830
13739
  */
13831
- function publishGlobalUtil(name, fn) {
13832
- if (typeof COMPILED === 'undefined' || !COMPILED) {
13833
- // Note: we can't export `ng` when using closure enhanced optimization as:
13834
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
13835
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
13836
- // for typings for AngularJS (via `goog.provide('ng....')`).
13837
- const w = _global;
13838
- ngDevMode && assertDefined(fn, 'function not defined');
13839
- if (w) {
13840
- let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
13841
- if (!container) {
13842
- container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
13843
- }
13844
- container[name] = fn;
13845
- }
13740
+ function ɵɵattribute(name, value, sanitizer, namespace) {
13741
+ const lView = getLView();
13742
+ const bindingIndex = nextBindingIndex();
13743
+ if (bindingUpdated(lView, bindingIndex, value)) {
13744
+ const tView = getTView();
13745
+ const tNode = getSelectedTNode();
13746
+ elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
13747
+ ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
13846
13748
  }
13749
+ return ɵɵattribute;
13847
13750
  }
13848
13751
 
13849
13752
  /**
@@ -13853,872 +13756,237 @@ function publishGlobalUtil(name, fn) {
13853
13756
  * Use of this source code is governed by an MIT-style license that can be
13854
13757
  * found in the LICENSE file at https://angular.io/license
13855
13758
  */
13856
- // TODO: A hack to not pull in the NullInjector from @angular/core.
13857
- const NULL_INJECTOR = {
13858
- get: (token, notFoundValue) => {
13859
- throwProviderNotFoundError(token, 'NullInjector');
13860
- }
13861
- };
13862
13759
  /**
13863
- * Bootstraps a Component into an existing host element and returns an instance
13864
- * of the component.
13760
+ * Create interpolation bindings with a variable number of expressions.
13761
+ *
13762
+ * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
13763
+ * Those are faster because there is no need to create an array of expressions and iterate over it.
13865
13764
  *
13866
- * Use this function to bootstrap a component into the DOM tree. Each invocation
13867
- * of this function will create a separate tree of components, injectors and
13868
- * change detection cycles and lifetimes. To dynamically insert a new component
13869
- * into an existing tree such that it shares the same injection, change detection
13870
- * and object lifetime, use {@link ViewContainer#createComponent}.
13765
+ * `values`:
13766
+ * - has static text at even indexes,
13767
+ * - has evaluated expressions at odd indexes.
13871
13768
  *
13872
- * @param componentType Component to bootstrap
13873
- * @param options Optional parameters which control bootstrapping
13769
+ * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
13874
13770
  */
13875
- function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13876
- ngDevMode && publishDefaultGlobalUtils$1();
13877
- ngDevMode && assertComponentType(componentType);
13878
- const rendererFactory = opts.rendererFactory || domRendererFactory3;
13879
- const sanitizer = opts.sanitizer || null;
13880
- const componentDef = getComponentDef(componentType);
13881
- if (componentDef.type != componentType)
13882
- componentDef.type = componentType;
13883
- // The first index of the first selector is the tag name.
13884
- const componentTag = componentDef.selectors[0][0];
13885
- const hostRenderer = rendererFactory.createRenderer(null, null);
13886
- const hostRNode = locateHostElement(hostRenderer, opts.host || componentTag, componentDef.encapsulation);
13887
- const rootFlags = componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
13888
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13889
- const rootContext = createRootContext(opts.scheduler, opts.playerHandler);
13890
- const renderer = rendererFactory.createRenderer(hostRNode, componentDef);
13891
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
13892
- const rootView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, null, opts.injector || null, null);
13893
- enterView(rootView);
13894
- let component;
13895
- try {
13896
- if (rendererFactory.begin)
13897
- rendererFactory.begin();
13898
- const componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer);
13899
- component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
13900
- // create mode pass
13901
- renderView(rootTView, rootView, null);
13902
- // update mode pass
13903
- refreshView(rootTView, rootView, null, null);
13771
+ function interpolationV(lView, values) {
13772
+ ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
13773
+ ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
13774
+ let isBindingUpdated = false;
13775
+ let bindingIndex = getBindingIndex();
13776
+ for (let i = 1; i < values.length; i += 2) {
13777
+ // Check if bindings (odd indexes) have changed
13778
+ isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
13904
13779
  }
13905
- finally {
13906
- leaveView();
13907
- if (rendererFactory.end)
13908
- rendererFactory.end();
13780
+ setBindingIndex(bindingIndex);
13781
+ if (!isBindingUpdated) {
13782
+ return NO_CHANGE;
13909
13783
  }
13910
- return component;
13784
+ // Build the updated content
13785
+ let content = values[0];
13786
+ for (let i = 1; i < values.length; i += 2) {
13787
+ content += renderStringify(values[i]) + values[i + 1];
13788
+ }
13789
+ return content;
13911
13790
  }
13912
13791
  /**
13913
- * Creates the root component view and the root component node.
13914
- *
13915
- * @param rNode Render host element.
13916
- * @param def ComponentDef
13917
- * @param rootView The parent view where the host node is stored
13918
- * @param rendererFactory Factory to be used for creating child renderers.
13919
- * @param hostRenderer The current renderer
13920
- * @param sanitizer The sanitizer, if provided
13792
+ * Creates an interpolation binding with 1 expression.
13921
13793
  *
13922
- * @returns Component view created
13794
+ * @param prefix static value used for concatenation only.
13795
+ * @param v0 value checked for change.
13796
+ * @param suffix static value used for concatenation only.
13923
13797
  */
13924
- function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13925
- const tView = rootView[TVIEW];
13926
- const index = HEADER_OFFSET;
13927
- ngDevMode && assertIndexInRange(rootView, index);
13928
- rootView[index] = rNode;
13929
- // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13930
- // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13931
- // representing a host element.
13932
- const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13933
- const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13934
- if (mergedAttrs !== null) {
13935
- computeStaticStyling(tNode, mergedAttrs, true);
13936
- if (rNode !== null) {
13937
- setUpAttributes(hostRenderer, rNode, mergedAttrs);
13938
- if (tNode.classes !== null) {
13939
- writeDirectClass(hostRenderer, rNode, tNode.classes);
13940
- }
13941
- if (tNode.styles !== null) {
13942
- writeDirectStyle(hostRenderer, rNode, tNode.styles);
13943
- }
13944
- }
13945
- }
13946
- const viewRenderer = rendererFactory.createRenderer(rNode, def);
13947
- const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13948
- if (tView.firstCreatePass) {
13949
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13950
- markAsComponentHost(tView, tNode);
13951
- initTNodeFlags(tNode, rootView.length, 1);
13952
- }
13953
- addToViewTree(rootView, componentView);
13954
- // Store component view at node index, with node as the HOST
13955
- return rootView[index] = componentView;
13798
+ function interpolation1(lView, prefix, v0, suffix) {
13799
+ const different = bindingUpdated(lView, nextBindingIndex(), v0);
13800
+ return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
13956
13801
  }
13957
13802
  /**
13958
- * Creates a root component and sets it up with features and host bindings. Shared by
13959
- * renderComponent() and ViewContainerRef.createComponent().
13803
+ * Creates an interpolation binding with 2 expressions.
13960
13804
  */
13961
- function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13962
- const tView = rootLView[TVIEW];
13963
- // Create directive instance with factory() and store at next index in viewData
13964
- const component = instantiateRootComponent(tView, rootLView, componentDef);
13965
- rootContext.components.push(component);
13966
- componentView[CONTEXT] = component;
13967
- if (hostFeatures !== null) {
13968
- for (const feature of hostFeatures) {
13969
- feature(component, componentDef);
13970
- }
13971
- }
13972
- // We want to generate an empty QueryList for root content queries for backwards
13973
- // compatibility with ViewEngine.
13974
- if (componentDef.contentQueries) {
13975
- const tNode = getCurrentTNode();
13976
- ngDevMode && assertDefined(tNode, 'TNode expected');
13977
- componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13978
- }
13979
- const rootTNode = getCurrentTNode();
13980
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13981
- if (tView.firstCreatePass &&
13982
- (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13983
- setSelectedIndex(rootTNode.index);
13984
- const rootTView = rootLView[TVIEW];
13985
- registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13986
- invokeHostBindingsInCreationMode(componentDef, component);
13987
- }
13988
- return component;
13989
- }
13990
- function createRootContext(scheduler, playerHandler) {
13991
- return {
13992
- components: [],
13993
- scheduler: scheduler || defaultScheduler,
13994
- clean: CLEAN_PROMISE,
13995
- playerHandler: playerHandler || null,
13996
- flags: 0 /* RootContextFlags.Empty */
13997
- };
13805
+ function interpolation2(lView, prefix, v0, i0, v1, suffix) {
13806
+ const bindingIndex = getBindingIndex();
13807
+ const different = bindingUpdated2(lView, bindingIndex, v0, v1);
13808
+ incrementBindingIndex(2);
13809
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
13998
13810
  }
13999
13811
  /**
14000
- * Used to enable lifecycle hooks on the root component.
14001
- *
14002
- * Include this feature when calling `renderComponent` if the root component
14003
- * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
14004
- * be called properly.
14005
- *
14006
- * Example:
14007
- *
14008
- * ```
14009
- * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
14010
- * ```
13812
+ * Creates an interpolation binding with 3 expressions.
14011
13813
  */
14012
- function LifecycleHooksFeature() {
14013
- const tNode = getCurrentTNode();
14014
- ngDevMode && assertDefined(tNode, 'TNode is required');
14015
- registerPostOrderHooks(getLView()[TVIEW], tNode);
13814
+ function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
13815
+ const bindingIndex = getBindingIndex();
13816
+ const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
13817
+ incrementBindingIndex(3);
13818
+ return different ?
13819
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
13820
+ NO_CHANGE;
14016
13821
  }
14017
13822
  /**
14018
- * Wait on component until it is rendered.
14019
- *
14020
- * This function returns a `Promise` which is resolved when the component's
14021
- * change detection is executed. This is determined by finding the scheduler
14022
- * associated with the `component`'s render tree and waiting until the scheduler
14023
- * flushes. If nothing is scheduled, the function returns a resolved promise.
14024
- *
14025
- * Example:
14026
- * ```
14027
- * await whenRendered(myComponent);
14028
- * ```
14029
- *
14030
- * @param component Component to wait upon
14031
- * @returns Promise which resolves when the component is rendered.
13823
+ * Create an interpolation binding with 4 expressions.
14032
13824
  */
14033
- function whenRendered(component) {
14034
- return getRootContext(component).clean;
13825
+ function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
13826
+ const bindingIndex = getBindingIndex();
13827
+ const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13828
+ incrementBindingIndex(4);
13829
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13830
+ renderStringify(v2) + i2 + renderStringify(v3) + suffix :
13831
+ NO_CHANGE;
14035
13832
  }
14036
-
14037
13833
  /**
14038
- * @license
14039
- * Copyright Google LLC All Rights Reserved.
14040
- *
14041
- * Use of this source code is governed by an MIT-style license that can be
14042
- * found in the LICENSE file at https://angular.io/license
13834
+ * Creates an interpolation binding with 5 expressions.
14043
13835
  */
14044
- function getSuperType(type) {
14045
- return Object.getPrototypeOf(type.prototype).constructor;
14046
- }
13836
+ function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
13837
+ const bindingIndex = getBindingIndex();
13838
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13839
+ different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
13840
+ incrementBindingIndex(5);
13841
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13842
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
13843
+ NO_CHANGE;
13844
+ }
14047
13845
  /**
14048
- * Merges the definition from a super class to a sub class.
14049
- * @param definition The definition that is a SubClass of another directive of component
14050
- *
14051
- * @codeGenApi
13846
+ * Creates an interpolation binding with 6 expressions.
14052
13847
  */
14053
- function ɵɵInheritDefinitionFeature(definition) {
14054
- let superType = getSuperType(definition.type);
14055
- let shouldInheritFields = true;
14056
- const inheritanceChain = [definition];
14057
- while (superType) {
14058
- let superDef = undefined;
14059
- if (isComponentDef(definition)) {
14060
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14061
- superDef = superType.ɵcmp || superType.ɵdir;
14062
- }
14063
- else {
14064
- if (superType.ɵcmp) {
14065
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14066
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14067
- }
14068
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14069
- superDef = superType.ɵdir;
14070
- }
14071
- if (superDef) {
14072
- if (shouldInheritFields) {
14073
- inheritanceChain.push(superDef);
14074
- // Some fields in the definition may be empty, if there were no values to put in them that
14075
- // would've justified object creation. Unwrap them if necessary.
14076
- const writeableDef = definition;
14077
- writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
14078
- writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
14079
- writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
14080
- // Merge hostBindings
14081
- const superHostBindings = superDef.hostBindings;
14082
- superHostBindings && inheritHostBindings(definition, superHostBindings);
14083
- // Merge queries
14084
- const superViewQuery = superDef.viewQuery;
14085
- const superContentQueries = superDef.contentQueries;
14086
- superViewQuery && inheritViewQuery(definition, superViewQuery);
14087
- superContentQueries && inheritContentQueries(definition, superContentQueries);
14088
- // Merge inputs and outputs
14089
- fillProperties(definition.inputs, superDef.inputs);
14090
- fillProperties(definition.declaredInputs, superDef.declaredInputs);
14091
- fillProperties(definition.outputs, superDef.outputs);
14092
- // Merge animations metadata.
14093
- // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
14094
- if (isComponentDef(superDef) && superDef.data.animation) {
14095
- // If super def is a Component, the `definition` is also a Component, since Directives can
14096
- // not inherit Components (we throw an error above and cannot reach this code).
14097
- const defData = definition.data;
14098
- defData.animation = (defData.animation || []).concat(superDef.data.animation);
14099
- }
14100
- }
14101
- // Run parent features
14102
- const features = superDef.features;
14103
- if (features) {
14104
- for (let i = 0; i < features.length; i++) {
14105
- const feature = features[i];
14106
- if (feature && feature.ngInherit) {
14107
- feature(definition);
14108
- }
14109
- // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
14110
- // def already has all the necessary information inherited from its super class(es), so we
14111
- // can stop merging fields from super classes. However we need to iterate through the
14112
- // prototype chain to look for classes that might contain other "features" (like
14113
- // NgOnChanges), which we should invoke for the original `definition`. We set the
14114
- // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
14115
- // logic and only invoking functions from the "features" list.
14116
- if (feature === ɵɵInheritDefinitionFeature) {
14117
- shouldInheritFields = false;
14118
- }
14119
- }
14120
- }
14121
- }
14122
- superType = Object.getPrototypeOf(superType);
14123
- }
14124
- mergeHostAttrsAcrossInheritance(inheritanceChain);
13848
+ function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
13849
+ const bindingIndex = getBindingIndex();
13850
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13851
+ different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
13852
+ incrementBindingIndex(6);
13853
+ return different ?
13854
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
13855
+ renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
13856
+ NO_CHANGE;
14125
13857
  }
14126
13858
  /**
14127
- * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
14128
- *
14129
- * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
14130
- * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
14131
- * type.
13859
+ * Creates an interpolation binding with 7 expressions.
14132
13860
  */
14133
- function mergeHostAttrsAcrossInheritance(inheritanceChain) {
14134
- let hostVars = 0;
14135
- let hostAttrs = null;
14136
- // We process the inheritance order from the base to the leaves here.
14137
- for (let i = inheritanceChain.length - 1; i >= 0; i--) {
14138
- const def = inheritanceChain[i];
14139
- // For each `hostVars`, we need to add the superclass amount.
14140
- def.hostVars = (hostVars += def.hostVars);
14141
- // for each `hostAttrs` we need to merge it with superclass.
14142
- def.hostAttrs =
14143
- mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
14144
- }
14145
- }
14146
- function maybeUnwrapEmpty(value) {
14147
- if (value === EMPTY_OBJ) {
14148
- return {};
14149
- }
14150
- else if (value === EMPTY_ARRAY) {
14151
- return [];
14152
- }
14153
- else {
14154
- return value;
14155
- }
14156
- }
14157
- function inheritViewQuery(definition, superViewQuery) {
14158
- const prevViewQuery = definition.viewQuery;
14159
- if (prevViewQuery) {
14160
- definition.viewQuery = (rf, ctx) => {
14161
- superViewQuery(rf, ctx);
14162
- prevViewQuery(rf, ctx);
14163
- };
14164
- }
14165
- else {
14166
- definition.viewQuery = superViewQuery;
14167
- }
14168
- }
14169
- function inheritContentQueries(definition, superContentQueries) {
14170
- const prevContentQueries = definition.contentQueries;
14171
- if (prevContentQueries) {
14172
- definition.contentQueries = (rf, ctx, directiveIndex) => {
14173
- superContentQueries(rf, ctx, directiveIndex);
14174
- prevContentQueries(rf, ctx, directiveIndex);
14175
- };
14176
- }
14177
- else {
14178
- definition.contentQueries = superContentQueries;
14179
- }
13861
+ function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
13862
+ const bindingIndex = getBindingIndex();
13863
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13864
+ different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
13865
+ incrementBindingIndex(7);
13866
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13867
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13868
+ renderStringify(v5) + i5 + renderStringify(v6) + suffix :
13869
+ NO_CHANGE;
14180
13870
  }
14181
- function inheritHostBindings(definition, superHostBindings) {
14182
- const prevHostBindings = definition.hostBindings;
14183
- if (prevHostBindings) {
14184
- definition.hostBindings = (rf, ctx) => {
14185
- superHostBindings(rf, ctx);
14186
- prevHostBindings(rf, ctx);
14187
- };
14188
- }
14189
- else {
14190
- definition.hostBindings = superHostBindings;
14191
- }
13871
+ /**
13872
+ * Creates an interpolation binding with 8 expressions.
13873
+ */
13874
+ function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
13875
+ const bindingIndex = getBindingIndex();
13876
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13877
+ different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
13878
+ incrementBindingIndex(8);
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) + i6 + renderStringify(v7) + suffix :
13882
+ NO_CHANGE;
14192
13883
  }
14193
13884
 
14194
13885
  /**
14195
- * @license
14196
- * Copyright Google LLC All Rights Reserved.
14197
13886
  *
14198
- * Use of this source code is governed by an MIT-style license that can be
14199
- * found in the LICENSE file at https://angular.io/license
14200
- */
14201
- /**
14202
- * Fields which exist on either directive or component definitions, and need to be copied from
14203
- * parent to child classes by the `ɵɵCopyDefinitionFeature`.
14204
- */
14205
- const COPY_DIRECTIVE_FIELDS = [
14206
- // The child class should use the providers of its parent.
14207
- 'providersResolver',
14208
- // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
14209
- // as inputs, outputs, and host binding functions.
14210
- ];
14211
- /**
14212
- * Fields which exist only on component definitions, and need to be copied from parent to child
14213
- * classes by the `ɵɵCopyDefinitionFeature`.
13887
+ * Update an interpolated attribute on an element with single bound value surrounded by text.
14214
13888
  *
14215
- * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
14216
- * since those should go in `COPY_DIRECTIVE_FIELDS` above.
14217
- */
14218
- const COPY_COMPONENT_FIELDS = [
14219
- // The child class should use the template function of its parent, including all template
14220
- // semantics.
14221
- 'template',
14222
- 'decls',
14223
- 'consts',
14224
- 'vars',
14225
- 'onPush',
14226
- 'ngContentSelectors',
14227
- // The child class should use the CSS styles of its parent, including all styling semantics.
14228
- 'styles',
14229
- 'encapsulation',
14230
- // The child class should be checked by the runtime in the same way as its parent.
14231
- 'schemas',
14232
- ];
14233
- /**
14234
- * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
14235
- * definition.
13889
+ * Used when the value passed to a property has 1 interpolated value in it:
14236
13890
  *
14237
- * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
14238
- * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
14239
- * generates a skeleton definition on the child class, and applies this feature.
13891
+ * ```html
13892
+ * <div attr.title="prefix{{v0}}suffix"></div>
13893
+ * ```
14240
13894
  *
14241
- * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
14242
- * including things like the component template function.
13895
+ * Its compiled representation is::
14243
13896
  *
14244
- * @param definition The definition of a child class which inherits from a parent class with its
14245
- * own definition.
13897
+ * ```ts
13898
+ * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
13899
+ * ```
14246
13900
  *
13901
+ * @param attrName The name of the attribute to update
13902
+ * @param prefix Static value used for concatenation only.
13903
+ * @param v0 Value checked for change.
13904
+ * @param suffix Static value used for concatenation only.
13905
+ * @param sanitizer An optional sanitizer function
13906
+ * @returns itself, so that it may be chained.
14247
13907
  * @codeGenApi
14248
13908
  */
14249
- function ɵɵCopyDefinitionFeature(definition) {
14250
- let superType = getSuperType(definition.type);
14251
- let superDef = undefined;
14252
- if (isComponentDef(definition)) {
14253
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14254
- superDef = superType.ɵcmp;
14255
- }
14256
- else {
14257
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14258
- superDef = superType.ɵdir;
14259
- }
14260
- // Needed because `definition` fields are readonly.
14261
- const defAny = definition;
14262
- // Copy over any fields that apply to either directives or components.
14263
- for (const field of COPY_DIRECTIVE_FIELDS) {
14264
- defAny[field] = superDef[field];
14265
- }
14266
- if (isComponentDef(superDef)) {
14267
- // Copy over any component-specific fields.
14268
- for (const field of COPY_COMPONENT_FIELDS) {
14269
- defAny[field] = superDef[field];
14270
- }
13909
+ function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
13910
+ const lView = getLView();
13911
+ const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
13912
+ if (interpolatedValue !== NO_CHANGE) {
13913
+ const tNode = getSelectedTNode();
13914
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13915
+ ngDevMode &&
13916
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14271
13917
  }
13918
+ return ɵɵattributeInterpolate1;
14272
13919
  }
14273
-
14274
13920
  /**
14275
- * @license
14276
- * Copyright Google LLC All Rights Reserved.
14277
13921
  *
14278
- * Use of this source code is governed by an MIT-style license that can be
14279
- * found in the LICENSE file at https://angular.io/license
14280
- */
14281
- let _symbolIterator = null;
14282
- function getSymbolIterator() {
14283
- if (!_symbolIterator) {
14284
- const Symbol = _global['Symbol'];
14285
- if (Symbol && Symbol.iterator) {
14286
- _symbolIterator = Symbol.iterator;
14287
- }
14288
- else {
14289
- // es6-shim specific logic
14290
- const keys = Object.getOwnPropertyNames(Map.prototype);
14291
- for (let i = 0; i < keys.length; ++i) {
14292
- const key = keys[i];
14293
- if (key !== 'entries' && key !== 'size' &&
14294
- Map.prototype[key] === Map.prototype['entries']) {
14295
- _symbolIterator = key;
14296
- }
14297
- }
14298
- }
14299
- }
14300
- return _symbolIterator;
14301
- }
14302
-
14303
- /**
14304
- * @license
14305
- * Copyright Google LLC All Rights Reserved.
13922
+ * Update an interpolated attribute on an element with 2 bound values surrounded by text.
14306
13923
  *
14307
- * Use of this source code is governed by an MIT-style license that can be
14308
- * found in the LICENSE file at https://angular.io/license
14309
- */
14310
- function isIterable(obj) {
14311
- return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
14312
- }
14313
- function isListLikeIterable(obj) {
14314
- if (!isJsObject(obj))
14315
- return false;
14316
- return Array.isArray(obj) ||
14317
- (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
14318
- getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
14319
- }
14320
- function areIterablesEqual(a, b, comparator) {
14321
- const iterator1 = a[getSymbolIterator()]();
14322
- const iterator2 = b[getSymbolIterator()]();
14323
- while (true) {
14324
- const item1 = iterator1.next();
14325
- const item2 = iterator2.next();
14326
- if (item1.done && item2.done)
14327
- return true;
14328
- if (item1.done || item2.done)
14329
- return false;
14330
- if (!comparator(item1.value, item2.value))
14331
- return false;
14332
- }
14333
- }
14334
- function iterateListLike(obj, fn) {
14335
- if (Array.isArray(obj)) {
14336
- for (let i = 0; i < obj.length; i++) {
14337
- fn(obj[i]);
14338
- }
14339
- }
14340
- else {
14341
- const iterator = obj[getSymbolIterator()]();
14342
- let item;
14343
- while (!((item = iterator.next()).done)) {
14344
- fn(item.value);
14345
- }
14346
- }
14347
- }
14348
- function isJsObject(o) {
14349
- return o !== null && (typeof o === 'function' || typeof o === 'object');
14350
- }
14351
-
14352
- /**
14353
- * @license
14354
- * Copyright Google LLC All Rights Reserved.
13924
+ * Used when the value passed to a property has 2 interpolated values in it:
14355
13925
  *
14356
- * Use of this source code is governed by an MIT-style license that can be
14357
- * found in the LICENSE file at https://angular.io/license
14358
- */
14359
- function devModeEqual(a, b) {
14360
- const isListLikeIterableA = isListLikeIterable(a);
14361
- const isListLikeIterableB = isListLikeIterable(b);
14362
- if (isListLikeIterableA && isListLikeIterableB) {
14363
- return areIterablesEqual(a, b, devModeEqual);
14364
- }
14365
- else {
14366
- const isAObject = a && (typeof a === 'object' || typeof a === 'function');
14367
- const isBObject = b && (typeof b === 'object' || typeof b === 'function');
14368
- if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
14369
- return true;
14370
- }
14371
- else {
14372
- return Object.is(a, b);
14373
- }
14374
- }
14375
- }
14376
-
14377
- /**
14378
- * @license
14379
- * Copyright Google LLC All Rights Reserved.
13926
+ * ```html
13927
+ * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
13928
+ * ```
14380
13929
  *
14381
- * Use of this source code is governed by an MIT-style license that can be
14382
- * found in the LICENSE file at https://angular.io/license
14383
- */
14384
- // TODO(misko): consider inlining
14385
- /** Updates binding and returns the value. */
14386
- function updateBinding(lView, bindingIndex, value) {
14387
- return lView[bindingIndex] = value;
14388
- }
14389
- /** Gets the current binding value. */
14390
- function getBinding(lView, bindingIndex) {
14391
- ngDevMode && assertIndexInRange(lView, bindingIndex);
14392
- ngDevMode &&
14393
- assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
14394
- return lView[bindingIndex];
14395
- }
14396
- /**
14397
- * Updates binding if changed, then returns whether it was updated.
13930
+ * Its compiled representation is::
14398
13931
  *
14399
- * This function also checks the `CheckNoChangesMode` and throws if changes are made.
14400
- * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
14401
- * behavior.
13932
+ * ```ts
13933
+ * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
13934
+ * ```
14402
13935
  *
14403
- * @param lView current `LView`
14404
- * @param bindingIndex The binding in the `LView` to check
14405
- * @param value New value to check against `lView[bindingIndex]`
14406
- * @returns `true` if the bindings has changed. (Throws if binding has changed during
14407
- * `CheckNoChangesMode`)
13936
+ * @param attrName The name of the attribute to update
13937
+ * @param prefix Static value used for concatenation only.
13938
+ * @param v0 Value checked for change.
13939
+ * @param i0 Static value used for concatenation only.
13940
+ * @param v1 Value checked for change.
13941
+ * @param suffix Static value used for concatenation only.
13942
+ * @param sanitizer An optional sanitizer function
13943
+ * @returns itself, so that it may be chained.
13944
+ * @codeGenApi
14408
13945
  */
14409
- function bindingUpdated(lView, bindingIndex, value) {
14410
- ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
14411
- ngDevMode &&
14412
- assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
14413
- const oldValue = lView[bindingIndex];
14414
- if (Object.is(oldValue, value)) {
14415
- return false;
14416
- }
14417
- else {
14418
- if (ngDevMode && isInCheckNoChangesMode()) {
14419
- // View engine didn't report undefined values as changed on the first checkNoChanges pass
14420
- // (before the change detection was run).
14421
- const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
14422
- if (!devModeEqual(oldValueToCompare, value)) {
14423
- const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
14424
- throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
14425
- }
14426
- // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
14427
- // For this reason we exit as if no change. The early exit is needed to prevent the changed
14428
- // value to be written into `LView` (If we would write the new value that we would not see it
14429
- // as change on next CD.)
14430
- return false;
14431
- }
14432
- lView[bindingIndex] = value;
14433
- return true;
13946
+ function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
13947
+ const lView = getLView();
13948
+ const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
13949
+ if (interpolatedValue !== NO_CHANGE) {
13950
+ const tNode = getSelectedTNode();
13951
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13952
+ ngDevMode &&
13953
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14434
13954
  }
13955
+ return ɵɵattributeInterpolate2;
14435
13956
  }
14436
- /** Updates 2 bindings if changed, then returns whether either was updated. */
14437
- function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
14438
- const different = bindingUpdated(lView, bindingIndex, exp1);
14439
- return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
14440
- }
14441
- /** Updates 3 bindings if changed, then returns whether any was updated. */
14442
- function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
14443
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14444
- return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
14445
- }
14446
- /** Updates 4 bindings if changed, then returns whether any was updated. */
14447
- function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
14448
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14449
- return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
14450
- }
14451
-
14452
13957
  /**
14453
- * @license
14454
- * Copyright Google LLC All Rights Reserved.
14455
13958
  *
14456
- * Use of this source code is governed by an MIT-style license that can be
14457
- * found in the LICENSE file at https://angular.io/license
14458
- */
14459
- /**
14460
- * Updates the value of or removes a bound attribute on an Element.
13959
+ * Update an interpolated attribute on an element with 3 bound values surrounded by text.
14461
13960
  *
14462
- * Used in the case of `[attr.title]="value"`
13961
+ * Used when the value passed to a property has 3 interpolated values in it:
14463
13962
  *
14464
- * @param name name The name of the attribute.
14465
- * @param value value The attribute is removed when value is `null` or `undefined`.
14466
- * Otherwise the attribute value is set to the stringified value.
14467
- * @param sanitizer An optional function used to sanitize the value.
14468
- * @param namespace Optional namespace to use when setting the attribute.
13963
+ * ```html
13964
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
13965
+ * ```
13966
+ *
13967
+ * Its compiled representation is::
14469
13968
  *
13969
+ * ```ts
13970
+ * ɵɵattributeInterpolate3(
13971
+ * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
13972
+ * ```
13973
+ *
13974
+ * @param attrName The name of the attribute to update
13975
+ * @param prefix Static value used for concatenation only.
13976
+ * @param v0 Value checked for change.
13977
+ * @param i0 Static value used for concatenation only.
13978
+ * @param v1 Value checked for change.
13979
+ * @param i1 Static value used for concatenation only.
13980
+ * @param v2 Value checked for change.
13981
+ * @param suffix Static value used for concatenation only.
13982
+ * @param sanitizer An optional sanitizer function
13983
+ * @returns itself, so that it may be chained.
14470
13984
  * @codeGenApi
14471
13985
  */
14472
- function ɵɵattribute(name, value, sanitizer, namespace) {
13986
+ function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14473
13987
  const lView = getLView();
14474
- const bindingIndex = nextBindingIndex();
14475
- if (bindingUpdated(lView, bindingIndex, value)) {
14476
- const tView = getTView();
14477
- const tNode = getSelectedTNode();
14478
- elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
14479
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
14480
- }
14481
- return ɵɵattribute;
14482
- }
14483
-
14484
- /**
14485
- * @license
14486
- * Copyright Google LLC All Rights Reserved.
14487
- *
14488
- * Use of this source code is governed by an MIT-style license that can be
14489
- * found in the LICENSE file at https://angular.io/license
14490
- */
14491
- /**
14492
- * Create interpolation bindings with a variable number of expressions.
14493
- *
14494
- * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
14495
- * Those are faster because there is no need to create an array of expressions and iterate over it.
14496
- *
14497
- * `values`:
14498
- * - has static text at even indexes,
14499
- * - has evaluated expressions at odd indexes.
14500
- *
14501
- * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
14502
- */
14503
- function interpolationV(lView, values) {
14504
- ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
14505
- ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
14506
- let isBindingUpdated = false;
14507
- let bindingIndex = getBindingIndex();
14508
- for (let i = 1; i < values.length; i += 2) {
14509
- // Check if bindings (odd indexes) have changed
14510
- isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
14511
- }
14512
- setBindingIndex(bindingIndex);
14513
- if (!isBindingUpdated) {
14514
- return NO_CHANGE;
14515
- }
14516
- // Build the updated content
14517
- let content = values[0];
14518
- for (let i = 1; i < values.length; i += 2) {
14519
- content += renderStringify(values[i]) + values[i + 1];
14520
- }
14521
- return content;
14522
- }
14523
- /**
14524
- * Creates an interpolation binding with 1 expression.
14525
- *
14526
- * @param prefix static value used for concatenation only.
14527
- * @param v0 value checked for change.
14528
- * @param suffix static value used for concatenation only.
14529
- */
14530
- function interpolation1(lView, prefix, v0, suffix) {
14531
- const different = bindingUpdated(lView, nextBindingIndex(), v0);
14532
- return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
14533
- }
14534
- /**
14535
- * Creates an interpolation binding with 2 expressions.
14536
- */
14537
- function interpolation2(lView, prefix, v0, i0, v1, suffix) {
14538
- const bindingIndex = getBindingIndex();
14539
- const different = bindingUpdated2(lView, bindingIndex, v0, v1);
14540
- incrementBindingIndex(2);
14541
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14542
- }
14543
- /**
14544
- * Creates an interpolation binding with 3 expressions.
14545
- */
14546
- function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
14547
- const bindingIndex = getBindingIndex();
14548
- const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
14549
- incrementBindingIndex(3);
14550
- return different ?
14551
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
14552
- NO_CHANGE;
14553
- }
14554
- /**
14555
- * Create an interpolation binding with 4 expressions.
14556
- */
14557
- function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
14558
- const bindingIndex = getBindingIndex();
14559
- const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14560
- incrementBindingIndex(4);
14561
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14562
- renderStringify(v2) + i2 + renderStringify(v3) + suffix :
14563
- NO_CHANGE;
14564
- }
14565
- /**
14566
- * Creates an interpolation binding with 5 expressions.
14567
- */
14568
- function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
14569
- const bindingIndex = getBindingIndex();
14570
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14571
- different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
14572
- incrementBindingIndex(5);
14573
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14574
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
14575
- NO_CHANGE;
14576
- }
14577
- /**
14578
- * Creates an interpolation binding with 6 expressions.
14579
- */
14580
- function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
14581
- const bindingIndex = getBindingIndex();
14582
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14583
- different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
14584
- incrementBindingIndex(6);
14585
- return different ?
14586
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
14587
- renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
14588
- NO_CHANGE;
14589
- }
14590
- /**
14591
- * Creates an interpolation binding with 7 expressions.
14592
- */
14593
- function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
14594
- const bindingIndex = getBindingIndex();
14595
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14596
- different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
14597
- incrementBindingIndex(7);
14598
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14599
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14600
- renderStringify(v5) + i5 + renderStringify(v6) + suffix :
14601
- NO_CHANGE;
14602
- }
14603
- /**
14604
- * Creates an interpolation binding with 8 expressions.
14605
- */
14606
- function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
14607
- const bindingIndex = getBindingIndex();
14608
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14609
- different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
14610
- incrementBindingIndex(8);
14611
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14612
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14613
- renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
14614
- NO_CHANGE;
14615
- }
14616
-
14617
- /**
14618
- *
14619
- * Update an interpolated attribute on an element with single bound value surrounded by text.
14620
- *
14621
- * Used when the value passed to a property has 1 interpolated value in it:
14622
- *
14623
- * ```html
14624
- * <div attr.title="prefix{{v0}}suffix"></div>
14625
- * ```
14626
- *
14627
- * Its compiled representation is::
14628
- *
14629
- * ```ts
14630
- * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
14631
- * ```
14632
- *
14633
- * @param attrName The name of the attribute to update
14634
- * @param prefix Static value used for concatenation only.
14635
- * @param v0 Value checked for change.
14636
- * @param suffix Static value used for concatenation only.
14637
- * @param sanitizer An optional sanitizer function
14638
- * @returns itself, so that it may be chained.
14639
- * @codeGenApi
14640
- */
14641
- function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
14642
- const lView = getLView();
14643
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
14644
- if (interpolatedValue !== NO_CHANGE) {
14645
- const tNode = getSelectedTNode();
14646
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14647
- ngDevMode &&
14648
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14649
- }
14650
- return ɵɵattributeInterpolate1;
14651
- }
14652
- /**
14653
- *
14654
- * Update an interpolated attribute on an element with 2 bound values surrounded by text.
14655
- *
14656
- * Used when the value passed to a property has 2 interpolated values in it:
14657
- *
14658
- * ```html
14659
- * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
14660
- * ```
14661
- *
14662
- * Its compiled representation is::
14663
- *
14664
- * ```ts
14665
- * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
14666
- * ```
14667
- *
14668
- * @param attrName The name of the attribute to update
14669
- * @param prefix Static value used for concatenation only.
14670
- * @param v0 Value checked for change.
14671
- * @param i0 Static value used for concatenation only.
14672
- * @param v1 Value checked for change.
14673
- * @param suffix Static value used for concatenation only.
14674
- * @param sanitizer An optional sanitizer function
14675
- * @returns itself, so that it may be chained.
14676
- * @codeGenApi
14677
- */
14678
- function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
14679
- const lView = getLView();
14680
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
14681
- if (interpolatedValue !== NO_CHANGE) {
14682
- const tNode = getSelectedTNode();
14683
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14684
- ngDevMode &&
14685
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14686
- }
14687
- return ɵɵattributeInterpolate2;
14688
- }
14689
- /**
14690
- *
14691
- * Update an interpolated attribute on an element with 3 bound values surrounded by text.
14692
- *
14693
- * Used when the value passed to a property has 3 interpolated values in it:
14694
- *
14695
- * ```html
14696
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
14697
- * ```
14698
- *
14699
- * Its compiled representation is::
14700
- *
14701
- * ```ts
14702
- * ɵɵattributeInterpolate3(
14703
- * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
14704
- * ```
14705
- *
14706
- * @param attrName The name of the attribute to update
14707
- * @param prefix Static value used for concatenation only.
14708
- * @param v0 Value checked for change.
14709
- * @param i0 Static value used for concatenation only.
14710
- * @param v1 Value checked for change.
14711
- * @param i1 Static value used for concatenation only.
14712
- * @param v2 Value checked for change.
14713
- * @param suffix Static value used for concatenation only.
14714
- * @param sanitizer An optional sanitizer function
14715
- * @returns itself, so that it may be chained.
14716
- * @codeGenApi
14717
- */
14718
- function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14719
- const lView = getLView();
14720
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
14721
- if (interpolatedValue !== NO_CHANGE) {
13988
+ const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
13989
+ if (interpolatedValue !== NO_CHANGE) {
14722
13990
  const tNode = getSelectedTNode();
14723
13991
  elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14724
13992
  ngDevMode &&
@@ -15006,19 +14274,53 @@ function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
15006
14274
  * Use of this source code is governed by an MIT-style license that can be
15007
14275
  * found in the LICENSE file at https://angular.io/license
15008
14276
  */
15009
- function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
15010
- ngDevMode && assertFirstCreatePass(tView);
15011
- ngDevMode && ngDevMode.firstCreatePass++;
15012
- const tViewConsts = tView.consts;
15013
- // TODO(pk): refactor getOrCreateTNode to have the "create" only version
15014
- const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, getConstant(tViewConsts, attrsIndex));
15015
- resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
15016
- registerPostOrderHooks(tView, tNode);
15017
- const embeddedTView = tNode.tViews = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
15018
- if (tView.queries !== null) {
15019
- tView.queries.template(tView, tNode);
15020
- embeddedTView.queries = tView.queries.embeddedTView(tNode);
15021
- }
14277
+ /**
14278
+ * Synchronously perform change detection on a component (and possibly its sub-components).
14279
+ *
14280
+ * This function triggers change detection in a synchronous way on a component.
14281
+ *
14282
+ * @param component The component which the change detection should be performed on.
14283
+ */
14284
+ function detectChanges(component) {
14285
+ const view = getComponentViewByInstance(component);
14286
+ detectChangesInternal(view[TVIEW], view, component);
14287
+ }
14288
+ /**
14289
+ * Marks the component as dirty (needing change detection). Marking a component dirty will
14290
+ * schedule a change detection on it at some point in the future.
14291
+ *
14292
+ * Marking an already dirty component as dirty won't do anything. Only one outstanding change
14293
+ * detection can be scheduled per component tree.
14294
+ *
14295
+ * @param component Component to mark as dirty.
14296
+ */
14297
+ function markDirty(component) {
14298
+ ngDevMode && assertDefined(component, 'component');
14299
+ const rootView = markViewDirty(getComponentViewByInstance(component));
14300
+ ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
14301
+ scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
14302
+ }
14303
+
14304
+ /**
14305
+ * @license
14306
+ * Copyright Google LLC All Rights Reserved.
14307
+ *
14308
+ * Use of this source code is governed by an MIT-style license that can be
14309
+ * found in the LICENSE file at https://angular.io/license
14310
+ */
14311
+ function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
14312
+ ngDevMode && assertFirstCreatePass(tView);
14313
+ ngDevMode && ngDevMode.firstCreatePass++;
14314
+ const tViewConsts = tView.consts;
14315
+ // TODO(pk): refactor getOrCreateTNode to have the "create" only version
14316
+ const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, getConstant(tViewConsts, attrsIndex));
14317
+ resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
14318
+ registerPostOrderHooks(tView, tNode);
14319
+ const embeddedTView = tNode.tViews = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
14320
+ if (tView.queries !== null) {
14321
+ tView.queries.template(tView, tNode);
14322
+ embeddedTView.queries = tView.queries.embeddedTView(tNode);
14323
+ }
15022
14324
  return tNode;
15023
14325
  }
15024
14326
  /**
@@ -15543,51 +14845,42 @@ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
15543
14845
  tNode.index;
15544
14846
  // In order to match current behavior, native DOM event listeners must be added for all
15545
14847
  // events (including outputs).
15546
- if (isProceduralRenderer(renderer)) {
15547
- // There might be cases where multiple directives on the same element try to register an event
15548
- // handler function for the same event. In this situation we want to avoid registration of
15549
- // several native listeners as each registration would be intercepted by NgZone and
15550
- // trigger change detection. This would mean that a single user action would result in several
15551
- // change detections being invoked. To avoid this situation we want to have only one call to
15552
- // native handler registration (for the same element and same type of event).
15553
- //
15554
- // In order to have just one native event handler in presence of multiple handler functions,
15555
- // we just register a first handler function as a native event listener and then chain
15556
- // (coalesce) other handler functions on top of the first native handler function.
15557
- let existingListener = null;
15558
- // Please note that the coalescing described here doesn't happen for events specifying an
15559
- // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
15560
- // view engine.
15561
- // Also, we don't have to search for existing listeners is there are no directives
15562
- // matching on a given node as we can't register multiple event handlers for the same event in
15563
- // a template (this would mean having duplicate attributes).
15564
- if (!eventTargetResolver && isTNodeDirectiveHost) {
15565
- existingListener = findExistingListener(tView, lView, eventName, tNode.index);
15566
- }
15567
- if (existingListener !== null) {
15568
- // Attach a new listener to coalesced listeners list, maintaining the order in which
15569
- // listeners are registered. For performance reasons, we keep a reference to the last
15570
- // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
15571
- // the entire set each time we need to add a new listener.
15572
- const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
15573
- lastListenerFn.__ngNextListenerFn__ = listenerFn;
15574
- existingListener.__ngLastListenerFn__ = listenerFn;
15575
- processOutputs = false;
15576
- }
15577
- else {
15578
- listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
15579
- const cleanupFn = renderer.listen(target, eventName, listenerFn);
15580
- ngDevMode && ngDevMode.rendererAddEventListener++;
15581
- lCleanup.push(listenerFn, cleanupFn);
15582
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15583
- }
14848
+ // There might be cases where multiple directives on the same element try to register an event
14849
+ // handler function for the same event. In this situation we want to avoid registration of
14850
+ // several native listeners as each registration would be intercepted by NgZone and
14851
+ // trigger change detection. This would mean that a single user action would result in several
14852
+ // change detections being invoked. To avoid this situation we want to have only one call to
14853
+ // native handler registration (for the same element and same type of event).
14854
+ //
14855
+ // In order to have just one native event handler in presence of multiple handler functions,
14856
+ // we just register a first handler function as a native event listener and then chain
14857
+ // (coalesce) other handler functions on top of the first native handler function.
14858
+ let existingListener = null;
14859
+ // Please note that the coalescing described here doesn't happen for events specifying an
14860
+ // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
14861
+ // view engine.
14862
+ // Also, we don't have to search for existing listeners is there are no directives
14863
+ // matching on a given node as we can't register multiple event handlers for the same event in
14864
+ // a template (this would mean having duplicate attributes).
14865
+ if (!eventTargetResolver && isTNodeDirectiveHost) {
14866
+ existingListener = findExistingListener(tView, lView, eventName, tNode.index);
14867
+ }
14868
+ if (existingListener !== null) {
14869
+ // Attach a new listener to coalesced listeners list, maintaining the order in which
14870
+ // listeners are registered. For performance reasons, we keep a reference to the last
14871
+ // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
14872
+ // the entire set each time we need to add a new listener.
14873
+ const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
14874
+ lastListenerFn.__ngNextListenerFn__ = listenerFn;
14875
+ existingListener.__ngLastListenerFn__ = listenerFn;
14876
+ processOutputs = false;
15584
14877
  }
15585
14878
  else {
15586
- listenerFn = wrapListener(tNode, lView, context, listenerFn, true /** preventDefault */);
15587
- target.addEventListener(eventName, listenerFn, useCapture);
14879
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
14880
+ const cleanupFn = renderer.listen(target, eventName, listenerFn);
15588
14881
  ngDevMode && ngDevMode.rendererAddEventListener++;
15589
- lCleanup.push(listenerFn);
15590
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture);
14882
+ lCleanup.push(listenerFn, cleanupFn);
14883
+ tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15591
14884
  }
15592
14885
  }
15593
14886
  else {
@@ -17661,7 +16954,7 @@ function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
17661
16954
  valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : undefined;
17662
16955
  }
17663
16956
  let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
17664
- key === prop ? valueAtLViewIndex : undefined;
16957
+ (key === prop ? valueAtLViewIndex : undefined);
17665
16958
  if (containsStatics && !isStylingValuePresent(currentValue)) {
17666
16959
  currentValue = keyValueArrayGet(rawKey, prop);
17667
16960
  }
@@ -19184,7 +18477,7 @@ function findLocaleData(locale) {
19184
18477
  if (parentLocale === 'en') {
19185
18478
  return localeEn;
19186
18479
  }
19187
- throw new Error(`Missing locale data for the locale "${locale}".`);
18480
+ throw new RuntimeError(701 /* RuntimeErrorCode.MISSING_LOCALE_DATA */, ngDevMode && `Missing locale data for the locale "${locale}".`);
19188
18481
  }
19189
18482
  /**
19190
18483
  * Retrieves the default currency code for the given locale.
@@ -21514,7 +20807,7 @@ function noComponentFactoryError(component) {
21514
20807
  return error;
21515
20808
  }
21516
20809
  const ERROR_COMPONENT = 'ngComponent';
21517
- function getComponent(error) {
20810
+ function getComponent$1(error) {
21518
20811
  return error[ERROR_COMPONENT];
21519
20812
  }
21520
20813
  class _NullComponentFactoryResolver {
@@ -21698,14 +20991,6 @@ class Renderer2 {
21698
20991
  * @nocollapse
21699
20992
  */
21700
20993
  Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
21701
- /** Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) */
21702
- function getOrCreateRenderer2(lView) {
21703
- const renderer = lView[RENDERER];
21704
- if (ngDevMode && !isProceduralRenderer(renderer)) {
21705
- throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
21706
- }
21707
- return renderer;
21708
- }
21709
20994
  /** Injects a Renderer2 for the current component. */
21710
20995
  function injectRenderer2() {
21711
20996
  // We need the Renderer to be based on the component that it's being injected into, however since
@@ -21713,7 +20998,7 @@ function injectRenderer2() {
21713
20998
  const lView = getLView();
21714
20999
  const tNode = getCurrentTNode();
21715
21000
  const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
21716
- return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
21001
+ return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
21717
21002
  }
21718
21003
 
21719
21004
  /**
@@ -21760,7 +21045,7 @@ class Version {
21760
21045
  /**
21761
21046
  * @publicApi
21762
21047
  */
21763
- const VERSION = new Version('14.0.3');
21048
+ const VERSION = new Version('14.0.6');
21764
21049
 
21765
21050
  /**
21766
21051
  * @license
@@ -22139,367 +21424,783 @@ class RootViewRef extends ViewRef$1 {
22139
21424
  * Use of this source code is governed by an MIT-style license that can be
22140
21425
  * found in the LICENSE file at https://angular.io/license
22141
21426
  */
22142
- class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
22143
- /**
22144
- * @param ngModule The NgModuleRef to which all resolved factories are bound.
22145
- */
22146
- constructor(ngModule) {
22147
- super();
22148
- this.ngModule = ngModule;
22149
- }
22150
- resolveComponentFactory(component) {
22151
- ngDevMode && assertComponentType(component);
22152
- const componentDef = getComponentDef(component);
22153
- return new ComponentFactory(componentDef, this.ngModule);
22154
- }
22155
- }
22156
- function toRefArray(map) {
22157
- const array = [];
22158
- for (let nonMinified in map) {
22159
- if (map.hasOwnProperty(nonMinified)) {
22160
- const minified = map[nonMinified];
22161
- array.push({ propName: minified, templateName: nonMinified });
21427
+ class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
21428
+ /**
21429
+ * @param ngModule The NgModuleRef to which all resolved factories are bound.
21430
+ */
21431
+ constructor(ngModule) {
21432
+ super();
21433
+ this.ngModule = ngModule;
21434
+ }
21435
+ resolveComponentFactory(component) {
21436
+ ngDevMode && assertComponentType(component);
21437
+ const componentDef = getComponentDef(component);
21438
+ return new ComponentFactory(componentDef, this.ngModule);
21439
+ }
21440
+ }
21441
+ function toRefArray(map) {
21442
+ const array = [];
21443
+ for (let nonMinified in map) {
21444
+ if (map.hasOwnProperty(nonMinified)) {
21445
+ const minified = map[nonMinified];
21446
+ array.push({ propName: minified, templateName: nonMinified });
21447
+ }
21448
+ }
21449
+ return array;
21450
+ }
21451
+ function getNamespace(elementName) {
21452
+ const name = elementName.toLowerCase();
21453
+ return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21454
+ }
21455
+ /**
21456
+ * Injector that looks up a value using a specific injector, before falling back to the module
21457
+ * injector. Used primarily when creating components or embedded views dynamically.
21458
+ */
21459
+ class ChainedInjector {
21460
+ constructor(injector, parentInjector) {
21461
+ this.injector = injector;
21462
+ this.parentInjector = parentInjector;
21463
+ }
21464
+ get(token, notFoundValue, flags) {
21465
+ const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21466
+ if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21467
+ notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21468
+ // Return the value from the root element injector when
21469
+ // - it provides it
21470
+ // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21471
+ // - the module injector should not be checked
21472
+ // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21473
+ return value;
21474
+ }
21475
+ return this.parentInjector.get(token, notFoundValue, flags);
21476
+ }
21477
+ }
21478
+ /**
21479
+ * Render3 implementation of {@link viewEngine_ComponentFactory}.
21480
+ */
21481
+ class ComponentFactory extends ComponentFactory$1 {
21482
+ /**
21483
+ * @param componentDef The component definition.
21484
+ * @param ngModule The NgModuleRef to which the factory is bound.
21485
+ */
21486
+ constructor(componentDef, ngModule) {
21487
+ super();
21488
+ this.componentDef = componentDef;
21489
+ this.ngModule = ngModule;
21490
+ this.componentType = componentDef.type;
21491
+ this.selector = stringifyCSSSelectorList(componentDef.selectors);
21492
+ this.ngContentSelectors =
21493
+ componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
21494
+ this.isBoundToModule = !!ngModule;
21495
+ }
21496
+ get inputs() {
21497
+ return toRefArray(this.componentDef.inputs);
21498
+ }
21499
+ get outputs() {
21500
+ return toRefArray(this.componentDef.outputs);
21501
+ }
21502
+ create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
21503
+ environmentInjector = environmentInjector || this.ngModule;
21504
+ let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
21505
+ environmentInjector :
21506
+ environmentInjector === null || environmentInjector === void 0 ? void 0 : environmentInjector.injector;
21507
+ if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
21508
+ realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
21509
+ realEnvironmentInjector;
21510
+ }
21511
+ const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
21512
+ const rendererFactory = rootViewInjector.get(RendererFactory2, null);
21513
+ if (rendererFactory === null) {
21514
+ throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
21515
+ 'Angular was not able to inject a renderer (RendererFactory2). ' +
21516
+ 'Likely this is due to a broken DI hierarchy. ' +
21517
+ 'Make sure that any injector used to create this component has a correct parent.');
21518
+ }
21519
+ const sanitizer = rootViewInjector.get(Sanitizer, null);
21520
+ const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
21521
+ // Determine a tag name used for creating host elements when this component is created
21522
+ // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
21523
+ const elementName = this.componentDef.selectors[0][0] || 'div';
21524
+ const hostRNode = rootSelectorOrNode ?
21525
+ locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
21526
+ createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
21527
+ const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
21528
+ 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
21529
+ const rootContext = createRootContext();
21530
+ // Create the root view. Uses empty TView and ContentTemplate.
21531
+ const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
21532
+ const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
21533
+ // rootView is the parent when bootstrapping
21534
+ // TODO(misko): it looks like we are entering view here but we don't really need to as
21535
+ // `renderView` does that. However as the code is written it is needed because
21536
+ // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
21537
+ // issues would allow us to drop this.
21538
+ enterView(rootLView);
21539
+ let component;
21540
+ let tElementNode;
21541
+ try {
21542
+ const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
21543
+ if (hostRNode) {
21544
+ if (rootSelectorOrNode) {
21545
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
21546
+ }
21547
+ else {
21548
+ // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
21549
+ // is not defined), also apply attributes and classes extracted from component selector.
21550
+ // Extract attributes and classes from the first selector only to match VE behavior.
21551
+ const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
21552
+ if (attrs) {
21553
+ setUpAttributes(hostRenderer, hostRNode, attrs);
21554
+ }
21555
+ if (classes && classes.length > 0) {
21556
+ writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
21557
+ }
21558
+ }
21559
+ }
21560
+ tElementNode = getTNode(rootTView, HEADER_OFFSET);
21561
+ if (projectableNodes !== undefined) {
21562
+ const projection = tElementNode.projection = [];
21563
+ for (let i = 0; i < this.ngContentSelectors.length; i++) {
21564
+ const nodesforSlot = projectableNodes[i];
21565
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
21566
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
21567
+ // complex checks down the line.
21568
+ // We also normalize the length of the passed in projectable nodes (to match the number of
21569
+ // <ng-container> slots defined by a component).
21570
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
21571
+ }
21572
+ }
21573
+ // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
21574
+ // executed here?
21575
+ // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
21576
+ component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
21577
+ renderView(rootTView, rootLView, null);
21578
+ }
21579
+ finally {
21580
+ leaveView();
21581
+ }
21582
+ return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21583
+ }
21584
+ }
21585
+ const componentFactoryResolver = new ComponentFactoryResolver();
21586
+ /**
21587
+ * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
21588
+ * ComponentFactoryResolver
21589
+ * already exists, retrieves the existing ComponentFactoryResolver.
21590
+ *
21591
+ * @returns The ComponentFactoryResolver instance to use
21592
+ */
21593
+ function injectComponentFactoryResolver() {
21594
+ return componentFactoryResolver;
21595
+ }
21596
+ /**
21597
+ * Represents an instance of a Component created via a {@link ComponentFactory}.
21598
+ *
21599
+ * `ComponentRef` provides access to the Component Instance as well other objects related to this
21600
+ * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
21601
+ * method.
21602
+ *
21603
+ */
21604
+ class ComponentRef extends ComponentRef$1 {
21605
+ constructor(componentType, instance, location, _rootLView, _tNode) {
21606
+ super();
21607
+ this.location = location;
21608
+ this._rootLView = _rootLView;
21609
+ this._tNode = _tNode;
21610
+ this.instance = instance;
21611
+ this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
21612
+ this.componentType = componentType;
21613
+ }
21614
+ get injector() {
21615
+ return new NodeInjector(this._tNode, this._rootLView);
21616
+ }
21617
+ destroy() {
21618
+ this.hostView.destroy();
21619
+ }
21620
+ onDestroy(callback) {
21621
+ this.hostView.onDestroy(callback);
21622
+ }
21623
+ }
21624
+
21625
+ /**
21626
+ * @license
21627
+ * Copyright Google LLC All Rights Reserved.
21628
+ *
21629
+ * Use of this source code is governed by an MIT-style license that can be
21630
+ * found in the LICENSE file at https://angular.io/license
21631
+ */
21632
+ /**
21633
+ * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
21634
+ * @param ngModule NgModule class.
21635
+ * @param parentInjector Optional injector instance to use as a parent for the module injector. If
21636
+ * not provided, `NullInjector` will be used instead.
21637
+ * @publicApi
21638
+ */
21639
+ function createNgModuleRef(ngModule, parentInjector) {
21640
+ return new NgModuleRef(ngModule, parentInjector !== null && parentInjector !== void 0 ? parentInjector : null);
21641
+ }
21642
+ class NgModuleRef extends NgModuleRef$1 {
21643
+ constructor(ngModuleType, _parent) {
21644
+ super();
21645
+ this._parent = _parent;
21646
+ // tslint:disable-next-line:require-internal-with-underscore
21647
+ this._bootstrapComponents = [];
21648
+ this.injector = this;
21649
+ this.destroyCbs = [];
21650
+ // When bootstrapping a module we have a dependency graph that looks like this:
21651
+ // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
21652
+ // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
21653
+ // circular dependency which will result in a runtime error, because the injector doesn't
21654
+ // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
21655
+ // and providing it, rather than letting the injector resolve it.
21656
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21657
+ const ngModuleDef = getNgModuleDef(ngModuleType);
21658
+ ngDevMode &&
21659
+ assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
21660
+ this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
21661
+ this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
21662
+ { provide: NgModuleRef$1, useValue: this }, {
21663
+ provide: ComponentFactoryResolver$1,
21664
+ useValue: this.componentFactoryResolver
21665
+ }
21666
+ ], stringify(ngModuleType), new Set(['environment']));
21667
+ // We need to resolve the injector types separately from the injector creation, because
21668
+ // the module might be trying to use this ref in its constructor for DI which will cause a
21669
+ // circular error that will eventually error out, because the injector isn't created yet.
21670
+ this._r3Injector.resolveInjectorInitializers();
21671
+ this.instance = this.get(ngModuleType);
21672
+ }
21673
+ get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
21674
+ if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
21675
+ return this;
21676
+ }
21677
+ return this._r3Injector.get(token, notFoundValue, injectFlags);
21678
+ }
21679
+ destroy() {
21680
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21681
+ const injector = this._r3Injector;
21682
+ !injector.destroyed && injector.destroy();
21683
+ this.destroyCbs.forEach(fn => fn());
21684
+ this.destroyCbs = null;
21685
+ }
21686
+ onDestroy(callback) {
21687
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21688
+ this.destroyCbs.push(callback);
21689
+ }
21690
+ }
21691
+ class NgModuleFactory extends NgModuleFactory$1 {
21692
+ constructor(moduleType) {
21693
+ super();
21694
+ this.moduleType = moduleType;
21695
+ }
21696
+ create(parentInjector) {
21697
+ return new NgModuleRef(this.moduleType, parentInjector);
21698
+ }
21699
+ }
21700
+ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
21701
+ constructor(providers, parent, source) {
21702
+ super();
21703
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21704
+ this.instance = null;
21705
+ const injector = new R3Injector([
21706
+ ...providers,
21707
+ { provide: NgModuleRef$1, useValue: this },
21708
+ { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
21709
+ ], parent || getNullInjector(), source, new Set(['environment']));
21710
+ this.injector = injector;
21711
+ injector.resolveInjectorInitializers();
21712
+ }
21713
+ destroy() {
21714
+ this.injector.destroy();
21715
+ }
21716
+ onDestroy(callback) {
21717
+ this.injector.onDestroy(callback);
21718
+ }
21719
+ }
21720
+ /**
21721
+ * Create a new environment injector.
21722
+ *
21723
+ * @publicApi
21724
+ * @developerPreview
21725
+ */
21726
+ function createEnvironmentInjector(providers, parent = null, debugName = null) {
21727
+ const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
21728
+ return adapter.injector;
21729
+ }
21730
+
21731
+ /**
21732
+ * @license
21733
+ * Copyright Google LLC All Rights Reserved.
21734
+ *
21735
+ * Use of this source code is governed by an MIT-style license that can be
21736
+ * found in the LICENSE file at https://angular.io/license
21737
+ */
21738
+ /**
21739
+ * A service used by the framework to create instances of standalone injectors. Those injectors are
21740
+ * created on demand in case of dynamic component instantiation and contain ambient providers
21741
+ * collected from the imports graph rooted at a given standalone component.
21742
+ */
21743
+ class StandaloneService {
21744
+ constructor(_injector) {
21745
+ this._injector = _injector;
21746
+ this.cachedInjectors = new Map();
21747
+ }
21748
+ getOrCreateStandaloneInjector(componentDef) {
21749
+ if (!componentDef.standalone) {
21750
+ return null;
21751
+ }
21752
+ if (!this.cachedInjectors.has(componentDef.id)) {
21753
+ const providers = internalImportProvidersFrom(false, componentDef.type);
21754
+ const standaloneInjector = providers.length > 0 ?
21755
+ createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
21756
+ null;
21757
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
21758
+ }
21759
+ return this.cachedInjectors.get(componentDef.id);
21760
+ }
21761
+ ngOnDestroy() {
21762
+ try {
21763
+ for (const injector of this.cachedInjectors.values()) {
21764
+ if (injector !== null) {
21765
+ injector.destroy();
21766
+ }
21767
+ }
21768
+ }
21769
+ finally {
21770
+ this.cachedInjectors.clear();
21771
+ }
21772
+ }
21773
+ }
21774
+ /** @nocollapse */
21775
+ StandaloneService.ɵprov = ɵɵdefineInjectable({
21776
+ token: StandaloneService,
21777
+ providedIn: 'environment',
21778
+ factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
21779
+ });
21780
+ /**
21781
+ * A feature that acts as a setup code for the {@link StandaloneService}.
21782
+ *
21783
+ * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
21784
+ * function (an entry points to a standalone injector creation) on a component definition object. We
21785
+ * go through the features infrastructure to make sure that the standalone injector creation logic
21786
+ * is tree-shakable and not included in applications that don't use standalone components.
21787
+ *
21788
+ * @codeGenApi
21789
+ */
21790
+ function ɵɵStandaloneFeature(definition) {
21791
+ definition.getStandaloneInjector = (parentInjector) => {
21792
+ return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
21793
+ };
21794
+ }
21795
+
21796
+ /**
21797
+ * @license
21798
+ * Copyright Google LLC All Rights Reserved.
21799
+ *
21800
+ * Use of this source code is governed by an MIT-style license that can be
21801
+ * found in the LICENSE file at https://angular.io/license
21802
+ */
21803
+ /**
21804
+ * Retrieves the component instance associated with a given DOM element.
21805
+ *
21806
+ * @usageNotes
21807
+ * Given the following DOM structure:
21808
+ *
21809
+ * ```html
21810
+ * <app-root>
21811
+ * <div>
21812
+ * <child-comp></child-comp>
21813
+ * </div>
21814
+ * </app-root>
21815
+ * ```
21816
+ *
21817
+ * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
21818
+ * associated with this DOM element.
21819
+ *
21820
+ * Calling the function on `<app-root>` will return the `MyApp` instance.
21821
+ *
21822
+ *
21823
+ * @param element DOM element from which the component should be retrieved.
21824
+ * @returns Component instance associated with the element or `null` if there
21825
+ * is no component associated with it.
21826
+ *
21827
+ * @publicApi
21828
+ * @globalApi ng
21829
+ */
21830
+ function getComponent(element) {
21831
+ ngDevMode && assertDomElement(element);
21832
+ const context = getLContext(element);
21833
+ if (context === null)
21834
+ return null;
21835
+ if (context.component === undefined) {
21836
+ const lView = context.lView;
21837
+ if (lView === null) {
21838
+ return null;
22162
21839
  }
21840
+ context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
22163
21841
  }
22164
- return array;
21842
+ return context.component;
22165
21843
  }
22166
- function getNamespace(elementName) {
22167
- const name = elementName.toLowerCase();
22168
- return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21844
+ /**
21845
+ * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
21846
+ * view that the element is part of. Otherwise retrieves the instance of the component whose view
21847
+ * owns the element (in this case, the result is the same as calling `getOwningComponent`).
21848
+ *
21849
+ * @param element Element for which to get the surrounding component instance.
21850
+ * @returns Instance of the component that is around the element or null if the element isn't
21851
+ * inside any component.
21852
+ *
21853
+ * @publicApi
21854
+ * @globalApi ng
21855
+ */
21856
+ function getContext(element) {
21857
+ assertDomElement(element);
21858
+ const context = getLContext(element);
21859
+ const lView = context ? context.lView : null;
21860
+ return lView === null ? null : lView[CONTEXT];
22169
21861
  }
22170
21862
  /**
22171
- * Injector that looks up a value using a specific injector, before falling back to the module
22172
- * injector. Used primarily when creating components or embedded views dynamically.
21863
+ * Retrieves the component instance whose view contains the DOM element.
21864
+ *
21865
+ * For example, if `<child-comp>` is used in the template of `<app-comp>`
21866
+ * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
21867
+ * would return `<app-comp>`.
21868
+ *
21869
+ * @param elementOrDir DOM element, component or directive instance
21870
+ * for which to retrieve the root components.
21871
+ * @returns Component instance whose view owns the DOM element or null if the element is not
21872
+ * part of a component view.
21873
+ *
21874
+ * @publicApi
21875
+ * @globalApi ng
22173
21876
  */
22174
- class ChainedInjector {
22175
- constructor(injector, parentInjector) {
22176
- this.injector = injector;
22177
- this.parentInjector = parentInjector;
22178
- }
22179
- get(token, notFoundValue, flags) {
22180
- const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
22181
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
22182
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
22183
- // Return the value from the root element injector when
22184
- // - it provides it
22185
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22186
- // - the module injector should not be checked
22187
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22188
- return value;
22189
- }
22190
- return this.parentInjector.get(token, notFoundValue, flags);
21877
+ function getOwningComponent(elementOrDir) {
21878
+ const context = getLContext(elementOrDir);
21879
+ let lView = context ? context.lView : null;
21880
+ if (lView === null)
21881
+ return null;
21882
+ let parent;
21883
+ while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
21884
+ lView = parent;
22191
21885
  }
21886
+ return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
22192
21887
  }
22193
21888
  /**
22194
- * Render3 implementation of {@link viewEngine_ComponentFactory}.
21889
+ * Retrieves all root components associated with a DOM element, directive or component instance.
21890
+ * Root components are those which have been bootstrapped by Angular.
21891
+ *
21892
+ * @param elementOrDir DOM element, component or directive instance
21893
+ * for which to retrieve the root components.
21894
+ * @returns Root components associated with the target object.
21895
+ *
21896
+ * @publicApi
21897
+ * @globalApi ng
22195
21898
  */
22196
- class ComponentFactory extends ComponentFactory$1 {
22197
- /**
22198
- * @param componentDef The component definition.
22199
- * @param ngModule The NgModuleRef to which the factory is bound.
22200
- */
22201
- constructor(componentDef, ngModule) {
22202
- super();
22203
- this.componentDef = componentDef;
22204
- this.ngModule = ngModule;
22205
- this.componentType = componentDef.type;
22206
- this.selector = stringifyCSSSelectorList(componentDef.selectors);
22207
- this.ngContentSelectors =
22208
- componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
22209
- this.isBoundToModule = !!ngModule;
22210
- }
22211
- get inputs() {
22212
- return toRefArray(this.componentDef.inputs);
22213
- }
22214
- get outputs() {
22215
- return toRefArray(this.componentDef.outputs);
22216
- }
22217
- create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
22218
- environmentInjector = environmentInjector || this.ngModule;
22219
- let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
22220
- environmentInjector :
22221
- environmentInjector === null || environmentInjector === void 0 ? void 0 : environmentInjector.injector;
22222
- if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
22223
- realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
22224
- realEnvironmentInjector;
22225
- }
22226
- const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
22227
- const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
22228
- const sanitizer = rootViewInjector.get(Sanitizer, null);
22229
- const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
22230
- // Determine a tag name used for creating host elements when this component is created
22231
- // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
22232
- const elementName = this.componentDef.selectors[0][0] || 'div';
22233
- const hostRNode = rootSelectorOrNode ?
22234
- locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
22235
- createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
22236
- const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
22237
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
22238
- const rootContext = createRootContext();
22239
- // Create the root view. Uses empty TView and ContentTemplate.
22240
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
22241
- const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
22242
- // rootView is the parent when bootstrapping
22243
- // TODO(misko): it looks like we are entering view here but we don't really need to as
22244
- // `renderView` does that. However as the code is written it is needed because
22245
- // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
22246
- // issues would allow us to drop this.
22247
- enterView(rootLView);
22248
- let component;
22249
- let tElementNode;
22250
- try {
22251
- const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
22252
- if (hostRNode) {
22253
- if (rootSelectorOrNode) {
22254
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
22255
- }
22256
- else {
22257
- // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
22258
- // is not defined), also apply attributes and classes extracted from component selector.
22259
- // Extract attributes and classes from the first selector only to match VE behavior.
22260
- const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
22261
- if (attrs) {
22262
- setUpAttributes(hostRenderer, hostRNode, attrs);
22263
- }
22264
- if (classes && classes.length > 0) {
22265
- writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
22266
- }
22267
- }
22268
- }
22269
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
22270
- if (projectableNodes !== undefined) {
22271
- const projection = tElementNode.projection = [];
22272
- for (let i = 0; i < this.ngContentSelectors.length; i++) {
22273
- const nodesforSlot = projectableNodes[i];
22274
- // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
22275
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
22276
- // complex checks down the line.
22277
- // We also normalize the length of the passed in projectable nodes (to match the number of
22278
- // <ng-container> slots defined by a component).
22279
- projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
22280
- }
22281
- }
22282
- // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
22283
- // executed here?
22284
- // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
22285
- component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
22286
- renderView(rootTView, rootLView, null);
22287
- }
22288
- finally {
22289
- leaveView();
21899
+ function getRootComponents(elementOrDir) {
21900
+ const lView = readPatchedLView(elementOrDir);
21901
+ return lView !== null ? [...getRootContext(lView).components] : [];
21902
+ }
21903
+ /**
21904
+ * Retrieves an `Injector` associated with an element, component or directive instance.
21905
+ *
21906
+ * @param elementOrDir DOM element, component or directive instance for which to
21907
+ * retrieve the injector.
21908
+ * @returns Injector associated with the element, component or directive instance.
21909
+ *
21910
+ * @publicApi
21911
+ * @globalApi ng
21912
+ */
21913
+ function getInjector(elementOrDir) {
21914
+ const context = getLContext(elementOrDir);
21915
+ const lView = context ? context.lView : null;
21916
+ if (lView === null)
21917
+ return Injector.NULL;
21918
+ const tNode = lView[TVIEW].data[context.nodeIndex];
21919
+ return new NodeInjector(tNode, lView);
21920
+ }
21921
+ /**
21922
+ * Retrieve a set of injection tokens at a given DOM node.
21923
+ *
21924
+ * @param element Element for which the injection tokens should be retrieved.
21925
+ */
21926
+ function getInjectionTokens(element) {
21927
+ const context = getLContext(element);
21928
+ const lView = context ? context.lView : null;
21929
+ if (lView === null)
21930
+ return [];
21931
+ const tView = lView[TVIEW];
21932
+ const tNode = tView.data[context.nodeIndex];
21933
+ const providerTokens = [];
21934
+ const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
21935
+ const endIndex = tNode.directiveEnd;
21936
+ for (let i = startIndex; i < endIndex; i++) {
21937
+ let value = tView.data[i];
21938
+ if (isDirectiveDefHack(value)) {
21939
+ // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
21940
+ // design flaw. We should always store same type so that we can be monomorphic. The issue
21941
+ // is that for Components/Directives we store the def instead the type. The correct behavior
21942
+ // is that we should always be storing injectable type in this location.
21943
+ value = value.type;
22290
21944
  }
22291
- return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21945
+ providerTokens.push(value);
22292
21946
  }
21947
+ return providerTokens;
22293
21948
  }
22294
- const componentFactoryResolver = new ComponentFactoryResolver();
22295
21949
  /**
22296
- * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
22297
- * ComponentFactoryResolver
22298
- * already exists, retrieves the existing ComponentFactoryResolver.
21950
+ * Retrieves directive instances associated with a given DOM node. Does not include
21951
+ * component instances.
22299
21952
  *
22300
- * @returns The ComponentFactoryResolver instance to use
21953
+ * @usageNotes
21954
+ * Given the following DOM structure:
21955
+ *
21956
+ * ```html
21957
+ * <app-root>
21958
+ * <button my-button></button>
21959
+ * <my-comp></my-comp>
21960
+ * </app-root>
21961
+ * ```
21962
+ *
21963
+ * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
21964
+ * directive that is associated with the DOM node.
21965
+ *
21966
+ * Calling `getDirectives` on `<my-comp>` will return an empty array.
21967
+ *
21968
+ * @param node DOM node for which to get the directives.
21969
+ * @returns Array of directives associated with the node.
21970
+ *
21971
+ * @publicApi
21972
+ * @globalApi ng
22301
21973
  */
22302
- function injectComponentFactoryResolver() {
22303
- return componentFactoryResolver;
21974
+ function getDirectives(node) {
21975
+ // Skip text nodes because we can't have directives associated with them.
21976
+ if (node instanceof Text) {
21977
+ return [];
21978
+ }
21979
+ const context = getLContext(node);
21980
+ const lView = context ? context.lView : null;
21981
+ if (lView === null) {
21982
+ return [];
21983
+ }
21984
+ const tView = lView[TVIEW];
21985
+ const nodeIndex = context.nodeIndex;
21986
+ if (!(tView === null || tView === void 0 ? void 0 : tView.data[nodeIndex])) {
21987
+ return [];
21988
+ }
21989
+ if (context.directives === undefined) {
21990
+ context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
21991
+ }
21992
+ // The `directives` in this case are a named array called `LComponentView`. Clone the
21993
+ // result so we don't expose an internal data structure in the user's console.
21994
+ return context.directives === null ? [] : [...context.directives];
22304
21995
  }
22305
21996
  /**
22306
- * Represents an instance of a Component created via a {@link ComponentFactory}.
21997
+ * Returns the debug (partial) metadata for a particular directive or component instance.
21998
+ * The function accepts an instance of a directive or component and returns the corresponding
21999
+ * metadata.
22307
22000
  *
22308
- * `ComponentRef` provides access to the Component Instance as well other objects related to this
22309
- * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
22310
- * method.
22001
+ * @param directiveOrComponentInstance Instance of a directive or component
22002
+ * @returns metadata of the passed directive or component
22311
22003
  *
22004
+ * @publicApi
22005
+ * @globalApi ng
22312
22006
  */
22313
- class ComponentRef extends ComponentRef$1 {
22314
- constructor(componentType, instance, location, _rootLView, _tNode) {
22315
- super();
22316
- this.location = location;
22317
- this._rootLView = _rootLView;
22318
- this._tNode = _tNode;
22319
- this.instance = instance;
22320
- this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
22321
- this.componentType = componentType;
22322
- }
22323
- get injector() {
22324
- return new NodeInjector(this._tNode, this._rootLView);
22007
+ function getDirectiveMetadata$1(directiveOrComponentInstance) {
22008
+ const { constructor } = directiveOrComponentInstance;
22009
+ if (!constructor) {
22010
+ throw new Error('Unable to find the instance constructor');
22325
22011
  }
22326
- destroy() {
22327
- this.hostView.destroy();
22012
+ // In case a component inherits from a directive, we may have component and directive metadata
22013
+ // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
22014
+ const componentDef = getComponentDef(constructor);
22015
+ if (componentDef) {
22016
+ return {
22017
+ inputs: componentDef.inputs,
22018
+ outputs: componentDef.outputs,
22019
+ encapsulation: componentDef.encapsulation,
22020
+ changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
22021
+ ChangeDetectionStrategy.Default
22022
+ };
22328
22023
  }
22329
- onDestroy(callback) {
22330
- this.hostView.onDestroy(callback);
22024
+ const directiveDef = getDirectiveDef(constructor);
22025
+ if (directiveDef) {
22026
+ return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
22331
22027
  }
22028
+ return null;
22332
22029
  }
22333
-
22334
22030
  /**
22335
- * @license
22336
- * Copyright Google LLC All Rights Reserved.
22031
+ * Retrieve map of local references.
22337
22032
  *
22338
- * Use of this source code is governed by an MIT-style license that can be
22339
- * found in the LICENSE file at https://angular.io/license
22033
+ * The references are retrieved as a map of local reference name to element or directive instance.
22034
+ *
22035
+ * @param target DOM element, component or directive instance for which to retrieve
22036
+ * the local references.
22340
22037
  */
22038
+ function getLocalRefs(target) {
22039
+ const context = getLContext(target);
22040
+ if (context === null)
22041
+ return {};
22042
+ if (context.localRefs === undefined) {
22043
+ const lView = context.lView;
22044
+ if (lView === null) {
22045
+ return {};
22046
+ }
22047
+ context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
22048
+ }
22049
+ return context.localRefs || {};
22050
+ }
22341
22051
  /**
22342
- * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
22343
- * @param ngModule NgModule class.
22344
- * @param parentInjector Optional injector instance to use as a parent for the module injector. If
22345
- * not provided, `NullInjector` will be used instead.
22052
+ * Retrieves the host element of a component or directive instance.
22053
+ * The host element is the DOM element that matched the selector of the directive.
22054
+ *
22055
+ * @param componentOrDirective Component or directive instance for which the host
22056
+ * element should be retrieved.
22057
+ * @returns Host element of the target.
22058
+ *
22346
22059
  * @publicApi
22060
+ * @globalApi ng
22347
22061
  */
22348
- function createNgModuleRef(ngModule, parentInjector) {
22349
- return new NgModuleRef(ngModule, parentInjector !== null && parentInjector !== void 0 ? parentInjector : null);
22062
+ function getHostElement(componentOrDirective) {
22063
+ return getLContext(componentOrDirective).native;
22350
22064
  }
22351
- class NgModuleRef extends NgModuleRef$1 {
22352
- constructor(ngModuleType, _parent) {
22353
- super();
22354
- this._parent = _parent;
22355
- // tslint:disable-next-line:require-internal-with-underscore
22356
- this._bootstrapComponents = [];
22357
- this.injector = this;
22358
- this.destroyCbs = [];
22359
- // When bootstrapping a module we have a dependency graph that looks like this:
22360
- // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
22361
- // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
22362
- // circular dependency which will result in a runtime error, because the injector doesn't
22363
- // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
22364
- // and providing it, rather than letting the injector resolve it.
22365
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22366
- const ngModuleDef = getNgModuleDef(ngModuleType);
22367
- ngDevMode &&
22368
- assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
22369
- this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
22370
- this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
22371
- { provide: NgModuleRef$1, useValue: this }, {
22372
- provide: ComponentFactoryResolver$1,
22373
- useValue: this.componentFactoryResolver
22065
+ /**
22066
+ * Retrieves the rendered text for a given component.
22067
+ *
22068
+ * This function retrieves the host element of a component and
22069
+ * and then returns the `textContent` for that element. This implies
22070
+ * that the text returned will include re-projected content of
22071
+ * the component as well.
22072
+ *
22073
+ * @param component The component to return the content text for.
22074
+ */
22075
+ function getRenderedText(component) {
22076
+ const hostElement = getHostElement(component);
22077
+ return hostElement.textContent || '';
22078
+ }
22079
+ /**
22080
+ * Retrieves a list of event listeners associated with a DOM element. The list does include host
22081
+ * listeners, but it does not include event listeners defined outside of the Angular context
22082
+ * (e.g. through `addEventListener`).
22083
+ *
22084
+ * @usageNotes
22085
+ * Given the following DOM structure:
22086
+ *
22087
+ * ```html
22088
+ * <app-root>
22089
+ * <div (click)="doSomething()"></div>
22090
+ * </app-root>
22091
+ * ```
22092
+ *
22093
+ * Calling `getListeners` on `<div>` will return an object that looks as follows:
22094
+ *
22095
+ * ```ts
22096
+ * {
22097
+ * name: 'click',
22098
+ * element: <div>,
22099
+ * callback: () => doSomething(),
22100
+ * useCapture: false
22101
+ * }
22102
+ * ```
22103
+ *
22104
+ * @param element Element for which the DOM listeners should be retrieved.
22105
+ * @returns Array of event listeners on the DOM element.
22106
+ *
22107
+ * @publicApi
22108
+ * @globalApi ng
22109
+ */
22110
+ function getListeners(element) {
22111
+ ngDevMode && assertDomElement(element);
22112
+ const lContext = getLContext(element);
22113
+ const lView = lContext === null ? null : lContext.lView;
22114
+ if (lView === null)
22115
+ return [];
22116
+ const tView = lView[TVIEW];
22117
+ const lCleanup = lView[CLEANUP];
22118
+ const tCleanup = tView.cleanup;
22119
+ const listeners = [];
22120
+ if (tCleanup && lCleanup) {
22121
+ for (let i = 0; i < tCleanup.length;) {
22122
+ const firstParam = tCleanup[i++];
22123
+ const secondParam = tCleanup[i++];
22124
+ if (typeof firstParam === 'string') {
22125
+ const name = firstParam;
22126
+ const listenerElement = unwrapRNode(lView[secondParam]);
22127
+ const callback = lCleanup[tCleanup[i++]];
22128
+ const useCaptureOrIndx = tCleanup[i++];
22129
+ // if useCaptureOrIndx is boolean then report it as is.
22130
+ // if useCaptureOrIndx is positive number then it in unsubscribe method
22131
+ // if useCaptureOrIndx is negative number then it is a Subscription
22132
+ const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
22133
+ const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
22134
+ if (element == listenerElement) {
22135
+ listeners.push({ element, name, callback, useCapture, type });
22136
+ }
22374
22137
  }
22375
- ], stringify(ngModuleType), new Set(['environment']));
22376
- // We need to resolve the injector types separately from the injector creation, because
22377
- // the module might be trying to use this ref in its constructor for DI which will cause a
22378
- // circular error that will eventually error out, because the injector isn't created yet.
22379
- this._r3Injector.resolveInjectorInitializers();
22380
- this.instance = this.get(ngModuleType);
22381
- }
22382
- get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
22383
- if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
22384
- return this;
22385
22138
  }
22386
- return this._r3Injector.get(token, notFoundValue, injectFlags);
22387
- }
22388
- destroy() {
22389
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22390
- const injector = this._r3Injector;
22391
- !injector.destroyed && injector.destroy();
22392
- this.destroyCbs.forEach(fn => fn());
22393
- this.destroyCbs = null;
22394
- }
22395
- onDestroy(callback) {
22396
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22397
- this.destroyCbs.push(callback);
22398
- }
22399
- }
22400
- class NgModuleFactory extends NgModuleFactory$1 {
22401
- constructor(moduleType) {
22402
- super();
22403
- this.moduleType = moduleType;
22404
- }
22405
- create(parentInjector) {
22406
- return new NgModuleRef(this.moduleType, parentInjector);
22407
22139
  }
22140
+ listeners.sort(sortListeners);
22141
+ return listeners;
22408
22142
  }
22409
- class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22410
- constructor(providers, parent, source) {
22411
- super();
22412
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22413
- this.instance = null;
22414
- const injector = new R3Injector([
22415
- ...providers,
22416
- { provide: NgModuleRef$1, useValue: this },
22417
- { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
22418
- ], parent || getNullInjector(), source, new Set(['environment']));
22419
- this.injector = injector;
22420
- injector.resolveInjectorInitializers();
22421
- }
22422
- destroy() {
22423
- this.injector.destroy();
22424
- }
22425
- onDestroy(callback) {
22426
- this.injector.onDestroy(callback);
22427
- }
22143
+ function sortListeners(a, b) {
22144
+ if (a.name == b.name)
22145
+ return 0;
22146
+ return a.name < b.name ? -1 : 1;
22428
22147
  }
22429
22148
  /**
22430
- * Create a new environment injector.
22149
+ * This function should not exist because it is megamorphic and only mostly correct.
22431
22150
  *
22432
- * @publicApi
22433
- * @developerPreview
22151
+ * See call site for more info.
22434
22152
  */
22435
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22436
- const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22437
- return adapter.injector;
22153
+ function isDirectiveDefHack(obj) {
22154
+ return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
22438
22155
  }
22439
-
22440
22156
  /**
22441
- * @license
22442
- * Copyright Google LLC All Rights Reserved.
22157
+ * Returns the attached `DebugNode` instance for an element in the DOM.
22443
22158
  *
22444
- * Use of this source code is governed by an MIT-style license that can be
22445
- * found in the LICENSE file at https://angular.io/license
22446
- */
22447
- /**
22448
- * A service used by the framework to create instances of standalone injectors. Those injectors are
22449
- * created on demand in case of dynamic component instantiation and contain ambient providers
22450
- * collected from the imports graph rooted at a given standalone component.
22159
+ * @param element DOM element which is owned by an existing component's view.
22451
22160
  */
22452
- class StandaloneService {
22453
- constructor(_injector) {
22454
- this._injector = _injector;
22455
- this.cachedInjectors = new Map();
22161
+ function getDebugNode$1(element) {
22162
+ if (ngDevMode && !(element instanceof Node)) {
22163
+ throw new Error('Expecting instance of DOM Element');
22456
22164
  }
22457
- getOrCreateStandaloneInjector(componentDef) {
22458
- if (!componentDef.standalone) {
22459
- return null;
22460
- }
22461
- if (!this.cachedInjectors.has(componentDef.id)) {
22462
- const providers = internalImportProvidersFrom(false, componentDef.type);
22463
- const standaloneInjector = providers.length > 0 ?
22464
- createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22465
- null;
22466
- this.cachedInjectors.set(componentDef.id, standaloneInjector);
22467
- }
22468
- return this.cachedInjectors.get(componentDef.id);
22165
+ const lContext = getLContext(element);
22166
+ const lView = lContext ? lContext.lView : null;
22167
+ if (lView === null) {
22168
+ return null;
22469
22169
  }
22470
- ngOnDestroy() {
22471
- try {
22472
- for (const injector of this.cachedInjectors.values()) {
22473
- if (injector !== null) {
22474
- injector.destroy();
22475
- }
22476
- }
22477
- }
22478
- finally {
22479
- this.cachedInjectors.clear();
22480
- }
22170
+ const nodeIndex = lContext.nodeIndex;
22171
+ if (nodeIndex !== -1) {
22172
+ const valueInLView = lView[nodeIndex];
22173
+ // this means that value in the lView is a component with its own
22174
+ // data. In this situation the TNode is not accessed at the same spot.
22175
+ const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
22176
+ ngDevMode &&
22177
+ assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
22178
+ return buildDebugNode(tNode, lView);
22481
22179
  }
22180
+ return null;
22482
22181
  }
22483
- /** @nocollapse */
22484
- StandaloneService.ɵprov = ɵɵdefineInjectable({
22485
- token: StandaloneService,
22486
- providedIn: 'environment',
22487
- factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
22488
- });
22489
22182
  /**
22490
- * A feature that acts as a setup code for the {@link StandaloneService}.
22183
+ * Retrieve the component `LView` from component/element.
22491
22184
  *
22492
- * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
22493
- * function (an entry points to a standalone injector creation) on a component definition object. We
22494
- * go through the features infrastructure to make sure that the standalone injector creation logic
22495
- * is tree-shakable and not included in applications that don't use standalone components.
22185
+ * NOTE: `LView` is a private and should not be leaked outside.
22186
+ * Don't export this method to `ng.*` on window.
22496
22187
  *
22497
- * @codeGenApi
22188
+ * @param target DOM element or component instance for which to retrieve the LView.
22498
22189
  */
22499
- function ɵɵStandaloneFeature(definition) {
22500
- definition.getStandaloneInjector = (parentInjector) => {
22501
- return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
22502
- };
22190
+ function getComponentLView(target) {
22191
+ const lContext = getLContext(target);
22192
+ const nodeIndx = lContext.nodeIndex;
22193
+ const lView = lContext.lView;
22194
+ ngDevMode && assertLView(lView);
22195
+ const componentLView = lView[nodeIndx];
22196
+ ngDevMode && assertLView(componentLView);
22197
+ return componentLView;
22198
+ }
22199
+ /** Asserts that a value is a DOM Element. */
22200
+ function assertDomElement(value) {
22201
+ if (typeof Element !== 'undefined' && !(value instanceof Element)) {
22202
+ throw new Error('Expecting instance of DOM Element');
22203
+ }
22503
22204
  }
22504
22205
 
22505
22206
  /**
@@ -23720,7 +23421,7 @@ const unusedValueExportToPlacateAjd = 1;
23720
23421
  * Use of this source code is governed by an MIT-style license that can be
23721
23422
  * found in the LICENSE file at https://angular.io/license
23722
23423
  */
23723
- const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd;
23424
+ const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd;
23724
23425
  class LQuery_ {
23725
23426
  constructor(queryList) {
23726
23427
  this.queryList = queryList;
@@ -26142,6 +25843,99 @@ const COMPILER_OPTIONS = new InjectionToken('compilerOptions');
26142
25843
  class CompilerFactory {
26143
25844
  }
26144
25845
 
25846
+ /**
25847
+ * @license
25848
+ * Copyright Google LLC All Rights Reserved.
25849
+ *
25850
+ * Use of this source code is governed by an MIT-style license that can be
25851
+ * found in the LICENSE file at https://angular.io/license
25852
+ */
25853
+ /**
25854
+ * Marks a component for check (in case of OnPush components) and synchronously
25855
+ * performs change detection on the application this component belongs to.
25856
+ *
25857
+ * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
25858
+ *
25859
+ * @publicApi
25860
+ * @globalApi ng
25861
+ */
25862
+ function applyChanges(component) {
25863
+ markDirty(component);
25864
+ getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
25865
+ }
25866
+
25867
+ /**
25868
+ * @license
25869
+ * Copyright Google LLC All Rights Reserved.
25870
+ *
25871
+ * Use of this source code is governed by an MIT-style license that can be
25872
+ * found in the LICENSE file at https://angular.io/license
25873
+ */
25874
+ /**
25875
+ * This file introduces series of globally accessible debug tools
25876
+ * to allow for the Angular debugging story to function.
25877
+ *
25878
+ * To see this in action run the following command:
25879
+ *
25880
+ * bazel run //packages/core/test/bundling/todo:devserver
25881
+ *
25882
+ * Then load `localhost:5432` and start using the console tools.
25883
+ */
25884
+ /**
25885
+ * This value reflects the property on the window where the dev
25886
+ * tools are patched (window.ng).
25887
+ * */
25888
+ const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
25889
+ let _published = false;
25890
+ /**
25891
+ * Publishes a collection of default debug tools onto`window.ng`.
25892
+ *
25893
+ * These functions are available globally when Angular is in development
25894
+ * mode and are automatically stripped away from prod mode is on.
25895
+ */
25896
+ function publishDefaultGlobalUtils$1() {
25897
+ if (!_published) {
25898
+ _published = true;
25899
+ /**
25900
+ * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
25901
+ * The contract of the function might be changed in any release and/or the function can be
25902
+ * removed completely.
25903
+ */
25904
+ publishGlobalUtil('ɵsetProfiler', setProfiler);
25905
+ publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
25906
+ publishGlobalUtil('getComponent', getComponent);
25907
+ publishGlobalUtil('getContext', getContext);
25908
+ publishGlobalUtil('getListeners', getListeners);
25909
+ publishGlobalUtil('getOwningComponent', getOwningComponent);
25910
+ publishGlobalUtil('getHostElement', getHostElement);
25911
+ publishGlobalUtil('getInjector', getInjector);
25912
+ publishGlobalUtil('getRootComponents', getRootComponents);
25913
+ publishGlobalUtil('getDirectives', getDirectives);
25914
+ publishGlobalUtil('applyChanges', applyChanges);
25915
+ }
25916
+ }
25917
+ /**
25918
+ * Publishes the given function to `window.ng` so that it can be
25919
+ * used from the browser console when an application is not in production.
25920
+ */
25921
+ function publishGlobalUtil(name, fn) {
25922
+ if (typeof COMPILED === 'undefined' || !COMPILED) {
25923
+ // Note: we can't export `ng` when using closure enhanced optimization as:
25924
+ // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
25925
+ // - we can't declare a closure extern as the namespace `ng` is already used within Google
25926
+ // for typings for AngularJS (via `goog.provide('ng....')`).
25927
+ const w = _global;
25928
+ ngDevMode && assertDefined(fn, 'function not defined');
25929
+ if (w) {
25930
+ let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
25931
+ if (!container) {
25932
+ container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
25933
+ }
25934
+ container[name] = fn;
25935
+ }
25936
+ }
25937
+ }
25938
+
26145
25939
  /**
26146
25940
  * @license
26147
25941
  * Copyright Google LLC All Rights Reserved.
@@ -26297,7 +26091,7 @@ class NgZone {
26297
26091
  */
26298
26092
  this.onError = new EventEmitter(false);
26299
26093
  if (typeof Zone == 'undefined') {
26300
- throw new Error(`In this configuration Angular requires Zone.js`);
26094
+ throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);
26301
26095
  }
26302
26096
  Zone.assertZonePatched();
26303
26097
  const self = this;
@@ -26324,12 +26118,12 @@ class NgZone {
26324
26118
  }
26325
26119
  static assertInAngularZone() {
26326
26120
  if (!NgZone.isInAngularZone()) {
26327
- throw new Error('Expected to be in Angular Zone, but it is not!');
26121
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
26328
26122
  }
26329
26123
  }
26330
26124
  static assertNotInAngularZone() {
26331
26125
  if (NgZone.isInAngularZone()) {
26332
- throw new Error('Expected to not be in Angular Zone, but it is!');
26126
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
26333
26127
  }
26334
26128
  }
26335
26129
  /**
@@ -26900,7 +26694,7 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26900
26694
  * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
26901
26695
  * entire class tree-shakeable.
26902
26696
  */
26903
- const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
26697
+ const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
26904
26698
  const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
26905
26699
  function compileNgModuleFactory(injector, options, moduleType) {
26906
26700
  ngDevMode && assertNgModuleType(moduleType);
@@ -27039,7 +26833,15 @@ function internalBootstrapApplication(config) {
27039
26833
  const localeId = appInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
27040
26834
  setLocaleId(localeId || DEFAULT_LOCALE_ID);
27041
26835
  const appRef = appInjector.get(ApplicationRef);
27042
- appRef.onDestroy(() => onErrorSubscription.unsubscribe());
26836
+ // If the whole platform is destroyed, invoke the `destroy` method
26837
+ // for all bootstrapped applications as well.
26838
+ const destroyListener = () => appRef.destroy();
26839
+ const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS, null);
26840
+ onPlatformDestroyListeners === null || onPlatformDestroyListeners === void 0 ? void 0 : onPlatformDestroyListeners.add(destroyListener);
26841
+ appRef.onDestroy(() => {
26842
+ onPlatformDestroyListeners === null || onPlatformDestroyListeners === void 0 ? void 0 : onPlatformDestroyListeners.delete(destroyListener);
26843
+ onErrorSubscription.unsubscribe();
26844
+ });
27043
26845
  appRef.bootstrap(rootComponent);
27044
26846
  return appRef;
27045
26847
  });
@@ -27103,7 +26905,7 @@ function createPlatformInjector(providers = [], name) {
27103
26905
  name,
27104
26906
  providers: [
27105
26907
  { provide: INJECTOR_SCOPE, useValue: 'platform' },
27106
- { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
26908
+ { provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => _platformInjector = null]) },
27107
26909
  ...providers
27108
26910
  ],
27109
26911
  });
@@ -27252,8 +27054,11 @@ class PlatformRef {
27252
27054
  }
27253
27055
  this._modules.slice().forEach(module => module.destroy());
27254
27056
  this._destroyListeners.forEach(listener => listener());
27255
- const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
27256
- destroyListener === null || destroyListener === void 0 ? void 0 : destroyListener();
27057
+ const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
27058
+ if (destroyListeners) {
27059
+ destroyListeners.forEach(listener => listener());
27060
+ destroyListeners.clear();
27061
+ }
27257
27062
  this._destroyed = true;
27258
27063
  }
27259
27064
  /**
@@ -27413,11 +27218,10 @@ function optionsReducer(dst, objs) {
27413
27218
  */
27414
27219
  class ApplicationRef {
27415
27220
  /** @internal */
27416
- constructor(_zone, _injector, _exceptionHandler, _initStatus) {
27221
+ constructor(_zone, _injector, _exceptionHandler) {
27417
27222
  this._zone = _zone;
27418
27223
  this._injector = _injector;
27419
27224
  this._exceptionHandler = _exceptionHandler;
27420
- this._initStatus = _initStatus;
27421
27225
  /** @internal */
27422
27226
  this._bootstrapListeners = [];
27423
27227
  this._views = [];
@@ -27534,7 +27338,8 @@ class ApplicationRef {
27534
27338
  bootstrap(componentOrFactory, rootSelectorOrNode) {
27535
27339
  NG_DEV_MODE && this.warnIfDestroyed();
27536
27340
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
27537
- if (!this._initStatus.done) {
27341
+ const initStatus = this._injector.get(ApplicationInitStatus);
27342
+ if (!initStatus.done) {
27538
27343
  const standalone = !isComponentFactory && isStandalone(componentOrFactory);
27539
27344
  const errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' +
27540
27345
  (standalone ? '' :
@@ -27666,7 +27471,7 @@ class ApplicationRef {
27666
27471
  }
27667
27472
  /**
27668
27473
  * Destroys an Angular application represented by this `ApplicationRef`. Calling this function
27669
- * will destroy the associated environnement injectors as well as all the bootstrapped components
27474
+ * will destroy the associated environment injectors as well as all the bootstrapped components
27670
27475
  * with their views.
27671
27476
  */
27672
27477
  destroy() {
@@ -27693,13 +27498,13 @@ class ApplicationRef {
27693
27498
  }
27694
27499
  }
27695
27500
  }
27696
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
27501
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler)); };
27697
27502
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
27698
27503
  (function () {
27699
27504
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
27700
27505
  type: Injectable,
27701
27506
  args: [{ providedIn: 'root' }]
27702
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null);
27507
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }]; }, null);
27703
27508
  })();
27704
27509
  function remove(list, el) {
27705
27510
  const index = list.indexOf(el);
@@ -28047,7 +27852,7 @@ class DebugNode {
28047
27852
  get componentInstance() {
28048
27853
  const nativeElement = this.nativeNode;
28049
27854
  return nativeElement &&
28050
- (getComponent$1(nativeElement) || getOwningComponent(nativeElement));
27855
+ (getComponent(nativeElement) || getOwningComponent(nativeElement));
28051
27856
  }
28052
27857
  /**
28053
27858
  * An object that provides parent context for this element. Often an ancestor component instance
@@ -28058,7 +27863,7 @@ class DebugNode {
28058
27863
  * of heroes"`.
28059
27864
  */
28060
27865
  get context() {
28061
- return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
27866
+ return getComponent(this.nativeNode) || getContext(this.nativeNode);
28062
27867
  }
28063
27868
  /**
28064
27869
  * The callbacks attached to the component's @Output properties and/or the element's event
@@ -28398,8 +28203,7 @@ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, root
28398
28203
  // Renderer2, however that's not the case in Ivy. This approach is being used because:
28399
28204
  // 1. Matching the ViewEngine behavior would mean potentially introducing a depedency
28400
28205
  // from `Renderer2` to Ivy which could bring Ivy code into ViewEngine.
28401
- // 2. We would have to make `Renderer3` "know" about debug nodes.
28402
- // 3. It allows us to capture nodes that were inserted directly via the DOM.
28206
+ // 2. It allows us to capture nodes that were inserted directly via the DOM.
28403
28207
  nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
28404
28208
  }
28405
28209
  // In all cases, if a dynamic container exists for this node, each view inside it has to be
@@ -29871,5 +29675,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29871
29675
  * Generated bundle index. Do not edit.
29872
29676
  */
29873
29677
 
29874
- 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 };
29678
+ 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 };
29875
29679
  //# sourceMappingURL=core.mjs.map