RoboHub

This page was generated from the source of RoboHub. Edit the source, not this page.

RoboHub UI

The look every RoboHub application shares: one stylesheet, one top bar with the
application switcher and the person's menu, one theme choice and the bar's words
in English and Romanian. The keeper, Mesh, aquarium and energy all draw their
pages with it.

Using it

deps:
  robohub:
    ui: ">=0.1.0"
include "ui"

The module needs no host hooks. It serves /ui/robohub.css, /ui/robohub.js
and /ui/theme on the application's router. A page puts ui_head() in its
<head>, ui_theme(req) in the data-theme attribute of its <html> and
class="rh" on its <body>, then draws the top bar.

The top bar

The bar is the brand, the application switcher, what the application adds in
the middle (HTML), and the person's menu.

let person: string = ui_person(req, "Ana Example", "operator",
    ui_language(locale, request_path(req)), signout, true)

ui_person(req, who, role, links, signout, themes) is the person's menu: their
initials and name, the role when one is given, the theme choice when themes
is true, the links the application adds (HTML; ui_language is the language
choice, posted to the i18n module's /i18n/locale) and signout last.

There are two ways to draw the switcher:

  • ui_topbar_in(current, apps, middle, person, locale) — the application
    knows the list. apps is one application per line,
    name|title|port|route|state. An empty port is this application, opened at
    route on this host; a port opens the application at that port on the host
    the page was reached on. The one named current is marked. The keeper draws
    its bar this way.
  • ui_topbar_remote_in(current, title, keeper_port, middle, person, locale)
    — an application that is not the keeper. The bar names the application, and
    the page's script fills the list from the keeper's /api/v1/switcher on
    keeper_port of the same host (the answer carries no credential). An
    application the keeper serves behind its own origin (a path in that answer,
    such as /app/aquarium/) is linked through the keeper, so its own port is never
    visited; otherwise it is linked at its port. Until the keeper answers, the list
    holds the way back to the keeper. Applications that include appshell get
    this bar from appshell_topbar.

ui_topbar is ui_topbar_in in the default language.

State words

A state in the switcher is shown with a coloured dot and a word.
ui_state_word(locale, state) is the word for a state in a language, and a state
it has no word for is shown as it is.

StateDotEnglishRomanian
running, keeperokrunning, keeperpornită, keeper
starting, not-builtwarnstarting, not builtpornește, neconstruită
failedbadfailedeșuată
stopped and anything elseoffstoppedoprită

Locales

The bar's own words (ui.applications, ui.theme.*, ui.language,
ui.state.*, ui.keeper) are in locales/en.json and locales/ro.json, which
travel with the module, so any application that includes it has them. The
language is the request's locale cookie (en or ro), set by the i18n
module; with none, the default language is used.

Themes

Dark is the default. /ui/theme?set=light|dark|system&back=<path> keeps the
choice in the rh_theme cookie and returns to back (only a path on this host).
A cookie belongs to the host rather than the port, so every application on the
machine opens in the same theme. Every colour in the stylesheet is a token, and
the light theme redefines the tokens only.

What the script does

/ui/robohub.js fills the links to other applications, shows times
(.local-time[data-ms]) in the reader's zone, closes an open menu when the
reader clicks elsewhere, and marks the card whose inspector is open. It runs
again after every htmx swap.

Components

ClassWhat it is
rh-top, rh-rail, rh-main, rh-stripthe shell: top bar, left rail of places, page, bottom strip
rh-split, rh-canvas, rh-insa canvas with an inspector beside it
rh-grid, rh-card (svc, int, keeper, sel, needs)a grid of things
rh-pill (ok, warn, bad, busy)the one state a card shows
rh-chips, rh-chipfilters
rh-ins-h, rh-kick, rh-tabs, rh-body, rh-row, rh-impact, rh-footthe inspector's parts
button, .quiet, .danger, .notice, .grid, tablesplain elements

Reference

Generated from the module's manifest and sources when this site was built.

Exports — what an application may call (provides.exports, imported as robohub.ui):

  • ui_head
  • ui_theme
  • ui_state_word
  • ui_person
  • ui_topbar_in
  • ui_language
  • ui_topbar_remote_in

Routes — registered on the host application's router:

MethodPathHandler
GET/ui/robohub.cssui_stylesheet
GET/ui/robohub.jsui_script
GET/ui/themeui_theme_set

Release history

All notable changes to this module are recorded here, one section per release.

[0.1.0] - 2026-11-13

The RoboHub look as a module: design tokens for a dark and a light theme (the same variables, so a theme changes colours and nothing else), the components every application draws — cards with one pill, chips, the inspector with its tabs, rows, the "applying this change" box, the strip — the top bar with the app switcher and the person's menu, and the theme a person chooses kept in a cookie every application on the host reads.

[0.1.1] - 2026-11-13

An application that is not the keeper draws the same top bar (ui_topbar_remote): its switcher fills itself from the keeper's /api/v1/switcher. The person's menu can leave the theme out for an application that has no light look yet, takes its sign-out as HTML (an application signs out at the keeper), and the language choice is shared (ui_language). An inspector can be a page of its own (rh-ins-page, with rh-crumbs above it), and its tabs no longer collapse when its body is tall.

[0.1.2] - 2026-11-13

A browser keeps the stylesheet and the script for five minutes rather than a day, and the version in their address moves with the module, so a page never runs with the look of an older release (where an inspector's tabs collapsed under a long log).

[0.1.3] - 2026-11-14

The app switcher links to an application through the keeper's origin when the keeper says so (path in its switcher list), and to its port otherwise.

[0.1.4] - 2026-11-14

The bar's own words — the Applications, Theme and Language headings, the theme names, the applications' states and the way back to the keeper — come from the module's catalogs (locales/en.json, ro.json), in the request's language: ui_topbar_in, ui_topbar_remote_in and ui_switcher_in take the locale, ui_person reads it from the request, and the old functions are the default language. The switcher shows the keeper's translated state_label.

[0.2.0] - 2026-11-14

It lists what other code may use (provides.exports, imported as robohub.ui). An application that includes it still reaches everything, and a build (rho 0.8.3) names each call to a function outside the list. The list is what the applications and modules of the ecosystem call; anything else is the module's own and may change without notice.