refactor(ivy): treate LView as the primary global state (#27282)
- rename `LViewData` to `LView` (to be consistent with `TView`) - Remove `getRenderer`, `getRendererFactory`, `getTview`, `getCurrentQueries`, PR Close #27282
This commit is contained in:
@ -10,7 +10,7 @@ import {InitialStylingFlags} from '../interfaces/definition';
|
||||
import {BindingStore, BindingType, Player, PlayerBuilder, PlayerFactory, PlayerIndex} from '../interfaces/player';
|
||||
import {Renderer3, RendererStyleFlags3, isProceduralRenderer} from '../interfaces/renderer';
|
||||
import {InitialStyles, StylingContext, StylingFlags, StylingIndex} from '../interfaces/styling';
|
||||
import {LViewData, RootContext} from '../interfaces/view';
|
||||
import {LView, RootContext} from '../interfaces/view';
|
||||
import {NO_CHANGE} from '../tokens';
|
||||
import {getRootContext} from '../util';
|
||||
|
||||
@ -479,7 +479,7 @@ export function updateClassProp(
|
||||
* @returns number the total amount of players that got queued for animation (if any)
|
||||
*/
|
||||
export function renderStyleAndClassBindings(
|
||||
context: StylingContext, renderer: Renderer3, rootOrView: RootContext | LViewData,
|
||||
context: StylingContext, renderer: Renderer3, rootOrView: RootContext | LView,
|
||||
isFirstRender: boolean, classesStore?: BindingStore | null,
|
||||
stylesStore?: BindingStore | null): number {
|
||||
let totalPlayersQueued = 0;
|
||||
|
@ -14,7 +14,7 @@ import {LContext} from '../interfaces/context';
|
||||
import {PlayState, Player, PlayerContext, PlayerIndex} from '../interfaces/player';
|
||||
import {RElement} from '../interfaces/renderer';
|
||||
import {InitialStyles, StylingContext, StylingIndex} from '../interfaces/styling';
|
||||
import {FLAGS, HEADER_OFFSET, HOST, LViewData, RootContext} from '../interfaces/view';
|
||||
import {FLAGS, HEADER_OFFSET, HOST, LView, RootContext} from '../interfaces/view';
|
||||
import {getTNode} from '../util';
|
||||
|
||||
import {CorePlayerHandler} from './core_player_handler';
|
||||
@ -59,20 +59,20 @@ export function allocStylingContext(
|
||||
* @param index Index of the style allocation. See: `elementStyling`.
|
||||
* @param viewData The view to search for the styling context
|
||||
*/
|
||||
export function getStylingContext(index: number, viewData: LViewData): StylingContext {
|
||||
export function getStylingContext(index: number, viewData: LView): StylingContext {
|
||||
let storageIndex = index + HEADER_OFFSET;
|
||||
let slotValue: LContainer|LViewData|StylingContext|RElement = viewData[storageIndex];
|
||||
let wrapper: LContainer|LViewData|StylingContext = viewData;
|
||||
let slotValue: LContainer|LView|StylingContext|RElement = viewData[storageIndex];
|
||||
let wrapper: LContainer|LView|StylingContext = viewData;
|
||||
|
||||
while (Array.isArray(slotValue)) {
|
||||
wrapper = slotValue;
|
||||
slotValue = slotValue[HOST] as LViewData | StylingContext | RElement;
|
||||
slotValue = slotValue[HOST] as LView | StylingContext | RElement;
|
||||
}
|
||||
|
||||
if (isStylingContext(wrapper)) {
|
||||
return wrapper as StylingContext;
|
||||
} else {
|
||||
// This is an LViewData or an LContainer
|
||||
// This is an LView or an LContainer
|
||||
const stylingTemplate = getTNode(index, viewData).stylingTemplate;
|
||||
|
||||
if (wrapper !== viewData) {
|
||||
@ -85,8 +85,8 @@ export function getStylingContext(index: number, viewData: LViewData): StylingCo
|
||||
}
|
||||
}
|
||||
|
||||
function isStylingContext(value: LViewData | LContainer | StylingContext) {
|
||||
// Not an LViewData or an LContainer
|
||||
function isStylingContext(value: LView | LContainer | StylingContext) {
|
||||
// Not an LView or an LContainer
|
||||
return typeof value[FLAGS] !== 'number' && typeof value[ACTIVE_INDEX] !== 'number';
|
||||
}
|
||||
|
||||
@ -158,8 +158,8 @@ export function getOrCreatePlayerContext(target: {}, context?: LContext | null):
|
||||
return null;
|
||||
}
|
||||
|
||||
const {lViewData, nodeIndex} = context;
|
||||
const stylingContext = getStylingContext(nodeIndex - HEADER_OFFSET, lViewData);
|
||||
const {lView, nodeIndex} = context;
|
||||
const stylingContext = getStylingContext(nodeIndex - HEADER_OFFSET, lView);
|
||||
return getPlayerContext(stylingContext) || allocPlayerContext(stylingContext);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user