Skip to the content

Taisen Brackets対戦

Knockout brackets as SVG, from a list of ties.

Taisen (対戦, たいせん) is Japanese for a matchup: two sides facing each other. About the name

Contents

Reference

Draw a bracket, a table or a road to the final

import { … } from "@johnmorrisdotca/taisen-brackets";

Exports

NameKindWhat it is
abbreviatefunctionA short name for a small box: the initials of a name of several words ("NYR"), else its first three letters; capitals.
advanceWinnersfunctionFills the sides of every tie from the ties that feed it: a decided tie's winner takes its place in the next tie (the loser, for a third-place match).
BACKGROUND_PRESETSconstantThe names of the twenty-five poster backgrounds.
BackgroundImageOptionstypeYour own picture as the background: an image address (http(s), relative or data:image/…; anything else is refused), laid under a veil so the text reads.
BackgroundInktypeThe colours that read well over a background: text, lines, boxes, edges and its dominant colours.
BackgroundOptionstypeA preset, tuned: your own colours (hex or rgb(), the first two the ground), the gradient's angle, how strong the pattern is (0 to 1, default 0.6), a seed for the scattered parts, and which of its two variants.
BackgroundPresetNametypeThe name of one of the poster backgrounds.
backgroundSvgfunctionDraws one of the poster backgrounds.
BackgroundSvgtypeA drawn background: the defs and the body to put in an SVG, and the ink that reads over it.
BackgroundSvgOptionstypeWhat a background is drawn for: its width and height, the theme, colours, angle, intensity and seed.
BOARD_SIZESconstantThe sizes of a board: a TV's 1920 by 1080, a tablet on its side (1280 by 800) and upright (800 by 1280), a phone's 600 by 1300, and the social-card shapes, square (1080) and 4:5 (1080 by 1350).
BoardOptionstypeWhat every board takes.
BoardSizeNametypeThe sizes of a board: tv, tablet, tablet-tall, phone, square and portrait.
BoutAthletetypeOne of the two athletes of a bout.
boutBoardfunctionThe bout presentation board as a standalone SVG.
BoutBoardOptionstypeWhat a bout board can be told: the name style and case, and the options of every broadcast board.
boutBoardSizefunctionThe width and the height of a bout board with officialCount officials: the width given (1280 by default) and a height of 64 + 38 + 10 + 62 + 10 + 38 + 42 an official + 10, in units of the width over 1280.
BoutBoardSourcetypeA bout to draw: the title, the phase, the bout number, the red and blue athletes and the officials.
BoutOfficialtypeA referee or a judge.
BracketInputtypeA bracket's input with its teams listed once: { matchups, teams }.
BracketLayouttypeThe shape of a bracket worked out from its ties: the ties, the halves, the rounds, the rows and the champion.
bracketStylefunctionThe stylesheet of a drawing with these options, for a page that draws the same bracket twice (a desk's size and a phone's): put it in the page once, give each drawing the same styleScope and style: false, and every drawing takes its colours from it.
bracketTablefunctionThe bracket as an HTML table, for a reader the drawing does not serve: one row for every tie, round by round, with the two sides, the score, the winner in bold, the date where the tie has one (written as the language writes dates) and a note.
BROADCAST_LOOKSconstantThe looks: blue (a broadcast's deep blue with a bright title band), night (near black with a cyan band) and paper (white, with the same blue band).
BroadcastIcontypeThe icons of the title band's square, drawn by the package: a medal and a stopwatch.
BroadcastLooktypeThe looks of a broadcast board: blue, night and paper.
BroadcastMedalOptionstypeWhat a broadcast medal table can be told: labels (the codes or the names), ranks, the sort and the rows, and the options of every broadcast board.
broadcastMedalSizefunctionThe width and the height of a broadcast medal table of rowCount rows: the width given (1280 by default) and a height of 64 + 36 + 10 + 48 a row + 10, in units of the width over 1280.
broadcastMedalTablefunctionThe broadcast-style medal table as a standalone SVG.
BroadcastOptionstypeWhat every broadcast board takes: the width, the look, the icon, the flags, the language, a title and an id.
cleanSvgfunctionTakes inline SVG markup from a caller and makes it safe to put inside a drawing: the outer <svg>'s viewBox is kept, and scripts, event handlers, <style>, <foreignObject>, comments and javascript: addresses are removed.
collectTeamsfunctionA bracket's teams: the list given, plus a team made from every id that a matchup names and the list does not.
CONFERENCE_COLORSconstantThe colours of the two halves (conferences) of the layouts that colour them, each with white letters on it: --tb-conf-a and --tb-conf-b.
contrastRatiofunctionThe contrast between two colours, from 1 (the same) to 21 (black on white).
countryNamefunctionThe name of a country in a language, from its ISO 3166 code, through Intl.DisplayNames: no list to write ("DE" is Germany, Allemagne, ドイツ, Alemania, Deutschland).
defineLocalefunctionA language of your own: what you give, on top of the base language's (English unless base says another) for what you leave out.
describeBoutBoardfunctionThe board as a sentence, the drawing's description.
describeBracketfunctionThe text a screen reader gets for the drawing as a whole, in the language of locale.
describeEntryListfunctionThe entry list as a sentence, the drawing's description.
describeJudoCardfunctionThe contest card as a sentence, the drawing's description.
describeJudoContestfunctionThe words of the state in a sentence, for the drawing's description.
describeJudoQueuefunctionThe mat queue as a sentence: for each mat, its contests in order.
describeJudoRoadfunctionThe road as a sentence, the drawing's description.
describeMatchupfunctionThe card as a sentence, the drawing's description.
describeMedalTablefunctionThe table as a sentence, the drawing's description.
describeNumberOnesfunctionThe cards as a sentence, the drawing's description.
describeRankingfunctionThe ranking as a sentence, the drawing's description.
describeResultsBoardfunctionThe board as a sentence, the drawing's description.
describeTiefunctionA tie in a sentence, for a tooltip, a table and a description: "Argentina 3, France 3 (after extra time, 4–2 on penalties).
DetailtypeHow much a box shows: both names and scores, an abbreviation and the score, or only the marks.
drawBracketfunctionDraws a bracket as an SVG string.
DrawOptionstypeEverything a drawing can be told: the layout, look, size, theme, background, language, marks, flags, trophy, links and titles.
EmblemRenderertypeA function from an emblem id and a request to an SVG string; renderEmblem of @johnmorrisdotca/dougu-sports/emblems is one.
EmblemRequesttypeWhat drawBracket asks an emblems renderer for.
EmblemStyletypeHow an emblem is drawn; the names are those of @johnmorrisdotca/dougu-sports.
EntryListOptionstypeWhat an entry list can be told: the sort (entry or ranking), numbers, columns, rows and page.
EntryListSourcetypeAn entry list to draw: a title, a category, a date and the athletes entered, with their rank if they have one.
FAMILY_BACKGROUNDS_VERSIONconstantThe version of the backgrounds the family shares; a change to any picture changes it.
FeedtypeWhat takes a side of a tie: a tie's id (its winner, as feeds always meant) or { tie, result }, which can name the tie's loser as well (a play-in's loser goes on to a decider).
FlagRenderertypeA function from a country code and a request to an SVG string, or null or undefined for a code it has no flag for.
FlagRequesttypeWhat a drawing asks a flags renderer for.
FlagShapetypeHow a flag is framed: round in a circle, square, or rect in its own proportions.
GametypeOne game of a tie: a match of a knockout, a game of a series, a leg of an aggregate, a replay.
GamesOptionstypeHow the games of a flat list are grouped into ties: the stages in order, which one is the third-place match, which are two legs, and how long each series is.
GroupRowtypeOne team's line of a group's table.
groupsTablefunctionThe table of the groups as HTML, for a reader the drawing does not serve: one <table> a group, its caption the group's name, a row a team.
groupStandingsfunctionThe tables of the group stage: one for each group, from the round-robin games (round: 0) of the ties.
GroupTabletypeOne group: its name in the language and its teams, the best first.
isEmblemIdfunctionWhether a trophy value names an emblem ("trophy:hockey-cup", "medal:gold/line") rather than being inline SVG or an image address.
JUDO_BOARD_SIZESconstantThe sizes: a TV's 1920 by 1080, a tablet on its side, 1280 by 800, and a tablet held upright, 800 by 1280.
JUDO_MAT_COLORSconstantThe IJF-style mat colours, in turn: red, green, yellow, purple, orange, teal.
JUDO_WEIGHT_CLASSESconstantThe IJF's senior weight classes in kilograms, the lightest first: a number is "up to and including", a text starting + is "over".
JudoAthletetypeOne athlete on the scoreboard.
JudoBoardOptionstypeWhat a judo board can be told: the size, the theme, the style (board or flip cards), which side is on the left, the coaches, the flags and the language.
JudoBoardSizeNametypeThe sizes of a judo board: tv, tablet and tablet-tall.
judoBracketfunctionThe contests of one judo weight category for any number of athletes, seeded in the standard way (the top seeds have the byes when the number is not a power of two).
JudoBracketOptionstypeWhat judoBracket can be told: the system and a prefix for the ties' ids.
JudoCardContesttypeWhat the contest card shows: the two athletes and the header.
JudoCategorytypeA judo category: the sex and the weight class.
judoCategoryLabelfunctionA weight category as a heading in a language: "Men -66 kg", "Women +78 kg".
judoClockfunctionSeconds as m:ss.
JudoContesttypeThe state of a contest: who is on the mat, what has been scored, and the clock.
judoContestCardfunctionThe contest card: the weight class and the round on top, then the white athlete over the blue one, each as a wide band with the flag, the name as big as the band lets it be, and the country code.
JudoMattypeOne mat: its number or name, its colour (any CSS colour that a hex code gives, default by position) and its contests in the order they will be fought.
judoMatQueuefunctionThe mat queue board: for each mat a big number in the mat's colour and the contests to come, in order, each a row with the contest number, the white athlete and the blue one (name, code, flag).
JudoMethodtypeHow a contest was won.
judoOutcomefunctionChecks a result against the rules and works out who won and how.
JudoOutcometypeA result checked and worked out.
judoPodiumfunctionThe gold, silver and two bronze medals of a bracket (matchups, input or layout), from the final, the bronze medal contests or the semi-finals.
JudoPodiumtypeThe medallists of a judo tournament, as far as it has been fought.
JudoQueueContesttypeOne contest of a mat's queue: its number ("G-24", 24) and the two athletes, and optionally the weight class and the round (for a caption).
JudoQueueOptionstypeWhat a mat queue can be told: the size, the theme, how many rows, whether the first contest is marked as the current one, and the mat colours.
JudoResulttypeThe result of one judo contest, the sides in the order of the matchup's sides: the first is white, the second blue.
JudoRoadOptionstypeWhat a road panel can be told: the weight class, the side's colour, the order of the wins, how many rows, the size, the theme and the language.
judoRoadPanelfunctionThe road-to-the-final panel for an athlete: their block (flag, name, code, coach) in the colour of a judogi, and a row for each contest won, most recent first: the round, the opponent's flag, code and name, and how it was won.
JudoRoadSourcetypeWhat a road panel shows: the athlete and the contests they won.
judoScoreboardfunctionThe scoreboard of a contest as an SVG string.
judoSecondsfunctionA time as seconds: a number, or "m:ss".
JudoSidetypeWhat one side scored in a contest.
JudoSystemtypeHow a judo tournament is drawn: repechage (the IJF's quarter-final repechage, with its two bronze medal contests), or direct (a direct knockout in which both semi-final losers are bronze medallists).
JudoWintypeOne win on the road: the round it was in, the opponent (none for a bye), and how it was won in words ("ippon · 1:12", "decision · GS · 5:12", or a score).
judoWinsfunctionThe contests an athlete has won in a bracket, oldest first, with a bye for each round skipped at the start: the opponent, the round (a repechage and a bronze medal contest are named as such) and how it was won, from the judo result's notes or the score.
JudoWinsOptionstypeWhat judoWins can be told: the language, the round names, how to make an athlete of a team, and whether byes are listed.
LayoutBoxtypeA tie's place in the tree.
layoutBracketfunctionThe shape of a knockout, worked out from its ties: which tie feeds which (a winner goes on to the next tie its team plays, or the tie that feeds names), the rounds, which half each tie sits in, and which side has a bye.
LayoutNametypeHow the ties are drawn: tree (the default) is the bracket as ever; the others are other ways to draw the same ties.
LayoutOptionstypeWhat layoutBracket can be told: the shape (halves or left to right) and the order of the groups.
LAYOUTSconstantThe names of the layouts, the tree first.
LayoutSidetypeOne half of a bracket: its boxes, its rows and the name of its group.
LeaguetypeA league with a playoff format by era: nhl, nba, mlb, nfl, cfl, mls or worldcup.
LEAGUE_EMBLEMSconstantThe emblem each league's champion gets by default: an id of @johnmorrisdotca/dougu-sports (generic forms, no league's own mark).
LEAGUESconstantThe leagues that have a format here.
LocaletypeA language: its words, the names of the rounds (by their English names), and the tag Intl formats numbers and dates for.
LOCALE_CODESconstantThe codes of the built-in languages, English first.
localeOffunctionThe language an option names: a code of a built-in one, or a Locale.
LOCALESconstantThe built-in languages, by code.
localizedLayoutfunctionThe layout with each team's name in the language: what the drawing, the table and the description are written from.
LooktypeHow a bracket is drawn: classic (the default) or road, with large round marks, big scores and a dotted path.
MatchuptypeOne tie: two sides and who went through.
MatchupKindtypeHow a tie is contested.
MatchupOptionstypeWhat a matchup board can be told: how many meetings are listed, the name and rank style, the precision, and the options of every board.
matchupRecordfunctionThe record of the meetings: how many each athlete won.
matchupsFromGamesfunctionMatchups from a flat list of games: the games of one pair in one stage become one tie (a replay, two legs or a series), the stage orders the rounds, and the third-place stage becomes the third-place match.
MatchupSourcetypeA matchup to draw: the two athletes with their ranks and points, and their earlier meetings.
MedalAwardtypeA medal won: who won it and what kind, with whatever you filter on.
MedalFiltertypeWhat tallyMedals keeps: awards equal to every field given.
medalRanksfunctionThe ranks of a list of rows, as medalTable draws them ([1, 2, 2, 4]), in the order they are drawn.
MedalRowtypeOne row of a medal table: a country or a team and its medals.
medalTablefunctionThe medal table as an SVG.
MedalTableOptionstypeWhat a medal table can be told: the sort (gold, total or given), ties, how many rows, columns, highlighting, and the options of every board.
MedalTableSourcetypeA medal table to draw: the title, the sport or event, the date, the source and the rows.
noteLongfunctionThe notes of a tie written out, for a sentence or a table: "after extra time", "4–2 on penalties".
notePartsfunctionThe pieces of a note under a tie's score, short: "a.e.t.", "pens", "in 7", "agg.".
NUMBER_ONE_COLORSconstantOrange, crimson, blue, teal, purple and amber, each dark enough for white type (4.5 to 1 or better).
NumberOnesOptionstypeWhat the number-ones board can be told: the columns, the card colours, and the options of every board.
NumberOnesSourcetypeThe number ones to draw: a title, a date, a source and one card for each category.
PalettetypeThe colours of one look.
PlacetypeWhere the layout put a tie.
PlayedGametypeOne played game, in the flat shape that most data sources give.
playoffErasfunctionEvery era of a league, oldest first.
playoffFormatfunctionThe playoff format of a league in a season (or a World Cup in its year), or null when there was none or this package does not cover it.
PlayoffFormattypeA league's playoff format in one era: the years it ran, its rounds, how many teams it took, its byes and its sources.
PlayoffRoundtypeOne round of a playoff format: its name and how many games a series is (null for a single game).
RankingCardtypeA category and its number one.
rankingCategoryLabelfunctionA category as a heading ("U18 · Men -60 kg"): an age group, a sex and a weight, any of them, joined by a dot.
RankingEntrytypeOne line of a ranking.
rankingEntryListfunctionAn event's entry list: a numbered row for each athlete in the order of the draw, with the flag, the name and club, the country's letters and the athlete's ranking (NR for none) at the right.
rankingListfunctionThe ranking list as an SVG.
rankingMatchupfunctionThe head-to-head card for two athletes and their meetings.
RankingMeetingtypeOne previous meeting of the two athletes.
RankingNametypeA name in two parts: the family name is written in capitals and first by default (SURNAME Given, as judo and the IJF write it).
rankingNumberOnesfunctionThe number ones as cards in a grid: a coloured panel with the 1, the flag, the name and the club or country, the points and a pill that says "#1 in -57 kg".
RankingOptionstypeWhat a ranking can be told: the style (podium, list or featured), rows and page, columns, movement arrows, name and rank style, and the size, theme and language.
rankingRanksfunctionThe ranks of a list, in order: an entry's own rank, else its position, with equal points sharing a rank; null for a champion row.
RankingSourcetypeA ranking to draw: the title, the category, the date, the source and the entries.
resolveBackgroundfunctionReads the background option for a drawing width by height in the look theme, with prefix for the ids.
ResolvedBackgroundtypeA background ready to put in a drawing: its definitions, its body and the ink that reads over it.
resolveMatchupfunctionOne matchup as a tie: sides resolved to teams, the winner and the result worked out.
ResulttypeWhat a tie came to, worked out from its games.
resultsBoardfunctionThe results board as a standalone SVG.
ResultsBoardOptionstypeWhat a results board can be told: the width, the look, the icon, the rank style, the name style and case, and the language.
resultsBoardSizefunctionThe width and the height of a results board with rowCount rows: the width given (1280 by default) and a height of 64 + 36 + 20 + 54 a row, in units of the width over 1280.
ResultsBoardSourcetypeA results board to draw: the title, the phase, the columns and the rows.
ResultsColumntypeA column of scores: its heading in the sub bar, and the decimals of its numbers.
ResultsRowtypeOne line of a results board.
ROAD_THEMESconstantThe road look's colours for each theme: light, dark and poster.
RoadCharttypeWhat roadToFinal gives back.
RoadDecidedtypeHow a match was decided: ft (full time, the default), aet (after extra time) or pens (a shoot-out after extra time).
RoadFinaltypeThe final, when it has been played.
RoadFinalisttypeA finalist: a team and the matches it played on the way, the earliest first.
RoadGroupMatchtypeOne match of the group stage: as a knockout match, without a round.
RoadInputtypeWhat roadToFinal takes: the two finalists with their paths, or a tournament (a list of matchups, { matchups, teams } or a layout) whose final has two sides.
RoadMatchtypeOne match on a finalist's way.
RoadOptionstypeWhat roadToFinal takes besides the finalists or the tournament.
RoadPalettetypeWhat the road look adds to a palette: the ring and the hairline round a mark, the pill behind a round's name, and the road's dots.
RoadRecordtypeOne finalist's record on the way.
RoadScoretypeA match's score from the finalist's side: [for, against] (numbers, or text such as a series' 4), or one text, "4-2", that is split at its dash.
RoadSizetypeThe sizes of the road chart are the bracket's: card (the default here), square, wide (the finalists at the two ends) and phone.
RoadTeamtypeA team of a road chart: a Team whose id is optional (a standalone finalist needs only a name), with logo as another name for mark.
roadToFinalfunctionThe road to the final: the two finalists as large round marks with their names at the top, each one's matches on its side (the round mark of both teams with the score between them, and FT, AET or the shoot-out under it), the round names down the middle, and the group stage as a compact row of small marks, codes and scores.
RoadTotalstypeThe numbers behind a road chart.
roundLabelfunctionThe name of round round (1 is the first) of a layout, from the names given (which may be only the last rounds) or the generic ones.
roundNamefunctionThe name of a round that has remaining teams left in it, counting from the final: Final, Semi-finals, Quarter-finals, Round of 16…
roundNamesForfunctionThe generic names of count rounds, first round first: roundNamesFor(3) is Quarter-finals, Semi-finals, Final.
safeHreffunctionWhether an address may be a link in a drawing: http(s), a relative path or a # fragment.
safeUrlfunctionWhether an image address is one a drawing will load: http(s), a relative path, or a data:image/.
SideIdtypeA side's key: a team code, a franchise id, anything that is unique within one bracket.
singleEliminationfunctionThe matchups of a single-elimination bracket for any number of teams, seeded in the standard way: the top seeds meet the lowest first, and when the number is not a power of two the top seeds have byes.
SingleEliminationOptionstypeWhat singleElimination can be told.
SizetypeA size in pixels: a width and, when it is not worked out from the drawing, a height.
SizeNametypeThe sizes a drawing has by name: wide, square, card and phone.
SIZESconstantThe sizes by name.
SourcetypeWhere a side of a tie comes from: the winner or the loser of the tie at tie (its index).
standardSeedsfunctionThe seeds in the order a standard bracket lists them, so that 1 meets 2 only in the final and the top seeds meet the bottom ones first: standardSeeds(8) is [1, 8, 4, 5, 2, 7, 3, 6].
TableOptionstypeWhat bracketTable can be told: the language and words, the round names, a caption and a class.
tallyMedalsfunctionAdds up a list of medals into the rows of a table, one row for each name, keeping the first flag, mark, code and note given for it.
TeamtypeA side of a tie: a team, with the marks and labels a drawing needs.
ThemeNametypeThe colours of a drawing: auto follows the page's light or dark, light, dark, poster is dark with gold lines, and none writes no style, for your own CSS.
THEMESconstantThe looks.
TietypeA tie as the layout knows it.
VERSIONconstantThe package's version.
VoicetypeA language ready to write with: the words with any replacements, and the formats.
voiceOffunctionBuilds the voice of a drawing from its locale, words and teamName options.
WordstypeThe words a drawing and a table use, in one language.
WORDSconstantThe English words, as they were before there were languages.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/taisen-brackets 0.20.0.