@johnmorrisdotca/kyogijo-stadiums 0.4.0 → 0.6.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.
Files changed (361) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/NOTICE.md +182 -2
  3. package/README.md +106 -19
  4. package/dist/annotate.js +1 -1
  5. package/dist/arenas-entry.d.ts +4 -0
  6. package/dist/arenas-entry.js +3 -0
  7. package/dist/arenas.d.ts +125 -0
  8. package/dist/arenas.data.d.ts +2 -0
  9. package/dist/arenas.data.js +3763 -0
  10. package/dist/arenas.js +72 -0
  11. package/dist/athletics/describe.d.ts +8 -0
  12. package/dist/athletics/describe.js +41 -0
  13. package/dist/athletics/events.d.ts +17 -0
  14. package/dist/athletics/events.js +48 -0
  15. package/dist/athletics/facilities.d.ts +80 -0
  16. package/dist/athletics/facilities.js +176 -0
  17. package/dist/athletics/infield.d.ts +79 -0
  18. package/dist/athletics/infield.js +166 -0
  19. package/dist/athletics/layout.d.ts +13 -0
  20. package/dist/athletics/layout.js +98 -0
  21. package/dist/athletics/oval.d.ts +57 -0
  22. package/dist/athletics/oval.js +116 -0
  23. package/dist/athletics/plan.d.ts +97 -0
  24. package/dist/athletics/plan.js +355 -0
  25. package/dist/athletics/races.d.ts +102 -0
  26. package/dist/athletics/races.js +355 -0
  27. package/dist/athletics/steeplechase.d.ts +72 -0
  28. package/dist/athletics/steeplechase.js +196 -0
  29. package/dist/athletics/stencil.d.ts +13 -0
  30. package/dist/athletics/stencil.js +85 -0
  31. package/dist/athletics/track.d.ts +54 -0
  32. package/dist/athletics/track.js +105 -0
  33. package/dist/athletics/types.d.ts +77 -0
  34. package/dist/athletics/types.js +1 -0
  35. package/dist/athletics-entry.d.ts +17 -0
  36. package/dist/athletics-entry.js +11 -0
  37. package/dist/athletics.style.d.ts +16 -0
  38. package/dist/athletics.style.js +51 -0
  39. package/dist/atlas-entry.d.ts +6 -2
  40. package/dist/atlas-entry.js +4 -2
  41. package/dist/atlas.d.ts +117 -23
  42. package/dist/atlas.js +197 -12
  43. package/dist/background.js +2 -1
  44. package/dist/budo/describe.d.ts +13 -0
  45. package/dist/budo/describe.js +120 -0
  46. package/dist/budo/dojo.api.d.ts +64 -0
  47. package/dist/budo/dojo.api.js +46 -0
  48. package/dist/budo/dojo.d.ts +72 -0
  49. package/dist/budo/dojo.js +300 -0
  50. package/dist/budo/judo.d.ts +61 -0
  51. package/dist/budo/judo.js +109 -0
  52. package/dist/budo/karate.d.ts +29 -0
  53. package/dist/budo/karate.js +80 -0
  54. package/dist/budo/kendo.d.ts +18 -0
  55. package/dist/budo/kendo.js +44 -0
  56. package/dist/budo/kimarite.d.ts +19 -0
  57. package/dist/budo/kimarite.js +33 -0
  58. package/dist/budo/kit.d.ts +16 -0
  59. package/dist/budo/kit.js +24 -0
  60. package/dist/budo/kyudo.d.ts +28 -0
  61. package/dist/budo/kyudo.js +66 -0
  62. package/dist/budo/looks.d.ts +28 -0
  63. package/dist/budo/looks.js +58 -0
  64. package/dist/budo/parts.d.ts +32 -0
  65. package/dist/budo/parts.js +10 -0
  66. package/dist/budo/plan.d.ts +64 -0
  67. package/dist/budo/plan.js +139 -0
  68. package/dist/budo/room.d.ts +133 -0
  69. package/dist/budo/room.js +111 -0
  70. package/dist/budo/sumo.d.ts +31 -0
  71. package/dist/budo/sumo.js +71 -0
  72. package/dist/budo/tatami.d.ts +55 -0
  73. package/dist/budo/tatami.js +156 -0
  74. package/dist/budo/types.d.ts +192 -0
  75. package/dist/budo/types.js +2 -0
  76. package/dist/budo-entry.d.ts +22 -0
  77. package/dist/budo-entry.js +13 -0
  78. package/dist/budo.board.d.ts +28 -0
  79. package/dist/budo.board.js +81 -0
  80. package/dist/budo.score.d.ts +18 -0
  81. package/dist/budo.score.js +52 -0
  82. package/dist/budo.style.d.ts +6 -0
  83. package/dist/budo.style.js +67 -0
  84. package/dist/charts-entry.d.ts +6 -1
  85. package/dist/charts-entry.js +3 -0
  86. package/dist/charts.athletics.d.ts +183 -0
  87. package/dist/charts.athletics.js +455 -0
  88. package/dist/charts.baseball.js +1 -1
  89. package/dist/charts.curling.heat.d.ts +24 -0
  90. package/dist/charts.curling.heat.js +116 -0
  91. package/dist/charts.curling.js +14 -3
  92. package/dist/charts.js +4 -4
  93. package/dist/charts.pool.d.ts +67 -0
  94. package/dist/charts.pool.js +76 -0
  95. package/dist/charts.skating.d.ts +204 -0
  96. package/dist/charts.skating.js +426 -0
  97. package/dist/charts.soccer.js +3 -3
  98. package/dist/charts.types.d.ts +63 -1
  99. package/dist/colour.d.ts +4 -4
  100. package/dist/colour.js +4 -4
  101. package/dist/court.d.ts +85 -2
  102. package/dist/court.js +102 -7
  103. package/dist/court.more.d.ts +46 -0
  104. package/dist/court.more.js +219 -0
  105. package/dist/courts.style.d.ts +14 -2
  106. package/dist/courts.style.js +51 -4
  107. package/dist/crowd.d.ts +164 -0
  108. package/dist/crowd.draw.d.ts +17 -0
  109. package/dist/crowd.draw.js +204 -0
  110. package/dist/crowd.js +480 -0
  111. package/dist/crowd.park.d.ts +19 -0
  112. package/dist/crowd.park.js +153 -0
  113. package/dist/curling.stats.d.ts +271 -0
  114. package/dist/curling.stats.js +301 -0
  115. package/dist/draw.d.ts +16 -0
  116. package/dist/draw.js +462 -54
  117. package/dist/element-entry.d.ts +3 -1
  118. package/dist/element-entry.js +2 -1
  119. package/dist/element.d.ts +13 -2
  120. package/dist/element.js +79 -4
  121. package/dist/emblems-source.d.ts +50 -0
  122. package/dist/emblems-source.js +56 -0
  123. package/dist/eras.d.ts +3 -1
  124. package/dist/eras.js +8 -3
  125. package/dist/features.js +204 -0
  126. package/dist/field.data.d.ts +16 -0
  127. package/dist/field.data.js +50 -0
  128. package/dist/fields.kit.d.ts +2 -2
  129. package/dist/fields.types.d.ts +24 -4
  130. package/dist/formations.js +18 -7
  131. package/dist/formations.sports.d.ts +8 -0
  132. package/dist/formations.sports.js +251 -0
  133. package/dist/frames.providers.js +71 -8
  134. package/dist/geojson.js +3 -0
  135. package/dist/geometry-entry.d.ts +2 -1
  136. package/dist/geometry-entry.js +2 -1
  137. package/dist/geometry.d.ts +20 -0
  138. package/dist/geometry.js +78 -1
  139. package/dist/grounds.d.ts +4 -0
  140. package/dist/grounds.data.js +12 -0
  141. package/dist/halls.d.ts +65 -0
  142. package/dist/halls.js +122 -0
  143. package/dist/hardwood.d.ts +31 -0
  144. package/dist/hardwood.js +157 -0
  145. package/dist/heat.js +21 -13
  146. package/dist/heat.types.d.ts +5 -0
  147. package/dist/heat.zones.d.ts +4 -2
  148. package/dist/heat.zones.js +207 -7
  149. package/dist/homeside.js +24 -0
  150. package/dist/index.d.ts +30 -4
  151. package/dist/index.js +18 -2
  152. package/dist/layers-entry.d.ts +2 -1
  153. package/dist/layers-entry.js +1 -0
  154. package/dist/layers.d.ts +2 -1
  155. package/dist/layers.env.d.ts +12 -1
  156. package/dist/layers.env.js +36 -4
  157. package/dist/layers.js +32 -13
  158. package/dist/layers.types.d.ts +9 -2
  159. package/dist/leagues/athletics.d.ts +63 -0
  160. package/dist/leagues/athletics.js +87 -0
  161. package/dist/leagues/budo.d.ts +196 -0
  162. package/dist/leagues/budo.js +105 -0
  163. package/dist/leagues/courts.d.ts +269 -4
  164. package/dist/leagues/courts.js +155 -1
  165. package/dist/leagues/hockey.js +41 -19
  166. package/dist/leagues/skating.d.ts +145 -0
  167. package/dist/leagues/skating.js +73 -0
  168. package/dist/leagues/sources.js +41 -0
  169. package/dist/leagues/types.d.ts +1 -1
  170. package/dist/leagues-entry.d.ts +4 -2
  171. package/dist/leagues-entry.js +2 -1
  172. package/dist/leagues.d.ts +17 -4
  173. package/dist/leagues.js +246 -5
  174. package/dist/lineup.codes.d.ts +23 -0
  175. package/dist/lineup.codes.js +122 -0
  176. package/dist/logo.d.ts +25 -0
  177. package/dist/logo.js +47 -0
  178. package/dist/look.d.ts +3 -3
  179. package/dist/look.js +39 -6
  180. package/dist/outline.d.ts +1 -1
  181. package/dist/outline.js +46 -4
  182. package/dist/pageant.d.ts +120 -0
  183. package/dist/pageant.draw.d.ts +21 -0
  184. package/dist/pageant.draw.js +171 -0
  185. package/dist/pageant.js +211 -0
  186. package/dist/pageant.style.d.ts +8 -0
  187. package/dist/pageant.style.js +42 -0
  188. package/dist/png.d.ts +8 -1
  189. package/dist/png.js +21 -1
  190. package/dist/pointer-entry.d.ts +2 -0
  191. package/dist/pointer-entry.js +2 -0
  192. package/dist/pointer.d.ts +113 -0
  193. package/dist/pointer.js +151 -0
  194. package/dist/pool.d.ts +176 -0
  195. package/dist/pool.figures.d.ts +306 -0
  196. package/dist/pool.figures.js +148 -0
  197. package/dist/pool.js +304 -0
  198. package/dist/pool.kit.d.ts +48 -0
  199. package/dist/pool.kit.js +141 -0
  200. package/dist/pool.labels.d.ts +20 -0
  201. package/dist/pool.labels.js +258 -0
  202. package/dist/pool.race.d.ts +65 -0
  203. package/dist/pool.race.js +140 -0
  204. package/dist/pool.replay.d.ts +46 -0
  205. package/dist/pool.replay.js +127 -0
  206. package/dist/pool.section.d.ts +13 -0
  207. package/dist/pool.section.js +83 -0
  208. package/dist/pool.style.d.ts +20 -0
  209. package/dist/pool.style.js +169 -0
  210. package/dist/pool.types.d.ts +145 -0
  211. package/dist/pool.types.js +3 -0
  212. package/dist/pool.words.d.ts +13 -0
  213. package/dist/pool.words.js +101 -0
  214. package/dist/ranges.names.js +53 -3
  215. package/dist/replay-entry.d.ts +3 -0
  216. package/dist/replay-entry.js +2 -0
  217. package/dist/restyle.js +1 -1
  218. package/dist/road.draw.js +3 -2
  219. package/dist/road.js +2 -1
  220. package/dist/road.types.d.ts +3 -0
  221. package/dist/rules.d.ts +138 -0
  222. package/dist/rules.js +511 -0
  223. package/dist/rules.types.d.ts +4 -0
  224. package/dist/rules.types.js +64 -0
  225. package/dist/score.d.ts +3 -0
  226. package/dist/score.js +93 -6
  227. package/dist/sheet.d.ts +3 -0
  228. package/dist/sheet.js +7 -3
  229. package/dist/situation.d.ts +135 -0
  230. package/dist/situation.draw.d.ts +34 -0
  231. package/dist/situation.draw.js +202 -0
  232. package/dist/situation.js +337 -0
  233. package/dist/situation.style.d.ts +2 -0
  234. package/dist/situation.style.js +45 -0
  235. package/dist/situation.types.d.ts +77 -0
  236. package/dist/situation.types.js +3 -0
  237. package/dist/situation.widgets.d.ts +39 -0
  238. package/dist/situation.widgets.js +129 -0
  239. package/dist/skating/describe.d.ts +7 -0
  240. package/dist/skating/describe.js +44 -0
  241. package/dist/skating/events.d.ts +24 -0
  242. package/dist/skating/events.js +47 -0
  243. package/dist/skating/figure.d.ts +24 -0
  244. package/dist/skating/figure.js +37 -0
  245. package/dist/skating/long.d.ts +54 -0
  246. package/dist/skating/long.js +111 -0
  247. package/dist/skating/parts.d.ts +43 -0
  248. package/dist/skating/parts.js +40 -0
  249. package/dist/skating/plan.d.ts +55 -0
  250. package/dist/skating/plan.js +197 -0
  251. package/dist/skating/short.d.ts +47 -0
  252. package/dist/skating/short.js +89 -0
  253. package/dist/skating/track.d.ts +66 -0
  254. package/dist/skating/track.js +94 -0
  255. package/dist/skating/types.d.ts +57 -0
  256. package/dist/skating/types.js +3 -0
  257. package/dist/skating-entry.d.ts +17 -0
  258. package/dist/skating-entry.js +11 -0
  259. package/dist/skating.style.d.ts +4 -0
  260. package/dist/skating.style.js +24 -0
  261. package/dist/strings.d.ts +470 -0
  262. package/dist/strings.js +674 -13
  263. package/dist/style.d.ts +2 -0
  264. package/dist/style.js +19 -2
  265. package/dist/surfaces/artistic.d.ts +9 -0
  266. package/dist/surfaces/artistic.js +94 -0
  267. package/dist/surfaces/athletics.d.ts +16 -0
  268. package/dist/surfaces/athletics.js +132 -0
  269. package/dist/surfaces/baseball.js +17 -0
  270. package/dist/surfaces/basketball.floor.d.ts +27 -0
  271. package/dist/surfaces/basketball.floor.js +83 -0
  272. package/dist/surfaces/basketball.gear.d.ts +27 -0
  273. package/dist/surfaces/basketball.gear.js +90 -0
  274. package/dist/surfaces/basketball.js +44 -22
  275. package/dist/surfaces/budo.d.ts +6 -0
  276. package/dist/surfaces/budo.js +104 -0
  277. package/dist/surfaces/curling.d.ts +16 -0
  278. package/dist/surfaces/curling.fold.d.ts +67 -0
  279. package/dist/surfaces/curling.fold.js +107 -0
  280. package/dist/surfaces/curling.js +37 -3
  281. package/dist/surfaces/dive.d.ts +9 -0
  282. package/dist/surfaces/dive.js +128 -0
  283. package/dist/surfaces/field.d.ts +7 -2
  284. package/dist/surfaces/field.js +15 -9
  285. package/dist/surfaces/football.js +7 -0
  286. package/dist/surfaces/hockey.js +4 -2
  287. package/dist/surfaces/net.d.ts +2 -1
  288. package/dist/surfaces/net.js +160 -15
  289. package/dist/surfaces/polo.d.ts +12 -0
  290. package/dist/surfaces/polo.js +159 -0
  291. package/dist/surfaces/pool.d.ts +27 -0
  292. package/dist/surfaces/pool.js +198 -0
  293. package/dist/surfaces/skating.d.ts +6 -0
  294. package/dist/surfaces/skating.js +62 -0
  295. package/dist/surfaces/soccer.js +2 -1
  296. package/dist/surfaces/surface.d.ts +76 -0
  297. package/dist/surfaces/venue.d.ts +15 -0
  298. package/dist/surfaces/venue.js +95 -0
  299. package/dist/target-entry.d.ts +2 -0
  300. package/dist/target-entry.js +2 -0
  301. package/dist/target.d.ts +200 -0
  302. package/dist/target.js +525 -0
  303. package/dist/team.common.d.ts +1 -1
  304. package/dist/team.common.js +3 -3
  305. package/dist/team.formation.d.ts +3 -1
  306. package/dist/team.formation.js +3 -3
  307. package/dist/team.layers.d.ts +2 -2
  308. package/dist/team.layers.js +4 -1
  309. package/dist/team.lineup.d.ts +27 -0
  310. package/dist/team.lineup.js +207 -0
  311. package/dist/team.network.js +6 -5
  312. package/dist/team.shape.js +5 -5
  313. package/dist/team.types.d.ts +40 -1
  314. package/dist/tenants.d.ts +77 -0
  315. package/dist/tenants.data.d.ts +8 -0
  316. package/dist/tenants.data.js +1793 -0
  317. package/dist/tenants.js +46 -0
  318. package/dist/turn-entry.d.ts +12 -0
  319. package/dist/turn-entry.js +7 -0
  320. package/dist/turn.camera.d.ts +116 -0
  321. package/dist/turn.camera.js +184 -0
  322. package/dist/turn.dom.d.ts +40 -0
  323. package/dist/turn.dom.js +353 -0
  324. package/dist/turn.kit.d.ts +86 -0
  325. package/dist/turn.kit.js +110 -0
  326. package/dist/turn.markup.d.ts +48 -0
  327. package/dist/turn.markup.js +108 -0
  328. package/dist/turn.model.d.ts +78 -0
  329. package/dist/turn.model.js +91 -0
  330. package/dist/turn.style.d.ts +5 -0
  331. package/dist/turn.style.js +56 -0
  332. package/dist/types.d.ts +221 -20
  333. package/dist/units.d.ts +1 -1
  334. package/dist/units.js +22 -1
  335. package/dist/uprights.board.d.ts +17 -0
  336. package/dist/uprights.board.js +59 -0
  337. package/dist/uprights.budo.d.ts +17 -0
  338. package/dist/uprights.budo.js +87 -0
  339. package/dist/uprights.d.ts +37 -0
  340. package/dist/uprights.fields.d.ts +32 -0
  341. package/dist/uprights.fields.js +172 -0
  342. package/dist/uprights.goal.d.ts +49 -0
  343. package/dist/uprights.goal.js +69 -0
  344. package/dist/uprights.js +169 -0
  345. package/dist/uprights.more.d.ts +7 -0
  346. package/dist/uprights.more.js +183 -0
  347. package/dist/uprights.net.d.ts +12 -0
  348. package/dist/uprights.net.js +109 -0
  349. package/dist/uprights.netkit.d.ts +28 -0
  350. package/dist/uprights.netkit.js +67 -0
  351. package/dist/uprights.pools.d.ts +8 -0
  352. package/dist/uprights.pools.js +190 -0
  353. package/dist/uprights.rinks.d.ts +27 -0
  354. package/dist/uprights.rinks.js +106 -0
  355. package/dist/uprights.track.d.ts +50 -0
  356. package/dist/uprights.track.js +246 -0
  357. package/dist/version.d.ts +1 -1
  358. package/dist/version.js +1 -1
  359. package/dist/zones-entry.d.ts +2 -0
  360. package/dist/zones-entry.js +2 -0
  361. package/package.json +56 -3
@@ -0,0 +1,85 @@
1
+ // Lane numbers painted on a track, as paths: a stencil face of our own, with no font and no file. A digit stands in a box 0.62 wide and 1 high (scaled by the figure's height `h`) and is a few thick
2
+ // strokes with the gaps (bridges) a stencil has, so that it reads at a glance from far off. Written for this package; no typeface was used or looked at.
3
+ /** A number to four places: a figure under a metre tall needs more than the drawing's two. */
4
+ const num = (value) => {
5
+ const rounded = Math.round(value * 10000) / 10000;
6
+ return Object.is(rounded, -0) || rounded === 0 ? "0" : String(rounded);
7
+ };
8
+ /** The width of a digit over its height, and the gap between two digits over the height. */
9
+ export const DIGIT_WIDTH = 0.62;
10
+ export const DIGIT_GAP = 0.14;
11
+ /** The thickness of a stroke over the height. */
12
+ export const STROKE = 0.18;
13
+ // A stroke is a path of the pen's centre line in the box: `M x y`, `L x y` and `A rx ry sweep x y` (an arc of less than a half turn). The ends are butt, so a gap is a gap.
14
+ const xl = 0.09;
15
+ const xr = 0.53;
16
+ const xm = 0.31;
17
+ const yt = 0.09;
18
+ const yb = 0.91;
19
+ /** A closed ellipse as two half turns, with no bridge: the loops of a 6, an 8 and a 9. */
20
+ function loop(xc, yc, a, b) {
21
+ const f = (n) => String(Math.round(n * 1000) / 1000);
22
+ return `M${f(xc - a)} ${f(yc)}A${f(a)} ${f(b)} 0 0 1 ${f(xc + a)} ${f(yc)}A${f(a)} ${f(b)} 0 0 1 ${f(xc - a)} ${f(yc)}`;
23
+ }
24
+ const SIX = [`M0.5 ${yt}H0.31A0.22 0.2 0 0 0 ${xl} 0.29V0.68`, loop(xm, 0.68, 0.22, 0.23)];
25
+ /** A glyph turned half a turn about the middle of its box: a 6 is a 9. */
26
+ const turned = (strokes) => strokes.map((d) => d.replace(/([MLHVA])([^MLHVA]*)/g, (_m, cmd, rest) => {
27
+ const v = rest.trim().split(/[\s,]+/).filter((t) => t !== "").map(Number);
28
+ const f = (n) => String(Math.round(n * 1000) / 1000);
29
+ switch (cmd) {
30
+ case "M":
31
+ case "L":
32
+ return `${cmd}${f(DIGIT_WIDTH - v[0])} ${f(1 - v[1])}`;
33
+ case "H":
34
+ return `H${f(DIGIT_WIDTH - v[0])}`;
35
+ case "V":
36
+ return `V${f(1 - v[0])}`;
37
+ default:
38
+ return `A${v[0]} ${v[1]} 0 ${v[3]} ${v[4]} ${f(DIGIT_WIDTH - v[5])} ${f(1 - v[6])}`;
39
+ }
40
+ }));
41
+ const GLYPHS = {
42
+ "0": [`M0.27 ${yt}A0.18 0.22 0 0 0 ${xl} 0.31V0.69A0.18 0.22 0 0 0 0.27 ${yb}`, `M0.35 ${yt}A0.18 0.22 0 0 1 ${xr} 0.31V0.69A0.18 0.22 0 0 1 0.35 ${yb}`],
43
+ "1": [`M0.15 0.3L${xm} ${yt}V${yb}`],
44
+ "2": [`M${xl} 0.29A0.22 0.2 0 0 1 ${xr} 0.29L${xl} ${yb}H${xr}`],
45
+ "3": [`M${xl} ${yt}H0.30A0.23 0.19 0 0 1 0.30 0.455H0.2`, `M0.2 0.545H0.30A0.23 0.19 0 0 1 0.30 ${yb}H${xl}`],
46
+ "4": [`M0.4 ${yb}V${yt}L${xl} 0.65H0.55`],
47
+ "5": [`M${xr} ${yt}H${xl}V0.4`, `M0.19 0.45H0.30A0.23 0.23 0 0 1 0.30 ${yb}H${xl}`],
48
+ "6": SIX,
49
+ "7": [`M${xl} ${yt}H${xr}`, `M${xr} 0.18L0.26 ${yb}`],
50
+ "8": [loop(xm, 0.285, 0.2, 0.195), loop(xm, 0.715, 0.22, 0.195)],
51
+ "9": turned(SIX),
52
+ };
53
+ /** The width of a string of digits at the height `h`. */
54
+ export const digitsWidth = (text, h) => (text.length * DIGIT_WIDTH + Math.max(0, text.length - 1) * DIGIT_GAP) * h;
55
+ const scalePath = (d, h, ox, oy) => d.replace(/([MLHVA])([^MLHVA]*)/g, (_m, cmd, rest) => {
56
+ const v = rest.trim().split(/[\s,]+/).filter((s) => s !== "").map(Number);
57
+ switch (cmd) {
58
+ case "M":
59
+ case "L":
60
+ return `${cmd}${num(ox + v[0] * h)} ${num(oy + v[1] * h)}`;
61
+ case "H":
62
+ return `H${num(ox + v[0] * h)}`;
63
+ case "V":
64
+ return `V${num(oy + v[0] * h)}`;
65
+ default:
66
+ return `A${num(v[0] * h)} ${num(v[1] * h)} 0 ${v[3]} ${v[4]} ${num(ox + v[5] * h)} ${num(oy + v[6] * h)}`;
67
+ }
68
+ });
69
+ /**
70
+ * A string of digits as one path of strokes, centred on `(cx, cy)`, `h` tall, upright. `stroke-width` is `strokeWidth(h)`. Characters that are not digits are left out.
71
+ */
72
+ export function digitsD(text, h, cx, cy) {
73
+ const digits = [...text].filter((c) => Object.prototype.hasOwnProperty.call(GLYPHS, c));
74
+ const width = digitsWidth(digits.join(""), h);
75
+ let x = cx - width / 2;
76
+ const top = cy - h / 2;
77
+ let out = "";
78
+ for (const c of digits) {
79
+ out += GLYPHS[c].map((d) => scalePath(d, h, x, top)).join("");
80
+ x += (DIGIT_WIDTH + DIGIT_GAP) * h;
81
+ }
82
+ return out;
83
+ }
84
+ /** The thickness of a stroke at the height `h`. */
85
+ export const strokeWidth = (h) => STROKE * h;
@@ -0,0 +1,54 @@
1
+ /** An oval track: two straights of `straight` metres joined by two semicircles whose kerb radius is `radius` (Manual 2.2.1.1; Technical Rule 14.1). */
2
+ export interface Oval {
3
+ /** The length of each straight, which is also the distance between the centres of the semicircles. */
4
+ straight: number;
5
+ /** The radius of the semicircles at the kerb: the track's inside edge. */
6
+ radius: number;
7
+ /** The width of a lane, the 50 mm line on its right included (Rule 14.4). */
8
+ lane: number;
9
+ /** How many lanes the oval has. */
10
+ lanes: number;
11
+ /** The width of the lines. */
12
+ line: number;
13
+ /** Where the running line is measured: lane 1's from the kerb, every other lane's from the outer edge of the line on its left (Rule 14.2). */
14
+ inner: number;
15
+ outer: number;
16
+ }
17
+ /** A point on the track and the way the athlete is facing there (radians, clockwise from the right, as the eye sees it: 0 faces right, π/2 down). */
18
+ export interface Pose {
19
+ x: number;
20
+ y: number;
21
+ heading: number;
22
+ }
23
+ /** The radius of lane `n`'s running line (Rule 14.2, Manual 2.2.1.1): the kerb radius and 0.30 m for lane 1, and 0.20 m outside the line on the left for the others. */
24
+ export declare const laneRadius: (o: Oval, n: number) => number;
25
+ /** The radius of the outer edge of lane `n`'s line. */
26
+ export declare const laneEdge: (o: Oval, n: number) => number;
27
+ /** The length of lane `n`'s running line: one lap. */
28
+ export declare const lap: (o: Oval, n: number) => number;
29
+ /** A point on the running line of radius `r`, `s` metres from the finish line. A distance beyond a lap goes round again. */
30
+ export declare function pose(o: Oval, r: number, s: number): Pose;
31
+ /** The staggered start of a lane: how far ahead of lane 1's start line it is, for a race run in lanes round `bends` bends, `bends` half-turns of π(r - r₁) each (Manual Table 2.2.1.6a). */
32
+ export declare function stagger(o: Oval, n: number, bends: number): number;
33
+ /** The distance along the running line of radius `r` from the finish line of the point of it nearest to (x, y): the inverse of `pose`. */
34
+ export declare function distanceOn(o: Oval, r: number, x: number, y: number): number;
35
+ /** The bend the athletes run: `right` is the first, round CP2, and `left` the second, round CP1. */
36
+ type Side = "right" | "left";
37
+ /** The point of a bend's running line at the angle `f` (radians from the bend's entry), with the way the athlete faces. */
38
+ export declare function bendPoint(o: Oval, side: Side, r: number, f: number): Pose;
39
+ /**
40
+ * A point of an involute of the lane-1 running circle of a bend: the curve a tight wire makes when it is unwound from the pins round the kerb, which is how the Manual has the
41
+ * start lines and the breakline marked (2.2.1.6, "Marking for Curved Start Lines" and "Marking for the 800m Breakline"). Every point of it is the same distance from the finish by
42
+ * the shortest permitted route: a straight line to the circle and then round it. `wire` is the length of the wire already unwound where it touches the circle at the bend's entry
43
+ * (0 for a start on the bend, the distance back along the straight for one before it, 84.39 m for the 800 m breakline), and `f` the angle of the tangent point from the entry.
44
+ */
45
+ export declare function involutePoint(o: Oval, side: Side, a: number, wire: number, f: number): [number, number];
46
+ /**
47
+ * The start of a race of `distance` metres run in lanes' own staggers, and the breakline of the 800 m: the stagger of lane `n` over lane 1's, from the involute of the breakline
48
+ * (Manual Tables 2.2.1.6a and 2.2.1.6b). The breakline is the involute of lane 1's second-bend circle through the end of the first bend; a lane's runner is equal to lane 1's when
49
+ * the lane's run to the breakline is one semicircle of lane 1's length.
50
+ */
51
+ export declare function breaklineStagger(o: Oval, n: number): number;
52
+ /** The path of an arc of the circle (cx, cy, r) from the heading-free angle `a0` to `a1` (radians clockwise from the right as the eye sees it, y down). */
53
+ export declare function arcD(cx: number, cy: number, r: number, a0: number, a1: number): string;
54
+ export {};
@@ -0,0 +1,105 @@
1
+ // The geometry of an oval athletics track, in metres, as plain data. Nothing here draws: the plan (plan.ts) and the drawing (surfaces/athletics.ts) read it, and the tests check the figures
2
+ // the World Athletics Track and Field Facilities Manual (2019 edition, 2.2.1) prints against it.
3
+ //
4
+ // The frame: the origin is the middle of the track, x runs along the straights (to the right, as the oval is drawn wide) and y across them, down the page. The athletes run
5
+ // counter-clockwise as the eye sees it (left-hand inside, Technical Rule 17.2.1), so the finish straight is the bottom one, running to the right, and the finish line A stands on
6
+ // the axis through the right-hand semicircle's centre CP2 (Manual 2.2.1.4: "the prolongation of diameter D-A"). A lane's own length `s` is measured along its running line from the
7
+ // finish line, forward.
8
+ import { num } from "../format.js";
9
+ /** The radius of lane `n`'s running line (Rule 14.2, Manual 2.2.1.1): the kerb radius and 0.30 m for lane 1, and 0.20 m outside the line on the left for the others. */
10
+ export const laneRadius = (o, n) => (n <= 1 ? o.radius + o.inner : o.radius + (n - 1) * o.lane + o.outer);
11
+ /** The radius of the outer edge of lane `n`'s line. */
12
+ export const laneEdge = (o, n) => o.radius + n * o.lane;
13
+ /** The length of lane `n`'s running line: one lap. */
14
+ export const lap = (o, n) => 2 * o.straight + 2 * Math.PI * laneRadius(o, n);
15
+ /** A point on the running line of radius `r`, `s` metres from the finish line. A distance beyond a lap goes round again. */
16
+ export function pose(o, r, s) {
17
+ const S = o.straight;
18
+ const L = 2 * S + 2 * Math.PI * r;
19
+ const d = ((s % L) + L) % L;
20
+ const bend = Math.PI * r;
21
+ if (d <= bend) {
22
+ const f = d / r;
23
+ return { x: S / 2 + r * Math.sin(f), y: r * Math.cos(f), heading: -f };
24
+ }
25
+ if (d <= bend + S)
26
+ return { x: S / 2 - (d - bend), y: -r, heading: Math.PI };
27
+ if (d <= 2 * bend + S) {
28
+ const f = (d - bend - S) / r;
29
+ return { x: -S / 2 - r * Math.sin(f), y: -r * Math.cos(f), heading: Math.PI - f };
30
+ }
31
+ return { x: -S / 2 + (d - 2 * bend - S), y: r, heading: 0 };
32
+ }
33
+ /** The staggered start of a lane: how far ahead of lane 1's start line it is, for a race run in lanes round `bends` bends, `bends` half-turns of π(r - r₁) each (Manual Table 2.2.1.6a). */
34
+ export function stagger(o, n, bends) {
35
+ return bends * Math.PI * (laneRadius(o, n) - laneRadius(o, 1));
36
+ }
37
+ /** The distance along the running line of radius `r` from the finish line of the point of it nearest to (x, y): the inverse of `pose`. */
38
+ export function distanceOn(o, r, x, y) {
39
+ const S = o.straight;
40
+ const bend = Math.PI * r;
41
+ if (x >= S / 2)
42
+ return r * Math.atan2(x - S / 2, y);
43
+ if (x <= -S / 2)
44
+ return bend + S + r * Math.atan2(-(x + S / 2), -y);
45
+ return y < 0 ? bend + (S / 2 - x) : 2 * bend + S + (x + S / 2);
46
+ }
47
+ /** The point of a bend's running line at the angle `f` (radians from the bend's entry), with the way the athlete faces. */
48
+ export function bendPoint(o, side, r, f) {
49
+ const S = o.straight;
50
+ return side === "right"
51
+ ? { x: S / 2 + r * Math.sin(f), y: r * Math.cos(f), heading: -f }
52
+ : { x: -S / 2 - r * Math.sin(f), y: -r * Math.cos(f), heading: Math.PI - f };
53
+ }
54
+ /**
55
+ * A point of an involute of the lane-1 running circle of a bend: the curve a tight wire makes when it is unwound from the pins round the kerb, which is how the Manual has the
56
+ * start lines and the breakline marked (2.2.1.6, "Marking for Curved Start Lines" and "Marking for the 800m Breakline"). Every point of it is the same distance from the finish by
57
+ * the shortest permitted route: a straight line to the circle and then round it. `wire` is the length of the wire already unwound where it touches the circle at the bend's entry
58
+ * (0 for a start on the bend, the distance back along the straight for one before it, 84.39 m for the 800 m breakline), and `f` the angle of the tangent point from the entry.
59
+ */
60
+ export function involutePoint(o, side, a, wire, f) {
61
+ const T = bendPoint(o, side, a, f);
62
+ const l = wire + a * f;
63
+ return [T.x - l * Math.cos(T.heading), T.y - l * Math.sin(T.heading)];
64
+ }
65
+ /**
66
+ * The start of a race of `distance` metres run in lanes' own staggers, and the breakline of the 800 m: the stagger of lane `n` over lane 1's, from the involute of the breakline
67
+ * (Manual Tables 2.2.1.6a and 2.2.1.6b). The breakline is the involute of lane 1's second-bend circle through the end of the first bend; a lane's runner is equal to lane 1's when
68
+ * the lane's run to the breakline is one semicircle of lane 1's length.
69
+ */
70
+ export function breaklineStagger(o, n) {
71
+ const a = laneRadius(o, 1);
72
+ const r = laneRadius(o, n);
73
+ if (n <= 1)
74
+ return 0;
75
+ // The breakline: tangent points of the second bend's circle, wire 84.39 m at the bend's entry C. Find where it meets lane n's circle about CP2 (the first bend's).
76
+ const S = o.straight;
77
+ const lo0 = 0;
78
+ const f = (t) => {
79
+ const [x, y] = involutePoint(o, "left", a, S, t);
80
+ return Math.hypot(x - S / 2, y) - r;
81
+ };
82
+ let lo = lo0;
83
+ let hi = 1.5;
84
+ // The radius from CP2 grows with t: bisect.
85
+ for (let i = 0; i < 80; i += 1) {
86
+ const mid = (lo + hi) / 2;
87
+ if (f(mid) < 0)
88
+ lo = mid;
89
+ else
90
+ hi = mid;
91
+ }
92
+ const t = (lo + hi) / 2;
93
+ const [x, y] = involutePoint(o, "left", a, S, t);
94
+ // The angle of the point about CP2 from the top (the end of the first bend), growing towards the finish line (so that a point beyond the line of the diameter is negative).
95
+ const behind = Math.atan2(x - S / 2, -y);
96
+ const arc = r * (Math.PI - behind);
97
+ return arc - Math.PI * a;
98
+ }
99
+ /** The path of an arc of the circle (cx, cy, r) from the heading-free angle `a0` to `a1` (radians clockwise from the right as the eye sees it, y down). */
100
+ export function arcD(cx, cy, r, a0, a1) {
101
+ const p = (a) => `${num(cx + r * Math.cos(a))} ${num(cy + r * Math.sin(a))}`;
102
+ const large = Math.abs(a1 - a0) > Math.PI ? 1 : 0;
103
+ const sweep = a1 > a0 ? 1 : 0;
104
+ return `M${p(a0)}A${num(r)} ${num(r)} 0 ${large} ${sweep} ${p(a1)}`;
105
+ }
@@ -0,0 +1,77 @@
1
+ import type { SoccerPitchId, SoccerSize } from "../surfaces/soccer-spec.ts";
2
+ /** The races a drawing can mark: where each starts, how it is staggered or curved, its hurdles or its exchange zones. A race is named by its distance, in kebab case. */
3
+ export type AthleticsRace = "60m" | "60m-hurdles" | "100m" | "100m-hurdles" | "110m-hurdles" | "200m" | "400m" | "400m-hurdles" | "800m" | "1000m" | "1500m" | "mile" | "2000m" | "3000m" | "5000m" | "10000m" | "2000m-steeplechase" | "3000m-steeplechase" | "4x100m" | "4x400m";
4
+ /** The field events a drawing can mark in the infield, and alone at a large scale (`layout`). */
5
+ export type AthleticsFieldEvent = "high-jump" | "pole-vault" | "long-jump" | "triple-jump" | "shot-put" | "discus-throw" | "hammer-throw" | "javelin-throw";
6
+ /** What lies inside the track: the soccer pitch the package draws (`pitch`), plain mown grass, or nothing but the track's own surface. */
7
+ export type AthleticsInfield = "pitch" | "grass" | "none";
8
+ /** The colour of the track: Mondo red (the usual), Berlin's blue (the 2009 World Championships), the terracotta of a club track, or green. A colour of your own is `colors.surface`... or `colors.track`. */
9
+ export type AthleticsTrackLook = "red" | "blue" | "terracotta" | "green";
10
+ /** Where the steeplechase's water jump is: inside the second bend, outside it, or not drawn. */
11
+ export type WaterJump = "inside" | "outside" | "none";
12
+ /** The kind of a race's start, which says how its lines are made. */
13
+ export type StartKind = "straight" | "stagger" | "curved" | "steeplechase";
14
+ /**
15
+ * What an athletics drawing takes beyond a surface: the number of lanes, the colour of the track, what is in the infield, which races and which field events are marked.
16
+ * Every part is optional; the standard 400 m track of World Athletics, with eight lanes, a red track, a soccer pitch inside it and every field event in its usual place, is drawn without any.
17
+ */
18
+ export interface AthleticsStyle {
19
+ /** The lanes of the oval: 4 to 9 outdoors (8 by default; the Manual says nine is the most there should be), 4 to 6 on the indoor track (6 by default). */
20
+ lanes?: number;
21
+ /** The lanes of the straight that runs on beyond the oval's, 6 to 10 (the oval's number by default), as the straight of a 10-lane stadium is built (Manual 2.2.2). */
22
+ straightLanes?: number;
23
+ /** The colour of the track: `red` (the default), `blue`, `terracotta` or `green`. */
24
+ track?: AthleticsTrackLook;
25
+ /** What is inside the track: `pitch` (the default outdoors: a soccer pitch laid out as the package draws it), `grass` or `none`. */
26
+ infield?: AthleticsInfield;
27
+ /** The pitch inside the track when `infield` is `pitch`: a preset or a size, as the soccer `pitch` option. 105 by 68 metres by default. */
28
+ pitch?: SoccerPitchId | SoccerSize;
29
+ /** The field events drawn, each in its usual place in the standard stadium: all by default, `false` for none, or a list. */
30
+ events?: boolean | readonly AthleticsFieldEvent[];
31
+ /** The races whose starts and marks are drawn: the finish line and the lane numbers always are. `all` marks every race; a list marks those. None by default. */
32
+ races?: "all" | readonly AthleticsRace[];
33
+ /** The race of a close-up of a start (`range: "start"`): the 400 m by default. The race's start is marked whether or not it is in `races`. */
34
+ start?: AthleticsRace;
35
+ /** One field event alone, drawn at a large scale from the rulebook's own diagram: its runway or circle, its pit or sector, and its landing area. */
36
+ layout?: AthleticsFieldEvent;
37
+ /** The steeplechase's water jump: `inside` the second bend (the default) or `outside` it. Drawn with the steeplechase races. */
38
+ waterJump?: WaterJump;
39
+ /** The lane numbers painted on the track at the start and the finish lines: on by default. */
40
+ numbers?: boolean;
41
+ /** Draw the oval's lanes in the straight's numbers as well as the oval's, on the finish straight: on by default. */
42
+ straightNumbers?: boolean;
43
+ }
44
+ /** A race, as the package knows it. */
45
+ export interface RaceInfo {
46
+ id: AthleticsRace;
47
+ /** The distance in metres (the legs of a relay are in `legs`). */
48
+ distance: number;
49
+ kind: StartKind;
50
+ /** The legs of a relay, in metres. */
51
+ legs?: readonly number[];
52
+ /** The bends run in lanes (a stagger's), for a race that starts staggered. */
53
+ bends?: number;
54
+ /** True for a race with a breakline, which the athletes may leave their lanes after. */
55
+ breakline?: boolean;
56
+ /** True for a race that is run over hurdles. */
57
+ hurdles?: boolean;
58
+ /** True for a race of the covered track only: the 60 m and its hurdles, on the infield straight. */
59
+ indoor?: boolean;
60
+ /** True for a race with a group start, which an outer half of the track may start on a line of its own. */
61
+ group?: boolean;
62
+ /** The words of its name, in English, Japanese and French. */
63
+ name: {
64
+ en: string;
65
+ ja: string;
66
+ fr: string;
67
+ };
68
+ }
69
+ /** A field event, as the package knows it. */
70
+ export interface FieldEventInfo {
71
+ id: AthleticsFieldEvent;
72
+ name: {
73
+ en: string;
74
+ ja: string;
75
+ fr: string;
76
+ };
77
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ export { laneDraw, raceResults, raceReplay, fieldMarks, formatTime, distanceRun } from "./charts.athletics.ts";
2
+ export type { AthleticsEntry, AthleticsResult, AthleticsRaceOptions, AthleticsRunner, FieldAttempt, FieldMarksOptions, FieldTotals, LaneDrawTotals, RaceReplay, RaceReplayOptions, ResultsTotals } from "./charts.athletics.ts";
3
+ export { FIELD_EVENTS, FIELD_EVENT_IDS, RACES, RACE_IDS, fieldEventById, raceById } from "./athletics/events.ts";
4
+ export { athleticsLeague, athleticsPlan, eventsOf, racesOf, INDOOR_RACES } from "./athletics/plan.ts";
5
+ export type { AthleticsPlan, MBox, MMark, MRange } from "./athletics/plan.ts";
6
+ export { breaklineStagger, distanceOn, laneEdge, laneRadius, lap, pose, stagger } from "./athletics/track.ts";
7
+ export type { Oval, Pose } from "./athletics/track.ts";
8
+ export { firstStart, markRace, staggerOf } from "./athletics/races.ts";
9
+ export type { RaceMarks, StartPlacement } from "./athletics/races.ts";
10
+ export { ARENA, SECTOR_REACH } from "./athletics/infield.ts";
11
+ export { JAVELIN_HALF, SECTOR_ANGLE } from "./athletics/facilities.ts";
12
+ export type { Facility } from "./athletics/facilities.ts";
13
+ export { HURDLE as STEEPLECHASE_HURDLE, INSIDE as STEEPLECHASE_INSIDE, OUTSIDE as STEEPLECHASE_OUTSIDE, scPose } from "./athletics/steeplechase.ts";
14
+ export { ATHLETICS_LEAGUES, WA_SHORT_STAGGER_TABLE, WA_SHORT_TRACK, WA_STAGGER_TABLE, WA_STANDARD_TRACK } from "./leagues/athletics.ts";
15
+ export type { AthleticsFigures, AthleticsLeague } from "./leagues/athletics.ts";
16
+ export { KYOGIJO_ATHLETICS_STYLE, KYOGIJO_TRACK_STYLE, TRACK_COLOURS } from "./athletics.style.ts";
17
+ export type { AthleticsFieldEvent, AthleticsInfield, AthleticsRace, AthleticsStyle, AthleticsTrackLook, FieldEventInfo, RaceInfo, WaterJump } from "./athletics/types.ts";
@@ -0,0 +1,11 @@
1
+ // The athletics stadium: the races and the field events, the plan of the track and what is marked on it, the oval's geometry (a point of a lane, the stagger of each lane's start), and the data: lane draws, results, a replay and the marks of throws and jumps.
2
+ export { laneDraw, raceResults, raceReplay, fieldMarks, formatTime, distanceRun } from "./charts.athletics.js";
3
+ export { FIELD_EVENTS, FIELD_EVENT_IDS, RACES, RACE_IDS, fieldEventById, raceById } from "./athletics/events.js";
4
+ export { athleticsLeague, athleticsPlan, eventsOf, racesOf, INDOOR_RACES } from "./athletics/plan.js";
5
+ export { breaklineStagger, distanceOn, laneEdge, laneRadius, lap, pose, stagger } from "./athletics/track.js";
6
+ export { firstStart, markRace, staggerOf } from "./athletics/races.js";
7
+ export { ARENA, SECTOR_REACH } from "./athletics/infield.js";
8
+ export { JAVELIN_HALF, SECTOR_ANGLE } from "./athletics/facilities.js";
9
+ export { HURDLE as STEEPLECHASE_HURDLE, INSIDE as STEEPLECHASE_INSIDE, OUTSIDE as STEEPLECHASE_OUTSIDE, scPose } from "./athletics/steeplechase.js";
10
+ export { ATHLETICS_LEAGUES, WA_SHORT_STAGGER_TABLE, WA_SHORT_TRACK, WA_STAGGER_TABLE, WA_STANDARD_TRACK } from "./leagues/athletics.js";
11
+ export { KYOGIJO_ATHLETICS_STYLE, KYOGIJO_TRACK_STYLE, TRACK_COLOURS } from "./athletics.style.js";
@@ -0,0 +1,16 @@
1
+ import type { AthleticsTrackLook } from "./athletics/types.ts";
2
+ /** The colours of each track look, light and dark. */
3
+ export declare const TRACK_COLOURS: Readonly<Record<AthleticsTrackLook, {
4
+ light: string;
5
+ dark: string;
6
+ }>>;
7
+ /** The rules of an athletics drawing's colours. A drawing that names its track (`athletics.track`) has its `data-track`, whose rules come after a look's so that the track wins. */
8
+ export declare const KYOGIJO_ATHLETICS_STYLE: string;
9
+ /** The rules of a named track: its colour in light and dark, and, on a blue track, red where the rules say blue (the 4 x 400 m's marks and the 110 m hurdles). */
10
+ export declare function trackStyle(track: AthleticsTrackLook): string;
11
+ /** The rules of every named track, for a page that draws with `style: "none"`. */
12
+ export declare const KYOGIJO_TRACK_STYLE: string;
13
+ /** The base rules a drawing of this sport writes into its stylesheet: nothing for another sport. */
14
+ export declare const athleticsStyle: (sport: string) => string;
15
+ /** The rules of the track the options name, written after a look's so that the track wins: nothing for another sport or a track not named. */
16
+ export declare const athleticsTrackRules: (sport: string, track: AthleticsTrackLook | undefined) => string;
@@ -0,0 +1,51 @@
1
+ const MARKS_LIGHT = "--ky-ath-y:#f2c230;--ky-ath-b:#1d4ed8;--ky-ath-g:#1f9d4c;--ky-ath-k:#1c1f1d;--ky-ath-r:#d6342a;--ky-sand:#e3cf9d;--ky-mat:#3d6fb5;--ky-water:#7cc4ee;--ky-concrete:#a9adb0;--ky-pad:#40454a";
2
+ const MARKS_DARK = "--ky-ath-y:#f2c230;--ky-ath-b:#6f95ff;--ky-ath-g:#43c06d;--ky-ath-k:#0f1210;--ky-ath-r:#ef6c60;--ky-sand:#a89568;--ky-mat:#2c528a;--ky-water:#4d8fb8;--ky-concrete:#6e7377;--ky-pad:#1f2326";
3
+ /** The colours of each track look, light and dark. */
4
+ export const TRACK_COLOURS = {
5
+ red: { light: "#c05a46", dark: "#9a4636" },
6
+ blue: { light: "#2f65b4", dark: "#264f8c" },
7
+ terracotta: { light: "#c9744a", dark: "#a45b3a" },
8
+ green: { light: "#3b8a62", dark: "#2d6b4c" },
9
+ };
10
+ const GROUND = {
11
+ light: { track: TRACK_COLOURS.red.light, surface: "#4c9b56", alt: "#438f4d", apron: "#d9d6c8" },
12
+ dark: { track: TRACK_COLOURS.red.dark, surface: "#2d6c3e", alt: "#276136", apron: "#1b1f1c" },
13
+ };
14
+ const base = (c, marks) => `--ky-track:${c.track};--ky-surface:${c.surface};--ky-surface-alt:${c.alt};--ky-apron:${c.apron};${marks}`;
15
+ /** The rules of an athletics drawing's colours. A drawing that names its track (`athletics.track`) has its `data-track`, whose rules come after a look's so that the track wins. */
16
+ export const KYOGIJO_ATHLETICS_STYLE = [
17
+ `:where(.kyogijo[data-sport=athletics]){${base(GROUND.light, MARKS_LIGHT)}}`,
18
+ `@media (prefers-color-scheme:dark){:where(html:not([data-theme=light]) .kyogijo[data-sport=athletics]:not([data-theme=light])){${base(GROUND.dark, MARKS_DARK)}}}`,
19
+ `:where(html[data-theme=dark] .kyogijo[data-sport=athletics],.kyogijo[data-theme=dark][data-sport=athletics]){${base(GROUND.dark, MARKS_DARK)}}`,
20
+ ".kyogijo .ky-ath-track{fill:var(--ky-track)}",
21
+ ".kyogijo .ky-ath-grass{fill:var(--ky-surface)}",
22
+ ".kyogijo .ky-ath-sand{fill:var(--ky-sand)}",
23
+ ".kyogijo .ky-ath-mat{fill:var(--ky-mat)}",
24
+ ".kyogijo .ky-ath-water{fill:var(--ky-water)}",
25
+ ".kyogijo .ky-ath-concrete{fill:var(--ky-concrete)}",
26
+ ".kyogijo .ky-ath-pad{fill:var(--ky-pad)}",
27
+ ".kyogijo .ky-ath-board{fill:var(--ky-line)}",
28
+ ".kyogijo .ky-ath-bank{fill:var(--ky-ath-k);fill-opacity:.12}",
29
+ ".kyogijo .ky-ath-y{stroke:var(--ky-ath-y);fill:none}.kyogijo .ky-ath-b{stroke:var(--ky-ath-b);fill:none}.kyogijo .ky-ath-g{stroke:var(--ky-ath-g);fill:none}.kyogijo .ky-ath-k{stroke:var(--ky-ath-k);fill:none}.kyogijo .ky-ath-r{stroke:var(--ky-ath-r);fill:none}.kyogijo .ky-ath-s{stroke:var(--ky-line);stroke-opacity:.8;fill:none}",
30
+ ".kyogijo .ky-ath-y-fill{fill:var(--ky-ath-y)}.kyogijo .ky-ath-b-fill{fill:var(--ky-ath-b)}.kyogijo .ky-ath-g-fill{fill:var(--ky-ath-g)}.kyogijo .ky-ath-k-fill{fill:var(--ky-ath-k)}.kyogijo .ky-ath-r-fill{fill:var(--ky-ath-r)}",
31
+ ".kyogijo .ky-ath-num{fill:none;stroke:var(--ky-line);stroke-linejoin:round}",
32
+ ".kyogijo .ky-ath-tag{fill:var(--ky-plate)}.kyogijo .ky-ath-tagnum{fill:none;stroke:var(--ky-plate-ink);stroke-linejoin:round}",
33
+ ].join("\n");
34
+ /** The rules of a named track: its colour in light and dark, and, on a blue track, red where the rules say blue (the 4 x 400 m's marks and the 110 m hurdles). */
35
+ export function trackStyle(track) {
36
+ const c = TRACK_COLOURS[track];
37
+ const at = `[data-track=${track}]`;
38
+ const red = track === "blue" ? ";--ky-ath-b:#e0342b" : "";
39
+ const redDark = track === "blue" ? ";--ky-ath-b:#ff7a6e" : "";
40
+ return [
41
+ `:where(.kyogijo${at}){--ky-track:${c.light}${red}}`,
42
+ `@media (prefers-color-scheme:dark){:where(html:not([data-theme=light]) .kyogijo${at}:not([data-theme=light])){--ky-track:${c.dark}${redDark}}}`,
43
+ `:where(html[data-theme=dark] .kyogijo${at},.kyogijo[data-theme=dark]${at}){--ky-track:${c.dark}${redDark}}`,
44
+ ].join("\n");
45
+ }
46
+ /** The rules of every named track, for a page that draws with `style: "none"`. */
47
+ export const KYOGIJO_TRACK_STYLE = Object.keys(TRACK_COLOURS).map(trackStyle).join("\n");
48
+ /** The base rules a drawing of this sport writes into its stylesheet: nothing for another sport. */
49
+ export const athleticsStyle = (sport) => (sport === "athletics" ? KYOGIJO_ATHLETICS_STYLE : "");
50
+ /** The rules of the track the options name, written after a look's so that the track wins: nothing for another sport or a track not named. */
51
+ export const athleticsTrackRules = (sport, track) => (sport === "athletics" && track !== undefined ? trackStyle(track) : "");
@@ -1,4 +1,8 @@
1
- export { PLACES, atlasFacets, placeById, placeByName, placesBy, placesByName, surfaceOf } from "./atlas.ts";
1
+ export { PLACES, atlasFacets, hallSurfaces, placeById, placeByName, placesBy, placesByClub, placesByName, surfaceOf, surfacesOf, tenantsOf } from "./atlas.ts";
2
+ export { HALLS } from "./halls.ts";
3
+ export type { Hall, HallBasis, HallSurface } from "./halls.ts";
2
4
  export { officialName, plainName } from "./names.ts";
5
+ export { TENANTS, TENANT_JAPANESE_NAMES, nameJaOf } from "./tenants.ts";
3
6
  export type { PlaceAlias, PlaceNameKind } from "./names.ts";
4
- export type { AtlasFacets, Place, PlaceFilter, PlaceKind, PlaceSport, PlaceStatus } from "./atlas.ts";
7
+ export type { AtlasFacets, Place, PlaceFilter, PlaceKind, PlaceSport, PlaceStatus, PlaceSurface, SurfaceSport, TenantFilter } from "./atlas.ts";
8
+ export type { Tenant, TenantArticle, TenantNameJa, TenantNameKind, TenantSource, TenantSport } from "./tenants.ts";
@@ -1,3 +1,5 @@
1
- // The atlas: every ballpark and soccer ground with where it stands and when it was in use, and the filters over them.
2
- export { PLACES, atlasFacets, placeById, placeByName, placesBy, placesByName, surfaceOf } from "./atlas.js";
1
+ // The atlas: every ballpark, soccer ground and hockey and basketball arena, and the famous halls of the budō, with where it stands, when it was in use and the clubs that played there, and the filters over them.
2
+ export { PLACES, atlasFacets, hallSurfaces, placeById, placeByName, placesBy, placesByClub, placesByName, surfaceOf, surfacesOf, tenantsOf } from "./atlas.js";
3
+ export { HALLS } from "./halls.js";
3
4
  export { officialName, plainName } from "./names.js";
5
+ export { TENANTS, TENANT_JAPANESE_NAMES, nameJaOf } from "./tenants.js";