Fixed types generation
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
src/index.js
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@meteolab/uchart",
|
"name": "@meteolab/uchart",
|
||||||
"publishConfig": { "access": "public" },
|
"publishConfig": { "access": "public" },
|
||||||
"version": "1.0.3",
|
"version": "1.0.5",
|
||||||
"description": "Lightweight charting library for the browser and Node.js",
|
"description": "Lightweight charting library for the browser and Node.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
"module": "./dist/uchart.js",
|
"module": "./dist/uchart.js",
|
||||||
"types": "./dist/uchart.d.ts",
|
"types": "./dist/uchart.d.ts",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
|
"outDir": "./dist",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/uchart.d.ts",
|
"types": "./dist/uchart.d.ts",
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"build:js": "esbuild src/index.ts --bundle --minify --format=esm --outfile=dist/uchart.js",
|
"build:js": "esbuild src/index.ts --bundle --minify --format=esm --outfile=dist/uchart.js",
|
||||||
"build:types": "tsc -p tsconfig.json",
|
"build:types": "tsc --declaration --emitDeclarationOnly",
|
||||||
"build": "npm run clean && npm run build:js && npm run build:types",
|
"build": "npm run clean && npm run build:js && npm run build:types",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"serve": "npx http-server . -c-1 --gzip"
|
"serve": "npx http-server . -c-1 --gzip"
|
||||||
|
|||||||
28
src/index.d.ts
vendored
Normal file
28
src/index.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
export type ChartSeries = {
|
||||||
|
data: [number, number][];
|
||||||
|
strokeColor?: string;
|
||||||
|
};
|
||||||
|
export declare function drawChart(ctx: CanvasRenderingContext2D, seriesList: ChartSeries[], opts: {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
min?: number;
|
||||||
|
max?: number;
|
||||||
|
showYAxis?: boolean;
|
||||||
|
yTicks?: number;
|
||||||
|
backgroundColor?: string;
|
||||||
|
cursorX?: number | null;
|
||||||
|
}): void;
|
||||||
|
export declare function createChartElement(seriesList: ChartSeries[], opts: {
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
min?: number;
|
||||||
|
max?: number;
|
||||||
|
showYAxis?: boolean;
|
||||||
|
yTicks?: number;
|
||||||
|
backgroundColor?: string;
|
||||||
|
}): {
|
||||||
|
element: HTMLDivElement;
|
||||||
|
setSeries(series: ChartSeries[]): void;
|
||||||
|
setOptions(o: Partial<typeof opts>): void;
|
||||||
|
destroy(): void;
|
||||||
|
};
|
||||||
@@ -2,11 +2,13 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES6",
|
"target": "ES6",
|
||||||
"module": "ES6",
|
"module": "ES6",
|
||||||
|
"declaration": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true,
|
||||||
|
"outDir": "./dist"
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user