From: Evert Timberg Date: Sun, 20 Dec 2020 18:26:09 +0000 (-0500) Subject: Split animation definitions (#8208) X-Git-Tag: v3.0.0-beta.8~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec7b38134544b4c13b9bf020ab11d379f283d2d8;p=thirdparty%2FChart.js.git Split animation definitions (#8208) --- diff --git a/types/animation.d.ts b/types/animation.d.ts new file mode 100644 index 000000000..e383e829f --- /dev/null +++ b/types/animation.d.ts @@ -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; +} diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index cfe43bb6a..c8be1c4d8 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -13,10 +13,12 @@ */ import { TimeUnit } from "./adapters"; +import { AnimationEvent } from './animation'; import { Element }from './element'; import { ChartArea, Point } from './geometric'; export { DateAdapterBase, DateAdapter, TimeUnit, _adapters } from './adapters'; +export { Animation, Animations, Animator, AnimationEvent } from './animation'; export { Element } from './element'; export { ChartArea, Point } from './geometric'; @@ -351,37 +353,6 @@ export const RadarController: ChartComponent & { prototype: 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 { type: string; controller: DatasetController;