refactor(ivy): add insertTStylingBinding to keep track of bindings. (#34004)

This adds `insertTStyleValue` but does not hook it up to anything yet.

The purpose of this function is to create a linked-list of styling
related bindings. The bindings can be traversed during flush.

The linked list also keeps track of duplicates. This is important
for binding to know if it needs to check other styles for reconciliation.

PR Close #34004
This commit is contained in:
Miško Hevery
2019-12-12 13:03:20 -08:00
parent 76698d38f7
commit 94504ff5c8
11 changed files with 1547 additions and 22 deletions

View File

@ -5,7 +5,7 @@
* 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
*/
import {StylingMapArray, TStylingContext} from '../interfaces/styling';
import {StylingMapArray, TStylingContext, TStylingRange} from '../interfaces/styling';
import {CssSelector} from './projection';
import {RNode} from './renderer';
import {LView, TView} from './view';
@ -599,6 +599,36 @@ export interface TNode {
* will be placed into the initial styling slot in the newly created `TStylingContext`.
*/
classes: StylingMapArray|TStylingContext|null;
/**
* Stores the head/tail index of the class bindings.
*
* - If no bindings, the head and tail will both be 0.
* - If there are template bindings, stores the head/tail of the class bindings in the template.
* - If no template bindings but there are host bindings, the head value will point to the last
* host binding for "class" (not the head of the linked list), tail will be 0.
*
* See: `style_binding_list.ts` for details.
*
* This is used by `insertTStylingBinding` to know where the next styling binding should be
* inserted so that they can be sorted in priority order.
*/
classBindings: TStylingRange;
/**
* Stores the head/tail index of the class bindings.
*
* - If no bindings, the head and tail will both be 0.
* - If there are template bindings, stores the head/tail of the style bindings in the template.
* - If no template bindings but there are host bindings, the head value will point to the last
* host binding for "style" (not the head of the linked list), tail will be 0.
*
* See: `style_binding_list.ts` for details.
*
* This is used by `insertTStylingBinding` to know where the next styling binding should be
* inserted so that they can be sorted in priority order.
*/
styleBindings: TStylingRange;
}
/** Static data for an element */