@angular/language-service 7.0.0-rc.1 → 7.0.0
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/bundles/language-service.umd.js +766 -546
- package/bundles/language-service.umd.min.js +106 -91
- package/package.json +1 -1
- package/src/version.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v7.0.0
|
|
2
|
+
* @license Angular v7.0.0
|
|
3
3
|
* (c) 2010-2018 Google, Inc. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1164,7 +1164,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
1164
1164
|
* Use of this source code is governed by an MIT-style license that can be
|
|
1165
1165
|
* found in the LICENSE file at https://angular.io/license
|
|
1166
1166
|
*/
|
|
1167
|
-
var VERSION = new Version('7.0.0
|
|
1167
|
+
var VERSION = new Version('7.0.0');
|
|
1168
1168
|
|
|
1169
1169
|
/**
|
|
1170
1170
|
* @license
|
|
@@ -14439,6 +14439,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
14439
14439
|
Identifiers.pipeBind3 = { name: 'ɵpipeBind3', moduleName: CORE$1 };
|
|
14440
14440
|
Identifiers.pipeBind4 = { name: 'ɵpipeBind4', moduleName: CORE$1 };
|
|
14441
14441
|
Identifiers.pipeBindV = { name: 'ɵpipeBindV', moduleName: CORE$1 };
|
|
14442
|
+
Identifiers.i18nAttribute = { name: 'ɵi18nAttribute', moduleName: CORE$1 };
|
|
14443
|
+
Identifiers.i18nExp = { name: 'ɵi18nExp', moduleName: CORE$1 };
|
|
14444
|
+
Identifiers.i18nStart = { name: 'ɵi18nStart', moduleName: CORE$1 };
|
|
14445
|
+
Identifiers.i18nEnd = { name: 'ɵi18nEnd', moduleName: CORE$1 };
|
|
14446
|
+
Identifiers.i18nApply = { name: 'ɵi18nApply', moduleName: CORE$1 };
|
|
14442
14447
|
Identifiers.load = { name: 'ɵload', moduleName: CORE$1 };
|
|
14443
14448
|
Identifiers.loadQueryList = { name: 'ɵloadQueryList', moduleName: CORE$1 };
|
|
14444
14449
|
Identifiers.pipe = { name: 'ɵpipe', moduleName: CORE$1 };
|
|
@@ -14447,7 +14452,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
14447
14452
|
Identifiers.reference = { name: 'ɵreference', moduleName: CORE$1 };
|
|
14448
14453
|
Identifiers.inject = { name: 'inject', moduleName: CORE$1 };
|
|
14449
14454
|
Identifiers.injectAttribute = { name: 'ɵinjectAttribute', moduleName: CORE$1 };
|
|
14450
|
-
Identifiers.injectRenderer2 = { name: 'ɵinjectRenderer2', moduleName: CORE$1 };
|
|
14451
14455
|
Identifiers.directiveInject = { name: 'ɵdirectiveInject', moduleName: CORE$1 };
|
|
14452
14456
|
Identifiers.templateRefExtractor = { name: 'ɵtemplateRefExtractor', moduleName: CORE$1 };
|
|
14453
14457
|
Identifiers.defineBase = { name: 'ɵdefineBase', moduleName: CORE$1 };
|
|
@@ -14557,10 +14561,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
14557
14561
|
* The dependency is for the `Injector` type itself.
|
|
14558
14562
|
*/
|
|
14559
14563
|
R3ResolvedDependencyType[R3ResolvedDependencyType["Injector"] = 2] = "Injector";
|
|
14560
|
-
/**
|
|
14561
|
-
* The dependency is for `Renderer2`.
|
|
14562
|
-
*/
|
|
14563
|
-
R3ResolvedDependencyType[R3ResolvedDependencyType["Renderer2"] = 3] = "Renderer2";
|
|
14564
14564
|
})(R3ResolvedDependencyType || (R3ResolvedDependencyType = {}));
|
|
14565
14565
|
|
|
14566
14566
|
/**
|
|
@@ -24476,6 +24476,18 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24476
24476
|
throw new Error("ASSERTION ERROR: " + msg);
|
|
24477
24477
|
}
|
|
24478
24478
|
|
|
24479
|
+
/**
|
|
24480
|
+
* @license
|
|
24481
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
24482
|
+
*
|
|
24483
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
24484
|
+
* found in the LICENSE file at https://angular.io/license
|
|
24485
|
+
*/
|
|
24486
|
+
/**
|
|
24487
|
+
* This property will be monkey-patched on elements, components and directives
|
|
24488
|
+
*/
|
|
24489
|
+
var MONKEY_PATCH_KEY_NAME = '__ngContext__';
|
|
24490
|
+
|
|
24479
24491
|
/**
|
|
24480
24492
|
* @license
|
|
24481
24493
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -24484,24 +24496,25 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24484
24496
|
* found in the LICENSE file at https://angular.io/license
|
|
24485
24497
|
*/
|
|
24486
24498
|
/** Size of LViewData's header. Necessary to adjust for it when setting slots. */
|
|
24487
|
-
var HEADER_OFFSET =
|
|
24499
|
+
var HEADER_OFFSET = 17;
|
|
24488
24500
|
// Below are constants for LViewData indices to help us look up LViewData members
|
|
24489
24501
|
// without having to remember the specific indices.
|
|
24490
24502
|
// Uglify will inline these when minifying so there shouldn't be a cost.
|
|
24491
24503
|
var TVIEW = 0;
|
|
24492
|
-
var
|
|
24493
|
-
var
|
|
24494
|
-
var
|
|
24495
|
-
var
|
|
24496
|
-
var
|
|
24497
|
-
var
|
|
24498
|
-
var
|
|
24499
|
-
var
|
|
24500
|
-
var
|
|
24501
|
-
var
|
|
24502
|
-
var
|
|
24503
|
-
var
|
|
24504
|
-
var
|
|
24504
|
+
var FLAGS = 1;
|
|
24505
|
+
var PARENT = 2;
|
|
24506
|
+
var NEXT = 3;
|
|
24507
|
+
var QUERIES = 4;
|
|
24508
|
+
var HOST = 5;
|
|
24509
|
+
var HOST_NODE = 6;
|
|
24510
|
+
var BINDING_INDEX = 7;
|
|
24511
|
+
var CLEANUP = 8;
|
|
24512
|
+
var CONTEXT = 9;
|
|
24513
|
+
var INJECTOR$1 = 10;
|
|
24514
|
+
var RENDERER = 11;
|
|
24515
|
+
var SANITIZER = 12;
|
|
24516
|
+
var CONTAINER_INDEX = 14;
|
|
24517
|
+
var DECLARATION_VIEW = 16;
|
|
24505
24518
|
|
|
24506
24519
|
/**
|
|
24507
24520
|
* @license
|
|
@@ -24510,45 +24523,371 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24510
24523
|
* Use of this source code is governed by an MIT-style license that can be
|
|
24511
24524
|
* found in the LICENSE file at https://angular.io/license
|
|
24512
24525
|
*/
|
|
24526
|
+
function devModeEqual(a, b) {
|
|
24527
|
+
var isListLikeIterableA = isListLikeIterable(a);
|
|
24528
|
+
var isListLikeIterableB = isListLikeIterable(b);
|
|
24529
|
+
if (isListLikeIterableA && isListLikeIterableB) {
|
|
24530
|
+
return areIterablesEqual(a, b, devModeEqual);
|
|
24531
|
+
}
|
|
24532
|
+
else {
|
|
24533
|
+
var isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
|
24534
|
+
var isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
|
24535
|
+
if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
|
24536
|
+
return true;
|
|
24537
|
+
}
|
|
24538
|
+
else {
|
|
24539
|
+
return looseIdentical(a, b);
|
|
24540
|
+
}
|
|
24541
|
+
}
|
|
24542
|
+
}
|
|
24513
24543
|
/**
|
|
24514
|
-
*
|
|
24544
|
+
* Indicates that the result of a {@link Pipe} transformation has changed even though the
|
|
24545
|
+
* reference has not changed.
|
|
24546
|
+
*
|
|
24547
|
+
* Wrapped values are unwrapped automatically during the change detection, and the unwrapped value
|
|
24548
|
+
* is stored.
|
|
24549
|
+
*
|
|
24550
|
+
* Example:
|
|
24551
|
+
*
|
|
24552
|
+
* ```
|
|
24553
|
+
* if (this._latestValue === this._latestReturnedValue) {
|
|
24554
|
+
* return this._latestReturnedValue;
|
|
24555
|
+
* } else {
|
|
24556
|
+
* this._latestReturnedValue = this._latestValue;
|
|
24557
|
+
* return WrappedValue.wrap(this._latestValue); // this will force update
|
|
24558
|
+
* }
|
|
24559
|
+
* ```
|
|
24560
|
+
*
|
|
24515
24561
|
*/
|
|
24516
|
-
var
|
|
24562
|
+
var WrappedValue = /** @class */ (function () {
|
|
24563
|
+
function WrappedValue(value) {
|
|
24564
|
+
this.wrapped = value;
|
|
24565
|
+
}
|
|
24566
|
+
/** Creates a wrapped value. */
|
|
24567
|
+
WrappedValue.wrap = function (value) { return new WrappedValue(value); };
|
|
24568
|
+
/**
|
|
24569
|
+
* Returns the underlying value of a wrapped value.
|
|
24570
|
+
* Returns the given `value` when it is not wrapped.
|
|
24571
|
+
**/
|
|
24572
|
+
WrappedValue.unwrap = function (value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; };
|
|
24573
|
+
/** Returns true if `value` is a wrapped value. */
|
|
24574
|
+
WrappedValue.isWrapped = function (value) { return value instanceof WrappedValue; };
|
|
24575
|
+
return WrappedValue;
|
|
24576
|
+
}());
|
|
24577
|
+
/**
|
|
24578
|
+
* Represents a basic change from a previous to a new value.
|
|
24579
|
+
*
|
|
24580
|
+
*/
|
|
24581
|
+
var SimpleChange = /** @class */ (function () {
|
|
24582
|
+
function SimpleChange(previousValue, currentValue, firstChange) {
|
|
24583
|
+
this.previousValue = previousValue;
|
|
24584
|
+
this.currentValue = currentValue;
|
|
24585
|
+
this.firstChange = firstChange;
|
|
24586
|
+
}
|
|
24587
|
+
/**
|
|
24588
|
+
* Check whether the new value is the first value assigned.
|
|
24589
|
+
*/
|
|
24590
|
+
SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
|
|
24591
|
+
return SimpleChange;
|
|
24592
|
+
}());
|
|
24593
|
+
function isListLikeIterable(obj) {
|
|
24594
|
+
if (!isJsObject(obj))
|
|
24595
|
+
return false;
|
|
24596
|
+
return Array.isArray(obj) ||
|
|
24597
|
+
(!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
|
|
24598
|
+
getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
|
|
24599
|
+
}
|
|
24600
|
+
function areIterablesEqual(a, b, comparator) {
|
|
24601
|
+
var iterator1 = a[getSymbolIterator()]();
|
|
24602
|
+
var iterator2 = b[getSymbolIterator()]();
|
|
24603
|
+
while (true) {
|
|
24604
|
+
var item1 = iterator1.next();
|
|
24605
|
+
var item2 = iterator2.next();
|
|
24606
|
+
if (item1.done && item2.done)
|
|
24607
|
+
return true;
|
|
24608
|
+
if (item1.done || item2.done)
|
|
24609
|
+
return false;
|
|
24610
|
+
if (!comparator(item1.value, item2.value))
|
|
24611
|
+
return false;
|
|
24612
|
+
}
|
|
24613
|
+
}
|
|
24614
|
+
function iterateListLike(obj, fn) {
|
|
24615
|
+
if (Array.isArray(obj)) {
|
|
24616
|
+
for (var i = 0; i < obj.length; i++) {
|
|
24617
|
+
fn(obj[i]);
|
|
24618
|
+
}
|
|
24619
|
+
}
|
|
24620
|
+
else {
|
|
24621
|
+
var iterator = obj[getSymbolIterator()]();
|
|
24622
|
+
var item = void 0;
|
|
24623
|
+
while (!((item = iterator.next()).done)) {
|
|
24624
|
+
fn(item.value);
|
|
24625
|
+
}
|
|
24626
|
+
}
|
|
24627
|
+
}
|
|
24628
|
+
function isJsObject(o) {
|
|
24629
|
+
return o !== null && (typeof o === 'function' || typeof o === 'object');
|
|
24630
|
+
}
|
|
24631
|
+
|
|
24632
|
+
/**
|
|
24633
|
+
* @license
|
|
24634
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
24635
|
+
*
|
|
24636
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
24637
|
+
* found in the LICENSE file at https://angular.io/license
|
|
24638
|
+
*/
|
|
24639
|
+
/**
|
|
24640
|
+
* Below are constants for LContainer indices to help us look up LContainer members
|
|
24641
|
+
* without having to remember the specific indices.
|
|
24642
|
+
* Uglify will inline these when minifying so there shouldn't be a cost.
|
|
24643
|
+
*/
|
|
24644
|
+
var ACTIVE_INDEX = 0;
|
|
24645
|
+
var VIEWS = 1;
|
|
24646
|
+
// PARENT, NEXT, QUERIES, and HOST are indices 2, 3, 4, and 5.
|
|
24647
|
+
// As we already have these constants in LViewData, we don't need to re-create them.
|
|
24648
|
+
var NATIVE = 6;
|
|
24649
|
+
var RENDER_PARENT = 7;
|
|
24650
|
+
|
|
24651
|
+
/**
|
|
24652
|
+
* @license
|
|
24653
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
24654
|
+
*
|
|
24655
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
24656
|
+
* found in the LICENSE file at https://angular.io/license
|
|
24657
|
+
*/
|
|
24658
|
+
function stringify$2(value) {
|
|
24659
|
+
if (typeof value == 'function')
|
|
24660
|
+
return value.name || value;
|
|
24661
|
+
if (typeof value == 'string')
|
|
24662
|
+
return value;
|
|
24663
|
+
if (value == null)
|
|
24664
|
+
return '';
|
|
24665
|
+
return '' + value;
|
|
24666
|
+
}
|
|
24667
|
+
/**
|
|
24668
|
+
* Flattens an array in non-recursive way. Input arrays are not modified.
|
|
24669
|
+
*/
|
|
24670
|
+
function flatten$2(list) {
|
|
24671
|
+
var result = [];
|
|
24672
|
+
var i = 0;
|
|
24673
|
+
while (i < list.length) {
|
|
24674
|
+
var item = list[i];
|
|
24675
|
+
if (Array.isArray(item)) {
|
|
24676
|
+
if (item.length > 0) {
|
|
24677
|
+
list = item.concat(list.slice(i + 1));
|
|
24678
|
+
i = 0;
|
|
24679
|
+
}
|
|
24680
|
+
else {
|
|
24681
|
+
i++;
|
|
24682
|
+
}
|
|
24683
|
+
}
|
|
24684
|
+
else {
|
|
24685
|
+
result.push(item);
|
|
24686
|
+
i++;
|
|
24687
|
+
}
|
|
24688
|
+
}
|
|
24689
|
+
return result;
|
|
24690
|
+
}
|
|
24691
|
+
function assertDataInRangeInternal(index, arr) {
|
|
24692
|
+
assertLessThan(index, arr ? arr.length : 0, 'index expected to be a valid data index');
|
|
24693
|
+
}
|
|
24694
|
+
/**
|
|
24695
|
+
* Takes the value of a slot in `LViewData` and returns the element node.
|
|
24696
|
+
*
|
|
24697
|
+
* Normally, element nodes are stored flat, but if the node has styles/classes on it,
|
|
24698
|
+
* it might be wrapped in a styling context. Or if that node has a directive that injects
|
|
24699
|
+
* ViewContainerRef, it may be wrapped in an LContainer. Or if that node is a component,
|
|
24700
|
+
* it will be wrapped in LViewData. It could even have all three, so we keep looping
|
|
24701
|
+
* until we find something that isn't an array.
|
|
24702
|
+
*
|
|
24703
|
+
* @param value The initial value in `LViewData`
|
|
24704
|
+
*/
|
|
24705
|
+
function readElementValue(value) {
|
|
24706
|
+
while (Array.isArray(value)) {
|
|
24707
|
+
value = value[HOST];
|
|
24708
|
+
}
|
|
24709
|
+
return value;
|
|
24710
|
+
}
|
|
24711
|
+
function getNativeByTNode(tNode, hostView) {
|
|
24712
|
+
return readElementValue(hostView[tNode.index]);
|
|
24713
|
+
}
|
|
24714
|
+
function getTNode(index, view) {
|
|
24715
|
+
return view[TVIEW].data[index + HEADER_OFFSET];
|
|
24716
|
+
}
|
|
24717
|
+
function getComponentViewByIndex(nodeIndex, hostView) {
|
|
24718
|
+
// Could be an LViewData or an LContainer. If LContainer, unwrap to find LViewData.
|
|
24719
|
+
var slotValue = hostView[nodeIndex];
|
|
24720
|
+
return slotValue.length >= HEADER_OFFSET ? slotValue : slotValue[HOST];
|
|
24721
|
+
}
|
|
24722
|
+
function isContentQueryHost(tNode) {
|
|
24723
|
+
return (tNode.flags & 16384 /* hasContentQuery */) !== 0;
|
|
24724
|
+
}
|
|
24725
|
+
function isLContainer(value) {
|
|
24726
|
+
// Styling contexts are also arrays, but their first index contains an element node
|
|
24727
|
+
return Array.isArray(value) && typeof value[ACTIVE_INDEX] === 'number';
|
|
24728
|
+
}
|
|
24729
|
+
/**
|
|
24730
|
+
* Returns the monkey-patch value data present on the target (which could be
|
|
24731
|
+
* a component, directive or a DOM node).
|
|
24732
|
+
*/
|
|
24733
|
+
function readPatchedData(target) {
|
|
24734
|
+
return target[MONKEY_PATCH_KEY_NAME];
|
|
24735
|
+
}
|
|
24736
|
+
function readPatchedLViewData(target) {
|
|
24737
|
+
var value = readPatchedData(target);
|
|
24738
|
+
if (value) {
|
|
24739
|
+
return Array.isArray(value) ? value : value.lViewData;
|
|
24740
|
+
}
|
|
24741
|
+
return null;
|
|
24742
|
+
}
|
|
24743
|
+
|
|
24744
|
+
/**
|
|
24745
|
+
* @license
|
|
24746
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
24747
|
+
*
|
|
24748
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
24749
|
+
* found in the LICENSE file at https://angular.io/license
|
|
24750
|
+
*/
|
|
24751
|
+
/** Returns the matching `LContext` data for a given DOM node, directive or component instance.
|
|
24752
|
+
*
|
|
24753
|
+
* This function will examine the provided DOM element, component, or directive instance\'s
|
|
24754
|
+
* monkey-patched property to derive the `LContext` data. Once called then the monkey-patched
|
|
24755
|
+
* value will be that of the newly created `LContext`.
|
|
24756
|
+
*
|
|
24757
|
+
* If the monkey-patched value is the `LViewData` instance then the context value for that
|
|
24758
|
+
* target will be created and the monkey-patch reference will be updated. Therefore when this
|
|
24759
|
+
* function is called it may mutate the provided element\'s, component\'s or any of the associated
|
|
24760
|
+
* directive\'s monkey-patch values.
|
|
24761
|
+
*
|
|
24762
|
+
* If the monkey-patch value is not detected then the code will walk up the DOM until an element
|
|
24763
|
+
* is found which contains a monkey-patch reference. When that occurs then the provided element
|
|
24764
|
+
* will be updated with a new context (which is then returned). If the monkey-patch value is not
|
|
24765
|
+
* detected for a component/directive instance then it will throw an error (all components and
|
|
24766
|
+
* directives should be automatically monkey-patched by ivy).
|
|
24767
|
+
*/
|
|
24768
|
+
function getContext(target) {
|
|
24769
|
+
var mpValue = readPatchedData(target);
|
|
24770
|
+
if (mpValue) {
|
|
24771
|
+
// only when it's an array is it considered an LViewData instance
|
|
24772
|
+
// ... otherwise it's an already constructed LContext instance
|
|
24773
|
+
if (Array.isArray(mpValue)) {
|
|
24774
|
+
var lViewData = mpValue;
|
|
24775
|
+
var nodeIndex = void 0;
|
|
24776
|
+
var component = undefined;
|
|
24777
|
+
var directives = undefined;
|
|
24778
|
+
if (isComponentInstance(target)) {
|
|
24779
|
+
nodeIndex = findViaComponent(lViewData, target);
|
|
24780
|
+
if (nodeIndex == -1) {
|
|
24781
|
+
throw new Error('The provided component was not found in the application');
|
|
24782
|
+
}
|
|
24783
|
+
component = target;
|
|
24784
|
+
}
|
|
24785
|
+
else if (isDirectiveInstance(target)) {
|
|
24786
|
+
nodeIndex = findViaDirective(lViewData, target);
|
|
24787
|
+
if (nodeIndex == -1) {
|
|
24788
|
+
throw new Error('The provided directive was not found in the application');
|
|
24789
|
+
}
|
|
24790
|
+
directives = discoverDirectives(nodeIndex, lViewData, false);
|
|
24791
|
+
}
|
|
24792
|
+
else {
|
|
24793
|
+
nodeIndex = findViaNativeElement(lViewData, target);
|
|
24794
|
+
if (nodeIndex == -1) {
|
|
24795
|
+
return null;
|
|
24796
|
+
}
|
|
24797
|
+
}
|
|
24798
|
+
// the goal is not to fill the entire context full of data because the lookups
|
|
24799
|
+
// are expensive. Instead, only the target data (the element, compontent or
|
|
24800
|
+
// directive details) are filled into the context. If called multiple times
|
|
24801
|
+
// with different target values then the missing target data will be filled in.
|
|
24802
|
+
var native = readElementValue(lViewData[nodeIndex]);
|
|
24803
|
+
var existingCtx = readPatchedData(native);
|
|
24804
|
+
var context = (existingCtx && !Array.isArray(existingCtx)) ?
|
|
24805
|
+
existingCtx :
|
|
24806
|
+
createLContext(lViewData, nodeIndex, native);
|
|
24807
|
+
// only when the component has been discovered then update the monkey-patch
|
|
24808
|
+
if (component && context.component === undefined) {
|
|
24809
|
+
context.component = component;
|
|
24810
|
+
attachPatchData(context.component, context);
|
|
24811
|
+
}
|
|
24812
|
+
// only when the directives have been discovered then update the monkey-patch
|
|
24813
|
+
if (directives && context.directives === undefined) {
|
|
24814
|
+
context.directives = directives;
|
|
24815
|
+
for (var i = 0; i < directives.length; i++) {
|
|
24816
|
+
attachPatchData(directives[i], context);
|
|
24817
|
+
}
|
|
24818
|
+
}
|
|
24819
|
+
attachPatchData(context.native, context);
|
|
24820
|
+
mpValue = context;
|
|
24821
|
+
}
|
|
24822
|
+
}
|
|
24823
|
+
else {
|
|
24824
|
+
var rElement = target;
|
|
24825
|
+
ngDevMode && assertDomElement(rElement);
|
|
24826
|
+
// if the context is not found then we need to traverse upwards up the DOM
|
|
24827
|
+
// to find the nearest element that has already been monkey patched with data
|
|
24828
|
+
var parent_1 = rElement;
|
|
24829
|
+
while (parent_1 = parent_1.parentNode) {
|
|
24830
|
+
var parentContext = readPatchedData(parent_1);
|
|
24831
|
+
if (parentContext) {
|
|
24832
|
+
var lViewData = void 0;
|
|
24833
|
+
if (Array.isArray(parentContext)) {
|
|
24834
|
+
lViewData = parentContext;
|
|
24835
|
+
}
|
|
24836
|
+
else {
|
|
24837
|
+
lViewData = parentContext.lViewData;
|
|
24838
|
+
}
|
|
24839
|
+
// the edge of the app was also reached here through another means
|
|
24840
|
+
// (maybe because the DOM was changed manually).
|
|
24841
|
+
if (!lViewData) {
|
|
24842
|
+
return null;
|
|
24843
|
+
}
|
|
24844
|
+
var index = findViaNativeElement(lViewData, rElement);
|
|
24845
|
+
if (index >= 0) {
|
|
24846
|
+
var native = readElementValue(lViewData[index]);
|
|
24847
|
+
var context = createLContext(lViewData, index, native);
|
|
24848
|
+
attachPatchData(native, context);
|
|
24849
|
+
mpValue = context;
|
|
24850
|
+
break;
|
|
24851
|
+
}
|
|
24852
|
+
}
|
|
24853
|
+
}
|
|
24854
|
+
}
|
|
24855
|
+
return mpValue || null;
|
|
24856
|
+
}
|
|
24517
24857
|
/**
|
|
24518
24858
|
* Creates an empty instance of a `LContext` context
|
|
24519
24859
|
*/
|
|
24520
|
-
function createLContext(lViewData,
|
|
24860
|
+
function createLContext(lViewData, nodeIndex, native) {
|
|
24521
24861
|
return {
|
|
24522
24862
|
lViewData: lViewData,
|
|
24523
|
-
nodeIndex:
|
|
24863
|
+
nodeIndex: nodeIndex, native: native,
|
|
24524
24864
|
component: undefined,
|
|
24525
24865
|
directives: undefined,
|
|
24526
24866
|
localRefs: undefined,
|
|
24527
24867
|
};
|
|
24528
24868
|
}
|
|
24529
24869
|
/**
|
|
24530
|
-
*
|
|
24870
|
+
* Takes a component instance and returns the view for that component.
|
|
24531
24871
|
*
|
|
24532
|
-
*
|
|
24533
|
-
*
|
|
24534
|
-
* any programmatic access to an element's context (only change detection uses this function).
|
|
24872
|
+
* @param componentInstance
|
|
24873
|
+
* @returns The component's view
|
|
24535
24874
|
*/
|
|
24536
|
-
function
|
|
24875
|
+
function getComponentViewByInstance(componentInstance) {
|
|
24537
24876
|
var lViewData = readPatchedData(componentInstance);
|
|
24538
|
-
var
|
|
24877
|
+
var view;
|
|
24539
24878
|
if (Array.isArray(lViewData)) {
|
|
24540
|
-
var
|
|
24541
|
-
|
|
24542
|
-
var context = createLContext(lViewData,
|
|
24879
|
+
var nodeIndex = findViaComponent(lViewData, componentInstance);
|
|
24880
|
+
view = getComponentViewByIndex(nodeIndex, lViewData);
|
|
24881
|
+
var context = createLContext(lViewData, nodeIndex, view[HOST]);
|
|
24543
24882
|
context.component = componentInstance;
|
|
24544
24883
|
attachPatchData(componentInstance, context);
|
|
24545
24884
|
attachPatchData(context.native, context);
|
|
24546
24885
|
}
|
|
24547
24886
|
else {
|
|
24548
24887
|
var context = lViewData;
|
|
24549
|
-
|
|
24888
|
+
view = getComponentViewByIndex(context.nodeIndex, context.lViewData);
|
|
24550
24889
|
}
|
|
24551
|
-
return
|
|
24890
|
+
return view;
|
|
24552
24891
|
}
|
|
24553
24892
|
/**
|
|
24554
24893
|
* Assigns the given data to the given target (which could be a component,
|
|
@@ -24557,17 +24896,38 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24557
24896
|
function attachPatchData(target, data) {
|
|
24558
24897
|
target[MONKEY_PATCH_KEY_NAME] = data;
|
|
24559
24898
|
}
|
|
24899
|
+
function isComponentInstance(instance) {
|
|
24900
|
+
return instance && instance.constructor && instance.constructor.ngComponentDef;
|
|
24901
|
+
}
|
|
24902
|
+
function isDirectiveInstance(instance) {
|
|
24903
|
+
return instance && instance.constructor && instance.constructor.ngDirectiveDef;
|
|
24904
|
+
}
|
|
24560
24905
|
/**
|
|
24561
|
-
*
|
|
24562
|
-
* a component, directive or a DOM node).
|
|
24906
|
+
* Locates the element within the given LViewData and returns the matching index
|
|
24563
24907
|
*/
|
|
24564
|
-
function
|
|
24565
|
-
|
|
24908
|
+
function findViaNativeElement(lViewData, target) {
|
|
24909
|
+
var tNode = lViewData[TVIEW].firstChild;
|
|
24910
|
+
while (tNode) {
|
|
24911
|
+
var native = getNativeByTNode(tNode, lViewData);
|
|
24912
|
+
if (native === target) {
|
|
24913
|
+
return tNode.index;
|
|
24914
|
+
}
|
|
24915
|
+
tNode = traverseNextElement(tNode);
|
|
24916
|
+
}
|
|
24917
|
+
return -1;
|
|
24566
24918
|
}
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24919
|
+
/**
|
|
24920
|
+
* Locates the next tNode (child, sibling or parent).
|
|
24921
|
+
*/
|
|
24922
|
+
function traverseNextElement(tNode) {
|
|
24923
|
+
if (tNode.child) {
|
|
24924
|
+
return tNode.child;
|
|
24925
|
+
}
|
|
24926
|
+
else if (tNode.next) {
|
|
24927
|
+
return tNode.next;
|
|
24928
|
+
}
|
|
24929
|
+
else if (tNode.parent) {
|
|
24930
|
+
return tNode.parent.next || null;
|
|
24571
24931
|
}
|
|
24572
24932
|
return null;
|
|
24573
24933
|
}
|
|
@@ -24579,15 +24939,15 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24579
24939
|
if (componentIndices) {
|
|
24580
24940
|
for (var i = 0; i < componentIndices.length; i++) {
|
|
24581
24941
|
var elementComponentIndex = componentIndices[i];
|
|
24582
|
-
var
|
|
24583
|
-
if (
|
|
24942
|
+
var componentView = getComponentViewByIndex(elementComponentIndex, lViewData);
|
|
24943
|
+
if (componentView[CONTEXT] === componentInstance) {
|
|
24584
24944
|
return elementComponentIndex;
|
|
24585
24945
|
}
|
|
24586
24946
|
}
|
|
24587
24947
|
}
|
|
24588
24948
|
else {
|
|
24589
|
-
var
|
|
24590
|
-
var rootComponent =
|
|
24949
|
+
var rootComponentView = getComponentViewByIndex(HEADER_OFFSET, lViewData);
|
|
24950
|
+
var rootComponent = rootComponentView[CONTEXT];
|
|
24591
24951
|
if (rootComponent === componentInstance) {
|
|
24592
24952
|
// we are dealing with the root element here therefore we know that the
|
|
24593
24953
|
// element is the very first element after the HEADER data in the lView
|
|
@@ -24596,8 +24956,77 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24596
24956
|
}
|
|
24597
24957
|
return -1;
|
|
24598
24958
|
}
|
|
24599
|
-
|
|
24600
|
-
|
|
24959
|
+
/**
|
|
24960
|
+
* Locates the directive within the given LViewData and returns the matching index
|
|
24961
|
+
*/
|
|
24962
|
+
function findViaDirective(lViewData, directiveInstance) {
|
|
24963
|
+
// if a directive is monkey patched then it will (by default)
|
|
24964
|
+
// have a reference to the LViewData of the current view. The
|
|
24965
|
+
// element bound to the directive being search lives somewhere
|
|
24966
|
+
// in the view data. We loop through the nodes and check their
|
|
24967
|
+
// list of directives for the instance.
|
|
24968
|
+
var tNode = lViewData[TVIEW].firstChild;
|
|
24969
|
+
while (tNode) {
|
|
24970
|
+
var directiveIndexStart = getDirectiveStartIndex(tNode);
|
|
24971
|
+
var directiveIndexEnd = getDirectiveEndIndex(tNode, directiveIndexStart);
|
|
24972
|
+
for (var i = directiveIndexStart; i < directiveIndexEnd; i++) {
|
|
24973
|
+
if (lViewData[i] === directiveInstance) {
|
|
24974
|
+
return tNode.index;
|
|
24975
|
+
}
|
|
24976
|
+
}
|
|
24977
|
+
tNode = traverseNextElement(tNode);
|
|
24978
|
+
}
|
|
24979
|
+
return -1;
|
|
24980
|
+
}
|
|
24981
|
+
function assertDomElement(element) {
|
|
24982
|
+
assertEqual(element.nodeType, 1, 'The provided value must be an instance of an HTMLElement');
|
|
24983
|
+
}
|
|
24984
|
+
/**
|
|
24985
|
+
* Returns a list of directives extracted from the given view based on the
|
|
24986
|
+
* provided list of directive index values.
|
|
24987
|
+
*
|
|
24988
|
+
* @param nodeIndex The node index
|
|
24989
|
+
* @param lViewData The target view data
|
|
24990
|
+
* @param includeComponents Whether or not to include components in returned directives
|
|
24991
|
+
*/
|
|
24992
|
+
function discoverDirectives(nodeIndex, lViewData, includeComponents) {
|
|
24993
|
+
var tNode = lViewData[TVIEW].data[nodeIndex];
|
|
24994
|
+
var directiveStartIndex = getDirectiveStartIndex(tNode);
|
|
24995
|
+
var directiveEndIndex = getDirectiveEndIndex(tNode, directiveStartIndex);
|
|
24996
|
+
if (!includeComponents && tNode.flags & 4096 /* isComponent */)
|
|
24997
|
+
directiveStartIndex++;
|
|
24998
|
+
return lViewData.slice(directiveStartIndex, directiveEndIndex);
|
|
24999
|
+
}
|
|
25000
|
+
/**
|
|
25001
|
+
* Returns a map of local references (local reference name => element or directive instance) that
|
|
25002
|
+
* exist on a given element.
|
|
25003
|
+
*/
|
|
25004
|
+
function discoverLocalRefs(lViewData, nodeIndex) {
|
|
25005
|
+
var tNode = lViewData[TVIEW].data[nodeIndex];
|
|
25006
|
+
if (tNode && tNode.localNames) {
|
|
25007
|
+
var result = {};
|
|
25008
|
+
for (var i = 0; i < tNode.localNames.length; i += 2) {
|
|
25009
|
+
var localRefName = tNode.localNames[i];
|
|
25010
|
+
var directiveIndex = tNode.localNames[i + 1];
|
|
25011
|
+
result[localRefName] =
|
|
25012
|
+
directiveIndex === -1 ? getNativeByTNode(tNode, lViewData) : lViewData[directiveIndex];
|
|
25013
|
+
}
|
|
25014
|
+
return result;
|
|
25015
|
+
}
|
|
25016
|
+
return null;
|
|
25017
|
+
}
|
|
25018
|
+
function getDirectiveStartIndex(tNode) {
|
|
25019
|
+
// the tNode instances store a flag value which then has a
|
|
25020
|
+
// pointer which tells the starting index of where all the
|
|
25021
|
+
// active directives are in the master directive array
|
|
25022
|
+
return tNode.flags >> 15 /* DirectiveStartingIndexShift */;
|
|
25023
|
+
}
|
|
25024
|
+
function getDirectiveEndIndex(tNode, startIndex) {
|
|
25025
|
+
// The end value is also a part of the same flag
|
|
25026
|
+
// (see `TNodeFlags` to see how the flag bit shifting
|
|
25027
|
+
// values are used).
|
|
25028
|
+
var count = tNode.flags & 4095 /* DirectiveCountMask */;
|
|
25029
|
+
return count ? (startIndex + count) : -1;
|
|
24601
25030
|
}
|
|
24602
25031
|
|
|
24603
25032
|
/**
|
|
@@ -24716,24 +25145,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24716
25145
|
throw new Error("Cannot instantiate cyclic dependency! " + token);
|
|
24717
25146
|
}
|
|
24718
25147
|
|
|
24719
|
-
/**
|
|
24720
|
-
* @license
|
|
24721
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
24722
|
-
*
|
|
24723
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
24724
|
-
* found in the LICENSE file at https://angular.io/license
|
|
24725
|
-
*/
|
|
24726
|
-
/**
|
|
24727
|
-
* Below are constants for LContainer indices to help us look up LContainer members
|
|
24728
|
-
* without having to remember the specific indices.
|
|
24729
|
-
* Uglify will inline these when minifying so there shouldn't be a cost.
|
|
24730
|
-
*/
|
|
24731
|
-
var ACTIVE_INDEX = 0;
|
|
24732
|
-
// PARENT, NEXT, and QUERIES are indices 1, 2, and 3.
|
|
24733
|
-
// As we already have these constants in LViewData, we don't need to re-create them.
|
|
24734
|
-
var VIEWS = 4;
|
|
24735
|
-
var RENDER_PARENT = 5;
|
|
24736
|
-
|
|
24737
25148
|
/**
|
|
24738
25149
|
* @license
|
|
24739
25150
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -24815,196 +25226,16 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
24815
25226
|
* Use of this source code is governed by an MIT-style license that can be
|
|
24816
25227
|
* found in the LICENSE file at https://angular.io/license
|
|
24817
25228
|
*/
|
|
24818
|
-
function
|
|
24819
|
-
var isListLikeIterableA = isListLikeIterable(a);
|
|
24820
|
-
var isListLikeIterableB = isListLikeIterable(b);
|
|
24821
|
-
if (isListLikeIterableA && isListLikeIterableB) {
|
|
24822
|
-
return areIterablesEqual(a, b, devModeEqual);
|
|
24823
|
-
}
|
|
24824
|
-
else {
|
|
24825
|
-
var isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
|
24826
|
-
var isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
|
24827
|
-
if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
|
24828
|
-
return true;
|
|
24829
|
-
}
|
|
24830
|
-
else {
|
|
24831
|
-
return looseIdentical(a, b);
|
|
24832
|
-
}
|
|
24833
|
-
}
|
|
24834
|
-
}
|
|
24835
|
-
/**
|
|
24836
|
-
* Indicates that the result of a {@link Pipe} transformation has changed even though the
|
|
24837
|
-
* reference has not changed.
|
|
24838
|
-
*
|
|
24839
|
-
* Wrapped values are unwrapped automatically during the change detection, and the unwrapped value
|
|
24840
|
-
* is stored.
|
|
24841
|
-
*
|
|
24842
|
-
* Example:
|
|
24843
|
-
*
|
|
24844
|
-
* ```
|
|
24845
|
-
* if (this._latestValue === this._latestReturnedValue) {
|
|
24846
|
-
* return this._latestReturnedValue;
|
|
24847
|
-
* } else {
|
|
24848
|
-
* this._latestReturnedValue = this._latestValue;
|
|
24849
|
-
* return WrappedValue.wrap(this._latestValue); // this will force update
|
|
24850
|
-
* }
|
|
24851
|
-
* ```
|
|
24852
|
-
*
|
|
24853
|
-
*/
|
|
24854
|
-
var WrappedValue = /** @class */ (function () {
|
|
24855
|
-
function WrappedValue(value) {
|
|
24856
|
-
this.wrapped = value;
|
|
24857
|
-
}
|
|
24858
|
-
/** Creates a wrapped value. */
|
|
24859
|
-
WrappedValue.wrap = function (value) { return new WrappedValue(value); };
|
|
24860
|
-
/**
|
|
24861
|
-
* Returns the underlying value of a wrapped value.
|
|
24862
|
-
* Returns the given `value` when it is not wrapped.
|
|
24863
|
-
**/
|
|
24864
|
-
WrappedValue.unwrap = function (value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; };
|
|
24865
|
-
/** Returns true if `value` is a wrapped value. */
|
|
24866
|
-
WrappedValue.isWrapped = function (value) { return value instanceof WrappedValue; };
|
|
24867
|
-
return WrappedValue;
|
|
24868
|
-
}());
|
|
24869
|
-
/**
|
|
24870
|
-
* Represents a basic change from a previous to a new value.
|
|
24871
|
-
*
|
|
24872
|
-
*/
|
|
24873
|
-
var SimpleChange = /** @class */ (function () {
|
|
24874
|
-
function SimpleChange(previousValue, currentValue, firstChange) {
|
|
24875
|
-
this.previousValue = previousValue;
|
|
24876
|
-
this.currentValue = currentValue;
|
|
24877
|
-
this.firstChange = firstChange;
|
|
24878
|
-
}
|
|
24879
|
-
/**
|
|
24880
|
-
* Check whether the new value is the first value assigned.
|
|
24881
|
-
*/
|
|
24882
|
-
SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
|
|
24883
|
-
return SimpleChange;
|
|
24884
|
-
}());
|
|
24885
|
-
function isListLikeIterable(obj) {
|
|
24886
|
-
if (!isJsObject(obj))
|
|
24887
|
-
return false;
|
|
24888
|
-
return Array.isArray(obj) ||
|
|
24889
|
-
(!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
|
|
24890
|
-
getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
|
|
24891
|
-
}
|
|
24892
|
-
function areIterablesEqual(a, b, comparator) {
|
|
24893
|
-
var iterator1 = a[getSymbolIterator()]();
|
|
24894
|
-
var iterator2 = b[getSymbolIterator()]();
|
|
24895
|
-
while (true) {
|
|
24896
|
-
var item1 = iterator1.next();
|
|
24897
|
-
var item2 = iterator2.next();
|
|
24898
|
-
if (item1.done && item2.done)
|
|
24899
|
-
return true;
|
|
24900
|
-
if (item1.done || item2.done)
|
|
24901
|
-
return false;
|
|
24902
|
-
if (!comparator(item1.value, item2.value))
|
|
24903
|
-
return false;
|
|
24904
|
-
}
|
|
24905
|
-
}
|
|
24906
|
-
function iterateListLike(obj, fn) {
|
|
24907
|
-
if (Array.isArray(obj)) {
|
|
24908
|
-
for (var i = 0; i < obj.length; i++) {
|
|
24909
|
-
fn(obj[i]);
|
|
24910
|
-
}
|
|
24911
|
-
}
|
|
24912
|
-
else {
|
|
24913
|
-
var iterator = obj[getSymbolIterator()]();
|
|
24914
|
-
var item = void 0;
|
|
24915
|
-
while (!((item = iterator.next()).done)) {
|
|
24916
|
-
fn(item.value);
|
|
24917
|
-
}
|
|
24918
|
-
}
|
|
24919
|
-
}
|
|
24920
|
-
function isJsObject(o) {
|
|
24921
|
-
return o !== null && (typeof o === 'function' || typeof o === 'object');
|
|
24922
|
-
}
|
|
24923
|
-
|
|
24924
|
-
/**
|
|
24925
|
-
* @license
|
|
24926
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
24927
|
-
*
|
|
24928
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
24929
|
-
* found in the LICENSE file at https://angular.io/license
|
|
24930
|
-
*/
|
|
24931
|
-
function stringify$2(value) {
|
|
24932
|
-
if (typeof value == 'function')
|
|
24933
|
-
return value.name || value;
|
|
24934
|
-
if (typeof value == 'string')
|
|
24935
|
-
return value;
|
|
24936
|
-
if (value == null)
|
|
24937
|
-
return '';
|
|
24938
|
-
return '' + value;
|
|
24939
|
-
}
|
|
24940
|
-
/**
|
|
24941
|
-
* Flattens an array in non-recursive way. Input arrays are not modified.
|
|
24942
|
-
*/
|
|
24943
|
-
function flatten$2(list) {
|
|
24944
|
-
var result = [];
|
|
24945
|
-
var i = 0;
|
|
24946
|
-
while (i < list.length) {
|
|
24947
|
-
var item = list[i];
|
|
24948
|
-
if (Array.isArray(item)) {
|
|
24949
|
-
if (item.length > 0) {
|
|
24950
|
-
list = item.concat(list.slice(i + 1));
|
|
24951
|
-
i = 0;
|
|
24952
|
-
}
|
|
24953
|
-
else {
|
|
24954
|
-
i++;
|
|
24955
|
-
}
|
|
24956
|
-
}
|
|
24957
|
-
else {
|
|
24958
|
-
result.push(item);
|
|
24959
|
-
i++;
|
|
24960
|
-
}
|
|
24961
|
-
}
|
|
24962
|
-
return result;
|
|
24963
|
-
}
|
|
24964
|
-
function assertDataInRangeInternal(index, arr) {
|
|
24965
|
-
assertLessThan(index, arr ? arr.length : 0, 'index expected to be a valid data index');
|
|
24966
|
-
}
|
|
24967
|
-
function getLNode(tNode, hostView) {
|
|
24968
|
-
return readElementValue(hostView[tNode.index]);
|
|
24969
|
-
}
|
|
24970
|
-
function isContentQueryHost(tNode) {
|
|
24971
|
-
return (tNode.flags & 16384 /* hasContentQuery */) !== 0;
|
|
24972
|
-
}
|
|
24973
|
-
|
|
24974
|
-
/**
|
|
24975
|
-
* @license
|
|
24976
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
24977
|
-
*
|
|
24978
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
24979
|
-
* found in the LICENSE file at https://angular.io/license
|
|
24980
|
-
*/
|
|
24981
|
-
/** Retrieves the parent LNode of a given node. */
|
|
24982
|
-
function getParentLNode(tNode, currentView) {
|
|
24983
|
-
return tNode.parent == null ? getHostElementNode(currentView) :
|
|
24984
|
-
getLNode(tNode.parent, currentView);
|
|
24985
|
-
}
|
|
24986
|
-
/**
|
|
24987
|
-
* Gets the host LElementNode given a view. Will return null if the host element is an
|
|
24988
|
-
* LViewNode, since they are being phased out.
|
|
24989
|
-
*/
|
|
24990
|
-
function getHostElementNode(currentView) {
|
|
24991
|
-
var hostTNode = currentView[HOST_NODE];
|
|
24992
|
-
return hostTNode && hostTNode.type !== 2 /* View */ ?
|
|
24993
|
-
getLNode(hostTNode, currentView[PARENT]) :
|
|
24994
|
-
null;
|
|
24995
|
-
}
|
|
24996
|
-
function getContainerNode(tNode, embeddedView) {
|
|
25229
|
+
function getLContainer(tNode, embeddedView) {
|
|
24997
25230
|
if (tNode.index === -1) {
|
|
24998
25231
|
// This is a dynamically created view inside a dynamic container.
|
|
24999
25232
|
// If the host index is -1, the view has not yet been inserted, so it has no parent.
|
|
25000
25233
|
var containerHostIndex = embeddedView[CONTAINER_INDEX];
|
|
25001
|
-
return containerHostIndex > -1 ?
|
|
25002
|
-
embeddedView[PARENT][containerHostIndex].dynamicLContainerNode :
|
|
25003
|
-
null;
|
|
25234
|
+
return containerHostIndex > -1 ? embeddedView[PARENT][containerHostIndex] : null;
|
|
25004
25235
|
}
|
|
25005
25236
|
else {
|
|
25006
25237
|
// This is a inline view node (e.g. embeddedViewStart)
|
|
25007
|
-
return
|
|
25238
|
+
return embeddedView[PARENT][tNode.parent.index];
|
|
25008
25239
|
}
|
|
25009
25240
|
}
|
|
25010
25241
|
/**
|
|
@@ -25020,45 +25251,39 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25020
25251
|
* one found, or on all of them.
|
|
25021
25252
|
*
|
|
25022
25253
|
* @param viewToWalk the view to walk
|
|
25023
|
-
* @param action identifies the action to be performed on the
|
|
25254
|
+
* @param action identifies the action to be performed on the elements
|
|
25024
25255
|
* @param renderer the current renderer.
|
|
25025
|
-
* @param
|
|
25256
|
+
* @param renderParent Optional the render parent node to be set in all LContainers found,
|
|
25026
25257
|
* required for action modes Insert and Destroy.
|
|
25027
25258
|
* @param beforeNode Optional the node before which elements should be added, required for action
|
|
25028
25259
|
* Insert.
|
|
25029
25260
|
*/
|
|
25030
|
-
function walkTNodeTree(viewToWalk, action, renderer,
|
|
25261
|
+
function walkTNodeTree(viewToWalk, action, renderer, renderParent, beforeNode) {
|
|
25031
25262
|
var rootTNode = viewToWalk[TVIEW].node;
|
|
25032
25263
|
var projectionNodeIndex = -1;
|
|
25033
25264
|
var currentView = viewToWalk;
|
|
25034
25265
|
var tNode = rootTNode.child;
|
|
25035
25266
|
while (tNode) {
|
|
25036
25267
|
var nextTNode = null;
|
|
25037
|
-
var parent_1 = renderParentNode ? renderParentNode.native : null;
|
|
25038
25268
|
if (tNode.type === 3 /* Element */) {
|
|
25039
|
-
|
|
25040
|
-
|
|
25041
|
-
if (
|
|
25042
|
-
|
|
25269
|
+
executeNodeAction(action, renderer, renderParent, getNativeByTNode(tNode, currentView), beforeNode);
|
|
25270
|
+
var nodeOrContainer = currentView[tNode.index];
|
|
25271
|
+
if (isLContainer(nodeOrContainer)) {
|
|
25272
|
+
// This element has an LContainer, and its comment needs to be handled
|
|
25273
|
+
executeNodeAction(action, renderer, renderParent, nodeOrContainer[NATIVE], beforeNode);
|
|
25043
25274
|
}
|
|
25044
25275
|
}
|
|
25045
25276
|
else if (tNode.type === 0 /* Container */) {
|
|
25046
|
-
var
|
|
25047
|
-
executeNodeAction(action, renderer,
|
|
25048
|
-
|
|
25049
|
-
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
childContainerData[RENDER_PARENT] = renderParentNode;
|
|
25053
|
-
}
|
|
25054
|
-
if (childContainerData[VIEWS].length) {
|
|
25055
|
-
currentView = childContainerData[VIEWS][0];
|
|
25277
|
+
var lContainer = currentView[tNode.index];
|
|
25278
|
+
executeNodeAction(action, renderer, renderParent, lContainer[NATIVE], beforeNode);
|
|
25279
|
+
if (renderParent)
|
|
25280
|
+
lContainer[RENDER_PARENT] = renderParent;
|
|
25281
|
+
if (lContainer[VIEWS].length) {
|
|
25282
|
+
currentView = lContainer[VIEWS][0];
|
|
25056
25283
|
nextTNode = currentView[TVIEW].node;
|
|
25057
25284
|
// When the walker enters a container, then the beforeNode has to become the local native
|
|
25058
25285
|
// comment node.
|
|
25059
|
-
beforeNode =
|
|
25060
|
-
lContainerNode.dynamicLContainerNode.native :
|
|
25061
|
-
lContainerNode.native;
|
|
25286
|
+
beforeNode = lContainer[NATIVE];
|
|
25062
25287
|
}
|
|
25063
25288
|
}
|
|
25064
25289
|
else if (tNode.type === 1 /* Projection */) {
|
|
@@ -25086,7 +25311,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25086
25311
|
}
|
|
25087
25312
|
nextTNode = tNode.next;
|
|
25088
25313
|
/**
|
|
25089
|
-
* Find the next node in the
|
|
25314
|
+
* Find the next node in the TNode tree, taking into account the place where a node is
|
|
25090
25315
|
* projected (in the shadow DOM) rather than where it comes from (in the light DOM).
|
|
25091
25316
|
*
|
|
25092
25317
|
* If there is no sibling node, then it goes to the next sibling of the parent node...
|
|
@@ -25100,7 +25325,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25100
25325
|
// When exiting a container, the beforeNode must be restored to the previous value
|
|
25101
25326
|
if (tNode.type === 0 /* Container */) {
|
|
25102
25327
|
currentView = currentView[PARENT];
|
|
25103
|
-
beforeNode = currentView[tNode.index]
|
|
25328
|
+
beforeNode = currentView[tNode.index][NATIVE];
|
|
25104
25329
|
}
|
|
25105
25330
|
if (tNode.type === 2 /* View */ && currentView[NEXT]) {
|
|
25106
25331
|
currentView = currentView[NEXT];
|
|
@@ -25238,10 +25463,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25238
25463
|
}
|
|
25239
25464
|
/** Gets the child of the given LViewData */
|
|
25240
25465
|
function getLViewChild(viewData) {
|
|
25241
|
-
|
|
25242
|
-
|
|
25243
|
-
var hostNode = viewData[viewData[TVIEW].childIndex];
|
|
25244
|
-
return hostNode.data ? hostNode.data : hostNode.dynamicLContainerNode.data;
|
|
25466
|
+
var childIndex = viewData[TVIEW].childIndex;
|
|
25467
|
+
return childIndex === -1 ? null : viewData[childIndex];
|
|
25245
25468
|
}
|
|
25246
25469
|
/**
|
|
25247
25470
|
* A standalone function which destroys an LView,
|
|
@@ -25252,7 +25475,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25252
25475
|
function destroyLView(view) {
|
|
25253
25476
|
var renderer = view[RENDERER];
|
|
25254
25477
|
if (isProceduralRenderer(renderer) && renderer.destroyNode) {
|
|
25255
|
-
walkTNodeTree(view, 2 /* Destroy */, renderer);
|
|
25478
|
+
walkTNodeTree(view, 2 /* Destroy */, renderer, null);
|
|
25256
25479
|
}
|
|
25257
25480
|
destroyViewTree(view);
|
|
25258
25481
|
// Sets the destroyed flag
|
|
@@ -25276,7 +25499,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25276
25499
|
tNode.type === 2 /* View */) {
|
|
25277
25500
|
// if it's an embedded view, the state needs to go up to the container, in case the
|
|
25278
25501
|
// container has a next
|
|
25279
|
-
return
|
|
25502
|
+
return getLContainer(tNode, state);
|
|
25280
25503
|
}
|
|
25281
25504
|
else {
|
|
25282
25505
|
// otherwise, use parent view for containers or component views
|
|
@@ -25289,7 +25512,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25289
25512
|
* @param view The LViewData to clean up
|
|
25290
25513
|
*/
|
|
25291
25514
|
function cleanUpView(viewOrContainer) {
|
|
25292
|
-
if (viewOrContainer
|
|
25515
|
+
if (viewOrContainer.length >= HEADER_OFFSET) {
|
|
25293
25516
|
var view = viewOrContainer;
|
|
25294
25517
|
removeListeners(view);
|
|
25295
25518
|
executeOnDestroys(view);
|
|
@@ -25308,7 +25531,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25308
25531
|
for (var i = 0; i < cleanup.length - 1; i += 2) {
|
|
25309
25532
|
if (typeof cleanup[i] === 'string') {
|
|
25310
25533
|
// This is a listener with the native renderer
|
|
25311
|
-
var native = readElementValue(viewData[cleanup[i + 1]])
|
|
25534
|
+
var native = readElementValue(viewData[cleanup[i + 1]]);
|
|
25312
25535
|
var listener = viewData[CLEANUP][cleanup[i + 2]];
|
|
25313
25536
|
native.removeEventListener(cleanup[i], listener, cleanup[i + 3]);
|
|
25314
25537
|
i += 2;
|
|
@@ -25359,6 +25582,14 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25359
25582
|
* found in the LICENSE file at https://angular.io/license
|
|
25360
25583
|
*/
|
|
25361
25584
|
|
|
25585
|
+
/**
|
|
25586
|
+
* @license
|
|
25587
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
25588
|
+
*
|
|
25589
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
25590
|
+
* found in the LICENSE file at https://angular.io/license
|
|
25591
|
+
*/
|
|
25592
|
+
|
|
25362
25593
|
/**
|
|
25363
25594
|
* @license
|
|
25364
25595
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -25470,8 +25701,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25470
25701
|
* context, this is the TView.expandoStartIndex + any dirs/hostVars before the given dir.
|
|
25471
25702
|
*/
|
|
25472
25703
|
var bindingRootIndex = -1;
|
|
25473
|
-
// Root component will always have an element index of 0 and an injector size of 1
|
|
25474
|
-
var ROOT_EXPANDO_INSTRUCTIONS = [0, 1];
|
|
25475
25704
|
/**
|
|
25476
25705
|
* Swap the current state with a new state.
|
|
25477
25706
|
*
|
|
@@ -25604,81 +25833,52 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25604
25833
|
}
|
|
25605
25834
|
function createLViewData(renderer, tView, context, flags, sanitizer) {
|
|
25606
25835
|
var instance = tView.blueprint.slice();
|
|
25607
|
-
instance[PARENT] = instance[DECLARATION_VIEW] = viewData;
|
|
25608
25836
|
instance[FLAGS] = flags | 1 /* CreationMode */ | 8 /* Attached */ | 16 /* RunInit */;
|
|
25837
|
+
instance[PARENT] = instance[DECLARATION_VIEW] = viewData;
|
|
25609
25838
|
instance[CONTEXT] = context;
|
|
25610
25839
|
instance[INJECTOR$1] = viewData ? viewData[INJECTOR$1] : null;
|
|
25611
25840
|
instance[RENDERER] = renderer;
|
|
25612
25841
|
instance[SANITIZER] = sanitizer || null;
|
|
25613
25842
|
return instance;
|
|
25614
25843
|
}
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
function createNodeAtIndex(index, type, native, name, attrs, state) {
|
|
25624
|
-
var parent = isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
|
|
25625
|
-
// Parents cannot cross component boundaries because components will be used in multiple places,
|
|
25626
|
-
// so it's only set if the view is the same.
|
|
25627
|
-
var parentInSameView = parent && viewData && parent !== viewData[HOST_NODE];
|
|
25628
|
-
var tParent = parentInSameView ? parent : null;
|
|
25629
|
-
var isState = state != null;
|
|
25630
|
-
var node = createLNodeObject(type, native, isState ? state : null);
|
|
25631
|
-
var tNode;
|
|
25632
|
-
if (index === -1 || type === 2 /* View */) {
|
|
25633
|
-
// View nodes are not stored in data because they can be added / removed at runtime (which
|
|
25634
|
-
// would cause indices to change). Their TNodes are instead stored in tView.node.
|
|
25635
|
-
tNode = (state ? state[TVIEW].node : null) ||
|
|
25636
|
-
createTNode(type, index, null, null, tParent, null);
|
|
25637
|
-
}
|
|
25638
|
-
else {
|
|
25639
|
-
var adjustedIndex = index + HEADER_OFFSET;
|
|
25640
|
-
// This is an element or container or projection node
|
|
25641
|
-
var tData = tView.data;
|
|
25642
|
-
ngDevMode && assertLessThan(adjustedIndex, viewData.length, "Slot should have been initialized with null");
|
|
25643
|
-
viewData[adjustedIndex] = node;
|
|
25644
|
-
if (tData[adjustedIndex] == null) {
|
|
25645
|
-
var tNode_1 = tData[adjustedIndex] =
|
|
25646
|
-
createTNode(type, adjustedIndex, name, attrs, tParent, null);
|
|
25647
|
-
if (!isParent && previousOrParentTNode) {
|
|
25648
|
-
previousOrParentTNode.next = tNode_1;
|
|
25649
|
-
if (previousOrParentTNode.dynamicContainerNode)
|
|
25650
|
-
previousOrParentTNode.dynamicContainerNode.next = tNode_1;
|
|
25651
|
-
}
|
|
25652
|
-
}
|
|
25653
|
-
tNode = tData[adjustedIndex];
|
|
25654
|
-
if (!tView.firstChild && type === 3 /* Element */) {
|
|
25655
|
-
tView.firstChild = tNode;
|
|
25656
|
-
}
|
|
25844
|
+
function createNodeAtIndex(index, type, native, name, attrs) {
|
|
25845
|
+
var adjustedIndex = index + HEADER_OFFSET;
|
|
25846
|
+
ngDevMode &&
|
|
25847
|
+
assertLessThan(adjustedIndex, viewData.length, "Slot should have been initialized with null");
|
|
25848
|
+
viewData[adjustedIndex] = native;
|
|
25849
|
+
var tNode = tView.data[adjustedIndex];
|
|
25850
|
+
if (tNode == null) {
|
|
25851
|
+
tNode = tView.data[adjustedIndex] = createTNode(type, adjustedIndex, name, attrs, null);
|
|
25657
25852
|
// Now link ourselves into the tree.
|
|
25658
|
-
if (
|
|
25659
|
-
if (previousOrParentTNode.child == null &&
|
|
25660
|
-
previousOrParentTNode.type === 2 /* View */) {
|
|
25661
|
-
// We are in the same view, which means we are adding content node to the parent
|
|
25853
|
+
if (previousOrParentTNode) {
|
|
25854
|
+
if (isParent && previousOrParentTNode.child == null &&
|
|
25855
|
+
(tNode.parent !== null || previousOrParentTNode.type === 2 /* View */)) {
|
|
25856
|
+
// We are in the same view, which means we are adding content node to the parent view.
|
|
25662
25857
|
previousOrParentTNode.child = tNode;
|
|
25663
25858
|
}
|
|
25859
|
+
else if (!isParent) {
|
|
25860
|
+
previousOrParentTNode.next = tNode;
|
|
25861
|
+
}
|
|
25664
25862
|
}
|
|
25665
25863
|
}
|
|
25666
|
-
|
|
25667
|
-
|
|
25668
|
-
var lViewData = state;
|
|
25669
|
-
ngDevMode &&
|
|
25670
|
-
assertEqual(lViewData[HOST_NODE], null, 'lViewData[HOST_NODE] should not have been initialized');
|
|
25671
|
-
lViewData[HOST_NODE] = tNode;
|
|
25672
|
-
if (lViewData[TVIEW].firstTemplatePass) {
|
|
25673
|
-
lViewData[TVIEW].node = tNode;
|
|
25674
|
-
}
|
|
25864
|
+
if (tView.firstChild == null && type === 3 /* Element */) {
|
|
25865
|
+
tView.firstChild = tNode;
|
|
25675
25866
|
}
|
|
25676
25867
|
previousOrParentTNode = tNode;
|
|
25677
25868
|
isParent = true;
|
|
25678
25869
|
return tNode;
|
|
25679
25870
|
}
|
|
25871
|
+
function createViewNode(index, view) {
|
|
25872
|
+
// View nodes are not stored in data because they can be added / removed at runtime (which
|
|
25873
|
+
// would cause indices to change). Their TNodes are instead stored in tView.node.
|
|
25874
|
+
if (view[TVIEW].node == null) {
|
|
25875
|
+
view[TVIEW].node = createTNode(2 /* View */, index, null, null, null);
|
|
25876
|
+
}
|
|
25877
|
+
isParent = true;
|
|
25878
|
+
return previousOrParentTNode = view[HOST_NODE] = view[TVIEW].node;
|
|
25879
|
+
}
|
|
25680
25880
|
/**
|
|
25681
|
-
* When
|
|
25881
|
+
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
25682
25882
|
* i18nApply() or ComponentFactory.create), we need to adjust the blueprint for future
|
|
25683
25883
|
* template passes.
|
|
25684
25884
|
*/
|
|
@@ -25715,7 +25915,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25715
25915
|
if (queries) {
|
|
25716
25916
|
lView[QUERIES] = queries.createView();
|
|
25717
25917
|
}
|
|
25718
|
-
|
|
25918
|
+
createViewNode(-1, lView);
|
|
25719
25919
|
if (tView.firstTemplatePass) {
|
|
25720
25920
|
tView.node.injectorIndex = injectorIndex;
|
|
25721
25921
|
}
|
|
@@ -25917,7 +26117,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
25917
26117
|
childIndex: -1,
|
|
25918
26118
|
bindingStartIndex: bindingStartIndex,
|
|
25919
26119
|
expandoStartIndex: initialViewLength,
|
|
25920
|
-
directives: null,
|
|
25921
26120
|
expandoInstructions: null,
|
|
25922
26121
|
firstTemplatePass: true,
|
|
25923
26122
|
initHooks: null,
|
|
@@ -26007,26 +26206,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26007
26206
|
}
|
|
26008
26207
|
return rNode;
|
|
26009
26208
|
}
|
|
26010
|
-
/**
|
|
26011
|
-
* Creates the host LNode.
|
|
26012
|
-
*
|
|
26013
|
-
* @param rNode Render host element.
|
|
26014
|
-
* @param def ComponentDef
|
|
26015
|
-
*
|
|
26016
|
-
* @returns LElementNode created
|
|
26017
|
-
*/
|
|
26018
|
-
function hostElement(tag, rNode, def, sanitizer) {
|
|
26019
|
-
resetComponentState();
|
|
26020
|
-
var tNode = createNodeAtIndex(0, 3 /* Element */, rNode, null, null, createLViewData(renderer, getOrCreateTView(def.template, def.consts, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery), null, def.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */, sanitizer));
|
|
26021
|
-
if (firstTemplatePass) {
|
|
26022
|
-
tView.expandoInstructions = ROOT_EXPANDO_INSTRUCTIONS.slice();
|
|
26023
|
-
if (def.diPublic)
|
|
26024
|
-
def.diPublic(def);
|
|
26025
|
-
tNode.flags =
|
|
26026
|
-
viewData.length << 15 /* DirectiveStartingIndexShift */ | 4096 /* isComponent */;
|
|
26027
|
-
}
|
|
26028
|
-
return viewData[HEADER_OFFSET];
|
|
26029
|
-
}
|
|
26030
26209
|
/**
|
|
26031
26210
|
* Saves the cleanup function itself in LView.cleanupInstances.
|
|
26032
26211
|
*
|
|
@@ -26048,16 +26227,20 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26048
26227
|
* @param adjustedIndex The index of the TNode in TView.data, adjusted for HEADER_OFFSET
|
|
26049
26228
|
* @param tagName The tag name of the node
|
|
26050
26229
|
* @param attrs The attributes defined on this node
|
|
26051
|
-
* @param parent The parent of this node
|
|
26052
26230
|
* @param tViews Any TViews attached to this node
|
|
26053
26231
|
* @returns the TNode object
|
|
26054
26232
|
*/
|
|
26055
|
-
function createTNode(type, adjustedIndex, tagName, attrs,
|
|
26233
|
+
function createTNode(type, adjustedIndex, tagName, attrs, tViews) {
|
|
26056
26234
|
ngDevMode && ngDevMode.tNode++;
|
|
26235
|
+
var parent = isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
|
|
26236
|
+
// Parents cannot cross component boundaries because components will be used in multiple places,
|
|
26237
|
+
// so it's only set if the view is the same.
|
|
26238
|
+
var parentInSameView = parent && viewData && parent !== viewData[HOST_NODE];
|
|
26239
|
+
var tParent = parentInSameView ? parent : null;
|
|
26057
26240
|
return {
|
|
26058
26241
|
type: type,
|
|
26059
26242
|
index: adjustedIndex,
|
|
26060
|
-
injectorIndex:
|
|
26243
|
+
injectorIndex: tParent ? tParent.injectorIndex : -1,
|
|
26061
26244
|
flags: 0,
|
|
26062
26245
|
tagName: tagName,
|
|
26063
26246
|
attrs: attrs,
|
|
@@ -26068,8 +26251,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26068
26251
|
tViews: tViews,
|
|
26069
26252
|
next: null,
|
|
26070
26253
|
child: null,
|
|
26071
|
-
parent:
|
|
26072
|
-
dynamicContainerNode: null,
|
|
26254
|
+
parent: tParent,
|
|
26073
26255
|
detached: null,
|
|
26074
26256
|
stylingTemplate: null,
|
|
26075
26257
|
projection: null
|
|
@@ -26088,10 +26270,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26088
26270
|
* @param directiveDef DirectiveDef object which contains information about the template.
|
|
26089
26271
|
*/
|
|
26090
26272
|
function directiveCreate(directiveDefIdx, directive, directiveDef) {
|
|
26091
|
-
var
|
|
26092
|
-
var instance = baseDirectiveCreate(directiveDefIdx, directive, directiveDef,
|
|
26273
|
+
var native = getNativeByTNode(previousOrParentTNode, viewData);
|
|
26274
|
+
var instance = baseDirectiveCreate(directiveDefIdx, directive, directiveDef, native);
|
|
26093
26275
|
if (directiveDef.template) {
|
|
26094
|
-
|
|
26276
|
+
var componentView = getComponentViewByIndex(previousOrParentTNode.index, viewData);
|
|
26277
|
+
componentView[CONTEXT] = directive;
|
|
26095
26278
|
}
|
|
26096
26279
|
if (firstTemplatePass) {
|
|
26097
26280
|
// Init hooks are queued now so ngOnInit is called in host components before
|
|
@@ -26113,12 +26296,12 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26113
26296
|
* This version does not contain features that we don't already support at root in
|
|
26114
26297
|
* current Angular. Example: local refs and inputs on root component.
|
|
26115
26298
|
*/
|
|
26116
|
-
function baseDirectiveCreate(index, directive, directiveDef,
|
|
26299
|
+
function baseDirectiveCreate(index, directive, directiveDef, native) {
|
|
26117
26300
|
ngDevMode && assertEqual(viewData[BINDING_INDEX], tView.bindingStartIndex, 'directives should be created before any bindings');
|
|
26118
26301
|
ngDevMode && assertPreviousIsParent();
|
|
26119
26302
|
attachPatchData(directive, viewData);
|
|
26120
|
-
if (
|
|
26121
|
-
attachPatchData(
|
|
26303
|
+
if (native) {
|
|
26304
|
+
attachPatchData(native, viewData);
|
|
26122
26305
|
}
|
|
26123
26306
|
viewData[index] = directive;
|
|
26124
26307
|
if (firstTemplatePass) {
|
|
@@ -26146,7 +26329,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26146
26329
|
diPublic(directiveDef);
|
|
26147
26330
|
}
|
|
26148
26331
|
if (directiveDef.attributes != null && previousOrParentTNode.type == 3 /* Element */) {
|
|
26149
|
-
setUpAttributes(
|
|
26332
|
+
setUpAttributes(native, directiveDef.attributes);
|
|
26150
26333
|
}
|
|
26151
26334
|
return directive;
|
|
26152
26335
|
}
|
|
@@ -26218,7 +26401,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26218
26401
|
// Note: current can be an LViewData or an LContainer instance, but here we are only interested
|
|
26219
26402
|
// in LContainer. We can tell it's an LContainer because its length is less than the LViewData
|
|
26220
26403
|
// header.
|
|
26221
|
-
if (current.length < HEADER_OFFSET && current[ACTIVE_INDEX] ===
|
|
26404
|
+
if (current.length < HEADER_OFFSET && current[ACTIVE_INDEX] === -1) {
|
|
26222
26405
|
var container_1 = current;
|
|
26223
26406
|
for (var i = 0; i < container_1[VIEWS].length; i++) {
|
|
26224
26407
|
var dynamicViewData = container_1[VIEWS][i];
|
|
@@ -26237,11 +26420,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26237
26420
|
*/
|
|
26238
26421
|
function componentRefresh(adjustedElementIndex, parentFirstTemplatePass) {
|
|
26239
26422
|
ngDevMode && assertDataInRange(adjustedElementIndex);
|
|
26240
|
-
var
|
|
26423
|
+
var hostView = getComponentViewByIndex(adjustedElementIndex, viewData);
|
|
26241
26424
|
ngDevMode && assertNodeType(tView.data[adjustedElementIndex], 3 /* Element */);
|
|
26242
|
-
ngDevMode &&
|
|
26243
|
-
assertDefined(element.data, "Component's host node should have an LViewData attached.");
|
|
26244
|
-
var hostView = element.data;
|
|
26245
26425
|
// Only attached CheckAlways components or attached, dirty OnPush components should be checked
|
|
26246
26426
|
if (viewAttached(hostView) && hostView[FLAGS] & (2 /* CheckAlways */ | 4 /* Dirty */)) {
|
|
26247
26427
|
parentFirstTemplatePass && syncViewWithBlueprint(hostView);
|
|
@@ -26352,10 +26532,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26352
26532
|
* @param component The component which the change detection should be performed on.
|
|
26353
26533
|
*/
|
|
26354
26534
|
function detectChanges(component) {
|
|
26355
|
-
|
|
26356
|
-
ngDevMode &&
|
|
26357
|
-
assertDefined(hostNode, 'Component host node should be attached to an LViewData instance.');
|
|
26358
|
-
detectChangesInternal(hostNode.data, component);
|
|
26535
|
+
detectChangesInternal(getComponentViewByInstance(component), component);
|
|
26359
26536
|
}
|
|
26360
26537
|
/**
|
|
26361
26538
|
* Synchronously perform change detection on a root view and its components.
|
|
@@ -26427,9 +26604,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26427
26604
|
}
|
|
26428
26605
|
/** A special value which designates that a value has not changed. */
|
|
26429
26606
|
var NO_CHANGE = {};
|
|
26430
|
-
function getTNode(index) {
|
|
26431
|
-
return tView.data[index + HEADER_OFFSET];
|
|
26432
|
-
}
|
|
26433
26607
|
function assertPreviousIsParent() {
|
|
26434
26608
|
assertEqual(isParent, true, 'previousOrParentTNode should be a parent');
|
|
26435
26609
|
}
|
|
@@ -26447,15 +26621,45 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26447
26621
|
* Use of this source code is governed by an MIT-style license that can be
|
|
26448
26622
|
* found in the LICENSE file at https://angular.io/license
|
|
26449
26623
|
*/
|
|
26624
|
+
// Root component will always have an element index of 0 and an injector size of 1
|
|
26625
|
+
var ROOT_EXPANDO_INSTRUCTIONS = [0, 1];
|
|
26626
|
+
/**
|
|
26627
|
+
* Creates the root component view and the root component node.
|
|
26628
|
+
*
|
|
26629
|
+
* @param rNode Render host element.
|
|
26630
|
+
* @param def ComponentDef
|
|
26631
|
+
* @param rootView The parent view where the host node is stored
|
|
26632
|
+
* @param renderer The current renderer
|
|
26633
|
+
* @param sanitizer The sanitizer, if provided
|
|
26634
|
+
*
|
|
26635
|
+
* @returns Component view created
|
|
26636
|
+
*/
|
|
26637
|
+
function createRootComponentView(rNode, def, rootView, renderer, sanitizer) {
|
|
26638
|
+
resetComponentState();
|
|
26639
|
+
var tView = rootView[TVIEW];
|
|
26640
|
+
var componentView = createLViewData(renderer, getOrCreateTView(def.template, def.consts, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery), null, def.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */, sanitizer);
|
|
26641
|
+
var tNode = createNodeAtIndex(0, 3 /* Element */, rNode, null, null);
|
|
26642
|
+
if (tView.firstTemplatePass) {
|
|
26643
|
+
tView.expandoInstructions = ROOT_EXPANDO_INSTRUCTIONS.slice();
|
|
26644
|
+
if (def.diPublic)
|
|
26645
|
+
def.diPublic(def);
|
|
26646
|
+
tNode.flags =
|
|
26647
|
+
rootView.length << 15 /* DirectiveStartingIndexShift */ | 4096 /* isComponent */;
|
|
26648
|
+
}
|
|
26649
|
+
// Store component view at node index, with node as the HOST
|
|
26650
|
+
componentView[HOST] = rootView[HEADER_OFFSET];
|
|
26651
|
+
componentView[HOST_NODE] = tNode;
|
|
26652
|
+
return rootView[HEADER_OFFSET] = componentView;
|
|
26653
|
+
}
|
|
26450
26654
|
/**
|
|
26451
26655
|
* Creates a root component and sets it up with features and host bindings. Shared by
|
|
26452
26656
|
* renderComponent() and ViewContainerRef.createComponent().
|
|
26453
26657
|
*/
|
|
26454
|
-
function createRootComponent(
|
|
26658
|
+
function createRootComponent(hostRNode, componentView, componentDef, rootView, rootContext, hostFeatures) {
|
|
26455
26659
|
// Create directive instance with factory() and store at next index in viewData
|
|
26456
|
-
var component = baseDirectiveCreate(rootView.length, componentDef.factory(), componentDef,
|
|
26660
|
+
var component = baseDirectiveCreate(rootView.length, componentDef.factory(), componentDef, hostRNode);
|
|
26457
26661
|
rootContext.components.push(component);
|
|
26458
|
-
|
|
26662
|
+
componentView[CONTEXT] = component;
|
|
26459
26663
|
hostFeatures && hostFeatures.forEach(function (feature) { return feature(component, componentDef); });
|
|
26460
26664
|
if (rootView[TVIEW].firstTemplatePass)
|
|
26461
26665
|
prefillHostVars(componentDef.hostVars);
|
|
@@ -26499,76 +26703,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26499
26703
|
* found in the LICENSE file at https://angular.io/license
|
|
26500
26704
|
*/
|
|
26501
26705
|
|
|
26502
|
-
/**
|
|
26503
|
-
* @license
|
|
26504
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
26505
|
-
*
|
|
26506
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
26507
|
-
* found in the LICENSE file at https://angular.io/license
|
|
26508
|
-
*/
|
|
26509
|
-
|
|
26510
|
-
/**
|
|
26511
|
-
* @license
|
|
26512
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
26513
|
-
*
|
|
26514
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
26515
|
-
* found in the LICENSE file at https://angular.io/license
|
|
26516
|
-
*/
|
|
26517
|
-
/**
|
|
26518
|
-
* @deprecated Use the `Renderer2` instead.
|
|
26519
|
-
*/
|
|
26520
|
-
var Renderer = /** @class */ (function () {
|
|
26521
|
-
function Renderer() {
|
|
26522
|
-
}
|
|
26523
|
-
return Renderer;
|
|
26524
|
-
}());
|
|
26525
|
-
var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
|
26526
|
-
/**
|
|
26527
|
-
* Creates and initializes a custom renderer that implements the `Renderer2` base class.
|
|
26528
|
-
*
|
|
26529
|
-
* @experimental
|
|
26530
|
-
*/
|
|
26531
|
-
var RendererFactory2 = /** @class */ (function () {
|
|
26532
|
-
function RendererFactory2() {
|
|
26533
|
-
}
|
|
26534
|
-
return RendererFactory2;
|
|
26535
|
-
}());
|
|
26536
|
-
/**
|
|
26537
|
-
* Flags for renderer-specific style modifiers.
|
|
26538
|
-
* @experimental
|
|
26539
|
-
*/
|
|
26540
|
-
var RendererStyleFlags2;
|
|
26541
|
-
(function (RendererStyleFlags2) {
|
|
26542
|
-
/**
|
|
26543
|
-
* Marks a style as important.
|
|
26544
|
-
*/
|
|
26545
|
-
RendererStyleFlags2[RendererStyleFlags2["Important"] = 1] = "Important";
|
|
26546
|
-
/**
|
|
26547
|
-
* Marks a style as using dash case naming (this-is-dash-case).
|
|
26548
|
-
*/
|
|
26549
|
-
RendererStyleFlags2[RendererStyleFlags2["DashCase"] = 2] = "DashCase";
|
|
26550
|
-
})(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
|
|
26551
|
-
/**
|
|
26552
|
-
* Extend this base class to implement custom rendering. By default, Angular
|
|
26553
|
-
* renders a template into DOM. You can use custom rendering to intercept
|
|
26554
|
-
* rendering calls, or to render to something other than DOM.
|
|
26555
|
-
*
|
|
26556
|
-
* Create your custom renderer using `RendererFactory2`.
|
|
26557
|
-
*
|
|
26558
|
-
* Use a custom renderer to bypass Angular's templating and
|
|
26559
|
-
* make custom UI changes that can't be expressed declaratively.
|
|
26560
|
-
* For example if you need to set a property or an attribute whose name is
|
|
26561
|
-
* not statically known, use the `setProperty()` or
|
|
26562
|
-
* `setAttribute()` method.
|
|
26563
|
-
*
|
|
26564
|
-
* @experimental
|
|
26565
|
-
*/
|
|
26566
|
-
var Renderer2 = /** @class */ (function () {
|
|
26567
|
-
function Renderer2() {
|
|
26568
|
-
}
|
|
26569
|
-
return Renderer2;
|
|
26570
|
-
}());
|
|
26571
|
-
|
|
26572
26706
|
/**
|
|
26573
26707
|
* @license
|
|
26574
26708
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -26689,15 +26823,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26689
26823
|
}
|
|
26690
26824
|
return parentView;
|
|
26691
26825
|
}
|
|
26692
|
-
function getOrCreateRenderer2(view) {
|
|
26693
|
-
var renderer = view[RENDERER];
|
|
26694
|
-
if (isProceduralRenderer(renderer)) {
|
|
26695
|
-
return renderer;
|
|
26696
|
-
}
|
|
26697
|
-
else {
|
|
26698
|
-
throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
|
|
26699
|
-
}
|
|
26700
|
-
}
|
|
26701
26826
|
/**
|
|
26702
26827
|
* Returns the value associated to the given token from the injectors.
|
|
26703
26828
|
*
|
|
@@ -26875,9 +27000,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
26875
27000
|
this._injectorIndex = getOrCreateNodeInjectorForNode(_tNode, _hostView);
|
|
26876
27001
|
}
|
|
26877
27002
|
NodeInjector.prototype.get = function (token) {
|
|
26878
|
-
if (token === Renderer2) {
|
|
26879
|
-
return getOrCreateRenderer2(this._hostView);
|
|
26880
|
-
}
|
|
26881
27003
|
setEnvironment(this._tNode, this._hostView);
|
|
26882
27004
|
return getOrCreateInjectable(this._tNode, this._hostView, token);
|
|
26883
27005
|
};
|
|
@@ -27262,7 +27384,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27262
27384
|
return ElementRef_;
|
|
27263
27385
|
}(ElementRefToken));
|
|
27264
27386
|
}
|
|
27265
|
-
return new R3ElementRef(
|
|
27387
|
+
return new R3ElementRef(getNativeByTNode(tNode, view));
|
|
27266
27388
|
}
|
|
27267
27389
|
var R3TemplateRef;
|
|
27268
27390
|
/**
|
|
@@ -27289,10 +27411,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27289
27411
|
_this._injectorIndex = _injectorIndex;
|
|
27290
27412
|
return _this;
|
|
27291
27413
|
}
|
|
27292
|
-
TemplateRef_.prototype.createEmbeddedView = function (context, container$$1,
|
|
27414
|
+
TemplateRef_.prototype.createEmbeddedView = function (context, container$$1, hostTNode, hostView, index) {
|
|
27293
27415
|
var lView = createEmbeddedViewAndNode(this._tView, context, this._declarationParentView, this._renderer, this._queries, this._injectorIndex);
|
|
27294
27416
|
if (container$$1) {
|
|
27295
|
-
insertView(lView, container$$1, hostView, index,
|
|
27417
|
+
insertView(lView, container$$1, hostView, index, hostTNode.index);
|
|
27296
27418
|
}
|
|
27297
27419
|
renderEmbeddedTemplate(lView, this._tView, context, 1 /* Create */);
|
|
27298
27420
|
var viewRef = new ViewRef(lView, context, -1);
|
|
@@ -27302,10 +27424,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27302
27424
|
return TemplateRef_;
|
|
27303
27425
|
}(TemplateRefToken));
|
|
27304
27426
|
}
|
|
27305
|
-
var
|
|
27427
|
+
var hostContainer = hostView[hostTNode.index];
|
|
27306
27428
|
ngDevMode && assertNodeType(hostTNode, 0 /* Container */);
|
|
27307
27429
|
ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated');
|
|
27308
|
-
return new R3TemplateRef(hostView, createElementRef(ElementRefToken, hostTNode, hostView), hostTNode.tViews, getRenderer(),
|
|
27430
|
+
return new R3TemplateRef(hostView, createElementRef(ElementRefToken, hostTNode, hostView), hostTNode.tViews, getRenderer(), hostContainer[QUERIES], hostTNode.injectorIndex);
|
|
27309
27431
|
}
|
|
27310
27432
|
|
|
27311
27433
|
/**
|
|
@@ -27333,10 +27455,12 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27333
27455
|
var R3_TEMPLATE_REF_FACTORY__PRE_NGCC__ = noopFactory;
|
|
27334
27456
|
var R3_CHANGE_DETECTOR_REF_FACTORY__PRE_NGCC__ = noopFactory;
|
|
27335
27457
|
var R3_VIEW_CONTAINER_REF_FACTORY__PRE_NGCC__ = noopFactory;
|
|
27458
|
+
var R3_RENDERER2_FACTORY__PRE_NGCC__ = noopFactory;
|
|
27336
27459
|
var R3_ELEMENT_REF_FACTORY$1 = R3_ELEMENT_REF_FACTORY__PRE_NGCC__;
|
|
27337
27460
|
var R3_TEMPLATE_REF_FACTORY$1 = R3_TEMPLATE_REF_FACTORY__PRE_NGCC__;
|
|
27338
27461
|
var R3_CHANGE_DETECTOR_REF_FACTORY$1 = R3_CHANGE_DETECTOR_REF_FACTORY__PRE_NGCC__;
|
|
27339
27462
|
var R3_VIEW_CONTAINER_REF_FACTORY$1 = R3_VIEW_CONTAINER_REF_FACTORY__PRE_NGCC__;
|
|
27463
|
+
var R3_RENDERER2_FACTORY$1 = R3_RENDERER2_FACTORY__PRE_NGCC__;
|
|
27340
27464
|
|
|
27341
27465
|
/**
|
|
27342
27466
|
* @license
|
|
@@ -27369,6 +27493,70 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27369
27493
|
return ElementRef;
|
|
27370
27494
|
}());
|
|
27371
27495
|
|
|
27496
|
+
/**
|
|
27497
|
+
* @license
|
|
27498
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
27499
|
+
*
|
|
27500
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
27501
|
+
* found in the LICENSE file at https://angular.io/license
|
|
27502
|
+
*/
|
|
27503
|
+
/**
|
|
27504
|
+
* @deprecated Use the `Renderer2` instead.
|
|
27505
|
+
*/
|
|
27506
|
+
var Renderer = /** @class */ (function () {
|
|
27507
|
+
function Renderer() {
|
|
27508
|
+
}
|
|
27509
|
+
return Renderer;
|
|
27510
|
+
}());
|
|
27511
|
+
var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
|
27512
|
+
/**
|
|
27513
|
+
* Creates and initializes a custom renderer that implements the `Renderer2` base class.
|
|
27514
|
+
*
|
|
27515
|
+
* @experimental
|
|
27516
|
+
*/
|
|
27517
|
+
var RendererFactory2 = /** @class */ (function () {
|
|
27518
|
+
function RendererFactory2() {
|
|
27519
|
+
}
|
|
27520
|
+
return RendererFactory2;
|
|
27521
|
+
}());
|
|
27522
|
+
/**
|
|
27523
|
+
* Flags for renderer-specific style modifiers.
|
|
27524
|
+
* @experimental
|
|
27525
|
+
*/
|
|
27526
|
+
var RendererStyleFlags2;
|
|
27527
|
+
(function (RendererStyleFlags2) {
|
|
27528
|
+
/**
|
|
27529
|
+
* Marks a style as important.
|
|
27530
|
+
*/
|
|
27531
|
+
RendererStyleFlags2[RendererStyleFlags2["Important"] = 1] = "Important";
|
|
27532
|
+
/**
|
|
27533
|
+
* Marks a style as using dash case naming (this-is-dash-case).
|
|
27534
|
+
*/
|
|
27535
|
+
RendererStyleFlags2[RendererStyleFlags2["DashCase"] = 2] = "DashCase";
|
|
27536
|
+
})(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
|
|
27537
|
+
/**
|
|
27538
|
+
* Extend this base class to implement custom rendering. By default, Angular
|
|
27539
|
+
* renders a template into DOM. You can use custom rendering to intercept
|
|
27540
|
+
* rendering calls, or to render to something other than DOM.
|
|
27541
|
+
*
|
|
27542
|
+
* Create your custom renderer using `RendererFactory2`.
|
|
27543
|
+
*
|
|
27544
|
+
* Use a custom renderer to bypass Angular's templating and
|
|
27545
|
+
* make custom UI changes that can't be expressed declaratively.
|
|
27546
|
+
* For example if you need to set a property or an attribute whose name is
|
|
27547
|
+
* not statically known, use the `setProperty()` or
|
|
27548
|
+
* `setAttribute()` method.
|
|
27549
|
+
*
|
|
27550
|
+
* @experimental
|
|
27551
|
+
*/
|
|
27552
|
+
var Renderer2 = /** @class */ (function () {
|
|
27553
|
+
function Renderer2() {
|
|
27554
|
+
}
|
|
27555
|
+
/** @internal */
|
|
27556
|
+
Renderer2.__NG_ELEMENT_ID__ = function () { return R3_RENDERER2_FACTORY$1(); };
|
|
27557
|
+
return Renderer2;
|
|
27558
|
+
}());
|
|
27559
|
+
|
|
27372
27560
|
/**
|
|
27373
27561
|
* @license
|
|
27374
27562
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -27455,7 +27643,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27455
27643
|
else {
|
|
27456
27644
|
rendererFactory = domRendererFactory3;
|
|
27457
27645
|
}
|
|
27458
|
-
var
|
|
27646
|
+
var hostRNode = isInternalRootView ?
|
|
27459
27647
|
elementCreate(this.selector, rendererFactory.createRenderer(null, this.componentDef)) :
|
|
27460
27648
|
locateHostElement(rendererFactory, rootSelectorOrNode);
|
|
27461
27649
|
// The first index of the first selector is the tag name.
|
|
@@ -27465,21 +27653,20 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27465
27653
|
var rootContext = ngModule && !isInternalRootView ?
|
|
27466
27654
|
ngModule.injector.get(ROOT_CONTEXT) :
|
|
27467
27655
|
createRootContext(requestAnimationFrame.bind(window));
|
|
27656
|
+
var renderer = rendererFactory.createRenderer(hostRNode, this.componentDef);
|
|
27468
27657
|
// Create the root view. Uses empty TView and ContentTemplate.
|
|
27469
|
-
var rootView = createLViewData(
|
|
27658
|
+
var rootView = createLViewData(renderer, createTView(-1, null, 1, 0, null, null, null), rootContext, rootFlags);
|
|
27470
27659
|
rootView[INJECTOR$1] = ngModule && ngModule.injector || null;
|
|
27471
27660
|
// rootView is the parent when bootstrapping
|
|
27472
27661
|
var oldView = enterView(rootView, null);
|
|
27473
27662
|
var component;
|
|
27474
|
-
var elementNode;
|
|
27475
27663
|
var tElementNode;
|
|
27476
27664
|
try {
|
|
27477
27665
|
if (rendererFactory.begin)
|
|
27478
27666
|
rendererFactory.begin();
|
|
27479
|
-
|
|
27480
|
-
|
|
27481
|
-
|
|
27482
|
-
// Transform the arrays of native nodes into a LNode structure that can be consumed by the
|
|
27667
|
+
var componentView = createRootComponentView(hostRNode, this.componentDef, rootView, renderer);
|
|
27668
|
+
tElementNode = getTNode(0, rootView);
|
|
27669
|
+
// Transform the arrays of native nodes into a structure that can be consumed by the
|
|
27483
27670
|
// projection instruction. This is needed to support the reprojection of these nodes.
|
|
27484
27671
|
if (projectableNodes) {
|
|
27485
27672
|
var index = 0;
|
|
@@ -27500,9 +27687,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27500
27687
|
// TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
|
|
27501
27688
|
// executed here?
|
|
27502
27689
|
// Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
|
|
27503
|
-
component = createRootComponent(
|
|
27690
|
+
component = createRootComponent(hostRNode, componentView, this.componentDef, rootView, rootContext, [LifecycleHooksFeature]);
|
|
27504
27691
|
// Execute the template in creation mode only, and then turn off the CreationMode flag
|
|
27505
|
-
var componentView = elementNode.data;
|
|
27506
27692
|
renderEmbeddedTemplate(componentView, componentView[TVIEW], component, 1 /* Create */);
|
|
27507
27693
|
componentView[FLAGS] &= ~1 /* CreationMode */;
|
|
27508
27694
|
}
|
|
@@ -27537,7 +27723,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
27537
27723
|
_this.destroyCbs = [];
|
|
27538
27724
|
_this.instance = instance;
|
|
27539
27725
|
_this.hostView = _this.changeDetectorRef = new RootViewRef(rootView);
|
|
27540
|
-
_this.hostView._tViewNode =
|
|
27726
|
+
_this.hostView._tViewNode = createViewNode(-1, rootView);
|
|
27541
27727
|
_this.injector = injector;
|
|
27542
27728
|
_this.componentType = componentType;
|
|
27543
27729
|
return _this;
|
|
@@ -32277,7 +32463,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
32277
32463
|
}
|
|
32278
32464
|
return Version;
|
|
32279
32465
|
}());
|
|
32280
|
-
var VERSION$2 = new Version$1('7.0.0
|
|
32466
|
+
var VERSION$2 = new Version$1('7.0.0');
|
|
32281
32467
|
|
|
32282
32468
|
/**
|
|
32283
32469
|
* @license
|
|
@@ -38218,6 +38404,14 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
38218
38404
|
* found in the LICENSE file at https://angular.io/license
|
|
38219
38405
|
*/
|
|
38220
38406
|
|
|
38407
|
+
/**
|
|
38408
|
+
* @license
|
|
38409
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
38410
|
+
*
|
|
38411
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
38412
|
+
* found in the LICENSE file at https://angular.io/license
|
|
38413
|
+
*/
|
|
38414
|
+
|
|
38221
38415
|
/**
|
|
38222
38416
|
* @license
|
|
38223
38417
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -43298,11 +43492,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43298
43492
|
this.debugContextFactory = getCurrentDebugContext;
|
|
43299
43493
|
this.data = this.delegate.data;
|
|
43300
43494
|
}
|
|
43301
|
-
|
|
43302
|
-
get: function () { return this.debugContextFactory(); },
|
|
43303
|
-
enumerable: true,
|
|
43304
|
-
configurable: true
|
|
43305
|
-
});
|
|
43495
|
+
DebugRenderer2.prototype.createDebugContext = function (nativeElement) { return this.debugContextFactory(nativeElement); };
|
|
43306
43496
|
DebugRenderer2.prototype.destroyNode = function (node) {
|
|
43307
43497
|
removeDebugNodeFromIndex(getDebugNode(node));
|
|
43308
43498
|
if (this.delegate.destroyNode) {
|
|
@@ -43312,7 +43502,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43312
43502
|
DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); };
|
|
43313
43503
|
DebugRenderer2.prototype.createElement = function (name, namespace) {
|
|
43314
43504
|
var el = this.delegate.createElement(name, namespace);
|
|
43315
|
-
var debugCtx = this.
|
|
43505
|
+
var debugCtx = this.createDebugContext(el);
|
|
43316
43506
|
if (debugCtx) {
|
|
43317
43507
|
var debugEl = new DebugElement(el, null, debugCtx);
|
|
43318
43508
|
debugEl.name = name;
|
|
@@ -43322,7 +43512,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43322
43512
|
};
|
|
43323
43513
|
DebugRenderer2.prototype.createComment = function (value) {
|
|
43324
43514
|
var comment = this.delegate.createComment(value);
|
|
43325
|
-
var debugCtx = this.
|
|
43515
|
+
var debugCtx = this.createDebugContext(comment);
|
|
43326
43516
|
if (debugCtx) {
|
|
43327
43517
|
indexDebugNode(new DebugNode(comment, null, debugCtx));
|
|
43328
43518
|
}
|
|
@@ -43330,7 +43520,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43330
43520
|
};
|
|
43331
43521
|
DebugRenderer2.prototype.createText = function (value) {
|
|
43332
43522
|
var text = this.delegate.createText(value);
|
|
43333
|
-
var debugCtx = this.
|
|
43523
|
+
var debugCtx = this.createDebugContext(text);
|
|
43334
43524
|
if (debugCtx) {
|
|
43335
43525
|
indexDebugNode(new DebugNode(text, null, debugCtx));
|
|
43336
43526
|
}
|
|
@@ -43363,7 +43553,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43363
43553
|
};
|
|
43364
43554
|
DebugRenderer2.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
|
|
43365
43555
|
var el = this.delegate.selectRootElement(selectorOrNode, preserveContent);
|
|
43366
|
-
var debugCtx = getCurrentDebugContext();
|
|
43556
|
+
var debugCtx = getCurrentDebugContext() || (null);
|
|
43367
43557
|
if (debugCtx) {
|
|
43368
43558
|
indexDebugNode(new DebugElement(el, null, debugCtx));
|
|
43369
43559
|
}
|
|
@@ -43493,6 +43683,53 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43493
43683
|
* found in the LICENSE file at https://angular.io/license
|
|
43494
43684
|
*/
|
|
43495
43685
|
|
|
43686
|
+
/**
|
|
43687
|
+
* Returns the host component instance associated with the target.
|
|
43688
|
+
*
|
|
43689
|
+
* This will only return a component instance of the DOM node
|
|
43690
|
+
* contains an instance of a component on it.
|
|
43691
|
+
*/
|
|
43692
|
+
function getHostComponent(target) {
|
|
43693
|
+
var context = loadContext(target);
|
|
43694
|
+
var tNode = context.lViewData[TVIEW].data[context.nodeIndex];
|
|
43695
|
+
if (tNode.flags & 4096 /* isComponent */) {
|
|
43696
|
+
var componentView = getComponentViewByIndex(context.nodeIndex, context.lViewData);
|
|
43697
|
+
return componentView[CONTEXT];
|
|
43698
|
+
}
|
|
43699
|
+
return null;
|
|
43700
|
+
}
|
|
43701
|
+
/**
|
|
43702
|
+
* Returns the injector instance that is associated with
|
|
43703
|
+
* the element, component or directive.
|
|
43704
|
+
*/
|
|
43705
|
+
function getInjector(target) {
|
|
43706
|
+
var context = loadContext(target);
|
|
43707
|
+
var tNode = context.lViewData[TVIEW].data[context.nodeIndex];
|
|
43708
|
+
return new NodeInjector(tNode, context.lViewData);
|
|
43709
|
+
}
|
|
43710
|
+
/**
|
|
43711
|
+
* Returns LContext associated with a target passed as an argument.
|
|
43712
|
+
* Throws if a given target doesn't have associated LContext.
|
|
43713
|
+
*/
|
|
43714
|
+
function loadContext(target) {
|
|
43715
|
+
var context = getContext(target);
|
|
43716
|
+
if (!context) {
|
|
43717
|
+
throw new Error(ngDevMode ? 'Unable to find the given context data for the given target' :
|
|
43718
|
+
'Invalid ng target');
|
|
43719
|
+
}
|
|
43720
|
+
return context;
|
|
43721
|
+
}
|
|
43722
|
+
/**
|
|
43723
|
+
* Retrieve map of local references (local reference name => element or directive instance).
|
|
43724
|
+
*/
|
|
43725
|
+
function getLocalRefs(target) {
|
|
43726
|
+
var context = loadContext(target);
|
|
43727
|
+
if (context.localRefs === undefined) {
|
|
43728
|
+
context.localRefs = discoverLocalRefs(context.lViewData, context.nodeIndex);
|
|
43729
|
+
}
|
|
43730
|
+
return context.localRefs || {};
|
|
43731
|
+
}
|
|
43732
|
+
|
|
43496
43733
|
/**
|
|
43497
43734
|
* @license
|
|
43498
43735
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -43510,9 +43747,9 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43510
43747
|
function Render3DebugRendererFactory2() {
|
|
43511
43748
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
43512
43749
|
}
|
|
43513
|
-
Render3DebugRendererFactory2.prototype.createRenderer = function (element
|
|
43514
|
-
var renderer = _super.prototype.createRenderer.call(this, element
|
|
43515
|
-
renderer.debugContextFactory = function () { return new Render3DebugContext(
|
|
43750
|
+
Render3DebugRendererFactory2.prototype.createRenderer = function (element, renderData) {
|
|
43751
|
+
var renderer = _super.prototype.createRenderer.call(this, element, renderData);
|
|
43752
|
+
renderer.debugContextFactory = function (nativeElement) { return new Render3DebugContext(nativeElement); };
|
|
43516
43753
|
return renderer;
|
|
43517
43754
|
};
|
|
43518
43755
|
return Render3DebugRendererFactory2;
|
|
@@ -43523,88 +43760,71 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
43523
43760
|
* Used in tests to retrieve information those nodes.
|
|
43524
43761
|
*/
|
|
43525
43762
|
var Render3DebugContext = /** @class */ (function () {
|
|
43526
|
-
function Render3DebugContext(
|
|
43527
|
-
this.
|
|
43528
|
-
// The LNode will be created next and appended to viewData
|
|
43529
|
-
this.nodeIndex = viewData ? viewData.length : null;
|
|
43763
|
+
function Render3DebugContext(_nativeNode) {
|
|
43764
|
+
this._nativeNode = _nativeNode;
|
|
43530
43765
|
}
|
|
43766
|
+
Object.defineProperty(Render3DebugContext.prototype, "nodeIndex", {
|
|
43767
|
+
get: function () { return loadContext(this._nativeNode).nodeIndex; },
|
|
43768
|
+
enumerable: true,
|
|
43769
|
+
configurable: true
|
|
43770
|
+
});
|
|
43531
43771
|
Object.defineProperty(Render3DebugContext.prototype, "view", {
|
|
43532
|
-
get: function () { return this.
|
|
43772
|
+
get: function () { return loadContext(this._nativeNode).lViewData; },
|
|
43533
43773
|
enumerable: true,
|
|
43534
43774
|
configurable: true
|
|
43535
43775
|
});
|
|
43536
43776
|
Object.defineProperty(Render3DebugContext.prototype, "injector", {
|
|
43537
|
-
get: function () {
|
|
43538
|
-
if (this.nodeIndex !== null) {
|
|
43539
|
-
var tNode = this.view[TVIEW].data[this.nodeIndex];
|
|
43540
|
-
return new NodeInjector(tNode, this.view);
|
|
43541
|
-
}
|
|
43542
|
-
return Injector.NULL;
|
|
43543
|
-
},
|
|
43777
|
+
get: function () { return getInjector(this._nativeNode); },
|
|
43544
43778
|
enumerable: true,
|
|
43545
43779
|
configurable: true
|
|
43546
43780
|
});
|
|
43547
43781
|
Object.defineProperty(Render3DebugContext.prototype, "component", {
|
|
43548
|
-
get: function () {
|
|
43549
|
-
// TODO(vicb): why/when
|
|
43550
|
-
if (this.nodeIndex === null) {
|
|
43551
|
-
return null;
|
|
43552
|
-
}
|
|
43553
|
-
var tView = this.view[TVIEW];
|
|
43554
|
-
var components = tView.components;
|
|
43555
|
-
return (components && components.indexOf(this.nodeIndex) == -1) ?
|
|
43556
|
-
null :
|
|
43557
|
-
this.view[this.nodeIndex].data[CONTEXT];
|
|
43558
|
-
},
|
|
43782
|
+
get: function () { return getHostComponent(this._nativeNode); },
|
|
43559
43783
|
enumerable: true,
|
|
43560
43784
|
configurable: true
|
|
43561
43785
|
});
|
|
43562
43786
|
Object.defineProperty(Render3DebugContext.prototype, "providerTokens", {
|
|
43563
|
-
// TODO(vicb): add view providers when supported
|
|
43564
43787
|
get: function () {
|
|
43565
|
-
|
|
43566
|
-
var
|
|
43567
|
-
|
|
43568
|
-
|
|
43569
|
-
|
|
43570
|
-
|
|
43571
|
-
|
|
43572
|
-
|
|
43573
|
-
|
|
43788
|
+
var lDebugCtx = loadContext(this._nativeNode);
|
|
43789
|
+
var lViewData = lDebugCtx.lViewData;
|
|
43790
|
+
var tNode = lViewData[TVIEW].data[lDebugCtx.nodeIndex];
|
|
43791
|
+
var directivesCount = tNode.flags & 4095 /* DirectiveCountMask */;
|
|
43792
|
+
if (directivesCount > 0) {
|
|
43793
|
+
var directiveIdxStart = tNode.flags >> 15 /* DirectiveStartingIndexShift */;
|
|
43794
|
+
var directiveIdxEnd = directiveIdxStart + directivesCount;
|
|
43795
|
+
var viewDirectiveDefs = this.view[TVIEW].data;
|
|
43796
|
+
var directiveDefs = viewDirectiveDefs.slice(directiveIdxStart, directiveIdxEnd);
|
|
43797
|
+
return directiveDefs.map(function (directiveDef) { return directiveDef.type; });
|
|
43798
|
+
}
|
|
43799
|
+
return [];
|
|
43574
43800
|
},
|
|
43575
43801
|
enumerable: true,
|
|
43576
43802
|
configurable: true
|
|
43577
43803
|
});
|
|
43578
43804
|
Object.defineProperty(Render3DebugContext.prototype, "references", {
|
|
43579
|
-
get: function () {
|
|
43580
|
-
// TODO(vicb): implement retrieving references
|
|
43581
|
-
throw new Error('Not implemented yet in ivy');
|
|
43582
|
-
},
|
|
43805
|
+
get: function () { return getLocalRefs(this._nativeNode); },
|
|
43583
43806
|
enumerable: true,
|
|
43584
43807
|
configurable: true
|
|
43585
43808
|
});
|
|
43586
43809
|
Object.defineProperty(Render3DebugContext.prototype, "context", {
|
|
43587
|
-
|
|
43588
|
-
|
|
43589
|
-
return null;
|
|
43590
|
-
}
|
|
43591
|
-
var lNode = this.view[this.nodeIndex];
|
|
43592
|
-
return lNode.view[CONTEXT];
|
|
43593
|
-
},
|
|
43810
|
+
// TODO(pk): check previous implementation and re-implement
|
|
43811
|
+
get: function () { throw new Error('Not implemented in ivy'); },
|
|
43594
43812
|
enumerable: true,
|
|
43595
43813
|
configurable: true
|
|
43596
43814
|
});
|
|
43597
43815
|
Object.defineProperty(Render3DebugContext.prototype, "componentRenderElement", {
|
|
43816
|
+
// TODO(pk): check previous implementation and re-implement
|
|
43598
43817
|
get: function () { throw new Error('Not implemented in ivy'); },
|
|
43599
43818
|
enumerable: true,
|
|
43600
43819
|
configurable: true
|
|
43601
43820
|
});
|
|
43602
43821
|
Object.defineProperty(Render3DebugContext.prototype, "renderNode", {
|
|
43822
|
+
// TODO(pk): check previous implementation and re-implement
|
|
43603
43823
|
get: function () { throw new Error('Not implemented in ivy'); },
|
|
43604
43824
|
enumerable: true,
|
|
43605
43825
|
configurable: true
|
|
43606
43826
|
});
|
|
43607
|
-
// TODO(
|
|
43827
|
+
// TODO(pk): check previous implementation and re-implement
|
|
43608
43828
|
Render3DebugContext.prototype.logError = function (console) {
|
|
43609
43829
|
var values = [];
|
|
43610
43830
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -44644,7 +44864,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
|
|
|
44644
44864
|
* Use of this source code is governed by an MIT-style license that can be
|
|
44645
44865
|
* found in the LICENSE file at https://angular.io/license
|
|
44646
44866
|
*/
|
|
44647
|
-
var VERSION$3 = new Version$1('7.0.0
|
|
44867
|
+
var VERSION$3 = new Version$1('7.0.0');
|
|
44648
44868
|
|
|
44649
44869
|
/**
|
|
44650
44870
|
* @license
|