import { ComputedRef, MaybeRefOrGetter } from '../../node_modules/vue'; /** * A single legend entry. Mirrors the `Datum` shape consumed by the * `LegendOrdinal` component. */ export interface LegendMarkerDatum { id?: string | number; color: string; path?: string; label: string; } /** * Resolves the SVG path for a marker, either a constant path string or a * per-datum path function. */ export type MarkerPath = string | ((d: LegendMarkerDatum) => string); /** * Reactive API returned by {@link useLegendMarker}. */ export interface UseLegendMarker { /** * SVG `viewBox` string sized to the default marker path, measured by * rendering it once off-screen. */ markerViewbox: ComputedRef; /** * Resolves the marker path for a given datum. When `markerPath` is a * function it is only applied if a datum is provided; otherwise the constant * path string is returned. * * @param d - The datum to resolve the path for, when `markerPath` is a function. * @returns The SVG path data string. */ markerPathFunction: (d?: LegendMarkerDatum) => string; } /** * Owns the marker geometry derivation of the `LegendOrdinal` component: it * resolves the per-datum SVG path and measures the default marker to build the * shared `viewBox`. The measurement renders an off-screen SVG to read the * marker bounding box, so it depends on a DOM being available. * * @param markerPath - The marker path, as a constant string or a per-datum * function (see {@link MarkerPath}), accepted as a plain value, ref or getter. * @returns The {@link UseLegendMarker} API: the shared `markerViewbox` and the * `markerPathFunction` resolver. * @example * // Internal building block of the `LegendOrdinal` component; not exported * // from the package root. Inside a `