/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Which of a ruler's labels draw, measured as the page lays them out (#1269) — * the desktop ruler's (`Ruler.tsx`) and the narrow layout's * (`narrow/chrome.tsx`). While it measures, every label draws whole, centred * on its column; `thinTicks` then decides from the labels as they drew which * draw and where. It measures before the browser paints — when the ruler * mounts, when its buckets change, when its track's width changes (in the * ResizeObserver's delivery) and when fonts arrive — so no frame shows a label * it does not rest on. A track with no width yet (a ruler not laid out) draws * every label. * * @packageDocumentation */ import { type RefObject } from "react"; import type { Scale, ScaleBucket } from "./scale.js"; /** The geometry and vocabulary a ruler needs, independent of its host. */ export type RulerScale = Pick, "kind" | "resolution" | "buckets" | "toNumber">; import { type RulerFit } from "./ruler-thin.js"; /** The room between two drawn labels, in px: with a bucket line between them, two labels read apart (#1269). */ export declare const RULER_GAP = 4; /** * Whether a bucket starts a period one up from the scale's resolution (#1269): * a Monday under days, a month's first week under weeks, January under months * or quarters, midnight under hours. A number or ordinal axis, or years, has * none. * * @param scale - The scale * @param b - The bucket * @returns Whether its column's label always draws */ export declare function startsPeriod(scale: RulerScale, b: ScaleBucket): boolean; /** * What a ruler draws of its labels — see the module docs. * * @param trackRef - The ruler's track: one tick per bucket, in order, each holding its label as a `[data-tick-label]` * @param scale - The scale the ticks are the buckets of * @param prefer - The bucket (its `index`) whose label draws wherever it clears every period's first column drawn: the * narrow ruler's now bucket * @returns Which labels draw and where each sits; `undefined` while the ruler measures, or while its track has no * width, when every label draws, centred */ export declare function useRulerFit(trackRef: RefObject, scale: RulerScale, prefer?: number, enabled?: boolean): RulerFit | undefined; //# sourceMappingURL=use-ruler-fit.d.ts.map