本文へ移動

Taisen Brackets対戦

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

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

目次

リファレンス · 各対戦の位置を計算

Team型

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

A side of a tie: a team, with the marks and labels a drawing needs. Only id and name are required.

インポート

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

ほかのエクスポート元: @johnmorrisdotca/taisen-brackets

定義

interface Team {
    id: SideId;
    name: string;
    abbr?: string;
    seed?: number;
    tag?: string;
    mark?: string;
    group?: string;
    color?: string;
    names?: Readonly<Record<string, string>>;
    region?: string;
    flag?: string;
    code?: string;
}

メンバー

名前型説明
idSideId
namestring
abbr (省略可)string | undefined

A short name for a small box (three letters is usual). Left out, one is made from the name.

seed (省略可)number | undefined

The seed, shown beside the name when seeds is on.

tag (省略可)string | undefined

A tag for the road look's seed tags (C1, WC2, M3): written small beside the mark when seeds is on, in place of the number. A tie's seeds win over it.

mark (省略可)string | undefined

The team's mark: a logo or a flag. Either the address of an image (https://, data:image/…, or a relative path) or inline SVG markup (<svg …>; a round flag from @johnmorrisdotca/hata goes here as it is).

group (省略可)string | undefined

The half this team belongs to when the halves are named: a conference, a region, a group.

color (省略可)string | undefined

A colour for the team's initials when it has no mark, any CSS colour.

names (省略可)Readonly<Record<string, string>> | undefined

The name in other languages, by locale code: { fr: "Allemagne", ja: "ドイツ" }. The language of a drawing picks its own, else name.

region (省略可)string | undefined

An ISO 3166 region code (DE), for countryName and a teamName that uses it.

flag (省略可)string | undefined

A country code (ca, GB-ENG) for a round flag drawn by the flags option's renderer (@johnmorrisdotca/hata has one). With no renderer, or one that has no flag for the code, the team's mark is drawn, or its initials: it never throws.

code (省略可)string | undefined

The three letters of the team's country (JPN), which the judo screens write beside the name (judoWins, judoRoadPanel).

例

import { drawBracket, type Team } from "@johnmorrisdotca/taisen-brackets";

const argentina: Team = { id: "ARG", name: "Argentina", abbr: "ARG", flag: "AR" };
const svg = drawBracket({ teams: [argentina], matchups: [{ sides: ["ARG", "FRA"], score: [3, 3], pens: [4, 2] }] });
console.log(svg.includes("Argentina"));
true

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

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

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