Comparing version 5.4.0 to 5.4.1
@@ -5,3 +5,3 @@ /*! | ||
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me) | ||
* Version: v5.4.0 | ||
* Version: v5.4.1 | ||
* URL: https://typeitjs.com | ||
@@ -543,3 +543,7 @@ * License: GPL-2.0 | ||
_this6.elementContainer.innerHTML = textArray.join(""); | ||
//-- Make the content a string again, AND strip out any empty HTML tags. | ||
//-- We want do strip empty tags here and ONLY here because when we're | ||
//-- typing new content inside an HTML tag, there is momentarily an empty | ||
//-- tag we want to keep. | ||
_this6.elementContainer.innerHTML = textArray.join("").replace(/<[^\/>][^>]*><\/[^>]+>/, ""); | ||
@@ -546,0 +550,0 @@ //-- Delete again! Don't call directly, to respect possible pauses. |
@@ -5,3 +5,3 @@ /*! | ||
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me) | ||
* Version: v5.4.0 | ||
* Version: v5.4.1 | ||
* URL: https://typeitjs.com | ||
@@ -549,3 +549,7 @@ * License: GPL-2.0 | ||
_this6.elementContainer.innerHTML = textArray.join(""); | ||
//-- Make the content a string again, AND strip out any empty HTML tags. | ||
//-- We want do strip empty tags here and ONLY here because when we're | ||
//-- typing new content inside an HTML tag, there is momentarily an empty | ||
//-- tag we want to keep. | ||
_this6.elementContainer.innerHTML = textArray.join("").replace(/<[^\/>][^>]*><\/[^>]+>/, ""); | ||
@@ -552,0 +556,0 @@ //-- Delete again! Don't call directly, to respect possible pauses. |
@@ -5,3 +5,3 @@ /*! | ||
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me) | ||
* Version: v5.4.0 | ||
* Version: v5.4.1 | ||
* URL: https://typeitjs.com | ||
@@ -14,3 +14,3 @@ * License: GPL-2.0 | ||
* Removes helper elements with certain classes from the TypeIt element. | ||
*/},{key:"removeHelperElements",value:function(){var e=this,t=this.element.querySelectorAll(".ti-container, .ti-cursor");[].forEach.call(t,function(t){e.element.removeChild(t)})}},{key:"setOptions",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n={};null===t&&(t=this.options);for(var s in t)n[s]=t[s];for(var o in e)n[o]=e[o];this.options=n,i&&this.next()}},{key:"randomInRange",value:function(e,t){return Math.abs(Math.random()*(e+t-(e-t))+(e-t))}},{key:"setPace",value:function(){var e=this.options.speed,t=void 0!==this.options.deleteSpeed?this.options.deleteSpeed:this.options.speed/3,i=e/2,n=t/2;this.typePace=this.options.lifeLike?this.randomInRange(e,i):e,this.deletePace=this.options.lifeLike?this.randomInRange(t,n):t}},{key:"delete",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.timeouts[1]=setTimeout(function(){e.setPace();for(var i=e.elementContainer.innerHTML.split(""),n=i.length-1;n>-1;n--){if(">"!==i[n]&&";"!==i[n]||!e.options.html){i.pop();break}for(var s=n;s>-1;s--){if("<br>"===i.slice(s-3,s+1).join("")){i.splice(s-3,4);break}if("&"===i[s]){i.splice(s,n-s+1);break}if("<"===i[s]&&">"!==i[s-1]){if(";"===i[s-1])for(var o=s-1;o>-1;o--)if("&"===i[o]){i.splice(o,s-o);break}i.splice(s-1,1);break}}break}if(e.elementContainer.innerHTML.indexOf("></")>-1)for(var r=e.elementContainer.innerHTML.indexOf("></")-2;r>=0;r--)if("<"===i[r]){i.splice(r,i.length-r);break}e.elementContainer.innerHTML=i.join(""),null===t&&e.queue.unshift([e.delete,i.length]),t>1&&e.queue.unshift([e.delete,t-1]),e.next()},this.deletePace)}},{key:"empty",value:function(){this.elementContainer.innerHTML="",this.next()}},{key:"next",value:function(){var e=this;if(!this.isFrozen){if(this.queue.length>0){var t=this.queue[0];return this.queue.shift(),void t[0].call(this,t[1])}this.options.callback(),this.options.loop?(this.queueUpDeletions(this.elementContainer.innerHTML),this.generateQueue([this.pause,this.options.loopDelay/2]),setTimeout(function(){e.next()},this.options.loopDelay/2)):this.isComplete=!0}}}]),e}();return function(){function s(i,n){t(this,s),this.id=this.generateHash(),this.instances=[],this.elements=[],this.args=n,"object"===(void 0===i?"undefined":e(i))&&(void 0===i.length?this.elements.push(i):this.elements=i),"string"==typeof i&&(this.elements=document.querySelectorAll(i)),this.createInstances()}return i(s,[{key:"generateHash",value:function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}},{key:"createInstances",value:function(){var e=this;[].slice.call(this.elements).forEach(function(t){e.instances.push(new n(t,e.id,e.args))})}},{key:"pushAction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.instances.forEach(function(i){i.queue.push([i[e],t]),!0===i.isComplete&&i.next()})} | ||
*/},{key:"removeHelperElements",value:function(){var e=this,t=this.element.querySelectorAll(".ti-container, .ti-cursor");[].forEach.call(t,function(t){e.element.removeChild(t)})}},{key:"setOptions",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n={};null===t&&(t=this.options);for(var s in t)n[s]=t[s];for(var o in e)n[o]=e[o];this.options=n,i&&this.next()}},{key:"randomInRange",value:function(e,t){return Math.abs(Math.random()*(e+t-(e-t))+(e-t))}},{key:"setPace",value:function(){var e=this.options.speed,t=void 0!==this.options.deleteSpeed?this.options.deleteSpeed:this.options.speed/3,i=e/2,n=t/2;this.typePace=this.options.lifeLike?this.randomInRange(e,i):e,this.deletePace=this.options.lifeLike?this.randomInRange(t,n):t}},{key:"delete",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.timeouts[1]=setTimeout(function(){e.setPace();for(var i=e.elementContainer.innerHTML.split(""),n=i.length-1;n>-1;n--){if(">"!==i[n]&&";"!==i[n]||!e.options.html){i.pop();break}for(var s=n;s>-1;s--){if("<br>"===i.slice(s-3,s+1).join("")){i.splice(s-3,4);break}if("&"===i[s]){i.splice(s,n-s+1);break}if("<"===i[s]&&">"!==i[s-1]){if(";"===i[s-1])for(var o=s-1;o>-1;o--)if("&"===i[o]){i.splice(o,s-o);break}i.splice(s-1,1);break}}break}if(e.elementContainer.innerHTML.indexOf("></")>-1)for(var r=e.elementContainer.innerHTML.indexOf("></")-2;r>=0;r--)if("<"===i[r]){i.splice(r,i.length-r);break}e.elementContainer.innerHTML=i.join("").replace(/<[^\/>][^>]*><\/[^>]+>/,""),null===t&&e.queue.unshift([e.delete,i.length]),t>1&&e.queue.unshift([e.delete,t-1]),e.next()},this.deletePace)}},{key:"empty",value:function(){this.elementContainer.innerHTML="",this.next()}},{key:"next",value:function(){var e=this;if(!this.isFrozen){if(this.queue.length>0){var t=this.queue[0];return this.queue.shift(),void t[0].call(this,t[1])}this.options.callback(),this.options.loop?(this.queueUpDeletions(this.elementContainer.innerHTML),this.generateQueue([this.pause,this.options.loopDelay/2]),setTimeout(function(){e.next()},this.options.loopDelay/2)):this.isComplete=!0}}}]),e}();return function(){function s(i,n){t(this,s),this.id=this.generateHash(),this.instances=[],this.elements=[],this.args=n,"object"===(void 0===i?"undefined":e(i))&&(void 0===i.length?this.elements.push(i):this.elements=i),"string"==typeof i&&(this.elements=document.querySelectorAll(i)),this.createInstances()}return i(s,[{key:"generateHash",value:function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}},{key:"createInstances",value:function(){var e=this;[].slice.call(this.elements).forEach(function(t){e.instances.push(new n(t,e.id,e.args))})}},{key:"pushAction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.instances.forEach(function(i){i.queue.push([i[e],t]),!0===i.isComplete&&i.next()})} | ||
/** | ||
@@ -17,0 +17,0 @@ * If used after typing has started, will append strings to the end of the existing queue. If used when typing is paused, will restart it. |
{ | ||
"name": "typeit", | ||
"version": "5.4.0", | ||
"version": "5.4.1", | ||
"description": "The most versatile animated typing utility on the planet.", | ||
@@ -17,3 +17,3 @@ "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)", | ||
"scripts": { | ||
"build": "rollup -c && prettier src/* --write", | ||
"build": "rollup -c && prettier src/* --write && prettier tests/* --write", | ||
"watch": "rollup -c -w", | ||
@@ -28,2 +28,3 @@ "serve": "concurrently --kill-others \"rollup -c -w\" \"node serve.js\"", | ||
"typing", | ||
"typing effect", | ||
"typewriter", | ||
@@ -30,0 +31,0 @@ "typewriter effect", |
@@ -227,3 +227,3 @@ # TypeIt | ||
| cursorSpeed | (number in milliseconds) The blinking speed of the cursor. | 1000 | | ||
| cursorChar | (string) The character used for the cursor. HTML works too! | '|' | | ||
| cursorChar | (string) The character used for the cursor. HTML works too! | pipe | | ||
| breakLines | (boolean) Choose whether you want multiple strings to be printed on top of each other (`breakLines: true`), or if you want each string to be deleted and replaced by the next one (`breakLines: false`). | true | | ||
@@ -230,0 +230,0 @@ | nextStringDelay | (number in milliseconds) The amount of time (milliseconds) between typing the next string when multiple strings are defined. | 750 | |
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
86687
1338