-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
124 lines (110 loc) · 3.72 KB
/
index.d.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import { Data, Match, Player, Round, Side } from "./lib/data/data"
// TODO check if all options present here
type Options = {
width: string,
height: string,
rootBorderColor: string,
wrapperBorderColor: string,
verticalScrollMode: 'buttons' | 'native' | 'mixed',
scrollButtonsPosition: 'gutters' | 'overMatches',
showScrollbar: boolean,
scrollbarWidth: number,
scrollbarColor: string,
scrollButtonSvgColor: string,
scrollGutterBorderColor: string,
scrollButtonPadding: string,
scrollUpButtonHTML: string,
scrollDownButtonHTML: string,
resetScrollOnNavigation: boolean,
buttonScrollAmount: number,
scrollButtonArrowSize: number,
rootBgColor: string,
mainVerticalPadding: number,
visibleRoundsCount: number,
displayWholeRounds: boolean,
useClassicalLayout: boolean,
disableHighlight: boolean,
roundTitlesVerticalPadding: number,
roundTitlesBorderColor: string,
roundTitleColor: string,
hoveredMatchBorderColor: string,
matchStatusBgColor: string,
navButtonsPosition: 'overMatches' | 'gutters' | 'beforeTitles' | 'overTitles' | 'hidden',
navButtonsTopDistance: string,
navGutterBorderColor: string,
navButtonArrowSize: number,
navButtonSvgColor: string,
leftNavButtonHTML: string,
rightNavButtonHTML: string,
navButtonPadding: string,
rootFontFamily: string,
roundTitlesFontFamily: string,
roundTitlesFontSize: number,
matchTextColor: string,
matchFontSize: number,
playerTitleFontFamily: string,
highlightedPlayerTitleColor: string,
scoreFontFamily: string,
connectionLinesWidth: number,
connectionLinesColor: string,
highlightedConnectionLinesColor: string,
matchMaxWidth: number,
matchMinVerticalGap: number,
matchHorMargin: number,
matchAxisMargin: number,
oneSidePlayersGap: number,
liveMatchBorderColor: string,
liveMatchBgColor: string,
distanceBetweenScorePairs: number,
onMatchClick: (match: Partial<Match>) => void,
onMatchSideClick: (match: Partial<Match>, sideIndex: number) => void,
getRoundTitleElement: (roundData: Round, roundIndex: number) => Element,
getMatchElement: (roundIndex: number, matchOrder: number) => Element | null,
getNationalityHTML: (
player: Player,
context: { roundIndex: number, matchOrder: number, contestantId: string, playerIndex: number }
) => string,
getEntryStatusHTML: (
entryStatus: any,
context: { roundIndex: number, matchOrder: number, contestantId: string }
) => string,
getPlayerTitleHTML: (
player: Player,
context: { roundIndex: number, matchOrder: number, contestantId: string, playerIndex: number }
) => string,
getScoresHTML: (
side: Side,
match: Match
) => string,
getMatchTopHTML: (
match: Match
) => string,
getMatchBottomHTML: (
match: Match
) => string,
}
type OptionsMap = Partial<Options>
export function createBracket(
data: Data,
wrapperElement: Element,
options?: OptionsMap
): {
moveToPreviousRound: () => void
moveToNextRound: () => void
moveToLastRound: () => void
setBaseRoundIndex: (i: number) => void
getNavigationState: () => {
lastRoundIsFullyVisible: boolean,
allRoundsAreVisible: boolean,
baseRoundIndex: number,
maxBaseRoundIndex: number,
visibleRoundsCount: number,
}
applyNewOptions: (newOptions: OptionsMap) => void
getUserOptions: () => OptionsMap
replaceData: (newData: Data) => void
applyMatchesUpdates: (matches: Match[]) => void
getAllData: () => Data
highlightContestantHistory: (contestantId: string | null) => void,
uninstall: () => void
}