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…
Searchable, categorized glossary for ubiquitous language and project taxonomy — progressively enhances a dl definition list.
Overview
A web component that progressively enhances a <dl> definition list into a searchable, categorized glossary with alphabet navigation and cross-linking. Without JavaScript, the definition list renders normally. With JavaScript, terms are grouped by category, searchable, and navigable via a letter jump bar.
Basic usage
123456789101112131415161718
<glossary-wcdata-title="Project Glossary"searchable><dl><divdata-category="Domain"data-term-id="velocity"><dt>Velocity</dt><dd>The amount of work a team can complete in a sprint, measured in story points.</dd></div><divdata-category="Domain"data-term-id="epic"><dt>Epic</dt><dd>A large body of work broken down into stories. See also: <ahref="#velocity">velocity</a>.</dd></div><divdata-category="Technical"data-term-id="api-gateway"><dt>API Gateway</dt><dd>Single entry point for all client requests.</dd></div></dl></glossary-wc>
Category label for grouping (e.g., "Domain", "Technical"). Terms without one go under “Uncategorized”.
data-term-id
<div>
Unique ID, set as the div’s id for fragment anchors and cross-links
The authored <dl> stays in the element (hidden) while it is upgraded, and its term <div>s are moved back into it on teardown — moving the element or re-rendering it gives the same result every time.
Enhanced Features
Search — when searchable is set, a search input filters terms by name and definition text. Matches inside collapsed categories are revealed while searching; clearing the search restores the categories you collapsed.
Categories — terms grouped under collapsible category headers, sorted with the language’s collation
Letter jump bar — one link per first letter actually used, pointing at the first term with that letter. Letters come from the terms via Intl.Collator for the element’s lang: accent-insensitive where the language treats accents as variants (É files under E in English), non-Latin scripts by their first character (А, あ…), and digits or symbols under #. While searching, letters with no visible term are aria-disabled.
Cross-linking — use standard <a href="#term-id"> inside definitions to link between terms; a link into a collapsed category expands it. Links stay on the page under <base href>.
Term count — visual badges showing total and filtered counts (the count is announced through the live region, not the heading or button names)
Data mode
With src, the JSON is fetched once per URL. An inline <dl> is optional: it renders as the fallback while loading and stays if the fetch fails, when data-state="error" is set and an error message is shown. glossary-wc:ready fires after the loaded terms render.
JSON format
123456789101112131415161718
{"title":"Project Glossary","terms":[{"id":"velocity","term":"Velocity","definition":"Work completed per sprint in story points.","category":"Domain","seeAlso":["epic","sprint"]},{"id":"epic","term":"Epic","definitionHtml":"A large body of work, split into <em>stories</em>.","category":"Domain"}]}
title is used as the heading when data-title is not set.
definition is rendered as text — markup in it is shown literally, never parsed.
definitionHtml is an explicit opt-in for formatted definitions. It is passed through VB’s HTML sanitizer (scripts, frames, event handlers and javascript: URLs are removed) and used instead of definition. Only use it for content you trust.
seeAlso lists term ids; each becomes a link labelled with that term’s own text.
JavaScript API
The terms property reads the parsed glossary as { id, term, definition, category, seeAlso? } records. Assigning it rebuilds the glossary from records in the JSON format above (written into the source <dl>, so they survive moves) and fires glossary-wc:terms-changed.
Every UI string can be replaced with a data-label-*attribute. Counts use Intl.PluralRules for the nearest lang, so add any plural category you need (-one, -few, -many, -other…).
The <dl> provides native definition list semantics before and after upgrade
The search input sits in a <search> landmark and has an aria-label (the placeholder is only a hint)
One polite live region announces the match count, and the full count when the search is cleared; count badges are hidden from assistive technology so they are not read into the heading or toggle names
Category groups are collapsible buttons with aria-expanded and aria-controls
Jump-bar letters are at least 24×24 px (WCAG 2.5.8); letters with no visible term are aria-disabled while searching. They stay in the tab order so keyboard users can reach them, and activating one does nothing
Term IDs enable fragment anchor navigation; the target is focused
The collapse chevron follows the writing direction in RTL