本文へ移動

Taisen Brackets対戦

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

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

目次

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

ResultsRow型

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

One line of a results board. Only name is needed.

インポート

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

定義

interface ResultsRow {
    name: string | RankingName;
    rank?: number | string;
    code?: string;
    flag?: string;
    mark?: string;
    values?: readonly (number | string | null)[];
    record?: string | readonly string[];
    note?: string;
}

メンバー

名前型説明
namestring | RankingName

The name as it is to be written ("A. SACRAMONE", "Svetlana Khorkina"), or its two parts (set by nameStyle).

rank (省略可)string | number | undefined

The rank: a number, or a text ("=3", "DQ"). Left out, the place in the list (equal results share one, see ties).

code (省略可)string | undefined

The country's three letters, written before the flag.

flag (省略可)string | undefined

A code for the flags function (US, CA-BC), drawn 4:3.

mark (省略可)string | undefined

A mark of your own (an image address or inline SVG) in place of a flag.

values (省略可)readonly (string | number | null)[] | undefined

One value for each column: a number (written to the column's precision decimals), a text (written as it is: 1:08.34), or none.

record (省略可)string | readonly string[] | undefined

A record badge or several beside the last value: "OR", ["WR", "NR"].

note (省略可)string | undefined

Written in place of the values when there are none to show: DNS, DNF, DQ.

例

import { resultsBoard, type ResultsRow } from "@johnmorrisdotca/taisen-brackets";

const row: ResultsRow = { code: "USA", flag: "US", name: "Michael Phillips", values: [50.58], record: "OR" };
console.log(resultsBoard({ title: "Final", rows: [row] }).includes("50.58"));
true

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

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

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