7.5 KiB
Changelog
2.0.0
OverlayScrollbars was rewritten from the ground up in TypeScript in a functional manner.
The rewrite comes with multiple benefits:
- The library is much smaller now (about 50% smaller fully treeshaken)
- Modern browsers benefit greatly because compat code is inside
pluginswhich are treeshaken if unused - Multiple performance optimizations were made due to the new structure
- Framework Components benefit of the
pureparameter foroptionsandevents(same input produces same output) - TypeScript definitions are always up to date (
@types/overlayscrollbarsis obsolete now)
New Features:
- If applied to
bodyall the native functionality in modern browsers (e.g. swipe down to refresh on mobile, scroll restoration etc.) is preserved (#376, #425, #273, #320) - If you scroll while the cursor hovers a scrollbar element the viewport is now scrolled (#128, #322)
- The initialization process can be fully customized now. This makes it possible to itegrate with other plugins / libraries (#432, #304, #149, #148, #139, #49)
- Scrollbars can be cloned and positioned anywhere in the DOM tree. (#404, #323, #158, #17)
- The update behavior of the
MutationObserverfor the content can be customized with theupdateoptions. (#307, #183, #23) - Works now without adjustments with CSS-Grid, CSS-Flexbox etc.
- Supports all kind of input devices additionally to
mouseandtouch. (Uses native pointer-events now) - Exports a
esmversion which can be treeshaken
Breaking changes:
-
Browser support changed. The minimal version is now IE11.
-
The
scrollfunction is missing. (WIP will be added as a plugin) -
Initialization to
textareaelement is not suppored. (WIP will be added as a plugin) -
extensionsare replaced withplugins. Plugins are more powerful but work nothing likeextensions. -
Any helper functions for
extensionsare removed. -
TypesScriptdefinitions changed completely. -
CSSstyles changed completely. -
There is no
jQueryversion anymore and nojQuerycompat functionality -
The following changed for the
initialization:- Arrays of elements are not supported anymore. If you want to initialize the plugin to multiple elements, you have to loop over them.
- Since the initialization is now fully customizable, the plugin won't have special behavior anymore if it has children with
os-classnames - The third parameter are
eventsnow instead ofeventsionssinceextensionsare removed
-
The following options were removed / replaced / renamed:
resizeis removedsizeAutoCapableis removed (works always now)clipAlwaysis removed (works automatically now)normalizeRTLis removed since thescrollfunction isn't implemented yet there is nothing to normalizeautoUpdateis removed since all browser support theMutationObserverapi there is no need for customizing a update loopautoUpdateIntervalis removedclassNameis replaced withscrollbars.themeupdateOnLoadis replaced withupdate.elementEventsnativeScrollbarsOverlaid.initializeis replaced with theInitializationconcept. You can pass a object as target now where you can specify when to cancel the initialization of the plugin.nativeScrollbarsOverlaid.showNativeScrollbars: is renamed toshowNativeOverlaidScrollbarsscrollbars.dragScrollingis renamed toscrollbars.dragScrollscrollbars.clickScrollingis renamed toscrollbars.clickScrolland animates the scroll change only with theClickScrollPluginotherwise its instantscrollbars.touchSupportis replaced withscrollbars.pointersscrollbars.snapHandleis removedtextareais removed sincetextareainitialization isn't possible yetcallbacksis removed / replaced with theeventsconcept. You can pass listeners / callback separately to the options. Thethiscontext is nowundefinedas a replacement each event recieves theinstanceas its first argument.onScrollStartis removedonScrollStopis removedonInitializedis replaced with theinitializedeventonUpdatedis replaced with theupdatedtheonDestroyedis replaced with thedestroyedeventonScrollis replaced with thescrolleventonInitializationWithdrawnis replaced with thedestroyedevent (if the second argumentcanceledistrue)onOverflowChangedis replaced with theupdatedevent (its second argument holds the information whether the overflow changed)onOverflowAmountChangedis replaced with theupdatedevent (its second argument holds the information whether the overflow amount changed and how much)onDirectionChangedis replaced with theupdatedevent (its second argument holds the information whether the direction changed)onContentSizeChangedis replaced with theupdatedevent (its second argument holds the information whether the content got mutated)onHostSizeChangedis replaced with theupdatedevent (its second argument holds the information whether the host got mutated / its size changed)
-
The following instance methods were removed / replaced / renamed:
sleep()is removed since it doesn't fit into the new structure and shouldn't be needed anymoreext()is removedaddExt()is removedremoveExt()is removedscroll()is removed (WIP)scrollStop()is removed (WIP)getElements()is renamed toelements()and doesn't support any argumens anymore.getState()is renamed tostate()and doesn't support any argumens anymore.
-
The following static methods were removed / replaced / renamed:
extension()is removeddefaultOptions()is replaced withenv().getDefaultOptions()andenv().setDefaultOptions()globals()is replaced withenv()
-
If you used any fields from the
globals()result, please refer to the TypeScript definitions for the correct replacement inenv()
Theming changes:
- Because scrollbars can be cloned and positioned anywhere in the DOM, themes which worked in
v1have to be adapted slightly:.os-scrollbarelements now don't rely on its parent element. Selectors like.os-theme-dark > .os-scrollbar-verticalare now.os-theme-dark.os-scrollbar-vertical- the
.os-host-rtlclass is replaced with.os-scrollbar-rtl. Selectors like.os-theme-dark.os-host-rtl > .os-scrollbar-horizontalare now.os-theme-dark.os-scrollbar-rtl.os-scrollbar-horizontal