Skip to content

Releases: CristianDavideConte/universalSmoothScroll

Universal Smooth Scroll 6.1.0

27 Nov 18:08
d1cdbbf
Compare
Choose a tag to compare

Version 6.1.0 is out !

New Features

  • the new getWindowScroller method allows you to retrieve the element that scrolls the window
  • the new getFramesTime method allows you to retrieve the value of uss._framesTime
  • the new calcFramesTimes method allows you to recalculate the uss._framesTime value
  • the new containScroll parameter of scrollXTo, scrollYTo, scrollXBy and scrollYBy allows you to limit the range of scrolling of a container between 0 and its maxScrollX/maxScrollY
  • getAllScrollableParents now returns the same array of parents used by scrollIntoView and scrollIntoViewIfNeeded
  • calcXScrollbarsDimensions now support all instances of Element instead of only SVGElements and HTMLElements
  • calcYScrollbarsDimensions now support all instances of Element instead of only SVGElements and HTMLElements
  • calcScrollbarsDimensions now support all instances of Element instead of only SVGElements and HTMLElements
  • scrollable parents of Elements are now cached (10x faster)
  • the new getBrowserRefreshRate method of the Dev-Helpers library allows you to retrieve the browser's fps count during testing
  • the same stepLengthCalculator obtained from one of the methods of the Ease-Functions library can now be used with multiple containers
  • setStepLengthCalculator can now reset the default xStepLengthCalculator and yStepLengthCalculator of a container if no value is passed
  • the calculation time and reliability of uss._framesTime has been greatly improved (from a few seconds down to 33ms at most)
  • improved parsing of default error/warning loggers for values that are not instances of Element
  • bugfixes and performance improvements


Changes compared to the previous version

  • if the init parameter is passed to hrefSetup, now the propagation of the event is not stopped by default (the event is now the 3rd input parameter of the init method)
  • the alignment of scrollIntoViewIfNeeded is now always applied, even if the passed element is already into view
  • regexes used by the API are now global constants
  • the scrollable parent of document.documentElement is now null instead of window
  • API caches are now reset to undefined instead of null after a resize event


Here you can find the full Universal Smooth Scroll 6.1.0 project: https://github.com/users/CristianDavideConte/projects/1

For any bug or feature request don't hesitate to contact me.
Have a nice day :)

Cristian Davide Conte

Universal Smooth Scroll 6.0.0

18 Aug 16:43
84975f9
Compare
Choose a tag to compare

Version 6.0 is out !

New Features

  • mobile browsers are supported again
  • SVGElement elements are now supported
  • the new Dev-Helpers library will help you with the more challenging aspects of the API
  • the Ease-Functions library now works with scroll-animations that have stillStart = false
  • the new calcXScrollbarDimension allows you to calculate the width of the vertical scrollbar of an element
  • the new calcYScrollbarDimension allows you to calculate the height of the horizontal scrollbar of an element
  • the new addOnResizeCallback function allows you to add a callback that will be executed only once the user has finished resizing the browser
  • the new forceCalculation parameter of getMaxScrollX now allows you to manually recalculate the maxScrollX value of an element, the result is returned from cache otherwise (69x faster)
  • the new forceCalculation parameter of getMaxScrollY now allows you to manually recalculate the maxScrollY value of an element, the result is returned from cache otherwise (69x faster)
  • the new forceCalculation parameter of getScrollbarsMaxDimension now allows you to manually recalculate the _scrollbarMaxDimension, the results are returned from cache otherwise (8.3x faster)
  • the new forceCalculation parameter of calcScrollbarsDimensions now allows you to manually recalculate the scrollbarsDimensions of an element, the results are returned from cache otherwise (8.3x faster)
  • the new forceCalculation parameter of calcBordersDimensions now allows you to manually recalculate the bordersDimensions of an element, the result is returned from cache otherwise (6x faster)
  • the new forceCalculation parameter of getPageScroller now allows you to manually recalculate the _pageScroller, the result is returned from cache otherwise (6x faster)
  • scrollIntoView and scrollIntoViewIfNeeded are now on average 6.8x faster cpu-wise and 45x faster gpu-wise
  • hrefSetup can now animate pages with a URL that contains a valid fragment at loadtime
  • hrefSetup can now update and smoothly scroll through history on Safari and IOS Safari too
  • hrefSetup now supports anchors that have a # in their href
  • the new setErrorLogger allows you to set a custom error logger
  • the new setWarningLogger allows you to set a custom warning logger
  • calling a setter with no argument now resets the corresponding variable to its default value
  • support for UniversalSmoothScroll 2.x has been dropped
  • the API functionalities are now automatically tested with Cypress
  • greatly improved default error and warning loggers
  • bugfixes and performance improvements


Changes compared to the previous version

  • isXscrolling has been renamed to isXScrolling
  • isYscrolling has been renamed to isYScrolling
  • the js project directory has been renamed src
  • the Ease-Functions library is now a module
  • the internal constants of the API are now private
  • the calcXStepLength and calcYStepLength functions are no longer available and they have been replaced by the DEFAULT_X_STEP_LENGTH_CALCULATOR and DEFAULT_Y_STEP_LENGTH_CALCULATOR constants
  • the shouldBeTested parameter of setXStepLengthCalculator, setYStepLengthCalculator and setStepLengthCalculator is not available anymore (moved to the Dev-Helpers library)
  • whenever the history navigation is not triggered by an anchor and updateHistory = true, the init function of hrefSetup is passed null instead of window as the anchor
  • if an error is thrown by a custom StepLengthCalculator, the API no longer catches it
  • all the callbacks passed to the API functions are now executed in the same frame the scroll-animations end
  • the timestamp and originalTimestamp passed to the StepLengthCalculators are now the same value at the beginning of a scroll-animation
  • the nearest alignment of scrollIntoView is now case insensitive
  • getScrollXCalculator and getScrollYCalculator now immediately report any error that occurs instead of passing a functions that throws it when invoked
  • the default values of every API function is now explicitly stated inside the docs
  • mandatory API functions' parameters are now in bold inside the docs
  • optional API functions' parameters are now in italic inside the docs


Here you can find the full Universal Smooth Scroll 6.0.0 project: https://github.com/CristianDavideConte/universalSmoothScroll/projects/2

IMPORTANT NOTE

Universal Smooth Scroll 6.0.0 is a major release of the API and it may not work out-of-the-box with existing Universal Smooth Scroll 5.x.x projects.

The Ease-Functions library is now a module so you have to manually import the ease-functions you're using in your project.
I would also suggest you to check all the functions that now cache their results to make sure you're getting what you expect.

For any bug or feature request don't hesitate to contact me.
Have a nice day :)

Cristian Davide Conte

Universal Smooth Scroll 5.1.2

19 May 13:22
ff46bbc
Compare
Choose a tag to compare

New Features

  • setXStepLengthCalculator, setYStepLengthCalculator, setStepLengthCalculator have a new parameter called shouldBeTested that allows you to test if the passed function is a valid StepLengthCalculator
  • bugfixes and performance improvements

Universal Smooth Scroll 5.1.1

16 May 13:44
Compare
Choose a tag to compare

Bugfixes and performance improvements

Universal Smooth Scroll 5.1.0

06 May 15:47
44cd4e0
Compare
Choose a tag to compare

Version 5.1.0 is out !

New Features

  • the new getScrollXDirection function allows you to retrieve the direction of a scroll-animation on the x-axis of a container
  • the new getScrollYDirection function allows you to retrieve the direction of a scroll-animation on the y-axis of a container
  • the new stopScrollingAll function allows you to stop all the current scroll-animations on both the x and y axes of all the containers
  • the new CUSTOM_CUBIC_HERMITE_SPLINE ease function of the universalsmoothscroll-ease-function library allows you to specify a canonical cubic hermite spline as the easing pattern of a scroll-animation.
  • the new CUSTOM_BEZIER_CURVE ease function of the universalsmoothscroll-ease-function library allows you to specify a n-th degree bezier curve as the easing pattern of a scroll-animation.
  • the new bouncesNumber parameter of EASE_IN_BOUNCE, EASE_OUT_BOUNCE and EASE_IN_OUT_BOUNCE of the universalsmoothscroll-ease-function library allows you to freely choose the number of bounces of these ease functions.
  • greatly improved the API memory management
  • bugfixes and performance improvements


Changes compared to the previous version

  • the error messages can now show up to 40 character instead of 30
  • the error messages are now much more informative
  • the stack trace of error and warning messages is now collapsed by default
  • a warning message is now emitted if the API is requested to scroll a container that is not scrollable on that axis
  • the _CUSTOM_BOUNCE internal function of the universalsmoothscroll-ease-function library has been repurposed according to the new CUSTOM_CUBIC_HERMITE_SPLINE ease function


IMPORTANT NOTE

On NPM this version is tagged as 5.1.0-s, but it's the same version.

For any bug or feature request don't hesitate to contact me.
Have a nice day :)

Cristian Davide Conte

Universal Smooth Scroll 5.0.0

18 Dec 17:36
Compare
Choose a tag to compare

Version 5.0 is out !

New Features

  • the new getFinalXPosition function allows you to retrieve the final position of a scroll-animation on the x-axis of a container
  • the new getFinalYPosition function allows you to retrieve the final position of a scroll-animation on the y-axis of a container
  • the new calcBordersDimensions allows you to retrieve the borders' sizes of a container
  • the new getAllScrollableParents allows you to retrieve all the scrollable parents of a container
  • the new updateHistory parameter of hrefSetup allows you to update the browser's history whenever an anchor is clicked and to support automatic smooth-scrolling between fragments when the user navigates through the history
  • the new isTemporary parameter of setXStepLengthCalculator, setYStepLengthCalculator and setStepLengthCalculator allows you to set a one-time StepLengthCalculator that will control only the next scroll-animation
  • StepLengthCalculators can now be dynamically changed even when there's a scroll-animation happening
  • it is now possible to initiate a scroll-animation from inside a StepLengthCalculator
  • it is now possible to stop a scroll-animation from inside a StepLengthCalculator
  • the new _debugMode and its accessors allow you to disable debug messages or to just display them unstyled
  • scrollIntoView and scrollIntoViewIfNeeded now takes containers' borders into consideration
  • scrollIntoViewIfNeeded now takes scrollbars into consideration
  • scrollIntoViewIfNeeded 's callback invocation time has been greatly reduced
  • getXScrollableParent, getYScrollableParent, getScrollableParent, scrollIntoView and scrollIntoViewIfNeeded now all work with containers that has the css property position:fixed
  • calcScrollbarsDimensions now supports containers that hide the scrollbars through the css properties ::webkit-scrollbar or scrollbar-width
  • scrollIntoView and scrollIntoViewIfNeeded are 20% faster than before
  • the stillStart parameter now works properly in the scrollBy function
  • scrollIntoView and scrollIntoViewIfNeeded now work with any amount of nested containers
  • getMaxScrollX and getMaxScrollY now work properly with the html, the body and the window elements
  • calcScrollbarDimensions now works properly with the html and the body elements
  • the default constant values of the API now scales with the browser's window resolution
  • the documentation is now divided into navigable sections and it's more informative
  • bugfixes and performance improvements


Changes compared to the previous version

  • scrollIntoViewIfNeeded now only centers the element to its closest scrollable parent instead of centering every scrollable ancestor
  • hrefSetup now scrolls the uss._pageScroller to (0, 0) when the anchor's destination (href) is #
  • getXScrollableParent, getYScrollableParent and getScrollableParent now return null if an element doesn't have a scrollable parent
  • a warning is now emitted whenever a StepLengthCalculator doesn't return a valid stepLength during a scroll-animation


IMPORTANT NOTE

Universal Smooth Scroll 5.0.0 is a major release of the API and it may not work out-of-the-box with existing Universal Smooth Scroll 4.x.x projects.

I suggest you to check the return value of getXScrollableParent, getYScrollableParent and getScrollableParent functions that you invoked on containers that may not have a scrollable parent, because the return value is now null instead of window.
I also suggest you to check if the new scrollIntoView and scrollIntoViewIfNeeded behave as you expect on containers that have scrollabars/borders.

For any bug or feature request don't hesitate to contact me.
Happy holidays 🎅🎆

Cristian Davide Conte

Universal Smooth Scroll 4.1.0

22 Oct 17:54
Compare
Choose a tag to compare

Version 4.1.0 is out !

New Features

  • the new getScrollbarsMaxDimension method allows you to retrieve the _scrollbarsMaxDimensions value
  • the new calcScrollbarsDimensions method allows you to retrieve the amount of pixels occupied by an element's scrollbars
  • scrollIntoView & scrollIntoViewIfNeeded now supports scrollbars' dimensions calculations on containers bigger than the viewport
  • the new EASE_ELASTIC_X ease function of the universalsmoothscroll-ease-function library allows for elastic-easing-driven scroll animations on the x-axis of a container
  • the new EASE_ELASTIC_Y ease function of the universalsmoothscroll-ease-function library allows for elastic-easing-driven scroll animations on the y-axis of a container
  • rubber band scrolling effect is now supported
  • greatly improved the DEFAULT_ERROR_LOGGER message logging
  • greatly improved the DEFAULT_WARNING_LOGGER message logging
  • the DEMO has been updated to showcase the new rubber band effect
  • several performance optimizations + bug fixes + code cleanup

Changes compared to the previous version

  • all the API methods that require a container parameter now check if the corresponding received value is the window element or an HTMLElement
  • _scrollbarDimension is now called _scrollbarsMaxDimension
  • all the ease function of the universalsmoothscroll-ease-function library now correctly respect the passed duration
  • the hrefSetup method now stops the propagation of click events on the supported pageLinks
  • scroll-animations with a finalPosition equals to the current position of the container will now stop the current scroll-animation
  • errors generated inside of an ease function of the universalsmoothscroll-ease-function library now shows the correct ease function name

Universal Smooth Scroll 4.0.2

22 Sep 14:52
Compare
Choose a tag to compare

scrollIntoView && scrollIntoViewIfNeeded methods now correctly calculate the scrollbars dimensions.
Bugfixes + performance optimizations.

Universal Smooth Scroll 4.0.1

20 Sep 17:15
Compare
Choose a tag to compare

Bugfixes and performance optimizations + DEFAULT_MIN_ANIMATION_FRAMES is now 60.

Universal Smooth Scroll 4.0.0

03 Sep 15:57
e1e32ad
Compare
Choose a tag to compare

Version 4.0 is out !

New Features

  • the new scrollIntoViewIfNeeded method allows you to bring elements into the screen only when needed
  • added support for nearest option in the scrollIntoView method
  • added a brand new API error/warning system
  • the new getXScrollableParent method allows you find the first scrollable parent of a container which is scrollable on the x-axis only
  • the new getYScrollableParent method allows you find the first scrollable parent of a container which is scrollable on the y-axis only
  • the default document scrolling element can now be set through the new uss._pageScroller variable
  • ease functions now support callbacks that are executed at each scroll step
  • added support for custom bounce-scrolling ease functions
  • new bounce-scrolling ease functions are provided in the universalsmoothscroll-ease-function library
  • added support for anchors that use the name attribute inside the hrefSetup method
  • added support for anchors that use the href="#" attribute inside the hrefSetup method
  • added support for the reduceMotion feature on Safari older than version 14

Changes compared to the previous version

  • the string "nearest" can no longer be used to center items with the scrollIntoView method because it now indicates the nearest alignment
  • the default value for the input parameter container is now uss._pageScroller instead of window
  • stepLengthCalculator can now return numbers < 0 without triggering any internal value overlay at runtime
  • element made visible with the scrollintoView method are no longer automatically focused (bugged with new chrome versions)
  • scrollIntoView method now takes the scrollbar dimensions into consideration for the scroll amount
  • the API now uses strict mode
  • the DEMO now uses a less resource-intensive theme
  • getScrollableParent no longer have a default value for the element input parameter
  • scrollIntoView no longer have a default value for the element input parameter
  • fixed the DEMO's behavior on Firefox and Safari.

IMPORTANT NOTE

universalSmoothScroll 4.0.0 is a Major release and it may not work out-of-the-box with existing universalSmoothScroll 3.x.x based projects.
I suggest you to update the signature of your getScrollableParent and scrollIntoView if you used the default parameters (which were doing basically nothing).
I also suggest you to check the behavior of those particular stepLengthCalculators that used to return a value < 0 relying on the fact that the API was resetting it to the default value at runtime, because it will be different (they will now force the scroll animation to invert its direction).

For any bug or feature request don't hesitate to contact me.
Have a nice day :)

Cristian Davide Conte