Socket
Socket
Sign inDemoInstall

typeit

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeit - npm Package Compare versions

Comparing version 6.1.2 to 6.1.3

dist/typeit.es.min.js

20

dist/typeit.min.js

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

/*!
*
* TypeIt - The most versatile animated typing utility on the planet.
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.2
* License: GPL-2.0
* URL: https://typeitjs.com
*
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TypeIt=e():t.TypeIt=e()}(this,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var i={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:750,html:!0,waitUntilVisible:!1,beforeString:function(){},afterString:function(){},beforeStep:function(){},afterStep:function(){},afterComplete:function(){}},r=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.insert=function(e,n){t.waiting.splice(e,0,n)},this.add=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e[0])?(t.waiting=t.waiting.concat(e),t):(t.waiting[n?"unshift":"push"](e),t)},this.delete=function(e){return t.waiting.splice(e,1),t},this.reset=function(){return t.waiting=t.executed.concat(t.waiting),t.executed=[],t},this.executed=[],this.waiting=e,!e.length&&n&&this.add(n)},o=function(t){return document.createElement(t)};function u(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=o("style");n.id=e,n.appendChild(document.createTextNode(t)),document.head.appendChild(n)}function a(t){return t.map((function(t){return t.replace(/<\!--.*?-->/g,"")}))}var c=function(t){return["textarea","input"].indexOf(t.tagName.toLowerCase())>-1},f=function(t){return Array.isArray(t)?t:[t]},l=function(t){return[].slice.call(t)},p=function(t,e){var n=t.nextSibling;return!!n&&!n.isEqualNode(e)};function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var d=function(t,e){var n=e;if(c(t))t.value="".concat(t.value).concat(n);else{var i=l(t.childNodes).filter((function(t){return t.classList&&t.classList.contains("ti-cursor")}));if(i=i.length?i[0]:null,"object"===h(e)&&!(e instanceof HTMLElement)){var r=e.ancestorTree.slice(0).reverse().join(" "),u=l(t.querySelectorAll("".concat(r))),s=(u=u.filter((function(t){return!i||!i.isEqualNode(t)}))).length>0?u[u.length-1]:null;if(s&&function(t,e){if(!t)return!1;for(var n=!1,i=[],r=t;!n;)i.push(p(r,e)),(r=r.parentNode)&&r.hasAttribute&&!r.hasAttribute("data-typeit-id")||(n=!0);return!i.some((function(t){return t}))}(s,i))t=s,n=e.content;else if(n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=o(t);return e.forEach((function(t){i.setAttribute(t.name,t.value)})),i.innerHTML=n,i}(e.ancestorTree[0],e.attributes,e.content),e.ancestorTree.length>1){var a=l(t.querySelectorAll(e.ancestorTree[1]));t=a[a.length-1]}}n="object"===h(n)?n:document.createTextNode(n),t.insertBefore(n,i&&t.hasAttribute("data-typeit-id")?i:null)}},y=function(t){var e=[];return e.concat.apply(e,t)},v=function(t){var e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body},m=function(t){return l(t.childNodes).map((function(t){return 3===t.nodeType?t.nodeValue.split(""):t}))},g=function(t,e,n){return{ancestorTree:e,attributes:(i=t,l(i.attributes).map((function(t){return{name:t.name,value:t.nodeValue}}))),content:n};var i},b=function(t,e){var n=g(t,e,""),i=m(t).map((function(n,i){return Array.isArray(n)?n.map((function(n,i){return g(t,e,n)})):n}));return i.unshift(n),y(i)},S=function(t){return t instanceof HTMLElement&&"BR"!==t.tagName},w=function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e.map((function(t){if(S(t)){if(!n)return l(t.childNodes);for(var e=t.parentNode,i=[t.tagName];["BODY","HTML"].indexOf(e.tagName)<0;)i.push(e.tagName),e=e.parentNode;return b(t,i)}return t}));return(i=y(i)).some((function(t){return S(t)}))?t(i,n):i};function q(t){var e=v(t),n=m(e);return w(n)}function x(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e?q(t):t.split("")}var T=function(t,e){e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")},A=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!Array.isArray(t),r=t.length;return(t=i?new Array(t).fill(0):t).map((function(t,o){if(i)return e;var u=[e,t];return n&&(0===o&&u.push({isFirst:!0}),o+1===r&&u.push({isLast:!0})),u}))},N=function(t){t.parentNode.removeChild(t)},L=function(t){return 3!==t.nodeType&&"BR"!==t.tagName&&!t.firstChild},M=function(t){return t.some((function(t){return L(t)}))},D=function(t){for(var e=l(t.querySelectorAll("*")),n=M(e);e.length&&n;){var i=!1;e.forEach((function(t){L(t)&&(N(t),i=!0)})),i&&(e=l(t.querySelectorAll("*"))),n=M(e)}return e},$=function(t){return Array.isArray(t)||(t=[t/2,t/2]),{before:t[0],after:t[1],total:t[0]+t[1]}},j=function(t,e,n){var i=(e=null!==e?e:t/3)/2;return n?[u(t,t/2),u(e,i)]:[t,e]};function E(t){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.typeIt,u=e.element,p=e.id,h=e.options,y=e.queue,m=void 0===y?[]:y,g=e.isAReset,b=void 0!==g&&g,S=function(){var e=l(t.$e.childNodes).filter((function(t){return!t.isEqualNode(k)}));return w(e,!1)},L=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=t.opts.nextStringDelay;t.queue.insert(e,[t.pause,i.before]),t.queue.insert(e+n+1,[t.pause,i.after])},M=function(){!I&&t.opts.cursor&&(s("@keyframes blink-".concat(p," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(p,"'] .ti-cursor { animation: blink-").concat(p," ").concat(t.opts.cursorSpeed/1e3,"s infinite; }"),p),(k=o("span")).innerHTML=v(t.opts.cursorChar).innerHTML,k.className="ti-cursor",k.setAttribute("style","display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;"),t.$e.appendChild(k))};this.wait=function(t,e){this.timeouts.push(setTimeout(t,e))};var P=function(){t.opts.strings.forEach((function(e,n){var i=x(e,t.opts.html);t.queue.add(A(i,t.type,!0));var r=t.queue.waiting.length;if(n+1!==t.opts.strings.length){if(t.opts.breakLines)return t.queue.add([t.type,o("BR")]),void L(r);t.queue.add(A(i,t.delete)),L(r,e.length)}}))},C=function(e){t.queue.reset().delete(0).add([t.pause,e.before],!0);for(var n=0;n<S().length;n++)t.queue.add([t.delete,null,{isPhantom:!0}],!0)},H=function(e){var n=t.$e.innerHTML;return n?(t.$e.innerHTML="",t.opts.startDelete?(q(n).forEach((function(e){d(t.$e,e)})),t.queue.add([t.delete,!0]),L(1),e):[n.trim()].concat(e)):e};this.pause=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n,i){t.wait((function(){return n()}),e||t.opts.nextStringDelay.total)}))},this.reset=function(){return this.queue.reset(),new O({typeIt:n,element:this.$e,id:p,options:this.opts,queue:this.queue.waiting,isAReset:!0})},this.init=function(){var t=this;if(!this.status.started){if(M(),!this.opts.waitUntilVisible)return this.status.started=!0,this.fire();new IntersectionObserver((function(e,n){e.forEach((function(e){e.isIntersecting&&(t.fire(),n.unobserve(t.$e))}))}),{threshold:1}).observe(this.$e)}},this.fire=function(){for(var t=this,e=this.queue.waiting.slice(),i=Promise.resolve(),r=function(r){var o=e[r],u=[o,t.queue,n];i=i.then((function(){return new Promise((function(e,n){var i,r;if(t.status.frozen)return n();(t.pace=j(t.opts.speed,t.opts.deleteSpeed,t.opts.lifeLike),o[2]&&o[2].isFirst)&&(r=t.opts).beforeString.apply(r,u);(i=t.opts).beforeStep.apply(i,u),o[0].call(t,o[1],o[2]).then((function(){var n,i,r=t.queue.waiting.shift();if(o[2]&&o[2].isPhantom)return e();o[2]&&o[2].isLast&&(i=t.opts).afterString.apply(i,u);return(n=t.opts).afterStep.apply(n,u),t.queue.executed.push(r),e()}))}))}))},o=0;o<e.length;o++)r(o);i.then((function(){if(t.opts.loop){var e=t.opts.loopDelay?t.opts.loopDelay:t.opts.nextStringDelay;t.wait((function(){C(e),t.fire()}),e.after)}t.status.completed=!0,t.opts.afterComplete(n)})).catch((function(){}))},this.type=function(t){var e=this;return"object"!==E(t)||t.content?new Promise((function(n){e.wait((function(){return d(e.$e,t),n()}),e.pace[0])})):(d(this.$e,t),Promise.resolve())},this.empty=function(){var t=this;return new Promise((function(e){return I?t.$e.value="":l(t.$e.childNodes).forEach((function(t){k.isEqualNode(t)||N(t)})),e()}))},this.delete=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n){t.wait((function(){var i=S();return i.length&&N(i[i.length-1]),D(t.$e),e&&i.length-1>0?t.delete(!0).then((function(){return n()})):n()}),t.pace[1])}))},this.setOptions=function(t){var e=this;return new Promise((function(n){return e.opts=Object.assign({},e.opts,t),n()}))};var k=null,I=c(u);this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.$e=u,this.timeouts=[],this.opts=Object.assign({},i,h),this.opts.html=!I&&this.opts.html,this.opts.nextStringDelay=$(this.opts.nextStringDelay),this.opts.loopDelay=$(this.opts.loopDelay),this.queue=new r(m,[this.pause,this.opts.startDelay]),this.$e.setAttribute("data-typeit-id",p),s("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}"),T(u,I);var z=f(this.opts.strings);z=H(z),this.opts.strings=a(z),this.opts.strings.length&&!b&&P()}function P(t,e){var n,i=this;this.instances=(n=t,"string"==typeof n?n=document.querySelectorAll(n):n.forEach||(n=[n]),l(n)).map((function(t){return new O({typeIt:i,element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[],isAReset:!1})}));var r=function(t){i.instances.forEach((function(e){t.call(i,e)}))},u=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;r((function(r){var o="string"!=typeof t,u=o?t:r[t],s=A(n,[u,o?i:e]);r.queue.add(s)}))};this.is=function(t){return e=this.instances,n=t,i=!0,!!e.length&&!e.some((function(t){return t.status[n]!==i}));var e,n,i},this.freeze=function(){r((function(t){t.status.frozen=!0}))},this.unfreeze=function(){r((function(t){t.status.frozen&&(t.status.frozen=!1,t.fire())}))},this.type=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r((function(e){var n=x(t,e.opts.html);e.queue.add(A(n,e.type,!0))})),this},this.delete=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return u("delete",null===t,null===t?1:t),this},this.pause=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return u("pause",t),this},this.break=function(){return u("type",o("BR")),this},this.options=function(t){return u("setOptions",t),this},this.exec=function(t){return u(t),this},this.destroy=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.instances=this.instances.map((function(e){if(e.timeouts.forEach((function(t){clearTimeout(t)})),e.timeouts=[],t){var n=e.isInput?null:e.$e.querySelector(".ti-cursor");n&&e.$e.removeChild(n)}return e.status.destroyed=!0,e}))},this.empty=function(){return u("empty"),this},this.reset=function(){return this.destroy(),this.instances=this.instances.map((function(t){return t.reset()})),this},this.go=function(){return r((function(t){t.init()})),this}}n.d(e,"default",(function(){return P}))}]).default}));
/**
*
* TypeIt - The most versatile animated typing utility on the planet.
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.3
* License: GPL-2.0
* URL: https://typeitjs.com
*
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).TypeIt=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}var e={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:750,html:!0,waitUntilVisible:!1,beforeString:function(){},afterString:function(){},beforeStep:function(){},afterStep:function(){},afterComplete:function(){}};function n(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.insert=function(e,n){t.waiting.splice(e,0,n)},this.add=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e[0])?(t.waiting=t.waiting.concat(e),t):(t.waiting[n?"unshift":"push"](e),t)},this.delete=function(e){return t.waiting.splice(e,1),t},this.reset=function(){return t.waiting=t.executed.concat(t.waiting),t.executed=[],t},this.executed=[],this.waiting=e,!e.length&&n&&this.add(n)}var i=function(t){return document.createElement(t)};function r(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))}function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=i("style");n.id=e,n.appendChild(document.createTextNode(t)),document.head.appendChild(n)}function u(t){return t.map((function(t){return t.replace(/<\!--.*?-->/g,"")}))}var s=function(t){return["textarea","input"].indexOf(t.tagName.toLowerCase())>-1},a=function(t){return Array.isArray(t)?t:[t]},c=function(t){return[].slice.call(t)},l=function(t,e){var n=t.nextSibling;return!!n&&!n.isEqualNode(e)};var f=function(e,n){var r=n;if(s(e))e.value="".concat(e.value).concat(r);else{var o=c(e.childNodes).filter((function(t){return t.classList&&t.classList.contains("ti-cursor")}));if(o=o.length?o[0]:null,"object"===t(n)&&!(n instanceof HTMLElement)){var u=n.ancestorTree.slice(0).reverse().join(" "),a=c(e.querySelectorAll("".concat(u))),f=(a=a.filter((function(t){return!o||!o.isEqualNode(t)}))).length>0?a[a.length-1]:null;if(f&&function(t,e){if(!t)return!1;for(var n=!1,i=[],r=t;!n;)i.push(l(r,e)),(r=r.parentNode)&&r.hasAttribute&&!r.hasAttribute("data-typeit-id")||(n=!0);return!i.some((function(t){return t}))}(f,o))e=f,r=n.content;else if(r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=i(t);return e.forEach((function(t){r.setAttribute(t.name,t.value)})),r.innerHTML=n,r}(n.ancestorTree[0],n.attributes,n.content),n.ancestorTree.length>1){var h=c(e.querySelectorAll(n.ancestorTree[1]));e=h[h.length-1]}}r="object"===t(r)?r:document.createTextNode(r),e.insertBefore(r,o&&e.hasAttribute("data-typeit-id")?o:null)}},h=function(t){var e=[];return e.concat.apply(e,t)},p=function(t){var e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body},d=function(t){return c(t.childNodes).map((function(t){return 3===t.nodeType?t.nodeValue.split(""):t}))},v=function(t,e,n){return{ancestorTree:e,attributes:(i=t,c(i.attributes).map((function(t){return{name:t.name,value:t.nodeValue}}))),content:n};var i},y=function(t,e){var n=v(t,e,""),i=d(t).map((function(n,i){return Array.isArray(n)?n.map((function(n,i){return v(t,e,n)})):n}));return i.unshift(n),h(i)},m=function(t){return t instanceof HTMLElement&&"BR"!==t.tagName},g=function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e.map((function(t){if(m(t)){if(!n)return c(t.childNodes);for(var e=t.parentNode,i=[t.tagName];["BODY","HTML"].indexOf(e.tagName)<0;)i.push(e.tagName),e=e.parentNode;return y(t,i)}return t}));return(i=h(i)).some((function(t){return m(t)}))?t(i,n):i};function b(t){var e=p(t),n=d(e);return g(n)}function q(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e?b(t):t.split("")}var w=function(t,e){e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")},S=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!Array.isArray(t),r=t.length;return(t=i?new Array(t).fill(0):t).map((function(t,o){if(i)return e;var u=[e,t];return n&&(0===o&&u.push({isFirst:!0}),o+1===r&&u.push({isLast:!0})),u}))},A=function(t){t.parentNode.removeChild(t)},T=function(t){return 3!==t.nodeType&&"BR"!==t.tagName&&!t.firstChild},N=function(t){return t.some((function(t){return T(t)}))},L=function(t){for(var e=c(t.querySelectorAll("*")),n=N(e);e.length&&n;){var i=!1;e.forEach((function(t){T(t)&&(A(t),i=!0)})),i&&(e=c(t.querySelectorAll("*"))),n=N(e)}return e},x=function(t){return Array.isArray(t)||(t=[t/2,t/2]),{before:t[0],after:t[1],total:t[0]+t[1]}};function D(t,e,n){var i=(e=null!==e?e:t/3)/2;return n?[r(t,t/2),r(e,i)]:[t,e]}function $(){var r=this,l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h=l.typeIt,d=l.element,v=l.id,y=l.options,m=l.queue,T=void 0===m?[]:m,N=l.isAReset,E=void 0!==N&&N,M=function(){var t=c(r.$e.childNodes).filter((function(t){return!t.isEqualNode(j)}));return g(t,!1)},C=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=r.opts.nextStringDelay;r.queue.insert(t,[r.pause,n.before]),r.queue.insert(t+e+1,[r.pause,n.after])},H=function(){!z&&r.opts.cursor&&(o("@keyframes blink-".concat(v," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(v,"'] .ti-cursor { animation: blink-").concat(v," ").concat(r.opts.cursorSpeed/1e3,"s infinite; }"),v),(j=i("span")).innerHTML=p(r.opts.cursorChar).innerHTML,j.className="ti-cursor",j.setAttribute("style","display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;"),r.$e.appendChild(j))};this.wait=function(t,e){this.timeouts.push(setTimeout(t,e))};var P=function(){r.opts.strings.forEach((function(t,e){var n=q(t,r.opts.html);r.queue.add(S(n,r.type,!0));var o=r.queue.waiting.length;if(e+1!==r.opts.strings.length){if(r.opts.breakLines)return r.queue.add([r.type,i("BR")]),void C(o);r.queue.add(S(n,r.delete)),C(o,t.length)}}))},k=function(t){r.queue.reset().delete(0).add([r.pause,t.before],!0);for(var e=0;e<M().length;e++)r.queue.add([r.delete,null,{isPhantom:!0}],!0)},O=function(t){var e=r.$e.innerHTML;return e?(r.$e.innerHTML="",r.opts.startDelete?(b(e).forEach((function(t){f(r.$e,t)})),r.queue.add([r.delete,!0]),C(1),t):[e.trim()].concat(t)):t};this.pause=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n,i){t.wait((function(){return n()}),e||t.opts.nextStringDelay.total)}))},this.reset=function(){return this.queue.reset(),new $({typeIt:h,element:this.$e,id:v,options:this.opts,queue:this.queue.waiting,isAReset:!0})},this.init=function(){var t=this;if(!this.status.started){if(H(),!this.opts.waitUntilVisible)return this.status.started=!0,this.fire();new IntersectionObserver((function(e,n){e.forEach((function(e){e.isIntersecting&&(t.fire(),n.unobserve(t.$e))}))}),{threshold:1}).observe(this.$e)}},this.fire=function(){for(var t=this,e=this.queue.waiting.slice(),n=Promise.resolve(),i=function(i){var r=e[i],o=[r,t.queue,h];n=n.then((function(){return new Promise((function(e,n){var i,u;if(t.status.frozen)return n();(t.pace=D(t.opts.speed,t.opts.deleteSpeed,t.opts.lifeLike),r[2]&&r[2].isFirst)&&(u=t.opts).beforeString.apply(u,o);(i=t.opts).beforeStep.apply(i,o),r[0].call(t,r[1],r[2]).then((function(){var n,i,u=t.queue.waiting.shift();if(r[2]&&r[2].isPhantom)return e();r[2]&&r[2].isLast&&(i=t.opts).afterString.apply(i,o);return(n=t.opts).afterStep.apply(n,o),t.queue.executed.push(u),e()}))}))}))},r=0;r<e.length;r++)i(r);n.then((function(){if(t.opts.loop){var e=t.opts.loopDelay?t.opts.loopDelay:t.opts.nextStringDelay;t.wait((function(){k(e),t.fire()}),e.after)}t.status.completed=!0,t.opts.afterComplete(h)})).catch((function(){}))},this.type=function(e){var n=this;return"object"!==t(e)||e.content?new Promise((function(t){n.wait((function(){return f(n.$e,e),t()}),n.pace[0])})):(f(this.$e,e),Promise.resolve())},this.empty=function(){var t=this;return new Promise((function(e){return z?t.$e.value="":c(t.$e.childNodes).forEach((function(t){j.isEqualNode(t)||A(t)})),e()}))},this.delete=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n){t.wait((function(){var i=M();return i.length&&A(i[i.length-1]),L(t.$e),e&&i.length-1>0?t.delete(!0).then((function(){return n()})):n()}),t.pace[1])}))},this.setOptions=function(t){var e=this;return new Promise((function(n){return e.opts=Object.assign({},e.opts,t),n()}))};var j=null,z=s(d);this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.$e=d,this.timeouts=[],this.opts=Object.assign({},e,y),this.opts.html=!z&&this.opts.html,this.opts.nextStringDelay=x(this.opts.nextStringDelay),this.opts.loopDelay=x(this.opts.loopDelay),this.queue=new n(T,[this.pause,this.opts.startDelay]),this.$e.setAttribute("data-typeit-id",v),o("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}"),w(d,z);var I=a(this.opts.strings);I=O(I),this.opts.strings=u(I),this.opts.strings.length&&!E&&P()}return function(t,e){var n,r=this;this.instances=(n=t,"string"==typeof n?n=document.querySelectorAll(n):n.forEach||(n=[n]),c(n)).map((function(t){return new $({typeIt:r,element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[],isAReset:!1})}));var o=function(t){r.instances.forEach((function(e){t.call(r,e)}))},u=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;o((function(i){var o="string"!=typeof t,u=o?t:i[t],s=S(n,[u,o?r:e]);i.queue.add(s)}))};this.is=function(t){return e=this.instances,n=t,i=!0,!!e.length&&!e.some((function(t){return t.status[n]!==i}));var e,n,i},this.freeze=function(){o((function(t){t.status.frozen=!0}))},this.unfreeze=function(){o((function(t){t.status.frozen&&(t.status.frozen=!1,t.fire())}))},this.type=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o((function(e){var n=q(t,e.opts.html);e.queue.add(S(n,e.type,!0))})),this},this.delete=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return u("delete",null===t,null===t?1:t),this},this.pause=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return u("pause",t),this},this.break=function(){return u("type",i("BR")),this},this.options=function(t){return u("setOptions",t),this},this.exec=function(t){return u(t),this},this.destroy=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.instances=this.instances.map((function(e){if(e.timeouts.forEach((function(t){clearTimeout(t)})),e.timeouts=[],t){var n=e.isInput?null:e.$e.querySelector(".ti-cursor");n&&e.$e.removeChild(n)}return e.status.destroyed=!0,e}))},this.empty=function(){return u("empty"),this},this.reset=function(){return this.destroy(),this.instances=this.instances.map((function(t){return t.reset()})),this},this.go=function(){return o((function(t){t.init()})),this}}}));
{
"name": "typeit",
"version": "6.1.2",
"version": "6.1.3",
"description": "The most versatile animated typing utility on the planet.",

@@ -12,3 +12,3 @@ "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",

"main": "dist/typeit.min.js",
"module": "dist/typeit.min.js",
"module": "dist/typeit.es.min.js",
"files": [

@@ -18,6 +18,6 @@ "dist/"

"scripts": {
"build": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=webpack.config.js && npm run prettier",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=webpack.config.js",
"rollup": "NODE_ENV=production rollup -c",
"watch": "NODE_ENV=development rollup -c -w",
"build": "npm run rollup && npm run prettier",
"serve": "concurrently --kill-others \"npm run watch\" \"node serve.js\"",
"analyze": "node_modules/webpack/bin/webpack.js --profile --json > stats.json",
"precommit": "pretty-quick --staged",

@@ -43,5 +43,5 @@ "prettier": "prettier --write \"**/*.{md,js}\"",

"devDependencies": {
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"babel-jest": "^24.9.0",

@@ -51,9 +51,9 @@ "babel-loader": "^8.0.6",

"express": "^4.17.1",
"husky": "^3.0.9",
"husky": "^3.1.0",
"jest-cli": "^24.9.0",
"prettier": "^1.18.2",
"pretty-quick": "^2.0.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-merge": "^4.2.2"
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"rollup": "^1.27.12",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-terser": "^5.2.0"
},

@@ -60,0 +60,0 @@ "jest": {

@@ -35,3 +35,2 @@ # TypeIt

- Personal or Open Source - [FREE, go install it!](https://typeitjs.com/docs/#installation)
- Single Commercial License - [Purchase Here](https://typeitjs.com/checkout/limited)

@@ -50,3 +49,3 @@ - Extended Commercial License - [Purchase Here](https://typeitjs.com/checkout/unlimited)

Bundles exist for browsers that support ES2015+ (which accounts for a [very strong majority](https://caniuse.com/#feat=es6-class) of users), as well as for those that do not. If you're using IE11 or older, you'll also need the following polyfills:
There are two bundles generated -- an ES module version for [browsers that support them](https://caniuse.com/#feat=es6-module), and a fully transpiled bundle. When in doubt, go for the latter. If you're using IE11 or older, you'll also need the following polyfills:

@@ -53,0 +52,0 @@ - `Array.prototype.fill`

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