/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The results (#938) — beside the pane, the last run's result * (`Query Editor Spec.md` §4.11), the builder frame's main (#1125): * * - **the band**, at the top, as tall as the pane's tab row, so the two line * up across the builder: the result's controls ({@link resultToolbarItems}), * Table · Tree and Download ▾ with CSV and BEAST2, on the shared toolbar's * row — the band a `Library` holds its search box in; * - **the strips** ({@link ResultStrips}), which the builder draws under its * toolbar, its full width: the stale strip — its "Stale" tag, "The query * changed after this run.", and Run again with its keys — while the query * differs from the one the result is of; a run that gave no result, worded by * how it ended; and the note after a download, dismissible by Font * Awesome's xmark (#1263); * - **the body**: before any run, the empty state; while a run goes, the data * sources it reads over skeleton rows — and a split run's progress, pieces * done of all (#941); a result as a Table (east-ui's Table renderer, over * `results-table.ts`'s rows) or as a Value tree (east-ui's ValueTree * renderer, read-only). Rows open as a Table and one value as a tree; the * toolbar's switch overrides it until the next run. A result too large for * one answer is read a page at a time, as either (`paged-result.ts`, * #1113): the Table's paged source, or the Tree's paging over every row. A * stale result's body is dashed; * - **the footer**: the result's read-outs — its count in words and its * fields, or how many of how many it shows; how the run reads its data, its * plan's explanation on a click (`plan-popover.tsx`, #941); the run's * number, time and duration, its East type on hover; and each data source * it read, with its hash. Its parts give way as the results narrow. * * @packageDocumentation */ import { type ReactNode } from "react"; import { type ToolbarItem } from "@elaraai/east-ui-components"; import { type QueryWords } from "./model/words.js"; import { type Styles } from "./parts.js"; import type { RunOutput, RunState } from "./run.js"; /** How a result shows: as a Table of its rows, or as a Value tree. */ export type ResultView = "table" | "tree"; /** A download's format. */ export type DownloadFormat = "csv" | "beast2"; /** * How a result opens: rows — an array, a set or a vector — as a Table, one * value as a tree. * * @param output - the result * @returns its view */ export declare function pickedView(output: RunOutput): ResultView; /** What a run that gave no result says: its title, and the words under it. */ export interface RunFailure { readonly title: string; readonly message: string; } /** * Why a run gave no result, in the builder's words (`Query Editor Spec.md` * §4.11): the checker's problems; a runtime error or e3's refusal; the time * limit; the size limit; a platform function the server lacks; a call that * never reached the server, or that the server refused. * * @param state - the run * @param words - the words * @returns the banner's title and message; `undefined` for a run that gave a result, or none yet */ export declare function runFailure(state: RunState, words: QueryWords): RunFailure | undefined; /** The footer's read-outs of a run: its count, its fields, the run's own line and what it read. */ export interface ResultFooter { /** The count in words, or the run's state — `10 orders`, `Showing 1–1,000 of 4,210`, `Running…`. */ readonly count: string; /** The rows' fields — `· order, customer, total`. */ readonly fields: string; /** The run's own line — `run #3 · 14:02 · 412 ms`. */ readonly run: string; /** Its East type and multiplicity, on hover. */ readonly type: string; /** What it read — `reads orders #4f2a1c8d · customers #9b07e3a4`. */ readonly reads: string; } /** * The footer's read-outs of a run (`Query Editor Spec.md` §4.11). * * @param state - the run * @param words - the words * @returns the footer's parts */ export declare function resultFooter(state: RunState, words: QueryWords): ResultFooter; /** Props of {@link QueryResults}. */ export interface QueryResultsProps { /** The run. */ readonly state: RunState; /** Whether the query changed after the run that gave the result. */ readonly stale: boolean; /** How the result shows. */ readonly view: ResultView; /** The words. */ readonly words: QueryWords; /** The builder's storage key: the result's renderers keep their state under it. */ readonly storageKey: string; /** The result's controls, for the band ({@link resultToolbarItems}). */ readonly controls: readonly ToolbarItem[]; /** A phone's: no band and no footer, whose parts have moved to the first row and *This result* (QP3, QP4). */ readonly phone?: boolean | undefined; /** A phone's strips, under the pager (QP14; the builder's banners hold them elsewhere). */ readonly strips?: ReactNode; } /** * Renders the results — see the module docs. * * @param props - The run, whether it is stale, the view, the words and the result's controls ({@link QueryResultsProps}) * @returns The results */ export declare const QueryResults: import("react").MemoExoticComponent<({ state, stale, view, words, storageKey, controls, phone, strips }: QueryResultsProps) => import("react/jsx-runtime").JSX.Element>; /** Props of {@link ResultStrips}. */ export interface ResultStripsProps { /** The run. */ readonly state: RunState; /** Whether the query changed after the run that gave the result. */ readonly stale: boolean; /** The note after a download, until it is dismissed or the next run. */ readonly note: string | undefined; /** Dismisses the note. */ readonly onDismissNote: () => void; /** Runs the query again. */ readonly onRunAgain: () => void; /** The words. */ readonly words: QueryWords; /** A phone's: its note in the band over the strip instead (QP16). */ readonly phone?: boolean | undefined; /** A phone's link to what stopped a run (QP14). */ readonly onShowProblem?: (() => void) | undefined; /** A phone's: the run the rows below are from, and when. */ readonly shownRun?: number | undefined; readonly shownAt?: Date | undefined; /** A phone's: the first problem in the steps' plain words, for a run the checker refused (5d). */ readonly problem?: { readonly n: number; readonly text: string; } | undefined; } /** * The result's strips (`Query Editor Spec.md` §4.11): under the builder's * toolbar, the builder's full width, edge to edge, each over a rule — the * stale strip while the query differs from the one the result is of; a run * that gave no result, worded by how it ended; and the note after a download, * dismissible. None, and the strips take no room. * * @param props - The run, whether it is stale, the note and the words ({@link ResultStripsProps}) * @returns The strips */ export declare const ResultStrips: import("react").MemoExoticComponent<({ state, stale, note, onDismissNote, onRunAgain, words, phone, onShowProblem, shownRun, shownAt, problem }: ResultStripsProps) => import("react/jsx-runtime").JSX.Element>; /** What the result's toolbar items show, and do. */ export interface ResultToolbarOptions { /** The view shown; `undefined` without a result. */ readonly view: ResultView | undefined; /** Whether the result can be downloaded: one in hand, not one read a page at a time (#1113). */ readonly downloadable: boolean; /** The view the run picked. */ readonly picked: ResultView | undefined; /** Shows a view. */ readonly onView: (view: ResultView) => void; /** The result's views this builder offers, in the switch's order: Table · Tree shows only where there are two. */ readonly views: readonly ResultView[]; /** Downloads the result. */ readonly onDownload: (format: DownloadFormat) => void; /** The words. */ readonly words: QueryWords; /** The `queryBuilder` recipe's styles. */ readonly styles: Styles; /** The `seg` recipe's styles. */ readonly seg: Styles; } /** * The result's controls, the items of the results' band (`Query Editor * Spec.md` §4.11): **Table · Tree**, the `seg` strip, folding to its icons; * and **Download ▾**, a menu of CSV and BEAST2, folding to its icon. Both are * off without a result, and Download for a result read a page at a time. * * @param options - The view, the picked view, the downloads and the words ({@link ResultToolbarOptions}) * @returns The items, in their order along the row */ export declare function resultToolbarItems(options: ResultToolbarOptions): ToolbarItem[]; /** * A result's file name, from the query's name: lower-cased, every other * character a "-" — `top-shipped-orders-2026`. * * @param name - the query's name * @returns the file's name, without its extension */ export declare function resultFileName(name: string): string; //# sourceMappingURL=results.d.ts.map