@johnmorrisdotca/kyogijo-stadiums 0.61.0 → 0.62.0

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.
@@ -136,6 +136,8 @@ export function boardSize(w, h) {
136
136
  export const hangsOver = (sport) => sport !== "mlb";
137
137
  /** The segments of a seven-segment digit, a to g, that are lit for each digit. */
138
138
  const SEGMENTS = ["abcdef", "bc", "abged", "abgcd", "fgbc", "afgcd", "afgedc", "abc", "abcdefg", "abcdfg"];
139
+ /** The letters a seven-segment board writes for a power play. */
140
+ const LETTERS = { P: "abefg" };
139
141
  /** How wide a colon is, as a share of the height of the digits beside it. */
140
142
  const COLON = 0.3;
141
143
  /** A text of digits and colons in seven segments, `high` feet tall, from (x, y) at its top left: the path and the width it takes. */
@@ -165,7 +167,7 @@ function segments(text, x, y, high) {
165
167
  at += cw;
166
168
  return;
167
169
  }
168
- for (const seg of SEGMENTS[Number(ch)] ?? "") {
170
+ for (const seg of LETTERS[ch] ?? SEGMENTS[Number(ch)] ?? "") {
169
171
  const [rx, ry, rw, rh] = rects[seg];
170
172
  d += `M${n(at + rx)} ${n(y + ry)}h${n(rw)}v${n(rh)}h${n(-rw)}z`;
171
173
  }
@@ -220,6 +222,23 @@ function boardFace(w, h, look) {
220
222
  svg += `<path class="u-led" fill="${c2}" d="${h0.d}${a0.d}M${n(x0 + home.width + gap)} ${n(y0 + high / 2 - high * 0.065)}h${n(high * dash)}v${n(high * 0.13)}h${n(-high * dash)}z"/>`;
221
223
  if (live !== undefined)
222
224
  svg += liveRow(w, h, room, live, c2);
225
+ // A power play: in each side's block of colour, its penalty clocks (one or two, stacked), or PP for the side with more skaters, dark on the colour.
226
+ if (live?.penalties !== undefined) {
227
+ const pen = live.penalties;
228
+ for (const [side, x] of [["home", edge * 2], ["away", w - edge * 2 - block]]) {
229
+ const lines = (pen.pp === side ? ["PP"] : pen[side].filter((one) => safeClock(one) !== "").slice(0, 2));
230
+ if (lines.length === 0)
231
+ continue;
232
+ const rows = lines.length;
233
+ const high2 = Math.min((hb * 0.8) / rows / 1.15, block / ((lines[0].length - (lines[0].includes(":") ? 1 : 0)) * 0.69 + 0.4));
234
+ let d = "";
235
+ lines.forEach((text, i) => {
236
+ const width = segments(text, 0, 0, high2).width;
237
+ d += segments(text, x + (block - width) / 2, yb + (hb - rows * high2 * 1.15) / 2 + i * high2 * 1.15, high2).d;
238
+ });
239
+ svg += `<path class="u-led-bed" d="${d}"/>`;
240
+ }
241
+ }
223
242
  return svg;
224
243
  }
225
244
  /**
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** The package's version: the same as package.json's, and a test holds them to each other. */
2
- export declare const VERSION = "0.61.0";
2
+ export declare const VERSION = "0.62.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** The package's version: the same as package.json's, and a test holds them to each other. */
2
- export const VERSION = "0.61.0";
2
+ export const VERSION = "0.62.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/kyogijo-stadiums",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "Kyogijo Stadiums 競技場, 40 sports' surfaces as SVG, drawn to scale from the rulebooks: NFL, CFL and IFAF football fields, an NHL rink, an NBA court, MLB ballparks, soccer pitches, curling sheets, athletics stadiums, speed skating, short track and figure skating rinks, swimming pools, water polo fields, diving wells, artistic swimming areas, and the courts and fields of tennis, volleyball (indoor, beach and sitting), badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet, netball, lacrosse, rugby, Australian football, Gaelic games, cricket, field hockey and handball, and the budo of judo, karate, kendo, sumo and kyudo with a dojo of tatami laid as real units, the MMA cage, with each team's name and logo on its side and the score in the middle, stands and a crowd, a pageant of flags, and a 3D view. Light and dark, accessible, a compact badge for lists, a helper for React and a custom element. Zero dependencies.",
5
5
  "keywords": [
6
6
  "sports",