/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The viewer's layer choices (#1389, `Schematic Builder Spec.md` §8, SC27): * what the library's Layers tab shows, hides, isolates and locks, held in the * UI store under the Schematic's `id` (`schematicKeys(id).layers`) as an East * value — as the tools are (`tools.ts`) — so a remount keeps them and two * Schematics of one `id` share them. They are view settings, like the Plan's * Series and the Sheet's Columns: they write no record. * * Each layer's author defaults — its `visible` and `locked` — stand until the * viewer overrides them: * * - **Show or Hide** flips the layer as it shows now, isolation counted, and * ends an isolation; * - **Isolate** shows that layer alone — an entity on no layer, or on a key no * layer has, still shows — and Isolate again ends it; * - **Lock** flips whether the layer's entities select; * - **Show all** shows every layer, the ones its author hides at first among * them, and ends an isolation; the locks stay as they are. * * The pure functions here turn the choices into the layers the drawing obeys * (`layersInForce`, which `canvas/layers.ts`' `layerState` reads), and each * toggle into the next choices. * * @packageDocumentation */ import { BooleanType, DictType, OptionType, StringType, StructType, type ValueTypeOf } from "@elaraai/east"; import type { SchematicLayerValue } from "./canvas/layers.js"; /** * The viewer's layer choices, as the UI store holds them. * * @property shown - Each layer the viewer showed or hid, by its key: over its author's `visible` * @property locked - Each layer the viewer locked or unlocked, by its key: over its author's `locked` * @property isolated - The layer shown alone; `none` while none is */ export declare const SchematicLayerViewType: StructType<{ readonly shown: DictType; readonly locked: DictType; readonly isolated: OptionType; }>; /** The viewer's layer choices, decoded. */ export type SchematicLayerView = ValueTypeOf; /** No choice yet: every layer as its author has it. */ export declare const NO_LAYER_VIEW: SchematicLayerView; /** * Whether a layer shows now: the isolated one alone while one is, else the * viewer's choice, else its author's default — shown unless it says otherwise. * * @param layer - The layer * @param view - The viewer's choices * @returns Whether it shows */ export declare function layerShown(layer: SchematicLayerValue, view: SchematicLayerView): boolean; /** * Whether a layer is locked now: the viewer's choice, else its author's * default — unlocked unless it says otherwise. * * @param layer - The layer * @param view - The viewer's choices * @returns Whether its entities never select */ export declare function layerLocked(layer: SchematicLayerValue, view: SchematicLayerView): boolean; /** * The layers as the drawing obeys them: each one's `visible` and `locked` the * viewer's choices over its author's defaults (see the module docs). * * @param layers - The layers, in their order * @param view - The viewer's choices * @returns The layers, each as it shows and locks now; the layers themselves while the viewer has chosen nothing */ export declare function layersInForce(layers: readonly SchematicLayerValue[], view: SchematicLayerView): readonly SchematicLayerValue[]; /** * Show or Hide: the layer flipped as it shows now, isolation counted, and the * isolation ended. * * @param layers - The layers * @param view - The viewer's choices * @param key - The layer's key * @returns The choices after it */ export declare function toggleShown(layers: readonly SchematicLayerValue[], view: SchematicLayerView, key: string): SchematicLayerView; /** * Lock or unlock a layer, as it is locked now. * * @param layers - The layers * @param view - The viewer's choices * @param key - The layer's key * @returns The choices after it */ export declare function toggleLocked(layers: readonly SchematicLayerValue[], view: SchematicLayerView, key: string): SchematicLayerView; /** * Isolate a layer, or end its isolation. * * @param view - The viewer's choices * @param key - The layer's key * @returns The choices after it */ export declare function toggleIsolated(view: SchematicLayerView, key: string): SchematicLayerView; /** * Show all: every layer shown, the ones its author hides at first among them, * the isolation ended and the locks kept. * * @param layers - The layers * @param view - The viewer's choices * @returns The choices after it */ export declare function showAll(layers: readonly SchematicLayerValue[], view: SchematicLayerView): SchematicLayerView; /** * Whether any layer is hidden now, isolation counted: what offers Show all. * * @param layers - The layers * @param view - The viewer's choices * @returns Whether one is */ export declare function anyHidden(layers: readonly SchematicLayerValue[], view: SchematicLayerView): boolean; /** * The viewer's layer choices under a key, and the write that changes them — * every Schematic under that key follows it (see the module docs). * * @param key - The Schematic's layers key (`schematicKeys(id).layers`) * @returns What the store holds — no choice until the viewer makes one — and the write */ export declare function useSchematicLayerView(key: string): [SchematicLayerView, (next: SchematicLayerView) => void]; //# sourceMappingURL=layers-view.d.ts.map