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

RankingOptionstype

What 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.

Import it

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

Definition

interface RankingOptions extends BoardOptions {
    style?: "podium" | "list" | "featured";
    big?: number;
    columns?: 1 | 2;
    rows?: number;
    page?: number;
    split?: boolean;
    medals?: boolean;
    movement?: "arrow" | "row" | "both" | "none";
    nameStyle?: "surname-first" | "given-first" | "as-is";
    rankStyle?: "plain" | "hash";
    precision?: number;
    ties?: boolean;
    sort?: "given" | "points";
    categories?: boolean;
    badge?: boolean;
}

Members

NameTypeDescription
style (optional)"podium" | "list" | "featured" | undefined

podium (the default): the top three as big rows, tinted gold, silver and bronze, above the compact rest. featured: one big row above two columns. list: every row compact.

big (optional)number | undefined

How many rows, from the top, are big (0 to 3). Default by style. Only on the first page.

columns (optional)2 | 1 | undefined

One column or two for the compact rows (the first column runs down before the second starts). Default 1, and 2 for featured.

rows (optional)number | undefined

The most entries drawn, from the first of the page. Default: as many as fit at a readable size.

page (optional)number | undefined

Which page of rows entries (0 is the first). The header says which entries are shown.

split (optional)boolean | undefined

On a wide board (at least 3:2) the big rows go in a panel on the left and the compact ones beside them, in place of one above the other. Default true; false stacks them.

medals (optional)boolean | undefined

Tint the rows of ranks 1 to 3 gold, silver and bronze. Default: on for podium and featured (off when the list has a champion row), off for list.

movement (optional)"none" | "arrow" | "row" | "both" | undefined

How movement is shown: arrow (an arrow and the number of places, the default), row (the row tinted green or red), both, or none.

nameStyle (optional)"surname-first" | "given-first" | "as-is" | undefined

surname-first (the default: SURNAME Given), given-first (Given SURNAME) or as-is, for a name given in two parts.

rankStyle (optional)"plain" | "hash" | undefined

plain (10, the default) or hash (#10).

precision (optional)number | undefined

Decimals for numeric points (2 writes 91.60 and 50.00). Default: as many as the number has, up to three.

ties (optional)boolean | undefined

Equal points share a rank where an entry names none (1, 2, 2, 4). Default true.

sort (optional)"points" | "given" | undefined

given (the default) keeps the order of the entries; points puts the most points first.

categories (optional)boolean | undefined

Write each entry's own category in the second line.

badge (optional)boolean | undefined

Draw a club's (or the athlete's) initials on a badge for an entry with no flag or mark, even where no entry has one. Default: only where some entry has a flag or mark.

size (optional)BoardSizeName | { width: number; height: number; } | undefined

One of BOARD_SIZES (tv by default), or a size of your own, { width, height }, at least 200 each way.

theme (optional)"auto" | "light" | "dark" | undefined

auto (the default) follows the page's light or dark, light and dark fix it.

flags (optional)FlagRenderer | undefined

Draws a flag from its code, as for drawBracket: a synchronous function from a code (CA-BC, JP) and { shape, size, theme } to an SVG string, such as one made from @johnmorrisdotca/hata.

flagHref (optional)((code: string) => string | null | undefined) | undefined

The address of a flag as a picture to load, tried where flags gives none.

flagShape (optional)"round" | "square" | undefined

round (the default) or square: the shape a flag is asked for and drawn in.

locale (optional)string | Locale | undefined

The language: en, fr, ja, es, de or a Locale.

words (optional)Partial<Words> | undefined
title (optional)string | undefined

The <title> of the drawing. Default: the board's own heading.

id (optional)string | undefined

Prefix for the drawing's ids. Default: a hash of the state and the options.

className (optional)string | undefined

Examples

import { rankingList, type RankingOptions } from "@johnmorrisdotca/taisen-brackets";

const options: RankingOptions = { style: "list", precision: 2, size: "portrait", movement: "arrow" };
console.log(rankingList({ entries: [
  { name: { surname: "Nakamura", given: "Kenji" }, club: "Coastal Pine Judo", flag: "CA-BC", points: 412.5, change: 1 },
  { name: { surname: "Brar", given: "Harpreet" }, club: "Salmonberry Judo Club", flag: "CA-BC", points: 398, change: -1 },
  { name: { surname: "Leclerc", given: "Mathieu" }, club: "Kestrel Valley Judo", flag: "CA-QC", points: 366.25, change: 4 },
] }, options).includes("412.50"));
true

What it prints (run when this page was built)

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