Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

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…

Read the release notes

watch-wc

Drop-in wrapper for the data-watch-page button. One tag renders an icon, compact, or full-button toggle that adds the current page to the user's watch list.

Overview

<watch-wc> wraps the data-watch-page button into a one-tag component. Drop it anywhere on a page and a user can toggle whether that page is in their watch list. State persists in VBStore under the watches namespace; the bell’s Watching tab surfaces the list.

The component is a thin author convenience — the watch state machine still lives in src/utils/page-watch-init.js. The wrapper renders a <button data-watch-page aria-pressed> with the right markup, label, and icon for the chosen variant, then repaints its label and icon whenever aria-pressed changes. The state script keeps aria-pressed in step with the store: on load (so an already-watched page shows “Watching” straight away), on click, and when the page is watched or unwatched anywhere else on the page.

Variants

Three visual presets fit different surfaces. All three behave identically — the difference is layout and density.

Where to put it

The four docs layouts (guide, element, attribute, pattern) ship a <watch-wc> inside their <page-tools> sticky sidebar — that’s the bookmark icon you see on this page next to print and share (it switches to a bookmark with a check mark while you watch the page). Other natural places: the floating fab-stack, an article header, or a sidebar block.

Attributes

AttributeValuesDescription
varianticon (default), compact, buttonVisual preset. icon is a 2.25-rem ghost icon button, compact is small icon plus text, button is a full-size ghost button.
labelstringConstant visible text for the compact and button variants, used in both states. Without it the text toggles between data-label-watch and data-label-watching.
server-syncbooleanTurns on server-side sync via VBService('notify') for the whole page, not just this instance: it sets the page-global window.vbPageWatch.serverSync flag, which every watch button and the notification panel’s unwatch then use. Equivalent to <meta name="vb-page-watch-server" content="true">.
data-label-watchstringText of the compact / button variants while the page is not watched. Default “Watch for updates”.
data-label-watchingstringText of the compact / button variants while the page is watched. Default “Watching”.
data-label-actionstringIcon variant: accessible name (aria-label) and tooltip while not watched. Default “Watch this page for updates”.
data-label-stopstringIcon variant: tooltip while watched. Default “Stop watching this page”.

Changing variant, label or a data-label-* attribute after upgrade re-renders the button.

Events

The component bubbles the same events the underlying [data-watch-page] button emits, so listeners attached to the document don’t care which one was clicked:

EventDetailWhen
page-watch:add{ entry }User started watching the page
page-watch:remove{ url, subscriptionId }User stopped watching

Multiple instances stay in sync

Put two or three <watch-wc> elements on the same page (article header, sticky sidebar, footer call-to-action) and they’ll stay synchronised — clicking any one of them updates the others, and so do plain [data-watch-page] buttons and the × in the notification panel’s Watching tab. The state script listens for page-watch:add / page-watch:remove on the document and repaints every watch button from VBStore.

Watches are keyed by a normalised path, so /guide, /guide/ and /guide/index.html are the same watch. Entries saved under an older un-normalised key move to the new key the next time the page loads.

Accessibility

  • The button is a toggle: aria-pressed="true" while the page is watched, "false" otherwise. The icon (bookmark / bookmark-check) is decorative (aria-hidden).
  • The icon variant has no visible text, so it is named by aria-label (data-label-action); its tooltip says what a click will do.
  • The compact and button variants carry no aria-label: the visible text is the accessible name, so speech-input users can say what they see (WCAG 2.5.3 Label in Name). Use label for a text that stays the same in both states.
  • Localise every string with the data-label-* attributes.

Without JavaScript

Watching needs JavaScript (the state lives in the browser), so there is nothing to show by default: an empty <watch-wc> renders nothing until it upgrades. For a no-JS fallback, put something that works without JS inside the element, such as a feed or “subscribe by email” link. It shows until the component upgrades and is hidden from then on, so you never get two controls.

Related

  • data-watch-page — the underlying attribute pattern this component wraps
  • <notification-wc> — surfaces the watch list in its Watching tab, and a “content changed” notice when a watched page changed since your last visit
  • Service contracts — the /go/notify/subscribe endpoint server-sync uses
↑