Instruments Matrix
// Matrix

Matrix

A dense cell grid where each cell's colour is a banded value: the health of many homogeneous units at a glance.

<talos-matrix> is the honest form for “the health of many identical units”: a satellite shell (planes × slots), a disk array, a rack, a sensor wall. Each cell is one unit and its colour is that unit’s band, so the whole field reads as one picture of where the trouble is and how much of it there is. It renders to one <canvas>, so 72 × 22 = 1,584 cells repaint live without a DOM node each.

Default — .cells with a terminator

LIVE
<talos-matrix cols="48" rows="12" warn="70" crit="90" terminator="0.2"></talos-matrix>
<script type="module">
  const el = document.querySelector("talos-matrix");
  el.cells = new Float32Array(48 * 12).map(() => Math.random() * 100); // row-major
</script>

The demo walks every cell each second and advances terminator. The terminator is a shadow band (for example the day/night line crossing an orbital shell): cells inside it are dimmed, still their colour, because they are in eclipse, not unknown. Under reduced motion the consumer stops advancing terminator and the band holds, which is still a valid reading.

Clicking a cell

el.addEventListener("talos:cell", (e) => {
  const { col, row, index } = e.detail;
  el.highlight = { index };
});

A click emits talos:cell with the cell’s col, row and index. The highlight property ({ col } or { index }) outlines a column or one cell.

Keyboard focus goes to a role="listbox" inside the shadow root, not to the host: arrow keys move between cells and Enter or Space emits talos:cell for the focused one. The host carries no role, aria-label or tabindex.

Behaviour

el.cells takes an array or TypedArray of cols × rows values, row-major.

Attributes

Generated from custom-elements.json in the installed package. Shared attributes (state, format, static…) behave as the instrument contract describes.

AttributeTypeDefaultDescription
cols number 72 grid dimensions.
rows number 22 grid dimensions.
warn number 70 band thresholds on each cell value.
crit number 90 band thresholds on each cell value.
invert boolean — low = bad.
terminator number 0 shadow-band centre, 0..1.
terminator-width number 0.35 shadow-band width fraction.
gap number 1 px gap between cells.
label string — accessible label.
state string — live | loading | stale | offline | unknown; sets data-state on the host
updated-at string — time of the last sample (ISO or epoch ms); drives the age caption
stale-after string — seconds after updated-at at which the element reads stale
format string — number | compact | percent | bytes | duration | currency; the readout's number format
precision string — fraction digits of the formatted value
currency string — ISO 4217 code when format=currency
locale string — BCP 47 locale for formatting; defaults to the page locale

Properties and methods

MemberTypeDescription
.cells ArrayLike<number> Imperative data API — set the cell values (row-major, length cols×rows).
.highlight { col?: number; index?: number } | null Highlight a plane (a whole column, `{col}`) or a single cell (`{index}`), drawn as an outline over the grid — the selection an operator drilled into. Set null to clear. Selection is state (PHILOSOPHY.md), so the outline is bound to a real choice, not decoration.

Events

EventTypeDescription
talos:cell CustomEvent<{ col, row, index }> Bubbles and is composed.

CSS parts

::part(canvas)