/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The saved views' narrowing (#1345): every source's narrowing of the sheet's * one `Slice.bindRecords`, by the source's name — read off the rail, written * back to it as a view opens, compared, cleared and described through East's * own types. * * A view holds the viewer's own choices, never a source's page's scope * (#1621), which the page holds and no choice changes: a view saved on one * press's page opens on another's as the same choices, under that page's * press, and a page whose viewer has chosen nothing is the All tab's. * * @packageDocumentation */ import { type ValueTypeOf } from "@elaraai/east"; import { type RecordSliceReadType, type RecordSliceScopeHolder, type RecordSlicesChromeType } from "@elaraai/east-ui/internal"; import type { SheetNarrowing, SheetSavedView } from "./values.js"; /** The rail's chrome, as the root carries it. */ type Chrome = ValueTypeOf; /** * The rail's narrowing now: each source's state, by its name, as its viewer chose it — its narrowing without its page's * scope (#1621), which a read of the source lays over it. * * @param chrome - The sheet's rail * @returns Every source's narrowing */ export declare function narrowingOf(chrome: Chrome): SheetNarrowing; /** * A narrowing as the rail holds it, source by source: each source's its viewer's choices alone — a clause on a field the * page scopes is the page's, never a choice (#1621), and a view saved before the page was scoped, or on a page with no * scope that shares its views, may hold one — and a source the narrowing does not hold with nothing chosen, as a preset * clears a source it does not name. What {@link writeNarrowing} writes, so what the rail reads back after it. * * @param chrome - The sheet's rail * @param narrowing - The narrowing — a view's, or the whole sheet's * @returns Every source's narrowing, as the rail holds it */ export declare function heldNarrowing(chrome: Chrome, narrowing: SheetNarrowing): SheetNarrowing; /** * Writes a narrowing back to the rail, source by source, as the rail holds it ({@link heldNarrowing}). * * @param chrome - The sheet's rail * @param narrowing - The narrowing to write — a view's, or the whole sheet's * @throws {Error} When a source refuses its choices — ones no index it lists answers together with its page's scope — * the sources before it written */ export declare function writeNarrowing(chrome: Chrome, narrowing: SheetNarrowing): void; /** * What a saved view's tab counts (#1345): the view's narrowing of the `rows` * source, read alone — never by area (#1432) — with its page's scope laid over * it (#1621), as every read of the source carries it. A view saved on one * press's page counts another's rows under that page's press. * * @param rows - The `rows` source's part of the sheet's slice * @param view - The saved view * @returns The read the view's count asks of the source */ export declare function viewRowsRead(rows: RecordSliceScopeHolder, view: SheetSavedView): ValueTypeOf; /** Whether two narrowings hold the same choices, through East's equality, by source. */ export declare function narrowingEqual(a: SheetNarrowing, b: SheetNarrowing): boolean; /** Value equality keeps optimistic tab changes when the host decodes a fresh payload. */ export declare function sheetViewsEqual(a: readonly SheetSavedView[], b: readonly SheetSavedView[]): boolean; /** The All tab clears every source's choices but keeps their presentation. */ export declare function clearNarrowing(state: SheetNarrowing): SheetNarrowing; /** Search text for a new tab's default name: each source's prefix searches. Exact typed choices are not search text. */ export declare function narrowingQuery(state: SheetNarrowing): string; /** Escape clears every search, each source keeping its other choices and its presentation. */ export declare function clearSearch(state: SheetNarrowing): SheetNarrowing; /** A view's scope as the existing tab description names it. */ export declare function narrowingScope(state: SheetNarrowing): "query" | "range" | "filter" | "none"; /** * Writes the saved views back to the host's bind handle. * * @param views - The views, as the sheet holds them now * @param write - The views' write-back, if the host keeps them */ export declare function writeSheetViews(views: readonly SheetSavedView[], write: ((views: SheetSavedView[]) => unknown) | undefined): void; export {}; //# sourceMappingURL=view-state.d.ts.map