| 1 | "use client" |
| 2 | |
| 3 | import { createContext, use } from "react" |
| 4 | import type { Seed |
| 5 | |
| 6 | export type SeriesContextValue |
| 7 | dataKey: string |
| 8 | seed: Seed |
| 9 | dimmed: boolean |
| 10 | } |
| 11 | |
| 12 | export const SeriesContext = |
| 13 | |
| 14 | /** Boundary guard for series-scoped markers (`<Dot>`, `<ActiveDot>`). */ |
| 15 | export function useSeries(part |
| 16 | const ctx = |
| 17 | if (!ctx) |
| 18 | throw new Error( |
| 19 | `<${part} /> must be rendered inside a series (e.g. <Area />).` |
| 20 | ) |
| 21 | } |
| 22 | return ctx |
| 23 | } |