@sportsdataverse/sdvplot 0.0.0-stage → 0.2.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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +109 -0
  3. package/README.md +984 -2
  4. package/dist/_web-D7Aa5Rd8.d.ts +69 -0
  5. package/dist/aaf-GJ3SH34T.js +13 -0
  6. package/dist/aaf-HCYN5T6Y.js +37 -0
  7. package/dist/aaf-ZAE5KS2Y.js +13 -0
  8. package/dist/ahl-E66MDVCU.js +66 -0
  9. package/dist/ahl-NPQQWZEV.js +249 -0
  10. package/dist/ahl-QRDU73XX.js +309 -0
  11. package/dist/axis-CraWQRUJ.d.ts +49 -0
  12. package/dist/bins.d.ts +174 -0
  13. package/dist/bins.js +4 -0
  14. package/dist/bins.js.map +1 -0
  15. package/dist/cfb-F42SVS4X.js +5000 -0
  16. package/dist/cfb-P3SHEYRZ.js +692 -0
  17. package/dist/cfb-WXRZANLP.js +10226 -0
  18. package/dist/chartjs-surface.d.ts +42 -0
  19. package/dist/chartjs-surface.js +65 -0
  20. package/dist/chartjs-surface.js.map +1 -0
  21. package/dist/chartjs.d.ts +162 -0
  22. package/dist/chartjs.js +342 -0
  23. package/dist/chartjs.js.map +1 -0
  24. package/dist/chunk-4C3GX6QO.js +92 -0
  25. package/dist/chunk-4C3GX6QO.js.map +1 -0
  26. package/dist/chunk-57WFSI4Q.js +128 -0
  27. package/dist/chunk-57WFSI4Q.js.map +1 -0
  28. package/dist/chunk-7ULOCCFL.js +313 -0
  29. package/dist/chunk-7ULOCCFL.js.map +1 -0
  30. package/dist/chunk-AMXASQHT.js +120 -0
  31. package/dist/chunk-AMXASQHT.js.map +1 -0
  32. package/dist/chunk-B2MP37SR.js +175 -0
  33. package/dist/chunk-B2MP37SR.js.map +1 -0
  34. package/dist/chunk-C2CDY5OG.js +137 -0
  35. package/dist/chunk-C2CDY5OG.js.map +1 -0
  36. package/dist/chunk-DYMUVE6K.js +127 -0
  37. package/dist/chunk-DYMUVE6K.js.map +1 -0
  38. package/dist/chunk-E7G7VSLV.js +43 -0
  39. package/dist/chunk-E7G7VSLV.js.map +1 -0
  40. package/dist/chunk-H2C3FMMA.js +300 -0
  41. package/dist/chunk-H2C3FMMA.js.map +1 -0
  42. package/dist/chunk-J4P4HDBF.js +175 -0
  43. package/dist/chunk-J4P4HDBF.js.map +1 -0
  44. package/dist/chunk-J6R2LEJ7.js +58 -0
  45. package/dist/chunk-J6R2LEJ7.js.map +1 -0
  46. package/dist/chunk-M3XD2OSN.js +132 -0
  47. package/dist/chunk-M3XD2OSN.js.map +1 -0
  48. package/dist/chunk-OIILARXI.js +30 -0
  49. package/dist/chunk-OIILARXI.js.map +1 -0
  50. package/dist/chunk-RPVVJY74.js +170 -0
  51. package/dist/chunk-RPVVJY74.js.map +1 -0
  52. package/dist/chunk-UL5M6KDE.js +205 -0
  53. package/dist/chunk-UL5M6KDE.js.map +1 -0
  54. package/dist/chunk-WQT4IVLX.js +10 -0
  55. package/dist/chunk-WQT4IVLX.js.map +1 -0
  56. package/dist/chunk-ZAEQXFJM.js +556 -0
  57. package/dist/chunk-ZAEQXFJM.js.map +1 -0
  58. package/dist/cricket-KPCYG2HL.js +493 -0
  59. package/dist/cricket-NDXLE25B.js +116 -0
  60. package/dist/cricket-YUUF7P6M.js +160 -0
  61. package/dist/cytoscape.d.ts +188 -0
  62. package/dist/cytoscape.js +219 -0
  63. package/dist/cytoscape.js.map +1 -0
  64. package/dist/d3.d.ts +234 -0
  65. package/dist/d3.js +198 -0
  66. package/dist/d3.js.map +1 -0
  67. package/dist/deckgl.d.ts +232 -0
  68. package/dist/deckgl.js +197 -0
  69. package/dist/deckgl.js.map +1 -0
  70. package/dist/echarts.d.ts +121 -0
  71. package/dist/echarts.js +228 -0
  72. package/dist/echarts.js.map +1 -0
  73. package/dist/echl-3CR4RGFC.js +241 -0
  74. package/dist/echl-NPC32C23.js +107 -0
  75. package/dist/echl-PI33DGJC.js +64 -0
  76. package/dist/export.d.ts +130 -0
  77. package/dist/export.js +258 -0
  78. package/dist/export.js.map +1 -0
  79. package/dist/g2.d.ts +251 -0
  80. package/dist/g2.js +102 -0
  81. package/dist/g2.js.map +1 -0
  82. package/dist/headshots-B2J_LOO8.d.ts +40 -0
  83. package/dist/index.d.ts +183 -0
  84. package/dist/index.js +9 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/interact.d.ts +567 -0
  87. package/dist/interact.js +809 -0
  88. package/dist/interact.js.map +1 -0
  89. package/dist/lightweight-charts.d.ts +217 -0
  90. package/dist/lightweight-charts.js +155 -0
  91. package/dist/lightweight-charts.js.map +1 -0
  92. package/dist/maplibre.d.ts +271 -0
  93. package/dist/maplibre.js +175 -0
  94. package/dist/maplibre.js.map +1 -0
  95. package/dist/marks-DH-tQIP-.d.ts +75 -0
  96. package/dist/mbb-3TRLVW3H.js +3619 -0
  97. package/dist/mbb-DQUHCHZP.js +5111 -0
  98. package/dist/mbb-PRAIO2P5.js +371 -0
  99. package/dist/milb-6IQ6NCEW.js +291 -0
  100. package/dist/milb-EYY5MD4T.js +1752 -0
  101. package/dist/milb-EYZ4SZLI.js +797 -0
  102. package/dist/mlb-4PBUJSVQ.js +35 -0
  103. package/dist/mlb-FHPY3GQJ.js +701 -0
  104. package/dist/mlb-REVGL3N2.js +665 -0
  105. package/dist/mui.d.ts +338 -0
  106. package/dist/mui.js +184 -0
  107. package/dist/mui.js.map +1 -0
  108. package/dist/nba-ATT775GS.js +485 -0
  109. package/dist/nba-LKM4UHVU.js +482 -0
  110. package/dist/nba-YX7PXM3R.js +35 -0
  111. package/dist/nbagl-3WGZCZ4S.js +37 -0
  112. package/dist/nbagl-LP4XJRAL.js +229 -0
  113. package/dist/nbagl-VTTOU7LN.js +499 -0
  114. package/dist/ncaa_baseball-UV75LNVR.js +2670 -0
  115. package/dist/ncaa_baseball-VD5J5C72.js +419 -0
  116. package/dist/ncaa_baseball-YRBS32D6.js +4592 -0
  117. package/dist/ncaa_mhockey-IMYHS7QS.js +1033 -0
  118. package/dist/ncaa_mhockey-TXTKWHE3.js +115 -0
  119. package/dist/ncaa_mhockey-U3MFW5VT.js +663 -0
  120. package/dist/ncaa_softball-6WR6KS64.js +420 -0
  121. package/dist/ncaa_softball-RZCTIE56.js +2654 -0
  122. package/dist/ncaa_softball-VOD4PVGY.js +4599 -0
  123. package/dist/ncaa_whockey-6XXGUTBK.js +607 -0
  124. package/dist/ncaa_whockey-AKKYKY67.js +53 -0
  125. package/dist/ncaa_whockey-KBEKXFBB.js +293 -0
  126. package/dist/nfl-BDB2HYAR.js +625 -0
  127. package/dist/nfl-EHYHDLJD.js +37 -0
  128. package/dist/nfl-VF4NJCHY.js +514 -0
  129. package/dist/nfl_gsis-UY64JO37.js +4 -0
  130. package/dist/nhl-6WPHME7H.js +511 -0
  131. package/dist/nhl-EMIJFZHY.js +884 -0
  132. package/dist/nhl-ISFUKRFU.js +37 -0
  133. package/dist/nivo.d.ts +193 -0
  134. package/dist/nivo.js +8 -0
  135. package/dist/nivo.js.map +1 -0
  136. package/dist/ohl-2FEM554G.js +113 -0
  137. package/dist/ohl-C5Q4W6JB.js +32 -0
  138. package/dist/ohl-TQ4J46VC.js +66 -0
  139. package/dist/perspective.d.ts +198 -0
  140. package/dist/perspective.js +171 -0
  141. package/dist/perspective.js.map +1 -0
  142. package/dist/phf-H7POU2KW.js +32 -0
  143. package/dist/phf-K5IFMZUM.js +13 -0
  144. package/dist/phf-TWJI3BOW.js +20 -0
  145. package/dist/placement-UWkqUzpa.d.ts +32 -0
  146. package/dist/plot.d.ts +451 -0
  147. package/dist/plot.js +712 -0
  148. package/dist/plot.js.map +1 -0
  149. package/dist/plotly.d.ts +129 -0
  150. package/dist/plotly.js +360 -0
  151. package/dist/plotly.js.map +1 -0
  152. package/dist/pwhl-OX3BO4JI.js +53 -0
  153. package/dist/pwhl-W44OC3C6.js +17 -0
  154. package/dist/pwhl-ZJGG3H7W.js +23 -0
  155. package/dist/qmjhl-5HISEHLL.js +35 -0
  156. package/dist/qmjhl-DA3UHKE5.js +125 -0
  157. package/dist/qmjhl-YG4BOQPF.js +614 -0
  158. package/dist/react.d.ts +377 -0
  159. package/dist/react.js +522 -0
  160. package/dist/react.js.map +1 -0
  161. package/dist/recharts.d.ts +162 -0
  162. package/dist/recharts.js +8 -0
  163. package/dist/recharts.js.map +1 -0
  164. package/dist/resolve-CQW-jzvr.d.ts +28 -0
  165. package/dist/selection-D4T3PkRt.d.ts +140 -0
  166. package/dist/shadcn.d.ts +83 -0
  167. package/dist/shadcn.js +88 -0
  168. package/dist/shadcn.js.map +1 -0
  169. package/dist/shots.d.ts +364 -0
  170. package/dist/shots.js +86 -0
  171. package/dist/shots.js.map +1 -0
  172. package/dist/soccer-7BH3ZLVL.js +7898 -0
  173. package/dist/soccer-MRU25OGE.js +2636 -0
  174. package/dist/soccer-PF4IPPVA.js +12342 -0
  175. package/dist/surface-TR7YFJW3.js +4 -0
  176. package/dist/surface-TR7YFJW3.js.map +1 -0
  177. package/dist/surfaces-MIG7HOFU.js +6 -0
  178. package/dist/surfaces-MIG7HOFU.js.map +1 -0
  179. package/dist/surfaces-W-odWLpT.d.ts +47 -0
  180. package/dist/svelte/HeadshotMark.svelte +25 -0
  181. package/dist/svelte/HeadshotMark.svelte.d.ts +10 -0
  182. package/dist/svelte/HeadshotMark.svelte.d.ts.map +1 -0
  183. package/dist/svelte/LogoMark.svelte +25 -0
  184. package/dist/svelte/LogoMark.svelte.d.ts +10 -0
  185. package/dist/svelte/LogoMark.svelte.d.ts.map +1 -0
  186. package/dist/svelte/Marks.svelte +25 -0
  187. package/dist/svelte/Marks.svelte.d.ts +10 -0
  188. package/dist/svelte/Marks.svelte.d.ts.map +1 -0
  189. package/dist/svelte/Surface.svelte +29 -0
  190. package/dist/svelte/Surface.svelte.d.ts +9 -0
  191. package/dist/svelte/Surface.svelte.d.ts.map +1 -0
  192. package/dist/svelte/SurfaceBackdrop.svelte +26 -0
  193. package/dist/svelte/SurfaceBackdrop.svelte.d.ts +11 -0
  194. package/dist/svelte/SurfaceBackdrop.svelte.d.ts.map +1 -0
  195. package/dist/svelte/index.d.ts +13 -0
  196. package/dist/svelte/index.d.ts.map +1 -0
  197. package/dist/svelte/index.js +11 -0
  198. package/dist/svelte-core.d.ts +139 -0
  199. package/dist/svelte-core.js +123 -0
  200. package/dist/svelte-core.js.map +1 -0
  201. package/dist/tanstack.d.ts +240 -0
  202. package/dist/tanstack.js +110 -0
  203. package/dist/tanstack.js.map +1 -0
  204. package/dist/testing.d.ts +75 -0
  205. package/dist/testing.js +239 -0
  206. package/dist/testing.js.map +1 -0
  207. package/dist/three.d.ts +223 -0
  208. package/dist/three.js +50 -0
  209. package/dist/three.js.map +1 -0
  210. package/dist/tiers-BN4md-GB.d.ts +65 -0
  211. package/dist/types-C7n6gJF3.d.ts +62 -0
  212. package/dist/ufl-7VLZTLTT.js +143 -0
  213. package/dist/ufl-CCMBLPSW.js +100 -0
  214. package/dist/ufl-F2BJRXME.js +16 -0
  215. package/dist/unovis.d.ts +127 -0
  216. package/dist/unovis.js +108 -0
  217. package/dist/unovis.js.map +1 -0
  218. package/dist/uplot.d.ts +120 -0
  219. package/dist/uplot.js +110 -0
  220. package/dist/uplot.js.map +1 -0
  221. package/dist/usfl-4CR5RMZJ.js +32 -0
  222. package/dist/usfl-LD7HP2YK.js +14 -0
  223. package/dist/usfl-VU4YSJQD.js +19 -0
  224. package/dist/ushl-CPG2LB4L.js +73 -0
  225. package/dist/ushl-PQL6HJAD.js +88 -0
  226. package/dist/ushl-ZT2ATPHK.js +22 -0
  227. package/dist/vega.d.ts +85 -0
  228. package/dist/vega.js +362 -0
  229. package/dist/vega.js.map +1 -0
  230. package/dist/victory.d.ts +107 -0
  231. package/dist/victory.js +38 -0
  232. package/dist/victory.js.map +1 -0
  233. package/dist/wbb-3KHCDYTK.js +5087 -0
  234. package/dist/wbb-BMX53Q3Q.js +369 -0
  235. package/dist/wbb-QNRN2CJJ.js +3620 -0
  236. package/dist/whl-4ATYZWUB.js +97 -0
  237. package/dist/whl-RVFPL6MH.js +79 -0
  238. package/dist/whl-Y7ASKYMM.js +28 -0
  239. package/dist/wnba-FWX5SFVI.js +232 -0
  240. package/dist/wnba-GX6HZR4B.js +220 -0
  241. package/dist/wnba-NTMWIPP6.js +20 -0
  242. package/dist/xfl-43R2JMJK.js +30 -0
  243. package/dist/xfl-H3BXQPZZ.js +16 -0
  244. package/dist/xfl-XON7A7FI.js +69 -0
  245. package/package.json +366 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plot/marks.ts","../src/plot/link.ts","../src/plot/axis.ts","../src/plot/scales.ts","../src/plot/lines.ts","../src/plot/title.ts","../src/plot/tiers.ts","../src/plot/surface.ts","../src/plot/shots.ts"],"names":["Plot","values","initializer","Plot2","Plot3","text","Plot4","Plot5","tip","geo","pointer"],"mappings":";;;;;;;;;;;;;;;;AAsEA,IAAM,OAAO,CAAI,IAAA,KACf,MAAA,CAAO,QAAA,IAAY,QAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,IAAI,KAAK,EAAE,SAAA,IAAa,QAAQ,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,GAAI,IAAA;AAE/F,IAAM,SAAS,CAAI,IAAA,EAAe,CAAA,KAC3BA,KAAA,CAAA,OAAA,CAAQ,MAAmB,CAAsB,CAAA;AAGxD,SAAS,KAAA,CAAS,MAAe,CAAA,EAA4B;AAC3D,EAAA,MAAM,CAAA,GAAI,OAAO,CAAA,KAAM,QAAA,IAAY,MAAM,IAAA,IAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,IAAK,OAAA,IAAW,CAAA,GAAI,EAAE,KAAA,GAAQ,CAAA;AAC/F,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,OAAO,CAAA,KAAM,UAAA,IAAc,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA,GACtE,MAAA,CAAO,IAAA,EAAM,C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,UACA,GAAG;AAAA,SACJ;AAAA;AACH,KACF;AAAA,EACF;AACA,EAAA,OAAO,KAAA;AACT","file":"plot.js","sourcesContent":["import * as Plot from \"@observablehq/plot\";\nimport { InputError } from \"../errors.js\";\nimport type { EspnHeadshotLeague } from \"../headshots.js\";\nimport { type Kind, type Placement, checkAlpha, checkHeight, placeSync, placedName } from \"../placement.js\";\nimport type { Value } from \"../resolve.js\";\nimport { toId } from \"../selection.js\";\nimport { stampImage } from \"../stamp.js\";\nimport type { HeadshotIdSystem, IdSystem, League, SeasonInput, Variant } from \"../types.js\";\n\n/** A column name, an accessor, or an array of values (one per row). */\nexport type Channel<R> = keyof R | ((d: R, i: number) => Value) | readonly Value[];\n/** Rows to draw: any iterable, or an Arrow-like table `Plot.valueof` accepts. */\nexport type Data<R> = Iterable<R> | { numRows: number };\n\n/**\n * Every `Plot.image` option sdvplot does not compute passes through untouched: `x`, `y`, `fx`, `fy`, `tip`, `href`,\n * `target`, `title`, `ariaLabel`, `ariaDescription`, `sort`, `filter`, `reverse`, `dx`, `dy`, `clip`, `className`,\n * `opacity`, `rotate`, `frameAnchor`, `channels`, and `transform` / `initializer` / `render` (so Plot's transforms and\n * `Plot.pointer` wrap the mark). sdvplot owns `src`, `width` and `height` (the image and its size).\n */\nexport type ImagePassThrough = Omit<\n Plot.ImageOptions,\n \"src\" | \"width\" | \"height\" | \"r\" | \"preserveAspectRatio\"\n>;\n\n/** sdvplot's own image-mark options (shared by `logos`, `wordmarks` and `headshots`); the rest are Plot's. */\nexport interface ImageMarkOptions extends ImagePassThrough {\n /** Fraction of the (facet) frame height in (0, 1]; default 0.1. */\n height?: number;\n /**\n * Opacity in [0, 1]; default 1. `alpha` is the Python sdvplot name for a constant `opacity`, kept for parity; Plot's\n * `opacity` also takes a per-row channel. Passing both throws `InputError`.\n */\n alpha?: number;\n // ponytail: no circular crop on the Plot image marks; add an explicit `clip: \"circle\"` option, as the d3 faces have\n // (appendHeadshots), if Plot users need round headshots.\n /**\n * Read by `Plot.dodgeX` / `Plot.dodgeY` as the collision radius in pixels (dodge's own option); the image is never\n * clipped or sized by it. Half the drawn height (`height` × frame height / 2) makes neighbours just touch; a smaller\n * `r` lets them overlap (by design: the images keep their size). Plot's own image mark uses `r` to clip the image to\n * a circle, while sdvplot uses `r` only for dodge spacing and never clips.\n */\n r?: Plot.ChannelValue;\n}\nexport interface MarkOptions<R> extends ImageMarkOptions {\n league: League;\n team: Channel<R>;\n /** A literal season (number, null, or a 4-digit string like \"2023\"), or a channel: any other string is a column name; functions and arrays are per-row channels. */\n season?: SeasonInput | Channel<R>;\n variant?: Variant;\n idSystem?: IdSystem;\n /**\n * The link id stamped as each image's `data-sdv-id`, which `sdvplot/interact` matches against a store or a linked\n * table's `rowKey` (`id: \"team\"` for a table keyed by abbreviation). One value per row, like every channel: ids\n * index the data row, never the draw position, so each follows its row through `sort`, `filter`, facets\n * (`fx`/`fy`) and `Plot.dodgeY`. It changes only the stamp: each image keeps its team's accessible name and tip.\n * Default: the resolved ESPN team id (\"12\" for KC), which never matches \"KC\".\n */\n id?: Channel<R>;\n}\nexport interface HeadshotOptions<R> extends ImageMarkOptions {\n league: EspnHeadshotLeague;\n player: Channel<R>;\n /** \"espn\" (default) or \"gsis\". \"gsis\" is sync and needs `loadGsis()` to have run first, else this throws InputError. */\n idSystem?: HeadshotIdSystem;\n /** The link id stamped as each image's `data-sdv-id`, as `logos`' `id`. Default: the player id. */\n id?: Channel<R>;\n}\n\n/** Materialise a one-shot iterable once (it is read several times); arrays and Arrow-like tables pass through. */\nconst once = <R>(data: Data<R>): Data<R> =>\n Symbol.iterator in data && !Array.isArray(data) && !(\"numRows\" in data) ? Array.from(data) : data;\n\nconst values = <R>(data: Data<R>, c: Channel<R> | Plot.ChannelValue): Value[] =>\n Plot.valueof(data as Plot.Data, c as Plot.ChannelValue) as Value[];\n\n/** The values behind x or y when the caller gave them (a column, accessor, array or `{ value }`), not a transform such as dodge. */\nfunction given<R>(data: Data<R>, c: unknown): Value[] | null {\n const v = typeof c === \"object\" && c !== null && !Array.isArray(c) && \"value\" in c ? c.value : c;\n return typeof v === \"string\" || typeof v === \"function\" || Array.isArray(v)\n ? values(data, v as Plot.ChannelValue)\n : null;\n}\n\ntype Source = { value: ArrayLike<unknown>; scale?: unknown; source?: Source | null };\n/**\n * The data value behind a channel at row i (a dodge keeps x's source; its y is screen space, so none), as the\n * `data-sdv-x`/`-y` text `drawnMarks` reads back: a Date as its time in ms, so it reads back as a number.\n */\nfunction dataValue(values: Plot.ChannelValues, key: \"x\" | \"y\", i: number): string | null {\n const ch = (values.channels as Record<string, Source | undefined>)[key];\n const src = ch?.source ?? (ch?.scale == null ? undefined : ch);\n const v = src?.value[i];\n return v === undefined || v === null ? null : String(v instanceof Date ? v.getTime() : v);\n}\n\n/**\n * Plot `render` transform: size each `<image>` to `height` x the (facet) frame height, keep the mark's\n * aspect, re-centre on the point and stamp the `data-sdv-*` attributes `drawnMarks` reads.\n * `placed` is looked up by original row index (`Placement.index`), which is what Plot hands `render`; so are `ids`,\n * the link ids by row (the `id` option), stamped in place of each placement's resolved id.\n */\nexport function sizeRender(\n height: number,\n placed: readonly Placement[],\n kind: Kind,\n ids?: readonly string[],\n): Plot.RenderFunction {\n const byRow = new Map(placed.map((p) => [p.index, p]));\n return (index, scales, vals, dimensions, context, next) => {\n const g = next?.(index, scales, vals, dimensions, context) as SVGElement | null | undefined;\n if (g == null) return null;\n const { width, height: H, marginTop, marginRight, marginBottom, marginLeft } = dimensions;\n const frame = H - marginTop - marginBottom;\n const px = height * frame;\n const X = vals.x as ArrayLike<number> | undefined;\n const Y = vals.y as ArrayLike<number> | undefined;\n const images = g.querySelectorAll(\"image\"); // descendants: an `href` wraps each image in an <a>\n index.forEach((i, k) => {\n const img = images[k];\n const p = byRow.get(i);\n if (!img || !p) return;\n const cx = X ? (X[i] as number) : (marginLeft + width - marginRight) / 2; // Plot's middle frame anchor\n const cy = Y ? (Y[i] as number) : (marginTop + H - marginBottom) / 2;\n stampImage(img, p, kind, px, frame, cx, cy);\n img.setAttribute(\"data-sdv-id\", ids?.[i] ?? p.id); // by row index i, never draw order k: Plot sorts and filters\n const dx = dataValue(vals, \"x\", i);\n const dy = dataValue(vals, \"y\", i);\n if (dx !== null) img.setAttribute(\"data-sdv-x\", dx);\n if (dy !== null) img.setAttribute(\"data-sdv-y\", dy);\n });\n return g;\n };\n}\n\n/**\n * `outer` wraps `inner`, as Plot composes render transforms: a caller's `Plot.pointer` must stay outermost, because\n * it re-renders the mark on every pointer move. Not re-exported from the subpath barrel.\n * @internal\n */\nexport function compose(\n outer: Plot.RenderFunction | undefined,\n inner: Plot.RenderFunction,\n): Plot.RenderFunction {\n if (outer === undefined) return inner;\n return function (this: Plot.Mark, index, scales, values, dimensions, context, next) {\n return outer.call(this, index, scales, values, dimensions, context, (i, s, v, d, c) =>\n inner.call(this, i, s, v, d, c, next),\n );\n };\n}\n\nconst ONE_PER_ROW =\n \"sdvplot marks draw one shape per input row (an image, a cell, a zone), so a transform that makes new rows (bin, group, hexbin) cannot run on them: aggregate first, then draw the result\";\ntype StepOut = {\n data?: unknown;\n facets?: readonly Iterable<number>[];\n channels?: Record<string, { value?: ArrayLike<unknown> | null } | undefined>;\n};\n/**\n * Guard a caller's `transform` or `initializer`: row-preserving ones (filter, sort, stack, window, select, dodge) pass;\n * one that makes new rows throws `InputError`. A transform such as `Plot.group` returns new data; an initializer such\n * as `Plot.hexbin` keeps the data but returns channels with one value per bin, and facets of bin indices. So the\n * returned data must be the input, every returned channel one value per input row, and every returned facet a subset\n * of its input facet. Runs as the mark (dodge reads `this.r`). Not re-exported from the subpath barrel.\n * @internal\n */\nexport function sameRows<F extends (...args: never[]) => unknown>(f: F): F {\n return function (this: unknown, data: unknown, facets?: readonly Iterable<number>[], ...rest: unknown[]) {\n const out = (f as unknown as (...a: unknown[]) => StepOut).call(this, data, facets, ...rest);\n if (out.data !== undefined && out.data !== data) throw new InputError(ONE_PER_ROW);\n const n = Array.isArray(data) ? data.length : (data as { numRows?: number } | null)?.numRows;\n for (const c of Object.values(out.channels ?? {}))\n if (c?.value != null && c.value.length !== n) throw new InputError(ONE_PER_ROW);\n out.facets?.forEach((I, k) => {\n const own = new Set(facets?.[k]);\n for (const i of I) if (!own.has(i)) throw new InputError(ONE_PER_ROW);\n });\n return out;\n } as unknown as F;\n}\n\n// The mark is built on the caller's own data (not on the placements) so Plot's top-level `facet: {data}` identity\n// check applies; `src` is row-aligned, null where a row is skipped (Plot then drops the row).\nfunction imageMark<R>(\n input: Data<R>,\n o: ImageMarkOptions & {\n league: League;\n season?: unknown;\n variant?: Variant;\n idSystem?: IdSystem | HeadshotIdSystem;\n id?: Channel<R>;\n },\n kind: Kind,\n key: Channel<R>,\n): Plot.Markish {\n const data = once(input);\n const height = checkHeight(o.height ?? 0.1);\n if (o.alpha !== undefined && o.opacity !== undefined)\n throw new InputError(\"pass alpha (a constant) or opacity (Plot's channel), not both\");\n const alpha = checkAlpha(o.alpha ?? 1);\n const keys = values(data, key);\n const ids = o.id == null ? undefined : values(data, o.id).map(toId); // null is no channel, as in Plot\n const name = kind === \"headshot\" ? \"player\" : \"team\";\n if (ids !== undefined && ids.length !== keys.length)\n throw new InputError(\n `id and ${name} need one value per row: id has ${ids.length}, ${name} has ${keys.length}`,\n );\n // x / y feed only the skip-and-warn check (a missing x or y); Plot draws from its own channels\n const zeros = keys.map(() => 0);\n const xs = given(data, o.x) ?? zeros;\n const ys = given(data, o.y) ?? zeros;\n const season =\n o.season == null ||\n typeof o.season === \"number\" ||\n (typeof o.season === \"string\" && /^\\d{4}$/.test(o.season))\n ? (o.season as SeasonInput)\n : (values(data, o.season as Channel<R>) as readonly SeasonInput[]);\n const placed = placeSync(xs, ys, keys, {\n league: o.league,\n kind,\n ...(kind === \"headshot\" ? {} : { variant: o.variant ?? \"default\" }),\n ...(o.idSystem === undefined\n ? kind === \"headshot\"\n ? { idSystem: \"espn\" }\n : {}\n : { idSystem: o.idSystem }),\n ...(season === undefined || kind === \"headshot\" ? {} : { season }),\n });\n const src: (string | null)[] = new Array(keys.length).fill(null);\n for (const p of placed) src[p.index] = p.url;\n // each image's accessible name: the resolved team (\"KC\"), whatever id system the caller used (see placedName)\n const names = keys.map((k) => String(k));\n for (const p of placed) names[p.index] = placedName(p, o.league, keys[p.index]);\n const {\n height: _h,\n alpha: _a,\n r: _r,\n league: _l,\n season: _s,\n variant: _v,\n idSystem: _i,\n id: _id, // sdvplot's link id, stamped by sizeRender: never Plot's\n render,\n transform,\n initializer,\n channels,\n ...rest\n } = o as typeof o & { team?: unknown; player?: unknown };\n const { team: _t, player: _p, ...pass } = rest as typeof rest & { team?: unknown; player?: unknown };\n return Plot.image(data as Plot.Data, {\n ...pass,\n src: src as Plot.ChannelValue,\n ...(o.opacity === undefined ? { opacity: alpha } : {}),\n // an accessible name per image, as the Vega adapter's (PR #28): \"KC logo\", \"3139477 headshot\"\n ariaLabel: o.ariaLabel ?? names.map((n) => `${n} ${kind}`),\n // the tip names the team as the image does (\"KC\", not team_id \"12\"); a headshot has only its id\n channels: { [name]: { value: kind === \"headshot\" ? keys : names, label: name }, ...channels },\n ...(transform === undefined ? {} : { transform: sameRows(transform) }),\n ...(initializer === undefined ? {} : { initializer: sameRows(initializer) }),\n render: compose(render, sizeRender(height, placed, kind, ids)),\n });\n}\n\n/**\n * Team logos as an Observable Plot mark at (x, y), `height` a fraction of the (facet) frame height. Needs\n * `loadLeague(league)` first; a team that does not resolve is left out, with one warning. Every other `Plot.image`\n * option passes through (`tip`, `href`, `fx`/`fy`, `sort`, `filter`, `dx`/`dy`, `className`, `clip`, …), and Plot's\n * row-preserving transforms wrap it (`Plot.dodgeY`, `Plot.stackY`, `Plot.windowY`, `Plot.selectLast`, `Plot.pointer`);\n * an aggregating transform (`bin`, `group`, `hexbin`) throws `InputError`. Each image is named for its team (\"KC logo\").\n * `ariaLabel` is Plot's per-image channel, so a string is a COLUMN name (`ariaLabel: \"qb\"` names each image by its\n * row's `qb`); pass an accessor or an array for any other text.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { loadLeague } from \"@sportsdataverse/sdvplot\";\n * import { logos } from \"@sportsdataverse/sdvplot/plot\";\n *\n * await loadLeague(\"nfl\");\n * const afc = [\n * { team: \"KC\", pf: 385, pa: 326 },\n * { team: \"BUF\", pf: 525, pa: 368 },\n * { team: \"DEN\", pf: 425, pa: 311 },\n * ];\n * Plot.plot({ marks: [logos(afc, { league: \"nfl\", x: \"pf\", y: \"pa\", team: \"team\", tip: true })] });\n * ```\n *\n * @example A beeswarm: Plot.dodgeY reads r as the collision radius in pixels, about half the drawn height.\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { loadLeague } from \"@sportsdataverse/sdvplot\";\n * import { logos } from \"@sportsdataverse/sdvplot/plot\";\n *\n * await loadLeague(\"nfl\");\n * const afc = [\n * { team: \"KC\", net_epa: 0.063 },\n * { team: \"LAC\", net_epa: 0.101 },\n * { team: \"DEN\", net_epa: 0.108 },\n * { team: \"BUF\", net_epa: 0.19 },\n * ];\n * Plot.plot({ height: 160, marks: [logos(afc, Plot.dodgeY({ league: \"nfl\", team: \"team\", x: \"net_epa\", r: 12, height: 0.18 }))] });\n * ```\n */\nexport function logos<R>(data: Data<R>, o: MarkOptions<R>): Plot.Markish {\n return imageMark(data, o, \"logo\", o.team);\n}\n/** Team wordmarks, as `logos` (same options and pass-through); each image is named for its team (\"KC wordmark\"). */\nexport function wordmarks<R>(data: Data<R>, o: MarkOptions<R>): Plot.Markish {\n return imageMark(data, o, \"wordmark\", o.team);\n}\n/** ESPN player headshots, as `logos` with a `player` channel; each image is named for its player id (\"3139477 headshot\"; pass `ariaLabel` for names). */\nexport function headshots<R>(data: Data<R>, o: HeadshotOptions<R>): Plot.Markish {\n return imageMark(data, o, \"headshot\", o.player);\n}\n","import * as Plot from \"@observablehq/plot\";\nimport { warn } from \"../errors.js\";\nimport { toId } from \"../selection.js\";\nimport type { Channel, Data } from \"./marks.js\";\n\n/**\n * The one `data-sdv-id` stamping helper: a `render` transform that stamps the element `next` drew for each index\n * entry (a child of the mark's `<g>`, so a mark wrapped by `href` stamps its `<a>`, or the stamped `<image>` inside\n * it for sdvplot's image marks: one stamp per row, and the outer render's id wins). A mark that drew a different\n * number of elements (lines and areas draw one path per series) is left unstamped, never mislabelled; `mismatch`\n * hears about it.\n */\nexport function stampRender(\n idOf: (row: number) => string,\n mismatch?: (drawn: number, rows: number) => void,\n): Plot.RenderFunction {\n return (index, scales, values, dimensions, context, next) => {\n const g = next?.(index, scales, values, dimensions, context) ?? null;\n if (g === null) return null;\n // walk the siblings, never `g.children`: jsdom walks a live HTMLCollection afresh for each index and again after\n // every setAttribute, which made stamping 10,000 dots O(n²) (7-12 s; this loop is linear)\n const els: Element[] = [];\n for (let el = g.firstElementChild; el !== null; el = el.nextElementSibling) els.push(el);\n if (els.length !== index.length) {\n mismatch?.(els.length, index.length);\n return g;\n }\n // an sdvplot image mark stamps its <image> (sizeRender); `href` wraps it in the <a> drawn here: restamp that image\n const at = (el: Element | undefined): Element | undefined =>\n el?.tagName === \"a\" ? (el.querySelector(\"[data-sdv-id]\") ?? el) : el;\n index.forEach((i, k) => at(els[k])?.setAttribute(\"data-sdv-id\", idOf(i)));\n return g;\n };\n}\n\n/**\n * Plot `render` transform that stamps `data-sdv-id` on every element a one-element-per-row mark draws (dot, cell,\n * rect / bar, text, tick, image), so `sdvplot/interact` can highlight it by class toggle, never a redraw. `id`\n * defaults to the row index, which is also a linked table's id when its spec has no `rowKey`. Plot hands `render`\n * the source row indexes, so a row Plot drops (a null coordinate) leaves the others aligned. A mark that draws one\n * element per series (line, area) is left unstamped, with one warning.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { linkIds } from \"@sportsdataverse/sdvplot/plot\";\n *\n * const rows = [\n * { team: \"KC\", wins: 15, net_epa: 0.063 },\n * { team: \"BUF\", wins: 13, net_epa: 0.19 },\n * ];\n * const svg = Plot.plot({ marks: [Plot.dot(rows, { x: \"wins\", y: \"net_epa\", render: linkIds(rows, \"team\") })] });\n * Array.from(svg.querySelectorAll(\"circle\")).map((c) => c.getAttribute(\"data-sdv-id\"));\n * ```\n */\nexport function linkIds<R>(data: Data<R>, id?: Channel<R>): Plot.RenderFunction {\n const ids =\n id === undefined\n ? null\n : Array.from(Plot.valueof(data as Plot.Data, id as Plot.ChannelValue) ?? [], toId);\n return stampRender(\n (i) => (ids === null ? String(i) : (ids[i] ?? \"\")),\n (drawn, rows) =>\n warn(\n `linkIds:${drawn}:${rows}`,\n `linkIds needs one element per row; this mark drew ${drawn} for ${rows} rows, so nothing was stamped`,\n ),\n );\n}\n","import * as Plot from \"@observablehq/plot\";\nimport { checkHeight, placeSync, placedName } from \"../placement.js\";\nimport { stampImage } from \"../stamp.js\";\nimport type { IdSystem, League, MarkType, SeasonInput, Variant } from \"../types.js\";\nimport { compose } from \"./marks.js\";\n\nexport type Axis = \"x\" | \"y\" | \"fx\" | \"fy\";\n/**\n * Plot's axis options sdvplot does not own pass through: `ticks`, `tickSpacing`, `tickPadding`, `tickRotate`,\n * `fontSize`, `fill`, `ariaLabel`, `ariaDescription`, `facetAnchor`, `className`, the margins, and the rest. A\n * `render` you pass wraps sdvplot's (it sees the images). sdvplot owns `tickFormat` (the tick text becomes the\n * image); `anchor`, `tickSize` and `label` are sdvplot's own options below.\n */\nexport type AxisPassThrough = Omit<Plot.AxisXOptions, \"tickFormat\" | \"anchor\" | \"tickSize\" | \"label\">;\n/**\n * Options for `axisLogos`. Each drawn image is named by the tick it replaces (\"KC logo\", \"KC wordmark\"), so assistive\n * technology reads the category the text showed. The images are sized by `height` (a fraction of the frame); a caller\n * margin on the anchored side smaller than the computed one can clip them.\n */\nexport interface AxisLogosOptions extends AxisPassThrough {\n league: League;\n season?: SeasonInput;\n /** Fraction of the frame height in (0, 1]; default 0.1. */\n height?: number;\n variant?: Variant;\n markType?: MarkType;\n idSystem?: IdSystem;\n anchor?: \"top\" | \"bottom\" | \"left\" | \"right\";\n tickSize?: number;\n label?: string | null;\n}\n// Plot 0.6.17's default anchor per axis (axis.js: anchorX/Y/Fx/Fy).\nconst DEFAULT_ANCHOR = { x: \"bottom\", y: \"left\", fx: \"top\", fy: \"right\" } as const;\nconst AXIS: Record<Axis, (options: Plot.AxisXOptions) => Plot.Markish> = {\n x: Plot.axisX,\n y: Plot.axisY,\n fx: Plot.axisFx,\n fy: Plot.axisFy,\n} as const;\n\n/**\n * Axis mark whose tick text is swapped for the team image; categories that do not resolve keep their text.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { loadLeague } from \"@sportsdataverse/sdvplot\";\n * import { axisLogos } from \"@sportsdataverse/sdvplot/plot\";\n *\n * await loadLeague(\"nfl\");\n * const wins = [\n * { team: \"KC\", wins: 15 },\n * { team: \"BUF\", wins: 13 },\n * { team: \"LAC\", wins: 11 },\n * ];\n * Plot.plot({ marks: [Plot.barY(wins, { x: \"team\", y: \"wins\" }), axisLogos(\"x\", { league: \"nfl\" })] });\n * ```\n */\nexport function axisLogos(axis: Axis, o: AxisLogosOptions): Plot.Markish {\n const {\n league: _l,\n season: _s,\n height: _h,\n variant: _v,\n markType: _m,\n idSystem: _i,\n anchor: _a,\n tickSize: _t,\n label: _b,\n render: outer,\n ...pass\n } = o;\n const height = checkHeight(o.height ?? 0.1);\n const kind = o.markType ?? \"logo\";\n const tickSize = o.tickSize ?? 6;\n const horizontal = axis === \"x\" || axis === \"fx\";\n const side = o.anchor ?? DEFAULT_ANCHOR[axis];\n const render: Plot.RenderFunction = (index, scales, values, dimensions, context, next) => {\n const g = next?.(index, scales, values, dimensions, context) as SVGElement | null | undefined;\n const text = values.text as ArrayLike<string> | undefined;\n if (!g || !text) return g ?? null; // the tick-vector sub-mark has no text channel: leave it alone\n const labels = Array.from(index, (i) => text[i] ?? \"\"); // `index` may be a typed array, whose map() coerces to numbers\n const placed = placeSync(\n labels.map(() => 0),\n labels.map(() => 0),\n labels,\n {\n league: o.league,\n kind,\n variant: o.variant ?? \"default\",\n ...(o.idSystem === undefined ? {} : { idSystem: o.idSystem }),\n ...(o.season === undefined ? {} : { season: o.season }),\n },\n );\n const byIndex = new Map(placed.map((p) => [p.index, p]));\n const frame = dimensions.height - dimensions.marginTop - dimensions.marginBottom;\n const px = height * frame;\n const X = values.x as ArrayLike<number> | undefined;\n const Y = values.y as ArrayLike<number> | undefined;\n const texts = g.querySelectorAll(\"text\");\n index.forEach((i, k) => {\n const t = texts[k];\n const p = byIndex.get(k);\n if (!t || !p) return; // the unknown category keeps its <text>\n // fx/fy tick marks carry no x/y channel: take the band centre from the facet scale instead\n const pos = horizontal ? X?.[i] : Y?.[i];\n const sc = (scales as unknown as Record<string, unknown>)[axis] as\n | (((v: unknown) => number | undefined) & { bandwidth?: () => number })\n | undefined;\n const tick = pos ?? (sc ? (sc(labels[k]) ?? Number.NaN) + (sc.bandwidth?.() ?? 0) / 2 : undefined);\n if (tick === undefined || Number.isNaN(tick)) return;\n const w = px * (p.aspect ?? 1);\n const gap = 3; // Plot already translated this <g> by tickSize + tickPadding\n const c =\n side === \"bottom\"\n ? [tick, dimensions.height - dimensions.marginBottom + gap + px / 2]\n : side === \"top\"\n ? [tick, dimensions.marginTop - gap - px / 2]\n : side === \"left\"\n ? [dimensions.marginLeft - gap - w / 2, tick]\n : [dimensions.width - dimensions.marginRight + gap + w / 2, tick];\n const [cx, cy] = c as [number, number];\n const img = context.document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\n img.setAttribute(\"href\", p.url);\n img.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n img.setAttribute(\"data-sdv-axis\", axis);\n img.setAttribute(\"data-sdv-tick\", String(tick));\n img.setAttribute(\"aria-label\", `${placedName(p, o.league, labels[k])} ${kind}`); // the team its tick named\n stampImage(img, p, kind, px, frame, cx, cy);\n t.replaceWith(img);\n });\n return g;\n };\n // ponytail: margin is sized for the default 400px plot; pass height/margins explicitly for other plot heights\n const margin = Math.round(height * 400) + tickSize + 8;\n const marginKey = `margin${side[0]?.toUpperCase()}${side.slice(1)}` as\n | \"marginTop\"\n | \"marginRight\"\n | \"marginBottom\"\n | \"marginLeft\";\n return AXIS[axis]({\n ...pass,\n tickFormat: (d: unknown) => String(d),\n tickSize,\n label: o.label ?? null,\n ...(o.anchor ? { anchor: o.anchor } : {}),\n [marginKey]: pass[marginKey] ?? pass.margin ?? margin, // a caller's own margin on the anchored side wins\n render: compose(outer, render), // a caller's render wraps sdvplot's swap\n } as Plot.AxisXOptions);\n}\n","import type * as Plot from \"@observablehq/plot\";\nimport { hex6 } from \"../contrast.js\";\nimport { checkAlpha } from \"../placement.js\";\nimport type { Value } from \"../resolve.js\";\nimport { teamColorDomain } from \"../team-color-domain.js\";\nimport type { IdSystem, League, SeasonInput, Which } from \"../types.js\";\n\nexport interface TeamColorOptions {\n /** \"primary\" (default) or \"secondary\". */\n which?: Which;\n /** Season for era-aware resolution; passing it avoids the ambiguity warning for reused abbreviations. */\n season?: SeasonInput;\n idSystem?: IdSystem;\n strict?: boolean;\n /** Colour for values that resolve to no team; default \"grey\". Never gets `alpha`. */\n naValue?: string;\n /** Opacity in [0, 1], appended as an 8-bit hex alpha to team colours only. */\n alpha?: number;\n /** Domain = these distinct values; default every team_id and abbr of the league. */\n values?: readonly Value[];\n legend?: boolean;\n}\n\n/**\n * Plot colour-scale options that colour a team column by team colour. The same scale serves `fill` and\n * `stroke` (Plot has one colour scale), so `teamFill` is this function. Without `values` the domain is every\n * `team_id` and `abbr`; some abbreviations are reused across eras, so pass `season` to avoid the\n * ambiguity warning. Needs `loadLeague(league)` first.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { loadLeague } from \"@sportsdataverse/sdvplot\";\n * import { teamColor } from \"@sportsdataverse/sdvplot/plot\";\n *\n * await loadLeague(\"nfl\");\n * const wins = [\n * { team: \"KC\", wins: 15 },\n * { team: \"BUF\", wins: 13 },\n * { team: \"LAC\", wins: 11 },\n * ];\n * Plot.plot({\n * color: teamColor(\"nfl\", { values: wins.map((w) => w.team) }),\n * marks: [Plot.barY(wins, { x: \"team\", y: \"wins\", fill: \"team\" })],\n * });\n * ```\n */\nexport function teamColor(league: League, o: TeamColorOptions = {}): Plot.ScaleOptions {\n const naValue = o.naValue ?? \"grey\";\n const suffix =\n o.alpha === undefined\n ? \"\"\n : Math.round(checkAlpha(o.alpha) * 255)\n .toString(16)\n .padStart(2, \"0\");\n const { domain, colors } = teamColorDomain(league, {\n which: o.which,\n idSystem: o.idSystem,\n strict: o.strict,\n season: o.season,\n values: o.values,\n });\n const range = colors.map((c) => (c === undefined ? naValue : hex6(c) + suffix));\n return { type: \"ordinal\", domain, range, unknown: naValue, ...(o.legend ? { legend: true } : {}) };\n}\nexport const teamFill: typeof teamColor = teamColor;\n","import * as Plot from \"@observablehq/plot\";\nimport { InputError } from \"../errors.js\";\nimport type { Channel, Data } from \"./marks.js\";\n\n/**\n * Plot's rule options sdvplot does not own pass through to both rules: `fx`, `fy`, `tip`, `title`, `className`,\n * `ariaLabel`, `ariaDescription`, `dx`, `dy`, `clip`, and the rest. sdvplot owns the rule positions (`x`, `y`, `x1`,\n * `x2`, `y1`, `y2`): the reducer computes them per facet, top-level or mark-level.\n */\nexport type RuleLinePassThrough = Omit<Plot.RuleXOptions, \"x\" | \"y\" | \"x1\" | \"x2\" | \"y1\" | \"y2\">;\nexport interface RefLineOptions<R> extends RuleLinePassThrough {\n x?: Channel<R>;\n y?: Channel<R>;\n /** Default \"red\". */\n stroke?: string;\n /** Default \"4 4\". */\n strokeDasharray?: string;\n /** Default 1. */\n strokeWidth?: number;\n strokeOpacity?: number;\n}\n\nfunction refLines<R>(data: Data<R>, o: RefLineOptions<R>, reducer: \"mean\" | \"median\"): Plot.Markish[] {\n if (o.x === undefined && o.y === undefined)\n throw new InputError(`${reducer}Lines() needs an x and/or a y channel`);\n const { x: _x, y: _y, ...pass } = o;\n const style = {\n ...pass,\n stroke: o.stroke ?? \"red\",\n strokeDasharray: o.strokeDasharray ?? \"4 4\",\n strokeWidth: o.strokeWidth ?? 1,\n ...(o.strokeOpacity !== undefined ? { strokeOpacity: o.strokeOpacity } : {}),\n };\n const d = data as Plot.Data;\n const marks: Plot.Markish[] = [];\n // groupZ reduces per facet\n if (o.x !== undefined)\n marks.push(Plot.ruleX(d, Plot.groupZ({ x: reducer }, { x: o.x as Plot.ChannelValue, ...style })));\n if (o.y !== undefined)\n marks.push(Plot.ruleY(d, Plot.groupZ({ y: reducer }, { y: o.y as Plot.ChannelValue, ...style })));\n return marks;\n}\n\n/** A vertical rule at mean(x) and/or a horizontal rule at mean(y), per facet. Throws InputError if neither is given. */\nexport function meanLines<R>(data: Data<R>, o: RefLineOptions<R>): Plot.Markish[] {\n return refLines(data, o, \"mean\");\n}\n/** Like `meanLines`, at the median. */\nexport function medianLines<R>(data: Data<R>, o: RefLineOptions<R>): Plot.Markish[] {\n return refLines(data, o, \"median\");\n}\n","import { InputError } from \"../errors.js\";\nimport { type LogoUrlOptions, logoUrlSync } from \"../marks.js\";\nimport type { Value } from \"../resolve.js\";\nimport type { League, SeasonInput } from \"../types.js\";\n\nexport interface TitleImageOptions {\n /** A team (resolved in `league`), or an https image URL when `league` is not given. */\n image: Value;\n league?: League;\n season?: SeasonInput;\n /** Required when `figure` is a bare `<svg>`: it becomes the new `<h2>`. */\n title?: string;\n side?: \"left\" | \"right\";\n /** Pixels (unlike the marks' fraction of the plot height); at least 1, default 24. */\n height?: number;\n}\n\n/** Puts a team logo (or an https image) in the `<h2>` of a Plot figure and returns the `<figure>` (a bare `<svg>` is wrapped in a new one). An unknown team draws the title alone (the resolver warned once). */\nexport function titleImage(figure: HTMLElement | SVGSVGElement, o: TitleImageOptions): HTMLElement {\n const height = o.height ?? 24;\n if (!(typeof height === \"number\" && Number.isFinite(height) && height >= 1))\n throw new InputError(`height is a pixel height of at least 1, got ${String(height)}`);\n const side = o.side ?? \"left\";\n if (side !== \"left\" && side !== \"right\")\n throw new InputError(`side must be \"left\" or \"right\", got ${String(side)}`);\n const bare = figure.tagName.toLowerCase() === \"svg\";\n if (bare && !o.title)\n throw new InputError(\"the plot has no title; pass {title} (or render with Plot.plot({title}))\");\n if (!bare && !figure.querySelector(\"h2\"))\n throw new InputError(\"the figure has no <h2> title; render with Plot.plot({title}) first\");\n let src: string | undefined;\n if (o.league) {\n const lo: LogoUrlOptions = o.season === undefined ? {} : { season: o.season };\n src = logoUrlSync(o.image, o.league, lo);\n } else {\n const s = String(o.image);\n if (!/^https:\\/\\//.test(s))\n throw new InputError(`image must be an https URL when league is not given, got ${s}`);\n src = s;\n }\n // every check has passed: only now touch the DOM\n const doc = figure.ownerDocument;\n let fig: HTMLElement;\n if (bare) {\n fig = doc.createElement(\"figure\");\n const heading = doc.createElement(\"h2\");\n heading.textContent = o.title as string;\n fig.append(heading, figure);\n } else fig = figure as HTMLElement;\n if (src === undefined) return fig;\n const h2 = fig.querySelector(\"h2\") as HTMLElement;\n const img = doc.createElement(\"img\");\n img.setAttribute(\"src\", src);\n img.setAttribute(\"height\", String(height));\n img.setAttribute(\"alt\", \"\");\n img.style.verticalAlign = \"middle\";\n img.style.margin = side === \"left\" ? \"0 0.4em 0 0\" : \"0 0 0 0.4em\";\n if (side === \"left\") h2.prepend(img);\n else h2.append(img);\n return fig;\n}\n","import * as Plot from \"@observablehq/plot\";\nimport { type TierRow, type TiersOptions, prepareTiers } from \"../tiers.js\";\nimport type { League } from \"../types.js\";\nimport { logos } from \"./marks.js\";\n\n/** Options for a tier plot (see `prepareTiers`), plus `devel` (draw team abbreviations as text, not logos) and `width` (px, default 640). */\nexport type TeamTiersOptions = TiersOptions & {\n league: League;\n devel?: boolean;\n width?: number;\n /** Plot's tip on the logos, naming the team on hover (opt-in; default false). Ignored with `devel`. */\n tip?: boolean;\n};\n\n/**\n * A tier plot as `Plot.plot` options (SSR-composable; the caller runs `Plot.plot`): tier 1 on top, logos ranked\n * within each tier, separator rules, wrapped tier labels on the y axis.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { loadLeague } from \"@sportsdataverse/sdvplot\";\n * import { teamTiers } from \"@sportsdataverse/sdvplot/plot\";\n *\n * await loadLeague(\"nfl\");\n * const rows = [\n * { team: \"BUF\", tier_no: 1 },\n * { team: \"KC\", tier_no: 1 },\n * { team: \"MIA\", tier_no: 2 },\n * { team: \"NE\", tier_no: 3 },\n * ];\n * Plot.plot(teamTiers(rows, { league: \"nfl\" }));\n * ```\n */\nexport function teamTiers(rows: readonly TierRow[], o: TeamTiersOptions): Plot.PlotOptions {\n const t = prepareTiers(rows, o.league, o);\n const pts = t.x.map((x, i) => ({\n x,\n y: t.y[i] as number,\n team: t.teamIds[i] as string,\n label: t.labels[i] as string,\n }));\n const marks: Plot.Markish[] = [\n Plot.ruleY(t.lines, { stroke: t.theme.line }),\n o.devel\n ? Plot.text(pts, { x: \"x\", y: \"y\", text: \"label\", fill: t.theme.text, fontWeight: \"bold\" })\n : logos(pts, {\n league: o.league,\n x: \"x\",\n y: \"y\",\n team: \"team\",\n idSystem: \"team_id\",\n height: t.height,\n alpha: t.alpha,\n variant: t.variant,\n ...(o.tip ? { tip: true, title: \"label\" } : {}),\n }),\n ];\n return {\n width: o.width ?? 640,\n height: 480,\n marginLeft: 110,\n style: { background: t.theme.bg, color: t.theme.text, fontFamily: \"sans-serif\" },\n ...(t.title ? { title: t.title, ariaLabel: t.title } : {}), // the figure is named by its title\n ...(t.subtitle ? { subtitle: t.subtitle } : {}),\n ...(t.caption ? { caption: t.caption } : {}),\n x: { domain: t.xlim, axis: null },\n y: {\n domain: t.ylim,\n reverse: true,\n ticks: t.breaks,\n tickFormat: (d: number) => t.breakLabels[t.breaks.indexOf(d)] ?? \"\",\n tickSize: 0,\n label: null,\n fontWeight: \"bold\",\n } as Plot.ScaleOptions,\n marks,\n };\n}\n","import type * as Plot from \"@observablehq/plot\";\nimport type { Scene } from \"@sportsdataverse/sporty\";\nimport { surfaceMark, surfaceScales } from \"@sportsdataverse/sporty/plot\";\nimport { checkHeight } from \"../placement.js\";\nimport { type SurfaceSceneOptions, surfaceScene } from \"../surfaces.js\";\nimport type { League } from \"../types.js\";\nimport { logos } from \"./marks.js\";\n\nexport { SURFACES, SURFACE_BASE, colorUpdates } from \"../surfaces.js\";\n\n/** Sporty's surface options plus `team` painting; `colorUpdates` overrides are keyed by sporty colour keys. */\nexport interface SurfaceOpts extends SurfaceSceneOptions {\n /**\n * A team logo at the surface centre (0, 0): `true` is 0.25 of the frame height, a number is that fraction in (0, 1] (0 or\n * out of range throws InputError). Ignored without a `team`. xTrans/yTrans or a half-court displayRange can move (0, 0) off-frame.\n */\n centerLogo?: boolean | number;\n}\n\n/**\n * Plot marks + scales for a team-painted sporty surface, for any key of `SURFACES`. An unsupported key, or a `team` on a key\n * without team identities, throws `InputError`; sporty's own\n * errors (`SportyError` subclasses: unknown displayRange/unit, bad arcResolution) propagate unwrapped.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { loadLeague } from \"@sportsdataverse/sdvplot\";\n * import { surface } from \"@sportsdataverse/sdvplot/plot\";\n *\n * await loadLeague(\"nhl\");\n * // arcResolution: points per arc (default 200); 24 is plenty at 480 px and keeps the SVG small\n * const rink = surface(\"nhl\", { team: \"BOS\", displayRange: \"offense\", arcResolution: 24 });\n * Plot.plot({ ...rink.scales, width: 480, marks: rink.marks });\n * ```\n */\nexport function surface(\n league: League | (string & {}),\n o: SurfaceOpts = {},\n): { marks: Plot.Markish[]; scales: ReturnType<typeof surfaceScales>; scene: Scene } {\n const { centerLogo, ...opts } = o;\n const scene = surfaceScene(league, opts);\n const marks = surfaceMark(scene);\n const { team, season } = o;\n if (centerLogo !== undefined && centerLogo !== false && team !== undefined && team !== null) {\n const height = centerLogo === true ? 0.25 : checkHeight(centerLogo);\n marks.push(\n logos([{ x: 0, y: 0, team }], {\n league: league as League, // surfaceScene threw already if a team was passed for a key without team identities\n x: \"x\",\n y: \"y\",\n team: \"team\",\n height,\n ...(season !== undefined ? { season } : {}),\n }),\n );\n }\n return { marks, scales: surfaceScales(scene), scene };\n}\n","// Plot marks for shot charts: blazing-the-nets `main` lib/charts/hexShotChart.ts and shootingSignature.ts (@31427b8)\n// drawn in data space, so they sit on a sporty court at any orientation.\nimport * as Plot from \"@observablehq/plot\";\nimport {\n BASKETBALL_ZONE_LABELS,\n type BasketballZone,\n type BasketballZoneArea,\n FRAMES,\n type Frame,\n type FrameName,\n} from \"@sportsdataverse/sporty\";\nimport { type BinShape, cellPoints } from \"../bins/index.js\";\nimport { InputError } from \"../errors.js\";\nimport { type CellVsLeague, LEAGUE_PRIOR_ATTEMPTS, type Split, shrunkDiff } from \"../shots/aggregate.js\";\nimport { type DiffScale, diffScale } from \"../shots/diff.js\";\nimport { SIGNATURE_NAME, type SignaturePoint, signatureGradient } from \"../shots/signature.js\";\nimport { stampRender } from \"./link.js\";\nimport { compose, sameRows } from \"./marks.js\";\n\ntype Point = [number, number];\ntype Polygon = { type: \"Polygon\"; coordinates: [Point[]] };\n\n/** Stamp `data-sdv-id` on each drawn path, so `sdvplot/interact` can link them; silent on a mismatch. */\nconst stampIds = (id: (i: number) => string): Plot.RenderFunction => stampRender(id);\n\ntype TipObject = Exclude<NonNullable<Plot.MarkOptions[\"tip\"]>, boolean | Plot.TipPointer>;\n/** A caller's `tip` as options, sdvplot's default formats merged under its own key by key (the caller's keys win). */\nfunction withFormat(\n tip: NonNullable<Plot.MarkOptions[\"tip\"]>,\n format: Record<string, Plot.TipFormat | boolean>,\n): TipObject | false {\n if (tip === false) return false;\n if (tip === true) return { format };\n if (typeof tip === \"string\") return { pointer: tip, format };\n const own = tip.format;\n return {\n ...tip,\n format: { ...format, ...(typeof own === \"object\" ? own : own === undefined ? {} : { title: own }) },\n };\n}\n\n/** Even-odd: is (x, y) inside the closed ring? */\nfunction inRing(x: number, y: number, r: readonly Point[]): boolean {\n let inside = false;\n for (let i = 0, j = r.length - 1; i < r.length; j = i++) {\n const [xi, yi] = r[i] as Point;\n const [xj, yj] = r[j] as Point;\n if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n/** Zone tip anchors per side of the zones' extent: 40 = 1.25 ft on an NBA half court (1,520 anchors). */\nconst ZONE_STEPS = 40;\n/**\n * Tip anchors inside the zones: a grid of step = the zones' extent / `ZONE_STEPS`, each point kept for the first ring\n * holding it. `data[i]` is that zone's area, so the tip's channels read the caller's areas.\n */\nfunction zoneSamples<A>(\n areas: readonly A[],\n rings: readonly (readonly Point[])[],\n): { data: A[]; x: number[]; y: number[] } {\n const xs = rings.flatMap((r) => r.map((p) => p[0]));\n const ys = rings.flatMap((r) => r.map((p) => p[1]));\n const [x0, x1, y0, y1] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];\n const step = Math.max(x1 - x0, y1 - y0) / ZONE_STEPS;\n const out: { data: A[]; x: number[]; y: number[] } = { data: [], x: [], y: [] };\n for (let i = 0; x0 + (i + 0.5) * step < x1; i++) {\n for (let j = 0; y0 + (j + 0.5) * step < y1; j++) {\n const [x, y] = [x0 + (i + 0.5) * step, y0 + (j + 0.5) * step];\n const area = areas[rings.findIndex((r) => inRing(x, y, r))];\n if (area === undefined) continue;\n out.data.push(area);\n out.x.push(x);\n out.y.push(y);\n }\n }\n return out;\n}\n\nfunction frameOf(f: FrameName | Frame | undefined): Frame {\n const frame = typeof f === \"object\" ? f : FRAMES[f ?? \"nba-legacy\"];\n if (frame === undefined) throw new InputError(`unknown frame \"${String(f)}\"`); // JS callers\n return frame;\n}\n/** One legacy-tenths point through a sporty frame into plot coordinates. */\nfunction toPlot([x, y]: readonly [number, number], f: Frame): Point {\n const px = f.x({ x, y });\n const py = f.y({ x, y });\n if (px === null || py === null) throw new InputError(`frame \"${f.description}\" dropped point (${x}, ${y})`);\n return [px, py];\n}\n/** A ring through the frame, closed explicitly (GeoJSON rings repeat their first point). */\nfunction ring(points: readonly (readonly [number, number])[], f: Frame): Point[] {\n const out = points.map((p) => toPlot(p, f));\n const first = out[0];\n if (first !== undefined) out.push([first[0], first[1]]);\n return out;\n}\nconst polygon = (coordinates: Point[]): Polygon => ({ type: \"Polygon\", coordinates: [coordinates] });\n\n/**\n * Plot's geo options sdvplot does not own pass through (tip, title, href, fx, fy, filter, className, clip, …). `x` and\n * `y` are sdvplot's: a cell's tip anchors on the cell's centre and a zone's on samples inside the zone, so neither\n * needs a mark-level anchor.\n */\nexport type GeoPassThrough = Omit<Plot.GeoOptions, \"geometry\" | \"fill\" | \"r\" | \"x\" | \"y\">;\n\n/** Options for `shotCells`. */\nexport interface ShotCellsOptions extends GeoPassThrough {\n /**\n * Size per cell in legacy tenths (`sizeCells(cells, …).r`) or one size for all: a hexagon's circumradius, or a\n * square's side. 0 hides a cell.\n */\n r: readonly number[] | number;\n /** The cells' shape, as binned (`binShots`, `leagueIndex`); default `\"hex\"`. */\n shape?: BinShape;\n /** Colour of each cell's shrunk FG% vs league; default `diffScale()`. */\n scale?: DiffScale;\n /** `shrunkDiff` prior in attempts; default 25 (`main`), 0 = the raw difference (`master`). */\n prior?: number;\n /** Legacy tenths to plot coordinates: a sporty frame name or `Frame`; default `\"nba-legacy\"`. */\n frame?: FrameName | Frame;\n /** Default `var(--sdv-muted, #525252)`, so near-average cells stay visible (`hexShotChart.ts:159-161`). */\n stroke?: Plot.ChannelValueSpec;\n /** Default 0.85 px. */\n strokeWidth?: Plot.ChannelValueSpec;\n /**\n * Drop the cells centred outside the plot's frame, as blazing-the-nets `main` drops those past its viewport\n * (`hexShotChart.ts:74`); a cell centred inside is drawn whole. Not Plot's `clip` (which cuts paths, and passes\n * through). Default true. Was `clip` before Phase 11.\n */\n dropOutside?: boolean;\n}\n\n/**\n * Data-space hexagons or squares (the dual encoding: `r` from `sizeCells`, `fill` from `diffScale`) drawn as\n * `Plot.geo` through the plot's x/y scales, so they sit on a sporty court at any orientation. Fewest attempts first,\n * so busy cells stay on top (blazing-the-nets `main` `lib/charts/hexShotChart.ts:79`); `r = 0` is not drawn, nor\n * (by default, `dropOutside`) a cell centred outside the plot's frame. Each path carries `data-sdv-id=\"x,y\"`, the cell's\n * legacy centre. Marks paint in array order: after `...court.marks` the cells cover the court lines under them, as\n * in `main`.\n * `tip: true` shows attempts, FG%, league FG% and the shrunk difference (formats `.1%`, `+.1%`; a `tip` object's\n * `format` overrides them key by key); every other\n * `Plot.geo` option passes through, and the cells are the mark's data, so `fx`/`fy`, `filter`, `sort` (replacing the\n * default order) and `title` read the caller's fields. A `transform` or `initializer` that makes new rows\n * (`Plot.group`, `Plot.hexbin`) throws `InputError`.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { shotCells, surface } from \"@sportsdataverse/sdvplot/plot\";\n * import { cellsVsLeague, leagueIndex } from \"@sportsdataverse/sdvplot/shots\";\n *\n * // Brooklyn shots from the sportsdataverse-data nba_stats_shots release, 2025-26\n * const shots = [\n * { x_legacy: -1, y_legacy: 7, shot_distance: 1, shot_value: 2, shot_result: \"Made\" },\n * { x_legacy: 0, y_legacy: 0, shot_distance: 0, shot_value: 2, shot_result: \"Missed\" },\n * { x_legacy: -44, y_legacy: 252, shot_distance: 26, shot_value: 3, shot_result: \"Made\" },\n * ];\n * // the three shots stand in for the league; the gallery's hex chart uses the 2025-26 league's index\n * const cells = cellsVsLeague(shots, leagueIndex(shots, 15));\n * const court = surface(\"nba\", { displayRange: \"defense\" });\n * Plot.plot({ ...court.scales, marks: [...court.marks, shotCells(cells, { r: 15 })] });\n * ```\n */\nexport function shotCells(cells: readonly CellVsLeague[], o: ShotCellsOptions): Plot.Markish {\n const {\n r,\n shape = \"hex\",\n scale = diffScale(),\n prior = LEAGUE_PRIOR_ATTEMPTS,\n frame,\n dropOutside = true,\n stroke = \"var(--sdv-muted, #525252)\",\n strokeWidth = 0.85,\n sort = (a: CellVsLeague, b: CellVsLeague) => a.attempts - b.attempts,\n tip,\n channels,\n transform,\n initializer,\n render,\n ...pass\n } = o;\n const f = frameOf(frame);\n const diff = (h: CellVsLeague): number | null =>\n h.leagueFgPct === null || h.attempts === 0 ? null : shrunkDiff(h.makes, h.attempts, h.leagueFgPct, prior);\n const size = (i: number): number => (typeof r === \"number\" ? r : (r[i] ?? 0));\n const centre = (h: CellVsLeague): Point => toPlot([h.x, h.y], f);\n // In an initializer (not render), so a tip never points at a dropped cell.\n // ponytail: keeps a cell by its centre only, as Phase 10 did: a cell centred just inside is drawn whole (and\n // tippable) though mostly off-frame. Plot's `clip: \"frame\"` cuts it; test every vertex if a partial cell must go.\n const inFrame: Plot.InitializerFunction = (data, facets, _channels, scales, dimensions) => {\n const { x, y } = scales;\n if (!dropOutside || !x || !y) return { data, facets };\n const { width, height, marginTop, marginRight, marginBottom, marginLeft } = dimensions;\n const keep = (i: number): boolean => {\n const [cx, cy] = centre(data[i] as CellVsLeague);\n const px: number = x(cx);\n const py: number = y(cy);\n return px >= marginLeft && px <= width - marginRight && py >= marginTop && py <= height - marginBottom;\n };\n return { data, facets: facets.map((I) => I.filter(keep)) };\n };\n const geo: Plot.GeoOptions = {\n // each path's accessible name, in the tip's terms (\"147 of 181 made, 81.2%\"); a caller's ariaLabel wins\n ariaLabel: (h: CellVsLeague) =>\n `${h.makes} of ${h.attempts} made${h.fgPct === null ? \"\" : `, ${(h.fgPct * 100).toFixed(1)}%`}`,\n ...pass,\n // each path is stamped by its input row, so a transform that makes new rows throws (sameRows)\n ...(transform === undefined ? {} : { transform: sameRows(transform) }),\n // r = 0 gives a null geometry, which Plot drops (the default `defined` filter)\n geometry: (h: CellVsLeague, i: number) =>\n size(i) > 0\n ? polygon(\n ring(\n cellPoints(shape, size(i)).map(([vx, vy]) => [h.x + vx, h.y + vy]),\n f,\n ),\n )\n : null,\n fill: (h: CellVsLeague) => scale(diff(h)),\n stroke,\n strokeWidth,\n sort: sort as NonNullable<Plot.MarkOptions[\"sort\"]>,\n ...(tip === undefined || tip === null\n ? {}\n : {\n tip: withFormat(tip, { attempts: true, fgPct: \".1%\", leagueFgPct: \".1%\", diff: \"+.1%\" }),\n x: (h: CellVsLeague) => centre(h)[0],\n y: (h: CellVsLeague) => centre(h)[1],\n }),\n channels: {\n attempts: { value: \"attempts\", label: \"Attempts\" },\n fgPct: { value: \"fgPct\", label: \"FG%\" },\n leagueFgPct: { value: \"leagueFgPct\", label: \"League FG%\" },\n diff: { value: diff, label: \"vs league (shrunk)\" },\n ...channels,\n },\n render: compose(\n render,\n stampIds((i) => `${cells[i]?.x},${cells[i]?.y}`),\n ),\n };\n // An explicit initializer makes Plot ignore sort/filter/reverse; Plot.initializer folds them in first, then the\n // frame filter, then the caller's own initializer.\n const framed = Plot.initializer(geo, inFrame);\n return Plot.geo(\n cells as CellVsLeague[],\n initializer === undefined ? framed : Plot.initializer(framed, sameRows(initializer)),\n );\n}\n\n/** Options for `shotZones`. */\nexport interface ShotZonesOptions extends GeoPassThrough {\n /** Fill per zone (e.g. `diffScale()` of the zone's shrunk diff). */\n fill: (zone: BasketballZone) => string;\n /**\n * A label per zone at its anchor, haloed so it reads over any fill (`hexShotChart.ts:83-95`); omit for none. Labels\n * take no pointer events, so a click or hover on one reaches the zone under it. They are hidden from assistive\n * technology, so each zone's accessible name carries its label's text after the zone's name (\"Paint (non-RA),\n * 136/326\").\n */\n text?: (zone: BasketballZone) => string;\n /** The SAME frame as the shots (zones built with `scale: 10` are in legacy tenths); default `\"nba-legacy\"`. */\n frame?: FrameName | Frame;\n /** Default 0.85 (`hexShotChart.ts:110`). */\n fillOpacity?: Plot.ChannelValueSpec;\n /** Per-zone makes and attempts (`statsByZone(shots)`): with `tip`, each zone shows them. */\n stats?: Readonly<Record<BasketballZone, Split>>;\n}\n\n/**\n * sporty's zone areas (built with `scale: 10`, legacy tenths) filled per zone, plus optional haloed labels, the\n * corner strips' set vertically (blazing-the-nets `main` zones mode, `lib/charts/hexShotChart.ts:97-136`). Each\n * area's path carries `data-sdv-id` = its zone.\n *\n * Returns the zone paths, then the labels (with `text`), then the tip (with `tip`). Marks paint in array order and\n * the tip is last, so spread these marks LAST, or add other marks before them: a mark added after them paints over\n * the tip. After `...court.marks` the zone fills dim the court lines under them; `main` draws its lines after the\n * zones, but moving the court mark last would hide the zones under its floor (sporty draws lines as filled polygons).\n * For lines on top, put a second `surface` right after the paths, its `colorUpdates` setting `plot_background`,\n * `defensive_half_court`, `offensive_half_court`, `court_apron`, `two_point_range`, `painted_area`,\n * `center_circle_fill` and `free_throw_circle_fill` to `\"#00000000\"` so only the lines remain:\n * `const [paths, ...rest] = shotZones(areas, o)`, then `marks: [...court.marks, paths, ...lines.marks, ...rest]`.\n * The areas are the mark's data and each path is named by its zone (with `text`, then its label's text). `tip: true`\n * adds a `Plot.tip` mark that names the zone under the pointer and, with `stats` (`statsByZone(shots)`), its\n * makes/attempts and FG%. It follows the nearest of a grid of anchors inside the zones (a fortieth of their extent\n * apart, 1.25 ft on an NBA half court), so within about that of a zone edge it may name the neighbour. The tip's data\n * is the areas, so `channels` (shown in the tip) read the caller's fields; a `tip` object's `format` overrides\n * sdvplot's key by key. Every other `Plot.geo` option passes through to the zone paths.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { basketballZones } from \"@sportsdataverse/sporty\";\n * import { shotZones, surface } from \"@sportsdataverse/sdvplot/plot\";\n *\n * const court = surface(\"nba\", { displayRange: \"defense\" });\n * const zones = shotZones(basketballZones(\"nba\", { scale: 10 }), { fill: () => \"#f7f7f7\", text: (z) => z });\n * Plot.plot({ ...court.scales, marks: [...court.marks, ...zones] });\n * ```\n */\nexport function shotZones(areas: readonly BasketballZoneArea[], o: ShotZonesOptions): Plot.Markish[] {\n const {\n fill,\n text,\n frame,\n stats,\n fillOpacity = 0.85,\n tip,\n channels,\n transform,\n initializer,\n render,\n ...pass\n } = o;\n const f = frameOf(frame);\n const rings = areas.map((a) => ring(a.points, f));\n const marks: Plot.Markish[] = [\n Plot.geo(areas as BasketballZoneArea[], {\n // each path's accessible name: its zone, then what its label shows (\"Paint (non-RA), 136/326\"); a caller's\n // ariaLabel wins\n ariaLabel: (a: BasketballZoneArea) =>\n text === undefined\n ? BASKETBALL_ZONE_LABELS[a.zone]\n : `${BASKETBALL_ZONE_LABELS[a.zone]}, ${text(a.zone)}`,\n ...pass,\n ...(transform === undefined ? {} : { transform: sameRows(transform) }),\n ...(initializer === undefined ? {} : { initializer: sameRows(initializer) }),\n geometry: (_a: BasketballZoneArea, i: number) => polygon(rings[i] as Point[]),\n fill: (a: BasketballZoneArea) => fill(a.zone),\n fillOpacity,\n render: compose(\n render,\n stampIds((i) => areas[i]?.zone ?? \"\"),\n ),\n }),\n ];\n if (text) {\n const labels = areas.map((a) => {\n const [x, y] = toPlot(a.label, f);\n return { x, y, text: text(a.zone), vertical: a.vertical };\n });\n marks.push(\n Plot.text(labels, {\n x: \"x\",\n y: \"y\",\n text: \"text\",\n rotate: (d: { vertical: boolean }) => (d.vertical ? -90 : 0),\n fill: \"currentColor\",\n stroke: \"var(--sdv-bg, white)\",\n strokeWidth: 3,\n strokeLinejoin: \"round\",\n paintOrder: \"stroke\",\n ariaHidden: \"true\", // the zone paths' names carry the labels' text, so a screen reader hears each once\n pointerEvents: \"none\", // a label sits inside its zone: a click or hover on it is the zone's\n }),\n );\n }\n // the tip goes last, so nothing shotZones draws paints over it (Plot appends its own derived tips last too)\n const t =\n tip === undefined ? false : withFormat(tip, { x: false, y: false, zone: true, made: true, fgPct: \".1%\" });\n if (t !== false) {\n // A geo's tip anchors on each zone's centroid, which lies outside the C-shaped mid-range: the pointer takes the\n // nearest of many anchors inside the zones instead.\n // ponytail: nearest anchor, not a hit test: within about one grid step of a zone edge the tip can name the\n // neighbour. A larger ZONE_STEPS narrows that band (more anchors, more pointer work per move).\n const { pointer: mode, ...options } = t;\n const pointer = mode === \"x\" ? Plot.pointerX : mode === \"y\" ? Plot.pointerY : Plot.pointer;\n const at = zoneSamples(areas, rings);\n marks.push(\n Plot.tip(\n at.data,\n pointer({\n x: at.x,\n y: at.y,\n channels: {\n zone: { value: (a: BasketballZoneArea) => BASKETBALL_ZONE_LABELS[a.zone], label: \"Zone\" },\n ...(stats === undefined\n ? {}\n : {\n made: {\n value: (a: BasketballZoneArea) => `${stats[a.zone].makes}/${stats[a.zone].attempts}`,\n label: \"Made\",\n },\n fgPct: { value: (a: BasketballZoneArea) => stats[a.zone].fgPct, label: \"FG%\" },\n }),\n ...channels,\n },\n ...options,\n }),\n ),\n );\n }\n return marks;\n}\n\n/** Options for `shootingSignature`. */\nexport interface ShootingSignatureOptions {\n /** Colour of `colourDiff`; default `diffScale()`. */\n fill?: DiffScale;\n /** `\"monotone-x\"` (default, `main`) or `\"basis\"` (`master` `ShootingSignature/index.js:96`). */\n curve?: \"monotone-x\" | \"basis\";\n /**\n * Ribbon half-width in y units. Default `main`'s 20 px at the busiest distance on its 190 px [0, 1] axis, never\n * under 0.75 px (`shootingSignature.ts:13-15`, `:131-132`): `max(share / maxShare * 20, 0.75) / 190`. `master`:\n * `(p) => (1 + p.share * 199) / 200` (`ShootingSignature/index.js:73-75`, `:88-90`).\n */\n halfWidth?: (p: SignaturePoint, maxShare: number) => number;\n /** The dashed league line, faint everywhere and full strength under the ribbon (`:165-181`); default true. */\n league?: boolean;\n /**\n * A tip that follows the pointer along x: distance, FG%, league FG% and shot share (`Plot.tip` + `Plot.pointerX`).\n * An options object's `format` overrides sdvplot's key by key.\n */\n tip?: boolean | Plot.TipOptions;\n}\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\n/**\n * The shooting signature: a ribbon along FG% by distance, as wide as the shot share and coloured along x by the\n * shrunk FG% vs league (blazing-the-nets `main` `lib/charts/shootingSignature.ts:117-213`; `master`\n * `src/components/ShootingSignature/index.js`). Input: `signaturePoints(...)`; a null `fgPct` is a gap. The gradient\n * id is a hash of its stops and its pixel x range, so two signatures on a page, or one drawn at two widths, never\n * share one (`master`'s fixed id did, `Gradient.js:10`).\n *\n * y is not clamped: the ribbon's edges are `fgPct ± halfWidth` in y units, so near 0% or 100% they pass a [0, 1]\n * domain (`main` clamps the ribbon's centre instead, which misstates FG%). To clamp them, pass\n * `y: { domain: [0, 1], clamp: true }`.\n * `tip` adds a `Plot.tip` that follows the pointer along x (`Plot.pointerX`): distance, FG%, league FG% and share.\n * It is the last mark returned, and a mark added after it paints over it, so spread these marks LAST, or add other\n * marks (a `Plot.ruleY`, say) before them.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { shootingSignature } from \"@sportsdataverse/sdvplot/plot\";\n * import { fgPctByDistance, signaturePoints, vsLeague } from \"@sportsdataverse/sdvplot/shots\";\n *\n * // Brooklyn shots from the sportsdataverse-data nba_stats_shots release, 2025-26\n * const shots = [\n * { x_legacy: -1, y_legacy: 7, shot_distance: 1, shot_value: 2, shot_result: \"Made\" },\n * { x_legacy: 0, y_legacy: 0, shot_distance: 0, shot_value: 2, shot_result: \"Missed\" },\n * { x_legacy: -44, y_legacy: 252, shot_distance: 26, shot_value: 3, shot_result: \"Made\" },\n * ];\n * // the makes against all three attempts, which stand in for the league (the gallery's uses the 2025-26 league)\n * const made = fgPctByDistance(shots.filter((s) => s.shot_result === \"Made\"));\n * const points = signaturePoints(vsLeague(made, fgPctByDistance(shots)), { minAttempts: 1 });\n * Plot.plot({ y: { domain: [0, 1] }, marks: shootingSignature(points) });\n * ```\n */\nexport function shootingSignature(\n points: readonly SignaturePoint[],\n o: ShootingSignatureOptions = {},\n): Plot.Markish[] {\n const curve = o.curve ?? \"monotone-x\";\n const { maxShare, maxFt, stops, id: gradientId } = signatureGradient(points, o.fill ?? diffScale());\n const half = o.halfWidth ?? ((p: SignaturePoint, m: number) => Math.max((p.share / m) * 20, 0.75) / 190);\n const marks: Plot.Markish[] = [];\n if (o.league ?? true) {\n const leagueLine = (strong: boolean) =>\n Plot.line(points, {\n x: \"distance\",\n y: (p: SignaturePoint) =>\n p.leagueFgPct === null || (strong && p.fgPct === null) ? Number.NaN : p.leagueFgPct,\n curve,\n stroke: \"currentColor\",\n strokeOpacity: strong ? 1 : 0.4,\n strokeDasharray: \"3 3\",\n });\n marks.push(leagueLine(false), leagueLine(true));\n }\n const edge = (sign: 1 | -1) => (p: SignaturePoint) =>\n p.fgPct === null ? Number.NaN : p.fgPct + sign * half(p, maxShare);\n marks.push(\n Plot.areaY(points, {\n x: \"distance\",\n y1: edge(-1),\n y2: edge(1),\n curve,\n stroke: \"currentColor\",\n strokeOpacity: 0.2,\n strokeWidth: 0.5,\n ariaLabel: () => SIGNATURE_NAME,\n render(index, scales, values, dimensions, context, next) {\n const g = next?.(index, scales, values, dimensions, context) ?? null;\n if (g === null) return null;\n const x = scales.x as (v: number) => number;\n const [x1, x2] = [String(x(0)), String(x(maxFt))];\n const id = gradientId(x1, x2); // hashes the pixel range with the colours (signatureGradient)\n g.setAttribute(\"fill\", `url(#${id})`); // Plot sets a constant fill on the mark's <g>\n const doc = context.document;\n const grad = doc.createElementNS(SVG_NS, \"linearGradient\");\n grad.setAttribute(\"id\", id);\n grad.setAttribute(\"gradientUnits\", \"userSpaceOnUse\");\n grad.setAttribute(\"x1\", x1);\n grad.setAttribute(\"x2\", x2);\n grad.setAttribute(\"y1\", \"0\");\n grad.setAttribute(\"y2\", \"0\");\n for (const [offset, colour] of stops) {\n const s = doc.createElementNS(SVG_NS, \"stop\");\n s.setAttribute(\"offset\", `${offset}%`);\n s.setAttribute(\"stop-color\", colour);\n grad.appendChild(s);\n }\n const defs = doc.createElementNS(SVG_NS, \"defs\");\n defs.appendChild(grad);\n g.insertBefore(defs, g.firstChild);\n return g;\n },\n }),\n );\n const t = withFormat(o.tip ?? false, {\n x: (d: number) => `${d} ft`,\n y: \".1%\",\n leagueFgPct: \".1%\",\n share: \".1%\",\n });\n if (t !== false) {\n marks.push(\n Plot.tip(\n points,\n Plot.pointerX({\n x: { value: \"distance\", label: \"Distance\" },\n y: { value: (p: SignaturePoint) => p.fgPct ?? Number.NaN, label: \"FG%\" },\n channels: {\n leagueFgPct: { value: \"leagueFgPct\", label: \"League FG%\" },\n share: { value: \"share\", label: \"Share of shots\" },\n },\n ...t,\n }),\n ),\n );\n }\n return marks;\n}\n"]}
@@ -0,0 +1,129 @@
1
+ import { A as AxisOptions, H as HeadshotOptions, M as MarkOptions, D as DrawnAxisMark, a as DrawnMark, R as Row } from './_web-D7Aa5Rd8.js';
2
+ export { e as embedSources } from './_web-D7Aa5Rd8.js';
3
+ import { L as League, S as SeasonInput, I as IdSystem } from './types-C7n6gJF3.js';
4
+
5
+ /** The Plotly adapter: logos, wordmarks, headshots and axis logos as layout images on a plain `{ data, layout }` figure.
6
+ * Pure: plotly.js is never imported at runtime; the figure is a plain object and a NEW one is returned. */
7
+
8
+ /** Structural types for a plotly.js figure: the subset `sdvplot/plotly` reads and writes. No runtime import of plotly.js. */
9
+ interface PlotlyAxis {
10
+ type?: "-" | "linear" | "log" | "date" | "category";
11
+ range?: readonly [unknown, unknown];
12
+ autorange?: boolean | "reversed";
13
+ categoryorder?: string;
14
+ categoryarray?: readonly unknown[];
15
+ domain?: readonly [number, number];
16
+ tickmode?: string;
17
+ tickvals?: readonly unknown[];
18
+ ticktext?: readonly string[];
19
+ showticklabels?: boolean;
20
+ }
21
+ interface LayoutImage {
22
+ source: string;
23
+ xref: string;
24
+ yref: string;
25
+ x: number;
26
+ y: number;
27
+ sizex: number;
28
+ sizey: number;
29
+ sizing: "contain" | "fill" | "stretch";
30
+ xanchor: "left" | "center" | "right";
31
+ yanchor: "top" | "middle" | "bottom";
32
+ opacity?: number;
33
+ layer?: "above" | "below";
34
+ name?: string;
35
+ }
36
+ interface PlotlyLayout {
37
+ width?: number;
38
+ height?: number;
39
+ margin?: {
40
+ l?: number;
41
+ r?: number;
42
+ t?: number;
43
+ b?: number;
44
+ };
45
+ barmode?: string;
46
+ barnorm?: string;
47
+ images?: readonly LayoutImage[];
48
+ xaxis?: PlotlyAxis;
49
+ yaxis?: PlotlyAxis;
50
+ [axis: `${"x" | "y"}axis${number}`]: PlotlyAxis | undefined;
51
+ }
52
+ interface PlotlyTrace {
53
+ type?: string;
54
+ x?: readonly unknown[];
55
+ y?: readonly unknown[];
56
+ x0?: number;
57
+ y0?: number;
58
+ dx?: number;
59
+ dy?: number;
60
+ xaxis?: string;
61
+ yaxis?: string;
62
+ orientation?: "v" | "h";
63
+ base?: unknown;
64
+ offsetgroup?: string;
65
+ stackgroup?: string;
66
+ fill?: string;
67
+ }
68
+ interface PlotlyFigure {
69
+ data: readonly PlotlyTrace[];
70
+ layout?: PlotlyLayout;
71
+ }
72
+ /** `withLogos` / `withWordmarks` options: the shared ones plus the subplot axes and the image layer. */
73
+ interface PlotlyMarkOptions extends MarkOptions {
74
+ /** The x axis the images are placed on, e.g. "x2" for a subplot. Default "x". */
75
+ xref?: string;
76
+ /** The y axis the images are placed on, e.g. "y2" for a subplot. Default "y". */
77
+ yref?: string;
78
+ /** Draw the images above (default) or below the traces. */
79
+ layer?: "above" | "below";
80
+ }
81
+ /** `withHeadshots` options: the shared ones plus the subplot axes and the image layer. */
82
+ interface PlotlyHeadshotOptions extends HeadshotOptions {
83
+ /** The x axis the images are placed on, e.g. "x2" for a subplot. Default "x". */
84
+ xref?: string;
85
+ /** The y axis the images are placed on, e.g. "y2" for a subplot. Default "y". */
86
+ yref?: string;
87
+ /** Draw the images above (default) or below the traces. */
88
+ layer?: "above" | "below";
89
+ }
90
+ declare function withLogos(figure: PlotlyFigure, rows: readonly Row[], o: PlotlyMarkOptions): PlotlyFigure;
91
+ declare function withLogos<F extends object>(figure: F, rows: readonly Row[], o: PlotlyMarkOptions): F;
92
+ declare function withWordmarks(figure: PlotlyFigure, rows: readonly Row[], o: PlotlyMarkOptions): PlotlyFigure;
93
+ declare function withWordmarks<F extends object>(figure: F, rows: readonly Row[], o: PlotlyMarkOptions): F;
94
+ declare function withHeadshots(figure: PlotlyFigure, rows: readonly Row[], o: PlotlyHeadshotOptions): PlotlyFigure;
95
+ declare function withHeadshots<F extends object>(figure: F, rows: readonly Row[], o: PlotlyHeadshotOptions): F;
96
+ /** Test hook: [teamId, x, y, height, source] for each image withLogos/withWordmarks/withHeadshots drew. */
97
+ declare function drawnMarks(figure: PlotlyFigure): DrawnMark[];
98
+ /** `withAxisLogos` options: the shared ones plus the subplot axes. */
99
+ interface PlotlyAxisOptions extends AxisOptions {
100
+ /** The subplot's x axis, e.g. "x2". Default "x". */
101
+ xref?: string;
102
+ /** The subplot's y axis, e.g. "y2". Default "y". */
103
+ yref?: string;
104
+ }
105
+ /** Team logos (or wordmarks, `markType`) in place of the tick labels of a category axis.
106
+ * `xref`/`yref` pick the subplot axes (default "x"/"y"); the category axis is the one named by `axis`.
107
+ * Pixel sizing uses `layout.width`/`layout.height`; when unset it assumes Plotly's 700x450 default, which is
108
+ * approximate under autosize (images stay correctly placed in paper/data units).
109
+ * x: images hang under the subplot in its y domain units (`height` of that subplot, exact), and `margin.b` grows by
110
+ * what they reach below the paper; under an upper subplot they hang into the subplot below.
111
+ * y: images sit left of the plot in data y; the range is pinned to the category bands so `sizey = h × span`.
112
+ * Hover still names each category: the labels are hidden (`showticklabels: false`), not blanked, because Plotly's hover
113
+ * reads a tick's text. With an unresolved category only those keep a tick, so a drawn one loses its tick mark and grid
114
+ * line (both off by default on a category axis). */
115
+ declare function withAxisLogos(figure: PlotlyFigure, axis: "x" | "y", o: PlotlyAxisOptions): PlotlyFigure;
116
+ declare function withAxisLogos<F extends object>(figure: F, axis: "x" | "y", o: PlotlyAxisOptions): F;
117
+ /** One colour per team, in order, for `layout.colorway` (Plotly cycles it per trace). */
118
+ declare function teamColorway(league: League, teams: readonly unknown[], o?: {
119
+ which?: "primary" | "secondary";
120
+ season?: SeasonInput;
121
+ idSystem?: IdSystem;
122
+ fallback?: string;
123
+ }): string[];
124
+ /** Test hook: [teamId, category index, height] for each image on `axis`, in tick order. */
125
+ declare function drawnAxisMarks(figure: PlotlyFigure, axis: "x" | "y"): DrawnAxisMark[];
126
+ /** Test hook: the tick labels on `axis` still shown as text. */
127
+ declare function visibleAxisLabels(figure: PlotlyFigure, axis: "x" | "y"): string[];
128
+
129
+ export { AxisOptions, DrawnAxisMark, DrawnMark, HeadshotOptions, type LayoutImage, MarkOptions, type PlotlyAxis, type PlotlyAxisOptions, type PlotlyFigure, type PlotlyHeadshotOptions, type PlotlyLayout, type PlotlyMarkOptions, type PlotlyTrace, Row, drawnAxisMarks, drawnMarks, teamColorway, visibleAxisLabels, withAxisLogos, withHeadshots, withLogos, withWordmarks };