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