/** * @file item.ts * @brief Material, visibility and pressed state shared by shapes and groups. */ import { type Scheme } from "../layout.js"; import type { Rgba } from "../material.js"; import type { Renderer } from "../renderer/renderer.js"; import type { Glass } from "./glass.js"; import type { Appearance, Foreground, MaterialOptions, Preset, ShownScheme, Transition } from "./types.js"; /** @brief Material, tint, opacity, visibility and press state shared by shapes and groups. */ export declare abstract class GlassItem { /** @brief The glass this belongs to. */ readonly glass: Glass; protected readonly renderer: Renderer; protected id: number; protected preset: Preset; protected appearance: Appearance | null; protected tint: Rgba | null; protected opacity: number; protected chromatic: number | null; protected visible: boolean; protected pressed: boolean; protected transition: Transition; protected adaptive: boolean; protected onScheme: ((scheme: ShownScheme) => void) | null; protected removed: boolean; protected shown: number; /** * @brief Why the last update that named a material or a mask had one rejected ("" when it was * accepted). * @details A rejected field is left out; the other fields of the same update still apply. */ error: string; /** * @brief Handle of the shape in the renderer, for the low-level calls. * @details It is dead once this is removed. */ get handle(): number; /** @brief False once removed (or while the removal is fading out). */ get alive(): boolean; /** * @brief The scheme the glass shows now: that of its surroundings, or for small adaptive glass * the one it took from the backdrop under it (light over a bright backdrop). * @details Content on the glass should follow it. */ get shownScheme(): ShownScheme; /** * @brief Colors for content on this glass: near-white on dark glass, near-black on light glass. * @details Elements the glass follows get them as the custom properties `--glass-foreground` * and `--glass-title`. */ get foreground(): Foreground; /** @brief Effective color-separation multiplier, including the inherited canvas default. */ get chromaticAberration(): number; /** @brief Show the glass (with the transition of this item). */ show(): this; /** * @brief Hide the glass (with the transition of this item); it keeps its place and can be shown * again. */ hide(): this; /** @brief Set the press veil. */ press(down: boolean): this; /** @brief Remove the glass; with the "materialize" transition it fades out first. */ remove(): void; protected abstract paint(): void; protected current(): Scheme; protected setVisible(v: boolean): this; protected takeMaterial(u: Partial, rejected?: string, named?: boolean): boolean; protected applyMaterial(): void; protected applyTint(): void; protected applyVeil(): void; protected start(): void; }