Split animation definitions (#8208)

This commit is contained in:
Evert Timberg 2020-12-20 13:26:09 -05:00 committed by GitHub
parent 544f50888e
commit ec7b381345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 31 deletions

31
types/animation.d.ts vendored Normal file
View File

@ -0,0 +1,31 @@
import { Chart } from './index.esm';
export class Animation {
constructor(cfg: any, target: any, prop: string, to?: any);
active(): boolean;
update(cfg: any, to: any, date: number): void;
cancel(): void;
tick(date: number): void;
}
export interface AnimationEvent {
chart: Chart;
numSteps: number;
currentState: number;
}
export class Animator {
listen(chart: Chart, event: 'complete' | 'progress', cb: (event: AnimationEvent) => void): void;
add(chart: Chart, items: readonly Animation[]): void;
has(chart: Chart): boolean;
start(chart: Chart): void;
running(chart: Chart): boolean;
stop(chart: Chart): void;
remove(chart: Chart): boolean;
}
export class Animations {
constructor(chart: Chart, animations: {});
configure(animations: {}): void;
update(target: any, values: any): undefined | boolean;
}

33
types/index.esm.d.ts vendored
View File

@ -13,10 +13,12 @@
*/ */
import { TimeUnit } from "./adapters"; import { TimeUnit } from "./adapters";
import { AnimationEvent } from './animation';
import { Element }from './element'; import { Element }from './element';
import { ChartArea, Point } from './geometric'; import { ChartArea, Point } from './geometric';
export { DateAdapterBase, DateAdapter, TimeUnit, _adapters } from './adapters'; export { DateAdapterBase, DateAdapter, TimeUnit, _adapters } from './adapters';
export { Animation, Animations, Animator, AnimationEvent } from './animation';
export { Element } from './element'; export { Element } from './element';
export { ChartArea, Point } from './geometric'; export { ChartArea, Point } from './geometric';
@ -351,37 +353,6 @@ export const RadarController: ChartComponent & {
prototype: RadarController; prototype: RadarController;
new (chart: Chart, datasetIndex: number): RadarController; new (chart: Chart, datasetIndex: number): RadarController;
}; };
export class Animation {
constructor(cfg: any, target: any, prop: string, to?: any);
active(): boolean;
update(cfg: any, to: any, date: number): void;
cancel(): void;
tick(date: number): void;
}
export interface AnimationEvent {
chart: Chart;
numSteps: number;
currentState: number;
}
export class Animator {
listen(chart: Chart, event: 'complete' | 'progress', cb: (event: AnimationEvent) => void): void;
add(chart: Chart, items: readonly Animation[]): void;
has(chart: Chart): boolean;
start(chart: Chart): void;
running(chart: Chart): boolean;
stop(chart: Chart): void;
remove(chart: Chart): boolean;
}
export class Animations {
constructor(chart: Chart, animations: {});
configure(animations: {}): void;
update(target: any, values: any): undefined | boolean;
}
export interface ChartMeta<TElement extends Element = Element, TDatasetElement extends Element = Element> { export interface ChartMeta<TElement extends Element = Element, TDatasetElement extends Element = Element> {
type: string; type: string;
controller: DatasetController; controller: DatasetController;