Guide

Changelog

Every @samline/reveal release, newest first, with breaking changes, behavior changes and upgrade steps called out explicitly.

All notable changes to this package. Format: Keep a Changelog; versions follow semver.

[2.0.0] - 2026-12-03

Breaking

  • reveal() and autoReveal() return a RevealController (elements, show, hide, update, refresh, finished, destroy) instead of a bare cleanup function or { refresh, destroy }.
  • The callbacks are named after the events: onReveal is now onShow and onRevealed is now onEnd. onHide is unchanged. There are no aliases.
  • An unknown, non-empty data-reveal value is no longer rewritten to the effect option: it is left as is, so your CSS can define the effect (and it fades when you define none). Only an empty or missing value takes effect.
  • Without a DOM, or when the observer rejects an option, the call returns a controller whose methods do nothing, instead of a no-op function. With no matching elements it returns a live controller (with no elements), so refresh() can add matches later; it used to return a no-op. AutoInitController is no longer exported.

Added

  • controller.show(target?) reveals now, even off screen, with the transition and the cascade; controller.hide(target?) hides again instantly and fires onHide and reveal:hide, and elements shown as is (reduced motion, media query not matching) stay visible. hide().show() replays the effect.
  • controller.update(options) merges options and applies them again; controller.refresh() resolves the target again (new matches join, disconnected elements leave). Neither flashes: pending elements stay pending, revealed ones stay revealed and fire no events again. With autoReveal, update() also applies to elements added later.
  • controller.finished() resolves when no controlled element is queued or revealing, and on destroy().
  • presets option: { hero: { effect: 'up blur', duration: 900 } } makes data-reveal="hero" use those per-element options (attributes win, then the preset, then the options of the call). The RevealPreset and RevealController types.
  • The effect option accepts the name of an effect of your own CSS, keeping autocomplete for the built-in ones.
  • Reveal.show(target?), Reveal.hide(target?) and Reveal.refresh() act on the automatic run and are safe before it exists.
  • Examples: Controls and Presets.

Changed

  • onHide and reveal:hide also fire when hide() hides an element, not only when a repeat element leaves the viewport.
  • A callback that throws no longer affects the package: the error is reported with reportError (or rethrown in a microtask) and the cascade, finished() and the other elements carry on. Calling destroy(), update(), refresh(), show() or hide() inside a callback or an event listener is safe.
  • show() on an element the observer has not reported yet shows it without a transition.
  • Size budgets raised to 6600 B (index.js) and 6700 B (reveal.global.js) gzip for the controller and presets.

Upgrading from 1.x

  • Return value: const stop = reveal('.card') and stop() become const controller = reveal('.card') and controller.destroy(). In frameworks, useEffect(() => reveal(ref.current), []) becomes useEffect(() => reveal(ref.current).destroy, []). autoReveal() still has refresh() and destroy().
  • Callback names: { onReveal, onRevealed } becomes { onShow, onEnd }.
  • Unknown effect values: <div data-reveal="spin"> used to become data-reveal="up" (or your effect option); now it stays spin and fades unless your CSS defines [data-reveal~='spin']. To keep the old result, write data-reveal="up" or leave the attribute empty.

[1.2.0] - 2026-12-03

Added

  • Cascade patterns on the data-reveal-stagger container: data-reveal-stagger-from (start, end, center, edges, random), data-reveal-stagger-grid (rows and columns measured from the layout), data-reveal-stagger-ease (linear, out) and data-reveal-stagger-max, with the staggerFrom, staggerGrid, staggerEase and staggerMax options.
  • Split text: data-reveal-split="words" or "chars" and the split option animate the text piece by piece with the element’s effect, with data-reveal-split-stagger, data-reveal-split-max, --reveal-split-stagger and --reveal-index. Screen readers read a visually hidden copy; only plain inline text is split, and anything else inside is revealed as a whole.
  • REVEAL_STAGGER_FROM, REVEAL_STAGGER_EASE, REVEAL_SPLIT and their types.
  • Examples: Stagger and Split text.

Existing markup behaves exactly as before: the new attributes and options are opt-in.

Changed

  • Size budgets raised to 5800 B (index.js) and 5900 B (reveal.global.js) gzip, from 3800 and 3900, for cascade patterns and split text.

[1.1.0] - 2026-12-02

Added

  • Effect composition: data-reveal and the effect option accept space-separated effects (up blur, zoom fade). One direction and one wipe at most.
  • Effects rotate (--reveal-rotate) and wipe-up, wipe-down, wipe-left, wipe-right (clip-path wipes; add fade to also fade). They work in scrub mode too.
  • Easing presets smooth, snappy, spring and bounce through data-reveal-easing and the easing option, which also accepts any CSS timing function. REVEAL_EASINGS, the RevealEasing type and Reveal.easings.
  • data-reveal-threshold and data-reveal-margin override threshold and rootMargin per element.
  • data-reveal-media and the media option: elements are shown as is while the media query does not match, and pending elements are shown when it stops matching.
  • data-reveal-reduced="fade" and the reducedMotion: 'fade' option: with reduced motion, elements still hide and reveal, but only opacity transitions.
  • Lifecycle events reveal:show, reveal:end and reveal:hide (bubbling, detail.animated), EVENT_PREFIX, and the onRevealed option.
  • Examples: Compose, Events and Conditions, and rotate and wipes in Effects.

Fixed

  • Showing hidden elements when reduced motion turns on now calls onReveal for each of them, like every other reveal.

Changed

  • Elements with an unknown data-reveal value that the script skips (such as data-reveal-scrub ones) no longer slide up by default in CSS: only an empty value or up does.
  • The stylesheet selects effects with [data-reveal~='…'] and keeps each property family independent; the size budgets grew to 3800 and 3900 bytes gzip.

[1.0.4] - 2026-12-02

Changed

  • Bundle @samline/is-visible 1.1.2 for visibility-triggered reveals.

[1.0.3] - 2026-11-27

Fixed

  • Scrub mode in style.css now also requires animation-range support, so browsers that implement animation-timeline without animation-range keep the element visible instead of scrubbing the whole timeline. The documented CSS.supports check includes it too.

[1.0.2] - 2026-11-17

Fixed

  • repeat with stagger: an element revealed on its own after leaving the viewport no longer keeps the cascade delay it got in an earlier batch.

Changed

  • Internal: the DOM controller moved from src/core to src/vanilla; src/core keeps the DOM-free types, constants and helpers. Public entries are unchanged.

[1.0.1] - 2026-11-17

Changed

  • The scroll-driven scrub animation in style.css is named reveal-scrub instead of samline-reveal-scrub, like the --reveal-* custom properties. Only CSS that referenced the old keyframes name by hand needs the new one.
  • The package moved from the samline/utils monorepo to its own repository, samline/reveal. Homepage, repository and documentation links point to the package’s own site.

[1.0.0] - 2026-11-13

Added

  • First release: reveal and autoReveal reveal elements as they scroll into view with seven CSS effects (up, down, left, right, fade, zoom, blur), cascades per data-reveal-stagger container, repeat, per-element duration, delay and distance, and a CSS-only scrub mode on animation-timeline: view(). Content in view on load is never hidden; without JavaScript, with reduced motion or when printing, everything stays visible. ESM, CommonJS, style.css and a browser global (window.Reveal) that starts on its own.