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.26 kB
/** * ScrollingText v0.5.7 * build on Sat, 12 Jul 2025 18:15:25 GMT * (c) 2025 Hardik Naik * Released under the ISC License. */ "use strict";Object.defineProperty(exports,"t",{value:!0});var r=require("react"),e=require("react-dom/server"),n=require("./index.min.js"),t=function(){return t=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var u in e=arguments[n])Object.prototype.hasOwnProperty.call(e,u)&&(r[u]=e[u]);return r},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var u=r.createContext({});exports.ScrollingTextProvider=function(e){var n=e.children,t=e.options,o=void 0===t?{}:t;return r.createElement(u.Provider,{value:o},n)},exports.default=function(o){var i,c=o.options,s=o.ref,a=o.children,v=r.useRef(null),f=r.useContext(u);return r.useEffect((function(){var u=r.Children.map(a,(function(r){return e.renderToStaticMarkup(r)})),o=t(t({},f),c),i=new n(v.current,u,o);return i.start(),s&&("function"==typeof s?s(i):s.current=i),function(){return i.dispose()}}),[JSON.stringify(c),JSON.stringify(f)]),r.createElement("div",{ref:v},r.createElement("div",{className:"scroll-wrapper"},r.createElement("div",{className:"scroll-text"},null===(i=r.Children.toArray(a))||void 0===i?void 0:i[0])))};