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

pager-wc

Standalone pagination controls element targeting any [data-paged] container. The element form of the data-paged primitive. Mirrors VB's layout-* / data-layout-* element-attribute symmetry — pick the surface that fits the markup.

Overview

The <pager-wc> element is the element form of the data-paged primitive. Same engine, different surface. Authors choose:

  • Attribute form — data-paged on the container; controls render in place as siblings of the items.
  • Element form — <pager-wc target="#id"> anywhere on the page; controls live wherever you put the element.

This mirrors the framework-wide pattern: <layout-grid> + data-layout-min, <layout-stack> + data-layout-gap, etc. Element-and-attribute symmetry covers all the cases — pick the one that fits the markup you already have.

When to reach for pager-wc

Use the element form when the items and the controls live in different parts of the layout:

  • Controls in a sticky header with items in the main column
  • Controls in a footer with items above
  • Multiple sets of controls (top + bottom) staying in sync
  • Controls in a sidebar driving a paginated main column

For the common in-place case (controls right after the items), use data-paged directly — no extra element required.

Attributes

AttributeTypeDefaultDescription
target string (CSS selector) — Preferred. CSS selector for the [data-paged] container.
for string (id) — HTML-form-style alternative to target: the bare ID of the target.
data-style enum: numbered · prev-next · load-more numbered Control style. load-more needs a progressive target (see below). infinite is intentionally unsupported — an IntersectionObserver sentinel doesn't make sense for decoupled controls.

Implicit target: if neither target nor for is set, <pager-wc> binds to the nearest preceding [data-paged] sibling. Useful for the common "items above, pager below" pattern with zero wiring.

Only an element that carries data-paged counts as a target. If none resolves yet, the pager shows a short note and binds as soon as a matching target renders (it re-resolves on every paged:change and on click), so a target inserted later still works.

Labels

Every string is an attribute, so the controls can be translated or made more specific. Templates use {page}, {total} and {n}.

AttributeDefaultUsed for
data-label-navPaginationName of the <nav> landmark. Give top and bottom pagers different names.
data-label-prevPreviousPrevious button.
data-label-nextNextNext button.
data-label-pagePage {page}Accessible name of each page-number button (the visible text stays the number).
data-label-statusPage {page} of {total}prev-next status text.
data-label-load-moreLoad more ({n})Load-more button; {n} is the number of items still hidden.
data-label-no-moreNo moreLoad-more button once everything is shown.
data-label-missingNo paginated target foundNote shown while no target resolves.

Load more

A load-more pager drives a progressive target: set data-paged-style="load-more" on the container, and data-paged-controls="none" so the engine doesn't render a second button. The remaining count comes from the engine (paged:change detail visible), so it counts down as items are revealed.

With a numbered or prev-next target, data-style="load-more" logs a console warning: those styles show one page at a time, so there is nothing to append to.

Events

EventDetailNotes
pager-wc:navigate { page } Bubbles from the pager before it dispatches paged:goto on the target. Fired for page navigations only (numbered and prev-next), not for load-more. Not cancelable. Use for analytics, scroll-restore, or transition hooks.

The target's own paged:change event fires from the data-paged engine after the slice updates — listen on the target itself for "after navigation" hooks.

Multi-instance sync

Two or more <pager-wc> elements pointing at the same target stay in sync automatically — each subscribes to the target's paged:change event and re-renders. No additional wiring needed.

Accessibility

  • Renders the same <nav> markup as data-paged — native <button>s, aria-current="page", ellipsis with aria-hidden. Page-number buttons are named Page N (data-label-page).
  • Each instance is a navigation landmark. When a page has more than one, name them apart with data-label-nav (for example Results pages, top and Results pages, bottom).
  • Focus stays put: after a click or key press, focus returns to the same control in the re-rendered nav (Next stays on Next; on the last page it falls back to the current page button).
  • The prev-next status (Page N of M) is a single polite live region that persists across renders, so page changes are announced.
  • In forced-colors mode the current page keeps a Highlight fill and a thicker border.
  • If the target can't be found, the element shows a visible note ("No paginated target found", data-label-missing) instead of failing silently. The note is not a live region; it is an authoring signal.

How it talks to the engine

The decoupled-control story is wired through three custom events on the target:

  • paged:change — fired by the engine after each render, with { page, size, total, totalPages, visible, style }. It bubbles; <pager-wc> listens at document level and re-renders its own controls.
  • paged:goto { page } — fired by <pager-wc> button clicks. The engine listens and navigates.
  • paged:loadmore — fired for the load-more button. Same pattern.

Any consumer can dispatch paged:goto on a [data-paged] container to drive navigation — <pager-wc> is just one possible source.

↑