Comparing version 8.5.2 to 8.5.3
@@ -335,5 +335,5 @@ // TypeIt by Alex MacArthur - https://typeitjs.com | ||
}; | ||
let _addSplitPause = (item) => { | ||
let _addSplitPause = (items) => { | ||
let delay = _opts.nextStringDelay; | ||
_queue.add([{ delay: delay[0] }, item, { delay: delay[1] }]); | ||
_queue.add([{ delay: delay[0] }, ...items, { delay: delay[1] }]); | ||
}; | ||
@@ -370,6 +370,7 @@ let _setUpCursor = () => { | ||
} | ||
_addSplitPause({ | ||
func: _opts.breakLines ? () => _type(createElement("BR")) : _delete, | ||
typeable: !!_opts.breakLines | ||
}); | ||
let splitItems = _opts.breakLines ? [{ func: () => _type(createElement("BR")), typeable: true }] : duplicate({ | ||
func: _delete, | ||
delay: _getPace(1) | ||
}, _queue.getTypeable().length); | ||
_addSplitPause(splitItems); | ||
}); | ||
@@ -395,6 +396,6 @@ }; | ||
expandTextNodes(_element); | ||
_addSplitPause({ func: _delete }); | ||
_addSplitPause([{ func: _delete }]); | ||
return strings; | ||
} | ||
let hardCodedStrings = existingMarkup.trim().split(/<br(?:\s*?)(?:\/)?>/); | ||
let hardCodedStrings = existingMarkup.replace(/<!--(.+?)-->/g, "").trim().split(/<br(?:\s*?)(?:\/)?>/); | ||
return hardCodedStrings.concat(strings); | ||
@@ -408,3 +409,3 @@ }; | ||
continue; | ||
if (queueItem.typeable) | ||
if (queueItem.typeable && !_statuses.frozen) | ||
_disableCursorBlink(true); | ||
@@ -560,3 +561,3 @@ await fireItem(queueItem, _wait); | ||
}; | ||
this.unfreeze = function() { | ||
this.unfreeze = () => { | ||
}; | ||
@@ -563,0 +564,0 @@ this.reset = function(rebuild) { |
// TypeIt by Alex MacArthur - https://typeitjs.com | ||
(function(E,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(E=typeof globalThis<"u"?globalThis:E||self,E.TypeIt=w())})(this,function(){"use strict";var E=e=>Array.isArray(e),w=e=>E(e)?e:[e];let se=function(e){let r=function(d){return w(d).forEach(g=>m.set(Symbol(g.char?.innerText),{...g})),this},l=()=>u().filter(d=>d.typeable),s=function(d,g){let U=m.keys();m.set(U[d],g)},o=function(){m.forEach(d=>delete d.done)},c=function(){m=new Map,r(e)},T=()=>m,u=()=>Array.from(m.values()),p=d=>m.delete(d),b=(d=!1)=>d?u():u().filter(g=>!g.done),x=(d,g=!1)=>g?m.delete(d):m.get(d).done=!0,m=new Map;return r(e),{add:r,set:s,wipe:c,reset:o,destroy:p,done:x,getItems:b,getQueue:T,getTypeable:l}};var j=e=>Array.from(e),R=e=>document.createTextNode(e);let B=e=>([...e.childNodes].forEach(r=>{if(r.nodeValue){[...r.nodeValue].forEach(l=>{r.parentNode.insertBefore(R(l),r)}),r.remove();return}B(r)}),e);var W=e=>{let r=document.implementation.createHTMLDocument();return r.body.innerHTML=e,B(r.body)};const J="data-typeit-id",k="ti-cursor",oe="END",ae={started:!1,completed:!1,frozen:!1,destroyed:!1},ue={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:()=>{}},de=`[${J}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`;function K(e,r=!1){let l=document.createTreeWalker(e,NodeFilter.SHOW_ALL,{acceptNode:c=>c.classList?.contains(k)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),s,o=[];for(;s=l.nextNode();)s.originalParent=s.parentNode,o.push(s);return r?o.reverse():o}function fe(e){return K(W(e))}function ce(e,r=!0){return r?fe(e):j(e).map(R)}var P=e=>document.createElement(e),X=(e,r="")=>{let l=P("style");l.id=r,l.appendChild(R(e)),document.head.appendChild(l)},Y=e=>(E(e)||(e=[e/2,e/2]),e),G=(e,r)=>Math.abs(Math.random()*(e+r-(e-r))+(e-r));let Z=e=>e/2;function ye(e){let{speed:r,deleteSpeed:l,lifeLike:s}=e;return l=l!==null?l:r/3,s?[G(r,Z(r)),G(l,Z(l))]:[r,l]}var pe=e=>(e.forEach(clearTimeout),[]),he=()=>Math.random().toString().substring(2,9),Q=e=>"value"in e;let me=e=>Q(e)?j(e.value):K(e,!0).filter(r=>!(r.childNodes.length>0));var be=(e,r)=>{new IntersectionObserver((s,o)=>{s.forEach(c=>{c.isIntersecting&&(r(),o.unobserve(e))})},{threshold:1}).observe(e)};let C=e=>typeof e=="function"?e():e;var ee=e=>Number.isInteger(e);let F=(e,r=document,l=!1)=>r[`querySelector${l?"All":""}`](e),ge=e=>e?.tagName==="BODY",Se=(e,r)=>{if(Q(e)){e.value=`${e.value}${r.textContent}`;return}r.innerHTML="";let l=ge(r.originalParent)?e:r.originalParent||e;l.insertBefore(r,F("."+k,l)||null)},Te=(e,r,l)=>Math.min(Math.max(r+e,0),l.length);var D=(e,r)=>Object.assign({},e,r),z=e=>{if(!e)return;let r=e.parentNode;(r.childNodes.length>1?e:r).remove()},ve=(e,r,l)=>{let s=r[l-1],o=F(`.${k}`,e);e=s?.parentNode||e,e.insertBefore(o,s||null)};function _e(e){return typeof e=="string"?F(e):e}var Ee=e=>/<(.+)>(.*?)<\/(.+)>/.test(e.outerHTML);let we=async(e,r,l)=>new Promise(s=>{let o=async()=>{await e(),s()};l.push(setTimeout(o,r||0))}),Ce={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"},Ne=(e,r,l)=>{let o=`${`[${J}='${e}']`} .${k}`,c=getComputedStyle(l),T=Object.entries(Ce).reduce((u,[p,b])=>`${u} ${p}: var(--ti-cursor-${p}, ${b||c[p]});`,"");X(`@keyframes blink-${e} { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ${o} { display: inline; letter-spacing: -1em; ${T} animation: blink-${e} ${r.cursorSpeed/1e3}s infinite; } ${o}.with-delay { animation-delay: 500ms; } ${o}.disabled { animation: none; }`,e)};var te=(e,r)=>new Array(r).fill(e);const re=({queueItems:e,selector:r,cursorPosition:l,to:s})=>{if(ee(r))return r*-1;let o=new RegExp(oe,"i").test(s),c=r?[...e].reverse().findIndex(({char:u})=>{let p=u.parentElement,b=p.matches(r);return o&&b?!0:b&&p.firstChild.isSameNode(u)}):-1;c<0&&(c=o?0:e.length-1);let T=o?0:1;return c-l+T};let Le=async(e,r)=>{let l=async()=>e.func?.call(globalThis);e.delay?await r(async()=>{await l()},e.delay):await l()};return function(e,r={}){let l=async(t,n,a=!1)=>{S.frozen&&await new Promise(y=>{this.unfreeze=()=>{S.frozen=!1,y()}}),a||await i.beforeStep(this),await we(t,n,V),a||await i.afterStep(this)},s=()=>Q(f),o=(t=0)=>ye(i)[t],c=()=>me(f),T=(t={})=>{let n=t.delay;n&&h.add({delay:n})},u=(t,n)=>(h.add(t),T(n),this),p=()=>le??N,b=(t={})=>[{func:()=>A(t)},{func:()=>A(i)}],x=t=>{let n=i.nextStringDelay;h.add([{delay:n[0]},t,{delay:n[1]}])},m=()=>{if(s())return;let t=P("span");return t.className=k,q?(t.innerHTML=W(i.cursorChar).innerHTML,t):(t.style.visibility="hidden",t)},d=async()=>{!s()&&v&&f.appendChild(v),q&&Ne(ie,i,f)},g=t=>{q&&v&&(v.classList.toggle("disabled",t),v.classList.toggle("with-delay",!t))},U=()=>{let t=i.strings.filter(n=>!!n);t.forEach((n,a)=>{this.type(n),a+1!==t.length&&x({func:i.breakLines?()=>O(P("BR")):$,typeable:!!i.breakLines})})},Ie=async t=>{let n=p();n&&await ne({value:n});for(let a of h.getTypeable())await l($,o(1));h.reset(),h.set(0,{delay:t})},ke=t=>{let n=f.innerHTML;return n?(f.innerHTML="",i.startDelete?(f.innerHTML=n,B(f),x({func:$}),t):n.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(t)):t},M=async(t=!0)=>{S.started=!0;try{for(let[a,y]of h.getQueue())y.done||(y.typeable&&g(!0),await Le(y,l),g(!1),h.done(a,!t));if(!t)return this;if(S.completed=!0,await i.afterComplete(this),!i.loop)throw"";let n=i.loopDelay;l(async()=>{await Ie(n[0]),M()},n[1])}catch{}return this},ne=async t=>{N=Te(t,N,c()),ve(f,c(),N)},O=t=>Se(f,t),A=async t=>i=D(i,t),Pe=async()=>{if(s()){f.value="";return}c().forEach(z)},$=()=>{let t=c();!t.length||(s()?f.value=f.value.slice(0,-1):z(t[N]))};this.break=function(t){return u({func:()=>O(P("BR")),typeable:!0},t)},this.delete=function(t=null,n={}){t=C(t);let a=b(n),y=t,{instant:H,to:_}=n,L=h.getTypeable(),I=(()=>y===null?L.length:ee(y)?y:re({queueItems:L,selector:y,cursorPosition:p(),to:_}))();return u([a[0],...te({func:$,delay:H?0:o(1)},I),a[1]],n)},this.empty=function(t={}){return u({func:Pe},t)},this.exec=function(t,n={}){let a=b(n);return u([a[0],{func:()=>t(this)},a[1]],n)},this.move=function(t,n={}){t=C(t);let a=b(n),{instant:y,to:H}=n,_=re({queueItems:h.getTypeable(),selector:t===null?"":t,to:H,cursorPosition:p()}),L=_<0?-1:1;return le=p()+_,u([a[0],...te({func:()=>ne(L),delay:y?0:o()},Math.abs(_)),a[1]],n)},this.options=function(t,n={}){return t=C(t),A(t),u({},n)},this.pause=function(t,n={}){return u({delay:C(t)},n)},this.type=function(t,n={}){t=C(t);let{instant:a}=n,y=b(n),_=ce(t,i.html).map(I=>({func:()=>O(I),char:I,delay:a||Ee(I)?0:o(),typeable:I.nodeType===Node.TEXT_NODE})),L=[y[0],{func:async()=>await i.beforeString(t,this)},..._,{func:async()=>await i.afterString(t,this)},y[1]];return u(L,n)},this.is=function(t){return S[t]},this.destroy=function(t=!0){V=pe(V),C(t)&&v&&z(v),S.destroyed=!0},this.freeze=function(){S.frozen=!0},this.unfreeze=function(){},this.reset=function(t){!this.is("destroyed")&&this.destroy(),t?(h.wipe(),t(this)):h.reset(),N=0;for(let n in S)S[n]=!1;return f[s()?"value":"innerHTML"]="",this},this.go=function(){return S.started?this:(d(),i.waitUntilVisible?(be(f,M.bind(this)),this):(M(),this))},this.flush=function(t=()=>{}){return d(),M(!1).then(t),this},this.getQueue=()=>h,this.getOptions=()=>i,this.updateOptions=t=>A(t),this.getElement=()=>f;let f=_e(e),V=[],N=0,le=null,S=D({},ae),i=D(ue,r);i=D(i,{html:!s()&&i.html,nextStringDelay:Y(i.nextStringDelay),loopDelay:Y(i.loopDelay)});let ie=he(),h=se([{func:()=>{},delay:i.startDelay}]);f.dataset.typeitId=ie,X(de);let q=i.cursor&&!s(),v=m();i.strings=ke(w(i.strings)),i.strings.length&&U()}}); | ||
(function(E,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(E=typeof globalThis<"u"?globalThis:E||self,E.TypeIt=w())})(this,function(){"use strict";var E=e=>Array.isArray(e),w=e=>E(e)?e:[e];let se=function(e){let r=function(d){return w(d).forEach(g=>m.set(Symbol(g.char?.innerText),{...g})),this},l=()=>u().filter(d=>d.typeable),s=function(d,g){let O=m.keys();m.set(O[d],g)},o=function(){m.forEach(d=>delete d.done)},y=function(){m=new Map,r(e)},S=()=>m,u=()=>Array.from(m.values()),h=d=>m.delete(d),b=(d=!1)=>d?u():u().filter(g=>!g.done),x=(d,g=!1)=>g?m.delete(d):m.get(d).done=!0,m=new Map;return r(e),{add:r,set:s,wipe:y,reset:o,destroy:h,done:x,getItems:b,getQueue:S,getTypeable:l}};var W=e=>Array.from(e),R=e=>document.createTextNode(e);let B=e=>([...e.childNodes].forEach(r=>{if(r.nodeValue){[...r.nodeValue].forEach(l=>{r.parentNode.insertBefore(R(l),r)}),r.remove();return}B(r)}),e);var J=e=>{let r=document.implementation.createHTMLDocument();return r.body.innerHTML=e,B(r.body)};const K="data-typeit-id",k="ti-cursor",oe="END",ae={started:!1,completed:!1,frozen:!1,destroyed:!1},ue={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:()=>{}},de=`[${K}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`;function X(e,r=!1){let l=document.createTreeWalker(e,NodeFilter.SHOW_ALL,{acceptNode:y=>y.classList?.contains(k)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),s,o=[];for(;s=l.nextNode();)s.originalParent=s.parentNode,o.push(s);return r?o.reverse():o}function fe(e){return X(J(e))}function ce(e,r=!0){return r?fe(e):W(e).map(R)}var P=e=>document.createElement(e),Y=(e,r="")=>{let l=P("style");l.id=r,l.appendChild(R(e)),document.head.appendChild(l)},G=e=>(E(e)||(e=[e/2,e/2]),e),Z=(e,r)=>Math.abs(Math.random()*(e+r-(e-r))+(e-r));let ee=e=>e/2;function ye(e){let{speed:r,deleteSpeed:l,lifeLike:s}=e;return l=l!==null?l:r/3,s?[Z(r,ee(r)),Z(l,ee(l))]:[r,l]}var pe=e=>(e.forEach(clearTimeout),[]),he=()=>Math.random().toString().substring(2,9),Q=e=>"value"in e;let me=e=>Q(e)?W(e.value):X(e,!0).filter(r=>!(r.childNodes.length>0));var be=(e,r)=>{new IntersectionObserver((s,o)=>{s.forEach(y=>{y.isIntersecting&&(r(),o.unobserve(e))})},{threshold:1}).observe(e)};let C=e=>typeof e=="function"?e():e;var te=e=>Number.isInteger(e);let z=(e,r=document,l=!1)=>r[`querySelector${l?"All":""}`](e),ge=e=>e?.tagName==="BODY",Te=(e,r)=>{if(Q(e)){e.value=`${e.value}${r.textContent}`;return}r.innerHTML="";let l=ge(r.originalParent)?e:r.originalParent||e;l.insertBefore(r,z("."+k,l)||null)},Se=(e,r,l)=>Math.min(Math.max(r+e,0),l.length);var D=(e,r)=>Object.assign({},e,r),F=e=>{if(!e)return;let r=e.parentNode;(r.childNodes.length>1?e:r).remove()},ve=(e,r,l)=>{let s=r[l-1],o=z(`.${k}`,e);e=s?.parentNode||e,e.insertBefore(o,s||null)};function _e(e){return typeof e=="string"?z(e):e}var Ee=e=>/<(.+)>(.*?)<\/(.+)>/.test(e.outerHTML);let we=async(e,r,l)=>new Promise(s=>{let o=async()=>{await e(),s()};l.push(setTimeout(o,r||0))}),Ce={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"},Ne=(e,r,l)=>{let o=`${`[${K}='${e}']`} .${k}`,y=getComputedStyle(l),S=Object.entries(Ce).reduce((u,[h,b])=>`${u} ${h}: var(--ti-cursor-${h}, ${b||y[h]});`,"");Y(`@keyframes blink-${e} { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ${o} { display: inline; letter-spacing: -1em; ${S} animation: blink-${e} ${r.cursorSpeed/1e3}s infinite; } ${o}.with-delay { animation-delay: 500ms; } ${o}.disabled { animation: none; }`,e)};var U=(e,r)=>new Array(r).fill(e);const re=({queueItems:e,selector:r,cursorPosition:l,to:s})=>{if(te(r))return r*-1;let o=new RegExp(oe,"i").test(s),y=r?[...e].reverse().findIndex(({char:u})=>{let h=u.parentElement,b=h.matches(r);return o&&b?!0:b&&h.firstChild.isSameNode(u)}):-1;y<0&&(y=o?0:e.length-1);let S=o?0:1;return y-l+S};let Ie=async(e,r)=>{let l=async()=>e.func?.call(globalThis);e.delay?await r(async()=>{await l()},e.delay):await l()};return function(e,r={}){let l=async(t,n,a=!1)=>{T.frozen&&await new Promise(c=>{this.unfreeze=()=>{T.frozen=!1,c()}}),a||await i.beforeStep(this),await we(t,n,q),a||await i.afterStep(this)},s=()=>Q(f),o=(t=0)=>ye(i)[t],y=()=>me(f),S=(t={})=>{let n=t.delay;n&&p.add({delay:n})},u=(t,n)=>(p.add(t),S(n),this),h=()=>le??N,b=(t={})=>[{func:()=>A(t)},{func:()=>A(i)}],x=t=>{let n=i.nextStringDelay;p.add([{delay:n[0]},...t,{delay:n[1]}])},m=()=>{if(s())return;let t=P("span");return t.className=k,j?(t.innerHTML=J(i.cursorChar).innerHTML,t):(t.style.visibility="hidden",t)},d=async()=>{!s()&&v&&f.appendChild(v),j&&Ne(ie,i,f)},g=t=>{j&&v&&(v.classList.toggle("disabled",t),v.classList.toggle("with-delay",!t))},O=()=>{let t=i.strings.filter(n=>!!n);t.forEach((n,a)=>{if(this.type(n),a+1===t.length)return;let c=i.breakLines?[{func:()=>V(P("BR")),typeable:!0}]:U({func:$,delay:o(1)},p.getTypeable().length);x(c)})},Le=async t=>{let n=h();n&&await ne({value:n});for(let a of p.getTypeable())await l($,o(1));p.reset(),p.set(0,{delay:t})},ke=t=>{let n=f.innerHTML;return n?(f.innerHTML="",i.startDelete?(f.innerHTML=n,B(f),x([{func:$}]),t):n.replace(/<!--(.+?)-->/g,"").trim().split(/<br(?:\s*?)(?:\/)?>/).concat(t)):t},M=async(t=!0)=>{T.started=!0;try{for(let[a,c]of p.getQueue())c.done||(c.typeable&&!T.frozen&&g(!0),await Ie(c,l),g(!1),p.done(a,!t));if(!t)return this;if(T.completed=!0,await i.afterComplete(this),!i.loop)throw"";let n=i.loopDelay;l(async()=>{await Le(n[0]),M()},n[1])}catch{}return this},ne=async t=>{N=Se(t,N,y()),ve(f,y(),N)},V=t=>Te(f,t),A=async t=>i=D(i,t),Pe=async()=>{if(s()){f.value="";return}y().forEach(F)},$=()=>{let t=y();!t.length||(s()?f.value=f.value.slice(0,-1):F(t[N]))};this.break=function(t){return u({func:()=>V(P("BR")),typeable:!0},t)},this.delete=function(t=null,n={}){t=C(t);let a=b(n),c=t,{instant:H,to:_}=n,I=p.getTypeable(),L=(()=>c===null?I.length:te(c)?c:re({queueItems:I,selector:c,cursorPosition:h(),to:_}))();return u([a[0],...U({func:$,delay:H?0:o(1)},L),a[1]],n)},this.empty=function(t={}){return u({func:Pe},t)},this.exec=function(t,n={}){let a=b(n);return u([a[0],{func:()=>t(this)},a[1]],n)},this.move=function(t,n={}){t=C(t);let a=b(n),{instant:c,to:H}=n,_=re({queueItems:p.getTypeable(),selector:t===null?"":t,to:H,cursorPosition:h()}),I=_<0?-1:1;return le=h()+_,u([a[0],...U({func:()=>ne(I),delay:c?0:o()},Math.abs(_)),a[1]],n)},this.options=function(t,n={}){return t=C(t),A(t),u({},n)},this.pause=function(t,n={}){return u({delay:C(t)},n)},this.type=function(t,n={}){t=C(t);let{instant:a}=n,c=b(n),_=ce(t,i.html).map(L=>({func:()=>V(L),char:L,delay:a||Ee(L)?0:o(),typeable:L.nodeType===Node.TEXT_NODE})),I=[c[0],{func:async()=>await i.beforeString(t,this)},..._,{func:async()=>await i.afterString(t,this)},c[1]];return u(I,n)},this.is=function(t){return T[t]},this.destroy=function(t=!0){q=pe(q),C(t)&&v&&F(v),T.destroyed=!0},this.freeze=function(){T.frozen=!0},this.unfreeze=()=>{},this.reset=function(t){!this.is("destroyed")&&this.destroy(),t?(p.wipe(),t(this)):p.reset(),N=0;for(let n in T)T[n]=!1;return f[s()?"value":"innerHTML"]="",this},this.go=function(){return T.started?this:(d(),i.waitUntilVisible?(be(f,M.bind(this)),this):(M(),this))},this.flush=function(t=()=>{}){return d(),M(!1).then(t),this},this.getQueue=()=>p,this.getOptions=()=>i,this.updateOptions=t=>A(t),this.getElement=()=>f;let f=_e(e),q=[],N=0,le=null,T=D({},ae),i=D(ue,r);i=D(i,{html:!s()&&i.html,nextStringDelay:G(i.nextStringDelay),loopDelay:G(i.loopDelay)});let ie=he(),p=se([{func:()=>{},delay:i.startDelay}]);f.dataset.typeitId=ie,Y(de);let j=i.cursor&&!s(),v=m();i.strings=ke(w(i.strings)),i.strings.length&&O()}}); |
{ | ||
"name": "typeit", | ||
"version": "8.5.2", | ||
"version": "8.5.3", | ||
"description": "The most versatile animated typing utility on the planet.", | ||
@@ -5,0 +5,0 @@ "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)", |
@@ -102,6 +102,6 @@ import Queue from "./Queue"; | ||
*/ | ||
let _addSplitPause = (item: QueueItem) => { | ||
let _addSplitPause = (items: QueueItem[]) => { | ||
let delay = _opts.nextStringDelay; | ||
_queue.add([{ delay: delay[0] }, item, { delay: delay[1] }]); | ||
_queue.add([{ delay: delay[0] }, ...items, { delay: delay[1] }]); | ||
}; | ||
@@ -166,6 +166,13 @@ | ||
_addSplitPause({ | ||
func: _opts.breakLines ? () => _type(createElement("BR")) : _delete, | ||
typeable: !!_opts.breakLines, | ||
}); | ||
let splitItems: QueueItem[] = _opts.breakLines | ||
? [{ func: () => _type(createElement("BR")), typeable: true }] | ||
: duplicate( | ||
{ | ||
func: _delete, | ||
delay: _getPace(1), | ||
}, | ||
_queue.getTypeable().length | ||
); | ||
_addSplitPause(splitItems); | ||
}); | ||
@@ -205,3 +212,3 @@ }; | ||
expandTextNodes(_element); | ||
_addSplitPause({ func: _delete }); | ||
_addSplitPause([{ func: _delete }]); | ||
@@ -211,3 +218,6 @@ return strings; | ||
let hardCodedStrings = existingMarkup.trim().split(/<br(?:\s*?)(?:\/)?>/); | ||
let hardCodedStrings = existingMarkup | ||
.replace(/<!--(.+?)-->/g, "") | ||
.trim() | ||
.split(/<br(?:\s*?)(?:\/)?>/); | ||
@@ -241,3 +251,3 @@ return hardCodedStrings.concat(strings); | ||
if (queueItem.typeable) _disableCursorBlink(true); | ||
if (queueItem.typeable && !_statuses.frozen) _disableCursorBlink(true); | ||
@@ -491,3 +501,3 @@ await fireItem(queueItem, _wait); | ||
this.unfreeze = function () {}; | ||
this.unfreeze = () => {}; | ||
@@ -494,0 +504,0 @@ this.reset = function (rebuild: ((TypeIt) => typeof TypeIt) | undefined) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67128
1842