/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { StringType, type ArrayType, type option, type ValueTypeOf } from "@elaraai/east"; import type { RowSourceType } from "@elaraai/east-ui"; import type { RecordSliceBindType } from "@elaraai/east-ui/internal"; /** What a builder's payload says about which rows show. */ export interface KeyVisibilityInput { /** The narrowed rows' keys, paged through a record Slice; `none` with no record Slice. */ visibleSource: option>>> | undefined; /** The keys to show when no record Slice narrows: a Set, or `none` for every row. */ visible: option>; /** Every row, in its order: what shows when nothing narrows. */ rows: readonly { key: string; }[]; /** The record Slice chrome, whose Retry a failed narrowing offers. */ recordSlice: option<{ slice: { retry: () => void; }; }> | undefined; } /** The words a failed narrowing says. */ export interface KeyVisibilityWords { /** The results moved while they were read (`Staff results changed; retry the narrowing.`). */ changed: string; /** The results could not be read (`Could not load staff results`). */ failed: string; } /** Which rows show, and the narrowing's state. */ export interface KeyVisibility { /** The keys to show: `none` for every row. */ keys: option>; /** Whether a complete membership has resolved yet. */ ready: boolean; /** Whether a new narrowing is resolving (the previous membership still shows). */ loading: boolean; /** Why the narrowing could not be read. */ error: string | undefined; /** Read the narrowing again. */ retry: () => void; } /** * Which rows show (see the module docs). * * @param value - What the payload says about which rows show * @param words - What a failed narrowing says * @returns The keys to show, and the narrowing's state */ export declare function useKeyVisibility(value: KeyVisibilityInput, words: KeyVisibilityWords): KeyVisibility; /** A Slice over several records' chrome, as a builder's payload carries it: each source's part. */ export interface SourcesChrome { slice: { parts: readonly { source: string; slice: ValueTypeOf; }[]; }; } /** * One source's part of a Slice over several records (#1339). * * @param chrome - The payload's chrome; `undefined` with no slice * @param source - The source's name (`resources`) * @returns Its record Slice's controls, if the slice has the source */ export declare function sourcePart(chrome: SourcesChrome | undefined, source: string): ValueTypeOf | undefined; /** * Which of a source's rows show (#1339): the keys its part of a Slice over * several records narrows to while a choice narrows it, every row — and no * read — while none does. Every place a builder shows the source's rows reads * these keys, so one choice narrows them all. * * @param chrome - The payload's chrome; `undefined` with no slice * @param source - The source's name (`resources`) * @param keys - The source's narrowed keys, paged through its part, as the payload carries them * @param rows - Every row of the source, in order * @param words - What a failed narrowing says * @returns The keys to show, and the narrowing's state */ export declare function useSourceVisibility(chrome: SourcesChrome | undefined, source: string, keys: option>>>, rows: readonly { key: string; }[], words: KeyVisibilityWords): KeyVisibility; //# sourceMappingURL=visibility.d.ts.map