/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The theme bridge for the Canvas2D schematic (#1387, "The canvas's theme and * styles"). The canvas can't read Chakra's CSS custom properties, so it reads * what the recipe resolves: hidden elements in the `schematic` recipe's * `probe` slot, each named by a data attribute, never styled inline — * * - **its own marks' colours**, a role each (`data-role`), each a design-system * token: `brandMark`, `brand.solid`, `brandTint`, `fg` … `fg.faint`, * `bg.surface`, `bg.canvas`, `border.subtle`, `border.strong`, `status.*`, * the placeholders' fill `bg.subtle` (#1398) and the heat ramp a density's * steps draw in, `heat.1` … `heat.5` — never a raw palette step, never a * Chakra default; * - **its fonts** (`data-font`): its labels' and its eyebrows', the design * system's mono face (`fonts.mono`); * - **each entity's colour** (`data-tint`), through the chain an item's card * dot resolves its own by (`tints.ts`), so the canvas and the cards draw one * colour in each mode, and a value naming no theme colour token draws its * tone (D14, SC26); * - **the links' look** (#1403): the shared links part's own elements * (`linkRibbons`), as the Plan's links layer draws them — the casing's paper, * the muted ink and the strong ink, the ring, the knockout and a selected * one's outline, the caption's ink and font, a drag's new line and a moved * link's `was` line with their widths — so a change to the part changes the * Plan's, the Allocation's and the Schematic's links together. * * A colour is read as the page computes it and converted to RGB on a 1×1 * canvas, which takes every colour the page can compute (`oklch()`, a * `color-mix()`'s result); with no canvas — jsdom — an `rgb()` is parsed. The * canvas reads again when the colours its drawing names change, or the * document's theme does. * * @packageDocumentation */ import { type Ref } from "react"; import type { RGB, SchematicPalette } from "./paint"; import { type SchematicTint } from "./tints"; /** The palette's colour roles, each named after the token the probe resolves it from. */ export declare const PALETTE_ROLES: readonly ["brandMark", "brandSolid", "brandTint", "fg", "fgStrong", "fgMuted", "fgSubtle", "fgFaint", "bgSurface", "bgCanvas", "borderSubtle", "borderStrong", "statusPos", "statusNeg", "statusWarn", "statusInfo", "bgSubtle", "heat1", "heat2", "heat3", "heat4", "heat5"]; /** Props of {@link SchematicProbe}. */ export interface SchematicProbeProps { /** Every colour the drawing names, by its key (`tintsOf`). */ readonly tints: ReadonlyMap; /** The colours' keys, in order (`tintsOf`'s signature): the probe draws again only when it moves. */ readonly signature: string; /** The probe's element: what {@link readPalette} reads. */ readonly probeRef: Ref; } /** * The probe: hidden, in the recipe's `probe` slot, one element per palette * role, per font and per colour the drawing names (see the module docs). It * draws again only when the colours named do — a drawing that moves and names * the same colours probes nothing new. * * @param props - The colours, their signature, and where the probe's element goes * @returns The probe */ export declare const SchematicProbe: import("react").MemoExoticComponent<({ tints, probeRef }: SchematicProbeProps) => import("react/jsx-runtime").JSX.Element>; /** What the probe reads: the palette, and each colour the drawing names, by its key. */ export interface ProbeReading { /** The canvas's own colours and fonts. */ readonly palette: SchematicPalette; /** Each colour the drawing names, by its key. */ readonly tints: ReadonlyMap; } /** * Reads the probe (see the module docs). * * @param probe - The probe's element, its children committed * @returns The palette and the drawing's colours */ export declare function readPalette(probe: HTMLElement): ProbeReading; /** * The document's theme's version: it moves when the document root's class, * `data-theme` or style does — a light/dark switch — so the canvas reads its * palette again. * * @returns The version */ export declare function useThemeVersion(): number; //# sourceMappingURL=theme.d.ts.map