@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/fesm2020/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
  */
@@ -1593,87 +1593,6 @@ function getNamespaceUri(namespace) {
1593
1593
  (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
1594
1594
  }
1595
1595
 
1596
- /**
1597
- * @license
1598
- * Copyright Google LLC All Rights Reserved.
1599
- *
1600
- * Use of this source code is governed by an MIT-style license that can be
1601
- * found in the LICENSE file at https://angular.io/license
1602
- */
1603
- /**
1604
- * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
1605
- * inject the `DOCUMENT` token and are done.
1606
- *
1607
- * Ivy is special because it does not rely upon the DI and must get hold of the document some other
1608
- * way.
1609
- *
1610
- * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
1611
- * Wherever ivy needs the global document, it calls `getDocument()` instead.
1612
- *
1613
- * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
1614
- * tell ivy what the global `document` is.
1615
- *
1616
- * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
1617
- * by calling `setDocument()` when providing the `DOCUMENT` token.
1618
- */
1619
- let DOCUMENT = undefined;
1620
- /**
1621
- * Tell ivy what the `document` is for this platform.
1622
- *
1623
- * It is only necessary to call this if the current platform is not a browser.
1624
- *
1625
- * @param document The object representing the global `document` in this environment.
1626
- */
1627
- function setDocument(document) {
1628
- DOCUMENT = document;
1629
- }
1630
- /**
1631
- * Access the object that represents the `document` for this platform.
1632
- *
1633
- * Ivy calls this whenever it needs to access the `document` object.
1634
- * For example to create the renderer or to do sanitization.
1635
- */
1636
- function getDocument() {
1637
- if (DOCUMENT !== undefined) {
1638
- return DOCUMENT;
1639
- }
1640
- else if (typeof document !== 'undefined') {
1641
- return document;
1642
- }
1643
- // No "document" can be found. This should only happen if we are running ivy outside Angular and
1644
- // the current platform is not a browser. Since this is not a supported scenario at the moment
1645
- // this should not happen in Angular apps.
1646
- // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
1647
- // public API. Meanwhile we just return `undefined` and let the application fail.
1648
- return undefined;
1649
- }
1650
-
1651
- /**
1652
- * @license
1653
- * Copyright Google LLC All Rights Reserved.
1654
- *
1655
- * Use of this source code is governed by an MIT-style license that can be
1656
- * found in the LICENSE file at https://angular.io/license
1657
- */
1658
- // TODO: cleanup once the code is merged in angular/angular
1659
- var RendererStyleFlags3;
1660
- (function (RendererStyleFlags3) {
1661
- RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
1662
- RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
1663
- })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
1664
- /** Returns whether the `renderer` is a `ProceduralRenderer3` */
1665
- function isProceduralRenderer(renderer) {
1666
- return !!(renderer.listen);
1667
- }
1668
- const domRendererFactory3 = {
1669
- createRenderer: (hostElement, rendererType) => {
1670
- return getDocument();
1671
- }
1672
- };
1673
- // Note: This hack is necessary so we don't erroneously get a circular dependency
1674
- // failure based on types.
1675
- const unusedValueExportToPlacateAjd$6 = 1;
1676
-
1677
1596
  /**
1678
1597
  * @license
1679
1598
  * Copyright Google LLC All Rights Reserved.
@@ -1756,7 +1675,6 @@ function getNativeByTNode(tNode, lView) {
1756
1675
  ngDevMode && assertTNodeForLView(tNode, lView);
1757
1676
  ngDevMode && assertIndexInRange(lView, tNode.index);
1758
1677
  const node = unwrapRNode(lView[tNode.index]);
1759
- ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1760
1678
  return node;
1761
1679
  }
1762
1680
  /**
@@ -1772,7 +1690,6 @@ function getNativeByTNodeOrNull(tNode, lView) {
1772
1690
  if (index !== -1) {
1773
1691
  ngDevMode && assertTNodeForLView(tNode, lView);
1774
1692
  const node = unwrapRNode(lView[index]);
1775
- ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1776
1693
  return node;
1777
1694
  }
1778
1695
  return null;
@@ -2721,7 +2638,7 @@ function isFactory(obj) {
2721
2638
  }
2722
2639
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2723
2640
  // failure based on types.
2724
- const unusedValueExportToPlacateAjd$5 = 1;
2641
+ const unusedValueExportToPlacateAjd$6 = 1;
2725
2642
 
2726
2643
  /**
2727
2644
  * Converts `TNodeType` into human readable text.
@@ -2740,7 +2657,7 @@ function toTNodeTypeAsString(tNodeType) {
2740
2657
  }
2741
2658
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2742
2659
  // failure based on types.
2743
- const unusedValueExportToPlacateAjd$4 = 1;
2660
+ const unusedValueExportToPlacateAjd$5 = 1;
2744
2661
  /**
2745
2662
  * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.
2746
2663
  *
@@ -2844,7 +2761,6 @@ function assertPureTNodeType(type) {
2844
2761
  * @returns the index value that was last accessed in the attributes array
2845
2762
  */
2846
2763
  function setUpAttributes(renderer, native, attrs) {
2847
- const isProc = isProceduralRenderer(renderer);
2848
2764
  let i = 0;
2849
2765
  while (i < attrs.length) {
2850
2766
  const value = attrs[i];
@@ -2861,9 +2777,7 @@ function setUpAttributes(renderer, native, attrs) {
2861
2777
  const attrName = attrs[i++];
2862
2778
  const attrVal = attrs[i++];
2863
2779
  ngDevMode && ngDevMode.rendererSetAttribute++;
2864
- isProc ?
2865
- renderer.setAttribute(native, attrName, attrVal, namespaceURI) :
2866
- native.setAttributeNS(namespaceURI, attrName, attrVal);
2780
+ renderer.setAttribute(native, attrName, attrVal, namespaceURI);
2867
2781
  }
2868
2782
  else {
2869
2783
  // attrName is string;
@@ -2872,14 +2786,10 @@ function setUpAttributes(renderer, native, attrs) {
2872
2786
  // Standard attributes
2873
2787
  ngDevMode && ngDevMode.rendererSetAttribute++;
2874
2788
  if (isAnimationProp(attrName)) {
2875
- if (isProc) {
2876
- renderer.setProperty(native, attrName, attrVal);
2877
- }
2789
+ renderer.setProperty(native, attrName, attrVal);
2878
2790
  }
2879
2791
  else {
2880
- isProc ?
2881
- renderer.setAttribute(native, attrName, attrVal) :
2882
- native.setAttribute(attrName, attrVal);
2792
+ renderer.setAttribute(native, attrName, attrVal);
2883
2793
  }
2884
2794
  i++;
2885
2795
  }
@@ -4875,22 +4785,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
4875
4785
  * Throws an error indicating that a factory function could not be generated by the compiler for a
4876
4786
  * particular class.
4877
4787
  *
4878
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
4879
- * off, saving bytes of generated code while still providing a good experience in dev mode.
4880
- *
4881
4788
  * The name of the class is not mentioned here, but will be in the generated factory function name
4882
4789
  * and thus in the stack trace.
4883
4790
  *
4884
4791
  * @codeGenApi
4885
4792
  */
4886
4793
  function ɵɵinvalidFactoryDep(index) {
4887
- const msg = ngDevMode ?
4794
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4888
4795
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4889
4796
  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.
4890
4797
 
4891
- 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.` :
4892
- 'invalid';
4893
- throw new Error(msg);
4798
+ 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.`);
4894
4799
  }
4895
4800
  /**
4896
4801
  * Injects a token from the currently active injector.
@@ -5154,7 +5059,7 @@ function reflectDependency(dep) {
5154
5059
  }
5155
5060
  else if (param instanceof Attribute) {
5156
5061
  if (param.attributeName === undefined) {
5157
- throw new Error(`Attribute name must be defined.`);
5062
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5158
5063
  }
5159
5064
  meta.attribute = param.attributeName;
5160
5065
  }
@@ -5340,6 +5245,61 @@ function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
5340
5245
  checkForDuplicateNgModules = !allowDuplicates;
5341
5246
  }
5342
5247
 
5248
+ /**
5249
+ * @license
5250
+ * Copyright Google LLC All Rights Reserved.
5251
+ *
5252
+ * Use of this source code is governed by an MIT-style license that can be
5253
+ * found in the LICENSE file at https://angular.io/license
5254
+ */
5255
+ /**
5256
+ * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
5257
+ * inject the `DOCUMENT` token and are done.
5258
+ *
5259
+ * Ivy is special because it does not rely upon the DI and must get hold of the document some other
5260
+ * way.
5261
+ *
5262
+ * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
5263
+ * Wherever ivy needs the global document, it calls `getDocument()` instead.
5264
+ *
5265
+ * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
5266
+ * tell ivy what the global `document` is.
5267
+ *
5268
+ * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
5269
+ * by calling `setDocument()` when providing the `DOCUMENT` token.
5270
+ */
5271
+ let DOCUMENT = undefined;
5272
+ /**
5273
+ * Tell ivy what the `document` is for this platform.
5274
+ *
5275
+ * It is only necessary to call this if the current platform is not a browser.
5276
+ *
5277
+ * @param document The object representing the global `document` in this environment.
5278
+ */
5279
+ function setDocument(document) {
5280
+ DOCUMENT = document;
5281
+ }
5282
+ /**
5283
+ * Access the object that represents the `document` for this platform.
5284
+ *
5285
+ * Ivy calls this whenever it needs to access the `document` object.
5286
+ * For example to create the renderer or to do sanitization.
5287
+ */
5288
+ function getDocument() {
5289
+ if (DOCUMENT !== undefined) {
5290
+ return DOCUMENT;
5291
+ }
5292
+ else if (typeof document !== 'undefined') {
5293
+ return document;
5294
+ }
5295
+ // No "document" can be found. This should only happen if we are running ivy outside Angular and
5296
+ // the current platform is not a browser. Since this is not a supported scenario at the moment
5297
+ // this should not happen in Angular apps.
5298
+ // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
5299
+ // public API. Meanwhile we just return `undefined` and let the application fail.
5300
+ return undefined;
5301
+ }
5302
+
5343
5303
  /**
5344
5304
  * @license
5345
5305
  * Copyright Google LLC All Rights Reserved.
@@ -7069,6 +7029,17 @@ function ensureIcuContainerVisitorLoaded(loader) {
7069
7029
  }
7070
7030
  }
7071
7031
 
7032
+ /**
7033
+ * @license
7034
+ * Copyright Google LLC All Rights Reserved.
7035
+ *
7036
+ * Use of this source code is governed by an MIT-style license that can be
7037
+ * found in the LICENSE file at https://angular.io/license
7038
+ */
7039
+ // Note: This hack is necessary so we don't erroneously get a circular dependency
7040
+ // failure based on types.
7041
+ const unusedValueExportToPlacateAjd$4 = 1;
7042
+
7072
7043
  /**
7073
7044
  * @license
7074
7045
  * Copyright Google LLC All Rights Reserved.
@@ -7151,7 +7122,7 @@ function getNearestLContainer(viewOrContainer) {
7151
7122
  * Use of this source code is governed by an MIT-style license that can be
7152
7123
  * found in the LICENSE file at https://angular.io/license
7153
7124
  */
7154
- const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$8;
7125
+ const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$8;
7155
7126
  /**
7156
7127
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
7157
7128
  * being passed as an argument.
@@ -7176,7 +7147,6 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7176
7147
  lNodeToHandle = lNodeToHandle[HOST];
7177
7148
  }
7178
7149
  const rNode = unwrapRNode(lNodeToHandle);
7179
- ngDevMode && !isProceduralRenderer(renderer) && assertDomNode(rNode);
7180
7150
  if (action === 0 /* WalkTNodeTreeAction.Create */ && parent !== null) {
7181
7151
  if (beforeNode == null) {
7182
7152
  nativeAppendChild(renderer, parent, rNode);
@@ -7203,17 +7173,14 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7203
7173
  function createTextNode(renderer, value) {
7204
7174
  ngDevMode && ngDevMode.rendererCreateTextNode++;
7205
7175
  ngDevMode && ngDevMode.rendererSetText++;
7206
- return isProceduralRenderer(renderer) ? renderer.createText(value) :
7207
- renderer.createTextNode(value);
7176
+ return renderer.createText(value);
7208
7177
  }
7209
7178
  function updateTextNode(renderer, rNode, value) {
7210
7179
  ngDevMode && ngDevMode.rendererSetText++;
7211
- isProceduralRenderer(renderer) ? renderer.setValue(rNode, value) : rNode.textContent = value;
7180
+ renderer.setValue(rNode, value);
7212
7181
  }
7213
7182
  function createCommentNode(renderer, value) {
7214
7183
  ngDevMode && ngDevMode.rendererCreateComment++;
7215
- // isProceduralRenderer check is not needed because both `Renderer2` and `Renderer3` have the same
7216
- // method name.
7217
7184
  return renderer.createComment(escapeCommentText(value));
7218
7185
  }
7219
7186
  /**
@@ -7225,14 +7192,7 @@ function createCommentNode(renderer, value) {
7225
7192
  */
7226
7193
  function createElementNode(renderer, name, namespace) {
7227
7194
  ngDevMode && ngDevMode.rendererCreateElement++;
7228
- if (isProceduralRenderer(renderer)) {
7229
- return renderer.createElement(name, namespace);
7230
- }
7231
- else {
7232
- const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
7233
- return namespaceUri === null ? renderer.createElement(name) :
7234
- renderer.createElementNS(namespaceUri, name);
7235
- }
7195
+ return renderer.createElement(name, namespace);
7236
7196
  }
7237
7197
  /**
7238
7198
  * Removes all DOM elements associated with a view.
@@ -7464,7 +7424,7 @@ function detachView(lContainer, removeIndex) {
7464
7424
  function destroyLView(tView, lView) {
7465
7425
  if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7466
7426
  const renderer = lView[RENDERER];
7467
- if (isProceduralRenderer(renderer) && renderer.destroyNode) {
7427
+ if (renderer.destroyNode) {
7468
7428
  applyView(tView, lView, renderer, 3 /* WalkTNodeTreeAction.Destroy */, null, null);
7469
7429
  }
7470
7430
  destroyViewTree(lView);
@@ -7492,7 +7452,7 @@ function cleanUpView(tView, lView) {
7492
7452
  executeOnDestroys(tView, lView);
7493
7453
  processCleanups(tView, lView);
7494
7454
  // For component views only, the local renderer is destroyed at clean up time.
7495
- if (lView[TVIEW].type === 1 /* TViewType.Component */ && isProceduralRenderer(lView[RENDERER])) {
7455
+ if (lView[TVIEW].type === 1 /* TViewType.Component */) {
7496
7456
  ngDevMode && ngDevMode.rendererDestroy++;
7497
7457
  lView[RENDERER].destroy();
7498
7458
  }
@@ -7668,30 +7628,17 @@ function getClosestRElement(tView, tNode, lView) {
7668
7628
  }
7669
7629
  }
7670
7630
  /**
7671
- * Inserts a native node before another native node for a given parent using {@link Renderer3}.
7672
- * This is a utility function that can be used when native nodes were determined - it abstracts an
7673
- * actual renderer being used.
7631
+ * Inserts a native node before another native node for a given parent.
7632
+ * This is a utility function that can be used when native nodes were determined.
7674
7633
  */
7675
7634
  function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
7676
7635
  ngDevMode && ngDevMode.rendererInsertBefore++;
7677
- if (isProceduralRenderer(renderer)) {
7678
- renderer.insertBefore(parent, child, beforeNode, isMove);
7679
- }
7680
- else {
7681
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7682
- targetParent.insertBefore(child, beforeNode, isMove);
7683
- }
7636
+ renderer.insertBefore(parent, child, beforeNode, isMove);
7684
7637
  }
7685
7638
  function nativeAppendChild(renderer, parent, child) {
7686
7639
  ngDevMode && ngDevMode.rendererAppendChild++;
7687
7640
  ngDevMode && assertDefined(parent, 'parent node must be defined');
7688
- if (isProceduralRenderer(renderer)) {
7689
- renderer.appendChild(parent, child);
7690
- }
7691
- else {
7692
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7693
- targetParent.appendChild(child);
7694
- }
7641
+ renderer.appendChild(parent, child);
7695
7642
  }
7696
7643
  function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
7697
7644
  if (beforeNode !== null) {
@@ -7703,12 +7650,7 @@ function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove)
7703
7650
  }
7704
7651
  /** Removes a node from the DOM given its native parent. */
7705
7652
  function nativeRemoveChild(renderer, parent, child, isHostElement) {
7706
- if (isProceduralRenderer(renderer)) {
7707
- renderer.removeChild(parent, child, isHostElement);
7708
- }
7709
- else {
7710
- parent.removeChild(child);
7711
- }
7653
+ renderer.removeChild(parent, child, isHostElement);
7712
7654
  }
7713
7655
  /** Checks if an element is a `<template>` node. */
7714
7656
  function isTemplateNode(node) {
@@ -7718,13 +7660,13 @@ function isTemplateNode(node) {
7718
7660
  * Returns a native parent of a given native node.
7719
7661
  */
7720
7662
  function nativeParentNode(renderer, node) {
7721
- return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode);
7663
+ return renderer.parentNode(node);
7722
7664
  }
7723
7665
  /**
7724
7666
  * Returns a native sibling of a given native node.
7725
7667
  */
7726
7668
  function nativeNextSibling(renderer, node) {
7727
- return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
7669
+ return renderer.nextSibling(node);
7728
7670
  }
7729
7671
  /**
7730
7672
  * Find a node in front of which `currentTNode` should be inserted.
@@ -8033,39 +7975,22 @@ function applyContainer(renderer, action, lContainer, parentRElement, beforeNode
8033
7975
  * otherwise).
8034
7976
  */
8035
7977
  function applyStyling(renderer, isClassBased, rNode, prop, value) {
8036
- const isProcedural = isProceduralRenderer(renderer);
8037
7978
  if (isClassBased) {
8038
7979
  // We actually want JS true/false here because any truthy value should add the class
8039
7980
  if (!value) {
8040
7981
  ngDevMode && ngDevMode.rendererRemoveClass++;
8041
- if (isProcedural) {
8042
- renderer.removeClass(rNode, prop);
8043
- }
8044
- else {
8045
- rNode.classList.remove(prop);
8046
- }
7982
+ renderer.removeClass(rNode, prop);
8047
7983
  }
8048
7984
  else {
8049
7985
  ngDevMode && ngDevMode.rendererAddClass++;
8050
- if (isProcedural) {
8051
- renderer.addClass(rNode, prop);
8052
- }
8053
- else {
8054
- ngDevMode && assertDefined(rNode.classList, 'HTMLElement expected');
8055
- rNode.classList.add(prop);
8056
- }
7986
+ renderer.addClass(rNode, prop);
8057
7987
  }
8058
7988
  }
8059
7989
  else {
8060
7990
  let flags = prop.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase;
8061
7991
  if (value == null /** || value === undefined */) {
8062
7992
  ngDevMode && ngDevMode.rendererRemoveStyle++;
8063
- if (isProcedural) {
8064
- renderer.removeStyle(rNode, prop, flags);
8065
- }
8066
- else {
8067
- rNode.style.removeProperty(prop);
8068
- }
7993
+ renderer.removeStyle(rNode, prop, flags);
8069
7994
  }
8070
7995
  else {
8071
7996
  // A value is important if it ends with `!important`. The style
@@ -8077,13 +8002,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8077
8002
  flags |= RendererStyleFlags2.Important;
8078
8003
  }
8079
8004
  ngDevMode && ngDevMode.rendererSetStyle++;
8080
- if (isProcedural) {
8081
- renderer.setStyle(rNode, prop, value, flags);
8082
- }
8083
- else {
8084
- ngDevMode && assertDefined(rNode.style, 'HTMLElement expected');
8085
- rNode.style.setProperty(prop, value, isImportant ? 'important' : '');
8086
- }
8005
+ renderer.setStyle(rNode, prop, value, flags);
8087
8006
  }
8088
8007
  }
8089
8008
  }
@@ -8099,12 +8018,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8099
8018
  */
8100
8019
  function writeDirectStyle(renderer, element, newValue) {
8101
8020
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8102
- if (isProceduralRenderer(renderer)) {
8103
- renderer.setAttribute(element, 'style', newValue);
8104
- }
8105
- else {
8106
- element.style.cssText = newValue;
8107
- }
8021
+ renderer.setAttribute(element, 'style', newValue);
8108
8022
  ngDevMode && ngDevMode.rendererSetStyle++;
8109
8023
  }
8110
8024
  /**
@@ -8119,17 +8033,12 @@ function writeDirectStyle(renderer, element, newValue) {
8119
8033
  */
8120
8034
  function writeDirectClass(renderer, element, newValue) {
8121
8035
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8122
- if (isProceduralRenderer(renderer)) {
8123
- if (newValue === '') {
8124
- // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8125
- renderer.removeAttribute(element, 'class');
8126
- }
8127
- else {
8128
- renderer.setAttribute(element, 'class', newValue);
8129
- }
8036
+ if (newValue === '') {
8037
+ // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8038
+ renderer.removeAttribute(element, 'class');
8130
8039
  }
8131
8040
  else {
8132
- element.className = newValue;
8041
+ renderer.setAttribute(element, 'class', newValue);
8133
8042
  }
8134
8043
  ngDevMode && ngDevMode.rendererSetClassName++;
8135
8044
  }
@@ -8179,7 +8088,7 @@ function classIndexOf(className, classToSearch, startingIndex) {
8179
8088
  * Use of this source code is governed by an MIT-style license that can be
8180
8089
  * found in the LICENSE file at https://angular.io/license
8181
8090
  */
8182
- const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3;
8091
+ const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4;
8183
8092
  const NG_TEMPLATE_SELECTOR = 'ng-template';
8184
8093
  /**
8185
8094
  * Search the `TAttributes` to see if it contains `cssClassToMatch` (case insensitive)
@@ -9818,7 +9727,7 @@ class ReflectiveKey {
9818
9727
  this.token = token;
9819
9728
  this.id = id;
9820
9729
  if (!token) {
9821
- throw new Error('Token must be defined!');
9730
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
9822
9731
  }
9823
9732
  this.displayName = stringify(this.token);
9824
9733
  }
@@ -11508,6 +11417,13 @@ class LContainerDebug {
11508
11417
  }
11509
11418
  }
11510
11419
 
11420
+ /**
11421
+ * @license
11422
+ * Copyright Google LLC All Rights Reserved.
11423
+ *
11424
+ * Use of this source code is governed by an MIT-style license that can be
11425
+ * found in the LICENSE file at https://angular.io/license
11426
+ */
11511
11427
  /**
11512
11428
  * A permanent marker promise which signifies that the current CD tree is
11513
11429
  * clean.
@@ -11575,7 +11491,7 @@ function refreshChildComponents(hostLView, components) {
11575
11491
  /** Renders child components in the current view (creation mode). */
11576
11492
  function renderChildComponents(hostLView, components) {
11577
11493
  for (let i = 0; i < components.length; i++) {
11578
- renderComponent$1(hostLView, components[i]);
11494
+ renderComponent(hostLView, components[i]);
11579
11495
  }
11580
11496
  }
11581
11497
  function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
@@ -12093,16 +12009,6 @@ function createViewBlueprint(bindingStartIndex, initialViewLength) {
12093
12009
  function createError(text, token) {
12094
12010
  return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
12095
12011
  }
12096
- function assertHostNodeExists(rElement, elementOrSelector) {
12097
- if (!rElement) {
12098
- if (typeof elementOrSelector === 'string') {
12099
- throw createError('Host node with selector not found:', elementOrSelector);
12100
- }
12101
- else {
12102
- throw createError('Host node is required:', elementOrSelector);
12103
- }
12104
- }
12105
- }
12106
12012
  /**
12107
12013
  * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
12108
12014
  *
@@ -12111,21 +12017,9 @@ function assertHostNodeExists(rElement, elementOrSelector) {
12111
12017
  * @param encapsulation View Encapsulation defined for component that requests host element.
12112
12018
  */
12113
12019
  function locateHostElement(renderer, elementOrSelector, encapsulation) {
12114
- if (isProceduralRenderer(renderer)) {
12115
- // When using native Shadow DOM, do not clear host element to allow native slot projection
12116
- const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12117
- return renderer.selectRootElement(elementOrSelector, preserveContent);
12118
- }
12119
- let rElement = typeof elementOrSelector === 'string' ?
12120
- renderer.querySelector(elementOrSelector) :
12121
- elementOrSelector;
12122
- ngDevMode && assertHostNodeExists(rElement, elementOrSelector);
12123
- // Always clear host element's content when Renderer3 is in use. For procedural renderer case we
12124
- // make it depend on whether ShadowDom encapsulation is used (in which case the content should be
12125
- // preserved to allow native slot projection). ShadowDom encapsulation requires procedural
12126
- // renderer, and procedural renderer case is handled above.
12127
- rElement.textContent = '';
12128
- return rElement;
12020
+ // When using native Shadow DOM, do not clear host element to allow native slot projection
12021
+ const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12022
+ return renderer.selectRootElement(elementOrSelector, preserveContent);
12129
12023
  }
12130
12024
  /**
12131
12025
  * Saves context for this cleanup function in LView.cleanupInstances.
@@ -12340,13 +12234,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12340
12234
  // It is assumed that the sanitizer is only added when the compiler determines that the
12341
12235
  // property is risky, so sanitization can be done without further checks.
12342
12236
  value = sanitizer != null ? sanitizer(value, tNode.value || '', propName) : value;
12343
- if (isProceduralRenderer(renderer)) {
12344
- renderer.setProperty(element, propName, value);
12345
- }
12346
- else if (!isAnimationProp(propName)) {
12347
- element.setProperty ? element.setProperty(propName, value) :
12348
- element[propName] = value;
12349
- }
12237
+ renderer.setProperty(element, propName, value);
12350
12238
  }
12351
12239
  else if (tNode.type & 12 /* TNodeType.AnyContainer */) {
12352
12240
  // If the node is a container and the property didn't
@@ -12370,23 +12258,15 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
12370
12258
  const debugValue = normalizeDebugBindingValue(value);
12371
12259
  if (type & 3 /* TNodeType.AnyRNode */) {
12372
12260
  if (value == null) {
12373
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, attrName) :
12374
- element.removeAttribute(attrName);
12261
+ renderer.removeAttribute(element, attrName);
12375
12262
  }
12376
12263
  else {
12377
- isProceduralRenderer(renderer) ?
12378
- renderer.setAttribute(element, attrName, debugValue) :
12379
- element.setAttribute(attrName, debugValue);
12264
+ renderer.setAttribute(element, attrName, debugValue);
12380
12265
  }
12381
12266
  }
12382
12267
  else {
12383
12268
  const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
12384
- if (isProceduralRenderer(renderer)) {
12385
- renderer.setValue(element, textContent);
12386
- }
12387
- else {
12388
- element.textContent = textContent;
12389
- }
12269
+ renderer.setValue(element, textContent);
12390
12270
  }
12391
12271
  }
12392
12272
  function setNgReflectProperties(lView, element, type, dataValue, value) {
@@ -12740,19 +12620,12 @@ function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespac
12740
12620
  function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) {
12741
12621
  if (value == null) {
12742
12622
  ngDevMode && ngDevMode.rendererRemoveAttribute++;
12743
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) :
12744
- element.removeAttribute(name);
12623
+ renderer.removeAttribute(element, name, namespace);
12745
12624
  }
12746
12625
  else {
12747
12626
  ngDevMode && ngDevMode.rendererSetAttribute++;
12748
12627
  const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || '', name);
12749
- if (isProceduralRenderer(renderer)) {
12750
- renderer.setAttribute(element, name, strValue, namespace);
12751
- }
12752
- else {
12753
- namespace ? element.setAttributeNS(namespace, name, strValue) :
12754
- element.setAttribute(name, strValue);
12755
- }
12628
+ renderer.setAttribute(element, name, strValue, namespace);
12756
12629
  }
12757
12630
  }
12758
12631
  /**
@@ -12844,7 +12717,6 @@ const LContainerArray = class LContainer extends Array {
12844
12717
  */
12845
12718
  function createLContainer(hostNative, currentView, native, tNode) {
12846
12719
  ngDevMode && assertLView(currentView);
12847
- ngDevMode && !isProceduralRenderer(currentView[RENDERER]) && assertDomNode(native);
12848
12720
  // https://jsperf.com/array-literal-vs-new-array-really
12849
12721
  const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative, // host native
12850
12722
  true, // Boolean `true` in this position signifies that this is an `LContainer`
@@ -12960,7 +12832,7 @@ function refreshContainsDirtyView(lView) {
12960
12832
  }
12961
12833
  }
12962
12834
  }
12963
- function renderComponent$1(hostLView, componentHostIdx) {
12835
+ function renderComponent(hostLView, componentHostIdx) {
12964
12836
  ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
12965
12837
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
12966
12838
  const componentTView = componentView[TVIEW];
@@ -13312,457 +13184,474 @@ function computeStaticStyling(tNode, attrs, writeToHost) {
13312
13184
  * Use of this source code is governed by an MIT-style license that can be
13313
13185
  * found in the LICENSE file at https://angular.io/license
13314
13186
  */
13187
+ // TODO: A hack to not pull in the NullInjector from @angular/core.
13188
+ const NULL_INJECTOR = {
13189
+ get: (token, notFoundValue) => {
13190
+ throwProviderNotFoundError(token, 'NullInjector');
13191
+ }
13192
+ };
13315
13193
  /**
13316
- * Synchronously perform change detection on a component (and possibly its sub-components).
13194
+ * Creates the root component view and the root component node.
13317
13195
  *
13318
- * This function triggers change detection in a synchronous way on a component.
13196
+ * @param rNode Render host element.
13197
+ * @param def ComponentDef
13198
+ * @param rootView The parent view where the host node is stored
13199
+ * @param rendererFactory Factory to be used for creating child renderers.
13200
+ * @param hostRenderer The current renderer
13201
+ * @param sanitizer The sanitizer, if provided
13319
13202
  *
13320
- * @param component The component which the change detection should be performed on.
13203
+ * @returns Component view created
13321
13204
  */
13322
- function detectChanges(component) {
13323
- const view = getComponentViewByInstance(component);
13324
- detectChangesInternal(view[TVIEW], view, component);
13205
+ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13206
+ const tView = rootView[TVIEW];
13207
+ const index = HEADER_OFFSET;
13208
+ ngDevMode && assertIndexInRange(rootView, index);
13209
+ rootView[index] = rNode;
13210
+ // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13211
+ // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13212
+ // representing a host element.
13213
+ const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13214
+ const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13215
+ if (mergedAttrs !== null) {
13216
+ computeStaticStyling(tNode, mergedAttrs, true);
13217
+ if (rNode !== null) {
13218
+ setUpAttributes(hostRenderer, rNode, mergedAttrs);
13219
+ if (tNode.classes !== null) {
13220
+ writeDirectClass(hostRenderer, rNode, tNode.classes);
13221
+ }
13222
+ if (tNode.styles !== null) {
13223
+ writeDirectStyle(hostRenderer, rNode, tNode.styles);
13224
+ }
13225
+ }
13226
+ }
13227
+ const viewRenderer = rendererFactory.createRenderer(rNode, def);
13228
+ const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13229
+ if (tView.firstCreatePass) {
13230
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13231
+ markAsComponentHost(tView, tNode);
13232
+ initTNodeFlags(tNode, rootView.length, 1);
13233
+ }
13234
+ addToViewTree(rootView, componentView);
13235
+ // Store component view at node index, with node as the HOST
13236
+ return rootView[index] = componentView;
13325
13237
  }
13326
13238
  /**
13327
- * Marks the component as dirty (needing change detection). Marking a component dirty will
13328
- * schedule a change detection on it at some point in the future.
13329
- *
13330
- * Marking an already dirty component as dirty won't do anything. Only one outstanding change
13331
- * detection can be scheduled per component tree.
13332
- *
13333
- * @param component Component to mark as dirty.
13239
+ * Creates a root component and sets it up with features and host bindings. Shared by
13240
+ * renderComponent() and ViewContainerRef.createComponent().
13334
13241
  */
13335
- function markDirty(component) {
13336
- ngDevMode && assertDefined(component, 'component');
13337
- const rootView = markViewDirty(getComponentViewByInstance(component));
13338
- ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
13339
- scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
13242
+ function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13243
+ const tView = rootLView[TVIEW];
13244
+ // Create directive instance with factory() and store at next index in viewData
13245
+ const component = instantiateRootComponent(tView, rootLView, componentDef);
13246
+ rootContext.components.push(component);
13247
+ componentView[CONTEXT] = component;
13248
+ if (hostFeatures !== null) {
13249
+ for (const feature of hostFeatures) {
13250
+ feature(component, componentDef);
13251
+ }
13252
+ }
13253
+ // We want to generate an empty QueryList for root content queries for backwards
13254
+ // compatibility with ViewEngine.
13255
+ if (componentDef.contentQueries) {
13256
+ const tNode = getCurrentTNode();
13257
+ ngDevMode && assertDefined(tNode, 'TNode expected');
13258
+ componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13259
+ }
13260
+ const rootTNode = getCurrentTNode();
13261
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13262
+ if (tView.firstCreatePass &&
13263
+ (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13264
+ setSelectedIndex(rootTNode.index);
13265
+ const rootTView = rootLView[TVIEW];
13266
+ registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13267
+ invokeHostBindingsInCreationMode(componentDef, component);
13268
+ }
13269
+ return component;
13270
+ }
13271
+ function createRootContext(scheduler, playerHandler) {
13272
+ return {
13273
+ components: [],
13274
+ scheduler: scheduler || defaultScheduler,
13275
+ clean: CLEAN_PROMISE,
13276
+ playerHandler: playerHandler || null,
13277
+ flags: 0 /* RootContextFlags.Empty */
13278
+ };
13340
13279
  }
13341
13280
  /**
13342
- * Used to perform change detection on the whole application.
13281
+ * Used to enable lifecycle hooks on the root component.
13343
13282
  *
13344
- * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick`
13345
- * executes lifecycle hooks and conditionally checks components based on their
13346
- * `ChangeDetectionStrategy` and dirtiness.
13283
+ * Include this feature when calling `renderComponent` if the root component
13284
+ * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
13285
+ * be called properly.
13347
13286
  *
13348
- * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally
13349
- * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a
13350
- * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can
13351
- * be changed when calling `renderComponent` and providing the `scheduler` option.
13352
- */
13353
- function tick(component) {
13354
- const rootView = getRootView(component);
13355
- const rootContext = rootView[CONTEXT];
13356
- tickRootContext(rootContext);
13357
- }
13358
-
13359
- /**
13360
- * @license
13361
- * Copyright Google LLC All Rights Reserved.
13287
+ * Example:
13362
13288
  *
13363
- * Use of this source code is governed by an MIT-style license that can be
13364
- * found in the LICENSE file at https://angular.io/license
13289
+ * ```
13290
+ * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13291
+ * ```
13365
13292
  */
13293
+ function LifecycleHooksFeature() {
13294
+ const tNode = getCurrentTNode();
13295
+ ngDevMode && assertDefined(tNode, 'TNode is required');
13296
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13297
+ }
13366
13298
  /**
13367
- * Retrieves the component instance associated with a given DOM element.
13299
+ * Wait on component until it is rendered.
13368
13300
  *
13369
- * @usageNotes
13370
- * Given the following DOM structure:
13301
+ * This function returns a `Promise` which is resolved when the component's
13302
+ * change detection is executed. This is determined by finding the scheduler
13303
+ * associated with the `component`'s render tree and waiting until the scheduler
13304
+ * flushes. If nothing is scheduled, the function returns a resolved promise.
13371
13305
  *
13372
- * ```html
13373
- * <app-root>
13374
- * <div>
13375
- * <child-comp></child-comp>
13376
- * </div>
13377
- * </app-root>
13306
+ * Example:
13307
+ * ```
13308
+ * await whenRendered(myComponent);
13378
13309
  * ```
13379
13310
  *
13380
- * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
13381
- * associated with this DOM element.
13382
- *
13383
- * Calling the function on `<app-root>` will return the `MyApp` instance.
13384
- *
13385
- *
13386
- * @param element DOM element from which the component should be retrieved.
13387
- * @returns Component instance associated with the element or `null` if there
13388
- * is no component associated with it.
13389
- *
13390
- * @publicApi
13391
- * @globalApi ng
13311
+ * @param component Component to wait upon
13312
+ * @returns Promise which resolves when the component is rendered.
13392
13313
  */
13393
- function getComponent$1(element) {
13394
- ngDevMode && assertDomElement(element);
13395
- const context = getLContext(element);
13396
- if (context === null)
13397
- return null;
13398
- if (context.component === undefined) {
13399
- const lView = context.lView;
13400
- if (lView === null) {
13401
- return null;
13402
- }
13403
- context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
13404
- }
13405
- return context.component;
13314
+ function whenRendered(component) {
13315
+ return getRootContext(component).clean;
13406
13316
  }
13317
+
13407
13318
  /**
13408
- * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
13409
- * view that the element is part of. Otherwise retrieves the instance of the component whose view
13410
- * owns the element (in this case, the result is the same as calling `getOwningComponent`).
13411
- *
13412
- * @param element Element for which to get the surrounding component instance.
13413
- * @returns Instance of the component that is around the element or null if the element isn't
13414
- * inside any component.
13319
+ * @license
13320
+ * Copyright Google LLC All Rights Reserved.
13415
13321
  *
13416
- * @publicApi
13417
- * @globalApi ng
13322
+ * Use of this source code is governed by an MIT-style license that can be
13323
+ * found in the LICENSE file at https://angular.io/license
13418
13324
  */
13419
- function getContext(element) {
13420
- assertDomElement(element);
13421
- const context = getLContext(element);
13422
- const lView = context ? context.lView : null;
13423
- return lView === null ? null : lView[CONTEXT];
13325
+ function getSuperType(type) {
13326
+ return Object.getPrototypeOf(type.prototype).constructor;
13424
13327
  }
13425
13328
  /**
13426
- * Retrieves the component instance whose view contains the DOM element.
13427
- *
13428
- * For example, if `<child-comp>` is used in the template of `<app-comp>`
13429
- * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
13430
- * would return `<app-comp>`.
13431
- *
13432
- * @param elementOrDir DOM element, component or directive instance
13433
- * for which to retrieve the root components.
13434
- * @returns Component instance whose view owns the DOM element or null if the element is not
13435
- * part of a component view.
13329
+ * Merges the definition from a super class to a sub class.
13330
+ * @param definition The definition that is a SubClass of another directive of component
13436
13331
  *
13437
- * @publicApi
13438
- * @globalApi ng
13332
+ * @codeGenApi
13439
13333
  */
13440
- function getOwningComponent(elementOrDir) {
13441
- const context = getLContext(elementOrDir);
13442
- let lView = context ? context.lView : null;
13443
- if (lView === null)
13444
- return null;
13445
- let parent;
13446
- while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
13447
- lView = parent;
13334
+ function ɵɵInheritDefinitionFeature(definition) {
13335
+ let superType = getSuperType(definition.type);
13336
+ let shouldInheritFields = true;
13337
+ const inheritanceChain = [definition];
13338
+ while (superType) {
13339
+ let superDef = undefined;
13340
+ if (isComponentDef(definition)) {
13341
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13342
+ superDef = superType.ɵcmp || superType.ɵdir;
13343
+ }
13344
+ else {
13345
+ if (superType.ɵcmp) {
13346
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
13347
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
13348
+ }
13349
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13350
+ superDef = superType.ɵdir;
13351
+ }
13352
+ if (superDef) {
13353
+ if (shouldInheritFields) {
13354
+ inheritanceChain.push(superDef);
13355
+ // Some fields in the definition may be empty, if there were no values to put in them that
13356
+ // would've justified object creation. Unwrap them if necessary.
13357
+ const writeableDef = definition;
13358
+ writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
13359
+ writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
13360
+ writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
13361
+ // Merge hostBindings
13362
+ const superHostBindings = superDef.hostBindings;
13363
+ superHostBindings && inheritHostBindings(definition, superHostBindings);
13364
+ // Merge queries
13365
+ const superViewQuery = superDef.viewQuery;
13366
+ const superContentQueries = superDef.contentQueries;
13367
+ superViewQuery && inheritViewQuery(definition, superViewQuery);
13368
+ superContentQueries && inheritContentQueries(definition, superContentQueries);
13369
+ // Merge inputs and outputs
13370
+ fillProperties(definition.inputs, superDef.inputs);
13371
+ fillProperties(definition.declaredInputs, superDef.declaredInputs);
13372
+ fillProperties(definition.outputs, superDef.outputs);
13373
+ // Merge animations metadata.
13374
+ // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
13375
+ if (isComponentDef(superDef) && superDef.data.animation) {
13376
+ // If super def is a Component, the `definition` is also a Component, since Directives can
13377
+ // not inherit Components (we throw an error above and cannot reach this code).
13378
+ const defData = definition.data;
13379
+ defData.animation = (defData.animation || []).concat(superDef.data.animation);
13380
+ }
13381
+ }
13382
+ // Run parent features
13383
+ const features = superDef.features;
13384
+ if (features) {
13385
+ for (let i = 0; i < features.length; i++) {
13386
+ const feature = features[i];
13387
+ if (feature && feature.ngInherit) {
13388
+ feature(definition);
13389
+ }
13390
+ // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
13391
+ // def already has all the necessary information inherited from its super class(es), so we
13392
+ // can stop merging fields from super classes. However we need to iterate through the
13393
+ // prototype chain to look for classes that might contain other "features" (like
13394
+ // NgOnChanges), which we should invoke for the original `definition`. We set the
13395
+ // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
13396
+ // logic and only invoking functions from the "features" list.
13397
+ if (feature === ɵɵInheritDefinitionFeature) {
13398
+ shouldInheritFields = false;
13399
+ }
13400
+ }
13401
+ }
13402
+ }
13403
+ superType = Object.getPrototypeOf(superType);
13448
13404
  }
13449
- return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
13405
+ mergeHostAttrsAcrossInheritance(inheritanceChain);
13450
13406
  }
13451
13407
  /**
13452
- * Retrieves all root components associated with a DOM element, directive or component instance.
13453
- * Root components are those which have been bootstrapped by Angular.
13454
- *
13455
- * @param elementOrDir DOM element, component or directive instance
13456
- * for which to retrieve the root components.
13457
- * @returns Root components associated with the target object.
13408
+ * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
13458
13409
  *
13459
- * @publicApi
13460
- * @globalApi ng
13410
+ * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
13411
+ * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
13412
+ * type.
13461
13413
  */
13462
- function getRootComponents(elementOrDir) {
13463
- const lView = readPatchedLView(elementOrDir);
13464
- return lView !== null ? [...getRootContext(lView).components] : [];
13414
+ function mergeHostAttrsAcrossInheritance(inheritanceChain) {
13415
+ let hostVars = 0;
13416
+ let hostAttrs = null;
13417
+ // We process the inheritance order from the base to the leaves here.
13418
+ for (let i = inheritanceChain.length - 1; i >= 0; i--) {
13419
+ const def = inheritanceChain[i];
13420
+ // For each `hostVars`, we need to add the superclass amount.
13421
+ def.hostVars = (hostVars += def.hostVars);
13422
+ // for each `hostAttrs` we need to merge it with superclass.
13423
+ def.hostAttrs =
13424
+ mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
13425
+ }
13465
13426
  }
13466
- /**
13467
- * Retrieves an `Injector` associated with an element, component or directive instance.
13468
- *
13469
- * @param elementOrDir DOM element, component or directive instance for which to
13470
- * retrieve the injector.
13471
- * @returns Injector associated with the element, component or directive instance.
13472
- *
13473
- * @publicApi
13474
- * @globalApi ng
13475
- */
13476
- function getInjector(elementOrDir) {
13477
- const context = getLContext(elementOrDir);
13478
- const lView = context ? context.lView : null;
13479
- if (lView === null)
13480
- return Injector.NULL;
13481
- const tNode = lView[TVIEW].data[context.nodeIndex];
13482
- return new NodeInjector(tNode, lView);
13483
- }
13484
- /**
13485
- * Retrieve a set of injection tokens at a given DOM node.
13486
- *
13487
- * @param element Element for which the injection tokens should be retrieved.
13488
- */
13489
- function getInjectionTokens(element) {
13490
- const context = getLContext(element);
13491
- const lView = context ? context.lView : null;
13492
- if (lView === null)
13493
- return [];
13494
- const tView = lView[TVIEW];
13495
- const tNode = tView.data[context.nodeIndex];
13496
- const providerTokens = [];
13497
- const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
13498
- const endIndex = tNode.directiveEnd;
13499
- for (let i = startIndex; i < endIndex; i++) {
13500
- let value = tView.data[i];
13501
- if (isDirectiveDefHack(value)) {
13502
- // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
13503
- // design flaw. We should always store same type so that we can be monomorphic. The issue
13504
- // is that for Components/Directives we store the def instead the type. The correct behavior
13505
- // is that we should always be storing injectable type in this location.
13506
- value = value.type;
13507
- }
13508
- providerTokens.push(value);
13427
+ function maybeUnwrapEmpty(value) {
13428
+ if (value === EMPTY_OBJ) {
13429
+ return {};
13509
13430
  }
13510
- return providerTokens;
13511
- }
13512
- /**
13513
- * Retrieves directive instances associated with a given DOM node. Does not include
13514
- * component instances.
13515
- *
13516
- * @usageNotes
13517
- * Given the following DOM structure:
13518
- *
13519
- * ```html
13520
- * <app-root>
13521
- * <button my-button></button>
13522
- * <my-comp></my-comp>
13523
- * </app-root>
13524
- * ```
13525
- *
13526
- * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
13527
- * directive that is associated with the DOM node.
13528
- *
13529
- * Calling `getDirectives` on `<my-comp>` will return an empty array.
13530
- *
13531
- * @param node DOM node for which to get the directives.
13532
- * @returns Array of directives associated with the node.
13533
- *
13534
- * @publicApi
13535
- * @globalApi ng
13536
- */
13537
- function getDirectives(node) {
13538
- // Skip text nodes because we can't have directives associated with them.
13539
- if (node instanceof Text) {
13431
+ else if (value === EMPTY_ARRAY) {
13540
13432
  return [];
13541
13433
  }
13542
- const context = getLContext(node);
13543
- const lView = context ? context.lView : null;
13544
- if (lView === null) {
13545
- return [];
13434
+ else {
13435
+ return value;
13546
13436
  }
13547
- const tView = lView[TVIEW];
13548
- const nodeIndex = context.nodeIndex;
13549
- if (!tView?.data[nodeIndex]) {
13550
- return [];
13437
+ }
13438
+ function inheritViewQuery(definition, superViewQuery) {
13439
+ const prevViewQuery = definition.viewQuery;
13440
+ if (prevViewQuery) {
13441
+ definition.viewQuery = (rf, ctx) => {
13442
+ superViewQuery(rf, ctx);
13443
+ prevViewQuery(rf, ctx);
13444
+ };
13551
13445
  }
13552
- if (context.directives === undefined) {
13553
- context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
13446
+ else {
13447
+ definition.viewQuery = superViewQuery;
13554
13448
  }
13555
- // The `directives` in this case are a named array called `LComponentView`. Clone the
13556
- // result so we don't expose an internal data structure in the user's console.
13557
- return context.directives === null ? [] : [...context.directives];
13558
13449
  }
13559
- /**
13560
- * Returns the debug (partial) metadata for a particular directive or component instance.
13561
- * The function accepts an instance of a directive or component and returns the corresponding
13562
- * metadata.
13563
- *
13564
- * @param directiveOrComponentInstance Instance of a directive or component
13565
- * @returns metadata of the passed directive or component
13566
- *
13567
- * @publicApi
13568
- * @globalApi ng
13569
- */
13570
- function getDirectiveMetadata$1(directiveOrComponentInstance) {
13571
- const { constructor } = directiveOrComponentInstance;
13572
- if (!constructor) {
13573
- throw new Error('Unable to find the instance constructor');
13450
+ function inheritContentQueries(definition, superContentQueries) {
13451
+ const prevContentQueries = definition.contentQueries;
13452
+ if (prevContentQueries) {
13453
+ definition.contentQueries = (rf, ctx, directiveIndex) => {
13454
+ superContentQueries(rf, ctx, directiveIndex);
13455
+ prevContentQueries(rf, ctx, directiveIndex);
13456
+ };
13574
13457
  }
13575
- // In case a component inherits from a directive, we may have component and directive metadata
13576
- // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
13577
- const componentDef = getComponentDef(constructor);
13578
- if (componentDef) {
13579
- return {
13580
- inputs: componentDef.inputs,
13581
- outputs: componentDef.outputs,
13582
- encapsulation: componentDef.encapsulation,
13583
- changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
13584
- ChangeDetectionStrategy.Default
13458
+ else {
13459
+ definition.contentQueries = superContentQueries;
13460
+ }
13461
+ }
13462
+ function inheritHostBindings(definition, superHostBindings) {
13463
+ const prevHostBindings = definition.hostBindings;
13464
+ if (prevHostBindings) {
13465
+ definition.hostBindings = (rf, ctx) => {
13466
+ superHostBindings(rf, ctx);
13467
+ prevHostBindings(rf, ctx);
13585
13468
  };
13586
13469
  }
13587
- const directiveDef = getDirectiveDef(constructor);
13588
- if (directiveDef) {
13589
- return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
13470
+ else {
13471
+ definition.hostBindings = superHostBindings;
13590
13472
  }
13591
- return null;
13592
13473
  }
13474
+
13593
13475
  /**
13594
- * Retrieve map of local references.
13595
- *
13596
- * The references are retrieved as a map of local reference name to element or directive instance.
13476
+ * @license
13477
+ * Copyright Google LLC All Rights Reserved.
13597
13478
  *
13598
- * @param target DOM element, component or directive instance for which to retrieve
13599
- * the local references.
13479
+ * Use of this source code is governed by an MIT-style license that can be
13480
+ * found in the LICENSE file at https://angular.io/license
13600
13481
  */
13601
- function getLocalRefs(target) {
13602
- const context = getLContext(target);
13603
- if (context === null)
13604
- return {};
13605
- if (context.localRefs === undefined) {
13606
- const lView = context.lView;
13607
- if (lView === null) {
13608
- return {};
13609
- }
13610
- context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
13611
- }
13612
- return context.localRefs || {};
13613
- }
13614
13482
  /**
13615
- * Retrieves the host element of a component or directive instance.
13616
- * The host element is the DOM element that matched the selector of the directive.
13617
- *
13618
- * @param componentOrDirective Component or directive instance for which the host
13619
- * element should be retrieved.
13620
- * @returns Host element of the target.
13621
- *
13622
- * @publicApi
13623
- * @globalApi ng
13483
+ * Fields which exist on either directive or component definitions, and need to be copied from
13484
+ * parent to child classes by the `ɵɵCopyDefinitionFeature`.
13624
13485
  */
13625
- function getHostElement(componentOrDirective) {
13626
- return getLContext(componentOrDirective).native;
13627
- }
13486
+ const COPY_DIRECTIVE_FIELDS = [
13487
+ // The child class should use the providers of its parent.
13488
+ 'providersResolver',
13489
+ // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
13490
+ // as inputs, outputs, and host binding functions.
13491
+ ];
13628
13492
  /**
13629
- * Retrieves the rendered text for a given component.
13630
- *
13631
- * This function retrieves the host element of a component and
13632
- * and then returns the `textContent` for that element. This implies
13633
- * that the text returned will include re-projected content of
13634
- * the component as well.
13493
+ * Fields which exist only on component definitions, and need to be copied from parent to child
13494
+ * classes by the `ɵɵCopyDefinitionFeature`.
13635
13495
  *
13636
- * @param component The component to return the content text for.
13496
+ * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
13497
+ * since those should go in `COPY_DIRECTIVE_FIELDS` above.
13637
13498
  */
13638
- function getRenderedText(component) {
13639
- const hostElement = getHostElement(component);
13640
- return hostElement.textContent || '';
13641
- }
13499
+ const COPY_COMPONENT_FIELDS = [
13500
+ // The child class should use the template function of its parent, including all template
13501
+ // semantics.
13502
+ 'template',
13503
+ 'decls',
13504
+ 'consts',
13505
+ 'vars',
13506
+ 'onPush',
13507
+ 'ngContentSelectors',
13508
+ // The child class should use the CSS styles of its parent, including all styling semantics.
13509
+ 'styles',
13510
+ 'encapsulation',
13511
+ // The child class should be checked by the runtime in the same way as its parent.
13512
+ 'schemas',
13513
+ ];
13642
13514
  /**
13643
- * Retrieves a list of event listeners associated with a DOM element. The list does include host
13644
- * listeners, but it does not include event listeners defined outside of the Angular context
13645
- * (e.g. through `addEventListener`).
13646
- *
13647
- * @usageNotes
13648
- * Given the following DOM structure:
13649
- *
13650
- * ```html
13651
- * <app-root>
13652
- * <div (click)="doSomething()"></div>
13653
- * </app-root>
13654
- * ```
13515
+ * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
13516
+ * definition.
13655
13517
  *
13656
- * Calling `getListeners` on `<div>` will return an object that looks as follows:
13518
+ * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
13519
+ * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
13520
+ * generates a skeleton definition on the child class, and applies this feature.
13657
13521
  *
13658
- * ```ts
13659
- * {
13660
- * name: 'click',
13661
- * element: <div>,
13662
- * callback: () => doSomething(),
13663
- * useCapture: false
13664
- * }
13665
- * ```
13522
+ * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
13523
+ * including things like the component template function.
13666
13524
  *
13667
- * @param element Element for which the DOM listeners should be retrieved.
13668
- * @returns Array of event listeners on the DOM element.
13525
+ * @param definition The definition of a child class which inherits from a parent class with its
13526
+ * own definition.
13669
13527
  *
13670
- * @publicApi
13671
- * @globalApi ng
13528
+ * @codeGenApi
13672
13529
  */
13673
- function getListeners(element) {
13674
- ngDevMode && assertDomElement(element);
13675
- const lContext = getLContext(element);
13676
- const lView = lContext === null ? null : lContext.lView;
13677
- if (lView === null)
13678
- return [];
13679
- const tView = lView[TVIEW];
13680
- const lCleanup = lView[CLEANUP];
13681
- const tCleanup = tView.cleanup;
13682
- const listeners = [];
13683
- if (tCleanup && lCleanup) {
13684
- for (let i = 0; i < tCleanup.length;) {
13685
- const firstParam = tCleanup[i++];
13686
- const secondParam = tCleanup[i++];
13687
- if (typeof firstParam === 'string') {
13688
- const name = firstParam;
13689
- const listenerElement = unwrapRNode(lView[secondParam]);
13690
- const callback = lCleanup[tCleanup[i++]];
13691
- const useCaptureOrIndx = tCleanup[i++];
13692
- // if useCaptureOrIndx is boolean then report it as is.
13693
- // if useCaptureOrIndx is positive number then it in unsubscribe method
13694
- // if useCaptureOrIndx is negative number then it is a Subscription
13695
- const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
13696
- const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
13697
- if (element == listenerElement) {
13698
- listeners.push({ element, name, callback, useCapture, type });
13699
- }
13700
- }
13530
+ function ɵɵCopyDefinitionFeature(definition) {
13531
+ let superType = getSuperType(definition.type);
13532
+ let superDef = undefined;
13533
+ if (isComponentDef(definition)) {
13534
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13535
+ superDef = superType.ɵcmp;
13536
+ }
13537
+ else {
13538
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13539
+ superDef = superType.ɵdir;
13540
+ }
13541
+ // Needed because `definition` fields are readonly.
13542
+ const defAny = definition;
13543
+ // Copy over any fields that apply to either directives or components.
13544
+ for (const field of COPY_DIRECTIVE_FIELDS) {
13545
+ defAny[field] = superDef[field];
13546
+ }
13547
+ if (isComponentDef(superDef)) {
13548
+ // Copy over any component-specific fields.
13549
+ for (const field of COPY_COMPONENT_FIELDS) {
13550
+ defAny[field] = superDef[field];
13701
13551
  }
13702
13552
  }
13703
- listeners.sort(sortListeners);
13704
- return listeners;
13705
- }
13706
- function sortListeners(a, b) {
13707
- if (a.name == b.name)
13708
- return 0;
13709
- return a.name < b.name ? -1 : 1;
13710
13553
  }
13554
+
13711
13555
  /**
13712
- * This function should not exist because it is megamorphic and only mostly correct.
13556
+ * @license
13557
+ * Copyright Google LLC All Rights Reserved.
13713
13558
  *
13714
- * See call site for more info.
13559
+ * Use of this source code is governed by an MIT-style license that can be
13560
+ * found in the LICENSE file at https://angular.io/license
13715
13561
  */
13716
- function isDirectiveDefHack(obj) {
13717
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
13562
+ let _symbolIterator = null;
13563
+ function getSymbolIterator() {
13564
+ if (!_symbolIterator) {
13565
+ const Symbol = _global['Symbol'];
13566
+ if (Symbol && Symbol.iterator) {
13567
+ _symbolIterator = Symbol.iterator;
13568
+ }
13569
+ else {
13570
+ // es6-shim specific logic
13571
+ const keys = Object.getOwnPropertyNames(Map.prototype);
13572
+ for (let i = 0; i < keys.length; ++i) {
13573
+ const key = keys[i];
13574
+ if (key !== 'entries' && key !== 'size' &&
13575
+ Map.prototype[key] === Map.prototype['entries']) {
13576
+ _symbolIterator = key;
13577
+ }
13578
+ }
13579
+ }
13580
+ }
13581
+ return _symbolIterator;
13718
13582
  }
13583
+
13719
13584
  /**
13720
- * Returns the attached `DebugNode` instance for an element in the DOM.
13585
+ * @license
13586
+ * Copyright Google LLC All Rights Reserved.
13721
13587
  *
13722
- * @param element DOM element which is owned by an existing component's view.
13588
+ * Use of this source code is governed by an MIT-style license that can be
13589
+ * found in the LICENSE file at https://angular.io/license
13723
13590
  */
13724
- function getDebugNode$1(element) {
13725
- if (ngDevMode && !(element instanceof Node)) {
13726
- throw new Error('Expecting instance of DOM Element');
13591
+ function isIterable(obj) {
13592
+ return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
13593
+ }
13594
+ function isListLikeIterable(obj) {
13595
+ if (!isJsObject(obj))
13596
+ return false;
13597
+ return Array.isArray(obj) ||
13598
+ (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
13599
+ getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
13600
+ }
13601
+ function areIterablesEqual(a, b, comparator) {
13602
+ const iterator1 = a[getSymbolIterator()]();
13603
+ const iterator2 = b[getSymbolIterator()]();
13604
+ while (true) {
13605
+ const item1 = iterator1.next();
13606
+ const item2 = iterator2.next();
13607
+ if (item1.done && item2.done)
13608
+ return true;
13609
+ if (item1.done || item2.done)
13610
+ return false;
13611
+ if (!comparator(item1.value, item2.value))
13612
+ return false;
13727
13613
  }
13728
- const lContext = getLContext(element);
13729
- const lView = lContext ? lContext.lView : null;
13730
- if (lView === null) {
13731
- return null;
13614
+ }
13615
+ function iterateListLike(obj, fn) {
13616
+ if (Array.isArray(obj)) {
13617
+ for (let i = 0; i < obj.length; i++) {
13618
+ fn(obj[i]);
13619
+ }
13732
13620
  }
13733
- const nodeIndex = lContext.nodeIndex;
13734
- if (nodeIndex !== -1) {
13735
- const valueInLView = lView[nodeIndex];
13736
- // this means that value in the lView is a component with its own
13737
- // data. In this situation the TNode is not accessed at the same spot.
13738
- const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
13739
- ngDevMode &&
13740
- assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
13741
- return buildDebugNode(tNode, lView);
13621
+ else {
13622
+ const iterator = obj[getSymbolIterator()]();
13623
+ let item;
13624
+ while (!((item = iterator.next()).done)) {
13625
+ fn(item.value);
13626
+ }
13742
13627
  }
13743
- return null;
13744
13628
  }
13629
+ function isJsObject(o) {
13630
+ return o !== null && (typeof o === 'function' || typeof o === 'object');
13631
+ }
13632
+
13745
13633
  /**
13746
- * Retrieve the component `LView` from component/element.
13747
- *
13748
- * NOTE: `LView` is a private and should not be leaked outside.
13749
- * Don't export this method to `ng.*` on window.
13634
+ * @license
13635
+ * Copyright Google LLC All Rights Reserved.
13750
13636
  *
13751
- * @param target DOM element or component instance for which to retrieve the LView.
13637
+ * Use of this source code is governed by an MIT-style license that can be
13638
+ * found in the LICENSE file at https://angular.io/license
13752
13639
  */
13753
- function getComponentLView(target) {
13754
- const lContext = getLContext(target);
13755
- const nodeIndx = lContext.nodeIndex;
13756
- const lView = lContext.lView;
13757
- ngDevMode && assertLView(lView);
13758
- const componentLView = lView[nodeIndx];
13759
- ngDevMode && assertLView(componentLView);
13760
- return componentLView;
13761
- }
13762
- /** Asserts that a value is a DOM Element. */
13763
- function assertDomElement(value) {
13764
- if (typeof Element !== 'undefined' && !(value instanceof Element)) {
13765
- throw new Error('Expecting instance of DOM Element');
13640
+ function devModeEqual(a, b) {
13641
+ const isListLikeIterableA = isListLikeIterable(a);
13642
+ const isListLikeIterableB = isListLikeIterable(b);
13643
+ if (isListLikeIterableA && isListLikeIterableB) {
13644
+ return areIterablesEqual(a, b, devModeEqual);
13645
+ }
13646
+ else {
13647
+ const isAObject = a && (typeof a === 'object' || typeof a === 'function');
13648
+ const isBObject = b && (typeof b === 'object' || typeof b === 'function');
13649
+ if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
13650
+ return true;
13651
+ }
13652
+ else {
13653
+ return Object.is(a, b);
13654
+ }
13766
13655
  }
13767
13656
  }
13768
13657
 
@@ -13773,18 +13662,72 @@ function assertDomElement(value) {
13773
13662
  * Use of this source code is governed by an MIT-style license that can be
13774
13663
  * found in the LICENSE file at https://angular.io/license
13775
13664
  */
13665
+ // TODO(misko): consider inlining
13666
+ /** Updates binding and returns the value. */
13667
+ function updateBinding(lView, bindingIndex, value) {
13668
+ return lView[bindingIndex] = value;
13669
+ }
13670
+ /** Gets the current binding value. */
13671
+ function getBinding(lView, bindingIndex) {
13672
+ ngDevMode && assertIndexInRange(lView, bindingIndex);
13673
+ ngDevMode &&
13674
+ assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
13675
+ return lView[bindingIndex];
13676
+ }
13776
13677
  /**
13777
- * Marks a component for check (in case of OnPush components) and synchronously
13778
- * performs change detection on the application this component belongs to.
13678
+ * Updates binding if changed, then returns whether it was updated.
13779
13679
  *
13780
- * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
13680
+ * This function also checks the `CheckNoChangesMode` and throws if changes are made.
13681
+ * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
13682
+ * behavior.
13781
13683
  *
13782
- * @publicApi
13783
- * @globalApi ng
13684
+ * @param lView current `LView`
13685
+ * @param bindingIndex The binding in the `LView` to check
13686
+ * @param value New value to check against `lView[bindingIndex]`
13687
+ * @returns `true` if the bindings has changed. (Throws if binding has changed during
13688
+ * `CheckNoChangesMode`)
13784
13689
  */
13785
- function applyChanges(component) {
13786
- markDirty(component);
13787
- getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
13690
+ function bindingUpdated(lView, bindingIndex, value) {
13691
+ ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
13692
+ ngDevMode &&
13693
+ assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
13694
+ const oldValue = lView[bindingIndex];
13695
+ if (Object.is(oldValue, value)) {
13696
+ return false;
13697
+ }
13698
+ else {
13699
+ if (ngDevMode && isInCheckNoChangesMode()) {
13700
+ // View engine didn't report undefined values as changed on the first checkNoChanges pass
13701
+ // (before the change detection was run).
13702
+ const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
13703
+ if (!devModeEqual(oldValueToCompare, value)) {
13704
+ const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
13705
+ throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
13706
+ }
13707
+ // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
13708
+ // For this reason we exit as if no change. The early exit is needed to prevent the changed
13709
+ // value to be written into `LView` (If we would write the new value that we would not see it
13710
+ // as change on next CD.)
13711
+ return false;
13712
+ }
13713
+ lView[bindingIndex] = value;
13714
+ return true;
13715
+ }
13716
+ }
13717
+ /** Updates 2 bindings if changed, then returns whether either was updated. */
13718
+ function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
13719
+ const different = bindingUpdated(lView, bindingIndex, exp1);
13720
+ return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
13721
+ }
13722
+ /** Updates 3 bindings if changed, then returns whether any was updated. */
13723
+ function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
13724
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13725
+ return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
13726
+ }
13727
+ /** Updates 4 bindings if changed, then returns whether any was updated. */
13728
+ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
13729
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13730
+ return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
13788
13731
  }
13789
13732
 
13790
13733
  /**
@@ -13795,68 +13738,28 @@ function applyChanges(component) {
13795
13738
  * found in the LICENSE file at https://angular.io/license
13796
13739
  */
13797
13740
  /**
13798
- * This file introduces series of globally accessible debug tools
13799
- * to allow for the Angular debugging story to function.
13741
+ * Updates the value of or removes a bound attribute on an Element.
13800
13742
  *
13801
- * To see this in action run the following command:
13743
+ * Used in the case of `[attr.title]="value"`
13802
13744
  *
13803
- * bazel run //packages/core/test/bundling/todo:devserver
13804
- *
13805
- * Then load `localhost:5432` and start using the console tools.
13806
- */
13807
- /**
13808
- * This value reflects the property on the window where the dev
13809
- * tools are patched (window.ng).
13810
- * */
13811
- const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
13812
- let _published = false;
13813
- /**
13814
- * Publishes a collection of default debug tools onto`window.ng`.
13745
+ * @param name name The name of the attribute.
13746
+ * @param value value The attribute is removed when value is `null` or `undefined`.
13747
+ * Otherwise the attribute value is set to the stringified value.
13748
+ * @param sanitizer An optional function used to sanitize the value.
13749
+ * @param namespace Optional namespace to use when setting the attribute.
13815
13750
  *
13816
- * These functions are available globally when Angular is in development
13817
- * mode and are automatically stripped away from prod mode is on.
13818
- */
13819
- function publishDefaultGlobalUtils$1() {
13820
- if (!_published) {
13821
- _published = true;
13822
- /**
13823
- * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
13824
- * The contract of the function might be changed in any release and/or the function can be
13825
- * removed completely.
13826
- */
13827
- publishGlobalUtil('ɵsetProfiler', setProfiler);
13828
- publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
13829
- publishGlobalUtil('getComponent', getComponent$1);
13830
- publishGlobalUtil('getContext', getContext);
13831
- publishGlobalUtil('getListeners', getListeners);
13832
- publishGlobalUtil('getOwningComponent', getOwningComponent);
13833
- publishGlobalUtil('getHostElement', getHostElement);
13834
- publishGlobalUtil('getInjector', getInjector);
13835
- publishGlobalUtil('getRootComponents', getRootComponents);
13836
- publishGlobalUtil('getDirectives', getDirectives);
13837
- publishGlobalUtil('applyChanges', applyChanges);
13838
- }
13839
- }
13840
- /**
13841
- * Publishes the given function to `window.ng` so that it can be
13842
- * used from the browser console when an application is not in production.
13751
+ * @codeGenApi
13843
13752
  */
13844
- function publishGlobalUtil(name, fn) {
13845
- if (typeof COMPILED === 'undefined' || !COMPILED) {
13846
- // Note: we can't export `ng` when using closure enhanced optimization as:
13847
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
13848
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
13849
- // for typings for AngularJS (via `goog.provide('ng....')`).
13850
- const w = _global;
13851
- ngDevMode && assertDefined(fn, 'function not defined');
13852
- if (w) {
13853
- let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
13854
- if (!container) {
13855
- container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
13856
- }
13857
- container[name] = fn;
13858
- }
13753
+ function ɵɵattribute(name, value, sanitizer, namespace) {
13754
+ const lView = getLView();
13755
+ const bindingIndex = nextBindingIndex();
13756
+ if (bindingUpdated(lView, bindingIndex, value)) {
13757
+ const tView = getTView();
13758
+ const tNode = getSelectedTNode();
13759
+ elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
13760
+ ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
13859
13761
  }
13762
+ return ɵɵattribute;
13860
13763
  }
13861
13764
 
13862
13765
  /**
@@ -13866,872 +13769,237 @@ function publishGlobalUtil(name, fn) {
13866
13769
  * Use of this source code is governed by an MIT-style license that can be
13867
13770
  * found in the LICENSE file at https://angular.io/license
13868
13771
  */
13869
- // TODO: A hack to not pull in the NullInjector from @angular/core.
13870
- const NULL_INJECTOR = {
13871
- get: (token, notFoundValue) => {
13872
- throwProviderNotFoundError(token, 'NullInjector');
13873
- }
13874
- };
13875
13772
  /**
13876
- * Bootstraps a Component into an existing host element and returns an instance
13877
- * of the component.
13773
+ * Create interpolation bindings with a variable number of expressions.
13774
+ *
13775
+ * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
13776
+ * Those are faster because there is no need to create an array of expressions and iterate over it.
13878
13777
  *
13879
- * Use this function to bootstrap a component into the DOM tree. Each invocation
13880
- * of this function will create a separate tree of components, injectors and
13881
- * change detection cycles and lifetimes. To dynamically insert a new component
13882
- * into an existing tree such that it shares the same injection, change detection
13883
- * and object lifetime, use {@link ViewContainer#createComponent}.
13778
+ * `values`:
13779
+ * - has static text at even indexes,
13780
+ * - has evaluated expressions at odd indexes.
13884
13781
  *
13885
- * @param componentType Component to bootstrap
13886
- * @param options Optional parameters which control bootstrapping
13782
+ * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
13887
13783
  */
13888
- function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13889
- ngDevMode && publishDefaultGlobalUtils$1();
13890
- ngDevMode && assertComponentType(componentType);
13891
- const rendererFactory = opts.rendererFactory || domRendererFactory3;
13892
- const sanitizer = opts.sanitizer || null;
13893
- const componentDef = getComponentDef(componentType);
13894
- if (componentDef.type != componentType)
13895
- componentDef.type = componentType;
13896
- // The first index of the first selector is the tag name.
13897
- const componentTag = componentDef.selectors[0][0];
13898
- const hostRenderer = rendererFactory.createRenderer(null, null);
13899
- const hostRNode = locateHostElement(hostRenderer, opts.host || componentTag, componentDef.encapsulation);
13900
- const rootFlags = componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
13901
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13902
- const rootContext = createRootContext(opts.scheduler, opts.playerHandler);
13903
- const renderer = rendererFactory.createRenderer(hostRNode, componentDef);
13904
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
13905
- const rootView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, null, opts.injector || null, null);
13906
- enterView(rootView);
13907
- let component;
13908
- try {
13909
- if (rendererFactory.begin)
13910
- rendererFactory.begin();
13911
- const componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer);
13912
- component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
13913
- // create mode pass
13914
- renderView(rootTView, rootView, null);
13915
- // update mode pass
13916
- refreshView(rootTView, rootView, null, null);
13784
+ function interpolationV(lView, values) {
13785
+ ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
13786
+ ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
13787
+ let isBindingUpdated = false;
13788
+ let bindingIndex = getBindingIndex();
13789
+ for (let i = 1; i < values.length; i += 2) {
13790
+ // Check if bindings (odd indexes) have changed
13791
+ isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
13917
13792
  }
13918
- finally {
13919
- leaveView();
13920
- if (rendererFactory.end)
13921
- rendererFactory.end();
13793
+ setBindingIndex(bindingIndex);
13794
+ if (!isBindingUpdated) {
13795
+ return NO_CHANGE;
13922
13796
  }
13923
- return component;
13797
+ // Build the updated content
13798
+ let content = values[0];
13799
+ for (let i = 1; i < values.length; i += 2) {
13800
+ content += renderStringify(values[i]) + values[i + 1];
13801
+ }
13802
+ return content;
13924
13803
  }
13925
13804
  /**
13926
- * Creates the root component view and the root component node.
13927
- *
13928
- * @param rNode Render host element.
13929
- * @param def ComponentDef
13930
- * @param rootView The parent view where the host node is stored
13931
- * @param rendererFactory Factory to be used for creating child renderers.
13932
- * @param hostRenderer The current renderer
13933
- * @param sanitizer The sanitizer, if provided
13805
+ * Creates an interpolation binding with 1 expression.
13934
13806
  *
13935
- * @returns Component view created
13807
+ * @param prefix static value used for concatenation only.
13808
+ * @param v0 value checked for change.
13809
+ * @param suffix static value used for concatenation only.
13936
13810
  */
13937
- function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13938
- const tView = rootView[TVIEW];
13939
- const index = HEADER_OFFSET;
13940
- ngDevMode && assertIndexInRange(rootView, index);
13941
- rootView[index] = rNode;
13942
- // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13943
- // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13944
- // representing a host element.
13945
- const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13946
- const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13947
- if (mergedAttrs !== null) {
13948
- computeStaticStyling(tNode, mergedAttrs, true);
13949
- if (rNode !== null) {
13950
- setUpAttributes(hostRenderer, rNode, mergedAttrs);
13951
- if (tNode.classes !== null) {
13952
- writeDirectClass(hostRenderer, rNode, tNode.classes);
13953
- }
13954
- if (tNode.styles !== null) {
13955
- writeDirectStyle(hostRenderer, rNode, tNode.styles);
13956
- }
13957
- }
13958
- }
13959
- const viewRenderer = rendererFactory.createRenderer(rNode, def);
13960
- const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13961
- if (tView.firstCreatePass) {
13962
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13963
- markAsComponentHost(tView, tNode);
13964
- initTNodeFlags(tNode, rootView.length, 1);
13965
- }
13966
- addToViewTree(rootView, componentView);
13967
- // Store component view at node index, with node as the HOST
13968
- return rootView[index] = componentView;
13811
+ function interpolation1(lView, prefix, v0, suffix) {
13812
+ const different = bindingUpdated(lView, nextBindingIndex(), v0);
13813
+ return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
13969
13814
  }
13970
13815
  /**
13971
- * Creates a root component and sets it up with features and host bindings. Shared by
13972
- * renderComponent() and ViewContainerRef.createComponent().
13816
+ * Creates an interpolation binding with 2 expressions.
13973
13817
  */
13974
- function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13975
- const tView = rootLView[TVIEW];
13976
- // Create directive instance with factory() and store at next index in viewData
13977
- const component = instantiateRootComponent(tView, rootLView, componentDef);
13978
- rootContext.components.push(component);
13979
- componentView[CONTEXT] = component;
13980
- if (hostFeatures !== null) {
13981
- for (const feature of hostFeatures) {
13982
- feature(component, componentDef);
13983
- }
13984
- }
13985
- // We want to generate an empty QueryList for root content queries for backwards
13986
- // compatibility with ViewEngine.
13987
- if (componentDef.contentQueries) {
13988
- const tNode = getCurrentTNode();
13989
- ngDevMode && assertDefined(tNode, 'TNode expected');
13990
- componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13991
- }
13992
- const rootTNode = getCurrentTNode();
13993
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13994
- if (tView.firstCreatePass &&
13995
- (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13996
- setSelectedIndex(rootTNode.index);
13997
- const rootTView = rootLView[TVIEW];
13998
- registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13999
- invokeHostBindingsInCreationMode(componentDef, component);
14000
- }
14001
- return component;
14002
- }
14003
- function createRootContext(scheduler, playerHandler) {
14004
- return {
14005
- components: [],
14006
- scheduler: scheduler || defaultScheduler,
14007
- clean: CLEAN_PROMISE,
14008
- playerHandler: playerHandler || null,
14009
- flags: 0 /* RootContextFlags.Empty */
14010
- };
13818
+ function interpolation2(lView, prefix, v0, i0, v1, suffix) {
13819
+ const bindingIndex = getBindingIndex();
13820
+ const different = bindingUpdated2(lView, bindingIndex, v0, v1);
13821
+ incrementBindingIndex(2);
13822
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14011
13823
  }
14012
13824
  /**
14013
- * Used to enable lifecycle hooks on the root component.
14014
- *
14015
- * Include this feature when calling `renderComponent` if the root component
14016
- * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
14017
- * be called properly.
14018
- *
14019
- * Example:
14020
- *
14021
- * ```
14022
- * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
14023
- * ```
13825
+ * Creates an interpolation binding with 3 expressions.
14024
13826
  */
14025
- function LifecycleHooksFeature() {
14026
- const tNode = getCurrentTNode();
14027
- ngDevMode && assertDefined(tNode, 'TNode is required');
14028
- registerPostOrderHooks(getLView()[TVIEW], tNode);
13827
+ function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
13828
+ const bindingIndex = getBindingIndex();
13829
+ const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
13830
+ incrementBindingIndex(3);
13831
+ return different ?
13832
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
13833
+ NO_CHANGE;
14029
13834
  }
14030
13835
  /**
14031
- * Wait on component until it is rendered.
14032
- *
14033
- * This function returns a `Promise` which is resolved when the component's
14034
- * change detection is executed. This is determined by finding the scheduler
14035
- * associated with the `component`'s render tree and waiting until the scheduler
14036
- * flushes. If nothing is scheduled, the function returns a resolved promise.
14037
- *
14038
- * Example:
14039
- * ```
14040
- * await whenRendered(myComponent);
14041
- * ```
14042
- *
14043
- * @param component Component to wait upon
14044
- * @returns Promise which resolves when the component is rendered.
13836
+ * Create an interpolation binding with 4 expressions.
14045
13837
  */
14046
- function whenRendered(component) {
14047
- return getRootContext(component).clean;
13838
+ function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
13839
+ const bindingIndex = getBindingIndex();
13840
+ const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13841
+ incrementBindingIndex(4);
13842
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13843
+ renderStringify(v2) + i2 + renderStringify(v3) + suffix :
13844
+ NO_CHANGE;
14048
13845
  }
14049
-
14050
13846
  /**
14051
- * @license
14052
- * Copyright Google LLC All Rights Reserved.
14053
- *
14054
- * Use of this source code is governed by an MIT-style license that can be
14055
- * found in the LICENSE file at https://angular.io/license
13847
+ * Creates an interpolation binding with 5 expressions.
14056
13848
  */
14057
- function getSuperType(type) {
14058
- return Object.getPrototypeOf(type.prototype).constructor;
14059
- }
13849
+ function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
13850
+ const bindingIndex = getBindingIndex();
13851
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13852
+ different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
13853
+ incrementBindingIndex(5);
13854
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13855
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
13856
+ NO_CHANGE;
13857
+ }
14060
13858
  /**
14061
- * Merges the definition from a super class to a sub class.
14062
- * @param definition The definition that is a SubClass of another directive of component
14063
- *
14064
- * @codeGenApi
13859
+ * Creates an interpolation binding with 6 expressions.
14065
13860
  */
14066
- function ɵɵInheritDefinitionFeature(definition) {
14067
- let superType = getSuperType(definition.type);
14068
- let shouldInheritFields = true;
14069
- const inheritanceChain = [definition];
14070
- while (superType) {
14071
- let superDef = undefined;
14072
- if (isComponentDef(definition)) {
14073
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14074
- superDef = superType.ɵcmp || superType.ɵdir;
14075
- }
14076
- else {
14077
- if (superType.ɵcmp) {
14078
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14079
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14080
- }
14081
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14082
- superDef = superType.ɵdir;
14083
- }
14084
- if (superDef) {
14085
- if (shouldInheritFields) {
14086
- inheritanceChain.push(superDef);
14087
- // Some fields in the definition may be empty, if there were no values to put in them that
14088
- // would've justified object creation. Unwrap them if necessary.
14089
- const writeableDef = definition;
14090
- writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
14091
- writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
14092
- writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
14093
- // Merge hostBindings
14094
- const superHostBindings = superDef.hostBindings;
14095
- superHostBindings && inheritHostBindings(definition, superHostBindings);
14096
- // Merge queries
14097
- const superViewQuery = superDef.viewQuery;
14098
- const superContentQueries = superDef.contentQueries;
14099
- superViewQuery && inheritViewQuery(definition, superViewQuery);
14100
- superContentQueries && inheritContentQueries(definition, superContentQueries);
14101
- // Merge inputs and outputs
14102
- fillProperties(definition.inputs, superDef.inputs);
14103
- fillProperties(definition.declaredInputs, superDef.declaredInputs);
14104
- fillProperties(definition.outputs, superDef.outputs);
14105
- // Merge animations metadata.
14106
- // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
14107
- if (isComponentDef(superDef) && superDef.data.animation) {
14108
- // If super def is a Component, the `definition` is also a Component, since Directives can
14109
- // not inherit Components (we throw an error above and cannot reach this code).
14110
- const defData = definition.data;
14111
- defData.animation = (defData.animation || []).concat(superDef.data.animation);
14112
- }
14113
- }
14114
- // Run parent features
14115
- const features = superDef.features;
14116
- if (features) {
14117
- for (let i = 0; i < features.length; i++) {
14118
- const feature = features[i];
14119
- if (feature && feature.ngInherit) {
14120
- feature(definition);
14121
- }
14122
- // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
14123
- // def already has all the necessary information inherited from its super class(es), so we
14124
- // can stop merging fields from super classes. However we need to iterate through the
14125
- // prototype chain to look for classes that might contain other "features" (like
14126
- // NgOnChanges), which we should invoke for the original `definition`. We set the
14127
- // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
14128
- // logic and only invoking functions from the "features" list.
14129
- if (feature === ɵɵInheritDefinitionFeature) {
14130
- shouldInheritFields = false;
14131
- }
14132
- }
14133
- }
14134
- }
14135
- superType = Object.getPrototypeOf(superType);
14136
- }
14137
- mergeHostAttrsAcrossInheritance(inheritanceChain);
13861
+ function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
13862
+ const bindingIndex = getBindingIndex();
13863
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13864
+ different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
13865
+ incrementBindingIndex(6);
13866
+ return different ?
13867
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
13868
+ renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
13869
+ NO_CHANGE;
14138
13870
  }
14139
13871
  /**
14140
- * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
14141
- *
14142
- * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
14143
- * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
14144
- * type.
13872
+ * Creates an interpolation binding with 7 expressions.
14145
13873
  */
14146
- function mergeHostAttrsAcrossInheritance(inheritanceChain) {
14147
- let hostVars = 0;
14148
- let hostAttrs = null;
14149
- // We process the inheritance order from the base to the leaves here.
14150
- for (let i = inheritanceChain.length - 1; i >= 0; i--) {
14151
- const def = inheritanceChain[i];
14152
- // For each `hostVars`, we need to add the superclass amount.
14153
- def.hostVars = (hostVars += def.hostVars);
14154
- // for each `hostAttrs` we need to merge it with superclass.
14155
- def.hostAttrs =
14156
- mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
14157
- }
14158
- }
14159
- function maybeUnwrapEmpty(value) {
14160
- if (value === EMPTY_OBJ) {
14161
- return {};
14162
- }
14163
- else if (value === EMPTY_ARRAY) {
14164
- return [];
14165
- }
14166
- else {
14167
- return value;
14168
- }
14169
- }
14170
- function inheritViewQuery(definition, superViewQuery) {
14171
- const prevViewQuery = definition.viewQuery;
14172
- if (prevViewQuery) {
14173
- definition.viewQuery = (rf, ctx) => {
14174
- superViewQuery(rf, ctx);
14175
- prevViewQuery(rf, ctx);
14176
- };
14177
- }
14178
- else {
14179
- definition.viewQuery = superViewQuery;
14180
- }
14181
- }
14182
- function inheritContentQueries(definition, superContentQueries) {
14183
- const prevContentQueries = definition.contentQueries;
14184
- if (prevContentQueries) {
14185
- definition.contentQueries = (rf, ctx, directiveIndex) => {
14186
- superContentQueries(rf, ctx, directiveIndex);
14187
- prevContentQueries(rf, ctx, directiveIndex);
14188
- };
14189
- }
14190
- else {
14191
- definition.contentQueries = superContentQueries;
14192
- }
13874
+ function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
13875
+ const bindingIndex = getBindingIndex();
13876
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13877
+ different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
13878
+ incrementBindingIndex(7);
13879
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13880
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13881
+ renderStringify(v5) + i5 + renderStringify(v6) + suffix :
13882
+ NO_CHANGE;
14193
13883
  }
14194
- function inheritHostBindings(definition, superHostBindings) {
14195
- const prevHostBindings = definition.hostBindings;
14196
- if (prevHostBindings) {
14197
- definition.hostBindings = (rf, ctx) => {
14198
- superHostBindings(rf, ctx);
14199
- prevHostBindings(rf, ctx);
14200
- };
14201
- }
14202
- else {
14203
- definition.hostBindings = superHostBindings;
14204
- }
13884
+ /**
13885
+ * Creates an interpolation binding with 8 expressions.
13886
+ */
13887
+ function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
13888
+ const bindingIndex = getBindingIndex();
13889
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13890
+ different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
13891
+ incrementBindingIndex(8);
13892
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13893
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13894
+ renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
13895
+ NO_CHANGE;
14205
13896
  }
14206
13897
 
14207
13898
  /**
14208
- * @license
14209
- * Copyright Google LLC All Rights Reserved.
14210
13899
  *
14211
- * Use of this source code is governed by an MIT-style license that can be
14212
- * found in the LICENSE file at https://angular.io/license
14213
- */
14214
- /**
14215
- * Fields which exist on either directive or component definitions, and need to be copied from
14216
- * parent to child classes by the `ɵɵCopyDefinitionFeature`.
14217
- */
14218
- const COPY_DIRECTIVE_FIELDS = [
14219
- // The child class should use the providers of its parent.
14220
- 'providersResolver',
14221
- // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
14222
- // as inputs, outputs, and host binding functions.
14223
- ];
14224
- /**
14225
- * Fields which exist only on component definitions, and need to be copied from parent to child
14226
- * classes by the `ɵɵCopyDefinitionFeature`.
13900
+ * Update an interpolated attribute on an element with single bound value surrounded by text.
14227
13901
  *
14228
- * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
14229
- * since those should go in `COPY_DIRECTIVE_FIELDS` above.
14230
- */
14231
- const COPY_COMPONENT_FIELDS = [
14232
- // The child class should use the template function of its parent, including all template
14233
- // semantics.
14234
- 'template',
14235
- 'decls',
14236
- 'consts',
14237
- 'vars',
14238
- 'onPush',
14239
- 'ngContentSelectors',
14240
- // The child class should use the CSS styles of its parent, including all styling semantics.
14241
- 'styles',
14242
- 'encapsulation',
14243
- // The child class should be checked by the runtime in the same way as its parent.
14244
- 'schemas',
14245
- ];
14246
- /**
14247
- * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
14248
- * definition.
13902
+ * Used when the value passed to a property has 1 interpolated value in it:
14249
13903
  *
14250
- * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
14251
- * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
14252
- * generates a skeleton definition on the child class, and applies this feature.
13904
+ * ```html
13905
+ * <div attr.title="prefix{{v0}}suffix"></div>
13906
+ * ```
14253
13907
  *
14254
- * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
14255
- * including things like the component template function.
13908
+ * Its compiled representation is::
14256
13909
  *
14257
- * @param definition The definition of a child class which inherits from a parent class with its
14258
- * own definition.
13910
+ * ```ts
13911
+ * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
13912
+ * ```
14259
13913
  *
13914
+ * @param attrName The name of the attribute to update
13915
+ * @param prefix Static value used for concatenation only.
13916
+ * @param v0 Value checked for change.
13917
+ * @param suffix Static value used for concatenation only.
13918
+ * @param sanitizer An optional sanitizer function
13919
+ * @returns itself, so that it may be chained.
14260
13920
  * @codeGenApi
14261
13921
  */
14262
- function ɵɵCopyDefinitionFeature(definition) {
14263
- let superType = getSuperType(definition.type);
14264
- let superDef = undefined;
14265
- if (isComponentDef(definition)) {
14266
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14267
- superDef = superType.ɵcmp;
14268
- }
14269
- else {
14270
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14271
- superDef = superType.ɵdir;
14272
- }
14273
- // Needed because `definition` fields are readonly.
14274
- const defAny = definition;
14275
- // Copy over any fields that apply to either directives or components.
14276
- for (const field of COPY_DIRECTIVE_FIELDS) {
14277
- defAny[field] = superDef[field];
14278
- }
14279
- if (isComponentDef(superDef)) {
14280
- // Copy over any component-specific fields.
14281
- for (const field of COPY_COMPONENT_FIELDS) {
14282
- defAny[field] = superDef[field];
14283
- }
13922
+ function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
13923
+ const lView = getLView();
13924
+ const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
13925
+ if (interpolatedValue !== NO_CHANGE) {
13926
+ const tNode = getSelectedTNode();
13927
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13928
+ ngDevMode &&
13929
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14284
13930
  }
13931
+ return ɵɵattributeInterpolate1;
14285
13932
  }
14286
-
14287
13933
  /**
14288
- * @license
14289
- * Copyright Google LLC All Rights Reserved.
14290
13934
  *
14291
- * Use of this source code is governed by an MIT-style license that can be
14292
- * found in the LICENSE file at https://angular.io/license
14293
- */
14294
- let _symbolIterator = null;
14295
- function getSymbolIterator() {
14296
- if (!_symbolIterator) {
14297
- const Symbol = _global['Symbol'];
14298
- if (Symbol && Symbol.iterator) {
14299
- _symbolIterator = Symbol.iterator;
14300
- }
14301
- else {
14302
- // es6-shim specific logic
14303
- const keys = Object.getOwnPropertyNames(Map.prototype);
14304
- for (let i = 0; i < keys.length; ++i) {
14305
- const key = keys[i];
14306
- if (key !== 'entries' && key !== 'size' &&
14307
- Map.prototype[key] === Map.prototype['entries']) {
14308
- _symbolIterator = key;
14309
- }
14310
- }
14311
- }
14312
- }
14313
- return _symbolIterator;
14314
- }
14315
-
14316
- /**
14317
- * @license
14318
- * Copyright Google LLC All Rights Reserved.
13935
+ * Update an interpolated attribute on an element with 2 bound values surrounded by text.
14319
13936
  *
14320
- * Use of this source code is governed by an MIT-style license that can be
14321
- * found in the LICENSE file at https://angular.io/license
14322
- */
14323
- function isIterable(obj) {
14324
- return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
14325
- }
14326
- function isListLikeIterable(obj) {
14327
- if (!isJsObject(obj))
14328
- return false;
14329
- return Array.isArray(obj) ||
14330
- (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
14331
- getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
14332
- }
14333
- function areIterablesEqual(a, b, comparator) {
14334
- const iterator1 = a[getSymbolIterator()]();
14335
- const iterator2 = b[getSymbolIterator()]();
14336
- while (true) {
14337
- const item1 = iterator1.next();
14338
- const item2 = iterator2.next();
14339
- if (item1.done && item2.done)
14340
- return true;
14341
- if (item1.done || item2.done)
14342
- return false;
14343
- if (!comparator(item1.value, item2.value))
14344
- return false;
14345
- }
14346
- }
14347
- function iterateListLike(obj, fn) {
14348
- if (Array.isArray(obj)) {
14349
- for (let i = 0; i < obj.length; i++) {
14350
- fn(obj[i]);
14351
- }
14352
- }
14353
- else {
14354
- const iterator = obj[getSymbolIterator()]();
14355
- let item;
14356
- while (!((item = iterator.next()).done)) {
14357
- fn(item.value);
14358
- }
14359
- }
14360
- }
14361
- function isJsObject(o) {
14362
- return o !== null && (typeof o === 'function' || typeof o === 'object');
14363
- }
14364
-
14365
- /**
14366
- * @license
14367
- * Copyright Google LLC All Rights Reserved.
13937
+ * Used when the value passed to a property has 2 interpolated values in it:
14368
13938
  *
14369
- * Use of this source code is governed by an MIT-style license that can be
14370
- * found in the LICENSE file at https://angular.io/license
14371
- */
14372
- function devModeEqual(a, b) {
14373
- const isListLikeIterableA = isListLikeIterable(a);
14374
- const isListLikeIterableB = isListLikeIterable(b);
14375
- if (isListLikeIterableA && isListLikeIterableB) {
14376
- return areIterablesEqual(a, b, devModeEqual);
14377
- }
14378
- else {
14379
- const isAObject = a && (typeof a === 'object' || typeof a === 'function');
14380
- const isBObject = b && (typeof b === 'object' || typeof b === 'function');
14381
- if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
14382
- return true;
14383
- }
14384
- else {
14385
- return Object.is(a, b);
14386
- }
14387
- }
14388
- }
14389
-
14390
- /**
14391
- * @license
14392
- * Copyright Google LLC All Rights Reserved.
13939
+ * ```html
13940
+ * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
13941
+ * ```
14393
13942
  *
14394
- * Use of this source code is governed by an MIT-style license that can be
14395
- * found in the LICENSE file at https://angular.io/license
14396
- */
14397
- // TODO(misko): consider inlining
14398
- /** Updates binding and returns the value. */
14399
- function updateBinding(lView, bindingIndex, value) {
14400
- return lView[bindingIndex] = value;
14401
- }
14402
- /** Gets the current binding value. */
14403
- function getBinding(lView, bindingIndex) {
14404
- ngDevMode && assertIndexInRange(lView, bindingIndex);
14405
- ngDevMode &&
14406
- assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
14407
- return lView[bindingIndex];
14408
- }
14409
- /**
14410
- * Updates binding if changed, then returns whether it was updated.
13943
+ * Its compiled representation is::
14411
13944
  *
14412
- * This function also checks the `CheckNoChangesMode` and throws if changes are made.
14413
- * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
14414
- * behavior.
13945
+ * ```ts
13946
+ * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
13947
+ * ```
14415
13948
  *
14416
- * @param lView current `LView`
14417
- * @param bindingIndex The binding in the `LView` to check
14418
- * @param value New value to check against `lView[bindingIndex]`
14419
- * @returns `true` if the bindings has changed. (Throws if binding has changed during
14420
- * `CheckNoChangesMode`)
13949
+ * @param attrName The name of the attribute to update
13950
+ * @param prefix Static value used for concatenation only.
13951
+ * @param v0 Value checked for change.
13952
+ * @param i0 Static value used for concatenation only.
13953
+ * @param v1 Value checked for change.
13954
+ * @param suffix Static value used for concatenation only.
13955
+ * @param sanitizer An optional sanitizer function
13956
+ * @returns itself, so that it may be chained.
13957
+ * @codeGenApi
14421
13958
  */
14422
- function bindingUpdated(lView, bindingIndex, value) {
14423
- ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
14424
- ngDevMode &&
14425
- assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
14426
- const oldValue = lView[bindingIndex];
14427
- if (Object.is(oldValue, value)) {
14428
- return false;
14429
- }
14430
- else {
14431
- if (ngDevMode && isInCheckNoChangesMode()) {
14432
- // View engine didn't report undefined values as changed on the first checkNoChanges pass
14433
- // (before the change detection was run).
14434
- const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
14435
- if (!devModeEqual(oldValueToCompare, value)) {
14436
- const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
14437
- throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
14438
- }
14439
- // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
14440
- // For this reason we exit as if no change. The early exit is needed to prevent the changed
14441
- // value to be written into `LView` (If we would write the new value that we would not see it
14442
- // as change on next CD.)
14443
- return false;
14444
- }
14445
- lView[bindingIndex] = value;
14446
- return true;
13959
+ function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
13960
+ const lView = getLView();
13961
+ const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
13962
+ if (interpolatedValue !== NO_CHANGE) {
13963
+ const tNode = getSelectedTNode();
13964
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13965
+ ngDevMode &&
13966
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14447
13967
  }
13968
+ return ɵɵattributeInterpolate2;
14448
13969
  }
14449
- /** Updates 2 bindings if changed, then returns whether either was updated. */
14450
- function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
14451
- const different = bindingUpdated(lView, bindingIndex, exp1);
14452
- return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
14453
- }
14454
- /** Updates 3 bindings if changed, then returns whether any was updated. */
14455
- function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
14456
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14457
- return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
14458
- }
14459
- /** Updates 4 bindings if changed, then returns whether any was updated. */
14460
- function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
14461
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14462
- return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
14463
- }
14464
-
14465
13970
  /**
14466
- * @license
14467
- * Copyright Google LLC All Rights Reserved.
14468
13971
  *
14469
- * Use of this source code is governed by an MIT-style license that can be
14470
- * found in the LICENSE file at https://angular.io/license
14471
- */
14472
- /**
14473
- * Updates the value of or removes a bound attribute on an Element.
13972
+ * Update an interpolated attribute on an element with 3 bound values surrounded by text.
14474
13973
  *
14475
- * Used in the case of `[attr.title]="value"`
13974
+ * Used when the value passed to a property has 3 interpolated values in it:
14476
13975
  *
14477
- * @param name name The name of the attribute.
14478
- * @param value value The attribute is removed when value is `null` or `undefined`.
14479
- * Otherwise the attribute value is set to the stringified value.
14480
- * @param sanitizer An optional function used to sanitize the value.
14481
- * @param namespace Optional namespace to use when setting the attribute.
13976
+ * ```html
13977
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
13978
+ * ```
13979
+ *
13980
+ * Its compiled representation is::
14482
13981
  *
13982
+ * ```ts
13983
+ * ɵɵattributeInterpolate3(
13984
+ * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
13985
+ * ```
13986
+ *
13987
+ * @param attrName The name of the attribute to update
13988
+ * @param prefix Static value used for concatenation only.
13989
+ * @param v0 Value checked for change.
13990
+ * @param i0 Static value used for concatenation only.
13991
+ * @param v1 Value checked for change.
13992
+ * @param i1 Static value used for concatenation only.
13993
+ * @param v2 Value checked for change.
13994
+ * @param suffix Static value used for concatenation only.
13995
+ * @param sanitizer An optional sanitizer function
13996
+ * @returns itself, so that it may be chained.
14483
13997
  * @codeGenApi
14484
13998
  */
14485
- function ɵɵattribute(name, value, sanitizer, namespace) {
13999
+ function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14486
14000
  const lView = getLView();
14487
- const bindingIndex = nextBindingIndex();
14488
- if (bindingUpdated(lView, bindingIndex, value)) {
14489
- const tView = getTView();
14490
- const tNode = getSelectedTNode();
14491
- elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
14492
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
14493
- }
14494
- return ɵɵattribute;
14495
- }
14496
-
14497
- /**
14498
- * @license
14499
- * Copyright Google LLC All Rights Reserved.
14500
- *
14501
- * Use of this source code is governed by an MIT-style license that can be
14502
- * found in the LICENSE file at https://angular.io/license
14503
- */
14504
- /**
14505
- * Create interpolation bindings with a variable number of expressions.
14506
- *
14507
- * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
14508
- * Those are faster because there is no need to create an array of expressions and iterate over it.
14509
- *
14510
- * `values`:
14511
- * - has static text at even indexes,
14512
- * - has evaluated expressions at odd indexes.
14513
- *
14514
- * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
14515
- */
14516
- function interpolationV(lView, values) {
14517
- ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
14518
- ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
14519
- let isBindingUpdated = false;
14520
- let bindingIndex = getBindingIndex();
14521
- for (let i = 1; i < values.length; i += 2) {
14522
- // Check if bindings (odd indexes) have changed
14523
- isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
14524
- }
14525
- setBindingIndex(bindingIndex);
14526
- if (!isBindingUpdated) {
14527
- return NO_CHANGE;
14528
- }
14529
- // Build the updated content
14530
- let content = values[0];
14531
- for (let i = 1; i < values.length; i += 2) {
14532
- content += renderStringify(values[i]) + values[i + 1];
14533
- }
14534
- return content;
14535
- }
14536
- /**
14537
- * Creates an interpolation binding with 1 expression.
14538
- *
14539
- * @param prefix static value used for concatenation only.
14540
- * @param v0 value checked for change.
14541
- * @param suffix static value used for concatenation only.
14542
- */
14543
- function interpolation1(lView, prefix, v0, suffix) {
14544
- const different = bindingUpdated(lView, nextBindingIndex(), v0);
14545
- return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
14546
- }
14547
- /**
14548
- * Creates an interpolation binding with 2 expressions.
14549
- */
14550
- function interpolation2(lView, prefix, v0, i0, v1, suffix) {
14551
- const bindingIndex = getBindingIndex();
14552
- const different = bindingUpdated2(lView, bindingIndex, v0, v1);
14553
- incrementBindingIndex(2);
14554
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14555
- }
14556
- /**
14557
- * Creates an interpolation binding with 3 expressions.
14558
- */
14559
- function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
14560
- const bindingIndex = getBindingIndex();
14561
- const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
14562
- incrementBindingIndex(3);
14563
- return different ?
14564
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
14565
- NO_CHANGE;
14566
- }
14567
- /**
14568
- * Create an interpolation binding with 4 expressions.
14569
- */
14570
- function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
14571
- const bindingIndex = getBindingIndex();
14572
- const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14573
- incrementBindingIndex(4);
14574
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14575
- renderStringify(v2) + i2 + renderStringify(v3) + suffix :
14576
- NO_CHANGE;
14577
- }
14578
- /**
14579
- * Creates an interpolation binding with 5 expressions.
14580
- */
14581
- function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
14582
- const bindingIndex = getBindingIndex();
14583
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14584
- different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
14585
- incrementBindingIndex(5);
14586
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14587
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
14588
- NO_CHANGE;
14589
- }
14590
- /**
14591
- * Creates an interpolation binding with 6 expressions.
14592
- */
14593
- function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
14594
- const bindingIndex = getBindingIndex();
14595
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14596
- different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
14597
- incrementBindingIndex(6);
14598
- return different ?
14599
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
14600
- renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
14601
- NO_CHANGE;
14602
- }
14603
- /**
14604
- * Creates an interpolation binding with 7 expressions.
14605
- */
14606
- function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
14607
- const bindingIndex = getBindingIndex();
14608
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14609
- different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
14610
- incrementBindingIndex(7);
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) + suffix :
14614
- NO_CHANGE;
14615
- }
14616
- /**
14617
- * Creates an interpolation binding with 8 expressions.
14618
- */
14619
- function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
14620
- const bindingIndex = getBindingIndex();
14621
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14622
- different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
14623
- incrementBindingIndex(8);
14624
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14625
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14626
- renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
14627
- NO_CHANGE;
14628
- }
14629
-
14630
- /**
14631
- *
14632
- * Update an interpolated attribute on an element with single bound value surrounded by text.
14633
- *
14634
- * Used when the value passed to a property has 1 interpolated value in it:
14635
- *
14636
- * ```html
14637
- * <div attr.title="prefix{{v0}}suffix"></div>
14638
- * ```
14639
- *
14640
- * Its compiled representation is::
14641
- *
14642
- * ```ts
14643
- * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
14644
- * ```
14645
- *
14646
- * @param attrName The name of the attribute to update
14647
- * @param prefix Static value used for concatenation only.
14648
- * @param v0 Value checked for change.
14649
- * @param suffix Static value used for concatenation only.
14650
- * @param sanitizer An optional sanitizer function
14651
- * @returns itself, so that it may be chained.
14652
- * @codeGenApi
14653
- */
14654
- function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
14655
- const lView = getLView();
14656
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
14657
- if (interpolatedValue !== NO_CHANGE) {
14658
- const tNode = getSelectedTNode();
14659
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14660
- ngDevMode &&
14661
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14662
- }
14663
- return ɵɵattributeInterpolate1;
14664
- }
14665
- /**
14666
- *
14667
- * Update an interpolated attribute on an element with 2 bound values surrounded by text.
14668
- *
14669
- * Used when the value passed to a property has 2 interpolated values in it:
14670
- *
14671
- * ```html
14672
- * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
14673
- * ```
14674
- *
14675
- * Its compiled representation is::
14676
- *
14677
- * ```ts
14678
- * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
14679
- * ```
14680
- *
14681
- * @param attrName The name of the attribute to update
14682
- * @param prefix Static value used for concatenation only.
14683
- * @param v0 Value checked for change.
14684
- * @param i0 Static value used for concatenation only.
14685
- * @param v1 Value checked for change.
14686
- * @param suffix Static value used for concatenation only.
14687
- * @param sanitizer An optional sanitizer function
14688
- * @returns itself, so that it may be chained.
14689
- * @codeGenApi
14690
- */
14691
- function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
14692
- const lView = getLView();
14693
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
14694
- if (interpolatedValue !== NO_CHANGE) {
14695
- const tNode = getSelectedTNode();
14696
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14697
- ngDevMode &&
14698
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14699
- }
14700
- return ɵɵattributeInterpolate2;
14701
- }
14702
- /**
14703
- *
14704
- * Update an interpolated attribute on an element with 3 bound values surrounded by text.
14705
- *
14706
- * Used when the value passed to a property has 3 interpolated values in it:
14707
- *
14708
- * ```html
14709
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
14710
- * ```
14711
- *
14712
- * Its compiled representation is::
14713
- *
14714
- * ```ts
14715
- * ɵɵattributeInterpolate3(
14716
- * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
14717
- * ```
14718
- *
14719
- * @param attrName The name of the attribute to update
14720
- * @param prefix Static value used for concatenation only.
14721
- * @param v0 Value checked for change.
14722
- * @param i0 Static value used for concatenation only.
14723
- * @param v1 Value checked for change.
14724
- * @param i1 Static value used for concatenation only.
14725
- * @param v2 Value checked for change.
14726
- * @param suffix Static value used for concatenation only.
14727
- * @param sanitizer An optional sanitizer function
14728
- * @returns itself, so that it may be chained.
14729
- * @codeGenApi
14730
- */
14731
- function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14732
- const lView = getLView();
14733
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
14734
- if (interpolatedValue !== NO_CHANGE) {
14001
+ const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
14002
+ if (interpolatedValue !== NO_CHANGE) {
14735
14003
  const tNode = getSelectedTNode();
14736
14004
  elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14737
14005
  ngDevMode &&
@@ -15019,19 +14287,53 @@ function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
15019
14287
  * Use of this source code is governed by an MIT-style license that can be
15020
14288
  * found in the LICENSE file at https://angular.io/license
15021
14289
  */
15022
- function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
15023
- ngDevMode && assertFirstCreatePass(tView);
15024
- ngDevMode && ngDevMode.firstCreatePass++;
15025
- const tViewConsts = tView.consts;
15026
- // TODO(pk): refactor getOrCreateTNode to have the "create" only version
15027
- const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, getConstant(tViewConsts, attrsIndex));
15028
- resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
15029
- registerPostOrderHooks(tView, tNode);
15030
- const embeddedTView = tNode.tViews = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
15031
- if (tView.queries !== null) {
15032
- tView.queries.template(tView, tNode);
15033
- embeddedTView.queries = tView.queries.embeddedTView(tNode);
15034
- }
14290
+ /**
14291
+ * Synchronously perform change detection on a component (and possibly its sub-components).
14292
+ *
14293
+ * This function triggers change detection in a synchronous way on a component.
14294
+ *
14295
+ * @param component The component which the change detection should be performed on.
14296
+ */
14297
+ function detectChanges(component) {
14298
+ const view = getComponentViewByInstance(component);
14299
+ detectChangesInternal(view[TVIEW], view, component);
14300
+ }
14301
+ /**
14302
+ * Marks the component as dirty (needing change detection). Marking a component dirty will
14303
+ * schedule a change detection on it at some point in the future.
14304
+ *
14305
+ * Marking an already dirty component as dirty won't do anything. Only one outstanding change
14306
+ * detection can be scheduled per component tree.
14307
+ *
14308
+ * @param component Component to mark as dirty.
14309
+ */
14310
+ function markDirty(component) {
14311
+ ngDevMode && assertDefined(component, 'component');
14312
+ const rootView = markViewDirty(getComponentViewByInstance(component));
14313
+ ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
14314
+ scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
14315
+ }
14316
+
14317
+ /**
14318
+ * @license
14319
+ * Copyright Google LLC All Rights Reserved.
14320
+ *
14321
+ * Use of this source code is governed by an MIT-style license that can be
14322
+ * found in the LICENSE file at https://angular.io/license
14323
+ */
14324
+ function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
14325
+ ngDevMode && assertFirstCreatePass(tView);
14326
+ ngDevMode && ngDevMode.firstCreatePass++;
14327
+ const tViewConsts = tView.consts;
14328
+ // TODO(pk): refactor getOrCreateTNode to have the "create" only version
14329
+ const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, getConstant(tViewConsts, attrsIndex));
14330
+ resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
14331
+ registerPostOrderHooks(tView, tNode);
14332
+ const embeddedTView = tNode.tViews = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
14333
+ if (tView.queries !== null) {
14334
+ tView.queries.template(tView, tNode);
14335
+ embeddedTView.queries = tView.queries.embeddedTView(tNode);
14336
+ }
15035
14337
  return tNode;
15036
14338
  }
15037
14339
  /**
@@ -15556,51 +14858,42 @@ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
15556
14858
  tNode.index;
15557
14859
  // In order to match current behavior, native DOM event listeners must be added for all
15558
14860
  // events (including outputs).
15559
- if (isProceduralRenderer(renderer)) {
15560
- // There might be cases where multiple directives on the same element try to register an event
15561
- // handler function for the same event. In this situation we want to avoid registration of
15562
- // several native listeners as each registration would be intercepted by NgZone and
15563
- // trigger change detection. This would mean that a single user action would result in several
15564
- // change detections being invoked. To avoid this situation we want to have only one call to
15565
- // native handler registration (for the same element and same type of event).
15566
- //
15567
- // In order to have just one native event handler in presence of multiple handler functions,
15568
- // we just register a first handler function as a native event listener and then chain
15569
- // (coalesce) other handler functions on top of the first native handler function.
15570
- let existingListener = null;
15571
- // Please note that the coalescing described here doesn't happen for events specifying an
15572
- // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
15573
- // view engine.
15574
- // Also, we don't have to search for existing listeners is there are no directives
15575
- // matching on a given node as we can't register multiple event handlers for the same event in
15576
- // a template (this would mean having duplicate attributes).
15577
- if (!eventTargetResolver && isTNodeDirectiveHost) {
15578
- existingListener = findExistingListener(tView, lView, eventName, tNode.index);
15579
- }
15580
- if (existingListener !== null) {
15581
- // Attach a new listener to coalesced listeners list, maintaining the order in which
15582
- // listeners are registered. For performance reasons, we keep a reference to the last
15583
- // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
15584
- // the entire set each time we need to add a new listener.
15585
- const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
15586
- lastListenerFn.__ngNextListenerFn__ = listenerFn;
15587
- existingListener.__ngLastListenerFn__ = listenerFn;
15588
- processOutputs = false;
15589
- }
15590
- else {
15591
- listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
15592
- const cleanupFn = renderer.listen(target, eventName, listenerFn);
15593
- ngDevMode && ngDevMode.rendererAddEventListener++;
15594
- lCleanup.push(listenerFn, cleanupFn);
15595
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15596
- }
14861
+ // There might be cases where multiple directives on the same element try to register an event
14862
+ // handler function for the same event. In this situation we want to avoid registration of
14863
+ // several native listeners as each registration would be intercepted by NgZone and
14864
+ // trigger change detection. This would mean that a single user action would result in several
14865
+ // change detections being invoked. To avoid this situation we want to have only one call to
14866
+ // native handler registration (for the same element and same type of event).
14867
+ //
14868
+ // In order to have just one native event handler in presence of multiple handler functions,
14869
+ // we just register a first handler function as a native event listener and then chain
14870
+ // (coalesce) other handler functions on top of the first native handler function.
14871
+ let existingListener = null;
14872
+ // Please note that the coalescing described here doesn't happen for events specifying an
14873
+ // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
14874
+ // view engine.
14875
+ // Also, we don't have to search for existing listeners is there are no directives
14876
+ // matching on a given node as we can't register multiple event handlers for the same event in
14877
+ // a template (this would mean having duplicate attributes).
14878
+ if (!eventTargetResolver && isTNodeDirectiveHost) {
14879
+ existingListener = findExistingListener(tView, lView, eventName, tNode.index);
14880
+ }
14881
+ if (existingListener !== null) {
14882
+ // Attach a new listener to coalesced listeners list, maintaining the order in which
14883
+ // listeners are registered. For performance reasons, we keep a reference to the last
14884
+ // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
14885
+ // the entire set each time we need to add a new listener.
14886
+ const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
14887
+ lastListenerFn.__ngNextListenerFn__ = listenerFn;
14888
+ existingListener.__ngLastListenerFn__ = listenerFn;
14889
+ processOutputs = false;
15597
14890
  }
15598
14891
  else {
15599
- listenerFn = wrapListener(tNode, lView, context, listenerFn, true /** preventDefault */);
15600
- target.addEventListener(eventName, listenerFn, useCapture);
14892
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
14893
+ const cleanupFn = renderer.listen(target, eventName, listenerFn);
15601
14894
  ngDevMode && ngDevMode.rendererAddEventListener++;
15602
- lCleanup.push(listenerFn);
15603
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture);
14895
+ lCleanup.push(listenerFn, cleanupFn);
14896
+ tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15604
14897
  }
15605
14898
  }
15606
14899
  else {
@@ -17674,7 +16967,7 @@ function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
17674
16967
  valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : undefined;
17675
16968
  }
17676
16969
  let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
17677
- key === prop ? valueAtLViewIndex : undefined;
16970
+ (key === prop ? valueAtLViewIndex : undefined);
17678
16971
  if (containsStatics && !isStylingValuePresent(currentValue)) {
17679
16972
  currentValue = keyValueArrayGet(rawKey, prop);
17680
16973
  }
@@ -19197,7 +18490,7 @@ function findLocaleData(locale) {
19197
18490
  if (parentLocale === 'en') {
19198
18491
  return localeEn;
19199
18492
  }
19200
- throw new Error(`Missing locale data for the locale "${locale}".`);
18493
+ throw new RuntimeError(701 /* RuntimeErrorCode.MISSING_LOCALE_DATA */, ngDevMode && `Missing locale data for the locale "${locale}".`);
19201
18494
  }
19202
18495
  /**
19203
18496
  * Retrieves the default currency code for the given locale.
@@ -21527,7 +20820,7 @@ function noComponentFactoryError(component) {
21527
20820
  return error;
21528
20821
  }
21529
20822
  const ERROR_COMPONENT = 'ngComponent';
21530
- function getComponent(error) {
20823
+ function getComponent$1(error) {
21531
20824
  return error[ERROR_COMPONENT];
21532
20825
  }
21533
20826
  class _NullComponentFactoryResolver {
@@ -21711,14 +21004,6 @@ class Renderer2 {
21711
21004
  * @nocollapse
21712
21005
  */
21713
21006
  Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
21714
- /** Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) */
21715
- function getOrCreateRenderer2(lView) {
21716
- const renderer = lView[RENDERER];
21717
- if (ngDevMode && !isProceduralRenderer(renderer)) {
21718
- throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
21719
- }
21720
- return renderer;
21721
- }
21722
21007
  /** Injects a Renderer2 for the current component. */
21723
21008
  function injectRenderer2() {
21724
21009
  // We need the Renderer to be based on the component that it's being injected into, however since
@@ -21726,7 +21011,7 @@ function injectRenderer2() {
21726
21011
  const lView = getLView();
21727
21012
  const tNode = getCurrentTNode();
21728
21013
  const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
21729
- return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
21014
+ return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
21730
21015
  }
21731
21016
 
21732
21017
  /**
@@ -21773,7 +21058,7 @@ class Version {
21773
21058
  /**
21774
21059
  * @publicApi
21775
21060
  */
21776
- const VERSION = new Version('14.0.3');
21061
+ const VERSION = new Version('14.0.6');
21777
21062
 
21778
21063
  /**
21779
21064
  * @license
@@ -22152,367 +21437,783 @@ class RootViewRef extends ViewRef$1 {
22152
21437
  * Use of this source code is governed by an MIT-style license that can be
22153
21438
  * found in the LICENSE file at https://angular.io/license
22154
21439
  */
22155
- class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
22156
- /**
22157
- * @param ngModule The NgModuleRef to which all resolved factories are bound.
22158
- */
22159
- constructor(ngModule) {
22160
- super();
22161
- this.ngModule = ngModule;
22162
- }
22163
- resolveComponentFactory(component) {
22164
- ngDevMode && assertComponentType(component);
22165
- const componentDef = getComponentDef(component);
22166
- return new ComponentFactory(componentDef, this.ngModule);
22167
- }
22168
- }
22169
- function toRefArray(map) {
22170
- const array = [];
22171
- for (let nonMinified in map) {
22172
- if (map.hasOwnProperty(nonMinified)) {
22173
- const minified = map[nonMinified];
22174
- array.push({ propName: minified, templateName: nonMinified });
21440
+ class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
21441
+ /**
21442
+ * @param ngModule The NgModuleRef to which all resolved factories are bound.
21443
+ */
21444
+ constructor(ngModule) {
21445
+ super();
21446
+ this.ngModule = ngModule;
21447
+ }
21448
+ resolveComponentFactory(component) {
21449
+ ngDevMode && assertComponentType(component);
21450
+ const componentDef = getComponentDef(component);
21451
+ return new ComponentFactory(componentDef, this.ngModule);
21452
+ }
21453
+ }
21454
+ function toRefArray(map) {
21455
+ const array = [];
21456
+ for (let nonMinified in map) {
21457
+ if (map.hasOwnProperty(nonMinified)) {
21458
+ const minified = map[nonMinified];
21459
+ array.push({ propName: minified, templateName: nonMinified });
21460
+ }
21461
+ }
21462
+ return array;
21463
+ }
21464
+ function getNamespace(elementName) {
21465
+ const name = elementName.toLowerCase();
21466
+ return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21467
+ }
21468
+ /**
21469
+ * Injector that looks up a value using a specific injector, before falling back to the module
21470
+ * injector. Used primarily when creating components or embedded views dynamically.
21471
+ */
21472
+ class ChainedInjector {
21473
+ constructor(injector, parentInjector) {
21474
+ this.injector = injector;
21475
+ this.parentInjector = parentInjector;
21476
+ }
21477
+ get(token, notFoundValue, flags) {
21478
+ const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21479
+ if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21480
+ notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21481
+ // Return the value from the root element injector when
21482
+ // - it provides it
21483
+ // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21484
+ // - the module injector should not be checked
21485
+ // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21486
+ return value;
21487
+ }
21488
+ return this.parentInjector.get(token, notFoundValue, flags);
21489
+ }
21490
+ }
21491
+ /**
21492
+ * Render3 implementation of {@link viewEngine_ComponentFactory}.
21493
+ */
21494
+ class ComponentFactory extends ComponentFactory$1 {
21495
+ /**
21496
+ * @param componentDef The component definition.
21497
+ * @param ngModule The NgModuleRef to which the factory is bound.
21498
+ */
21499
+ constructor(componentDef, ngModule) {
21500
+ super();
21501
+ this.componentDef = componentDef;
21502
+ this.ngModule = ngModule;
21503
+ this.componentType = componentDef.type;
21504
+ this.selector = stringifyCSSSelectorList(componentDef.selectors);
21505
+ this.ngContentSelectors =
21506
+ componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
21507
+ this.isBoundToModule = !!ngModule;
21508
+ }
21509
+ get inputs() {
21510
+ return toRefArray(this.componentDef.inputs);
21511
+ }
21512
+ get outputs() {
21513
+ return toRefArray(this.componentDef.outputs);
21514
+ }
21515
+ create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
21516
+ environmentInjector = environmentInjector || this.ngModule;
21517
+ let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
21518
+ environmentInjector :
21519
+ environmentInjector?.injector;
21520
+ if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
21521
+ realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
21522
+ realEnvironmentInjector;
21523
+ }
21524
+ const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
21525
+ const rendererFactory = rootViewInjector.get(RendererFactory2, null);
21526
+ if (rendererFactory === null) {
21527
+ throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
21528
+ 'Angular was not able to inject a renderer (RendererFactory2). ' +
21529
+ 'Likely this is due to a broken DI hierarchy. ' +
21530
+ 'Make sure that any injector used to create this component has a correct parent.');
21531
+ }
21532
+ const sanitizer = rootViewInjector.get(Sanitizer, null);
21533
+ const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
21534
+ // Determine a tag name used for creating host elements when this component is created
21535
+ // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
21536
+ const elementName = this.componentDef.selectors[0][0] || 'div';
21537
+ const hostRNode = rootSelectorOrNode ?
21538
+ locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
21539
+ createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
21540
+ const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
21541
+ 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
21542
+ const rootContext = createRootContext();
21543
+ // Create the root view. Uses empty TView and ContentTemplate.
21544
+ const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
21545
+ const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
21546
+ // rootView is the parent when bootstrapping
21547
+ // TODO(misko): it looks like we are entering view here but we don't really need to as
21548
+ // `renderView` does that. However as the code is written it is needed because
21549
+ // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
21550
+ // issues would allow us to drop this.
21551
+ enterView(rootLView);
21552
+ let component;
21553
+ let tElementNode;
21554
+ try {
21555
+ const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
21556
+ if (hostRNode) {
21557
+ if (rootSelectorOrNode) {
21558
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
21559
+ }
21560
+ else {
21561
+ // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
21562
+ // is not defined), also apply attributes and classes extracted from component selector.
21563
+ // Extract attributes and classes from the first selector only to match VE behavior.
21564
+ const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
21565
+ if (attrs) {
21566
+ setUpAttributes(hostRenderer, hostRNode, attrs);
21567
+ }
21568
+ if (classes && classes.length > 0) {
21569
+ writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
21570
+ }
21571
+ }
21572
+ }
21573
+ tElementNode = getTNode(rootTView, HEADER_OFFSET);
21574
+ if (projectableNodes !== undefined) {
21575
+ const projection = tElementNode.projection = [];
21576
+ for (let i = 0; i < this.ngContentSelectors.length; i++) {
21577
+ const nodesforSlot = projectableNodes[i];
21578
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
21579
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
21580
+ // complex checks down the line.
21581
+ // We also normalize the length of the passed in projectable nodes (to match the number of
21582
+ // <ng-container> slots defined by a component).
21583
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
21584
+ }
21585
+ }
21586
+ // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
21587
+ // executed here?
21588
+ // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
21589
+ component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
21590
+ renderView(rootTView, rootLView, null);
21591
+ }
21592
+ finally {
21593
+ leaveView();
21594
+ }
21595
+ return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21596
+ }
21597
+ }
21598
+ const componentFactoryResolver = new ComponentFactoryResolver();
21599
+ /**
21600
+ * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
21601
+ * ComponentFactoryResolver
21602
+ * already exists, retrieves the existing ComponentFactoryResolver.
21603
+ *
21604
+ * @returns The ComponentFactoryResolver instance to use
21605
+ */
21606
+ function injectComponentFactoryResolver() {
21607
+ return componentFactoryResolver;
21608
+ }
21609
+ /**
21610
+ * Represents an instance of a Component created via a {@link ComponentFactory}.
21611
+ *
21612
+ * `ComponentRef` provides access to the Component Instance as well other objects related to this
21613
+ * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
21614
+ * method.
21615
+ *
21616
+ */
21617
+ class ComponentRef extends ComponentRef$1 {
21618
+ constructor(componentType, instance, location, _rootLView, _tNode) {
21619
+ super();
21620
+ this.location = location;
21621
+ this._rootLView = _rootLView;
21622
+ this._tNode = _tNode;
21623
+ this.instance = instance;
21624
+ this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
21625
+ this.componentType = componentType;
21626
+ }
21627
+ get injector() {
21628
+ return new NodeInjector(this._tNode, this._rootLView);
21629
+ }
21630
+ destroy() {
21631
+ this.hostView.destroy();
21632
+ }
21633
+ onDestroy(callback) {
21634
+ this.hostView.onDestroy(callback);
21635
+ }
21636
+ }
21637
+
21638
+ /**
21639
+ * @license
21640
+ * Copyright Google LLC All Rights Reserved.
21641
+ *
21642
+ * Use of this source code is governed by an MIT-style license that can be
21643
+ * found in the LICENSE file at https://angular.io/license
21644
+ */
21645
+ /**
21646
+ * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
21647
+ * @param ngModule NgModule class.
21648
+ * @param parentInjector Optional injector instance to use as a parent for the module injector. If
21649
+ * not provided, `NullInjector` will be used instead.
21650
+ * @publicApi
21651
+ */
21652
+ function createNgModuleRef(ngModule, parentInjector) {
21653
+ return new NgModuleRef(ngModule, parentInjector ?? null);
21654
+ }
21655
+ class NgModuleRef extends NgModuleRef$1 {
21656
+ constructor(ngModuleType, _parent) {
21657
+ super();
21658
+ this._parent = _parent;
21659
+ // tslint:disable-next-line:require-internal-with-underscore
21660
+ this._bootstrapComponents = [];
21661
+ this.injector = this;
21662
+ this.destroyCbs = [];
21663
+ // When bootstrapping a module we have a dependency graph that looks like this:
21664
+ // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
21665
+ // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
21666
+ // circular dependency which will result in a runtime error, because the injector doesn't
21667
+ // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
21668
+ // and providing it, rather than letting the injector resolve it.
21669
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21670
+ const ngModuleDef = getNgModuleDef(ngModuleType);
21671
+ ngDevMode &&
21672
+ assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
21673
+ this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
21674
+ this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
21675
+ { provide: NgModuleRef$1, useValue: this }, {
21676
+ provide: ComponentFactoryResolver$1,
21677
+ useValue: this.componentFactoryResolver
21678
+ }
21679
+ ], stringify(ngModuleType), new Set(['environment']));
21680
+ // We need to resolve the injector types separately from the injector creation, because
21681
+ // the module might be trying to use this ref in its constructor for DI which will cause a
21682
+ // circular error that will eventually error out, because the injector isn't created yet.
21683
+ this._r3Injector.resolveInjectorInitializers();
21684
+ this.instance = this.get(ngModuleType);
21685
+ }
21686
+ get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
21687
+ if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
21688
+ return this;
21689
+ }
21690
+ return this._r3Injector.get(token, notFoundValue, injectFlags);
21691
+ }
21692
+ destroy() {
21693
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21694
+ const injector = this._r3Injector;
21695
+ !injector.destroyed && injector.destroy();
21696
+ this.destroyCbs.forEach(fn => fn());
21697
+ this.destroyCbs = null;
21698
+ }
21699
+ onDestroy(callback) {
21700
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21701
+ this.destroyCbs.push(callback);
21702
+ }
21703
+ }
21704
+ class NgModuleFactory extends NgModuleFactory$1 {
21705
+ constructor(moduleType) {
21706
+ super();
21707
+ this.moduleType = moduleType;
21708
+ }
21709
+ create(parentInjector) {
21710
+ return new NgModuleRef(this.moduleType, parentInjector);
21711
+ }
21712
+ }
21713
+ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
21714
+ constructor(providers, parent, source) {
21715
+ super();
21716
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21717
+ this.instance = null;
21718
+ const injector = new R3Injector([
21719
+ ...providers,
21720
+ { provide: NgModuleRef$1, useValue: this },
21721
+ { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
21722
+ ], parent || getNullInjector(), source, new Set(['environment']));
21723
+ this.injector = injector;
21724
+ injector.resolveInjectorInitializers();
21725
+ }
21726
+ destroy() {
21727
+ this.injector.destroy();
21728
+ }
21729
+ onDestroy(callback) {
21730
+ this.injector.onDestroy(callback);
21731
+ }
21732
+ }
21733
+ /**
21734
+ * Create a new environment injector.
21735
+ *
21736
+ * @publicApi
21737
+ * @developerPreview
21738
+ */
21739
+ function createEnvironmentInjector(providers, parent = null, debugName = null) {
21740
+ const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
21741
+ return adapter.injector;
21742
+ }
21743
+
21744
+ /**
21745
+ * @license
21746
+ * Copyright Google LLC All Rights Reserved.
21747
+ *
21748
+ * Use of this source code is governed by an MIT-style license that can be
21749
+ * found in the LICENSE file at https://angular.io/license
21750
+ */
21751
+ /**
21752
+ * A service used by the framework to create instances of standalone injectors. Those injectors are
21753
+ * created on demand in case of dynamic component instantiation and contain ambient providers
21754
+ * collected from the imports graph rooted at a given standalone component.
21755
+ */
21756
+ class StandaloneService {
21757
+ constructor(_injector) {
21758
+ this._injector = _injector;
21759
+ this.cachedInjectors = new Map();
21760
+ }
21761
+ getOrCreateStandaloneInjector(componentDef) {
21762
+ if (!componentDef.standalone) {
21763
+ return null;
21764
+ }
21765
+ if (!this.cachedInjectors.has(componentDef.id)) {
21766
+ const providers = internalImportProvidersFrom(false, componentDef.type);
21767
+ const standaloneInjector = providers.length > 0 ?
21768
+ createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
21769
+ null;
21770
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
21771
+ }
21772
+ return this.cachedInjectors.get(componentDef.id);
21773
+ }
21774
+ ngOnDestroy() {
21775
+ try {
21776
+ for (const injector of this.cachedInjectors.values()) {
21777
+ if (injector !== null) {
21778
+ injector.destroy();
21779
+ }
21780
+ }
21781
+ }
21782
+ finally {
21783
+ this.cachedInjectors.clear();
21784
+ }
21785
+ }
21786
+ }
21787
+ /** @nocollapse */
21788
+ StandaloneService.ɵprov = ɵɵdefineInjectable({
21789
+ token: StandaloneService,
21790
+ providedIn: 'environment',
21791
+ factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
21792
+ });
21793
+ /**
21794
+ * A feature that acts as a setup code for the {@link StandaloneService}.
21795
+ *
21796
+ * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
21797
+ * function (an entry points to a standalone injector creation) on a component definition object. We
21798
+ * go through the features infrastructure to make sure that the standalone injector creation logic
21799
+ * is tree-shakable and not included in applications that don't use standalone components.
21800
+ *
21801
+ * @codeGenApi
21802
+ */
21803
+ function ɵɵStandaloneFeature(definition) {
21804
+ definition.getStandaloneInjector = (parentInjector) => {
21805
+ return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
21806
+ };
21807
+ }
21808
+
21809
+ /**
21810
+ * @license
21811
+ * Copyright Google LLC All Rights Reserved.
21812
+ *
21813
+ * Use of this source code is governed by an MIT-style license that can be
21814
+ * found in the LICENSE file at https://angular.io/license
21815
+ */
21816
+ /**
21817
+ * Retrieves the component instance associated with a given DOM element.
21818
+ *
21819
+ * @usageNotes
21820
+ * Given the following DOM structure:
21821
+ *
21822
+ * ```html
21823
+ * <app-root>
21824
+ * <div>
21825
+ * <child-comp></child-comp>
21826
+ * </div>
21827
+ * </app-root>
21828
+ * ```
21829
+ *
21830
+ * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
21831
+ * associated with this DOM element.
21832
+ *
21833
+ * Calling the function on `<app-root>` will return the `MyApp` instance.
21834
+ *
21835
+ *
21836
+ * @param element DOM element from which the component should be retrieved.
21837
+ * @returns Component instance associated with the element or `null` if there
21838
+ * is no component associated with it.
21839
+ *
21840
+ * @publicApi
21841
+ * @globalApi ng
21842
+ */
21843
+ function getComponent(element) {
21844
+ ngDevMode && assertDomElement(element);
21845
+ const context = getLContext(element);
21846
+ if (context === null)
21847
+ return null;
21848
+ if (context.component === undefined) {
21849
+ const lView = context.lView;
21850
+ if (lView === null) {
21851
+ return null;
22175
21852
  }
21853
+ context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
22176
21854
  }
22177
- return array;
21855
+ return context.component;
22178
21856
  }
22179
- function getNamespace(elementName) {
22180
- const name = elementName.toLowerCase();
22181
- return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21857
+ /**
21858
+ * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
21859
+ * view that the element is part of. Otherwise retrieves the instance of the component whose view
21860
+ * owns the element (in this case, the result is the same as calling `getOwningComponent`).
21861
+ *
21862
+ * @param element Element for which to get the surrounding component instance.
21863
+ * @returns Instance of the component that is around the element or null if the element isn't
21864
+ * inside any component.
21865
+ *
21866
+ * @publicApi
21867
+ * @globalApi ng
21868
+ */
21869
+ function getContext(element) {
21870
+ assertDomElement(element);
21871
+ const context = getLContext(element);
21872
+ const lView = context ? context.lView : null;
21873
+ return lView === null ? null : lView[CONTEXT];
22182
21874
  }
22183
21875
  /**
22184
- * Injector that looks up a value using a specific injector, before falling back to the module
22185
- * injector. Used primarily when creating components or embedded views dynamically.
21876
+ * Retrieves the component instance whose view contains the DOM element.
21877
+ *
21878
+ * For example, if `<child-comp>` is used in the template of `<app-comp>`
21879
+ * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
21880
+ * would return `<app-comp>`.
21881
+ *
21882
+ * @param elementOrDir DOM element, component or directive instance
21883
+ * for which to retrieve the root components.
21884
+ * @returns Component instance whose view owns the DOM element or null if the element is not
21885
+ * part of a component view.
21886
+ *
21887
+ * @publicApi
21888
+ * @globalApi ng
22186
21889
  */
22187
- class ChainedInjector {
22188
- constructor(injector, parentInjector) {
22189
- this.injector = injector;
22190
- this.parentInjector = parentInjector;
22191
- }
22192
- get(token, notFoundValue, flags) {
22193
- const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
22194
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
22195
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
22196
- // Return the value from the root element injector when
22197
- // - it provides it
22198
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22199
- // - the module injector should not be checked
22200
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22201
- return value;
22202
- }
22203
- return this.parentInjector.get(token, notFoundValue, flags);
21890
+ function getOwningComponent(elementOrDir) {
21891
+ const context = getLContext(elementOrDir);
21892
+ let lView = context ? context.lView : null;
21893
+ if (lView === null)
21894
+ return null;
21895
+ let parent;
21896
+ while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
21897
+ lView = parent;
22204
21898
  }
21899
+ return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
22205
21900
  }
22206
21901
  /**
22207
- * Render3 implementation of {@link viewEngine_ComponentFactory}.
21902
+ * Retrieves all root components associated with a DOM element, directive or component instance.
21903
+ * Root components are those which have been bootstrapped by Angular.
21904
+ *
21905
+ * @param elementOrDir DOM element, component or directive instance
21906
+ * for which to retrieve the root components.
21907
+ * @returns Root components associated with the target object.
21908
+ *
21909
+ * @publicApi
21910
+ * @globalApi ng
22208
21911
  */
22209
- class ComponentFactory extends ComponentFactory$1 {
22210
- /**
22211
- * @param componentDef The component definition.
22212
- * @param ngModule The NgModuleRef to which the factory is bound.
22213
- */
22214
- constructor(componentDef, ngModule) {
22215
- super();
22216
- this.componentDef = componentDef;
22217
- this.ngModule = ngModule;
22218
- this.componentType = componentDef.type;
22219
- this.selector = stringifyCSSSelectorList(componentDef.selectors);
22220
- this.ngContentSelectors =
22221
- componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
22222
- this.isBoundToModule = !!ngModule;
22223
- }
22224
- get inputs() {
22225
- return toRefArray(this.componentDef.inputs);
22226
- }
22227
- get outputs() {
22228
- return toRefArray(this.componentDef.outputs);
22229
- }
22230
- create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
22231
- environmentInjector = environmentInjector || this.ngModule;
22232
- let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
22233
- environmentInjector :
22234
- environmentInjector?.injector;
22235
- if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
22236
- realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
22237
- realEnvironmentInjector;
22238
- }
22239
- const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
22240
- const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
22241
- const sanitizer = rootViewInjector.get(Sanitizer, null);
22242
- const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
22243
- // Determine a tag name used for creating host elements when this component is created
22244
- // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
22245
- const elementName = this.componentDef.selectors[0][0] || 'div';
22246
- const hostRNode = rootSelectorOrNode ?
22247
- locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
22248
- createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
22249
- const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
22250
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
22251
- const rootContext = createRootContext();
22252
- // Create the root view. Uses empty TView and ContentTemplate.
22253
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
22254
- const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
22255
- // rootView is the parent when bootstrapping
22256
- // TODO(misko): it looks like we are entering view here but we don't really need to as
22257
- // `renderView` does that. However as the code is written it is needed because
22258
- // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
22259
- // issues would allow us to drop this.
22260
- enterView(rootLView);
22261
- let component;
22262
- let tElementNode;
22263
- try {
22264
- const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
22265
- if (hostRNode) {
22266
- if (rootSelectorOrNode) {
22267
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
22268
- }
22269
- else {
22270
- // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
22271
- // is not defined), also apply attributes and classes extracted from component selector.
22272
- // Extract attributes and classes from the first selector only to match VE behavior.
22273
- const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
22274
- if (attrs) {
22275
- setUpAttributes(hostRenderer, hostRNode, attrs);
22276
- }
22277
- if (classes && classes.length > 0) {
22278
- writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
22279
- }
22280
- }
22281
- }
22282
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
22283
- if (projectableNodes !== undefined) {
22284
- const projection = tElementNode.projection = [];
22285
- for (let i = 0; i < this.ngContentSelectors.length; i++) {
22286
- const nodesforSlot = projectableNodes[i];
22287
- // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
22288
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
22289
- // complex checks down the line.
22290
- // We also normalize the length of the passed in projectable nodes (to match the number of
22291
- // <ng-container> slots defined by a component).
22292
- projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
22293
- }
22294
- }
22295
- // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
22296
- // executed here?
22297
- // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
22298
- component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
22299
- renderView(rootTView, rootLView, null);
22300
- }
22301
- finally {
22302
- leaveView();
21912
+ function getRootComponents(elementOrDir) {
21913
+ const lView = readPatchedLView(elementOrDir);
21914
+ return lView !== null ? [...getRootContext(lView).components] : [];
21915
+ }
21916
+ /**
21917
+ * Retrieves an `Injector` associated with an element, component or directive instance.
21918
+ *
21919
+ * @param elementOrDir DOM element, component or directive instance for which to
21920
+ * retrieve the injector.
21921
+ * @returns Injector associated with the element, component or directive instance.
21922
+ *
21923
+ * @publicApi
21924
+ * @globalApi ng
21925
+ */
21926
+ function getInjector(elementOrDir) {
21927
+ const context = getLContext(elementOrDir);
21928
+ const lView = context ? context.lView : null;
21929
+ if (lView === null)
21930
+ return Injector.NULL;
21931
+ const tNode = lView[TVIEW].data[context.nodeIndex];
21932
+ return new NodeInjector(tNode, lView);
21933
+ }
21934
+ /**
21935
+ * Retrieve a set of injection tokens at a given DOM node.
21936
+ *
21937
+ * @param element Element for which the injection tokens should be retrieved.
21938
+ */
21939
+ function getInjectionTokens(element) {
21940
+ const context = getLContext(element);
21941
+ const lView = context ? context.lView : null;
21942
+ if (lView === null)
21943
+ return [];
21944
+ const tView = lView[TVIEW];
21945
+ const tNode = tView.data[context.nodeIndex];
21946
+ const providerTokens = [];
21947
+ const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
21948
+ const endIndex = tNode.directiveEnd;
21949
+ for (let i = startIndex; i < endIndex; i++) {
21950
+ let value = tView.data[i];
21951
+ if (isDirectiveDefHack(value)) {
21952
+ // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
21953
+ // design flaw. We should always store same type so that we can be monomorphic. The issue
21954
+ // is that for Components/Directives we store the def instead the type. The correct behavior
21955
+ // is that we should always be storing injectable type in this location.
21956
+ value = value.type;
22303
21957
  }
22304
- return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21958
+ providerTokens.push(value);
22305
21959
  }
21960
+ return providerTokens;
22306
21961
  }
22307
- const componentFactoryResolver = new ComponentFactoryResolver();
22308
21962
  /**
22309
- * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
22310
- * ComponentFactoryResolver
22311
- * already exists, retrieves the existing ComponentFactoryResolver.
21963
+ * Retrieves directive instances associated with a given DOM node. Does not include
21964
+ * component instances.
22312
21965
  *
22313
- * @returns The ComponentFactoryResolver instance to use
21966
+ * @usageNotes
21967
+ * Given the following DOM structure:
21968
+ *
21969
+ * ```html
21970
+ * <app-root>
21971
+ * <button my-button></button>
21972
+ * <my-comp></my-comp>
21973
+ * </app-root>
21974
+ * ```
21975
+ *
21976
+ * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
21977
+ * directive that is associated with the DOM node.
21978
+ *
21979
+ * Calling `getDirectives` on `<my-comp>` will return an empty array.
21980
+ *
21981
+ * @param node DOM node for which to get the directives.
21982
+ * @returns Array of directives associated with the node.
21983
+ *
21984
+ * @publicApi
21985
+ * @globalApi ng
22314
21986
  */
22315
- function injectComponentFactoryResolver() {
22316
- return componentFactoryResolver;
21987
+ function getDirectives(node) {
21988
+ // Skip text nodes because we can't have directives associated with them.
21989
+ if (node instanceof Text) {
21990
+ return [];
21991
+ }
21992
+ const context = getLContext(node);
21993
+ const lView = context ? context.lView : null;
21994
+ if (lView === null) {
21995
+ return [];
21996
+ }
21997
+ const tView = lView[TVIEW];
21998
+ const nodeIndex = context.nodeIndex;
21999
+ if (!tView?.data[nodeIndex]) {
22000
+ return [];
22001
+ }
22002
+ if (context.directives === undefined) {
22003
+ context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
22004
+ }
22005
+ // The `directives` in this case are a named array called `LComponentView`. Clone the
22006
+ // result so we don't expose an internal data structure in the user's console.
22007
+ return context.directives === null ? [] : [...context.directives];
22317
22008
  }
22318
22009
  /**
22319
- * Represents an instance of a Component created via a {@link ComponentFactory}.
22010
+ * Returns the debug (partial) metadata for a particular directive or component instance.
22011
+ * The function accepts an instance of a directive or component and returns the corresponding
22012
+ * metadata.
22320
22013
  *
22321
- * `ComponentRef` provides access to the Component Instance as well other objects related to this
22322
- * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
22323
- * method.
22014
+ * @param directiveOrComponentInstance Instance of a directive or component
22015
+ * @returns metadata of the passed directive or component
22324
22016
  *
22017
+ * @publicApi
22018
+ * @globalApi ng
22325
22019
  */
22326
- class ComponentRef extends ComponentRef$1 {
22327
- constructor(componentType, instance, location, _rootLView, _tNode) {
22328
- super();
22329
- this.location = location;
22330
- this._rootLView = _rootLView;
22331
- this._tNode = _tNode;
22332
- this.instance = instance;
22333
- this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
22334
- this.componentType = componentType;
22335
- }
22336
- get injector() {
22337
- return new NodeInjector(this._tNode, this._rootLView);
22020
+ function getDirectiveMetadata$1(directiveOrComponentInstance) {
22021
+ const { constructor } = directiveOrComponentInstance;
22022
+ if (!constructor) {
22023
+ throw new Error('Unable to find the instance constructor');
22338
22024
  }
22339
- destroy() {
22340
- this.hostView.destroy();
22025
+ // In case a component inherits from a directive, we may have component and directive metadata
22026
+ // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
22027
+ const componentDef = getComponentDef(constructor);
22028
+ if (componentDef) {
22029
+ return {
22030
+ inputs: componentDef.inputs,
22031
+ outputs: componentDef.outputs,
22032
+ encapsulation: componentDef.encapsulation,
22033
+ changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
22034
+ ChangeDetectionStrategy.Default
22035
+ };
22341
22036
  }
22342
- onDestroy(callback) {
22343
- this.hostView.onDestroy(callback);
22037
+ const directiveDef = getDirectiveDef(constructor);
22038
+ if (directiveDef) {
22039
+ return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
22344
22040
  }
22041
+ return null;
22345
22042
  }
22346
-
22347
22043
  /**
22348
- * @license
22349
- * Copyright Google LLC All Rights Reserved.
22044
+ * Retrieve map of local references.
22350
22045
  *
22351
- * Use of this source code is governed by an MIT-style license that can be
22352
- * found in the LICENSE file at https://angular.io/license
22046
+ * The references are retrieved as a map of local reference name to element or directive instance.
22047
+ *
22048
+ * @param target DOM element, component or directive instance for which to retrieve
22049
+ * the local references.
22353
22050
  */
22051
+ function getLocalRefs(target) {
22052
+ const context = getLContext(target);
22053
+ if (context === null)
22054
+ return {};
22055
+ if (context.localRefs === undefined) {
22056
+ const lView = context.lView;
22057
+ if (lView === null) {
22058
+ return {};
22059
+ }
22060
+ context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
22061
+ }
22062
+ return context.localRefs || {};
22063
+ }
22354
22064
  /**
22355
- * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
22356
- * @param ngModule NgModule class.
22357
- * @param parentInjector Optional injector instance to use as a parent for the module injector. If
22358
- * not provided, `NullInjector` will be used instead.
22065
+ * Retrieves the host element of a component or directive instance.
22066
+ * The host element is the DOM element that matched the selector of the directive.
22067
+ *
22068
+ * @param componentOrDirective Component or directive instance for which the host
22069
+ * element should be retrieved.
22070
+ * @returns Host element of the target.
22071
+ *
22359
22072
  * @publicApi
22073
+ * @globalApi ng
22360
22074
  */
22361
- function createNgModuleRef(ngModule, parentInjector) {
22362
- return new NgModuleRef(ngModule, parentInjector ?? null);
22075
+ function getHostElement(componentOrDirective) {
22076
+ return getLContext(componentOrDirective).native;
22363
22077
  }
22364
- class NgModuleRef extends NgModuleRef$1 {
22365
- constructor(ngModuleType, _parent) {
22366
- super();
22367
- this._parent = _parent;
22368
- // tslint:disable-next-line:require-internal-with-underscore
22369
- this._bootstrapComponents = [];
22370
- this.injector = this;
22371
- this.destroyCbs = [];
22372
- // When bootstrapping a module we have a dependency graph that looks like this:
22373
- // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
22374
- // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
22375
- // circular dependency which will result in a runtime error, because the injector doesn't
22376
- // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
22377
- // and providing it, rather than letting the injector resolve it.
22378
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22379
- const ngModuleDef = getNgModuleDef(ngModuleType);
22380
- ngDevMode &&
22381
- assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
22382
- this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
22383
- this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
22384
- { provide: NgModuleRef$1, useValue: this }, {
22385
- provide: ComponentFactoryResolver$1,
22386
- useValue: this.componentFactoryResolver
22078
+ /**
22079
+ * Retrieves the rendered text for a given component.
22080
+ *
22081
+ * This function retrieves the host element of a component and
22082
+ * and then returns the `textContent` for that element. This implies
22083
+ * that the text returned will include re-projected content of
22084
+ * the component as well.
22085
+ *
22086
+ * @param component The component to return the content text for.
22087
+ */
22088
+ function getRenderedText(component) {
22089
+ const hostElement = getHostElement(component);
22090
+ return hostElement.textContent || '';
22091
+ }
22092
+ /**
22093
+ * Retrieves a list of event listeners associated with a DOM element. The list does include host
22094
+ * listeners, but it does not include event listeners defined outside of the Angular context
22095
+ * (e.g. through `addEventListener`).
22096
+ *
22097
+ * @usageNotes
22098
+ * Given the following DOM structure:
22099
+ *
22100
+ * ```html
22101
+ * <app-root>
22102
+ * <div (click)="doSomething()"></div>
22103
+ * </app-root>
22104
+ * ```
22105
+ *
22106
+ * Calling `getListeners` on `<div>` will return an object that looks as follows:
22107
+ *
22108
+ * ```ts
22109
+ * {
22110
+ * name: 'click',
22111
+ * element: <div>,
22112
+ * callback: () => doSomething(),
22113
+ * useCapture: false
22114
+ * }
22115
+ * ```
22116
+ *
22117
+ * @param element Element for which the DOM listeners should be retrieved.
22118
+ * @returns Array of event listeners on the DOM element.
22119
+ *
22120
+ * @publicApi
22121
+ * @globalApi ng
22122
+ */
22123
+ function getListeners(element) {
22124
+ ngDevMode && assertDomElement(element);
22125
+ const lContext = getLContext(element);
22126
+ const lView = lContext === null ? null : lContext.lView;
22127
+ if (lView === null)
22128
+ return [];
22129
+ const tView = lView[TVIEW];
22130
+ const lCleanup = lView[CLEANUP];
22131
+ const tCleanup = tView.cleanup;
22132
+ const listeners = [];
22133
+ if (tCleanup && lCleanup) {
22134
+ for (let i = 0; i < tCleanup.length;) {
22135
+ const firstParam = tCleanup[i++];
22136
+ const secondParam = tCleanup[i++];
22137
+ if (typeof firstParam === 'string') {
22138
+ const name = firstParam;
22139
+ const listenerElement = unwrapRNode(lView[secondParam]);
22140
+ const callback = lCleanup[tCleanup[i++]];
22141
+ const useCaptureOrIndx = tCleanup[i++];
22142
+ // if useCaptureOrIndx is boolean then report it as is.
22143
+ // if useCaptureOrIndx is positive number then it in unsubscribe method
22144
+ // if useCaptureOrIndx is negative number then it is a Subscription
22145
+ const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
22146
+ const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
22147
+ if (element == listenerElement) {
22148
+ listeners.push({ element, name, callback, useCapture, type });
22149
+ }
22387
22150
  }
22388
- ], stringify(ngModuleType), new Set(['environment']));
22389
- // We need to resolve the injector types separately from the injector creation, because
22390
- // the module might be trying to use this ref in its constructor for DI which will cause a
22391
- // circular error that will eventually error out, because the injector isn't created yet.
22392
- this._r3Injector.resolveInjectorInitializers();
22393
- this.instance = this.get(ngModuleType);
22394
- }
22395
- get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
22396
- if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
22397
- return this;
22398
22151
  }
22399
- return this._r3Injector.get(token, notFoundValue, injectFlags);
22400
- }
22401
- destroy() {
22402
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22403
- const injector = this._r3Injector;
22404
- !injector.destroyed && injector.destroy();
22405
- this.destroyCbs.forEach(fn => fn());
22406
- this.destroyCbs = null;
22407
- }
22408
- onDestroy(callback) {
22409
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22410
- this.destroyCbs.push(callback);
22411
- }
22412
- }
22413
- class NgModuleFactory extends NgModuleFactory$1 {
22414
- constructor(moduleType) {
22415
- super();
22416
- this.moduleType = moduleType;
22417
- }
22418
- create(parentInjector) {
22419
- return new NgModuleRef(this.moduleType, parentInjector);
22420
22152
  }
22153
+ listeners.sort(sortListeners);
22154
+ return listeners;
22421
22155
  }
22422
- class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22423
- constructor(providers, parent, source) {
22424
- super();
22425
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22426
- this.instance = null;
22427
- const injector = new R3Injector([
22428
- ...providers,
22429
- { provide: NgModuleRef$1, useValue: this },
22430
- { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
22431
- ], parent || getNullInjector(), source, new Set(['environment']));
22432
- this.injector = injector;
22433
- injector.resolveInjectorInitializers();
22434
- }
22435
- destroy() {
22436
- this.injector.destroy();
22437
- }
22438
- onDestroy(callback) {
22439
- this.injector.onDestroy(callback);
22440
- }
22156
+ function sortListeners(a, b) {
22157
+ if (a.name == b.name)
22158
+ return 0;
22159
+ return a.name < b.name ? -1 : 1;
22441
22160
  }
22442
22161
  /**
22443
- * Create a new environment injector.
22162
+ * This function should not exist because it is megamorphic and only mostly correct.
22444
22163
  *
22445
- * @publicApi
22446
- * @developerPreview
22164
+ * See call site for more info.
22447
22165
  */
22448
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22449
- const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22450
- return adapter.injector;
22166
+ function isDirectiveDefHack(obj) {
22167
+ return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
22451
22168
  }
22452
-
22453
22169
  /**
22454
- * @license
22455
- * Copyright Google LLC All Rights Reserved.
22170
+ * Returns the attached `DebugNode` instance for an element in the DOM.
22456
22171
  *
22457
- * Use of this source code is governed by an MIT-style license that can be
22458
- * found in the LICENSE file at https://angular.io/license
22459
- */
22460
- /**
22461
- * A service used by the framework to create instances of standalone injectors. Those injectors are
22462
- * created on demand in case of dynamic component instantiation and contain ambient providers
22463
- * collected from the imports graph rooted at a given standalone component.
22172
+ * @param element DOM element which is owned by an existing component's view.
22464
22173
  */
22465
- class StandaloneService {
22466
- constructor(_injector) {
22467
- this._injector = _injector;
22468
- this.cachedInjectors = new Map();
22174
+ function getDebugNode$1(element) {
22175
+ if (ngDevMode && !(element instanceof Node)) {
22176
+ throw new Error('Expecting instance of DOM Element');
22469
22177
  }
22470
- getOrCreateStandaloneInjector(componentDef) {
22471
- if (!componentDef.standalone) {
22472
- return null;
22473
- }
22474
- if (!this.cachedInjectors.has(componentDef.id)) {
22475
- const providers = internalImportProvidersFrom(false, componentDef.type);
22476
- const standaloneInjector = providers.length > 0 ?
22477
- createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22478
- null;
22479
- this.cachedInjectors.set(componentDef.id, standaloneInjector);
22480
- }
22481
- return this.cachedInjectors.get(componentDef.id);
22178
+ const lContext = getLContext(element);
22179
+ const lView = lContext ? lContext.lView : null;
22180
+ if (lView === null) {
22181
+ return null;
22482
22182
  }
22483
- ngOnDestroy() {
22484
- try {
22485
- for (const injector of this.cachedInjectors.values()) {
22486
- if (injector !== null) {
22487
- injector.destroy();
22488
- }
22489
- }
22490
- }
22491
- finally {
22492
- this.cachedInjectors.clear();
22493
- }
22183
+ const nodeIndex = lContext.nodeIndex;
22184
+ if (nodeIndex !== -1) {
22185
+ const valueInLView = lView[nodeIndex];
22186
+ // this means that value in the lView is a component with its own
22187
+ // data. In this situation the TNode is not accessed at the same spot.
22188
+ const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
22189
+ ngDevMode &&
22190
+ assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
22191
+ return buildDebugNode(tNode, lView);
22494
22192
  }
22193
+ return null;
22495
22194
  }
22496
- /** @nocollapse */
22497
- StandaloneService.ɵprov = ɵɵdefineInjectable({
22498
- token: StandaloneService,
22499
- providedIn: 'environment',
22500
- factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
22501
- });
22502
22195
  /**
22503
- * A feature that acts as a setup code for the {@link StandaloneService}.
22196
+ * Retrieve the component `LView` from component/element.
22504
22197
  *
22505
- * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
22506
- * function (an entry points to a standalone injector creation) on a component definition object. We
22507
- * go through the features infrastructure to make sure that the standalone injector creation logic
22508
- * is tree-shakable and not included in applications that don't use standalone components.
22198
+ * NOTE: `LView` is a private and should not be leaked outside.
22199
+ * Don't export this method to `ng.*` on window.
22509
22200
  *
22510
- * @codeGenApi
22201
+ * @param target DOM element or component instance for which to retrieve the LView.
22511
22202
  */
22512
- function ɵɵStandaloneFeature(definition) {
22513
- definition.getStandaloneInjector = (parentInjector) => {
22514
- return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
22515
- };
22203
+ function getComponentLView(target) {
22204
+ const lContext = getLContext(target);
22205
+ const nodeIndx = lContext.nodeIndex;
22206
+ const lView = lContext.lView;
22207
+ ngDevMode && assertLView(lView);
22208
+ const componentLView = lView[nodeIndx];
22209
+ ngDevMode && assertLView(componentLView);
22210
+ return componentLView;
22211
+ }
22212
+ /** Asserts that a value is a DOM Element. */
22213
+ function assertDomElement(value) {
22214
+ if (typeof Element !== 'undefined' && !(value instanceof Element)) {
22215
+ throw new Error('Expecting instance of DOM Element');
22216
+ }
22516
22217
  }
22517
22218
 
22518
22219
  /**
@@ -23732,7 +23433,7 @@ const unusedValueExportToPlacateAjd = 1;
23732
23433
  * Use of this source code is governed by an MIT-style license that can be
23733
23434
  * found in the LICENSE file at https://angular.io/license
23734
23435
  */
23735
- const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd;
23436
+ const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd;
23736
23437
  class LQuery_ {
23737
23438
  constructor(queryList) {
23738
23439
  this.queryList = queryList;
@@ -26166,6 +25867,99 @@ const COMPILER_OPTIONS = new InjectionToken('compilerOptions');
26166
25867
  class CompilerFactory {
26167
25868
  }
26168
25869
 
25870
+ /**
25871
+ * @license
25872
+ * Copyright Google LLC All Rights Reserved.
25873
+ *
25874
+ * Use of this source code is governed by an MIT-style license that can be
25875
+ * found in the LICENSE file at https://angular.io/license
25876
+ */
25877
+ /**
25878
+ * Marks a component for check (in case of OnPush components) and synchronously
25879
+ * performs change detection on the application this component belongs to.
25880
+ *
25881
+ * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
25882
+ *
25883
+ * @publicApi
25884
+ * @globalApi ng
25885
+ */
25886
+ function applyChanges(component) {
25887
+ markDirty(component);
25888
+ getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
25889
+ }
25890
+
25891
+ /**
25892
+ * @license
25893
+ * Copyright Google LLC All Rights Reserved.
25894
+ *
25895
+ * Use of this source code is governed by an MIT-style license that can be
25896
+ * found in the LICENSE file at https://angular.io/license
25897
+ */
25898
+ /**
25899
+ * This file introduces series of globally accessible debug tools
25900
+ * to allow for the Angular debugging story to function.
25901
+ *
25902
+ * To see this in action run the following command:
25903
+ *
25904
+ * bazel run //packages/core/test/bundling/todo:devserver
25905
+ *
25906
+ * Then load `localhost:5432` and start using the console tools.
25907
+ */
25908
+ /**
25909
+ * This value reflects the property on the window where the dev
25910
+ * tools are patched (window.ng).
25911
+ * */
25912
+ const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
25913
+ let _published = false;
25914
+ /**
25915
+ * Publishes a collection of default debug tools onto`window.ng`.
25916
+ *
25917
+ * These functions are available globally when Angular is in development
25918
+ * mode and are automatically stripped away from prod mode is on.
25919
+ */
25920
+ function publishDefaultGlobalUtils$1() {
25921
+ if (!_published) {
25922
+ _published = true;
25923
+ /**
25924
+ * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
25925
+ * The contract of the function might be changed in any release and/or the function can be
25926
+ * removed completely.
25927
+ */
25928
+ publishGlobalUtil('ɵsetProfiler', setProfiler);
25929
+ publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
25930
+ publishGlobalUtil('getComponent', getComponent);
25931
+ publishGlobalUtil('getContext', getContext);
25932
+ publishGlobalUtil('getListeners', getListeners);
25933
+ publishGlobalUtil('getOwningComponent', getOwningComponent);
25934
+ publishGlobalUtil('getHostElement', getHostElement);
25935
+ publishGlobalUtil('getInjector', getInjector);
25936
+ publishGlobalUtil('getRootComponents', getRootComponents);
25937
+ publishGlobalUtil('getDirectives', getDirectives);
25938
+ publishGlobalUtil('applyChanges', applyChanges);
25939
+ }
25940
+ }
25941
+ /**
25942
+ * Publishes the given function to `window.ng` so that it can be
25943
+ * used from the browser console when an application is not in production.
25944
+ */
25945
+ function publishGlobalUtil(name, fn) {
25946
+ if (typeof COMPILED === 'undefined' || !COMPILED) {
25947
+ // Note: we can't export `ng` when using closure enhanced optimization as:
25948
+ // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
25949
+ // - we can't declare a closure extern as the namespace `ng` is already used within Google
25950
+ // for typings for AngularJS (via `goog.provide('ng....')`).
25951
+ const w = _global;
25952
+ ngDevMode && assertDefined(fn, 'function not defined');
25953
+ if (w) {
25954
+ let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
25955
+ if (!container) {
25956
+ container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
25957
+ }
25958
+ container[name] = fn;
25959
+ }
25960
+ }
25961
+ }
25962
+
26169
25963
  /**
26170
25964
  * @license
26171
25965
  * Copyright Google LLC All Rights Reserved.
@@ -26321,7 +26115,7 @@ class NgZone {
26321
26115
  */
26322
26116
  this.onError = new EventEmitter(false);
26323
26117
  if (typeof Zone == 'undefined') {
26324
- throw new Error(`In this configuration Angular requires Zone.js`);
26118
+ throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);
26325
26119
  }
26326
26120
  Zone.assertZonePatched();
26327
26121
  const self = this;
@@ -26348,12 +26142,12 @@ class NgZone {
26348
26142
  }
26349
26143
  static assertInAngularZone() {
26350
26144
  if (!NgZone.isInAngularZone()) {
26351
- throw new Error('Expected to be in Angular Zone, but it is not!');
26145
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
26352
26146
  }
26353
26147
  }
26354
26148
  static assertNotInAngularZone() {
26355
26149
  if (NgZone.isInAngularZone()) {
26356
- throw new Error('Expected to not be in Angular Zone, but it is!');
26150
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
26357
26151
  }
26358
26152
  }
26359
26153
  /**
@@ -26917,7 +26711,7 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26917
26711
  * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
26918
26712
  * entire class tree-shakeable.
26919
26713
  */
26920
- const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
26714
+ const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
26921
26715
  const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
26922
26716
  function compileNgModuleFactory(injector, options, moduleType) {
26923
26717
  ngDevMode && assertNgModuleType(moduleType);
@@ -27056,7 +26850,15 @@ function internalBootstrapApplication(config) {
27056
26850
  const localeId = appInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
27057
26851
  setLocaleId(localeId || DEFAULT_LOCALE_ID);
27058
26852
  const appRef = appInjector.get(ApplicationRef);
27059
- appRef.onDestroy(() => onErrorSubscription.unsubscribe());
26853
+ // If the whole platform is destroyed, invoke the `destroy` method
26854
+ // for all bootstrapped applications as well.
26855
+ const destroyListener = () => appRef.destroy();
26856
+ const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS, null);
26857
+ onPlatformDestroyListeners?.add(destroyListener);
26858
+ appRef.onDestroy(() => {
26859
+ onPlatformDestroyListeners?.delete(destroyListener);
26860
+ onErrorSubscription.unsubscribe();
26861
+ });
27060
26862
  appRef.bootstrap(rootComponent);
27061
26863
  return appRef;
27062
26864
  });
@@ -27120,7 +26922,7 @@ function createPlatformInjector(providers = [], name) {
27120
26922
  name,
27121
26923
  providers: [
27122
26924
  { provide: INJECTOR_SCOPE, useValue: 'platform' },
27123
- { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
26925
+ { provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => _platformInjector = null]) },
27124
26926
  ...providers
27125
26927
  ],
27126
26928
  });
@@ -27267,8 +27069,11 @@ class PlatformRef {
27267
27069
  }
27268
27070
  this._modules.slice().forEach(module => module.destroy());
27269
27071
  this._destroyListeners.forEach(listener => listener());
27270
- const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
27271
- destroyListener?.();
27072
+ const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
27073
+ if (destroyListeners) {
27074
+ destroyListeners.forEach(listener => listener());
27075
+ destroyListeners.clear();
27076
+ }
27272
27077
  this._destroyed = true;
27273
27078
  }
27274
27079
  /**
@@ -27426,11 +27231,10 @@ function optionsReducer(dst, objs) {
27426
27231
  */
27427
27232
  class ApplicationRef {
27428
27233
  /** @internal */
27429
- constructor(_zone, _injector, _exceptionHandler, _initStatus) {
27234
+ constructor(_zone, _injector, _exceptionHandler) {
27430
27235
  this._zone = _zone;
27431
27236
  this._injector = _injector;
27432
27237
  this._exceptionHandler = _exceptionHandler;
27433
- this._initStatus = _initStatus;
27434
27238
  /** @internal */
27435
27239
  this._bootstrapListeners = [];
27436
27240
  this._views = [];
@@ -27547,7 +27351,8 @@ class ApplicationRef {
27547
27351
  bootstrap(componentOrFactory, rootSelectorOrNode) {
27548
27352
  NG_DEV_MODE && this.warnIfDestroyed();
27549
27353
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
27550
- if (!this._initStatus.done) {
27354
+ const initStatus = this._injector.get(ApplicationInitStatus);
27355
+ if (!initStatus.done) {
27551
27356
  const standalone = !isComponentFactory && isStandalone(componentOrFactory);
27552
27357
  const errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' +
27553
27358
  (standalone ? '' :
@@ -27679,7 +27484,7 @@ class ApplicationRef {
27679
27484
  }
27680
27485
  /**
27681
27486
  * Destroys an Angular application represented by this `ApplicationRef`. Calling this function
27682
- * will destroy the associated environnement injectors as well as all the bootstrapped components
27487
+ * will destroy the associated environment injectors as well as all the bootstrapped components
27683
27488
  * with their views.
27684
27489
  */
27685
27490
  destroy() {
@@ -27706,12 +27511,12 @@ class ApplicationRef {
27706
27511
  }
27707
27512
  }
27708
27513
  }
27709
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
27514
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler)); };
27710
27515
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
27711
27516
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
27712
27517
  type: Injectable,
27713
27518
  args: [{ providedIn: 'root' }]
27714
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null); })();
27519
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }]; }, null); })();
27715
27520
  function remove(list, el) {
27716
27521
  const index = list.indexOf(el);
27717
27522
  if (index > -1) {
@@ -28058,7 +27863,7 @@ class DebugNode {
28058
27863
  get componentInstance() {
28059
27864
  const nativeElement = this.nativeNode;
28060
27865
  return nativeElement &&
28061
- (getComponent$1(nativeElement) || getOwningComponent(nativeElement));
27866
+ (getComponent(nativeElement) || getOwningComponent(nativeElement));
28062
27867
  }
28063
27868
  /**
28064
27869
  * An object that provides parent context for this element. Often an ancestor component instance
@@ -28069,7 +27874,7 @@ class DebugNode {
28069
27874
  * of heroes"`.
28070
27875
  */
28071
27876
  get context() {
28072
- return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
27877
+ return getComponent(this.nativeNode) || getContext(this.nativeNode);
28073
27878
  }
28074
27879
  /**
28075
27880
  * The callbacks attached to the component's @Output properties and/or the element's event
@@ -28409,8 +28214,7 @@ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, root
28409
28214
  // Renderer2, however that's not the case in Ivy. This approach is being used because:
28410
28215
  // 1. Matching the ViewEngine behavior would mean potentially introducing a depedency
28411
28216
  // from `Renderer2` to Ivy which could bring Ivy code into ViewEngine.
28412
- // 2. We would have to make `Renderer3` "know" about debug nodes.
28413
- // 3. It allows us to capture nodes that were inserted directly via the DOM.
28217
+ // 2. It allows us to capture nodes that were inserted directly via the DOM.
28414
28218
  nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
28415
28219
  }
28416
28220
  // In all cases, if a dynamic container exists for this node, each view inside it has to be
@@ -29886,5 +29690,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29886
29690
  * Generated bundle index. Do not edit.
29887
29691
  */
29888
29692
 
29889
- 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 };
29693
+ 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 };
29890
29694
  //# sourceMappingURL=core.mjs.map