本文へ移動

Taisen Brackets対戦

対戦の一覧から、トーナメント表をSVGで描きます。

対戦(たいせん)は、二者が向かい合って勝負することです。 名前について(英語)

目次

リファレンス · トーナメント表・表・決勝までの道を描く

EntryListOptions型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What an entry list can be told: the sort (entry or ranking), numbers, columns, rows and page.

インポート

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

定義

interface EntryListOptions extends BoardOptions, Shared {
    sort?: "entry" | "ranking";
    numbers?: boolean;
    columns?: number;
    rows?: number;
    page?: number;
    badge?: boolean;
}

メンバー

名前型説明
sort (省略可)"entry" | "ranking" | undefined

entry (the default) keeps the order given; ranking puts the best ranked first and the unranked last.

numbers (省略可)boolean | undefined

Number the rows 1, 2, 3 in the order drawn. Default true.

columns (省略可)number | undefined

Columns of rows, 1 to 3. Default: as many as the size needs to keep the rows readable.

rows (省略可)number | undefined

The most entries drawn, from the first of the page, and which page (0 is the first). Default: as many as fit at a readable size.

page (省略可)number | undefined
badge (省略可)boolean | undefined

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

size (省略可)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 (省略可)"auto" | "light" | "dark" | undefined

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

flags (省略可)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 (省略可)((code: string) => string | null | undefined) | undefined

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

flagShape (省略可)"round" | "square" | undefined

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

locale (省略可)string | Locale | undefined

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

words (省略可)Partial<Words> | undefined
title (省略可)string | undefined

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

id (省略可)string | undefined

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

className (省略可)string | undefined
nameStyle (省略可)"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 (省略可)number | undefined

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

例

import { rankingEntryList, type EntryListOptions } from "@johnmorrisdotca/taisen-brackets";

const options: EntryListOptions = { sort: "ranking", numbers: true, columns: 2 };
console.log(rankingEntryList({ entries: [{ name: "A", rank: 2 }, { name: "B" }] }, options).startsWith("<svg"));
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/taisen-brackets 0.20.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。