/** * Photo and feature age as fixed steps from a time, e.g. "older than 4 years", "2–4 years", * "newer than 2 years". The default is the TILDA palette with 4 and 2 years; both the thresholds * (years, or exact times for a project that needs them) and the colors are options. * * Use `ageBand*` (`ageBands.ts`) instead when the steps should follow a "from" filter. */ /** Photos older than this are not useful for most mapping; hosts can hide them by default. */ export declare const MAX_USEFUL_AGE_YEARS = 4; /** TILDA age palette: green, yellow, orange; grey for no date. */ export declare const AGE_STEP_COLORS: { readonly current: '#05CB63'; readonly mid: '#FFC01B'; readonly old: '#F77E5E'; readonly unknown: '#9ca3af'; }; /** Time (ms) `years` calendar years before `now` (UTC). */ export declare const yearsAgoMs: (years: number, now?: number) => number; export type AgeStep = { id: string; color: string; /** Captured at or after this time (ms); `null`: no lower bound. */ from: number | null; /** Captured before this time (ms); `null`: no upper bound. */ to: number | null; }; export type AgeStepsOptions = { /** Reference time. Default: now. Keep it fixed for the page's lifetime so paint stays stable. */ now?: number; /** Years back where each step after the oldest starts, oldest first. Default `[4, 2]`. */ years?: readonly number[]; /** Exact times (ms) where each step after the oldest starts, oldest first; wins over `years`. */ starts?: readonly number[]; /** One color per step, oldest first. Default orange, yellow, green. */ colors?: readonly string[]; /** One id per step, oldest first. Default `old`, `mid`, `current` (for the default three). */ ids?: readonly string[]; }; /** * The steps from oldest to newest. N start times give N + 1 steps: the oldest has no lower bound, * the newest no upper bound. */ export declare const createAgeSteps: ({ now, years, starts, colors, ids, }?: AgeStepsOptions) => AgeStep[]; /** Step of a capture time (ms); `null` for photos without a date. */ export declare const ageStepOf: (steps: readonly AgeStep[], capturedAt: number | null | undefined) => AgeStep | null; /** Number of items per step id; `unknown` counts the ones without a date. */ export declare const countByAgeStep: (items: readonly T[], capturedAt: (item: T) => number | null | undefined, steps: readonly AgeStep[]) => Record; /** * MapLibre color expression by the feature's time property (ms): `capturedAt` for photos, * `lastSeenAt` for map features. Without a value: `unknownColor`. */ export declare const ageStepColorExpression: (steps: readonly AgeStep[], { property, unknownColor }?: { property?: string | undefined; unknownColor?: "#9ca3af" | undefined; }) => unknown[]; /** MapLibre boolean expression: the feature's time property is in the step (for legend counts). */ export declare const ageStepMatchExpression: (step: AgeStep, property?: string) => unknown[];