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