From 3ef4d8a690b0efa1b3d812dae83a4289e8d17807 Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Fri, 5 Aug 2022 10:15:17 -0700 Subject: [PATCH] refactor(core): drop unused animation-related types (#47054) This commit removes animation-related types that are no longer used after the `RootContext` cleanup. PR Close #47054 --- .../core/src/core_render3_private_export.ts | 6 - packages/core/src/render3/component_ref.ts | 2 - .../core/src/render3/interfaces/player.ts | 133 ------------------ 3 files changed, 141 deletions(-) delete mode 100644 packages/core/src/render3/interfaces/player.ts diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index 264683d7968..e5f15b475ee 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -218,12 +218,6 @@ export { export { setDocument as ɵsetDocument } from './render3/interfaces/document'; -export { - Player as ɵPlayer, - PlayerFactory as ɵPlayerFactory, - PlayerHandler as ɵPlayerHandler, - PlayState as ɵPlayState, -} from './render3/interfaces/player'; export { compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, diff --git a/packages/core/src/render3/component_ref.ts b/packages/core/src/render3/component_ref.ts index 66e40d38a17..647328855ae 100644 --- a/packages/core/src/render3/component_ref.ts +++ b/packages/core/src/render3/component_ref.ts @@ -32,7 +32,6 @@ import {reportUnknownPropertyError} from './instructions/element_validation'; import {addToViewTree, createLView, createTView, getOrCreateTComponentView, getOrCreateTNode, initTNodeFlags, instantiateRootComponent, invokeHostBindingsInCreationMode, locateHostElement, markAsComponentHost, markDirtyIfOnPush, registerHostBindingOpCodes, renderView, setInputsForProperty} from './instructions/shared'; import {ComponentDef, RenderFlags} from './interfaces/definition'; import {PropertyAliasValue, TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeType} from './interfaces/node'; -import {PlayerHandler} from './interfaces/player'; import {Renderer, RendererFactory} from './interfaces/renderer'; import {RElement, RNode} from './interfaces/renderer_dom'; import {CONTEXT, HEADER_OFFSET, LView, LViewFlags, RootContext, TVIEW, TViewType} from './interfaces/view'; @@ -43,7 +42,6 @@ import {enterView, getCurrentTNode, getLView, leaveView, setSelectedIndex} from import {computeStaticStyling} from './styling/static_styling'; import {setUpAttributes} from './util/attrs_utils'; import {stringifyForError} from './util/stringify_utils'; -import {getRootContext} from './util/view_traversal_utils'; import {getTNode} from './util/view_utils'; import {RootViewRef, ViewRef} from './view_ref'; diff --git a/packages/core/src/render3/interfaces/player.ts b/packages/core/src/render3/interfaces/player.ts deleted file mode 100644 index cd4c5187967..00000000000 --- a/packages/core/src/render3/interfaces/player.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @license - * Copyright Google LLC 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 - */ - -/** - * A shared interface which contains an animation player - */ -export interface Player { - parent?: Player|null; - state: PlayState; - play(): void; - pause(): void; - finish(): void; - destroy(): void; - addEventListener(state: PlayState|string, cb: (data?: any) => any): void; -} - -export const enum BindingType { - Unset = 0, - Class = 1, - Style = 2, -} - -export interface BindingStore { - setValue(prop: string, value: any): void; -} - -/** - * Defines the shape which produces the Player. - * - * Used to produce a player that will be placed on an element that contains - * styling bindings that make use of the player. This function is designed - * to be used with `PlayerFactory`. - */ -export interface PlayerFactoryBuildFn { - (element: HTMLElement, type: BindingType, values: {[key: string]: any}, isFirstRender: boolean, - currentPlayer: Player|null): Player|null; -} - -/** - * Used as a reference to build a player from a styling template binding - * (`[style]` and `[class]`). - * - * The `fn` function will be called once any styling-related changes are - * evaluated on an element and is expected to return a player that will - * be then run on the element. - * - * `[style]`, `[style.prop]`, `[class]` and `[class.name]` template bindings - * all accept a `PlayerFactory` as input and this player factories. - */ -export interface PlayerFactory { - '__brand__': 'Brand for PlayerFactory that nothing will match'; -} - -export interface PlayerBuilder extends BindingStore { - buildPlayer(currentPlayer: Player|null, isFirstRender: boolean): Player|undefined|null; -} - -/** - * The state of a given player - * - * Do not change the increasing nature of the numbers since the player - * code may compare state by checking if a number is higher or lower than - * a certain numeric value. - */ -export const enum PlayState { - Pending = 0, - Running = 1, - Paused = 2, - Finished = 100, - Destroyed = 200 -} - -/** - * The context that stores all the active players and queued player factories present on an element. - */ -export interface PlayerContext extends Array { - [PlayerIndex.NonBuilderPlayersStart]: number; - [PlayerIndex.ClassMapPlayerBuilderPosition]: PlayerBuilder|null; - [PlayerIndex.ClassMapPlayerPosition]: Player|null; - [PlayerIndex.StyleMapPlayerBuilderPosition]: PlayerBuilder|null; - [PlayerIndex.StyleMapPlayerPosition]: Player|null; -} - -/** - * Designed to be used as an injection service to capture all animation players. - * - * When present all animation players will be passed into the flush method below. - * This feature is designed to service application-wide animation testing, live - * debugging as well as custom animation choreographing tools. - */ -export interface PlayerHandler { - /** - * Designed to kick off the player at the end of change detection - */ - flushPlayers(): void; - - /** - * @param player The player that has been scheduled to run within the application. - * @param context The context as to where the player was bound to - */ - queuePlayer(player: Player, context: ComponentInstance|DirectiveInstance|HTMLElement): void; -} - -export const enum PlayerIndex { - // The position where the index that reveals where players start in the PlayerContext - NonBuilderPlayersStart = 0, - // The position where the player builder lives (which handles {key:value} map expression) for - // classes - ClassMapPlayerBuilderPosition = 1, - // The position where the last player assigned to the class player builder is stored - ClassMapPlayerPosition = 2, - // The position where the player builder lives (which handles {key:value} map expression) for - // styles - StyleMapPlayerBuilderPosition = 3, - // The position where the last player assigned to the style player builder is stored - StyleMapPlayerPosition = 4, - // The position where any player builders start in the PlayerContext - PlayerBuildersStartPosition = 1, - // The position where non map-based player builders start in the PlayerContext - SinglePlayerBuildersStartPosition = 5, - // For each player builder there is a player in the player context (therefore size = 2) - PlayerAndPlayerBuildersTupleSize = 2, - // The player exists next to the player builder in the list - PlayerOffsetPosition = 1, -} - -export declare type ComponentInstance = {}; -export declare type DirectiveInstance = {};