@angular/core 15.0.0-next.1 → 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 +16 -18
- package/esm2020/src/render3/context_discovery.mjs +12 -9
- package/esm2020/src/render3/definition.mjs +3 -2
- package/esm2020/src/render3/di.mjs +3 -3
- package/esm2020/src/render3/features/host_directives_feature.mjs +36 -13
- package/esm2020/src/render3/i18n/i18n_parse.mjs +3 -6
- package/esm2020/src/render3/instructions/element.mjs +1 -1
- package/esm2020/src/render3/instructions/element_validation.mjs +2 -2
- 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 +75 -93
- package/esm2020/src/render3/instructions/styling.mjs +2 -2
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/interfaces/injector.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/interfaces/view.mjs +1 -1
- 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/render3/util/discovery_utils.mjs +2 -2
- package/esm2020/src/render3/util/view_traversal_utils.mjs +5 -5
- package/esm2020/src/render3/view_ref.mjs +10 -4
- package/esm2020/src/sanitization/html_sanitizer.mjs +4 -8
- package/esm2020/src/sanitization/url_sanitizer.mjs +1 -5
- 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 +178 -174
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +170 -172
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +177 -173
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +170 -171
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +44 -32
- 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
|
/**
|
|
@@ -4893,7 +4894,7 @@ function injectAttributeImpl(tNode, attrNameToInject) {
|
|
|
4893
4894
|
return null;
|
|
4894
4895
|
}
|
|
4895
4896
|
function notFoundValueOrThrow(notFoundValue, token, flags) {
|
|
4896
|
-
if (flags & InjectFlags.Optional) {
|
|
4897
|
+
if ((flags & InjectFlags.Optional) || notFoundValue !== undefined) {
|
|
4897
4898
|
return notFoundValue;
|
|
4898
4899
|
}
|
|
4899
4900
|
else {
|
|
@@ -4910,7 +4911,7 @@ function notFoundValueOrThrow(notFoundValue, token, flags) {
|
|
|
4910
4911
|
* @returns the value from the injector or throws an exception
|
|
4911
4912
|
*/
|
|
4912
4913
|
function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {
|
|
4913
|
-
if (flags & InjectFlags.Optional && notFoundValue === undefined) {
|
|
4914
|
+
if ((flags & InjectFlags.Optional) && notFoundValue === undefined) {
|
|
4914
4915
|
// This must be set or the NullInjector will throw for optional deps
|
|
4915
4916
|
notFoundValue = null;
|
|
4916
4917
|
}
|
|
@@ -6102,10 +6103,6 @@ function _sanitizeUrl(url) {
|
|
|
6102
6103
|
}
|
|
6103
6104
|
return 'unsafe:' + url;
|
|
6104
6105
|
}
|
|
6105
|
-
function sanitizeSrcset(srcset) {
|
|
6106
|
-
srcset = String(srcset);
|
|
6107
|
-
return srcset.split(',').map((srcset) => _sanitizeUrl(srcset.trim())).join(', ');
|
|
6108
|
-
}
|
|
6109
6106
|
|
|
6110
6107
|
/**
|
|
6111
6108
|
* @license
|
|
@@ -6152,12 +6149,10 @@ const INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,a
|
|
|
6152
6149
|
const VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
|
|
6153
6150
|
// Attributes that have href and hence need to be sanitized
|
|
6154
6151
|
const URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
|
|
6155
|
-
// Attributes that have special href set hence need to be sanitized
|
|
6156
|
-
const SRCSET_ATTRS = tagSet('srcset');
|
|
6157
6152
|
const HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
|
|
6158
6153
|
'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
|
|
6159
6154
|
'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
|
|
6160
|
-
'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
|
|
6155
|
+
'scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,' +
|
|
6161
6156
|
'valign,value,vspace,width');
|
|
6162
6157
|
// Accessibility attributes as per WAI-ARIA 1.1 (W3C Working Draft 14 December 2018)
|
|
6163
6158
|
const ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,' +
|
|
@@ -6173,7 +6168,7 @@ const ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,a
|
|
|
6173
6168
|
// NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
|
|
6174
6169
|
// can be sanitized, but they increase security surface area without a legitimate use case, so they
|
|
6175
6170
|
// are left out here.
|
|
6176
|
-
const VALID_ATTRS = merge(URI_ATTRS,
|
|
6171
|
+
const VALID_ATTRS = merge(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS);
|
|
6177
6172
|
// Elements whose content should not be traversed/preserved, if the elements themselves are invalid.
|
|
6178
6173
|
//
|
|
6179
6174
|
// Typically, `<invalid>Some content</invalid>` would traverse (and in this case preserve)
|
|
@@ -6256,8 +6251,6 @@ class SanitizingHtmlSerializer {
|
|
|
6256
6251
|
// TODO(martinprobst): Special case image URIs for data:image/...
|
|
6257
6252
|
if (URI_ATTRS[lower])
|
|
6258
6253
|
value = _sanitizeUrl(value);
|
|
6259
|
-
if (SRCSET_ATTRS[lower])
|
|
6260
|
-
value = sanitizeSrcset(value);
|
|
6261
6254
|
this.buf.push(' ', attrName, '="', encodeEntities(value), '"');
|
|
6262
6255
|
}
|
|
6263
6256
|
this.buf.push('>');
|
|
@@ -7644,7 +7637,7 @@ class Version {
|
|
|
7644
7637
|
/**
|
|
7645
7638
|
* @publicApi
|
|
7646
7639
|
*/
|
|
7647
|
-
const VERSION = new Version('15.0.0-next.
|
|
7640
|
+
const VERSION = new Version('15.0.0-next.3');
|
|
7648
7641
|
|
|
7649
7642
|
/**
|
|
7650
7643
|
* @license
|
|
@@ -7948,7 +7941,7 @@ function getTemplateLocationDetails(lView) {
|
|
|
7948
7941
|
* that the `CommonModule` should also be included.
|
|
7949
7942
|
*/
|
|
7950
7943
|
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
|
|
7951
|
-
['ngIf', 'NgIf'], ['ngFor', '
|
|
7944
|
+
['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
|
|
7952
7945
|
['ngSwitchDefault', 'NgSwitchDefault']
|
|
7953
7946
|
]);
|
|
7954
7947
|
/**
|
|
@@ -8464,18 +8457,21 @@ function findViaDirective(lView, directiveInstance) {
|
|
|
8464
8457
|
*/
|
|
8465
8458
|
function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
8466
8459
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
8467
|
-
|
|
8468
|
-
if (directiveStartIndex == 0)
|
|
8460
|
+
if (tNode.directiveStart === 0)
|
|
8469
8461
|
return EMPTY_ARRAY;
|
|
8470
|
-
const
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
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;
|
|
8474
8470
|
}
|
|
8475
8471
|
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
8476
8472
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
8477
|
-
|
|
8478
|
-
return
|
|
8473
|
+
const { directiveStart, componentOffset } = tNode;
|
|
8474
|
+
return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
|
|
8479
8475
|
}
|
|
8480
8476
|
/**
|
|
8481
8477
|
* Returns a map of local references (local reference name => element or directive instance) that
|
|
@@ -8697,16 +8693,16 @@ function getRootView(componentOrLView) {
|
|
|
8697
8693
|
return lView;
|
|
8698
8694
|
}
|
|
8699
8695
|
/**
|
|
8700
|
-
* Returns the
|
|
8701
|
-
*
|
|
8702
|
-
*
|
|
8696
|
+
* Returns the context information associated with the application where the target is situated. It
|
|
8697
|
+
* does this by walking the parent views until it gets to the root view, then getting the context
|
|
8698
|
+
* off of that.
|
|
8703
8699
|
*
|
|
8704
8700
|
* @param viewOrComponent the `LView` or component to get the root context for.
|
|
8705
8701
|
*/
|
|
8706
8702
|
function getRootContext(viewOrComponent) {
|
|
8707
8703
|
const rootView = getRootView(viewOrComponent);
|
|
8708
8704
|
ngDevMode &&
|
|
8709
|
-
assertDefined(rootView[CONTEXT], '
|
|
8705
|
+
assertDefined(rootView[CONTEXT], 'Root view has no context. Perhaps it is disconnected?');
|
|
8710
8706
|
return rootView[CONTEXT];
|
|
8711
8707
|
}
|
|
8712
8708
|
/**
|
|
@@ -9223,9 +9219,10 @@ function getClosestRElement(tView, tNode, lView) {
|
|
|
9223
9219
|
}
|
|
9224
9220
|
else {
|
|
9225
9221
|
ngDevMode && assertTNodeType(parentTNode, 3 /* TNodeType.AnyRNode */ | 4 /* TNodeType.Container */);
|
|
9226
|
-
|
|
9222
|
+
const { componentOffset } = parentTNode;
|
|
9223
|
+
if (componentOffset > -1) {
|
|
9227
9224
|
ngDevMode && assertTNodeForLView(parentTNode, lView);
|
|
9228
|
-
const encapsulation = tView.data[parentTNode.directiveStart]
|
|
9225
|
+
const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
|
|
9229
9226
|
// We've got a parent which is an element in the current view. We just need to verify if the
|
|
9230
9227
|
// parent element is not a component. Component's content nodes are not inserted immediately
|
|
9231
9228
|
// because they will be projected, and so doing insert at this point would be wasteful.
|
|
@@ -9458,10 +9455,10 @@ function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode,
|
|
|
9458
9455
|
if (isProjection) {
|
|
9459
9456
|
if (action === 0 /* WalkTNodeTreeAction.Create */) {
|
|
9460
9457
|
rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
|
|
9461
|
-
tNode.flags |=
|
|
9458
|
+
tNode.flags |= 2 /* TNodeFlags.isProjected */;
|
|
9462
9459
|
}
|
|
9463
9460
|
}
|
|
9464
|
-
if ((tNode.flags &
|
|
9461
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
9465
9462
|
if (tNodeType & 8 /* TNodeType.ElementContainer */) {
|
|
9466
9463
|
applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
|
|
9467
9464
|
applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
|
@@ -11516,6 +11513,7 @@ class TNode {
|
|
|
11516
11513
|
index, //
|
|
11517
11514
|
insertBeforeIndex, //
|
|
11518
11515
|
injectorIndex, //
|
|
11516
|
+
componentOffset, //
|
|
11519
11517
|
directiveStart, //
|
|
11520
11518
|
directiveEnd, //
|
|
11521
11519
|
directiveStylingLast, //
|
|
@@ -11548,6 +11546,7 @@ class TNode {
|
|
|
11548
11546
|
this.index = index;
|
|
11549
11547
|
this.insertBeforeIndex = insertBeforeIndex;
|
|
11550
11548
|
this.injectorIndex = injectorIndex;
|
|
11549
|
+
this.componentOffset = componentOffset;
|
|
11551
11550
|
this.directiveStart = directiveStart;
|
|
11552
11551
|
this.directiveEnd = directiveEnd;
|
|
11553
11552
|
this.directiveStylingLast = directiveStylingLast;
|
|
@@ -11625,21 +11624,19 @@ class TNode {
|
|
|
11625
11624
|
}
|
|
11626
11625
|
get flags_() {
|
|
11627
11626
|
const flags = [];
|
|
11628
|
-
if (this.flags &
|
|
11627
|
+
if (this.flags & 8 /* TNodeFlags.hasClassInput */)
|
|
11629
11628
|
flags.push('TNodeFlags.hasClassInput');
|
|
11630
|
-
if (this.flags &
|
|
11629
|
+
if (this.flags & 4 /* TNodeFlags.hasContentQuery */)
|
|
11631
11630
|
flags.push('TNodeFlags.hasContentQuery');
|
|
11632
|
-
if (this.flags &
|
|
11631
|
+
if (this.flags & 16 /* TNodeFlags.hasStyleInput */)
|
|
11633
11632
|
flags.push('TNodeFlags.hasStyleInput');
|
|
11634
|
-
if (this.flags &
|
|
11633
|
+
if (this.flags & 64 /* TNodeFlags.hasHostBindings */)
|
|
11635
11634
|
flags.push('TNodeFlags.hasHostBindings');
|
|
11636
|
-
if (this.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
11637
|
-
flags.push('TNodeFlags.isComponentHost');
|
|
11638
11635
|
if (this.flags & 1 /* TNodeFlags.isDirectiveHost */)
|
|
11639
11636
|
flags.push('TNodeFlags.isDirectiveHost');
|
|
11640
|
-
if (this.flags &
|
|
11637
|
+
if (this.flags & 32 /* TNodeFlags.isDetached */)
|
|
11641
11638
|
flags.push('TNodeFlags.isDetached');
|
|
11642
|
-
if (this.flags &
|
|
11639
|
+
if (this.flags & 2 /* TNodeFlags.isProjected */)
|
|
11643
11640
|
flags.push('TNodeFlags.isProjected');
|
|
11644
11641
|
return flags.join('|');
|
|
11645
11642
|
}
|
|
@@ -12149,7 +12146,7 @@ function getOrCreateTNode(tView, index, type, name, attrs) {
|
|
|
12149
12146
|
// See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
12150
12147
|
// If the `TNode` was not pre-declared than it means it was not mentioned which means it was
|
|
12151
12148
|
// removed, so we mark it as detached.
|
|
12152
|
-
tNode.flags |=
|
|
12149
|
+
tNode.flags |= 32 /* TNodeFlags.isDetached */;
|
|
12153
12150
|
}
|
|
12154
12151
|
}
|
|
12155
12152
|
else if (tNode.type & 64 /* TNodeType.Placeholder */) {
|
|
@@ -12411,28 +12408,6 @@ function refreshView(tView, lView, templateFn, context) {
|
|
|
12411
12408
|
leaveView();
|
|
12412
12409
|
}
|
|
12413
12410
|
}
|
|
12414
|
-
function renderComponentOrTemplate(tView, lView, templateFn, context) {
|
|
12415
|
-
const rendererFactory = lView[RENDERER_FACTORY];
|
|
12416
|
-
// Check no changes mode is a dev only mode used to verify that bindings have not changed
|
|
12417
|
-
// since they were assigned. We do not want to invoke renderer factory functions in that mode
|
|
12418
|
-
// to avoid any possible side-effects.
|
|
12419
|
-
const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
|
|
12420
|
-
const creationModeIsActive = isCreationMode(lView);
|
|
12421
|
-
try {
|
|
12422
|
-
if (!checkNoChangesMode && !creationModeIsActive && rendererFactory.begin) {
|
|
12423
|
-
rendererFactory.begin();
|
|
12424
|
-
}
|
|
12425
|
-
if (creationModeIsActive) {
|
|
12426
|
-
renderView(tView, lView, context);
|
|
12427
|
-
}
|
|
12428
|
-
refreshView(tView, lView, templateFn, context);
|
|
12429
|
-
}
|
|
12430
|
-
finally {
|
|
12431
|
-
if (!checkNoChangesMode && !creationModeIsActive && rendererFactory.end) {
|
|
12432
|
-
rendererFactory.end();
|
|
12433
|
-
}
|
|
12434
|
-
}
|
|
12435
|
-
}
|
|
12436
12411
|
function executeTemplate(tView, lView, templateFn, rf, context) {
|
|
12437
12412
|
const prevSelectedIndex = getSelectedIndex();
|
|
12438
12413
|
const isUpdatePhase = rf & 2 /* RenderFlags.Update */;
|
|
@@ -12475,7 +12450,7 @@ function createDirectivesInstances(tView, lView, tNode) {
|
|
|
12475
12450
|
if (!getBindingsEnabled())
|
|
12476
12451
|
return;
|
|
12477
12452
|
instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
|
|
12478
|
-
if ((tNode.flags &
|
|
12453
|
+
if ((tNode.flags & 64 /* TNodeFlags.hasHostBindings */) === 64 /* TNodeFlags.hasHostBindings */) {
|
|
12479
12454
|
invokeDirectivesHostBindings(tView, lView, tNode);
|
|
12480
12455
|
}
|
|
12481
12456
|
}
|
|
@@ -12503,7 +12478,7 @@ function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNative
|
|
|
12503
12478
|
* @param def ComponentDef
|
|
12504
12479
|
* @returns TView
|
|
12505
12480
|
*/
|
|
12506
|
-
function
|
|
12481
|
+
function getOrCreateComponentTView(def) {
|
|
12507
12482
|
const tView = def.tView;
|
|
12508
12483
|
// Create a TView if there isn't one, or recreate it if the first create pass didn't
|
|
12509
12484
|
// complete successfully since we can't know for sure whether it's in a usable shape.
|
|
@@ -12675,6 +12650,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12675
12650
|
index, // index: number
|
|
12676
12651
|
null, // insertBeforeIndex: null|-1|number|number[]
|
|
12677
12652
|
injectorIndex, // injectorIndex: number
|
|
12653
|
+
-1, // componentOffset: number
|
|
12678
12654
|
-1, // directiveStart: number
|
|
12679
12655
|
-1, // directiveEnd: number
|
|
12680
12656
|
-1, // directiveStylingLast: number
|
|
@@ -12710,6 +12686,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12710
12686
|
directiveStart: -1,
|
|
12711
12687
|
directiveEnd: -1,
|
|
12712
12688
|
directiveStylingLast: -1,
|
|
12689
|
+
componentOffset: -1,
|
|
12713
12690
|
propertyBindings: null,
|
|
12714
12691
|
flags: 0,
|
|
12715
12692
|
providerIndexes: 0,
|
|
@@ -12773,24 +12750,23 @@ function initializeInputAndOutputAliases(tView, tNode) {
|
|
|
12773
12750
|
let outputsStore = null;
|
|
12774
12751
|
for (let i = start; i < end; i++) {
|
|
12775
12752
|
const directiveDef = tViewData[i];
|
|
12776
|
-
|
|
12753
|
+
inputsStore = generatePropertyAliases(directiveDef.inputs, i, inputsStore);
|
|
12754
|
+
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
|
12777
12755
|
// Do not use unbound attributes as inputs to structural directives, since structural
|
|
12778
12756
|
// directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
|
|
12779
12757
|
// TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
|
|
12780
12758
|
// should be set for inline templates.
|
|
12781
|
-
const initialInputs = (tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12782
|
-
generateInitialInputs(
|
|
12759
|
+
const initialInputs = (inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12760
|
+
generateInitialInputs(inputsStore, i, tNodeAttrs) :
|
|
12783
12761
|
null;
|
|
12784
12762
|
inputsFromAttrs.push(initialInputs);
|
|
12785
|
-
inputsStore = generatePropertyAliases(directiveInputs, i, inputsStore);
|
|
12786
|
-
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
|
12787
12763
|
}
|
|
12788
12764
|
if (inputsStore !== null) {
|
|
12789
12765
|
if (inputsStore.hasOwnProperty('class')) {
|
|
12790
|
-
tNode.flags |=
|
|
12766
|
+
tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
|
|
12791
12767
|
}
|
|
12792
12768
|
if (inputsStore.hasOwnProperty('style')) {
|
|
12793
|
-
tNode.flags |=
|
|
12769
|
+
tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
|
|
12794
12770
|
}
|
|
12795
12771
|
}
|
|
12796
12772
|
tNode.initialInputs = inputsFromAttrs;
|
|
@@ -12911,7 +12887,7 @@ function instantiateRootComponent(tView, lView, def) {
|
|
|
12911
12887
|
configureViewWithDirective(tView, rootTNode, lView, directiveIndex, def);
|
|
12912
12888
|
initializeInputAndOutputAliases(tView, rootTNode);
|
|
12913
12889
|
}
|
|
12914
|
-
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart, rootTNode);
|
|
12890
|
+
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
|
|
12915
12891
|
attachPatchData(directive, lView);
|
|
12916
12892
|
const native = getNativeByTNode(rootTNode, lView);
|
|
12917
12893
|
if (native) {
|
|
@@ -12928,7 +12904,10 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12928
12904
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12929
12905
|
let hasDirectives = false;
|
|
12930
12906
|
if (getBindingsEnabled()) {
|
|
12931
|
-
const
|
|
12907
|
+
const directiveDefsMatchedBySelectors = findDirectiveDefMatches(tView, lView, tNode);
|
|
12908
|
+
const directiveDefs = directiveDefsMatchedBySelectors ?
|
|
12909
|
+
findHostDirectiveDefs$1(directiveDefsMatchedBySelectors, tView, lView, tNode) :
|
|
12910
|
+
null;
|
|
12932
12911
|
const exportsMap = localRefs === null ? null : { '': -1 };
|
|
12933
12912
|
if (directiveDefs !== null) {
|
|
12934
12913
|
hasDirectives = true;
|
|
@@ -12957,9 +12936,9 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12957
12936
|
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
12958
12937
|
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
12959
12938
|
if (def.contentQueries !== null)
|
|
12960
|
-
tNode.flags |=
|
|
12939
|
+
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
12961
12940
|
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
12962
|
-
tNode.flags |=
|
|
12941
|
+
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
12963
12942
|
const lifeCycleHooks = def.type.prototype;
|
|
12964
12943
|
// Only push a node index into the preOrderHooks array if this is the first
|
|
12965
12944
|
// pre-order hook found on this node.
|
|
@@ -13098,7 +13077,6 @@ function invokeHostBindingsInCreationMode(def, directive) {
|
|
|
13098
13077
|
* If a component is matched (at most one), it is returned in first position in the array.
|
|
13099
13078
|
*/
|
|
13100
13079
|
function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
13101
|
-
var _a;
|
|
13102
13080
|
ngDevMode && assertFirstCreatePass(tView);
|
|
13103
13081
|
ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
|
|
13104
13082
|
const registry = tView.directiveRegistry;
|
|
@@ -13113,20 +13091,19 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
|
13113
13091
|
if (ngDevMode) {
|
|
13114
13092
|
assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
|
|
13115
13093
|
`Please use a different tag to activate the ${stringify(def.type)} component.`);
|
|
13116
|
-
if (tNode
|
|
13094
|
+
if (isComponentHost(tNode)) {
|
|
13117
13095
|
// If another component has been matched previously, it's the first element in the
|
|
13118
13096
|
// `matches` array, see how we store components/directives in `matches` below.
|
|
13119
13097
|
throwMultipleComponentError(tNode, matches[0].type, def.type);
|
|
13120
13098
|
}
|
|
13121
13099
|
}
|
|
13122
|
-
markAsComponentHost(tView, tNode);
|
|
13100
|
+
markAsComponentHost(tView, tNode, 0);
|
|
13123
13101
|
// The component is always stored first with directives after.
|
|
13124
13102
|
matches.unshift(def);
|
|
13125
13103
|
}
|
|
13126
13104
|
else {
|
|
13127
13105
|
matches.push(def);
|
|
13128
13106
|
}
|
|
13129
|
-
(_a = def.applyHostDirectives) === null || _a === void 0 ? void 0 : _a.call(def, tView, viewData, tNode, matches);
|
|
13130
13107
|
}
|
|
13131
13108
|
}
|
|
13132
13109
|
}
|
|
@@ -13134,15 +13111,36 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
|
13134
13111
|
}
|
|
13135
13112
|
/**
|
|
13136
13113
|
* Marks a given TNode as a component's host. This consists of:
|
|
13137
|
-
* - setting
|
|
13114
|
+
* - setting the component offset on the TNode.
|
|
13138
13115
|
* - storing index of component's host element so it will be queued for view refresh during CD.
|
|
13139
13116
|
*/
|
|
13140
|
-
function markAsComponentHost(tView, hostTNode) {
|
|
13117
|
+
function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
13141
13118
|
ngDevMode && assertFirstCreatePass(tView);
|
|
13142
|
-
|
|
13119
|
+
ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
|
|
13120
|
+
hostTNode.componentOffset = componentOffset;
|
|
13143
13121
|
(tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
|
|
13144
13122
|
.push(hostTNode.index);
|
|
13145
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
|
+
}
|
|
13146
13144
|
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
13147
13145
|
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
13148
13146
|
if (localRefs) {
|
|
@@ -13214,7 +13212,7 @@ function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
|
|
|
13214
13212
|
}
|
|
13215
13213
|
function addComponentLogic(lView, hostTNode, def) {
|
|
13216
13214
|
const native = getNativeByTNode(hostTNode, lView);
|
|
13217
|
-
const tView =
|
|
13215
|
+
const tView = getOrCreateComponentTView(def);
|
|
13218
13216
|
// Only component views should be added to the view tree directly. Embedded views are
|
|
13219
13217
|
// accessed through their containers because they may be removed / re-added later.
|
|
13220
13218
|
const rendererFactory = lView[RENDERER_FACTORY];
|
|
@@ -13285,10 +13283,11 @@ function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initial
|
|
|
13285
13283
|
*
|
|
13286
13284
|
* <my-component name="Bess"></my-component>
|
|
13287
13285
|
*
|
|
13288
|
-
* @param inputs
|
|
13289
|
-
* @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.
|
|
13290
13289
|
*/
|
|
13291
|
-
function generateInitialInputs(inputs, attrs) {
|
|
13290
|
+
function generateInitialInputs(inputs, directiveIndex, attrs) {
|
|
13292
13291
|
let inputsToStore = null;
|
|
13293
13292
|
let i = 0;
|
|
13294
13293
|
while (i < attrs.length) {
|
|
@@ -13309,7 +13308,17 @@ function generateInitialInputs(inputs, attrs) {
|
|
|
13309
13308
|
if (inputs.hasOwnProperty(attrName)) {
|
|
13310
13309
|
if (inputsToStore === null)
|
|
13311
13310
|
inputsToStore = [];
|
|
13312
|
-
|
|
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
|
+
}
|
|
13313
13322
|
}
|
|
13314
13323
|
i += 2;
|
|
13315
13324
|
}
|
|
@@ -13541,63 +13550,32 @@ function markViewDirty(lView) {
|
|
|
13541
13550
|
}
|
|
13542
13551
|
return null;
|
|
13543
13552
|
}
|
|
13544
|
-
function
|
|
13545
|
-
for (let i = 0; i < rootContext.components.length; i++) {
|
|
13546
|
-
const rootComponent = rootContext.components[i];
|
|
13547
|
-
const lView = readPatchedLView(rootComponent);
|
|
13548
|
-
// We might not have an `LView` if the component was destroyed.
|
|
13549
|
-
if (lView !== null) {
|
|
13550
|
-
const tView = lView[TVIEW];
|
|
13551
|
-
renderComponentOrTemplate(tView, lView, tView.template, rootComponent);
|
|
13552
|
-
}
|
|
13553
|
-
}
|
|
13554
|
-
}
|
|
13555
|
-
function detectChangesInternal(tView, lView, context) {
|
|
13553
|
+
function detectChangesInternal(tView, lView, context, notifyErrorHandler = true) {
|
|
13556
13554
|
const rendererFactory = lView[RENDERER_FACTORY];
|
|
13557
|
-
|
|
13555
|
+
// Check no changes mode is a dev only mode used to verify that bindings have not changed
|
|
13556
|
+
// since they were assigned. We do not want to invoke renderer factory functions in that mode
|
|
13557
|
+
// to avoid any possible side-effects.
|
|
13558
|
+
const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
|
|
13559
|
+
if (!checkNoChangesMode && rendererFactory.begin)
|
|
13558
13560
|
rendererFactory.begin();
|
|
13559
13561
|
try {
|
|
13560
13562
|
refreshView(tView, lView, tView.template, context);
|
|
13561
13563
|
}
|
|
13562
13564
|
catch (error) {
|
|
13563
|
-
|
|
13565
|
+
if (notifyErrorHandler) {
|
|
13566
|
+
handleError(lView, error);
|
|
13567
|
+
}
|
|
13564
13568
|
throw error;
|
|
13565
13569
|
}
|
|
13566
13570
|
finally {
|
|
13567
|
-
if (rendererFactory.end)
|
|
13571
|
+
if (!checkNoChangesMode && rendererFactory.end)
|
|
13568
13572
|
rendererFactory.end();
|
|
13569
13573
|
}
|
|
13570
13574
|
}
|
|
13571
|
-
|
|
13572
|
-
* Synchronously perform change detection on a root view and its components.
|
|
13573
|
-
*
|
|
13574
|
-
* @param lView The view which the change detection should be performed on.
|
|
13575
|
-
*/
|
|
13576
|
-
function detectChangesInRootView(lView) {
|
|
13577
|
-
tickRootContext(lView[CONTEXT]);
|
|
13578
|
-
}
|
|
13579
|
-
function checkNoChangesInternal(tView, view, context) {
|
|
13580
|
-
setIsInCheckNoChangesMode(true);
|
|
13581
|
-
try {
|
|
13582
|
-
detectChangesInternal(tView, view, context);
|
|
13583
|
-
}
|
|
13584
|
-
finally {
|
|
13585
|
-
setIsInCheckNoChangesMode(false);
|
|
13586
|
-
}
|
|
13587
|
-
}
|
|
13588
|
-
/**
|
|
13589
|
-
* Checks the change detector on a root view and its components, and throws if any changes are
|
|
13590
|
-
* detected.
|
|
13591
|
-
*
|
|
13592
|
-
* This is used in development mode to verify that running change detection doesn't
|
|
13593
|
-
* introduce other changes.
|
|
13594
|
-
*
|
|
13595
|
-
* @param lView The view which the change detection should be checked on.
|
|
13596
|
-
*/
|
|
13597
|
-
function checkNoChangesInRootView(lView) {
|
|
13575
|
+
function checkNoChangesInternal(tView, lView, context, notifyErrorHandler = true) {
|
|
13598
13576
|
setIsInCheckNoChangesMode(true);
|
|
13599
13577
|
try {
|
|
13600
|
-
|
|
13578
|
+
detectChangesInternal(tView, lView, context, notifyErrorHandler);
|
|
13601
13579
|
}
|
|
13602
13580
|
finally {
|
|
13603
13581
|
setIsInCheckNoChangesMode(false);
|
|
@@ -14090,11 +14068,17 @@ class RootViewRef extends ViewRef {
|
|
|
14090
14068
|
this._view = _view;
|
|
14091
14069
|
}
|
|
14092
14070
|
detectChanges() {
|
|
14093
|
-
|
|
14071
|
+
const lView = this._view;
|
|
14072
|
+
const tView = lView[TVIEW];
|
|
14073
|
+
const context = lView[CONTEXT];
|
|
14074
|
+
detectChangesInternal(tView, lView, context, false);
|
|
14094
14075
|
}
|
|
14095
14076
|
checkNoChanges() {
|
|
14096
14077
|
if (ngDevMode) {
|
|
14097
|
-
|
|
14078
|
+
const lView = this._view;
|
|
14079
|
+
const tView = lView[TVIEW];
|
|
14080
|
+
const context = lView[CONTEXT];
|
|
14081
|
+
checkNoChangesInternal(tView, lView, context, false);
|
|
14098
14082
|
}
|
|
14099
14083
|
}
|
|
14100
14084
|
get context() {
|
|
@@ -14161,7 +14145,7 @@ class ChainedInjector {
|
|
|
14161
14145
|
}
|
|
14162
14146
|
}
|
|
14163
14147
|
/**
|
|
14164
|
-
*
|
|
14148
|
+
* ComponentFactory interface implementation.
|
|
14165
14149
|
*/
|
|
14166
14150
|
class ComponentFactory extends ComponentFactory$1 {
|
|
14167
14151
|
/**
|
|
@@ -14211,10 +14195,9 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
14211
14195
|
createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
|
|
14212
14196
|
const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
|
|
14213
14197
|
16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
|
|
14214
|
-
const rootContext = createRootContext();
|
|
14215
14198
|
// Create the root view. Uses empty TView and ContentTemplate.
|
|
14216
14199
|
const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
|
|
14217
|
-
const rootLView = createLView(null, rootTView,
|
|
14200
|
+
const rootLView = createLView(null, rootTView, null, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
|
|
14218
14201
|
// rootView is the parent when bootstrapping
|
|
14219
14202
|
// TODO(misko): it looks like we are entering view here but we don't really need to as
|
|
14220
14203
|
// `renderView` does that. However as the code is written it is needed because
|
|
@@ -14258,7 +14241,8 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
14258
14241
|
// TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
|
|
14259
14242
|
// executed here?
|
|
14260
14243
|
// Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
|
|
14261
|
-
component =
|
|
14244
|
+
component =
|
|
14245
|
+
createRootComponent(componentView, this.componentDef, rootLView, [LifecycleHooksFeature]);
|
|
14262
14246
|
renderView(rootTView, rootLView, null);
|
|
14263
14247
|
}
|
|
14264
14248
|
finally {
|
|
@@ -14364,10 +14348,10 @@ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRend
|
|
|
14364
14348
|
}
|
|
14365
14349
|
}
|
|
14366
14350
|
const viewRenderer = rendererFactory.createRenderer(rNode, def);
|
|
14367
|
-
const componentView = createLView(rootView,
|
|
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);
|
|
14368
14352
|
if (tView.firstCreatePass) {
|
|
14369
14353
|
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
|
|
14370
|
-
markAsComponentHost(tView, tNode);
|
|
14354
|
+
markAsComponentHost(tView, tNode, 0);
|
|
14371
14355
|
initTNodeFlags(tNode, rootView.length, 1);
|
|
14372
14356
|
}
|
|
14373
14357
|
addToViewTree(rootView, componentView);
|
|
@@ -14378,12 +14362,13 @@ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRend
|
|
|
14378
14362
|
* Creates a root component and sets it up with features and host bindings.Shared by
|
|
14379
14363
|
* renderComponent() and ViewContainerRef.createComponent().
|
|
14380
14364
|
*/
|
|
14381
|
-
function createRootComponent(componentView, componentDef, rootLView,
|
|
14365
|
+
function createRootComponent(componentView, componentDef, rootLView, hostFeatures) {
|
|
14382
14366
|
const tView = rootLView[TVIEW];
|
|
14383
14367
|
// Create directive instance with factory() and store at next index in viewData
|
|
14384
14368
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
14385
|
-
|
|
14386
|
-
|
|
14369
|
+
// Root view only contains an instance of this component,
|
|
14370
|
+
// so we use a reference to that component instance as a context.
|
|
14371
|
+
componentView[CONTEXT] = rootLView[CONTEXT] = component;
|
|
14387
14372
|
if (hostFeatures !== null) {
|
|
14388
14373
|
for (const feature of hostFeatures) {
|
|
14389
14374
|
feature(component, componentDef);
|
|
@@ -14407,9 +14392,6 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
14407
14392
|
}
|
|
14408
14393
|
return component;
|
|
14409
14394
|
}
|
|
14410
|
-
function createRootContext() {
|
|
14411
|
-
return { components: [] };
|
|
14412
|
-
}
|
|
14413
14395
|
/**
|
|
14414
14396
|
* Used to enable lifecycle hooks on the root component.
|
|
14415
14397
|
*
|
|
@@ -14666,6 +14648,13 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14666
14648
|
}
|
|
14667
14649
|
}
|
|
14668
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
|
+
*/
|
|
14669
14658
|
/**
|
|
14670
14659
|
* This feature add the host directives behavior to a directive definition by patching a
|
|
14671
14660
|
* function onto it. The expectation is that the runtime will invoke the function during
|
|
@@ -14687,29 +14676,43 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14687
14676
|
* @codeGenApi
|
|
14688
14677
|
*/
|
|
14689
14678
|
function ɵɵHostDirectivesFeature(rawHostDirectives) {
|
|
14690
|
-
const unwrappedHostDirectives = Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives();
|
|
14691
|
-
const hostDirectives = unwrappedHostDirectives.map(dir => typeof dir === 'function' ? { directive: dir, inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } : {
|
|
14692
|
-
directive: dir.directive,
|
|
14693
|
-
inputs: bindingArrayToMap(dir.inputs),
|
|
14694
|
-
outputs: bindingArrayToMap(dir.outputs)
|
|
14695
|
-
});
|
|
14696
14679
|
return (definition) => {
|
|
14697
|
-
|
|
14698
|
-
definition.
|
|
14699
|
-
(
|
|
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
|
+
});
|
|
14700
14691
|
};
|
|
14701
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
|
+
}
|
|
14702
14705
|
/**
|
|
14703
14706
|
* Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
|
|
14704
14707
|
* a map in the form of `{publicName: 'alias', otherPublicName: 'otherAlias'}`.
|
|
14705
14708
|
*/
|
|
14706
14709
|
function bindingArrayToMap(bindings) {
|
|
14707
|
-
if (
|
|
14710
|
+
if (bindings === undefined || bindings.length === 0) {
|
|
14708
14711
|
return EMPTY_OBJ;
|
|
14709
14712
|
}
|
|
14710
14713
|
const result = {};
|
|
14711
|
-
for (let i =
|
|
14712
|
-
result[bindings[i
|
|
14714
|
+
for (let i = 0; i < bindings.length; i += 2) {
|
|
14715
|
+
result[bindings[i]] = bindings[i + 1];
|
|
14713
14716
|
}
|
|
14714
14717
|
return result;
|
|
14715
14718
|
}
|
|
@@ -15668,7 +15671,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
15668
15671
|
if (styles !== null) {
|
|
15669
15672
|
writeDirectStyle(renderer, native, styles);
|
|
15670
15673
|
}
|
|
15671
|
-
if ((tNode.flags &
|
|
15674
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
15672
15675
|
// In the i18n case, the translation may have removed this element, so only add it if it is not
|
|
15673
15676
|
// detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
15674
15677
|
appendChild(tView, lView, native, tNode);
|
|
@@ -16106,9 +16109,7 @@ function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault)
|
|
|
16106
16109
|
}
|
|
16107
16110
|
// In order to be backwards compatible with View Engine, events on component host nodes
|
|
16108
16111
|
// must also mark the component view itself dirty (i.e. the view that it owns).
|
|
16109
|
-
const startView = tNode.
|
|
16110
|
-
getComponentLViewByIndex(tNode.index, lView) :
|
|
16111
|
-
lView;
|
|
16112
|
+
const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
|
|
16112
16113
|
markViewDirty(startView);
|
|
16113
16114
|
let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
|
|
16114
16115
|
// A just-invoked listener function might have coalesced listeners so we need to check for
|
|
@@ -16265,7 +16266,7 @@ function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
|
|
|
16265
16266
|
tProjectionNode.projection = selectorIndex;
|
|
16266
16267
|
// `<ng-content>` has no content
|
|
16267
16268
|
setCurrentTNodeAsNotParent();
|
|
16268
|
-
if ((tProjectionNode.flags &
|
|
16269
|
+
if ((tProjectionNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
16269
16270
|
// re-distribution of projectable nodes is stored on a component's view level
|
|
16270
16271
|
applyProjection(tView, lView, tProjectionNode);
|
|
16271
16272
|
}
|
|
@@ -18179,7 +18180,7 @@ function normalizeSuffix(value, suffix) {
|
|
|
18179
18180
|
* @param isClassBased `true` if `class` (`false` if `style`)
|
|
18180
18181
|
*/
|
|
18181
18182
|
function hasStylingInputShadow(tNode, isClassBased) {
|
|
18182
|
-
return (tNode.flags & (isClassBased ?
|
|
18183
|
+
return (tNode.flags & (isClassBased ? 8 /* TNodeFlags.hasClassInput */ : 16 /* TNodeFlags.hasStyleInput */)) !== 0;
|
|
18183
18184
|
}
|
|
18184
18185
|
|
|
18185
18186
|
/**
|
|
@@ -19871,7 +19872,7 @@ function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parent
|
|
|
19871
19872
|
anchorRNode = i18nParent;
|
|
19872
19873
|
i18nParent = parentRElement;
|
|
19873
19874
|
}
|
|
19874
|
-
if (i18nParent !== null &&
|
|
19875
|
+
if (i18nParent !== null && childTNode.componentOffset === -1) {
|
|
19875
19876
|
for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
|
|
19876
19877
|
// No need to `unwrapRNode` because all of the indexes point to i18n text nodes.
|
|
19877
19878
|
// see `assertDomNode` below.
|
|
@@ -21302,9 +21303,6 @@ function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, up
|
|
|
21302
21303
|
if (URI_ATTRS[lowerAttrName]) {
|
|
21303
21304
|
generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
|
|
21304
21305
|
}
|
|
21305
|
-
else if (SRCSET_ATTRS[lowerAttrName]) {
|
|
21306
|
-
generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, sanitizeSrcset);
|
|
21307
|
-
}
|
|
21308
21306
|
else {
|
|
21309
21307
|
generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
|
|
21310
21308
|
}
|
|
@@ -22273,7 +22271,7 @@ function getOwningComponent(elementOrDir) {
|
|
|
22273
22271
|
*/
|
|
22274
22272
|
function getRootComponents(elementOrDir) {
|
|
22275
22273
|
const lView = readPatchedLView(elementOrDir);
|
|
22276
|
-
return lView !== null ? [
|
|
22274
|
+
return lView !== null ? [getRootContext(lView)] : [];
|
|
22277
22275
|
}
|
|
22278
22276
|
/**
|
|
22279
22277
|
* Retrieves an `Injector` associated with an element, component or directive instance.
|