-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize the project by adding native Typescript types. Making a class
TopBar that can be imported as an ESM project. And added container option because I saw in an open issue. Also moved the tooling for minimizing to Rollup which allow minification with terser but aslo Typescript transpilation and differen export module formats
- Loading branch information
1 parent
74b4d71
commit 56c5502
Showing
10 changed files
with
1,246 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,6 @@ lib-cov | |
pids | ||
logs | ||
results | ||
|
||
dist | ||
npm-debug.log | ||
node_modules | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,39 @@ | ||
export interface BarColors { | ||
[key: string]: string | ||
type TopBarOptions = { | ||
container?: HTMLElement; | ||
autoRun?: boolean; | ||
barThickness?: number; | ||
barColors?: Record<string, string>; | ||
shadowBlur?: number; | ||
showShadow?: boolean; | ||
shadowColor?: string; | ||
className?: string; | ||
}; | ||
declare class Topbar { | ||
private container; | ||
private canvas; | ||
private progressTimerId; | ||
private autoRun; | ||
private showing; | ||
private currentProgress; | ||
private barThickness; | ||
private barColors; | ||
private shadowBlur; | ||
private shadowColor; | ||
private className; | ||
private fadeTimerId; | ||
private delayTimerId; | ||
constructor({ container, autoRun, barThickness, barColors, shadowBlur, shadowColor, className, }?: Partial<TopBarOptions>); | ||
show(delay?: number): void; | ||
hide(): void; | ||
progress(to?: number | string): number; | ||
private hideLoop; | ||
private loopShow; | ||
private createCanvas; | ||
private repaint; | ||
} | ||
declare function config(options: Partial<TopBarOptions>): Topbar; | ||
declare function show(delay?: number): void; | ||
declare function hide(): void; | ||
declare function progress(to?: number | string): number; | ||
|
||
export interface TopbarConfigOptions { | ||
autoRun?: boolean | ||
barThickness?: number | ||
barColors?: BarColors | ||
shadowBlur?: number | ||
shadowColor?: string | ||
className?: string | ||
} | ||
|
||
export interface Topbar { | ||
config: (options: TopbarConfigOptions) => void | ||
show: (delay?: number) => void | ||
progress: (to?: number | string) => number | ||
hide: () => void | ||
} | ||
|
||
declare const topbar: Topbar | ||
|
||
export default topbar | ||
export { type TopBarOptions, Topbar, config, hide, progress, show }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.