/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { option, ValueTypeOf } from "@elaraai/east"; import type { RecordSliceBindType } from "@elaraai/east-ui/internal"; import type { LibraryEmpty, LibraryNarrowing } from "@elaraai/east-ui-components"; import { type CountWords } from "@elaraai/east-ui-components/internal"; import { type KeyVisibility } from "./visibility.js"; /** What one source of the rail shows of a tab. */ export interface SourceShown { /** The keys that show: `none` while the source narrows nothing. */ keys: option>; /** * Whether a choice of the viewer's narrows them (#1621): its page's scope is none, and is no filter to clear. Left * out, as by a source that narrows nothing, any narrowing it holds is the viewer's. */ chosen?: boolean; /** How many rows its page holds, where a scope narrows it (#1621): `none` while read; left out on a page that holds every row. */ held?: option | undefined; /** A new membership resolving, or the last read failed: the tab's cards are retained, as main's are. */ busy: boolean; /** Whether a complete membership has resolved: until it has, an empty tab says nothing of the filters. */ ready: boolean; /** Clears the source's choices, the rail's other sources keeping theirs; `undefined` with no such source. */ clear: (() => void) | undefined; } /** * A source's visibility as a tab reads it: the same object while the source's * membership, its state and its part stand, so a tab's cards are filtered again * only when what it shows changes. * * @param shown - The source's visibility (`useSourceVisibility`) * @param part - The source's part of the slice, whose Clear all clears it alone * @returns What the source shows of a tab */ export declare function useSourceShown(shown: KeyVisibility, part: ValueTypeOf | undefined): SourceShown; /** A tab over a source, as its Library and its pane take it. */ export interface SourceTab { /** The cards the source shows, in their order. */ cards: readonly C[]; /** The tab's count: `12 of 69` while its source narrows, else the count alone. */ count: string | number; /** While its source narrows: what the tab says when that leaves it no card of the source's — above any the source does not touch (#1342) — and its Clear filters. */ narrowing: LibraryNarrowing | undefined; /** An empty tab's own words; none while its narrowing has not resolved (the rail's banner speaks for it). */ empty: LibraryEmpty | undefined; /** * The pane's attributes while its source resolves or after its read fails: busy, and its cards retained (#1398, * CL8) — readable, focusable and selectable, aria-disabled; the builder's commands take no drag of them meanwhile. */ pane: { "aria-busy"?: true; "aria-disabled"?: true; }; } /** * A tab over a source (see the module docs) — {@link sourcesTab} over its one * source, every card of the tab that source's. * * @param args - The tab's cards, each one's key in the source's record, what the source shows, the tab's plural noun as running text writes it, and the app's number formatter * @returns The cards it shows, its count, its narrowed and its own empty states, and its pane's attributes */ export declare function sourceTab(args: { cards: readonly C[]; keyOf: (card: C) => string; shown: SourceShown; noun: string; words: CountWords; }): SourceTab; /** * A tab over several sources (#1345): each card follows its own source — the * Sheet's Rows tab, its templates lists each a record of their own, and the * Calendar's templates. It shows each card its source shows, and every card * of a source that narrows nothing or of none; counts what it shows of every * card (`3 of 11`) while any source narrows; and is emptied when no card of a * narrowing source shows, while the cards of sources that narrow nothing * still show — its words then said above them. Its Clear filters clears each * narrowing source, the rail's other sources keeping theirs. Until every * narrowing source has resolved, an empty tab says nothing of its own, and * while any resolves or failed its pane is busy. * * A source's page scope (#1621) is no narrowing of the tab's: its cards are * the scope's alone, the tab's whole, counted as they are — `12`, never * `12 of 69` — and emptied, the tab says so plainly, with no Clear filters, * which could not clear the scope. A choice of the viewer's beside it counts * what it shows out of the cards the scope holds. * * @param args - The tab's cards, each one's key in its source's record, the sources, the source each card follows (`undefined`: none), the tab's plural noun as running text writes it, and the app's number formatter * @returns The cards it shows, its count, its narrowed and its own empty states, and its pane's attributes */ export declare function sourcesTab(args: { cards: readonly C[]; keyOf: (card: C) => string; sources: readonly SourceShown[]; sourceOf: (card: C) => SourceShown | undefined; noun: string; words: CountWords; }): SourceTab; //# sourceMappingURL=source-tab.d.ts.map