Releases: ceriousdevtech/cerious-scroll
Releases · ceriousdevtech/cerious-scroll
Release list
v1.0.8
v1.0.7
Full Changelog: v1.0.6...v1.0.7
v1.0.6
Full Changelog: v1.0.5...v1.0.6
v1.0.5
Full Changelog: v1.0.4...v1.0.5
v1.0.4
v1.0.3
What's Changed
- Fix scrollbar and thumb for mobile by @jared-ceriousdevtech in #4
Full Changelog: v1.0.2...v1.0.3
v1.0.2
[1.0.2] - 2026-06-01
Changed
Hardening & Input Validation
totalElementsnow validated withNumber.isFiniteand floored viaMath.floor()— fractional or non-finite values are rejected with a clear error messagecontainervalidated as an HTMLElement (must haveappendChild) onrenderViewport()callsrenderElementvalidated as a function onrenderViewport()calls- Constructor options are now deep-cloned and frozen (
Object.freeze) on construction — mutating the caller's config object after construction no longer affects library behavior
Performance Cache
- New
setTotalElements()method bounds all linear walks (e.g.findRowFromScrollPosition) by dataset size, preventing runaway loops on malformed scroll positions - Defensive validation rejects NaN, Infinity, and negative heights — uses a 1px placeholder rather than poisoning the cache
- Cumulative height cache is invalidated correctly when an in-window measurement is updated
Navigation Engine
scrollByDeltanow guards against non-finitedeltaYor zero/negativeviewportHeightscrollToElementclamps index to valid range[0, totalElements-1]and emits a console warning when clamping occursjumpToPercentageandjumpToElementguard against non-finite inputs with safe fallback to current position- Scroll offset clamped to
[0, elementHeight - 1]to prevent scroll position escaping element bounds - Object reuse for
_scrollResulteliminates per-scroll allocations on the hot path
Native Scrollbar
- Replaced
null as anyinitialization cast with a proper typedsetScrollHandlers(engine)setter - Programmatic scroll events tracked via
_pendingProgrammaticEventscounter to prevent event feedback loops - Scroll listener stored as typed field (
_scrollListener) for reliable removal
Resize Controller
- Added
ResizeObserverintegration alongside the existingwindow.resizelistener - Skips the first
ResizeObservercallback to avoid spurious reflows on initial attach - Only triggers viewport recalculation when width or height actually changes
- Multiple cleanup handlers composed into a single returned cleanup function
Touch Controller
- Replaced unbounded velocity array with a fixed-size ring buffer (
Float64Array, 16 slots) for O(1) velocity sampling regardless of gesture length - More accurate momentum calculation under high frame rates (240Hz+)
Event Emitter
- New
setErrorHandler(handler)method — errors thrown by event listeners are routed to the handler instead of being silently swallowed or crashing the emitter - Falls back to
console.errorwhen no error handler is set
Content Observer
- Reference-counted observation via
WeakMap— the same container element can be observed multiple times safely; the underlying observer is only disconnected when all callers release it - Guards against non-finite or negative heights from
ResizeObserverentries - Defensive try/catch around individual
observe/unobservecalls for detached nodes