@angular/core 15.2.2 → 15.2.4
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/change_detection/change_detector_ref.mjs +4 -4
- package/esm2020/src/render3/definition.mjs +53 -42
- package/esm2020/src/render3/interfaces/type_checks.mjs +2 -2
- package/esm2020/src/render3/node_selector_matcher.mjs +17 -5
- package/esm2020/src/render3/util/discovery_utils.mjs +3 -2
- package/esm2020/src/render3/view_ref.mjs +1 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/esm2020/testing/src/test_bed_compiler.mjs +12 -7
- package/fesm2015/core.mjs +72 -66
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +83 -72
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +73 -49
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +84 -55
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +244 -356
- package/package.json +1 -1
- package/schematics/migrations/relative-link-resolution/bundle.js +7 -7
- package/schematics/migrations/router-link-with-href/bundle.js +10 -10
- package/schematics/ng-generate/standalone-migration/bundle.js +323 -323
- package/schematics/ng-generate/standalone-migration/bundle.js.map +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2020/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.2.
|
|
2
|
+
* @license Angular v15.2.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -935,7 +935,7 @@ let componentDefCount = 0;
|
|
|
935
935
|
*
|
|
936
936
|
* # Example
|
|
937
937
|
* ```
|
|
938
|
-
* class
|
|
938
|
+
* class MyComponent {
|
|
939
939
|
* // Generated by Angular Template Compiler
|
|
940
940
|
* // [Symbol] syntax will not be supported by TypeScript until v2.7
|
|
941
941
|
* static ɵcmp = defineComponent({
|
|
@@ -950,61 +950,31 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
950
950
|
// Initialize ngDevMode. This must be the first statement in ɵɵdefineComponent.
|
|
951
951
|
// See the `initNgDevMode` docstring for more information.
|
|
952
952
|
(typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
|
|
953
|
-
const
|
|
954
|
-
const standalone = componentDefinition.standalone === true;
|
|
955
|
-
const declaredInputs = {};
|
|
953
|
+
const baseDef = getNgDirectiveDef(componentDefinition);
|
|
956
954
|
const def = {
|
|
957
|
-
|
|
958
|
-
providersResolver: null,
|
|
955
|
+
...baseDef,
|
|
959
956
|
decls: componentDefinition.decls,
|
|
960
957
|
vars: componentDefinition.vars,
|
|
961
|
-
|
|
962
|
-
template: componentDefinition.template || null,
|
|
958
|
+
template: componentDefinition.template,
|
|
963
959
|
consts: componentDefinition.consts || null,
|
|
964
960
|
ngContentSelectors: componentDefinition.ngContentSelectors,
|
|
965
|
-
hostBindings: componentDefinition.hostBindings || null,
|
|
966
|
-
hostVars: componentDefinition.hostVars || 0,
|
|
967
|
-
hostAttrs: componentDefinition.hostAttrs || null,
|
|
968
|
-
contentQueries: componentDefinition.contentQueries || null,
|
|
969
|
-
declaredInputs: declaredInputs,
|
|
970
|
-
inputs: null,
|
|
971
|
-
outputs: null,
|
|
972
|
-
exportAs: componentDefinition.exportAs || null,
|
|
973
961
|
onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
|
|
974
962
|
directiveDefs: null,
|
|
975
963
|
pipeDefs: null,
|
|
976
|
-
standalone,
|
|
977
|
-
dependencies: standalone && componentDefinition.dependencies || null,
|
|
964
|
+
dependencies: baseDef.standalone && componentDefinition.dependencies || null,
|
|
978
965
|
getStandaloneInjector: null,
|
|
979
|
-
selectors: componentDefinition.selectors || EMPTY_ARRAY,
|
|
980
|
-
viewQuery: componentDefinition.viewQuery || null,
|
|
981
|
-
features: componentDefinition.features || null,
|
|
982
966
|
data: componentDefinition.data || {},
|
|
983
967
|
encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
|
|
984
968
|
id: `c${componentDefCount++}`,
|
|
985
969
|
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
986
970
|
_: null,
|
|
987
|
-
setInput: null,
|
|
988
971
|
schemas: componentDefinition.schemas || null,
|
|
989
972
|
tView: null,
|
|
990
|
-
findHostDirectiveDefs: null,
|
|
991
|
-
hostDirectives: null,
|
|
992
973
|
};
|
|
974
|
+
initFeatures(def);
|
|
993
975
|
const dependencies = componentDefinition.dependencies;
|
|
994
|
-
|
|
995
|
-
def.
|
|
996
|
-
def.outputs = invertObject(componentDefinition.outputs),
|
|
997
|
-
feature && feature.forEach((fn) => fn(def));
|
|
998
|
-
def.directiveDefs = dependencies ?
|
|
999
|
-
(() => (typeof dependencies === 'function' ? dependencies() : dependencies)
|
|
1000
|
-
.map(extractDirectiveDef)
|
|
1001
|
-
.filter(nonNull)) :
|
|
1002
|
-
null;
|
|
1003
|
-
def.pipeDefs = dependencies ?
|
|
1004
|
-
(() => (typeof dependencies === 'function' ? dependencies() : dependencies)
|
|
1005
|
-
.map(getPipeDef$1)
|
|
1006
|
-
.filter(nonNull)) :
|
|
1007
|
-
null;
|
|
976
|
+
def.directiveDefs = extractDefListOrFactory(dependencies, /* pipeDef */ false);
|
|
977
|
+
def.pipeDefs = extractDefListOrFactory(dependencies, /* pipeDef */ true);
|
|
1008
978
|
return def;
|
|
1009
979
|
});
|
|
1010
980
|
}
|
|
@@ -1019,8 +989,8 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
1019
989
|
*/
|
|
1020
990
|
function ɵɵsetComponentScope(type, directives, pipes) {
|
|
1021
991
|
const def = type.ɵcmp;
|
|
1022
|
-
def.directiveDefs = (
|
|
1023
|
-
def.pipeDefs = (
|
|
992
|
+
def.directiveDefs = extractDefListOrFactory(directives, /* pipeDef */ false);
|
|
993
|
+
def.pipeDefs = extractDefListOrFactory(pipes, /* pipeDef */ true);
|
|
1024
994
|
}
|
|
1025
995
|
function extractDirectiveDef(type) {
|
|
1026
996
|
return getComponentDef(type) || getDirectiveDef(type);
|
|
@@ -1155,7 +1125,13 @@ function invertObject(obj, secondary) {
|
|
|
1155
1125
|
*
|
|
1156
1126
|
* @codeGenApi
|
|
1157
1127
|
*/
|
|
1158
|
-
|
|
1128
|
+
function ɵɵdefineDirective(directiveDefinition) {
|
|
1129
|
+
return noSideEffects(() => {
|
|
1130
|
+
const def = getNgDirectiveDef(directiveDefinition);
|
|
1131
|
+
initFeatures(def);
|
|
1132
|
+
return def;
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1159
1135
|
/**
|
|
1160
1136
|
* Create a pipe definition object.
|
|
1161
1137
|
*
|
|
@@ -1215,6 +1191,41 @@ function getNgModuleDef(type, throwNotFound) {
|
|
|
1215
1191
|
}
|
|
1216
1192
|
return ngModuleDef;
|
|
1217
1193
|
}
|
|
1194
|
+
function getNgDirectiveDef(directiveDefinition) {
|
|
1195
|
+
const declaredInputs = {};
|
|
1196
|
+
return {
|
|
1197
|
+
type: directiveDefinition.type,
|
|
1198
|
+
providersResolver: null,
|
|
1199
|
+
factory: null,
|
|
1200
|
+
hostBindings: directiveDefinition.hostBindings || null,
|
|
1201
|
+
hostVars: directiveDefinition.hostVars || 0,
|
|
1202
|
+
hostAttrs: directiveDefinition.hostAttrs || null,
|
|
1203
|
+
contentQueries: directiveDefinition.contentQueries || null,
|
|
1204
|
+
declaredInputs,
|
|
1205
|
+
exportAs: directiveDefinition.exportAs || null,
|
|
1206
|
+
standalone: directiveDefinition.standalone === true,
|
|
1207
|
+
selectors: directiveDefinition.selectors || EMPTY_ARRAY,
|
|
1208
|
+
viewQuery: directiveDefinition.viewQuery || null,
|
|
1209
|
+
features: directiveDefinition.features || null,
|
|
1210
|
+
setInput: null,
|
|
1211
|
+
findHostDirectiveDefs: null,
|
|
1212
|
+
hostDirectives: null,
|
|
1213
|
+
inputs: invertObject(directiveDefinition.inputs, declaredInputs),
|
|
1214
|
+
outputs: invertObject(directiveDefinition.outputs),
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function initFeatures(definition) {
|
|
1218
|
+
definition.features?.forEach((fn) => fn(definition));
|
|
1219
|
+
}
|
|
1220
|
+
function extractDefListOrFactory(dependencies, pipeDef) {
|
|
1221
|
+
if (!dependencies) {
|
|
1222
|
+
return null;
|
|
1223
|
+
}
|
|
1224
|
+
const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;
|
|
1225
|
+
return () => (typeof dependencies === 'function' ? dependencies() : dependencies)
|
|
1226
|
+
.map(dep => defExtractor(dep))
|
|
1227
|
+
.filter(nonNull);
|
|
1228
|
+
}
|
|
1218
1229
|
|
|
1219
1230
|
// Below are constants for LView indices to help us look up LView members
|
|
1220
1231
|
// without having to remember the specific indices.
|
|
@@ -1316,7 +1327,7 @@ function isDirectiveHost(tNode) {
|
|
|
1316
1327
|
return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
|
|
1317
1328
|
}
|
|
1318
1329
|
function isComponentDef(def) {
|
|
1319
|
-
return def.template
|
|
1330
|
+
return !!def.template;
|
|
1320
1331
|
}
|
|
1321
1332
|
function isRootView(target) {
|
|
1322
1333
|
return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
|
|
@@ -8336,7 +8347,7 @@ class Version {
|
|
|
8336
8347
|
/**
|
|
8337
8348
|
* @publicApi
|
|
8338
8349
|
*/
|
|
8339
|
-
const VERSION = new Version('15.2.
|
|
8350
|
+
const VERSION = new Version('15.2.4');
|
|
8340
8351
|
|
|
8341
8352
|
// This default value is when checking the hierarchy for a token.
|
|
8342
8353
|
//
|
|
@@ -8618,12 +8629,19 @@ function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
|
|
|
8618
8629
|
ngDevMode &&
|
|
8619
8630
|
assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), 'Class name expected to be lowercase.');
|
|
8620
8631
|
let i = 0;
|
|
8632
|
+
// Indicates whether we are processing value from the implicit
|
|
8633
|
+
// attribute section (i.e. before the first marker in the array).
|
|
8634
|
+
let isImplicitAttrsSection = true;
|
|
8621
8635
|
while (i < attrs.length) {
|
|
8622
8636
|
let item = attrs[i++];
|
|
8623
|
-
if (
|
|
8624
|
-
|
|
8625
|
-
if (
|
|
8626
|
-
|
|
8637
|
+
if (typeof item === 'string' && isImplicitAttrsSection) {
|
|
8638
|
+
const value = attrs[i++];
|
|
8639
|
+
if (isProjectionMode && item === 'class') {
|
|
8640
|
+
// We found a `class` attribute in the implicit attribute section,
|
|
8641
|
+
// check if it matches the value of the `cssClassToMatch` argument.
|
|
8642
|
+
if (classIndexOf(value.toLowerCase(), cssClassToMatch, 0) !== -1) {
|
|
8643
|
+
return true;
|
|
8644
|
+
}
|
|
8627
8645
|
}
|
|
8628
8646
|
}
|
|
8629
8647
|
else if (item === 1 /* AttributeMarker.Classes */) {
|
|
@@ -8635,6 +8653,11 @@ function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
|
|
|
8635
8653
|
}
|
|
8636
8654
|
return false;
|
|
8637
8655
|
}
|
|
8656
|
+
else if (typeof item === 'number') {
|
|
8657
|
+
// We've came across a first marker, which indicates
|
|
8658
|
+
// that the implicit attribute section is over.
|
|
8659
|
+
isImplicitAttrsSection = false;
|
|
8660
|
+
}
|
|
8638
8661
|
}
|
|
8639
8662
|
return false;
|
|
8640
8663
|
}
|
|
@@ -20261,7 +20284,8 @@ function sortListeners(a, b) {
|
|
|
20261
20284
|
* See call site for more info.
|
|
20262
20285
|
*/
|
|
20263
20286
|
function isDirectiveDefHack(obj) {
|
|
20264
|
-
return obj.type !== undefined && obj.
|
|
20287
|
+
return obj.type !== undefined && obj.declaredInputs !== undefined &&
|
|
20288
|
+
obj.findHostDirectiveDefs !== undefined;
|
|
20265
20289
|
}
|
|
20266
20290
|
/**
|
|
20267
20291
|
* Retrieve the component `LView` from component/element.
|