Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

flow-diagram

User flow and sequence visualization — progressively enhances an ol into a connected node graph with actions, decisions, and branching paths.

Overview

A web component that progressively enhances an <ol> of steps into a connected node graph with typed shapes. Without JavaScript, the ordered list renders normally. With JavaScript, each step becomes a node with connectors, and decisions branch into parallel paths. The rendered diagram is itself a nested list inside a labelled <figure>, so screen readers get the same structure sighted users see.

Node Types

TypeShapeColorUse Case
startPillGreenEntry point of the flow
actionRounded rectBlueUser or system action (default)
decisionRectAmberYes/no branch point
processRectPurpleBackground or automated process
waitDashed rectGrayDelay, timeout, or pause
endPillRedTerminal state

Attributes

AttributeTypeDefaultDescription
data-titlestring—Diagram heading. Rendered as a real heading that names the figure (no hover tooltip, unlike the global title attribute).
data-heading-level1–62Heading level for data-title, so the diagram fits the page outline.
srcstring (URL)—JSON data URL: { title?, steps }. Loaded on connect when there is no inline <ol>, and whenever it changes.
data-directionstring"vertical"vertical or horizontal. Horizontal follows the writing direction.
compactboolean—Reduced spacing and node sizes (CSS only, no re-render).
data-labelstring"Flow diagram"Accessible name of the figure when there is no data-title.
data-label-selectedstring"Selected: {text}"Live-region announcement when a node is selected.
data-label-steps-one, -other, …string"{count} step" / "{count} steps"Step-count summary, chosen with Intl.PluralRules for the element's lang. Any plural category works (-zero, -two, -few, -many).
data-label-type-<type>stringStart, Action, …Spoken type prefix for each node type (“Decision: Valid credentials?”).

Direction

data-direction="horizontal" lays the flow out along the inline axis, with branches stacked beside the decision. Use it for short flows in wide containers.

Compact

The boolean compact attribute tightens node padding, sizes and connectors. It is pure CSS, so toggling it does not rebuild the diagram.

Loading from JSON

Point src at a JSON file with the same shape as the .steps property, plus an optional title that becomes data-title. Leave the element empty; the list is built from the data.

Right-to-left and localization

Layout uses logical properties: in a dir="rtl" context a horizontal flow runs right to left, the arrows point left, and the Left/Right arrow keys follow the visual order. Every generated string can be overridden with data-label-*.

Step Attributes

Each <li> in the ordered list carries these data attributes:

AttributeOnDescription
data-type<li>Node type: start, action, decision, process, wait, end
data-annotation<li>Note text displayed below the node
data-branch<li>Branch label on decision children (e.g., "Yes", "No")

Decision Branching

To create branches from a decision node, nest an <ol> inside the decision <li>. Each branch is a <li data-branch="..."> containing its own <ol> of steps. Branches can contain further decisions for nested branching.

Events

EventDetailWhen
flow-diagram:upgraded—Once after first connect. Wait for this before assigning .steps from a framework.
flow-diagram:steps-changed{ steps, source: 'property' }After .steps assignment, following that render's ready.
flow-diagram:ready{ nodeCount }After every render: initial upgrade, an observed attribute change, a src load, and each .steps assignment.
flow-diagram:select{ type, text }Node activated by click, Enter or Space.

JavaScript API

<flow-diagram> follows the HTML-first + JS-first dual-mode contract. Reactive consumers (Montane, Lit, Solid, etc.) should wait for flow-diagram:upgraded before assigning .steps.

PropertyTypeDescription
.steps Step[] Get or replace the flow. Each step is { type, text, annotation?, branches?: [{ label, steps }] }. Input is normalized (branches defaults to [], strings become action steps, malformed entries are dropped) and written into the source <ol>, so it survives later attribute changes and moves. The getter returns the normalized records.

Accessibility

  • The diagram is a <figure> named by the data-title heading (or data-label), containing a nested list: each step is a list item, each decision holds a sublist of labelled branches, annotations are plain text. The source <ol> is hidden after upgrade so nothing is read twice.
  • Each node is a <button> whose name includes its type (“Decision: Valid credentials?”); the annotation is its description.
  • The whole diagram is one tab stop. Arrow keys move between nodes in reading order (Left/Right follow the writing direction), Home/End jump to the first/last node, Enter/Space select.
  • Connectors are decorative (aria-hidden) and repaint in CanvasText under forced colors.
  • Node colours come from theme status tokens and keep AA text contrast in light and dark schemes; shape and the spoken type prefix carry the type, not colour alone.
  • A polite live region announces the selected node.

Related

↑