Mercurial > hg > ugly-duckling
view src/app/waveform/waves-ui.d.ts @ 192:e4f38975c2bc
Introduce interface for reading a file, once again avoiding specific browser implementation.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Thu, 23 Mar 2017 15:42:34 +0000 |
parents | 4a2d21f73b9f |
children | 53ea6406d601 |
line wrap: on
line source
import EventEmitter = NodeJS.EventEmitter; /** * Created by lucas on 01/12/2016. */ declare const AmbientInstance: WavesUserInterface; declare module 'waves-ui' { export default AmbientInstance; } interface WavesUserInterface { core: Core; helpers: any; states: any; utils: Utilities; shapes: any; } interface MatrixEntity { getColumnCount(): number; getColumnHeight(): number; getColumn(n: number): Float32Array | number[]; getStepDuration(): number; getStartTime(): number; dispose(): void; } type TimeContext = any; // TODO interface Area { top: number; left: number; width: number; height: number; } interface Layer extends EventEmitter { destroy(): void; configureTimeContextBehaviour(ctor: ObjectConstructor): void; start: number; offset: number; duration: number; stretchRatio: number; yDomain: number[]; opacity: number; readonly timeToPixel: () => (time: number) => number; readonly valueToPixel: () => (value: number) => number; readonly items: Element[]; data: ArrayLike<any> | Object; setTimeContext(context: TimeContext): void; configureShape(ctor: ObjectConstructor /* TODO BaseShape*/, accessors: Object, options: Object): void; configureCommonShape(ctor: ObjectConstructor /* TODO BaseShape*/, accessors: Object, options: Object): void; setBehaviour(behaviour: Object /* TODO BaseBehavior */): void; readonly selectedItems: Element[]; select(...$items: Element[]); unselect(...$items: Element[]); toggleSelection(...$items: Element[]); edit($items: Element[], dx: number, dy: number, $target: Element): void; setContextEditable(bool: boolean): void; editContext(dx: number, dy: number, $target: Element): void; stretchContext(dx: number, dy: number, $target: Element): void; getItemFromDOMElement($el: Element): Element | null; getDatumFromItem($item: Element): Object | any[] | null; getDatumFromDOMElement($item: Element): Object | any[] | null; hasItem($item: Element): boolean; hasElement($el: Element): boolean; getItemsInArea(area: Area): Element[]; render(): void; update(): void; updateContainer(): void; updateShapes(): void; } interface LayerConstructor { new(dataType: "entity" | "collection", data: ArrayLike<any> | Object, options: Object): Layer; } interface MatrixEntityConstructor { new(): MatrixEntity; } interface PrefilledMatrixEntityConstructor { new(data: Float32Array[] | number[][], startTime: number, stepDuration: number): MatrixEntity; } interface Utilities { MatrixEntity: MatrixEntityConstructor; PrefilledMatrixEntity: PrefilledMatrixEntityConstructor; scales: any; } interface Core { Layer: LayerConstructor; LayerTimeContext: any; // TODO Timeline: any; // TODO TimelineTimeContext: TimelineTimeContextConstructor; } type Timeline = any; interface TimelineTimeContext { pixelsPerSecond: number; readonly computedPixelsPerSecond: number; offset: number; zoom: number; visibleWidth: number; readonly visibleDuration: number; maintainVisibleDuration: boolean; timeToPixel: (time: number) => number; } interface TimelineTimeContextConstructor { new(pixelsPerSecond: number, visibleWidth: number): TimelineTimeContext; }