@sportsdataverse/sdvplot 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/NOTICE.md +94 -0
- package/README.md +908 -2
- package/dist/_web-D7Aa5Rd8.d.ts +69 -0
- package/dist/aaf-GJ3SH34T.js +13 -0
- package/dist/aaf-HCYN5T6Y.js +37 -0
- package/dist/aaf-ZAE5KS2Y.js +13 -0
- package/dist/ahl-E66MDVCU.js +66 -0
- package/dist/ahl-NPQQWZEV.js +249 -0
- package/dist/ahl-QRDU73XX.js +309 -0
- package/dist/axis-CraWQRUJ.d.ts +49 -0
- package/dist/bins.d.ts +174 -0
- package/dist/bins.js +4 -0
- package/dist/bins.js.map +1 -0
- package/dist/cfb-F42SVS4X.js +5000 -0
- package/dist/cfb-P3SHEYRZ.js +692 -0
- package/dist/cfb-WXRZANLP.js +10226 -0
- package/dist/chartjs-surface.d.ts +42 -0
- package/dist/chartjs-surface.js +65 -0
- package/dist/chartjs-surface.js.map +1 -0
- package/dist/chartjs.d.ts +132 -0
- package/dist/chartjs.js +339 -0
- package/dist/chartjs.js.map +1 -0
- package/dist/chunk-4C3GX6QO.js +92 -0
- package/dist/chunk-4C3GX6QO.js.map +1 -0
- package/dist/chunk-C2CDY5OG.js +137 -0
- package/dist/chunk-C2CDY5OG.js.map +1 -0
- package/dist/chunk-E7G7VSLV.js +43 -0
- package/dist/chunk-E7G7VSLV.js.map +1 -0
- package/dist/chunk-J6R2LEJ7.js +58 -0
- package/dist/chunk-J6R2LEJ7.js.map +1 -0
- package/dist/chunk-JJFTD4VB.js +175 -0
- package/dist/chunk-JJFTD4VB.js.map +1 -0
- package/dist/chunk-KKH6ABMA.js +223 -0
- package/dist/chunk-KKH6ABMA.js.map +1 -0
- package/dist/chunk-NLPH2VZT.js +127 -0
- package/dist/chunk-NLPH2VZT.js.map +1 -0
- package/dist/chunk-OKEE4AH6.js +30 -0
- package/dist/chunk-OKEE4AH6.js.map +1 -0
- package/dist/chunk-QY65DUEF.js +306 -0
- package/dist/chunk-QY65DUEF.js.map +1 -0
- package/dist/chunk-RMT2GMFH.js +97 -0
- package/dist/chunk-RMT2GMFH.js.map +1 -0
- package/dist/chunk-SEBO35DV.js +76 -0
- package/dist/chunk-SEBO35DV.js.map +1 -0
- package/dist/chunk-TAXO3VXH.js +556 -0
- package/dist/chunk-TAXO3VXH.js.map +1 -0
- package/dist/chunk-TDNBAEQB.js +105 -0
- package/dist/chunk-TDNBAEQB.js.map +1 -0
- package/dist/cricket-KPCYG2HL.js +493 -0
- package/dist/cricket-NDXLE25B.js +116 -0
- package/dist/cricket-YUUF7P6M.js +160 -0
- package/dist/d3.d.ts +234 -0
- package/dist/d3.js +198 -0
- package/dist/d3.js.map +1 -0
- package/dist/echarts.d.ts +121 -0
- package/dist/echarts.js +228 -0
- package/dist/echarts.js.map +1 -0
- package/dist/echl-3CR4RGFC.js +241 -0
- package/dist/echl-NPC32C23.js +107 -0
- package/dist/echl-PI33DGJC.js +64 -0
- package/dist/export.d.ts +130 -0
- package/dist/export.js +258 -0
- package/dist/export.js.map +1 -0
- package/dist/headshots-B2J_LOO8.d.ts +40 -0
- package/dist/index.d.ts +182 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/interact.d.ts +567 -0
- package/dist/interact.js +809 -0
- package/dist/interact.js.map +1 -0
- package/dist/marks-DH-tQIP-.d.ts +75 -0
- package/dist/mbb-3TRLVW3H.js +3619 -0
- package/dist/mbb-DQUHCHZP.js +5111 -0
- package/dist/mbb-PRAIO2P5.js +371 -0
- package/dist/milb-6IQ6NCEW.js +291 -0
- package/dist/milb-EYY5MD4T.js +1752 -0
- package/dist/milb-EYZ4SZLI.js +797 -0
- package/dist/mlb-4PBUJSVQ.js +35 -0
- package/dist/mlb-FHPY3GQJ.js +701 -0
- package/dist/mlb-REVGL3N2.js +665 -0
- package/dist/nba-ATT775GS.js +485 -0
- package/dist/nba-LKM4UHVU.js +482 -0
- package/dist/nba-YX7PXM3R.js +35 -0
- package/dist/nbagl-3WGZCZ4S.js +37 -0
- package/dist/nbagl-LP4XJRAL.js +229 -0
- package/dist/nbagl-VTTOU7LN.js +499 -0
- package/dist/ncaa_baseball-UV75LNVR.js +2670 -0
- package/dist/ncaa_baseball-VD5J5C72.js +419 -0
- package/dist/ncaa_baseball-YRBS32D6.js +4592 -0
- package/dist/ncaa_mhockey-IMYHS7QS.js +1033 -0
- package/dist/ncaa_mhockey-TXTKWHE3.js +115 -0
- package/dist/ncaa_mhockey-U3MFW5VT.js +663 -0
- package/dist/ncaa_softball-6WR6KS64.js +420 -0
- package/dist/ncaa_softball-RZCTIE56.js +2654 -0
- package/dist/ncaa_softball-VOD4PVGY.js +4599 -0
- package/dist/ncaa_whockey-6XXGUTBK.js +607 -0
- package/dist/ncaa_whockey-AKKYKY67.js +53 -0
- package/dist/ncaa_whockey-KBEKXFBB.js +293 -0
- package/dist/nfl-BDB2HYAR.js +625 -0
- package/dist/nfl-EHYHDLJD.js +37 -0
- package/dist/nfl-VF4NJCHY.js +514 -0
- package/dist/nfl_gsis-UY64JO37.js +4 -0
- package/dist/nhl-6WPHME7H.js +511 -0
- package/dist/nhl-EMIJFZHY.js +884 -0
- package/dist/nhl-ISFUKRFU.js +37 -0
- package/dist/ohl-2FEM554G.js +113 -0
- package/dist/ohl-C5Q4W6JB.js +32 -0
- package/dist/ohl-TQ4J46VC.js +66 -0
- package/dist/phf-H7POU2KW.js +32 -0
- package/dist/phf-K5IFMZUM.js +13 -0
- package/dist/phf-TWJI3BOW.js +20 -0
- package/dist/plot.d.ts +449 -0
- package/dist/plot.js +711 -0
- package/dist/plot.js.map +1 -0
- package/dist/plotly.d.ts +129 -0
- package/dist/plotly.js +360 -0
- package/dist/plotly.js.map +1 -0
- package/dist/pwhl-OX3BO4JI.js +53 -0
- package/dist/pwhl-W44OC3C6.js +17 -0
- package/dist/pwhl-ZJGG3H7W.js +23 -0
- package/dist/qmjhl-5HISEHLL.js +35 -0
- package/dist/qmjhl-DA3UHKE5.js +125 -0
- package/dist/qmjhl-YG4BOQPF.js +614 -0
- package/dist/react.d.ts +101 -0
- package/dist/react.js +164 -0
- package/dist/react.js.map +1 -0
- package/dist/resolve-CQW-jzvr.d.ts +28 -0
- package/dist/selection-D4T3PkRt.d.ts +140 -0
- package/dist/shots.d.ts +364 -0
- package/dist/shots.js +85 -0
- package/dist/shots.js.map +1 -0
- package/dist/soccer-7BH3ZLVL.js +7898 -0
- package/dist/soccer-MRU25OGE.js +2636 -0
- package/dist/soccer-PF4IPPVA.js +12342 -0
- package/dist/surfaces-ChaD9nei.d.ts +38 -0
- package/dist/testing.d.ts +75 -0
- package/dist/testing.js +240 -0
- package/dist/testing.js.map +1 -0
- package/dist/tiers-B6pUBPcE.d.ts +93 -0
- package/dist/types-C7n6gJF3.d.ts +62 -0
- package/dist/ufl-7VLZTLTT.js +143 -0
- package/dist/ufl-CCMBLPSW.js +100 -0
- package/dist/ufl-F2BJRXME.js +16 -0
- package/dist/usfl-4CR5RMZJ.js +32 -0
- package/dist/usfl-LD7HP2YK.js +14 -0
- package/dist/usfl-VU4YSJQD.js +19 -0
- package/dist/ushl-CPG2LB4L.js +73 -0
- package/dist/ushl-PQL6HJAD.js +88 -0
- package/dist/ushl-ZT2ATPHK.js +22 -0
- package/dist/vega.d.ts +85 -0
- package/dist/vega.js +362 -0
- package/dist/vega.js.map +1 -0
- package/dist/wbb-3KHCDYTK.js +5087 -0
- package/dist/wbb-BMX53Q3Q.js +369 -0
- package/dist/wbb-QNRN2CJJ.js +3620 -0
- package/dist/whl-4ATYZWUB.js +97 -0
- package/dist/whl-RVFPL6MH.js +79 -0
- package/dist/whl-Y7ASKYMM.js +28 -0
- package/dist/wnba-FWX5SFVI.js +232 -0
- package/dist/wnba-GX6HZR4B.js +220 -0
- package/dist/wnba-NTMWIPP6.js +20 -0
- package/dist/xfl-43R2JMJK.js +30 -0
- package/dist/xfl-H3BXQPZZ.js +16 -0
- package/dist/xfl-XON7A7FI.js +69 -0
- package/package.json +154 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interact/highlight.ts","../src/interact/brush.ts","../src/interact/cursor.ts","../src/interact/link.ts","../src/interact/tooltip.ts","../src/interact/nearest.ts"],"names":["SVG_NS","CSS","s","NOOP","box","b","pointer"],"mappings":";;;;;AAAA,IAAM,MAAA,GAAS,4BAAA;AAKf,IAAM,GAAA,GAAM,gGAAA;AACZ,IAAM,KAAA,uBAAiC,GAAA,EAAY;AAOnD,IAAM,KAAA,uBAAY,OAAA,EAAsB;AAcjC,SAAS,MAAA,GAAkB;AAChC,EAAA,OAAO,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,QAAA,KAAa,WAAA;AAC9D;AAGA,IAAM,MAAA,GAAS,CAAC,EAAA,KACd,EAAA,CAAG,YAAA,CAAa,eAAe,CAAA,GAAI,EAAA,GAAM,EAAA,CAAG,YAAA,CAAa,aAAa,CAAA,IAAK,EAAA;AAG7E,SAAS,UAAU,IAAA,EAAuB;AACxC,EAAA,IAAI,IAAA,CAAK,QAAA,KAAa,CAAA,EAAG,OAAO,EAAC;AACjC,EAAA,MAAM,EAAA,GAAK,IAAA;AACX,EAAA,MAAM,MAAM,KAAA,CAAM,IAAA,CAAK,EAAA,CAAG,gBAAA,CAAiB,eAAe,CAAC,CAAA;AAC3D,EAAA,IAAI,GAAG,YAAA,CAAa,aAAa,CAAA,EAAG,GAAA,CAAI,QAAQ,EAAE,CAAA;AAClD,EAAA,OAAO,GAAA;AACT;AACA,SAAS,GAAA,CAAI,KAAA,EAAkC,EAAA,EAAY,EAAA,EAAmB;AAC5E,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,GAAA,CAAI,EAAE,CAAA;AACxB,EAAA,IAAI,GAAA,EAAK,GAAA,CAAI,GAAA,CAAI,EAAE,CAAA;AAAA,OACd,KAAA,CAAM,IAAI,EAAA,kBAAI,IAAI,IAAI,CA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AAW,GAAA,CAAI,mBAAA,CAAoB,IAAA,EAAM,EAAA,EAAI,EAAE,OAAA,EAAS,CAAA;AAC1F,MAAA,GAAA,EAAK,OAAA,EAAQ;AACb,MAAA,IAAI,UAAU,IAAA,IAAQ,KAAA,CAAM,IAAA,GAAO,CAAA,IAAK,MAAM,QAAA,EAAS,CAAE,KAAA,KAAU,KAAA,QAAa,GAAA,CAAI,EAAE,KAAA,EAAO,IAAI,CAAA;AACjG,MAAA,GAAA,GAAM,MAAA;AACN,MAAA,KAAA,GAAQ,IAAA;AAAA,IACV;AAAA,GACF;AACF","file":"interact.js","sourcesContent":["const SVG_NS = \"http://www.w3.org/2000/svg\";\n/**\n * Dimming is one CSS rule keyed on a ROOT class, so a hover touches the root plus the marks whose state changed.\n * Axis decorations (`axisLogos` stamps `data-sdv-axis` beside an ESPN id) are not data marks: never dimmed.\n */\nconst CSS = \".sdv-focus [data-sdv-id]:not(.sdv-hl):not([data-sdv-axis]){opacity:var(--sdv-dim-opacity,0.2)}\";\nconst EMPTY: ReadonlySet<string> = new Set<string>();\n\ninterface Lit {\n readonly index: Map<string, Set<Element>>;\n readonly mo: MutationObserver;\n ids: ReadonlySet<string> | null;\n}\nconst roots = new WeakMap<Element, Lit>();\n\n/**\n * Interaction needs a live DOM. Without one (Node / SSR) every `sdvplot/interact` function is a no-op, so a\n * server-rendered figure is byte-identical with or without a link.\n *\n * @example\n * ```ts\n * import { hasDom } from \"@sportsdataverse/sdvplot/interact\";\n *\n * // it depends on where this runs: a browser (or the jsdom that prerendered this page) has a DOM, Node has none\n * `this ran ${hasDom() ? \"with a DOM: interact functions work\" : \"without a DOM: interact functions are no-ops\"}`;\n * ```\n */\nexport function hasDom(): boolean {\n return typeof window !== \"undefined\" && typeof document !== \"undefined\";\n}\n\n/** A data mark's link id; `\"\"` for a decoration (`data-sdv-axis`) or an empty stamp, which never index. */\nconst markId = (el: Element): string =>\n el.hasAttribute(\"data-sdv-axis\") ? \"\" : (el.getAttribute(\"data-sdv-id\") ?? \"\");\n\n/** `node` and its stamped descendants (`nodeType`, not `instanceof`: a node may come from another realm). */\nfunction stampedIn(node: Node): Element[] {\n if (node.nodeType !== 1) return [];\n const el = node as Element;\n const out = Array.from(el.querySelectorAll(\"[data-sdv-id]\"));\n if (el.hasAttribute(\"data-sdv-id\")) out.unshift(el);\n return out;\n}\nfunction add(index: Map<string, Set<Element>>, id: string, el: Element): void {\n const set = index.get(id);\n if (set) set.add(el);\n else index.set(id, new Set([el]));\n}\n\n/**\n * Fold DOM changes into the index: O(added + removed), never a rescan. Each node is judged by where it is NOW\n * (`root.contains`), so record order does not matter. A node added under an already-lit id is lit at once: Plot's\n * pointer redraws its layer on every move (`g.replaceWith`) and that writes no store value, so no `highlight` follows.\n */\nfunction apply(root: Element, state: Lit, records: readonly MutationRecord[]): void {\n for (const r of records) {\n for (const el of Array.from(r.removedNodes).flatMap(stampedIn)) {\n const id = markId(el);\n const set = state.index.get(id);\n if (set === undefined || root.contains(el)) continue;\n set.delete(el);\n if (set.size === 0) state.index.delete(id);\n }\n for (const el of Array.from(r.addedNodes).flatMap(stampedIn)) {\n const id = markId(el);\n if (id === \"\" || !root.contains(el)) continue;\n add(state.index, id, el);\n if (state.ids?.has(id)) el.classList.add(\"sdv-hl\");\n }\n }\n}\n\n// ponytail: one MutationObserver per root keeps the index in step with re-rendered layers; it lives as long as the\n// root (the WeakMap and the observer registration both die with it), so there is nothing to disconnect.\nfunction litOf(root: Element): Lit {\n const known = roots.get(root);\n if (known) return known;\n const index = new Map<string, Set<Element>>();\n for (const el of stampedIn(root)) {\n const id = markId(el);\n if (id !== \"\" && el !== root) add(index, id, el);\n }\n const doc = root.ownerDocument;\n const style =\n root.namespaceURI === SVG_NS ? doc.createElementNS(SVG_NS, \"style\") : doc.createElement(\"style\");\n style.setAttribute(\"data-sdv-interact\", \"\");\n style.textContent = CSS;\n root.append(style);\n const state: Lit = { index, mo: new MutationObserver((records) => apply(root, state, records)), ids: null };\n state.mo.observe(root, { childList: true, subtree: true });\n roots.set(root, state);\n return state;\n}\n\n/**\n * Emphasise the marks under `root` stamped (`data-sdv-id`) with one of `ids` and dim the rest; `null` clears and an\n * empty set dims everything. A class toggle, never a redraw: each call touches only the marks whose state changed,\n * plus the root's class, and one CSS rule (`--sdv-dim-opacity`, default 0.2) does the dimming. Marks Plot draws later\n * (a `Plot.pointer` layer) are indexed as they appear; axis logos (`data-sdv-axis`) are decorations and never dim.\n * Returns the ids that match no mark here (an id absent from this figure is not an error). No-op without a DOM.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { highlight } from \"@sportsdataverse/sdvplot/interact\";\n * import { linkIds } from \"@sportsdataverse/sdvplot/plot\";\n *\n * const rows = [\n * { team: \"KC\", wins: 15, pf: 385 },\n * { team: \"BUF\", wins: 13, pf: 525 },\n * { team: \"MIA\", wins: 8, pf: 345 },\n * ];\n * const svg = Plot.plot({ marks: [Plot.dot(rows, { x: \"wins\", y: \"pf\", r: 6, render: linkIds(rows, \"team\") })] });\n * const missing = highlight(svg, new Set([\"KC\", \"SEA\"])); // [\"SEA\"]: no SEA dot here; BUF and MIA dim\n * svg;\n * ```\n */\nexport function highlight(root: Element, ids: ReadonlySet<string> | null): string[] {\n if (!hasDom()) return [];\n const state = litOf(root);\n apply(root, state, state.mo.takeRecords()); // changes the observer has not delivered yet\n const prev = state.ids ?? EMPTY;\n const next = ids ?? EMPTY;\n for (const id of prev) {\n if (next.has(id)) continue;\n for (const el of state.index.get(id) ?? []) el.classList.remove(\"sdv-hl\");\n }\n const missing: string[] = [];\n for (const id of next) {\n const els = state.index.get(id);\n if (els === undefined) missing.push(id);\n else if (!prev.has(id)) for (const el of els) el.classList.add(\"sdv-hl\");\n }\n root.classList.toggle(\"sdv-focus\", ids !== null);\n state.ids = ids === null ? null : new Set(ids); // a copy: the caller may reuse its set\n return missing;\n}\n","import { type BrushSelection, type D3BrushEvent, brush, brushX, brushY, select } from \"d3\";\nimport { InputError } from \"../errors.js\";\nimport { type RowFilter, type SelectionStore, toId } from \"../selection.js\";\nimport { hasDom } from \"./highlight.js\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\n/** A row field name, or an accessor. Index-based accessors cannot apply: linked tables re-test their own rows. */\nexport type Field<R> = (keyof R & string) | ((row: R) => unknown);\n/**\n * What `brushFilter` brushes: the figure's rows, the fields its brushed axes encode (x and y, or one alone), each row's\n * link id, what a brush holding no row means, and the scales of a chart that has no `figure.scale`.\n */\nexport interface BrushFilterOptions<R> {\n /** The rows the figure was drawn from. */\n data: readonly R[];\n /** The field the figure's x scale encodes. Without `y`, a 1-D brush along x over the svg's full height. */\n x?: Field<R>;\n /** The field the figure's y scale encodes. Without `x`, a 1-D brush along y over the svg's full width. */\n y?: Field<R>;\n /** The link id per row: the same values as the marks' `id` / `linkIds` channel. Default: the row index. */\n id?: Field<R>;\n /**\n * A brush that holds no row. `\"dim\"` (the default): its region stays in the store, so every mark dims and a linked\n * table shows no row. `\"clear\"`: it is no filter at all; the store goes idle and, when the gesture ends, the drawn\n * rectangle is removed (a date window over the All-Star break selects no game, and left drawn would look applied).\n */\n empty?: \"dim\" | \"clear\";\n /**\n * The brushed axes' scales, overriding `figure.scale`: how a d3-drawn chart, which has none, is brushed. A d3 scale\n * goes in as it is (`d3.scaleUtc()`, whose `range()` is a method); a {@link ScaleLike} works too.\n */\n scales?: { x?: ScaleLike | D3ScaleLike; y?: ScaleLike | D3ScaleLike };\n}\n/** A live brush: drive it programmatically, or remove it. */\nexport interface BrushFilterHandle {\n /**\n * Brush a region in DATA coordinates, one range per brushed axis (`null` clears), as if the user had dragged it. Rows\n * are tested against these exact bounds, never their pixel round trip: a row on a bound is inside.\n */\n move(region: { x?: readonly [unknown, unknown]; y?: readonly [unknown, unknown] } | null): void;\n /** Remove the overlay and stop following the store; clears its selection and predicate if this brush set them. */\n destroy(): void;\n}\n/** The slice of a materialised Plot scale the brush reads (`plot.scale(\"x\")`); structural, so no Plot import. */\nexport interface ScaleLike {\n /** Data value to pixel. */\n apply(value: unknown): unknown;\n /** Pixel to data value; absent on band and point scales, which a brush cannot invert. */\n invert?(pixel: unknown): unknown;\n /** The pixel range; the brush's extent spans it. Absent (or with no finite value), the svg's box on that axis. */\n range?: Iterable<unknown>;\n}\n/**\n * A d3-scale scale as `d3.scaleLinear()`, `d3.scaleUtc()` or `d3.scaleBand()` makes it: callable, with `range()` a\n * METHOD (a {@link ScaleLike}'s `range` is the pixels themselves), and on a band scale `bandwidth()` and `domain()`\n * methods too. `brushFilter` and `linkCursor` adapt it, so a d3-drawn chart passes its own scales as they are.\n */\nexport interface D3ScaleLike {\n /** Data value to pixel. */\n (value: never): unknown;\n /** Pixel to data value; absent on band and point scales, which a brush cannot invert. */\n invert?(pixel: number): unknown;\n /** The pixel range, read once when the brush or cursor is made. */\n range(): Iterable<unknown>;\n /** A band scale's band width in pixels (a `linkCursor` band). */\n bandwidth?(): number;\n /** The domain; a band scale's values are each band's first value (a `linkCursor` band). */\n domain?(): Iterable<unknown>;\n}\n/**\n * What `Plot.plot` returns: the `<svg>`, or a `<figure>` wrapping it, exposing its scales. Any `<svg>` fits: a d3-drawn\n * chart has no `scale` and passes `scales` instead.\n */\nexport type PlotFigure = Element & { scale?(name: \"x\" | \"y\"): ScaleLike | undefined };\n\nconst get = <R>(row: R, f: Field<R>): unknown => (typeof f === \"function\" ? f(row) : row[f]);\n/** Missing values are never inside a brush: `Number(null)` is 0, which a range spanning 0 would wrongly admit. */\nconst num = (v: unknown): number => (v === null || v === undefined || v === \"\" ? Number.NaN : Number(v));\nconst span = (a: unknown, b: unknown): [number, number] => {\n const p = num(a);\n const q = num(b);\n return p <= q ? [p, q] : [q, p];\n};\nconst NOOP: BrushFilterHandle = { move: () => {}, destroy: () => {} };\n/** A scale as the interact functions read it: a {@link ScaleLike}, plus a band scale's width and domain. */\ntype Adapted = ScaleLike & { readonly bandwidth?: number; readonly domain?: Iterable<unknown> };\n/**\n * A d3 scale is a function: its `range`, `bandwidth` and `domain` are methods and its `apply` is\n * Function.prototype's, so `scale.apply(10)` would call it with no argument. Never read it as is: adapt it.\n * @internal\n */\nexport function scaleOf(s: Adapted | D3ScaleLike): Adapted;\nexport function scaleOf(s: Adapted | D3ScaleLike | undefined): Adapted | undefined;\nexport function scaleOf(s: Adapted | D3ScaleLike | undefined): Adapted | undefined {\n if (typeof s !== \"function\") return s;\n const f = s as unknown as (value: unknown) => unknown;\n const { invert: inv, bandwidth: bw, domain: dom } = s;\n return {\n apply: (v) => f(v),\n ...(inv && { invert: (p: unknown) => inv.call(s, Number(p)) }),\n range: s.range(),\n ...(bw && { bandwidth: bw.call(s) }),\n ...(dom && { domain: dom.call(s) }),\n };\n}\n/** The svg's user-space box: its viewBox, else its width and height. A 1-D brush spans the other axis entirely. */\nconst boxOf = (svg: Element): [number, number, number, number] => {\n const v = (svg.getAttribute(\"viewBox\") ?? \"\")\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n if (v.length === 4 && v.every(Number.isFinite)) return v as [number, number, number, number];\n return [0, 0, Number(svg.getAttribute(\"width\")) || 0, Number(svg.getAttribute(\"height\")) || 0];\n};\n\n/**\n * Overlay a d3-brush on a rendered Plot figure, or on a d3-drawn `<svg>` given its own `scales`. Each brush move sets\n * the store's `predicate` (the region as a row test, for linked tables) and `selected` (the ids of `data` inside it,\n * for highlighting) in ONE notification. Pass `x` and `y` for a rectangle, or one of them for a 1-D brush across the\n * whole svg (a date window on a timeline). Clearing the brush, or a click on the empty chart, clears both, but only\n * while the store still holds this brush's region. A selection made elsewhere since (a table row, a toggled mark)\n * survives, and so does one made before that holds exactly the brushed ids: the store kept that set, so the brush\n * wrote none of its own. The drawn brush follows the store: when its region is cleared or replaced elsewhere, the\n * rectangle is removed with no second write. `empty` says what a brush holding no row means. The overlay is inserted\n * BEHIND the marks, so hovering a mark still reaches it. On a figure with a Plot `tip`, the press that starts a brush\n * also pins the tip showing at that moment (Plot's pointer toggles a sticky tip on `pointerdown`); the brush still\n * works. Throws `InputError` without `x` or `y`, or unless each brushed axis has a continuous (invertible) scale, in\n * Node too. Returns a HANDLE, not a teardown function, because a brush has more to do than tear down: `move` drives it\n * and `destroy` removes it (`linkSelection` and `linkCursor`, whose teardown is all they have, return a function). A\n * no-op handle without a DOM.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { brushFilter } from \"@sportsdataverse/sdvplot/interact\";\n * import { linkIds } from \"@sportsdataverse/sdvplot/plot\";\n *\n * const rows = [\n * { team: \"KC\", wins: 15, net_epa: 0.063 },\n * { team: \"LAC\", wins: 11, net_epa: 0.101 },\n * { team: \"MIA\", wins: 8, net_epa: -0.019 },\n * ];\n * const svg = Plot.plot({ marks: [Plot.dot(rows, { x: \"wins\", y: \"net_epa\", render: linkIds(rows, \"team\") })] });\n * const store = createSelection<(typeof rows)[number]>();\n * const brush = brushFilter(svg, store, { data: rows, x: \"wins\", y: \"net_epa\", id: \"team\" });\n * brush.move({ x: [10, 16], y: [0, 0.15] }); // drag over the 10+ win teams with a positive net EPA\n * [...store.getState().selected]; // [\"KC\", \"LAC\"]\n * ```\n *\n * @example A 1-D date window that clears when it holds no game\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { brushFilter } from \"@sportsdataverse/sdvplot/interact\";\n * import { linkIds } from \"@sportsdataverse/sdvplot/plot\";\n *\n * // five of Brooklyn's 2025-26 games\n * const games = [\n * { game_id: \"0022500130\", game_date: \"2025-10-29\", matchup: \"BKN vs. ATL\" },\n * { game_id: \"0022500149\", game_date: \"2025-11-02\", matchup: \"BKN vs. PHI\" },\n * { game_id: \"0022500156\", game_date: \"2025-11-03\", matchup: \"BKN vs. MIN\" },\n * { game_id: \"0022500173\", game_date: \"2025-11-05\", matchup: \"BKN @ IND\" },\n * { game_id: \"0022500031\", game_date: \"2025-11-07\", matchup: \"BKN vs. DET\" },\n * ];\n * const day = (g: (typeof games)[number]): Date => new Date(`${g.game_date}T00:00:00Z`);\n * const svg = Plot.plot({\n * height: 60,\n * x: { type: \"utc\" },\n * marks: [Plot.tickX(games, { x: day, render: linkIds(games, \"game_id\") })],\n * });\n * const store = createSelection<(typeof games)[number]>();\n * // x alone: a brush along the dates; \"clear\": a window holding no game is no filter and is not left drawn\n * const brush = brushFilter(svg, store, { data: games, x: day, id: \"game_id\", empty: \"clear\" });\n * brush.move({ x: [new Date(\"2025-11-01\"), new Date(\"2025-11-06\")] });\n * [...store.getState().selected]; // [\"0022500149\", \"0022500156\", \"0022500173\"]\n * ```\n *\n * @example A d3-drawn chart brushed through its own d3 scale\n * ```ts\n * import { scaleUtc, select } from \"d3\";\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { brushFilter } from \"@sportsdataverse/sdvplot/interact\";\n *\n * // five of Brooklyn's 2025-26 games\n * const games = [\n * { game_id: \"0022500130\", game_date: \"2025-10-29\", matchup: \"BKN vs. ATL\" },\n * { game_id: \"0022500149\", game_date: \"2025-11-02\", matchup: \"BKN vs. PHI\" },\n * { game_id: \"0022500156\", game_date: \"2025-11-03\", matchup: \"BKN vs. MIN\" },\n * { game_id: \"0022500173\", game_date: \"2025-11-05\", matchup: \"BKN @ IND\" },\n * { game_id: \"0022500031\", game_date: \"2025-11-07\", matchup: \"BKN vs. DET\" },\n * ];\n * const day = (g: (typeof games)[number]): Date => new Date(`${g.game_date}T00:00:00Z`);\n * const x = scaleUtc([new Date(\"2025-10-28\"), new Date(\"2025-11-08\")], [10, 630]);\n * const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n * svg.setAttribute(\"viewBox\", \"0 0 640 60\");\n * select(svg)\n * .selectAll(\"rect\")\n * .data(games)\n * .join(\"rect\")\n * .attr(\"x\", (g) => x(day(g)) - 1.5)\n * .attr(\"y\", 6)\n * .attr(\"width\", 3)\n * .attr(\"height\", 40)\n * .attr(\"data-sdv-id\", (g) => g.game_id); // the stamp linkIds would write\n * const store = createSelection<(typeof games)[number]>();\n * // no figure.scale on a d3 chart: pass the d3 scale itself (its range() is a method; brushFilter reads it)\n * brushFilter(svg, store, { data: games, x: day, id: \"game_id\", scales: { x } }).move({\n * x: [new Date(\"2025-11-04\"), new Date(\"2025-11-08\")],\n * });\n * [...store.getState().selected]; // [\"0022500173\", \"0022500031\"]\n * ```\n */\nexport function brushFilter<R>(\n figure: PlotFigure,\n store: SelectionStore<R>,\n o: BrushFilterOptions<R>,\n): BrushFilterHandle {\n if (o.x === undefined && o.y === undefined)\n throw new InputError(\"brushFilter needs x, y or both: the fields its brushed axes encode\");\n if (o.empty !== undefined && o.empty !== \"dim\" && o.empty !== \"clear\")\n throw new InputError(`brushFilter: empty is \"dim\" or \"clear\", not ${JSON.stringify(o.empty)}`);\n const xs = o.x === undefined ? undefined : scaleOf(o.scales?.x ?? figure.scale?.(\"x\"));\n const ys = o.y === undefined ? undefined : scaleOf(o.scales?.y ?? figure.scale?.(\"y\"));\n // both directions: move() maps data to pixels (apply), a drag maps pixels back (invert); a JavaScript caller can\n // pass an object with one alone\n const usable = (s: ScaleLike | undefined): boolean =>\n typeof s?.apply === \"function\" && typeof s?.invert === \"function\";\n if ((o.x !== undefined && !usable(xs)) || (o.y !== undefined && !usable(ys)))\n throw new InputError(\n \"brushFilter needs continuous x and y scales on the axes it brushes; band and point scales cannot be inverted, and a chart without figure.scale passes `scales`\",\n );\n if (!hasDom()) return NOOP;\n const svg =\n figure.tagName.toLowerCase() === \"svg\"\n ? figure\n : Array.from(figure.querySelectorAll(\":scope > svg\")).at(-1);\n if (!svg) throw new InputError(\"brushFilter: no <svg> in the figure\");\n const [bx, by, bw, bh] = boxOf(svg);\n /** The axis' pixel extent: the scale's range, else (no scale, or no finite range) the svg's box, as linkCursor's. */\n const pixels = (s: ScaleLike | undefined, from: number, to: number): [number, number] => {\n const r = Array.from(s?.range ?? [], Number).filter(Number.isFinite);\n return r.length > 0 ? [Math.min(...r), Math.max(...r)] : [from, to];\n };\n const [x0px, x1px] = pixels(xs, bx, bx + bw);\n const [y0px, y1px] = pixels(ys, by, by + bh);\n const node = svg.ownerDocument.createElementNS(SVG_NS, \"g\");\n node.setAttribute(\"class\", \"sdv-brush\");\n svg.insertBefore(node, svg.firstChild);\n const g = select<SVGGElement, unknown>(node);\n let mine: RowFilter<R> | null = null;\n let picked: ReadonlySet<string> | null = null; // the `selected` this brush wrote with `mine`\n let last = \"\"; // d3 emits \"brush\" then \"end\" for one gesture: one store update per distinct region\n // move()'s own data region while d3 emits it (synchronously): the pixel round trip is inexact, and\n // invert(apply(10)) = 10.000000000000002 would leave a row at 10 outside a brush starting at 10\n let asked: { x?: [number, number]; y?: [number, number] } | null = null;\n const idOf = (row: R, i: number): string => (o.id === undefined ? String(i) : toId(get(row, o.id)));\n const b = (xs && ys ? brush<unknown>() : xs ? brushX<unknown>() : brushY<unknown>()).extent([\n [x0px, y0px],\n [x1px, y1px],\n ]);\n /**\n * The brush's region is gone: clear the store only while it still holds that region (main: the window alone), and\n * `selected` only while it is still the set this brush wrote: a pick another control made since survives.\n */\n const release = (): void => {\n last = \"\";\n if (mine === null) return;\n const own = store.getState().selected === picked;\n mine = null;\n picked = null;\n store.set(own ? { selected: [], predicate: null } : { predicate: null });\n };\n // Remove the drawn rectangle. Always called with `mine` already null, so the null selection d3 then emits releases\n // nothing: the erasure writes nothing (main ignores its programmatic moves the same way, timeline.ts:57).\n const erase = (): void => {\n g.call(b.move, null);\n };\n b.on(\"brush end\", (event: D3BrushEvent<unknown>) => {\n const sel: BrushSelection | null = event.selection;\n if (sel === null) return release();\n // a 1-D brush reports [p0, p1] along its axis; a 2-D one [[x0, y0], [x1, y1]]\n const [px, py]: [readonly number[] | null, readonly number[] | null] =\n typeof sel[0] === \"number\"\n ? xs\n ? [sel as [number, number], null]\n : [null, sel as [number, number]]\n : [\n [sel[0][0], (sel[1] as [number, number])[0]],\n [sel[0][1], (sel[1] as [number, number])[1]],\n ];\n const tests: [Field<R>, number, number][] = [];\n if (o.x !== undefined && px)\n tests.push([o.x, ...(asked?.x ?? span(xs?.invert?.(px[0]), xs?.invert?.(px[1])))]);\n if (o.y !== undefined && py)\n tests.push([o.y, ...(asked?.y ?? span(ys?.invert?.(py[0]), ys?.invert?.(py[1])))]);\n const key = tests.map(([, lo, hi]) => `${lo}|${hi}`).join(\"|\");\n if (key === last) return;\n const inside: RowFilter<R> = (row) =>\n tests.every(([f, lo, hi]) => {\n const v = num(get(row, f));\n return v >= lo && v <= hi;\n });\n // ponytail: linear scan per move (10k rows well under a frame); d3.quadtree if data passes ~100k\n const ids = o.data.flatMap((row, i) => (inside(row) ? [idOf(row, i)] : []));\n if (ids.length === 0 && o.empty === \"clear\") {\n release();\n if (event.type === \"end\") erase(); // main timeline.ts:35-43: an empty window left drawn would look applied\n return;\n }\n last = key;\n mine = inside;\n const had = store.getState().selected;\n store.set({ selected: ids, predicate: inside });\n const now = store.getState().selected;\n // the brush owns `selected` by identity: the set its write made, or one it already owned. An equal set another\n // control selected first keeps its identity (the store drops a no-op), so it stays that control's\n picked = now !== had || had === picked ? now : null;\n });\n g.call(b);\n // The drawn brush follows the store: a region cleared or replaced elsewhere (a \"Clear dates\" button, another brush)\n // removes the rectangle, writing nothing.\n const off = store.subscribe((s) => {\n if (mine === null || s.predicate === mine) return;\n mine = null;\n erase();\n });\n const at = (s: ScaleLike | undefined, r: readonly [unknown, unknown] | undefined, axis: string) => {\n if (s === undefined) return null;\n if (r === undefined)\n throw new InputError(`brushFilter: move needs region.${axis}, the brushed ${axis} range`);\n return span(s.apply(r[0]), s.apply(r[1]));\n };\n return {\n move(region) {\n if (region === null) {\n g.call(b.move, null);\n return;\n }\n const px = at(xs, region.x, \"x\");\n const py = at(ys, region.y, \"y\");\n asked = {\n ...(px && region.x && { x: span(region.x[0], region.x[1]) }),\n ...(py && region.y && { y: span(region.y[0], region.y[1]) }),\n };\n try {\n g.call(\n b.move,\n px && py\n ? [\n [px[0], py[0]],\n [px[1], py[1]],\n ]\n : (px ?? py),\n );\n } finally {\n asked = null;\n }\n },\n destroy() {\n off();\n node.remove();\n if (mine !== null && store.getState().predicate === mine) release();\n },\n };\n}\n","import { pointer } from \"d3\";\nimport { InputError } from \"../errors.js\";\nimport { type Cursor, type SelectionStore, sameCursor } from \"../selection.js\";\nimport { type D3ScaleLike, type PlotFigure, type ScaleLike, scaleOf } from \"./brush.js\";\nimport { hasDom } from \"./highlight.js\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n/** A13: custom properties with fallbacks, so a page's light/dark tokens restyle every cursor with no JS. */\nconst CSS =\n \".sdv-cursor line,.sdv-cursor ellipse{fill:none;stroke:var(--sdv-cursor-color,rgba(0,0,0,.2));stroke-width:var(--sdv-cursor-width,10px)}\" +\n \".sdv-cursor rect{fill:var(--sdv-cursor-color,rgba(0,0,0,.2))}.sdv-cursor circle{fill:currentColor}\";\n/** Master's readout flips once the distance reaches 30 of the chart's 35 ft (`BarChart/Cursor.js:7,20-22`). */\nconst FLIP_AT = 30 / 35;\n\n/** A scale a cursor maps through: a {@link ScaleLike}, plus a band scale's width and domain. */\nexport interface BandScaleLike extends ScaleLike {\n /** The band width in pixels. A number marks a band scale, whose domain values are the bands' first values. */\n readonly bandwidth?: number;\n /** The domain; a band scale's must be all numbers. */\n readonly domain?: Iterable<unknown>;\n}\n/**\n * What a figure draws for the cursor. `axis: \"x\" | \"y\"`: a rule across the plot at the value, or with `width` a band\n * `width` data units wide centred on it, or on a band scale (`bandwidth`) the band holding it. `cross` is the other\n * axis' scale: the rule spans its range (default: the figure's own other scale on a Plot figure, else the svg's\n * viewBox). `axis: \"ring\"`: an ellipse around `center` (data coordinates) whose radii are the value mapped through the\n * x and y scales, such as a shot distance around the hoop. Every scale is a Plot figure's (`svg.scale(\"x\")`) or a d3\n * scale as it is ({@link D3ScaleLike}: `d3.scaleLinear()`, `d3.scaleBand()`), as `brushFilter`'s `scales` are.\n */\nexport type CursorShape =\n | {\n readonly axis: \"x\" | \"y\";\n readonly scale: BandScaleLike | D3ScaleLike;\n readonly width?: number;\n readonly cross?: ScaleLike | D3ScaleLike;\n }\n | {\n readonly axis: \"ring\";\n readonly x: ScaleLike | D3ScaleLike;\n readonly y: ScaleLike | D3ScaleLike;\n readonly center: readonly [number, number];\n };\n/** How {@link linkCursor} follows and emits the store's cursor. */\nexport interface LinkCursorOptions {\n /** The cursor field this figure draws and emits, such as `\"shot_distance\"`; a cursor naming another field hides it. */\n readonly field: string;\n /** What to draw, through which scale. */\n readonly shape: CursorShape;\n /** Write the value under the pointer to the store. Default `true` for `\"x\"` / `\"y\"`; a ring never emits. */\n readonly emit?: boolean;\n /** Snap an emitted value on a linear scale, such as `(v) => Math.floor(v) + 0.5` for 1 ft bins. Default: none. */\n readonly snap?: (value: number) => number;\n /** A readout beside an `\"x\"` cursor, one line per string. */\n readonly label?: (value: number) => readonly string[];\n /** Past this fraction of the axis' pixel range (0, 1] the readout flips to the cursor's left. Default 30 / 35. */\n readonly flipAt?: number;\n /** A dot on the cursor at this OTHER-axis data value (a curve's value there); `null` hides it. Needs `cross`. */\n readonly dot?: (value: number) => number | null;\n}\n\nconst isNum = (v: unknown): v is number => typeof v === \"number\" && Number.isFinite(v);\nconst extent = (r: Iterable<unknown> | undefined): [number, number] | null => {\n const a = Array.from(r ?? [], Number).filter(Number.isFinite);\n return a.length > 0 ? [Math.min(...a), Math.max(...a)] : null;\n};\n/** The svg's user-space box: its viewBox, else its width and height. */\nconst box = (svg: Element): { x: [number, number]; y: [number, number] } => {\n const v = (svg.getAttribute(\"viewBox\") ?? \"\")\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n const [x, y, w, h] =\n v.length === 4 && v.every(Number.isFinite)\n ? v\n : [0, 0, Number(svg.getAttribute(\"width\")) || 0, Number(svg.getAttribute(\"height\")) || 0];\n return { x: [x ?? 0, (x ?? 0) + (w ?? 0)], y: [y ?? 0, (y ?? 0) + (h ?? 0)] };\n};\n\n/**\n * Draw the store's cursor (J34: one shared hover VALUE, such as a shot distance) through THIS figure's own scale, and\n * write the value under the pointer back. Every linked chart follows the same number its own way: a band on share bars\n * (linear x), the band holding it on FG% bars (a band scale), a band on a side chart (y), a rule on a curve, a ring\n * around the hoop. Moving inside one snapped bin writes nothing; crossing a bin edge is one update; leaving the figure\n * (`pointerleave`, `pointercancel`) or the axis' range clears the cursor this figure wrote, while the store still holds\n * it: never one an app `store.set` or another figure wrote since, nor an equal one set before (the store kept that one,\n * so this figure wrote none). A cursor never dims marks or filters a table (it is not an id). A store change moves\n * attributes only: no element is added or removed, so a cursor costs O(1) per figure. The move and press listeners\n * capture, so a Plot `tip` that stops a press from reaching other listeners does not stop this one; the leave listeners\n * do not, so a mark's own `pointerleave` (the pointer crossing a bar's edge inside one bin) writes nothing. Styled by\n * `--sdv-cursor-color` and `--sdv-cursor-width`. Returns a teardown FUNCTION, not a handle, because teardown is all it\n * has (as `linkSelection`'s; `brushFilter`, `nearestHover` and `tooltip` return a handle with `destroy()`). The scales'\n * pixel ranges are read once, so after a resize, relink. The teardown removes the cursor and its listeners, and clears\n * the store's cursor when it still holds the one this figure last wrote (as `linkSelection`'s teardown does with its\n * hover): a chart redrawn under the pointer leaves no cursor that no pointer drives. Throws `InputError` on a bad\n * option, in Node too; a no-op without a DOM.\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { linkCursor } from \"@sportsdataverse/sdvplot/interact\";\n * import { fgPctByDistance } 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 * const bins = fgPctByDistance(shots, 1, 30);\n * const svg = Plot.plot({\n * x: { label: \"Shot distance (ft)\" },\n * marks: [Plot.rectY(bins, { x1: \"distance\", x2: (b) => b.distance + 1, y: \"attempts\" })],\n * });\n * const store = createSelection();\n * linkCursor(svg, store, {\n * field: \"shot_distance\",\n * shape: { axis: \"x\", scale: svg.scale(\"x\")!, width: 1 },\n * snap: (feet) => Math.floor(feet) + 0.5, // one value per 1 ft bin\n * label: (feet) => [`@ ${Math.floor(feet)} ft`],\n * });\n * store.set({ cursor: { field: \"shot_distance\", value: 26.5 } }); // what a pointer 26.3 ft out writes\n * svg; // the 26-27 ft band shaded, with its readout\n * ```\n */\nexport function linkCursor<R>(root: Element, store: SelectionStore<R>, o: LinkCursorOptions): () => void {\n const { shape } = o;\n if (typeof o.field !== \"string\" || o.field === \"\")\n throw new InputError(\"linkCursor needs a non-empty cursor field\");\n if (typeof shape !== \"object\" || shape === null)\n throw new InputError(\"linkCursor needs a shape: what to draw\");\n if (shape.axis !== \"x\" && shape.axis !== \"y\" && shape.axis !== \"ring\")\n throw new InputError(`linkCursor shape.axis must be \"x\", \"y\" or \"ring\", got ${String(shape.axis)}`);\n if (o.flipAt !== undefined && !(o.flipAt > 0 && o.flipAt <= 1))\n throw new InputError(`linkCursor flipAt must be in (0, 1], got ${String(o.flipAt)}`);\n // a d3 scale is adapted once (A6): its range, bandwidth and domain are methods, its apply Function.prototype's\n const ring = shape.axis === \"ring\" ? { ...shape, x: scaleOf(shape.x), y: scaleOf(shape.y) } : null;\n const line =\n shape.axis === \"ring\" ? null : { ...shape, scale: scaleOf(shape.scale), cross: scaleOf(shape.cross) };\n // a JavaScript caller can leave one out: name it here, in Node too, never a TypeError (or a throw in the browser later)\n const isScale = (s: unknown): boolean =>\n typeof (s as { apply?: unknown } | undefined)?.apply === \"function\";\n if (\n ring\n ? !isScale(ring.x) || !isScale(ring.y)\n : !isScale(line?.scale) || (line?.cross !== undefined && !isScale(line.cross))\n )\n throw new InputError(\n `linkCursor: shape.${ring ? \"x and shape.y\" : line?.cross === undefined ? \"scale\" : \"scale and shape.cross\"} must be scales, a Plot figure's or d3's`,\n );\n if (ring) {\n // exactly two: every() is vacuously true on [], which would leave the ring hidden for good\n const c: unknown = ring.center;\n if (!Array.isArray(c) || c.length !== 2 || !c.every(Number.isFinite))\n throw new InputError(`linkCursor ring center must be two finite numbers, got ${JSON.stringify(c)}`);\n if (o.emit === true) throw new InputError(\"linkCursor: a ring follows the cursor but never emits it\");\n if (o.label || o.dot)\n throw new InputError(\"linkCursor: label and dot are for an x or y cursor, not a ring\");\n }\n if (line?.width !== undefined && !(isNum(line.width) && line.width > 0))\n throw new InputError(`linkCursor shape.width must be a finite number > 0, got ${String(line.width)}`);\n if (line?.axis === \"y\" && o.label)\n throw new InputError(\"linkCursor: label is a readout beside an x cursor\");\n // a band scale: its sorted numeric domain, each value the start of a band that runs to the next start\n let starts: number[] | null = null;\n if (line && typeof line.scale.bandwidth === \"number\") {\n const d = Array.from(line.scale.domain ?? []);\n if (d.length === 0 || !d.every(isNum))\n throw new InputError(\"linkCursor: a band scale's domain must be numbers, each band's first value\");\n starts = [...d].sort((a, b) => a - b);\n }\n const emit = line !== null && o.emit !== false;\n if (emit && starts === null && typeof line?.scale.invert !== \"function\")\n throw new InputError(\"linkCursor: emitting needs a scale with invert (linear) or a bandwidth (band)\");\n const figure = root as Partial<PlotFigure>;\n const cross: ScaleLike | undefined =\n line?.cross ??\n (line && typeof figure.scale === \"function\" ? figure.scale(line.axis === \"x\" ? \"y\" : \"x\") : undefined);\n if (o.dot && !cross) throw new InputError(\"linkCursor: dot needs a cross scale (shape.cross)\");\n if (!hasDom()) return () => {};\n\n const svg =\n root.tagName.toLowerCase() === \"svg\" ? root : Array.from(root.querySelectorAll(\":scope > svg\")).at(-1);\n if (!svg) throw new InputError(\"linkCursor: no <svg> in the root\");\n const doc = svg.ownerDocument;\n const make = (tag: string, parent: Element): Element => {\n const el = doc.createElementNS(SVG_NS, tag);\n parent.append(el);\n return el;\n };\n if (!svg.querySelector(':scope > style[data-sdv-interact=\"cursor\"]')) {\n const style = make(\"style\", svg);\n style.setAttribute(\"data-sdv-interact\", \"cursor\");\n style.textContent = CSS;\n }\n const g = make(\"g\", svg);\n g.setAttribute(\"class\", \"sdv-cursor\");\n g.setAttribute(\"pointer-events\", \"none\");\n g.setAttribute(\"display\", \"none\");\n const mark = make(ring ? \"ellipse\" : starts || line?.width ? \"rect\" : \"line\", g);\n const text = o.label ? make(\"text\", g) : null;\n const tspans: { el: Element; line: Text }[] = [];\n const circle = o.dot ? make(\"circle\", g) : null;\n circle?.setAttribute(\"r\", \"3\");\n\n const vb = box(svg);\n const along = line ? (extent(line.scale.range) ?? vb[line.axis]) : vb.x;\n const across = line ? (extent(cross?.range) ?? vb[line.axis === \"x\" ? \"y\" : \"x\"]) : vb.y;\n /** The band `i` covers [starts[i], end(i)): the next start, or one step past the last (a single band never ends). */\n const end = (s: number[], i: number): number => {\n const next = s[i + 1];\n if (next !== undefined) return next;\n const last = s[i] ?? 0;\n const prev = s[i - 1];\n return prev === undefined ? Number.POSITIVE_INFINITY : last + (last - prev);\n };\n const set = (el: Element, attrs: Record<string, number | string>): void => {\n for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, String(v));\n };\n /** Where an axis cursor sits for `v`, in pixels along its axis: [low edge, high edge, centre]; null if nowhere. */\n const place = (v: number): [number, number, number] | null => {\n if (!line) return null;\n const px = (d: number): number => Number(line.scale.apply(d));\n let lo: number;\n let hi: number;\n let mid: number;\n if (starts) {\n let i = -1;\n for (let k = 0; k < starts.length && (starts[k] ?? 0) <= v; k++) i = k;\n if (i < 0 || v >= end(starts, i)) return null;\n lo = px(starts[i] ?? 0);\n hi = lo + (line.scale.bandwidth ?? 0);\n mid = (lo + hi) / 2;\n } else {\n const w = (line.width ?? 0) / 2;\n const [p, q] = [px(v - w), px(v + w)];\n [lo, hi, mid] = [Math.min(p, q), Math.max(p, q), px(v)];\n }\n return [lo, hi, mid].every(Number.isFinite) ? [lo, hi, mid] : null;\n };\n const draw = (c: Cursor | null): void => {\n const v = c?.value;\n if (v === undefined) {\n g.setAttribute(\"display\", \"none\");\n return;\n }\n if (ring) {\n const [c0, c1] = ring.center;\n const cx = Number(ring.x.apply(c0));\n const cy = Number(ring.y.apply(c1));\n const rx = Math.abs(Number(ring.x.apply(c0 + v)) - cx);\n const ry = Math.abs(Number(ring.y.apply(c1 + v)) - cy);\n if (![cx, cy, rx, ry].every(Number.isFinite)) {\n g.setAttribute(\"display\", \"none\");\n return;\n }\n set(mark, { cx, cy, rx, ry });\n g.removeAttribute(\"display\");\n return;\n }\n const at = place(v);\n if (!line || !at) {\n g.setAttribute(\"display\", \"none\");\n return;\n }\n const [lo, hi, mid] = at;\n const [a0, a1] = across;\n const x = line.axis === \"x\";\n if (mark.tagName === \"rect\")\n set(\n mark,\n x\n ? { x: lo, width: hi - lo, y: a0, height: a1 - a0 }\n : { y: lo, height: hi - lo, x: a0, width: a1 - a0 },\n );\n else set(mark, x ? { x1: mid, x2: mid, y1: a0, y2: a1 } : { y1: mid, y2: mid, x1: a0, x2: a1 });\n if (text && o.label) {\n const lines = o.label(v);\n const [p0, p1] = along;\n const flip = (mid - p0) / (p1 - p0 || 1) > (o.flipAt ?? FLIP_AT);\n while (tspans.length < lines.length) {\n const el = make(\"tspan\", text); // ponytail: added once, the first time a readout needs this many lines\n el.setAttribute(\"dy\", tspans.length === 0 ? \"1em\" : \"1.3em\");\n const t = doc.createTextNode(\"\");\n el.append(t);\n tspans.push({ el, line: t });\n }\n set(text, { y: a0, \"text-anchor\": flip ? \"end\" : \"start\" });\n for (const [i, { el, line: t }] of tspans.entries()) {\n el.setAttribute(\"x\", String(flip ? lo - 10 : hi + 10));\n t.data = lines[i] ?? \"\"; // characterData, not a child swap\n }\n }\n if (circle && o.dot && cross) {\n const dv = o.dot(v);\n const cp = dv === null ? Number.NaN : Number(cross.apply(dv));\n if (Number.isFinite(cp)) {\n set(circle, x ? { cx: mid, cy: cp } : { cx: cp, cy: mid });\n circle.removeAttribute(\"display\");\n } else circle.setAttribute(\"display\", \"none\");\n }\n g.removeAttribute(\"display\");\n };\n\n let drawn: Cursor | null = null;\n const sync = (c: Cursor | null): void => {\n const mine = c !== null && c.field === o.field ? c : null;\n if (sameCursor(mine, drawn)) return; // a hover or selection change, or the same value again: nothing to move\n drawn = mine;\n draw(mine);\n };\n const offs: (() => void)[] = [store.subscribe((s) => sync(s.cursor))];\n offs.push(() => g.remove());\n sync(store.getState().cursor);\n\n let wrote: Cursor | null = null; // the store's cursor object this figure wrote\n /** Clear the store's cursor only while it holds the one this figure wrote: never an app's or another figure's. */\n const clear = (): void => {\n if (wrote !== null && store.getState().cursor === wrote) store.set({ cursor: null });\n wrote = null;\n };\n if (line && emit) {\n /** The value under the pointer along this axis, or null outside the axis' pixel range. */\n const valueAt = (p: number): number | null => {\n const [p0, p1] = along;\n if (!(p >= p0 && p <= p1)) return null;\n if (starts) {\n let best = 0;\n let gap = Number.POSITIVE_INFINITY;\n for (const [i, s] of starts.entries()) {\n const d = Math.abs(Number(line.scale.apply(s)) + (line.scale.bandwidth ?? 0) / 2 - p);\n if (d < gap) [best, gap] = [i, d];\n }\n const e = end(starts, best);\n const s = starts[best] ?? 0;\n return Number.isFinite(e) ? (s + e) / 2 : s;\n }\n const v = Number(line.scale.invert?.(p));\n return o.snap ? o.snap(v) : v;\n };\n const move = (e: Event): void => {\n const [mx, my] = pointer(e, svg);\n const v = valueAt(line.axis === \"x\" ? mx : my);\n if (v === null || !Number.isFinite(v)) clear();\n else {\n const had = store.getState().cursor;\n store.set({ cursor: { field: o.field, value: v } });\n const now = store.getState().cursor;\n // owned by identity, as a brush owns `selected`: the cursor this write made, or one this figure already\n // owned. An equal cursor set first elsewhere keeps its identity (the store drops a no-op), so it stays theirs\n wrote = now !== had || had === wrote ? now : null;\n }\n };\n const on = (type: string, fn: (e: Event) => void, capture: boolean): void => {\n svg.addEventListener(type, fn, { capture });\n offs.push(() => svg.removeEventListener(type, fn, { capture }));\n };\n on(\"pointermove\", move, true);\n on(\"pointerdown\", move, true); // A34: capture, before Plot's tip, which stops other pointerdowns\n // never capture a leave: pointerleave does not bubble, but a capture listener hears every mark's own leave, so\n // crossing a bar's edge inside one bin would write null and then the value again (nearestHover registers the same)\n on(\"pointerleave\", clear, false);\n on(\"pointercancel\", clear, false);\n }\n return () => {\n for (const off of offs) off();\n clear();\n };\n}\n","import { InputError, warn } from \"../errors.js\";\nimport { type RowFilter, type SelectionState, type SelectionStore, focusIds, toId } from \"../selection.js\";\nimport { hasDom, highlight } from \"./highlight.js\";\n\n/** What an sdvtables engine emits on `subscribe` (structurally its `TableEvent`). */\nexport type LinkEvent =\n | { readonly type: \"change\" }\n | { readonly type: \"hover\"; readonly id: string | null }\n | { readonly type: \"select\"; readonly ids: ReadonlySet<string> };\n/** The slice of an sdvtables `Table` that linking needs. Structural, so sdvplot never depends on sdvtables. */\nexport interface LinkableTable<Row> {\n /** Filter the table's rows by a row test (the store's brush region); `null` clears it. */\n setExternalFilter(filter: RowFilter<Row> | null): void;\n /** Select rows by id; the table renders them selected. */\n setSelection(ids: ReadonlySet<string>): void;\n /** Light one row by id (the store's first hover id); `null` clears it. A table holds one hover id. */\n setHover(id: string | null): void;\n /** Row hover and click events; returns the unsubscribe function. */\n subscribe(fn: (event: LinkEvent) => void): () => void;\n}\n/** What {@link linkSelection} wires to a store: one figure and/or one table. */\nexport interface LinkSelectionOptions<Row, Datum = unknown> {\n /**\n * The figure whose marks carry `data-sdv-id`: what `Plot.plot` returns (stamped by `linkIds`), or a d3-drawn `<svg>`\n * with its own stamps.\n */\n figure?: Element;\n /**\n * How the figure writes `hover`. `true` (the default): the stamped mark under the pointer (`mouseover`). `false`: it\n * writes nothing, for a figure another writer hovers. `{ id }`: the datum Plot's own `tip`/`pointer` picks, the\n * nearest within its `maxRadius`, published as the figure's `value` with an `input` event; `id` maps it to a link id\n * (`null` clears). Pass `figure` as `Plot.plot` returned it: with a caption or legend that is a `<figure>`, and only the\n * figure hears `input`. Anything else throws `InputError`, in Node too.\n */\n hover?: boolean | { readonly id: (datum: Datum) => unknown };\n /** A `createTable` engine: `useTable().table`, or the one passed to `hydrate`. */\n table?: LinkableTable<Row>;\n /**\n * `\"toggle\"`: each stamped mark of `figure` becomes a checkbox (`role`, `tabindex=\"0\"`, `aria-checked` kept in step\n * with the store), and a click, Enter or Space toggles its id in `selected`. Each checkbox keeps the mark's own\n * accessible name: name the marks through Plot's `ariaLabel` channel (`ariaLabel: \"matchup\"`, an `aria-label`) or its\n * `title` channel (a `<title>`); a mark with neither is named by its link id until teardown. Throws `InputError` when\n * a mark sits in an `<a href>`: a checkbox inside a link is nested interactive content with two tab stops; and, with\n * a DOM, when the figure already has a live toggle link, whose click would then toggle twice (tear it down first).\n * On a Plot figure with a `tip`, a click also pins Plot's tip; give the tip `pointerEvents: \"none\"` so the pinned tip\n * never takes a click meant for a mark under it.\n */\n select?: \"toggle\";\n}\n\nconst first = (ids: ReadonlySet<string>): string | null => {\n for (const id of ids) return id;\n return null;\n};\n/**\n * A data mark's element under the event: its stamp, never an axis decoration's (`data-sdv-axis`, A39), nor an empty\n * stamp (`toId`'s missing id), which names no row to hover or toggle.\n */\nconst MARK = '[data-sdv-id]:not([data-sdv-id=\"\"]):not([data-sdv-axis])';\n/** The stamped mark an event in `figure` landed in; `closest` alone climbs past `figure` to a stamped ancestor. */\nconst markAt = (figure: Element, e: Event): Element | null => {\n const t = e.target as Node | null;\n const mark = t?.nodeType === 1 ? (t as Element).closest(MARK) : null;\n return mark && figure.contains(mark) ? mark : null;\n};\n/** Figures already warned about a join-key mismatch: once per figure, not once per hovered id. */\nconst warned = new WeakSet<Element>();\n/** Live links per figure: a teardown un-dims its figure only when no other link on it still follows the store. */\nconst links = new WeakMap<Element, number>();\n/** Figures with a live `select: \"toggle\"` link: a second one would toggle each click twice, so it throws. */\nconst toggling = new WeakSet<Element>();\n/** What `select: \"toggle\"` sets on a mark, and its teardown gives back. */\nconst TOGGLE_ATTRS = [\"role\", \"tabindex\", \"aria-checked\", \"aria-label\"] as const;\n\n/**\n * Wire a figure and/or a table to a selection store (J31). Figure: pointer hover → `hover` (see\n * {@link LinkSelectionOptions.hover}); every store change → `highlight(figure, focusIds(state))`. Table: row hover /\n * click → `hover` / `selected`; every store change → `setSelection(selected)`, `setExternalFilter(predicate)` and\n * `setHover` with the first hover id. Loop-free: the store and the engine drop no-op updates, and the events a table\n * emits while the store is being applied to it are not written back (so a two-id hover is never narrowed to the one id\n * a table holds). One figure or one table per call; link several by calling again with the same store. The store\n * comes first because the call takes a figure, a table or both. Returns a teardown FUNCTION, not a handle: teardown is\n * all a link has, so `useEffect(() => linkSelection(store, o), deps)` is one line (`brushFilter`, `nearestHover` and\n * `tooltip`, which have more to do, return a handle with `destroy()`). The teardown clears `hover` when the store still\n * holds the hover this link wrote (as `nearestHover`'s `destroy` does; an equal hover set first elsewhere is not one it\n * wrote): a figure redrawn under the pointer leaves no stale hover dimming the others. It then restores the view it\n * changed, so a figure or table unlinked and kept on the page shows no store state: the figure un-dims (once the last\n * link on it goes), its toggled marks get their own attributes back, and the table drops the brush filter and the hover\n * it showed. It never clears store state another writer owns: a brush's region and a selection stay in the store for\n * the views still linked. To replace a figure, tear its link down before linking the new one, which otherwise reads the\n * old figure's hover. Inert without a DOM, so server-rendered markup never changes. With `select: \"toggle\"`, the\n * figure's marks are keyboard-reachable checkboxes over `selected` ({@link LinkSelectionOptions.select}).\n *\n * @example\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { linkSelection } from \"@sportsdataverse/sdvplot/interact\";\n * import { linkIds } from \"@sportsdataverse/sdvplot/plot\";\n * import { createTable, defineTable } from \"@sportsdataverse/sdvtables\";\n *\n * const rows = [\n * { team: \"KC\", wins: 15, net_epa: 0.063 },\n * { team: \"BUF\", wins: 13, net_epa: 0.19 },\n * { team: \"MIA\", wins: 8, net_epa: -0.019 },\n * ];\n * type Row = (typeof rows)[number];\n * const svg = Plot.plot({ marks: [Plot.dot(rows, { x: \"wins\", y: \"net_epa\", r: 6, render: linkIds(rows, \"team\") })] });\n * const spec = defineTable<Row>().columns((c) => [c.text(\"team\"), c.int(\"wins\")]).rowKey(\"team\").build();\n * const table = createTable(spec, rows); // the engine a hydrated table or <SdvTable table/> renders\n * const store = createSelection<Row>();\n * linkSelection(store, { figure: svg });\n * linkSelection(store, { table });\n * table.setSelection(new Set([\"BUF\"])); // what a click on Buffalo's row calls: the store and the figure follow\n * svg; // Buffalo's dot lit, the rest dimmed\n * ```\n *\n * @example Games as checkboxes: click a cell, or Tab to it and press Enter or Space\n * ```ts\n * import * as Plot from \"@observablehq/plot\";\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { linkSelection } from \"@sportsdataverse/sdvplot/interact\";\n * import { linkIds } from \"@sportsdataverse/sdvplot/plot\";\n *\n * // five of Brooklyn's 2025-26 games\n * const games = [\n * { game_id: \"0022500130\", game_date: \"2025-10-29\", matchup: \"BKN vs. ATL\", wl: \"L\" },\n * { game_id: \"0022500149\", game_date: \"2025-11-02\", matchup: \"BKN vs. PHI\", wl: \"L\" },\n * { game_id: \"0022500156\", game_date: \"2025-11-03\", matchup: \"BKN vs. MIN\", wl: \"L\" },\n * { game_id: \"0022500173\", game_date: \"2025-11-05\", matchup: \"BKN @ IND\", wl: \"W\" },\n * { game_id: \"0022500031\", game_date: \"2025-11-07\", matchup: \"BKN vs. DET\", wl: \"L\" },\n * ];\n * const svg = Plot.plot({\n * height: 60,\n * x: { type: \"band\" },\n * marks: [\n * Plot.cell(games, { x: \"game_date\", fill: \"wl\", ariaLabel: \"matchup\", render: linkIds(games, \"game_id\") }),\n * ],\n * });\n * const store = createSelection<(typeof games)[number]>();\n * linkSelection(store, { figure: svg, select: \"toggle\" }); // each cell: role=\"checkbox\", tabindex=\"0\", aria-checked\n * svg.querySelector('[data-sdv-id=\"0022500173\"]')?.dispatchEvent(new MouseEvent(\"click\", { bubbles: true }));\n * svg; // the win at Indiana checked and lit, the rest dimmed: click a game, or Tab to it and press Enter or Space\n * ```\n */\nexport function linkSelection<Row, Datum = unknown>(\n store: SelectionStore<Row>,\n o: LinkSelectionOptions<Row, Datum>,\n): () => void {\n const toggled = toggleMarks(o);\n const { figure, table, hover = true } = o;\n if (typeof hover !== \"boolean\" && typeof (hover as { id?: unknown } | null)?.id !== \"function\")\n throw new InputError(\"linkSelection: hover is true, false or { id: (datum) => link id }\");\n if (!hasDom()) return () => {};\n if (figure && toggled.length > 0 && toggling.has(figure))\n throw new InputError(\n 'linkSelection: this figure already has a live select: \"toggle\" link (a click would toggle twice); tear it down first',\n );\n if (figure) links.set(figure, (links.get(figure) ?? 0) + 1);\n const offs: (() => void)[] = [];\n let wrote: ReadonlySet<string> | null = null; // the store's hover set this link wrote; the teardown clears it\n const writeHover = (id: string | null): void => {\n const had = store.getState().hover;\n store.set({ hover: id === null ? [] : [id] });\n const now = store.getState().hover;\n // owned by identity, as a brush owns `selected`: the set this write made, or one this link already owned. An\n // equal hover set first elsewhere keeps its identity (the store drops a no-op), so it stays theirs\n wrote = now !== had || had === wrote ? now : null;\n };\n let syncing = false; // A29: the table's own events while the store is applied to it are echoes, not user input\n const sync = (s: SelectionState<Row>): void => {\n if (figure) {\n const focus = focusIds(s);\n const missing = highlight(figure, focus);\n if (focus !== null && focus.size > 0 && missing.length === focus.size && !warned.has(figure)) {\n warned.add(figure);\n const shown = missing.slice(0, 5).join(\", \");\n warn(\n `link:missing:${shown}`,\n `none of the linked ids (${shown}${missing.length > 5 ? \", …\" : \"\"}) is drawn in this figure; the marks' id channel and the table's rowKey must hold the same values`,\n );\n }\n }\n if (table) {\n syncing = true;\n try {\n table.setSelection(s.selected);\n table.setExternalFilter(s.predicate);\n table.setHover(first(s.hover));\n } finally {\n syncing = false;\n }\n }\n };\n const on = (el: Element, type: string, fn: (e: Event) => void): void => {\n el.addEventListener(type, fn);\n offs.push(() => el.removeEventListener(type, fn));\n };\n if (figure && hover === true) {\n on(figure, \"mouseover\", (e) => {\n const mark = markAt(figure, e);\n writeHover(mark ? (mark.getAttribute(\"data-sdv-id\") ?? \"\") : null);\n });\n on(figure, \"mouseleave\", () => writeHover(null));\n } else if (figure && typeof hover === \"object\") {\n // Plot sets `value` on the element it dispatches `input` from (the svg, or the <figure> wrapping it)\n on(figure, \"input\", (e) => {\n const v = (e.target as { value?: unknown } | null)?.value;\n writeHover(v === null || v === undefined ? null : toId(hover.id(v as Datum)));\n });\n }\n if (table) {\n offs.push(\n table.subscribe((e) => {\n if (syncing) return;\n if (e.type === \"hover\") writeHover(e.id);\n else if (e.type === \"select\") store.set({ selected: e.ids });\n }),\n );\n }\n if (figure && toggled.length > 0) offs.push(toggles(figure, store, toggled));\n offs.push(store.subscribe(sync));\n sync(store.getState());\n let live = true;\n return () => {\n if (!live) return; // a second teardown writes and restores nothing\n live = false;\n // before the unsubscribe: this figure, and its table, still follow the store and un-dim too\n if (wrote !== null && wrote.size > 0 && store.getState().hover === wrote) store.set({ hover: [] });\n wrote = null;\n for (const off of offs) off();\n // Unlink and keep: restore the view this link changed, never the store, which the views still linked show. Done\n // after the unsubscribe, so the table's own events now are not written back.\n if (figure) {\n const n = (links.get(figure) ?? 1) - 1;\n if (n > 0) links.set(figure, n);\n else {\n links.delete(figure);\n highlight(figure, null);\n }\n }\n if (table) {\n const s = store.getState();\n if (s.predicate !== null) table.setExternalFilter(null);\n if (s.hover.size > 0) table.setHover(null);\n }\n };\n}\n\n/** `select: \"toggle\"`'s marks, checked before the DOM test so a bad call throws in Node too (A36, A38). */\nfunction toggleMarks(t: { readonly figure?: Element; readonly select?: \"toggle\" }): Element[] {\n if (t.select === undefined) return [];\n if (t.select !== \"toggle\")\n throw new InputError(`linkSelection: select is \"toggle\", not ${JSON.stringify(t.select)}`);\n if (t.figure === undefined)\n throw new InputError('linkSelection: select \"toggle\" needs the figure whose marks it toggles');\n const marks = Array.from(t.figure.querySelectorAll(MARK));\n // closest() matches the element itself: linkIds stamps an <a href> (A38), which a parent-only lookup would miss\n const linked = marks.find((m) => m.closest(\"a[href]\") !== null);\n if (linked)\n throw new InputError(\n `linkSelection: select \"toggle\" would put a checkbox inside a link (the mark \"${linked.getAttribute(\"data-sdv-id\")}\" is in an <a href>); drop one`,\n );\n return marks;\n}\n\n/**\n * Marks as checkboxes over `selected` (blazing-the-nets main, lib/charts/gameStrip.ts:75-110): a click, Enter or Space\n * toggles a mark's id; `aria-checked` follows the store, set only on the marks whose membership changed.\n */\nfunction toggles<Row>(figure: Element, store: SelectionStore<Row>, marks: readonly Element[]): () => void {\n const byId = new Map<string, Element[]>();\n let shown = store.getState().selected;\n const own = marks.map((m) => TOGGLE_ATTRS.map((a) => m.getAttribute(a))); // a d3 mark may have had its own\n for (const m of marks) {\n const id = m.getAttribute(\"data-sdv-id\") ?? \"\";\n const same = byId.get(id);\n if (same) same.push(m);\n else byId.set(id, [m]);\n m.setAttribute(\"role\", \"checkbox\");\n m.setAttribute(\"tabindex\", \"0\");\n m.setAttribute(\"aria-checked\", String(shown.has(id)));\n // a checkbox needs a name: the mark's own (Plot's ariaLabel channel writes aria-label, its title channel a\n // <title> child), else its link id\n if (\n !m.hasAttribute(\"aria-label\") &&\n !m.hasAttribute(\"aria-labelledby\") &&\n !m.querySelector(\":scope > title\")\n )\n m.setAttribute(\"aria-label\", id);\n }\n const flip = (e: Event): void => {\n const id = markAt(figure, e)?.getAttribute(\"data-sdv-id\");\n if (!id) return;\n if (e.type === \"keydown\") {\n const key = (e as KeyboardEvent).key;\n if (key !== \"Enter\" && key !== \" \") return;\n e.preventDefault(); // Space would scroll the page\n }\n const next = new Set(store.getState().selected);\n if (!next.delete(id)) next.add(id);\n store.set({ selected: next });\n };\n const check = (ids: Iterable<string>, unless: ReadonlySet<string>, value: string): void => {\n for (const id of ids)\n if (!unless.has(id)) for (const m of byId.get(id) ?? []) m.setAttribute(\"aria-checked\", value);\n };\n const off = store.subscribe((s) => {\n if (s.selected === shown) return;\n check(shown, s.selected, \"false\");\n check(s.selected, shown, \"true\");\n shown = s.selected;\n });\n figure.addEventListener(\"click\", flip);\n figure.addEventListener(\"keydown\", flip);\n toggling.add(figure);\n return () => {\n toggling.delete(figure);\n off();\n figure.removeEventListener(\"click\", flip);\n figure.removeEventListener(\"keydown\", flip);\n for (const [i, m] of marks.entries())\n for (const [k, a] of TOGGLE_ATTRS.entries()) {\n const v = own[i]?.[k] ?? null;\n if (v === null) m.removeAttribute(a);\n else m.setAttribute(a, v);\n }\n };\n}\n","import { InputError } from \"../errors.js\";\nimport { hasDom } from \"./highlight.js\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n/** Colours are CSS custom properties with fallbacks (A13), so a page's light/dark tokens restyle the box with no JS. */\nconst CSS =\n \".sdv-tip>.sdv-tip-box{fill:var(--sdv-tip-bg,rgba(34,34,34,.85))}.sdv-tip>text{fill:var(--sdv-tip-fg,#ddd)}\" +\n \".sdv-tip>.sdv-tip-swatch{stroke:var(--sdv-tip-fg,#ddd)}\";\n\n/** Options for {@link tooltip}. */\nexport interface TooltipOptions {\n /** The width the box stays inside, in the svg's user units. Default: the svg's viewBox width. */\n readonly width?: number;\n /** The height the box stays inside. Default: the svg's viewBox height. */\n readonly height?: number;\n /** Text size in px; the box is sized from it. Default 11. */\n readonly fontSize?: number;\n}\n/** A live tooltip that {@link tooltip} returns. */\nexport interface TooltipHandle {\n /**\n * Show `lines` (the first bold) beside the point `x`, `y` in the svg's user space, with an optional colour swatch\n * at the right. Placed 12 px right of the point and above it; flipped to its left when it would pass the right\n * edge, and kept inside the top and bottom.\n */\n show(x: number, y: number, lines: readonly string[], swatch?: string): void;\n /** Hide the box; `show` brings it back. */\n hide(): void;\n /** Remove the box. */\n destroy(): void;\n}\n\n/** @internal The svg's user-space box: its viewBox, else its width and height attributes; an unstated side is unbounded. */\nexport function svgBox(svg: Element): { x: number; y: number; width: number; height: number } {\n const [x = Number.NaN, y = Number.NaN, width = Number.NaN, height = Number.NaN] = (\n svg.getAttribute(\"viewBox\") ?? \"\"\n )\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n if ([x, y, width, height].every(Number.isFinite)) return { x, y, width, height };\n const side = (name: string): number => {\n const v = svg.getAttribute(name)?.trim();\n const n = v ? Number(v) : Number.NaN; // \"100%\" and \"\" are not user units\n return Number.isFinite(n) ? n : Number.POSITIVE_INFINITY;\n };\n return { x: 0, y: 0, width: side(\"width\"), height: side(\"height\") };\n}\n/** @internal Interact visuals draw in an `<svg>`'s user space: anything else is an argument error. */\nexport function svgRoot(root: Element, fn: string): Element {\n if (root.namespaceURI !== SVG_NS || root.localName !== \"svg\")\n throw new InputError(`${fn} needs an <svg> root (got <${root.localName}>)`);\n return root;\n}\n\nconst NOOP: TooltipHandle = { show: () => {}, hide: () => {}, destroy: () => {} };\n\n/**\n * An in-SVG tooltip for d3-drawn and other non-Plot figures (a Plot figure uses its own `tip` mark): a rounded box of\n * text lines, the first bold, with an optional 12 px colour swatch, kept inside the svg. It is drawn hidden, with\n * `pointer-events=\"none\"`, and re-appended last on each `show` so it stays above the marks. Its size is ESTIMATED from\n * the text (`0.6 * fontSize` per character, `1.35 * fontSize` per line), never measured, so it renders the same under\n * jsdom and in every browser. Colours: `--sdv-tip-bg` (default `rgba(34,34,34,.85)`) and `--sdv-tip-fg` (default\n * `#ddd`). Throws `InputError` on a non-positive `fontSize` or a negative size, in Node too, and when `root` is not an\n * `<svg>`. Returns a HANDLE (`show`, `hide`, `destroy`), not a teardown function, because it has more to do than tear\n * down. A no-op handle without a DOM: a server render never holds a tooltip.\n *\n * @example\n * ```ts\n * import { loadLeague, teamColorsSync } from \"@sportsdataverse/sdvplot\";\n * import { tooltip } from \"@sportsdataverse/sdvplot/interact\";\n * import * as d3 from \"d3\";\n *\n * await loadLeague(\"nfl\");\n * const red = teamColorsSync(\"nfl\", \"KC\");\n * const svg = d3.create(\"svg\").attr(\"viewBox\", \"0 0 320 120\").attr(\"width\", 320);\n * svg.append(\"circle\").attr(\"cx\", 280).attr(\"cy\", 80).attr(\"r\", 6).attr(\"fill\", red ?? \"currentColor\");\n * // Kansas City's 2024 line, as a chart shows it on hover: no room right of the dot, so the box flips to its left\n * tooltip(svg.node() as SVGSVGElement).show(280, 80, [\"KC 15-2\", \"Net EPA/play 0.063\", \"QB Patrick Mahomes\"], red);\n * svg.node();\n * ```\n */\nexport function tooltip(root: Element, o: TooltipOptions = {}): TooltipHandle {\n const { fontSize = 11 } = o;\n if (!(fontSize > 0)) throw new InputError(`tooltip: fontSize must be a number > 0 (got ${fontSize})`);\n for (const [k, v] of [\n [\"width\", o.width],\n [\"height\", o.height],\n ] as const)\n if (v !== undefined && !(v >= 0)) throw new InputError(`tooltip: ${k} must be a number >= 0 (got ${v})`);\n if (!hasDom()) return NOOP;\n const svg = svgRoot(root, \"tooltip\");\n const el = (name: string, attrs: Readonly<Record<string, string | number>>): Element => {\n const e = svg.ownerDocument.createElementNS(SVG_NS, name);\n for (const [k, v] of Object.entries(attrs)) e.setAttribute(k, String(v));\n return e;\n };\n if (!svg.querySelector(':scope > style[data-sdv-interact=\"tip\"]')) {\n const style = el(\"style\", { \"data-sdv-interact\": \"tip\" });\n style.textContent = CSS;\n svg.append(style);\n }\n const box = el(\"rect\", { class: \"sdv-tip-box\", rx: 4 });\n const text = el(\"text\", { \"font-size\": fontSize });\n const swatch = el(\"rect\", { class: \"sdv-tip-swatch\", width: 12, height: 12, rx: 2 });\n const g = el(\"g\", { class: \"sdv-tip\", \"pointer-events\": \"none\", display: \"none\" });\n g.append(box, text);\n svg.append(g);\n return {\n show(x, y, lines, color) {\n const b = svgBox(svg);\n const w = Math.ceil(\n 16 + 0.6 * fontSize * Math.max(0, ...lines.map((l) => l.length)) + (color ? 20 : 0),\n );\n const h = Math.ceil(10 + 1.35 * fontSize * lines.length);\n text.replaceChildren(\n ...lines.map((line, i) => {\n const t = el(\"tspan\", { x: 8, dy: i === 0 ? \"1.3em\" : \"1.35em\" });\n if (i === 0) t.setAttribute(\"font-weight\", \"bold\");\n t.textContent = line;\n return t;\n }),\n );\n box.setAttribute(\"width\", String(w));\n box.setAttribute(\"height\", String(h));\n if (color) {\n swatch.setAttribute(\"fill\", color);\n swatch.setAttribute(\"x\", String(w - 20));\n swatch.setAttribute(\"y\", String((h - 12) / 2));\n g.append(swatch);\n } else swatch.remove();\n const right = b.x + (o.width ?? b.width);\n const bottom = b.y + (o.height ?? b.height);\n const tx = Math.max(b.x, x + 12 + w > right ? x - 12 - w : x + 12);\n const ty = Math.min(Math.max(b.y, y - h - 8), bottom - h);\n g.setAttribute(\"transform\", `translate(${tx},${ty})`);\n g.removeAttribute(\"display\");\n if (svg.lastElementChild !== g) svg.append(g); // above anything drawn after the tooltip was created\n },\n hide() {\n g.setAttribute(\"display\", \"none\");\n },\n destroy() {\n g.remove();\n },\n };\n}\n","import { Delaunay, bisector, pointer } from \"d3\";\nimport { InputError } from \"../errors.js\";\nimport type { SelectionStore } from \"../selection.js\";\nimport { hasDom } from \"./highlight.js\";\nimport { svgBox, svgRoot, tooltip } from \"./tooltip.js\";\n\n/** A hover target: a mark's centre in PIXELS, in the svg's user space (where its scales put it), and its link id. */\nexport interface HoverPoint {\n /** Horizontal position, svg user units. */\n readonly x: number;\n /** Vertical position, svg user units. */\n readonly y: number;\n /** The link id the mark is stamped with (`data-sdv-id`). */\n readonly id: string;\n}\n/** Options for {@link nearestHover}. */\nexport interface NearestHoverOptions {\n /** Every hoverable mark's centre. Points with a non-finite coordinate are skipped. */\n readonly points: readonly HoverPoint[];\n /** `\"xy\"` (the default): nearest in the plane. `\"x\"` / `\"y\"`: nearest along that axis alone, ignoring the other. */\n readonly dimension?: \"x\" | \"y\" | \"xy\";\n /** Farthest hover, in px: Euclidean for `\"xy\"`, along the axis for `\"x\"` / `\"y\"`. Default: unlimited. */\n readonly radius?: number;\n /** A margin inside the svg's bounds, in px, where the pointer hovers nothing. Default 0. */\n readonly padding?: number;\n /** The tooltip for a hovered id, shown at its point; `null` shows none. Default: no tooltip. */\n readonly label?: (id: string) => { readonly lines: readonly string[]; readonly swatch?: string } | null;\n}\n/** A live {@link nearestHover}. */\nexport interface NearestHoverHandle {\n /** Re-target after a zoom or a resize: the marks' new centres. */\n update(points: readonly HoverPoint[]): void;\n /** Remove the listeners and the tooltip; clears `hover` when it still holds what this handle wrote. */\n destroy(): void;\n}\n\nconst NOOP: NearestHoverHandle = { update: () => {}, destroy: () => {} };\nconst DIMENSIONS: readonly unknown[] = [\"x\", \"y\", \"xy\"];\n\n/**\n * Hover the NEAREST mark of a d3-drawn (or any non-Plot) figure, within a radius, rather than the element under the\n * pointer: sparse or small marks stay easy to hit. `\"xy\"` finds it with a Delaunay triangulation (`Delaunay.find`,\n * as blazing-the-nets' hex chart does within 18 px); `\"x\"` / `\"y\"` bisect the points sorted along that axis (a 1-D\n * Voronoi, as its distance bars do). The pointer writes `hover: [id]`, once per distinct mark; beyond `radius`, inside\n * the `padding` margin, on `pointerleave` / `pointercancel` or with no points, it writes `hover: []`. `label` shows a\n * {@link tooltip} at the mark, not at the pointer. Link the same figure with `hover: false` in `linkSelection` so\n * this is its only hover writer while `highlight` still follows the store. The pointer listeners capture,\n * so a handler registered earlier on the svg that stops the event (Plot's `tip` on `pointerdown`) cannot hide it.\n * A Plot figure hovers through its own `tip` instead (`linkSelection`'s `hover: { id }`). Throws `InputError` on a\n * negative `radius` or `padding` or an unknown `dimension`, in Node too, and when `root` is not an `<svg>`. Returns a\n * HANDLE, not a teardown function, because it has more to do than tear down: `update` re-targets it and `destroy`\n * removes it (`linkSelection` and `linkCursor`, whose teardown is all they have, return a function). A no-op handle\n * without a DOM.\n *\n * @example\n * ```ts\n * import { createSelection } from \"@sportsdataverse/sdvplot\";\n * import { linkSelection, nearestHover } from \"@sportsdataverse/sdvplot/interact\";\n * import * as d3 from \"d3\";\n *\n * const rows = [\n * { team: \"KC\", wins: 15, net_epa: 0.063 },\n * { team: \"BUF\", wins: 13, net_epa: 0.19 },\n * { team: \"MIA\", wins: 8, net_epa: -0.019 },\n * { team: \"LV\", wins: 4, net_epa: -0.146 },\n * ];\n * const x = d3.scaleLinear([0, 17], [30, 410]);\n * const y = d3.scaleLinear([-0.2, 0.2], [190, 10]);\n * const svg = d3.create(\"svg\").attr(\"viewBox\", \"0 0 440 200\").attr(\"width\", 440);\n * svg\n * .selectAll(\"circle\")\n * .data(rows)\n * .join(\"circle\")\n * .attr(\"data-sdv-id\", (d) => d.team) // the d3 way to stamp link ids\n * .attr(\"cx\", (d) => x(d.wins))\n * .attr(\"cy\", (d) => y(d.net_epa))\n * .attr(\"r\", 5)\n * .attr(\"fill\", \"currentColor\");\n * const node = svg.node() as SVGSVGElement;\n * const store = createSelection();\n * linkSelection(store, { figure: node, hover: false }); // highlight follows the store; nearestHover writes hover\n * nearestHover(node, store, {\n * points: rows.map((d) => ({ x: x(d.wins), y: y(d.net_epa), id: d.team })),\n * radius: 18,\n * label: (team) => ({ lines: [team, `net EPA/play ${rows.find((d) => d.team === team)?.net_epa}`] }),\n * });\n * node; // hover near a dot: within 18 px it lights and its tooltip shows\n * ```\n */\nexport function nearestHover<R>(\n root: Element,\n store: SelectionStore<R>,\n o: NearestHoverOptions,\n): NearestHoverHandle {\n const { dimension = \"xy\", radius = Number.POSITIVE_INFINITY, padding = 0, label } = o;\n if (!DIMENSIONS.includes(dimension))\n throw new InputError(`nearestHover: dimension must be \"x\", \"y\" or \"xy\" (got ${String(dimension)})`);\n if (!(radius >= 0)) throw new InputError(`nearestHover: radius must be a number >= 0 (got ${radius})`);\n if (!(padding >= 0)) throw new InputError(`nearestHover: padding must be a number >= 0 (got ${padding})`);\n if (!hasDom()) return NOOP;\n const svg = svgRoot(root, \"nearestHover\");\n const tip = label ? tooltip(svg) : null;\n const far = (p: HoverPoint, px: number, py: number): number =>\n dimension === \"x\"\n ? Math.abs(p.x - px)\n : dimension === \"y\"\n ? Math.abs(p.y - py)\n : Math.hypot(p.x - px, p.y - py);\n let find: (px: number, py: number) => HoverPoint | undefined = () => undefined;\n const index = (points: readonly HoverPoint[]): void => {\n const ps = points.filter((p) => Number.isFinite(p.x) && Number.isFinite(p.y));\n if (ps.length === 0) find = () => undefined;\n else if (dimension === \"xy\") {\n const d = Delaunay.from(\n ps,\n (p) => p.x,\n (p) => p.y,\n );\n find = (px, py) => ps[d.find(px, py)];\n } else {\n const k = dimension;\n const sorted = ps.slice().sort((a, b) => a[k] - b[k]);\n const b = bisector<HoverPoint, number>((p) => p[k]);\n find = (px, py) => sorted[b.center(sorted, k === \"x\" ? px : py)];\n }\n };\n index(o.points);\n let cur: string | null | undefined; // the id last shown; undefined: unknown, so the next event writes and re-places\n let wrote: ReadonlySet<string> | null = null; // the store's hover set this handle wrote; destroy clears it\n const to = (p: HoverPoint | undefined): void => {\n const id = p === undefined ? null : p.id;\n // the same mark as last time: silent while the store still holds this handle's hover (another view may have hovered\n // something since, and the latest pointer event wins); off every mark, never re-clear another writer's hover\n if (id === cur && (id === null || store.getState().hover === wrote)) return;\n cur = id;\n const had = store.getState().hover;\n store.set({ hover: id === null ? [] : [id] });\n const now = store.getState().hover;\n // owned by identity: an equal hover set first elsewhere keeps its identity (a no-op patch), so it stays theirs\n wrote = now !== had || had === wrote ? now : null;\n const shown = p !== undefined && label ? label(p.id) : null;\n if (shown && p) tip?.show(p.x, p.y, shown.lines, shown.swatch);\n else tip?.hide();\n };\n const move = (e: Event): void => {\n const [px, py] = pointer(e, svg);\n const b = svgBox(svg);\n const inside =\n px >= b.x + padding &&\n px <= b.x + b.width - padding &&\n py >= b.y + padding &&\n py <= b.y + b.height - padding;\n const p = inside ? find(px, py) : undefined;\n to(p !== undefined && far(p, px, py) <= radius ? p : undefined);\n };\n const leave = (): void => to(undefined);\n // A34: capture, so a listener registered on the svg before ours (Plot's sticky-tip pointerdown) cannot stop it\n const listeners: readonly (readonly [string, (e: Event) => void, boolean])[] = [\n [\"pointermove\", move, true],\n [\"pointerdown\", move, true],\n [\"pointerleave\", leave, false],\n [\"pointercancel\", leave, false],\n ];\n for (const [type, fn, capture] of listeners) svg.addEventListener(type, fn, { capture });\n return {\n update(points) {\n index(points);\n cur = undefined; // the same id may now sit elsewhere: the next event re-places the tooltip\n },\n destroy() {\n for (const [type, fn, capture] of listeners) svg.removeEventListener(type, fn, { capture });\n tip?.destroy();\n if (wrote !== null && wrote.size > 0 && store.getState().hover === wrote) store.set({ hover: [] });\n cur = undefined;\n wrote = null;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { R as ResolveOptions, V as Value } from './resolve-CQW-jzvr.js';
|
|
2
|
+
import { W as Which, L as League, S as SeasonInput, V as Variant, M as MarkType, I as IdSystem, a as MarkRow } from './types-C7n6gJF3.js';
|
|
3
|
+
|
|
4
|
+
interface ColorOptions extends ResolveOptions {
|
|
5
|
+
which?: Which;
|
|
6
|
+
}
|
|
7
|
+
type ColorResult<T> = T extends readonly Value[] ? (string | undefined)[] : string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* `{team: "#hex"}` for a league. Without `teams`: keyed by abbr, or team_id where abbr is null/shared (one warning).
|
|
10
|
+
* With `teams`: keyed by the caller's own values; first team wins on a reused value.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { palette } from "@sportsdataverse/sdvplot";
|
|
15
|
+
*
|
|
16
|
+
* await palette("nfl", ["KC", "BUF", "PHI"]);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare function palette(league: League, teams?: Value | readonly Value[], opts?: ColorOptions): Promise<Record<string, string>>;
|
|
20
|
+
/** One `#hex` (or undefined) per team value, in the container the values came in. Call after the league is loaded. */
|
|
21
|
+
declare function teamColorsSync<T extends Value | readonly Value[]>(league: League, teams: T, opts?: ColorOptions): ColorResult<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Team colour(s), loading the league first: one team gives one `#hex` (or `undefined`), an array gives one per team.
|
|
24
|
+
* `which: "secondary"` picks the second colour; an unknown team gives `undefined` and one warning.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { teamColors } from "@sportsdataverse/sdvplot";
|
|
29
|
+
*
|
|
30
|
+
* await teamColors("nba", ["LAL", "BOS"], { which: "secondary" });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function teamColors<T extends Value | readonly Value[]>(league: League, teams: T, opts?: ColorOptions): Promise<ColorResult<T>>;
|
|
34
|
+
|
|
35
|
+
interface SelectOptions {
|
|
36
|
+
season?: SeasonInput;
|
|
37
|
+
variant?: Variant;
|
|
38
|
+
markType?: MarkType;
|
|
39
|
+
}
|
|
40
|
+
interface LogoUrlOptions extends SelectOptions {
|
|
41
|
+
idSystem?: IdSystem;
|
|
42
|
+
strict?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Port of `select_mark` (post-preload): requested variant, then (keeping polarity) default / polarity variants, then any; within each, season-covering rows (dated before open-ended), else the best row. Rows are already ranked best-first. */
|
|
45
|
+
declare function selectMarkSync(team: Value, league: League, o?: SelectOptions): MarkRow | undefined;
|
|
46
|
+
declare function selectMark(team: Value, league: League, o?: SelectOptions): Promise<MarkRow | undefined>;
|
|
47
|
+
/** Port of `logo_url` (post-preload): archive URL of the team's logo/wordmark for the season; `undefined` for an unknown team (the resolver warns) or when no mark of that type exists (one warning). */
|
|
48
|
+
declare function logoUrlSync(team: Value, league: League, o?: LogoUrlOptions): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Archive URL of a team's logo (or wordmark, `markType`) for the season, loading the league first; `undefined` for an
|
|
51
|
+
* unknown team (the resolver warns) or when no mark of that type is archived (one warning).
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { logoUrl } from "@sportsdataverse/sdvplot";
|
|
56
|
+
*
|
|
57
|
+
* await logoUrl("KC", "nfl", { markType: "wordmark" });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function logoUrl(team: Value, league: League, o?: LogoUrlOptions): Promise<string | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Every archived mark for one team, best first (logos and wordmarks, every variant and source).
|
|
63
|
+
* Default: the committed shard (deduped, ranked rows). `full: true` fetches the CDN manifest lazily (once per process)
|
|
64
|
+
* and returns every manifest row for the team, including rows the shard dedupe dropped; a failed download throws
|
|
65
|
+
* `DownloadError`. Both paths filter on the team only. `fetch` overrides the global fetch for the manifest download.
|
|
66
|
+
* Throws `UnresolvedTeamError` when the team is null or does not resolve (strict, as Python).
|
|
67
|
+
*/
|
|
68
|
+
declare function marks(team: Value, league: League, o?: {
|
|
69
|
+
season?: SeasonInput;
|
|
70
|
+
idSystem?: IdSystem;
|
|
71
|
+
full?: boolean;
|
|
72
|
+
fetch?: typeof fetch;
|
|
73
|
+
}): Promise<readonly MarkRow[]>;
|
|
74
|
+
|
|
75
|
+
export { type ColorOptions as C, type LogoUrlOptions as L, type SelectOptions as S, type ColorResult as a, logoUrlSync as b, selectMarkSync as c, teamColorsSync as d, logoUrl as l, marks as m, palette as p, selectMark as s, teamColors as t };
|