Register every UI icon word in the registry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWYNS1qAMRdgAtbr5Rq
This commit is contained in:
Krzysztof Rudnicki 2026-11-16 10:50:45 +01:00
parent 2df84b30b9
commit 6aa40636e7
13 changed files with 505 additions and 66 deletions

View File

@ -7,7 +7,7 @@ Part of the web control API ([DOCS-web-control-api.md](DOCS-web-control-api.md))
`GET /api/icon-words` → `IconLedger`; `POST` or `PUT /api/icon-words/{icon_id}` with `{word?, glyph?}` → `IconLedger` (200). Writes need Host, Origin and `X-SBE-Token` like every non-GET. TS mirror: `web/src/api/iconWordsContract.ts`.
- **Ledger** `web/src/ui/icon_words.json` (a repo file the user commits; `SBE_ICON_WORDS` overrides the path): `{"version":1,"icons":{"<id>":{"word":"<text>"|null,"glyph":"<emoji>"|null}}}`. Absent id = unanswered; no `word` key = only a glyph chosen; `word: null` = skipped (no label); `glyph: null` = default. The server reads it per request and never builds from it (`_web_build` ignores it); writes go to a sibling temp file, then rename.
- **Registry** `web/src/icons/registry.json`: id → default glyph, spoken name, description, 3 suggested words, 3 alternative glyphs (`registry.ts` types it).
- **Registry** `web/src/icons/registry.json`: id → default glyph, spoken name, description, 3 suggested words, 3 alternative glyphs (`registry.ts` types it). It lists every icon the UI paints, in picker order: new ids go at the end so answered icons keep their place and the picker opens at the first unanswered one. Ids match `[a-z][a-z0-9_.-]{0,63}`. `web/src/icons/coverage.test.ts` fails on any pictograph or icon symbol typed as a literal in non-test source; draw icons with `glyph(id)`, `iconInline(id)`, `iconMark(id)` or `pill(tone, text, id)`.
- **`word`**: any text; casing kept, whitespace runs collapsed; 1–40 characters, no control characters, else `invalid_params`. `null` skips. **`glyph`**: the default or one of the icon's 3 alternatives (the default is stored as `null`), else `invalid_params`. Unknown id → `not_found`; empty body or unknown key → `invalid_params`.
- Every served `.html` page carries the ledger as `<script type="application/json" id="sbe-icon-words">` (`<` escaped), so a pick shows on the next page load.
- **Corrupt ledger** (bad JSON or schema): copied to `<ledger>.corrupt` (an older copy is never overwritten) and left in place; every read and write answers `op_failed` (500) naming the copy until someone fixes it. Pages then carry that error body and draw no words.

View File

@ -0,0 +1,59 @@
"""The shipped icon registry and the user's ledger against the server's rules."""
from __future__ import annotations
import json
from pathlib import Path
import re
from typing import Any
from steam_backlog_enforcer import _web_icon_words
LEDGER_FILE = (
Path(_web_icon_words.__file__).resolve().parent.parent
/ "web"
/ "src"
/ "ui"
/ "icon_words.json"
)
# The same shape the route accepts for ``/api/icon-words/{icon}``.
ICON_ID = re.compile(r"[a-z][a-z0-9_.-]{0,63}")
VARIATION_SELECTOR = "️"
def _registry() -> dict[str, dict[str, Any]]:
return _web_icon_words.load_registry()
def _look(glyph: str) -> str:
"""The glyph without its emoji variation selector."""
return glyph.replace(VARIATION_SELECTOR, "")
def test_every_registered_id_fits_the_route() -> None:
"""A registered id the route cannot match could never be saved."""
registry = _registry()
assert len(registry) > 45
assert [i for i in registry if not ICON_ID.fullmatch(i)] == []
def test_every_entry_is_complete() -> None:
"""Each icon has a description, 3 one-word suggestions and 3 alternatives."""
for icon, entry in _registry().items():
looks = {_look(entry["glyph"]), *(_look(a) for a in entry["alts"])}
assert entry["spoken"], icon
assert len(entry["desc"]) > 20, icon
assert len({w.lower() for w in entry["words"]}) == 3, icon
assert all(re.fullmatch(r"\S+", w) for w in entry["words"]), icon
assert len(entry["alts"]) == 3, icon
assert len(looks) == 4, icon
def test_the_users_ledger_only_names_registered_icons() -> None:
"""Every ledger answer belongs to an icon, and a chosen glyph is one of its own."""
registry = _registry()
icons = json.loads(LEDGER_FILE.read_text("utf-8"))["icons"]
assert [i for i in icons if i not in registry] == []
for icon, choice in icons.items():
glyph = choice.get("glyph")
assert glyph is None or glyph in registry[icon]["alts"], icon

View File

@ -0,0 +1,56 @@
// Completeness gate for the icon words: every icon the UI paints comes from
// the registry (icons/registry.json), so the /words picker covers the whole
// UI. This scans the source, not a rendered page: a pictograph or an icon
// symbol typed as a literal in any non-test file is an unregistered icon.
// Comments are ignored; the picker's own controls and the palette's key
// hints are the only allowed literals, named below.
import { readdirSync, readFileSync } from 'node:fs'
import { join, relative } from 'node:path'
import { describe, expect, it } from 'vitest'
import { ICONS } from './registry'
const SRC = join(import.meta.dirname, '..')
/** Pictographs, plus the symbol icons the UI paints (Σ ∅ ↺ ✕ ↵ ▲ ▼ ∞ and arrows). */
const ICON_LITERAL = /\p{Extended_Pictographic}|[Σ∅↺✕↵▲▼∞←→↑↓]|'×'|\u{FE0F}/u
/** The /words picker's own controls and keyboard hints: text, not UI icons. */
const ALLOWED = ["'← back'", "'forward →'", "'↑↓ · ⏎ · ⎋'", "'↑↓ to move · Enter to run · Esc to close'","{ class: 'm0' }, '✅')"]
function sourceFiles(dir: string): string[] {
return readdirSync(dir, { recursive: true, encoding: 'utf8' })
.map((f) => join(dir, f))
.filter((f) => /\.(ts|astro)$/.test(f) && !f.endsWith('.test.ts') && !f.includes(`${join(SRC, 'test')}/`))
}
function code(text: string): string {
const noBlocks = text.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, ' ')).replace(/<!--[\s\S]*?-->/g, (m) => m.replace(/[^\n]/g, ' '))
return noBlocks.replace(/(^|\s)\/\/.*$/gm, '$1')
}
/** `file:line` of every line that paints an icon literal. */
function unregistered(): string[] {
const hits: string[] = []
for (const file of sourceFiles(SRC)) {
const lines = code(readFileSync(file, 'utf8')).split('\n')
lines.forEach((line, i) => {
const bare = ALLOWED.reduce((s, a) => s.split(a).join(''), line)
if (ICON_LITERAL.test(bare)) hits.push(`${relative(SRC, file)}:${i + 1}`)
})
}
return hits
}
describe('icon words cover the whole UI', () => {
it('no source file paints an icon outside the registry', () => {
const hits = unregistered()
expect(hits, `${hits.length} unregistered icon sites`).toEqual([])
})
it('the first 45 registry entries are the answered pass-1 icons, so the picker opens after them', () => {
const ids = ICONS.map((e) => e.id)
expect(ids.slice(0, 45).filter((id) => /^(nav|palette|cmd|job\.state|notice)\./.test(id))).toHaveLength(45)
expect(ids[44]).toBe('notice.danger')
})
})

11
web/src/icons/iconText.ts Normal file
View File

@ -0,0 +1,11 @@
// An icon as plain text, for the places that cannot hold markup: an input's
// placeholder or an <option>. The glyph (the user's alternative applied),
// then his word right of it when he chose one.
import type { IconId } from './registry'
import { iconFor } from './render'
export function iconText(id: IconId): string {
const { glyph, word } = iconFor(id)
return word ? `${glyph} ${word}` : glyph
}

View File

@ -0,0 +1,72 @@
// iconInline: the painted-only icon (no spoken text) used inside said(...),
// buttons and labels, plus the shared builders that now take ids.
import { describe, expect, it } from 'vitest'
import { useIcons } from '../test/iconLedger'
import { copyButton, empty, pill } from '../ui/build'
import { setWordsHidden } from './ledger'
import { iconInline } from './render'
describe('iconInline', () => {
it('is the glyph mark alone when there is no word', () => {
const el = iconInline('state.wait', 'x')
expect(el.textContent).toBe('⏳')
expect(el).toHaveAttribute('aria-hidden', 'true')
expect(el).toHaveAttribute('data-icon', 'state.wait')
expect(el).toHaveClass('x')
})
it('paints the chosen alternative glyph', () => {
useIcons({ 'state.wait': { word: null, glyph: '⌛' } })
expect(iconInline('state.wait').textContent).toBe('⌛')
})
it('puts the word right of the icon in one row, both aria-hidden', () => {
useIcons({ 'state.wait': { word: 'busy' } })
const el = iconInline('state.wait')
expect(el).toHaveClass('icon-inline', 'has-word')
const [icon, word] = [...el.children]
expect(icon.textContent).toBe('⏳')
expect(word).toHaveClass('icon-word')
expect(word).toHaveAttribute('aria-hidden', 'true')
expect(word.textContent).toBe('Busy')
})
it('draws no word while words are hidden', () => {
useIcons({ 'state.wait': { word: 'busy' } })
setWordsHidden(true)
expect(iconInline('state.wait').querySelector('.icon-word')).toBeNull()
setWordsHidden(false)
})
})
describe('builders that take ids', () => {
it('empty paints the empty icon and its word, the sentence stays spoken', () => {
useIcons({ 'state.empty': { word: 'nothing' } })
const el = empty('No games')
expect(el.querySelector('.empty-icon')?.textContent).toBe('📭')
expect(el.querySelector('.icon-word')?.textContent).toBe('Nothing')
expect(el.querySelector('.sr-only')?.textContent).toBe('No games')
})
it('pill paints its icon, word and spoken text', () => {
useIcons({ 'state.warn': { word: 'attention', glyph: '🟠' } })
const el = pill('warning', 'locked', 'state.warn')
expect(el.className).toBe('pill pill-warning')
expect(el.querySelector('.pill-icon')?.textContent).toBe('🟠')
expect(el.querySelector('.icon-word')?.textContent).toBe('Attention')
expect(el.querySelector('.sr-only')?.textContent).toBe('locked')
})
it('copyButton paints its icon and word, then the done icon after a copy', async () => {
useIcons({ 'copy.command': { word: 'copy' }, 'copy.done': { word: 'copied', glyph: '🎉' } })
Object.defineProperty(navigator, 'clipboard', { value: { writeText: () => Promise.resolve() }, configurable: true })
const btn = copyButton('sudo x')
expect(btn.textContent).toBe('📋Copy')
btn.click()
await Promise.resolve()
await Promise.resolve()
expect(btn.textContent).toBe('🎉Copied')
expect(btn).toHaveAttribute('aria-label', 'Copied')
})
})

View File

@ -45,6 +45,224 @@
"notice.info": { "glyph": "ℹ️", "spoken": "Information", "desc": "Mark on an information notice: a neutral fact or a hint.", "words": ["info", "note", "hint"], "alts": ["💡", "🔷", "📢"] },
"notice.success": { "glyph": "✅", "spoken": "Success", "desc": "Mark on a success notice: the action worked.", "words": ["success", "ok", "done"], "alts": ["✔️", "🎉", "👍"] },
"notice.warning": { "glyph": "⚠️", "spoken": "Warning", "desc": "Mark on a warning notice: something needs your attention, but nothing failed.", "words": ["warning", "caution", "careful"], "alts": ["🟡", "🔶", "❗"] },
"notice.danger": { "glyph": "⛔", "spoken": "Error", "desc": "Mark on an error notice: something failed or was refused. The server's message follows it.", "words": ["error", "danger", "problem"], "alts": ["🛑", "‼️", "🔴"] }
"notice.danger": { "glyph": "⛔", "spoken": "Error", "desc": "Mark on an error notice: something failed or was refused. The server's message follows it.", "words": ["error", "danger", "problem"], "alts": ["🛑", "‼️", "🔴"] },
"state.yes": { "glyph": "✅", "spoken": "Yes", "desc": "Marks a yes in a row: the thing is on, present, current or matching.", "words": ["yes", "on", "present"], "alts": ["🟢", "👍", "🆗"] },
"state.no": { "glyph": "❌", "spoken": "No", "desc": "Marks a no in a row: the thing is missing, off or does not match.", "words": ["no", "missing", "wrong"], "alts": ["🙅", "🔴", "👎"] },
"state.off": { "glyph": "➖", "spoken": "Off", "desc": "Marks an empty value in a row: off, none or not set.", "words": ["none", "off", "blank"], "alts": ["⚪", "⬜", "🕳️"] },
"state.warn": { "glyph": "⚠️", "spoken": "Needs attention", "desc": "Marks a row or label that needs attention: stale, unavailable or not ready. Nothing has failed yet.", "words": ["attention", "stale", "caution"], "alts": ["🟠", "❗", "🚧"] },
"state.wait": { "glyph": "⏳", "spoken": "Busy", "desc": "Shows that a button or row is busy: saving, sending, restarting or counting down.", "words": ["busy", "waiting", "working"], "alts": ["⌛", "💤", "🌀"] },
"state.empty": { "glyph": "📭", "spoken": "Nothing here", "desc": "Empty state: there is nothing to show yet, such as no data or no games.", "words": ["empty", "nothing", "vacant"], "alts": ["📪", "🕸️", "🫙"] },
"state.unknown": { "glyph": "❔", "spoken": "Unknown", "desc": "Unknown value: the data is missing or its kind is not recognised. It also shows a play style that is not known yet.", "words": ["unknown", "unclear", "mystery"], "alts": ["❓", "🤷", "🫥"] },
"state.locked": { "glyph": "🔒", "spoken": "Locked", "desc": "Locked: the command or action cannot run right now. The reason is read aloud.", "words": ["locked", "closed", "sealed"], "alts": ["🔐", "🚧", "⛓️"] },
"state.unlocked": { "glyph": "🔓", "spoken": "Unlocked", "desc": "Unlocked: the action is open and free to use.", "words": ["unlocked", "open", "free"], "alts": ["🗝️", "🚪", "🔑"] },
"action.cancel": { "glyph": "✖️", "spoken": "Cancel", "desc": "Button that cancels or closes the open form, dialog or countdown without doing anything.", "words": ["cancel", "close", "dismiss"], "alts": ["❌", "↩️", "🚪"] },
"action.confirm": { "glyph": "✔️", "spoken": "Confirm", "desc": "Button that confirms: it saves the form or sends the answer.", "words": ["confirm", "save", "accept"], "alts": ["✅", "💾", "👍"] },
"action.open": { "glyph": "➡️", "spoken": "Open", "desc": "Link on a card that opens the page behind it, such as the details or the full list.", "words": ["open", "details", "more"], "alts": ["↗️", "🔗", "⏩"] },
"copy.command": { "glyph": "📋", "spoken": "Copy command", "desc": "Button that copies a shell command to the clipboard. It is the way out when the UI cannot act itself.", "words": ["copy", "clipboard", "duplicate"], "alts": ["📎", "📄", "🗒️"] },
"copy.done": { "glyph": "✅", "spoken": "Copied", "desc": "Replaces the copy button for two seconds after the copy worked.", "words": ["copied", "done", "saved"], "alts": ["✔️", "👌", "🎉"] },
"dash.ago": { "glyph": "🕓", "spoken": "Ago", "desc": "Shown before a time span that says how long ago something happened, such as a recent job or the live verdict.", "words": ["ago", "age", "since"], "alts": ["🕰️", "⏰", "📆"] },
"dash.finished": { "glyph": "🏆", "spoken": "Games finished", "desc": "Marks the number of games you finished with every achievement. It labels the dashboard row and the base of your pace estimate.", "words": ["finished", "trophies", "completed"], "alts": ["🥇", "🎖️", "🏁"] },
"dash.store": { "glyph": "🛒", "spoken": "Store", "desc": "Row label on the dashboard: whether the Steam store is blocked right now.", "words": ["store", "shop", "market"], "alts": ["🏪", "🛍️", "🧾"] },
"dash.store-blocked": { "glyph": "🔒", "spoken": "Store blocked", "desc": "Value of the store row on the dashboard: the Steam store is blocked.", "words": ["blocked", "closed", "shut"], "alts": ["🚫", "🔐", "🚧"] },
"dash.store-open": { "glyph": "🔓", "spoken": "Store unblocked", "desc": "Value of the store row on the dashboard: the Steam store is unblocked for now. It blocks itself again later.", "words": ["open", "unblocked", "free"], "alts": ["🟢", "🚪", "🗝️"] },
"dash.games": { "glyph": "🗂️", "spoken": "Installed games", "desc": "Row label on the dashboard: how many games are installed on this PC.", "words": ["games", "library", "count"], "alts": ["🎮", "📦", "🗃️"] },
"dash.total-block": { "glyph": "⛔", "spoken": "Total block", "desc": "Row label on the dashboard: the total gaming block. While it is active the row counts down the time left.", "words": ["block", "ban", "lockdown"], "alts": ["🚷", "🧱", "📵"] },
"picks.manual": { "glyph": "📌", "spoken": "Manual picks", "desc": "Marks your manual picks, the games you locked in by hand. It heads the picks card and labels the dashboard row.", "words": ["manual", "pinned", "chosen"], "alts": ["📍", "🧷", "🖐️"] },
"assigned.game": { "glyph": "🎯", "spoken": "Assigned game", "desc": "Marks the game assigned to you. It heads the assignment card, tags the game in the library and sits beside the live verdict.", "words": ["assigned", "target", "current"], "alts": ["🏹", "🥅", "⭐"] },
"dash.block-left": { "glyph": "⏳", "spoken": "Time left", "desc": "Time left on the total gaming block, shown as a countdown.", "words": ["left", "remaining", "countdown"], "alts": ["⌛", "⏲️", "🕰️"] },
"dash.budget": { "glyph": "⏱️", "spoken": "Gaming today", "desc": "Heading of the budget card on the dashboard. It shows how much gaming time is left today.", "words": ["budget", "timer", "allowance"], "alts": ["⏲️", "🕹️", "🪙"] },
"dash.blocked-today": { "glyph": "⛔", "spoken": "Blocked for today", "desc": "Shown on the budget card when gaming is blocked for the rest of the day.", "words": ["blocked", "banned", "stopped"], "alts": ["🚫", "🛑", "🔴"] },
"dash.not-billing": { "glyph": "⏸️", "spoken": "Nothing billing", "desc": "Shown while no game is running, so no gaming time is used. It marks the budget line and the live verdict.", "words": ["idle", "paused", "resting"], "alts": ["⏯️", "💤", "🟦"] },
"dash.billing": { "glyph": "▶️", "spoken": "Billing now", "desc": "Shown while a game is running and its time counts against today's budget. It marks the budget line and the live verdict.", "words": ["playing", "billing", "counting"], "alts": ["⏺️", "🔴", "🎮"] },
"dash.fast-failed": { "glyph": "⛔", "spoken": "Fast install failed", "desc": "A fast install failed. The daemon's own message follows it.", "words": ["failed", "error", "broken"], "alts": ["💥", "❌", "🔴"] },
"dash.steam-took-over": { "glyph": "↪️", "spoken": "Steam took over", "desc": "Note under a failed fast install: Steam's own download took over.", "words": ["fallback", "handover", "detour"], "alts": ["↩️", "🔀", "🔁"] },
"dash.fast-install": { "glyph": "⚡", "spoken": "Fast install", "desc": "A fast install is running. It heads the fast install card and marks each running download.", "words": ["fast", "turbo", "quick"], "alts": ["🚀", "💨", "⏩"] },
"dash.elapsed": { "glyph": "⏳", "spoken": "Elapsed", "desc": "Time a fast install has been running so far.", "words": ["elapsed", "running", "duration"], "alts": ["⌛", "🕐", "⏱️"] },
"dash.recent-jobs": { "glyph": "⚙️", "spoken": "Recent jobs", "desc": "Heading of the recent jobs card on the dashboard. It lists the last five jobs with their state.", "words": ["jobs", "recent", "history"], "alts": ["🛠️", "📜", "🗒️"] },
"dash.outlook": { "glyph": "📚", "spoken": "Backlog outlook", "desc": "Heading of the backlog outlook card on the dashboard: the planner summary at the default filters.", "words": ["backlog", "outlook", "forecast"], "alts": ["📖", "🔮", "🗓️"] },
"picks.age": { "glyph": "🕐", "spoken": "Picked days ago", "desc": "Marks how many days ago a manual pick was made. The app id follows it.", "words": ["picked", "age", "days"], "alts": ["📆", "🕰️", "⏳"] },
"picks.kept": { "glyph": "📌", "spoken": "Kept", "desc": "Marks a pick that was released but kept: the game stays installed and playable.", "words": ["kept", "released", "spared"], "alts": ["📎", "💚", "🔖"] },
"store.blocked": { "glyph": "🛒🔒", "spoken": "Store blocked", "desc": "Notice on the store page: the Steam store is blocked. Unblocking takes a typed phrase and lasts at most 30 minutes.", "words": ["blocked", "closed", "sealed"], "alts": ["🚫", "🔐", "🛑"] },
"store.open": { "glyph": "🛒🔓", "spoken": "Store unblocked", "desc": "Notice on the store page: the Steam store is open right now. It blocks itself again after the timer runs out.", "words": ["open", "unblocked", "live"], "alts": ["🏪", "🟢", "🚪"] },
"setup.help": { "glyph": "🔗", "spoken": "Where to get it", "desc": "Link next to a setup field that opens the page where you get the value.", "words": ["link", "source", "help"], "alts": ["🌍", "🧭", "📎"] },
"setup.key-stored": { "glyph": "🔒", "spoken": "Key stored", "desc": "Shown when the Steam API key is already stored, in the setup field and the system row. The key stays hidden, and typing a new key replaces it.", "words": ["stored", "saved", "secret"], "alts": ["🔐", "🗝️", "🛡️"] },
"setup.api-key": { "glyph": "🔑", "spoken": "Steam Web API key", "desc": "Marks the Steam Web API key: the field on the setup page where you paste it, and the system row that shows if one is stored.", "words": ["key", "token", "secret"], "alts": ["🗝️", "🔐", "🪪"] },
"setup.steam-id": { "glyph": "🆔", "spoken": "SteamID64", "desc": "Marks the SteamID: the field on the setup page for your 17-digit profile number, and the system row that shows it.", "words": ["id", "profile", "account"], "alts": ["🪪", "👤", "🔢"] },
"libpage.all": { "glyph": "🗂️", "spoken": "All games", "desc": "Switch on the library page that shows every game you own as a cover grid.", "words": ["all", "covers", "owned"], "alts": ["🖼️", "🧩", "🗃️"] },
"libpage.game": { "glyph": "🎮", "spoken": "Game", "desc": "Marks a game: the game column of the installed table and the number of installed games.", "words": ["game", "title", "count"], "alts": ["🕹️", "👾", "🃏"] },
"libpage.app-id": { "glyph": "#", "spoken": "App id", "desc": "Header of the app id column in the installed table: the Steam number of each game.", "words": ["number", "appid", "index"], "alts": ["🔢", "🆔", "🔖"] },
"libpage.size": { "glyph": "💽", "spoken": "Size", "desc": "Size on disk: the size column header and the total of all installed games.", "words": ["size", "space", "disk"], "alts": ["📏", "🧮", "⚖️"] },
"libpage.role": { "glyph": "🏷️", "spoken": "Role", "desc": "Header of the role column in the installed table: whether a game is assigned, protected or removable.", "words": ["role", "status", "tag"], "alts": ["🔖", "🎭", "🪪"] },
"libpage.protected": { "glyph": "🛡️", "spoken": "Protected", "desc": "Tags an installed game that is protected, so uninstall never removes it.", "words": ["protected", "safe", "shielded"], "alts": ["🔰", "🔐", "🧱"] },
"libpage.candidate": { "glyph": "🗑️", "spoken": "Uninstall candidate", "desc": "Marks an installed game that is neither assigned nor protected, so uninstall would remove it.", "words": ["removable", "trash", "surplus"], "alts": ["🧹", "♻️", "🪣"] },
"jobs.command": { "glyph": "⌨️", "spoken": "Command", "desc": "Header of the command column in the job history.", "words": ["command", "action", "task"], "alts": ["💻", "🔤", "🧰"] },
"jobs.state": { "glyph": "🚦", "spoken": "State", "desc": "Header of the state column in the job history: queued, running, finished or failed.", "words": ["state", "status", "outcome"], "alts": ["🟢", "📶", "🚥"] },
"jobs.started": { "glyph": "🕐", "spoken": "Started", "desc": "When a job started: the started column of the job history and the created time on a job page.", "words": ["started", "created", "when"], "alts": ["🕒", "📅", "🕰️"] },
"jobs.took": { "glyph": "⏱️", "spoken": "Took", "desc": "Header of the duration column in the job history: how long each job ran.", "words": ["took", "duration", "length"], "alts": ["⏲️", "⌛", "📏"] },
"jobs.not-found": { "glyph": "❓", "spoken": "Job not found", "desc": "Marks a job page whose id does not exist. The history keeps only the last 50 jobs.", "words": ["missing", "unknown", "gone"], "alts": ["❔", "🔍", "🕳️"] },
"jobs.all": { "glyph": "📋", "spoken": "All jobs", "desc": "Link to the job history list, shown on a job page and on a missing job.", "words": ["all", "list", "history"], "alts": ["📜", "🗒️", "📚"] },
"jobs.job": { "glyph": "⚙️", "spoken": "Job", "desc": "Heading of a job page while the job loads.", "words": ["job", "task", "work"], "alts": ["🔧", "🛠️", "🧰"] },
"jobs.waiting": { "glyph": "⏳", "spoken": "Waiting for you", "desc": "Phase mark on a job page when the job waits for your answer.", "words": ["waiting", "paused", "pending"], "alts": ["⌛", "✋", "💤"] },
"jobs.cancel": { "glyph": "✕", "spoken": "Cancel job", "desc": "Button on a running job that asks it to stop. It appears only for jobs that can be cancelled.", "words": ["stop", "cancel", "abort"], "alts": ["🛑", "⏹️", "✖️"] },
"jobs.log": { "glyph": "📋", "spoken": "Log", "desc": "Marks the job log: it shows the number of log lines and opens the log.", "words": ["log", "lines", "output"], "alts": ["📜", "📄", "🧾"] },
"prompt.question": { "glyph": "❓", "spoken": "Job question", "desc": "Marks a question a job asks you. The job waits until you answer.", "words": ["question", "ask", "prompt"], "alts": ["❔", "💬", "🙋"] },
"prompt.own-game": { "glyph": "🗂️", "spoken": "Choose your own game", "desc": "Choice in a job question that lets you pick any game from your library instead of the offered ones.", "words": ["own", "browse", "other"], "alts": ["🔎", "📂", "🎮"] },
"prompt.yes": { "glyph": "✔️", "spoken": "Yes", "desc": "Button that answers yes to a job question.", "words": ["yes", "accept", "agree"], "alts": ["✅", "👍", "🆗"] },
"prompt.no": { "glyph": "✖️", "spoken": "No", "desc": "Button that answers no to a job question.", "words": ["no", "decline", "refuse"], "alts": ["❌", "👎", "🚫"] },
"prompt.answer": { "glyph": "↵", "spoken": "Answer", "desc": "Button that sends your answer to a job question. The Enter key does the same.", "words": ["send", "answer", "submit"], "alts": ["⏎", "📤", "➡️"] },
"prompt.back": { "glyph": "↩️", "spoken": "Back to the list", "desc": "Button that returns from the game picker to the previous question of the job.", "words": ["back", "return", "previous"], "alts": ["◀️", "⬅️", "🔙"] },
"prompt.games": { "glyph": "🎮", "spoken": "Games to pick from", "desc": "Shows how many games a job offers to pick from in a game question.", "words": ["choices", "games", "options"], "alts": ["🕹️", "🔢", "🧮"] },
"prompt.pick": { "glyph": "🎯", "spoken": "Pick this game", "desc": "Button that sends the game you selected as the answer. It shows the game name once you select one.", "words": ["pick", "select", "choose"], "alts": ["🏹", "✅", "📌"] },
"jobchip.needs-input": { "glyph": "✋", "spoken": "Needs input", "desc": "Shown on a job chip in the top bar when the job waits for your answer.", "words": ["answer", "halt", "hand"], "alts": ["🙋", "🔔", "🛑"] },
"dash.installed": { "glyph": "💾", "spoken": "Installed", "desc": "Marks a game that is installed on this PC. It labels the dashboard row, the library filter and table, and the badge on a game.", "words": ["installed", "disk", "local"], "alts": ["📥", "🗃️", "🖥️"] },
"gaming.series.other": { "glyph": "➕", "spoken": "Other games", "desc": "Legend and list entry that groups the many small games of the chart into one segment.", "words": ["other", "rest", "remainder"], "alts": ["🧩", "🗃️", "🔢"] },
"gaming.series.unattributed": { "glyph": "❔", "spoken": "Unattributed", "desc": "Legend entry for gaming time that no single game could be charged for.", "words": ["unattributed", "unclaimed", "orphan"], "alts": ["🫥", "🕳️", "👻"] },
"gaming.launcher": { "glyph": "🚀", "spoken": "Launcher", "desc": "Marks a game launcher such as a store client. It also labels the rule that counts launcher time against the budget.", "words": ["launcher", "client", "starter"], "alts": ["🛫", "🛸", "🏁"] },
"gaming.cutoff.masked": { "glyph": "⛔🔒", "spoken": "Cutoff, launchers masked", "desc": "Badge on a blocked day: the cutoff is engaged and the launchers are masked, so no game can start.", "words": ["cutoff", "masked", "sealed"], "alts": ["🚫🔒", "🛑🔐", "⛓️"] },
"gaming.cutoff.unmasked": { "glyph": "⛔🔓", "spoken": "Cutoff, launchers not masked", "desc": "Badge on a blocked day: the cutoff is engaged but no launcher is masked right now. That happens after a total block released the mounts.", "words": ["unmasked", "exposed", "leaking"], "alts": ["🚫🔓", "🛑🔓", "🪟"] },
"gaming.warn.none": { "glyph": "🔕", "spoken": "No more warnings", "desc": "Shows that no further warning fires today. The enforcer has already sent the last one.", "words": ["silent", "quiet", "muted"], "alts": ["🤫", "🔇", "💤"] },
"gaming.warning": { "glyph": "🔔", "spoken": "Warning", "desc": "The time of the next warning on today's card and the warning times in the rules card. The enforcer warns you when the remaining budget reaches them.", "words": ["warning", "alarm", "bell"], "alts": ["⏰", "📣", "🚨"] },
"gaming.day": { "glyph": "📅", "spoken": "Gaming day", "desc": "The date of the gaming day that today's budget belongs to.", "words": ["date", "day", "calendar"], "alts": ["🗓️", "📆", "📖"] },
"gaming.day_start": { "glyph": "🌅", "spoken": "Day starts", "desc": "The local time when the gaming day rolls over and the budget refills.", "words": ["sunrise", "rollover", "refill"], "alts": ["🌄", "⏰", "🔁"] },
"gaming.by_game": { "glyph": "🎮", "spoken": "Today by game", "desc": "Heading of the list that splits today's billed time by game.", "words": ["games", "split", "breakdown"], "alts": ["🕹️", "🎲", "👾"] },
"gaming.right_now": { "glyph": "📡", "spoken": "Right now", "desc": "Heading of the live card with the daemon's latest verdict on what the budget is charging.", "words": ["live", "now", "verdict"], "alts": ["📶", "🛰️", "🔴"] },
"gaming.qualifying": { "glyph": "⚙️", "spoken": "Qualifying processes", "desc": "The number of running processes that count as gaming and bill the budget.", "words": ["processes", "counted", "running"], "alts": ["🧮", "🔢", "🧩"] },
"gaming.billing_to": { "glyph": "💸", "spoken": "Billing to", "desc": "Names the game or launcher that the budget is charging right now.", "words": ["charging", "spending", "cost"], "alts": ["💰", "🪙", "💳"] },
"gaming.billed_last": { "glyph": "⏮️💸", "spoken": "Last billed to", "desc": "Names the game or launcher that was charged last, once nothing qualifies any more.", "words": ["previous", "last", "former"], "alts": ["🧾", "⏪💸", "📜"] },
"gaming.history": { "glyph": "📊", "spoken": "Last 14 days", "desc": "Heading of the chart with the billed gaming time of each of the last 14 days.", "words": ["history", "chart", "trend"], "alts": ["📈", "🗓️", "📉"] },
"gaming.rules": { "glyph": "📏", "spoken": "Rules in effect", "desc": "Heading of the card that lists the budget rules the enforcer applies right now.", "words": ["rules", "limits", "policy"], "alts": ["📐", "📜", "⚖️"] },
"gaming.budget": { "glyph": "⏱️", "spoken": "Daily budget", "desc": "Row label for how much gaming time one day allows.", "words": ["budget", "allowance", "quota"], "alts": ["⏲️", "🪙", "⌛"] },
"gaming.enforcement": { "glyph": "🛡️", "spoken": "Enforcement", "desc": "Row label that shows whether the enforcer cuts off gaming when the budget runs out.", "words": ["enforcement", "guard", "cutoff"], "alts": ["⚔️", "🚔", "🧱"] },
"gaming.mode": { "glyph": "🧪", "spoken": "Mode", "desc": "Row label for the budget mode, the real one or the demo.", "words": ["mode", "variant", "setting"], "alts": ["🎚️", "🔀", "🧭"] },
"gaming.demo": { "glyph": "🧪", "spoken": "Demo budget", "desc": "Marks the short demo budget with its separate state. As a link it switches the page to that demo.", "words": ["demo", "trial", "sandbox"], "alts": ["🔬", "🎬", "🧫"] },
"gaming.masked": { "glyph": "🔒", "spoken": "Masked launchers", "desc": "Row label that lists the launchers masked right now, so that they cannot start.", "words": ["masked", "hidden", "sealed"], "alts": ["🎭", "🚫", "🕶️"] },
"gaming.production": { "glyph": "🏭", "spoken": "Production budget", "desc": "Link shown on the demo page that switches back to the real daily budget.", "words": ["production", "real", "live"], "alts": ["🏢", "🌍", "🔙"] },
"daemon.heading": { "glyph": "🛡️", "spoken": "Enforcer daemon", "desc": "The root daemon that enforces the rules. It heads the daemon card and is the daemon badge in the top bar.", "words": ["daemon", "guard", "root"], "alts": ["🔐", "👮", "🏰"] },
"daemon.demo_run": { "glyph": "🧪", "spoken": "Demo run", "desc": "Button that opens the runner for a 60-second demo of the enforcer with a short budget.", "words": ["demo", "trial", "rehearsal"], "alts": ["🎬", "🔬", "🎭"] },
"daemon.journal": { "glyph": "📜", "spoken": "Journal", "desc": "Heading of the live tail of the daemon's log.", "words": ["journal", "log", "history"], "alts": ["📓", "🧾", "📰"] },
"daemon.state": { "glyph": "📡", "spoken": "State", "desc": "Row label for the daemon's current state.", "words": ["state", "status", "signal"], "alts": ["📶", "🩺", "🚦"] },
"daemon.running": { "glyph": "🟢", "spoken": "Running", "desc": "Daemon state: the daemon is up and answers.", "words": ["running", "alive", "up"], "alts": ["💚", "🔋", "👍"] },
"daemon.restarting": { "glyph": "🔄", "spoken": "Restarting", "desc": "Daemon state: the daemon is restarting and answers again in a moment.", "words": ["restarting", "cycling", "rebooting"], "alts": ["🔁", "🌀", "🟡"] },
"daemon.unreachable": { "glyph": "🔴", "spoken": "Unreachable", "desc": "Daemon state: the daemon does not answer, so the privileged actions are unavailable.", "words": ["unreachable", "down", "dead"], "alts": ["⚫", "💀", "📵"] },
"daemon.pid": { "glyph": "#️⃣", "spoken": "PID", "desc": "Row label for the process number of the running daemon.", "words": ["process", "number", "pid"], "alts": ["🔢", "🆔", "🪪"] },
"daemon.up_since": { "glyph": "⏱️", "spoken": "Up since", "desc": "Row label for how long the daemon has been running.", "words": ["uptime", "since", "age"], "alts": ["🕰️", "⏲️", "📆"] },
"daemon.restart": { "glyph": "🔄", "spoken": "Restart daemon", "desc": "Button that restarts the root daemon. A rate limit allows it only now and then.", "words": ["restart", "reload", "cycle"], "alts": ["🔁", "♻️", "⚡"] },
"server.heading": { "glyph": "🌐", "spoken": "Web server", "desc": "The web server that serves this UI. It heads the server card and is the server badge in the top bar.", "words": ["server", "web", "host"], "alts": ["🕸️", "📶", "🔌"] },
"server.version": { "glyph": "🏷️", "spoken": "Version", "desc": "Row label for the version of the running web server.", "words": ["version", "build", "release"], "alts": ["🔢", "🔖", "📦"] },
"server.started": { "glyph": "🕒", "spoken": "Started", "desc": "Row label for the time the web server process started.", "words": ["started", "launched", "since"], "alts": ["🕐", "⏰", "🚦"] },
"server.code": { "glyph": "💾", "spoken": "Code", "desc": "Row label that compares the code on disk with the running server. A warning means the server runs old code.", "words": ["code", "source", "files"], "alts": ["💻", "📝", "🧬"] },
"server.restart": { "glyph": "🔄", "spoken": "Restart server", "desc": "Button that restarts the web server, on the server card and in the stale-server banner. The page reloads when the server is back.", "words": ["restart", "reload", "refresh"], "alts": ["🔁", "♻️", "🚀"] },
"backup.item": { "glyph": "🗄️", "spoken": "Backup", "desc": "Heading of the card with the saved state backups, and the mark in front of one backup in the restore dialog.", "words": ["backup", "archive", "snapshot"], "alts": ["🗃️", "📦", "💿"] },
"backup.reason.reset": { "glyph": "♻️", "spoken": "Before reset", "desc": "Reason mark: the backup was taken right before a reset wiped the state.", "words": ["reset", "wipe", "recycle"], "alts": ["🧹", "🔁", "💣"] },
"backup.reason.nightly": { "glyph": "🌙", "spoken": "Nightly", "desc": "Reason mark: the backup was taken by the nightly timer.", "words": ["nightly", "scheduled", "night"], "alts": ["🌛", "🌃", "⭐"] },
"backup.reason.other": { "glyph": "🗄️", "spoken": "Other reason", "desc": "Reason mark for a backup whose reason the UI does not know.", "words": ["other", "unlabelled", "misc"], "alts": ["📁", "🧾", "🔖"] },
"backup.restore": { "glyph": "⏮️", "spoken": "Restore", "desc": "Button that restores the state from a backup. It first asks for a typed phrase.", "words": ["restore", "rewind", "rollback"], "alts": ["⏪", "↩️", "🔙"] },
"syssetup.configured": { "glyph": "⚙️", "spoken": "Configured", "desc": "Row label that shows whether setup is complete.", "words": ["configured", "ready", "complete"], "alts": ["🛠️", "🔩", "🎛️"] },
"syssetup.edit": { "glyph": "✏️", "spoken": "Open setup", "desc": "Link that opens the setup page, where the key and the SteamID can be changed.", "words": ["edit", "change", "pencil"], "alts": ["🖊️", "📝", "🧰"] },
"gaming.today": { "glyph": "📅", "spoken": "Today", "desc": "Heading of the card with today's budget numbers on the gaming page.", "words": ["today", "day", "budget"], "alts": ["🗓️", "📆", "🌞"] },
"basis.rush": { "glyph": "🐇", "spoken": "Rush", "desc": "Rush estimate: how long the games take at a fast completionist pace. It is a choice in the filter panel, a card in the summary and a column in the table.", "words": ["rush", "fast", "sprint"], "alts": ["🐎", "🚀", "🏃"] },
"basis.leisure": { "glyph": "🐢", "spoken": "Leisure", "desc": "Leisure estimate: how long the games take at a slow, comfortable pace. It is a choice in the filter panel, a card in the summary and a column in the table.", "words": ["leisure", "slow", "relaxed"], "alts": ["🦥", "🧘", "🛋️"] },
"basis.worst": { "glyph": "🐌", "spoken": "Worst case", "desc": "Worst-case estimate: the longest time anyone has recorded for each game. It is a choice in the filter panel, a card in the summary and a column in the table.", "words": ["worst", "longest", "maximum"], "alts": ["🐘", "🧱", "🕰️"] },
"basis.pace": { "glyph": "👤", "spoken": "Your pace", "desc": "Your own pace: the estimate built from how fast you finished games before. It marks the pace choice, the pace card and your play-style block.", "words": ["pace", "yours", "personal"], "alts": ["🙋", "🧍", "🪞"] },
"style.fast": { "glyph": "⚡", "spoken": "Faster than HLTB rush", "desc": "Play style: you finish games faster than the fast times on HowLongToBeat.", "words": ["fast", "speedy", "quick"], "alts": ["🚀", "💨", "🏎️"] },
"style.between": { "glyph": "🐇↔🐢", "spoken": "Between rush and leisure", "desc": "Play style: your pace sits between the rush and leisure times on HowLongToBeat.", "words": ["between", "average", "typical"], "alts": ["⚖️", "🔀", "↔️"] },
"style.slow": { "glyph": "🐌", "spoken": "Slower than HLTB leisure", "desc": "Play style: you finish games slower than the slow leisure times on HowLongToBeat.", "words": ["slow", "careful", "thorough"], "alts": ["🦥", "🪨", "🛌"] },
"tier.native": { "glyph": "⭐", "spoken": "Native", "desc": "ProtonDB tier native: the game runs on Linux without Proton. It shows in the tier column and the tier filters.", "words": ["native", "linux", "built-in"], "alts": ["🌟", "✨", "🎖️"] },
"tier.platinum": { "glyph": "💎", "spoken": "Platinum", "desc": "ProtonDB tier platinum: the game runs perfectly under Proton out of the box. It shows in the tier column and the tier filters.", "words": ["platinum", "perfect", "flawless"], "alts": ["💠", "🔷", "👑"] },
"tier.gold": { "glyph": "🥇", "spoken": "Gold", "desc": "ProtonDB tier gold: the game runs perfectly after small tweaks. It shows in the tier column and the tier filters.", "words": ["gold", "great", "tweaked"], "alts": ["🏅", "🟡", "👍"] },
"tier.silver": { "glyph": "🥈", "spoken": "Silver", "desc": "ProtonDB tier silver: the game is playable with minor issues. It shows in the tier column and the tier filters.", "words": ["silver", "playable", "minor"], "alts": ["⚪", "🔘", "🪙"] },
"tier.bronze": { "glyph": "🥉", "spoken": "Bronze", "desc": "ProtonDB tier bronze: the game runs but with frequent problems. It shows in the tier column and the tier filters.", "words": ["bronze", "rough", "shaky"], "alts": ["🟤", "🔶", "🪵"] },
"tier.borked": { "glyph": "💥", "spoken": "Borked", "desc": "ProtonDB tier borked: the game does not run at all. It shows in the tier column and the tier filters.", "words": ["borked", "broken", "unplayable"], "alts": ["💀", "🧨", "☠️"] },
"tier.pending": { "glyph": "⏳", "spoken": "Pending", "desc": "ProtonDB tier pending: there are not enough reports to rate the game yet. It shows in the tier column and the tier filters.", "words": ["pending", "unrated", "waiting"], "alts": ["⌛", "🕓", "🔜"] },
"keep.kept": { "glyph": "📌", "spoken": "Kept", "desc": "Value of the keep filter: the game stays in the plan. Choosing it shows only the kept games.", "words": ["kept", "pinned", "included"], "alts": ["📍", "🔖", "🧷"] },
"keep.excluded": { "glyph": "🚫", "spoken": "Excluded", "desc": "Value of the keep filter: you took the game out of the plan. Choosing it shows only the dropped games.", "words": ["excluded", "dropped", "skipped"], "alts": ["🙅", "🗑️", "✂️"] },
"backlog.any": { "glyph": "✱", "spoken": "Any", "desc": "Any value: in a filter it sets no limit and shows every game.", "words": ["any", "all", "everything"], "alts": ["✳️", "🌐", "♾️"] },
"backlog.cli": { "glyph": "⌨️", "spoken": "CLI default", "desc": "Stands for the command-line tool's own rule. It marks the playable rule, the default game count and what reset restores.", "words": ["cli", "terminal", "default"], "alts": ["💻", "🖥️", "📟"] },
"filter.reset": { "glyph": "↺", "spoken": "Reset to CLI defaults", "desc": "Button in the filter panel that sets every filter back to the CLI defaults.", "words": ["reset", "restore", "defaults"], "alts": ["🔃", "↩️", "🧹"] },
"filter.min-tier": { "glyph": "🥇≥", "spoken": "Min tier", "desc": "Choice of the ProtonDB filter: keep games at or above a minimum tier that you pick.", "words": ["minimum", "tier", "threshold"], "alts": ["🥇+", "🪜", "⬆️"] },
"filter.started": { "glyph": "▶️", "spoken": "Started", "desc": "Choice of the playtime filter: only games you have already started.", "words": ["started", "played", "begun"], "alts": ["🕹️", "⏯️", "🟢"] },
"filter.untouched": { "glyph": "∅", "spoken": "Untouched", "desc": "Choice of the playtime filter: only games with no playtime at all.", "words": ["untouched", "unplayed", "fresh"], "alts": ["🆕", "🧼", "⭕"] },
"filter.daily": { "glyph": "⏰", "spoken": "Daily play time", "desc": "Slider for how many hours you play each day. The time estimates divide by it.", "words": ["daily", "hours", "schedule"], "alts": ["🕰️", "⌚", "📆"] },
"planner.completions": { "glyph": "#", "spoken": "HLTB completions", "desc": "How many completion times HowLongToBeat holds for a game. It is a table column and the minimum slider in the filter panel.", "words": ["completions", "polled", "count"], "alts": ["🔢", "🧮", "🗳️"] },
"filter.min-polled": { "glyph": "💯", "spoken": "Min polled completionist times", "desc": "Slider for the fewest polled completionist times a game needs to count.", "words": ["polled", "completionist", "hundred"], "alts": ["💮", "🧪", "🔟"] },
"filter.min-confidence": { "glyph": "Σ", "spoken": "Min confidence sum", "desc": "Slider for the minimum confidence sum, the total weight of the time reports behind an estimate.", "words": ["confidence", "weight", "sum"], "alts": ["🧮", "➕", "🪙"] },
"filter.max-time": { "glyph": "⏳", "spoken": "Max time per game", "desc": "Slider for the longest game you accept. Longer games are hidden.", "words": ["cap", "longest", "limit"], "alts": ["⌛", "⏲️", "🛑"] },
"filter.no-cap": { "glyph": "∞", "spoken": "No cap", "desc": "Shown in place of the hours when the time cap is off.", "words": ["unlimited", "endless", "uncapped"], "alts": ["♾️", "🌌", "🔓"] },
"filter.fallback": { "glyph": "❓", "spoken": "Fallback estimate", "desc": "Slider for the hours guessed for games that have no time data.", "words": ["guess", "fallback", "default"], "alts": ["🎲", "🤔", "📏"] },
"filter.basis": { "glyph": "📐", "spoken": "Estimate basis", "desc": "Heading of the estimate-basis choice: rush, leisure, worst case or your pace.", "words": ["basis", "model", "method"], "alts": ["📏", "🧭", "🧮"] },
"filter.advanced": { "glyph": "🔬", "spoken": "Advanced confidence", "desc": "Heading of the folded advanced confidence settings. Opening it shows two more sliders.", "words": ["advanced", "expert", "details"], "alts": ["🧪", "🔭", "🛠️"] },
"planner.proton": { "glyph": "🐧", "spoken": "ProtonDB", "desc": "ProtonDB: how well a game runs on Linux. It heads the compatibility filter and the table column.", "words": ["proton", "linux", "compatibility"], "alts": ["🍷", "🧩", "💻"] },
"filter.proton-missing": { "glyph": "❓", "spoken": "Keep games with no ProtonDB data", "desc": "Checkbox in the compatibility filter: keep games that have no ProtonDB data in the list.", "words": ["unrated", "unknown", "missing"], "alts": ["🤷", "🫥", "🌫️"] },
"planner.playtime": { "glyph": "⏱", "spoken": "Playtime", "desc": "Your playtime in a game. It heads the playtime filter and the table column.", "words": ["playtime", "hours", "played"], "alts": ["⌛", "🕒", "📈"] },
"planner.no-data": { "glyph": "❓", "spoken": "No HLTB data", "desc": "Badge on a game that has no HowLongToBeat data. The checkbox with the same mark includes such games, using the fallback hours.", "words": ["blank", "unmeasured", "unrated"], "alts": ["🫥", "🕳️", "🚧"] },
"filter.target-date": { "glyph": "🏁", "spoken": "Target finish date", "desc": "Target finish date: the filter's date field and the by-date marker in the banner. It turns hours into the daily pace you need.", "words": ["deadline", "target", "finish"], "alts": ["🎌", "🗓️", "🚩"] },
"filter.clear-date": { "glyph": "✕", "spoken": "Clear", "desc": "Button that clears the target finish date.", "words": ["clear", "erase", "remove"], "alts": ["✖️", "🧽", "⌫"] },
"backlog.sort-asc": { "glyph": "▲", "spoken": "Ascending", "desc": "Marks the table column that is sorted from low to high.", "words": ["ascending", "up", "lowest"], "alts": ["🔼", "⬆️", "📈"] },
"backlog.sort-desc": { "glyph": "▼", "spoken": "Descending", "desc": "Marks the table column that is sorted from high to low.", "words": ["descending", "down", "highest"], "alts": ["🔽", "⬇️", "📉"] },
"planner.game": { "glyph": "🎮", "spoken": "Game", "desc": "Table column with the game names. Clicking its header sorts by name.", "words": ["game", "title", "name"], "alts": ["🕹️", "🎲", "🔤"] },
"planner.completion": { "glyph": "%", "spoken": "Completion", "desc": "Table column with each game's achievement completion in percent.", "words": ["completion", "progress", "percent"], "alts": ["📶", "🧩", "📏"] },
"planner.keep": { "glyph": "📌", "spoken": "Keep", "desc": "Table column with the checkbox that keeps a game in the plan or drops it.", "words": ["keep", "include", "toggle"], "alts": ["📍", "☑️", "🔖"] },
"summary.to-finish": { "glyph": "🎮", "spoken": "To finish", "desc": "Banner on the backlog page: how many games are left to finish by your target date.", "words": ["remaining", "left", "games"], "alts": ["🕹️", "🎲", "🎯"] },
"summary.games-per-day": { "glyph": "🎮", "spoken": "Games per day", "desc": "Unit on the pace card and banner: games finished per day. It follows the number.", "words": ["rate", "speed", "tempo"], "alts": ["🕹️", "🎲", "🏃"] },
"backlog.in-scope": { "glyph": "🎮", "spoken": "Games in scope", "desc": "Count of games that pass the filters. It sits beside the big number in the summary and in the stats card.", "words": ["scope", "qualifying", "matching"], "alts": ["🧮", "🎲", "📚"] },
"summary.need": { "glyph": "→", "spoken": "You need", "desc": "Arrow in the target banner between the chosen model and the daily time you need.", "words": ["needs", "requires", "equals"], "alts": ["➡️", "⇨", "👉"] },
"summary.no-start": { "glyph": "∅", "spoken": "No start date set", "desc": "Shown on the pace card when no start date is set, so there is no finish date.", "words": ["unset", "empty", "undated"], "alts": ["⭕", "🕳️", "🗓️"] },
"summary.style": { "glyph": "🎭", "spoken": "Play style", "desc": "Label of the play-style row: how your pace compares with the HowLongToBeat times.", "words": ["style", "manner", "persona"], "alts": ["🧠", "🪞", "🎬"] },
"summary.interpolation": { "glyph": "t", "spoken": "Interpolation t", "desc": "Label of the blend value t. It is 0 at rush speed and 1 at leisure speed.", "words": ["blend", "position", "interpolation"], "alts": ["📏", "⚖️", "🔀"] },
"summary.estimated-total": { "glyph": "Σ", "spoken": "Estimated total at your pace", "desc": "Label of your estimated total time to finish all games at your pace.", "words": ["total", "estimate", "sum"], "alts": ["🧮", "⏳", "🏔️"] },
"summary.match": { "glyph": "✓", "spoken": "Match", "desc": "Shown when the number of games in scope equals the CLI default.", "words": ["match", "equal", "same"], "alts": ["✔️", "🟰", "👌"] },
"planner.playing": { "glyph": "▶️", "spoken": "Currently playing", "desc": "On the planner header: the game you are playing right now.", "words": ["playing", "current", "active"], "alts": ["🕹️", "⏯️", "🔵"] },
"planner.since": { "glyph": "📅", "spoken": "Since", "desc": "On the planner header: the date the enforcer started counting.", "words": ["since", "started", "begun"], "alts": ["🗓️", "📆", "🕰️"] },
"planner.candidates": { "glyph": "🎮", "spoken": "Candidates", "desc": "On the planner header: how many games the planner can pick from.", "words": ["candidates", "pool", "options"], "alts": ["🎲", "📚", "🧮"] },
"stats.card": { "glyph": "📊", "spoken": "Estimates", "desc": "Heading of the estimates card on the backlog page. It shows the totals for the default filters.", "words": ["estimates", "totals", "numbers"], "alts": ["📈", "🧮", "🗂️"] },
"backlog.filters": { "glyph": "🎚️", "spoken": "Filters", "desc": "Heading of the filter panel on the backlog page. Its sliders and switches narrow the game list.", "words": ["filters", "sliders", "controls"], "alts": ["🎛️", "🧰", "🔘"] },
"cmdflag.root": { "glyph": "🔑", "spoken": "Runs as root", "desc": "Flag on a command: it runs as root through the daemon. It shows on the command card and in the run dialog.", "words": ["root", "admin", "privileged"], "alts": ["🗝️", "👑", "🔐"] },
"cmdflag.countdown": { "glyph": "⏳", "spoken": "Countdown", "desc": "Flag on a command: it asks for a countdown before it can be committed. In the run dialog it carries the minutes.", "words": ["countdown", "delay", "wait"], "alts": ["⏲️", "🕰️", "⌛"] },
"cmdflag.mutating": { "glyph": "✏️", "spoken": "Changes state", "desc": "Flag in the run dialog: this command changes state on your PC or in the enforcer.", "words": ["changes", "writes", "mutates"], "alts": ["📝", "🖊️", "🛠️"] },
"cmdflag.readonly": { "glyph": "👁️", "spoken": "Read-only", "desc": "Flag in the run dialog: this command only reads and changes nothing.", "words": ["readonly", "safe", "viewing"], "alts": ["📖", "🧐", "🪞"] },
"cmdflag.cancellable": { "glyph": "⏹️", "spoken": "Cancellable", "desc": "Flag in the run dialog: a running job of this command can be stopped.", "words": ["stoppable", "cancel", "abort"], "alts": ["🛑", "✋", "🚦"] },
"cmdpal.search": { "glyph": "🔍", "spoken": "Search commands", "desc": "Search field of the command palette. Typing narrows the list of commands and pages.", "words": ["search", "filter", "find"], "alts": ["🔎", "🔦", "🕵️"] },
"cmdpal.run-phrase": { "glyph": "▶️⌨️", "spoken": "Run, needs a phrase", "desc": "Hint on a palette entry: choosing it opens the run dialog, where you must type a phrase first.", "words": ["confirm", "phrase", "guarded"], "alts": ["▶️🔐", "🛂", "🚧"] },
"cmdpal.open": { "glyph": "↗️", "spoken": "Open page", "desc": "Hint on a palette entry for a command that only views data: choosing it opens the page that shows it.", "words": ["page", "view", "open"], "alts": ["🔗", "🪟", "📄"] },
"cmdpal.go": { "glyph": "🧭", "spoken": "Go to", "desc": "Hint on a palette entry for a page: choosing it navigates there.", "words": ["navigate", "go", "jump"], "alts": ["🚀", "🗺️", "📍"] },
"runner.run": { "glyph": "▶️", "spoken": "Run", "desc": "Button that runs the command in the run dialog. The palette shows it as the hint on entries that run one.", "words": ["run", "start", "go"], "alts": ["🚀", "⏩", "🟢"] },
"runner.arm": { "glyph": "⏲️", "spoken": "Arm countdown", "desc": "Submit button for a command with a countdown: it arms the countdown instead of running at once.", "words": ["arm", "schedule", "delay"], "alts": ["⏰", "🧨", "🔔"] },
"runner.fill": { "glyph": "⬆️", "spoken": "Fill the fields above", "desc": "Hint in the run dialog: the exact phrase appears once the fields above are filled in.", "words": ["fill", "above", "complete"], "alts": ["☝️", "📝", "⏫"] },
"runner.terminal": { "glyph": "💻", "spoken": "Run from a terminal", "desc": "Shown when the root daemon is unreachable. The command beside it runs the same job from a terminal.", "words": ["terminal", "shell", "console"], "alts": ["⌨️", "🖥️", "🐚"] },
"params.app_id": { "glyph": "🎮", "spoken": "Game", "desc": "Field in the run dialog: the game to act on, by app id or by picking its name.", "words": ["game", "app", "title"], "alts": ["🕹️", "👾", "🎲"] },
"params.backup_id": { "glyph": "🗄️", "spoken": "Backup", "desc": "Field in the run dialog: which saved state backup to use.", "words": ["backup", "archive", "snapshot"], "alts": ["💾", "📼", "🗃️"] },
"params.days": { "glyph": "📅", "spoken": "Days", "desc": "Field in the run dialog: how many days the action lasts.", "words": ["days", "duration", "span"], "alts": ["🗓️", "📆", "🌅"] },
"params.minutes": { "glyph": "⏱️", "spoken": "Minutes", "desc": "Field in the run dialog: how many minutes the action lasts.", "words": ["minutes", "timer", "length"], "alts": ["⏲️", "🕐", "⌛"] },
"params.reason": { "glyph": "💬", "spoken": "Reason", "desc": "Field in the run dialog: why you do this. The reason is logged.", "words": ["reason", "why", "note"], "alts": ["📝", "🗨️", "🧾"] },
"params.replace": { "glyph": "🔁", "spoken": "Replace", "desc": "Switch in the run dialog: replace the current game instead of keeping it.", "words": ["replace", "swap", "override"], "alts": ["🔄", "♻️", "🔀"] },
"params.demo": { "glyph": "🧪", "spoken": "Demo", "desc": "Switch in the run dialog: run the short demo budget instead of the real one.", "words": ["demo", "test", "trial"], "alts": ["🎬", "🧫", "🔬"] },
"params.other": { "glyph": "✏️", "spoken": "Field", "desc": "Marks any run-dialog field that has no icon of its own.", "words": ["field", "input", "value"], "alts": ["🖊️", "📝", "🔤"] },
"phrase.field": { "glyph": "⌨️", "spoken": "Type the phrase", "desc": "Label of the typed-phrase field. You retype the shown sentence, and pasting is blocked.", "words": ["type", "phrase", "retype"], "alts": ["🔤", "✍️", "📜"] },
"pending.leave": { "glyph": "🚪✖️", "spoken": "Leaving cancels", "desc": "Warning during a countdown: closing the dialog or leaving the page cancels it.", "words": ["leaving", "stay", "warning"], "alts": ["🚪🚫", "🏃", "⚠️🚪"] },
"pending.rearm": { "glyph": "🔁", "spoken": "Arm again", "desc": "Button shown when the countdown lapsed: it starts the command over.", "words": ["rearm", "retry", "again"], "alts": ["🔄", "↩️", "🆕"] },
"pending.beat": { "glyph": "💓", "spoken": "Heartbeat", "desc": "Seconds since the last heartbeat that keeps the countdown alive. It turns into a broken heart when beats fail.", "words": ["heartbeat", "pulse", "alive"], "alts": ["💗", "📶", "🫀"] },
"pending.beat-lost": { "glyph": "💔", "spoken": "Heartbeat failing", "desc": "Replaces the heartbeat while beats fail. The countdown lapses if they do not recover.", "words": ["failing", "lost", "flatline"], "alts": ["📵", "🥀", "🔌"] },
"lib.sort": { "glyph": "↕️", "spoken": "Sort", "desc": "Label of the sort menu in the game browser. The menu orders the grid by name, last played, completion or length.", "words": ["sort", "order", "rank"], "alts": ["🔃", "🔽", "📊"] },
"lib.name": { "glyph": "🔤", "spoken": "Name", "desc": "Sort option: games in alphabetical order by name.", "words": ["name", "alphabet", "title"], "alts": ["🔡", "🅰️", "📇"] },
"lib.recent": { "glyph": "🕐", "spoken": "Recently played", "desc": "Sort option: the games you played most recently come first.", "words": ["recent", "lately", "latest"], "alts": ["🕓", "📆", "⏪"] },
"lib.completion": { "glyph": "🏆", "spoken": "Completion", "desc": "Share of achievements unlocked. It is a sort option and the first part of each game's meta line.", "words": ["completion", "progress", "percent"], "alts": ["🥇", "🎖️", "📈"] },
"lib.hltb": { "glyph": "⏱️", "spoken": "Time to beat", "desc": "Hours that How Long To Beat lists for the game. It is a sort option, shortest first, and part of the meta line.", "words": ["hltb", "hours", "length"], "alts": ["⏳", "⌛", "🕰️"] },
"lib.played": { "glyph": "▶️", "spoken": "Played", "desc": "Hours you have played the game, shown in its meta line.", "words": ["played", "playtime", "logged"], "alts": ["🎮", "🕹️", "⏯️"] },
"lib.hide-completed": { "glyph": "🙈🏆", "spoken": "Hide completed", "desc": "Filter in the game browser: hide the games you have finished.", "words": ["hide", "unfinished", "remaining"], "alts": ["🚫🏆", "🫥", "🧹"] },
"lib.pickable": { "glyph": "🎯", "spoken": "Pickable", "desc": "Filter in the game browser: show only the games the enforcer lets you pick.", "words": ["pickable", "eligible", "allowed"], "alts": ["🎟️", "🔓", "👌"] },
"lib.count": { "glyph": "🎮", "spoken": "Games shown", "desc": "Count in the game browser: the games shown before the slash, the games in total after it.", "words": ["games", "count", "shown"], "alts": ["🕹️", "👾", "🔢"] },
"lib.relevance": { "glyph": "🔍", "spoken": "By relevance", "desc": "Appears beside the count while a search ranks the games by relevance. The sort menu is off then.", "words": ["relevance", "ranked", "matched"], "alts": ["🎯", "📊", "🧲"] },
"lib.search": { "glyph": "🔍", "spoken": "Search your games", "desc": "Search field of the game browser. Typing filters the grid and lists suggestions.", "words": ["search", "find", "lookup"], "alts": ["🔎", "🕵️", "🧐"] },
"lib.why.complete": { "glyph": "🏆✅", "spoken": "Already complete", "desc": "Reason a game cannot be picked: all its achievements are done.", "words": ["complete", "finished", "maxed"], "alts": ["🥇", "💯", "🎖️"] },
"lib.why.noach": { "glyph": "🏆🚫", "spoken": "No achievements", "desc": "Reason a game cannot be picked: it has no achievements to earn.", "words": ["none", "barren", "empty"], "alts": ["🚫", "🪹", "🕳️"] },
"lib.why.skipped": { "glyph": "⏭️", "spoken": "Skipped", "desc": "Reason a game cannot be picked: it was skipped until the date shown beside it.", "words": ["skipped", "deferred", "paused"], "alts": ["⏩", "🛌", "📅"] },
"lib.why.blocked": { "glyph": "⛔", "spoken": "Not allowed", "desc": "Reason a game cannot be picked, for any other cause. The server's sentence is spoken.", "words": ["blocked", "refused", "banned"], "alts": ["🚫", "🛑", "🔒"] },
"health.ok": { "glyph": "✅", "spoken": "Healthy", "desc": "State mark on a health badge: all is well.", "words": ["healthy", "fine", "up"], "alts": ["🟢", "💚", "👍"] },
"health.warn": { "glyph": "⚠️", "spoken": "Degraded", "desc": "State mark on a health badge: the server runs stale code or the daemon is restarting.", "words": ["degraded", "stale", "shaky"], "alts": ["🟡", "🟠", "🚧"] },
"health.bad": { "glyph": "⛔", "spoken": "Down", "desc": "State mark on a health badge: the server is down or the daemon is unreachable.", "words": ["down", "dead", "offline"], "alts": ["🔴", "💥", "🛑"] },
"health.unknown": { "glyph": "…", "spoken": "Unknown", "desc": "State mark on a health badge before the daemon state is known.", "words": ["unknown", "loading", "pending"], "alts": ["❔", "💤", "🔘"] },
"health.stale": { "glyph": "⚠️🌐", "spoken": "Stale server", "desc": "Banner mark: the running server is older than the code on disk. The restart button beside it fixes that.", "words": ["stale", "outdated", "old"], "alts": ["🕰️🌐", "🥀", "📛"] },
"dialog.close": { "glyph": "×", "spoken": "Close", "desc": "Close button in the corner of every dialog.", "words": ["close", "exit", "dismiss"], "alts": ["✖️", "❌", "🚪"] },
"words.page": { "glyph": "🏷️", "spoken": "Icon words", "desc": "Command palette entry that opens this icon-words picker. You are here now.", "words": ["words", "labels", "names"], "alts": ["🔖", "🗨️", "🔤"] }
}
}

View File

@ -9,10 +9,13 @@ const JOB_STATES: JobState[] = ['queued', 'running', 'waiting_input', 'succeeded
const TONES: Tone[] = ['info', 'success', 'warning', 'danger']
describe('icon registry', () => {
it('registers exactly this pass: 8 nav, the palette, 26 commands, 6 job states, 4 tones', () => {
it('registers pass 1 first (8 nav, the palette, 26 commands, 6 job states, 4 tones), then the rest of the UI', () => {
const ids = ICONS.map((e) => e.id)
expect(new Set(ids).size).toBe(ids.length)
expect(ids).toHaveLength(8 + 1 + 26 + 6 + 4)
const pass1 = /^(nav|palette|cmd|job\.state|notice)\./
expect(ids.slice(0, 8 + 1 + 26 + 6 + 4).every((id) => pass1.test(id))).toBe(true)
expect(ids.slice(8 + 1 + 26 + 6 + 4).some((id) => pass1.test(id))).toBe(false)
expect(ids.length).toBeGreaterThan(45)
for (const n of NAV) expect(isIconId(n.icon)).toBe(true)
expect(isIconId('palette.open')).toBe(true)
for (const name of Object.keys(COMMAND_HOME) as (keyof typeof COMMAND_HOME)[]) {
@ -22,7 +25,9 @@ describe('icon registry', () => {
for (const t of TONES) expect(isIconId(`notice.${t}`)).toBe(true)
})
it.each(ICONS.map((e) => [e.id, e] as const))('%s: glyph, name, description, 3 words, 3 alternatives', (_id, e) => {
it.each(ICONS.map((e) => [e.id, e] as const))('%s: glyph, name, description, 3 words, 3 alternatives', (id, e) => {
// The server's route accepts only this id shape (_web_routes._ICON).
expect(id).toMatch(/^[a-z][a-z0-9_.-]{0,63}$/)
expect(e.glyph).not.toBe('')
expect(e.spoken).not.toBe('')
expect(e.desc.length).toBeGreaterThan(20)
@ -32,6 +37,8 @@ describe('icon registry', () => {
for (const w of e.words) expect(w).toMatch(/^\S+$/)
expect(e.alts).toHaveLength(3)
expect(new Set([e.glyph, ...e.alts]).size).toBe(4)
// Not the same picture twice, even when only the emoji variation selector differs.
expect(new Set([e.glyph, ...e.alts].map((g) => g.replaceAll('️', ''))).size).toBe(4)
})
it('keeps every default glyph the UI painted before the registry', () => {

View File

@ -66,11 +66,10 @@ describe('glyph(id)', () => {
expect(el.querySelector('.icon-word')).toBeNull()
})
it('still paints a raw glyph with the old signature', () => {
const el = glyph('🧭', 'navigate')
expect(el.querySelector('[aria-hidden]')?.textContent).toBe('🧭')
expect(el.querySelector('.sr-only')?.textContent).toBe('navigate')
expect(el.querySelector('.icon-word')).toBeNull()
it('tags the glyph with its id so decorateIcons can refresh it', () => {
const el = glyph('state.warn', 'Stale')
expect(el.querySelector('[data-icon]')?.getAttribute('data-icon')).toBe('state.warn')
expect(el.querySelector('.sr-only')?.textContent).toBe('Stale')
})
})

View File

@ -36,6 +36,17 @@ export function iconWord(id: IconId): HTMLSpanElement | null {
return word ? h('span', { class: 'icon-word', 'aria-hidden': 'true', 'data-icon-word': id }, word) : null
}
/**
* The icon for painted-only places (inside `said(...)`, buttons, labels): the
* glyph mark alone, or mark plus word in one row when the user chose a word.
* No spoken text: the caller keeps its own aria-label / .sr-only sentence.
*/
export function iconInline(id: IconId, className = ''): HTMLSpanElement {
const mark = iconMark(id, className)
const word = iconWord(id)
return word ? h('span', { class: 'icon-inline has-word' }, mark, word) : mark
}
/**
* Refresh static markup (the Astro sidebar and palette button) from the
* ledger: each `[data-icon]` gets its current glyph and, right after it, its
@ -54,7 +65,10 @@ export function decorateIcons(root: ParentNode): void {
}
}
/** The static chrome every page shares (sidebar, top bar); run at boot and after a pick. */
/**
* The static chrome every page shares (sidebar, top bar) plus any static
* markup tagged `data-static-icons` (the 404 home link); run at boot and after a pick.
*/
export function decorateChrome(doc: Document = document): void {
for (const el of doc.querySelectorAll('.sidebar, .topbar')) decorateIcons(el)
for (const el of doc.querySelectorAll('.sidebar, .topbar, [data-static-icons]')) decorateIcons(el)
}

View File

@ -0,0 +1,34 @@
// Static Astro markup outside the sidebar and top bar (the 404 home link) opts
// in with `data-static-icons`; the boot decoration then paints the user's
// word and glyph there too.
import { describe, expect, it } from 'vitest'
import { useIcons } from '../test/iconLedger'
import { decorateChrome } from './render'
const markup = (attr: string) => `
<div class="actions" ${attr}>
<a href="/" aria-label="Back to the dashboard"><span aria-hidden="true" data-icon="nav.dashboard">🏠</span></a>
</div>`
describe('decorateChrome and data-static-icons', () => {
it('decorates a tagged container with the word and the alternative glyph', () => {
useIcons({ 'nav.dashboard': { word: 'home', glyph: '🏡' } })
document.body.innerHTML = markup('data-static-icons')
decorateChrome()
const icon = document.querySelector('[data-icon]')
expect(icon?.textContent).toBe('🏡')
expect(icon?.nextElementSibling).toHaveClass('icon-word')
expect(icon?.nextElementSibling?.textContent).toBe('Home')
expect(icon?.parentElement).toHaveClass('has-word')
expect(document.querySelector('a')).toHaveAttribute('aria-label', 'Back to the dashboard')
})
it('leaves untagged containers alone', () => {
useIcons({ 'nav.dashboard': { word: 'home', glyph: '🏡' } })
document.body.innerHTML = markup('')
decorateChrome()
expect(document.querySelector('[data-icon]')?.textContent).toBe('🏠')
expect(document.querySelector('.icon-word')).toBeNull()
})
})

View File

@ -2,7 +2,7 @@
// right of the icon, a chosen alternative replaces the default glyph.
import { describe, expect, it } from 'vitest'
import { COMMAND_ICON, commandIcon } from '../commands/catalog'
import { commandIcon } from '../commands/catalog'
import { commandButton } from '../commands/commandButton'
import { stateBadge } from '../jobs/progress'
import { NAV } from '../shell/nav'
@ -48,10 +48,4 @@ describe('registered call sites', () => {
expect(commandIcon('gaming-status')).toBe('cmd.gaming-status')
})
it('COMMAND_ICON (sites not yet on ids) is the live glyph, alternative applied', () => {
expect(COMMAND_ICON.done).toBe('🏆')
useIcons({ 'cmd.done': { glyph: '🏁' } })
expect(COMMAND_ICON.done).toBe('🏁')
expect(Object.keys(COMMAND_ICON)).toHaveLength(26)
})
})

View File

@ -75,22 +75,13 @@ describe('small builders', () => {
expect(el.querySelector('.empty-icon')?.textContent).toBe('📭')
})
it('pill has an icon for known tones', () => {
const el = pill('danger', 'x')
it('pill paints the registered icon it is given and speaks its text', () => {
const el = pill('danger', 'odd one', 'notice.danger')
expect(el.className).toBe('pill pill-danger')
expect(el.querySelector('.pill-icon')).not.toBeNull()
})
it('pill paints a bullet for an unknown tone and speaks its text', () => {
const el = pill('mystery', 'odd one')
expect(el.querySelector('.pill-icon')?.textContent).toBe('•')
expect(el.querySelector('.pill-icon')?.textContent).toBe('⛔')
expect(el.querySelector('.sr-only')?.textContent).toBe('odd one')
})
it('pill paints the icon it is given over the tone glyph', () => {
expect(pill('danger', 'x', '🔥').querySelector('.pill-icon')?.textContent).toBe('🔥')
})
it('link is an anchor', () => {
const a = link('/library/', 'Open')
expect(a.getAttribute('href')).toBe('/library/')

View File

@ -3,8 +3,8 @@
// for content a custom element renders from live data.
import { explain } from '../api/errors'
import { isIconId, type IconId } from '../icons/registry'
import { iconFor, iconMark, iconWord } from '../icons/render'
import type { IconId } from '../icons/registry'
import { iconFor, iconInline, iconMark, iconWord } from '../icons/render'
import { h, type Child } from '../lib/dom'
export type Tone = 'info' | 'success' | 'warning' | 'danger'
@ -47,14 +47,14 @@ export function errorNotice(error: unknown, ...children: Child[]): HTMLDivElemen
}
export function copyButton(text: string): HTMLButtonElement {
const btn = h('button', { type: 'button', class: 'btn btn-ghost btn-small', 'aria-label': 'Copy command' }, '📋')
const btn = h('button', { type: 'button', class: 'btn btn-ghost btn-small', 'aria-label': 'Copy command' }, iconInline('copy.command'))
btn.addEventListener('click', () => {
if (!('clipboard' in navigator)) return
void navigator.clipboard.writeText(text).then(() => {
btn.textContent = '✅'
btn.replaceChildren(iconInline('copy.done'))
btn.setAttribute('aria-label', 'Copied')
setTimeout(() => {
btn.textContent = '📋'
btn.replaceChildren(iconInline('copy.command'))
btn.setAttribute('aria-label', 'Copy command')
}, 2000)
})
@ -71,12 +71,12 @@ export function loading(what: string): HTMLParagraphElement {
return h('p', { class: 'loading', role: 'status' }, h('span', { class: 'spinner', 'aria-hidden': 'true' }), h('span', { class: 'sr-only' }, `Loading ${what}`))
}
/** Empty-state marker: 📭 painted, the caller's sentence spoken only. */
/** Empty-state marker: the empty icon painted, the caller's sentence spoken only. */
export function empty(label: string): HTMLParagraphElement {
return h(
'p',
{ class: 'empty', 'aria-label': label },
h('span', { class: 'empty-icon', 'aria-hidden': 'true' }, '📭'),
iconInline('state.empty', 'empty-icon'),
h('span', { class: 'sr-only' }, label),
)
}
@ -84,27 +84,21 @@ export function empty(label: string): HTMLParagraphElement {
export interface CardOptions {
aside?: Child
className?: string
icon?: string
icon?: IconId
}
/**
* A painted glyph whose meaning is spoken (.sr-only). With a registered id the
* glyph comes from the registry (the user's alternative applied) and his word,
* if any, is drawn right of it; `spoken` then defaults to the registry name.
* A raw glyph (`glyph('🧭', 'navigate')`) paints just that, as before.
* A painted glyph whose meaning is spoken (.sr-only). The glyph comes from the
* registry (the user's alternative applied) and his word, if any, is drawn
* right of it; `spoken` defaults to the registry name.
*/
export function glyph(id: IconId, spoken?: string, className?: string): HTMLSpanElement
export function glyph(icon: string, spoken: string, className?: string): HTMLSpanElement
export function glyph(icon: string, spoken?: string, className = 'glyph'): HTMLSpanElement {
if (!isIconId(icon)) {
return h('span', { class: className }, h('span', { 'aria-hidden': 'true' }, icon), h('span', { class: 'sr-only' }, spoken))
}
const { glyph: painted, spoken: name } = iconFor(icon)
const word = iconWord(icon)
export function glyph(id: IconId, spoken?: string, className = 'glyph'): HTMLSpanElement {
const { glyph: painted, spoken: name } = iconFor(id)
const word = iconWord(id)
return h(
'span',
{ class: word ? `${className} has-word` : className },
h('span', { 'aria-hidden': 'true', 'data-icon': icon }, painted),
h('span', { 'aria-hidden': 'true', 'data-icon': id }, painted),
word,
h('span', { class: 'sr-only' }, spoken ?? name),
)
@ -126,23 +120,13 @@ export function facts(rows: readonly (readonly [Child, Child])[]): HTMLDListElem
)
}
const TONE_PILL_ICON: Record<string, string> = {
info: 'ℹ️',
success: '✅',
warning: '⚠️',
danger: '⛔',
kept: '📌',
excluded: '🚫',
idle: '⏸️',
running: '▶️',
}
/** A tone badge: `icon` (else the tone's glyph) painted, `text` spoken only. */
export function pill(tone: string, text: string, icon = TONE_PILL_ICON[tone] ?? '•'): HTMLSpanElement {
/** A tone badge: the registered `icon` (and its word) painted, `text` spoken only. */
export function pill(tone: string, text: string, icon: IconId): HTMLSpanElement {
return h(
'span',
{ class: `pill pill-${tone}` },
h('span', { class: 'pill-icon', 'aria-hidden': 'true' }, icon),
iconMark(icon, 'pill-icon'),
iconWord(icon),
h('span', { class: 'sr-only' }, text),
)
}