import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraVariant}from'../../../internal/variants.js'; /** The shared semantic tone. Kept as a local name so existing imports keep resolving. */ export type ContextMeterTone=LyraVariant; /** The meter geometry. This is deliberately separate from the semantic `variant` vocabulary. */ export type ContextMeterShape='ring'|'bar'; /** * What each legend row shows beside its swatch. Combinable rather than mutually exclusive (the * `label | value | percentage` spelling ``'s own legend uses cannot express "count AND * share", which is the ordinary reading of a part-to-whole key). */ export type ContextMeterLegendDisplay='label'|'label-value'|'label-percent'|'label-value-percent'; /** Detail of `lr-segment-activate`: which band the user picked, and what it stands for. */ export interface LyraContextMeterSegmentActivateDetail{ /** Zero-based index into the projected `segments` array. */ readonly index:number; /** That segment's own `label`, passed through verbatim. */ readonly label:string; /** That segment's normalized nonnegative `value` -- the absolute quantity, never a share. */ readonly value:number;}export interface LyraContextMeterEventMap{'lr-segment-activate':CustomEvent;}export interface ContextMeterSegment{label:string; /** Absolute quantity (e.g. tokens), not a pre-computed percentage. */ value:number;tone?:ContextMeterTone; /** Optional arbitrary CSS color. When set, it takes precedence over `tone`. */ color?:string; /** * Marks this band non-actionable while `interactive` is set: its control renders genuinely * disabled (no tab stop, no hover/press affordance) and activating it emits no * `lr-segment-activate`. * * Deliberately NOT inferred from `value === 0`. A zero band is legitimately clickable in a * budget meter -- the original use for this component -- so inertness is declared, never * guessed. For the derived signal, style the `segment-empty`/`legend-item-empty` part instead. */ disabled?:boolean;} /** * `` — a segmented occupancy meter (bar or ring) for * showing how a fixed capacity (a model's context window, a token budget, * any consumable quota) is divided across labeled categories. First-party * invention; no equivalent exists in Web Awesome. * * Pure data visualization: it renders `segments`/`total` as given and never * computes token counts, costs, or any other domain-specific estimate * itself — the one exception is the plain arithmetic sum of the segment * values used to build the accessible "X of Y used" summary below. * * 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-context-meter * @csspart base - The component's root wrapper (a `
` for `bar`, an `` for `ring`). * @csspart track - The unfilled/empty capacity track. * @csspart segment - One occupied segment. Carries `data-tone` for styling and * `--lr-context-meter-segment-color` when `color` is set. While `interactive` is set it is a * `` otherwise. * @csspart legend-value - One legend row's absolute count, rendered by `legendDisplay`'s * `label-value`/`label-value-percent` settings. * @csspart legend-percent - One legend row's share of `total`, rendered by `legendDisplay`'s * `label-percent`/`label-value-percent` settings. Always the ratio the bar/ring actually paints. * @csspart legend-swatch - The color chip of a legend item, painted from that segment's resolved * `color`/`tone` — the same ladder and the same inline custom-property escape `segment` uses. * @csspart legend-label - The text of a legend item (the segment's `label`). * @cssprop [--lr-context-meter-segment-color] - Per-segment color. Set inline on `[part="segment"]` by the component itself whenever that segment supplies a `color`; unset (and the token unread) otherwise, leaving the `data-tone` palette in charge. The matching `[part="legend-swatch"]` reads the same property, so a swatch can never disagree with the band it stands for. * @cssprop [--lr-context-meter-legend-swatch-size=var(--lr-size-0-625rem)] - Inline and block size of a legend swatch. * @cssprop [--lr-context-meter-track-size=var(--lr-size-0-5rem)] - Block size (thickness) of the `bar`-shape track, and therefore of its filled segments. * @cssprop [--lr-context-meter-track-radius=calc(var(--lr-radius) * 0.5)] - Corner radius of the `bar`-shape track. * @cssprop [--lr-context-meter-track-bg=color-mix(in srgb, var(--lr-color-border) 30%, transparent)] - Background of the unfilled remainder of the `bar`-shape track. * @cssprop [--lr-context-meter-segment-seam-color=var(--lr-color-surface)] - Color of the hairline seam painted between adjacent `bar`-shape segments. * @cssprop [--lr-context-meter-selected-ring-color=var(--lr-color-text)] - Colour of the inset ring marking a `bar`-shape band or a legend row whose index is in `selectedIndices`. Painted inside the shadow root because the state lives in the part name, and as a ring rather than an outline so it composes with the hover/press/focus outlines instead of being replaced by them. * @cssprop [--lr-context-meter-selected-ring-width=var(--lr-border-width-thick)] - Width of that selected ring. * @cssprop [--lr-context-meter-disabled-opacity=var(--lr-opacity-disabled)] - Opacity of a band or legend row whose `segments` entry sets `disabled`. The band keeps its own colour -- it is still the datum it always was -- and loses only the affordances that promise activation. * @cssprop [--lr-context-meter-selected-arc-stroke=16] - Stroke width, in this component's `0 0 100 100` viewBox units, of a selected `ring`-shape arc. Arcs share one bounding box, so a selected arc reports itself by thickening in place rather than by an outline that would trace the whole ring. * @event lr-segment-activate - A band or its legend row was activated while `interactive` is set. * `detail: { index, label, value }`. Cancelable: the default action is this component toggling * `index` in its own `selectedIndices`, so `preventDefault()` hands that state entirely to the * consumer. Never emitted in the default presentational mode. * @status stable * @since 4.0.0 */ export declare class LyraContextMeter extends LyraElement{protected static readonly ownedCollectionProperties:readonly string[];protected static readonly immutableEventDetails:readonly string[];static styles:import("lit").CSSResultGroup[]; /** Occupied segments, each an absolute quantity against `total` — never a percentage. */ segments:readonly ContextMeterSegment[]; /** The full capacity segments are measured against (e.g. a model's context window size). */ total:number;private _shape; /** Meter geometry. Foreign attribute values normalize to the default bar shape. */ get shape():ContextMeterShape;set shape(value:ContextMeterShape); /** Overall accessible label/caption, e.g. `"128K context window"`. */ label:string; /** Renders a static `[part="legend"]` key below the meter — one swatch/label pair per `segments` * entry, each swatch painted with that segment's resolved `color`/`tone`. Off by default. * * Without it, the only place a segment's own label is exposed is a hover `title` (desktop-only, * undiscoverable) and the visually-hidden breakdown list — so a meter split across more than two * or three categories is legible to a screen-reader user but not to a sighted one, who has to * hand-roll swatch+label markup outside the component. Non-interactive: it toggles nothing and * emits nothing, mirroring ``'s `showLegend` rather than the interactive * ``. */ showLegend:boolean; /** * What each legend row shows beside its swatch. `label` (the default) is exactly the output this * component has always produced. The other three add the segment's own count, its share of * `total`, or both, as `[part="legend-value"]`/`[part="legend-percent"]` spans. * * The share is the SAME clamped ratio the bar/ring paints, so a key can never disagree with the * band it stands for, and it is formatted through `effectiveLocale`. Has no effect while * `showLegend` is unset. Folding the number into `segment.label` instead would push it into the * hover title and the visually-hidden breakdown too, where a screen reader would hear the count * twice. */ legendDisplay:ContextMeterLegendDisplay; /** * Opt-in filter mode: every band, and every legend row, becomes a real button that emits the * cancelable `lr-segment-activate`. * * Off by default, and off is unchanged from before this property existed -- a pure part-to-whole * visualization whose visible parts are all `aria-hidden`. On, the bands are `