Skip to content

Signal

Platforms

Web

The CSS system, transit.js and how pages consume them.

The web platform is the CSS system in platforms/web/ plus the transit renderers. Every value comes from tokens.json or components.tokens.json; go test ./... fails on a raw color or size in a component file, in transit.js, or in transit.css outside the contract geometry it lists.

FileWhat it is
tokens.cssEvery token as a custom property, light and dark (generated)
chitransit.cssThe bundle: tokens and base in cascade layers, then components and utilities (generated)
base/Reset and global element styles
components/One stylesheet per web component
utilities/Layout and visual helpers, and the generated spacing, text and visual utilities
transit.js, transit.cssThe web implementations of the contracts: routeIcon, lineBar, station and vehicle markers, arrival cards, as window.ChiTransitTransit. The bare globals (routeIcon, vehicleEl, el, …) still work but are deprecated: call ChiTransitTransit.routeIcon(…)
icons/The transit SVGs, and icons/sprite.svg with each as a <symbol id="i-{name}"> (generated from icons/)

Signal's CSS reads env(safe-area-inset-*) and 100dvh, so a page needs these in its <head>. Without viewport-fit=cover every inset is 0; interactive-widget=resizes-content makes the Android keyboard shrink the layout instead of covering it; theme-color is Surface in each theme.

<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#FFFFFF" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#0F141C" media="(prefers-color-scheme: dark)">

Conventions

Classes use the ct- prefix and --modifier variants; state comes from aria-pressed, aria-current, [disabled] and :focus-visible. Each component reads var(--button-radius, var(--ct-button-radius)): change the token to restyle every instance, or set --button-radius on one element to override it.

Transit icons

/site/site.js fetches shared files from /icons/, including train, bus, refresh and scheduled, and turns each into a <symbol id="i-{name}">. Outside this site, put the package's icons/sprite.svg at the top of <body> for the same symbols; transit.js and toast.js need it. A page draws them with <svg><use href="#i-train"/></svg>, colored through currentColor. A refresh control's arrow spins one turn when pressed (none under Reduce Motion).

This site

This site is a consumer: every page loads /site/chitransit.css first and uses the ct- classes for its controls (search field, theme switch, buttons, cards, tables). The page shell's layout is the only page-local CSS.