title-switcher 2.1.13 → 2.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -0
- package/README.md +14 -0
- package/browser/titleSwitcher.js +1569 -5547
- package/browser/titleSwitcher.min.js +1 -1
- package/dist/main.d.ts +80 -90
- package/dist/main.js +365 -401
- package/dist/main.min.js +1 -1
- package/package.json +5 -8
package/dist/main.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.symbol.to-primitive.js"),require("core-js/modules/es.date.to-primitive.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.array.for-each.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.object.define-property.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.sticky.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.for-each.js"),require("core-js/modules/esnext.weak-map.delete-all.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.timers.js");var _this=void 0;function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var _TitleSwitcher_active,_TitleSwitcher_currentClass,_TitleSwitcher_currentIndex,_TitleSwitcher_delayEffect,_TitleSwitcher_delaySwitch,_TitleSwitcher_isRandom,_TitleSwitcher_titles,_TitleSwitcher_titlesContainer,_TitleSwitcher_switchStyle,_TitleSwitcher_typeSurface,__classPrivateFieldSet=function(e,t,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,i):s?s.value=i:t.set(e,i),i},__classPrivateFieldGet=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};Object.defineProperty(exports,"__esModule",{value:!0});var TitleSwitcher=function(){return _createClass((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"typingEffect";_classCallCheck(this,e),_TitleSwitcher_active.set(this,!1),_TitleSwitcher_currentClass.set(this,"displayTitle"),_TitleSwitcher_currentIndex.set(this,0),_TitleSwitcher_delayEffect.set(this,200),_TitleSwitcher_delaySwitch.set(this,400),_TitleSwitcher_isRandom.set(this,!1),_TitleSwitcher_titles.set(this,[]),_TitleSwitcher_titlesContainer.set(this,""),_TitleSwitcher_switchStyle.set(this,void 0),_TitleSwitcher_typeSurface.set(this,void 0),__classPrivateFieldSet(this,_TitleSwitcher_currentClass,"displayTitle","f"),__classPrivateFieldSet(this,_TitleSwitcher_switchStyle,"string"==typeof i?"function"==typeof this[i]?this[i]:this.typingEffect:i,"f"),__classPrivateFieldSet(this,_TitleSwitcher_titlesContainer,t,"f"),__classPrivateFieldSet(this,_TitleSwitcher_titles,[],"f");var r=t?document.querySelectorAll(t):[];r&&r[0]&&(__classPrivateFieldSet(this,_TitleSwitcher_titlesContainer,r[0],"f"),__classPrivateFieldSet(this,_TitleSwitcher_titles,r[0].children,"f"))}),[{key:"active",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_active,"f")}},{key:"currentClass",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f")}},{key:"currentIndex",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")}},{key:"delayEffect",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_delayEffect,"f")}},{key:"delaySwitch",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_delaySwitch,"f")}},{key:"switchStyle",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_switchStyle,"f")}},{key:"titles",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_titles,"f")}},{key:"typeSurface",get:function(){return __classPrivateFieldGet(this,_TitleSwitcher_typeSurface,"f")}},{key:"startTitles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.delaySwitch,i=void 0===t?400:t,r=e.delayEffect,s=void 0===r?200:r,l=e.isRandom,c=void 0!==l&&l,a=e.immediatePause,n=void 0!==a&&a,o="typeSurface";if(__classPrivateFieldSet(this,_TitleSwitcher_delaySwitch,i,"f"),__classPrivateFieldSet(this,_TitleSwitcher_delayEffect,s,"f"),__classPrivateFieldSet(this,_TitleSwitcher_isRandom,c,"f"),__classPrivateFieldSet(this,_TitleSwitcher_active,!n,"f"),__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")>=__classPrivateFieldGet(this,_TitleSwitcher_titles,"f").length||"string"==typeof __classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f"))return __classPrivateFieldSet(this,_TitleSwitcher_active,!1,"f"),console.warn("No titles found for '".concat(__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f"),"'")),this;__classPrivateFieldGet(this,_TitleSwitcher_isRandom,"f")&&__classPrivateFieldSet(this,_TitleSwitcher_currentIndex,Math.round(Math.random()*(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f").length-2))+1,"f");var _=__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")];_.classList?_.classList.add(__classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f")):_.className+=" "+__classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f");var h=__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[0].cloneNode(!0);return h.classList?h.classList.add(o):h.className+=" "+o,h.classList?h.classList.remove(__classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f")):h.className=h.className.replace(new RegExp("(^|\\b)"+h.className.split(" ").join("|")+"(\\b|$)","gi")," "),__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f").insertBefore(h,__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f").firstChild),__classPrivateFieldSet(this,_TitleSwitcher_typeSurface,__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f").querySelectorAll("."+o)[0],"f"),__classPrivateFieldGet(this,_TitleSwitcher_typeSurface,"f").innerHTML="",__classPrivateFieldGet(this,_TitleSwitcher_typeSurface,"f").style.display="block",Array.prototype.forEach.call(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f"),(function(e){e.style.display="none"})),this.switchTitle(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")],__classPrivateFieldGet(this,_TitleSwitcher_switchStyle,"f"),this)}},{key:"pause",value:function(){__classPrivateFieldSet(this,_TitleSwitcher_active,!1,"f")}},{key:"resume",value:function(){__classPrivateFieldGet(this,_TitleSwitcher_active,"f")||(__classPrivateFieldSet(this,_TitleSwitcher_active,!0,"f"),this.switchTitle(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")],__classPrivateFieldGet(this,_TitleSwitcher_switchStyle,"f"),this))}},{key:"switchTitle",value:function(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1,l=__classPrivateFieldGet(i=i||this,_TitleSwitcher_titles,"f").length,c=1;c<l;++c)if(__classPrivateFieldGet(i,_TitleSwitcher_titles,"f")[c]===e){s=c;break}if(!__classPrivateFieldGet(i,_TitleSwitcher_active,"f"))return __classPrivateFieldSet(i,_TitleSwitcher_currentIndex,s,"f"),i;var a=__classPrivateFieldGet(i,_TitleSwitcher_titles,"f").length-1,n=1;if(1===a)return t(e,r?function(){return i}:i.switchTitle,i,r);if(__classPrivateFieldGet(i,_TitleSwitcher_isRandom,"f")){i.typeSurface.textContent.trim()||(s=-1);do{n=Math.round(Math.random()*(a-1))+1}while(n===s)}else i.typeSurface.textContent.trim()||(s=a),n=s<a?s+1:1;var o=__classPrivateFieldGet(i,_TitleSwitcher_titles,"f")[n];return e.classList?e.classList.remove(i.currentClass):e.className=e.className.replace(new RegExp("(^|\\b)"+e.className.split(" ").join("|")+"(\\b|$)","gi")," "),o.classList?o.classList.add(i.currentClass):o.className+=" "+i.currentClass,t(o,r?function(){return i}:i.switchTitle,i,r)}}])}();_TitleSwitcher_active=new WeakMap,_TitleSwitcher_currentClass=new WeakMap,_TitleSwitcher_currentIndex=new WeakMap,_TitleSwitcher_delayEffect=new WeakMap,_TitleSwitcher_delaySwitch=new WeakMap,_TitleSwitcher_isRandom=new WeakMap,_TitleSwitcher_titles=new WeakMap,_TitleSwitcher_titlesContainer=new WeakMap,_TitleSwitcher_switchStyle=new WeakMap,_TitleSwitcher_typeSurface=new WeakMap,TitleSwitcher.prototype.cursorBlink=function(e,t){return t=t||_this,e?(t.typeSurface.innerHTML=t.typeSurface.innerHTML.replace(/\|| *(<\/span>)?$/,"$1").trim(),t.typeSurface.innerHTML=t.typeSurface.innerHTML+'<span style="display: inline-block;font-weight: normal; color: black; text-decoration: none">|</span>'):t.typeSurface.innerHTML=t.typeSurface.innerHTML.replace(/\|(<\/span>)$/," $1"),t},TitleSwitcher.prototype.typingEffect=function(e,t,i){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=(i=i||_this).titles.length,l=0,c=1;c<s;++c)if(i.titles[c]===e){l=c;break}e=e||i.titles[l+1];var a=!0;i.typeSurface.hasAttribute("style")&&i.typeSurface.removeAttribute("style"),e.hasAttribute("style")&&i.typeSurface.setAttribute("style",e.getAttribute("style")),i.typeSurface.innerHTML="",i.typeSurface.style.display="block";for(var n=0;n<4;++n)setTimeout((function(){i.cursorBlink(a,i),a=!a}),n*i.delaySwitch);return setTimeout((function(){i.typeSurface.innerHTML="",i.cursorBlink(!0,i),e.textContent.split("").forEach((function(s,l){setTimeout((function(){if(i.typeSurface.innerHTML=i.typeSurface.textContent.replace("|","")+s+'<span style="font-weight: normal; color: black; text-decoration: none">|</span>',e.textContent+"|"===i.typeSurface.textContent){i.typeSurface.innerHTML=e.innerHTML+'<span style="font-weight: normal; color: black; text-decoration: none">|</span>';for(var l=function(s){setTimeout((function(){--s,i.cursorBlink(a,i),0===s&&t(e,r?function(){return i}:i.switchStyle,i,r)}),s*i.delaySwitch),c=s},c=0;c<8;++c)l(c)}}),l*i.delayEffect)}))}),4*i.delaySwitch),i},exports.default=TitleSwitcher,"undefined"!=typeof window&&(window.TitleSwitcher=TitleSwitcher);
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js");var _TitleSwitcher_active,_TitleSwitcher_currentClass,_TitleSwitcher_currentIndex,_TitleSwitcher_delayEffect,_TitleSwitcher_delaySwitch,_TitleSwitcher_isRandom,_TitleSwitcher_titles,_TitleSwitcher_titlesContainer,_TitleSwitcher_switchStyle,_TitleSwitcher_typeSurface,__classPrivateFieldSet=function(e,t,i,s,l){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!l)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!l:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?l.call(e,i):l?l.value=i:t.set(e,i),i},__classPrivateFieldGet=function(e,t,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)};Object.defineProperty(exports,"__esModule",{value:!0});class TitleSwitcher{constructor(e="",t="typingEffect"){_TitleSwitcher_active.set(this,!1),_TitleSwitcher_currentClass.set(this,"displayTitle"),_TitleSwitcher_currentIndex.set(this,0),_TitleSwitcher_delayEffect.set(this,200),_TitleSwitcher_delaySwitch.set(this,400),_TitleSwitcher_isRandom.set(this,!1),_TitleSwitcher_titles.set(this,[]),_TitleSwitcher_titlesContainer.set(this,""),_TitleSwitcher_switchStyle.set(this,void 0),_TitleSwitcher_typeSurface.set(this,void 0),__classPrivateFieldSet(this,_TitleSwitcher_currentClass,"displayTitle","f"),__classPrivateFieldSet(this,_TitleSwitcher_switchStyle,"string"==typeof t?"function"==typeof this[t]?this[t]:this.typingEffect:t,"f"),__classPrivateFieldSet(this,_TitleSwitcher_titlesContainer,e,"f"),__classPrivateFieldSet(this,_TitleSwitcher_titles,[],"f");const i=e?document.querySelectorAll(e):[];i&&i[0]&&(__classPrivateFieldSet(this,_TitleSwitcher_titlesContainer,i[0],"f"),__classPrivateFieldSet(this,_TitleSwitcher_titles,i[0].children,"f"))}get active(){return __classPrivateFieldGet(this,_TitleSwitcher_active,"f")}get currentClass(){return __classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f")}get currentIndex(){return __classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")}get delayEffect(){return __classPrivateFieldGet(this,_TitleSwitcher_delayEffect,"f")}get delaySwitch(){return __classPrivateFieldGet(this,_TitleSwitcher_delaySwitch,"f")}get switchStyle(){return __classPrivateFieldGet(this,_TitleSwitcher_switchStyle,"f")}get titles(){return __classPrivateFieldGet(this,_TitleSwitcher_titles,"f")}get typeSurface(){return __classPrivateFieldGet(this,_TitleSwitcher_typeSurface,"f")}startTitles({delaySwitch:e=400,delayEffect:t=200,isRandom:i=!1,immediatePause:s=!1}={}){const l="typeSurface";if(__classPrivateFieldSet(this,_TitleSwitcher_delaySwitch,e,"f"),__classPrivateFieldSet(this,_TitleSwitcher_delayEffect,t,"f"),__classPrivateFieldSet(this,_TitleSwitcher_isRandom,i,"f"),__classPrivateFieldSet(this,_TitleSwitcher_active,!s,"f"),__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")>=__classPrivateFieldGet(this,_TitleSwitcher_titles,"f").length||"string"==typeof __classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f"))return __classPrivateFieldSet(this,_TitleSwitcher_active,!1,"f"),console.warn(`No titles found for '${__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f")}'`),this;__classPrivateFieldGet(this,_TitleSwitcher_isRandom,"f")&&__classPrivateFieldSet(this,_TitleSwitcher_currentIndex,Math.round(Math.random()*(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f").length-2))+1,"f");const r=__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")];r.classList?r.classList.add(__classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f")):r.className+=" "+__classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f");const a=__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[0].cloneNode(!0);return a.classList?a.classList.add(l):a.className+=" "+l,a.classList?a.classList.remove(__classPrivateFieldGet(this,_TitleSwitcher_currentClass,"f")):a.className=a.className.replace(new RegExp("(^|\\b)"+a.className.split(" ").join("|")+"(\\b|$)","gi")," "),__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f").insertBefore(a,__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f").firstChild),__classPrivateFieldSet(this,_TitleSwitcher_typeSurface,__classPrivateFieldGet(this,_TitleSwitcher_titlesContainer,"f").querySelectorAll("."+l)[0],"f"),__classPrivateFieldGet(this,_TitleSwitcher_typeSurface,"f").innerHTML="",__classPrivateFieldGet(this,_TitleSwitcher_typeSurface,"f").style.display="block",Array.prototype.forEach.call(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f"),(function(e){e.style.display="none"})),this.switchTitle(r,__classPrivateFieldGet(this,_TitleSwitcher_switchStyle,"f"),this)}pause(){__classPrivateFieldSet(this,_TitleSwitcher_active,!1,"f")}resume(){__classPrivateFieldGet(this,_TitleSwitcher_active,"f")||(__classPrivateFieldSet(this,_TitleSwitcher_active,!0,"f"),this.switchTitle(__classPrivateFieldGet(this,_TitleSwitcher_titles,"f")[__classPrivateFieldGet(this,_TitleSwitcher_currentIndex,"f")],__classPrivateFieldGet(this,_TitleSwitcher_switchStyle,"f"),this))}switchTitle(e,t,i,s=!1){let l=1;const r=__classPrivateFieldGet(i=i||this,_TitleSwitcher_titles,"f").length;for(let t=1;t<r;++t)if(__classPrivateFieldGet(i,_TitleSwitcher_titles,"f")[t]===e){l=t;break}if(!__classPrivateFieldGet(i,_TitleSwitcher_active,"f"))return __classPrivateFieldSet(i,_TitleSwitcher_currentIndex,l,"f"),i;const a=__classPrivateFieldGet(i,_TitleSwitcher_titles,"f").length-1;let c=1;if(1===a)return t(e,s?()=>i:i.switchTitle,i,s);if(__classPrivateFieldGet(i,_TitleSwitcher_isRandom,"f")){i.typeSurface.textContent.trim()||(l=-1);do{c=Math.round(Math.random()*(a-1))+1}while(c===l)}else i.typeSurface.textContent.trim()||(l=a),c=l<a?l+1:1;const _=__classPrivateFieldGet(i,_TitleSwitcher_titles,"f")[c];return e.classList?e.classList.remove(i.currentClass):e.className=e.className.replace(new RegExp("(^|\\b)"+e.className.split(" ").join("|")+"(\\b|$)","gi")," "),_.classList?_.classList.add(i.currentClass):_.className+=" "+i.currentClass,t(_,s?()=>i:i.switchTitle,i,s)}}_TitleSwitcher_active=new WeakMap,_TitleSwitcher_currentClass=new WeakMap,_TitleSwitcher_currentIndex=new WeakMap,_TitleSwitcher_delayEffect=new WeakMap,_TitleSwitcher_delaySwitch=new WeakMap,_TitleSwitcher_isRandom=new WeakMap,_TitleSwitcher_titles=new WeakMap,_TitleSwitcher_titlesContainer=new WeakMap,_TitleSwitcher_switchStyle=new WeakMap,_TitleSwitcher_typeSurface=new WeakMap,TitleSwitcher.prototype.cursorBlink=(e,t)=>(t=t||void 0,e?(t.typeSurface.innerHTML=t.typeSurface.innerHTML.replace(/\|| *(<\/span>)?$/,"$1").trim(),t.typeSurface.innerHTML=t.typeSurface.innerHTML+'<span style="display: inline-block;font-weight: normal; color: black; text-decoration: none">|</span>'):t.typeSurface.innerHTML=t.typeSurface.innerHTML.replace(/\|(<\/span>)$/," $1"),t);const typedPartialHtml=(e,t)=>{let i="";const s=Array.prototype.slice.call(e.childNodes);for(let e=0;e<s.length&&t>0;++e){const l=s[e];if(3===l.nodeType){const e=l.textContent||"",s=Math.min(t,e.length);i+=e.slice(0,s),t-=s}else if(1===l.nodeType){const e=typedPartialHtml(l,t);if(e.html){const t=l.cloneNode(!1);t.innerHTML=e.html,i+=t.outerHTML}t=e.remaining}}return{html:i,remaining:t}};TitleSwitcher.prototype.typingEffect=(e,t,i,s=!1)=>{const l=(i=i||void 0).titles.length;let r=0;for(let t=1;t<l;++t)if(i.titles[t]===e){r=t;break}e=e||i.titles[r+1];let a=!0;i.typeSurface.hasAttribute("style")&&i.typeSurface.removeAttribute("style"),e.hasAttribute("style")&&i.typeSurface.setAttribute("style",e.getAttribute("style")),i.typeSurface.innerHTML="",i.typeSurface.style.display="block";for(let e=0;e<4;++e)setTimeout((()=>{i.cursorBlink(a,i),a=!a}),e*i.delaySwitch);return setTimeout((()=>{i.typeSurface.innerHTML="",i.cursorBlink(!0,i);const l=e.textContent.length;for(let r=0;r<l;++r)setTimeout((()=>{if(i.typeSurface.innerHTML=typedPartialHtml(e,r+1).html+'<span style="font-weight: normal; color: black; text-decoration: none">|</span>',e.textContent+"|"===i.typeSurface.textContent){i.typeSurface.innerHTML=e.innerHTML+'<span style="font-weight: normal; color: black; text-decoration: none">|</span>';for(let l=0;l<8;++l)setTimeout((()=>{--l,i.cursorBlink(a,i),0===l&&t(e,s?()=>i:i.switchStyle,i,s)}),l*i.delaySwitch)}}),r*i.delayEffect)}),4*i.delaySwitch),i},exports.default=TitleSwitcher,"undefined"!=typeof window&&(window.TitleSwitcher=TitleSwitcher);
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "title-switcher",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"description": "Add typing effect to titles and also switch through several titles.",
|
|
5
5
|
"main": "dist/main.min.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "gulp build",
|
|
9
9
|
"dev": "gulp",
|
|
10
|
-
"
|
|
11
|
-
"readme": "gulp readme",
|
|
10
|
+
"docs": "gulp docs",
|
|
12
11
|
"resolutions": "npx npm-force-resolutions",
|
|
13
12
|
"test": "gulp testFull",
|
|
13
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
14
14
|
"test:quick": "gulp testQuick",
|
|
15
15
|
"watch": "gulp watchFull",
|
|
16
16
|
"watch:test": "gulp watchTest"
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/jheagle/title-switcher-v2#readme",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"js-build-tools": "^
|
|
37
|
+
"js-build-tools": "^5.3.2",
|
|
38
|
+
"typedoc": "^0.28.20"
|
|
38
39
|
},
|
|
39
|
-
"dependencies": {},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
42
42
|
"browser"
|
|
@@ -45,8 +45,5 @@
|
|
|
45
45
|
"env": [
|
|
46
46
|
"jest"
|
|
47
47
|
]
|
|
48
|
-
},
|
|
49
|
-
"directories": {
|
|
50
|
-
"doc": "docs"
|
|
51
48
|
}
|
|
52
49
|
}
|