/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * What the rail's narrowing does to the Schematic's drawing (#1392, * `Schematic Builder Spec.md` §10.2, §10.3) — pure: which entities match it, * which draw as context, and which it takes out of every list that shows the * drawing — Find, the Index, the Backlog, the inspector's Choosers and what an * item is joined to, and the footer's counts — and of the selection. * * A row matches while its kind's source narrows and holds it among its shown * keys (`useSourceVisibility`), never by a predicate over the rows. What else * the narrowing does follows how a narrowed-out row draws: * * - **Hidden** (the default): a kind read through its source reads only what * its narrowing holds, so a narrowed-out row is never drawn. A link or a net * draws only while its ends do, so one ending at an item of a kind read * through its source that its read does not hold is out too — a net once a * side of it has no such member left. * - **Dimmed** (`narrowed="dim"`): every row is read, and one its kind's * source narrows out draws as context; so does a link ending at one, and a * net whose every member drawn on a side is one. Context is out. * * A kind read by area reads only its window (#1393): a drafted row of it the * window doesn't hold, drawn where its draft places it, is the narrowing's or * not as the row its session began from answers (`drafts-narrowing.ts`) — a * match, or, dimmed, context — as every kind's drafted row is. * * A row a gesture created is neither: no read holds it, and it draws as it is. * * @packageDocumentation */ import { type ValueTypeOf, type option } from "@elaraai/east"; import type { Schematic } from "@elaraai/e3-ui/internal"; import { type SchematicDrawn, type SchematicRef } from "./canvas/drawn.js"; import type { SchematicHeldRows } from "./data.js"; /** How a narrowed-out row draws, and what the matches take (§10.3): the payload's `narrowed`, read once. */ export interface SchematicNarrowedLook { /** Whether a narrowed-out row draws as context, rather than hidden. */ readonly dim: boolean; /** Context's opacity (0–1). */ readonly opacity: number; /** Whether context is drained of colour. */ readonly desaturate: boolean; /** Whether a context item draws as a bare marker. */ readonly dot: boolean; /** The matches' emphasis: a ring, one that breathes, or none. */ readonly emphasis: "halo" | "pulse" | undefined; /** Whether the matches are boxed. */ readonly frame: boolean; /** Whether the camera flies to the matches when they change. */ readonly fit: boolean; } /** * How a narrowed-out row draws, as the payload says it. * * @param narrowed - The payload's `narrowed` * @returns Its look */ export declare function narrowedLook(narrowed: ValueTypeOf): SchematicNarrowedLook; /** Whether a look asks anything of the matches: an emphasis, a frame or a fit — what makes a hidden narrowing read its keys. */ export declare function looksAtMatches(look: SchematicNarrowedLook): boolean; /** What the narrowing does to the drawing, each entity by its id. */ export interface SchematicNarrowing { /** The matches: each entity of a kind whose source narrows, among its shown keys, and drawn as itself — what emphasis rings, frame boxes and fit flies to. */ readonly matches: ReadonlySet; /** What draws as context (`narrowed="dim"`): faded, drained of colour or a bare marker, and never selected. */ readonly context: ReadonlySet; /** What the narrowing takes out of every list and of the selection: the context, and a link or a net whose ends it hides. */ readonly out: ReadonlySet; /** Whether a row the read holds draws as context: one its kind's source narrows out, under `narrowed="dim"` — a backlog row among them. */ readonly isContext: (ref: SchematicRef) => boolean; } /** Nothing narrows. */ export declare const NO_NARROWING: SchematicNarrowing; /** What the narrowing is worked out from. */ export interface SchematicNarrowingArgs { /** What the canvas draws: the stored rows, the drafts in place. */ readonly drawn: SchematicDrawn; /** Each kind's rows its read holds, by the kind's slot, then by key. */ readonly held: SchematicHeldRows; /** The kinds read through their source of the slice, by slot. */ readonly sourced: ReadonlySet; /** * A kind's source's shown keys, by the kind's slot: `none` while the source narrows nothing; `undefined` for a kind * read whole, and for one whose source's keys are not read, or have not yet resolved. */ readonly keys: (slot: string) => option> | undefined; /** Whether a narrowed-out row draws as context: `narrowed="dim"`. */ readonly dim: boolean; /** * Whether a kind read by area's narrowing holds a drafted row of it its read does not hold, as the row its session * began from answers (`drafts-narrowing.ts`): `undefined` for a row not asked — one a gesture created, one of a kind * read otherwise, one whose answer is in flight — which is neither a match nor context. */ readonly drafted?: ((ref: SchematicRef) => boolean | undefined) | undefined; } /** * What the narrowing does to the drawing (see the module docs). * * @param args - The drawing, what each read holds, the kinds read through their source, each source's shown keys and whether a narrowed-out row is dimmed * @returns The matches, the context, and what is out */ export declare function schematicNarrowing(args: SchematicNarrowingArgs): SchematicNarrowing; /** * The drawing as the lists show it: what the narrowing takes out left out. * * @param drawn - What the canvas draws * @param out - What the narrowing takes out, by id * @returns The drawing; the one given while nothing is out */ export declare function narrowedDrawing(drawn: SchematicDrawn, out: ReadonlySet): SchematicDrawn; //# sourceMappingURL=narrowing.d.ts.map