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