packages/core/src/features/viz/lib/use-bar-scale.ts
This is the source snapshot used to build these API details. View this revision on GitHub.
1 import type { Signal } from "@pibbl/core";
2 import type { ResolvedBandScale, ResolvedScale, ScaleId } from "./types.js";
3 import { scaleView } from "./scale-view.js";
4 const views = new WeakMap<Signal<ResolvedScale>, Signal<ResolvedBandScale>>();
5 /**
6 * Reads an ancestor band scale as a stable, shared readonly signal.
7 * @param id - Ancestor scale identity. See {@link ScaleId}.
8 * @returns The reactive mapping. See {@link ResolvedBandScale} and {@link Signal}.
9 */
10 export function useBarScale(id: ScaleId): Signal<ResolvedBandScale> {
11 return scaleView(views, id, "useBarScale", (kind) => kind === "band");
12 }
13
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.