@angular/core 15.0.0 → 15.0.2
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/core_private_export.mjs +2 -1
- package/esm2020/src/error_details_base_url.mjs +6 -2
- package/esm2020/src/render/api.mjs +1 -3
- package/esm2020/src/render3/assert.mjs +1 -5
- package/esm2020/src/render3/component_ref.mjs +1 -12
- package/esm2020/src/render3/i18n/i18n_parse.mjs +3 -2
- package/esm2020/src/render3/index.mjs +2 -2
- package/esm2020/src/render3/instructions/listener.mjs +6 -5
- package/esm2020/src/render3/instructions/shared.mjs +87 -162
- package/esm2020/src/render3/interfaces/view.mjs +1 -10
- package/esm2020/src/render3/node_manipulation.mjs +11 -20
- package/esm2020/src/render3/util/discovery_utils.mjs +3 -32
- package/esm2020/src/sanitization/bypass.mjs +4 -3
- package/esm2020/src/sanitization/html_sanitizer.mjs +3 -2
- package/esm2020/src/sanitization/sanitization.mjs +3 -3
- package/esm2020/src/sanitization/url_sanitizer.mjs +3 -2
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/fesm2015/core.mjs +210 -1050
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +211 -1051
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +210 -1050
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +211 -1051
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +8 -223
- package/package.json +1 -1
- package/testing/index.d.ts +1 -1
- package/esm2020/src/render3/instructions/lview_debug.mjs +0 -684
- package/esm2020/src/util/named_array_type.mjs +0 -40
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.0.
|
|
2
|
+
* @license Angular v15.0.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getDebugNode
|
|
7
|
+
import { getDebugNode, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ɵisEnvironmentProviders, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
8
8
|
import { __awaiter } from 'tslib';
|
|
9
9
|
import { ResourceLoader } from '@angular/compiler';
|
|
10
10
|
import { Subject, Subscription } from 'rxjs';
|
|
@@ -86,7 +86,7 @@ class ComponentFixture {
|
|
|
86
86
|
this._onErrorSubscription = null;
|
|
87
87
|
this.changeDetectorRef = componentRef.changeDetectorRef;
|
|
88
88
|
this.elementRef = componentRef.location;
|
|
89
|
-
this.debugElement = getDebugNode
|
|
89
|
+
this.debugElement = getDebugNode(this.elementRef.nativeElement);
|
|
90
90
|
this.componentInstance = componentRef.instance;
|
|
91
91
|
this.nativeElement = this.elementRef.nativeElement;
|
|
92
92
|
this.componentRef = componentRef;
|
|
@@ -907,11 +907,15 @@ const NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafePr
|
|
|
907
907
|
/**
|
|
908
908
|
* Base URL for the error details page.
|
|
909
909
|
*
|
|
910
|
-
* Keep
|
|
910
|
+
* Keep this constant in sync across:
|
|
911
911
|
* - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
|
|
912
912
|
* - packages/core/src/error_details_base_url.ts
|
|
913
913
|
*/
|
|
914
914
|
const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
|
|
915
|
+
/**
|
|
916
|
+
* URL for the XSS security documentation.
|
|
917
|
+
*/
|
|
918
|
+
const XSS_SECURITY_URL = 'https://g.co/ng/security#xss';
|
|
915
919
|
|
|
916
920
|
/**
|
|
917
921
|
* @license
|
|
@@ -2890,15 +2894,6 @@ const EMBEDDED_VIEW_INJECTOR = 21;
|
|
|
2890
2894
|
* there should be no need to refer to `HEADER_OFFSET` anywhere else.
|
|
2891
2895
|
*/
|
|
2892
2896
|
const HEADER_OFFSET = 22;
|
|
2893
|
-
/**
|
|
2894
|
-
* Converts `TViewType` into human readable text.
|
|
2895
|
-
* Make sure this matches with `TViewType`
|
|
2896
|
-
*/
|
|
2897
|
-
const TViewTypeAsString = [
|
|
2898
|
-
'Root',
|
|
2899
|
-
'Component',
|
|
2900
|
-
'Embedded', // 2
|
|
2901
|
-
];
|
|
2902
2897
|
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
|
2903
2898
|
// failure based on types.
|
|
2904
2899
|
const unusedValueExportToPlacateAjd$7 = 1;
|
|
@@ -3021,10 +3016,6 @@ function assertIndexInDeclRange(lView, index) {
|
|
|
3021
3016
|
const tView = lView[1];
|
|
3022
3017
|
assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
|
|
3023
3018
|
}
|
|
3024
|
-
function assertIndexInVarsRange(lView, index) {
|
|
3025
|
-
const tView = lView[1];
|
|
3026
|
-
assertBetween(tView.bindingStartIndex, tView.expandoStartIndex, index);
|
|
3027
|
-
}
|
|
3028
3019
|
function assertIndexInExpandoRange(lView, index) {
|
|
3029
3020
|
const tView = lView[1];
|
|
3030
3021
|
assertBetween(tView.expandoStartIndex, lView.length, index);
|
|
@@ -6812,26 +6803,17 @@ function processCleanups(tView, lView) {
|
|
|
6812
6803
|
if (tCleanup !== null) {
|
|
6813
6804
|
for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
|
6814
6805
|
if (typeof tCleanup[i] === 'string') {
|
|
6815
|
-
// This is a native DOM listener
|
|
6816
|
-
|
|
6817
|
-
const
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
if (typeof useCaptureOrSubIdx === 'boolean') {
|
|
6823
|
-
// native DOM listener registered with Renderer3
|
|
6824
|
-
target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx);
|
|
6806
|
+
// This is a native DOM listener. It will occupy 4 entries in the TCleanup array (hence i +=
|
|
6807
|
+
// 2 at the end of this block).
|
|
6808
|
+
const targetIdx = tCleanup[i + 3];
|
|
6809
|
+
ngDevMode && assertNumber(targetIdx, 'cleanup target must be a number');
|
|
6810
|
+
if (targetIdx >= 0) {
|
|
6811
|
+
// unregister
|
|
6812
|
+
lCleanup[lastLCleanupIndex = targetIdx]();
|
|
6825
6813
|
}
|
|
6826
6814
|
else {
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
lCleanup[lastLCleanupIndex = useCaptureOrSubIdx]();
|
|
6830
|
-
}
|
|
6831
|
-
else {
|
|
6832
|
-
// Subscription
|
|
6833
|
-
lCleanup[lastLCleanupIndex = -useCaptureOrSubIdx].unsubscribe();
|
|
6834
|
-
}
|
|
6815
|
+
// Subscription
|
|
6816
|
+
lCleanup[lastLCleanupIndex = -targetIdx].unsubscribe();
|
|
6835
6817
|
}
|
|
6836
6818
|
i += 2;
|
|
6837
6819
|
}
|
|
@@ -7693,7 +7675,7 @@ class SafeValueImpl {
|
|
|
7693
7675
|
}
|
|
7694
7676
|
toString() {
|
|
7695
7677
|
return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}` +
|
|
7696
|
-
` (see
|
|
7678
|
+
` (see ${XSS_SECURITY_URL})`;
|
|
7697
7679
|
}
|
|
7698
7680
|
}
|
|
7699
7681
|
class SafeHtmlImpl extends SafeValueImpl {
|
|
@@ -7731,7 +7713,7 @@ function allowSanitizationBypassAndThrow(value, type) {
|
|
|
7731
7713
|
// Allow ResourceURLs in URL contexts, they are strictly more trusted.
|
|
7732
7714
|
if (actualType === "ResourceURL" /* BypassType.ResourceUrl */ && type === "URL" /* BypassType.Url */)
|
|
7733
7715
|
return true;
|
|
7734
|
-
throw new Error(`Required a safe ${type}, got a ${actualType} (see
|
|
7716
|
+
throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`);
|
|
7735
7717
|
}
|
|
7736
7718
|
return actualType === type;
|
|
7737
7719
|
}
|
|
@@ -7971,7 +7953,7 @@ function _sanitizeUrl(url) {
|
|
|
7971
7953
|
if (url.match(SAFE_URL_PATTERN))
|
|
7972
7954
|
return url;
|
|
7973
7955
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
7974
|
-
console.warn(`WARNING: sanitizing unsafe URL value ${url} (see
|
|
7956
|
+
console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`);
|
|
7975
7957
|
}
|
|
7976
7958
|
return 'unsafe:' + url;
|
|
7977
7959
|
}
|
|
@@ -8199,7 +8181,7 @@ function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
|
|
|
8199
8181
|
const sanitizer = new SanitizingHtmlSerializer();
|
|
8200
8182
|
const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
|
|
8201
8183
|
if ((typeof ngDevMode === 'undefined' || ngDevMode) && sanitizer.sanitizedSomething) {
|
|
8202
|
-
console.warn(
|
|
8184
|
+
console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`);
|
|
8203
8185
|
}
|
|
8204
8186
|
return trustedHTMLFromString(safeHtml);
|
|
8205
8187
|
}
|
|
@@ -8346,8 +8328,7 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
|
|
|
8346
8328
|
if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
|
|
8347
8329
|
return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
|
|
8348
8330
|
}
|
|
8349
|
-
throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
|
|
8350
|
-
'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
|
|
8331
|
+
throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
|
|
8351
8332
|
}
|
|
8352
8333
|
/**
|
|
8353
8334
|
* A `script` sanitizer which only lets trusted javascript through.
|
|
@@ -9448,7 +9429,6 @@ function unwrapElementRef(value) {
|
|
|
9448
9429
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9449
9430
|
* found in the LICENSE file at https://angular.io/license
|
|
9450
9431
|
*/
|
|
9451
|
-
const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
|
9452
9432
|
/**
|
|
9453
9433
|
* Creates and initializes a custom renderer that implements the `Renderer2` base class.
|
|
9454
9434
|
*
|
|
@@ -9532,7 +9512,7 @@ class Version {
|
|
|
9532
9512
|
/**
|
|
9533
9513
|
* @publicApi
|
|
9534
9514
|
*/
|
|
9535
|
-
const VERSION = new Version('15.0.
|
|
9515
|
+
const VERSION = new Version('15.0.2');
|
|
9536
9516
|
|
|
9537
9517
|
/**
|
|
9538
9518
|
* @license
|
|
@@ -11326,812 +11306,6 @@ function ɵɵinvalidFactory() {
|
|
|
11326
11306
|
throw new Error(msg);
|
|
11327
11307
|
}
|
|
11328
11308
|
|
|
11329
|
-
/**
|
|
11330
|
-
* @license
|
|
11331
|
-
* Copyright Google LLC All Rights Reserved.
|
|
11332
|
-
*
|
|
11333
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
11334
|
-
* found in the LICENSE file at https://angular.io/license
|
|
11335
|
-
*/
|
|
11336
|
-
/**
|
|
11337
|
-
* THIS FILE CONTAINS CODE WHICH SHOULD BE TREE SHAKEN AND NEVER CALLED FROM PRODUCTION CODE!!!
|
|
11338
|
-
*/
|
|
11339
|
-
/**
|
|
11340
|
-
* Creates an `Array` construction with a given name. This is useful when
|
|
11341
|
-
* looking for memory consumption to see what time of array it is.
|
|
11342
|
-
*
|
|
11343
|
-
*
|
|
11344
|
-
* @param name Name to give to the constructor
|
|
11345
|
-
* @returns A subclass of `Array` if possible. This can only be done in
|
|
11346
|
-
* environments which support `class` construct.
|
|
11347
|
-
*/
|
|
11348
|
-
function createNamedArrayType(name) {
|
|
11349
|
-
// This should never be called in prod mode, so let's verify that is the case.
|
|
11350
|
-
if (ngDevMode) {
|
|
11351
|
-
try {
|
|
11352
|
-
// If this function were compromised the following could lead to arbitrary
|
|
11353
|
-
// script execution. We bless it with Trusted Types anyway since this
|
|
11354
|
-
// function is stripped out of production binaries.
|
|
11355
|
-
return (newTrustedFunctionForDev('Array', `return class ${name} extends Array{}`))(Array);
|
|
11356
|
-
}
|
|
11357
|
-
catch (e) {
|
|
11358
|
-
// If it does not work just give up and fall back to regular Array.
|
|
11359
|
-
return Array;
|
|
11360
|
-
}
|
|
11361
|
-
}
|
|
11362
|
-
else {
|
|
11363
|
-
throw new Error('Looks like we are in \'prod mode\', but we are creating a named Array type, which is wrong! Check your code');
|
|
11364
|
-
}
|
|
11365
|
-
}
|
|
11366
|
-
|
|
11367
|
-
/**
|
|
11368
|
-
* @license
|
|
11369
|
-
* Copyright Google LLC All Rights Reserved.
|
|
11370
|
-
*
|
|
11371
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
11372
|
-
* found in the LICENSE file at https://angular.io/license
|
|
11373
|
-
*/
|
|
11374
|
-
function toTStylingRange(prev, next) {
|
|
11375
|
-
ngDevMode && assertNumberInRange(prev, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
11376
|
-
ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
11377
|
-
return (prev << 17 /* StylingRange.PREV_SHIFT */ | next << 2 /* StylingRange.NEXT_SHIFT */);
|
|
11378
|
-
}
|
|
11379
|
-
function getTStylingRangePrev(tStylingRange) {
|
|
11380
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11381
|
-
return (tStylingRange >> 17 /* StylingRange.PREV_SHIFT */) & 32767 /* StylingRange.UNSIGNED_MASK */;
|
|
11382
|
-
}
|
|
11383
|
-
function getTStylingRangePrevDuplicate(tStylingRange) {
|
|
11384
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11385
|
-
return (tStylingRange & 2 /* StylingRange.PREV_DUPLICATE */) ==
|
|
11386
|
-
2 /* StylingRange.PREV_DUPLICATE */;
|
|
11387
|
-
}
|
|
11388
|
-
function setTStylingRangePrev(tStylingRange, previous) {
|
|
11389
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11390
|
-
ngDevMode && assertNumberInRange(previous, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
11391
|
-
return ((tStylingRange & ~4294836224 /* StylingRange.PREV_MASK */) |
|
|
11392
|
-
(previous << 17 /* StylingRange.PREV_SHIFT */));
|
|
11393
|
-
}
|
|
11394
|
-
function setTStylingRangePrevDuplicate(tStylingRange) {
|
|
11395
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11396
|
-
return (tStylingRange | 2 /* StylingRange.PREV_DUPLICATE */);
|
|
11397
|
-
}
|
|
11398
|
-
function getTStylingRangeNext(tStylingRange) {
|
|
11399
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11400
|
-
return (tStylingRange & 131068 /* StylingRange.NEXT_MASK */) >> 2 /* StylingRange.NEXT_SHIFT */;
|
|
11401
|
-
}
|
|
11402
|
-
function setTStylingRangeNext(tStylingRange, next) {
|
|
11403
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11404
|
-
ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
11405
|
-
return ((tStylingRange & ~131068 /* StylingRange.NEXT_MASK */) | //
|
|
11406
|
-
next << 2 /* StylingRange.NEXT_SHIFT */);
|
|
11407
|
-
}
|
|
11408
|
-
function getTStylingRangeNextDuplicate(tStylingRange) {
|
|
11409
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11410
|
-
return (tStylingRange & 1 /* StylingRange.NEXT_DUPLICATE */) ===
|
|
11411
|
-
1 /* StylingRange.NEXT_DUPLICATE */;
|
|
11412
|
-
}
|
|
11413
|
-
function setTStylingRangeNextDuplicate(tStylingRange) {
|
|
11414
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11415
|
-
return (tStylingRange | 1 /* StylingRange.NEXT_DUPLICATE */);
|
|
11416
|
-
}
|
|
11417
|
-
function getTStylingRangeTail(tStylingRange) {
|
|
11418
|
-
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
11419
|
-
const next = getTStylingRangeNext(tStylingRange);
|
|
11420
|
-
return next === 0 ? getTStylingRangePrev(tStylingRange) : next;
|
|
11421
|
-
}
|
|
11422
|
-
|
|
11423
|
-
/**
|
|
11424
|
-
* @license
|
|
11425
|
-
* Copyright Google LLC All Rights Reserved.
|
|
11426
|
-
*
|
|
11427
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
11428
|
-
* found in the LICENSE file at https://angular.io/license
|
|
11429
|
-
*/
|
|
11430
|
-
/**
|
|
11431
|
-
* Patch a `debug` property on top of the existing object.
|
|
11432
|
-
*
|
|
11433
|
-
* NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
|
|
11434
|
-
*
|
|
11435
|
-
* @param obj Object to patch
|
|
11436
|
-
* @param debug Value to patch
|
|
11437
|
-
*/
|
|
11438
|
-
function attachDebugObject(obj, debug) {
|
|
11439
|
-
if (ngDevMode) {
|
|
11440
|
-
Object.defineProperty(obj, 'debug', { value: debug, enumerable: false });
|
|
11441
|
-
}
|
|
11442
|
-
else {
|
|
11443
|
-
throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
|
11444
|
-
}
|
|
11445
|
-
}
|
|
11446
|
-
/**
|
|
11447
|
-
* Patch a `debug` property getter on top of the existing object.
|
|
11448
|
-
*
|
|
11449
|
-
* NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
|
|
11450
|
-
*
|
|
11451
|
-
* @param obj Object to patch
|
|
11452
|
-
* @param debugGetter Getter returning a value to patch
|
|
11453
|
-
*/
|
|
11454
|
-
function attachDebugGetter(obj, debugGetter) {
|
|
11455
|
-
if (ngDevMode) {
|
|
11456
|
-
Object.defineProperty(obj, 'debug', { get: debugGetter, enumerable: false });
|
|
11457
|
-
}
|
|
11458
|
-
else {
|
|
11459
|
-
throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
|
11460
|
-
}
|
|
11461
|
-
}
|
|
11462
|
-
|
|
11463
|
-
/**
|
|
11464
|
-
* @license
|
|
11465
|
-
* Copyright Google LLC All Rights Reserved.
|
|
11466
|
-
*
|
|
11467
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
11468
|
-
* found in the LICENSE file at https://angular.io/license
|
|
11469
|
-
*/
|
|
11470
|
-
/*
|
|
11471
|
-
* This file contains conditionally attached classes which provide human readable (debug) level
|
|
11472
|
-
* information for `LView`, `LContainer` and other internal data structures. These data structures
|
|
11473
|
-
* are stored internally as array which makes it very difficult during debugging to reason about the
|
|
11474
|
-
* current state of the system.
|
|
11475
|
-
*
|
|
11476
|
-
* Patching the array with extra property does change the array's hidden class' but it does not
|
|
11477
|
-
* change the cost of access, therefore this patching should not have significant if any impact in
|
|
11478
|
-
* `ngDevMode` mode. (see: https://jsperf.com/array-vs-monkey-patch-array)
|
|
11479
|
-
*
|
|
11480
|
-
* So instead of seeing:
|
|
11481
|
-
* ```
|
|
11482
|
-
* Array(30) [Object, 659, null, …]
|
|
11483
|
-
* ```
|
|
11484
|
-
*
|
|
11485
|
-
* You get to see:
|
|
11486
|
-
* ```
|
|
11487
|
-
* LViewDebug {
|
|
11488
|
-
* views: [...],
|
|
11489
|
-
* flags: {attached: true, ...}
|
|
11490
|
-
* nodes: [
|
|
11491
|
-
* {html: '<div id="123">', ..., nodes: [
|
|
11492
|
-
* {html: '<span>', ..., nodes: null}
|
|
11493
|
-
* ]}
|
|
11494
|
-
* ]
|
|
11495
|
-
* }
|
|
11496
|
-
* ```
|
|
11497
|
-
*/
|
|
11498
|
-
let LVIEW_COMPONENT_CACHE;
|
|
11499
|
-
let LVIEW_EMBEDDED_CACHE;
|
|
11500
|
-
let LVIEW_ROOT;
|
|
11501
|
-
let LVIEW_COMPONENT;
|
|
11502
|
-
let LVIEW_EMBEDDED;
|
|
11503
|
-
/**
|
|
11504
|
-
* This function clones a blueprint and creates LView.
|
|
11505
|
-
*
|
|
11506
|
-
* Simple slice will keep the same type, and we need it to be LView
|
|
11507
|
-
*/
|
|
11508
|
-
function cloneToLViewFromTViewBlueprint(tView) {
|
|
11509
|
-
const debugTView = tView;
|
|
11510
|
-
const lView = getLViewToClone(debugTView.type, tView.template && tView.template.name);
|
|
11511
|
-
return lView.concat(tView.blueprint);
|
|
11512
|
-
}
|
|
11513
|
-
class LRootView extends Array {
|
|
11514
|
-
}
|
|
11515
|
-
class LComponentView extends Array {
|
|
11516
|
-
}
|
|
11517
|
-
class LEmbeddedView extends Array {
|
|
11518
|
-
}
|
|
11519
|
-
function getLViewToClone(type, name) {
|
|
11520
|
-
switch (type) {
|
|
11521
|
-
case 0 /* TViewType.Root */:
|
|
11522
|
-
if (LVIEW_ROOT === undefined)
|
|
11523
|
-
LVIEW_ROOT = new LRootView();
|
|
11524
|
-
return LVIEW_ROOT;
|
|
11525
|
-
case 1 /* TViewType.Component */:
|
|
11526
|
-
if (!ngDevMode || !ngDevMode.namedConstructors) {
|
|
11527
|
-
if (LVIEW_COMPONENT === undefined)
|
|
11528
|
-
LVIEW_COMPONENT = new LComponentView();
|
|
11529
|
-
return LVIEW_COMPONENT;
|
|
11530
|
-
}
|
|
11531
|
-
if (LVIEW_COMPONENT_CACHE === undefined)
|
|
11532
|
-
LVIEW_COMPONENT_CACHE = new Map();
|
|
11533
|
-
let componentArray = LVIEW_COMPONENT_CACHE.get(name);
|
|
11534
|
-
if (componentArray === undefined) {
|
|
11535
|
-
componentArray = new (createNamedArrayType('LComponentView' + nameSuffix(name)))();
|
|
11536
|
-
LVIEW_COMPONENT_CACHE.set(name, componentArray);
|
|
11537
|
-
}
|
|
11538
|
-
return componentArray;
|
|
11539
|
-
case 2 /* TViewType.Embedded */:
|
|
11540
|
-
if (!ngDevMode || !ngDevMode.namedConstructors) {
|
|
11541
|
-
if (LVIEW_EMBEDDED === undefined)
|
|
11542
|
-
LVIEW_EMBEDDED = new LEmbeddedView();
|
|
11543
|
-
return LVIEW_EMBEDDED;
|
|
11544
|
-
}
|
|
11545
|
-
if (LVIEW_EMBEDDED_CACHE === undefined)
|
|
11546
|
-
LVIEW_EMBEDDED_CACHE = new Map();
|
|
11547
|
-
let embeddedArray = LVIEW_EMBEDDED_CACHE.get(name);
|
|
11548
|
-
if (embeddedArray === undefined) {
|
|
11549
|
-
embeddedArray = new (createNamedArrayType('LEmbeddedView' + nameSuffix(name)))();
|
|
11550
|
-
LVIEW_EMBEDDED_CACHE.set(name, embeddedArray);
|
|
11551
|
-
}
|
|
11552
|
-
return embeddedArray;
|
|
11553
|
-
}
|
|
11554
|
-
}
|
|
11555
|
-
function nameSuffix(text) {
|
|
11556
|
-
if (text == null)
|
|
11557
|
-
return '';
|
|
11558
|
-
const index = text.lastIndexOf('_Template');
|
|
11559
|
-
return '_' + (index === -1 ? text : text.slice(0, index));
|
|
11560
|
-
}
|
|
11561
|
-
/**
|
|
11562
|
-
* This class is a debug version of Object literal so that we can have constructor name show up
|
|
11563
|
-
* in
|
|
11564
|
-
* debug tools in ngDevMode.
|
|
11565
|
-
*/
|
|
11566
|
-
const TViewConstructor = class TView {
|
|
11567
|
-
constructor(type, blueprint, template, queries, viewQuery, declTNode, data, bindingStartIndex, expandoStartIndex, hostBindingOpCodes, firstCreatePass, firstUpdatePass, staticViewQueries, staticContentQueries, preOrderHooks, preOrderCheckHooks, contentHooks, contentCheckHooks, viewHooks, viewCheckHooks, destroyHooks, cleanup, contentQueries, components, directiveRegistry, pipeRegistry, firstChild, schemas, consts, incompleteFirstPass, _decls, _vars) {
|
|
11568
|
-
this.type = type;
|
|
11569
|
-
this.blueprint = blueprint;
|
|
11570
|
-
this.template = template;
|
|
11571
|
-
this.queries = queries;
|
|
11572
|
-
this.viewQuery = viewQuery;
|
|
11573
|
-
this.declTNode = declTNode;
|
|
11574
|
-
this.data = data;
|
|
11575
|
-
this.bindingStartIndex = bindingStartIndex;
|
|
11576
|
-
this.expandoStartIndex = expandoStartIndex;
|
|
11577
|
-
this.hostBindingOpCodes = hostBindingOpCodes;
|
|
11578
|
-
this.firstCreatePass = firstCreatePass;
|
|
11579
|
-
this.firstUpdatePass = firstUpdatePass;
|
|
11580
|
-
this.staticViewQueries = staticViewQueries;
|
|
11581
|
-
this.staticContentQueries = staticContentQueries;
|
|
11582
|
-
this.preOrderHooks = preOrderHooks;
|
|
11583
|
-
this.preOrderCheckHooks = preOrderCheckHooks;
|
|
11584
|
-
this.contentHooks = contentHooks;
|
|
11585
|
-
this.contentCheckHooks = contentCheckHooks;
|
|
11586
|
-
this.viewHooks = viewHooks;
|
|
11587
|
-
this.viewCheckHooks = viewCheckHooks;
|
|
11588
|
-
this.destroyHooks = destroyHooks;
|
|
11589
|
-
this.cleanup = cleanup;
|
|
11590
|
-
this.contentQueries = contentQueries;
|
|
11591
|
-
this.components = components;
|
|
11592
|
-
this.directiveRegistry = directiveRegistry;
|
|
11593
|
-
this.pipeRegistry = pipeRegistry;
|
|
11594
|
-
this.firstChild = firstChild;
|
|
11595
|
-
this.schemas = schemas;
|
|
11596
|
-
this.consts = consts;
|
|
11597
|
-
this.incompleteFirstPass = incompleteFirstPass;
|
|
11598
|
-
this._decls = _decls;
|
|
11599
|
-
this._vars = _vars;
|
|
11600
|
-
}
|
|
11601
|
-
get template_() {
|
|
11602
|
-
const buf = [];
|
|
11603
|
-
processTNodeChildren(this.firstChild, buf);
|
|
11604
|
-
return buf.join('');
|
|
11605
|
-
}
|
|
11606
|
-
get type_() {
|
|
11607
|
-
return TViewTypeAsString[this.type] || `TViewType.?${this.type}?`;
|
|
11608
|
-
}
|
|
11609
|
-
};
|
|
11610
|
-
class TNode {
|
|
11611
|
-
constructor(tView_, //
|
|
11612
|
-
type, //
|
|
11613
|
-
index, //
|
|
11614
|
-
insertBeforeIndex, //
|
|
11615
|
-
injectorIndex, //
|
|
11616
|
-
componentOffset, //
|
|
11617
|
-
directiveStart, //
|
|
11618
|
-
directiveEnd, //
|
|
11619
|
-
directiveStylingLast, //
|
|
11620
|
-
propertyBindings, //
|
|
11621
|
-
flags, //
|
|
11622
|
-
providerIndexes, //
|
|
11623
|
-
value, //
|
|
11624
|
-
attrs, //
|
|
11625
|
-
mergedAttrs, //
|
|
11626
|
-
localNames, //
|
|
11627
|
-
initialInputs, //
|
|
11628
|
-
inputs, //
|
|
11629
|
-
outputs, //
|
|
11630
|
-
tViews, //
|
|
11631
|
-
next, //
|
|
11632
|
-
projectionNext, //
|
|
11633
|
-
child, //
|
|
11634
|
-
parent, //
|
|
11635
|
-
projection, //
|
|
11636
|
-
styles, //
|
|
11637
|
-
stylesWithoutHost, //
|
|
11638
|
-
residualStyles, //
|
|
11639
|
-
classes, //
|
|
11640
|
-
classesWithoutHost, //
|
|
11641
|
-
residualClasses, //
|
|
11642
|
-
classBindings, //
|
|
11643
|
-
styleBindings) {
|
|
11644
|
-
this.tView_ = tView_;
|
|
11645
|
-
this.type = type;
|
|
11646
|
-
this.index = index;
|
|
11647
|
-
this.insertBeforeIndex = insertBeforeIndex;
|
|
11648
|
-
this.injectorIndex = injectorIndex;
|
|
11649
|
-
this.componentOffset = componentOffset;
|
|
11650
|
-
this.directiveStart = directiveStart;
|
|
11651
|
-
this.directiveEnd = directiveEnd;
|
|
11652
|
-
this.directiveStylingLast = directiveStylingLast;
|
|
11653
|
-
this.propertyBindings = propertyBindings;
|
|
11654
|
-
this.flags = flags;
|
|
11655
|
-
this.providerIndexes = providerIndexes;
|
|
11656
|
-
this.value = value;
|
|
11657
|
-
this.attrs = attrs;
|
|
11658
|
-
this.mergedAttrs = mergedAttrs;
|
|
11659
|
-
this.localNames = localNames;
|
|
11660
|
-
this.initialInputs = initialInputs;
|
|
11661
|
-
this.inputs = inputs;
|
|
11662
|
-
this.outputs = outputs;
|
|
11663
|
-
this.tViews = tViews;
|
|
11664
|
-
this.next = next;
|
|
11665
|
-
this.projectionNext = projectionNext;
|
|
11666
|
-
this.child = child;
|
|
11667
|
-
this.parent = parent;
|
|
11668
|
-
this.projection = projection;
|
|
11669
|
-
this.styles = styles;
|
|
11670
|
-
this.stylesWithoutHost = stylesWithoutHost;
|
|
11671
|
-
this.residualStyles = residualStyles;
|
|
11672
|
-
this.classes = classes;
|
|
11673
|
-
this.classesWithoutHost = classesWithoutHost;
|
|
11674
|
-
this.residualClasses = residualClasses;
|
|
11675
|
-
this.classBindings = classBindings;
|
|
11676
|
-
this.styleBindings = styleBindings;
|
|
11677
|
-
}
|
|
11678
|
-
/**
|
|
11679
|
-
* Return a human debug version of the set of `NodeInjector`s which will be consulted when
|
|
11680
|
-
* resolving tokens from this `TNode`.
|
|
11681
|
-
*
|
|
11682
|
-
* When debugging applications, it is often difficult to determine which `NodeInjector`s will be
|
|
11683
|
-
* consulted. This method shows a list of `DebugNode`s representing the `TNode`s which will be
|
|
11684
|
-
* consulted in order when resolving a token starting at this `TNode`.
|
|
11685
|
-
*
|
|
11686
|
-
* The original data is stored in `LView` and `TView` with a lot of offset indexes, and so it is
|
|
11687
|
-
* difficult to reason about.
|
|
11688
|
-
*
|
|
11689
|
-
* @param lView The `LView` instance for this `TNode`.
|
|
11690
|
-
*/
|
|
11691
|
-
debugNodeInjectorPath(lView) {
|
|
11692
|
-
const path = [];
|
|
11693
|
-
let injectorIndex = getInjectorIndex(this, lView);
|
|
11694
|
-
if (injectorIndex === -1) {
|
|
11695
|
-
// Looks like the current `TNode` does not have `NodeInjector` associated with it => look for
|
|
11696
|
-
// parent NodeInjector.
|
|
11697
|
-
const parentLocation = getParentInjectorLocation(this, lView);
|
|
11698
|
-
if (parentLocation !== NO_PARENT_INJECTOR) {
|
|
11699
|
-
// We found a parent, so start searching from the parent location.
|
|
11700
|
-
injectorIndex = getParentInjectorIndex(parentLocation);
|
|
11701
|
-
lView = getParentInjectorView(parentLocation, lView);
|
|
11702
|
-
}
|
|
11703
|
-
else {
|
|
11704
|
-
// No parents have been found, so there are no `NodeInjector`s to consult.
|
|
11705
|
-
}
|
|
11706
|
-
}
|
|
11707
|
-
while (injectorIndex !== -1) {
|
|
11708
|
-
ngDevMode && assertNodeInjector(lView, injectorIndex);
|
|
11709
|
-
const tNode = lView[TVIEW].data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */];
|
|
11710
|
-
path.push(buildDebugNode(tNode, lView));
|
|
11711
|
-
const parentLocation = lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];
|
|
11712
|
-
if (parentLocation === NO_PARENT_INJECTOR) {
|
|
11713
|
-
injectorIndex = -1;
|
|
11714
|
-
}
|
|
11715
|
-
else {
|
|
11716
|
-
injectorIndex = getParentInjectorIndex(parentLocation);
|
|
11717
|
-
lView = getParentInjectorView(parentLocation, lView);
|
|
11718
|
-
}
|
|
11719
|
-
}
|
|
11720
|
-
return path;
|
|
11721
|
-
}
|
|
11722
|
-
get type_() {
|
|
11723
|
-
return toTNodeTypeAsString(this.type) || `TNodeType.?${this.type}?`;
|
|
11724
|
-
}
|
|
11725
|
-
get flags_() {
|
|
11726
|
-
const flags = [];
|
|
11727
|
-
if (this.flags & 8 /* TNodeFlags.hasClassInput */)
|
|
11728
|
-
flags.push('TNodeFlags.hasClassInput');
|
|
11729
|
-
if (this.flags & 4 /* TNodeFlags.hasContentQuery */)
|
|
11730
|
-
flags.push('TNodeFlags.hasContentQuery');
|
|
11731
|
-
if (this.flags & 16 /* TNodeFlags.hasStyleInput */)
|
|
11732
|
-
flags.push('TNodeFlags.hasStyleInput');
|
|
11733
|
-
if (this.flags & 64 /* TNodeFlags.hasHostBindings */)
|
|
11734
|
-
flags.push('TNodeFlags.hasHostBindings');
|
|
11735
|
-
if (this.flags & 1 /* TNodeFlags.isDirectiveHost */)
|
|
11736
|
-
flags.push('TNodeFlags.isDirectiveHost');
|
|
11737
|
-
if (this.flags & 32 /* TNodeFlags.isDetached */)
|
|
11738
|
-
flags.push('TNodeFlags.isDetached');
|
|
11739
|
-
if (this.flags & 2 /* TNodeFlags.isProjected */)
|
|
11740
|
-
flags.push('TNodeFlags.isProjected');
|
|
11741
|
-
return flags.join('|');
|
|
11742
|
-
}
|
|
11743
|
-
get template_() {
|
|
11744
|
-
if (this.type & 1 /* TNodeType.Text */)
|
|
11745
|
-
return this.value;
|
|
11746
|
-
const buf = [];
|
|
11747
|
-
const tagName = typeof this.value === 'string' && this.value || this.type_;
|
|
11748
|
-
buf.push('<', tagName);
|
|
11749
|
-
if (this.flags) {
|
|
11750
|
-
buf.push(' ', this.flags_);
|
|
11751
|
-
}
|
|
11752
|
-
if (this.attrs) {
|
|
11753
|
-
for (let i = 0; i < this.attrs.length;) {
|
|
11754
|
-
const attrName = this.attrs[i++];
|
|
11755
|
-
if (typeof attrName == 'number') {
|
|
11756
|
-
break;
|
|
11757
|
-
}
|
|
11758
|
-
const attrValue = this.attrs[i++];
|
|
11759
|
-
buf.push(' ', attrName, '="', attrValue, '"');
|
|
11760
|
-
}
|
|
11761
|
-
}
|
|
11762
|
-
buf.push('>');
|
|
11763
|
-
processTNodeChildren(this.child, buf);
|
|
11764
|
-
buf.push('</', tagName, '>');
|
|
11765
|
-
return buf.join('');
|
|
11766
|
-
}
|
|
11767
|
-
get styleBindings_() {
|
|
11768
|
-
return toDebugStyleBinding(this, false);
|
|
11769
|
-
}
|
|
11770
|
-
get classBindings_() {
|
|
11771
|
-
return toDebugStyleBinding(this, true);
|
|
11772
|
-
}
|
|
11773
|
-
get providerIndexStart_() {
|
|
11774
|
-
return this.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;
|
|
11775
|
-
}
|
|
11776
|
-
get providerIndexEnd_() {
|
|
11777
|
-
return this.providerIndexStart_ +
|
|
11778
|
-
(this.providerIndexes >>> 20 /* TNodeProviderIndexes.CptViewProvidersCountShift */);
|
|
11779
|
-
}
|
|
11780
|
-
}
|
|
11781
|
-
const TNodeDebug = TNode;
|
|
11782
|
-
function toDebugStyleBinding(tNode, isClassBased) {
|
|
11783
|
-
const tData = tNode.tView_.data;
|
|
11784
|
-
const bindings = [];
|
|
11785
|
-
const range = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
|
11786
|
-
const prev = getTStylingRangePrev(range);
|
|
11787
|
-
const next = getTStylingRangeNext(range);
|
|
11788
|
-
let isTemplate = next !== 0;
|
|
11789
|
-
let cursor = isTemplate ? next : prev;
|
|
11790
|
-
while (cursor !== 0) {
|
|
11791
|
-
const itemKey = tData[cursor];
|
|
11792
|
-
const itemRange = tData[cursor + 1];
|
|
11793
|
-
bindings.unshift({
|
|
11794
|
-
key: itemKey,
|
|
11795
|
-
index: cursor,
|
|
11796
|
-
isTemplate: isTemplate,
|
|
11797
|
-
prevDuplicate: getTStylingRangePrevDuplicate(itemRange),
|
|
11798
|
-
nextDuplicate: getTStylingRangeNextDuplicate(itemRange),
|
|
11799
|
-
nextIndex: getTStylingRangeNext(itemRange),
|
|
11800
|
-
prevIndex: getTStylingRangePrev(itemRange),
|
|
11801
|
-
});
|
|
11802
|
-
if (cursor === prev)
|
|
11803
|
-
isTemplate = false;
|
|
11804
|
-
cursor = getTStylingRangePrev(itemRange);
|
|
11805
|
-
}
|
|
11806
|
-
bindings.push((isClassBased ? tNode.residualClasses : tNode.residualStyles) || null);
|
|
11807
|
-
return bindings;
|
|
11808
|
-
}
|
|
11809
|
-
function processTNodeChildren(tNode, buf) {
|
|
11810
|
-
while (tNode) {
|
|
11811
|
-
buf.push(tNode.template_);
|
|
11812
|
-
tNode = tNode.next;
|
|
11813
|
-
}
|
|
11814
|
-
}
|
|
11815
|
-
class TViewData extends Array {
|
|
11816
|
-
}
|
|
11817
|
-
let TVIEWDATA_EMPTY; // can't initialize here or it will not be tree shaken, because
|
|
11818
|
-
// `LView` constructor could have side-effects.
|
|
11819
|
-
/**
|
|
11820
|
-
* This function clones a blueprint and creates TData.
|
|
11821
|
-
*
|
|
11822
|
-
* Simple slice will keep the same type, and we need it to be TData
|
|
11823
|
-
*/
|
|
11824
|
-
function cloneToTViewData(list) {
|
|
11825
|
-
if (TVIEWDATA_EMPTY === undefined)
|
|
11826
|
-
TVIEWDATA_EMPTY = new TViewData();
|
|
11827
|
-
return TVIEWDATA_EMPTY.concat(list);
|
|
11828
|
-
}
|
|
11829
|
-
class LViewBlueprint extends Array {
|
|
11830
|
-
}
|
|
11831
|
-
class MatchesArray extends Array {
|
|
11832
|
-
}
|
|
11833
|
-
class TViewComponents extends Array {
|
|
11834
|
-
}
|
|
11835
|
-
class TNodeLocalNames extends Array {
|
|
11836
|
-
}
|
|
11837
|
-
class TNodeInitialInputs extends Array {
|
|
11838
|
-
}
|
|
11839
|
-
class LCleanup extends Array {
|
|
11840
|
-
}
|
|
11841
|
-
class TCleanup extends Array {
|
|
11842
|
-
}
|
|
11843
|
-
function attachLViewDebug(lView) {
|
|
11844
|
-
attachDebugObject(lView, new LViewDebug(lView));
|
|
11845
|
-
}
|
|
11846
|
-
function attachLContainerDebug(lContainer) {
|
|
11847
|
-
attachDebugObject(lContainer, new LContainerDebug(lContainer));
|
|
11848
|
-
}
|
|
11849
|
-
function toDebug(obj) {
|
|
11850
|
-
if (obj) {
|
|
11851
|
-
const debug = obj.debug;
|
|
11852
|
-
assertDefined(debug, 'Object does not have a debug representation.');
|
|
11853
|
-
return debug;
|
|
11854
|
-
}
|
|
11855
|
-
else {
|
|
11856
|
-
return obj;
|
|
11857
|
-
}
|
|
11858
|
-
}
|
|
11859
|
-
/**
|
|
11860
|
-
* Use this method to unwrap a native element in `LView` and convert it into HTML for easier
|
|
11861
|
-
* reading.
|
|
11862
|
-
*
|
|
11863
|
-
* @param value possibly wrapped native DOM node.
|
|
11864
|
-
* @param includeChildren If `true` then the serialized HTML form will include child elements
|
|
11865
|
-
* (same
|
|
11866
|
-
* as `outerHTML`). If `false` then the serialized HTML form will only contain the element
|
|
11867
|
-
* itself
|
|
11868
|
-
* (will not serialize child elements).
|
|
11869
|
-
*/
|
|
11870
|
-
function toHtml(value, includeChildren = false) {
|
|
11871
|
-
const node = unwrapRNode(value);
|
|
11872
|
-
if (node) {
|
|
11873
|
-
switch (node.nodeType) {
|
|
11874
|
-
case Node.TEXT_NODE:
|
|
11875
|
-
return node.textContent;
|
|
11876
|
-
case Node.COMMENT_NODE:
|
|
11877
|
-
return `<!--${node.textContent}-->`;
|
|
11878
|
-
case Node.ELEMENT_NODE:
|
|
11879
|
-
const outerHTML = node.outerHTML;
|
|
11880
|
-
if (includeChildren) {
|
|
11881
|
-
return outerHTML;
|
|
11882
|
-
}
|
|
11883
|
-
else {
|
|
11884
|
-
const innerHTML = '>' + node.innerHTML + '<';
|
|
11885
|
-
return (outerHTML.split(innerHTML)[0]) + '>';
|
|
11886
|
-
}
|
|
11887
|
-
}
|
|
11888
|
-
}
|
|
11889
|
-
return null;
|
|
11890
|
-
}
|
|
11891
|
-
class LViewDebug {
|
|
11892
|
-
constructor(_raw_lView) {
|
|
11893
|
-
this._raw_lView = _raw_lView;
|
|
11894
|
-
}
|
|
11895
|
-
/**
|
|
11896
|
-
* Flags associated with the `LView` unpacked into a more readable state.
|
|
11897
|
-
*/
|
|
11898
|
-
get flags() {
|
|
11899
|
-
const flags = this._raw_lView[FLAGS];
|
|
11900
|
-
return {
|
|
11901
|
-
__raw__flags__: flags,
|
|
11902
|
-
initPhaseState: flags & 3 /* LViewFlags.InitPhaseStateMask */,
|
|
11903
|
-
creationMode: !!(flags & 4 /* LViewFlags.CreationMode */),
|
|
11904
|
-
firstViewPass: !!(flags & 8 /* LViewFlags.FirstLViewPass */),
|
|
11905
|
-
checkAlways: !!(flags & 16 /* LViewFlags.CheckAlways */),
|
|
11906
|
-
dirty: !!(flags & 32 /* LViewFlags.Dirty */),
|
|
11907
|
-
attached: !!(flags & 64 /* LViewFlags.Attached */),
|
|
11908
|
-
destroyed: !!(flags & 128 /* LViewFlags.Destroyed */),
|
|
11909
|
-
isRoot: !!(flags & 256 /* LViewFlags.IsRoot */),
|
|
11910
|
-
indexWithinInitPhase: flags >> 11 /* LViewFlags.IndexWithinInitPhaseShift */,
|
|
11911
|
-
};
|
|
11912
|
-
}
|
|
11913
|
-
get parent() {
|
|
11914
|
-
return toDebug(this._raw_lView[PARENT]);
|
|
11915
|
-
}
|
|
11916
|
-
get hostHTML() {
|
|
11917
|
-
return toHtml(this._raw_lView[HOST], true);
|
|
11918
|
-
}
|
|
11919
|
-
get html() {
|
|
11920
|
-
return (this.nodes || []).map(mapToHTML).join('');
|
|
11921
|
-
}
|
|
11922
|
-
get context() {
|
|
11923
|
-
return this._raw_lView[CONTEXT];
|
|
11924
|
-
}
|
|
11925
|
-
/**
|
|
11926
|
-
* The tree of nodes associated with the current `LView`. The nodes have been normalized into
|
|
11927
|
-
* a tree structure with relevant details pulled out for readability.
|
|
11928
|
-
*/
|
|
11929
|
-
get nodes() {
|
|
11930
|
-
const lView = this._raw_lView;
|
|
11931
|
-
const tNode = lView[TVIEW].firstChild;
|
|
11932
|
-
return toDebugNodes(tNode, lView);
|
|
11933
|
-
}
|
|
11934
|
-
get template() {
|
|
11935
|
-
return this.tView.template_;
|
|
11936
|
-
}
|
|
11937
|
-
get tView() {
|
|
11938
|
-
return this._raw_lView[TVIEW];
|
|
11939
|
-
}
|
|
11940
|
-
get cleanup() {
|
|
11941
|
-
return this._raw_lView[CLEANUP];
|
|
11942
|
-
}
|
|
11943
|
-
get injector() {
|
|
11944
|
-
return this._raw_lView[INJECTOR$1];
|
|
11945
|
-
}
|
|
11946
|
-
get rendererFactory() {
|
|
11947
|
-
return this._raw_lView[RENDERER_FACTORY];
|
|
11948
|
-
}
|
|
11949
|
-
get renderer() {
|
|
11950
|
-
return this._raw_lView[RENDERER];
|
|
11951
|
-
}
|
|
11952
|
-
get sanitizer() {
|
|
11953
|
-
return this._raw_lView[SANITIZER];
|
|
11954
|
-
}
|
|
11955
|
-
get childHead() {
|
|
11956
|
-
return toDebug(this._raw_lView[CHILD_HEAD]);
|
|
11957
|
-
}
|
|
11958
|
-
get next() {
|
|
11959
|
-
return toDebug(this._raw_lView[NEXT]);
|
|
11960
|
-
}
|
|
11961
|
-
get childTail() {
|
|
11962
|
-
return toDebug(this._raw_lView[CHILD_TAIL]);
|
|
11963
|
-
}
|
|
11964
|
-
get declarationView() {
|
|
11965
|
-
return toDebug(this._raw_lView[DECLARATION_VIEW]);
|
|
11966
|
-
}
|
|
11967
|
-
get queries() {
|
|
11968
|
-
return this._raw_lView[QUERIES];
|
|
11969
|
-
}
|
|
11970
|
-
get tHost() {
|
|
11971
|
-
return this._raw_lView[T_HOST];
|
|
11972
|
-
}
|
|
11973
|
-
get id() {
|
|
11974
|
-
return this._raw_lView[ID];
|
|
11975
|
-
}
|
|
11976
|
-
get decls() {
|
|
11977
|
-
return toLViewRange(this.tView, this._raw_lView, HEADER_OFFSET, this.tView.bindingStartIndex);
|
|
11978
|
-
}
|
|
11979
|
-
get vars() {
|
|
11980
|
-
return toLViewRange(this.tView, this._raw_lView, this.tView.bindingStartIndex, this.tView.expandoStartIndex);
|
|
11981
|
-
}
|
|
11982
|
-
get expando() {
|
|
11983
|
-
return toLViewRange(this.tView, this._raw_lView, this.tView.expandoStartIndex, this._raw_lView.length);
|
|
11984
|
-
}
|
|
11985
|
-
/**
|
|
11986
|
-
* Normalized view of child views (and containers) attached at this location.
|
|
11987
|
-
*/
|
|
11988
|
-
get childViews() {
|
|
11989
|
-
const childViews = [];
|
|
11990
|
-
let child = this.childHead;
|
|
11991
|
-
while (child) {
|
|
11992
|
-
childViews.push(child);
|
|
11993
|
-
child = child.next;
|
|
11994
|
-
}
|
|
11995
|
-
return childViews;
|
|
11996
|
-
}
|
|
11997
|
-
}
|
|
11998
|
-
function mapToHTML(node) {
|
|
11999
|
-
if (node.type === 'ElementContainer') {
|
|
12000
|
-
return (node.children || []).map(mapToHTML).join('');
|
|
12001
|
-
}
|
|
12002
|
-
else if (node.type === 'IcuContainer') {
|
|
12003
|
-
throw new Error('Not implemented');
|
|
12004
|
-
}
|
|
12005
|
-
else {
|
|
12006
|
-
return toHtml(node.native, true) || '';
|
|
12007
|
-
}
|
|
12008
|
-
}
|
|
12009
|
-
function toLViewRange(tView, lView, start, end) {
|
|
12010
|
-
let content = [];
|
|
12011
|
-
for (let index = start; index < end; index++) {
|
|
12012
|
-
content.push({ index: index, t: tView.data[index], l: lView[index] });
|
|
12013
|
-
}
|
|
12014
|
-
return { start: start, end: end, length: end - start, content: content };
|
|
12015
|
-
}
|
|
12016
|
-
/**
|
|
12017
|
-
* Turns a flat list of nodes into a tree by walking the associated `TNode` tree.
|
|
12018
|
-
*
|
|
12019
|
-
* @param tNode
|
|
12020
|
-
* @param lView
|
|
12021
|
-
*/
|
|
12022
|
-
function toDebugNodes(tNode, lView) {
|
|
12023
|
-
if (tNode) {
|
|
12024
|
-
const debugNodes = [];
|
|
12025
|
-
let tNodeCursor = tNode;
|
|
12026
|
-
while (tNodeCursor) {
|
|
12027
|
-
debugNodes.push(buildDebugNode(tNodeCursor, lView));
|
|
12028
|
-
tNodeCursor = tNodeCursor.next;
|
|
12029
|
-
}
|
|
12030
|
-
return debugNodes;
|
|
12031
|
-
}
|
|
12032
|
-
else {
|
|
12033
|
-
return [];
|
|
12034
|
-
}
|
|
12035
|
-
}
|
|
12036
|
-
function buildDebugNode(tNode, lView) {
|
|
12037
|
-
const rawValue = lView[tNode.index];
|
|
12038
|
-
const native = unwrapRNode(rawValue);
|
|
12039
|
-
const factories = [];
|
|
12040
|
-
const instances = [];
|
|
12041
|
-
const tView = lView[TVIEW];
|
|
12042
|
-
for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
|
|
12043
|
-
const def = tView.data[i];
|
|
12044
|
-
factories.push(def.type);
|
|
12045
|
-
instances.push(lView[i]);
|
|
12046
|
-
}
|
|
12047
|
-
return {
|
|
12048
|
-
html: toHtml(native),
|
|
12049
|
-
type: toTNodeTypeAsString(tNode.type),
|
|
12050
|
-
tNode,
|
|
12051
|
-
native: native,
|
|
12052
|
-
children: toDebugNodes(tNode.child, lView),
|
|
12053
|
-
factories,
|
|
12054
|
-
instances,
|
|
12055
|
-
injector: buildNodeInjectorDebug(tNode, tView, lView),
|
|
12056
|
-
get injectorResolutionPath() {
|
|
12057
|
-
return tNode.debugNodeInjectorPath(lView);
|
|
12058
|
-
},
|
|
12059
|
-
};
|
|
12060
|
-
}
|
|
12061
|
-
function buildNodeInjectorDebug(tNode, tView, lView) {
|
|
12062
|
-
const viewProviders = [];
|
|
12063
|
-
for (let i = tNode.providerIndexStart_; i < tNode.providerIndexEnd_; i++) {
|
|
12064
|
-
viewProviders.push(tView.data[i]);
|
|
12065
|
-
}
|
|
12066
|
-
const providers = [];
|
|
12067
|
-
for (let i = tNode.providerIndexEnd_; i < tNode.directiveEnd; i++) {
|
|
12068
|
-
providers.push(tView.data[i]);
|
|
12069
|
-
}
|
|
12070
|
-
const nodeInjectorDebug = {
|
|
12071
|
-
bloom: toBloom(lView, tNode.injectorIndex),
|
|
12072
|
-
cumulativeBloom: toBloom(tView.data, tNode.injectorIndex),
|
|
12073
|
-
providers,
|
|
12074
|
-
viewProviders,
|
|
12075
|
-
parentInjectorIndex: lView[tNode.providerIndexStart_ - 1],
|
|
12076
|
-
};
|
|
12077
|
-
return nodeInjectorDebug;
|
|
12078
|
-
}
|
|
12079
|
-
/**
|
|
12080
|
-
* Convert a number at `idx` location in `array` into binary representation.
|
|
12081
|
-
*
|
|
12082
|
-
* @param array
|
|
12083
|
-
* @param idx
|
|
12084
|
-
*/
|
|
12085
|
-
function binary(array, idx) {
|
|
12086
|
-
const value = array[idx];
|
|
12087
|
-
// If not a number we print 8 `?` to retain alignment but let user know that it was called on
|
|
12088
|
-
// wrong type.
|
|
12089
|
-
if (typeof value !== 'number')
|
|
12090
|
-
return '????????';
|
|
12091
|
-
// We prefix 0s so that we have constant length number
|
|
12092
|
-
const text = '00000000' + value.toString(2);
|
|
12093
|
-
return text.substring(text.length - 8);
|
|
12094
|
-
}
|
|
12095
|
-
/**
|
|
12096
|
-
* Convert a bloom filter at location `idx` in `array` into binary representation.
|
|
12097
|
-
*
|
|
12098
|
-
* @param array
|
|
12099
|
-
* @param idx
|
|
12100
|
-
*/
|
|
12101
|
-
function toBloom(array, idx) {
|
|
12102
|
-
if (idx < 0) {
|
|
12103
|
-
return 'NO_NODE_INJECTOR';
|
|
12104
|
-
}
|
|
12105
|
-
return `${binary(array, idx + 7)}_${binary(array, idx + 6)}_${binary(array, idx + 5)}_${binary(array, idx + 4)}_${binary(array, idx + 3)}_${binary(array, idx + 2)}_${binary(array, idx + 1)}_${binary(array, idx + 0)}`;
|
|
12106
|
-
}
|
|
12107
|
-
class LContainerDebug {
|
|
12108
|
-
constructor(_raw_lContainer) {
|
|
12109
|
-
this._raw_lContainer = _raw_lContainer;
|
|
12110
|
-
}
|
|
12111
|
-
get hasTransplantedViews() {
|
|
12112
|
-
return this._raw_lContainer[HAS_TRANSPLANTED_VIEWS];
|
|
12113
|
-
}
|
|
12114
|
-
get views() {
|
|
12115
|
-
return this._raw_lContainer.slice(CONTAINER_HEADER_OFFSET)
|
|
12116
|
-
.map(toDebug);
|
|
12117
|
-
}
|
|
12118
|
-
get parent() {
|
|
12119
|
-
return toDebug(this._raw_lContainer[PARENT]);
|
|
12120
|
-
}
|
|
12121
|
-
get movedViews() {
|
|
12122
|
-
return this._raw_lContainer[MOVED_VIEWS];
|
|
12123
|
-
}
|
|
12124
|
-
get host() {
|
|
12125
|
-
return this._raw_lContainer[HOST];
|
|
12126
|
-
}
|
|
12127
|
-
get native() {
|
|
12128
|
-
return this._raw_lContainer[NATIVE];
|
|
12129
|
-
}
|
|
12130
|
-
get next() {
|
|
12131
|
-
return toDebug(this._raw_lContainer[NEXT]);
|
|
12132
|
-
}
|
|
12133
|
-
}
|
|
12134
|
-
|
|
12135
11309
|
/**
|
|
12136
11310
|
* @license
|
|
12137
11311
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -12205,7 +11379,7 @@ function renderChildComponents(hostLView, components) {
|
|
|
12205
11379
|
}
|
|
12206
11380
|
}
|
|
12207
11381
|
function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector) {
|
|
12208
|
-
const lView =
|
|
11382
|
+
const lView = tView.blueprint.slice();
|
|
12209
11383
|
lView[HOST] = host;
|
|
12210
11384
|
lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 64 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
|
|
12211
11385
|
if (embeddedViewInjector !== null ||
|
|
@@ -12229,7 +11403,6 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, render
|
|
|
12229
11403
|
assertEqual(tView.type == 2 /* TViewType.Embedded */ ? parentLView !== null : true, true, 'Embedded views must have parentLView');
|
|
12230
11404
|
lView[DECLARATION_COMPONENT_VIEW] =
|
|
12231
11405
|
tView.type == 2 /* TViewType.Embedded */ ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
|
|
12232
|
-
ngDevMode && attachLViewDebug(lView);
|
|
12233
11406
|
return lView;
|
|
12234
11407
|
}
|
|
12235
11408
|
function getOrCreateTNode(tView, index, type, name, attrs) {
|
|
@@ -12612,73 +11785,38 @@ function createTView(type, declTNode, templateFn, decls, vars, directives, pipes
|
|
|
12612
11785
|
const initialViewLength = bindingStartIndex + vars;
|
|
12613
11786
|
const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
|
|
12614
11787
|
const consts = typeof constsOrFactory === 'function' ? constsOrFactory() : constsOrFactory;
|
|
12615
|
-
const tView = blueprint[TVIEW] =
|
|
12616
|
-
|
|
12617
|
-
blueprint
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
viewQuery
|
|
12621
|
-
declTNode
|
|
12622
|
-
|
|
12623
|
-
bindingStartIndex
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
|
|
12630
|
-
|
|
12631
|
-
|
|
12632
|
-
|
|
12633
|
-
|
|
12634
|
-
|
|
12635
|
-
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
typeof directives === 'function' ?
|
|
12641
|
-
|
|
12642
|
-
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
false, // incompleteFirstPass: boolean
|
|
12648
|
-
decls, // ngDevMode only: decls
|
|
12649
|
-
vars) :
|
|
12650
|
-
{
|
|
12651
|
-
type: type,
|
|
12652
|
-
blueprint: blueprint,
|
|
12653
|
-
template: templateFn,
|
|
12654
|
-
queries: null,
|
|
12655
|
-
viewQuery: viewQuery,
|
|
12656
|
-
declTNode: declTNode,
|
|
12657
|
-
data: blueprint.slice().fill(null, bindingStartIndex),
|
|
12658
|
-
bindingStartIndex: bindingStartIndex,
|
|
12659
|
-
expandoStartIndex: initialViewLength,
|
|
12660
|
-
hostBindingOpCodes: null,
|
|
12661
|
-
firstCreatePass: true,
|
|
12662
|
-
firstUpdatePass: true,
|
|
12663
|
-
staticViewQueries: false,
|
|
12664
|
-
staticContentQueries: false,
|
|
12665
|
-
preOrderHooks: null,
|
|
12666
|
-
preOrderCheckHooks: null,
|
|
12667
|
-
contentHooks: null,
|
|
12668
|
-
contentCheckHooks: null,
|
|
12669
|
-
viewHooks: null,
|
|
12670
|
-
viewCheckHooks: null,
|
|
12671
|
-
destroyHooks: null,
|
|
12672
|
-
cleanup: null,
|
|
12673
|
-
contentQueries: null,
|
|
12674
|
-
components: null,
|
|
12675
|
-
directiveRegistry: typeof directives === 'function' ? directives() : directives,
|
|
12676
|
-
pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
|
|
12677
|
-
firstChild: null,
|
|
12678
|
-
schemas: schemas,
|
|
12679
|
-
consts: consts,
|
|
12680
|
-
incompleteFirstPass: false
|
|
12681
|
-
};
|
|
11788
|
+
const tView = blueprint[TVIEW] = {
|
|
11789
|
+
type: type,
|
|
11790
|
+
blueprint: blueprint,
|
|
11791
|
+
template: templateFn,
|
|
11792
|
+
queries: null,
|
|
11793
|
+
viewQuery: viewQuery,
|
|
11794
|
+
declTNode: declTNode,
|
|
11795
|
+
data: blueprint.slice().fill(null, bindingStartIndex),
|
|
11796
|
+
bindingStartIndex: bindingStartIndex,
|
|
11797
|
+
expandoStartIndex: initialViewLength,
|
|
11798
|
+
hostBindingOpCodes: null,
|
|
11799
|
+
firstCreatePass: true,
|
|
11800
|
+
firstUpdatePass: true,
|
|
11801
|
+
staticViewQueries: false,
|
|
11802
|
+
staticContentQueries: false,
|
|
11803
|
+
preOrderHooks: null,
|
|
11804
|
+
preOrderCheckHooks: null,
|
|
11805
|
+
contentHooks: null,
|
|
11806
|
+
contentCheckHooks: null,
|
|
11807
|
+
viewHooks: null,
|
|
11808
|
+
viewCheckHooks: null,
|
|
11809
|
+
destroyHooks: null,
|
|
11810
|
+
cleanup: null,
|
|
11811
|
+
contentQueries: null,
|
|
11812
|
+
components: null,
|
|
11813
|
+
directiveRegistry: typeof directives === 'function' ? directives() : directives,
|
|
11814
|
+
pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
|
|
11815
|
+
firstChild: null,
|
|
11816
|
+
schemas: schemas,
|
|
11817
|
+
consts: consts,
|
|
11818
|
+
incompleteFirstPass: false
|
|
11819
|
+
};
|
|
12682
11820
|
if (ngDevMode) {
|
|
12683
11821
|
// For performance reasons it is important that the tView retains the same shape during runtime.
|
|
12684
11822
|
// (To make sure that all of the code is monomorphic.) For this reason we seal the object to
|
|
@@ -12688,7 +11826,7 @@ function createTView(type, declTNode, templateFn, decls, vars, directives, pipes
|
|
|
12688
11826
|
return tView;
|
|
12689
11827
|
}
|
|
12690
11828
|
function createViewBlueprint(bindingStartIndex, initialViewLength) {
|
|
12691
|
-
const blueprint =
|
|
11829
|
+
const blueprint = [];
|
|
12692
11830
|
for (let i = 0; i < initialViewLength; i++) {
|
|
12693
11831
|
blueprint.push(i < bindingStartIndex ? null : NO_CHANGE);
|
|
12694
11832
|
}
|
|
@@ -12741,74 +11879,40 @@ function createTNode(tView, tParent, type, index, value, attrs) {
|
|
|
12741
11879
|
ngDevMode && ngDevMode.tNode++;
|
|
12742
11880
|
ngDevMode && tParent && assertTNodeForTView(tParent, tView);
|
|
12743
11881
|
let injectorIndex = tParent ? tParent.injectorIndex : -1;
|
|
12744
|
-
const tNode =
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
-1,
|
|
12751
|
-
-1,
|
|
12752
|
-
-1,
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
0,
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
null,
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
0,
|
|
12777
|
-
|
|
12778
|
-
{
|
|
12779
|
-
type,
|
|
12780
|
-
index,
|
|
12781
|
-
insertBeforeIndex: null,
|
|
12782
|
-
injectorIndex,
|
|
12783
|
-
directiveStart: -1,
|
|
12784
|
-
directiveEnd: -1,
|
|
12785
|
-
directiveStylingLast: -1,
|
|
12786
|
-
componentOffset: -1,
|
|
12787
|
-
propertyBindings: null,
|
|
12788
|
-
flags: 0,
|
|
12789
|
-
providerIndexes: 0,
|
|
12790
|
-
value: value,
|
|
12791
|
-
attrs: attrs,
|
|
12792
|
-
mergedAttrs: null,
|
|
12793
|
-
localNames: null,
|
|
12794
|
-
initialInputs: undefined,
|
|
12795
|
-
inputs: null,
|
|
12796
|
-
outputs: null,
|
|
12797
|
-
tViews: null,
|
|
12798
|
-
next: null,
|
|
12799
|
-
projectionNext: null,
|
|
12800
|
-
child: null,
|
|
12801
|
-
parent: tParent,
|
|
12802
|
-
projection: null,
|
|
12803
|
-
styles: null,
|
|
12804
|
-
stylesWithoutHost: null,
|
|
12805
|
-
residualStyles: undefined,
|
|
12806
|
-
classes: null,
|
|
12807
|
-
classesWithoutHost: null,
|
|
12808
|
-
residualClasses: undefined,
|
|
12809
|
-
classBindings: 0,
|
|
12810
|
-
styleBindings: 0,
|
|
12811
|
-
};
|
|
11882
|
+
const tNode = {
|
|
11883
|
+
type,
|
|
11884
|
+
index,
|
|
11885
|
+
insertBeforeIndex: null,
|
|
11886
|
+
injectorIndex,
|
|
11887
|
+
directiveStart: -1,
|
|
11888
|
+
directiveEnd: -1,
|
|
11889
|
+
directiveStylingLast: -1,
|
|
11890
|
+
componentOffset: -1,
|
|
11891
|
+
propertyBindings: null,
|
|
11892
|
+
flags: 0,
|
|
11893
|
+
providerIndexes: 0,
|
|
11894
|
+
value: value,
|
|
11895
|
+
attrs: attrs,
|
|
11896
|
+
mergedAttrs: null,
|
|
11897
|
+
localNames: null,
|
|
11898
|
+
initialInputs: undefined,
|
|
11899
|
+
inputs: null,
|
|
11900
|
+
outputs: null,
|
|
11901
|
+
tViews: null,
|
|
11902
|
+
next: null,
|
|
11903
|
+
projectionNext: null,
|
|
11904
|
+
child: null,
|
|
11905
|
+
parent: tParent,
|
|
11906
|
+
projection: null,
|
|
11907
|
+
styles: null,
|
|
11908
|
+
stylesWithoutHost: null,
|
|
11909
|
+
residualStyles: undefined,
|
|
11910
|
+
classes: null,
|
|
11911
|
+
classesWithoutHost: null,
|
|
11912
|
+
residualClasses: undefined,
|
|
11913
|
+
classBindings: 0,
|
|
11914
|
+
styleBindings: 0,
|
|
11915
|
+
};
|
|
12812
11916
|
if (ngDevMode) {
|
|
12813
11917
|
// For performance reasons it is important that the tNode retains the same shape during runtime.
|
|
12814
11918
|
// (To make sure that all of the code is monomorphic.) For this reason we seal the object to
|
|
@@ -12865,7 +11969,7 @@ function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMa
|
|
|
12865
11969
|
const end = tNode.directiveEnd;
|
|
12866
11970
|
const tViewData = tView.data;
|
|
12867
11971
|
const tNodeAttrs = tNode.attrs;
|
|
12868
|
-
const inputsFromAttrs =
|
|
11972
|
+
const inputsFromAttrs = [];
|
|
12869
11973
|
let inputsStore = null;
|
|
12870
11974
|
let outputsStore = null;
|
|
12871
11975
|
for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
|
@@ -13204,7 +12308,7 @@ function findDirectiveDefMatches(tView, tNode) {
|
|
|
13204
12308
|
for (let i = 0; i < registry.length; i++) {
|
|
13205
12309
|
const def = registry[i];
|
|
13206
12310
|
if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
|
|
13207
|
-
matches || (matches =
|
|
12311
|
+
matches || (matches = []);
|
|
13208
12312
|
if (isComponentDef(def)) {
|
|
13209
12313
|
if (ngDevMode) {
|
|
13210
12314
|
assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
|
|
@@ -13262,13 +12366,12 @@ function markAsComponentHost(tView, hostTNode, componentOffset) {
|
|
|
13262
12366
|
ngDevMode && assertFirstCreatePass(tView);
|
|
13263
12367
|
ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
|
|
13264
12368
|
hostTNode.componentOffset = componentOffset;
|
|
13265
|
-
(tView.components || (tView.components =
|
|
13266
|
-
.push(hostTNode.index);
|
|
12369
|
+
(tView.components || (tView.components = [])).push(hostTNode.index);
|
|
13267
12370
|
}
|
|
13268
12371
|
/** Caches local names and their matching directive indices for query and template lookups. */
|
|
13269
12372
|
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
|
13270
12373
|
if (localRefs) {
|
|
13271
|
-
const localNames = tNode.localNames =
|
|
12374
|
+
const localNames = tNode.localNames = [];
|
|
13272
12375
|
// Local names must be stored in tNode in the same order that localRefs are defined
|
|
13273
12376
|
// in the template to ensure the data is loaded in the same slots as their refs
|
|
13274
12377
|
// in the template (for template queries).
|
|
@@ -13451,9 +12554,6 @@ function generateInitialInputs(inputs, directiveIndex, attrs) {
|
|
|
13451
12554
|
//////////////////////////
|
|
13452
12555
|
//// ViewContainer & View
|
|
13453
12556
|
//////////////////////////
|
|
13454
|
-
// Not sure why I need to do `any` here but TS complains later.
|
|
13455
|
-
const LContainerArray = class LContainer extends Array {
|
|
13456
|
-
};
|
|
13457
12557
|
/**
|
|
13458
12558
|
* Creates a LContainer, either from a container instruction, or for a ViewContainerRef.
|
|
13459
12559
|
*
|
|
@@ -13466,20 +12566,20 @@ const LContainerArray = class LContainer extends Array {
|
|
|
13466
12566
|
*/
|
|
13467
12567
|
function createLContainer(hostNative, currentView, native, tNode) {
|
|
13468
12568
|
ngDevMode && assertLView(currentView);
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
12569
|
+
const lContainer = [
|
|
12570
|
+
hostNative,
|
|
12571
|
+
true,
|
|
12572
|
+
false,
|
|
12573
|
+
currentView,
|
|
12574
|
+
null,
|
|
12575
|
+
0,
|
|
12576
|
+
tNode,
|
|
12577
|
+
native,
|
|
12578
|
+
null,
|
|
12579
|
+
null, // moved views
|
|
12580
|
+
];
|
|
13480
12581
|
ngDevMode &&
|
|
13481
12582
|
assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, 'Should allocate correct number of slots for LContainer header.');
|
|
13482
|
-
ngDevMode && attachLContainerDebug(lContainer);
|
|
13483
12583
|
return lContainer;
|
|
13484
12584
|
}
|
|
13485
12585
|
/**
|
|
@@ -13753,10 +12853,10 @@ function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex,
|
|
|
13753
12853
|
}
|
|
13754
12854
|
function getOrCreateLViewCleanup(view) {
|
|
13755
12855
|
// top level variables should not be exported for performance reasons (PERF_NOTES.md)
|
|
13756
|
-
return view[CLEANUP] || (view[CLEANUP] =
|
|
12856
|
+
return view[CLEANUP] || (view[CLEANUP] = []);
|
|
13757
12857
|
}
|
|
13758
12858
|
function getOrCreateTViewCleanup(tView) {
|
|
13759
|
-
return tView.cleanup || (tView.cleanup =
|
|
12859
|
+
return tView.cleanup || (tView.cleanup = []);
|
|
13760
12860
|
}
|
|
13761
12861
|
/**
|
|
13762
12862
|
* There are cases where the sub component's renderer needs to be included
|
|
@@ -14368,17 +13468,6 @@ class ComponentFactory extends ComponentFactory$1 {
|
|
|
14368
13468
|
return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
|
|
14369
13469
|
}
|
|
14370
13470
|
}
|
|
14371
|
-
const componentFactoryResolver = new ComponentFactoryResolver();
|
|
14372
|
-
/**
|
|
14373
|
-
* Creates a ComponentFactoryResolver and stores it on the injector. Or, if the
|
|
14374
|
-
* ComponentFactoryResolver
|
|
14375
|
-
* already exists, retrieves the existing ComponentFactoryResolver.
|
|
14376
|
-
*
|
|
14377
|
-
* @returns The ComponentFactoryResolver instance to use
|
|
14378
|
-
*/
|
|
14379
|
-
function injectComponentFactoryResolver() {
|
|
14380
|
-
return componentFactoryResolver;
|
|
14381
|
-
}
|
|
14382
13471
|
/**
|
|
14383
13472
|
* Represents an instance of a Component created via a {@link ComponentFactory}.
|
|
14384
13473
|
*
|
|
@@ -16139,7 +15228,8 @@ const isObservable = isSubscribable;
|
|
|
16139
15228
|
*
|
|
16140
15229
|
* @param eventName Name of the event
|
|
16141
15230
|
* @param listenerFn The function to be called when event emits
|
|
16142
|
-
* @param useCapture Whether or not to use capture in event listener
|
|
15231
|
+
* @param useCapture Whether or not to use capture in event listener - this argument is a reminder
|
|
15232
|
+
* from the Renderer3 infrastructure and should be removed from the instruction arguments
|
|
16143
15233
|
* @param eventTargetResolver Function that returns global target information in case this listener
|
|
16144
15234
|
* should be attached to a global object like window, document or body
|
|
16145
15235
|
*
|
|
@@ -16149,7 +15239,7 @@ function ɵɵlistener(eventName, listenerFn, useCapture, eventTargetResolver) {
|
|
|
16149
15239
|
const lView = getLView();
|
|
16150
15240
|
const tView = getTView();
|
|
16151
15241
|
const tNode = getCurrentTNode();
|
|
16152
|
-
listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn,
|
|
15242
|
+
listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, eventTargetResolver);
|
|
16153
15243
|
return ɵɵlistener;
|
|
16154
15244
|
}
|
|
16155
15245
|
/**
|
|
@@ -16179,7 +15269,7 @@ function ɵɵsyntheticHostListener(eventName, listenerFn) {
|
|
|
16179
15269
|
const tView = getTView();
|
|
16180
15270
|
const currentDef = getCurrentDirectiveDef(tView.data);
|
|
16181
15271
|
const renderer = loadComponentRenderer(currentDef, tNode, lView);
|
|
16182
|
-
listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn
|
|
15272
|
+
listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn);
|
|
16183
15273
|
return ɵɵsyntheticHostListener;
|
|
16184
15274
|
}
|
|
16185
15275
|
/**
|
|
@@ -16212,7 +15302,7 @@ function findExistingListener(tView, lView, eventName, tNodeIdx) {
|
|
|
16212
15302
|
}
|
|
16213
15303
|
return null;
|
|
16214
15304
|
}
|
|
16215
|
-
function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
|
|
15305
|
+
function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, eventTargetResolver) {
|
|
16216
15306
|
const isTNodeDirectiveHost = isDirectiveHost(tNode);
|
|
16217
15307
|
const firstCreatePass = tView.firstCreatePass;
|
|
16218
15308
|
const tCleanup = firstCreatePass && getOrCreateTViewCleanup(tView);
|
|
@@ -16963,6 +16053,62 @@ function ɵɵpropertyInterpolateV(propName, values, sanitizer) {
|
|
|
16963
16053
|
return ɵɵpropertyInterpolateV;
|
|
16964
16054
|
}
|
|
16965
16055
|
|
|
16056
|
+
/**
|
|
16057
|
+
* @license
|
|
16058
|
+
* Copyright Google LLC All Rights Reserved.
|
|
16059
|
+
*
|
|
16060
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
16061
|
+
* found in the LICENSE file at https://angular.io/license
|
|
16062
|
+
*/
|
|
16063
|
+
function toTStylingRange(prev, next) {
|
|
16064
|
+
ngDevMode && assertNumberInRange(prev, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
16065
|
+
ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
16066
|
+
return (prev << 17 /* StylingRange.PREV_SHIFT */ | next << 2 /* StylingRange.NEXT_SHIFT */);
|
|
16067
|
+
}
|
|
16068
|
+
function getTStylingRangePrev(tStylingRange) {
|
|
16069
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16070
|
+
return (tStylingRange >> 17 /* StylingRange.PREV_SHIFT */) & 32767 /* StylingRange.UNSIGNED_MASK */;
|
|
16071
|
+
}
|
|
16072
|
+
function getTStylingRangePrevDuplicate(tStylingRange) {
|
|
16073
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16074
|
+
return (tStylingRange & 2 /* StylingRange.PREV_DUPLICATE */) ==
|
|
16075
|
+
2 /* StylingRange.PREV_DUPLICATE */;
|
|
16076
|
+
}
|
|
16077
|
+
function setTStylingRangePrev(tStylingRange, previous) {
|
|
16078
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16079
|
+
ngDevMode && assertNumberInRange(previous, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
16080
|
+
return ((tStylingRange & ~4294836224 /* StylingRange.PREV_MASK */) |
|
|
16081
|
+
(previous << 17 /* StylingRange.PREV_SHIFT */));
|
|
16082
|
+
}
|
|
16083
|
+
function setTStylingRangePrevDuplicate(tStylingRange) {
|
|
16084
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16085
|
+
return (tStylingRange | 2 /* StylingRange.PREV_DUPLICATE */);
|
|
16086
|
+
}
|
|
16087
|
+
function getTStylingRangeNext(tStylingRange) {
|
|
16088
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16089
|
+
return (tStylingRange & 131068 /* StylingRange.NEXT_MASK */) >> 2 /* StylingRange.NEXT_SHIFT */;
|
|
16090
|
+
}
|
|
16091
|
+
function setTStylingRangeNext(tStylingRange, next) {
|
|
16092
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16093
|
+
ngDevMode && assertNumberInRange(next, 0, 32767 /* StylingRange.UNSIGNED_MASK */);
|
|
16094
|
+
return ((tStylingRange & ~131068 /* StylingRange.NEXT_MASK */) | //
|
|
16095
|
+
next << 2 /* StylingRange.NEXT_SHIFT */);
|
|
16096
|
+
}
|
|
16097
|
+
function getTStylingRangeNextDuplicate(tStylingRange) {
|
|
16098
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16099
|
+
return (tStylingRange & 1 /* StylingRange.NEXT_DUPLICATE */) ===
|
|
16100
|
+
1 /* StylingRange.NEXT_DUPLICATE */;
|
|
16101
|
+
}
|
|
16102
|
+
function setTStylingRangeNextDuplicate(tStylingRange) {
|
|
16103
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16104
|
+
return (tStylingRange | 1 /* StylingRange.NEXT_DUPLICATE */);
|
|
16105
|
+
}
|
|
16106
|
+
function getTStylingRangeTail(tStylingRange) {
|
|
16107
|
+
ngDevMode && assertNumber(tStylingRange, 'expected number');
|
|
16108
|
+
const next = getTStylingRangeNext(tStylingRange);
|
|
16109
|
+
return next === 0 ? getTStylingRangePrev(tStylingRange) : next;
|
|
16110
|
+
}
|
|
16111
|
+
|
|
16966
16112
|
/**
|
|
16967
16113
|
* @license
|
|
16968
16114
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -20784,6 +19930,46 @@ function loadIcuContainerVisitor() {
|
|
|
20784
19930
|
return icuContainerIteratorStart;
|
|
20785
19931
|
}
|
|
20786
19932
|
|
|
19933
|
+
/**
|
|
19934
|
+
* @license
|
|
19935
|
+
* Copyright Google LLC All Rights Reserved.
|
|
19936
|
+
*
|
|
19937
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
19938
|
+
* found in the LICENSE file at https://angular.io/license
|
|
19939
|
+
*/
|
|
19940
|
+
/**
|
|
19941
|
+
* Patch a `debug` property on top of the existing object.
|
|
19942
|
+
*
|
|
19943
|
+
* NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
|
|
19944
|
+
*
|
|
19945
|
+
* @param obj Object to patch
|
|
19946
|
+
* @param debug Value to patch
|
|
19947
|
+
*/
|
|
19948
|
+
function attachDebugObject(obj, debug) {
|
|
19949
|
+
if (ngDevMode) {
|
|
19950
|
+
Object.defineProperty(obj, 'debug', { value: debug, enumerable: false });
|
|
19951
|
+
}
|
|
19952
|
+
else {
|
|
19953
|
+
throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
|
19954
|
+
}
|
|
19955
|
+
}
|
|
19956
|
+
/**
|
|
19957
|
+
* Patch a `debug` property getter on top of the existing object.
|
|
19958
|
+
*
|
|
19959
|
+
* NOTE: always call this method with `ngDevMode && attachDebugObject(...)`
|
|
19960
|
+
*
|
|
19961
|
+
* @param obj Object to patch
|
|
19962
|
+
* @param debugGetter Getter returning a value to patch
|
|
19963
|
+
*/
|
|
19964
|
+
function attachDebugGetter(obj, debugGetter) {
|
|
19965
|
+
if (ngDevMode) {
|
|
19966
|
+
Object.defineProperty(obj, 'debug', { get: debugGetter, enumerable: false });
|
|
19967
|
+
}
|
|
19968
|
+
else {
|
|
19969
|
+
throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
|
19970
|
+
}
|
|
19971
|
+
}
|
|
19972
|
+
|
|
20787
19973
|
/**
|
|
20788
19974
|
* @license
|
|
20789
19975
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -21539,7 +20725,7 @@ function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, up
|
|
|
21539
20725
|
ngDevMode &&
|
|
21540
20726
|
console.warn(`WARNING: ignoring unsafe attribute value ` +
|
|
21541
20727
|
`${lowerAttrName} on element ${tagName} ` +
|
|
21542
|
-
`(see
|
|
20728
|
+
`(see ${XSS_SECURITY_URL})`);
|
|
21543
20729
|
}
|
|
21544
20730
|
}
|
|
21545
20731
|
else {
|
|
@@ -22753,32 +21939,6 @@ function sortListeners(a, b) {
|
|
|
22753
21939
|
function isDirectiveDefHack(obj) {
|
|
22754
21940
|
return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
|
|
22755
21941
|
}
|
|
22756
|
-
/**
|
|
22757
|
-
* Returns the attached `DebugNode` instance for an element in the DOM.
|
|
22758
|
-
*
|
|
22759
|
-
* @param element DOM element which is owned by an existing component's view.
|
|
22760
|
-
*/
|
|
22761
|
-
function getDebugNode(element) {
|
|
22762
|
-
if (ngDevMode && !(element instanceof Node)) {
|
|
22763
|
-
throw new Error('Expecting instance of DOM Element');
|
|
22764
|
-
}
|
|
22765
|
-
const lContext = getLContext(element);
|
|
22766
|
-
const lView = lContext ? lContext.lView : null;
|
|
22767
|
-
if (lView === null) {
|
|
22768
|
-
return null;
|
|
22769
|
-
}
|
|
22770
|
-
const nodeIndex = lContext.nodeIndex;
|
|
22771
|
-
if (nodeIndex !== -1) {
|
|
22772
|
-
const valueInLView = lView[nodeIndex];
|
|
22773
|
-
// this means that value in the lView is a component with its own
|
|
22774
|
-
// data. In this situation the TNode is not accessed at the same spot.
|
|
22775
|
-
const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
|
|
22776
|
-
ngDevMode &&
|
|
22777
|
-
assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
|
|
22778
|
-
return buildDebugNode(tNode, lView);
|
|
22779
|
-
}
|
|
22780
|
-
return null;
|
|
22781
|
-
}
|
|
22782
21942
|
/**
|
|
22783
21943
|
* Retrieve the component `LView` from component/element.
|
|
22784
21944
|
*
|