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…
A web component that shows source code with syntax highlighting, a copy button, optional line numbers and tabs for several files. The Vanilla Breeze stylesheet sets its colors, fonts and corner radius from the active theme, so it needs no extra styling on a VB page.
Not bundled. Vanilla Breeze lists it as a development dependency and imports it only in src/doc-extras.js, a bundle built for this docs site and left out of the npm package. You load the component yourself. The VB stylesheet does include the rules that theme it.
Install
Load the component from a CDN. The stylesheet is optional: it styles the element before the script has run, so the code does not show as a line of inline text and then jump.
The package also exports @profpowell/code-block/ssr, a Node module that renders blocks to HTML at build time. See the code-block documentation for that and for the full property list.
With Vanilla Breeze
A token is a CSS custom property that holds one design value, such as --color-surface. Two things connect the component to Vanilla Breeze tokens.
First, the component itself reads five VB tokens as fallbacks, so it picks up a VB theme even without any VB rule aimed at it.
VB token
Drives
--color-surface
Code area background
--color-surface-raised
Outer background and header background
--color-text
Code text and button text
--color-text-muted
Comment color
--color-border
Borders
Second, the VB stylesheet contains a token bridge: a rule with the selector code-block that sets the component's --cb-* properties from VB tokens. It ships in vanilla-breeze.css and vanilla-breeze-core.css, so there is no extra file to load and no attribute to add. The bridge covers more than the five fallbacks.
VB token
Set on
--color-surface, --color-surface-raised
Backgrounds of the block, header, line numbers, buttons and scrollbar track
--color-text, --color-text-muted
Code text, file name, label, comments and button text
--color-border
Borders and the scrollbar thumb
--color-interactive
Button hover, focus ring, expand link and the highlighted-line border
--color-primary
Keywords, functions, attributes and built-in names
--color-accent
Strings, numbers, tags and meta tokens
--radius-m, --radius-s
Corner radius of the block, and of buttons and menus
--font-mono, --font-sans
Code font and interface font
For each value the order is: the --cb-* property if it is set, then the VB token, then the component's built-in color. With VB loaded, the bridge is what sets the --cb-* properties.
Light or dark is chosen separately. With no themeattribute, the component follows the nearest ancestor with data-mode, then data-theme, data-mode or a dark class on <html> or <body>, then the page's computed color-scheme. It updates when these change.
The bridge sits in a cascade layer, so any rule you write outside a layer wins. To change one block, set the property on it.