refactor(ivy): replace LNode.dynamicLContainerNode with flat LContainers (#26407)
PR Close #26407
This commit is contained in:

committed by
Miško Hevery

parent
70cd112872
commit
735dfd3b1a
@ -6,8 +6,10 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {LElementNode} from './node';
|
||||
import {LContainerNode, LElementContainerNode, LElementNode} from './node';
|
||||
import {LQueries} from './query';
|
||||
import {RComment} from './renderer';
|
||||
import {StylingContext} from './styling';
|
||||
import {LViewData, NEXT, PARENT, QUERIES} from './view';
|
||||
|
||||
/**
|
||||
@ -18,8 +20,10 @@ import {LViewData, NEXT, PARENT, QUERIES} from './view';
|
||||
export const ACTIVE_INDEX = 0;
|
||||
// PARENT, NEXT, and QUERIES are indices 1, 2, and 3.
|
||||
// As we already have these constants in LViewData, we don't need to re-create them.
|
||||
export const VIEWS = 4;
|
||||
export const RENDER_PARENT = 5;
|
||||
export const HOST_NATIVE = 4;
|
||||
export const NATIVE = 5;
|
||||
export const VIEWS = 6;
|
||||
export const RENDER_PARENT = 7;
|
||||
|
||||
/**
|
||||
* The state associated with an LContainerNode.
|
||||
@ -37,7 +41,7 @@ export interface LContainer extends Array<any> {
|
||||
* it is set to null to identify this scenario, as indices are "absolute" in that case,
|
||||
* i.e. provided directly by the user of the ViewContainerRef API.
|
||||
*/
|
||||
[ACTIVE_INDEX]: number|null;
|
||||
[ACTIVE_INDEX]: number;
|
||||
|
||||
/**
|
||||
* Access to the parent view is necessary so we can propagate back
|
||||
@ -57,6 +61,13 @@ export interface LContainer extends Array<any> {
|
||||
*/
|
||||
[QUERIES]: LQueries|null;
|
||||
|
||||
/** The host node of this LContainer. */
|
||||
// TODO: Should contain just the native element once LNode is removed.
|
||||
[HOST_NATIVE]: LElementNode|LContainerNode|LElementContainerNode|StylingContext;
|
||||
|
||||
/** The comment element that serves as an anchor for this LContainer. */
|
||||
[NATIVE]: RComment;
|
||||
|
||||
/**
|
||||
* A list of the container's currently active child views. Views will be inserted
|
||||
* here as they are added and spliced from here when they are removed. We need
|
||||
|
@ -71,18 +71,12 @@ export interface LNode {
|
||||
readonly native: RComment|RElement|RText|null;
|
||||
|
||||
/**
|
||||
* If regular LElementNode, LTextNode, and LProjectionNode then `data` will be null.
|
||||
* If regular LElementNode, LTextNode, LContainerNode, and LProjectionNode then `data` will be
|
||||
* null.
|
||||
* If LElementNode with component, then `data` contains LViewData.
|
||||
* If LViewNode, then `data` contains the LViewData.
|
||||
* If LContainerNode, then `data` contains LContainer.
|
||||
*/
|
||||
readonly data: LViewData|LContainer|null;
|
||||
|
||||
/**
|
||||
* A pointer to an LContainerNode created by directives requesting ViewContainerRef
|
||||
*/
|
||||
// TODO(kara): Remove when removing LNodes
|
||||
dynamicLContainerNode: LContainerNode|null;
|
||||
readonly data: LViewData|null;
|
||||
}
|
||||
|
||||
|
||||
@ -107,14 +101,12 @@ export interface LTextNode extends LNode {
|
||||
/** The text node associated with this node. */
|
||||
native: RText;
|
||||
readonly data: null;
|
||||
dynamicLContainerNode: null;
|
||||
}
|
||||
|
||||
/** Abstract node which contains root nodes of a view. */
|
||||
export interface LViewNode extends LNode {
|
||||
readonly native: null;
|
||||
readonly data: LViewData;
|
||||
dynamicLContainerNode: null;
|
||||
}
|
||||
|
||||
/** Abstract node container which contains other views. */
|
||||
@ -127,14 +119,13 @@ export interface LContainerNode extends LNode {
|
||||
* until the parent view is processed.
|
||||
*/
|
||||
native: RComment;
|
||||
readonly data: LContainer;
|
||||
readonly data: null;
|
||||
}
|
||||
|
||||
|
||||
export interface LProjectionNode extends LNode {
|
||||
readonly native: null;
|
||||
readonly data: null;
|
||||
dynamicLContainerNode: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user