Skip to content

Elements of @contraagent/elements

Generated from the custom-elements.json of @contraagent/elements: 18 elements.

<cae-bar-chart>

Horizontal bars, one per label, in the order given (a funnel's stages, a ranking): each its label, a bar as long as its value against the longest, and the value in words. A bar with a tone takes that status colour, the others one colour. Every value is written beside its bar, so no tooltip is needed; the switch shows them as a table.

CaeBarChart | src/charts/bar-chart.ts | Live: Charts

PropertyAttributeTypeDescription
barsnonereadonly ChartBar[]
PartMeaning
plotthe bars
tablethe table of its values
switchthe button between the two
emptywhat it shows with no values

<cae-check-table>

Named values checked one by one: a row per name, with what it must be, what it is and the verdict. Without showValues, only the names and what each must be (nothing to check them against).

CaeCheckTable | src/checks/check-table.ts | Live: Check table | Live: Element gallery

PropertyAttributeTypeDescription
rowsnonereadonly CheckRow[]
showValuesshowValuesbooleanShow the values and the verdicts.
stringsnonePartial<CheckTableStrings>
PartMeaning
tablethe <table>
roweach row of a name
verdicteach verdict

<cae-code>

A text shown as code: highlighted by its language (LANGUAGES, another name of one or a file name; anything else is plain), each line numbered from start, the lines of highlight marked (a bar beside the number and a tint). Long lines scroll sideways, or wrap with wrap or the reader's switch. A text of more than maxLines lines or maxCharacters characters shows its first lines and says how many it has; the copy button copies the whole text. The line numbers are not part of a selection.

CaeCode | src/code/code.ts | Live: Code | Live: Tree | Live: Element gallery

PropertyAttributeTypeDescription
codecodestringThe text.
languagelanguagestringIts language: a name of LANGUAGES, another name of one, or a file name; anything else is plain text.
startstartnumberThe number of the first line.
highlightnonereadonly LineMark[]The lines marked, in the numbers shown.
pathpathstringThe file the text is, named over it.
labellabelstringWhat the lines are named to a screen reader (default: the path).
wrapwrapbooleanLong lines wrap at first; the reader's switch changes it.
maxLinesmaxLinesnumberThe most lines shown.
maxCharactersmaxCharactersnumberThe most characters shown, at the end of a line.
stringsnonePartial<CodeStrings>The visible words; English by default.
PartMeaning
headerthe path, the language and the buttons
codethe lines, which scroll
cutthe note under a text cut short

<cae-column-chart>

Vertical bars, one group per label of x: a bar per series side by side, or with stacked, the series of a label on one bar. Six series take the series colours in their order; past six, the sixth and later are one bar part, "other". A legend names the series when there are two or more. Pointing at a label, or moving to it with the arrow keys, shows its values; the switch shows them all as a table.

CaeColumnChart | src/charts/column-chart.ts | Live: Charts

PropertyAttributeTypeDescription
xnonereadonly string[]A label per group of bars, in order.
seriesnonereadonly ChartSeries[]
stackedstackedbooleanThe series of a label on one bar, instead of side by side.
PartMeaning
plotthe chart
tablethe table of its values
switchthe button between the two
emptywhat it shows with no values
legendthe legend

<cae-count>

A number that counts up (or down) to its new value when it changes; at once for a reader who asks for reduced motion.

CaeCount | src/count/count.ts

PropertyAttributeTypeDescription
valuevaluenumber

<cae-data-table>

A table of rows, one per item, in a real <table>: a header cell per column (scope="col"), the first rowHeader column as the row's header. The rows are one tab stop: the arrow keys, Home and End move between them, and Enter or a click is the row's primary action (cae-activate), or chooses it as the selection when the table is not activatable (cae-select). A sortable header sends cae-sort; the host orders the rows (sortRows) and sets them. Above windowAt rows, only the rows on screen are drawn, and a spacer stands for the others: as high as those rows were when drawn, or, for a row not drawn yet, as the rows drawn are on average. Rows may differ in height. Its look: --cae-data-table-gap (between the columns), --cae-data-table-row-padding, the parts, and cellStyles (styles for what the cells draw, added to the table's own).

CaeDataTable | src/table/data-table.ts | Live: @contraagent/elements | Live: Data table | Live: Element gallery

PropertyAttributeTypeDescription
columnsnonereadonly DataColumn<R>[]
rowsnonereadonly R[]
rowKeynone(row: R) => stringA row's id: unique among the rows (data-key, the id of the events). By default its id.
rowTonenone(row: R) => Tone | undefined | undefinedA row's tone (data-tone on the row).
rowAttrsnone(row: R) => Readonly<Record<string, string>> | undefinedMore attributes on a row (data-*), for the host's styles and tests.
activatableactivatablebooleanA click or Enter on a row is its primary action (cae-activate); otherwise it selects the row (cae-select).
selectedselectedstring | nullThe id of the selected row.
sortnoneSortState | nullThe column the rows are ordered by: shown in its header (aria-sort). The host orders the rows.
windowAtwindowAtnumberAbove this many rows, only the rows on screen are drawn.
rowHeightrowHeightnumberA row's height in px, until rows are measured.
captioncaptionstringThe table's caption (its accessible name).
stringsnonePartial<DataTableStrings>
cellStylesnonereadonly CSSResult[]Styles for what the cells draw, added after the table's own (the rows are tr, the cells th and td).
EventDetail and meaning
cae-activate{id}: a row's primary action (a click or Enter, when activatable)
cae-select{id}: a row chosen as the selection (a click or Enter, when not activatable)
cae-sort{id, direction}: a sortable header was clicked
PartMeaning
tablethe <table>
captionthe caption
headthe header row's group
header-celleach header cell
roweach row
row-selectedthe selected row
celleach cell
emptythe cell that stands for no rows

<cae-elapsed>

Time since since (epoch ms), ticking every second: 42s, 3m 05s, 1h 02m.

CaeElapsed | src/count/elapsed.ts

PropertyAttributeTypeDescription
sincesincenumber

<cae-heatmap>

A value per row (y) and column (x), each a cell coloured on one scale, light to dark (values[row][column]; a null cell is left empty, a 0 is the lightest step). The legend gives the scale's lowest and highest value. Pointing at a cell, or moving to it with the arrow keys (up and down by a row), shows its row, column and value; the switch shows them all as a table.

CaeHeatmap | src/charts/heatmap.ts | Live: Charts

PropertyAttributeTypeDescription
xnonereadonly string[]
ynonereadonly string[]
valuesnonereadonly (readonly (number | null)[])[]
PartMeaning
plotthe chart
tablethe table of its values
switchthe button between the two
emptywhat it shows with no values
legendthe legend

<cae-json-tree>

Any JSON value as a foldable tree: the first level open, deeper levels folded.

CaeJsonTree | src/json/json-tree.ts

PropertyAttributeTypeDescription
valuenoneunknown
openopennumberLevels opened from the start.
PartMeaning
treethe tree

<cae-lanes>

Bars on a time axis, a lane per group: each bar as long as it took, the overlapping bars of a lane stacked, a running bar (end null) growing until now and a line at now. A bar's look is its style in barStyles, whose labels are the legend (a row per group). The bars grow in when they are first drawn. Its look: --cae-lanes-label-width (the lanes' labels; 112px, 78px on a narrow screen) and the parts.

CaeLanes | src/lanes/lanes.ts | Live: Lanes | Live: Element gallery

PropertyAttributeTypeDescription
lanesnonereadonly Lane[]
barStylesnoneReadonly<Record<string, LaneStyle>>A look per style key of the bars, in legend order.
rangenoneTimeRange | nullThe time the axis spans; null fits the bars (fitRange).
livelivebooleanDraws again every second, so the running bars and the line at now move.
omittedomittednumberBars the host left out, as a note after the legend.
localelocalestringThe language of the axis' times; by default the page's (lang).
stringsnonePartial<LanesStrings>
PartMeaning
axisthe times above the lanes
laneeach lane
lane-labela lane's label
trackthe area of a lane's bars
bareach bar
nowthe line at now, while a bar runs
legendeach row of the legend
emptywhat the element shows with no bars

<cae-layered-graph>

A layered graph: each node in a layer by the longest path to it, edges bending only in the gaps between layers and never passing a node or a cluster's label; a cluster of nodes in a box (a cluster in a cluster: a box in a box), with, when it cycles, a dotted return from its last layer to its first; an edge from outside the graph from a named stub. Inside each node, one mark per series id, at the same place in every node, so a series can be followed across the graph; a mark is drawn in its state's look (states). Above barAt marks, a node shows a bar of its counts and lists its failed marks. The order depends on the structure only, and keeps a previous order: nodes that appear later are added at the end of their layer. A click selects a mark, a node or a cluster (cae-select); a card beside it (the host's content, in the inspector slot) moves with it as the graph pans and zooms, and hides while it is out of the frame; on a narrow screen it is a sheet under the frame. A double click or Enter is the item's action (cae-activate), or opens its inner view (cae-drill, for an item with drill). Hovering or focusing a mark highlights its series and what related names. The frame first shows the whole graph; Ctrl (or ⌘) and the wheel, or the buttons, zoom; dragging pans; "Show all" goes back. "Graph | Table" changes the view (cae-view-change): the table is a row per node, with its status and the nodes it is joined to. With matrix, the frame shows that <cae-mark-matrix> as the table instead. Size: the element is as wide as its container. Without a height set on it, the frame is as tall as the whole drawing at that width (never scaled up), up to 70% of the window's height or 360 px, whichever is more, and taller when the card needs it; top to bottom, as tall as the drawing. A height set on the element (or given it by a flex or grid container) is shared: the crumbs slot and the row under the frame keep theirs, and the frame takes the rest, the drawing fitted in it. Keyboard: Tab moves between nodes; the arrow keys, Home and End move between a node's marks, and a mark out of the frame is brought into it; Shift and an arrow key move along an edge to an earlier or a later node, on the same series; what has the focus is selected (Tab goes on to the card); Enter is the item's action; Escape clears the selection (and, with none, is left to the host).

CaeLayeredGraph | src/graph/layered-graph.ts | Live: @contraagent/elements | Live: Layered graph | Live: Element gallery

EventDetail and meaning
cae-select{id}: a mark, a node, a cluster or a table row was selected; {id: null}: the selection was cleared
cae-activate{id}: an item's action (a double click or Enter)
cae-drill{id}: an item's inner view (a double click or Enter on an item with drill, a cluster's chip in the table, a later part of a cluster's path)
cae-toggle{id, open}: an item's open or close control (toggle) was used
cae-view-change{view}: "Graph" or "Table" was chosen
PartMeaning
framethe frame every view is drawn in
stagewhat pans and zooms
nodeeach node
node-headera node's first line
node-namea node's name
markeach mark
clustereach cluster
cluster-labela cluster's header
edgeeach edge
stubeach stub
legendthe legend
keysthe line of key hints under the legend
inspectorthe selected item's card
tablethe node table
roweach row of the node table

<cae-line-chart>

Lines over the labels of x, one per series (a value per label; null breaks the line). Six series take the series colours in their order; any past six are drawn in the colour of "other" and named in the legend and the tooltip. Pointing at a label, or moving to it with the arrow keys, marks it with a rule and shows every series' value there; the switch shows them all as a table.

CaeLineChart | src/charts/line-chart.ts | Live: Charts

PropertyAttributeTypeDescription
xnonereadonly string[]
seriesnonereadonly ChartSeries[]
PartMeaning
plotthe chart
tablethe table of its values
switchthe button between the two
emptywhat it shows with no values
legendthe legend

<cae-mark-matrix>

A table of marks: a row per series (its label, then a value), a column per item, the columns under nested groups (a border where a group starts). A mark is drawn in its state's look (states). A click selects a mark (cae-select); a double click or Enter is its action (cae-activate, or cae-drill for a mark with an inner view). The arrow keys, Home, End, Page Up and Page Down move between the marks (Ctrl with Home and End: the first and the last row). The hovered, focused or selected mark's row is highlighted, else highlight's. The host sorts the rows: the sort control sends cae-sort. Above windowAt rows, only the rows in view are drawn.

CaeMarkMatrix | src/matrix/mark-matrix.ts | Live: Mark matrix | Live: Element gallery

EventDetail and meaning
cae-select{id}: a mark was clicked or focused
cae-activate{id}: a mark's action (a double click or Enter)
cae-drill{id}: a mark's inner view (a double click or Enter on a mark with drill)
cae-sort{id, direction: 'asc'}: an order was chosen
PartMeaning
matrixthe <table>
head-celleach header cell
row-headereach row's label
markeach mark
sortthe sort control

<cae-markdown>

A markdown text with a rendered/source switch. split may take a leading line off the text, shown apart above the rendered body; the source is the text as it is.

CaeMarkdown | src/markdown/cae-markdown.ts

PropertyAttributeTypeDescription
texttextstring
splitnone(text: string) => { head: string; body: string } | undefinedTakes a leading line off the text (head), shown apart above the rendered body.
transformnone(html: string) => string | undefinedMarks up the rendered (escaped) HTML further, as mdFile's mark.
stringsnonePartial<MarkdownStrings>The visible words; English by default.
PartMeaning
togglethe rendered/source button

<cae-segmented>

One choice among a few, as a row of buttons (a radio group): a click, or the arrow keys, Home and End, choose. The group is one tab stop. Its look: --cae-segmented-radius, --cae-segmented-height, --cae-segmented-padding, --cae-segmented-font-size, --cae-segmented-divider (the line between options) and --cae-segmented-hover (an option's text under the pointer), or the parts.

CaeSegmented | src/primitives/segmented.ts | Live: @contraagent/elements | Live: Primitives | Live: Element gallery

PropertyAttributeTypeDescription
optionsnonereadonly SegmentedOption[]
valuevaluestring
labellabelstringThe group's accessible name.
EventDetail and meaning
cae-change{value}: the option the reader chose
PartMeaning
groupthe row of options
optioneach option
option-selectedthe chosen option

<cae-stat-tiles>

Figures as a grid of tiles: each its label, its value (a number counts up in <cae-count>), the lines of facts under it and a link. A tile whose number changes bumps, unless bump is off or the reader asks for reduced motion. Its look: columns (fewer in a narrow element: 4 below 1100px of its width, 2 below 660px, 1 below 240px), --cae-stat-tiles-gap and the parts.

CaeStatTiles | src/tiles/stat-tiles.ts | Live: @contraagent/elements | Live: Theming | Live: Stat tiles | Live: Element gallery

PropertyAttributeTypeDescription
tilesnonereadonly StatTile[]
columnscolumnsnumberTiles per row on a wide screen.
bumpbumpbooleanA tile whose number changes bumps.
EventDetail and meaning
cae-action{id, action}: a tile's link, by the tile's id and the action's id
PartMeaning
tilesthe grid
tileeach tile (data-id is its id, data-tone its tone)
labela tile's label
valuea tile's value
subeach line under the value
actiona tile's link

<cae-transcript>

A conversation with an agent, in sections (one session each): chat bubbles, reasoning, notices and collapsible tool cards (a web search lists the pages it returned as links). Above two sections, a picker shows one at a time; the latest is followed unless shown names another. While the reader is at the bottom, new content scrolls into view; once they scroll up, it stays, and a button counts what arrived below. A new section that starts while they read the latest one keeps the one they read on screen. Give it a new element (or set loading until the content arrives) for another transcript: what the reader opened and where they were belong to one transcript, kept in memory.

CaeTranscript | src/transcript/transcript.ts | Live: Transcript | Live: Element gallery

PropertyAttributeTypeDescription
sectionsnonereadonly TranscriptSection[]
shownnonenumber | nullThe section to show, 0-based; null follows the latest.
livelivebooleanThe transcript is still being written: it shows the agent working; a tool call with no result is running, not interrupted.
earlierearliernumberLines before the content that are not loaded: above 0, a button asks for them (cae-load-earlier).
loadingloadingbooleanThe content has not arrived yet: the reader's position is restored once it has.
countnonenumber | nullHow much the transcript holds, for the count of what arrived below; by default its sections and items.
modemode'full' | 'tabs' | 'none'full; tabs: only the section picker; none: hidden.
memorynoneTranscriptMemory | nullWhere the open tool cards and the scroll position are kept.
markdownnone((text: string) => string) | nullMarkdown to safe HTML (the text escaped), for answers and reasoning; without it they show as plain text.
renderDetailnone((detail: TranscriptDetail) => unknown) | nullDraws an open prose detail (a prompt); by default as markdown.
stringsnonePartial<TranscriptStrings>
shownIndexnonenumberThe section on screen, 0-based; -1 with none.
EventDetail and meaning
cae-section-change{index}: the reader picked a section (null: the latest)
cae-section-shown{index}: the section on screen changed (-1: none)
cae-load-earlierthe reader asked for the content before earlier
PartMeaning
pickerthe section picker
sectionthe section shown
taga chip at the head of the section
bubblea prompt, an answer, reasoning or an event
noticea line of the agent's log
toola tool card
tool-bodyan open tool card's body
verdictthe box after the items (footer)

<cae-tree>

Items in a tree, the children of each under it, folded and opened by the reader: files and directories, say. It is one tab stop: Up and Down move between the items shown, Right opens an item (then moves to its first child), Left closes it (or moves to its parent), Home and End go to the first and the last, a letter to the next item of that initial; Enter, Space or a click selects a selectable item (cae-select) and opens or closes any other. The toggle before an item with children opens and closes it (cae-toggle). The ancestors of selected are always open.

CaeTree | src/tree/tree.ts | Live: Tree | Live: Element gallery

PropertyAttributeTypeDescription
itemsnonereadonly TreeItem[]
selectednonestring | nullThe selected item's id, or null.
labellabelstringWhat the tree is named to a screen reader.
stringsnonePartial<TreeStrings>The visible words; English by default.
EventDetail and meaning
cae-select{id}: an item was chosen with a click, Enter or Space
cae-toggle{id, open}: the reader opened or closed an item
PartMeaning
treethe list of items
iteman item's row
emptywhat it shows with no items