Socket
Socket
Sign inDemoInstall

typeit-react

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeit-react - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

LICENSE

2

dist/index.umd.js

@@ -1,1 +0,1 @@

var je=Object.defineProperty;var F=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var Se=(a,f,g)=>f in a?je(a,f,{enumerable:!0,configurable:!0,writable:!0,value:g}):a[f]=g,be=(a,f)=>{for(var g in f||(f={}))ye.call(f,g)&&Se(a,g,f[g]);if(F)for(var g of F(f))ge.call(f,g)&&Se(a,g,f[g]);return a};var ve=(a,f)=>{var g={};for(var v in a)ye.call(a,v)&&f.indexOf(v)<0&&(g[v]=a[v]);if(a!=null&&F)for(var v of F(a))f.indexOf(v)<0&&ge.call(a,v)&&(g[v]=a[v]);return g};(function(a,f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f(require("react")):typeof define=="function"&&define.amd?define(["react"],f):(a=typeof globalThis!="undefined"?globalThis:a||self,a.TypeIt=f(a.React))})(this,function(a){"use strict";function f(e){if(e&&e.__esModule)return e;var n={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach(function(r){if(r!=="default"){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,Object.freeze(n)}var g=f(a),v=e=>Array.isArray(e),Z=e=>v(e)?e:[e];const _e=function(e){const n=function(m){return d=d.concat(Z(m)),this},r=function(m,S){d[m]=S},o=function(){d=d.map(m=>(delete m.done,m))},u=()=>d.filter(m=>!m.done),c=m=>{d[m].done=!0};let d=[];return n(e),{add:n,set:r,reset:o,getItems:u,markDone:c}};var ee=e=>Array.from(e),z=e=>document.createTextNode(e);const Q=e=>([...e.childNodes].forEach(n=>{if(n.nodeValue){[...n.nodeValue].forEach(r=>{n.parentNode.insertBefore(z(r),n)}),n.remove();return}Q(n)}),e);var te=e=>{let n=document.implementation.createHTMLDocument();return n.body.innerHTML=e,Q(n.body)};const ne="data-typeit-id",D="ti-cursor",j="START",Te="END",Ee={started:!1,completed:!1,frozen:!1,destroyed:!1},we={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};function U(e,n=!1){const r=document.createTreeWalker(e,NodeFilter.SHOW_ALL,{acceptNode:c=>{var d;return((d=c==null?void 0:c.classList)==null?void 0:d.contains(D))?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let o,u=[];for(;o=r.nextNode();)o.originalParent=o.parentNode,u.push(o);return n?u.reverse():u}function Ie(e){return U(te(e))}function re(e,n=!0){return n?Ie(e):ee(e).map(z)}var R=e=>document.createElement(e),se=(e,n="")=>{let r=R("style");r.id=n,r.appendChild(z(e)),document.head.appendChild(r)};const oe=e=>Number.isInteger(e),k=(e,n=document,r=!1)=>n[`querySelector${r?"All":""}`](e);var q=e=>"value"in e;const ie=e=>q(e)?ee(e.value):U(e,!0).filter(n=>!(n.childNodes.length>0)),Ce=(e,n,r=j)=>{let o=new RegExp(Te,"i").test(r),u=e?k(e,n):n,c=U(u,!0),d=c[0],m=c[c.length-1],_=o&&!e?0:ie(n).findIndex(N=>N.isSameNode(o?d:m));return o&&_--,_+1};var le=({el:e,move:n,cursorPos:r,to:o})=>oe(n)?n*-1:Ce(n,e,o)-r,ue=e=>(v(e)||(e=[e/2,e/2]),e),ae=(e,n)=>Math.abs(Math.random()*(e+n-(e-n))+(e-n));let ce=e=>e/2;function Ne(e){let{speed:n,deleteSpeed:r,lifeLike:o}=e;return r=r!==null?r:n/3,o?[ae(n,ce(n)),ae(r,ce(r))]:[n,r]}var Le=e=>(e.forEach(n=>clearTimeout(n)),[]),Pe=()=>Math.random().toString().substring(2,9),Ae=(e,n)=>{new IntersectionObserver((o,u)=>{o.forEach(c=>{c.isIntersecting&&(n(),u.unobserve(e))})},{threshold:1}).observe(e)};const C=e=>typeof e=="function"?e():e,De=e=>(e==null?void 0:e.tagName)==="BODY",Me=(e,n)=>{if(q(e)){e.value=`${e.value}${n.textContent}`;return}n.innerHTML="";let r=De(n.originalParent)?e:n.originalParent||e;r.insertBefore(n,k("."+D,r)||null)},Re=(e,n,r)=>Math.min(Math.max(n+e,0),r.length);var x=(e,n)=>Object.assign({},e,n),V=e=>{if(!e)return;const n=e.parentNode;(n.childNodes.length>1?e:n).remove()},ke=(e,n,r)=>{let o=n[r-1],u=k(`.${D}`,e);e=(o==null?void 0:o.parentNode)||e,e.insertBefore(u,o||null)};function xe(e){return typeof e=="string"?k(e):e}const $e=e=>/<(.+)>(.*?)<\/(.+)>/.test(e.outerHTML),Oe=async(e,n,r)=>new Promise(o=>{const u=async()=>{await e(),o()};r.push(setTimeout(u,n))}),He={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"},Be=(e,n,r)=>{let u=`${`[${ne}='${e}']`} .${D}`,c=getComputedStyle(r),d=Object.entries(He).reduce((m,[S,_])=>`${m} ${S}: var(--ti-cursor-${S}, ${_||c[S]});`,"");se(`@keyframes blink-${e} { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ${u} { display: inline; letter-spacing: -1em; ${d} animation: blink-${e} ${n.cursorSpeed/1e3}s infinite; } ${u}.with-delay { animation-delay: 500ms; } ${u}.disabled { animation: none; }`,e)};function Fe(e,n={}){const r=async(t,s,l=!1)=>{E.frozen&&await new Promise(y=>{this.unfreeze=()=>{E.frozen=!1,y()}}),l||await i.beforeStep(this),await Oe(t,s,K),l||await i.afterStep(this)},o=()=>q(p),u=t=>Ne(i)[t],c=()=>ie(p),d=(t,s=0)=>t?u(s):0,m=(t={})=>{let s=t.delay;s&&w.add(()=>A(s))},S=(t,s)=>(w.add(t),m(s),this),_=(t={})=>[()=>H(t),()=>H(i)],N=t=>{let s=i.nextStringDelay;w.add([()=>A(s[0]),...t,()=>A(s[1])])},L=()=>{if(o())return;let t=R("span");return t.className=D,X?(t.innerHTML=te(i.cursorChar).innerHTML,t):(t.style.visibility="hidden",t)},J=async()=>{!o()&&p.appendChild(B),X&&Be(me,i,p)},P=t=>{X&&(B.classList.toggle("disabled",t),B.classList.toggle("with-delay",!t))},Y=()=>{let t=i.strings.filter(s=>!!s);t.forEach((s,l)=>{let y=re(s,i.html);if(w.add(()=>O({chars:y})),l+1===t.length)return;const h=[i.breakLines?()=>O({chars:[R("BR")],silent:!0}):()=>M({num:y.length})];N(h)})},G=async t=>{I&&await he({value:I}),w.reset(),w.set(0,()=>A(t)),await M({num:null})},$=t=>{let s=p.innerHTML;return s?(p.innerHTML="",i.startDelete?(p.innerHTML=s,Q(p),N([()=>M({num:null})]),t):s.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(t)):t},T=async()=>{E.started=!0;let t=w.getItems();try{for(let l=0;l<t.length;l++)await t[l](),w.markDone(l),P(!1);if(E.completed=!0,await i.afterComplete(this),!i.loop)throw"";let s=i.loopDelay;r(async()=>{await G(s[0]),T()},s[1])}catch{}return this},A=(t=0)=>r(()=>{},t),he=async({value:t,to:s=j,instant:l=!1})=>{P(!0);let y=le({el:p,move:t,cursorPos:I,to:s}),h=()=>{I=Re(y<0?-1:1,I,c()),ke(p,c(),I)};await r(async()=>{for(let b=0;b<Math.abs(y);b++)l?h():await r(h,u(0))},d(l))},O=({chars:t,silent:s=!1,instant:l=!1})=>(P(!0),r(async()=>{const y=h=>Me(p,h);s||await i.beforeString(t,this);for(let h of t)l||$e(h)?y(h):await r(()=>y(h),u(0));s||await i.afterString(t,this)},d(l),!0)),H=async t=>{i=x(i,t)},Qe=async()=>{if(o()){p.value="";return}c().forEach(t=>{V(t)})},M=async({num:t=null,instant:s=!1,to:l=j})=>{P(!0),await r(async()=>{let y=oe(t)||o()?t:le({el:p,move:t,cursorPos:I,to:l});const h=()=>{let b=c();!b.length||(o()?p.value=p.value.slice(0,-1):V(b[I]))};for(let b=0;b<y;b++)s?h():await r(h,u(1))},d(s,1)),t===null&&c().length-1>0&&await M({num:null})};this.break=function(t){return S(()=>O({chars:[R("BR")],silent:!0}),t)},this.delete=function(t=null,s={}){t=C(t);let l=_(s),y=t,{instant:h,to:b}=s;return S([l[0],()=>M({num:y,instant:h,to:b}),l[1]],s)},this.empty=function(t={}){return S(Qe,t)},this.exec=function(t,s){let l=_(s);return S([l[0],t,l[1]],s)},this.move=function(t,s={}){t=C(t);let l=_(s),{instant:y,to:h}=s,b={value:t===null?"":t,to:h,instant:y};return S([l[0],()=>he(b),l[1]],s)},this.options=function(t){return t=C(t),S(()=>H(t),t)},this.pause=function(t,s={}){return S(()=>A(C(t)),s)},this.type=function(t,s={}){t=C(t);let l=_(s),y=re(t,i.html),{instant:h}=s,b=[l[0],()=>O({chars:y,instant:h}),l[1]];return S(b,s)},this.is=function(t){return E[t]},this.destroy=function(t=!0){K=Le(K),C(t)&&V(B),E.destroyed=!0},this.freeze=function(){E.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),w.reset(),I=0;for(let t in E)E[t]=!1;return p[o()?"value":"innerHTML"]="",this},this.go=function(){return E.started?this:(J(),i.waitUntilVisible?(Ae(p,T.bind(this)),this):(T(),this))},this.getQueue=()=>w,this.getOptions=()=>i,this.updateOptions=t=>H(t),this.getElement=()=>p;let p=xe(e),K=[],I=0,E=x({},Ee),i=x(we,n);i=x(i,{html:!o()&&i.html,nextStringDelay:ue(i.nextStringDelay),loopDelay:ue(i.loopDelay)});let me=Pe(),w=_e([()=>A(i.startDelay)]);p.dataset.typeitId=me,se(`[${ne}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`);let X=i.cursor&&!o(),B=L();i.strings=$(Z(i.strings)),i.strings.length&&Y()}const{useRef:de,useEffect:W,useState:fe}=g,ze={as:"span",options:{},getBeforeInit:e=>e,getAfterInit:e=>e},pe=e=>{const n=de(null),r=de(null),$=e,{options:o,as:u,children:c,getBeforeInit:d,getAfterInit:m}=$,S=ve($,["options","as","children","getBeforeInit","getAfterInit"]),[_,N]=fe(!0),[L,J]=fe(null),P=u;function Y(){const T=Object.assign({},o);c&&n.current&&(T.strings=n.current.innerHTML),J(T)}function G(){r.current=new Fe(n.current,L),r.current=d(r.current),r.current.go(),r.current=m(r.current)}return W(()=>{Y(),N(!1)},[o]),W(()=>{var T;!L||((T=r.current)==null?void 0:T.updateOptions(L))||G()},[L]),W(()=>()=>{var T;return(T=r.current)==null?void 0:T.destroy()},[]),g.createElement(P,be({ref:n,children:_?c:null,style:{opacity:_?0:1}},S))};return pe.defaultProps=ze,pe});
var je=Object.defineProperty;var F=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var ye=(a,f,g)=>f in a?je(a,f,{enumerable:!0,configurable:!0,writable:!0,value:g}):a[f]=g,be=(a,f)=>{for(var g in f||(f={}))ge.call(f,g)&&ye(a,g,f[g]);if(F)for(var g of F(f))Se.call(f,g)&&ye(a,g,f[g]);return a};var ve=(a,f)=>{var g={};for(var v in a)ge.call(a,v)&&f.indexOf(v)<0&&(g[v]=a[v]);if(a!=null&&F)for(var v of F(a))f.indexOf(v)<0&&Se.call(a,v)&&(g[v]=a[v]);return g};(function(a,f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f(require("react")):typeof define=="function"&&define.amd?define(["react"],f):(a=typeof globalThis!="undefined"?globalThis:a||self,a.TypeIt=f(a.React))})(this,function(a){"use strict";function f(e){if(e&&e.__esModule)return e;var n={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach(function(r){if(r!=="default"){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,Object.freeze(n)}var g=f(a),v=e=>Array.isArray(e),Z=e=>v(e)?e:[e];const _e=function(e){const n=function(m){return d=d.concat(Z(m)),this},r=function(m,S){d[m]=S},o=function(){d=d.map(m=>(delete m.done,m))},u=()=>d.filter(m=>!m.done),c=m=>{d[m].done=!0};let d=[];return n(e),{add:n,set:r,reset:o,getItems:u,markDone:c}};var ee=e=>Array.from(e),z=e=>document.createTextNode(e);const Q=e=>([...e.childNodes].forEach(n=>{if(n.nodeValue){[...n.nodeValue].forEach(r=>{n.parentNode.insertBefore(z(r),n)}),n.remove();return}Q(n)}),e);var te=e=>{let n=document.implementation.createHTMLDocument();return n.body.innerHTML=e,Q(n.body)};const ne="data-typeit-id",D="ti-cursor",j="START",Te="END",Ee={started:!1,completed:!1,frozen:!1,destroyed:!1},we={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};function U(e,n=!1){const r=document.createTreeWalker(e,NodeFilter.SHOW_ALL,{acceptNode:c=>{var d;return((d=c==null?void 0:c.classList)==null?void 0:d.contains(D))?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let o,u=[];for(;o=r.nextNode();)o.originalParent=o.parentNode,u.push(o);return n?u.reverse():u}function Ie(e){return U(te(e))}function re(e,n=!0){return n?Ie(e):ee(e).map(z)}var R=e=>document.createElement(e),se=(e,n="")=>{let r=R("style");r.id=n,r.appendChild(z(e)),document.head.appendChild(r)};const oe=e=>Number.isInteger(e),k=(e,n=document,r=!1)=>n[`querySelector${r?"All":""}`](e);var q=e=>"value"in e;const ie=e=>q(e)?ee(e.value):U(e,!0).filter(n=>!(n.childNodes.length>0)),Ce=(e,n,r=j)=>{let o=new RegExp(Te,"i").test(r),u=e?k(e,n):n,c=U(u,!0),d=c[0],m=c[c.length-1],_=o&&!e?0:ie(n).findIndex(N=>N.isSameNode(o?d:m));return o&&_--,_+1};var le=({el:e,move:n,cursorPos:r,to:o})=>oe(n)?n*-1:Ce(n,e,o)-r,ue=e=>(v(e)||(e=[e/2,e/2]),e),ae=(e,n)=>Math.abs(Math.random()*(e+n-(e-n))+(e-n));let ce=e=>e/2;function Ne(e){let{speed:n,deleteSpeed:r,lifeLike:o}=e;return r=r!==null?r:n/3,o?[ae(n,ce(n)),ae(r,ce(r))]:[n,r]}var Le=e=>(e.forEach(n=>clearTimeout(n)),[]),Pe=()=>Math.random().toString().substring(2,9),Ae=(e,n)=>{new IntersectionObserver((o,u)=>{o.forEach(c=>{c.isIntersecting&&(n(),u.unobserve(e))})},{threshold:1}).observe(e)};const C=e=>typeof e=="function"?e():e,De=e=>(e==null?void 0:e.tagName)==="BODY",Me=(e,n)=>{if(q(e)){e.value=`${e.value}${n.textContent}`;return}n.innerHTML="";let r=De(n.originalParent)?e:n.originalParent||e;r.insertBefore(n,k("."+D,r)||null)},Re=(e,n,r)=>Math.min(Math.max(n+e,0),r.length);var x=(e,n)=>Object.assign({},e,n),V=e=>{if(!e)return;const n=e.parentNode;(n.childNodes.length>1?e:n).remove()},ke=(e,n,r)=>{let o=n[r-1],u=k(`.${D}`,e);e=(o==null?void 0:o.parentNode)||e,e.insertBefore(u,o||null)};function xe(e){return typeof e=="string"?k(e):e}const $e=e=>/<(.+)>(.*?)<\/(.+)>/.test(e.outerHTML),Oe=async(e,n,r)=>new Promise(o=>{const u=async()=>{await e(),o()};r.push(setTimeout(u,n))}),He={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"},Be=(e,n,r)=>{let u=`${`[${ne}='${e}']`} .${D}`,c=getComputedStyle(r),d=Object.entries(He).reduce((m,[S,_])=>`${m} ${S}: var(--ti-cursor-${S}, ${_||c[S]});`,"");se(`@keyframes blink-${e} { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ${u} { display: inline; letter-spacing: -1em; ${d} animation: blink-${e} ${n.cursorSpeed/1e3}s infinite; } ${u}.with-delay { animation-delay: 500ms; } ${u}.disabled { animation: none; }`,e)};function Fe(e,n={}){const r=async(t,s,l=!1)=>{E.frozen&&await new Promise(y=>{this.unfreeze=()=>{E.frozen=!1,y()}}),l||await i.beforeStep(this),await Oe(t,s,K),l||await i.afterStep(this)},o=()=>q(p),u=t=>Ne(i)[t],c=()=>ie(p),d=(t,s=0)=>t?u(s):0,m=(t={})=>{let s=t.delay;s&&w.add(()=>A(s))},S=(t,s)=>(w.add(t),m(s),this),_=(t={})=>[()=>H(t),()=>H(i)],N=t=>{let s=i.nextStringDelay;w.add([()=>A(s[0]),...t,()=>A(s[1])])},L=()=>{if(o())return;let t=R("span");return t.className=D,X?(t.innerHTML=te(i.cursorChar).innerHTML,t):(t.style.visibility="hidden",t)},J=async()=>{!o()&&p.appendChild(B),X&&Be(me,i,p)},P=t=>{X&&(B.classList.toggle("disabled",t),B.classList.toggle("with-delay",!t))},Y=()=>{let t=i.strings.filter(s=>!!s);t.forEach((s,l)=>{let y=re(s,i.html);if(w.add(()=>O({chars:y})),l+1===t.length)return;const h=[i.breakLines?()=>O({chars:[R("BR")],silent:!0}):()=>M({num:y.length})];N(h)})},G=async t=>{I&&await he({value:I}),w.reset(),w.set(0,()=>A(t)),await M({num:null})},$=t=>{let s=p.innerHTML;return s?(p.innerHTML="",i.startDelete?(p.innerHTML=s,Q(p),N([()=>M({num:null})]),t):s.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(t)):t},T=async()=>{E.started=!0;let t=w.getItems();try{for(let l=0;l<t.length;l++)await t[l](),w.markDone(l),P(!1);if(E.completed=!0,await i.afterComplete(this),!i.loop)throw"";let s=i.loopDelay;r(async()=>{await G(s[0]),T()},s[1])}catch{}return this},A=(t=0)=>r(()=>{},t),he=async({value:t,to:s=j,instant:l=!1})=>{P(!0);let y=le({el:p,move:t,cursorPos:I,to:s}),h=()=>{I=Re(y<0?-1:1,I,c()),ke(p,c(),I)};await r(async()=>{for(let b=0;b<Math.abs(y);b++)l?h():await r(h,u(0))},d(l))},O=({chars:t,silent:s=!1,instant:l=!1})=>(P(!0),r(async()=>{const y=h=>Me(p,h);s||await i.beforeString(t,this);for(let h of t)l||$e(h)?y(h):await r(()=>y(h),u(0));s||await i.afterString(t,this)},d(l),!0)),H=async t=>{i=x(i,t)},Qe=async()=>{if(o()){p.value="";return}c().forEach(t=>{V(t)})},M=async({num:t=null,instant:s=!1,to:l=j})=>{P(!0),await r(async()=>{let y=oe(t)||o()?t:le({el:p,move:t,cursorPos:I,to:l});const h=()=>{let b=c();!b.length||(o()?p.value=p.value.slice(0,-1):V(b[I]))};for(let b=0;b<y;b++)s?h():await r(h,u(1))},d(s,1)),t===null&&c().length-1>0&&await M({num:null})};this.break=function(t){return S(()=>O({chars:[R("BR")],silent:!0}),t)},this.delete=function(t=null,s={}){t=C(t);let l=_(s),y=t,{instant:h,to:b}=s;return S([l[0],()=>M({num:y,instant:h,to:b}),l[1]],s)},this.empty=function(t={}){return S(Qe,t)},this.exec=function(t,s){let l=_(s);return S([l[0],t,l[1]],s)},this.move=function(t,s={}){t=C(t);let l=_(s),{instant:y,to:h}=s,b={value:t===null?"":t,to:h,instant:y};return S([l[0],()=>he(b),l[1]],s)},this.options=function(t){return t=C(t),S(()=>H(t),t)},this.pause=function(t,s={}){return S(()=>A(C(t)),s)},this.type=function(t,s={}){t=C(t);let l=_(s),y=re(t,i.html),{instant:h}=s,b=[l[0],()=>O({chars:y,instant:h}),l[1]];return S(b,s)},this.is=function(t){return E[t]},this.destroy=function(t=!0){K=Le(K),C(t)&&V(B),E.destroyed=!0},this.freeze=function(){E.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),w.reset(),I=0;for(let t in E)E[t]=!1;return p[o()?"value":"innerHTML"]="",this},this.go=function(){return E.started?this:(J(),i.waitUntilVisible?(Ae(p,T.bind(this)),this):(T(),this))},this.getQueue=()=>w,this.getOptions=()=>i,this.updateOptions=t=>H(t),this.getElement=()=>p;let p=xe(e),K=[],I=0,E=x({},Ee),i=x(we,n);i=x(i,{html:!o()&&i.html,nextStringDelay:ue(i.nextStringDelay),loopDelay:ue(i.loopDelay)});let me=Pe(),w=_e([()=>A(i.startDelay)]);p.dataset.typeitId=me,se(`[${ne}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`);let X=i.cursor&&!o(),B=L();i.strings=$(Z(i.strings)),i.strings.length&&Y()}const{useRef:de,useEffect:W,useState:fe}=g,ze={as:"span",options:{},getBeforeInit:e=>e,getAfterInit:e=>e},pe=e=>{const n=de(null),r=de(null),$=e,{options:o,as:u,children:c,getBeforeInit:d,getAfterInit:m}=$,S=ve($,["options","as","children","getBeforeInit","getAfterInit"]),[_,N]=fe(!0),[L,J]=fe(null),P=u;function Y(){const T=Object.assign({},o);c&&n.current&&(T.strings=n.current.innerHTML),J(T)}function G(){r.current=new Fe(n.current,L),r.current=d(r.current),r.current.go(),r.current=m(r.current)}return W(()=>{Y(),N(!1)},[o]),W(()=>{var T;!L||((T=r.current)==null?void 0:T.updateOptions(L))||G()},[L]),W(()=>()=>{var T;return(T=r.current)==null?void 0:T.destroy()},[]),g.createElement(P,be({ref:n,children:_?c:null,style:{opacity:_?0:1}},S))};return pe.defaultProps=ze,pe});
{
"name": "typeit-react",
"version": "2.2.0",
"version": "2.3.0",
"description": "React component for the most versatile JavaScript animated typing utility on the planet.",

@@ -39,13 +39,14 @@ "homepage": "https://typeitjs.com",

"dependencies": {
"@types/react": "^17.0.37",
"@types/react": "^17.0.39",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typeit": "^8.2.0",
"vite": "^2.7.4"
"typeit": "^8.3.0",
"vite": "^2.8.1"
},
"devDependencies": {
"@babel/preset-typescript": "^7.16.5",
"lint-staged": "^12.1.3",
"typescript": "^4.5.4"
}
"@babel/preset-typescript": "^7.16.7",
"lint-staged": "^12.3.4",
"typescript": "^4.5.5"
},
"gitHead": "955a53721a6309bec7a2527f5c52c31b0bf332c5"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc