import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraTableEventMap}from'../../data/table/table.class.js';import type{LyraExportFormatOption}from'../../utility/export-button/export-button.class.js'; /** * One row of an evaluation dataset -- a single labeled test case an eval run scores a * model/prompt against. Deliberately its own small shape rather than reusing anything from * `src/ai/types.ts`: none of that module's existing interfaces (`RetrievalQuery`, `ChatMessage`, * etc.) model "one row of a labeled eval dataset", so a divergent-looking type squeezed in there * would be worse than a self-contained one defined next to the component that actually consumes * it. `input`/`expectedOutput` are plain strings (not `unknown`/structured payloads) since every * column's `cell()` here renders them as plain text. */ export interface EvalExample{id:string;input:string;expectedOutput?:string;tags?:readonly string[];metadata?:Record;}export interface LyraEvalDatasetEventMap{'lr-example-select':CustomEvent<{exampleId:string|null;}>;'lr-example-add-request':CustomEvent;'lr-example-remove-request':CustomEvent<{exampleId:string;}>;'lr-import-request':CustomEvent>;'lr-export-request':CustomEvent<{format:string;}>; /** Deliberate pass-through from the controlled comparison table. */ 'lr-sort':LyraTableEventMap['lr-sort'];focus:CustomEvent;blur:CustomEvent;} /** * `` — dataset management for an evaluation suite: a filterable/taggable list of * `EvalExample` rows, plus add/remove/import/export affordances. * * Fully controlled, matching this library's established convention for every other * orchestration-level component in this family (e.g. ``'s * `lr-thread-pin`/`-archive`/`-delete`): `examples` is the host's own data, and this component * never mutates it or performs any I/O itself. Every action a user takes -- adding a row, * removing the selected row, importing files, exporting to a format -- fires a `*-request` event * carrying just enough information to act on. Duplicate example ids normalize before filtering, * selection, row keys, exports, and actions; the first occurrence wins. The host decides how (a local mutation, a network * round-trip, opening its own creation dialog, parsing an imported file's actual contents, writing * an exported file to disk or a server) and passes an updated `examples` array back in. * * Composes `` for the row list (columns for `input`/`expectedOutput`/joined * `tags`), ``/`` as a tag-based browse filter (one toggleable chip per * distinct tag currently present across `examples`; multiple active tags OR together, matching * the common "browse by any of these tags" idiom rather than requiring every tag to match), * `` for the import affordance, and `` for the export affordance * -- its own built-in client-side CSV/JSON download is deliberately suppressed * (`event.preventDefault()` on its `lr-export`) since ``'s flat `rows`/`columns` * CSV/JSON builder can't preserve an `EvalExample`'s own `tags`/`metadata` shape faithfully, and * producing the actual exported file/API-call either way is the host's job per this component's * own controlled contract; this keeps `lr-export-request` the single source of truth for every * configured format rather than one format silently downloading locally while every other format * does nothing. * * Row sorting is *not* re-implemented here: all three built-in text columns opt into * `` sorting, and its own `lr-sort` bubbles through (composed events cross a shadow * boundary automatically) for a host that wants to reorder `examples` and hand back a resorted * array -- the same "the host owns the actual data" contract as every other mutation this * component surfaces. * * Public collection properties take bounded, clone-owned readonly snapshots. Create a new * collection and reassign it after changes; mutating the assigned array does not update the view. * * @customElement lr-eval-dataset * @event lr-example-select - A row was activated. `detail: { exampleId }` -- `exampleId` is `null` once the * previously-selected row no longer exists in `examples` or falls outside the active filters * (see `examples`' own doc). * @event lr-example-add-request - The "Add example" control was activated. No detail payload -- * this component has no opinion on what a new example's fields should be; the host implements * its own creation flow (a dialog, a generated draft, etc.) and appends the result to `examples`. * @event lr-example-remove-request - The "Remove" control was activated for the selected row. * `detail: { exampleId }`. * @event lr-import-request - Files were selected/dropped on the internal `` and at * least one was accepted by its own type/size rules. `detail: { files }` — raw `File[]`; parsing * (CSV/JSON/etc. into `EvalExample` rows) is left to the host, mirroring ``'s own * "parsing is a host concern" scope. * @event lr-export-request - An export format was chosen. `detail: { format }`. * @event lr-sort - Deliberate pass-through from the internal table. * `detail: { phase: 'commit', sortKey, sortDir }`. * @event focus - Re-dispatched when the internal search field (only rendered while `searchable`) * receives focus, since native focus neither bubbles nor crosses the shadow boundary. * @event blur - Re-dispatched when the internal search field loses focus. * @csspart base - The root. * @csspart toolbar - The row of add/remove/import/export controls. * @csspart add-button - The "Add example" button. * @csspart remove-button - The "Remove" button, disabled while nothing is selected. * @csspart import - The internal ``. * @csspart export - The internal ``. * @csspart search - The search field's wrapper. Only rendered while `searchable`. * @csspart search-input - The ``. Only rendered while `searchable`. * @csspart search-clear - The clear-search button, replacing the native search-cancel glyph the * component resets. Only rendered while the field has text. * @csspart tag-filter - The tag-filter chip group's wrapper. Only rendered while `examples` * carries at least one tag. * @csspart grid - The internal ``. * @cssprop [--lr-eval-dataset-search-min-height=auto] - Minimum row height of the search field, * for matching it to a themed search field of a chosen density tier. Point it at * `--lr-form-control-height-s` (or any tier of that ladder) to line this field up with the rest * of an application's controls. * @cssprop [--lr-eval-dataset-search-font-size=inherit] - Text size of the search field. * @cssprop [--lr-eval-dataset-search-padding-inline=var(--lr-space-s)] - Leading gutter of the * search field. The trailing gutter is reserved for the overlaid clear button. * @cssprop [--lr-eval-dataset-search-padding-block=var(--lr-space-xs)] - Block gutter of the search * field. * @cssprop [--lr-eval-dataset-search-radius=var(--lr-radius)] - Corner radius of the search field. * @status stable * @since 4.1.0 */ export declare class LyraEvalDataset extends LyraElement{protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[]; /** Controlled dataset: every example currently known to the host. This component never * mutates its own copy of it -- add/remove/import/export are all *requests*; the host performs * the actual mutation (and any persistence/API call) and passes the updated array back in. * Shrinking this out from under an in-progress selection or active tag filter is handled * gracefully: a `selectedId` that no longer matches any row or falls outside the filtered * result set resets to `null` (so Remove cannot act on a hidden row), and an active tag filter * that no longer matches any row's `tags` is dropped rather than silently matching zero rows * forever. Empty/blank ids are omitted and duplicates normalize first-wins before filtering, * selection, the nested grid, and mutation events. */ examples:readonly EvalExample[]; /** Shows the built-in free-text search field, filtering by a case-insensitive substring match * against `input`, `expectedOutput`, and `tags`. */ searchable:boolean; /** Native autocomplete hint forwarded to the built-in search input while `searchable`. An empty * string (the default) leaves the browser default in effect. */ autocomplete:string; /** Whether the browser spellchecks the built-in search input. Defaults to `true`; the literal * `spellcheck="false"` attribute is deliberately parsed as false instead of as a presence-based * boolean. */ spellcheck:boolean; /** Native capitalization hint forwarded to the built-in search input while `searchable`. */ autocapitalize:string; /** Native autocorrection hint forwarded to the built-in search input while `searchable`. * `autoCorrect` maps to the standard lowercase `autocorrect` attribute without colliding with * the incompatible inherited `HTMLElement.autocorrect` type. */ autoCorrect:string; /** Native virtual-keyboard input-mode hint forwarded to the built-in search input while * `searchable`. */ inputMode:string; /** Native virtual-keyboard enter-key hint forwarded to the built-in search input while * `searchable`. */ enterKeyHint:string; /** Forwarded to the internal ``'s own `accept` (native-file-input-style pattern, * e.g. `'.json,.csv'`). Empty (the default) accepts any file type. */ accept:string; /** Forwarded to the internal ``'s own `formats`. */ exportFormats:readonly LyraExportFormatOption[]; /** Disables every add/remove/import/export affordance -- e.g. while a host-side mutation from a * previous request is still in flight. */ disabled:boolean; /** Accessible name for the nested example grid. This wins over the localized * `evalDatasetLabel` default; a host `aria-label` names the host itself and is not cloned onto * the independently interactive grid. */ label:string;private searchText;private activeTags;private selectedId;private get normalizedExamples();protected willUpdate(changed:PropertyValues):void;private clearSelection;private allTags; /** `examples` narrowed by the active tag filter (OR across `activeTags`) and the search text * (AND with the tag filter -- both narrow the same list further). */ private get visibleExamples();private buildColumns;private onAddClick;private onRemoveClick;private onGridRowClick;private onFiles;private onExportButtonExport;private onTagChipSelect;private onSearchInput;private onClearSearch;private onSearchFocus;private onSearchBlur;private stopOwnedEvent;private renderToolbar;private renderSearch;private renderTagFilter;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-eval-dataset':LyraEvalDataset;}}