@johnmorrisdotca/taisen-brackets 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -56,6 +56,11 @@ export type MatchupKind =
56
56
  | "aggregate"
57
57
  /** A drawn game and the game replayed: the last one decides. */
58
58
  | "replay";
59
+ /** What takes a side of a tie: a tie's id (its winner, as `feeds` always meant) or `{ tie, result }`, which can name the tie's loser as well (a play-in's loser goes on to a decider). */
60
+ export type Feed = string | {
61
+ tie: string;
62
+ result: "winner" | "loser";
63
+ };
59
64
  /**
60
65
  * One tie: two sides and who went through. Everything but `sides` is optional, so that a bracket can be drawn from
61
66
  * what is known (the sides of a first round, a few results) and fill in as the games are played.
@@ -80,7 +85,7 @@ export interface Matchup {
80
85
  * Which ties feed this one: `feeds[0]` the one whose winner takes the first side, `feeds[1]` the second. Names the
81
86
  * tree outright, for a bracket whose sides are not known yet. Left out, a winner goes on to the next tie its team plays.
82
87
  */
83
- feeds?: readonly [string | null, string | null];
88
+ feeds?: readonly [Feed | null, Feed | null];
84
89
  /** How the tie is contested. Left out: replay if a game replays, series if there is a `bestOf` or several games, else game. */
85
90
  kind?: MatchupKind;
86
91
  /** The length of the series (7 for a best-of-seven). */
@@ -101,6 +106,10 @@ export interface Matchup {
101
106
  walkover?: boolean;
102
107
  /** This is the third-place match: it leads nowhere and is drawn apart. */
103
108
  third?: boolean;
109
+ /** `"play-in"`: a game of a play-in (the NBA's) that is outside the rounds of the tree: its winner (and loser, see `feeds`) goes on to a place the tree's ties name. Drawn by the `playin` layout and, apart, under the other layouts' trees. */
110
+ stage?: "play-in";
111
+ /** The side playing at home (0 or 1), for the `at` wording of the `columns` layout: the home side is drawn second, after "AT". Left out, the second side. */
112
+ home?: 0 | 1;
104
113
  note?: string;
105
114
  /** The seed tags of the two sides for this tie (`["C1", "WC2"]`), written beside the marks in the road look when `seeds` is on; a side's `Team.tag` is used where this has none. */
106
115
  seeds?: readonly [string | number | null, string | number | null];
@@ -140,6 +149,17 @@ export interface Tie {
140
149
  note: string | null;
141
150
  /** The seed tags given for the tie's sides (`Matchup.seeds`). */
142
151
  seeds?: readonly [string | number | null, string | number | null];
152
+ /** Where each side comes from, when the matchup's `feeds` name it: another tie's winner or its loser. Left out for a tie that says nothing of the kind. */
153
+ from?: readonly [Source | null, Source | null];
154
+ /** The tie is a play-in game (`Matchup.stage`). */
155
+ playIn?: boolean;
156
+ /** The side at home (`Matchup.home`), when given. */
157
+ home?: 0 | 1;
158
+ }
159
+ /** Where a side of a tie comes from: the winner or the loser of the tie at `tie` (its index). */
160
+ export interface Source {
161
+ tie: number;
162
+ result: "winner" | "loser";
143
163
  }
144
164
  /** Where the layout put a tie. */
145
165
  export type Place = "l" | "r" | "f" | "o";
@@ -191,6 +211,8 @@ export interface BracketLayout {
191
211
  /** Ties that lead nowhere near the final, and round-robin games. */
192
212
  other: number[];
193
213
  robin: number[];
214
+ /** The play-in games (`Matchup.stage`), kept out of the tree. */
215
+ playIn: number[];
194
216
  /** The third-place match, when there is one. */
195
217
  third: number | null;
196
218
  /** Where each tie is: a half, the final, or elsewhere; by tie index. */
@@ -297,6 +319,29 @@ export interface Words {
297
319
  /** `{name}`. */
298
320
  roadChampion: string;
299
321
  roadToPlay: string;
322
+ /** "vs": the tag between two sides of a tie in the `columns` layout, and between the shields. */
323
+ vs: string;
324
+ /** The word between the two sides of a tie of the `columns` layout that names the home side (`at: true`): "AT". */
325
+ at: string;
326
+ /** `{n}`: a group's name, "Group A" (`n` is the letter). */
327
+ groupName: string;
328
+ /** The heads of a group table: played, won, drawn, lost, goal difference, points. */
329
+ colPlayed: string;
330
+ colWon: string;
331
+ colDrawn: string;
332
+ colLost: string;
333
+ colDiff: string;
334
+ colPoints: string;
335
+ /** The heading over a bracket's play-in games. */
336
+ playIn: string;
337
+ /** `{a}`, `{b}`: the seeds of the two games a box takes the winner (or the loser) of: "Winner 9/10", "Loser 7/8". */
338
+ playInWinner: string;
339
+ playInLoser: string;
340
+ /** `{n}`: a seed's place, "Seed 7". */
341
+ seedSlot: string;
342
+ /** `{name}`: a side that is the winner or loser of another tie, in a sentence or a table: "Loser of {name}". */
343
+ winnerOf: string;
344
+ loserOf: string;
300
345
  }
301
346
  /** A language: its words, the names of the rounds (by their English names), and the tag `Intl` formats numbers and dates for. */
302
347
  export interface Locale {
@@ -372,7 +417,27 @@ export interface BackgroundImageOptions {
372
417
  dim?: number;
373
418
  theme?: "light" | "dark";
374
419
  }
420
+ /** How the ties are drawn: `tree` (the default) is the bracket as ever; the others are other ways to draw the same ties. */
421
+ export type LayoutName = "tree" | "rows" | "shields" | "update" | "columns" | "playin" | "series" | "groups";
375
422
  export interface DrawOptions extends LayoutOptions {
423
+ /**
424
+ * `tree` (the default): the halves meeting at the final. `rows`: each team a row, its name on the left and its mark on the right, a slot for the result toward the centre. `shields`: marks in shields with "vs",
425
+ * the matchups on both sides of the trophy. `update`: a compact score-update card. `columns`: tall slots that grow toward the centre, the conferences in two colours, "VS" (or "AT") on a tag, big seed numbers.
426
+ * `playin`: the play-in games with their winners and losers going on. `series`: a tall card, one line a series ("BOS 4-0 MIA"), the first half above and the second below. `groups`: the group-stage tables.
427
+ */
428
+ layout?: LayoutName;
429
+ /** Big title tiles (the halves' groups: West and East, AFC and NFC) over each half, in any layout: each half's `group` name in the colour of that half. Default false. */
430
+ headers?: boolean;
431
+ /** In the `columns` layout, write "AT" (the word `at` of the language) in place of "VS" between the two sides of a tie: the first side is the visitor and the second the home side (`Matchup.home` says otherwise). Default false. */
432
+ at?: boolean;
433
+ /** In the `groups` layout, the columns of a group's table: `points` (played, won, drawn, lost, goal difference, points) or `record` (won and lost, softball's). Default `points`. */
434
+ standings?: "points" | "record";
435
+ /** In the `groups` layout, how many teams of each group go through: their rows are marked. Default 0, none. */
436
+ qualify?: number;
437
+ /** Write the `<style>` into the drawing. Default true; false leaves it out, for a second drawing of a page that shares the first's (`styleScope`, `bracketStyle`). */
438
+ style?: boolean;
439
+ /** A class that carries this drawing's rules in place of its own: two drawings with the same `styleScope` take their colours from one `<style>`, and the second can leave it out (`style: false`). A word of letters, digits, `-` and `_`. */
440
+ styleScope?: string;
376
441
  /** `wide` 1200 by 675, `square` 1080 by 1080, `card` 1080 by 1350 (a tall post), `phone` 390 wide and as tall as it needs; or a size of your own. Default `wide`. */
377
442
  size?: SizeName | {
378
443
  width: number;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.5.0";
1
+ export declare const VERSION = "0.6.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.5.0";
1
+ export const VERSION = "0.6.1";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/taisen-brackets",
3
- "version": "0.5.0",
4
- "description": "Taisen Brackets 対戦, knockout brackets as SVG: from a list of ties (games, best-of series, two legs, replays, byes, a third-place match) it works out the rounds and halves and draws the bracket with the halves meeting at the final, or left to right, wide, square, as a tall card or for a phone, in a classic or a road look (large round flags, big scores, a team's dotted path, a link on every box), in light, dark or a gold-on-navy poster look, on one of twenty-five poster backgrounds (the playing surfaces of five sports among them) or your own, with each team's logo or round flag, the champion in the centre, and an accessible table; and the road to the final of either finalist. NHL, NBA, MLB, NFL, CFL, MLS and World Cup formats by era, in English, French, Japanese, Spanish and German. Zero dependencies.",
3
+ "version": "0.6.1",
4
+ "description": "Taisen Brackets 対戦, knockout brackets as SVG: from a list of ties (games, best-of series, two legs, replays, byes, a third-place match) it works out the rounds and halves and draws the bracket with the halves meeting at the final, or left to right, wide, square, as a tall card or for a phone, in a classic or a road look (large round flags, big scores, a team's dotted path, a link on every box), in light, dark or a gold-on-navy poster look, in eight layouts (the tree, rows, shields, a score-update card, tall columns, the NBA's play-in, a series card and group tables), on one of twenty-five poster backgrounds (the playing surfaces of five sports among them) or your own, with each team's logo or round flag, the champion in the centre, and an accessible table; and the road to the final of either finalist. NHL, NBA, MLB, NFL, CFL, MLS and World Cup formats by era, in English, French, Japanese, Spanish and German. Zero dependencies.",
5
5
  "keywords": [
6
6
  "bracket",
7
7
  "tournament",
@@ -30,7 +30,9 @@
30
30
  "zero-dependencies",
31
31
  "browser",
32
32
  "node",
33
- "itsutsu"
33
+ "itsutsu",
34
+ "play-in",
35
+ "group-stage"
34
36
  ],
35
37
  "homepage": "https://johnmorrisdotca.github.io/taisen-brackets/",
36
38
  "repository": {