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

page-tools

Configurable toolbar for page-level utilities — print, share, stats — with responsive FAB collapse.

Overview

The <page-tools> component aggregates page-level utilities into a cohesive toolbar. It handles positioning and responsive collapse so individual tools do not need to solve these problems independently.

Any direct child element is treated as a tool — no registry needed. On small viewports, the toolbar collapses into a floating action button (FAB) that opens a native popover panel.

Attributes

Attribute Type Default Description
data-position string sticky Positioning strategy: sticky, fixed, inline
data-orientation string auto Tool strip direction: auto, vertical, horizontal. Auto resolves to vertical for sticky/fixed, horizontal for inline. The resolved value is reflected as data-resolved-orientation and aria-orientation, and re-resolves when data-orientation or data-position changes.
data-gap string s Gap between tools: 2xs, xs, s, m, l
data-fab-icon string ellipsis-vertical Icon name for the mobile FAB button
data-fab-label string Page tools Accessible label for the FAB button
data-breakpoint string 48rem Viewport width at or below which the toolbar collapses to FAB

Reflected state

Attribute Description
data-resolved-orientation vertical or horizontal — the effective direction
data-collapsed Present while the toolbar is collapsed to the FAB

JavaScript

Property Description
tools Read-only array of the tool elements (your children, excluding the generated FAB and popover panel)

CSS custom properties

Property Description
--page-tools-gapGap between tools (set by data-gap)
--page-tools-offsetSticky top offset / fixed inline-end offset
--page-tools-button-paddingPadding of normalised icon tool buttons
--page-tools-icon-sizeIcon size inside tool buttons (default 1.25rem)
--page-tools-fab-sizeFAB diameter (default 3rem)
--page-tools-fab-bottomFAB distance from the bottom of the viewport
--page-tools-fab-endFAB distance from the inline-end edge of the viewport

Usage

Sticky Sidebar

The most common pattern — placed in a sidebar alongside a table of contents:

Inline Horizontal

Flows with the document, orientation defaults to horizontal:

Fixed Viewport Edge

Pinned to the viewport edge, centered vertically:

Mobile FAB Collapse

At or below the breakpoint (default 48rem), the toolbar collapses into a floating action button pinned to the bottom inline-end corner. The tools stay hidden until the FAB is activated; it then opens a native popover panel just above it containing the tools. Tools are DOM-moved (not cloned) so event listeners are preserved.

If the page has a <fab-stack>, the FAB joins it as its last child instead of taking the corner for itself, so it stacks with the page's other floating buttons (settings, back to top) rather than sitting on top of them, at their size and with their look. The panel then opens just above the FAB wherever the stack puts it. The FAB returns to <page-tools> when the toolbar expands or is removed.

Custom Tools

Any element works as a tool. Slot in standard VB components, plain links, or custom elements:

Highlights & Notes Integration

The highlights system ships an action component that fits naturally into <page-tools> as a page-level shortcut. Drop a <note-wc for="article-id"> into the rail and clicking it opens the note panel for the first highlight on that article.

Use the icon variants of the built-in tools (share-wc variant="icon", text-reader variant="icon") so they pick up the toolbar’s button normalisation.

For the inline selection toolbar (highlight + note on demand), use <selection-menu> alongside the article. Both surfaces talk to the same engine and storage.

Progressive Enhancement

Without JavaScript, <page-tools> is styled as a flex container by CSS alone. Children remain visible and functional. The FAB collapse and toolbar semantics are added only when the component upgrades.

Accessibility

  • The component sets role="toolbar" and aria-label="Page tools" on upgrade (authored values are kept), plus aria-orientation from the resolved direction. While collapsed, the element holds only the floating button and the popover, so the role and aria-orientation it set move to the popover panel, which becomes the role="toolbar" (named with the same label, aria-orientation="vertical"); both return to the element when the toolbar expands. An authored role is left in place, and the panel then takes no role.
  • It follows the toolbar keyboard pattern: the tools form a single Tab stop (roving tabindex); ←/→ (horizontal, mirrored in RTL) or ↑/↓ (vertical) move between tools and wrap; Home/End jump to the first/last tool. Text inputs and selects keep their own arrow keys.
  • The FAB is a native button with an accessible label (data-fab-label) and controls the popover via popovertarget; the panel is named with the same label.
  • The popover light-dismisses on Escape or a click outside. Focus returns to the FAB only when focus was inside the panel as it closed (for example Escape from a tool); a click elsewhere keeps focus where you clicked.
  • While collapsed and closed, the panel is display: none, so its tools are neither visible nor focusable.
↑