@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/core.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
|
*/
|
|
@@ -931,7 +931,8 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
931
931
|
setInput: null,
|
|
932
932
|
schemas: componentDefinition.schemas || null,
|
|
933
933
|
tView: null,
|
|
934
|
-
|
|
934
|
+
findHostDirectiveDefs: null,
|
|
935
|
+
hostDirectives: null,
|
|
935
936
|
};
|
|
936
937
|
const dependencies = componentDefinition.dependencies;
|
|
937
938
|
const feature = componentDefinition.features;
|
|
@@ -1265,10 +1266,10 @@ function isLContainer(value) {
|
|
|
1265
1266
|
return Array.isArray(value) && value[TYPE] === true;
|
|
1266
1267
|
}
|
|
1267
1268
|
function isContentQueryHost(tNode) {
|
|
1268
|
-
return (tNode.flags &
|
|
1269
|
+
return (tNode.flags & 4 /* TNodeFlags.hasContentQuery */) !== 0;
|
|
1269
1270
|
}
|
|
1270
1271
|
function isComponentHost(tNode) {
|
|
1271
|
-
return
|
|
1272
|
+
return tNode.componentOffset > -1;
|
|
1272
1273
|
}
|
|
1273
1274
|
function isDirectiveHost(tNode) {
|
|
1274
1275
|
return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
|
|
@@ -2678,7 +2679,7 @@ const unusedValueExportToPlacateAjd$5 = 1;
|
|
|
2678
2679
|
* @param tNode
|
|
2679
2680
|
*/
|
|
2680
2681
|
function hasClassInput(tNode) {
|
|
2681
|
-
return (tNode.flags &
|
|
2682
|
+
return (tNode.flags & 8 /* TNodeFlags.hasClassInput */) !== 0;
|
|
2682
2683
|
}
|
|
2683
2684
|
/**
|
|
2684
2685
|
* Returns `true` if the `TNode` has a directive which has `@Input()` for `style` binding.
|
|
@@ -2702,7 +2703,7 @@ function hasClassInput(tNode) {
|
|
|
2702
2703
|
* @param tNode
|
|
2703
2704
|
*/
|
|
2704
2705
|
function hasStyleInput(tNode) {
|
|
2705
|
-
return (tNode.flags &
|
|
2706
|
+
return (tNode.flags & 16 /* TNodeFlags.hasStyleInput */) !== 0;
|
|
2706
2707
|
}
|
|
2707
2708
|
|
|
2708
2709
|
/**
|
|
@@ -3255,7 +3256,7 @@ function injectAttributeImpl(tNode, attrNameToInject) {
|
|
|
3255
3256
|
return null;
|
|
3256
3257
|
}
|
|
3257
3258
|
function notFoundValueOrThrow(notFoundValue, token, flags) {
|
|
3258
|
-
if (flags & InjectFlags.Optional) {
|
|
3259
|
+
if ((flags & InjectFlags.Optional) || notFoundValue !== undefined) {
|
|
3259
3260
|
return notFoundValue;
|
|
3260
3261
|
}
|
|
3261
3262
|
else {
|
|
@@ -3272,7 +3273,7 @@ function notFoundValueOrThrow(notFoundValue, token, flags) {
|
|
|
3272
3273
|
* @returns the value from the injector or throws an exception
|
|
3273
3274
|
*/
|
|
3274
3275
|
function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {
|
|
3275
|
-
if (flags & InjectFlags.Optional && notFoundValue === undefined) {
|
|
3276
|
+
if ((flags & InjectFlags.Optional) && notFoundValue === undefined) {
|
|
3276
3277
|
// This must be set or the NullInjector will throw for optional deps
|
|
3277
3278
|
notFoundValue = null;
|
|
3278
3279
|
}
|
|
@@ -5787,10 +5788,6 @@ function _sanitizeUrl(url) {
|
|
|
5787
5788
|
}
|
|
5788
5789
|
return 'unsafe:' + url;
|
|
5789
5790
|
}
|
|
5790
|
-
function sanitizeSrcset(srcset) {
|
|
5791
|
-
srcset = String(srcset);
|
|
5792
|
-
return srcset.split(',').map((srcset) => _sanitizeUrl(srcset.trim())).join(', ');
|
|
5793
|
-
}
|
|
5794
5791
|
|
|
5795
5792
|
/**
|
|
5796
5793
|
* @license
|
|
@@ -5837,12 +5834,10 @@ const INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,a
|
|
|
5837
5834
|
const VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
|
|
5838
5835
|
// Attributes that have href and hence need to be sanitized
|
|
5839
5836
|
const URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
|
|
5840
|
-
// Attributes that have special href set hence need to be sanitized
|
|
5841
|
-
const SRCSET_ATTRS = tagSet('srcset');
|
|
5842
5837
|
const HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
|
|
5843
5838
|
'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
|
|
5844
5839
|
'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
|
|
5845
|
-
'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
|
|
5840
|
+
'scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,' +
|
|
5846
5841
|
'valign,value,vspace,width');
|
|
5847
5842
|
// Accessibility attributes as per WAI-ARIA 1.1 (W3C Working Draft 14 December 2018)
|
|
5848
5843
|
const ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,' +
|
|
@@ -5858,7 +5853,7 @@ const ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,a
|
|
|
5858
5853
|
// NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
|
|
5859
5854
|
// can be sanitized, but they increase security surface area without a legitimate use case, so they
|
|
5860
5855
|
// are left out here.
|
|
5861
|
-
const VALID_ATTRS = merge(URI_ATTRS,
|
|
5856
|
+
const VALID_ATTRS = merge(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS);
|
|
5862
5857
|
// Elements whose content should not be traversed/preserved, if the elements themselves are invalid.
|
|
5863
5858
|
//
|
|
5864
5859
|
// Typically, `<invalid>Some content</invalid>` would traverse (and in this case preserve)
|
|
@@ -5941,8 +5936,6 @@ class SanitizingHtmlSerializer {
|
|
|
5941
5936
|
// TODO(martinprobst): Special case image URIs for data:image/...
|
|
5942
5937
|
if (URI_ATTRS[lower])
|
|
5943
5938
|
value = _sanitizeUrl(value);
|
|
5944
|
-
if (SRCSET_ATTRS[lower])
|
|
5945
|
-
value = sanitizeSrcset(value);
|
|
5946
5939
|
this.buf.push(' ', attrName, '="', encodeEntities(value), '"');
|
|
5947
5940
|
}
|
|
5948
5941
|
this.buf.push('>');
|
|
@@ -7243,7 +7236,7 @@ class Version {
|
|
|
7243
7236
|
/**
|
|
7244
7237
|
* @publicApi
|
|
7245
7238
|
*/
|
|
7246
|
-
const VERSION = new Version('15.0.0-next.
|
|
7239
|
+
const VERSION = new Version('15.0.0-next.3');
|
|
7247
7240
|
|
|
7248
7241
|
/**
|
|
7249
7242
|
* @license
|
|
@@ -7547,7 +7540,7 @@ function getTemplateLocationDetails(lView) {
|
|
|
7547
7540
|
* that the `CommonModule` should also be included.
|
|
7548
7541
|
*/
|
|
7549
7542
|
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
|
|
7550
|
-
['ngIf', 'NgIf'], ['ngFor', '
|
|
7543
|
+
['ngIf', 'NgIf'], ['ngFor', 'NgFor'], ['ngSwitchCase', 'NgSwitchCase'],
|
|
7551
7544
|
['ngSwitchDefault', 'NgSwitchDefault']
|
|
7552
7545
|
]);
|
|
7553
7546
|
/**
|
|
@@ -8063,18 +8056,21 @@ function findViaDirective(lView, directiveInstance) {
|
|
|
8063
8056
|
*/
|
|
8064
8057
|
function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
|
8065
8058
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
8066
|
-
|
|
8067
|
-
if (directiveStartIndex == 0)
|
|
8059
|
+
if (tNode.directiveStart === 0)
|
|
8068
8060
|
return EMPTY_ARRAY;
|
|
8069
|
-
const
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8061
|
+
const results = [];
|
|
8062
|
+
for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
|
|
8063
|
+
const directiveInstance = lView[i];
|
|
8064
|
+
if (!isComponentInstance(directiveInstance) || includeComponents) {
|
|
8065
|
+
results.push(directiveInstance);
|
|
8066
|
+
}
|
|
8067
|
+
}
|
|
8068
|
+
return results;
|
|
8073
8069
|
}
|
|
8074
8070
|
function getComponentAtNodeIndex(nodeIndex, lView) {
|
|
8075
8071
|
const tNode = lView[TVIEW].data[nodeIndex];
|
|
8076
|
-
|
|
8077
|
-
return
|
|
8072
|
+
const { directiveStart, componentOffset } = tNode;
|
|
8073
|
+
return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
|
|
8078
8074
|
}
|
|
8079
8075
|
/**
|
|
8080
8076
|
* Returns a map of local references (local reference name => element or directive instance) that
|
|
@@ -8351,16 +8347,16 @@ function getRootView(componentOrLView) {
|
|
|
8351
8347
|
return lView;
|
|
8352
8348
|
}
|
|
8353
8349
|
/**
|
|
8354
|
-
* Returns the
|
|
8355
|
-
*
|
|
8356
|
-
*
|
|
8350
|
+
* Returns the context information associated with the application where the target is situated. It
|
|
8351
|
+
* does this by walking the parent views until it gets to the root view, then getting the context
|
|
8352
|
+
* off of that.
|
|
8357
8353
|
*
|
|
8358
8354
|
* @param viewOrComponent the `LView` or component to get the root context for.
|
|
8359
8355
|
*/
|
|
8360
8356
|
function getRootContext(viewOrComponent) {
|
|
8361
8357
|
const rootView = getRootView(viewOrComponent);
|
|
8362
8358
|
ngDevMode &&
|
|
8363
|
-
assertDefined(rootView[CONTEXT], '
|
|
8359
|
+
assertDefined(rootView[CONTEXT], 'Root view has no context. Perhaps it is disconnected?');
|
|
8364
8360
|
return rootView[CONTEXT];
|
|
8365
8361
|
}
|
|
8366
8362
|
/**
|
|
@@ -8877,9 +8873,10 @@ function getClosestRElement(tView, tNode, lView) {
|
|
|
8877
8873
|
}
|
|
8878
8874
|
else {
|
|
8879
8875
|
ngDevMode && assertTNodeType(parentTNode, 3 /* TNodeType.AnyRNode */ | 4 /* TNodeType.Container */);
|
|
8880
|
-
|
|
8876
|
+
const { componentOffset } = parentTNode;
|
|
8877
|
+
if (componentOffset > -1) {
|
|
8881
8878
|
ngDevMode && assertTNodeForLView(parentTNode, lView);
|
|
8882
|
-
const encapsulation = tView.data[parentTNode.directiveStart]
|
|
8879
|
+
const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
|
|
8883
8880
|
// We've got a parent which is an element in the current view. We just need to verify if the
|
|
8884
8881
|
// parent element is not a component. Component's content nodes are not inserted immediately
|
|
8885
8882
|
// because they will be projected, and so doing insert at this point would be wasteful.
|
|
@@ -9112,10 +9109,10 @@ function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode,
|
|
|
9112
9109
|
if (isProjection) {
|
|
9113
9110
|
if (action === 0 /* WalkTNodeTreeAction.Create */) {
|
|
9114
9111
|
rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
|
|
9115
|
-
tNode.flags |=
|
|
9112
|
+
tNode.flags |= 2 /* TNodeFlags.isProjected */;
|
|
9116
9113
|
}
|
|
9117
9114
|
}
|
|
9118
|
-
if ((tNode.flags &
|
|
9115
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
9119
9116
|
if (tNodeType & 8 /* TNodeType.ElementContainer */) {
|
|
9120
9117
|
applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
|
|
9121
9118
|
applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
|
@@ -11170,6 +11167,7 @@ class TNode {
|
|
|
11170
11167
|
index, //
|
|
11171
11168
|
insertBeforeIndex, //
|
|
11172
11169
|
injectorIndex, //
|
|
11170
|
+
componentOffset, //
|
|
11173
11171
|
directiveStart, //
|
|
11174
11172
|
directiveEnd, //
|
|
11175
11173
|
directiveStylingLast, //
|
|
@@ -11202,6 +11200,7 @@ class TNode {
|
|
|
11202
11200
|
this.index = index;
|
|
11203
11201
|
this.insertBeforeIndex = insertBeforeIndex;
|
|
11204
11202
|
this.injectorIndex = injectorIndex;
|
|
11203
|
+
this.componentOffset = componentOffset;
|
|
11205
11204
|
this.directiveStart = directiveStart;
|
|
11206
11205
|
this.directiveEnd = directiveEnd;
|
|
11207
11206
|
this.directiveStylingLast = directiveStylingLast;
|
|
@@ -11279,21 +11278,19 @@ class TNode {
|
|
|
11279
11278
|
}
|
|
11280
11279
|
get flags_() {
|
|
11281
11280
|
const flags = [];
|
|
11282
|
-
if (this.flags &
|
|
11281
|
+
if (this.flags & 8 /* TNodeFlags.hasClassInput */)
|
|
11283
11282
|
flags.push('TNodeFlags.hasClassInput');
|
|
11284
|
-
if (this.flags &
|
|
11283
|
+
if (this.flags & 4 /* TNodeFlags.hasContentQuery */)
|
|
11285
11284
|
flags.push('TNodeFlags.hasContentQuery');
|
|
11286
|
-
if (this.flags &
|
|
11285
|
+
if (this.flags & 16 /* TNodeFlags.hasStyleInput */)
|
|
11287
11286
|
flags.push('TNodeFlags.hasStyleInput');
|
|
11288
|
-
if (this.flags &
|
|
11287
|
+
if (this.flags & 64 /* TNodeFlags.hasHostBindings */)
|
|
11289
11288
|
flags.push('TNodeFlags.hasHostBindings');
|
|
11290
|
-
if (this.flags & 2 /* TNodeFlags.isComponentHost */)
|
|
11291
|
-
flags.push('TNodeFlags.isComponentHost');
|
|
11292
11289
|
if (this.flags & 1 /* TNodeFlags.isDirectiveHost */)
|
|
11293
11290
|
flags.push('TNodeFlags.isDirectiveHost');
|
|
11294
|
-
if (this.flags &
|
|
11291
|
+
if (this.flags & 32 /* TNodeFlags.isDetached */)
|
|
11295
11292
|
flags.push('TNodeFlags.isDetached');
|
|
11296
|
-
if (this.flags &
|
|
11293
|
+
if (this.flags & 2 /* TNodeFlags.isProjected */)
|
|
11297
11294
|
flags.push('TNodeFlags.isProjected');
|
|
11298
11295
|
return flags.join('|');
|
|
11299
11296
|
}
|
|
@@ -11803,7 +11800,7 @@ function getOrCreateTNode(tView, index, type, name, attrs) {
|
|
|
11803
11800
|
// See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
11804
11801
|
// If the `TNode` was not pre-declared than it means it was not mentioned which means it was
|
|
11805
11802
|
// removed, so we mark it as detached.
|
|
11806
|
-
tNode.flags |=
|
|
11803
|
+
tNode.flags |= 32 /* TNodeFlags.isDetached */;
|
|
11807
11804
|
}
|
|
11808
11805
|
}
|
|
11809
11806
|
else if (tNode.type & 64 /* TNodeType.Placeholder */) {
|
|
@@ -12065,28 +12062,6 @@ function refreshView(tView, lView, templateFn, context) {
|
|
|
12065
12062
|
leaveView();
|
|
12066
12063
|
}
|
|
12067
12064
|
}
|
|
12068
|
-
function renderComponentOrTemplate(tView, lView, templateFn, context) {
|
|
12069
|
-
const rendererFactory = lView[RENDERER_FACTORY];
|
|
12070
|
-
// Check no changes mode is a dev only mode used to verify that bindings have not changed
|
|
12071
|
-
// since they were assigned. We do not want to invoke renderer factory functions in that mode
|
|
12072
|
-
// to avoid any possible side-effects.
|
|
12073
|
-
const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
|
|
12074
|
-
const creationModeIsActive = isCreationMode(lView);
|
|
12075
|
-
try {
|
|
12076
|
-
if (!checkNoChangesMode && !creationModeIsActive && rendererFactory.begin) {
|
|
12077
|
-
rendererFactory.begin();
|
|
12078
|
-
}
|
|
12079
|
-
if (creationModeIsActive) {
|
|
12080
|
-
renderView(tView, lView, context);
|
|
12081
|
-
}
|
|
12082
|
-
refreshView(tView, lView, templateFn, context);
|
|
12083
|
-
}
|
|
12084
|
-
finally {
|
|
12085
|
-
if (!checkNoChangesMode && !creationModeIsActive && rendererFactory.end) {
|
|
12086
|
-
rendererFactory.end();
|
|
12087
|
-
}
|
|
12088
|
-
}
|
|
12089
|
-
}
|
|
12090
12065
|
function executeTemplate(tView, lView, templateFn, rf, context) {
|
|
12091
12066
|
const prevSelectedIndex = getSelectedIndex();
|
|
12092
12067
|
const isUpdatePhase = rf & 2 /* RenderFlags.Update */;
|
|
@@ -12129,7 +12104,7 @@ function createDirectivesInstances(tView, lView, tNode) {
|
|
|
12129
12104
|
if (!getBindingsEnabled())
|
|
12130
12105
|
return;
|
|
12131
12106
|
instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
|
|
12132
|
-
if ((tNode.flags &
|
|
12107
|
+
if ((tNode.flags & 64 /* TNodeFlags.hasHostBindings */) === 64 /* TNodeFlags.hasHostBindings */) {
|
|
12133
12108
|
invokeDirectivesHostBindings(tView, lView, tNode);
|
|
12134
12109
|
}
|
|
12135
12110
|
}
|
|
@@ -12157,7 +12132,7 @@ function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNative
|
|
|
12157
12132
|
* @param def ComponentDef
|
|
12158
12133
|
* @returns TView
|
|
12159
12134
|
*/
|
|
12160
|
-
function
|
|
12135
|
+
function getOrCreateComponentTView(def) {
|
|
12161
12136
|
const tView = def.tView;
|
|
12162
12137
|
// Create a TView if there isn't one, or recreate it if the first create pass didn't
|
|
12163
12138
|
// complete successfully since we can't know for sure whether it's in a usable shape.
|
|
@@ -12329,6 +12304,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12329
12304
|
index, // index: number
|
|
12330
12305
|
null, // insertBeforeIndex: null|-1|number|number[]
|
|
12331
12306
|
injectorIndex, // injectorIndex: number
|
|
12307
|
+
-1, // componentOffset: number
|
|
12332
12308
|
-1, // directiveStart: number
|
|
12333
12309
|
-1, // directiveEnd: number
|
|
12334
12310
|
-1, // directiveStylingLast: number
|
|
@@ -12364,6 +12340,7 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12364
12340
|
directiveStart: -1,
|
|
12365
12341
|
directiveEnd: -1,
|
|
12366
12342
|
directiveStylingLast: -1,
|
|
12343
|
+
componentOffset: -1,
|
|
12367
12344
|
propertyBindings: null,
|
|
12368
12345
|
flags: 0,
|
|
12369
12346
|
providerIndexes: 0,
|
|
@@ -12427,24 +12404,23 @@ function initializeInputAndOutputAliases(tView, tNode) {
|
|
|
12427
12404
|
let outputsStore = null;
|
|
12428
12405
|
for (let i = start; i < end; i++) {
|
|
12429
12406
|
const directiveDef = tViewData[i];
|
|
12430
|
-
|
|
12407
|
+
inputsStore = generatePropertyAliases(directiveDef.inputs, i, inputsStore);
|
|
12408
|
+
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
|
12431
12409
|
// Do not use unbound attributes as inputs to structural directives, since structural
|
|
12432
12410
|
// directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
|
|
12433
12411
|
// TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
|
|
12434
12412
|
// should be set for inline templates.
|
|
12435
|
-
const initialInputs = (tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12436
|
-
generateInitialInputs(
|
|
12413
|
+
const initialInputs = (inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
|
12414
|
+
generateInitialInputs(inputsStore, i, tNodeAttrs) :
|
|
12437
12415
|
null;
|
|
12438
12416
|
inputsFromAttrs.push(initialInputs);
|
|
12439
|
-
inputsStore = generatePropertyAliases(directiveInputs, i, inputsStore);
|
|
12440
|
-
outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
|
12441
12417
|
}
|
|
12442
12418
|
if (inputsStore !== null) {
|
|
12443
12419
|
if (inputsStore.hasOwnProperty('class')) {
|
|
12444
|
-
tNode.flags |=
|
|
12420
|
+
tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
|
|
12445
12421
|
}
|
|
12446
12422
|
if (inputsStore.hasOwnProperty('style')) {
|
|
12447
|
-
tNode.flags |=
|
|
12423
|
+
tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
|
|
12448
12424
|
}
|
|
12449
12425
|
}
|
|
12450
12426
|
tNode.initialInputs = inputsFromAttrs;
|
|
@@ -12565,7 +12541,7 @@ function instantiateRootComponent(tView, lView, def) {
|
|
|
12565
12541
|
configureViewWithDirective(tView, rootTNode, lView, directiveIndex, def);
|
|
12566
12542
|
initializeInputAndOutputAliases(tView, rootTNode);
|
|
12567
12543
|
}
|
|
12568
|
-
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart, rootTNode);
|
|
12544
|
+
const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
|
|
12569
12545
|
attachPatchData(directive, lView);
|
|
12570
12546
|
const native = getNativeByTNode(rootTNode, lView);
|
|
12571
12547
|
if (native) {
|
|
@@ -12582,7 +12558,10 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12582
12558
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12583
12559
|
let hasDirectives = false;
|
|
12584
12560
|
if (getBindingsEnabled()) {
|
|
12585
|
-
const
|
|
12561
|
+
const directiveDefsMatchedBySelectors = findDirectiveDefMatches(tView, lView, tNode);
|
|
12562
|
+
const directiveDefs = directiveDefsMatchedBySelectors ?
|
|
12563
|
+
findHostDirectiveDefs$1(directiveDefsMatchedBySelectors, tView, lView, tNode) :
|
|
12564
|
+
null;
|
|
12586
12565
|
const exportsMap = localRefs === null ? null : { '': -1 };
|
|
12587
12566
|
if (directiveDefs !== null) {
|
|
12588
12567
|
hasDirectives = true;
|
|
@@ -12611,9 +12590,9 @@ function resolveDirectives(tView, lView, tNode, localRefs) {
|
|
|
12611
12590
|
configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
|
12612
12591
|
saveNameToExportMap(directiveIdx, def, exportsMap);
|
|
12613
12592
|
if (def.contentQueries !== null)
|
|
12614
|
-
tNode.flags |=
|
|
12593
|
+
tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
|
|
12615
12594
|
if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
|
12616
|
-
tNode.flags |=
|
|
12595
|
+
tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
|
|
12617
12596
|
const lifeCycleHooks = def.type.prototype;
|
|
12618
12597
|
// Only push a node index into the preOrderHooks array if this is the first
|
|
12619
12598
|
// pre-order hook found on this node.
|
|
@@ -12752,7 +12731,6 @@ function invokeHostBindingsInCreationMode(def, directive) {
|
|
|
12752
12731
|
* If a component is matched (at most one), it is returned in first position in the array.
|
|
12753
12732
|
*/
|
|
12754
12733
|
function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
12755
|
-
var _a;
|
|
12756
12734
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12757
12735
|
ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
|
|
12758
12736
|
const registry = tView.directiveRegistry;
|
|
@@ -12767,20 +12745,19 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
|
12767
12745
|
if (ngDevMode) {
|
|
12768
12746
|
assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
|
|
12769
12747
|
`Please use a different tag to activate the ${stringify(def.type)} component.`);
|
|
12770
|
-
if (tNode
|
|
12748
|
+
if (isComponentHost(tNode)) {
|
|
12771
12749
|
// If another component has been matched previously, it's the first element in the
|
|
12772
12750
|
// `matches` array, see how we store components/directives in `matches` below.
|
|
12773
12751
|
throwMultipleComponentError(tNode, matches[0].type, def.type);
|
|
12774
12752
|
}
|
|
12775
12753
|
}
|
|
12776
|
-
markAsComponentHost(tView, tNode);
|
|
12754
|
+
markAsComponentHost(tView, tNode, 0);
|
|
12777
12755
|
// The component is always stored first with directives after.
|
|
12778
12756
|
matches.unshift(def);
|
|
12779
12757
|
}
|
|
12780
12758
|
else {
|
|
12781
12759
|
matches.push(def);
|
|
12782
12760
|
}
|
|
12783
|
-
(_a = def.applyHostDirectives) === null || _a === void 0 ? void 0 : _a.call(def, tView, viewData, tNode, matches);
|
|
12784
12761
|
}
|
|
12785
12762
|
}
|
|
12786
12763
|
}
|
|
@@ -12788,15 +12765,36 @@ function findDirectiveDefMatches(tView, viewData, tNode) {
|
|
|
12788
12765
|
}
|
|
12789
12766
|
/**
|
|
12790
12767
|
* Marks a given TNode as a component's host. This consists of:
|
|
12791
|
-
* - setting
|
|
12768
|
+
* - setting the component offset on the TNode.
|
|
12792
12769
|
* - storing index of component's host element so it will be queued for view refresh during CD.
|
|
12793
12770
|
*/
|
|
12794
|
-
function markAsComponentHost(tView, hostTNode) {
|
|
12771
|
+
function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
12795
12772
|
ngDevMode && assertFirstCreatePass(tView);
|
|
12796
|
-
|
|
12773
|
+
ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
|
|
12774
|
+
hostTNode.componentOffset = componentOffset;
|
|
12797
12775
|
(tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
|
|
12798
12776
|
.push(hostTNode.index);
|
|
12799
12777
|
}
|
|
12778
|
+
/**
|
|
12779
|
+
* Given an array of directives that were matched by their selectors, this function
|
|
12780
|
+
* produces a new array that also includes any host directives that have to be applied.
|
|
12781
|
+
* @param selectorMatches Directives matched in a template based on their selectors.
|
|
12782
|
+
* @param tView Current TView.
|
|
12783
|
+
* @param lView Current LView.
|
|
12784
|
+
* @param tNode Current TNode that is being matched.
|
|
12785
|
+
*/
|
|
12786
|
+
function findHostDirectiveDefs$1(selectorMatches, tView, lView, tNode) {
|
|
12787
|
+
const matches = [];
|
|
12788
|
+
for (const def of selectorMatches) {
|
|
12789
|
+
if (def.findHostDirectiveDefs === null) {
|
|
12790
|
+
matches.push(def);
|
|
12791
|
+
}
|
|
12792
|
+
else {
|
|
12793
|
+
def.findHostDirectiveDefs(matches, def, tView, lView, tNode);
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
return matches;
|
|
12797
|
+
}
|
|
12800
12798
|
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
12801
12799
|
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
12802
12800
|
if (localRefs) {
|
|
@@ -12868,7 +12866,7 @@ function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
|
|
|
12868
12866
|
}
|
|
12869
12867
|
function addComponentLogic(lView, hostTNode, def) {
|
|
12870
12868
|
const native = getNativeByTNode(hostTNode, lView);
|
|
12871
|
-
const tView =
|
|
12869
|
+
const tView = getOrCreateComponentTView(def);
|
|
12872
12870
|
// Only component views should be added to the view tree directly. Embedded views are
|
|
12873
12871
|
// accessed through their containers because they may be removed / re-added later.
|
|
12874
12872
|
const rendererFactory = lView[RENDERER_FACTORY];
|
|
@@ -12939,10 +12937,11 @@ function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initial
|
|
|
12939
12937
|
*
|
|
12940
12938
|
* <my-component name="Bess"></my-component>
|
|
12941
12939
|
*
|
|
12942
|
-
* @param inputs
|
|
12943
|
-
* @param
|
|
12940
|
+
* @param inputs Input alias map that was generated from the directive def inputs.
|
|
12941
|
+
* @param directiveIndex Index of the directive that is currently being processed.
|
|
12942
|
+
* @param attrs Static attrs on this node.
|
|
12944
12943
|
*/
|
|
12945
|
-
function generateInitialInputs(inputs, attrs) {
|
|
12944
|
+
function generateInitialInputs(inputs, directiveIndex, attrs) {
|
|
12946
12945
|
let inputsToStore = null;
|
|
12947
12946
|
let i = 0;
|
|
12948
12947
|
while (i < attrs.length) {
|
|
@@ -12963,7 +12962,17 @@ function generateInitialInputs(inputs, attrs) {
|
|
|
12963
12962
|
if (inputs.hasOwnProperty(attrName)) {
|
|
12964
12963
|
if (inputsToStore === null)
|
|
12965
12964
|
inputsToStore = [];
|
|
12966
|
-
|
|
12965
|
+
// Find the input's public name from the input store. Note that we can be found easier
|
|
12966
|
+
// through the directive def, but we want to do it using the inputs store so that it can
|
|
12967
|
+
// account for host directive aliases.
|
|
12968
|
+
const inputConfig = inputs[attrName];
|
|
12969
|
+
for (let j = 0; j < inputConfig.length; j += 2) {
|
|
12970
|
+
if (inputConfig[j] === directiveIndex) {
|
|
12971
|
+
inputsToStore.push(attrName, inputConfig[j + 1], attrs[i + 1]);
|
|
12972
|
+
// A directive can't have multiple inputs with the same name so we can break here.
|
|
12973
|
+
break;
|
|
12974
|
+
}
|
|
12975
|
+
}
|
|
12967
12976
|
}
|
|
12968
12977
|
i += 2;
|
|
12969
12978
|
}
|
|
@@ -13195,63 +13204,32 @@ function markViewDirty(lView) {
|
|
|
13195
13204
|
}
|
|
13196
13205
|
return null;
|
|
13197
13206
|
}
|
|
13198
|
-
function
|
|
13199
|
-
for (let i = 0; i < rootContext.components.length; i++) {
|
|
13200
|
-
const rootComponent = rootContext.components[i];
|
|
13201
|
-
const lView = readPatchedLView(rootComponent);
|
|
13202
|
-
// We might not have an `LView` if the component was destroyed.
|
|
13203
|
-
if (lView !== null) {
|
|
13204
|
-
const tView = lView[TVIEW];
|
|
13205
|
-
renderComponentOrTemplate(tView, lView, tView.template, rootComponent);
|
|
13206
|
-
}
|
|
13207
|
-
}
|
|
13208
|
-
}
|
|
13209
|
-
function detectChangesInternal(tView, lView, context) {
|
|
13207
|
+
function detectChangesInternal(tView, lView, context, notifyErrorHandler = true) {
|
|
13210
13208
|
const rendererFactory = lView[RENDERER_FACTORY];
|
|
13211
|
-
|
|
13209
|
+
// Check no changes mode is a dev only mode used to verify that bindings have not changed
|
|
13210
|
+
// since they were assigned. We do not want to invoke renderer factory functions in that mode
|
|
13211
|
+
// to avoid any possible side-effects.
|
|
13212
|
+
const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
|
|
13213
|
+
if (!checkNoChangesMode && rendererFactory.begin)
|
|
13212
13214
|
rendererFactory.begin();
|
|
13213
13215
|
try {
|
|
13214
13216
|
refreshView(tView, lView, tView.template, context);
|
|
13215
13217
|
}
|
|
13216
13218
|
catch (error) {
|
|
13217
|
-
|
|
13219
|
+
if (notifyErrorHandler) {
|
|
13220
|
+
handleError(lView, error);
|
|
13221
|
+
}
|
|
13218
13222
|
throw error;
|
|
13219
13223
|
}
|
|
13220
13224
|
finally {
|
|
13221
|
-
if (rendererFactory.end)
|
|
13225
|
+
if (!checkNoChangesMode && rendererFactory.end)
|
|
13222
13226
|
rendererFactory.end();
|
|
13223
13227
|
}
|
|
13224
13228
|
}
|
|
13225
|
-
|
|
13226
|
-
* Synchronously perform change detection on a root view and its components.
|
|
13227
|
-
*
|
|
13228
|
-
* @param lView The view which the change detection should be performed on.
|
|
13229
|
-
*/
|
|
13230
|
-
function detectChangesInRootView(lView) {
|
|
13231
|
-
tickRootContext(lView[CONTEXT]);
|
|
13232
|
-
}
|
|
13233
|
-
function checkNoChangesInternal(tView, view, context) {
|
|
13229
|
+
function checkNoChangesInternal(tView, lView, context, notifyErrorHandler = true) {
|
|
13234
13230
|
setIsInCheckNoChangesMode(true);
|
|
13235
13231
|
try {
|
|
13236
|
-
detectChangesInternal(tView,
|
|
13237
|
-
}
|
|
13238
|
-
finally {
|
|
13239
|
-
setIsInCheckNoChangesMode(false);
|
|
13240
|
-
}
|
|
13241
|
-
}
|
|
13242
|
-
/**
|
|
13243
|
-
* Checks the change detector on a root view and its components, and throws if any changes are
|
|
13244
|
-
* detected.
|
|
13245
|
-
*
|
|
13246
|
-
* This is used in development mode to verify that running change detection doesn't
|
|
13247
|
-
* introduce other changes.
|
|
13248
|
-
*
|
|
13249
|
-
* @param lView The view which the change detection should be checked on.
|
|
13250
|
-
*/
|
|
13251
|
-
function checkNoChangesInRootView(lView) {
|
|
13252
|
-
setIsInCheckNoChangesMode(true);
|
|
13253
|
-
try {
|
|
13254
|
-
detectChangesInRootView(lView);
|
|
13232
|
+
detectChangesInternal(tView, lView, context, notifyErrorHandler);
|
|
13255
13233
|
}
|
|
13256
13234
|
finally {
|
|
13257
13235
|
setIsInCheckNoChangesMode(false);
|
|
@@ -13744,11 +13722,17 @@ class RootViewRef extends ViewRef$1 {
|
|
|
13744
13722
|
this._view = _view;
|
|
13745
13723
|
}
|
|
13746
13724
|
detectChanges() {
|
|
13747
|
-
|
|
13725
|
+
const lView = this._view;
|
|
13726
|
+
const tView = lView[TVIEW];
|
|
13727
|
+
const context = lView[CONTEXT];
|
|
13728
|
+
detectChangesInternal(tView, lView, context, false);
|
|
13748
13729
|
}
|
|
13749
13730
|
checkNoChanges() {
|
|
13750
13731
|
if (ngDevMode) {
|
|
13751
|
-
|
|
13732
|
+
const lView = this._view;
|
|
13733
|
+
const tView = lView[TVIEW];
|
|
13734
|
+
const context = lView[CONTEXT];
|
|
13735
|
+
checkNoChangesInternal(tView, lView, context, false);
|
|
13752
13736
|
}
|
|
13753
13737
|
}
|
|
13754
13738
|
get context() {
|
|
@@ -13815,7 +13799,7 @@ class ChainedInjector {
|
|
|
13815
13799
|
}
|
|
13816
13800
|
}
|
|
13817
13801
|
/**
|
|
13818
|
-
*
|
|
13802
|
+
* ComponentFactory interface implementation.
|
|
13819
13803
|
*/
|
|
13820
13804
|
class ComponentFactory extends ComponentFactory$1 {
|
|
13821
13805
|
/**
|
|
@@ -13865,10 +13849,9 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
13865
13849
|
createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
|
|
13866
13850
|
const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
|
|
13867
13851
|
16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
|
|
13868
|
-
const rootContext = createRootContext();
|
|
13869
13852
|
// Create the root view. Uses empty TView and ContentTemplate.
|
|
13870
13853
|
const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null);
|
|
13871
|
-
const rootLView = createLView(null, rootTView,
|
|
13854
|
+
const rootLView = createLView(null, rootTView, null, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null);
|
|
13872
13855
|
// rootView is the parent when bootstrapping
|
|
13873
13856
|
// TODO(misko): it looks like we are entering view here but we don't really need to as
|
|
13874
13857
|
// `renderView` does that. However as the code is written it is needed because
|
|
@@ -13912,7 +13895,8 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
13912
13895
|
// TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
|
|
13913
13896
|
// executed here?
|
|
13914
13897
|
// Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
|
|
13915
|
-
component =
|
|
13898
|
+
component =
|
|
13899
|
+
createRootComponent(componentView, this.componentDef, rootLView, [LifecycleHooksFeature]);
|
|
13916
13900
|
renderView(rootTView, rootLView, null);
|
|
13917
13901
|
}
|
|
13918
13902
|
finally {
|
|
@@ -14018,10 +14002,10 @@ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRend
|
|
|
14018
14002
|
}
|
|
14019
14003
|
}
|
|
14020
14004
|
const viewRenderer = rendererFactory.createRenderer(rNode, def);
|
|
14021
|
-
const componentView = createLView(rootView,
|
|
14005
|
+
const componentView = createLView(rootView, getOrCreateComponentTView(def), null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null);
|
|
14022
14006
|
if (tView.firstCreatePass) {
|
|
14023
14007
|
diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
|
|
14024
|
-
markAsComponentHost(tView, tNode);
|
|
14008
|
+
markAsComponentHost(tView, tNode, 0);
|
|
14025
14009
|
initTNodeFlags(tNode, rootView.length, 1);
|
|
14026
14010
|
}
|
|
14027
14011
|
addToViewTree(rootView, componentView);
|
|
@@ -14032,12 +14016,13 @@ function createRootComponentView(rNode, def, rootView, rendererFactory, hostRend
|
|
|
14032
14016
|
* Creates a root component and sets it up with features and host bindings.Shared by
|
|
14033
14017
|
* renderComponent() and ViewContainerRef.createComponent().
|
|
14034
14018
|
*/
|
|
14035
|
-
function createRootComponent(componentView, componentDef, rootLView,
|
|
14019
|
+
function createRootComponent(componentView, componentDef, rootLView, hostFeatures) {
|
|
14036
14020
|
const tView = rootLView[TVIEW];
|
|
14037
14021
|
// Create directive instance with factory() and store at next index in viewData
|
|
14038
14022
|
const component = instantiateRootComponent(tView, rootLView, componentDef);
|
|
14039
|
-
|
|
14040
|
-
|
|
14023
|
+
// Root view only contains an instance of this component,
|
|
14024
|
+
// so we use a reference to that component instance as a context.
|
|
14025
|
+
componentView[CONTEXT] = rootLView[CONTEXT] = component;
|
|
14041
14026
|
if (hostFeatures !== null) {
|
|
14042
14027
|
for (const feature of hostFeatures) {
|
|
14043
14028
|
feature(component, componentDef);
|
|
@@ -14061,9 +14046,6 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
14061
14046
|
}
|
|
14062
14047
|
return component;
|
|
14063
14048
|
}
|
|
14064
|
-
function createRootContext() {
|
|
14065
|
-
return { components: [] };
|
|
14066
|
-
}
|
|
14067
14049
|
/**
|
|
14068
14050
|
* Used to enable lifecycle hooks on the root component.
|
|
14069
14051
|
*
|
|
@@ -14320,6 +14302,13 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14320
14302
|
}
|
|
14321
14303
|
}
|
|
14322
14304
|
|
|
14305
|
+
/**
|
|
14306
|
+
* @license
|
|
14307
|
+
* Copyright Google LLC All Rights Reserved.
|
|
14308
|
+
*
|
|
14309
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
14310
|
+
* found in the LICENSE file at https://angular.io/license
|
|
14311
|
+
*/
|
|
14323
14312
|
/**
|
|
14324
14313
|
* This feature add the host directives behavior to a directive definition by patching a
|
|
14325
14314
|
* function onto it. The expectation is that the runtime will invoke the function during
|
|
@@ -14341,29 +14330,43 @@ function ɵɵCopyDefinitionFeature(definition) {
|
|
|
14341
14330
|
* @codeGenApi
|
|
14342
14331
|
*/
|
|
14343
14332
|
function ɵɵHostDirectivesFeature(rawHostDirectives) {
|
|
14344
|
-
const unwrappedHostDirectives = Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives();
|
|
14345
|
-
const hostDirectives = unwrappedHostDirectives.map(dir => typeof dir === 'function' ? { directive: dir, inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } : {
|
|
14346
|
-
directive: dir.directive,
|
|
14347
|
-
inputs: bindingArrayToMap(dir.inputs),
|
|
14348
|
-
outputs: bindingArrayToMap(dir.outputs)
|
|
14349
|
-
});
|
|
14350
14333
|
return (definition) => {
|
|
14351
|
-
|
|
14352
|
-
definition.
|
|
14353
|
-
(
|
|
14334
|
+
definition.findHostDirectiveDefs = findHostDirectiveDefs;
|
|
14335
|
+
definition.hostDirectives =
|
|
14336
|
+
(Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives()).map(dir => {
|
|
14337
|
+
return typeof dir === 'function' ?
|
|
14338
|
+
{ directive: resolveForwardRef(dir), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } :
|
|
14339
|
+
{
|
|
14340
|
+
directive: resolveForwardRef(dir.directive),
|
|
14341
|
+
inputs: bindingArrayToMap(dir.inputs),
|
|
14342
|
+
outputs: bindingArrayToMap(dir.outputs)
|
|
14343
|
+
};
|
|
14344
|
+
});
|
|
14354
14345
|
};
|
|
14355
14346
|
}
|
|
14347
|
+
function findHostDirectiveDefs(matches, def, tView, lView, tNode) {
|
|
14348
|
+
if (def.hostDirectives !== null) {
|
|
14349
|
+
for (const hostDirectiveConfig of def.hostDirectives) {
|
|
14350
|
+
const hostDirectiveDef = getDirectiveDef(hostDirectiveConfig.directive);
|
|
14351
|
+
// TODO(crisbeto): assert that the def exists.
|
|
14352
|
+
// Host directives execute before the host so that its host bindings can be overwritten.
|
|
14353
|
+
findHostDirectiveDefs(matches, hostDirectiveDef, tView, lView, tNode);
|
|
14354
|
+
}
|
|
14355
|
+
}
|
|
14356
|
+
// Push the def itself at the end since it needs to execute after the host directives.
|
|
14357
|
+
matches.push(def);
|
|
14358
|
+
}
|
|
14356
14359
|
/**
|
|
14357
14360
|
* Converts an array in the form of `['publicName', 'alias', 'otherPublicName', 'otherAlias']` into
|
|
14358
14361
|
* a map in the form of `{publicName: 'alias', otherPublicName: 'otherAlias'}`.
|
|
14359
14362
|
*/
|
|
14360
14363
|
function bindingArrayToMap(bindings) {
|
|
14361
|
-
if (
|
|
14364
|
+
if (bindings === undefined || bindings.length === 0) {
|
|
14362
14365
|
return EMPTY_OBJ;
|
|
14363
14366
|
}
|
|
14364
14367
|
const result = {};
|
|
14365
|
-
for (let i =
|
|
14366
|
-
result[bindings[i
|
|
14368
|
+
for (let i = 0; i < bindings.length; i += 2) {
|
|
14369
|
+
result[bindings[i]] = bindings[i + 1];
|
|
14367
14370
|
}
|
|
14368
14371
|
return result;
|
|
14369
14372
|
}
|
|
@@ -15322,7 +15325,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
15322
15325
|
if (styles !== null) {
|
|
15323
15326
|
writeDirectStyle(renderer, native, styles);
|
|
15324
15327
|
}
|
|
15325
|
-
if ((tNode.flags &
|
|
15328
|
+
if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
15326
15329
|
// In the i18n case, the translation may have removed this element, so only add it if it is not
|
|
15327
15330
|
// detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
|
|
15328
15331
|
appendChild(tView, lView, native, tNode);
|
|
@@ -15760,9 +15763,7 @@ function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault)
|
|
|
15760
15763
|
}
|
|
15761
15764
|
// In order to be backwards compatible with View Engine, events on component host nodes
|
|
15762
15765
|
// must also mark the component view itself dirty (i.e. the view that it owns).
|
|
15763
|
-
const startView = tNode.
|
|
15764
|
-
getComponentLViewByIndex(tNode.index, lView) :
|
|
15765
|
-
lView;
|
|
15766
|
+
const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
|
|
15766
15767
|
markViewDirty(startView);
|
|
15767
15768
|
let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
|
|
15768
15769
|
// A just-invoked listener function might have coalesced listeners so we need to check for
|
|
@@ -15919,7 +15920,7 @@ function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
|
|
|
15919
15920
|
tProjectionNode.projection = selectorIndex;
|
|
15920
15921
|
// `<ng-content>` has no content
|
|
15921
15922
|
setCurrentTNodeAsNotParent();
|
|
15922
|
-
if ((tProjectionNode.flags &
|
|
15923
|
+
if ((tProjectionNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
|
|
15923
15924
|
// re-distribution of projectable nodes is stored on a component's view level
|
|
15924
15925
|
applyProjection(tView, lView, tProjectionNode);
|
|
15925
15926
|
}
|
|
@@ -17833,7 +17834,7 @@ function normalizeSuffix(value, suffix) {
|
|
|
17833
17834
|
* @param isClassBased `true` if `class` (`false` if `style`)
|
|
17834
17835
|
*/
|
|
17835
17836
|
function hasStylingInputShadow(tNode, isClassBased) {
|
|
17836
|
-
return (tNode.flags & (isClassBased ?
|
|
17837
|
+
return (tNode.flags & (isClassBased ? 8 /* TNodeFlags.hasClassInput */ : 16 /* TNodeFlags.hasStyleInput */)) !== 0;
|
|
17837
17838
|
}
|
|
17838
17839
|
|
|
17839
17840
|
/**
|
|
@@ -19525,7 +19526,7 @@ function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parent
|
|
|
19525
19526
|
anchorRNode = i18nParent;
|
|
19526
19527
|
i18nParent = parentRElement;
|
|
19527
19528
|
}
|
|
19528
|
-
if (i18nParent !== null &&
|
|
19529
|
+
if (i18nParent !== null && childTNode.componentOffset === -1) {
|
|
19529
19530
|
for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
|
|
19530
19531
|
// No need to `unwrapRNode` because all of the indexes point to i18n text nodes.
|
|
19531
19532
|
// see `assertDomNode` below.
|
|
@@ -20956,9 +20957,6 @@ function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, up
|
|
|
20956
20957
|
if (URI_ATTRS[lowerAttrName]) {
|
|
20957
20958
|
generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
|
|
20958
20959
|
}
|
|
20959
|
-
else if (SRCSET_ATTRS[lowerAttrName]) {
|
|
20960
|
-
generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, sanitizeSrcset);
|
|
20961
|
-
}
|
|
20962
20960
|
else {
|
|
20963
20961
|
generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
|
|
20964
20962
|
}
|
|
@@ -21927,7 +21925,7 @@ function getOwningComponent(elementOrDir) {
|
|
|
21927
21925
|
*/
|
|
21928
21926
|
function getRootComponents(elementOrDir) {
|
|
21929
21927
|
const lView = readPatchedLView(elementOrDir);
|
|
21930
|
-
return lView !== null ? [
|
|
21928
|
+
return lView !== null ? [getRootContext(lView)] : [];
|
|
21931
21929
|
}
|
|
21932
21930
|
/**
|
|
21933
21931
|
* Retrieves an `Injector` associated with an element, component or directive instance.
|
|
@@ -24999,6 +24997,7 @@ function extendsDirectlyFromObject(type) {
|
|
|
24999
24997
|
* `Component`).
|
|
25000
24998
|
*/
|
|
25001
24999
|
function directiveMetadata(type, metadata) {
|
|
25000
|
+
var _a;
|
|
25002
25001
|
// Reflect inputs and outputs.
|
|
25003
25002
|
const reflect = getReflect();
|
|
25004
25003
|
const propMetadata = reflect.ownPropMetadata(type);
|
|
@@ -25018,7 +25017,12 @@ function directiveMetadata(type, metadata) {
|
|
|
25018
25017
|
providers: metadata.providers || null,
|
|
25019
25018
|
viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery),
|
|
25020
25019
|
isStandalone: !!metadata.standalone,
|
|
25021
|
-
hostDirectives:
|
|
25020
|
+
hostDirectives:
|
|
25021
|
+
// TODO(crisbeto): remove the `as any` usage here and down in the `map` call once
|
|
25022
|
+
// host directives are exposed in the public API.
|
|
25023
|
+
((_a = metadata
|
|
25024
|
+
.hostDirectives) === null || _a === void 0 ? void 0 : _a.map((directive) => typeof directive === 'function' ? { directive } : directive)) ||
|
|
25025
|
+
null
|
|
25022
25026
|
};
|
|
25023
25027
|
}
|
|
25024
25028
|
/**
|
|
@@ -28285,7 +28289,7 @@ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, root
|
|
|
28285
28289
|
if (rootNativeNode !== nativeNode) {
|
|
28286
28290
|
// To determine the next node to be processed, we need to use the next or the projectionNext
|
|
28287
28291
|
// link, depending on whether the current node has been projected.
|
|
28288
|
-
const nextTNode = (tNode.flags &
|
|
28292
|
+
const nextTNode = (tNode.flags & 2 /* TNodeFlags.isProjected */) ? tNode.projectionNext : tNode.next;
|
|
28289
28293
|
if (nextTNode) {
|
|
28290
28294
|
_queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
28291
28295
|
}
|