@angular/core 15.0.0-next.2 → 15.0.0-next.3
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/debug/debug_node.mjs +1 -1
- package/esm2020/src/render3/component_ref.mjs +2 -2
- package/esm2020/src/render3/context_discovery.mjs +12 -9
- package/esm2020/src/render3/definition.mjs +3 -2
- package/esm2020/src/render3/features/host_directives_feature.mjs +36 -13
- package/esm2020/src/render3/instructions/element.mjs +1 -1
- package/esm2020/src/render3/instructions/listener.mjs +2 -4
- package/esm2020/src/render3/instructions/lview_debug.mjs +9 -9
- package/esm2020/src/render3/instructions/projection.mjs +1 -1
- package/esm2020/src/render3/instructions/shared.mjs +60 -25
- package/esm2020/src/render3/instructions/styling.mjs +2 -2
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/interfaces/node.mjs +3 -3
- package/esm2020/src/render3/interfaces/type_checks.mjs +3 -3
- package/esm2020/src/render3/jit/directive.mjs +7 -2
- package/esm2020/src/render3/node_manipulation.mjs +6 -5
- package/esm2020/src/render3/node_manipulation_i18n.mjs +2 -2
- 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/fesm2015/core.mjs +137 -73
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +129 -71
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +136 -72
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +129 -70
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +41 -29
- package/package.json +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.0.0-next.
|
|
2
|
+
* @license Angular v15.0.0-next.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2569,7 +2569,8 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2569
2569
|
setInput: null,
|
|
2570
2570
|
schemas: componentDefinition.schemas || null,
|
|
2571
2571
|
tView: null,
|
|
2572
|
-
|
|
2572
|
+
findHostDirectiveDefs: null,
|
|
2573
|
+
hostDirectives: null,
|
|
2573
2574
|
};
|
|
2574
2575
|
const dependencies = componentDefinition.dependencies;
|
|
2575
2576
|
const feature = componentDefinition.features;
|
|
@@ -2903,10 +2904,10 @@ function isLContainer(value) {
|
|
|
2903
2904
|
return Array.isArray(value) && value[TYPE] === true;
|
|
2904
2905
|
}
|
|
2905
2906
|
function isContentQueryHost(tNode) {
|
|
2906
|
-
return (tNode.flags &
|
|
2907
|
+
return (tNode.flags & 4 /* TNodeFlags.hasContentQuery */) !== 0;
|
|
2907
2908
|
}
|
|
2908
2909
|
function isComponentHost(tNode) {
|
|
2909
|
-
return
|
|
2910
|
+
return tNode.componentOffset > -1;
|
|
2910
2911
|
}
|
|
2911
2912
|
function isDirectiveHost(tNode) {
|
|
2912
2913
|
return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
|
|
@@ -4316,7 +4317,7 @@ const unusedValueExportToPlacateAjd$5 = 1;
|
|
|
4316
4317
|
* @param tNode
|
|
4317
4318
|
*/
|
|
4318
4319
|
function hasClassInput(tNode) {
|
|
4319
|
-
return (tNode.flags &
|
|
4320
|
+
return (tNode.flags & 8 /* TNodeFlags.hasClassInput */) !== 0;
|
|
4320
4321
|
}
|
|
4321
4322
|
/**
|
|
4322
4323
|
* Returns `true` if the `TNode` has a directive which has `@Input()` for `style` binding.
|
|
@@ -4340,7 +4341,7 @@ function hasClassInput(tNode) {
|
|
|
4340
4341
|
* @param tNode
|
|
4341
4342
|
*/
|
|
4342
4343
|
function hasStyleInput(tNode) {
|
|
4343
|
-
return (tNode.flags &
|
|
4344
|
+
return (tNode.flags & 16 /* TNodeFlags.hasStyleInput */) !== 0;
|
|
4344
4345
|
}
|
|
4345
4346
|
|
|
4346
4347
|
/**
|
|
@@ -7636,7 +7637,7 @@ class Version {
|
|
|
7636
7637
|
/**
|
|
7637
7638
|
* @publicApi
|
|
7638
7639
|
*/
|
|
7639
|
-
const VERSION = new Version('15.0.0-next.
|
|
7640
|
+
const VERSION = new Version('15.0.0-next.3');
|
|
7640
7641
|
|
|
7641
7642
|
/**
|
|
7642
7643
|
* @license
|
|
@@ -8456,18 +8457,21 @@ function findViaDirective(lView, directiveInstance) {
|
|
|
8456
8457
|
*/
|
|
8457
8458
|
function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
8458
8459
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
8459
|
-
|
|
8460
|
-
if (directiveStartIndex == 0)
|
|
8460
|
+
if (tNode.directiveStart === 0)
|
|
8461
8461
|
return EMPTY_ARRAY;
|
|
8462
|
-
const
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8462
|
+
const results = [];
|
|
8463
|
+
for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
|
|
8464
|
+
const directiveInstance = lView[i];
|
|
8465
|
+
if (!isComponentInstance(directiveInstance) || includeComponents) {
|
|
8466
|
+
results.push(directiveInstance);
|
|
8467
|
+
}
|
|
8468
|
+
}
|
|
8469
|
+
return results;
|
|
8466
8470
|
}
|
|
8467
8471
|
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
8468
8472
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
8469
|
-
|
|
8470
|
-
return
|
|
8473
|
+
const { directiveStart, componentOffset } = tNode;
|
|
8474
|
+
return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
|
|
8471
8475
|
}
|
|
8472
8476
|
/**
|
|
8473
8477
|
* Returns a map of local references (local reference name => element or directive instance) that
|
|
@@ -9215,9 +9219,10 @@ function getClosestRElement(tView, tNode, lView) {
|
|
|
9215
9219
|
}
|
|
9216
9220
|
else {
|
|
9217
9221
|
ngDevMode && assertTNodeType(parentTNode, 3 /* TNodeType.AnyRNode */ | 4 /* TNodeType.Container */);
|
|
9218
|
-
|
|
9222
|
+
const { componentOffset } = parentTNode;
|
|
9223
|
+
if (componentOffset > -1) {
|
|
9219
9224
|
ngDevMode && assertTNodeForLView(parentTNode, lView);
|
|
9220
|
-
const encapsulation = tView.data[parentTNode.directiveStart]
|
|
9225
|
+
const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
|
|
9221
9226
|
// We've got a parent which is an element in the current view. We just need to verify if the
|
|
9222
9227
|
// parent element is not a component. Component's content nodes are not inserted immediately
|
|
9223
9228
|
// because they will be projected, and so doing insert at this point would be wasteful.
|
|
@@ -9450,10 +9455,10 @@ function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode,
|
|
|
9450
9455
|
if (isProjection) {
|
|
9451
9456
|
if (action === 0 /* WalkTNodeTreeAction.Create */) {
|
|
9452
9457
|
rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
|
|
9453
|
-
tNode.flags |=
|
|
9458
|
+
tNode.flags |= 2 /* TNodeFlags.isProjected */;
|
|
9454
9459
|
}
|
|
9455
9460
|
}
|
|
9456
|
-
if ((tNode.flags &
|
|
9461
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
9457
9462
|
if (tNodeType & 8 /* TNodeType.ElementContainer */) {
|
|
9458
9463
|
applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
|
|
9459
9464
|
applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
|
@@ -11508,6 +11513,7 @@ class TNode {
|
|
|
11508
11513
|
index, //
|
|
11509
11514
|
insertBeforeIndex, //
|
|
11510
11515
|
injectorIndex, //
|
|
11516
|
+
componentOffset, //
|
|
11511
11517
|
directiveStart, //
|
|
11512
11518
|
directiveEnd, //
|
|
11513
11519
|
directiveStylingLast, //
|
|
@@ -11540,6 +11546,7 @@ class TNode {
|
|
|
11540
11546
|
this.index = index;
|
|
11541
11547
|
this.insertBeforeIndex = insertBeforeIndex;
|
|
11542
11548
|
this.injectorIndex = injectorIndex;
|
|
11549
|
+
this.componentOffset = componentOffset;
|
|
11543
11550
|
this.directiveStart = directiveStart;
|
|
11544
11551
|
this.directiveEnd = directiveEnd;
|
|
11545
11552
|
this.directiveStylingLast = directiveStylingLast;
|
|
@@ -11617,21 +11624,19 @@ class TNode {
|
|
|
11617
11624
|
}
|
|
11618
11625
|
get flags_() {
|
|
11619
11626
|
const flags = [];
|
|
11620
|
-
if (this.flags &
|
|
11627
|
+
if (this.flags & 8 /* TNodeFlags.hasClassInput */)
|
|
11621
11628
|
flags.push('TNodeFlags.hasClassInput');
|
|
11622
|
-
if (this.flags &
|
|
11629
|
+
if (this.flags & 4 /* TNodeFlags.hasContentQuery */)
|
|
11623
11630
|
flags.push('TNodeFlags.hasContentQuery');
|
|
11624
|
-
if (this.flags &
|
|
11631
|
+
if (this.flags & 16 /* TNodeFlags.hasStyleInput */)
|
|
11625
11632
|
flags.push('TNodeFlags.hasStyleInput');
|
|
11626
|
-
if (this.flags &
|
|
11633
|
+
if (this.flags & 64 /* TNodeFlags.hasHostBindings */)
|
|
11627
11634
|
flags.push('TNodeFlags.hasHostBindings');
|
|
11628
|
-
if (this.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
11629
|
-
flags.push('TNodeFlags.isComponentHost');
|
|
11630
11635
|
if (this.flags & 1 /* TNodeFlags.isDirectiveHost */)
|
|
11631
11636
|
flags.push('TNodeFlags.isDirectiveHost');
|
|
11632
|
-
if (this.flags &
|
|
11637
|
+
if (this.flags & 32 /* TNodeFlags.isDetached */)
|
|
11633
11638
|
flags.push('TNodeFlags.isDetached');
|
|
11634
|
-
if (this.flags &
|
|
11639
|
+
if (this.flags & 2 /* TNodeFlags.isProjected */)
|
|
11635
11640
|
flags.push('TNodeFlags.isProjected');
|
|
11636
11641
|
return flags.join('|');
|
|
11637
11642
|
}
|
|
@@ -12141,7 +12146,7 @@ function getOrCreateTNode(tView, index, type, name, attrs) {
|
|
|
12141
12146
|
// See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
12142
12147
|
// If the `TNode` was not pre-declared than it means it was not mentioned which means it was
|
|
12143
12148
|
// removed, so we mark it as detached.
|
|
12144
|
-
tNode.flags |=
|
|
12149
|
+
tNode.flags |= 32 /* TNodeFlags.isDetached */;
|
|
12145
12150
|
}
|
|
12146
12151
|
}
|
|
12147
12152
|
else if (tNode.type & 64 /* TNodeType.Placeholder */) {
|
|
@@ -12445,7 +12450,7 @@ function createDirectivesInstances(tView, lView, tNode) {
|
|
|
12445
12450
|
if (!getBindingsEnabled())
|
|
12446
12451
|
return;
|
|
12447
12452
|
instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
|
|
12448
|
-
if ((tNode.flags &
|
|
12453
|
+
if ((tNode.flags & 64 /* TNodeFlags.hasHostBindings */) === 64 /* TNodeFlags.hasHostBindings */) {
|
|
12449
12454
|
invokeDirectivesHostBindings(tView, lView, tNode);
|
|
12450
12455
|
}
|
|
12451
12456
|
}
|
|
@@ -12645,6 +12650,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12645
12650
|
index, // index: number
|
|
12646
12651
|
null, // insertBeforeIndex: null|-1|number|number[]
|
|
12647
12652
|
injectorIndex, // injectorIndex: number
|
|
12653
|
+
-1, // componentOffset: number
|
|
12648
12654
|
-1, // directiveStart: number
|
|
12649
12655
|
-1, // directiveEnd: number
|
|
12650
12656
|
-1, // directiveStylingLast: number
|
|
@@ -12680,6 +12686,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12680
12686
|
directiveStart: -1,
|
|
12681
12687
|
directiveEnd: -1,
|
|
12682
12688
|
directiveStylingLast: -1,
|
|
12689
|
+
componentOffset: -1,
|
|
12683
12690
|
propertyBindings: null,
|
|
12684
12691
|
flags: 0,
|
|
12685
12692
|
providerIndexes: 0,
|
|
@@ -12743,24 +12750,23 @@ function initializeInputAndOutputAliases(tView, tNode) {
|
|
|
12743
12750
|
let outputsStore = null;
|
|
12744
12751
|
for (let i = start; i < end; i++) {
|
|
12745
12752
|
const directiveDef = tViewData[i];
|
|
12746
|
-
|
|
12753
|
+
inputsStore = generatePropertyAliases(directiveDef.inputs, i, inputsStore);
|
|
12754
|
+
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
|
12747
12755
|
// Do not use unbound attributes as inputs to structural directives, since structural
|
|
12748
12756
|
// directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
|
|
12749
12757
|
// TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
|
|
12750
12758
|
// should be set for inline templates.
|
|
12751
|
-
const initialInputs = (tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12752
|
-
generateInitialInputs(
|
|
12759
|
+
const initialInputs = (inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12760
|
+
generateInitialInputs(inputsStore, i, tNodeAttrs) :
|
|
12753
12761
|
null;
|
|
12754
12762
|
inputsFromAttrs.push(initialInputs);
|
|
12755
|
-
inputsStore = generatePropertyAliases(directiveInputs, i, inputsStore);
|
|
12756
|
-
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
|
12757
12763
|
}
|
|
12758
12764
|
if (inputsStore !== null) {
|
|
12759
12765
|
if (inputsStore.hasOwnProperty('class')) {
|
|
12760
|
-
tNode.flags |=
|
|
12766
|
+
tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
|
|
12761
12767
|
}
|
|
12762
12768
|
if (inputsStore.hasOwnProperty('style')) {
|
|
12763
|
-
tNode.flags |=
|
|
12769
|
+
tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
|
|
12764
12770
|
}
|
|
12765
12771
|
}
|
|
12766
12772
|
tNode.initialInputs = inputsFromAttrs;
|
|
@@ -12881,7 +12887,7 @@ function instantiateRootComponent(tView, lView, def) {
|
|
|
12881
12887
|
configureViewWithDirective(tView, rootTNode, lView, directiveIndex, def);
|
|
12882
12888
|
initializeInputAndOutputAliases(tView, rootTNode);
|
|
12883
12889
|
}
|
|
12884
|
-
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart, rootTNode);
|
|
12890
|
+
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
|
|
12885
12891
|
attachPatchData(directive, lView);
|
|
12886
12892
|
const native = getNativeByTNode(rootTNode, lView);
|
|
12887
12893
|
if (native) {
|
|
@@ -12898,7 +12904,10 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12898
12904
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12899
12905
|
let hasDirectives = false;
|
|
12900
12906
|
if (getBindingsEnabled()) {
|
|
12901
|
-
const
|
|
12907
|
+
const directiveDefsMatchedBySelectors = findDirectiveDefMatches(tView, lView, tNode);
|
|
12908
|
+
const directiveDefs = directiveDefsMatchedBySelectors ?
|
|
12909
|
+
findHostDirectiveDefs$1(directiveDefsMatchedBySelectors, tView, lView, tNode) :
|
|
12910
|
+
null;
|
|
12902
12911
|
const exportsMap = localRefs === null ? null : { '': -1 };
|
|
12903
12912
|
if (directiveDefs !== null) {
|
|
12904
12913
|
hasDirectives = true;
|
|
@@ -12927,9 +12936,9 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12927
12936
|
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
12928
12937
|
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
12929
12938
|
if (def.contentQueries !== null)
|
|
12930
|
-
tNode.flags |=
|
|
12939
|
+
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
12931
12940
|
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
12932
|
-
tNode.flags |=
|
|
12941
|
+
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
12933
12942
|
const lifeCycleHooks = def.type.prototype;
|
|
12934
12943
|
// Only push a node index into the preOrderHooks array if this is the first
|
|
12935
12944
|
// pre-order hook found on this node.
|
|
@@ -13068,7 +13077,6 @@ function invokeHostBindingsInCreationMode(def, directive) {
|
|
|
13068
13077
|
* If a component is matched (at most one), it is returned in first position in the array.
|
|
13069
13078
|
*/
|
|
13070
13079
|
function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
13071
|
-
var _a;
|
|
13072
13080
|
ngDevMode && assertFirstCreatePass(tView);
|
|
13073
13081
|
ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
|
|
13074
13082
|
const registry = tView.directiveRegistry;
|
|
@@ -13083,20 +13091,19 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
|
13083
13091
|
if (ngDevMode) {
|
|
13084
13092
|
assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
|
|
13085
13093
|
`Please use a different tag to activate the ${stringify(def.type)} component.`);
|
|
13086
|
-
if (tNode
|
|
13094
|
+
if (isComponentHost(tNode)) {
|
|
13087
13095
|
// If another component has been matched previously, it's the first element in the
|
|
13088
13096
|
// `matches` array, see how we store components/directives in `matches` below.
|
|
13089
13097
|
throwMultipleComponentError(tNode, matches[0].type, def.type);
|
|
13090
13098
|
}
|
|
13091
13099
|
}
|
|
13092
|
-
markAsComponentHost(tView, tNode);
|
|
13100
|
+
markAsComponentHost(tView, tNode, 0);
|
|
13093
13101
|
// The component is always stored first with directives after.
|
|
13094
13102
|
matches.unshift(def);
|
|
13095
13103
|
}
|
|
13096
13104
|
else {
|
|
13097
13105
|
matches.push(def);
|
|
13098
13106
|
}
|
|
13099
|
-
(_a = def.applyHostDirectives) === null || _a === void 0 ? void 0 : _a.call(def, tView, viewData, tNode, matches);
|
|
13100
13107
|
}
|
|
13101
13108
|
}
|
|
13102
13109
|
}
|
|
@@ -13104,15 +13111,36 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
|
13104
13111
|
}
|
|
13105
13112
|
/**
|
|
13106
13113
|
* Marks a given TNode as a component's host. This consists of:
|
|
13107
|
-
* - setting
|
|
13114
|
+
* - setting the component offset on the TNode.
|
|
13108
13115
|
* - storing index of component's host element so it will be queued for view refresh during CD.
|
|
13109
13116
|
*/
|
|
13110
|
-
function markAsComponentHost(tView, hostTNode) {
|
|
13117
|
+
function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
13111
13118
|
ngDevMode && assertFirstCreatePass(tView);
|
|
13112
|
-
|
|
13119
|
+
ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
|
|
13120
|
+
hostTNode.componentOffset = componentOffset;
|
|
13113
13121
|
(tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
|
|
13114
13122
|
.push(hostTNode.index);
|
|
13115
13123
|
}
|
|
13124
|
+
/**
|
|
13125
|
+
* Given an array of directives that were matched by their selectors, this function
|
|
13126
|
+
* produces a new array that also includes any host directives that have to be applied.
|
|
13127
|
+
* @param selectorMatches Directives matched in a template based on their selectors.
|
|
13128
|
+
* @param tView Current TView.
|
|
13129
|
+
* @param lView Current LView.
|
|
13130
|
+
* @param tNode Current TNode that is being matched.
|
|
13131
|
+
*/
|
|
13132
|
+
function findHostDirectiveDefs$1(selectorMatches, tView, lView, tNode) {
|
|
13133
|
+
const matches = [];
|
|
13134
|
+
for (const def of selectorMatches) {
|
|
13135
|
+
if (def.findHostDirectiveDefs === null) {
|
|
13136
|
+
matches.push(def);
|
|
13137
|
+
}
|
|
13138
|
+
else {
|
|
13139
|
+
def.findHostDirectiveDefs(matches, def, tView, lView, tNode);
|
|
13140
|
+
}
|
|
13141
|
+
}
|
|
13142
|
+
return matches;
|
|
13143
|
+
}
|
|
13116
13144
|
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
13117
13145
|
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
13118
13146
|
if (localRefs) {
|
|
@@ -13255,10 +13283,11 @@ function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initial
|
|
|
13255
13283
|
*
|
|
13256
13284
|
* <my-component name="Bess"></my-component>
|
|
13257
13285
|
*
|
|
13258
|
-
* @param inputs
|
|
13259
|
-
* @param
|
|
13286
|
+
* @param inputs Input alias map that was generated from the directive def inputs.
|
|
13287
|
+
* @param directiveIndex Index of the directive that is currently being processed.
|
|
13288
|
+
* @param attrs Static attrs on this node.
|
|
13260
13289
|
*/
|
|
13261
|
-
function generateInitialInputs(inputs, attrs) {
|
|
13290
|
+
function generateInitialInputs(inputs, directiveIndex, attrs) {
|
|
13262
13291
|
let inputsToStore = null;
|
|
13263
13292
|
let i = 0;
|
|
13264
13293
|
while (i < attrs.length) {
|
|
@@ -13279,7 +13308,17 @@ function generateInitialInputs(inputs, attrs) {
|
|
|
13279
13308
|
if (inputs.hasOwnProperty(attrName)) {
|
|
13280
13309
|
if (inputsToStore === null)
|
|
13281
13310
|
inputsToStore = [];
|
|
13282
|
-
|
|
13311
|
+
// Find the input's public name from the input store. Note that we can be found easier
|
|
13312
|
+
// through the directive def, but we want to do it using the inputs store so that it can
|
|
13313
|
+
// account for host directive aliases.
|
|
13314
|
+
const inputConfig = inputs[attrName];
|
|
13315
|
+
for (let j = 0; j < inputConfig.length; j += 2) {
|
|
13316
|
+
if (inputConfig[j] === directiveIndex) {
|
|
13317
|
+
inputsToStore.push(attrName, inputConfig[j + 1], attrs[i + 1]);
|
|
13318
|
+
// A directive can't have multiple inputs with the same name so we can break here.
|
|
13319
|
+
break;
|
|
13320
|
+
}
|
|
13321
|
+
}
|
|
13283
13322
|
}
|
|
13284
13323
|
i += 2;
|
|
13285
13324
|
}
|
|
@@ -14312,7 +14351,7 @@ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRend
|
|
|
14312
14351
|
const componentView = createLView(rootView, getOrCreateComponentTView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
|
|
14313
14352
|
if (tView.firstCreatePass) {
|
|
14314
14353
|
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
|
|
14315
|
-
markAsComponentHost(tView, tNode);
|
|
14354
|
+
markAsComponentHost(tView, tNode, 0);
|
|
14316
14355
|
initTNodeFlags(tNode, rootView.length, 1);
|
|
14317
14356
|
}
|
|
14318
14357
|
addToViewTree(rootView, componentView);
|
|
@@ -14609,6 +14648,13 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14609
14648
|
}
|
|
14610
14649
|
}
|
|
14611
14650
|
|
|
14651
|
+
/**
|
|
14652
|
+
* @license
|
|
14653
|
+
* Copyright Google LLC All Rights Reserved.
|
|
14654
|
+
*
|
|
14655
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
14656
|
+
* found in the LICENSE file at https://angular.io/license
|
|
14657
|
+
*/
|
|
14612
14658
|
/**
|
|
14613
14659
|
* This feature add the host directives behavior to a directive definition by patching a
|
|
14614
14660
|
* function onto it. The expectation is that the runtime will invoke the function during
|
|
@@ -14630,29 +14676,43 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14630
14676
|
* @codeGenApi
|
|
14631
14677
|
*/
|
|
14632
14678
|
function ɵɵHostDirectivesFeature(rawHostDirectives) {
|
|
14633
|
-
const unwrappedHostDirectives = Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives();
|
|
14634
|
-
const hostDirectives = unwrappedHostDirectives.map(dir => typeof dir === 'function' ? { directive: dir, inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } : {
|
|
14635
|
-
directive: dir.directive,
|
|
14636
|
-
inputs: bindingArrayToMap(dir.inputs),
|
|
14637
|
-
outputs: bindingArrayToMap(dir.outputs)
|
|
14638
|
-
});
|
|
14639
14679
|
return (definition) => {
|
|
14640
|
-
|
|
14641
|
-
definition.
|
|
14642
|
-
(
|
|
14680
|
+
definition.findHostDirectiveDefs = findHostDirectiveDefs;
|
|
14681
|
+
definition.hostDirectives =
|
|
14682
|
+
(Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives()).map(dir => {
|
|
14683
|
+
return typeof dir === 'function' ?
|
|
14684
|
+
{ directive: resolveForwardRef(dir), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } :
|
|
14685
|
+
{
|
|
14686
|
+
directive: resolveForwardRef(dir.directive),
|
|
14687
|
+
inputs: bindingArrayToMap(dir.inputs),
|
|
14688
|
+
outputs: bindingArrayToMap(dir.outputs)
|
|
14689
|
+
};
|
|
14690
|
+
});
|
|
14643
14691
|
};
|
|
14644
14692
|
}
|
|
14693
|
+
function findHostDirectiveDefs(matches, def, tView, lView, tNode) {
|
|
14694
|
+
if (def.hostDirectives !== null) {
|
|
14695
|
+
for (const hostDirectiveConfig of def.hostDirectives) {
|
|
14696
|
+
const hostDirectiveDef = getDirectiveDef(hostDirectiveConfig.directive);
|
|
14697
|
+
// TODO(crisbeto): assert that the def exists.
|
|
14698
|
+
// Host directives execute before the host so that its host bindings can be overwritten.
|
|
14699
|
+
findHostDirectiveDefs(matches, hostDirectiveDef, tView, lView, tNode);
|
|
14700
|
+
}
|
|
14701
|
+
}
|
|
14702
|
+
// Push the def itself at the end since it needs to execute after the host directives.
|
|
14703
|
+
matches.push(def);
|
|
14704
|
+
}
|
|
14645
14705
|
/**
|
|
14646
14706
|
* Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
|
|
14647
14707
|
* a map in the form of `{publicName: 'alias', otherPublicName: 'otherAlias'}`.
|
|
14648
14708
|
*/
|
|
14649
14709
|
function bindingArrayToMap(bindings) {
|
|
14650
|
-
if (
|
|
14710
|
+
if (bindings === undefined || bindings.length === 0) {
|
|
14651
14711
|
return EMPTY_OBJ;
|
|
14652
14712
|
}
|
|
14653
14713
|
const result = {};
|
|
14654
|
-
for (let i =
|
|
14655
|
-
result[bindings[i
|
|
14714
|
+
for (let i = 0; i < bindings.length; i += 2) {
|
|
14715
|
+
result[bindings[i]] = bindings[i + 1];
|
|
14656
14716
|
}
|
|
14657
14717
|
return result;
|
|
14658
14718
|
}
|
|
@@ -15611,7 +15671,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
15611
15671
|
if (styles !== null) {
|
|
15612
15672
|
writeDirectStyle(renderer, native, styles);
|
|
15613
15673
|
}
|
|
15614
|
-
if ((tNode.flags &
|
|
15674
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
15615
15675
|
// In the i18n case, the translation may have removed this element, so only add it if it is not
|
|
15616
15676
|
// detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
15617
15677
|
appendChild(tView, lView, native, tNode);
|
|
@@ -16049,9 +16109,7 @@ function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault)
|
|
|
16049
16109
|
}
|
|
16050
16110
|
// In order to be backwards compatible with View Engine, events on component host nodes
|
|
16051
16111
|
// must also mark the component view itself dirty (i.e. the view that it owns).
|
|
16052
|
-
const startView = tNode.
|
|
16053
|
-
getComponentLViewByIndex(tNode.index, lView) :
|
|
16054
|
-
lView;
|
|
16112
|
+
const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
|
|
16055
16113
|
markViewDirty(startView);
|
|
16056
16114
|
let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
|
|
16057
16115
|
// A just-invoked listener function might have coalesced listeners so we need to check for
|
|
@@ -16208,7 +16266,7 @@ function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
|
|
|
16208
16266
|
tProjectionNode.projection = selectorIndex;
|
|
16209
16267
|
// `<ng-content>` has no content
|
|
16210
16268
|
setCurrentTNodeAsNotParent();
|
|
16211
|
-
if ((tProjectionNode.flags &
|
|
16269
|
+
if ((tProjectionNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
16212
16270
|
// re-distribution of projectable nodes is stored on a component's view level
|
|
16213
16271
|
applyProjection(tView, lView, tProjectionNode);
|
|
16214
16272
|
}
|
|
@@ -18122,7 +18180,7 @@ function normalizeSuffix(value, suffix) {
|
|
|
18122
18180
|
* @param isClassBased `true` if `class` (`false` if `style`)
|
|
18123
18181
|
*/
|
|
18124
18182
|
function hasStylingInputShadow(tNode, isClassBased) {
|
|
18125
|
-
return (tNode.flags & (isClassBased ?
|
|
18183
|
+
return (tNode.flags & (isClassBased ? 8 /* TNodeFlags.hasClassInput */ : 16 /* TNodeFlags.hasStyleInput */)) !== 0;
|
|
18126
18184
|
}
|
|
18127
18185
|
|
|
18128
18186
|
/**
|
|
@@ -19814,7 +19872,7 @@ function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parent
|
|
|
19814
19872
|
anchorRNode = i18nParent;
|
|
19815
19873
|
i18nParent = parentRElement;
|
|
19816
19874
|
}
|
|
19817
|
-
if (i18nParent !== null &&
|
|
19875
|
+
if (i18nParent !== null && childTNode.componentOffset === -1) {
|
|
19818
19876
|
for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
|
|
19819
19877
|
// No need to `unwrapRNode` because all of the indexes point to i18n text nodes.
|
|
19820
19878
|
// see `assertDomNode` below.
|