packages/core/src/features/viz/lib/use-linear-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 { ResolvedLinearScale, ResolvedScale, ScaleId } from "./types.js";
3 import { scaleView } from "./scale-view.js";
4 const views = new WeakMap<Signal<ResolvedScale>, Signal<ResolvedLinearScale>>();
5 /**
6 * Reads an ancestor linear scale as a stable, shared readonly signal.
7 * @param id - Ancestor scale identity. See {@link ScaleId}.
8 * @returns The reactive mapping. See {@link ResolvedLinearScale} and {@link Signal}.
9 */
10 export function useLinearScale(id: ScaleId): Signal<ResolvedLinearScale> {
11 return scaleView(views, id, "useLinearScale", (kind) => kind === "linear");
12 }
13
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.