diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 85839c6..9375213 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,4 +18,4 @@ jobs: reporter: github-pr-review eslint_flags: "src/" fail_on_error: "true" - level: "warning" \ No newline at end of file + level: "warning" diff --git a/package-lock.json b/package-lock.json index a0eb515..9f84773 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-audio-visualize", - "version": "0.0.3", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "react-audio-visualize", - "version": "0.0.3", + "version": "1.0.0", "license": "MIT", "devDependencies": { "@types/node": "^20.2.1", diff --git a/package.json b/package.json index b1dd5d6..9ceb169 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-audio-visualize", "private": false, - "version": "0.0.3", + "version": "1.0.0", "license": "MIT", "author": "", "repository": { @@ -24,9 +24,7 @@ "visualization" ], "files": [ - "dist", - "README.md", - "assets" + "dist" ], "main": "./dist/react-audio-visualize.umd.js", "module": "./dist/react-audio-visualize.es.js", diff --git a/src/AudioVisualizer/utils.ts b/src/AudioVisualizer/utils.ts index 55cfd76..40a2b68 100644 --- a/src/AudioVisualizer/utils.ts +++ b/src/AudioVisualizer/utils.ts @@ -1,5 +1,15 @@ import { type dataPoint } from "./types"; +interface CustomCanvasRenderingContext2D extends CanvasRenderingContext2D { + roundRect: ( + x: number, + y: number, + w: number, + h: number, + radius: number + ) => void; +} + export const calculateBarData = ( buffer: AudioBuffer, height: number, @@ -68,7 +78,7 @@ export const draw = ( ): void => { const amp = canvas.height / 2; - const ctx = canvas.getContext("2d"); + const ctx = canvas.getContext("2d") as CustomCanvasRenderingContext2D; if (!ctx) return; ctx.clearRect(0, 0, canvas.width, canvas.height); @@ -91,8 +101,6 @@ export const draw = ( const h = amp + dp.max - y; ctx.beginPath(); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error ctx.roundRect(x, y, w, h, 50); ctx.fill(); }); diff --git a/src/LiveAudioVisualizer/utils.ts b/src/LiveAudioVisualizer/utils.ts index 9887997..06771dc 100644 --- a/src/LiveAudioVisualizer/utils.ts +++ b/src/LiveAudioVisualizer/utils.ts @@ -1,3 +1,13 @@ +interface CustomCanvasRenderingContext2D extends CanvasRenderingContext2D { + roundRect: ( + x: number, + y: number, + w: number, + h: number, + radius: number + ) => void; +} + export const calculateBarData = ( frequencyData: Uint8Array, width: number, @@ -35,7 +45,7 @@ export const draw = ( ): void => { const amp = canvas.height / 2; - const ctx = canvas.getContext("2d"); + const ctx = canvas.getContext("2d") as CustomCanvasRenderingContext2D; if (!ctx) return; ctx.clearRect(0, 0, canvas.width, canvas.height); @@ -54,8 +64,6 @@ export const draw = ( const h = dp || 1; ctx.beginPath(); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error ctx.roundRect(x, y, w, h, 50); ctx.fill(); });