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…
Pagination upscale for any list-shaped container — native ul/ol/table or VB collections like card-list, data-table, layout-grid. Numbered, prev/next, load-more, and infinite styles. Optional URL state.
Overview
The data-paged attribute upscales any list-shaped container with pagination — native lists (<ul>, <ol>), tables (<table>, paginates the <tbody> rows), or VB collections (<card-list>, <data-table>, <layout-grid>). One attribute on the container, no per-element wiring; the script slices direct children, hides those outside the active page, and injects a <nav aria-label="Pagination"> sibling with the controls.
Items per page. 0 disables paging (single page covering all items).
data-paged-page
1
Initial page (1-based, user-facing).
data-paged-style
numbered
numbered · prev-next · load-more · infinite
data-paged-window
2
For numbered: page numbers shown around current before ellipsis kicks in.
data-paged-controls
after
before · after · both · none. none also drops the load-more button (pair it with <pager-wc data-style="load-more">); the infinite-scroll sentinel is not a control and always renders.
data-paged-url
—
Opt-in URL search-param name (e.g. page). When set, page state syncs to the address bar via the History API; back/forward re-render the matching page, and a URL without the parameter shows page 1.
data-label-nav
Pagination
Nav landmark name.
data-label-prev / data-label-next
Previous / Next
Button text.
data-label-page
Page {page}
Accessible name of a page-number button.
data-label-status
Page {page} of {total}
The prev-next status, and the announcement after a numbered page change.
data-label-load-more
Load more ({n})
Load-more text; {n} = items remaining.
data-label-no-more
No more
Exhausted load-more text.
data-label-showing
Showing {visible} of {total}
Announced after load-more / infinite reveal more items.
Localisation
The data-label-* strings are the same set <pager-wc> reads. They are read from the container or any ancestor, so one set on <html> or <main> translates every paged list; numbers are formatted for the container's closest [lang].
German labels
1234567
<mainlang="de"data-label-nav="Seiten"data-label-prev="Zurück"data-label-next="Weiter"data-label-page="Seite {page}"data-label-status="Seite {page} von {total}"data-label-load-more="Mehr laden ({n})"data-label-no-more="Keine weiteren"data-label-showing="{visible} von {total} angezeigt"><uldata-pageddata-paged-size="10">…</ul></main>
Events
The container emits paged:change (bubbles) after each render. visible is the number of items currently shown (it grows for load-more / infinite); style is the container's data-paged-style. Use it for analytics, scroll-restoration, or driving a sibling component such as <pager-wc>.
site-search handles filtering and highlighting; <card-list> handles template-driven rendering; data-paged handles paging and URL state. Each piece is independently testable and re-composable.
Accessibility
The injected nav uses <nav aria-label="Pagination"> with native <button>s — keyboard-navigable by default.
The active page button gets aria-current="page"; page-number buttons are named Page N. In forced-colors mode the current page keeps a Highlight fill and a thicker border.
The nav is swapped in place on each render, and focus returns to the equivalent control (Next stays on Next; on the last page it moves to the current page).
Prev/next on the first/last page get the native disabledattribute, so they are skipped by Tab and not actionable. (If you need them to stay focusable, drive the controls yourself with aria-disabled instead.)
Ellipsis markers (…) get aria-hidden="true" so screen readers don't announce them.
prev-next style includes a live status ("Page N of M") with aria-live="polite". The same node is kept across renders so the change is announced (with both, only the copy after the container is live).
numbered page changes are announced ("Page 2 of 5") through the shared polite live region; load-more and infinite announce how many items are shown ("Showing 20 of 54"). Focus stays on the Load more button, ready to load again.
See the note under Styles: infinite can make content after the list unreachable — prefer load-more.
Honours prefers-reduced-motion: no transitions on page change.
What gets paginated
The script paginates direct children of the host, with one exception: when the host is <table>, it paginates the <tbody> rows instead (so the <thead> and <tfoot> stay visible).
The injected <nav> nodes are placed as siblings of the host, not children — so they don't affect the host's grid / flex layout and don't trip its mutation observer.