2018-01-09 18:38:17 -08:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
2018-04-26 10:44:49 -07:00
|
|
|
import {LContainer} from './container';
|
2018-01-09 18:38:17 -08:00
|
|
|
import {LInjector} from './injector';
|
|
|
|
import {LProjection} from './projection';
|
2018-01-29 14:51:37 +01:00
|
|
|
import {LQueries} from './query';
|
2018-01-26 11:36:31 +01:00
|
|
|
import {RElement, RNode, RText} from './renderer';
|
2018-01-10 18:19:16 -08:00
|
|
|
import {LView, TData, TView} from './view';
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
/**
|
2018-05-17 12:54:57 -07:00
|
|
|
* TNodeType corresponds to the TNode.type property. It contains information
|
2018-03-20 19:06:49 -07:00
|
|
|
* on how to map a particular set of bits in LNode.flags to the node type.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-05-17 12:54:57 -07:00
|
|
|
export const enum TNodeType {
|
2018-01-09 18:38:17 -08:00
|
|
|
Container = 0b00,
|
|
|
|
Projection = 0b01,
|
|
|
|
View = 0b10,
|
|
|
|
Element = 0b11,
|
|
|
|
ViewOrElement = 0b10,
|
|
|
|
}
|
|
|
|
|
2018-03-20 19:06:49 -07:00
|
|
|
/**
|
2018-04-12 14:52:00 -07:00
|
|
|
* Corresponds to the TNode.flags property.
|
2018-03-20 19:06:49 -07:00
|
|
|
*/
|
2018-03-25 21:32:39 -07:00
|
|
|
export const enum TNodeFlags {
|
2018-04-12 14:52:00 -07:00
|
|
|
/** The number of directives on this node is encoded on the least significant bits */
|
|
|
|
DirectiveCountMask = 0b00000000000000000000111111111111,
|
2018-03-25 21:32:39 -07:00
|
|
|
|
2018-04-12 14:52:00 -07:00
|
|
|
/** Then this bit is set when the node is a component */
|
|
|
|
isComponent = 0b1000000000000,
|
2018-03-25 21:32:39 -07:00
|
|
|
|
2018-04-12 14:52:00 -07:00
|
|
|
/** The index of the first directive on this node is encoded on the most significant bits */
|
|
|
|
DirectiveStartingIndexShift = 13,
|
2018-03-25 21:32:39 -07:00
|
|
|
}
|
2018-03-20 19:06:49 -07:00
|
|
|
|
2018-01-09 18:38:17 -08:00
|
|
|
/**
|
|
|
|
* LNode is an internal data structure which is used for the incremental DOM algorithm.
|
|
|
|
* The "L" stands for "Logical" to differentiate between `RNodes` (actual rendered DOM
|
|
|
|
* node) and our logical representation of DOM nodes, `LNodes`.
|
|
|
|
*
|
|
|
|
* The data structure is optimized for speed and size.
|
|
|
|
*
|
|
|
|
* In order to be fast, all subtypes of `LNode` should have the same shape.
|
|
|
|
* Because size of the `LNode` matters, many fields have multiple roles depending
|
|
|
|
* on the `LNode` subtype.
|
|
|
|
*
|
|
|
|
* See: https://en.wikipedia.org/wiki/Inline_caching#Monomorphic_inline_caching
|
|
|
|
*
|
|
|
|
* NOTE: This is a private data structure and should not be exported by any of the
|
|
|
|
* instructions.
|
|
|
|
*/
|
|
|
|
export interface LNode {
|
|
|
|
/**
|
|
|
|
* The associated DOM node. Storing this allows us to:
|
|
|
|
* - append children to their element parents in the DOM (e.g. `parent.native.appendChild(...)`)
|
|
|
|
* - retrieve the sibling elements of text nodes whose creation / insertion has been delayed
|
|
|
|
*/
|
2018-01-26 11:36:31 +01:00
|
|
|
readonly native: RElement|RText|null|undefined;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If regular LElementNode, then `data` will be null.
|
|
|
|
* If LElementNode with component, then `data` contains LView.
|
|
|
|
* If LViewNode, then `data` contains the LView.
|
|
|
|
* If LContainerNode, then `data` contains LContainer.
|
|
|
|
* If LProjectionNode, then `data` contains LProjection.
|
|
|
|
*/
|
|
|
|
readonly data: LView|LContainer|LProjection|null;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Each node belongs to a view.
|
|
|
|
*
|
|
|
|
* When the injector is walking up a tree, it needs access to the `directives` (part of view).
|
|
|
|
*/
|
|
|
|
readonly view: LView;
|
|
|
|
|
|
|
|
/** The injector associated with this node. Necessary for DI. */
|
|
|
|
nodeInjector: LInjector|null;
|
|
|
|
|
|
|
|
/**
|
2018-01-29 14:51:37 +01:00
|
|
|
* Optional set of queries that track query-related events for this node.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
2018-01-29 14:51:37 +01:00
|
|
|
* If present the node creation/updates are reported to the `LQueries`.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-01-29 14:51:37 +01:00
|
|
|
queries: LQueries|null;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
2018-01-25 15:32:21 +01:00
|
|
|
/**
|
|
|
|
* If this node is projected, pointer to the next node in the same projection parent
|
|
|
|
* (which is a container, an element, or a text node), or to the parent projection node
|
|
|
|
* if this is the last node in the projection.
|
|
|
|
* If this node is not projected, this field is null.
|
|
|
|
*/
|
|
|
|
pNextOrParent: LNode|null;
|
|
|
|
|
2018-01-09 18:38:17 -08:00
|
|
|
/**
|
|
|
|
* Pointer to the corresponding TNode object, which stores static
|
|
|
|
* data about this node.
|
|
|
|
*/
|
2018-05-16 05:56:01 -07:00
|
|
|
tNode: TNode;
|
2018-04-03 10:18:25 +02:00
|
|
|
|
|
|
|
/**
|
2018-05-17 12:54:57 -07:00
|
|
|
* A pointer to an LContainerNode created by directives requesting ViewContainerRef
|
2018-04-03 10:18:25 +02:00
|
|
|
*/
|
2018-05-16 05:56:01 -07:00
|
|
|
// TODO(kara): Remove when removing LNodes
|
2018-04-03 10:18:25 +02:00
|
|
|
dynamicLContainerNode: LContainerNode|null;
|
2018-01-09 18:38:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** LNode representing an element. */
|
|
|
|
export interface LElementNode extends LNode {
|
|
|
|
/** The DOM element associated with this node. */
|
|
|
|
readonly native: RElement;
|
|
|
|
|
|
|
|
/** If Component then data has LView (light DOM) */
|
|
|
|
readonly data: LView|null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** LNode representing a #text node. */
|
|
|
|
export interface LTextNode extends LNode {
|
|
|
|
/** The text node associated with this node. */
|
|
|
|
native: RText;
|
|
|
|
readonly data: null;
|
2018-04-03 10:18:25 +02:00
|
|
|
dynamicLContainerNode: null;
|
2018-01-09 18:38:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Abstract node which contains root nodes of a view. */
|
|
|
|
export interface LViewNode extends LNode {
|
|
|
|
readonly native: null;
|
|
|
|
readonly data: LView;
|
2018-04-03 10:18:25 +02:00
|
|
|
dynamicLContainerNode: null;
|
2018-01-09 18:38:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Abstract node container which contains other views. */
|
|
|
|
export interface LContainerNode extends LNode {
|
2018-01-26 11:36:31 +01:00
|
|
|
/*
|
|
|
|
* Caches the reference of the first native node following this container in the same native
|
|
|
|
* parent.
|
|
|
|
* This is reset to undefined in containerRefreshEnd.
|
|
|
|
* When it is undefined, it means the value has not been computed yet.
|
|
|
|
* Otherwise, it contains the result of findBeforeNode(container, null).
|
|
|
|
*/
|
|
|
|
native: RElement|RText|null|undefined;
|
2018-01-09 18:38:17 -08:00
|
|
|
readonly data: LContainer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface LProjectionNode extends LNode {
|
|
|
|
readonly native: null;
|
|
|
|
readonly data: LProjection;
|
2018-04-03 10:18:25 +02:00
|
|
|
dynamicLContainerNode: null;
|
2018-01-09 18:38:17 -08:00
|
|
|
}
|
|
|
|
|
2018-05-04 15:58:42 +02:00
|
|
|
/**
|
|
|
|
* A set of marker values to be used in the attributes arrays. Those markers indicate that some
|
|
|
|
* items are not regular attributes and the processing should be adapted accordingly.
|
|
|
|
*/
|
|
|
|
export const enum AttributeMarker {
|
2018-05-30 15:57:09 -07:00
|
|
|
/**
|
|
|
|
* Use the next value as the full namespaces URI, the values after that
|
|
|
|
* are then the name and the value, respectively.
|
|
|
|
*/
|
2018-06-06 13:38:00 -07:00
|
|
|
NAMESPACE_URI = 0, // namespace. Has to be repeated.
|
2018-05-04 15:58:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This marker indicates that the following attribute names were extracted from bindings (ex.:
|
|
|
|
* [foo]="exp") and / or event handlers (ex. (bar)="doSth()").
|
|
|
|
* Taking the above bindings and outputs as an example an attributes array could look as follows:
|
|
|
|
* ['class', 'fade in', AttributeMarker.SELECT_ONLY, 'foo', 'bar']
|
|
|
|
*/
|
2018-06-06 13:38:00 -07:00
|
|
|
SELECT_ONLY = 1
|
2018-05-04 15:58:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A combination of:
|
|
|
|
* - attribute names and values
|
|
|
|
* - special markers acting as flags to alter attributes processing.
|
|
|
|
*/
|
2018-05-30 15:57:09 -07:00
|
|
|
export type TAttributes = (string | AttributeMarker)[];
|
2018-05-04 15:58:42 +02:00
|
|
|
|
2018-01-09 18:38:17 -08:00
|
|
|
/**
|
|
|
|
* LNode binding data (flyweight) for a particular node that is shared between all templates
|
|
|
|
* of a specific type.
|
|
|
|
*
|
|
|
|
* If a property is:
|
|
|
|
* - PropertyAliases: that property's data was generated and this is it
|
|
|
|
* - Null: that property's data was already generated and nothing was found.
|
|
|
|
* - Undefined: that property's data has not yet been generated
|
|
|
|
*
|
|
|
|
* see: https://en.wikipedia.org/wiki/Flyweight_pattern for more on the Flyweight pattern
|
|
|
|
*/
|
|
|
|
export interface TNode {
|
2018-05-17 12:54:57 -07:00
|
|
|
/** The type of the TNode. See TNodeType. */
|
|
|
|
type: TNodeType;
|
|
|
|
|
2018-05-11 20:57:37 -07:00
|
|
|
/**
|
|
|
|
* Index of the TNode in TView.data and corresponding LNode in LView.data.
|
|
|
|
*
|
|
|
|
* This is necessary to get from any TNode to its corresponding LNode when
|
|
|
|
* traversing the node tree.
|
2018-05-16 05:56:01 -07:00
|
|
|
*
|
2018-06-01 14:46:28 -07:00
|
|
|
* If index is -1, this is a dynamically created container node or embedded view node.
|
2018-05-11 20:57:37 -07:00
|
|
|
*/
|
2018-06-01 14:46:28 -07:00
|
|
|
index: number;
|
2018-05-11 20:57:37 -07:00
|
|
|
|
2018-03-20 19:06:49 -07:00
|
|
|
/**
|
|
|
|
* This number stores two values using its bits:
|
|
|
|
*
|
|
|
|
* - the number of directives on that node (first 12 bits)
|
|
|
|
* - the starting index of the node's directives in the directives array (last 20 bits).
|
|
|
|
*
|
|
|
|
* These two values are necessary so DI can effectively search the directives associated
|
|
|
|
* with a node without searching the whole directives array.
|
|
|
|
*/
|
|
|
|
flags: TNodeFlags;
|
|
|
|
|
2018-01-09 18:38:17 -08:00
|
|
|
/** The tag name associated with this node. */
|
|
|
|
tagName: string|null;
|
|
|
|
|
|
|
|
/**
|
2018-05-04 15:58:42 +02:00
|
|
|
* Attributes associated with an element. We need to store attributes to support various use-cases
|
|
|
|
* (attribute injection, content projection with selectors, directives matching).
|
|
|
|
* Attributes are stored statically because reading them from the DOM would be way too slow for
|
|
|
|
* content projection and queries.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
2018-05-04 15:58:42 +02:00
|
|
|
* Since attrs will always be calculated first, they will never need to be marked undefined by
|
|
|
|
* other instructions.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
2018-05-04 15:58:42 +02:00
|
|
|
* For regular attributes a name of an attribute and its value alternate in the array.
|
2018-01-09 18:38:17 -08:00
|
|
|
* e.g. ['role', 'checkbox']
|
2018-05-04 15:58:42 +02:00
|
|
|
* This array can contain flags that will indicate "special attributes" (attributes with
|
|
|
|
* namespaces, attributes extracted from bindings and outputs).
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-05-04 15:58:42 +02:00
|
|
|
attrs: TAttributes|null;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A set of local names under which a given element is exported in a template and
|
|
|
|
* visible to queries. An entry in this array can be created for different reasons:
|
|
|
|
* - an element itself is referenced, ex.: `<div #foo>`
|
|
|
|
* - a component is referenced, ex.: `<my-cmpt #foo>`
|
|
|
|
* - a directive is referenced, ex.: `<my-cmpt #foo="directiveExportAs">`.
|
|
|
|
*
|
|
|
|
* A given element might have different local names and those names can be associated
|
|
|
|
* with a directive. We store local names at even indexes while odd indexes are reserved
|
|
|
|
* for directive index in a view (or `-1` if there is no associated directive).
|
|
|
|
*
|
|
|
|
* Some examples:
|
|
|
|
* - `<div #foo>` => `["foo", -1]`
|
|
|
|
* - `<my-cmpt #foo>` => `["foo", myCmptIdx]`
|
|
|
|
* - `<my-cmpt #foo #bar="directiveExportAs">` => `["foo", myCmptIdx, "bar", directiveIdx]`
|
|
|
|
* - `<div #foo #bar="directiveExportAs">` => `["foo", -1, "bar", directiveIdx]`
|
|
|
|
*/
|
|
|
|
localNames: (string|number)[]|null;
|
|
|
|
|
2018-02-07 22:19:24 -08:00
|
|
|
/** Information about input properties that need to be set once from attribute data. */
|
2018-01-09 18:38:17 -08:00
|
|
|
initialInputs: InitialInputData|null|undefined;
|
|
|
|
|
2018-02-07 22:19:24 -08:00
|
|
|
/**
|
|
|
|
* Input data for all directives on this node.
|
|
|
|
*
|
|
|
|
* - `undefined` means that the prop has not been initialized yet,
|
|
|
|
* - `null` means that the prop has been initialized but no inputs have been found.
|
|
|
|
*/
|
2018-01-09 18:38:17 -08:00
|
|
|
inputs: PropertyAliases|null|undefined;
|
|
|
|
|
2018-02-07 22:19:24 -08:00
|
|
|
/**
|
|
|
|
* Output data for all directives on this node.
|
|
|
|
*
|
|
|
|
* - `undefined` means that the prop has not been initialized yet,
|
|
|
|
* - `null` means that the prop has been initialized but no outputs have been found.
|
|
|
|
*/
|
2018-01-09 18:38:17 -08:00
|
|
|
outputs: PropertyAliases|null|undefined;
|
|
|
|
|
|
|
|
/**
|
2018-04-26 10:44:49 -07:00
|
|
|
* The TView or TViews attached to this node.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
2018-04-26 10:44:49 -07:00
|
|
|
* If this TNode corresponds to an LContainerNode with inline views, the container will
|
|
|
|
* need to store separate static data for each of its view blocks (TView[]). Otherwise,
|
|
|
|
* nodes in inline views with the same index as nodes in their parent views will overwrite
|
|
|
|
* each other, as they are in the same template.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
2018-04-26 10:44:49 -07:00
|
|
|
* Each index in this array corresponds to the static data for a certain
|
|
|
|
* view. So if you had V(0) and V(1) in a container, you might have:
|
|
|
|
*
|
|
|
|
* [
|
|
|
|
* [{tagName: 'div', attrs: ...}, null], // V(0) TView
|
|
|
|
* [{tagName: 'button', attrs ...}, null] // V(1) TView
|
|
|
|
*
|
|
|
|
* If this TNode corresponds to an LContainerNode with a template (e.g. structural
|
|
|
|
* directive), the template's TView will be stored here.
|
|
|
|
*
|
|
|
|
* If this TNode corresponds to an LElementNode, tViews will be null .
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-04-26 10:44:49 -07:00
|
|
|
tViews: TView|TView[]|null;
|
2018-05-11 20:57:37 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The next sibling node. Necessary so we can propagate through the root nodes of a view
|
|
|
|
* to insert them or remove them from the DOM.
|
|
|
|
*/
|
|
|
|
next: TNode|null;
|
2018-05-16 05:56:01 -07:00
|
|
|
|
2018-05-24 13:13:51 -07:00
|
|
|
/**
|
|
|
|
* First child of the current node.
|
|
|
|
*
|
|
|
|
* For component nodes, the child will always be a ContentChild (in same view).
|
|
|
|
* For embedded view nodes, the child will be in their child view.
|
|
|
|
*/
|
|
|
|
child: TNode|null;
|
|
|
|
|
2018-05-29 15:08:30 -07:00
|
|
|
/**
|
|
|
|
* Parent node (in the same view only).
|
|
|
|
*
|
|
|
|
* We need a reference to a node's parent so we can append the node to its parent's native
|
|
|
|
* element at the appropriate time.
|
|
|
|
*
|
|
|
|
* If the parent would be in a different view (e.g. component host), this property will be null.
|
|
|
|
* It's important that we don't try to cross component boundaries when retrieving the parent
|
|
|
|
* because the parent will change (e.g. index, attrs) depending on where the component was
|
|
|
|
* used (and thus shouldn't be stored on TNode). In these cases, we retrieve the parent through
|
|
|
|
* LView.node instead (which will be instance-specific).
|
|
|
|
*
|
|
|
|
* If this is an inline view node (V), the parent will be its container.
|
|
|
|
*/
|
|
|
|
parent: TElementNode|TContainerNode|null;
|
|
|
|
|
2018-05-16 05:56:01 -07:00
|
|
|
/**
|
2018-05-17 12:54:57 -07:00
|
|
|
* A pointer to a TContainerNode created by directives requesting ViewContainerRef
|
2018-05-16 05:56:01 -07:00
|
|
|
*/
|
|
|
|
dynamicContainerNode: TNode|null;
|
2018-01-09 18:38:17 -08:00
|
|
|
}
|
|
|
|
|
2018-01-10 18:19:16 -08:00
|
|
|
/** Static data for an LElementNode */
|
2018-05-24 13:13:51 -07:00
|
|
|
export interface TElementNode extends TNode {
|
2018-05-29 15:08:30 -07:00
|
|
|
/** Index in the data[] array */
|
|
|
|
index: number;
|
|
|
|
child: TElementNode|TTextNode|TContainerNode|TProjectionNode|null;
|
|
|
|
/**
|
|
|
|
* Element nodes will have parents unless they are the first node of a component or
|
|
|
|
* embedded view (which means their parent is in a different view and must be
|
|
|
|
* retrieved using LView.node).
|
|
|
|
*/
|
|
|
|
parent: TElementNode|null;
|
2018-05-24 13:13:51 -07:00
|
|
|
tViews: null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Static data for an LTextNode */
|
|
|
|
export interface TTextNode extends TNode {
|
2018-05-29 15:08:30 -07:00
|
|
|
/** Index in the data[] array */
|
|
|
|
index: number;
|
2018-05-24 13:13:51 -07:00
|
|
|
child: null;
|
2018-05-29 15:08:30 -07:00
|
|
|
/**
|
|
|
|
* Text nodes will have parents unless they are the first node of a component or
|
|
|
|
* embedded view (which means their parent is in a different view and must be
|
|
|
|
* retrieved using LView.node).
|
|
|
|
*/
|
|
|
|
parent: TElementNode|null;
|
2018-05-24 13:13:51 -07:00
|
|
|
tViews: null;
|
|
|
|
}
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
/** Static data for an LContainerNode */
|
2018-05-24 13:13:51 -07:00
|
|
|
export interface TContainerNode extends TNode {
|
2018-05-29 15:08:30 -07:00
|
|
|
/**
|
2018-06-01 14:46:28 -07:00
|
|
|
* Index in the data[] array.
|
2018-05-29 15:08:30 -07:00
|
|
|
*
|
2018-06-01 14:46:28 -07:00
|
|
|
* If it's -1, this is a dynamically created container node that isn't stored in
|
2018-05-29 15:08:30 -07:00
|
|
|
* data[] (e.g. when you inject ViewContainerRef) .
|
|
|
|
*/
|
2018-06-01 14:46:28 -07:00
|
|
|
index: number;
|
2018-05-24 13:13:51 -07:00
|
|
|
child: null;
|
2018-05-29 15:08:30 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Container nodes will have parents unless:
|
|
|
|
*
|
|
|
|
* - They are the first node of a component or embedded view
|
|
|
|
* - They are dynamically created
|
|
|
|
*/
|
|
|
|
parent: TElementNode|null;
|
2018-05-24 13:13:51 -07:00
|
|
|
tViews: TView|TView[]|null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Static data for an LViewNode */
|
|
|
|
export interface TViewNode extends TNode {
|
2018-06-01 14:46:28 -07:00
|
|
|
/** If -1, it's a dynamically created view. Otherwise, it is the view block ID. */
|
|
|
|
index: number;
|
2018-05-29 15:08:30 -07:00
|
|
|
child: TElementNode|TTextNode|TContainerNode|TProjectionNode|null;
|
|
|
|
parent: TContainerNode|null;
|
2018-05-24 13:13:51 -07:00
|
|
|
tViews: null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Static data for an LProjectionNode */
|
|
|
|
export interface TProjectionNode extends TNode {
|
2018-05-29 15:08:30 -07:00
|
|
|
/** Index in the data[] array */
|
2018-05-24 13:13:51 -07:00
|
|
|
child: null;
|
2018-05-29 15:08:30 -07:00
|
|
|
/**
|
|
|
|
* Projection nodes will have parents unless they are the first node of a component
|
|
|
|
* or embedded view (which means their parent is in a different view and must be
|
|
|
|
* retrieved using LView.node).
|
|
|
|
*/
|
|
|
|
parent: TElementNode|null;
|
2018-05-24 13:13:51 -07:00
|
|
|
tViews: null;
|
|
|
|
}
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This mapping is necessary so we can set input properties and output listeners
|
|
|
|
* properly at runtime when property names are minified or aliased.
|
|
|
|
*
|
|
|
|
* Key: unminified / public input or output name
|
|
|
|
* Value: array containing minified / internal name and related directive index
|
|
|
|
*
|
|
|
|
* The value must be an array to support inputs and outputs with the same name
|
|
|
|
* on the same node.
|
|
|
|
*/
|
|
|
|
export type PropertyAliases = {
|
|
|
|
// This uses an object map because using the Map type would be too slow
|
|
|
|
[key: string]: PropertyAliasValue
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2018-02-07 22:19:24 -08:00
|
|
|
* Store the runtime input or output names for all the directives.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
2018-02-07 22:19:24 -08:00
|
|
|
* - Even indices: directive index
|
|
|
|
* - Odd indices: minified / internal name
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
|
|
|
* e.g. [0, 'change-minified']
|
|
|
|
*/
|
|
|
|
export type PropertyAliasValue = (number | string)[];
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This array contains information about input properties that
|
|
|
|
* need to be set once from attribute data. It's ordered by
|
|
|
|
* directive index (relative to element) so it's simple to
|
|
|
|
* look up a specific directive's initial input data.
|
|
|
|
*
|
|
|
|
* Within each sub-array:
|
|
|
|
*
|
|
|
|
* Even indices: minified/internal input name
|
|
|
|
* Odd indices: initial value
|
|
|
|
*
|
|
|
|
* If a directive on a node does not have any input properties
|
|
|
|
* that should be set from attributes, its index is set to null
|
|
|
|
* to avoid a sparse array.
|
|
|
|
*
|
|
|
|
* e.g. [null, ['role-min', 'button']]
|
|
|
|
*/
|
|
|
|
export type InitialInputData = (InitialInputs | null)[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used by InitialInputData to store input properties
|
|
|
|
* that should be set once from attributes.
|
|
|
|
*
|
|
|
|
* Even indices: minified/internal input name
|
|
|
|
* Odd indices: initial value
|
|
|
|
*
|
|
|
|
* e.g. ['role-min', 'button']
|
|
|
|
*/
|
|
|
|
export type InitialInputs = string[];
|
|
|
|
|
|
|
|
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
|
|
|
// failure based on types.
|
|
|
|
export const unusedValueExportToPlacateAjd = 1;
|