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

NumberOnesOptionstype

What the number-ones board can be told: the columns, the card colours, and the options of every board.

Import it

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

Definition

interface NumberOnesOptions extends BoardOptions, Shared {
    columns?: number;
    colors?: readonly string[];
}

Members

NameTypeDescription
columns (optional)number | undefined

Columns of cards, 1 to 4. Default: the number that makes the cards biggest.

colors (optional)readonly string[] | undefined

The colour of each card's number panel, hex codes, taken in turn. The number is white or near-black, whichever reads on the colour. Default NUMBER_ONE_COLORS.

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

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.

Examples

import { rankingNumberOnes, type NumberOnesOptions } from "@johnmorrisdotca/taisen-brackets";

const options: NumberOnesOptions = { size: "square", columns: 2, nameStyle: "given-first" };
console.log(rankingNumberOnes({ cards: [{ category: "-60 kg", entry: { name: { surname: "Nakamura", given: "Kenji" } } }] }, options).startsWith("<svg"));
true

What it prints (run when this page was built)

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