Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannchie committed Nov 26, 2020
1 parent c92cb85 commit e8258ea
Show file tree
Hide file tree
Showing 127 changed files with 864 additions and 49 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,10 @@ test/data/country-meta.csv
*.mov
*.csv
*.mp4
*.temp.*
*.temp.*

lib

dist

*.map
19 changes: 2 additions & 17 deletions dist/anichart.js

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@
"author": "jannchie <[email protected]>",
"license": "MIT",
"private": false,
"main": "dist/anichart.js",
"main": "lib/index.js",
"unpkg": "dist/anichart.js",
"jsdelivr": "dist/anichart.js",
"types": "type/index.d.ts",
"types": "typings/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/Jannchie/anichart.js.git"
},
"files": [
"dist/**/*.js",
"type/**/*.d.ts"
"lib/**/*",
"typings/**/*",
"src/**/*"
],
"scripts": {
"build": "webpack --config webpack.prod.js --optimize-minimize",
"build": "tsc & webpack --config webpack.prod.js",
"deploy": "npm version prerelease & npm publish",
"serve": "webpack-dev-server --open --config webpack.dev.js",
"dev": "webpack --config webpack.dev.js",
"watch": "webpack --watch --config webpack.dev.js"
Expand Down Expand Up @@ -86,4 +89,4 @@
"data",
"visualization"
]
}
}
3 changes: 0 additions & 3 deletions src/charts/bar.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/components/chart-compoment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export abstract class ChartCompoment extends Group implements Chart {
valueKey = "value";
idKey = "id";
colorKey = "id";
components: Component[] = [];
async loadData(path: string | any): Promise<void> {
this.hinter.drawHint("Loading Data...");
this.data = await this.readCsv(path);
Expand Down
3 changes: 0 additions & 3 deletions src/ctx.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
export * from "./charts";
export * from "./base";
export * from "./components";
import Bar from "./charts/bar";
export { Bar };
14 changes: 9 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"compilerOptions": {
"outDir": "./types/",
"sourceMap": true,
"outDir": "lib",
"declarationDir": "typings",
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"declarationMap": true,
"declaration": true,
"inlineSourceMap": true,
"typeRoots": [
"./src/**/*",
"./types/**/*",
"./typings/**/*",
"./node_modules/@types"
],
"moduleResolution":"Node"
"moduleResolution":"Node",
"allowJs": true
},
"compileOnSave": true,
"include": [
"./src/**/*", "@types", "./types/**/*"
"./src/**/*", "@types", "typings/**/*"
],
}
37 changes: 37 additions & 0 deletions typings/anichart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export class BaseAniChart {
metaData: any[];
data: any[];
ffmpeg: any;
pngToMp4: typeof pngToMp4;
setOptions(options: any): void;
innerMargin: {
left: any;
right: any;
top: any;
bottom: any;
};
loadImages(metaData: any, imgDict: any, imgData: any): Promise<void>;
imageDict(): any;
getColor(data: any): any;
label(data: any): any;
colorKey(data: any): any;
selectCanvas(selector?: string): Promise<void>;
canvas: Element | Window | Document | import("canvas").Canvas | import("d3-selection").EnterElement;
ctx: any;
initCanvas(parent?: string): Promise<void>;
hintText(txt: any, self?: BaseAniChart): Promise<void>;
play(): Promise<void>;
player: boolean | import("d3-timer").Timer;
readyToDraw(): Promise<void>;
useCtl: boolean;
ctl: Ctl;
ready: boolean;
drawFrame(n: any): Promise<void>;
outputPngs(): Promise<void>;
currentFrame: any;
outputMp4(): Promise<void>;
outputPng(n: any, name: any, fs: any, path: any): Promise<void>;
}
import { pngToMp4 } from "./ffmpeg";
import Ctl from "./ctl";
//# sourceMappingURL=anichart.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export declare abstract class BaseScene implements Playable, Hintable {
setCanvas(selector?: string): void;
update(): void;
}
//# sourceMappingURL=base-scene.d.ts.map
1 change: 1 addition & 0 deletions types/base/index.d.ts → typings/base/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./scene";
export * from "./series";
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions types/base/scene.d.ts → typings/base/scene.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export declare class Scene extends BaseScene {
private init;
addComponent(c: Component): void;
}
//# sourceMappingURL=scene.d.ts.map
1 change: 1 addition & 0 deletions types/base/series.d.ts → typings/base/series.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export declare class Series extends BaseScene {
addScene(s: Scene): void;
update(): void;
}
//# sourceMappingURL=series.d.ts.map
87 changes: 87 additions & 0 deletions typings/charts/bar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
export default AniBarChart;
declare class AniBarChart extends BaseAniChart {
constructor(options?: {});
imagePath: string;
language: string;
width: number;
height: number;
frameRate: number;
outerMargin: {
left: number;
right: number;
top: number;
bottom: number;
};
freeze: number;
colorThief: any;
interval: number;
barRedius: number;
itemCount: number;
labelPandding: number;
axisTextSize: number;
tickNumber: number;
dateLabelSize: number;
slogenSize: number;
output: boolean;
outputName: string;
idField: string;
keyFrameDeltaTime: any;
colorData: any[];
barInfo: (data: any) => any;
xDomain: (series: any) => any[];
sort: number;
valueFormat: (d: any) => string;
tickFormat: (val: any) => string;
dateFormat: string;
listImageSrc: () => any[];
imageData: {};
colorScheme: {
background: string;
colors: string[];
};
colorGener: Generator<string, never, unknown>;
numberKey: Set<any>;
drawBarExt: () => void;
drawExt: () => void;
barHeight: number;
loadMetaData(path: any): Promise<void>;
readCsv(path: any): Promise<import("d3-dsv").DSVRowArray<string>>;
loadCsv(path: any): Promise<void>;
getCurrentDate: import("d3-scale").ScaleLinear<number, number, never>;
id: string;
keyFramesCount: number;
tsToFi: import("d3-scale").ScaleLinear<number, number, never>;
fiToTs: import("d3-scale").ScaleLinear<number, number, never>;
calculateFrameData(data: any): void;
maxValue: any;
minValue: any;
maxData: any;
minData: any;
frameData: any[][];
idSet: Set<any>;
setKeyFramesInfo(): void;
totalTrueFrames: number;
keyFrames: number[];
preRender(): Promise<void>;
autoGetColorFromImage(key: any, src: any): Promise<void>;
/**
* Convolution 卷积
*
* @param {Set} idSet
* @param {List} frameData
*/
calPosition(idSet: Set<any>, frameData: any): void;
getKeyFrame(i: any): number[];
calScale(): void;
tickArrays: number[][];
drawAxis(n: any, cData: any): void;
drawTick(xScale: any, val: any): void;
drawWatermark(): void;
drawDate(n: any): void;
drawBackground(): void;
downloadBlob(blob: any, name?: string): void;
calRenderSort(): void;
fixAlpha(): Promise<void>;
}
import { BaseAniChart } from "../anichart";
//# sourceMappingURL=bar.d.ts.map
1 change: 1 addition & 0 deletions types/charts/index.d.ts → typings/charts/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./bar";
export * from "./line";
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions types/charts/line.d.ts → typings/charts/line.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ export declare class LineChart extends ChartCompoment {
render(): void;
private findY;
}
//# sourceMappingURL=line.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export declare class Background extends BaseComponent {
preRender(): void;
render(): void;
}
//# sourceMappingURL=background.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ export declare abstract class BaseComponent implements Component, Hintable {
draw(): void;
protected getValue(obj: any, n: number): any;
}
//# sourceMappingURL=base-component.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export declare class BlurText extends FadeText {
preRender(): void;
render(): void;
}
//# sourceMappingURL=blur-text.d.ts.map
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { DSVRowArray } from "d3-dsv";
import { Chart } from "./chart-interface";
import { Component } from "./component";
import { GroupComponent as Group } from "./group";
export declare abstract class ChartCompoment extends Group implements Chart {
dateKey: string;
valueKey: string;
idKey: string;
colorKey: string;
components: Component[];
loadData(path: string | any): Promise<void>;
update(option?: any): void;
private readCsv;
loadMeta(path: string | any): Promise<void>;
data: DSVRowArray<string>;
meta: DSVRowArray<string>;
}
//# sourceMappingURL=chart-compoment.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export interface Chart {
loadData: LoadCsvFunc;
loadMeta: LoadCsvFunc;
}
//# sourceMappingURL=chart-interface.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ interface Component extends Fontable, Shadowable, Hintable {
hinter: Hinter;
}
export { Component };
//# sourceMappingURL=component.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ declare class FadeText extends Text {
update(options?: FadeTextOptions): void;
}
export { FadeText };
//# sourceMappingURL=fade-text.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export declare class GroupComponent extends BaseComponent implements Groupable {
update(options?: any): void;
draw(): void;
}
//# sourceMappingURL=group.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export declare class ImageComponent extends BaseComponent {
update(options?: ImageComponentOptions): Promise<void>;
render(): void;
}
//# sourceMappingURL=image.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export { ImageComponent } from "./image";
export { RiseText } from "./rise-text";
export { TextLines } from "./text-lines";
export { Text } from "./text";
//# sourceMappingURL=index.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ declare class RiseText extends FadeText {
render(): void;
}
export { RiseText };
//# sourceMappingURL=rise-text.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export declare class TextLines extends GroupComponent implements Fontable {
constructor(options: TextLinesOptions);
update(options?: TextLinesOptions): void;
}
//# sourceMappingURL=text-lines.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ declare class Text extends BaseComponent {
render(): void;
}
export { Text };
//# sourceMappingURL=text.d.ts.map
9 changes: 9 additions & 0 deletions typings/ctl.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default Ctl;
declare class Ctl {
addCtl(aniChart: any): void;
ctlCurrentFrame: import("d3-selection").Selection<HTMLInputElement, any, HTMLElement, any>;
slider: HTMLInputElement;
updateCtl(aniChart: any): void;
updateCtlCFrame(aniChart: any): void;
}
//# sourceMappingURL=ctl.d.ts.map
2 changes: 2 additions & 0 deletions typings/ctx.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export default function enhanceCtx(ctx: any): void;
//# sourceMappingURL=ctx.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export declare class DefaultColorPicker implements ColorPicker {
getColor(key: string): string;
getNewColor(): string;
}
//# sourceMappingURL=default-color-picker.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export declare class DefaultComponentManager implements ComponentManager {
components: Component[];
addComponent(c: Component): void;
}
//# sourceMappingURL=default-component-manager.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export declare class DefaultHinter implements Hinter {
height: number;
drawHint(msg: string): Promise<void>;
}
//# sourceMappingURL=default-hinter.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export declare class DefaultPlayer implements Player {
drawFrame(frame: number): void;
play(): void;
}
//# sourceMappingURL=default-player.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export declare class DefaultRenderer implements Renderer {
setCanvas(selector?: string): EnhancedCanvasRenderingContext2D;
private initCanvas;
}
//# sourceMappingURL=defaut-renderer.d.ts.map
Loading

0 comments on commit e8258ea

Please sign in to comment.