Varendo

Delta

Explicit compatible baseline; zero denominator and percentage-point versus relative change distinguished.

FamilydataLicenseApache-2.0
StandaloneAvailable

Use the web element directly without the semantic runtime.

Semantic bindingAvailable

A registered presentation adapter can bind this component to host-owned meaning and state.

Automatic adaptationNo standard recipe

The standard recipe resolver does not select this component automatically.

Import and live example

One percentage-point comparison between two host-supplied exact values.

Interactive preview requires JavaScript.

View the complete example source
import {registerAeliqoElements} from "@varendo/web";
import {
  AeliqoCardCollectionElement,
  AeliqoDeltaElement,
  AeliqoDetailElement,
  AeliqoFilterBuilderElement,
  AeliqoKeyValueElement,
  AeliqoMetricElement,
  AeliqoRecordListElement,
  AeliqoSelectionSummaryElement,
  AeliqoTableElement,
  type AeliqoKeyValueItem,
  type AeliqoTableColumn,
  type AeliqoTableRow,
  } from "@varendo/web/data";

import type {ResultRef,
  Scalar,
} from "@varendo/core";
import type {AeliqoDataColumn, AeliqoDataScope, AeliqoFieldOption} from "@varendo/web/data";

const catalogRef: ResultRef = {
  id: "aeliqo-catalog-example",
  revision: "1",
  outputId: "people",
  queryDigest: "catalog-query",
  scopeDigest: "catalog-scope",
};
const catalogRows: readonly Readonly<Record<string, Scalar>>[] = [
  {id: "ada", name: "Ada Lovelace", team: "Research", date: "2026-09-08", amount: 120},
  {id: "lin", name: "Lin Chen", team: "Product", date: "2026-09-09", amount: 96},
  {id: "grace", name: "Grace Hopper", team: "Research", date: "2026-09-10", amount: 144},
];
const catalogColumns: readonly AeliqoDataColumn[] = [
  {key: "id", label: "ID", type: "text", sortable: true},
  {key: "name", label: "Name", type: "text", sortable: true},
  {key: "team", label: "Team", type: "text"},
  {key: "date", label: "Date", type: "date", sortable: true},
  {key: "amount", label: "Amount", type: "integer", align: "end"},
];
const catalogFields: readonly AeliqoFieldOption[] = [
  {id: "name", label: "Name", type: "text"},
  {id: "team", label: "Team", type: "text"},
  {id: "amount", label: "Amount", type: "integer"},
];
const catalogScope: AeliqoDataScope = {
  loaded: catalogRows.length,
  filteredTotal: catalogRows.length,
  populationDigest: catalogRef.scopeDigest,
  kind: "filtered",
  label: "Authorized people",
};
const tableColumns: readonly AeliqoTableColumn[] = catalogColumns.map(({key, label, sortable, align}) => ({key, label, ...(sortable === undefined ? {} : {sortable}), ...(align === undefined ? {} : {align})}));
const tableRows: readonly AeliqoTableRow[] = catalogRows.map((row) => ({id: row.id ?? null, name: row.name ?? null, team: row.team ?? null, date: row.date ?? null, amount: row.amount ?? null}));
const personKeys = ["string:3:ada", "string:5:grace"] as const;

registerAeliqoElements();

const host = document.querySelector<HTMLElement>("#aeliqo-example") ?? (() => {
  const created = document.createElement("div");
  created.id = "aeliqo-example";
  (document.body ?? document.documentElement).append(created);
  return created;
})();

function createCatalogRoot(container: HTMLElement): HTMLElement {
  const root = document.createElement("div");
  root.dataset.catalogSourceRoot = "true";
  root.style.display = "grid";
  root.style.gap = "12px";
  container.append(root);
  return root;
}

function createCatalogElement<T extends HTMLElement>(tagName: string, container: HTMLElement): T {
  const element = document.createElement(tagName) as T;
  element.setAttribute("data-aeliqo-theme", "light");
  container.append(element);
  return element;
}

function appendSlottedText(root: HTMLElement, slot: string, textContent: string): void {
  const content = document.createElement("span");
  content.slot = slot;
  content.textContent = textContent;
  root.append(content);
}

const root = createCatalogRoot(host);
(((root) => {
		const element = createCatalogElement<AeliqoDeltaElement>("aeliqo-delta", root);
		element.label = "Change from last week";
		element.current = .62;
		element.baseline = .5;
		element.mode = "percentage-point";
		element.unit = "%";
		element.scope = catalogScope;
	}))(root);

Purpose

Show the change between a current value and a baseline, as absolute, relative, or percentage-point. Incompatible inputs read as unavailable, not a misleading number.

When to use it

When to use a different component

Properties and defaults

The host supplies compatible values and declares comparison mode; the component does not infer compatibility.

Properties, ownership, and initial values
PropertyUse and ownershipDeclared typeInitial value
labelProvides the visible label and accessible name for the component.string'Change'
currentSupplies the current comparison value. The component displays it without recomputing the metric.AeliqoDataValue | undefinedundefined
baselineSupplies the comparison baseline and its evidence. The component does not infer a baseline from visible rows.AeliqoDataValue | undefinedundefined
modeSupplies mode to the component as application-owned input.AeliqoDeltaMode'absolute'
compatibleStates whether compared values share compatible meaning and units. The host computes this fact.booleantrue
unitProvides the unit label associated with the numeric value.string''
scopeSupplies the visible authorization and population scope associated with the displayed value or rows.AeliqoDataScope | undefinedundefined
statusSupplies the explicit ready, loading, empty, partial, stale, or error state.AeliqoDataStatus'ready'
messageProvides the user-facing status, error, or recovery message.string''

Events

States and failure handling

Relevant states:

Expected result: The comparison is labelled as percentage-point change and unavailable inputs remain explicit.

Keyboard, focus, and accessibility

Keyboard behavior:

Exposed semantics:

Responsive behavior

Keep current and baseline context with the change. Stack the values at narrow widths rather than dropping either one.

Style hooks

Generated TypeScript declaration

View generated declaration
export declare class AeliqoDeltaElement extends LitElement {
    static readonly aeliqoVersion = "0.1.0";
    static readonly properties: {
        label: {
            type: StringConstructor;
        };
        current: {
            attribute: boolean;
        };
        baseline: {
            attribute: boolean;
        };
        mode: {
            type: StringConstructor;
        };
        compatible: {
            type: BooleanConstructor;
        };
        unit: {
            type: StringConstructor;
        };
        scope: {
            attribute: boolean;
        };
        status: {
            type: StringConstructor;
        };
        message: {
            type: StringConstructor;
        };
    };
    label: string;
    current: AeliqoDataValue | undefined;
    baseline: AeliqoDataValue | undefined;
    mode: AeliqoDeltaMode;
    compatible: boolean;
    unit: string;
    scope: AeliqoDataScope | undefined;
    status: AeliqoDataStatus;
    message: string;
    protected render(): import("lit").TemplateResult<1>;
    private presentation;
    private canDisplayStatus;
    private renderedValue;
    private modeLabel;
    private renderUnit;
    private renderScope;
    private renderStatus;
    private get validMode();
    static readonly styles: import("lit").CSSResult[];
}

Version

This page documents the Varendo 0.6 component contract.