Releases: magic-spells/scrolling-content
Releases · magic-spells/scrolling-content
Release list
v2.1.1
v2.1.0
v2.0.0
Breaking changes
Speed configuration moved out of JS and into CSS, so breakpoints live in your
stylesheet instead of being hard-coded in the component.
| v1 | v2 |
|---|---|
mobile-speed / desktop-speed / breakpoint |
speed (px/sec) + --scrolling-content-speed |
<scrolling-track gap="30"> |
--scrolling-content-gap |
<scrolling-item pad="10"> |
--scrolling-content-item-padding |
stop(), then hovering out resumed |
stop() stays stopped — paused is real state |
| styles written inline by JS | injected @layer scrolling-content stylesheet |
| CommonJS build | ESM + UMD only |
.marquee { --scrolling-content-speed: 110; }
@media (max-width: 900px) {
.marquee { --scrolling-content-speed: 55; }
}
Precedence is --scrolling-content-speed → speed attribute → 60. Using a
removed speed attribute logs a one-time console warning naming its replacement.
Because styles now live in a cascade layer, plain author selectors ov
them — if you previously used !important to fight the inline styles,
drop it.
Fixed
Two bugs could hang the browser. Content that measured zero — unloade
images, unsettled webfonts, a display:none ancestor — made the clone-count
calculation return Infinity and appended clones forever. The same zero fed an
unbounded while loop in the drag path.
Listeners and animation frames leaked. There was no disconnectedCallb
five window listeners and a live rAF survived removal permanently, and moving
the element in the DOM re-bound them all. (v1's README claimed automatic
listener cleanup. It didn't have any.)
Also:
- Returning to a backgrounded tab no longer teleports the track — the per-frame
delta is clamped.
- Cloned content is hidden from assistive tech and stripped of ids. Previously
screen readers read the marquee N times and the page ended up with N copies of
every id.
- prefers-reduced-motion: reduce now holds the track still while leav
working, so the marquee degrades to a scrubbable strip.
- Measurement is driven by a ResizeObserver instead of three layers of
setTimeout, so late-sizing content is measured when it actually resolves.
- The component has named exports and registration guards.
New
- fade — masks the left and right edges so content dissolves instead of
clipping. Bare fade uses a 4rem ramp; fade="12rem" or
--scrolling-content-fade sets your own.
- direction="right", paused, pause-on-hover="false", and
drag="false".
- Four events: scrolling-content:start, :stop, :drag-start, :drag-end
- TypeScript declarations, so querySelector('scrolling-content') is typed.
Under the hood
Build migrated from Rollup 3 to Vite 8. Dragging uses pointer capture
window listeners, and touch-action: pan-y replaces the hand-rolled touch-axis
heuristic. The published package is 6 files, 10.9 kB — 2.5 kB gzipped, no
dependencies.v1.0.0
v0.1.1
fixed width calculation issue on new windows that don't have focus yet
replaced requestAnimationFrame with setTimeout in connectedCallback function, which gives more accurate widths for some reason - not sure why tbh