UNPKG

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.21 kB
/** * ScrollingText v0.5.7 * build on Sat, 12 Jul 2025 18:15:25 GMT * (c) 2025 Hardik Naik * Released under the ISC 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({}),u=function(e){var n=e.children,t=e.options,u=void 0===t?{}:t;return r.createElement(o.Provider,{value:u},n)},i=function(u){var i,f=u.options,a=u.ref,c=u.children,s=r.useRef(null),v=r.useContext(o);return r.useEffect((function(){var o=r.Children.map(c,(function(r){return e.renderToStaticMarkup(r)})),u=t(t({},v),f),i=new n(s.current,o,u);return i.start(),a&&("function"==typeof a?a(i):a.current=i),function(){return i.dispose()}}),[JSON.stringify(f),JSON.stringify(v)]),r.createElement("div",{ref:s},r.createElement("div",{className:"scroll-wrapper"},r.createElement("div",{className:"scroll-text"},null===(i=r.Children.toArray(c))||void 0===i?void 0:i[0])))};export{u as ScrollingTextProvider,i as default};