/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The Record's clock (`Record - DX Proposal.md` §2.3, C7): the instant its * age cells count to — the browser's, read as the Record mounts and again at * each whole minute — and an age column's count of a row's moment against * it: its hours to the instant, its days and weeks to the viewer's own day. * Every part that counts reads the one instant, so a day that turns over * where the viewer is moves the age cells, their stale dots, the footer's * count, the inspector's facts and the cells from data, read at its day * (#1559), together. * * @packageDocumentation */ import { type ReactNode } from "react"; import type { SheetColumnMeta } from "../sheet/model.js"; import type { SheetCellValue } from "../sheet/values.js"; /** * Provides the Record's clock to the parts under it, and its day to the sheet's. As it moves, only the parts that read * it draw again — the sheet's, only as the day turns. * * @param props - The parts under it * @returns The provider */ export declare function RecordClock({ children }: { children: ReactNode; }): import("react/jsx-runtime").JSX.Element; /** * Reads the instant the Record counts to; a part outside a {@link RecordClock} is a mistake of the frame's, and throws. * * @returns Now, as the Record's clock last read it */ export declare function useRecordNow(): Date; /** An age column's count at a row: the hours since the row's moment, or the days or weeks since its date, against the column's threshold. */ export interface RecordAge { /** Whole units since the moment. */ n: bigint; /** What one counts. */ unit: "hours" | "days" | "weeks"; /** At or past this many, the row is stale. */ threshold: bigint | undefined; /** Whether the count has reached the threshold. */ stale: boolean; } /** * An age column's count at a row — its `elapsed`, from the row's moment: its hours to now, its days and weeks to the * viewer's own day ({@link sheetDayOf}), so they turn over at the viewer's midnight, as the columns read at the day do. * * @param meta - The column * @param cell - The row's moment: a DateTime, else none * @param now - The Record's now * @returns The count; `undefined` for a column that counts nothing, a row with no moment, or an `elapsed` that fails */ export declare function ageOf(meta: SheetColumnMeta, cell: SheetCellValue | undefined, now: Date): RecordAge | undefined; //# sourceMappingURL=clock.d.ts.map