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.1 to 6.1.2

dist/.DS_Store

4

dist/typeit.min.js

@@ -5,3 +5,3 @@ /*!

* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.1
* Version: v6.1.2
* License: GPL-2.0

@@ -11,2 +11,2 @@ * 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)}var a=function(t){return["textarea","input"].indexOf(t.tagName.toLowerCase())>-1},c=function(t){return Array.isArray(t)?t:[t]},f=function(t){return[].slice.call(t)},l=function(t,e){var n=t.nextSibling;return!!n&&!n.isEqualNode(e)};function p(t){return(p="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 h=function(t,e){var n=e;if(a(t))t.value="".concat(t.value).concat(n);else{var i=f(t.childNodes).filter((function(t){return t.classList&&t.classList.contains("ti-cursor")}));if(i=i.length?i[0]:null,"object"===p(e)&&!(e instanceof HTMLElement)){var r=e.ancestorTree.slice(0).reverse().join(" "),u=f(t.querySelectorAll("".concat(r))),s=u[u.length-1];if(s&&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("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 c=f(t.querySelectorAll(e.ancestorTree[1]));t=c[c.length-1]}}n="object"===p(n)?n:document.createTextNode(n),t.insertBefore(n,i&&t.hasAttribute("data-typeit-id")?i:null)}},d=function(t){var e=[];return e.concat.apply(e,t)},y=function(t){var e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body},v=function(t){return f(t.childNodes).map((function(t){return 3===t.nodeType?t.nodeValue.split(""):t}))},m=function(t,e,n){return{ancestorTree:e,attributes:(i=t,f(i.attributes).map((function(t){return{name:t.name,value:t.nodeValue}}))),content:n};var i},g=function(t,e){var n=m(t,e,""),i=v(t).map((function(n,i){return Array.isArray(n)?n.map((function(n,i){return m(t,e,n)})):n}));return i.unshift(n),d(i)},b=function(t){return t instanceof HTMLElement&&"BR"!==t.tagName},S=function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e.map((function(t){if(b(t)){if(!n)return f(t.childNodes);for(var e=t.parentNode,i=[t.tagName];["BODY","HTML"].indexOf(e.tagName)<0;)i.push(e.tagName),e=e.parentNode;return g(t,i)}return t}));return(i=d(i)).some((function(t){return b(t)}))?t(i,n):i};function w(t){var e=y(t),n=v(e);return S(n)}function q(t){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?w(t):t.split("")}var x=function(t,e){e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")},T=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)},N=function(t){return 3!==t.nodeType&&"BR"!==t.tagName&&!t.firstChild},L=function(t){return t.some((function(t){return N(t)}))},M=function(t){for(var e=f(t.querySelectorAll("*")),n=L(e);e.length&&n;){var i=!1;e.forEach((function(t){N(t)&&(A(t),i=!0)})),i&&(e=f(t.querySelectorAll("*"))),n=L(e)}return e},D=function(t){return Array.isArray(t)||(t=[t/2,t/2]),{before:t[0],after:t[1],total:t[0]+t[1]}},$=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 j(t){return(j="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 E(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.typeIt,u=e.element,l=e.id,p=e.options,d=e.queue,v=void 0===d?[]:d,m=e.isAReset,g=void 0!==m&&m,b=function(){var e=f(t.$e.childNodes).filter((function(t){return!t.isEqualNode(L)}));return S(e,!1)},N=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])};this.wait=function(t,e){this.timeouts.push(setTimeout(t,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 E({typeIt:n,element:this.$e,id:l,options:this.opts,queue:this.queue.waiting,isAReset:!0})},this.init=function(){var e=this;if(!this.status.started){if(!O&&t.opts.cursor&&(s("@keyframes blink-".concat(l," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(l,"'] .ti-cursor { animation: blink-").concat(l," ").concat(t.opts.cursorSpeed/1e3,"s infinite; }"),l),(L=o("span")).innerHTML=y(t.opts.cursorChar).innerHTML,L.className="ti-cursor",L.setAttribute("style","display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;"),t.$e.appendChild(L)),!this.opts.waitUntilVisible)return this.status.started=!0,this.fire();new IntersectionObserver((function(t,n){t.forEach((function(t){t.isIntersecting&&(e.fire(),n.unobserve(e.$e))}))}),{threshold:1}).observe(this.$e)}},this.fire=function(){for(var e=this,i=this.queue.waiting.slice(),r=Promise.resolve(),o=function(t){var o=i[t],u=[o,e.queue,n];r=r.then((function(){return new Promise((function(t,n){var i,r;if(e.status.frozen)return n();(e.pace=$(e.opts.speed,e.opts.deleteSpeed,e.opts.lifeLike),o[2]&&o[2].isFirst)&&(r=e.opts).beforeString.apply(r,u);(i=e.opts).beforeStep.apply(i,u),o[0].call(e,o[1],o[2]).then((function(){var n,i,r=e.queue.waiting.shift();if(o[2]&&o[2].isPhantom)return t();o[2]&&o[2].isLast&&(i=e.opts).afterString.apply(i,u);return(n=e.opts).afterStep.apply(n,u),e.queue.executed.push(r),t()}))}))}))},u=0;u<i.length;u++)o(u);r.then((function(){if(e.opts.loop){var i=e.opts.loopDelay?e.opts.loopDelay:e.opts.nextStringDelay;e.wait((function(){!function(e){t.queue.reset().delete(0).add([t.pause,e.before],!0);for(var n=0;n<b().length;n++)t.queue.add([t.delete,null,{isPhantom:!0}],!0)}(i),e.fire()}),i.after)}e.status.completed=!0,e.opts.afterComplete(n)})).catch((function(){}))},this.type=function(t){var e=this;return"object"!==j(t)||t.content?new Promise((function(n){e.wait((function(){return h(e.$e,t),n()}),e.pace[0])})):(h(this.$e,t),Promise.resolve())},this.empty=function(){var t=this;return new Promise((function(e){return O?t.$e.value="":f(t.$e.childNodes).forEach((function(t){L.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=b();return i.length&&A(i[i.length-1]),M(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 L=null,O=a(u);this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.$e=u,this.timeouts=[],this.opts=Object.assign({},i,p),this.opts.html=!O&&this.opts.html,this.opts.nextStringDelay=D(this.opts.nextStringDelay),this.opts.loopDelay=D(this.opts.loopDelay),this.queue=new r(v,[this.pause,this.opts.startDelay]),this.$e.setAttribute("data-typeit-id",l),s("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}"),x(u,O);var P=c(this.opts.strings);P=function(e){var n=t.$e.innerHTML;return n?(t.$e.innerHTML="",t.opts.startDelete?(w(n).forEach((function(e){h(t.$e,e)})),t.queue.add([t.delete,!0]),N(1),e):[n.trim()].concat(e)):e}(P),this.opts.strings=P.map((function(t){return t.replace(/<\!--.*?-->/g,"")})),this.opts.strings.length&&!g&&t.opts.strings.forEach((function(e,n){var i=q(e,t.opts.html);t.queue.add(T(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 N(r);t.queue.add(T(i,t.delete)),N(r,e.length)}}))}var O=function(t,e,n){return!!t.length&&!t.some((function(t){return t.status[e]!==n}))},P=function(t){return"string"==typeof t?t=document.querySelectorAll(t):t.forEach||(t=[t]),f(t)};function C(t,e){var n=this;this.instances=P(t).map((function(t){return new E({typeIt:n,element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[],isAReset:!1})}));var i=function(t){n.instances.forEach((function(e){t.call(n,e)}))},r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;i((function(i){var o="string"!=typeof t,u=o?t:i[t],s=T(r,[u,o?n:e]);i.queue.add(s)}))};this.is=function(t){return O(this.instances,t,!0)},this.freeze=function(){i((function(t){t.status.frozen=!0}))},this.unfreeze=function(){i((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 i((function(e){var n=q(t,e.opts.html);e.queue.add(T(n,e.type,!0))})),this},this.delete=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r("delete",null===t,null===t?1:t),this},this.pause=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r("pause",t),this},this.break=function(){return r("type",o("BR")),this},this.options=function(t){return r("setOptions",t),this},this.exec=function(t){return r(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 r("empty"),this},this.reset=function(){return this.destroy(),this.instances=this.instances.map((function(t){return t.reset()})),this},this.go=function(){return i((function(t){t.init()})),this}}n.d(e,"default",(function(){return C}))}]).default}));
!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}));

@@ -5,3 +5,3 @@ /*!

* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.1
* Version: v6.1.2
* License: GPL-2.0

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

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

@@ -36,4 +36,4 @@ # TypeIt

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

@@ -40,0 +40,0 @@ ## Demos

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