-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.ts
78 lines (66 loc) · 1.98 KB
/
core.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
export interface TrickleIncrementalCurveRecord {
from: number
to: number
value: number
}
export type TrickleIncrementalCurveFunc = (
currentStatus: number,
) => TrickleIncrementalCurveRecord[] | number
export interface TricklingOptions {
speed?: number
easing?: string
minimum?: number
maximum?: number
showSpinner?: boolean
trickle?: boolean
/**
* trickling speed
*/
trickleSpeed?: number
appendTo?: string | HTMLElement
customWrapperClassName?: string
color?: string
progressBarHeight?: string
spinnerOpacity?: number
spinnerSize?: string
spinnerStrokeWidth?: string
zIndex?: number | string
rtl?: boolean
removeFromDOMWhenDone?: boolean
trickleIncrementalCurve?:
| TrickleIncrementalCurveFunc
| TrickleIncrementalCurveRecord[]
}
export interface TricklingInstance {
status: number | null
positionUsing: string
progressOffsetWidth: number
options: Required<TricklingOptions>
setOptions(opts: TricklingOptions): TricklingInstance
render: (fromStart?: boolean) => HTMLElement
start: () => TricklingInstance
set: (barStatus: number) => TricklingInstance
inc: (amount?: number) => TricklingInstance
trickle: () => TricklingInstance
done: (force?: boolean) => TricklingInstance
remove: (force?: boolean) => void
isRendered: () => boolean
isStarted: () => boolean
barPositionCSS: (
barStatus: number,
speed: number,
ease: string,
) => Record<string, string>
getPositioningCSS: () => 'translate3d' | 'translate' | 'margin'
setPercent: (value: number | null) => void
getPercent: () => number | null
setCSSVars: (target: HTMLElement) => void
getAppendToElement: () => HTMLElement
getBarElement: (target: HTMLElement) => HTMLElement
getWrapperElement(): HTMLElement | null
getBarPercentage(barStatus: number): string
visible(): void
hidden(): void
translateProgressBar(barEl: HTMLElement, fromStart?: boolean): void
}
export type CreateTrickling = (opts?: TricklingOptions) => TricklingInstance