web-scrolling-text
Version:
A lightweight, customizable text animation library for creating smooth scrolling text effects with support for React, Next.js, Angular and vanilla JavaScript
8 lines (7 loc) • 1.24 kB
JavaScript
/**
* ScrollingText v6.1.5
* build on Wed, 31 Dec 2025 04:31:12 GMT
* (c) 2025 Hardik Naik
* Released under the MIT License.
*/
import r from"react";import e from"react-dom/server";import n from"./index.es.js";var t=function(){return t=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var o=r.createContext({}),i=function(e){var n=e.children,t=e.options,i=void 0===t?{}:t;return r.createElement(o.Provider,{value:i},n)},u=function(i){var u,f=i.options,a=i.ref,c=i.children,v=r.useRef(null),s=r.useContext(o);return r.useEffect((function(){var o=r.Children.map(c,(function(r){return e.renderToStaticMarkup(r)}))||[];if(0!==o.length){var i=t(t({},s),f),u=new n(v.current,o,i);return u.start(),a&&("function"==typeof a?a(u):a.current=u),function(){return u.dispose()}}}),[JSON.stringify(f),JSON.stringify(s)]),r.createElement("div",{ref:v},r.createElement("div",{className:"scroll-wrapper"},r.createElement("div",{className:"scroll-text"},null===(u=r.Children.toArray(c))||void 0===u?void 0:u[0])))};export{i as ScrollingTextProvider,u as default};