BracketLayout型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The shape of a bracket worked out from its ties: the ties, the halves, the rounds, the rows and the champion.
インポート
import type { BracketLayout } from "@johnmorrisdotca/taisen-brackets/layout";
ほかのエクスポート元: @johnmorrisdotca/taisen-brackets
定義
interface BracketLayout {
ties: Tie[];
shape: "halves" | "ltr" | "forest";
sides: LayoutSide[];
final: {
i: number;
y: number;
order: readonly [
0 | 1,
0 | 1
];
} | null;
finalIndex: number | null;
columns: number[];
rounds: number;
rows: number;
other: number[];
robin: number[];
playIn: number[];
third: number | null;
place: Place[];
parent: number[];
champion: Team | null;
teams: Team[];
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
ties | Tie[] | Every tie, in the order given. |
shape | "halves" | "ltr" | "forest" | How the tree is drawn: two halves that meet at the final, one tree left to right, or several (no single final). |
sides | LayoutSide[] | |
final | { i: number; y: number; order: readonly [0 | 1, 0 | 1]; } | null | The final, when the halves meet at it: its row and the order of its sides (the first is the left half's). |
finalIndex | number | null | The tie that is the final, when the last round holds one, in any shape. |
columns | number[] | The rounds drawn on the sides, in order (the final's own round is left out when the halves meet at it). |
rounds | number | The number of rounds of the tree, the final's included. |
rows | number | |
other | number[] | Ties that lead nowhere near the final, and round-robin games. |
robin | number[] | |
playIn | number[] | The play-in games ( |
third | number | null | The third-place match, when there is one. |
place | Place[] | Where each tie is: a half, the final, or elsewhere; by tie index. |
parent | number[] | The tie each tie feeds, by index; -1 for none. |
champion | Team | null | The team that won the final, when it has been played. |
teams | Team[] | Every team that appears, by id. |
例
import { layoutBracket, drawBracket, type BracketLayout } from "@johnmorrisdotca/taisen-brackets";
const layout: BracketLayout = layoutBracket([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }]);
console.log(layout.shape, layout.rounds, drawBracket(layout).startsWith("<svg"));halves 2 true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。