Smooth Scroll Changelog: v2.4 -> v3.3 - "The Big Refactor & Glow-Up" ✨
Alright folks, big jump from v2.4! This wasn't just dusting off the cobwebs; it's more like a full engine swap and a new paint job. Here's the scoop on what changed:
✨ New Stuff & Major Goodies:
-  Motion Blur (Optional Bling!): cfg.mBluris here! If you turn it on, the page gets a subtle (or not-so-subtle, depending oncfg.mBlurInt) blur effect while scrolling fast. Looks slick, but might cost a tiny bit of performance on older machines. Off by default for max speed.
-  Smarter Acceleration: Remember scrollAcceleration? It's been replaced with a more responsive system (cfg.accDelFct,cfg.accMaxMult). Now, quick consecutive scrolls build up a multiplier, making fast flicks feel way more punchy, up to a configurable limit. Feels more natural.
-  VSync-Style Animation: Ditched the old refresh rate calculation (targetRefreshRate,requestAnimationFrameUpdate). We're now using purerequestAnimationFramefor the animation loop (_animStep). This means the animation timing is directly tied to your display's refresh rate – smoother, less guesswork, and generally the modern standard.
🚀 Improvements & Refactors (Under the Hood):
-  Core Animation Logic Overhaul: The entire scrolling calculation is simpler and based on a damping factor (1 - cfg.smth). Instead of complex time/ratio math, it's now just "move X% closer to the target each frame". More predictable, easier to tune.
-  Better Target Finding (_getTgt): The logic for finding which element to scroll (the whole page? that nesteddiv?) is more robust. It usescomposedPathand directly checks scrollable dimensions andoverflowstyles, handling edge cases better than the oldisScrollable/canScroll/hasScrollbarcombo.
-  Simplified State (stMap): No more jugglingsubPixelOffsetandpixelScrollAmount. Each scrolling element now has a simple state object in aWeakMapholding its target (tgtY), current animated position (curY), animation ID, timestamp for acceleration (ts), and current acceleration multiplier (mult). Cleaner!
-  Modern Structure (IIFE): Wrapped the whole thing in an IIFE (Immediately Invoked Function Expression). Less global pollution compared to the old SmoothScrollobject approach. Functions are mostly internal now (_prefix).
-  Event Handling Tweaks: Now uses capture: truefor listeners to grab events early. Explicitly non-passive (passive: false) for thewheelevent to reliablypreventDefault(). Also addedtouchstartlistener to cancel animation on touch devices.
-  Performance Focus: By simplifying the animation math and state, and relying directly on requestAnimationFrame, the core loop should be lighter. Removed the need for refresh rate calculation overhead.
⚙️ Config Changes (Out with the Old, In with the New):
-   Gone: scrollSmoothness,scrollAcceleration,debugMode,targetRefreshRate,maxRefreshRate,minRefreshRate,animationDuration,passiveEventListeners.
-   New:
-   smth: The smoothness factor (0 to 1, higher is smoother, opposite of oldscrollSmoothness). ReplacesscrollSmoothness.
-   stpMult: A simple overall multiplier for scroll distance.
-   accDelFct,accMaxMult: Control the new acceleration system. ReplacescrollAcceleration.
-   thrsh: How close (in pixels) the scroll needs to be to the target before stopping. ReplacesscrollThresholdconceptually.
-   lnHt: Default height (in pixels) fordeltaMode === 1(scroll by lines).
-   mBlur,mBlurInt: Toggle and control the motion blur intensity.
-   dbg: Simple true/false toggle for debug console logs.
 
🗑️ Removed:
-   The complex sub-pixel offset tracking logic. We round to the nearest pixel now.
-   Dynamic refresh rate calculations and the associated min/max limits.
-   The SmoothScrollglobal object and its publicstart/stopmethods (it's all internal now).
-   Browser fallbacks/polyfills (requestAnimationFrame,String.prototype.encamel) - assuming modern browser support.
TL;DR:
Version 3.3 is a significant rewrite focusing on smoother animation via requestAnimationFrame, a better acceleration feel, optional motion blur, more reliable target finding, and cleaner, modern code. Configuration is different, so check the new cfg object! Should feel better overall. Enjoy the scroll! 🚀