@angular/core 14.0.2 → 14.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/esm2020/src/application_ref.mjs +31 -35
  2. package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +3 -5
  3. package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +3 -5
  4. package/esm2020/src/change_detection/differs/iterable_differs.mjs +3 -5
  5. package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +2 -5
  6. package/esm2020/src/core.mjs +1 -1
  7. package/esm2020/src/core_render3_private_export.mjs +2 -2
  8. package/esm2020/src/debug/debug_node.mjs +2 -3
  9. package/esm2020/src/di/injector_compatibility.mjs +6 -16
  10. package/esm2020/src/di/jit/util.mjs +3 -2
  11. package/esm2020/src/di/reflective_key.mjs +3 -2
  12. package/esm2020/src/errors.mjs +1 -1
  13. package/esm2020/src/i18n/locale_data_api.mjs +3 -2
  14. package/esm2020/src/render/api.mjs +2 -11
  15. package/esm2020/src/render3/component.mjs +3 -57
  16. package/esm2020/src/render3/component_ref.mjs +9 -3
  17. package/esm2020/src/render3/features/inherit_definition_feature.mjs +3 -5
  18. package/esm2020/src/render3/index.mjs +3 -3
  19. package/esm2020/src/render3/instructions/listener.mjs +34 -44
  20. package/esm2020/src/render3/instructions/lview_debug.mjs +1 -1
  21. package/esm2020/src/render3/instructions/shared.mjs +19 -57
  22. package/esm2020/src/render3/instructions/styling.mjs +2 -2
  23. package/esm2020/src/render3/interfaces/renderer.mjs +1 -17
  24. package/esm2020/src/render3/interfaces/view.mjs +1 -1
  25. package/esm2020/src/render3/jit/directive.mjs +20 -3
  26. package/esm2020/src/render3/node_manipulation.mjs +24 -87
  27. package/esm2020/src/render3/node_manipulation_i18n.mjs +1 -1
  28. package/esm2020/src/render3/util/attrs_utils.mjs +4 -12
  29. package/esm2020/src/render3/util/view_utils.mjs +3 -6
  30. package/esm2020/src/render3/view_ref.mjs +3 -5
  31. package/esm2020/src/sanitization/sanitization.mjs +4 -9
  32. package/esm2020/src/version.mjs +1 -1
  33. package/esm2020/src/zone/ng_zone.mjs +5 -4
  34. package/esm2020/testing/src/logger.mjs +3 -3
  35. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  36. package/esm2020/testing/src/r3_test_bed_compiler.mjs +30 -25
  37. package/fesm2015/core.mjs +1821 -2020
  38. package/fesm2015/core.mjs.map +1 -1
  39. package/fesm2015/testing.mjs +1023 -1314
  40. package/fesm2015/testing.mjs.map +1 -1
  41. package/fesm2020/core.mjs +1821 -2020
  42. package/fesm2020/core.mjs.map +1 -1
  43. package/fesm2020/testing.mjs +1023 -1314
  44. package/fesm2020/testing.mjs.map +1 -1
  45. package/index.d.ts +60 -133
  46. package/package.json +1 -1
  47. package/testing/index.d.ts +1 -1
  48. package/schematics/utils/schematics_prompt.d.ts +0 -17
  49. package/schematics/utils/schematics_prompt.js +0 -45
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.2
2
+ * @license Angular v14.0.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1586,87 +1586,6 @@ function getNamespaceUri(namespace) {
1586
1586
  (name === MATH_ML_NAMESPACE ? MATH_ML_NAMESPACE_URI : null);
1587
1587
  }
1588
1588
 
1589
- /**
1590
- * @license
1591
- * Copyright Google LLC All Rights Reserved.
1592
- *
1593
- * Use of this source code is governed by an MIT-style license that can be
1594
- * found in the LICENSE file at https://angular.io/license
1595
- */
1596
- /**
1597
- * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
1598
- * inject the `DOCUMENT` token and are done.
1599
- *
1600
- * Ivy is special because it does not rely upon the DI and must get hold of the document some other
1601
- * way.
1602
- *
1603
- * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
1604
- * Wherever ivy needs the global document, it calls `getDocument()` instead.
1605
- *
1606
- * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
1607
- * tell ivy what the global `document` is.
1608
- *
1609
- * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
1610
- * by calling `setDocument()` when providing the `DOCUMENT` token.
1611
- */
1612
- let DOCUMENT = undefined;
1613
- /**
1614
- * Tell ivy what the `document` is for this platform.
1615
- *
1616
- * It is only necessary to call this if the current platform is not a browser.
1617
- *
1618
- * @param document The object representing the global `document` in this environment.
1619
- */
1620
- function setDocument(document) {
1621
- DOCUMENT = document;
1622
- }
1623
- /**
1624
- * Access the object that represents the `document` for this platform.
1625
- *
1626
- * Ivy calls this whenever it needs to access the `document` object.
1627
- * For example to create the renderer or to do sanitization.
1628
- */
1629
- function getDocument() {
1630
- if (DOCUMENT !== undefined) {
1631
- return DOCUMENT;
1632
- }
1633
- else if (typeof document !== 'undefined') {
1634
- return document;
1635
- }
1636
- // No "document" can be found. This should only happen if we are running ivy outside Angular and
1637
- // the current platform is not a browser. Since this is not a supported scenario at the moment
1638
- // this should not happen in Angular apps.
1639
- // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
1640
- // public API. Meanwhile we just return `undefined` and let the application fail.
1641
- return undefined;
1642
- }
1643
-
1644
- /**
1645
- * @license
1646
- * Copyright Google LLC All Rights Reserved.
1647
- *
1648
- * Use of this source code is governed by an MIT-style license that can be
1649
- * found in the LICENSE file at https://angular.io/license
1650
- */
1651
- // TODO: cleanup once the code is merged in angular/angular
1652
- var RendererStyleFlags3;
1653
- (function (RendererStyleFlags3) {
1654
- RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
1655
- RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
1656
- })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
1657
- /** Returns whether the `renderer` is a `ProceduralRenderer3` */
1658
- function isProceduralRenderer(renderer) {
1659
- return !!(renderer.listen);
1660
- }
1661
- const domRendererFactory3 = {
1662
- createRenderer: (hostElement, rendererType) => {
1663
- return getDocument();
1664
- }
1665
- };
1666
- // Note: This hack is necessary so we don't erroneously get a circular dependency
1667
- // failure based on types.
1668
- const unusedValueExportToPlacateAjd$6 = 1;
1669
-
1670
1589
  /**
1671
1590
  * @license
1672
1591
  * Copyright Google LLC All Rights Reserved.
@@ -1749,7 +1668,6 @@ function getNativeByTNode(tNode, lView) {
1749
1668
  ngDevMode && assertTNodeForLView(tNode, lView);
1750
1669
  ngDevMode && assertIndexInRange(lView, tNode.index);
1751
1670
  const node = unwrapRNode(lView[tNode.index]);
1752
- ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1753
1671
  return node;
1754
1672
  }
1755
1673
  /**
@@ -1765,7 +1683,6 @@ function getNativeByTNodeOrNull(tNode, lView) {
1765
1683
  if (index !== -1) {
1766
1684
  ngDevMode && assertTNodeForLView(tNode, lView);
1767
1685
  const node = unwrapRNode(lView[index]);
1768
- ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
1769
1686
  return node;
1770
1687
  }
1771
1688
  return null;
@@ -2714,7 +2631,7 @@ function isFactory(obj) {
2714
2631
  }
2715
2632
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2716
2633
  // failure based on types.
2717
- const unusedValueExportToPlacateAjd$5 = 1;
2634
+ const unusedValueExportToPlacateAjd$6 = 1;
2718
2635
 
2719
2636
  /**
2720
2637
  * Converts `TNodeType` into human readable text.
@@ -2733,7 +2650,7 @@ function toTNodeTypeAsString(tNodeType) {
2733
2650
  }
2734
2651
  // Note: This hack is necessary so we don't erroneously get a circular dependency
2735
2652
  // failure based on types.
2736
- const unusedValueExportToPlacateAjd$4 = 1;
2653
+ const unusedValueExportToPlacateAjd$5 = 1;
2737
2654
  /**
2738
2655
  * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.
2739
2656
  *
@@ -2837,7 +2754,6 @@ function assertPureTNodeType(type) {
2837
2754
  * @returns the index value that was last accessed in the attributes array
2838
2755
  */
2839
2756
  function setUpAttributes(renderer, native, attrs) {
2840
- const isProc = isProceduralRenderer(renderer);
2841
2757
  let i = 0;
2842
2758
  while (i < attrs.length) {
2843
2759
  const value = attrs[i];
@@ -2854,9 +2770,7 @@ function setUpAttributes(renderer, native, attrs) {
2854
2770
  const attrName = attrs[i++];
2855
2771
  const attrVal = attrs[i++];
2856
2772
  ngDevMode && ngDevMode.rendererSetAttribute++;
2857
- isProc ?
2858
- renderer.setAttribute(native, attrName, attrVal, namespaceURI) :
2859
- native.setAttributeNS(namespaceURI, attrName, attrVal);
2773
+ renderer.setAttribute(native, attrName, attrVal, namespaceURI);
2860
2774
  }
2861
2775
  else {
2862
2776
  // attrName is string;
@@ -2865,14 +2779,10 @@ function setUpAttributes(renderer, native, attrs) {
2865
2779
  // Standard attributes
2866
2780
  ngDevMode && ngDevMode.rendererSetAttribute++;
2867
2781
  if (isAnimationProp(attrName)) {
2868
- if (isProc) {
2869
- renderer.setProperty(native, attrName, attrVal);
2870
- }
2782
+ renderer.setProperty(native, attrName, attrVal);
2871
2783
  }
2872
2784
  else {
2873
- isProc ?
2874
- renderer.setAttribute(native, attrName, attrVal) :
2875
- native.setAttribute(attrName, attrVal);
2785
+ renderer.setAttribute(native, attrName, attrVal);
2876
2786
  }
2877
2787
  i++;
2878
2788
  }
@@ -4837,10 +4747,8 @@ function setCurrentInjector(injector) {
4837
4747
  }
4838
4748
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4839
4749
  if (_currentInjector === undefined) {
4840
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4841
- `inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
4842
- '';
4843
- throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4750
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4751
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
4844
4752
  }
4845
4753
  else if (_currentInjector === null) {
4846
4754
  return injectRootLimpMode(token, undefined, flags);
@@ -4856,22 +4764,17 @@ function ɵɵinject(token, flags = InjectFlags.Default) {
4856
4764
  * Throws an error indicating that a factory function could not be generated by the compiler for a
4857
4765
  * particular class.
4858
4766
  *
4859
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
4860
- * off, saving bytes of generated code while still providing a good experience in dev mode.
4861
- *
4862
4767
  * The name of the class is not mentioned here, but will be in the generated factory function name
4863
4768
  * and thus in the stack trace.
4864
4769
  *
4865
4770
  * @codeGenApi
4866
4771
  */
4867
4772
  function ɵɵinvalidFactoryDep(index) {
4868
- const msg = ngDevMode ?
4773
+ throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode &&
4869
4774
  `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
4870
4775
  This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
4871
4776
 
4872
- Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.` :
4873
- 'invalid';
4874
- throw new Error(msg);
4777
+ Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
4875
4778
  }
4876
4779
  /**
4877
4780
  * Injects a token from the currently active injector.
@@ -4946,10 +4849,7 @@ function injectArgs(types) {
4946
4849
  const arg = resolveForwardRef(types[i]);
4947
4850
  if (Array.isArray(arg)) {
4948
4851
  if (arg.length === 0) {
4949
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4950
- 'Arguments array must have arguments.' :
4951
- '';
4952
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
4852
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4953
4853
  }
4954
4854
  let type = undefined;
4955
4855
  let flags = InjectFlags.Default;
@@ -5138,7 +5038,7 @@ function reflectDependency(dep) {
5138
5038
  }
5139
5039
  else if (param instanceof Attribute) {
5140
5040
  if (param.attributeName === undefined) {
5141
- throw new Error(`Attribute name must be defined.`);
5041
+ throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);
5142
5042
  }
5143
5043
  meta.attribute = param.attributeName;
5144
5044
  }
@@ -5324,6 +5224,61 @@ function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
5324
5224
  checkForDuplicateNgModules = !allowDuplicates;
5325
5225
  }
5326
5226
 
5227
+ /**
5228
+ * @license
5229
+ * Copyright Google LLC All Rights Reserved.
5230
+ *
5231
+ * Use of this source code is governed by an MIT-style license that can be
5232
+ * found in the LICENSE file at https://angular.io/license
5233
+ */
5234
+ /**
5235
+ * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
5236
+ * inject the `DOCUMENT` token and are done.
5237
+ *
5238
+ * Ivy is special because it does not rely upon the DI and must get hold of the document some other
5239
+ * way.
5240
+ *
5241
+ * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
5242
+ * Wherever ivy needs the global document, it calls `getDocument()` instead.
5243
+ *
5244
+ * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
5245
+ * tell ivy what the global `document` is.
5246
+ *
5247
+ * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
5248
+ * by calling `setDocument()` when providing the `DOCUMENT` token.
5249
+ */
5250
+ let DOCUMENT = undefined;
5251
+ /**
5252
+ * Tell ivy what the `document` is for this platform.
5253
+ *
5254
+ * It is only necessary to call this if the current platform is not a browser.
5255
+ *
5256
+ * @param document The object representing the global `document` in this environment.
5257
+ */
5258
+ function setDocument(document) {
5259
+ DOCUMENT = document;
5260
+ }
5261
+ /**
5262
+ * Access the object that represents the `document` for this platform.
5263
+ *
5264
+ * Ivy calls this whenever it needs to access the `document` object.
5265
+ * For example to create the renderer or to do sanitization.
5266
+ */
5267
+ function getDocument() {
5268
+ if (DOCUMENT !== undefined) {
5269
+ return DOCUMENT;
5270
+ }
5271
+ else if (typeof document !== 'undefined') {
5272
+ return document;
5273
+ }
5274
+ // No "document" can be found. This should only happen if we are running ivy outside Angular and
5275
+ // the current platform is not a browser. Since this is not a supported scenario at the moment
5276
+ // this should not happen in Angular apps.
5277
+ // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
5278
+ // public API. Meanwhile we just return `undefined` and let the application fail.
5279
+ return undefined;
5280
+ }
5281
+
5327
5282
  /**
5328
5283
  * @license
5329
5284
  * Copyright Google LLC All Rights Reserved.
@@ -6200,10 +6155,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6200
6155
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
6201
6156
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6202
6157
  }
6203
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6204
- 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6205
- '';
6206
- throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6158
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
6159
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6207
6160
  }
6208
6161
  /**
6209
6162
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6225,10 +6178,7 @@ function ɵɵsanitizeScript(unsafeScript) {
6225
6178
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
6226
6179
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6227
6180
  }
6228
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6229
- 'unsafe value used in a script context' :
6230
- '';
6231
- throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6181
+ throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
6232
6182
  }
6233
6183
  /**
6234
6184
  * A template tag function for promoting the associated constant literal to a
@@ -7064,6 +7014,17 @@ function ensureIcuContainerVisitorLoaded(loader) {
7064
7014
  }
7065
7015
  }
7066
7016
 
7017
+ /**
7018
+ * @license
7019
+ * Copyright Google LLC All Rights Reserved.
7020
+ *
7021
+ * Use of this source code is governed by an MIT-style license that can be
7022
+ * found in the LICENSE file at https://angular.io/license
7023
+ */
7024
+ // Note: This hack is necessary so we don't erroneously get a circular dependency
7025
+ // failure based on types.
7026
+ const unusedValueExportToPlacateAjd$4 = 1;
7027
+
7067
7028
  /**
7068
7029
  * @license
7069
7030
  * Copyright Google LLC All Rights Reserved.
@@ -7146,7 +7107,7 @@ function getNearestLContainer(viewOrContainer) {
7146
7107
  * Use of this source code is governed by an MIT-style license that can be
7147
7108
  * found in the LICENSE file at https://angular.io/license
7148
7109
  */
7149
- const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$8 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$7;
7110
+ const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$8 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$7;
7150
7111
  /**
7151
7112
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
7152
7113
  * being passed as an argument.
@@ -7171,7 +7132,6 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7171
7132
  lNodeToHandle = lNodeToHandle[HOST];
7172
7133
  }
7173
7134
  const rNode = unwrapRNode(lNodeToHandle);
7174
- ngDevMode && !isProceduralRenderer(renderer) && assertDomNode(rNode);
7175
7135
  if (action === 0 /* WalkTNodeTreeAction.Create */ && parent !== null) {
7176
7136
  if (beforeNode == null) {
7177
7137
  nativeAppendChild(renderer, parent, rNode);
@@ -7198,17 +7158,14 @@ function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, befo
7198
7158
  function createTextNode(renderer, value) {
7199
7159
  ngDevMode && ngDevMode.rendererCreateTextNode++;
7200
7160
  ngDevMode && ngDevMode.rendererSetText++;
7201
- return isProceduralRenderer(renderer) ? renderer.createText(value) :
7202
- renderer.createTextNode(value);
7161
+ return renderer.createText(value);
7203
7162
  }
7204
7163
  function updateTextNode(renderer, rNode, value) {
7205
7164
  ngDevMode && ngDevMode.rendererSetText++;
7206
- isProceduralRenderer(renderer) ? renderer.setValue(rNode, value) : rNode.textContent = value;
7165
+ renderer.setValue(rNode, value);
7207
7166
  }
7208
7167
  function createCommentNode(renderer, value) {
7209
7168
  ngDevMode && ngDevMode.rendererCreateComment++;
7210
- // isProceduralRenderer check is not needed because both `Renderer2` and `Renderer3` have the same
7211
- // method name.
7212
7169
  return renderer.createComment(escapeCommentText(value));
7213
7170
  }
7214
7171
  /**
@@ -7220,14 +7177,7 @@ function createCommentNode(renderer, value) {
7220
7177
  */
7221
7178
  function createElementNode(renderer, name, namespace) {
7222
7179
  ngDevMode && ngDevMode.rendererCreateElement++;
7223
- if (isProceduralRenderer(renderer)) {
7224
- return renderer.createElement(name, namespace);
7225
- }
7226
- else {
7227
- const namespaceUri = namespace !== null ? getNamespaceUri(namespace) : null;
7228
- return namespaceUri === null ? renderer.createElement(name) :
7229
- renderer.createElementNS(namespaceUri, name);
7230
- }
7180
+ return renderer.createElement(name, namespace);
7231
7181
  }
7232
7182
  /**
7233
7183
  * Removes all DOM elements associated with a view.
@@ -7459,7 +7409,7 @@ function detachView(lContainer, removeIndex) {
7459
7409
  function destroyLView(tView, lView) {
7460
7410
  if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7461
7411
  const renderer = lView[RENDERER];
7462
- if (isProceduralRenderer(renderer) && renderer.destroyNode) {
7412
+ if (renderer.destroyNode) {
7463
7413
  applyView(tView, lView, renderer, 3 /* WalkTNodeTreeAction.Destroy */, null, null);
7464
7414
  }
7465
7415
  destroyViewTree(lView);
@@ -7487,7 +7437,7 @@ function cleanUpView(tView, lView) {
7487
7437
  executeOnDestroys(tView, lView);
7488
7438
  processCleanups(tView, lView);
7489
7439
  // For component views only, the local renderer is destroyed at clean up time.
7490
- if (lView[TVIEW].type === 1 /* TViewType.Component */ && isProceduralRenderer(lView[RENDERER])) {
7440
+ if (lView[TVIEW].type === 1 /* TViewType.Component */) {
7491
7441
  ngDevMode && ngDevMode.rendererDestroy++;
7492
7442
  lView[RENDERER].destroy();
7493
7443
  }
@@ -7663,30 +7613,17 @@ function getClosestRElement(tView, tNode, lView) {
7663
7613
  }
7664
7614
  }
7665
7615
  /**
7666
- * Inserts a native node before another native node for a given parent using {@link Renderer3}.
7667
- * This is a utility function that can be used when native nodes were determined - it abstracts an
7668
- * actual renderer being used.
7616
+ * Inserts a native node before another native node for a given parent.
7617
+ * This is a utility function that can be used when native nodes were determined.
7669
7618
  */
7670
7619
  function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
7671
7620
  ngDevMode && ngDevMode.rendererInsertBefore++;
7672
- if (isProceduralRenderer(renderer)) {
7673
- renderer.insertBefore(parent, child, beforeNode, isMove);
7674
- }
7675
- else {
7676
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7677
- targetParent.insertBefore(child, beforeNode, isMove);
7678
- }
7621
+ renderer.insertBefore(parent, child, beforeNode, isMove);
7679
7622
  }
7680
7623
  function nativeAppendChild(renderer, parent, child) {
7681
7624
  ngDevMode && ngDevMode.rendererAppendChild++;
7682
7625
  ngDevMode && assertDefined(parent, 'parent node must be defined');
7683
- if (isProceduralRenderer(renderer)) {
7684
- renderer.appendChild(parent, child);
7685
- }
7686
- else {
7687
- const targetParent = isTemplateNode(parent) ? parent.content : parent;
7688
- targetParent.appendChild(child);
7689
- }
7626
+ renderer.appendChild(parent, child);
7690
7627
  }
7691
7628
  function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
7692
7629
  if (beforeNode !== null) {
@@ -7698,12 +7635,7 @@ function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove)
7698
7635
  }
7699
7636
  /** Removes a node from the DOM given its native parent. */
7700
7637
  function nativeRemoveChild(renderer, parent, child, isHostElement) {
7701
- if (isProceduralRenderer(renderer)) {
7702
- renderer.removeChild(parent, child, isHostElement);
7703
- }
7704
- else {
7705
- parent.removeChild(child);
7706
- }
7638
+ renderer.removeChild(parent, child, isHostElement);
7707
7639
  }
7708
7640
  /** Checks if an element is a `<template>` node. */
7709
7641
  function isTemplateNode(node) {
@@ -7713,13 +7645,13 @@ function isTemplateNode(node) {
7713
7645
  * Returns a native parent of a given native node.
7714
7646
  */
7715
7647
  function nativeParentNode(renderer, node) {
7716
- return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode);
7648
+ return renderer.parentNode(node);
7717
7649
  }
7718
7650
  /**
7719
7651
  * Returns a native sibling of a given native node.
7720
7652
  */
7721
7653
  function nativeNextSibling(renderer, node) {
7722
- return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
7654
+ return renderer.nextSibling(node);
7723
7655
  }
7724
7656
  /**
7725
7657
  * Find a node in front of which `currentTNode` should be inserted.
@@ -8028,39 +7960,22 @@ function applyContainer(renderer, action, lContainer, parentRElement, beforeNode
8028
7960
  * otherwise).
8029
7961
  */
8030
7962
  function applyStyling(renderer, isClassBased, rNode, prop, value) {
8031
- const isProcedural = isProceduralRenderer(renderer);
8032
7963
  if (isClassBased) {
8033
7964
  // We actually want JS true/false here because any truthy value should add the class
8034
7965
  if (!value) {
8035
7966
  ngDevMode && ngDevMode.rendererRemoveClass++;
8036
- if (isProcedural) {
8037
- renderer.removeClass(rNode, prop);
8038
- }
8039
- else {
8040
- rNode.classList.remove(prop);
8041
- }
7967
+ renderer.removeClass(rNode, prop);
8042
7968
  }
8043
7969
  else {
8044
7970
  ngDevMode && ngDevMode.rendererAddClass++;
8045
- if (isProcedural) {
8046
- renderer.addClass(rNode, prop);
8047
- }
8048
- else {
8049
- ngDevMode && assertDefined(rNode.classList, 'HTMLElement expected');
8050
- rNode.classList.add(prop);
8051
- }
7971
+ renderer.addClass(rNode, prop);
8052
7972
  }
8053
7973
  }
8054
7974
  else {
8055
7975
  let flags = prop.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase;
8056
7976
  if (value == null /** || value === undefined */) {
8057
7977
  ngDevMode && ngDevMode.rendererRemoveStyle++;
8058
- if (isProcedural) {
8059
- renderer.removeStyle(rNode, prop, flags);
8060
- }
8061
- else {
8062
- rNode.style.removeProperty(prop);
8063
- }
7978
+ renderer.removeStyle(rNode, prop, flags);
8064
7979
  }
8065
7980
  else {
8066
7981
  // A value is important if it ends with `!important`. The style
@@ -8072,13 +7987,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8072
7987
  flags |= RendererStyleFlags2.Important;
8073
7988
  }
8074
7989
  ngDevMode && ngDevMode.rendererSetStyle++;
8075
- if (isProcedural) {
8076
- renderer.setStyle(rNode, prop, value, flags);
8077
- }
8078
- else {
8079
- ngDevMode && assertDefined(rNode.style, 'HTMLElement expected');
8080
- rNode.style.setProperty(prop, value, isImportant ? 'important' : '');
8081
- }
7990
+ renderer.setStyle(rNode, prop, value, flags);
8082
7991
  }
8083
7992
  }
8084
7993
  }
@@ -8094,12 +8003,7 @@ function applyStyling(renderer, isClassBased, rNode, prop, value) {
8094
8003
  */
8095
8004
  function writeDirectStyle(renderer, element, newValue) {
8096
8005
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8097
- if (isProceduralRenderer(renderer)) {
8098
- renderer.setAttribute(element, 'style', newValue);
8099
- }
8100
- else {
8101
- element.style.cssText = newValue;
8102
- }
8006
+ renderer.setAttribute(element, 'style', newValue);
8103
8007
  ngDevMode && ngDevMode.rendererSetStyle++;
8104
8008
  }
8105
8009
  /**
@@ -8114,17 +8018,12 @@ function writeDirectStyle(renderer, element, newValue) {
8114
8018
  */
8115
8019
  function writeDirectClass(renderer, element, newValue) {
8116
8020
  ngDevMode && assertString(newValue, '\'newValue\' should be a string');
8117
- if (isProceduralRenderer(renderer)) {
8118
- if (newValue === '') {
8119
- // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8120
- renderer.removeAttribute(element, 'class');
8121
- }
8122
- else {
8123
- renderer.setAttribute(element, 'class', newValue);
8124
- }
8021
+ if (newValue === '') {
8022
+ // There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
8023
+ renderer.removeAttribute(element, 'class');
8125
8024
  }
8126
8025
  else {
8127
- element.className = newValue;
8026
+ renderer.setAttribute(element, 'class', newValue);
8128
8027
  }
8129
8028
  ngDevMode && ngDevMode.rendererSetClassName++;
8130
8029
  }
@@ -8174,7 +8073,7 @@ function classIndexOf(className, classToSearch, startingIndex) {
8174
8073
  * Use of this source code is governed by an MIT-style license that can be
8175
8074
  * found in the LICENSE file at https://angular.io/license
8176
8075
  */
8177
- const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3;
8076
+ const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4;
8178
8077
  const NG_TEMPLATE_SELECTOR = 'ng-template';
8179
8078
  /**
8180
8079
  * Search the `TAttributes` to see if it contains `cssClassToMatch` (case insensitive)
@@ -9814,7 +9713,7 @@ class ReflectiveKey {
9814
9713
  this.token = token;
9815
9714
  this.id = id;
9816
9715
  if (!token) {
9817
- throw new Error('Token must be defined!');
9716
+ throw new RuntimeError(208 /* RuntimeErrorCode.MISSING_INJECTION_TOKEN */, ngDevMode && 'Token must be defined!');
9818
9717
  }
9819
9718
  this.displayName = stringify(this.token);
9820
9719
  }
@@ -11505,6 +11404,13 @@ class LContainerDebug {
11505
11404
  }
11506
11405
  }
11507
11406
 
11407
+ /**
11408
+ * @license
11409
+ * Copyright Google LLC All Rights Reserved.
11410
+ *
11411
+ * Use of this source code is governed by an MIT-style license that can be
11412
+ * found in the LICENSE file at https://angular.io/license
11413
+ */
11508
11414
  /**
11509
11415
  * A permanent marker promise which signifies that the current CD tree is
11510
11416
  * clean.
@@ -11572,7 +11478,7 @@ function refreshChildComponents(hostLView, components) {
11572
11478
  /** Renders child components in the current view (creation mode). */
11573
11479
  function renderChildComponents(hostLView, components) {
11574
11480
  for (let i = 0; i < components.length; i++) {
11575
- renderComponent$1(hostLView, components[i]);
11481
+ renderComponent(hostLView, components[i]);
11576
11482
  }
11577
11483
  }
11578
11484
  function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
@@ -12090,16 +11996,6 @@ function createViewBlueprint(bindingStartIndex, initialViewLength) {
12090
11996
  function createError(text, token) {
12091
11997
  return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
12092
11998
  }
12093
- function assertHostNodeExists(rElement, elementOrSelector) {
12094
- if (!rElement) {
12095
- if (typeof elementOrSelector === 'string') {
12096
- throw createError('Host node with selector not found:', elementOrSelector);
12097
- }
12098
- else {
12099
- throw createError('Host node is required:', elementOrSelector);
12100
- }
12101
- }
12102
- }
12103
11999
  /**
12104
12000
  * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
12105
12001
  *
@@ -12108,21 +12004,9 @@ function assertHostNodeExists(rElement, elementOrSelector) {
12108
12004
  * @param encapsulation View Encapsulation defined for component that requests host element.
12109
12005
  */
12110
12006
  function locateHostElement(renderer, elementOrSelector, encapsulation) {
12111
- if (isProceduralRenderer(renderer)) {
12112
- // When using native Shadow DOM, do not clear host element to allow native slot projection
12113
- const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12114
- return renderer.selectRootElement(elementOrSelector, preserveContent);
12115
- }
12116
- let rElement = typeof elementOrSelector === 'string' ?
12117
- renderer.querySelector(elementOrSelector) :
12118
- elementOrSelector;
12119
- ngDevMode && assertHostNodeExists(rElement, elementOrSelector);
12120
- // Always clear host element's content when Renderer3 is in use. For procedural renderer case we
12121
- // make it depend on whether ShadowDom encapsulation is used (in which case the content should be
12122
- // preserved to allow native slot projection). ShadowDom encapsulation requires procedural
12123
- // renderer, and procedural renderer case is handled above.
12124
- rElement.textContent = '';
12125
- return rElement;
12007
+ // When using native Shadow DOM, do not clear host element to allow native slot projection
12008
+ const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
12009
+ return renderer.selectRootElement(elementOrSelector, preserveContent);
12126
12010
  }
12127
12011
  /**
12128
12012
  * Saves context for this cleanup function in LView.cleanupInstances.
@@ -12337,13 +12221,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12337
12221
  // It is assumed that the sanitizer is only added when the compiler determines that the
12338
12222
  // property is risky, so sanitization can be done without further checks.
12339
12223
  value = sanitizer != null ? sanitizer(value, tNode.value || '', propName) : value;
12340
- if (isProceduralRenderer(renderer)) {
12341
- renderer.setProperty(element, propName, value);
12342
- }
12343
- else if (!isAnimationProp(propName)) {
12344
- element.setProperty ? element.setProperty(propName, value) :
12345
- element[propName] = value;
12346
- }
12224
+ renderer.setProperty(element, propName, value);
12347
12225
  }
12348
12226
  else if (tNode.type & 12 /* TNodeType.AnyContainer */) {
12349
12227
  // If the node is a container and the property didn't
@@ -12367,23 +12245,15 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
12367
12245
  const debugValue = normalizeDebugBindingValue(value);
12368
12246
  if (type & 3 /* TNodeType.AnyRNode */) {
12369
12247
  if (value == null) {
12370
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, attrName) :
12371
- element.removeAttribute(attrName);
12248
+ renderer.removeAttribute(element, attrName);
12372
12249
  }
12373
12250
  else {
12374
- isProceduralRenderer(renderer) ?
12375
- renderer.setAttribute(element, attrName, debugValue) :
12376
- element.setAttribute(attrName, debugValue);
12251
+ renderer.setAttribute(element, attrName, debugValue);
12377
12252
  }
12378
12253
  }
12379
12254
  else {
12380
12255
  const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
12381
- if (isProceduralRenderer(renderer)) {
12382
- renderer.setValue(element, textContent);
12383
- }
12384
- else {
12385
- element.textContent = textContent;
12386
- }
12256
+ renderer.setValue(element, textContent);
12387
12257
  }
12388
12258
  }
12389
12259
  function setNgReflectProperties(lView, element, type, dataValue, value) {
@@ -12737,19 +12607,12 @@ function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespac
12737
12607
  function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) {
12738
12608
  if (value == null) {
12739
12609
  ngDevMode && ngDevMode.rendererRemoveAttribute++;
12740
- isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) :
12741
- element.removeAttribute(name);
12610
+ renderer.removeAttribute(element, name, namespace);
12742
12611
  }
12743
12612
  else {
12744
12613
  ngDevMode && ngDevMode.rendererSetAttribute++;
12745
12614
  const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || '', name);
12746
- if (isProceduralRenderer(renderer)) {
12747
- renderer.setAttribute(element, name, strValue, namespace);
12748
- }
12749
- else {
12750
- namespace ? element.setAttributeNS(namespace, name, strValue) :
12751
- element.setAttribute(name, strValue);
12752
- }
12615
+ renderer.setAttribute(element, name, strValue, namespace);
12753
12616
  }
12754
12617
  }
12755
12618
  /**
@@ -12841,7 +12704,6 @@ const LContainerArray = class LContainer extends Array {
12841
12704
  */
12842
12705
  function createLContainer(hostNative, currentView, native, tNode) {
12843
12706
  ngDevMode && assertLView(currentView);
12844
- ngDevMode && !isProceduralRenderer(currentView[RENDERER]) && assertDomNode(native);
12845
12707
  // https://jsperf.com/array-literal-vs-new-array-really
12846
12708
  const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative, // host native
12847
12709
  true, // Boolean `true` in this position signifies that this is an `LContainer`
@@ -12957,7 +12819,7 @@ function refreshContainsDirtyView(lView) {
12957
12819
  }
12958
12820
  }
12959
12821
  }
12960
- function renderComponent$1(hostLView, componentHostIdx) {
12822
+ function renderComponent(hostLView, componentHostIdx) {
12961
12823
  ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
12962
12824
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
12963
12825
  const componentTView = componentView[TVIEW];
@@ -13309,48 +13171,135 @@ function computeStaticStyling(tNode, attrs, writeToHost) {
13309
13171
  * Use of this source code is governed by an MIT-style license that can be
13310
13172
  * found in the LICENSE file at https://angular.io/license
13311
13173
  */
13174
+ // TODO: A hack to not pull in the NullInjector from @angular/core.
13175
+ const NULL_INJECTOR = {
13176
+ get: (token, notFoundValue) => {
13177
+ throwProviderNotFoundError(token, 'NullInjector');
13178
+ }
13179
+ };
13312
13180
  /**
13313
- * Synchronously perform change detection on a component (and possibly its sub-components).
13181
+ * Creates the root component view and the root component node.
13314
13182
  *
13315
- * This function triggers change detection in a synchronous way on a component.
13183
+ * @param rNode Render host element.
13184
+ * @param def ComponentDef
13185
+ * @param rootView The parent view where the host node is stored
13186
+ * @param rendererFactory Factory to be used for creating child renderers.
13187
+ * @param hostRenderer The current renderer
13188
+ * @param sanitizer The sanitizer, if provided
13316
13189
  *
13317
- * @param component The component which the change detection should be performed on.
13190
+ * @returns Component view created
13318
13191
  */
13319
- function detectChanges(component) {
13320
- const view = getComponentViewByInstance(component);
13321
- detectChangesInternal(view[TVIEW], view, component);
13192
+ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13193
+ const tView = rootView[TVIEW];
13194
+ const index = HEADER_OFFSET;
13195
+ ngDevMode && assertIndexInRange(rootView, index);
13196
+ rootView[index] = rNode;
13197
+ // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13198
+ // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13199
+ // representing a host element.
13200
+ const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13201
+ const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13202
+ if (mergedAttrs !== null) {
13203
+ computeStaticStyling(tNode, mergedAttrs, true);
13204
+ if (rNode !== null) {
13205
+ setUpAttributes(hostRenderer, rNode, mergedAttrs);
13206
+ if (tNode.classes !== null) {
13207
+ writeDirectClass(hostRenderer, rNode, tNode.classes);
13208
+ }
13209
+ if (tNode.styles !== null) {
13210
+ writeDirectStyle(hostRenderer, rNode, tNode.styles);
13211
+ }
13212
+ }
13213
+ }
13214
+ const viewRenderer = rendererFactory.createRenderer(rNode, def);
13215
+ const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13216
+ if (tView.firstCreatePass) {
13217
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13218
+ markAsComponentHost(tView, tNode);
13219
+ initTNodeFlags(tNode, rootView.length, 1);
13220
+ }
13221
+ addToViewTree(rootView, componentView);
13222
+ // Store component view at node index, with node as the HOST
13223
+ return rootView[index] = componentView;
13322
13224
  }
13323
13225
  /**
13324
- * Marks the component as dirty (needing change detection). Marking a component dirty will
13325
- * schedule a change detection on it at some point in the future.
13326
- *
13327
- * Marking an already dirty component as dirty won't do anything. Only one outstanding change
13328
- * detection can be scheduled per component tree.
13329
- *
13330
- * @param component Component to mark as dirty.
13226
+ * Creates a root component and sets it up with features and host bindings. Shared by
13227
+ * renderComponent() and ViewContainerRef.createComponent().
13331
13228
  */
13332
- function markDirty(component) {
13333
- ngDevMode && assertDefined(component, 'component');
13334
- const rootView = markViewDirty(getComponentViewByInstance(component));
13335
- ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
13336
- scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
13229
+ function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13230
+ const tView = rootLView[TVIEW];
13231
+ // Create directive instance with factory() and store at next index in viewData
13232
+ const component = instantiateRootComponent(tView, rootLView, componentDef);
13233
+ rootContext.components.push(component);
13234
+ componentView[CONTEXT] = component;
13235
+ if (hostFeatures !== null) {
13236
+ for (const feature of hostFeatures) {
13237
+ feature(component, componentDef);
13238
+ }
13239
+ }
13240
+ // We want to generate an empty QueryList for root content queries for backwards
13241
+ // compatibility with ViewEngine.
13242
+ if (componentDef.contentQueries) {
13243
+ const tNode = getCurrentTNode();
13244
+ ngDevMode && assertDefined(tNode, 'TNode expected');
13245
+ componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13246
+ }
13247
+ const rootTNode = getCurrentTNode();
13248
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13249
+ if (tView.firstCreatePass &&
13250
+ (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13251
+ setSelectedIndex(rootTNode.index);
13252
+ const rootTView = rootLView[TVIEW];
13253
+ registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13254
+ invokeHostBindingsInCreationMode(componentDef, component);
13255
+ }
13256
+ return component;
13257
+ }
13258
+ function createRootContext(scheduler, playerHandler) {
13259
+ return {
13260
+ components: [],
13261
+ scheduler: scheduler || defaultScheduler,
13262
+ clean: CLEAN_PROMISE,
13263
+ playerHandler: playerHandler || null,
13264
+ flags: 0 /* RootContextFlags.Empty */
13265
+ };
13337
13266
  }
13338
13267
  /**
13339
- * Used to perform change detection on the whole application.
13268
+ * Used to enable lifecycle hooks on the root component.
13340
13269
  *
13341
- * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick`
13342
- * executes lifecycle hooks and conditionally checks components based on their
13343
- * `ChangeDetectionStrategy` and dirtiness.
13270
+ * Include this feature when calling `renderComponent` if the root component
13271
+ * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
13272
+ * be called properly.
13344
13273
  *
13345
- * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally
13346
- * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a
13347
- * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can
13348
- * be changed when calling `renderComponent` and providing the `scheduler` option.
13274
+ * Example:
13275
+ *
13276
+ * ```
13277
+ * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13278
+ * ```
13349
13279
  */
13350
- function tick(component) {
13351
- const rootView = getRootView(component);
13352
- const rootContext = rootView[CONTEXT];
13353
- tickRootContext(rootContext);
13280
+ function LifecycleHooksFeature() {
13281
+ const tNode = getCurrentTNode();
13282
+ ngDevMode && assertDefined(tNode, 'TNode is required');
13283
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13284
+ }
13285
+ /**
13286
+ * Wait on component until it is rendered.
13287
+ *
13288
+ * This function returns a `Promise` which is resolved when the component's
13289
+ * change detection is executed. This is determined by finding the scheduler
13290
+ * associated with the `component`'s render tree and waiting until the scheduler
13291
+ * flushes. If nothing is scheduled, the function returns a resolved promise.
13292
+ *
13293
+ * Example:
13294
+ * ```
13295
+ * await whenRendered(myComponent);
13296
+ * ```
13297
+ *
13298
+ * @param component Component to wait upon
13299
+ * @returns Promise which resolves when the component is rendered.
13300
+ */
13301
+ function whenRendered(component) {
13302
+ return getRootContext(component).clean;
13354
13303
  }
13355
13304
 
13356
13305
  /**
@@ -13360,407 +13309,312 @@ function tick(component) {
13360
13309
  * Use of this source code is governed by an MIT-style license that can be
13361
13310
  * found in the LICENSE file at https://angular.io/license
13362
13311
  */
13312
+ function getSuperType(type) {
13313
+ return Object.getPrototypeOf(type.prototype).constructor;
13314
+ }
13363
13315
  /**
13364
- * Retrieves the component instance associated with a given DOM element.
13365
- *
13366
- * @usageNotes
13367
- * Given the following DOM structure:
13368
- *
13369
- * ```html
13370
- * <app-root>
13371
- * <div>
13372
- * <child-comp></child-comp>
13373
- * </div>
13374
- * </app-root>
13375
- * ```
13376
- *
13377
- * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
13378
- * associated with this DOM element.
13379
- *
13380
- * Calling the function on `<app-root>` will return the `MyApp` instance.
13381
- *
13382
- *
13383
- * @param element DOM element from which the component should be retrieved.
13384
- * @returns Component instance associated with the element or `null` if there
13385
- * is no component associated with it.
13316
+ * Merges the definition from a super class to a sub class.
13317
+ * @param definition The definition that is a SubClass of another directive of component
13386
13318
  *
13387
- * @publicApi
13388
- * @globalApi ng
13319
+ * @codeGenApi
13389
13320
  */
13390
- function getComponent$1(element) {
13391
- ngDevMode && assertDomElement(element);
13392
- const context = getLContext(element);
13393
- if (context === null)
13394
- return null;
13395
- if (context.component === undefined) {
13396
- const lView = context.lView;
13397
- if (lView === null) {
13398
- return null;
13321
+ function ɵɵInheritDefinitionFeature(definition) {
13322
+ let superType = getSuperType(definition.type);
13323
+ let shouldInheritFields = true;
13324
+ const inheritanceChain = [definition];
13325
+ while (superType) {
13326
+ let superDef = undefined;
13327
+ if (isComponentDef(definition)) {
13328
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13329
+ superDef = superType.ɵcmp || superType.ɵdir;
13399
13330
  }
13400
- context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
13331
+ else {
13332
+ if (superType.ɵcmp) {
13333
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
13334
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
13335
+ }
13336
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13337
+ superDef = superType.ɵdir;
13338
+ }
13339
+ if (superDef) {
13340
+ if (shouldInheritFields) {
13341
+ inheritanceChain.push(superDef);
13342
+ // Some fields in the definition may be empty, if there were no values to put in them that
13343
+ // would've justified object creation. Unwrap them if necessary.
13344
+ const writeableDef = definition;
13345
+ writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
13346
+ writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
13347
+ writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
13348
+ // Merge hostBindings
13349
+ const superHostBindings = superDef.hostBindings;
13350
+ superHostBindings && inheritHostBindings(definition, superHostBindings);
13351
+ // Merge queries
13352
+ const superViewQuery = superDef.viewQuery;
13353
+ const superContentQueries = superDef.contentQueries;
13354
+ superViewQuery && inheritViewQuery(definition, superViewQuery);
13355
+ superContentQueries && inheritContentQueries(definition, superContentQueries);
13356
+ // Merge inputs and outputs
13357
+ fillProperties(definition.inputs, superDef.inputs);
13358
+ fillProperties(definition.declaredInputs, superDef.declaredInputs);
13359
+ fillProperties(definition.outputs, superDef.outputs);
13360
+ // Merge animations metadata.
13361
+ // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
13362
+ if (isComponentDef(superDef) && superDef.data.animation) {
13363
+ // If super def is a Component, the `definition` is also a Component, since Directives can
13364
+ // not inherit Components (we throw an error above and cannot reach this code).
13365
+ const defData = definition.data;
13366
+ defData.animation = (defData.animation || []).concat(superDef.data.animation);
13367
+ }
13368
+ }
13369
+ // Run parent features
13370
+ const features = superDef.features;
13371
+ if (features) {
13372
+ for (let i = 0; i < features.length; i++) {
13373
+ const feature = features[i];
13374
+ if (feature && feature.ngInherit) {
13375
+ feature(definition);
13376
+ }
13377
+ // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
13378
+ // def already has all the necessary information inherited from its super class(es), so we
13379
+ // can stop merging fields from super classes. However we need to iterate through the
13380
+ // prototype chain to look for classes that might contain other "features" (like
13381
+ // NgOnChanges), which we should invoke for the original `definition`. We set the
13382
+ // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
13383
+ // logic and only invoking functions from the "features" list.
13384
+ if (feature === ɵɵInheritDefinitionFeature) {
13385
+ shouldInheritFields = false;
13386
+ }
13387
+ }
13388
+ }
13389
+ }
13390
+ superType = Object.getPrototypeOf(superType);
13401
13391
  }
13402
- return context.component;
13392
+ mergeHostAttrsAcrossInheritance(inheritanceChain);
13403
13393
  }
13404
13394
  /**
13405
- * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
13406
- * view that the element is part of. Otherwise retrieves the instance of the component whose view
13407
- * owns the element (in this case, the result is the same as calling `getOwningComponent`).
13408
- *
13409
- * @param element Element for which to get the surrounding component instance.
13410
- * @returns Instance of the component that is around the element or null if the element isn't
13411
- * inside any component.
13395
+ * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
13412
13396
  *
13413
- * @publicApi
13414
- * @globalApi ng
13397
+ * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
13398
+ * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
13399
+ * type.
13415
13400
  */
13416
- function getContext(element) {
13417
- assertDomElement(element);
13418
- const context = getLContext(element);
13419
- const lView = context ? context.lView : null;
13420
- return lView === null ? null : lView[CONTEXT];
13401
+ function mergeHostAttrsAcrossInheritance(inheritanceChain) {
13402
+ let hostVars = 0;
13403
+ let hostAttrs = null;
13404
+ // We process the inheritance order from the base to the leaves here.
13405
+ for (let i = inheritanceChain.length - 1; i >= 0; i--) {
13406
+ const def = inheritanceChain[i];
13407
+ // For each `hostVars`, we need to add the superclass amount.
13408
+ def.hostVars = (hostVars += def.hostVars);
13409
+ // for each `hostAttrs` we need to merge it with superclass.
13410
+ def.hostAttrs =
13411
+ mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
13412
+ }
13421
13413
  }
13422
- /**
13423
- * Retrieves the component instance whose view contains the DOM element.
13424
- *
13425
- * For example, if `<child-comp>` is used in the template of `<app-comp>`
13426
- * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
13427
- * would return `<app-comp>`.
13428
- *
13429
- * @param elementOrDir DOM element, component or directive instance
13430
- * for which to retrieve the root components.
13431
- * @returns Component instance whose view owns the DOM element or null if the element is not
13432
- * part of a component view.
13433
- *
13434
- * @publicApi
13435
- * @globalApi ng
13436
- */
13437
- function getOwningComponent(elementOrDir) {
13438
- const context = getLContext(elementOrDir);
13439
- let lView = context ? context.lView : null;
13440
- if (lView === null)
13441
- return null;
13442
- let parent;
13443
- while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
13444
- lView = parent;
13414
+ function maybeUnwrapEmpty(value) {
13415
+ if (value === EMPTY_OBJ) {
13416
+ return {};
13417
+ }
13418
+ else if (value === EMPTY_ARRAY) {
13419
+ return [];
13420
+ }
13421
+ else {
13422
+ return value;
13445
13423
  }
13446
- return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
13447
13424
  }
13425
+ function inheritViewQuery(definition, superViewQuery) {
13426
+ const prevViewQuery = definition.viewQuery;
13427
+ if (prevViewQuery) {
13428
+ definition.viewQuery = (rf, ctx) => {
13429
+ superViewQuery(rf, ctx);
13430
+ prevViewQuery(rf, ctx);
13431
+ };
13432
+ }
13433
+ else {
13434
+ definition.viewQuery = superViewQuery;
13435
+ }
13436
+ }
13437
+ function inheritContentQueries(definition, superContentQueries) {
13438
+ const prevContentQueries = definition.contentQueries;
13439
+ if (prevContentQueries) {
13440
+ definition.contentQueries = (rf, ctx, directiveIndex) => {
13441
+ superContentQueries(rf, ctx, directiveIndex);
13442
+ prevContentQueries(rf, ctx, directiveIndex);
13443
+ };
13444
+ }
13445
+ else {
13446
+ definition.contentQueries = superContentQueries;
13447
+ }
13448
+ }
13449
+ function inheritHostBindings(definition, superHostBindings) {
13450
+ const prevHostBindings = definition.hostBindings;
13451
+ if (prevHostBindings) {
13452
+ definition.hostBindings = (rf, ctx) => {
13453
+ superHostBindings(rf, ctx);
13454
+ prevHostBindings(rf, ctx);
13455
+ };
13456
+ }
13457
+ else {
13458
+ definition.hostBindings = superHostBindings;
13459
+ }
13460
+ }
13461
+
13448
13462
  /**
13449
- * Retrieves all root components associated with a DOM element, directive or component instance.
13450
- * Root components are those which have been bootstrapped by Angular.
13451
- *
13452
- * @param elementOrDir DOM element, component or directive instance
13453
- * for which to retrieve the root components.
13454
- * @returns Root components associated with the target object.
13463
+ * @license
13464
+ * Copyright Google LLC All Rights Reserved.
13455
13465
  *
13456
- * @publicApi
13457
- * @globalApi ng
13466
+ * Use of this source code is governed by an MIT-style license that can be
13467
+ * found in the LICENSE file at https://angular.io/license
13458
13468
  */
13459
- function getRootComponents(elementOrDir) {
13460
- const lView = readPatchedLView(elementOrDir);
13461
- return lView !== null ? [...getRootContext(lView).components] : [];
13462
- }
13463
13469
  /**
13464
- * Retrieves an `Injector` associated with an element, component or directive instance.
13465
- *
13466
- * @param elementOrDir DOM element, component or directive instance for which to
13467
- * retrieve the injector.
13468
- * @returns Injector associated with the element, component or directive instance.
13469
- *
13470
- * @publicApi
13471
- * @globalApi ng
13470
+ * Fields which exist on either directive or component definitions, and need to be copied from
13471
+ * parent to child classes by the `ɵɵCopyDefinitionFeature`.
13472
13472
  */
13473
- function getInjector(elementOrDir) {
13474
- const context = getLContext(elementOrDir);
13475
- const lView = context ? context.lView : null;
13476
- if (lView === null)
13477
- return Injector.NULL;
13478
- const tNode = lView[TVIEW].data[context.nodeIndex];
13479
- return new NodeInjector(tNode, lView);
13480
- }
13473
+ const COPY_DIRECTIVE_FIELDS = [
13474
+ // The child class should use the providers of its parent.
13475
+ 'providersResolver',
13476
+ // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
13477
+ // as inputs, outputs, and host binding functions.
13478
+ ];
13481
13479
  /**
13482
- * Retrieve a set of injection tokens at a given DOM node.
13480
+ * Fields which exist only on component definitions, and need to be copied from parent to child
13481
+ * classes by the `ɵɵCopyDefinitionFeature`.
13483
13482
  *
13484
- * @param element Element for which the injection tokens should be retrieved.
13483
+ * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
13484
+ * since those should go in `COPY_DIRECTIVE_FIELDS` above.
13485
13485
  */
13486
- function getInjectionTokens(element) {
13487
- const context = getLContext(element);
13488
- const lView = context ? context.lView : null;
13489
- if (lView === null)
13490
- return [];
13491
- const tView = lView[TVIEW];
13492
- const tNode = tView.data[context.nodeIndex];
13493
- const providerTokens = [];
13494
- const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
13495
- const endIndex = tNode.directiveEnd;
13496
- for (let i = startIndex; i < endIndex; i++) {
13497
- let value = tView.data[i];
13498
- if (isDirectiveDefHack(value)) {
13499
- // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
13500
- // design flaw. We should always store same type so that we can be monomorphic. The issue
13501
- // is that for Components/Directives we store the def instead the type. The correct behavior
13502
- // is that we should always be storing injectable type in this location.
13503
- value = value.type;
13504
- }
13505
- providerTokens.push(value);
13506
- }
13507
- return providerTokens;
13508
- }
13486
+ const COPY_COMPONENT_FIELDS = [
13487
+ // The child class should use the template function of its parent, including all template
13488
+ // semantics.
13489
+ 'template',
13490
+ 'decls',
13491
+ 'consts',
13492
+ 'vars',
13493
+ 'onPush',
13494
+ 'ngContentSelectors',
13495
+ // The child class should use the CSS styles of its parent, including all styling semantics.
13496
+ 'styles',
13497
+ 'encapsulation',
13498
+ // The child class should be checked by the runtime in the same way as its parent.
13499
+ 'schemas',
13500
+ ];
13509
13501
  /**
13510
- * Retrieves directive instances associated with a given DOM node. Does not include
13511
- * component instances.
13512
- *
13513
- * @usageNotes
13514
- * Given the following DOM structure:
13515
- *
13516
- * ```html
13517
- * <app-root>
13518
- * <button my-button></button>
13519
- * <my-comp></my-comp>
13520
- * </app-root>
13521
- * ```
13502
+ * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
13503
+ * definition.
13522
13504
  *
13523
- * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
13524
- * directive that is associated with the DOM node.
13505
+ * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
13506
+ * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
13507
+ * generates a skeleton definition on the child class, and applies this feature.
13525
13508
  *
13526
- * Calling `getDirectives` on `<my-comp>` will return an empty array.
13509
+ * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
13510
+ * including things like the component template function.
13527
13511
  *
13528
- * @param node DOM node for which to get the directives.
13529
- * @returns Array of directives associated with the node.
13512
+ * @param definition The definition of a child class which inherits from a parent class with its
13513
+ * own definition.
13530
13514
  *
13531
- * @publicApi
13532
- * @globalApi ng
13515
+ * @codeGenApi
13533
13516
  */
13534
- function getDirectives(node) {
13535
- // Skip text nodes because we can't have directives associated with them.
13536
- if (node instanceof Text) {
13537
- return [];
13517
+ function ɵɵCopyDefinitionFeature(definition) {
13518
+ let superType = getSuperType(definition.type);
13519
+ let superDef = undefined;
13520
+ if (isComponentDef(definition)) {
13521
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13522
+ superDef = superType.ɵcmp;
13538
13523
  }
13539
- const context = getLContext(node);
13540
- const lView = context ? context.lView : null;
13541
- if (lView === null) {
13542
- return [];
13524
+ else {
13525
+ // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
13526
+ superDef = superType.ɵdir;
13543
13527
  }
13544
- const tView = lView[TVIEW];
13545
- const nodeIndex = context.nodeIndex;
13546
- if (!(tView === null || tView === void 0 ? void 0 : tView.data[nodeIndex])) {
13547
- return [];
13528
+ // Needed because `definition` fields are readonly.
13529
+ const defAny = definition;
13530
+ // Copy over any fields that apply to either directives or components.
13531
+ for (const field of COPY_DIRECTIVE_FIELDS) {
13532
+ defAny[field] = superDef[field];
13548
13533
  }
13549
- if (context.directives === undefined) {
13550
- context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
13534
+ if (isComponentDef(superDef)) {
13535
+ // Copy over any component-specific fields.
13536
+ for (const field of COPY_COMPONENT_FIELDS) {
13537
+ defAny[field] = superDef[field];
13538
+ }
13551
13539
  }
13552
- // The `directives` in this case are a named array called `LComponentView`. Clone the
13553
- // result so we don't expose an internal data structure in the user's console.
13554
- return context.directives === null ? [] : [...context.directives];
13555
13540
  }
13541
+
13556
13542
  /**
13557
- * Returns the debug (partial) metadata for a particular directive or component instance.
13558
- * The function accepts an instance of a directive or component and returns the corresponding
13559
- * metadata.
13560
- *
13561
- * @param directiveOrComponentInstance Instance of a directive or component
13562
- * @returns metadata of the passed directive or component
13543
+ * @license
13544
+ * Copyright Google LLC All Rights Reserved.
13563
13545
  *
13564
- * @publicApi
13565
- * @globalApi ng
13546
+ * Use of this source code is governed by an MIT-style license that can be
13547
+ * found in the LICENSE file at https://angular.io/license
13566
13548
  */
13567
- function getDirectiveMetadata$1(directiveOrComponentInstance) {
13568
- const { constructor } = directiveOrComponentInstance;
13569
- if (!constructor) {
13570
- throw new Error('Unable to find the instance constructor');
13571
- }
13572
- // In case a component inherits from a directive, we may have component and directive metadata
13573
- // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
13574
- const componentDef = getComponentDef(constructor);
13575
- if (componentDef) {
13576
- return {
13577
- inputs: componentDef.inputs,
13578
- outputs: componentDef.outputs,
13579
- encapsulation: componentDef.encapsulation,
13580
- changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
13581
- ChangeDetectionStrategy.Default
13582
- };
13583
- }
13584
- const directiveDef = getDirectiveDef(constructor);
13585
- if (directiveDef) {
13586
- return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
13549
+ let _symbolIterator = null;
13550
+ function getSymbolIterator() {
13551
+ if (!_symbolIterator) {
13552
+ const Symbol = _global['Symbol'];
13553
+ if (Symbol && Symbol.iterator) {
13554
+ _symbolIterator = Symbol.iterator;
13555
+ }
13556
+ else {
13557
+ // es6-shim specific logic
13558
+ const keys = Object.getOwnPropertyNames(Map.prototype);
13559
+ for (let i = 0; i < keys.length; ++i) {
13560
+ const key = keys[i];
13561
+ if (key !== 'entries' && key !== 'size' &&
13562
+ Map.prototype[key] === Map.prototype['entries']) {
13563
+ _symbolIterator = key;
13564
+ }
13565
+ }
13566
+ }
13587
13567
  }
13588
- return null;
13568
+ return _symbolIterator;
13589
13569
  }
13570
+
13590
13571
  /**
13591
- * Retrieve map of local references.
13592
- *
13593
- * The references are retrieved as a map of local reference name to element or directive instance.
13572
+ * @license
13573
+ * Copyright Google LLC All Rights Reserved.
13594
13574
  *
13595
- * @param target DOM element, component or directive instance for which to retrieve
13596
- * the local references.
13575
+ * Use of this source code is governed by an MIT-style license that can be
13576
+ * found in the LICENSE file at https://angular.io/license
13597
13577
  */
13598
- function getLocalRefs(target) {
13599
- const context = getLContext(target);
13600
- if (context === null)
13601
- return {};
13602
- if (context.localRefs === undefined) {
13603
- const lView = context.lView;
13604
- if (lView === null) {
13605
- return {};
13606
- }
13607
- context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
13608
- }
13609
- return context.localRefs || {};
13610
- }
13611
- /**
13612
- * Retrieves the host element of a component or directive instance.
13613
- * The host element is the DOM element that matched the selector of the directive.
13614
- *
13615
- * @param componentOrDirective Component or directive instance for which the host
13616
- * element should be retrieved.
13617
- * @returns Host element of the target.
13618
- *
13619
- * @publicApi
13620
- * @globalApi ng
13621
- */
13622
- function getHostElement(componentOrDirective) {
13623
- return getLContext(componentOrDirective).native;
13578
+ function isIterable(obj) {
13579
+ return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
13624
13580
  }
13625
- /**
13626
- * Retrieves the rendered text for a given component.
13627
- *
13628
- * This function retrieves the host element of a component and
13629
- * and then returns the `textContent` for that element. This implies
13630
- * that the text returned will include re-projected content of
13631
- * the component as well.
13632
- *
13633
- * @param component The component to return the content text for.
13634
- */
13635
- function getRenderedText(component) {
13636
- const hostElement = getHostElement(component);
13637
- return hostElement.textContent || '';
13581
+ function isListLikeIterable(obj) {
13582
+ if (!isJsObject(obj))
13583
+ return false;
13584
+ return Array.isArray(obj) ||
13585
+ (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
13586
+ getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
13638
13587
  }
13639
- /**
13640
- * Retrieves a list of event listeners associated with a DOM element. The list does include host
13641
- * listeners, but it does not include event listeners defined outside of the Angular context
13642
- * (e.g. through `addEventListener`).
13643
- *
13644
- * @usageNotes
13645
- * Given the following DOM structure:
13646
- *
13647
- * ```html
13648
- * <app-root>
13649
- * <div (click)="doSomething()"></div>
13650
- * </app-root>
13651
- * ```
13652
- *
13653
- * Calling `getListeners` on `<div>` will return an object that looks as follows:
13654
- *
13655
- * ```ts
13656
- * {
13657
- * name: 'click',
13658
- * element: <div>,
13659
- * callback: () => doSomething(),
13660
- * useCapture: false
13661
- * }
13662
- * ```
13663
- *
13664
- * @param element Element for which the DOM listeners should be retrieved.
13665
- * @returns Array of event listeners on the DOM element.
13666
- *
13667
- * @publicApi
13668
- * @globalApi ng
13669
- */
13670
- function getListeners(element) {
13671
- ngDevMode && assertDomElement(element);
13672
- const lContext = getLContext(element);
13673
- const lView = lContext === null ? null : lContext.lView;
13674
- if (lView === null)
13675
- return [];
13676
- const tView = lView[TVIEW];
13677
- const lCleanup = lView[CLEANUP];
13678
- const tCleanup = tView.cleanup;
13679
- const listeners = [];
13680
- if (tCleanup && lCleanup) {
13681
- for (let i = 0; i < tCleanup.length;) {
13682
- const firstParam = tCleanup[i++];
13683
- const secondParam = tCleanup[i++];
13684
- if (typeof firstParam === 'string') {
13685
- const name = firstParam;
13686
- const listenerElement = unwrapRNode(lView[secondParam]);
13687
- const callback = lCleanup[tCleanup[i++]];
13688
- const useCaptureOrIndx = tCleanup[i++];
13689
- // if useCaptureOrIndx is boolean then report it as is.
13690
- // if useCaptureOrIndx is positive number then it in unsubscribe method
13691
- // if useCaptureOrIndx is negative number then it is a Subscription
13692
- const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
13693
- const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
13694
- if (element == listenerElement) {
13695
- listeners.push({ element, name, callback, useCapture, type });
13696
- }
13697
- }
13698
- }
13588
+ function areIterablesEqual(a, b, comparator) {
13589
+ const iterator1 = a[getSymbolIterator()]();
13590
+ const iterator2 = b[getSymbolIterator()]();
13591
+ while (true) {
13592
+ const item1 = iterator1.next();
13593
+ const item2 = iterator2.next();
13594
+ if (item1.done && item2.done)
13595
+ return true;
13596
+ if (item1.done || item2.done)
13597
+ return false;
13598
+ if (!comparator(item1.value, item2.value))
13599
+ return false;
13699
13600
  }
13700
- listeners.sort(sortListeners);
13701
- return listeners;
13702
- }
13703
- function sortListeners(a, b) {
13704
- if (a.name == b.name)
13705
- return 0;
13706
- return a.name < b.name ? -1 : 1;
13707
- }
13708
- /**
13709
- * This function should not exist because it is megamorphic and only mostly correct.
13710
- *
13711
- * See call site for more info.
13712
- */
13713
- function isDirectiveDefHack(obj) {
13714
- return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
13715
13601
  }
13716
- /**
13717
- * Returns the attached `DebugNode` instance for an element in the DOM.
13718
- *
13719
- * @param element DOM element which is owned by an existing component's view.
13720
- */
13721
- function getDebugNode$1(element) {
13722
- if (ngDevMode && !(element instanceof Node)) {
13723
- throw new Error('Expecting instance of DOM Element');
13724
- }
13725
- const lContext = getLContext(element);
13726
- const lView = lContext ? lContext.lView : null;
13727
- if (lView === null) {
13728
- return null;
13602
+ function iterateListLike(obj, fn) {
13603
+ if (Array.isArray(obj)) {
13604
+ for (let i = 0; i < obj.length; i++) {
13605
+ fn(obj[i]);
13606
+ }
13729
13607
  }
13730
- const nodeIndex = lContext.nodeIndex;
13731
- if (nodeIndex !== -1) {
13732
- const valueInLView = lView[nodeIndex];
13733
- // this means that value in the lView is a component with its own
13734
- // data. In this situation the TNode is not accessed at the same spot.
13735
- const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
13736
- ngDevMode &&
13737
- assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
13738
- return buildDebugNode(tNode, lView);
13608
+ else {
13609
+ const iterator = obj[getSymbolIterator()]();
13610
+ let item;
13611
+ while (!((item = iterator.next()).done)) {
13612
+ fn(item.value);
13613
+ }
13739
13614
  }
13740
- return null;
13741
- }
13742
- /**
13743
- * Retrieve the component `LView` from component/element.
13744
- *
13745
- * NOTE: `LView` is a private and should not be leaked outside.
13746
- * Don't export this method to `ng.*` on window.
13747
- *
13748
- * @param target DOM element or component instance for which to retrieve the LView.
13749
- */
13750
- function getComponentLView(target) {
13751
- const lContext = getLContext(target);
13752
- const nodeIndx = lContext.nodeIndex;
13753
- const lView = lContext.lView;
13754
- ngDevMode && assertLView(lView);
13755
- const componentLView = lView[nodeIndx];
13756
- ngDevMode && assertLView(componentLView);
13757
- return componentLView;
13758
13615
  }
13759
- /** Asserts that a value is a DOM Element. */
13760
- function assertDomElement(value) {
13761
- if (typeof Element !== 'undefined' && !(value instanceof Element)) {
13762
- throw new Error('Expecting instance of DOM Element');
13763
- }
13616
+ function isJsObject(o) {
13617
+ return o !== null && (typeof o === 'function' || typeof o === 'object');
13764
13618
  }
13765
13619
 
13766
13620
  /**
@@ -13770,18 +13624,22 @@ function assertDomElement(value) {
13770
13624
  * Use of this source code is governed by an MIT-style license that can be
13771
13625
  * found in the LICENSE file at https://angular.io/license
13772
13626
  */
13773
- /**
13774
- * Marks a component for check (in case of OnPush components) and synchronously
13775
- * performs change detection on the application this component belongs to.
13776
- *
13777
- * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
13778
- *
13779
- * @publicApi
13780
- * @globalApi ng
13781
- */
13782
- function applyChanges(component) {
13783
- markDirty(component);
13784
- getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
13627
+ function devModeEqual(a, b) {
13628
+ const isListLikeIterableA = isListLikeIterable(a);
13629
+ const isListLikeIterableB = isListLikeIterable(b);
13630
+ if (isListLikeIterableA && isListLikeIterableB) {
13631
+ return areIterablesEqual(a, b, devModeEqual);
13632
+ }
13633
+ else {
13634
+ const isAObject = a && (typeof a === 'object' || typeof a === 'function');
13635
+ const isBObject = b && (typeof b === 'object' || typeof b === 'function');
13636
+ if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
13637
+ return true;
13638
+ }
13639
+ else {
13640
+ return Object.is(a, b);
13641
+ }
13642
+ }
13785
13643
  }
13786
13644
 
13787
13645
  /**
@@ -13791,70 +13649,73 @@ function applyChanges(component) {
13791
13649
  * Use of this source code is governed by an MIT-style license that can be
13792
13650
  * found in the LICENSE file at https://angular.io/license
13793
13651
  */
13652
+ // TODO(misko): consider inlining
13653
+ /** Updates binding and returns the value. */
13654
+ function updateBinding(lView, bindingIndex, value) {
13655
+ return lView[bindingIndex] = value;
13656
+ }
13657
+ /** Gets the current binding value. */
13658
+ function getBinding(lView, bindingIndex) {
13659
+ ngDevMode && assertIndexInRange(lView, bindingIndex);
13660
+ ngDevMode &&
13661
+ assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
13662
+ return lView[bindingIndex];
13663
+ }
13794
13664
  /**
13795
- * This file introduces series of globally accessible debug tools
13796
- * to allow for the Angular debugging story to function.
13797
- *
13798
- * To see this in action run the following command:
13799
- *
13800
- * bazel run //packages/core/test/bundling/todo:devserver
13665
+ * Updates binding if changed, then returns whether it was updated.
13801
13666
  *
13802
- * Then load `localhost:5432` and start using the console tools.
13803
- */
13804
- /**
13805
- * This value reflects the property on the window where the dev
13806
- * tools are patched (window.ng).
13807
- * */
13808
- const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
13809
- let _published = false;
13810
- /**
13811
- * Publishes a collection of default debug tools onto`window.ng`.
13667
+ * This function also checks the `CheckNoChangesMode` and throws if changes are made.
13668
+ * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
13669
+ * behavior.
13812
13670
  *
13813
- * These functions are available globally when Angular is in development
13814
- * mode and are automatically stripped away from prod mode is on.
13671
+ * @param lView current `LView`
13672
+ * @param bindingIndex The binding in the `LView` to check
13673
+ * @param value New value to check against `lView[bindingIndex]`
13674
+ * @returns `true` if the bindings has changed. (Throws if binding has changed during
13675
+ * `CheckNoChangesMode`)
13815
13676
  */
13816
- function publishDefaultGlobalUtils$1() {
13817
- if (!_published) {
13818
- _published = true;
13819
- /**
13820
- * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
13821
- * The contract of the function might be changed in any release and/or the function can be
13822
- * removed completely.
13823
- */
13824
- publishGlobalUtil('ɵsetProfiler', setProfiler);
13825
- publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
13826
- publishGlobalUtil('getComponent', getComponent$1);
13827
- publishGlobalUtil('getContext', getContext);
13828
- publishGlobalUtil('getListeners', getListeners);
13829
- publishGlobalUtil('getOwningComponent', getOwningComponent);
13830
- publishGlobalUtil('getHostElement', getHostElement);
13831
- publishGlobalUtil('getInjector', getInjector);
13832
- publishGlobalUtil('getRootComponents', getRootComponents);
13833
- publishGlobalUtil('getDirectives', getDirectives);
13834
- publishGlobalUtil('applyChanges', applyChanges);
13677
+ function bindingUpdated(lView, bindingIndex, value) {
13678
+ ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
13679
+ ngDevMode &&
13680
+ assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
13681
+ const oldValue = lView[bindingIndex];
13682
+ if (Object.is(oldValue, value)) {
13683
+ return false;
13835
13684
  }
13836
- }
13837
- /**
13838
- * Publishes the given function to `window.ng` so that it can be
13839
- * used from the browser console when an application is not in production.
13840
- */
13841
- function publishGlobalUtil(name, fn) {
13842
- if (typeof COMPILED === 'undefined' || !COMPILED) {
13843
- // Note: we can't export `ng` when using closure enhanced optimization as:
13844
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
13845
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
13846
- // for typings for AngularJS (via `goog.provide('ng....')`).
13847
- const w = _global;
13848
- ngDevMode && assertDefined(fn, 'function not defined');
13849
- if (w) {
13850
- let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
13851
- if (!container) {
13852
- container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
13685
+ else {
13686
+ if (ngDevMode && isInCheckNoChangesMode()) {
13687
+ // View engine didn't report undefined values as changed on the first checkNoChanges pass
13688
+ // (before the change detection was run).
13689
+ const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
13690
+ if (!devModeEqual(oldValueToCompare, value)) {
13691
+ const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
13692
+ throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
13853
13693
  }
13854
- container[name] = fn;
13694
+ // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
13695
+ // For this reason we exit as if no change. The early exit is needed to prevent the changed
13696
+ // value to be written into `LView` (If we would write the new value that we would not see it
13697
+ // as change on next CD.)
13698
+ return false;
13855
13699
  }
13700
+ lView[bindingIndex] = value;
13701
+ return true;
13856
13702
  }
13857
13703
  }
13704
+ /** Updates 2 bindings if changed, then returns whether either was updated. */
13705
+ function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
13706
+ const different = bindingUpdated(lView, bindingIndex, exp1);
13707
+ return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
13708
+ }
13709
+ /** Updates 3 bindings if changed, then returns whether any was updated. */
13710
+ function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
13711
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13712
+ return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
13713
+ }
13714
+ /** Updates 4 bindings if changed, then returns whether any was updated. */
13715
+ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
13716
+ const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
13717
+ return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
13718
+ }
13858
13719
 
13859
13720
  /**
13860
13721
  * @license
@@ -13863,982 +13724,377 @@ function publishGlobalUtil(name, fn) {
13863
13724
  * Use of this source code is governed by an MIT-style license that can be
13864
13725
  * found in the LICENSE file at https://angular.io/license
13865
13726
  */
13866
- // TODO: A hack to not pull in the NullInjector from @angular/core.
13867
- const NULL_INJECTOR = {
13868
- get: (token, notFoundValue) => {
13869
- throwProviderNotFoundError(token, 'NullInjector');
13870
- }
13871
- };
13872
13727
  /**
13873
- * Bootstraps a Component into an existing host element and returns an instance
13874
- * of the component.
13728
+ * Updates the value of or removes a bound attribute on an Element.
13875
13729
  *
13876
- * Use this function to bootstrap a component into the DOM tree. Each invocation
13877
- * of this function will create a separate tree of components, injectors and
13878
- * change detection cycles and lifetimes. To dynamically insert a new component
13879
- * into an existing tree such that it shares the same injection, change detection
13880
- * and object lifetime, use {@link ViewContainer#createComponent}.
13730
+ * Used in the case of `[attr.title]="value"`
13731
+ *
13732
+ * @param name name The name of the attribute.
13733
+ * @param value value The attribute is removed when value is `null` or `undefined`.
13734
+ * Otherwise the attribute value is set to the stringified value.
13735
+ * @param sanitizer An optional function used to sanitize the value.
13736
+ * @param namespace Optional namespace to use when setting the attribute.
13881
13737
  *
13882
- * @param componentType Component to bootstrap
13883
- * @param options Optional parameters which control bootstrapping
13738
+ * @codeGenApi
13884
13739
  */
13885
- function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
13886
- ngDevMode && publishDefaultGlobalUtils$1();
13887
- ngDevMode && assertComponentType(componentType);
13888
- const rendererFactory = opts.rendererFactory || domRendererFactory3;
13889
- const sanitizer = opts.sanitizer || null;
13890
- const componentDef = getComponentDef(componentType);
13891
- if (componentDef.type != componentType)
13892
- componentDef.type = componentType;
13893
- // The first index of the first selector is the tag name.
13894
- const componentTag = componentDef.selectors[0][0];
13895
- const hostRenderer = rendererFactory.createRenderer(null, null);
13896
- const hostRNode = locateHostElement(hostRenderer, opts.host || componentTag, componentDef.encapsulation);
13897
- const rootFlags = componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
13898
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13899
- const rootContext = createRootContext(opts.scheduler, opts.playerHandler);
13900
- const renderer = rendererFactory.createRenderer(hostRNode, componentDef);
13901
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
13902
- const rootView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, null, opts.injector || null, null);
13903
- enterView(rootView);
13904
- let component;
13905
- try {
13906
- if (rendererFactory.begin)
13907
- rendererFactory.begin();
13908
- const componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer);
13909
- component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
13910
- // create mode pass
13911
- renderView(rootTView, rootView, null);
13912
- // update mode pass
13913
- refreshView(rootTView, rootView, null, null);
13914
- }
13915
- finally {
13916
- leaveView();
13917
- if (rendererFactory.end)
13918
- rendererFactory.end();
13740
+ function ɵɵattribute(name, value, sanitizer, namespace) {
13741
+ const lView = getLView();
13742
+ const bindingIndex = nextBindingIndex();
13743
+ if (bindingUpdated(lView, bindingIndex, value)) {
13744
+ const tView = getTView();
13745
+ const tNode = getSelectedTNode();
13746
+ elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
13747
+ ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
13919
13748
  }
13920
- return component;
13749
+ return ɵɵattribute;
13921
13750
  }
13751
+
13922
13752
  /**
13923
- * Creates the root component view and the root component node.
13924
- *
13925
- * @param rNode Render host element.
13926
- * @param def ComponentDef
13927
- * @param rootView The parent view where the host node is stored
13928
- * @param rendererFactory Factory to be used for creating child renderers.
13929
- * @param hostRenderer The current renderer
13930
- * @param sanitizer The sanitizer, if provided
13753
+ * @license
13754
+ * Copyright Google LLC All Rights Reserved.
13931
13755
  *
13932
- * @returns Component view created
13756
+ * Use of this source code is governed by an MIT-style license that can be
13757
+ * found in the LICENSE file at https://angular.io/license
13933
13758
  */
13934
- function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
13935
- const tView = rootView[TVIEW];
13936
- const index = HEADER_OFFSET;
13937
- ngDevMode && assertIndexInRange(rootView, index);
13938
- rootView[index] = rNode;
13939
- // '#host' is added here as we don't know the real host DOM name (we don't want to read it) and at
13940
- // the same time we want to communicate the debug `TNode` that this is a special `TNode`
13941
- // representing a host element.
13942
- const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, '#host', null);
13943
- const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
13944
- if (mergedAttrs !== null) {
13945
- computeStaticStyling(tNode, mergedAttrs, true);
13946
- if (rNode !== null) {
13947
- setUpAttributes(hostRenderer, rNode, mergedAttrs);
13948
- if (tNode.classes !== null) {
13949
- writeDirectClass(hostRenderer, rNode, tNode.classes);
13950
- }
13951
- if (tNode.styles !== null) {
13952
- writeDirectStyle(hostRenderer, rNode, tNode.styles);
13953
- }
13954
- }
13955
- }
13956
- const viewRenderer = rendererFactory.createRenderer(rNode, def);
13957
- const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
13958
- if (tView.firstCreatePass) {
13959
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
13960
- markAsComponentHost(tView, tNode);
13961
- initTNodeFlags(tNode, rootView.length, 1);
13962
- }
13963
- addToViewTree(rootView, componentView);
13964
- // Store component view at node index, with node as the HOST
13965
- return rootView[index] = componentView;
13966
- }
13967
13759
  /**
13968
- * Creates a root component and sets it up with features and host bindings. Shared by
13969
- * renderComponent() and ViewContainerRef.createComponent().
13760
+ * Create interpolation bindings with a variable number of expressions.
13761
+ *
13762
+ * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
13763
+ * Those are faster because there is no need to create an array of expressions and iterate over it.
13764
+ *
13765
+ * `values`:
13766
+ * - has static text at even indexes,
13767
+ * - has evaluated expressions at odd indexes.
13768
+ *
13769
+ * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
13970
13770
  */
13971
- function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
13972
- const tView = rootLView[TVIEW];
13973
- // Create directive instance with factory() and store at next index in viewData
13974
- const component = instantiateRootComponent(tView, rootLView, componentDef);
13975
- rootContext.components.push(component);
13976
- componentView[CONTEXT] = component;
13977
- if (hostFeatures !== null) {
13978
- for (const feature of hostFeatures) {
13979
- feature(component, componentDef);
13980
- }
13771
+ function interpolationV(lView, values) {
13772
+ ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
13773
+ ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
13774
+ let isBindingUpdated = false;
13775
+ let bindingIndex = getBindingIndex();
13776
+ for (let i = 1; i < values.length; i += 2) {
13777
+ // Check if bindings (odd indexes) have changed
13778
+ isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
13981
13779
  }
13982
- // We want to generate an empty QueryList for root content queries for backwards
13983
- // compatibility with ViewEngine.
13984
- if (componentDef.contentQueries) {
13985
- const tNode = getCurrentTNode();
13986
- ngDevMode && assertDefined(tNode, 'TNode expected');
13987
- componentDef.contentQueries(1 /* RenderFlags.Create */, component, tNode.directiveStart);
13780
+ setBindingIndex(bindingIndex);
13781
+ if (!isBindingUpdated) {
13782
+ return NO_CHANGE;
13988
13783
  }
13989
- const rootTNode = getCurrentTNode();
13990
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
13991
- if (tView.firstCreatePass &&
13992
- (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
13993
- setSelectedIndex(rootTNode.index);
13994
- const rootTView = rootLView[TVIEW];
13995
- registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
13996
- invokeHostBindingsInCreationMode(componentDef, component);
13784
+ // Build the updated content
13785
+ let content = values[0];
13786
+ for (let i = 1; i < values.length; i += 2) {
13787
+ content += renderStringify(values[i]) + values[i + 1];
13997
13788
  }
13998
- return component;
13999
- }
14000
- function createRootContext(scheduler, playerHandler) {
14001
- return {
14002
- components: [],
14003
- scheduler: scheduler || defaultScheduler,
14004
- clean: CLEAN_PROMISE,
14005
- playerHandler: playerHandler || null,
14006
- flags: 0 /* RootContextFlags.Empty */
14007
- };
13789
+ return content;
14008
13790
  }
14009
13791
  /**
14010
- * Used to enable lifecycle hooks on the root component.
14011
- *
14012
- * Include this feature when calling `renderComponent` if the root component
14013
- * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
14014
- * be called properly.
14015
- *
14016
- * Example:
13792
+ * Creates an interpolation binding with 1 expression.
14017
13793
  *
14018
- * ```
14019
- * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
14020
- * ```
13794
+ * @param prefix static value used for concatenation only.
13795
+ * @param v0 value checked for change.
13796
+ * @param suffix static value used for concatenation only.
14021
13797
  */
14022
- function LifecycleHooksFeature() {
14023
- const tNode = getCurrentTNode();
14024
- ngDevMode && assertDefined(tNode, 'TNode is required');
14025
- registerPostOrderHooks(getLView()[TVIEW], tNode);
13798
+ function interpolation1(lView, prefix, v0, suffix) {
13799
+ const different = bindingUpdated(lView, nextBindingIndex(), v0);
13800
+ return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
14026
13801
  }
14027
13802
  /**
14028
- * Wait on component until it is rendered.
14029
- *
14030
- * This function returns a `Promise` which is resolved when the component's
14031
- * change detection is executed. This is determined by finding the scheduler
14032
- * associated with the `component`'s render tree and waiting until the scheduler
14033
- * flushes. If nothing is scheduled, the function returns a resolved promise.
14034
- *
14035
- * Example:
14036
- * ```
14037
- * await whenRendered(myComponent);
14038
- * ```
14039
- *
14040
- * @param component Component to wait upon
14041
- * @returns Promise which resolves when the component is rendered.
13803
+ * Creates an interpolation binding with 2 expressions.
14042
13804
  */
14043
- function whenRendered(component) {
14044
- return getRootContext(component).clean;
13805
+ function interpolation2(lView, prefix, v0, i0, v1, suffix) {
13806
+ const bindingIndex = getBindingIndex();
13807
+ const different = bindingUpdated2(lView, bindingIndex, v0, v1);
13808
+ incrementBindingIndex(2);
13809
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14045
13810
  }
14046
-
14047
13811
  /**
14048
- * @license
14049
- * Copyright Google LLC All Rights Reserved.
14050
- *
14051
- * Use of this source code is governed by an MIT-style license that can be
14052
- * found in the LICENSE file at https://angular.io/license
13812
+ * Creates an interpolation binding with 3 expressions.
14053
13813
  */
14054
- function getSuperType(type) {
14055
- return Object.getPrototypeOf(type.prototype).constructor;
13814
+ function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
13815
+ const bindingIndex = getBindingIndex();
13816
+ const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
13817
+ incrementBindingIndex(3);
13818
+ return different ?
13819
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
13820
+ NO_CHANGE;
14056
13821
  }
14057
13822
  /**
14058
- * Merges the definition from a super class to a sub class.
14059
- * @param definition The definition that is a SubClass of another directive of component
14060
- *
14061
- * @codeGenApi
13823
+ * Create an interpolation binding with 4 expressions.
14062
13824
  */
14063
- function ɵɵInheritDefinitionFeature(definition) {
14064
- let superType = getSuperType(definition.type);
14065
- let shouldInheritFields = true;
14066
- const inheritanceChain = [definition];
14067
- while (superType) {
14068
- let superDef = undefined;
14069
- if (isComponentDef(definition)) {
14070
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14071
- superDef = superType.ɵcmp || superType.ɵdir;
14072
- }
14073
- else {
14074
- if (superType.ɵcmp) {
14075
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
14076
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}` :
14077
- '';
14078
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, errorMessage);
14079
- }
14080
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14081
- superDef = superType.ɵdir;
14082
- }
14083
- if (superDef) {
14084
- if (shouldInheritFields) {
14085
- inheritanceChain.push(superDef);
14086
- // Some fields in the definition may be empty, if there were no values to put in them that
14087
- // would've justified object creation. Unwrap them if necessary.
14088
- const writeableDef = definition;
14089
- writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
14090
- writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
14091
- writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
14092
- // Merge hostBindings
14093
- const superHostBindings = superDef.hostBindings;
14094
- superHostBindings && inheritHostBindings(definition, superHostBindings);
14095
- // Merge queries
14096
- const superViewQuery = superDef.viewQuery;
14097
- const superContentQueries = superDef.contentQueries;
14098
- superViewQuery && inheritViewQuery(definition, superViewQuery);
14099
- superContentQueries && inheritContentQueries(definition, superContentQueries);
14100
- // Merge inputs and outputs
14101
- fillProperties(definition.inputs, superDef.inputs);
14102
- fillProperties(definition.declaredInputs, superDef.declaredInputs);
14103
- fillProperties(definition.outputs, superDef.outputs);
14104
- // Merge animations metadata.
14105
- // If `superDef` is a Component, the `data` field is present (defaults to an empty object).
14106
- if (isComponentDef(superDef) && superDef.data.animation) {
14107
- // If super def is a Component, the `definition` is also a Component, since Directives can
14108
- // not inherit Components (we throw an error above and cannot reach this code).
14109
- const defData = definition.data;
14110
- defData.animation = (defData.animation || []).concat(superDef.data.animation);
14111
- }
14112
- }
14113
- // Run parent features
14114
- const features = superDef.features;
14115
- if (features) {
14116
- for (let i = 0; i < features.length; i++) {
14117
- const feature = features[i];
14118
- if (feature && feature.ngInherit) {
14119
- feature(definition);
14120
- }
14121
- // If `InheritDefinitionFeature` is a part of the current `superDef`, it means that this
14122
- // def already has all the necessary information inherited from its super class(es), so we
14123
- // can stop merging fields from super classes. However we need to iterate through the
14124
- // prototype chain to look for classes that might contain other "features" (like
14125
- // NgOnChanges), which we should invoke for the original `definition`. We set the
14126
- // `shouldInheritFields` flag to indicate that, essentially skipping fields inheritance
14127
- // logic and only invoking functions from the "features" list.
14128
- if (feature === ɵɵInheritDefinitionFeature) {
14129
- shouldInheritFields = false;
14130
- }
14131
- }
14132
- }
14133
- }
14134
- superType = Object.getPrototypeOf(superType);
14135
- }
14136
- mergeHostAttrsAcrossInheritance(inheritanceChain);
13825
+ function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
13826
+ const bindingIndex = getBindingIndex();
13827
+ const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13828
+ incrementBindingIndex(4);
13829
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13830
+ renderStringify(v2) + i2 + renderStringify(v3) + suffix :
13831
+ NO_CHANGE;
14137
13832
  }
14138
13833
  /**
14139
- * Merge the `hostAttrs` and `hostVars` from the inherited parent to the base class.
14140
- *
14141
- * @param inheritanceChain A list of `WritableDefs` starting at the top most type and listing
14142
- * sub-types in order. For each type take the `hostAttrs` and `hostVars` and merge it with the child
14143
- * type.
13834
+ * Creates an interpolation binding with 5 expressions.
14144
13835
  */
14145
- function mergeHostAttrsAcrossInheritance(inheritanceChain) {
14146
- let hostVars = 0;
14147
- let hostAttrs = null;
14148
- // We process the inheritance order from the base to the leaves here.
14149
- for (let i = inheritanceChain.length - 1; i >= 0; i--) {
14150
- const def = inheritanceChain[i];
14151
- // For each `hostVars`, we need to add the superclass amount.
14152
- def.hostVars = (hostVars += def.hostVars);
14153
- // for each `hostAttrs` we need to merge it with superclass.
14154
- def.hostAttrs =
14155
- mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
14156
- }
14157
- }
14158
- function maybeUnwrapEmpty(value) {
14159
- if (value === EMPTY_OBJ) {
14160
- return {};
14161
- }
14162
- else if (value === EMPTY_ARRAY) {
14163
- return [];
14164
- }
14165
- else {
14166
- return value;
14167
- }
14168
- }
14169
- function inheritViewQuery(definition, superViewQuery) {
14170
- const prevViewQuery = definition.viewQuery;
14171
- if (prevViewQuery) {
14172
- definition.viewQuery = (rf, ctx) => {
14173
- superViewQuery(rf, ctx);
14174
- prevViewQuery(rf, ctx);
14175
- };
14176
- }
14177
- else {
14178
- definition.viewQuery = superViewQuery;
14179
- }
14180
- }
14181
- function inheritContentQueries(definition, superContentQueries) {
14182
- const prevContentQueries = definition.contentQueries;
14183
- if (prevContentQueries) {
14184
- definition.contentQueries = (rf, ctx, directiveIndex) => {
14185
- superContentQueries(rf, ctx, directiveIndex);
14186
- prevContentQueries(rf, ctx, directiveIndex);
14187
- };
14188
- }
14189
- else {
14190
- definition.contentQueries = superContentQueries;
14191
- }
14192
- }
14193
- function inheritHostBindings(definition, superHostBindings) {
14194
- const prevHostBindings = definition.hostBindings;
14195
- if (prevHostBindings) {
14196
- definition.hostBindings = (rf, ctx) => {
14197
- superHostBindings(rf, ctx);
14198
- prevHostBindings(rf, ctx);
14199
- };
14200
- }
14201
- else {
14202
- definition.hostBindings = superHostBindings;
14203
- }
13836
+ function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
13837
+ const bindingIndex = getBindingIndex();
13838
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13839
+ different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
13840
+ incrementBindingIndex(5);
13841
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13842
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
13843
+ NO_CHANGE;
14204
13844
  }
14205
-
14206
13845
  /**
14207
- * @license
14208
- * Copyright Google LLC All Rights Reserved.
14209
- *
14210
- * Use of this source code is governed by an MIT-style license that can be
14211
- * found in the LICENSE file at https://angular.io/license
13846
+ * Creates an interpolation binding with 6 expressions.
14212
13847
  */
13848
+ function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
13849
+ const bindingIndex = getBindingIndex();
13850
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13851
+ different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
13852
+ incrementBindingIndex(6);
13853
+ return different ?
13854
+ prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
13855
+ renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
13856
+ NO_CHANGE;
13857
+ }
14213
13858
  /**
14214
- * Fields which exist on either directive or component definitions, and need to be copied from
14215
- * parent to child classes by the `ɵɵCopyDefinitionFeature`.
13859
+ * Creates an interpolation binding with 7 expressions.
14216
13860
  */
14217
- const COPY_DIRECTIVE_FIELDS = [
14218
- // The child class should use the providers of its parent.
14219
- 'providersResolver',
14220
- // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
14221
- // as inputs, outputs, and host binding functions.
14222
- ];
13861
+ function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
13862
+ const bindingIndex = getBindingIndex();
13863
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13864
+ different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
13865
+ incrementBindingIndex(7);
13866
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13867
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13868
+ renderStringify(v5) + i5 + renderStringify(v6) + suffix :
13869
+ NO_CHANGE;
13870
+ }
14223
13871
  /**
14224
- * Fields which exist only on component definitions, and need to be copied from parent to child
14225
- * classes by the `ɵɵCopyDefinitionFeature`.
14226
- *
14227
- * The type here allows any field of `ComponentDef` which is not also a property of `DirectiveDef`,
14228
- * since those should go in `COPY_DIRECTIVE_FIELDS` above.
13872
+ * Creates an interpolation binding with 8 expressions.
14229
13873
  */
14230
- const COPY_COMPONENT_FIELDS = [
14231
- // The child class should use the template function of its parent, including all template
14232
- // semantics.
14233
- 'template',
14234
- 'decls',
14235
- 'consts',
14236
- 'vars',
14237
- 'onPush',
14238
- 'ngContentSelectors',
14239
- // The child class should use the CSS styles of its parent, including all styling semantics.
14240
- 'styles',
14241
- 'encapsulation',
14242
- // The child class should be checked by the runtime in the same way as its parent.
14243
- 'schemas',
14244
- ];
13874
+ function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
13875
+ const bindingIndex = getBindingIndex();
13876
+ let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
13877
+ different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
13878
+ incrementBindingIndex(8);
13879
+ return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
13880
+ renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
13881
+ renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
13882
+ NO_CHANGE;
13883
+ }
13884
+
14245
13885
  /**
14246
- * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
14247
- * definition.
14248
13886
  *
14249
- * This exists primarily to support ngcc migration of an existing View Engine pattern, where an
14250
- * entire decorator is inherited from a parent to a child class. When ngcc detects this case, it
14251
- * generates a skeleton definition on the child class, and applies this feature.
13887
+ * Update an interpolated attribute on an element with single bound value surrounded by text.
14252
13888
  *
14253
- * The `ɵɵCopyDefinitionFeature` then copies any needed fields from the parent class' definition,
14254
- * including things like the component template function.
13889
+ * Used when the value passed to a property has 1 interpolated value in it:
14255
13890
  *
14256
- * @param definition The definition of a child class which inherits from a parent class with its
14257
- * own definition.
13891
+ * ```html
13892
+ * <div attr.title="prefix{{v0}}suffix"></div>
13893
+ * ```
14258
13894
  *
14259
- * @codeGenApi
14260
- */
14261
- function ɵɵCopyDefinitionFeature(definition) {
14262
- let superType = getSuperType(definition.type);
14263
- let superDef = undefined;
14264
- if (isComponentDef(definition)) {
14265
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14266
- superDef = superType.ɵcmp;
14267
- }
14268
- else {
14269
- // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14270
- superDef = superType.ɵdir;
14271
- }
14272
- // Needed because `definition` fields are readonly.
14273
- const defAny = definition;
14274
- // Copy over any fields that apply to either directives or components.
14275
- for (const field of COPY_DIRECTIVE_FIELDS) {
14276
- defAny[field] = superDef[field];
14277
- }
14278
- if (isComponentDef(superDef)) {
14279
- // Copy over any component-specific fields.
14280
- for (const field of COPY_COMPONENT_FIELDS) {
14281
- defAny[field] = superDef[field];
14282
- }
14283
- }
14284
- }
14285
-
14286
- /**
14287
- * @license
14288
- * Copyright Google LLC All Rights Reserved.
13895
+ * Its compiled representation is::
14289
13896
  *
14290
- * Use of this source code is governed by an MIT-style license that can be
14291
- * found in the LICENSE file at https://angular.io/license
13897
+ * ```ts
13898
+ * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
13899
+ * ```
13900
+ *
13901
+ * @param attrName The name of the attribute to update
13902
+ * @param prefix Static value used for concatenation only.
13903
+ * @param v0 Value checked for change.
13904
+ * @param suffix Static value used for concatenation only.
13905
+ * @param sanitizer An optional sanitizer function
13906
+ * @returns itself, so that it may be chained.
13907
+ * @codeGenApi
14292
13908
  */
14293
- let _symbolIterator = null;
14294
- function getSymbolIterator() {
14295
- if (!_symbolIterator) {
14296
- const Symbol = _global['Symbol'];
14297
- if (Symbol && Symbol.iterator) {
14298
- _symbolIterator = Symbol.iterator;
14299
- }
14300
- else {
14301
- // es6-shim specific logic
14302
- const keys = Object.getOwnPropertyNames(Map.prototype);
14303
- for (let i = 0; i < keys.length; ++i) {
14304
- const key = keys[i];
14305
- if (key !== 'entries' && key !== 'size' &&
14306
- Map.prototype[key] === Map.prototype['entries']) {
14307
- _symbolIterator = key;
14308
- }
14309
- }
14310
- }
13909
+ function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
13910
+ const lView = getLView();
13911
+ const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
13912
+ if (interpolatedValue !== NO_CHANGE) {
13913
+ const tNode = getSelectedTNode();
13914
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13915
+ ngDevMode &&
13916
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14311
13917
  }
14312
- return _symbolIterator;
13918
+ return ɵɵattributeInterpolate1;
14313
13919
  }
14314
-
14315
13920
  /**
14316
- * @license
14317
- * Copyright Google LLC All Rights Reserved.
14318
13921
  *
14319
- * Use of this source code is governed by an MIT-style license that can be
14320
- * found in the LICENSE file at https://angular.io/license
13922
+ * Update an interpolated attribute on an element with 2 bound values surrounded by text.
13923
+ *
13924
+ * Used when the value passed to a property has 2 interpolated values in it:
13925
+ *
13926
+ * ```html
13927
+ * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
13928
+ * ```
13929
+ *
13930
+ * Its compiled representation is::
13931
+ *
13932
+ * ```ts
13933
+ * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
13934
+ * ```
13935
+ *
13936
+ * @param attrName The name of the attribute to update
13937
+ * @param prefix Static value used for concatenation only.
13938
+ * @param v0 Value checked for change.
13939
+ * @param i0 Static value used for concatenation only.
13940
+ * @param v1 Value checked for change.
13941
+ * @param suffix Static value used for concatenation only.
13942
+ * @param sanitizer An optional sanitizer function
13943
+ * @returns itself, so that it may be chained.
13944
+ * @codeGenApi
14321
13945
  */
14322
- function isIterable(obj) {
14323
- return obj !== null && typeof obj === 'object' && obj[getSymbolIterator()] !== undefined;
14324
- }
14325
- function isListLikeIterable(obj) {
14326
- if (!isJsObject(obj))
14327
- return false;
14328
- return Array.isArray(obj) ||
14329
- (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
14330
- getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
14331
- }
14332
- function areIterablesEqual(a, b, comparator) {
14333
- const iterator1 = a[getSymbolIterator()]();
14334
- const iterator2 = b[getSymbolIterator()]();
14335
- while (true) {
14336
- const item1 = iterator1.next();
14337
- const item2 = iterator2.next();
14338
- if (item1.done && item2.done)
14339
- return true;
14340
- if (item1.done || item2.done)
14341
- return false;
14342
- if (!comparator(item1.value, item2.value))
14343
- return false;
14344
- }
14345
- }
14346
- function iterateListLike(obj, fn) {
14347
- if (Array.isArray(obj)) {
14348
- for (let i = 0; i < obj.length; i++) {
14349
- fn(obj[i]);
14350
- }
14351
- }
14352
- else {
14353
- const iterator = obj[getSymbolIterator()]();
14354
- let item;
14355
- while (!((item = iterator.next()).done)) {
14356
- fn(item.value);
14357
- }
13946
+ function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
13947
+ const lView = getLView();
13948
+ const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
13949
+ if (interpolatedValue !== NO_CHANGE) {
13950
+ const tNode = getSelectedTNode();
13951
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13952
+ ngDevMode &&
13953
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14358
13954
  }
13955
+ return ɵɵattributeInterpolate2;
14359
13956
  }
14360
- function isJsObject(o) {
14361
- return o !== null && (typeof o === 'function' || typeof o === 'object');
14362
- }
14363
-
14364
13957
  /**
14365
- * @license
14366
- * Copyright Google LLC All Rights Reserved.
14367
13958
  *
14368
- * Use of this source code is governed by an MIT-style license that can be
14369
- * found in the LICENSE file at https://angular.io/license
13959
+ * Update an interpolated attribute on an element with 3 bound values surrounded by text.
13960
+ *
13961
+ * Used when the value passed to a property has 3 interpolated values in it:
13962
+ *
13963
+ * ```html
13964
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
13965
+ * ```
13966
+ *
13967
+ * Its compiled representation is::
13968
+ *
13969
+ * ```ts
13970
+ * ɵɵattributeInterpolate3(
13971
+ * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
13972
+ * ```
13973
+ *
13974
+ * @param attrName The name of the attribute to update
13975
+ * @param prefix Static value used for concatenation only.
13976
+ * @param v0 Value checked for change.
13977
+ * @param i0 Static value used for concatenation only.
13978
+ * @param v1 Value checked for change.
13979
+ * @param i1 Static value used for concatenation only.
13980
+ * @param v2 Value checked for change.
13981
+ * @param suffix Static value used for concatenation only.
13982
+ * @param sanitizer An optional sanitizer function
13983
+ * @returns itself, so that it may be chained.
13984
+ * @codeGenApi
14370
13985
  */
14371
- function devModeEqual(a, b) {
14372
- const isListLikeIterableA = isListLikeIterable(a);
14373
- const isListLikeIterableB = isListLikeIterable(b);
14374
- if (isListLikeIterableA && isListLikeIterableB) {
14375
- return areIterablesEqual(a, b, devModeEqual);
14376
- }
14377
- else {
14378
- const isAObject = a && (typeof a === 'object' || typeof a === 'function');
14379
- const isBObject = b && (typeof b === 'object' || typeof b === 'function');
14380
- if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
14381
- return true;
14382
- }
14383
- else {
14384
- return Object.is(a, b);
14385
- }
13986
+ function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
13987
+ const lView = getLView();
13988
+ const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
13989
+ if (interpolatedValue !== NO_CHANGE) {
13990
+ const tNode = getSelectedTNode();
13991
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
13992
+ ngDevMode &&
13993
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
14386
13994
  }
13995
+ return ɵɵattributeInterpolate3;
14387
13996
  }
14388
-
14389
13997
  /**
14390
- * @license
14391
- * Copyright Google LLC All Rights Reserved.
14392
13998
  *
14393
- * Use of this source code is governed by an MIT-style license that can be
14394
- * found in the LICENSE file at https://angular.io/license
13999
+ * Update an interpolated attribute on an element with 4 bound values surrounded by text.
14000
+ *
14001
+ * Used when the value passed to a property has 4 interpolated values in it:
14002
+ *
14003
+ * ```html
14004
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div>
14005
+ * ```
14006
+ *
14007
+ * Its compiled representation is::
14008
+ *
14009
+ * ```ts
14010
+ * ɵɵattributeInterpolate4(
14011
+ * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix');
14012
+ * ```
14013
+ *
14014
+ * @param attrName The name of the attribute to update
14015
+ * @param prefix Static value used for concatenation only.
14016
+ * @param v0 Value checked for change.
14017
+ * @param i0 Static value used for concatenation only.
14018
+ * @param v1 Value checked for change.
14019
+ * @param i1 Static value used for concatenation only.
14020
+ * @param v2 Value checked for change.
14021
+ * @param i2 Static value used for concatenation only.
14022
+ * @param v3 Value checked for change.
14023
+ * @param suffix Static value used for concatenation only.
14024
+ * @param sanitizer An optional sanitizer function
14025
+ * @returns itself, so that it may be chained.
14026
+ * @codeGenApi
14395
14027
  */
14396
- // TODO(misko): consider inlining
14397
- /** Updates binding and returns the value. */
14398
- function updateBinding(lView, bindingIndex, value) {
14399
- return lView[bindingIndex] = value;
14400
- }
14401
- /** Gets the current binding value. */
14402
- function getBinding(lView, bindingIndex) {
14403
- ngDevMode && assertIndexInRange(lView, bindingIndex);
14404
- ngDevMode &&
14405
- assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
14406
- return lView[bindingIndex];
14028
+ function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
14029
+ const lView = getLView();
14030
+ const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
14031
+ if (interpolatedValue !== NO_CHANGE) {
14032
+ const tNode = getSelectedTNode();
14033
+ elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14034
+ ngDevMode &&
14035
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
14036
+ }
14037
+ return ɵɵattributeInterpolate4;
14407
14038
  }
14408
14039
  /**
14409
- * Updates binding if changed, then returns whether it was updated.
14410
14040
  *
14411
- * This function also checks the `CheckNoChangesMode` and throws if changes are made.
14412
- * Some changes (Objects/iterables) during `CheckNoChangesMode` are exempt to comply with VE
14413
- * behavior.
14414
- *
14415
- * @param lView current `LView`
14416
- * @param bindingIndex The binding in the `LView` to check
14417
- * @param value New value to check against `lView[bindingIndex]`
14418
- * @returns `true` if the bindings has changed. (Throws if binding has changed during
14419
- * `CheckNoChangesMode`)
14420
- */
14421
- function bindingUpdated(lView, bindingIndex, value) {
14422
- ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
14423
- ngDevMode &&
14424
- assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
14425
- const oldValue = lView[bindingIndex];
14426
- if (Object.is(oldValue, value)) {
14427
- return false;
14428
- }
14429
- else {
14430
- if (ngDevMode && isInCheckNoChangesMode()) {
14431
- // View engine didn't report undefined values as changed on the first checkNoChanges pass
14432
- // (before the change detection was run).
14433
- const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
14434
- if (!devModeEqual(oldValueToCompare, value)) {
14435
- const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
14436
- throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
14437
- }
14438
- // There was a change, but the `devModeEqual` decided that the change is exempt from an error.
14439
- // For this reason we exit as if no change. The early exit is needed to prevent the changed
14440
- // value to be written into `LView` (If we would write the new value that we would not see it
14441
- // as change on next CD.)
14442
- return false;
14443
- }
14444
- lView[bindingIndex] = value;
14445
- return true;
14446
- }
14447
- }
14448
- /** Updates 2 bindings if changed, then returns whether either was updated. */
14449
- function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
14450
- const different = bindingUpdated(lView, bindingIndex, exp1);
14451
- return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
14452
- }
14453
- /** Updates 3 bindings if changed, then returns whether any was updated. */
14454
- function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
14455
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14456
- return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
14457
- }
14458
- /** Updates 4 bindings if changed, then returns whether any was updated. */
14459
- function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
14460
- const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
14461
- return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
14462
- }
14463
-
14464
- /**
14465
- * @license
14466
- * Copyright Google LLC All Rights Reserved.
14467
- *
14468
- * Use of this source code is governed by an MIT-style license that can be
14469
- * found in the LICENSE file at https://angular.io/license
14470
- */
14471
- /**
14472
- * Updates the value of or removes a bound attribute on an Element.
14473
- *
14474
- * Used in the case of `[attr.title]="value"`
14475
- *
14476
- * @param name name The name of the attribute.
14477
- * @param value value The attribute is removed when value is `null` or `undefined`.
14478
- * Otherwise the attribute value is set to the stringified value.
14479
- * @param sanitizer An optional function used to sanitize the value.
14480
- * @param namespace Optional namespace to use when setting the attribute.
14481
- *
14482
- * @codeGenApi
14483
- */
14484
- function ɵɵattribute(name, value, sanitizer, namespace) {
14485
- const lView = getLView();
14486
- const bindingIndex = nextBindingIndex();
14487
- if (bindingUpdated(lView, bindingIndex, value)) {
14488
- const tView = getTView();
14489
- const tNode = getSelectedTNode();
14490
- elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
14491
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
14492
- }
14493
- return ɵɵattribute;
14494
- }
14495
-
14496
- /**
14497
- * @license
14498
- * Copyright Google LLC All Rights Reserved.
14499
- *
14500
- * Use of this source code is governed by an MIT-style license that can be
14501
- * found in the LICENSE file at https://angular.io/license
14502
- */
14503
- /**
14504
- * Create interpolation bindings with a variable number of expressions.
14505
- *
14506
- * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
14507
- * Those are faster because there is no need to create an array of expressions and iterate over it.
14508
- *
14509
- * `values`:
14510
- * - has static text at even indexes,
14511
- * - has evaluated expressions at odd indexes.
14512
- *
14513
- * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
14514
- */
14515
- function interpolationV(lView, values) {
14516
- ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
14517
- ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
14518
- let isBindingUpdated = false;
14519
- let bindingIndex = getBindingIndex();
14520
- for (let i = 1; i < values.length; i += 2) {
14521
- // Check if bindings (odd indexes) have changed
14522
- isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
14523
- }
14524
- setBindingIndex(bindingIndex);
14525
- if (!isBindingUpdated) {
14526
- return NO_CHANGE;
14527
- }
14528
- // Build the updated content
14529
- let content = values[0];
14530
- for (let i = 1; i < values.length; i += 2) {
14531
- content += renderStringify(values[i]) + values[i + 1];
14532
- }
14533
- return content;
14534
- }
14535
- /**
14536
- * Creates an interpolation binding with 1 expression.
14537
- *
14538
- * @param prefix static value used for concatenation only.
14539
- * @param v0 value checked for change.
14540
- * @param suffix static value used for concatenation only.
14541
- */
14542
- function interpolation1(lView, prefix, v0, suffix) {
14543
- const different = bindingUpdated(lView, nextBindingIndex(), v0);
14544
- return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
14545
- }
14546
- /**
14547
- * Creates an interpolation binding with 2 expressions.
14548
- */
14549
- function interpolation2(lView, prefix, v0, i0, v1, suffix) {
14550
- const bindingIndex = getBindingIndex();
14551
- const different = bindingUpdated2(lView, bindingIndex, v0, v1);
14552
- incrementBindingIndex(2);
14553
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
14554
- }
14555
- /**
14556
- * Creates an interpolation binding with 3 expressions.
14557
- */
14558
- function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
14559
- const bindingIndex = getBindingIndex();
14560
- const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
14561
- incrementBindingIndex(3);
14562
- return different ?
14563
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
14564
- NO_CHANGE;
14565
- }
14566
- /**
14567
- * Create an interpolation binding with 4 expressions.
14568
- */
14569
- function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
14570
- const bindingIndex = getBindingIndex();
14571
- const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14572
- incrementBindingIndex(4);
14573
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14574
- renderStringify(v2) + i2 + renderStringify(v3) + suffix :
14575
- NO_CHANGE;
14576
- }
14577
- /**
14578
- * Creates an interpolation binding with 5 expressions.
14579
- */
14580
- function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
14581
- const bindingIndex = getBindingIndex();
14582
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14583
- different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
14584
- incrementBindingIndex(5);
14585
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14586
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
14587
- NO_CHANGE;
14588
- }
14589
- /**
14590
- * Creates an interpolation binding with 6 expressions.
14591
- */
14592
- function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
14593
- const bindingIndex = getBindingIndex();
14594
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14595
- different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
14596
- incrementBindingIndex(6);
14597
- return different ?
14598
- prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
14599
- renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
14600
- NO_CHANGE;
14601
- }
14602
- /**
14603
- * Creates an interpolation binding with 7 expressions.
14604
- */
14605
- function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
14606
- const bindingIndex = getBindingIndex();
14607
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14608
- different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
14609
- incrementBindingIndex(7);
14610
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14611
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14612
- renderStringify(v5) + i5 + renderStringify(v6) + suffix :
14613
- NO_CHANGE;
14614
- }
14615
- /**
14616
- * Creates an interpolation binding with 8 expressions.
14617
- */
14618
- function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
14619
- const bindingIndex = getBindingIndex();
14620
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
14621
- different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
14622
- incrementBindingIndex(8);
14623
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
14624
- renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
14625
- renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
14626
- NO_CHANGE;
14627
- }
14628
-
14629
- /**
14630
- *
14631
- * Update an interpolated attribute on an element with single bound value surrounded by text.
14041
+ * Update an interpolated attribute on an element with 5 bound values surrounded by text.
14632
14042
  *
14633
- * Used when the value passed to a property has 1 interpolated value in it:
14043
+ * Used when the value passed to a property has 5 interpolated values in it:
14634
14044
  *
14635
14045
  * ```html
14636
- * <div attr.title="prefix{{v0}}suffix"></div>
14046
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div>
14637
14047
  * ```
14638
14048
  *
14639
14049
  * Its compiled representation is::
14640
14050
  *
14641
14051
  * ```ts
14642
- * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix');
14052
+ * ɵɵattributeInterpolate5(
14053
+ * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix');
14643
14054
  * ```
14644
14055
  *
14645
14056
  * @param attrName The name of the attribute to update
14646
14057
  * @param prefix Static value used for concatenation only.
14647
14058
  * @param v0 Value checked for change.
14059
+ * @param i0 Static value used for concatenation only.
14060
+ * @param v1 Value checked for change.
14061
+ * @param i1 Static value used for concatenation only.
14062
+ * @param v2 Value checked for change.
14063
+ * @param i2 Static value used for concatenation only.
14064
+ * @param v3 Value checked for change.
14065
+ * @param i3 Static value used for concatenation only.
14066
+ * @param v4 Value checked for change.
14648
14067
  * @param suffix Static value used for concatenation only.
14649
14068
  * @param sanitizer An optional sanitizer function
14650
14069
  * @returns itself, so that it may be chained.
14651
14070
  * @codeGenApi
14652
14071
  */
14653
- function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
14072
+ function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
14654
14073
  const lView = getLView();
14655
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
14074
+ const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
14656
14075
  if (interpolatedValue !== NO_CHANGE) {
14657
14076
  const tNode = getSelectedTNode();
14658
14077
  elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14659
14078
  ngDevMode &&
14660
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
14079
+ storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
14661
14080
  }
14662
- return ɵɵattributeInterpolate1;
14081
+ return ɵɵattributeInterpolate5;
14663
14082
  }
14664
14083
  /**
14665
14084
  *
14666
- * Update an interpolated attribute on an element with 2 bound values surrounded by text.
14085
+ * Update an interpolated attribute on an element with 6 bound values surrounded by text.
14667
14086
  *
14668
- * Used when the value passed to a property has 2 interpolated values in it:
14087
+ * Used when the value passed to a property has 6 interpolated values in it:
14669
14088
  *
14670
14089
  * ```html
14671
- * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div>
14090
+ * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div>
14672
14091
  * ```
14673
14092
  *
14674
14093
  * Its compiled representation is::
14675
14094
  *
14676
14095
  * ```ts
14677
- * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix');
14678
- * ```
14679
- *
14680
- * @param attrName The name of the attribute to update
14681
- * @param prefix Static value used for concatenation only.
14682
- * @param v0 Value checked for change.
14683
- * @param i0 Static value used for concatenation only.
14684
- * @param v1 Value checked for change.
14685
- * @param suffix Static value used for concatenation only.
14686
- * @param sanitizer An optional sanitizer function
14687
- * @returns itself, so that it may be chained.
14688
- * @codeGenApi
14689
- */
14690
- function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
14691
- const lView = getLView();
14692
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
14693
- if (interpolatedValue !== NO_CHANGE) {
14694
- const tNode = getSelectedTNode();
14695
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14696
- ngDevMode &&
14697
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
14698
- }
14699
- return ɵɵattributeInterpolate2;
14700
- }
14701
- /**
14702
- *
14703
- * Update an interpolated attribute on an element with 3 bound values surrounded by text.
14704
- *
14705
- * Used when the value passed to a property has 3 interpolated values in it:
14706
- *
14707
- * ```html
14708
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div>
14709
- * ```
14710
- *
14711
- * Its compiled representation is::
14712
- *
14713
- * ```ts
14714
- * ɵɵattributeInterpolate3(
14715
- * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix');
14716
- * ```
14717
- *
14718
- * @param attrName The name of the attribute to update
14719
- * @param prefix Static value used for concatenation only.
14720
- * @param v0 Value checked for change.
14721
- * @param i0 Static value used for concatenation only.
14722
- * @param v1 Value checked for change.
14723
- * @param i1 Static value used for concatenation only.
14724
- * @param v2 Value checked for change.
14725
- * @param suffix Static value used for concatenation only.
14726
- * @param sanitizer An optional sanitizer function
14727
- * @returns itself, so that it may be chained.
14728
- * @codeGenApi
14729
- */
14730
- function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
14731
- const lView = getLView();
14732
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
14733
- if (interpolatedValue !== NO_CHANGE) {
14734
- const tNode = getSelectedTNode();
14735
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14736
- ngDevMode &&
14737
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
14738
- }
14739
- return ɵɵattributeInterpolate3;
14740
- }
14741
- /**
14742
- *
14743
- * Update an interpolated attribute on an element with 4 bound values surrounded by text.
14744
- *
14745
- * Used when the value passed to a property has 4 interpolated values in it:
14746
- *
14747
- * ```html
14748
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div>
14749
- * ```
14750
- *
14751
- * Its compiled representation is::
14752
- *
14753
- * ```ts
14754
- * ɵɵattributeInterpolate4(
14755
- * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix');
14756
- * ```
14757
- *
14758
- * @param attrName The name of the attribute to update
14759
- * @param prefix Static value used for concatenation only.
14760
- * @param v0 Value checked for change.
14761
- * @param i0 Static value used for concatenation only.
14762
- * @param v1 Value checked for change.
14763
- * @param i1 Static value used for concatenation only.
14764
- * @param v2 Value checked for change.
14765
- * @param i2 Static value used for concatenation only.
14766
- * @param v3 Value checked for change.
14767
- * @param suffix Static value used for concatenation only.
14768
- * @param sanitizer An optional sanitizer function
14769
- * @returns itself, so that it may be chained.
14770
- * @codeGenApi
14771
- */
14772
- function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
14773
- const lView = getLView();
14774
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
14775
- if (interpolatedValue !== NO_CHANGE) {
14776
- const tNode = getSelectedTNode();
14777
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14778
- ngDevMode &&
14779
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
14780
- }
14781
- return ɵɵattributeInterpolate4;
14782
- }
14783
- /**
14784
- *
14785
- * Update an interpolated attribute on an element with 5 bound values surrounded by text.
14786
- *
14787
- * Used when the value passed to a property has 5 interpolated values in it:
14788
- *
14789
- * ```html
14790
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div>
14791
- * ```
14792
- *
14793
- * Its compiled representation is::
14794
- *
14795
- * ```ts
14796
- * ɵɵattributeInterpolate5(
14797
- * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix');
14798
- * ```
14799
- *
14800
- * @param attrName The name of the attribute to update
14801
- * @param prefix Static value used for concatenation only.
14802
- * @param v0 Value checked for change.
14803
- * @param i0 Static value used for concatenation only.
14804
- * @param v1 Value checked for change.
14805
- * @param i1 Static value used for concatenation only.
14806
- * @param v2 Value checked for change.
14807
- * @param i2 Static value used for concatenation only.
14808
- * @param v3 Value checked for change.
14809
- * @param i3 Static value used for concatenation only.
14810
- * @param v4 Value checked for change.
14811
- * @param suffix Static value used for concatenation only.
14812
- * @param sanitizer An optional sanitizer function
14813
- * @returns itself, so that it may be chained.
14814
- * @codeGenApi
14815
- */
14816
- function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
14817
- const lView = getLView();
14818
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
14819
- if (interpolatedValue !== NO_CHANGE) {
14820
- const tNode = getSelectedTNode();
14821
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
14822
- ngDevMode &&
14823
- storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
14824
- }
14825
- return ɵɵattributeInterpolate5;
14826
- }
14827
- /**
14828
- *
14829
- * Update an interpolated attribute on an element with 6 bound values surrounded by text.
14830
- *
14831
- * Used when the value passed to a property has 6 interpolated values in it:
14832
- *
14833
- * ```html
14834
- * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div>
14835
- * ```
14836
- *
14837
- * Its compiled representation is::
14838
- *
14839
- * ```ts
14840
- * ɵɵattributeInterpolate6(
14841
- * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix');
14096
+ * ɵɵattributeInterpolate6(
14097
+ * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix');
14842
14098
  * ```
14843
14099
  *
14844
14100
  * @param attrName The name of the attribute to update
@@ -15011,6 +14267,57 @@ function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
15011
14267
  return ɵɵattributeInterpolateV;
15012
14268
  }
15013
14269
 
14270
+ /**
14271
+ * @license
14272
+ * Copyright Google LLC All Rights Reserved.
14273
+ *
14274
+ * Use of this source code is governed by an MIT-style license that can be
14275
+ * found in the LICENSE file at https://angular.io/license
14276
+ */
14277
+ /**
14278
+ * Synchronously perform change detection on a component (and possibly its sub-components).
14279
+ *
14280
+ * This function triggers change detection in a synchronous way on a component.
14281
+ *
14282
+ * @param component The component which the change detection should be performed on.
14283
+ */
14284
+ function detectChanges(component) {
14285
+ const view = getComponentViewByInstance(component);
14286
+ detectChangesInternal(view[TVIEW], view, component);
14287
+ }
14288
+ /**
14289
+ * Marks the component as dirty (needing change detection). Marking a component dirty will
14290
+ * schedule a change detection on it at some point in the future.
14291
+ *
14292
+ * Marking an already dirty component as dirty won't do anything. Only one outstanding change
14293
+ * detection can be scheduled per component tree.
14294
+ *
14295
+ * @param component Component to mark as dirty.
14296
+ */
14297
+ function markDirty(component) {
14298
+ ngDevMode && assertDefined(component, 'component');
14299
+ const rootView = markViewDirty(getComponentViewByInstance(component));
14300
+ ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
14301
+ scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
14302
+ }
14303
+ /**
14304
+ * Used to perform change detection on the whole application.
14305
+ *
14306
+ * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick`
14307
+ * executes lifecycle hooks and conditionally checks components based on their
14308
+ * `ChangeDetectionStrategy` and dirtiness.
14309
+ *
14310
+ * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally
14311
+ * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a
14312
+ * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can
14313
+ * be changed when calling `renderComponent` and providing the `scheduler` option.
14314
+ */
14315
+ function tick(component) {
14316
+ const rootView = getRootView(component);
14317
+ const rootContext = rootView[CONTEXT];
14318
+ tickRootContext(rootContext);
14319
+ }
14320
+
15014
14321
  /**
15015
14322
  * @license
15016
14323
  * Copyright Google LLC All Rights Reserved.
@@ -15555,51 +14862,42 @@ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
15555
14862
  tNode.index;
15556
14863
  // In order to match current behavior, native DOM event listeners must be added for all
15557
14864
  // events (including outputs).
15558
- if (isProceduralRenderer(renderer)) {
15559
- // There might be cases where multiple directives on the same element try to register an event
15560
- // handler function for the same event. In this situation we want to avoid registration of
15561
- // several native listeners as each registration would be intercepted by NgZone and
15562
- // trigger change detection. This would mean that a single user action would result in several
15563
- // change detections being invoked. To avoid this situation we want to have only one call to
15564
- // native handler registration (for the same element and same type of event).
15565
- //
15566
- // In order to have just one native event handler in presence of multiple handler functions,
15567
- // we just register a first handler function as a native event listener and then chain
15568
- // (coalesce) other handler functions on top of the first native handler function.
15569
- let existingListener = null;
15570
- // Please note that the coalescing described here doesn't happen for events specifying an
15571
- // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
15572
- // view engine.
15573
- // Also, we don't have to search for existing listeners is there are no directives
15574
- // matching on a given node as we can't register multiple event handlers for the same event in
15575
- // a template (this would mean having duplicate attributes).
15576
- if (!eventTargetResolver && isTNodeDirectiveHost) {
15577
- existingListener = findExistingListener(tView, lView, eventName, tNode.index);
15578
- }
15579
- if (existingListener !== null) {
15580
- // Attach a new listener to coalesced listeners list, maintaining the order in which
15581
- // listeners are registered. For performance reasons, we keep a reference to the last
15582
- // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
15583
- // the entire set each time we need to add a new listener.
15584
- const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
15585
- lastListenerFn.__ngNextListenerFn__ = listenerFn;
15586
- existingListener.__ngLastListenerFn__ = listenerFn;
15587
- processOutputs = false;
15588
- }
15589
- else {
15590
- listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
15591
- const cleanupFn = renderer.listen(target, eventName, listenerFn);
15592
- ngDevMode && ngDevMode.rendererAddEventListener++;
15593
- lCleanup.push(listenerFn, cleanupFn);
15594
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15595
- }
14865
+ // There might be cases where multiple directives on the same element try to register an event
14866
+ // handler function for the same event. In this situation we want to avoid registration of
14867
+ // several native listeners as each registration would be intercepted by NgZone and
14868
+ // trigger change detection. This would mean that a single user action would result in several
14869
+ // change detections being invoked. To avoid this situation we want to have only one call to
14870
+ // native handler registration (for the same element and same type of event).
14871
+ //
14872
+ // In order to have just one native event handler in presence of multiple handler functions,
14873
+ // we just register a first handler function as a native event listener and then chain
14874
+ // (coalesce) other handler functions on top of the first native handler function.
14875
+ let existingListener = null;
14876
+ // Please note that the coalescing described here doesn't happen for events specifying an
14877
+ // alternative target (ex. (document:click)) - this is to keep backward compatibility with the
14878
+ // view engine.
14879
+ // Also, we don't have to search for existing listeners is there are no directives
14880
+ // matching on a given node as we can't register multiple event handlers for the same event in
14881
+ // a template (this would mean having duplicate attributes).
14882
+ if (!eventTargetResolver && isTNodeDirectiveHost) {
14883
+ existingListener = findExistingListener(tView, lView, eventName, tNode.index);
14884
+ }
14885
+ if (existingListener !== null) {
14886
+ // Attach a new listener to coalesced listeners list, maintaining the order in which
14887
+ // listeners are registered. For performance reasons, we keep a reference to the last
14888
+ // listener in that list (in `__ngLastListenerFn__` field), so we can avoid going through
14889
+ // the entire set each time we need to add a new listener.
14890
+ const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
14891
+ lastListenerFn.__ngNextListenerFn__ = listenerFn;
14892
+ existingListener.__ngLastListenerFn__ = listenerFn;
14893
+ processOutputs = false;
15596
14894
  }
15597
14895
  else {
15598
- listenerFn = wrapListener(tNode, lView, context, listenerFn, true /** preventDefault */);
15599
- target.addEventListener(eventName, listenerFn, useCapture);
14896
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
14897
+ const cleanupFn = renderer.listen(target, eventName, listenerFn);
15600
14898
  ngDevMode && ngDevMode.rendererAddEventListener++;
15601
- lCleanup.push(listenerFn);
15602
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture);
14899
+ lCleanup.push(listenerFn, cleanupFn);
14900
+ tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
15603
14901
  }
15604
14902
  }
15605
14903
  else {
@@ -17673,7 +16971,7 @@ function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
17673
16971
  valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : undefined;
17674
16972
  }
17675
16973
  let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
17676
- key === prop ? valueAtLViewIndex : undefined;
16974
+ (key === prop ? valueAtLViewIndex : undefined);
17677
16975
  if (containsStatics && !isStylingValuePresent(currentValue)) {
17678
16976
  currentValue = keyValueArrayGet(rawKey, prop);
17679
16977
  }
@@ -19196,7 +18494,7 @@ function findLocaleData(locale) {
19196
18494
  if (parentLocale === 'en') {
19197
18495
  return localeEn;
19198
18496
  }
19199
- throw new Error(`Missing locale data for the locale "${locale}".`);
18497
+ throw new RuntimeError(701 /* RuntimeErrorCode.MISSING_LOCALE_DATA */, ngDevMode && `Missing locale data for the locale "${locale}".`);
19200
18498
  }
19201
18499
  /**
19202
18500
  * Retrieves the default currency code for the given locale.
@@ -21526,7 +20824,7 @@ function noComponentFactoryError(component) {
21526
20824
  return error;
21527
20825
  }
21528
20826
  const ERROR_COMPONENT = 'ngComponent';
21529
- function getComponent(error) {
20827
+ function getComponent$1(error) {
21530
20828
  return error[ERROR_COMPONENT];
21531
20829
  }
21532
20830
  class _NullComponentFactoryResolver {
@@ -21710,14 +21008,6 @@ class Renderer2 {
21710
21008
  * @nocollapse
21711
21009
  */
21712
21010
  Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
21713
- /** Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) */
21714
- function getOrCreateRenderer2(lView) {
21715
- const renderer = lView[RENDERER];
21716
- if (ngDevMode && !isProceduralRenderer(renderer)) {
21717
- throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
21718
- }
21719
- return renderer;
21720
- }
21721
21011
  /** Injects a Renderer2 for the current component. */
21722
21012
  function injectRenderer2() {
21723
21013
  // We need the Renderer to be based on the component that it's being injected into, however since
@@ -21725,7 +21015,7 @@ function injectRenderer2() {
21725
21015
  const lView = getLView();
21726
21016
  const tNode = getCurrentTNode();
21727
21017
  const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
21728
- return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
21018
+ return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
21729
21019
  }
21730
21020
 
21731
21021
  /**
@@ -21772,7 +21062,7 @@ class Version {
21772
21062
  /**
21773
21063
  * @publicApi
21774
21064
  */
21775
- const VERSION = new Version('14.0.2');
21065
+ const VERSION = new Version('14.0.5');
21776
21066
 
21777
21067
  /**
21778
21068
  * @license
@@ -22110,8 +21400,7 @@ class ViewRef$1 {
22110
21400
  }
22111
21401
  attachToViewContainerRef() {
22112
21402
  if (this._appRef) {
22113
- const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
22114
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
21403
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
22115
21404
  }
22116
21405
  this._attachedToViewContainer = true;
22117
21406
  }
@@ -22121,8 +21410,7 @@ class ViewRef$1 {
22121
21410
  }
22122
21411
  attachToAppRef(appRef) {
22123
21412
  if (this._attachedToViewContainer) {
22124
- const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
22125
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
21413
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
22126
21414
  }
22127
21415
  this._appRef = appRef;
22128
21416
  }
@@ -22153,367 +21441,783 @@ class RootViewRef extends ViewRef$1 {
22153
21441
  * Use of this source code is governed by an MIT-style license that can be
22154
21442
  * found in the LICENSE file at https://angular.io/license
22155
21443
  */
22156
- class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
22157
- /**
22158
- * @param ngModule The NgModuleRef to which all resolved factories are bound.
22159
- */
22160
- constructor(ngModule) {
22161
- super();
22162
- this.ngModule = ngModule;
22163
- }
22164
- resolveComponentFactory(component) {
22165
- ngDevMode && assertComponentType(component);
22166
- const componentDef = getComponentDef(component);
22167
- return new ComponentFactory(componentDef, this.ngModule);
22168
- }
22169
- }
22170
- function toRefArray(map) {
22171
- const array = [];
22172
- for (let nonMinified in map) {
22173
- if (map.hasOwnProperty(nonMinified)) {
22174
- const minified = map[nonMinified];
22175
- array.push({ propName: minified, templateName: nonMinified });
21444
+ class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
21445
+ /**
21446
+ * @param ngModule The NgModuleRef to which all resolved factories are bound.
21447
+ */
21448
+ constructor(ngModule) {
21449
+ super();
21450
+ this.ngModule = ngModule;
21451
+ }
21452
+ resolveComponentFactory(component) {
21453
+ ngDevMode && assertComponentType(component);
21454
+ const componentDef = getComponentDef(component);
21455
+ return new ComponentFactory(componentDef, this.ngModule);
21456
+ }
21457
+ }
21458
+ function toRefArray(map) {
21459
+ const array = [];
21460
+ for (let nonMinified in map) {
21461
+ if (map.hasOwnProperty(nonMinified)) {
21462
+ const minified = map[nonMinified];
21463
+ array.push({ propName: minified, templateName: nonMinified });
21464
+ }
21465
+ }
21466
+ return array;
21467
+ }
21468
+ function getNamespace(elementName) {
21469
+ const name = elementName.toLowerCase();
21470
+ return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21471
+ }
21472
+ /**
21473
+ * Injector that looks up a value using a specific injector, before falling back to the module
21474
+ * injector. Used primarily when creating components or embedded views dynamically.
21475
+ */
21476
+ class ChainedInjector {
21477
+ constructor(injector, parentInjector) {
21478
+ this.injector = injector;
21479
+ this.parentInjector = parentInjector;
21480
+ }
21481
+ get(token, notFoundValue, flags) {
21482
+ const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21483
+ if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21484
+ notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21485
+ // Return the value from the root element injector when
21486
+ // - it provides it
21487
+ // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21488
+ // - the module injector should not be checked
21489
+ // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21490
+ return value;
21491
+ }
21492
+ return this.parentInjector.get(token, notFoundValue, flags);
21493
+ }
21494
+ }
21495
+ /**
21496
+ * Render3 implementation of {@link viewEngine_ComponentFactory}.
21497
+ */
21498
+ class ComponentFactory extends ComponentFactory$1 {
21499
+ /**
21500
+ * @param componentDef The component definition.
21501
+ * @param ngModule The NgModuleRef to which the factory is bound.
21502
+ */
21503
+ constructor(componentDef, ngModule) {
21504
+ super();
21505
+ this.componentDef = componentDef;
21506
+ this.ngModule = ngModule;
21507
+ this.componentType = componentDef.type;
21508
+ this.selector = stringifyCSSSelectorList(componentDef.selectors);
21509
+ this.ngContentSelectors =
21510
+ componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
21511
+ this.isBoundToModule = !!ngModule;
21512
+ }
21513
+ get inputs() {
21514
+ return toRefArray(this.componentDef.inputs);
21515
+ }
21516
+ get outputs() {
21517
+ return toRefArray(this.componentDef.outputs);
21518
+ }
21519
+ create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
21520
+ environmentInjector = environmentInjector || this.ngModule;
21521
+ let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
21522
+ environmentInjector :
21523
+ environmentInjector === null || environmentInjector === void 0 ? void 0 : environmentInjector.injector;
21524
+ if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
21525
+ realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
21526
+ realEnvironmentInjector;
21527
+ }
21528
+ const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
21529
+ const rendererFactory = rootViewInjector.get(RendererFactory2, null);
21530
+ if (rendererFactory === null) {
21531
+ throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
21532
+ 'Angular was not able to inject a renderer (RendererFactory2). ' +
21533
+ 'Likely this is due to a broken DI hierarchy. ' +
21534
+ 'Make sure that any injector used to create this component has a correct parent.');
21535
+ }
21536
+ const sanitizer = rootViewInjector.get(Sanitizer, null);
21537
+ const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
21538
+ // Determine a tag name used for creating host elements when this component is created
21539
+ // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
21540
+ const elementName = this.componentDef.selectors[0][0] || 'div';
21541
+ const hostRNode = rootSelectorOrNode ?
21542
+ locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
21543
+ createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
21544
+ const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
21545
+ 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
21546
+ const rootContext = createRootContext();
21547
+ // Create the root view. Uses empty TView and ContentTemplate.
21548
+ const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
21549
+ const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
21550
+ // rootView is the parent when bootstrapping
21551
+ // TODO(misko): it looks like we are entering view here but we don't really need to as
21552
+ // `renderView` does that. However as the code is written it is needed because
21553
+ // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
21554
+ // issues would allow us to drop this.
21555
+ enterView(rootLView);
21556
+ let component;
21557
+ let tElementNode;
21558
+ try {
21559
+ const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
21560
+ if (hostRNode) {
21561
+ if (rootSelectorOrNode) {
21562
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
21563
+ }
21564
+ else {
21565
+ // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
21566
+ // is not defined), also apply attributes and classes extracted from component selector.
21567
+ // Extract attributes and classes from the first selector only to match VE behavior.
21568
+ const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
21569
+ if (attrs) {
21570
+ setUpAttributes(hostRenderer, hostRNode, attrs);
21571
+ }
21572
+ if (classes && classes.length > 0) {
21573
+ writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
21574
+ }
21575
+ }
21576
+ }
21577
+ tElementNode = getTNode(rootTView, HEADER_OFFSET);
21578
+ if (projectableNodes !== undefined) {
21579
+ const projection = tElementNode.projection = [];
21580
+ for (let i = 0; i < this.ngContentSelectors.length; i++) {
21581
+ const nodesforSlot = projectableNodes[i];
21582
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
21583
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
21584
+ // complex checks down the line.
21585
+ // We also normalize the length of the passed in projectable nodes (to match the number of
21586
+ // <ng-container> slots defined by a component).
21587
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
21588
+ }
21589
+ }
21590
+ // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
21591
+ // executed here?
21592
+ // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
21593
+ component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
21594
+ renderView(rootTView, rootLView, null);
21595
+ }
21596
+ finally {
21597
+ leaveView();
21598
+ }
21599
+ return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21600
+ }
21601
+ }
21602
+ const componentFactoryResolver = new ComponentFactoryResolver();
21603
+ /**
21604
+ * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
21605
+ * ComponentFactoryResolver
21606
+ * already exists, retrieves the existing ComponentFactoryResolver.
21607
+ *
21608
+ * @returns The ComponentFactoryResolver instance to use
21609
+ */
21610
+ function injectComponentFactoryResolver() {
21611
+ return componentFactoryResolver;
21612
+ }
21613
+ /**
21614
+ * Represents an instance of a Component created via a {@link ComponentFactory}.
21615
+ *
21616
+ * `ComponentRef` provides access to the Component Instance as well other objects related to this
21617
+ * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
21618
+ * method.
21619
+ *
21620
+ */
21621
+ class ComponentRef extends ComponentRef$1 {
21622
+ constructor(componentType, instance, location, _rootLView, _tNode) {
21623
+ super();
21624
+ this.location = location;
21625
+ this._rootLView = _rootLView;
21626
+ this._tNode = _tNode;
21627
+ this.instance = instance;
21628
+ this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
21629
+ this.componentType = componentType;
21630
+ }
21631
+ get injector() {
21632
+ return new NodeInjector(this._tNode, this._rootLView);
21633
+ }
21634
+ destroy() {
21635
+ this.hostView.destroy();
21636
+ }
21637
+ onDestroy(callback) {
21638
+ this.hostView.onDestroy(callback);
21639
+ }
21640
+ }
21641
+
21642
+ /**
21643
+ * @license
21644
+ * Copyright Google LLC All Rights Reserved.
21645
+ *
21646
+ * Use of this source code is governed by an MIT-style license that can be
21647
+ * found in the LICENSE file at https://angular.io/license
21648
+ */
21649
+ /**
21650
+ * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
21651
+ * @param ngModule NgModule class.
21652
+ * @param parentInjector Optional injector instance to use as a parent for the module injector. If
21653
+ * not provided, `NullInjector` will be used instead.
21654
+ * @publicApi
21655
+ */
21656
+ function createNgModuleRef(ngModule, parentInjector) {
21657
+ return new NgModuleRef(ngModule, parentInjector !== null && parentInjector !== void 0 ? parentInjector : null);
21658
+ }
21659
+ class NgModuleRef extends NgModuleRef$1 {
21660
+ constructor(ngModuleType, _parent) {
21661
+ super();
21662
+ this._parent = _parent;
21663
+ // tslint:disable-next-line:require-internal-with-underscore
21664
+ this._bootstrapComponents = [];
21665
+ this.injector = this;
21666
+ this.destroyCbs = [];
21667
+ // When bootstrapping a module we have a dependency graph that looks like this:
21668
+ // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
21669
+ // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
21670
+ // circular dependency which will result in a runtime error, because the injector doesn't
21671
+ // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
21672
+ // and providing it, rather than letting the injector resolve it.
21673
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21674
+ const ngModuleDef = getNgModuleDef(ngModuleType);
21675
+ ngDevMode &&
21676
+ assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
21677
+ this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
21678
+ this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
21679
+ { provide: NgModuleRef$1, useValue: this }, {
21680
+ provide: ComponentFactoryResolver$1,
21681
+ useValue: this.componentFactoryResolver
21682
+ }
21683
+ ], stringify(ngModuleType), new Set(['environment']));
21684
+ // We need to resolve the injector types separately from the injector creation, because
21685
+ // the module might be trying to use this ref in its constructor for DI which will cause a
21686
+ // circular error that will eventually error out, because the injector isn't created yet.
21687
+ this._r3Injector.resolveInjectorInitializers();
21688
+ this.instance = this.get(ngModuleType);
21689
+ }
21690
+ get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
21691
+ if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
21692
+ return this;
21693
+ }
21694
+ return this._r3Injector.get(token, notFoundValue, injectFlags);
21695
+ }
21696
+ destroy() {
21697
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21698
+ const injector = this._r3Injector;
21699
+ !injector.destroyed && injector.destroy();
21700
+ this.destroyCbs.forEach(fn => fn());
21701
+ this.destroyCbs = null;
21702
+ }
21703
+ onDestroy(callback) {
21704
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
21705
+ this.destroyCbs.push(callback);
21706
+ }
21707
+ }
21708
+ class NgModuleFactory extends NgModuleFactory$1 {
21709
+ constructor(moduleType) {
21710
+ super();
21711
+ this.moduleType = moduleType;
21712
+ }
21713
+ create(parentInjector) {
21714
+ return new NgModuleRef(this.moduleType, parentInjector);
21715
+ }
21716
+ }
21717
+ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
21718
+ constructor(providers, parent, source) {
21719
+ super();
21720
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
21721
+ this.instance = null;
21722
+ const injector = new R3Injector([
21723
+ ...providers,
21724
+ { provide: NgModuleRef$1, useValue: this },
21725
+ { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
21726
+ ], parent || getNullInjector(), source, new Set(['environment']));
21727
+ this.injector = injector;
21728
+ injector.resolveInjectorInitializers();
21729
+ }
21730
+ destroy() {
21731
+ this.injector.destroy();
21732
+ }
21733
+ onDestroy(callback) {
21734
+ this.injector.onDestroy(callback);
21735
+ }
21736
+ }
21737
+ /**
21738
+ * Create a new environment injector.
21739
+ *
21740
+ * @publicApi
21741
+ * @developerPreview
21742
+ */
21743
+ function createEnvironmentInjector(providers, parent = null, debugName = null) {
21744
+ const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
21745
+ return adapter.injector;
21746
+ }
21747
+
21748
+ /**
21749
+ * @license
21750
+ * Copyright Google LLC All Rights Reserved.
21751
+ *
21752
+ * Use of this source code is governed by an MIT-style license that can be
21753
+ * found in the LICENSE file at https://angular.io/license
21754
+ */
21755
+ /**
21756
+ * A service used by the framework to create instances of standalone injectors. Those injectors are
21757
+ * created on demand in case of dynamic component instantiation and contain ambient providers
21758
+ * collected from the imports graph rooted at a given standalone component.
21759
+ */
21760
+ class StandaloneService {
21761
+ constructor(_injector) {
21762
+ this._injector = _injector;
21763
+ this.cachedInjectors = new Map();
21764
+ }
21765
+ getOrCreateStandaloneInjector(componentDef) {
21766
+ if (!componentDef.standalone) {
21767
+ return null;
21768
+ }
21769
+ if (!this.cachedInjectors.has(componentDef.id)) {
21770
+ const providers = internalImportProvidersFrom(false, componentDef.type);
21771
+ const standaloneInjector = providers.length > 0 ?
21772
+ createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
21773
+ null;
21774
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
21775
+ }
21776
+ return this.cachedInjectors.get(componentDef.id);
21777
+ }
21778
+ ngOnDestroy() {
21779
+ try {
21780
+ for (const injector of this.cachedInjectors.values()) {
21781
+ if (injector !== null) {
21782
+ injector.destroy();
21783
+ }
21784
+ }
21785
+ }
21786
+ finally {
21787
+ this.cachedInjectors.clear();
21788
+ }
21789
+ }
21790
+ }
21791
+ /** @nocollapse */
21792
+ StandaloneService.ɵprov = ɵɵdefineInjectable({
21793
+ token: StandaloneService,
21794
+ providedIn: 'environment',
21795
+ factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
21796
+ });
21797
+ /**
21798
+ * A feature that acts as a setup code for the {@link StandaloneService}.
21799
+ *
21800
+ * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
21801
+ * function (an entry points to a standalone injector creation) on a component definition object. We
21802
+ * go through the features infrastructure to make sure that the standalone injector creation logic
21803
+ * is tree-shakable and not included in applications that don't use standalone components.
21804
+ *
21805
+ * @codeGenApi
21806
+ */
21807
+ function ɵɵStandaloneFeature(definition) {
21808
+ definition.getStandaloneInjector = (parentInjector) => {
21809
+ return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
21810
+ };
21811
+ }
21812
+
21813
+ /**
21814
+ * @license
21815
+ * Copyright Google LLC All Rights Reserved.
21816
+ *
21817
+ * Use of this source code is governed by an MIT-style license that can be
21818
+ * found in the LICENSE file at https://angular.io/license
21819
+ */
21820
+ /**
21821
+ * Retrieves the component instance associated with a given DOM element.
21822
+ *
21823
+ * @usageNotes
21824
+ * Given the following DOM structure:
21825
+ *
21826
+ * ```html
21827
+ * <app-root>
21828
+ * <div>
21829
+ * <child-comp></child-comp>
21830
+ * </div>
21831
+ * </app-root>
21832
+ * ```
21833
+ *
21834
+ * Calling `getComponent` on `<child-comp>` will return the instance of `ChildComponent`
21835
+ * associated with this DOM element.
21836
+ *
21837
+ * Calling the function on `<app-root>` will return the `MyApp` instance.
21838
+ *
21839
+ *
21840
+ * @param element DOM element from which the component should be retrieved.
21841
+ * @returns Component instance associated with the element or `null` if there
21842
+ * is no component associated with it.
21843
+ *
21844
+ * @publicApi
21845
+ * @globalApi ng
21846
+ */
21847
+ function getComponent(element) {
21848
+ ngDevMode && assertDomElement(element);
21849
+ const context = getLContext(element);
21850
+ if (context === null)
21851
+ return null;
21852
+ if (context.component === undefined) {
21853
+ const lView = context.lView;
21854
+ if (lView === null) {
21855
+ return null;
22176
21856
  }
21857
+ context.component = getComponentAtNodeIndex(context.nodeIndex, lView);
22177
21858
  }
22178
- return array;
21859
+ return context.component;
22179
21860
  }
22180
- function getNamespace(elementName) {
22181
- const name = elementName.toLowerCase();
22182
- return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
21861
+ /**
21862
+ * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded
21863
+ * view that the element is part of. Otherwise retrieves the instance of the component whose view
21864
+ * owns the element (in this case, the result is the same as calling `getOwningComponent`).
21865
+ *
21866
+ * @param element Element for which to get the surrounding component instance.
21867
+ * @returns Instance of the component that is around the element or null if the element isn't
21868
+ * inside any component.
21869
+ *
21870
+ * @publicApi
21871
+ * @globalApi ng
21872
+ */
21873
+ function getContext(element) {
21874
+ assertDomElement(element);
21875
+ const context = getLContext(element);
21876
+ const lView = context ? context.lView : null;
21877
+ return lView === null ? null : lView[CONTEXT];
22183
21878
  }
22184
21879
  /**
22185
- * Injector that looks up a value using a specific injector, before falling back to the module
22186
- * injector. Used primarily when creating components or embedded views dynamically.
21880
+ * Retrieves the component instance whose view contains the DOM element.
21881
+ *
21882
+ * For example, if `<child-comp>` is used in the template of `<app-comp>`
21883
+ * (i.e. a `ViewChild` of `<app-comp>`), calling `getOwningComponent` on `<child-comp>`
21884
+ * would return `<app-comp>`.
21885
+ *
21886
+ * @param elementOrDir DOM element, component or directive instance
21887
+ * for which to retrieve the root components.
21888
+ * @returns Component instance whose view owns the DOM element or null if the element is not
21889
+ * part of a component view.
21890
+ *
21891
+ * @publicApi
21892
+ * @globalApi ng
22187
21893
  */
22188
- class ChainedInjector {
22189
- constructor(injector, parentInjector) {
22190
- this.injector = injector;
22191
- this.parentInjector = parentInjector;
22192
- }
22193
- get(token, notFoundValue, flags) {
22194
- const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
22195
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
22196
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
22197
- // Return the value from the root element injector when
22198
- // - it provides it
22199
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22200
- // - the module injector should not be checked
22201
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
22202
- return value;
22203
- }
22204
- return this.parentInjector.get(token, notFoundValue, flags);
21894
+ function getOwningComponent(elementOrDir) {
21895
+ const context = getLContext(elementOrDir);
21896
+ let lView = context ? context.lView : null;
21897
+ if (lView === null)
21898
+ return null;
21899
+ let parent;
21900
+ while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
21901
+ lView = parent;
22205
21902
  }
21903
+ return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
22206
21904
  }
22207
21905
  /**
22208
- * Render3 implementation of {@link viewEngine_ComponentFactory}.
21906
+ * Retrieves all root components associated with a DOM element, directive or component instance.
21907
+ * Root components are those which have been bootstrapped by Angular.
21908
+ *
21909
+ * @param elementOrDir DOM element, component or directive instance
21910
+ * for which to retrieve the root components.
21911
+ * @returns Root components associated with the target object.
21912
+ *
21913
+ * @publicApi
21914
+ * @globalApi ng
22209
21915
  */
22210
- class ComponentFactory extends ComponentFactory$1 {
22211
- /**
22212
- * @param componentDef The component definition.
22213
- * @param ngModule The NgModuleRef to which the factory is bound.
22214
- */
22215
- constructor(componentDef, ngModule) {
22216
- super();
22217
- this.componentDef = componentDef;
22218
- this.ngModule = ngModule;
22219
- this.componentType = componentDef.type;
22220
- this.selector = stringifyCSSSelectorList(componentDef.selectors);
22221
- this.ngContentSelectors =
22222
- componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
22223
- this.isBoundToModule = !!ngModule;
22224
- }
22225
- get inputs() {
22226
- return toRefArray(this.componentDef.inputs);
22227
- }
22228
- get outputs() {
22229
- return toRefArray(this.componentDef.outputs);
22230
- }
22231
- create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
22232
- environmentInjector = environmentInjector || this.ngModule;
22233
- let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ?
22234
- environmentInjector :
22235
- environmentInjector === null || environmentInjector === void 0 ? void 0 : environmentInjector.injector;
22236
- if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
22237
- realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
22238
- realEnvironmentInjector;
22239
- }
22240
- const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
22241
- const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
22242
- const sanitizer = rootViewInjector.get(Sanitizer, null);
22243
- const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
22244
- // Determine a tag name used for creating host elements when this component is created
22245
- // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
22246
- const elementName = this.componentDef.selectors[0][0] || 'div';
22247
- const hostRNode = rootSelectorOrNode ?
22248
- locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
22249
- createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
22250
- const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
22251
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
22252
- const rootContext = createRootContext();
22253
- // Create the root view. Uses empty TView and ContentTemplate.
22254
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
22255
- const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
22256
- // rootView is the parent when bootstrapping
22257
- // TODO(misko): it looks like we are entering view here but we don't really need to as
22258
- // `renderView` does that. However as the code is written it is needed because
22259
- // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
22260
- // issues would allow us to drop this.
22261
- enterView(rootLView);
22262
- let component;
22263
- let tElementNode;
22264
- try {
22265
- const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
22266
- if (hostRNode) {
22267
- if (rootSelectorOrNode) {
22268
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
22269
- }
22270
- else {
22271
- // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
22272
- // is not defined), also apply attributes and classes extracted from component selector.
22273
- // Extract attributes and classes from the first selector only to match VE behavior.
22274
- const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
22275
- if (attrs) {
22276
- setUpAttributes(hostRenderer, hostRNode, attrs);
22277
- }
22278
- if (classes && classes.length > 0) {
22279
- writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
22280
- }
22281
- }
22282
- }
22283
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
22284
- if (projectableNodes !== undefined) {
22285
- const projection = tElementNode.projection = [];
22286
- for (let i = 0; i < this.ngContentSelectors.length; i++) {
22287
- const nodesforSlot = projectableNodes[i];
22288
- // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
22289
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
22290
- // complex checks down the line.
22291
- // We also normalize the length of the passed in projectable nodes (to match the number of
22292
- // <ng-container> slots defined by a component).
22293
- projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
22294
- }
22295
- }
22296
- // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
22297
- // executed here?
22298
- // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
22299
- component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
22300
- renderView(rootTView, rootLView, null);
22301
- }
22302
- finally {
22303
- leaveView();
21916
+ function getRootComponents(elementOrDir) {
21917
+ const lView = readPatchedLView(elementOrDir);
21918
+ return lView !== null ? [...getRootContext(lView).components] : [];
21919
+ }
21920
+ /**
21921
+ * Retrieves an `Injector` associated with an element, component or directive instance.
21922
+ *
21923
+ * @param elementOrDir DOM element, component or directive instance for which to
21924
+ * retrieve the injector.
21925
+ * @returns Injector associated with the element, component or directive instance.
21926
+ *
21927
+ * @publicApi
21928
+ * @globalApi ng
21929
+ */
21930
+ function getInjector(elementOrDir) {
21931
+ const context = getLContext(elementOrDir);
21932
+ const lView = context ? context.lView : null;
21933
+ if (lView === null)
21934
+ return Injector.NULL;
21935
+ const tNode = lView[TVIEW].data[context.nodeIndex];
21936
+ return new NodeInjector(tNode, lView);
21937
+ }
21938
+ /**
21939
+ * Retrieve a set of injection tokens at a given DOM node.
21940
+ *
21941
+ * @param element Element for which the injection tokens should be retrieved.
21942
+ */
21943
+ function getInjectionTokens(element) {
21944
+ const context = getLContext(element);
21945
+ const lView = context ? context.lView : null;
21946
+ if (lView === null)
21947
+ return [];
21948
+ const tView = lView[TVIEW];
21949
+ const tNode = tView.data[context.nodeIndex];
21950
+ const providerTokens = [];
21951
+ const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
21952
+ const endIndex = tNode.directiveEnd;
21953
+ for (let i = startIndex; i < endIndex; i++) {
21954
+ let value = tView.data[i];
21955
+ if (isDirectiveDefHack(value)) {
21956
+ // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a
21957
+ // design flaw. We should always store same type so that we can be monomorphic. The issue
21958
+ // is that for Components/Directives we store the def instead the type. The correct behavior
21959
+ // is that we should always be storing injectable type in this location.
21960
+ value = value.type;
22304
21961
  }
22305
- return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
21962
+ providerTokens.push(value);
22306
21963
  }
21964
+ return providerTokens;
22307
21965
  }
22308
- const componentFactoryResolver = new ComponentFactoryResolver();
22309
21966
  /**
22310
- * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
22311
- * ComponentFactoryResolver
22312
- * already exists, retrieves the existing ComponentFactoryResolver.
21967
+ * Retrieves directive instances associated with a given DOM node. Does not include
21968
+ * component instances.
22313
21969
  *
22314
- * @returns The ComponentFactoryResolver instance to use
21970
+ * @usageNotes
21971
+ * Given the following DOM structure:
21972
+ *
21973
+ * ```html
21974
+ * <app-root>
21975
+ * <button my-button></button>
21976
+ * <my-comp></my-comp>
21977
+ * </app-root>
21978
+ * ```
21979
+ *
21980
+ * Calling `getDirectives` on `<button>` will return an array with an instance of the `MyButton`
21981
+ * directive that is associated with the DOM node.
21982
+ *
21983
+ * Calling `getDirectives` on `<my-comp>` will return an empty array.
21984
+ *
21985
+ * @param node DOM node for which to get the directives.
21986
+ * @returns Array of directives associated with the node.
21987
+ *
21988
+ * @publicApi
21989
+ * @globalApi ng
22315
21990
  */
22316
- function injectComponentFactoryResolver() {
22317
- return componentFactoryResolver;
21991
+ function getDirectives(node) {
21992
+ // Skip text nodes because we can't have directives associated with them.
21993
+ if (node instanceof Text) {
21994
+ return [];
21995
+ }
21996
+ const context = getLContext(node);
21997
+ const lView = context ? context.lView : null;
21998
+ if (lView === null) {
21999
+ return [];
22000
+ }
22001
+ const tView = lView[TVIEW];
22002
+ const nodeIndex = context.nodeIndex;
22003
+ if (!(tView === null || tView === void 0 ? void 0 : tView.data[nodeIndex])) {
22004
+ return [];
22005
+ }
22006
+ if (context.directives === undefined) {
22007
+ context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
22008
+ }
22009
+ // The `directives` in this case are a named array called `LComponentView`. Clone the
22010
+ // result so we don't expose an internal data structure in the user's console.
22011
+ return context.directives === null ? [] : [...context.directives];
22318
22012
  }
22319
22013
  /**
22320
- * Represents an instance of a Component created via a {@link ComponentFactory}.
22014
+ * Returns the debug (partial) metadata for a particular directive or component instance.
22015
+ * The function accepts an instance of a directive or component and returns the corresponding
22016
+ * metadata.
22321
22017
  *
22322
- * `ComponentRef` provides access to the Component Instance as well other objects related to this
22323
- * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
22324
- * method.
22018
+ * @param directiveOrComponentInstance Instance of a directive or component
22019
+ * @returns metadata of the passed directive or component
22325
22020
  *
22021
+ * @publicApi
22022
+ * @globalApi ng
22326
22023
  */
22327
- class ComponentRef extends ComponentRef$1 {
22328
- constructor(componentType, instance, location, _rootLView, _tNode) {
22329
- super();
22330
- this.location = location;
22331
- this._rootLView = _rootLView;
22332
- this._tNode = _tNode;
22333
- this.instance = instance;
22334
- this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
22335
- this.componentType = componentType;
22336
- }
22337
- get injector() {
22338
- return new NodeInjector(this._tNode, this._rootLView);
22024
+ function getDirectiveMetadata$1(directiveOrComponentInstance) {
22025
+ const { constructor } = directiveOrComponentInstance;
22026
+ if (!constructor) {
22027
+ throw new Error('Unable to find the instance constructor');
22339
22028
  }
22340
- destroy() {
22341
- this.hostView.destroy();
22029
+ // In case a component inherits from a directive, we may have component and directive metadata
22030
+ // To ensure we don't get the metadata of the directive, we want to call `getComponentDef` first.
22031
+ const componentDef = getComponentDef(constructor);
22032
+ if (componentDef) {
22033
+ return {
22034
+ inputs: componentDef.inputs,
22035
+ outputs: componentDef.outputs,
22036
+ encapsulation: componentDef.encapsulation,
22037
+ changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
22038
+ ChangeDetectionStrategy.Default
22039
+ };
22342
22040
  }
22343
- onDestroy(callback) {
22344
- this.hostView.onDestroy(callback);
22041
+ const directiveDef = getDirectiveDef(constructor);
22042
+ if (directiveDef) {
22043
+ return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
22345
22044
  }
22045
+ return null;
22346
22046
  }
22347
-
22348
22047
  /**
22349
- * @license
22350
- * Copyright Google LLC All Rights Reserved.
22048
+ * Retrieve map of local references.
22351
22049
  *
22352
- * Use of this source code is governed by an MIT-style license that can be
22353
- * found in the LICENSE file at https://angular.io/license
22050
+ * The references are retrieved as a map of local reference name to element or directive instance.
22051
+ *
22052
+ * @param target DOM element, component or directive instance for which to retrieve
22053
+ * the local references.
22354
22054
  */
22055
+ function getLocalRefs(target) {
22056
+ const context = getLContext(target);
22057
+ if (context === null)
22058
+ return {};
22059
+ if (context.localRefs === undefined) {
22060
+ const lView = context.lView;
22061
+ if (lView === null) {
22062
+ return {};
22063
+ }
22064
+ context.localRefs = discoverLocalRefs(lView, context.nodeIndex);
22065
+ }
22066
+ return context.localRefs || {};
22067
+ }
22355
22068
  /**
22356
- * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
22357
- * @param ngModule NgModule class.
22358
- * @param parentInjector Optional injector instance to use as a parent for the module injector. If
22359
- * not provided, `NullInjector` will be used instead.
22069
+ * Retrieves the host element of a component or directive instance.
22070
+ * The host element is the DOM element that matched the selector of the directive.
22071
+ *
22072
+ * @param componentOrDirective Component or directive instance for which the host
22073
+ * element should be retrieved.
22074
+ * @returns Host element of the target.
22075
+ *
22360
22076
  * @publicApi
22077
+ * @globalApi ng
22361
22078
  */
22362
- function createNgModuleRef(ngModule, parentInjector) {
22363
- return new NgModuleRef(ngModule, parentInjector !== null && parentInjector !== void 0 ? parentInjector : null);
22079
+ function getHostElement(componentOrDirective) {
22080
+ return getLContext(componentOrDirective).native;
22364
22081
  }
22365
- class NgModuleRef extends NgModuleRef$1 {
22366
- constructor(ngModuleType, _parent) {
22367
- super();
22368
- this._parent = _parent;
22369
- // tslint:disable-next-line:require-internal-with-underscore
22370
- this._bootstrapComponents = [];
22371
- this.injector = this;
22372
- this.destroyCbs = [];
22373
- // When bootstrapping a module we have a dependency graph that looks like this:
22374
- // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
22375
- // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
22376
- // circular dependency which will result in a runtime error, because the injector doesn't
22377
- // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
22378
- // and providing it, rather than letting the injector resolve it.
22379
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22380
- const ngModuleDef = getNgModuleDef(ngModuleType);
22381
- ngDevMode &&
22382
- assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
22383
- this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
22384
- this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
22385
- { provide: NgModuleRef$1, useValue: this }, {
22386
- provide: ComponentFactoryResolver$1,
22387
- useValue: this.componentFactoryResolver
22082
+ /**
22083
+ * Retrieves the rendered text for a given component.
22084
+ *
22085
+ * This function retrieves the host element of a component and
22086
+ * and then returns the `textContent` for that element. This implies
22087
+ * that the text returned will include re-projected content of
22088
+ * the component as well.
22089
+ *
22090
+ * @param component The component to return the content text for.
22091
+ */
22092
+ function getRenderedText(component) {
22093
+ const hostElement = getHostElement(component);
22094
+ return hostElement.textContent || '';
22095
+ }
22096
+ /**
22097
+ * Retrieves a list of event listeners associated with a DOM element. The list does include host
22098
+ * listeners, but it does not include event listeners defined outside of the Angular context
22099
+ * (e.g. through `addEventListener`).
22100
+ *
22101
+ * @usageNotes
22102
+ * Given the following DOM structure:
22103
+ *
22104
+ * ```html
22105
+ * <app-root>
22106
+ * <div (click)="doSomething()"></div>
22107
+ * </app-root>
22108
+ * ```
22109
+ *
22110
+ * Calling `getListeners` on `<div>` will return an object that looks as follows:
22111
+ *
22112
+ * ```ts
22113
+ * {
22114
+ * name: 'click',
22115
+ * element: <div>,
22116
+ * callback: () => doSomething(),
22117
+ * useCapture: false
22118
+ * }
22119
+ * ```
22120
+ *
22121
+ * @param element Element for which the DOM listeners should be retrieved.
22122
+ * @returns Array of event listeners on the DOM element.
22123
+ *
22124
+ * @publicApi
22125
+ * @globalApi ng
22126
+ */
22127
+ function getListeners(element) {
22128
+ ngDevMode && assertDomElement(element);
22129
+ const lContext = getLContext(element);
22130
+ const lView = lContext === null ? null : lContext.lView;
22131
+ if (lView === null)
22132
+ return [];
22133
+ const tView = lView[TVIEW];
22134
+ const lCleanup = lView[CLEANUP];
22135
+ const tCleanup = tView.cleanup;
22136
+ const listeners = [];
22137
+ if (tCleanup && lCleanup) {
22138
+ for (let i = 0; i < tCleanup.length;) {
22139
+ const firstParam = tCleanup[i++];
22140
+ const secondParam = tCleanup[i++];
22141
+ if (typeof firstParam === 'string') {
22142
+ const name = firstParam;
22143
+ const listenerElement = unwrapRNode(lView[secondParam]);
22144
+ const callback = lCleanup[tCleanup[i++]];
22145
+ const useCaptureOrIndx = tCleanup[i++];
22146
+ // if useCaptureOrIndx is boolean then report it as is.
22147
+ // if useCaptureOrIndx is positive number then it in unsubscribe method
22148
+ // if useCaptureOrIndx is negative number then it is a Subscription
22149
+ const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
22150
+ const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
22151
+ if (element == listenerElement) {
22152
+ listeners.push({ element, name, callback, useCapture, type });
22153
+ }
22388
22154
  }
22389
- ], stringify(ngModuleType), new Set(['environment']));
22390
- // We need to resolve the injector types separately from the injector creation, because
22391
- // the module might be trying to use this ref in its constructor for DI which will cause a
22392
- // circular error that will eventually error out, because the injector isn't created yet.
22393
- this._r3Injector.resolveInjectorInitializers();
22394
- this.instance = this.get(ngModuleType);
22395
- }
22396
- get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
22397
- if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
22398
- return this;
22399
22155
  }
22400
- return this._r3Injector.get(token, notFoundValue, injectFlags);
22401
- }
22402
- destroy() {
22403
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22404
- const injector = this._r3Injector;
22405
- !injector.destroyed && injector.destroy();
22406
- this.destroyCbs.forEach(fn => fn());
22407
- this.destroyCbs = null;
22408
- }
22409
- onDestroy(callback) {
22410
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
22411
- this.destroyCbs.push(callback);
22412
- }
22413
- }
22414
- class NgModuleFactory extends NgModuleFactory$1 {
22415
- constructor(moduleType) {
22416
- super();
22417
- this.moduleType = moduleType;
22418
- }
22419
- create(parentInjector) {
22420
- return new NgModuleRef(this.moduleType, parentInjector);
22421
22156
  }
22157
+ listeners.sort(sortListeners);
22158
+ return listeners;
22422
22159
  }
22423
- class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
22424
- constructor(providers, parent, source) {
22425
- super();
22426
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
22427
- this.instance = null;
22428
- const injector = new R3Injector([
22429
- ...providers,
22430
- { provide: NgModuleRef$1, useValue: this },
22431
- { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
22432
- ], parent || getNullInjector(), source, new Set(['environment']));
22433
- this.injector = injector;
22434
- injector.resolveInjectorInitializers();
22435
- }
22436
- destroy() {
22437
- this.injector.destroy();
22438
- }
22439
- onDestroy(callback) {
22440
- this.injector.onDestroy(callback);
22441
- }
22160
+ function sortListeners(a, b) {
22161
+ if (a.name == b.name)
22162
+ return 0;
22163
+ return a.name < b.name ? -1 : 1;
22442
22164
  }
22443
22165
  /**
22444
- * Create a new environment injector.
22166
+ * This function should not exist because it is megamorphic and only mostly correct.
22445
22167
  *
22446
- * @publicApi
22447
- * @developerPreview
22168
+ * See call site for more info.
22448
22169
  */
22449
- function createEnvironmentInjector(providers, parent = null, debugName = null) {
22450
- const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22451
- return adapter.injector;
22170
+ function isDirectiveDefHack(obj) {
22171
+ return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
22452
22172
  }
22453
-
22454
22173
  /**
22455
- * @license
22456
- * Copyright Google LLC All Rights Reserved.
22174
+ * Returns the attached `DebugNode` instance for an element in the DOM.
22457
22175
  *
22458
- * Use of this source code is governed by an MIT-style license that can be
22459
- * found in the LICENSE file at https://angular.io/license
22460
- */
22461
- /**
22462
- * A service used by the framework to create instances of standalone injectors. Those injectors are
22463
- * created on demand in case of dynamic component instantiation and contain ambient providers
22464
- * collected from the imports graph rooted at a given standalone component.
22176
+ * @param element DOM element which is owned by an existing component's view.
22465
22177
  */
22466
- class StandaloneService {
22467
- constructor(_injector) {
22468
- this._injector = _injector;
22469
- this.cachedInjectors = new Map();
22178
+ function getDebugNode$1(element) {
22179
+ if (ngDevMode && !(element instanceof Node)) {
22180
+ throw new Error('Expecting instance of DOM Element');
22470
22181
  }
22471
- getOrCreateStandaloneInjector(componentDef) {
22472
- if (!componentDef.standalone) {
22473
- return null;
22474
- }
22475
- if (!this.cachedInjectors.has(componentDef.id)) {
22476
- const providers = internalImportProvidersFrom(false, componentDef.type);
22477
- const standaloneInjector = providers.length > 0 ?
22478
- createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22479
- null;
22480
- this.cachedInjectors.set(componentDef.id, standaloneInjector);
22481
- }
22482
- return this.cachedInjectors.get(componentDef.id);
22182
+ const lContext = getLContext(element);
22183
+ const lView = lContext ? lContext.lView : null;
22184
+ if (lView === null) {
22185
+ return null;
22483
22186
  }
22484
- ngOnDestroy() {
22485
- try {
22486
- for (const injector of this.cachedInjectors.values()) {
22487
- if (injector !== null) {
22488
- injector.destroy();
22489
- }
22490
- }
22491
- }
22492
- finally {
22493
- this.cachedInjectors.clear();
22494
- }
22187
+ const nodeIndex = lContext.nodeIndex;
22188
+ if (nodeIndex !== -1) {
22189
+ const valueInLView = lView[nodeIndex];
22190
+ // this means that value in the lView is a component with its own
22191
+ // data. In this situation the TNode is not accessed at the same spot.
22192
+ const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
22193
+ ngDevMode &&
22194
+ assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
22195
+ return buildDebugNode(tNode, lView);
22495
22196
  }
22197
+ return null;
22496
22198
  }
22497
- /** @nocollapse */
22498
- StandaloneService.ɵprov = ɵɵdefineInjectable({
22499
- token: StandaloneService,
22500
- providedIn: 'environment',
22501
- factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
22502
- });
22503
22199
  /**
22504
- * A feature that acts as a setup code for the {@link StandaloneService}.
22200
+ * Retrieve the component `LView` from component/element.
22505
22201
  *
22506
- * The most important responsaibility of this feature is to expose the "getStandaloneInjector"
22507
- * function (an entry points to a standalone injector creation) on a component definition object. We
22508
- * go through the features infrastructure to make sure that the standalone injector creation logic
22509
- * is tree-shakable and not included in applications that don't use standalone components.
22202
+ * NOTE: `LView` is a private and should not be leaked outside.
22203
+ * Don't export this method to `ng.*` on window.
22510
22204
  *
22511
- * @codeGenApi
22205
+ * @param target DOM element or component instance for which to retrieve the LView.
22512
22206
  */
22513
- function ɵɵStandaloneFeature(definition) {
22514
- definition.getStandaloneInjector = (parentInjector) => {
22515
- return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
22516
- };
22207
+ function getComponentLView(target) {
22208
+ const lContext = getLContext(target);
22209
+ const nodeIndx = lContext.nodeIndex;
22210
+ const lView = lContext.lView;
22211
+ ngDevMode && assertLView(lView);
22212
+ const componentLView = lView[nodeIndx];
22213
+ ngDevMode && assertLView(componentLView);
22214
+ return componentLView;
22215
+ }
22216
+ /** Asserts that a value is a DOM Element. */
22217
+ function assertDomElement(value) {
22218
+ if (typeof Element !== 'undefined' && !(value instanceof Element)) {
22219
+ throw new Error('Expecting instance of DOM Element');
22220
+ }
22517
22221
  }
22518
22222
 
22519
22223
  /**
@@ -23734,7 +23438,7 @@ const unusedValueExportToPlacateAjd = 1;
23734
23438
  * Use of this source code is governed by an MIT-style license that can be
23735
23439
  * found in the LICENSE file at https://angular.io/license
23736
23440
  */
23737
- const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd;
23441
+ const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd;
23738
23442
  class LQuery_ {
23739
23443
  constructor(queryList) {
23740
23444
  this.queryList = queryList;
@@ -25153,14 +24857,20 @@ function getStandaloneDefFunctions(type, imports) {
25153
24857
  // Standalone components are always able to self-reference, so include the component's own
25154
24858
  // definition in its `directiveDefs`.
25155
24859
  cachedDirectiveDefs = [getComponentDef(type)];
24860
+ const seen = new Set();
25156
24861
  for (const rawDep of imports) {
25157
24862
  ngDevMode && verifyStandaloneImport(rawDep, type);
25158
24863
  const dep = resolveForwardRef(rawDep);
24864
+ if (seen.has(dep)) {
24865
+ continue;
24866
+ }
24867
+ seen.add(dep);
25159
24868
  if (!!getNgModuleDef(dep)) {
25160
24869
  const scope = transitiveScopesFor(dep);
25161
24870
  for (const dir of scope.exported.directives) {
25162
24871
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25163
- if (def) {
24872
+ if (def && !seen.has(dir)) {
24873
+ seen.add(dir);
25164
24874
  cachedDirectiveDefs.push(def);
25165
24875
  }
25166
24876
  }
@@ -25178,11 +24888,22 @@ function getStandaloneDefFunctions(type, imports) {
25178
24888
  const pipeDefs = () => {
25179
24889
  if (cachedPipeDefs === null) {
25180
24890
  cachedPipeDefs = [];
24891
+ const seen = new Set();
25181
24892
  for (const rawDep of imports) {
25182
24893
  const dep = resolveForwardRef(rawDep);
24894
+ if (seen.has(dep)) {
24895
+ continue;
24896
+ }
24897
+ seen.add(dep);
25183
24898
  if (!!getNgModuleDef(dep)) {
25184
24899
  const scope = transitiveScopesFor(dep);
25185
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
24900
+ for (const pipe of scope.exported.pipes) {
24901
+ const def = getPipeDef$1(pipe);
24902
+ if (def && !seen.has(pipe)) {
24903
+ seen.add(pipe);
24904
+ cachedPipeDefs.push(def);
24905
+ }
24906
+ }
25186
24907
  }
25187
24908
  else {
25188
24909
  const def = getPipeDef$1(dep);
@@ -26139,6 +25860,99 @@ const COMPILER_OPTIONS = new InjectionToken('compilerOptions');
26139
25860
  class CompilerFactory {
26140
25861
  }
26141
25862
 
25863
+ /**
25864
+ * @license
25865
+ * Copyright Google LLC All Rights Reserved.
25866
+ *
25867
+ * Use of this source code is governed by an MIT-style license that can be
25868
+ * found in the LICENSE file at https://angular.io/license
25869
+ */
25870
+ /**
25871
+ * Marks a component for check (in case of OnPush components) and synchronously
25872
+ * performs change detection on the application this component belongs to.
25873
+ *
25874
+ * @param component Component to {@link ChangeDetectorRef#markForCheck mark for check}.
25875
+ *
25876
+ * @publicApi
25877
+ * @globalApi ng
25878
+ */
25879
+ function applyChanges(component) {
25880
+ markDirty(component);
25881
+ getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
25882
+ }
25883
+
25884
+ /**
25885
+ * @license
25886
+ * Copyright Google LLC All Rights Reserved.
25887
+ *
25888
+ * Use of this source code is governed by an MIT-style license that can be
25889
+ * found in the LICENSE file at https://angular.io/license
25890
+ */
25891
+ /**
25892
+ * This file introduces series of globally accessible debug tools
25893
+ * to allow for the Angular debugging story to function.
25894
+ *
25895
+ * To see this in action run the following command:
25896
+ *
25897
+ * bazel run //packages/core/test/bundling/todo:devserver
25898
+ *
25899
+ * Then load `localhost:5432` and start using the console tools.
25900
+ */
25901
+ /**
25902
+ * This value reflects the property on the window where the dev
25903
+ * tools are patched (window.ng).
25904
+ * */
25905
+ const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
25906
+ let _published = false;
25907
+ /**
25908
+ * Publishes a collection of default debug tools onto`window.ng`.
25909
+ *
25910
+ * These functions are available globally when Angular is in development
25911
+ * mode and are automatically stripped away from prod mode is on.
25912
+ */
25913
+ function publishDefaultGlobalUtils$1() {
25914
+ if (!_published) {
25915
+ _published = true;
25916
+ /**
25917
+ * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
25918
+ * The contract of the function might be changed in any release and/or the function can be
25919
+ * removed completely.
25920
+ */
25921
+ publishGlobalUtil('ɵsetProfiler', setProfiler);
25922
+ publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
25923
+ publishGlobalUtil('getComponent', getComponent);
25924
+ publishGlobalUtil('getContext', getContext);
25925
+ publishGlobalUtil('getListeners', getListeners);
25926
+ publishGlobalUtil('getOwningComponent', getOwningComponent);
25927
+ publishGlobalUtil('getHostElement', getHostElement);
25928
+ publishGlobalUtil('getInjector', getInjector);
25929
+ publishGlobalUtil('getRootComponents', getRootComponents);
25930
+ publishGlobalUtil('getDirectives', getDirectives);
25931
+ publishGlobalUtil('applyChanges', applyChanges);
25932
+ }
25933
+ }
25934
+ /**
25935
+ * Publishes the given function to `window.ng` so that it can be
25936
+ * used from the browser console when an application is not in production.
25937
+ */
25938
+ function publishGlobalUtil(name, fn) {
25939
+ if (typeof COMPILED === 'undefined' || !COMPILED) {
25940
+ // Note: we can't export `ng` when using closure enhanced optimization as:
25941
+ // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
25942
+ // - we can't declare a closure extern as the namespace `ng` is already used within Google
25943
+ // for typings for AngularJS (via `goog.provide('ng....')`).
25944
+ const w = _global;
25945
+ ngDevMode && assertDefined(fn, 'function not defined');
25946
+ if (w) {
25947
+ let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
25948
+ if (!container) {
25949
+ container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
25950
+ }
25951
+ container[name] = fn;
25952
+ }
25953
+ }
25954
+ }
25955
+
26142
25956
  /**
26143
25957
  * @license
26144
25958
  * Copyright Google LLC All Rights Reserved.
@@ -26294,7 +26108,7 @@ class NgZone {
26294
26108
  */
26295
26109
  this.onError = new EventEmitter(false);
26296
26110
  if (typeof Zone == 'undefined') {
26297
- throw new Error(`In this configuration Angular requires Zone.js`);
26111
+ throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);
26298
26112
  }
26299
26113
  Zone.assertZonePatched();
26300
26114
  const self = this;
@@ -26321,12 +26135,12 @@ class NgZone {
26321
26135
  }
26322
26136
  static assertInAngularZone() {
26323
26137
  if (!NgZone.isInAngularZone()) {
26324
- throw new Error('Expected to be in Angular Zone, but it is not!');
26138
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
26325
26139
  }
26326
26140
  }
26327
26141
  static assertNotInAngularZone() {
26328
26142
  if (NgZone.isInAngularZone()) {
26329
- throw new Error('Expected to not be in Angular Zone, but it is!');
26143
+ throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
26330
26144
  }
26331
26145
  }
26332
26146
  /**
@@ -26897,7 +26711,7 @@ const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
26897
26711
  * `PlatformRef` class (i.e. register the callback via `PlatformRef.onDestroy`), thus making the
26898
26712
  * entire class tree-shakeable.
26899
26713
  */
26900
- const PLATFORM_ON_DESTROY = new InjectionToken('PlatformOnDestroy');
26714
+ const PLATFORM_DESTROY_LISTENERS = new InjectionToken('PlatformDestroyListeners');
26901
26715
  const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
26902
26716
  function compileNgModuleFactory(injector, options, moduleType) {
26903
26717
  ngDevMode && assertNgModuleType(moduleType);
@@ -26962,10 +26776,8 @@ class NgProbeToken {
26962
26776
  */
26963
26777
  function createPlatform(injector) {
26964
26778
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26965
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26966
- 'There can be only one platform. Destroy the previous one to create a new one.' :
26967
- '';
26968
- throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, errorMessage);
26779
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26780
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26969
26781
  }
26970
26782
  publishDefaultGlobalUtils();
26971
26783
  _platformInjector = injector;
@@ -27038,7 +26850,15 @@ function internalBootstrapApplication(config) {
27038
26850
  const localeId = appInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
27039
26851
  setLocaleId(localeId || DEFAULT_LOCALE_ID);
27040
26852
  const appRef = appInjector.get(ApplicationRef);
27041
- 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 === null || onPlatformDestroyListeners === void 0 ? void 0 : onPlatformDestroyListeners.add(destroyListener);
26858
+ appRef.onDestroy(() => {
26859
+ onPlatformDestroyListeners === null || onPlatformDestroyListeners === void 0 ? void 0 : onPlatformDestroyListeners.delete(destroyListener);
26860
+ onErrorSubscription.unsubscribe();
26861
+ });
27042
26862
  appRef.bootstrap(rootComponent);
27043
26863
  return appRef;
27044
26864
  });
@@ -27085,8 +26905,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27085
26905
  function assertPlatform(requiredToken) {
27086
26906
  const platform = getPlatform();
27087
26907
  if (!platform) {
27088
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27089
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
26908
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27090
26909
  }
27091
26910
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27092
26911
  !platform.injector.get(requiredToken, null)) {
@@ -27103,7 +26922,7 @@ function createPlatformInjector(providers = [], name) {
27103
26922
  name,
27104
26923
  providers: [
27105
26924
  { provide: INJECTOR_SCOPE, useValue: 'platform' },
27106
- { provide: PLATFORM_ON_DESTROY, useValue: () => _platformInjector = null },
26925
+ { provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => _platformInjector = null]) },
27107
26926
  ...providers
27108
26927
  ],
27109
26928
  });
@@ -27166,10 +26985,7 @@ class PlatformRef {
27166
26985
  const moduleRef = moduleFactory.create(ngZoneInjector);
27167
26986
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27168
26987
  if (!exceptionHandler) {
27169
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27170
- 'No ErrorHandler. Is platform module (BrowserModule) included?' :
27171
- '';
27172
- throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, errorMessage);
26988
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27173
26989
  }
27174
26990
  ngZone.runOutsideAngular(() => {
27175
26991
  const subscription = ngZone.onError.subscribe({
@@ -27225,12 +27041,10 @@ class PlatformRef {
27225
27041
  moduleRef.instance.ngDoBootstrap(appRef);
27226
27042
  }
27227
27043
  else {
27228
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27044
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27229
27045
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27230
27046
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
27231
- `Please define one of these.` :
27232
- '';
27233
- throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
27047
+ `Please define one of these.`);
27234
27048
  }
27235
27049
  this._modules.push(moduleRef);
27236
27050
  }
@@ -27253,15 +27067,15 @@ class PlatformRef {
27253
27067
  */
27254
27068
  destroy() {
27255
27069
  if (this._destroyed) {
27256
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27257
- 'The platform has already been destroyed!' :
27258
- '';
27259
- throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, errorMessage);
27070
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27260
27071
  }
27261
27072
  this._modules.slice().forEach(module => module.destroy());
27262
27073
  this._destroyListeners.forEach(listener => listener());
27263
- const destroyListener = this._injector.get(PLATFORM_ON_DESTROY, null);
27264
- destroyListener === null || destroyListener === void 0 ? void 0 : destroyListener();
27074
+ const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
27075
+ if (destroyListeners) {
27076
+ destroyListeners.forEach(listener => listener());
27077
+ destroyListeners.clear();
27078
+ }
27265
27079
  this._destroyed = true;
27266
27080
  }
27267
27081
  /**
@@ -27421,11 +27235,10 @@ function optionsReducer(dst, objs) {
27421
27235
  */
27422
27236
  class ApplicationRef {
27423
27237
  /** @internal */
27424
- constructor(_zone, _injector, _exceptionHandler, _initStatus) {
27238
+ constructor(_zone, _injector, _exceptionHandler) {
27425
27239
  this._zone = _zone;
27426
27240
  this._injector = _injector;
27427
27241
  this._exceptionHandler = _exceptionHandler;
27428
- this._initStatus = _initStatus;
27429
27242
  /** @internal */
27430
27243
  this._bootstrapListeners = [];
27431
27244
  this._views = [];
@@ -27542,7 +27355,8 @@ class ApplicationRef {
27542
27355
  bootstrap(componentOrFactory, rootSelectorOrNode) {
27543
27356
  NG_DEV_MODE && this.warnIfDestroyed();
27544
27357
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
27545
- if (!this._initStatus.done) {
27358
+ const initStatus = this._injector.get(ApplicationInitStatus);
27359
+ if (!initStatus.done) {
27546
27360
  const standalone = !isComponentFactory && isStandalone(componentOrFactory);
27547
27361
  const errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' +
27548
27362
  (standalone ? '' :
@@ -27590,10 +27404,7 @@ class ApplicationRef {
27590
27404
  tick() {
27591
27405
  NG_DEV_MODE && this.warnIfDestroyed();
27592
27406
  if (this._runningTick) {
27593
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27594
- 'ApplicationRef.tick is called recursively' :
27595
- '';
27596
- throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
27407
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27597
27408
  }
27598
27409
  try {
27599
27410
  this._runningTick = true;
@@ -27682,7 +27493,7 @@ class ApplicationRef {
27682
27493
  */
27683
27494
  destroy() {
27684
27495
  if (this._destroyed) {
27685
- throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, NG_DEV_MODE && 'This instance of the `ApplicationRef` has already been destroyed.');
27496
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27686
27497
  }
27687
27498
  const injector = this._injector;
27688
27499
  // Check that this injector instance supports destroy operation.
@@ -27704,13 +27515,13 @@ class ApplicationRef {
27704
27515
  }
27705
27516
  }
27706
27517
  }
27707
- ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ApplicationInitStatus)); };
27518
+ ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler)); };
27708
27519
  ApplicationRef.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
27709
27520
  (function () {
27710
27521
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
27711
27522
  type: Injectable,
27712
27523
  args: [{ providedIn: 'root' }]
27713
- }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ApplicationInitStatus }]; }, null);
27524
+ }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }]; }, null);
27714
27525
  })();
27715
27526
  function remove(list, el) {
27716
27527
  const index = list.indexOf(el);
@@ -28058,7 +27869,7 @@ class DebugNode {
28058
27869
  get componentInstance() {
28059
27870
  const nativeElement = this.nativeNode;
28060
27871
  return nativeElement &&
28061
- (getComponent$1(nativeElement) || getOwningComponent(nativeElement));
27872
+ (getComponent(nativeElement) || getOwningComponent(nativeElement));
28062
27873
  }
28063
27874
  /**
28064
27875
  * An object that provides parent context for this element. Often an ancestor component instance
@@ -28069,7 +27880,7 @@ class DebugNode {
28069
27880
  * of heroes"`.
28070
27881
  */
28071
27882
  get context() {
28072
- return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
27883
+ return getComponent(this.nativeNode) || getContext(this.nativeNode);
28073
27884
  }
28074
27885
  /**
28075
27886
  * The callbacks attached to the component's @Output properties and/or the element's event
@@ -28409,8 +28220,7 @@ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, root
28409
28220
  // Renderer2, however that's not the case in Ivy. This approach is being used because:
28410
28221
  // 1. Matching the ViewEngine behavior would mean potentially introducing a depedency
28411
28222
  // 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.
28223
+ // 2. It allows us to capture nodes that were inserted directly via the DOM.
28414
28224
  nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
28415
28225
  }
28416
28226
  // In all cases, if a dynamic container exists for this node, each view inside it has to be
@@ -28721,10 +28531,8 @@ class DefaultIterableDiffer {
28721
28531
  if (collection == null)
28722
28532
  collection = [];
28723
28533
  if (!isListLikeIterable(collection)) {
28724
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28725
- `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
28726
- '';
28727
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
28534
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28535
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28728
28536
  }
28729
28537
  if (this.check(collection)) {
28730
28538
  return this;
@@ -29325,10 +29133,8 @@ class DefaultKeyValueDiffer {
29325
29133
  map = new Map();
29326
29134
  }
29327
29135
  else if (!(map instanceof Map || isJsObject(map))) {
29328
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29329
- `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
29330
- '';
29331
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
29136
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29137
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29332
29138
  }
29333
29139
  return this.check(map) ? this : null;
29334
29140
  }
@@ -29575,10 +29381,8 @@ class IterableDiffers {
29575
29381
  return factory;
29576
29382
  }
29577
29383
  else {
29578
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29579
- `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
29580
- '';
29581
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29384
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29385
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29582
29386
  }
29583
29387
  }
29584
29388
  }
@@ -29652,10 +29456,7 @@ class KeyValueDiffers {
29652
29456
  if (factory) {
29653
29457
  return factory;
29654
29458
  }
29655
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29656
- `Cannot find a differ supporting object '${kv}'` :
29657
- '';
29658
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29459
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29659
29460
  }
29660
29461
  }
29661
29462
  /** @nocollapse */
@@ -29891,5 +29692,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29891
29692
  * Generated bundle index. Do not edit.
29892
29693
  */
29893
29694
 
29894
- 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 };
29695
+ 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 };
29895
29696
  //# sourceMappingURL=core.mjs.map