typed.js 2.0.12 → 2.0.14
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.txt +1 -1
- package/README.md +88 -37
- package/dist/typed.cjs +2 -0
- package/dist/typed.cjs.map +1 -0
- package/dist/typed.module.js +2 -0
- package/dist/typed.module.js.map +1 -0
- package/dist/typed.umd.js +3 -0
- package/dist/typed.umd.js.map +1 -0
- package/index.d.ts +253 -134
- package/package.json +21 -28
- package/.codeclimate.yml +0 -31
- package/.csslintrc +0 -2
- package/.esdoc.json +0 -4
- package/.eslintignore +0 -3
- package/.eslintrc.yml +0 -25
- package/.github/CONTRIBUTING.md +0 -44
- package/.github/ISSUE_TEMPLATE.md +0 -27
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -38
- package/.prettierrc +0 -4
- package/.travis.yml +0 -16
- package/.vscode/launch.json +0 -14
- package/.vscode/settings.json +0 -11
- package/CODE_OF_CONDUCT.md +0 -46
- package/app.js +0 -12
- package/assets/demos.css +0 -61
- package/assets/demos.js +0 -133
- package/bower.json +0 -11
- package/docs/API.md +0 -231
- package/docs/assets/anchor.js +0 -197
- package/docs/assets/bass-addons.css +0 -12
- package/docs/assets/bass.css +0 -543
- package/docs/assets/fonts/EOT/SourceCodePro-Bold.eot +0 -0
- package/docs/assets/fonts/EOT/SourceCodePro-Regular.eot +0 -0
- package/docs/assets/fonts/LICENSE.txt +0 -93
- package/docs/assets/fonts/OTF/SourceCodePro-Bold.otf +0 -0
- package/docs/assets/fonts/OTF/SourceCodePro-Regular.otf +0 -0
- package/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf +0 -0
- package/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf +0 -0
- package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff +0 -0
- package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff +0 -0
- package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff +0 -0
- package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff +0 -0
- package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 +0 -0
- package/docs/assets/fonts/source-code-pro.css +0 -23
- package/docs/assets/github.css +0 -123
- package/docs/assets/site.js +0 -108
- package/docs/assets/style.css +0 -136
- package/docs/index.html +0 -2187
- package/gulpfile.js +0 -95
- package/index.html +0 -184
- package/lib/typed.js +0 -1052
- package/lib/typed.min.js +0 -11
- package/lib/typed.min.js.map +0 -1
- package/logo-cropped.png +0 -0
- package/logo.png +0 -0
- package/src/defaults.js +0 -164
- package/src/html-parser.js +0 -67
- package/src/initializer.js +0 -207
- package/src/typed.js +0 -433
- package/webpack.config.js +0 -45
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
[](https://travis-ci.org/mattboldt/typed.js)
|
|
2
1
|
[](https://codeclimate.com/github/mattboldt/typed.js)
|
|
3
2
|
[]()
|
|
4
3
|
[](https://img.shields.io/npm/dt/typed.js.svg)
|
|
@@ -14,36 +13,100 @@ Typed.js is a library that types. Enter in any string, and watch it type at the
|
|
|
14
13
|
|
|
15
14
|
## Installation
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
### CDN
|
|
18
17
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
yarn add typed.js
|
|
22
|
-
bower install typed.js
|
|
18
|
+
```html
|
|
19
|
+
<script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script>
|
|
23
20
|
```
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
For use directly in the browser via `<script>` tag:
|
|
26
23
|
|
|
27
24
|
```html
|
|
28
|
-
|
|
25
|
+
<!-- Element to contain animated typing -->
|
|
26
|
+
<span id="element"></span>
|
|
27
|
+
|
|
28
|
+
<!-- Load library from the CDN -->
|
|
29
|
+
<script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script>
|
|
30
|
+
|
|
31
|
+
<!-- Setup and start animation! -->
|
|
32
|
+
<script>
|
|
33
|
+
var typed = new Typed('#element', {
|
|
34
|
+
strings: ['<i>First</i> sentence.', '& a second sentence.'],
|
|
35
|
+
typeSpeed: 50,
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
</body>
|
|
29
39
|
```
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
### As an ESModule
|
|
32
42
|
|
|
33
|
-
|
|
43
|
+
For use with a build tool like [Vite](https://vitejs.dev/), and/or in a React application, install with NPM or Yarn.
|
|
34
44
|
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
#### NPM
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
npm install typed.js
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Yarn
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
yarn add typed.js
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### General ESM Usage
|
|
58
|
+
|
|
59
|
+
```js
|
|
37
60
|
import Typed from 'typed.js';
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
const typed = new Typed('#element', {
|
|
40
63
|
strings: ['<i>First</i> sentence.', '& a second sentence.'],
|
|
41
|
-
typeSpeed:
|
|
42
|
-
};
|
|
64
|
+
typeSpeed: 50,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### ReactJS Usage
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import React from 'react';
|
|
72
|
+
import Typed from 'typed.js';
|
|
43
73
|
|
|
44
|
-
|
|
74
|
+
function MyComponent() {
|
|
75
|
+
// Create reference to store the DOM element containing the animation
|
|
76
|
+
const el = React.useRef(null);
|
|
77
|
+
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
const typed = new Typed(el.current, {
|
|
80
|
+
strings: ['<i>First</i> sentence.', '& a second sentence.'],
|
|
81
|
+
typeSpeed: 50,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return () => {
|
|
85
|
+
// Destroy Typed instance during cleanup to stop animation
|
|
86
|
+
typed.destroy();
|
|
87
|
+
};
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className="App">
|
|
92
|
+
<span ref={el} />
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
45
96
|
```
|
|
46
97
|
|
|
98
|
+
More complex hook-based function component: https://jsfiddle.net/mattboldt/60h9an7y/
|
|
99
|
+
|
|
100
|
+
Class component: https://jsfiddle.net/mattboldt/ovat9jmp/
|
|
101
|
+
|
|
102
|
+
### Use with Vue.js
|
|
103
|
+
|
|
104
|
+
Check out the Vue.js component: https://github.com/Orlandster/vue-typed-js
|
|
105
|
+
|
|
106
|
+
### Use it as WebComponent
|
|
107
|
+
|
|
108
|
+
Check out the WebComponent: https://github.com/Orlandster/wc-typed-js
|
|
109
|
+
|
|
47
110
|
## Wonderful sites that have used (or are using) Typed.js
|
|
48
111
|
|
|
49
112
|
https://github.com/features/package-registry
|
|
@@ -100,9 +163,9 @@ This allows bots and search engines, as well as users with JavaScript disabled,
|
|
|
100
163
|
You can pause in the middle of a string for a given amount of time by including an escape character.
|
|
101
164
|
|
|
102
165
|
```javascript
|
|
103
|
-
var typed = new Typed('
|
|
166
|
+
var typed = new Typed('#element', {
|
|
104
167
|
// Waits 1000ms after typing "First"
|
|
105
|
-
strings: ['First ^1000 sentence.', 'Second sentence.']
|
|
168
|
+
strings: ['First ^1000 sentence.', 'Second sentence.'],
|
|
106
169
|
});
|
|
107
170
|
```
|
|
108
171
|
|
|
@@ -111,9 +174,9 @@ var typed = new Typed('.element', {
|
|
|
111
174
|
In the following example, this would only backspace the words after "This is a"
|
|
112
175
|
|
|
113
176
|
```javascript
|
|
114
|
-
var typed = new Typed('
|
|
177
|
+
var typed = new Typed('#element', {
|
|
115
178
|
strings: ['This is a JavaScript library', 'This is an ES6 module'],
|
|
116
|
-
smartBackspace: true // Default value
|
|
179
|
+
smartBackspace: true, // Default value
|
|
117
180
|
});
|
|
118
181
|
```
|
|
119
182
|
|
|
@@ -122,8 +185,8 @@ var typed = new Typed('.element', {
|
|
|
122
185
|
The following example would emulate how a terminal acts when typing a command and seeing its result.
|
|
123
186
|
|
|
124
187
|
```javascript
|
|
125
|
-
var typed = new Typed('
|
|
126
|
-
strings: ['git push --force ^1000\n `pushed to origin with option force`']
|
|
188
|
+
var typed = new Typed('#element', {
|
|
189
|
+
strings: ['git push --force ^1000\n `pushed to origin with option force`'],
|
|
127
190
|
});
|
|
128
191
|
```
|
|
129
192
|
|
|
@@ -141,22 +204,10 @@ CSS animations are built upon initialization in JavaScript. But, you can customi
|
|
|
141
204
|
}
|
|
142
205
|
```
|
|
143
206
|
|
|
144
|
-
### Use with ReactJS
|
|
145
|
-
|
|
146
|
-
Check out this example React app using Typed.js in a component: https://jsfiddle.net/mattboldt/ovat9jmp/
|
|
147
|
-
|
|
148
|
-
### Use with Vue.js
|
|
149
|
-
|
|
150
|
-
Check out the Vue.js component: https://github.com/Orlandster/vue-typed-js
|
|
151
|
-
|
|
152
|
-
### Use it as WebComponent
|
|
153
|
-
|
|
154
|
-
Check out the WebComponent: https://github.com/Orlandster/wc-typed-js
|
|
155
|
-
|
|
156
207
|
## Customization
|
|
157
208
|
|
|
158
209
|
```javascript
|
|
159
|
-
var typed = new Typed('
|
|
210
|
+
var typed = new Typed('#element', {
|
|
160
211
|
/**
|
|
161
212
|
* @property {array} strings strings to be typed
|
|
162
213
|
* @property {string} stringsElement ID of element containing string children
|
|
@@ -165,7 +216,7 @@ var typed = new Typed('.element', {
|
|
|
165
216
|
'These are the default values...',
|
|
166
217
|
'You know what you should do?',
|
|
167
218
|
'Use your own!',
|
|
168
|
-
'Have a great day!'
|
|
219
|
+
'Have a great day!',
|
|
169
220
|
],
|
|
170
221
|
stringsElement: null,
|
|
171
222
|
|
|
@@ -310,7 +361,7 @@ var typed = new Typed('.element', {
|
|
|
310
361
|
* After destroy
|
|
311
362
|
* @param {Typed} self
|
|
312
363
|
*/
|
|
313
|
-
onDestroy: (self) => {}
|
|
364
|
+
onDestroy: (self) => {},
|
|
314
365
|
});
|
|
315
366
|
```
|
|
316
367
|
|
package/dist/typed.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},t.apply(this,arguments)}var s={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:Infinity,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onBegin:function(t){},onComplete:function(t){},preStringTyped:function(t,s){},onStringTyped:function(t,s){},onLastStringBackspaced:function(t){},onTypingPaused:function(t,s){},onTypingResumed:function(t,s){},onReset:function(t){},onStop:function(t,s){},onStart:function(t,s){},onDestroy:function(t){}},e=new(/*#__PURE__*/function(){function e(){}var n=e.prototype;return n.load=function(e,n,i){if(e.el="string"==typeof i?document.querySelector(i):i,e.options=t({},s,n),e.isInput="input"===e.el.tagName.toLowerCase(),e.attr=e.options.attr,e.bindInputFocusEvents=e.options.bindInputFocusEvents,e.showCursor=!e.isInput&&e.options.showCursor,e.cursorChar=e.options.cursorChar,e.cursorBlinking=!0,e.elContent=e.attr?e.el.getAttribute(e.attr):e.el.textContent,e.contentType=e.options.contentType,e.typeSpeed=e.options.typeSpeed,e.startDelay=e.options.startDelay,e.backSpeed=e.options.backSpeed,e.smartBackspace=e.options.smartBackspace,e.backDelay=e.options.backDelay,e.fadeOut=e.options.fadeOut,e.fadeOutClass=e.options.fadeOutClass,e.fadeOutDelay=e.options.fadeOutDelay,e.isPaused=!1,e.strings=e.options.strings.map(function(t){return t.trim()}),e.stringsElement="string"==typeof e.options.stringsElement?document.querySelector(e.options.stringsElement):e.options.stringsElement,e.stringsElement){e.strings=[],e.stringsElement.style.cssText="clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;";var r=Array.prototype.slice.apply(e.stringsElement.children),o=r.length;if(o)for(var a=0;a<o;a+=1)e.strings.push(r[a].innerHTML.trim())}for(var u in e.strPos=0,e.arrayPos=0,e.stopNum=0,e.loop=e.options.loop,e.loopCount=e.options.loopCount,e.curLoop=0,e.shuffle=e.options.shuffle,e.sequence=[],e.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},e.typingComplete=!1,e.strings)e.sequence[u]=u;e.currentElContent=this.getCurrentElContent(e),e.autoInsertCss=e.options.autoInsertCss,this.appendAnimationCss(e)},n.getCurrentElContent=function(t){return t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:"html"===t.contentType?t.el.innerHTML:t.el.textContent},n.appendAnimationCss=function(t){var s="data-typed-js-css";if(t.autoInsertCss&&(t.showCursor||t.fadeOut)&&!document.querySelector("["+s+"]")){var e=document.createElement("style");e.type="text/css",e.setAttribute(s,!0);var n="";t.showCursor&&(n+="\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "),t.fadeOut&&(n+="\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "),0!==e.length&&(e.innerHTML=n,document.body.appendChild(e))}},e}()),n=new(/*#__PURE__*/function(){function t(){}var s=t.prototype;return s.typeHtmlChars=function(t,s,e){if("html"!==e.contentType)return s;var n=t.substr(s).charAt(0);if("<"===n||"&"===n){var i;for(i="<"===n?">":";";t.substr(s+1).charAt(0)!==i&&!(1+ ++s>t.length););s++}return s},s.backSpaceHtmlChars=function(t,s,e){if("html"!==e.contentType)return s;var n=t.substr(s).charAt(0);if(">"===n||";"===n){var i;for(i=">"===n?"<":"&";t.substr(s-1).charAt(0)!==i&&!(--s<0););s--}return s},t}());module.exports=/*#__PURE__*/function(){function t(t,s){e.load(this,s,t),this.begin()}var s=t.prototype;return s.toggle=function(){this.pause.status?this.start():this.stop()},s.stop=function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))},s.start=function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))},s.destroy=function(){this.reset(!1),this.options.onDestroy(this)},s.reset=function(t){void 0===t&&(t=!0),clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())},s.begin=function(){var t=this;this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.currentElContent&&0!==t.currentElContent.length?t.backspace(t.currentElContent,t.currentElContent.length):t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)},s.typewrite=function(t,s){var e=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var i=this.humanizer(this.typeSpeed),r=1;!0!==this.pause.status?this.timeout=setTimeout(function(){s=n.typeHtmlChars(t,s,e);var i=0,o=t.substr(s);if("^"===o.charAt(0)&&/^\^\d+/.test(o)){var a=1;a+=(o=/\d+/.exec(o)[0]).length,i=parseInt(o),e.temporaryPause=!0,e.options.onTypingPaused(e.arrayPos,e),t=t.substring(0,s)+t.substring(s+a),e.toggleBlinking(!0)}if("`"===o.charAt(0)){for(;"`"!==t.substr(s+r).charAt(0)&&(r++,!(s+r>t.length)););var u=t.substring(0,s),p=t.substring(u.length+1,s+r),c=t.substring(s+r+1);t=u+p+c,r--}e.timeout=setTimeout(function(){e.toggleBlinking(!1),s>=t.length?e.doneTyping(t,s):e.keepTyping(t,s,r),e.temporaryPause&&(e.temporaryPause=!1,e.options.onTypingResumed(e.arrayPos,e))},i)},i):this.setPauseStatus(t,s,!0)},s.keepTyping=function(t,s,e){0===s&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));var n=t.substr(0,s+=e);this.replaceText(n),this.typewrite(t,s)},s.doneTyping=function(t,s){var e=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),!1===this.loop||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){e.backspace(t,s)},this.backDelay))},s.backspace=function(t,s){var e=this;if(!0!==this.pause.status){if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var i=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){s=n.backSpaceHtmlChars(t,s,e);var i=t.substr(0,s);if(e.replaceText(i),e.smartBackspace){var r=e.strings[e.arrayPos+1];e.stopNum=r&&i===r.substr(0,s)?s:0}s>e.stopNum?(s--,e.backspace(t,s)):s<=e.stopNum&&(e.arrayPos++,e.arrayPos===e.strings.length?(e.arrayPos=0,e.options.onLastStringBackspaced(),e.shuffleStringsIfNeeded(),e.begin()):e.typewrite(e.strings[e.sequence[e.arrayPos]],s))},i)}else this.setPauseStatus(t,s,!1)},s.complete=function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0},s.setPauseStatus=function(t,s,e){this.pause.typewrite=e,this.pause.curString=t,this.pause.curStrPos=s},s.toggleBlinking=function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))},s.humanizer=function(t){return Math.round(Math.random()*t/2)+t},s.shuffleStringsIfNeeded=function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))},s.initFadeOut=function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)},s.replaceText=function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:"html"===this.contentType?this.el.innerHTML=t:this.el.textContent=t},s.bindFocusEvents=function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(s){t.stop()}),this.el.addEventListener("blur",function(s){t.el.value&&0!==t.el.value.length||t.start()}))},s.insertCursor=function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))},t}();
|
|
2
|
+
//# sourceMappingURL=typed.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.cjs","sources":["../src/defaults.js","../src/initializer.js","../src/html-parser.js","../src/typed.js"],"sourcesContent":["/**\n * Defaults & options\n * @returns {object} Typed defaults & options\n * @public\n */\n\nconst defaults = {\n /**\n * @property {array} strings strings to be typed\n * @property {string} stringsElement ID of element containing string children\n */\n strings: [\n 'These are the default values...',\n 'You know what you should do?',\n 'Use your own!',\n 'Have a great day!',\n ],\n stringsElement: null,\n\n /**\n * @property {number} typeSpeed type speed in milliseconds\n */\n typeSpeed: 0,\n\n /**\n * @property {number} startDelay time before typing starts in milliseconds\n */\n startDelay: 0,\n\n /**\n * @property {number} backSpeed backspacing speed in milliseconds\n */\n backSpeed: 0,\n\n /**\n * @property {boolean} smartBackspace only backspace what doesn't match the previous string\n */\n smartBackspace: true,\n\n /**\n * @property {boolean} shuffle shuffle the strings\n */\n shuffle: false,\n\n /**\n * @property {number} backDelay time before backspacing in milliseconds\n */\n backDelay: 700,\n\n /**\n * @property {boolean} fadeOut Fade out instead of backspace\n * @property {string} fadeOutClass css class for fade animation\n * @property {boolean} fadeOutDelay Fade out delay in milliseconds\n */\n fadeOut: false,\n fadeOutClass: 'typed-fade-out',\n fadeOutDelay: 500,\n\n /**\n * @property {boolean} loop loop strings\n * @property {number} loopCount amount of loops\n */\n loop: false,\n loopCount: Infinity,\n\n /**\n * @property {boolean} showCursor show cursor\n * @property {string} cursorChar character for cursor\n * @property {boolean} autoInsertCss insert CSS for cursor and fadeOut into HTML <head>\n */\n showCursor: true,\n cursorChar: '|',\n autoInsertCss: true,\n\n /**\n * @property {string} attr attribute for typing\n * Ex: input placeholder, value, or just HTML text\n */\n attr: null,\n\n /**\n * @property {boolean} bindInputFocusEvents bind to focus and blur if el is text input\n */\n bindInputFocusEvents: false,\n\n /**\n * @property {string} contentType 'html' or 'null' for plaintext\n */\n contentType: 'html',\n\n /**\n * Before it begins typing\n * @param {Typed} self\n */\n onBegin: (self) => {},\n\n /**\n * All typing is complete\n * @param {Typed} self\n */\n onComplete: (self) => {},\n\n /**\n * Before each string is typed\n * @param {number} arrayPos\n * @param {Typed} self\n */\n preStringTyped: (arrayPos, self) => {},\n\n /**\n * After each string is typed\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStringTyped: (arrayPos, self) => {},\n\n /**\n * During looping, after last string is typed\n * @param {Typed} self\n */\n onLastStringBackspaced: (self) => {},\n\n /**\n * Typing has been stopped\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onTypingPaused: (arrayPos, self) => {},\n\n /**\n * Typing has been started after being stopped\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onTypingResumed: (arrayPos, self) => {},\n\n /**\n * After reset\n * @param {Typed} self\n */\n onReset: (self) => {},\n\n /**\n * After stop\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStop: (arrayPos, self) => {},\n\n /**\n * After start\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStart: (arrayPos, self) => {},\n\n /**\n * After destroy\n * @param {Typed} self\n */\n onDestroy: (self) => {},\n};\n\nexport default defaults;\n","import defaults from './defaults.js';\n/**\n * Initialize the Typed object\n */\n\nexport default class Initializer {\n /**\n * Load up defaults & options on the Typed instance\n * @param {Typed} self instance of Typed\n * @param {object} options options object\n * @param {string} elementId HTML element ID _OR_ instance of HTML element\n * @private\n */\n\n load(self, options, elementId) {\n // chosen element to manipulate text\n if (typeof elementId === 'string') {\n self.el = document.querySelector(elementId);\n } else {\n self.el = elementId;\n }\n\n self.options = { ...defaults, ...options };\n\n // attribute to type into\n self.isInput = self.el.tagName.toLowerCase() === 'input';\n self.attr = self.options.attr;\n self.bindInputFocusEvents = self.options.bindInputFocusEvents;\n\n // show cursor\n self.showCursor = self.isInput ? false : self.options.showCursor;\n\n // custom cursor\n self.cursorChar = self.options.cursorChar;\n\n // Is the cursor blinking\n self.cursorBlinking = true;\n\n // text content of element\n self.elContent = self.attr\n ? self.el.getAttribute(self.attr)\n : self.el.textContent;\n\n // html or plain text\n self.contentType = self.options.contentType;\n\n // typing speed\n self.typeSpeed = self.options.typeSpeed;\n\n // add a delay before typing starts\n self.startDelay = self.options.startDelay;\n\n // backspacing speed\n self.backSpeed = self.options.backSpeed;\n\n // only backspace what doesn't match the previous string\n self.smartBackspace = self.options.smartBackspace;\n\n // amount of time to wait before backspacing\n self.backDelay = self.options.backDelay;\n\n // Fade out instead of backspace\n self.fadeOut = self.options.fadeOut;\n self.fadeOutClass = self.options.fadeOutClass;\n self.fadeOutDelay = self.options.fadeOutDelay;\n\n // variable to check whether typing is currently paused\n self.isPaused = false;\n\n // input strings of text\n self.strings = self.options.strings.map((s) => s.trim());\n\n // div containing strings\n if (typeof self.options.stringsElement === 'string') {\n self.stringsElement = document.querySelector(self.options.stringsElement);\n } else {\n self.stringsElement = self.options.stringsElement;\n }\n\n if (self.stringsElement) {\n self.strings = [];\n self.stringsElement.style.cssText =\n 'clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;';\n\n const strings = Array.prototype.slice.apply(self.stringsElement.children);\n const stringsLength = strings.length;\n\n if (stringsLength) {\n for (let i = 0; i < stringsLength; i += 1) {\n const stringEl = strings[i];\n self.strings.push(stringEl.innerHTML.trim());\n }\n }\n }\n\n // character number position of current string\n self.strPos = 0;\n\n // current array position\n self.arrayPos = 0;\n\n // index of string to stop backspacing on\n self.stopNum = 0;\n\n // Looping logic\n self.loop = self.options.loop;\n self.loopCount = self.options.loopCount;\n self.curLoop = 0;\n\n // shuffle the strings\n self.shuffle = self.options.shuffle;\n // the order of strings\n self.sequence = [];\n\n self.pause = {\n status: false,\n typewrite: true,\n curString: '',\n curStrPos: 0,\n };\n\n // When the typing is complete (when not looped)\n self.typingComplete = false;\n\n // Set the order in which the strings are typed\n for (let i in self.strings) {\n self.sequence[i] = i;\n }\n\n // If there is some text in the element\n self.currentElContent = this.getCurrentElContent(self);\n\n self.autoInsertCss = self.options.autoInsertCss;\n\n this.appendAnimationCss(self);\n }\n\n getCurrentElContent(self) {\n let elContent = '';\n if (self.attr) {\n elContent = self.el.getAttribute(self.attr);\n } else if (self.isInput) {\n elContent = self.el.value;\n } else if (self.contentType === 'html') {\n elContent = self.el.innerHTML;\n } else {\n elContent = self.el.textContent;\n }\n return elContent;\n }\n\n appendAnimationCss(self) {\n const cssDataName = 'data-typed-js-css';\n if (!self.autoInsertCss) {\n return;\n }\n if (!self.showCursor && !self.fadeOut) {\n return;\n }\n if (document.querySelector(`[${cssDataName}]`)) {\n return;\n }\n\n let css = document.createElement('style');\n css.type = 'text/css';\n css.setAttribute(cssDataName, true);\n\n let innerCss = '';\n if (self.showCursor) {\n innerCss += `\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n `;\n }\n\n if (self.fadeOut) {\n innerCss += `\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n `;\n }\n if (css.length === 0) {\n return;\n }\n css.innerHTML = innerCss;\n document.body.appendChild(css);\n }\n}\n\nexport let initializer = new Initializer();\n","/**\n * TODO: These methods can probably be combined somehow\n * Parse HTML tags & HTML Characters\n */\n\nexport default class HTMLParser {\n /**\n * Type HTML tags & HTML Characters\n * @param {string} curString Current string\n * @param {number} curStrPos Position in current string\n * @param {Typed} self instance of Typed\n * @returns {number} a new string position\n * @private\n */\n\n typeHtmlChars(curString, curStrPos, self) {\n if (self.contentType !== 'html') return curStrPos;\n const curChar = curString.substr(curStrPos).charAt(0);\n if (curChar === '<' || curChar === '&') {\n let endTag = '';\n if (curChar === '<') {\n endTag = '>';\n } else {\n endTag = ';';\n }\n while (curString.substr(curStrPos + 1).charAt(0) !== endTag) {\n curStrPos++;\n if (curStrPos + 1 > curString.length) {\n break;\n }\n }\n curStrPos++;\n }\n return curStrPos;\n }\n\n /**\n * Backspace HTML tags and HTML Characters\n * @param {string} curString Current string\n * @param {number} curStrPos Position in current string\n * @param {Typed} self instance of Typed\n * @returns {number} a new string position\n * @private\n */\n backSpaceHtmlChars(curString, curStrPos, self) {\n if (self.contentType !== 'html') return curStrPos;\n const curChar = curString.substr(curStrPos).charAt(0);\n if (curChar === '>' || curChar === ';') {\n let endTag = '';\n if (curChar === '>') {\n endTag = '<';\n } else {\n endTag = '&';\n }\n while (curString.substr(curStrPos - 1).charAt(0) !== endTag) {\n curStrPos--;\n if (curStrPos < 0) {\n break;\n }\n }\n curStrPos--;\n }\n return curStrPos;\n }\n}\n\nexport let htmlParser = new HTMLParser();\n","import { initializer } from './initializer.js';\nimport { htmlParser } from './html-parser.js';\n\n/**\n * Welcome to Typed.js!\n * @param {string} elementId HTML element ID _OR_ HTML element\n * @param {object} options options object\n * @returns {object} a new Typed object\n */\nexport default class Typed {\n constructor(elementId, options) {\n // Initialize it up\n initializer.load(this, options, elementId);\n // All systems go!\n this.begin();\n }\n\n /**\n * Toggle start() and stop() of the Typed instance\n * @public\n */\n toggle() {\n this.pause.status ? this.start() : this.stop();\n }\n\n /**\n * Stop typing / backspacing and enable cursor blinking\n * @public\n */\n stop() {\n if (this.typingComplete) return;\n if (this.pause.status) return;\n this.toggleBlinking(true);\n this.pause.status = true;\n this.options.onStop(this.arrayPos, this);\n }\n\n /**\n * Start typing / backspacing after being stopped\n * @public\n */\n start() {\n if (this.typingComplete) return;\n if (!this.pause.status) return;\n this.pause.status = false;\n if (this.pause.typewrite) {\n this.typewrite(this.pause.curString, this.pause.curStrPos);\n } else {\n this.backspace(this.pause.curString, this.pause.curStrPos);\n }\n this.options.onStart(this.arrayPos, this);\n }\n\n /**\n * Destroy this instance of Typed\n * @public\n */\n destroy() {\n this.reset(false);\n this.options.onDestroy(this);\n }\n\n /**\n * Reset Typed and optionally restarts\n * @param {boolean} restart\n * @public\n */\n reset(restart = true) {\n clearInterval(this.timeout);\n this.replaceText('');\n if (this.cursor && this.cursor.parentNode) {\n this.cursor.parentNode.removeChild(this.cursor);\n this.cursor = null;\n }\n this.strPos = 0;\n this.arrayPos = 0;\n this.curLoop = 0;\n if (restart) {\n this.insertCursor();\n this.options.onReset(this);\n this.begin();\n }\n }\n\n /**\n * Begins the typing animation\n * @private\n */\n begin() {\n this.options.onBegin(this);\n this.typingComplete = false;\n this.shuffleStringsIfNeeded(this);\n this.insertCursor();\n if (this.bindInputFocusEvents) this.bindFocusEvents();\n this.timeout = setTimeout(() => {\n // Check if there is some text in the element, if yes start by backspacing the default message\n if (!this.currentElContent || this.currentElContent.length === 0) {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], this.strPos);\n } else {\n // Start typing\n this.backspace(this.currentElContent, this.currentElContent.length);\n }\n }, this.startDelay);\n }\n\n /**\n * Called for each character typed\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n typewrite(curString, curStrPos) {\n if (this.fadeOut && this.el.classList.contains(this.fadeOutClass)) {\n this.el.classList.remove(this.fadeOutClass);\n if (this.cursor) this.cursor.classList.remove(this.fadeOutClass);\n }\n\n const humanize = this.humanizer(this.typeSpeed);\n let numChars = 1;\n\n if (this.pause.status === true) {\n this.setPauseStatus(curString, curStrPos, true);\n return;\n }\n\n // contain typing function in a timeout humanize'd delay\n this.timeout = setTimeout(() => {\n // skip over any HTML chars\n curStrPos = htmlParser.typeHtmlChars(curString, curStrPos, this);\n\n let pauseTime = 0;\n let substr = curString.substr(curStrPos);\n // check for an escape character before a pause value\n // format: \\^\\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^\n // single ^ are removed from string\n if (substr.charAt(0) === '^') {\n if (/^\\^\\d+/.test(substr)) {\n let skip = 1; // skip at least 1\n substr = /\\d+/.exec(substr)[0];\n skip += substr.length;\n pauseTime = parseInt(substr);\n this.temporaryPause = true;\n this.options.onTypingPaused(this.arrayPos, this);\n // strip out the escape character and pause value so they're not printed\n curString =\n curString.substring(0, curStrPos) +\n curString.substring(curStrPos + skip);\n this.toggleBlinking(true);\n }\n }\n\n // check for skip characters formatted as\n // \"this is a `string to print NOW` ...\"\n if (substr.charAt(0) === '`') {\n while (curString.substr(curStrPos + numChars).charAt(0) !== '`') {\n numChars++;\n if (curStrPos + numChars > curString.length) break;\n }\n // strip out the escape characters and append all the string in between\n const stringBeforeSkip = curString.substring(0, curStrPos);\n const stringSkipped = curString.substring(\n stringBeforeSkip.length + 1,\n curStrPos + numChars\n );\n const stringAfterSkip = curString.substring(curStrPos + numChars + 1);\n curString = stringBeforeSkip + stringSkipped + stringAfterSkip;\n numChars--;\n }\n\n // timeout for any pause after a character\n this.timeout = setTimeout(() => {\n // Accounts for blinking while paused\n this.toggleBlinking(false);\n\n // We're done with this sentence!\n if (curStrPos >= curString.length) {\n this.doneTyping(curString, curStrPos);\n } else {\n this.keepTyping(curString, curStrPos, numChars);\n }\n // end of character pause\n if (this.temporaryPause) {\n this.temporaryPause = false;\n this.options.onTypingResumed(this.arrayPos, this);\n }\n }, pauseTime);\n\n // humanized value for typing\n }, humanize);\n }\n\n /**\n * Continue to the next string & begin typing\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n keepTyping(curString, curStrPos, numChars) {\n // call before functions if applicable\n if (curStrPos === 0) {\n this.toggleBlinking(false);\n this.options.preStringTyped(this.arrayPos, this);\n }\n // start typing each new char into existing string\n // curString: arg, this.el.html: original text inside element\n curStrPos += numChars;\n const nextString = curString.substr(0, curStrPos);\n this.replaceText(nextString);\n // loop the function\n this.typewrite(curString, curStrPos);\n }\n\n /**\n * We're done typing the current string\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n doneTyping(curString, curStrPos) {\n // fires callback function\n this.options.onStringTyped(this.arrayPos, this);\n this.toggleBlinking(true);\n // is this the final string\n if (this.arrayPos === this.strings.length - 1) {\n // callback that occurs on the last typed string\n this.complete();\n // quit if we wont loop back\n if (this.loop === false || this.curLoop === this.loopCount) {\n return;\n }\n }\n this.timeout = setTimeout(() => {\n this.backspace(curString, curStrPos);\n }, this.backDelay);\n }\n\n /**\n * Backspaces 1 character at a time\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n backspace(curString, curStrPos) {\n if (this.pause.status === true) {\n this.setPauseStatus(curString, curStrPos, false);\n return;\n }\n if (this.fadeOut) return this.initFadeOut();\n\n this.toggleBlinking(false);\n const humanize = this.humanizer(this.backSpeed);\n\n this.timeout = setTimeout(() => {\n curStrPos = htmlParser.backSpaceHtmlChars(curString, curStrPos, this);\n // replace text with base text + typed characters\n const curStringAtPosition = curString.substr(0, curStrPos);\n this.replaceText(curStringAtPosition);\n\n // if smartBack is enabled\n if (this.smartBackspace) {\n // the remaining part of the current string is equal of the same part of the new string\n let nextString = this.strings[this.arrayPos + 1];\n if (\n nextString &&\n curStringAtPosition === nextString.substr(0, curStrPos)\n ) {\n this.stopNum = curStrPos;\n } else {\n this.stopNum = 0;\n }\n }\n\n // if the number (id of character in current string) is\n // less than the stop number, keep going\n if (curStrPos > this.stopNum) {\n // subtract characters one by one\n curStrPos--;\n // loop the function\n this.backspace(curString, curStrPos);\n } else if (curStrPos <= this.stopNum) {\n // if the stop number has been reached, increase\n // array position to next string\n this.arrayPos++;\n // When looping, begin at the beginning after backspace complete\n if (this.arrayPos === this.strings.length) {\n this.arrayPos = 0;\n this.options.onLastStringBackspaced();\n this.shuffleStringsIfNeeded();\n this.begin();\n } else {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], curStrPos);\n }\n }\n // humanized value for typing\n }, humanize);\n }\n\n /**\n * Full animation is complete\n * @private\n */\n complete() {\n this.options.onComplete(this);\n if (this.loop) {\n this.curLoop++;\n } else {\n this.typingComplete = true;\n }\n }\n\n /**\n * Has the typing been stopped\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @param {boolean} isTyping\n * @private\n */\n setPauseStatus(curString, curStrPos, isTyping) {\n this.pause.typewrite = isTyping;\n this.pause.curString = curString;\n this.pause.curStrPos = curStrPos;\n }\n\n /**\n * Toggle the blinking cursor\n * @param {boolean} isBlinking\n * @private\n */\n toggleBlinking(isBlinking) {\n if (!this.cursor) return;\n // if in paused state, don't toggle blinking a 2nd time\n if (this.pause.status) return;\n if (this.cursorBlinking === isBlinking) return;\n this.cursorBlinking = isBlinking;\n if (isBlinking) {\n this.cursor.classList.add('typed-cursor--blink');\n } else {\n this.cursor.classList.remove('typed-cursor--blink');\n }\n }\n\n /**\n * Speed in MS to type\n * @param {number} speed\n * @private\n */\n humanizer(speed) {\n return Math.round((Math.random() * speed) / 2) + speed;\n }\n\n /**\n * Shuffle the sequence of the strings array\n * @private\n */\n shuffleStringsIfNeeded() {\n if (!this.shuffle) return;\n this.sequence = this.sequence.sort(() => Math.random() - 0.5);\n }\n\n /**\n * Adds a CSS class to fade out current string\n * @private\n */\n initFadeOut() {\n this.el.className += ` ${this.fadeOutClass}`;\n if (this.cursor) this.cursor.className += ` ${this.fadeOutClass}`;\n return setTimeout(() => {\n this.arrayPos++;\n this.replaceText('');\n\n // Resets current string if end of loop reached\n if (this.strings.length > this.arrayPos) {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], 0);\n } else {\n this.typewrite(this.strings[0], 0);\n this.arrayPos = 0;\n }\n }, this.fadeOutDelay);\n }\n\n /**\n * Replaces current text in the HTML element\n * depending on element type\n * @param {string} str\n * @private\n */\n replaceText(str) {\n if (this.attr) {\n this.el.setAttribute(this.attr, str);\n } else {\n if (this.isInput) {\n this.el.value = str;\n } else if (this.contentType === 'html') {\n this.el.innerHTML = str;\n } else {\n this.el.textContent = str;\n }\n }\n }\n\n /**\n * If using input elements, bind focus in order to\n * start and stop the animation\n * @private\n */\n bindFocusEvents() {\n if (!this.isInput) return;\n this.el.addEventListener('focus', (e) => {\n this.stop();\n });\n this.el.addEventListener('blur', (e) => {\n if (this.el.value && this.el.value.length !== 0) {\n return;\n }\n this.start();\n });\n }\n\n /**\n * On init, insert the cursor element\n * @private\n */\n insertCursor() {\n if (!this.showCursor) return;\n if (this.cursor) return;\n this.cursor = document.createElement('span');\n this.cursor.className = 'typed-cursor';\n this.cursor.setAttribute('aria-hidden', true);\n this.cursor.innerHTML = this.cursorChar;\n this.el.parentNode &&\n this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling);\n }\n}\n"],"names":["defaults","strings","stringsElement","typeSpeed","startDelay","backSpeed","smartBackspace","shuffle","backDelay","fadeOut","fadeOutClass","fadeOutDelay","loop","loopCount","Infinity","showCursor","cursorChar","autoInsertCss","attr","bindInputFocusEvents","contentType","onBegin","self","onComplete","preStringTyped","arrayPos","onStringTyped","onLastStringBackspaced","onTypingPaused","onTypingResumed","onReset","onStop","onStart","onDestroy","initializer","Initializer","_proto","prototype","load","options","elementId","el","document","querySelector","_extends","isInput","tagName","toLowerCase","cursorBlinking","elContent","getAttribute","textContent","isPaused","map","s","trim","style","cssText","Array","slice","apply","children","stringsLength","length","i","push","innerHTML","strPos","stopNum","curLoop","sequence","pause","status","typewrite","curString","curStrPos","typingComplete","currentElContent","this","getCurrentElContent","appendAnimationCss","value","cssDataName","css","createElement","type","setAttribute","innerCss","body","appendChild","htmlParser","HTMLParser","typeHtmlChars","curChar","substr","charAt","endTag","backSpaceHtmlChars","Typed","begin","toggle","start","stop","toggleBlinking","backspace","destroy","reset","restart","clearInterval","timeout","replaceText","cursor","parentNode","removeChild","insertCursor","_this","shuffleStringsIfNeeded","bindFocusEvents","setTimeout","_this2","classList","contains","remove","humanize","humanizer","numChars","pauseTime","test","skip","exec","parseInt","temporaryPause","substring","stringBeforeSkip","stringSkipped","stringAfterSkip","doneTyping","keepTyping","setPauseStatus","nextString","_this3","complete","_this4","initFadeOut","curStringAtPosition","isTyping","isBlinking","add","speed","Math","round","random","sort","_this5","className","str","_this6","addEventListener","e","insertBefore","nextSibling"],"mappings":"oOAMA,IAAMA,EAAW,CAKfC,QAAS,CACP,kCACA,+B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F,EAEpB7E,KAAKrC,GAAGU,YAAcwG,CAG5B,EAACvH,EAODiF,gBAAA,eAAkBuC,EAAA9E,KACXA,KAAKjC,UACViC,KAAKrC,GAAGoH,iBAAiB,QAAS,SAACC,GACjCF,EAAKtD,MACP,GACAxB,KAAKrC,GAAGoH,iBAAiB,OAAQ,SAACC,GAC5BF,EAAKnH,GAAGwC,OAAkC,IAAzB2E,EAAKnH,GAAGwC,MAAMlB,QAGnC6F,EAAKvD,OACP,GACF,EAACjE,EAMD8E,aAAA,WACOpC,KAAK/D,aACN+D,KAAKiC,SACTjC,KAAKiC,OAASrE,SAAS0C,cAAc,QACrCN,KAAKiC,OAAO2C,UAAY,eACxB5E,KAAKiC,OAAOzB,aAAa,eAAe,GACxCR,KAAKiC,OAAO7C,UAAYY,KAAK9D,WAC7B8D,KAAKrC,GAAGuE,YACNlC,KAAKrC,GAAGuE,WAAW+C,aAAajF,KAAKiC,OAAQjC,KAAKrC,GAAGuH,cACzD,EAAC9D,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},t.apply(this,arguments)}const s={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:Infinity,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onBegin:t=>{},onComplete:t=>{},preStringTyped:(t,s)=>{},onStringTyped:(t,s)=>{},onLastStringBackspaced:t=>{},onTypingPaused:(t,s)=>{},onTypingResumed:(t,s)=>{},onReset:t=>{},onStop:(t,s)=>{},onStart:(t,s)=>{},onDestroy:t=>{}};let e=new class{load(e,i,n){if(e.el="string"==typeof n?document.querySelector(n):n,e.options=t({},s,i),e.isInput="input"===e.el.tagName.toLowerCase(),e.attr=e.options.attr,e.bindInputFocusEvents=e.options.bindInputFocusEvents,e.showCursor=!e.isInput&&e.options.showCursor,e.cursorChar=e.options.cursorChar,e.cursorBlinking=!0,e.elContent=e.attr?e.el.getAttribute(e.attr):e.el.textContent,e.contentType=e.options.contentType,e.typeSpeed=e.options.typeSpeed,e.startDelay=e.options.startDelay,e.backSpeed=e.options.backSpeed,e.smartBackspace=e.options.smartBackspace,e.backDelay=e.options.backDelay,e.fadeOut=e.options.fadeOut,e.fadeOutClass=e.options.fadeOutClass,e.fadeOutDelay=e.options.fadeOutDelay,e.isPaused=!1,e.strings=e.options.strings.map(t=>t.trim()),e.stringsElement="string"==typeof e.options.stringsElement?document.querySelector(e.options.stringsElement):e.options.stringsElement,e.stringsElement){e.strings=[],e.stringsElement.style.cssText="clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;";const t=Array.prototype.slice.apply(e.stringsElement.children),s=t.length;if(s)for(let i=0;i<s;i+=1)e.strings.push(t[i].innerHTML.trim())}e.strPos=0,e.arrayPos=0,e.stopNum=0,e.loop=e.options.loop,e.loopCount=e.options.loopCount,e.curLoop=0,e.shuffle=e.options.shuffle,e.sequence=[],e.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},e.typingComplete=!1;for(let t in e.strings)e.sequence[t]=t;e.currentElContent=this.getCurrentElContent(e),e.autoInsertCss=e.options.autoInsertCss,this.appendAnimationCss(e)}getCurrentElContent(t){let s="";return s=t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:"html"===t.contentType?t.el.innerHTML:t.el.textContent,s}appendAnimationCss(t){const s="data-typed-js-css";if(!t.autoInsertCss)return;if(!t.showCursor&&!t.fadeOut)return;if(document.querySelector(`[${s}]`))return;let e=document.createElement("style");e.type="text/css",e.setAttribute(s,!0);let i="";t.showCursor&&(i+="\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "),t.fadeOut&&(i+="\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "),0!==e.length&&(e.innerHTML=i,document.body.appendChild(e))}},i=new class{typeHtmlChars(t,s,e){if("html"!==e.contentType)return s;const i=t.substr(s).charAt(0);if("<"===i||"&"===i){let e="";for(e="<"===i?">":";";t.substr(s+1).charAt(0)!==e&&!(1+ ++s>t.length););s++}return s}backSpaceHtmlChars(t,s,e){if("html"!==e.contentType)return s;const i=t.substr(s).charAt(0);if(">"===i||";"===i){let e="";for(e=">"===i?"<":"&";t.substr(s-1).charAt(0)!==e&&!(--s<0););s--}return s}};class n{constructor(t,s){e.load(this,s,t),this.begin()}toggle(){this.pause.status?this.start():this.stop()}stop(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))}start(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))}destroy(){this.reset(!1),this.options.onDestroy(this)}reset(t=!0){clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())}begin(){this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(()=>{this.currentElContent&&0!==this.currentElContent.length?this.backspace(this.currentElContent,this.currentElContent.length):this.typewrite(this.strings[this.sequence[this.arrayPos]],this.strPos)},this.startDelay)}typewrite(t,s){this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));const e=this.humanizer(this.typeSpeed);let n=1;!0!==this.pause.status?this.timeout=setTimeout(()=>{s=i.typeHtmlChars(t,s,this);let e=0,r=t.substr(s);if("^"===r.charAt(0)&&/^\^\d+/.test(r)){let i=1;r=/\d+/.exec(r)[0],i+=r.length,e=parseInt(r),this.temporaryPause=!0,this.options.onTypingPaused(this.arrayPos,this),t=t.substring(0,s)+t.substring(s+i),this.toggleBlinking(!0)}if("`"===r.charAt(0)){for(;"`"!==t.substr(s+n).charAt(0)&&(n++,!(s+n>t.length)););const e=t.substring(0,s),i=t.substring(e.length+1,s+n),r=t.substring(s+n+1);t=e+i+r,n--}this.timeout=setTimeout(()=>{this.toggleBlinking(!1),s>=t.length?this.doneTyping(t,s):this.keepTyping(t,s,n),this.temporaryPause&&(this.temporaryPause=!1,this.options.onTypingResumed(this.arrayPos,this))},e)},e):this.setPauseStatus(t,s,!0)}keepTyping(t,s,e){0===s&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));const i=t.substr(0,s+=e);this.replaceText(i),this.typewrite(t,s)}doneTyping(t,s){this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),!1===this.loop||this.curLoop===this.loopCount)||(this.timeout=setTimeout(()=>{this.backspace(t,s)},this.backDelay))}backspace(t,s){if(!0===this.pause.status)return void this.setPauseStatus(t,s,!1);if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);const e=this.humanizer(this.backSpeed);this.timeout=setTimeout(()=>{s=i.backSpaceHtmlChars(t,s,this);const e=t.substr(0,s);if(this.replaceText(e),this.smartBackspace){let t=this.strings[this.arrayPos+1];this.stopNum=t&&e===t.substr(0,s)?s:0}s>this.stopNum?(s--,this.backspace(t,s)):s<=this.stopNum&&(this.arrayPos++,this.arrayPos===this.strings.length?(this.arrayPos=0,this.options.onLastStringBackspaced(),this.shuffleStringsIfNeeded(),this.begin()):this.typewrite(this.strings[this.sequence[this.arrayPos]],s))},e)}complete(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0}setPauseStatus(t,s,e){this.pause.typewrite=e,this.pause.curString=t,this.pause.curStrPos=s}toggleBlinking(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))}humanizer(t){return Math.round(Math.random()*t/2)+t}shuffleStringsIfNeeded(){this.shuffle&&(this.sequence=this.sequence.sort(()=>Math.random()-.5))}initFadeOut(){return this.el.className+=` ${this.fadeOutClass}`,this.cursor&&(this.cursor.className+=` ${this.fadeOutClass}`),setTimeout(()=>{this.arrayPos++,this.replaceText(""),this.strings.length>this.arrayPos?this.typewrite(this.strings[this.sequence[this.arrayPos]],0):(this.typewrite(this.strings[0],0),this.arrayPos=0)},this.fadeOutDelay)}replaceText(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:"html"===this.contentType?this.el.innerHTML=t:this.el.textContent=t}bindFocusEvents(){this.isInput&&(this.el.addEventListener("focus",t=>{this.stop()}),this.el.addEventListener("blur",t=>{this.el.value&&0!==this.el.value.length||this.start()}))}insertCursor(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))}}export{n as default};
|
|
2
|
+
//# sourceMappingURL=typed.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.module.js","sources":["../src/defaults.js","../src/initializer.js","../src/html-parser.js","../src/typed.js"],"sourcesContent":["/**\n * Defaults & options\n * @returns {object} Typed defaults & options\n * @public\n */\n\nconst defaults = {\n /**\n * @property {array} strings strings to be typed\n * @property {string} stringsElement ID of element containing string children\n */\n strings: [\n 'These are the default values...',\n 'You know what you should do?',\n 'Use your own!',\n 'Have a great day!',\n ],\n stringsElement: null,\n\n /**\n * @property {number} typeSpeed type speed in milliseconds\n */\n typeSpeed: 0,\n\n /**\n * @property {number} startDelay time before typing starts in milliseconds\n */\n startDelay: 0,\n\n /**\n * @property {number} backSpeed backspacing speed in milliseconds\n */\n backSpeed: 0,\n\n /**\n * @property {boolean} smartBackspace only backspace what doesn't match the previous string\n */\n smartBackspace: true,\n\n /**\n * @property {boolean} shuffle shuffle the strings\n */\n shuffle: false,\n\n /**\n * @property {number} backDelay time before backspacing in milliseconds\n */\n backDelay: 700,\n\n /**\n * @property {boolean} fadeOut Fade out instead of backspace\n * @property {string} fadeOutClass css class for fade animation\n * @property {boolean} fadeOutDelay Fade out delay in milliseconds\n */\n fadeOut: false,\n fadeOutClass: 'typed-fade-out',\n fadeOutDelay: 500,\n\n /**\n * @property {boolean} loop loop strings\n * @property {number} loopCount amount of loops\n */\n loop: false,\n loopCount: Infinity,\n\n /**\n * @property {boolean} showCursor show cursor\n * @property {string} cursorChar character for cursor\n * @property {boolean} autoInsertCss insert CSS for cursor and fadeOut into HTML <head>\n */\n showCursor: true,\n cursorChar: '|',\n autoInsertCss: true,\n\n /**\n * @property {string} attr attribute for typing\n * Ex: input placeholder, value, or just HTML text\n */\n attr: null,\n\n /**\n * @property {boolean} bindInputFocusEvents bind to focus and blur if el is text input\n */\n bindInputFocusEvents: false,\n\n /**\n * @property {string} contentType 'html' or 'null' for plaintext\n */\n contentType: 'html',\n\n /**\n * Before it begins typing\n * @param {Typed} self\n */\n onBegin: (self) => {},\n\n /**\n * All typing is complete\n * @param {Typed} self\n */\n onComplete: (self) => {},\n\n /**\n * Before each string is typed\n * @param {number} arrayPos\n * @param {Typed} self\n */\n preStringTyped: (arrayPos, self) => {},\n\n /**\n * After each string is typed\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStringTyped: (arrayPos, self) => {},\n\n /**\n * During looping, after last string is typed\n * @param {Typed} self\n */\n onLastStringBackspaced: (self) => {},\n\n /**\n * Typing has been stopped\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onTypingPaused: (arrayPos, self) => {},\n\n /**\n * Typing has been started after being stopped\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onTypingResumed: (arrayPos, self) => {},\n\n /**\n * After reset\n * @param {Typed} self\n */\n onReset: (self) => {},\n\n /**\n * After stop\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStop: (arrayPos, self) => {},\n\n /**\n * After start\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStart: (arrayPos, self) => {},\n\n /**\n * After destroy\n * @param {Typed} self\n */\n onDestroy: (self) => {},\n};\n\nexport default defaults;\n","import defaults from './defaults.js';\n/**\n * Initialize the Typed object\n */\n\nexport default class Initializer {\n /**\n * Load up defaults & options on the Typed instance\n * @param {Typed} self instance of Typed\n * @param {object} options options object\n * @param {string} elementId HTML element ID _OR_ instance of HTML element\n * @private\n */\n\n load(self, options, elementId) {\n // chosen element to manipulate text\n if (typeof elementId === 'string') {\n self.el = document.querySelector(elementId);\n } else {\n self.el = elementId;\n }\n\n self.options = { ...defaults, ...options };\n\n // attribute to type into\n self.isInput = self.el.tagName.toLowerCase() === 'input';\n self.attr = self.options.attr;\n self.bindInputFocusEvents = self.options.bindInputFocusEvents;\n\n // show cursor\n self.showCursor = self.isInput ? false : self.options.showCursor;\n\n // custom cursor\n self.cursorChar = self.options.cursorChar;\n\n // Is the cursor blinking\n self.cursorBlinking = true;\n\n // text content of element\n self.elContent = self.attr\n ? self.el.getAttribute(self.attr)\n : self.el.textContent;\n\n // html or plain text\n self.contentType = self.options.contentType;\n\n // typing speed\n self.typeSpeed = self.options.typeSpeed;\n\n // add a delay before typing starts\n self.startDelay = self.options.startDelay;\n\n // backspacing speed\n self.backSpeed = self.options.backSpeed;\n\n // only backspace what doesn't match the previous string\n self.smartBackspace = self.options.smartBackspace;\n\n // amount of time to wait before backspacing\n self.backDelay = self.options.backDelay;\n\n // Fade out instead of backspace\n self.fadeOut = self.options.fadeOut;\n self.fadeOutClass = self.options.fadeOutClass;\n self.fadeOutDelay = self.options.fadeOutDelay;\n\n // variable to check whether typing is currently paused\n self.isPaused = false;\n\n // input strings of text\n self.strings = self.options.strings.map((s) => s.trim());\n\n // div containing strings\n if (typeof self.options.stringsElement === 'string') {\n self.stringsElement = document.querySelector(self.options.stringsElement);\n } else {\n self.stringsElement = self.options.stringsElement;\n }\n\n if (self.stringsElement) {\n self.strings = [];\n self.stringsElement.style.cssText =\n 'clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;';\n\n const strings = Array.prototype.slice.apply(self.stringsElement.children);\n const stringsLength = strings.length;\n\n if (stringsLength) {\n for (let i = 0; i < stringsLength; i += 1) {\n const stringEl = strings[i];\n self.strings.push(stringEl.innerHTML.trim());\n }\n }\n }\n\n // character number position of current string\n self.strPos = 0;\n\n // current array position\n self.arrayPos = 0;\n\n // index of string to stop backspacing on\n self.stopNum = 0;\n\n // Looping logic\n self.loop = self.options.loop;\n self.loopCount = self.options.loopCount;\n self.curLoop = 0;\n\n // shuffle the strings\n self.shuffle = self.options.shuffle;\n // the order of strings\n self.sequence = [];\n\n self.pause = {\n status: false,\n typewrite: true,\n curString: '',\n curStrPos: 0,\n };\n\n // When the typing is complete (when not looped)\n self.typingComplete = false;\n\n // Set the order in which the strings are typed\n for (let i in self.strings) {\n self.sequence[i] = i;\n }\n\n // If there is some text in the element\n self.currentElContent = this.getCurrentElContent(self);\n\n self.autoInsertCss = self.options.autoInsertCss;\n\n this.appendAnimationCss(self);\n }\n\n getCurrentElContent(self) {\n let elContent = '';\n if (self.attr) {\n elContent = self.el.getAttribute(self.attr);\n } else if (self.isInput) {\n elContent = self.el.value;\n } else if (self.contentType === 'html') {\n elContent = self.el.innerHTML;\n } else {\n elContent = self.el.textContent;\n }\n return elContent;\n }\n\n appendAnimationCss(self) {\n const cssDataName = 'data-typed-js-css';\n if (!self.autoInsertCss) {\n return;\n }\n if (!self.showCursor && !self.fadeOut) {\n return;\n }\n if (document.querySelector(`[${cssDataName}]`)) {\n return;\n }\n\n let css = document.createElement('style');\n css.type = 'text/css';\n css.setAttribute(cssDataName, true);\n\n let innerCss = '';\n if (self.showCursor) {\n innerCss += `\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n `;\n }\n\n if (self.fadeOut) {\n innerCss += `\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n `;\n }\n if (css.length === 0) {\n return;\n }\n css.innerHTML = innerCss;\n document.body.appendChild(css);\n }\n}\n\nexport let initializer = new Initializer();\n","/**\n * TODO: These methods can probably be combined somehow\n * Parse HTML tags & HTML Characters\n */\n\nexport default class HTMLParser {\n /**\n * Type HTML tags & HTML Characters\n * @param {string} curString Current string\n * @param {number} curStrPos Position in current string\n * @param {Typed} self instance of Typed\n * @returns {number} a new string position\n * @private\n */\n\n typeHtmlChars(curString, curStrPos, self) {\n if (self.contentType !== 'html') return curStrPos;\n const curChar = curString.substr(curStrPos).charAt(0);\n if (curChar === '<' || curChar === '&') {\n let endTag = '';\n if (curChar === '<') {\n endTag = '>';\n } else {\n endTag = ';';\n }\n while (curString.substr(curStrPos + 1).charAt(0) !== endTag) {\n curStrPos++;\n if (curStrPos + 1 > curString.length) {\n break;\n }\n }\n curStrPos++;\n }\n return curStrPos;\n }\n\n /**\n * Backspace HTML tags and HTML Characters\n * @param {string} curString Current string\n * @param {number} curStrPos Position in current string\n * @param {Typed} self instance of Typed\n * @returns {number} a new string position\n * @private\n */\n backSpaceHtmlChars(curString, curStrPos, self) {\n if (self.contentType !== 'html') return curStrPos;\n const curChar = curString.substr(curStrPos).charAt(0);\n if (curChar === '>' || curChar === ';') {\n let endTag = '';\n if (curChar === '>') {\n endTag = '<';\n } else {\n endTag = '&';\n }\n while (curString.substr(curStrPos - 1).charAt(0) !== endTag) {\n curStrPos--;\n if (curStrPos < 0) {\n break;\n }\n }\n curStrPos--;\n }\n return curStrPos;\n }\n}\n\nexport let htmlParser = new HTMLParser();\n","import { initializer } from './initializer.js';\nimport { htmlParser } from './html-parser.js';\n\n/**\n * Welcome to Typed.js!\n * @param {string} elementId HTML element ID _OR_ HTML element\n * @param {object} options options object\n * @returns {object} a new Typed object\n */\nexport default class Typed {\n constructor(elementId, options) {\n // Initialize it up\n initializer.load(this, options, elementId);\n // All systems go!\n this.begin();\n }\n\n /**\n * Toggle start() and stop() of the Typed instance\n * @public\n */\n toggle() {\n this.pause.status ? this.start() : this.stop();\n }\n\n /**\n * Stop typing / backspacing and enable cursor blinking\n * @public\n */\n stop() {\n if (this.typingComplete) return;\n if (this.pause.status) return;\n this.toggleBlinking(true);\n this.pause.status = true;\n this.options.onStop(this.arrayPos, this);\n }\n\n /**\n * Start typing / backspacing after being stopped\n * @public\n */\n start() {\n if (this.typingComplete) return;\n if (!this.pause.status) return;\n this.pause.status = false;\n if (this.pause.typewrite) {\n this.typewrite(this.pause.curString, this.pause.curStrPos);\n } else {\n this.backspace(this.pause.curString, this.pause.curStrPos);\n }\n this.options.onStart(this.arrayPos, this);\n }\n\n /**\n * Destroy this instance of Typed\n * @public\n */\n destroy() {\n this.reset(false);\n this.options.onDestroy(this);\n }\n\n /**\n * Reset Typed and optionally restarts\n * @param {boolean} restart\n * @public\n */\n reset(restart = true) {\n clearInterval(this.timeout);\n this.replaceText('');\n if (this.cursor && this.cursor.parentNode) {\n this.cursor.parentNode.removeChild(this.cursor);\n this.cursor = null;\n }\n this.strPos = 0;\n this.arrayPos = 0;\n this.curLoop = 0;\n if (restart) {\n this.insertCursor();\n this.options.onReset(this);\n this.begin();\n }\n }\n\n /**\n * Begins the typing animation\n * @private\n */\n begin() {\n this.options.onBegin(this);\n this.typingComplete = false;\n this.shuffleStringsIfNeeded(this);\n this.insertCursor();\n if (this.bindInputFocusEvents) this.bindFocusEvents();\n this.timeout = setTimeout(() => {\n // Check if there is some text in the element, if yes start by backspacing the default message\n if (!this.currentElContent || this.currentElContent.length === 0) {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], this.strPos);\n } else {\n // Start typing\n this.backspace(this.currentElContent, this.currentElContent.length);\n }\n }, this.startDelay);\n }\n\n /**\n * Called for each character typed\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n typewrite(curString, curStrPos) {\n if (this.fadeOut && this.el.classList.contains(this.fadeOutClass)) {\n this.el.classList.remove(this.fadeOutClass);\n if (this.cursor) this.cursor.classList.remove(this.fadeOutClass);\n }\n\n const humanize = this.humanizer(this.typeSpeed);\n let numChars = 1;\n\n if (this.pause.status === true) {\n this.setPauseStatus(curString, curStrPos, true);\n return;\n }\n\n // contain typing function in a timeout humanize'd delay\n this.timeout = setTimeout(() => {\n // skip over any HTML chars\n curStrPos = htmlParser.typeHtmlChars(curString, curStrPos, this);\n\n let pauseTime = 0;\n let substr = curString.substr(curStrPos);\n // check for an escape character before a pause value\n // format: \\^\\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^\n // single ^ are removed from string\n if (substr.charAt(0) === '^') {\n if (/^\\^\\d+/.test(substr)) {\n let skip = 1; // skip at least 1\n substr = /\\d+/.exec(substr)[0];\n skip += substr.length;\n pauseTime = parseInt(substr);\n this.temporaryPause = true;\n this.options.onTypingPaused(this.arrayPos, this);\n // strip out the escape character and pause value so they're not printed\n curString =\n curString.substring(0, curStrPos) +\n curString.substring(curStrPos + skip);\n this.toggleBlinking(true);\n }\n }\n\n // check for skip characters formatted as\n // \"this is a `string to print NOW` ...\"\n if (substr.charAt(0) === '`') {\n while (curString.substr(curStrPos + numChars).charAt(0) !== '`') {\n numChars++;\n if (curStrPos + numChars > curString.length) break;\n }\n // strip out the escape characters and append all the string in between\n const stringBeforeSkip = curString.substring(0, curStrPos);\n const stringSkipped = curString.substring(\n stringBeforeSkip.length + 1,\n curStrPos + numChars\n );\n const stringAfterSkip = curString.substring(curStrPos + numChars + 1);\n curString = stringBeforeSkip + stringSkipped + stringAfterSkip;\n numChars--;\n }\n\n // timeout for any pause after a character\n this.timeout = setTimeout(() => {\n // Accounts for blinking while paused\n this.toggleBlinking(false);\n\n // We're done with this sentence!\n if (curStrPos >= curString.length) {\n this.doneTyping(curString, curStrPos);\n } else {\n this.keepTyping(curString, curStrPos, numChars);\n }\n // end of character pause\n if (this.temporaryPause) {\n this.temporaryPause = false;\n this.options.onTypingResumed(this.arrayPos, this);\n }\n }, pauseTime);\n\n // humanized value for typing\n }, humanize);\n }\n\n /**\n * Continue to the next string & begin typing\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n keepTyping(curString, curStrPos, numChars) {\n // call before functions if applicable\n if (curStrPos === 0) {\n this.toggleBlinking(false);\n this.options.preStringTyped(this.arrayPos, this);\n }\n // start typing each new char into existing string\n // curString: arg, this.el.html: original text inside element\n curStrPos += numChars;\n const nextString = curString.substr(0, curStrPos);\n this.replaceText(nextString);\n // loop the function\n this.typewrite(curString, curStrPos);\n }\n\n /**\n * We're done typing the current string\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n doneTyping(curString, curStrPos) {\n // fires callback function\n this.options.onStringTyped(this.arrayPos, this);\n this.toggleBlinking(true);\n // is this the final string\n if (this.arrayPos === this.strings.length - 1) {\n // callback that occurs on the last typed string\n this.complete();\n // quit if we wont loop back\n if (this.loop === false || this.curLoop === this.loopCount) {\n return;\n }\n }\n this.timeout = setTimeout(() => {\n this.backspace(curString, curStrPos);\n }, this.backDelay);\n }\n\n /**\n * Backspaces 1 character at a time\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n backspace(curString, curStrPos) {\n if (this.pause.status === true) {\n this.setPauseStatus(curString, curStrPos, false);\n return;\n }\n if (this.fadeOut) return this.initFadeOut();\n\n this.toggleBlinking(false);\n const humanize = this.humanizer(this.backSpeed);\n\n this.timeout = setTimeout(() => {\n curStrPos = htmlParser.backSpaceHtmlChars(curString, curStrPos, this);\n // replace text with base text + typed characters\n const curStringAtPosition = curString.substr(0, curStrPos);\n this.replaceText(curStringAtPosition);\n\n // if smartBack is enabled\n if (this.smartBackspace) {\n // the remaining part of the current string is equal of the same part of the new string\n let nextString = this.strings[this.arrayPos + 1];\n if (\n nextString &&\n curStringAtPosition === nextString.substr(0, curStrPos)\n ) {\n this.stopNum = curStrPos;\n } else {\n this.stopNum = 0;\n }\n }\n\n // if the number (id of character in current string) is\n // less than the stop number, keep going\n if (curStrPos > this.stopNum) {\n // subtract characters one by one\n curStrPos--;\n // loop the function\n this.backspace(curString, curStrPos);\n } else if (curStrPos <= this.stopNum) {\n // if the stop number has been reached, increase\n // array position to next string\n this.arrayPos++;\n // When looping, begin at the beginning after backspace complete\n if (this.arrayPos === this.strings.length) {\n this.arrayPos = 0;\n this.options.onLastStringBackspaced();\n this.shuffleStringsIfNeeded();\n this.begin();\n } else {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], curStrPos);\n }\n }\n // humanized value for typing\n }, humanize);\n }\n\n /**\n * Full animation is complete\n * @private\n */\n complete() {\n this.options.onComplete(this);\n if (this.loop) {\n this.curLoop++;\n } else {\n this.typingComplete = true;\n }\n }\n\n /**\n * Has the typing been stopped\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @param {boolean} isTyping\n * @private\n */\n setPauseStatus(curString, curStrPos, isTyping) {\n this.pause.typewrite = isTyping;\n this.pause.curString = curString;\n this.pause.curStrPos = curStrPos;\n }\n\n /**\n * Toggle the blinking cursor\n * @param {boolean} isBlinking\n * @private\n */\n toggleBlinking(isBlinking) {\n if (!this.cursor) return;\n // if in paused state, don't toggle blinking a 2nd time\n if (this.pause.status) return;\n if (this.cursorBlinking === isBlinking) return;\n this.cursorBlinking = isBlinking;\n if (isBlinking) {\n this.cursor.classList.add('typed-cursor--blink');\n } else {\n this.cursor.classList.remove('typed-cursor--blink');\n }\n }\n\n /**\n * Speed in MS to type\n * @param {number} speed\n * @private\n */\n humanizer(speed) {\n return Math.round((Math.random() * speed) / 2) + speed;\n }\n\n /**\n * Shuffle the sequence of the strings array\n * @private\n */\n shuffleStringsIfNeeded() {\n if (!this.shuffle) return;\n this.sequence = this.sequence.sort(() => Math.random() - 0.5);\n }\n\n /**\n * Adds a CSS class to fade out current string\n * @private\n */\n initFadeOut() {\n this.el.className += ` ${this.fadeOutClass}`;\n if (this.cursor) this.cursor.className += ` ${this.fadeOutClass}`;\n return setTimeout(() => {\n this.arrayPos++;\n this.replaceText('');\n\n // Resets current string if end of loop reached\n if (this.strings.length > this.arrayPos) {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], 0);\n } else {\n this.typewrite(this.strings[0], 0);\n this.arrayPos = 0;\n }\n }, this.fadeOutDelay);\n }\n\n /**\n * Replaces current text in the HTML element\n * depending on element type\n * @param {string} str\n * @private\n */\n replaceText(str) {\n if (this.attr) {\n this.el.setAttribute(this.attr, str);\n } else {\n if (this.isInput) {\n this.el.value = str;\n } else if (this.contentType === 'html') {\n this.el.innerHTML = str;\n } else {\n this.el.textContent = str;\n }\n }\n }\n\n /**\n * If using input elements, bind focus in order to\n * start and stop the animation\n * @private\n */\n bindFocusEvents() {\n if (!this.isInput) return;\n this.el.addEventListener('focus', (e) => {\n this.stop();\n });\n this.el.addEventListener('blur', (e) => {\n if (this.el.value && this.el.value.length !== 0) {\n return;\n }\n this.start();\n });\n }\n\n /**\n * On init, insert the cursor element\n * @private\n */\n insertCursor() {\n if (!this.showCursor) return;\n if (this.cursor) return;\n this.cursor = document.createElement('span');\n this.cursor.className = 'typed-cursor';\n this.cursor.setAttribute('aria-hidden', true);\n this.cursor.innerHTML = this.cursorChar;\n this.el.parentNode &&\n this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling);\n }\n}\n"],"names":["defaults","strings","stringsElement","typeSpeed","startDelay","backSpeed","smartBackspace","shuffle","backDelay","fadeOut","fadeOutClass","fadeOutDelay","loop","loopCount","Infinity","showCursor","cursorChar","autoInsertCss","attr","bindInputFocusEvents","contentType","onBegin","self","onComplete","preStringTyped","arrayPos","onStringTyped","onLastStringBackspaced","onTypingPaused","onTypingResumed","onReset","onStop","onStart","onDestroy","initializer","load","options","elementId","el","document","querySelector","_extends","isInput","tagName","toLowerCase","cursorBlinking","elContent","getAttribute","textContent","isPaused","map","s","trim","style","cssText","Array","prototype","slice","apply","children","stringsLength","length","i","push","innerHTML","strPos","stopNum","curLoop","sequence","pause","status","typewrite","curString","curStrPos","typingComplete","currentElContent","this","getCurrentElContent","appendAnimationCss","value","cssDataName","css","createElement","type","setAttribute","innerCss","body","appendChild","htmlParser","typeHtmlChars","curChar","substr","charAt","endTag","backSpaceHtmlChars","Typed","constructor","begin","toggle","start","stop","toggleBlinking","backspace","destroy","reset","restart","clearInterval","timeout","replaceText","cursor","parentNode","removeChild","insertCursor","shuffleStringsIfNeeded","bindFocusEvents","setTimeout","classList","contains","remove","humanize","humanizer","numChars","pauseTime","test","skip","exec","parseInt","temporaryPause","substring","stringBeforeSkip","stringSkipped","stringAfterSkip","doneTyping","keepTyping","setPauseStatus","nextString","complete","initFadeOut","curStringAtPosition","isTyping","isBlinking","add","speed","Math","round","random","sort","className","str","addEventListener","e","insertBefore","nextSibling"],"mappings":"oOAMA,MAAMA,EA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d?define(s):(t||self).Typed=s()}(this,function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},t.apply(this,arguments)}var s={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:Infinity,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onBegin:function(t){},onComplete:function(t){},preStringTyped:function(t,s){},onStringTyped:function(t,s){},onLastStringBackspaced:function(t){},onTypingPaused:function(t,s){},onTypingResumed:function(t,s){},onReset:function(t){},onStop:function(t,s){},onStart:function(t,s){},onDestroy:function(t){}},e=new(/*#__PURE__*/function(){function e(){}var n=e.prototype;return n.load=function(e,n,i){if(e.el="string"==typeof i?document.querySelector(i):i,e.options=t({},s,n),e.isInput="input"===e.el.tagName.toLowerCase(),e.attr=e.options.attr,e.bindInputFocusEvents=e.options.bindInputFocusEvents,e.showCursor=!e.isInput&&e.options.showCursor,e.cursorChar=e.options.cursorChar,e.cursorBlinking=!0,e.elContent=e.attr?e.el.getAttribute(e.attr):e.el.textContent,e.contentType=e.options.contentType,e.typeSpeed=e.options.typeSpeed,e.startDelay=e.options.startDelay,e.backSpeed=e.options.backSpeed,e.smartBackspace=e.options.smartBackspace,e.backDelay=e.options.backDelay,e.fadeOut=e.options.fadeOut,e.fadeOutClass=e.options.fadeOutClass,e.fadeOutDelay=e.options.fadeOutDelay,e.isPaused=!1,e.strings=e.options.strings.map(function(t){return t.trim()}),e.stringsElement="string"==typeof e.options.stringsElement?document.querySelector(e.options.stringsElement):e.options.stringsElement,e.stringsElement){e.strings=[],e.stringsElement.style.cssText="clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;";var r=Array.prototype.slice.apply(e.stringsElement.children),o=r.length;if(o)for(var a=0;a<o;a+=1)e.strings.push(r[a].innerHTML.trim())}for(var u in e.strPos=0,e.arrayPos=0,e.stopNum=0,e.loop=e.options.loop,e.loopCount=e.options.loopCount,e.curLoop=0,e.shuffle=e.options.shuffle,e.sequence=[],e.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},e.typingComplete=!1,e.strings)e.sequence[u]=u;e.currentElContent=this.getCurrentElContent(e),e.autoInsertCss=e.options.autoInsertCss,this.appendAnimationCss(e)},n.getCurrentElContent=function(t){return t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:"html"===t.contentType?t.el.innerHTML:t.el.textContent},n.appendAnimationCss=function(t){var s="data-typed-js-css";if(t.autoInsertCss&&(t.showCursor||t.fadeOut)&&!document.querySelector("["+s+"]")){var e=document.createElement("style");e.type="text/css",e.setAttribute(s,!0);var n="";t.showCursor&&(n+="\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "),t.fadeOut&&(n+="\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "),0!==e.length&&(e.innerHTML=n,document.body.appendChild(e))}},e}()),n=new(/*#__PURE__*/function(){function t(){}var s=t.prototype;return s.typeHtmlChars=function(t,s,e){if("html"!==e.contentType)return s;var n=t.substr(s).charAt(0);if("<"===n||"&"===n){var i;for(i="<"===n?">":";";t.substr(s+1).charAt(0)!==i&&!(1+ ++s>t.length););s++}return s},s.backSpaceHtmlChars=function(t,s,e){if("html"!==e.contentType)return s;var n=t.substr(s).charAt(0);if(">"===n||";"===n){var i;for(i=">"===n?"<":"&";t.substr(s-1).charAt(0)!==i&&!(--s<0););s--}return s},t}());/*#__PURE__*/
|
|
2
|
+
return function(){function t(t,s){e.load(this,s,t),this.begin()}var s=t.prototype;return s.toggle=function(){this.pause.status?this.start():this.stop()},s.stop=function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))},s.start=function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))},s.destroy=function(){this.reset(!1),this.options.onDestroy(this)},s.reset=function(t){void 0===t&&(t=!0),clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())},s.begin=function(){var t=this;this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.currentElContent&&0!==t.currentElContent.length?t.backspace(t.currentElContent,t.currentElContent.length):t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)},s.typewrite=function(t,s){var e=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var i=this.humanizer(this.typeSpeed),r=1;!0!==this.pause.status?this.timeout=setTimeout(function(){s=n.typeHtmlChars(t,s,e);var i=0,o=t.substr(s);if("^"===o.charAt(0)&&/^\^\d+/.test(o)){var a=1;a+=(o=/\d+/.exec(o)[0]).length,i=parseInt(o),e.temporaryPause=!0,e.options.onTypingPaused(e.arrayPos,e),t=t.substring(0,s)+t.substring(s+a),e.toggleBlinking(!0)}if("`"===o.charAt(0)){for(;"`"!==t.substr(s+r).charAt(0)&&(r++,!(s+r>t.length)););var u=t.substring(0,s),p=t.substring(u.length+1,s+r),c=t.substring(s+r+1);t=u+p+c,r--}e.timeout=setTimeout(function(){e.toggleBlinking(!1),s>=t.length?e.doneTyping(t,s):e.keepTyping(t,s,r),e.temporaryPause&&(e.temporaryPause=!1,e.options.onTypingResumed(e.arrayPos,e))},i)},i):this.setPauseStatus(t,s,!0)},s.keepTyping=function(t,s,e){0===s&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));var n=t.substr(0,s+=e);this.replaceText(n),this.typewrite(t,s)},s.doneTyping=function(t,s){var e=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),!1===this.loop||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){e.backspace(t,s)},this.backDelay))},s.backspace=function(t,s){var e=this;if(!0!==this.pause.status){if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var i=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){s=n.backSpaceHtmlChars(t,s,e);var i=t.substr(0,s);if(e.replaceText(i),e.smartBackspace){var r=e.strings[e.arrayPos+1];e.stopNum=r&&i===r.substr(0,s)?s:0}s>e.stopNum?(s--,e.backspace(t,s)):s<=e.stopNum&&(e.arrayPos++,e.arrayPos===e.strings.length?(e.arrayPos=0,e.options.onLastStringBackspaced(),e.shuffleStringsIfNeeded(),e.begin()):e.typewrite(e.strings[e.sequence[e.arrayPos]],s))},i)}else this.setPauseStatus(t,s,!1)},s.complete=function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0},s.setPauseStatus=function(t,s,e){this.pause.typewrite=e,this.pause.curString=t,this.pause.curStrPos=s},s.toggleBlinking=function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))},s.humanizer=function(t){return Math.round(Math.random()*t/2)+t},s.shuffleStringsIfNeeded=function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))},s.initFadeOut=function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)},s.replaceText=function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:"html"===this.contentType?this.el.innerHTML=t:this.el.textContent=t},s.bindFocusEvents=function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(s){t.stop()}),this.el.addEventListener("blur",function(s){t.el.value&&0!==t.el.value.length||t.start()}))},s.insertCursor=function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))},t}()});
|
|
3
|
+
//# sourceMappingURL=typed.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.umd.js","sources":["../src/defaults.js","../src/initializer.js","../src/html-parser.js","../src/typed.js"],"sourcesContent":["/**\n * Defaults & options\n * @returns {object} Typed defaults & options\n * @public\n */\n\nconst defaults = {\n /**\n * @property {array} strings strings to be typed\n * @property {string} stringsElement ID of element containing string children\n */\n strings: [\n 'These are the default values...',\n 'You know what you should do?',\n 'Use your own!',\n 'Have a great day!',\n ],\n stringsElement: null,\n\n /**\n * @property {number} typeSpeed type speed in milliseconds\n */\n typeSpeed: 0,\n\n /**\n * @property {number} startDelay time before typing starts in milliseconds\n */\n startDelay: 0,\n\n /**\n * @property {number} backSpeed backspacing speed in milliseconds\n */\n backSpeed: 0,\n\n /**\n * @property {boolean} smartBackspace only backspace what doesn't match the previous string\n */\n smartBackspace: true,\n\n /**\n * @property {boolean} shuffle shuffle the strings\n */\n shuffle: false,\n\n /**\n * @property {number} backDelay time before backspacing in milliseconds\n */\n backDelay: 700,\n\n /**\n * @property {boolean} fadeOut Fade out instead of backspace\n * @property {string} fadeOutClass css class for fade animation\n * @property {boolean} fadeOutDelay Fade out delay in milliseconds\n */\n fadeOut: false,\n fadeOutClass: 'typed-fade-out',\n fadeOutDelay: 500,\n\n /**\n * @property {boolean} loop loop strings\n * @property {number} loopCount amount of loops\n */\n loop: false,\n loopCount: Infinity,\n\n /**\n * @property {boolean} showCursor show cursor\n * @property {string} cursorChar character for cursor\n * @property {boolean} autoInsertCss insert CSS for cursor and fadeOut into HTML <head>\n */\n showCursor: true,\n cursorChar: '|',\n autoInsertCss: true,\n\n /**\n * @property {string} attr attribute for typing\n * Ex: input placeholder, value, or just HTML text\n */\n attr: null,\n\n /**\n * @property {boolean} bindInputFocusEvents bind to focus and blur if el is text input\n */\n bindInputFocusEvents: false,\n\n /**\n * @property {string} contentType 'html' or 'null' for plaintext\n */\n contentType: 'html',\n\n /**\n * Before it begins typing\n * @param {Typed} self\n */\n onBegin: (self) => {},\n\n /**\n * All typing is complete\n * @param {Typed} self\n */\n onComplete: (self) => {},\n\n /**\n * Before each string is typed\n * @param {number} arrayPos\n * @param {Typed} self\n */\n preStringTyped: (arrayPos, self) => {},\n\n /**\n * After each string is typed\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStringTyped: (arrayPos, self) => {},\n\n /**\n * During looping, after last string is typed\n * @param {Typed} self\n */\n onLastStringBackspaced: (self) => {},\n\n /**\n * Typing has been stopped\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onTypingPaused: (arrayPos, self) => {},\n\n /**\n * Typing has been started after being stopped\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onTypingResumed: (arrayPos, self) => {},\n\n /**\n * After reset\n * @param {Typed} self\n */\n onReset: (self) => {},\n\n /**\n * After stop\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStop: (arrayPos, self) => {},\n\n /**\n * After start\n * @param {number} arrayPos\n * @param {Typed} self\n */\n onStart: (arrayPos, self) => {},\n\n /**\n * After destroy\n * @param {Typed} self\n */\n onDestroy: (self) => {},\n};\n\nexport default defaults;\n","import defaults from './defaults.js';\n/**\n * Initialize the Typed object\n */\n\nexport default class Initializer {\n /**\n * Load up defaults & options on the Typed instance\n * @param {Typed} self instance of Typed\n * @param {object} options options object\n * @param {string} elementId HTML element ID _OR_ instance of HTML element\n * @private\n */\n\n load(self, options, elementId) {\n // chosen element to manipulate text\n if (typeof elementId === 'string') {\n self.el = document.querySelector(elementId);\n } else {\n self.el = elementId;\n }\n\n self.options = { ...defaults, ...options };\n\n // attribute to type into\n self.isInput = self.el.tagName.toLowerCase() === 'input';\n self.attr = self.options.attr;\n self.bindInputFocusEvents = self.options.bindInputFocusEvents;\n\n // show cursor\n self.showCursor = self.isInput ? false : self.options.showCursor;\n\n // custom cursor\n self.cursorChar = self.options.cursorChar;\n\n // Is the cursor blinking\n self.cursorBlinking = true;\n\n // text content of element\n self.elContent = self.attr\n ? self.el.getAttribute(self.attr)\n : self.el.textContent;\n\n // html or plain text\n self.contentType = self.options.contentType;\n\n // typing speed\n self.typeSpeed = self.options.typeSpeed;\n\n // add a delay before typing starts\n self.startDelay = self.options.startDelay;\n\n // backspacing speed\n self.backSpeed = self.options.backSpeed;\n\n // only backspace what doesn't match the previous string\n self.smartBackspace = self.options.smartBackspace;\n\n // amount of time to wait before backspacing\n self.backDelay = self.options.backDelay;\n\n // Fade out instead of backspace\n self.fadeOut = self.options.fadeOut;\n self.fadeOutClass = self.options.fadeOutClass;\n self.fadeOutDelay = self.options.fadeOutDelay;\n\n // variable to check whether typing is currently paused\n self.isPaused = false;\n\n // input strings of text\n self.strings = self.options.strings.map((s) => s.trim());\n\n // div containing strings\n if (typeof self.options.stringsElement === 'string') {\n self.stringsElement = document.querySelector(self.options.stringsElement);\n } else {\n self.stringsElement = self.options.stringsElement;\n }\n\n if (self.stringsElement) {\n self.strings = [];\n self.stringsElement.style.cssText =\n 'clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;';\n\n const strings = Array.prototype.slice.apply(self.stringsElement.children);\n const stringsLength = strings.length;\n\n if (stringsLength) {\n for (let i = 0; i < stringsLength; i += 1) {\n const stringEl = strings[i];\n self.strings.push(stringEl.innerHTML.trim());\n }\n }\n }\n\n // character number position of current string\n self.strPos = 0;\n\n // current array position\n self.arrayPos = 0;\n\n // index of string to stop backspacing on\n self.stopNum = 0;\n\n // Looping logic\n self.loop = self.options.loop;\n self.loopCount = self.options.loopCount;\n self.curLoop = 0;\n\n // shuffle the strings\n self.shuffle = self.options.shuffle;\n // the order of strings\n self.sequence = [];\n\n self.pause = {\n status: false,\n typewrite: true,\n curString: '',\n curStrPos: 0,\n };\n\n // When the typing is complete (when not looped)\n self.typingComplete = false;\n\n // Set the order in which the strings are typed\n for (let i in self.strings) {\n self.sequence[i] = i;\n }\n\n // If there is some text in the element\n self.currentElContent = this.getCurrentElContent(self);\n\n self.autoInsertCss = self.options.autoInsertCss;\n\n this.appendAnimationCss(self);\n }\n\n getCurrentElContent(self) {\n let elContent = '';\n if (self.attr) {\n elContent = self.el.getAttribute(self.attr);\n } else if (self.isInput) {\n elContent = self.el.value;\n } else if (self.contentType === 'html') {\n elContent = self.el.innerHTML;\n } else {\n elContent = self.el.textContent;\n }\n return elContent;\n }\n\n appendAnimationCss(self) {\n const cssDataName = 'data-typed-js-css';\n if (!self.autoInsertCss) {\n return;\n }\n if (!self.showCursor && !self.fadeOut) {\n return;\n }\n if (document.querySelector(`[${cssDataName}]`)) {\n return;\n }\n\n let css = document.createElement('style');\n css.type = 'text/css';\n css.setAttribute(cssDataName, true);\n\n let innerCss = '';\n if (self.showCursor) {\n innerCss += `\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n `;\n }\n\n if (self.fadeOut) {\n innerCss += `\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n `;\n }\n if (css.length === 0) {\n return;\n }\n css.innerHTML = innerCss;\n document.body.appendChild(css);\n }\n}\n\nexport let initializer = new Initializer();\n","/**\n * TODO: These methods can probably be combined somehow\n * Parse HTML tags & HTML Characters\n */\n\nexport default class HTMLParser {\n /**\n * Type HTML tags & HTML Characters\n * @param {string} curString Current string\n * @param {number} curStrPos Position in current string\n * @param {Typed} self instance of Typed\n * @returns {number} a new string position\n * @private\n */\n\n typeHtmlChars(curString, curStrPos, self) {\n if (self.contentType !== 'html') return curStrPos;\n const curChar = curString.substr(curStrPos).charAt(0);\n if (curChar === '<' || curChar === '&') {\n let endTag = '';\n if (curChar === '<') {\n endTag = '>';\n } else {\n endTag = ';';\n }\n while (curString.substr(curStrPos + 1).charAt(0) !== endTag) {\n curStrPos++;\n if (curStrPos + 1 > curString.length) {\n break;\n }\n }\n curStrPos++;\n }\n return curStrPos;\n }\n\n /**\n * Backspace HTML tags and HTML Characters\n * @param {string} curString Current string\n * @param {number} curStrPos Position in current string\n * @param {Typed} self instance of Typed\n * @returns {number} a new string position\n * @private\n */\n backSpaceHtmlChars(curString, curStrPos, self) {\n if (self.contentType !== 'html') return curStrPos;\n const curChar = curString.substr(curStrPos).charAt(0);\n if (curChar === '>' || curChar === ';') {\n let endTag = '';\n if (curChar === '>') {\n endTag = '<';\n } else {\n endTag = '&';\n }\n while (curString.substr(curStrPos - 1).charAt(0) !== endTag) {\n curStrPos--;\n if (curStrPos < 0) {\n break;\n }\n }\n curStrPos--;\n }\n return curStrPos;\n }\n}\n\nexport let htmlParser = new HTMLParser();\n","import { initializer } from './initializer.js';\nimport { htmlParser } from './html-parser.js';\n\n/**\n * Welcome to Typed.js!\n * @param {string} elementId HTML element ID _OR_ HTML element\n * @param {object} options options object\n * @returns {object} a new Typed object\n */\nexport default class Typed {\n constructor(elementId, options) {\n // Initialize it up\n initializer.load(this, options, elementId);\n // All systems go!\n this.begin();\n }\n\n /**\n * Toggle start() and stop() of the Typed instance\n * @public\n */\n toggle() {\n this.pause.status ? this.start() : this.stop();\n }\n\n /**\n * Stop typing / backspacing and enable cursor blinking\n * @public\n */\n stop() {\n if (this.typingComplete) return;\n if (this.pause.status) return;\n this.toggleBlinking(true);\n this.pause.status = true;\n this.options.onStop(this.arrayPos, this);\n }\n\n /**\n * Start typing / backspacing after being stopped\n * @public\n */\n start() {\n if (this.typingComplete) return;\n if (!this.pause.status) return;\n this.pause.status = false;\n if (this.pause.typewrite) {\n this.typewrite(this.pause.curString, this.pause.curStrPos);\n } else {\n this.backspace(this.pause.curString, this.pause.curStrPos);\n }\n this.options.onStart(this.arrayPos, this);\n }\n\n /**\n * Destroy this instance of Typed\n * @public\n */\n destroy() {\n this.reset(false);\n this.options.onDestroy(this);\n }\n\n /**\n * Reset Typed and optionally restarts\n * @param {boolean} restart\n * @public\n */\n reset(restart = true) {\n clearInterval(this.timeout);\n this.replaceText('');\n if (this.cursor && this.cursor.parentNode) {\n this.cursor.parentNode.removeChild(this.cursor);\n this.cursor = null;\n }\n this.strPos = 0;\n this.arrayPos = 0;\n this.curLoop = 0;\n if (restart) {\n this.insertCursor();\n this.options.onReset(this);\n this.begin();\n }\n }\n\n /**\n * Begins the typing animation\n * @private\n */\n begin() {\n this.options.onBegin(this);\n this.typingComplete = false;\n this.shuffleStringsIfNeeded(this);\n this.insertCursor();\n if (this.bindInputFocusEvents) this.bindFocusEvents();\n this.timeout = setTimeout(() => {\n // Check if there is some text in the element, if yes start by backspacing the default message\n if (!this.currentElContent || this.currentElContent.length === 0) {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], this.strPos);\n } else {\n // Start typing\n this.backspace(this.currentElContent, this.currentElContent.length);\n }\n }, this.startDelay);\n }\n\n /**\n * Called for each character typed\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n typewrite(curString, curStrPos) {\n if (this.fadeOut && this.el.classList.contains(this.fadeOutClass)) {\n this.el.classList.remove(this.fadeOutClass);\n if (this.cursor) this.cursor.classList.remove(this.fadeOutClass);\n }\n\n const humanize = this.humanizer(this.typeSpeed);\n let numChars = 1;\n\n if (this.pause.status === true) {\n this.setPauseStatus(curString, curStrPos, true);\n return;\n }\n\n // contain typing function in a timeout humanize'd delay\n this.timeout = setTimeout(() => {\n // skip over any HTML chars\n curStrPos = htmlParser.typeHtmlChars(curString, curStrPos, this);\n\n let pauseTime = 0;\n let substr = curString.substr(curStrPos);\n // check for an escape character before a pause value\n // format: \\^\\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^\n // single ^ are removed from string\n if (substr.charAt(0) === '^') {\n if (/^\\^\\d+/.test(substr)) {\n let skip = 1; // skip at least 1\n substr = /\\d+/.exec(substr)[0];\n skip += substr.length;\n pauseTime = parseInt(substr);\n this.temporaryPause = true;\n this.options.onTypingPaused(this.arrayPos, this);\n // strip out the escape character and pause value so they're not printed\n curString =\n curString.substring(0, curStrPos) +\n curString.substring(curStrPos + skip);\n this.toggleBlinking(true);\n }\n }\n\n // check for skip characters formatted as\n // \"this is a `string to print NOW` ...\"\n if (substr.charAt(0) === '`') {\n while (curString.substr(curStrPos + numChars).charAt(0) !== '`') {\n numChars++;\n if (curStrPos + numChars > curString.length) break;\n }\n // strip out the escape characters and append all the string in between\n const stringBeforeSkip = curString.substring(0, curStrPos);\n const stringSkipped = curString.substring(\n stringBeforeSkip.length + 1,\n curStrPos + numChars\n );\n const stringAfterSkip = curString.substring(curStrPos + numChars + 1);\n curString = stringBeforeSkip + stringSkipped + stringAfterSkip;\n numChars--;\n }\n\n // timeout for any pause after a character\n this.timeout = setTimeout(() => {\n // Accounts for blinking while paused\n this.toggleBlinking(false);\n\n // We're done with this sentence!\n if (curStrPos >= curString.length) {\n this.doneTyping(curString, curStrPos);\n } else {\n this.keepTyping(curString, curStrPos, numChars);\n }\n // end of character pause\n if (this.temporaryPause) {\n this.temporaryPause = false;\n this.options.onTypingResumed(this.arrayPos, this);\n }\n }, pauseTime);\n\n // humanized value for typing\n }, humanize);\n }\n\n /**\n * Continue to the next string & begin typing\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n keepTyping(curString, curStrPos, numChars) {\n // call before functions if applicable\n if (curStrPos === 0) {\n this.toggleBlinking(false);\n this.options.preStringTyped(this.arrayPos, this);\n }\n // start typing each new char into existing string\n // curString: arg, this.el.html: original text inside element\n curStrPos += numChars;\n const nextString = curString.substr(0, curStrPos);\n this.replaceText(nextString);\n // loop the function\n this.typewrite(curString, curStrPos);\n }\n\n /**\n * We're done typing the current string\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n doneTyping(curString, curStrPos) {\n // fires callback function\n this.options.onStringTyped(this.arrayPos, this);\n this.toggleBlinking(true);\n // is this the final string\n if (this.arrayPos === this.strings.length - 1) {\n // callback that occurs on the last typed string\n this.complete();\n // quit if we wont loop back\n if (this.loop === false || this.curLoop === this.loopCount) {\n return;\n }\n }\n this.timeout = setTimeout(() => {\n this.backspace(curString, curStrPos);\n }, this.backDelay);\n }\n\n /**\n * Backspaces 1 character at a time\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @private\n */\n backspace(curString, curStrPos) {\n if (this.pause.status === true) {\n this.setPauseStatus(curString, curStrPos, false);\n return;\n }\n if (this.fadeOut) return this.initFadeOut();\n\n this.toggleBlinking(false);\n const humanize = this.humanizer(this.backSpeed);\n\n this.timeout = setTimeout(() => {\n curStrPos = htmlParser.backSpaceHtmlChars(curString, curStrPos, this);\n // replace text with base text + typed characters\n const curStringAtPosition = curString.substr(0, curStrPos);\n this.replaceText(curStringAtPosition);\n\n // if smartBack is enabled\n if (this.smartBackspace) {\n // the remaining part of the current string is equal of the same part of the new string\n let nextString = this.strings[this.arrayPos + 1];\n if (\n nextString &&\n curStringAtPosition === nextString.substr(0, curStrPos)\n ) {\n this.stopNum = curStrPos;\n } else {\n this.stopNum = 0;\n }\n }\n\n // if the number (id of character in current string) is\n // less than the stop number, keep going\n if (curStrPos > this.stopNum) {\n // subtract characters one by one\n curStrPos--;\n // loop the function\n this.backspace(curString, curStrPos);\n } else if (curStrPos <= this.stopNum) {\n // if the stop number has been reached, increase\n // array position to next string\n this.arrayPos++;\n // When looping, begin at the beginning after backspace complete\n if (this.arrayPos === this.strings.length) {\n this.arrayPos = 0;\n this.options.onLastStringBackspaced();\n this.shuffleStringsIfNeeded();\n this.begin();\n } else {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], curStrPos);\n }\n }\n // humanized value for typing\n }, humanize);\n }\n\n /**\n * Full animation is complete\n * @private\n */\n complete() {\n this.options.onComplete(this);\n if (this.loop) {\n this.curLoop++;\n } else {\n this.typingComplete = true;\n }\n }\n\n /**\n * Has the typing been stopped\n * @param {string} curString the current string in the strings array\n * @param {number} curStrPos the current position in the curString\n * @param {boolean} isTyping\n * @private\n */\n setPauseStatus(curString, curStrPos, isTyping) {\n this.pause.typewrite = isTyping;\n this.pause.curString = curString;\n this.pause.curStrPos = curStrPos;\n }\n\n /**\n * Toggle the blinking cursor\n * @param {boolean} isBlinking\n * @private\n */\n toggleBlinking(isBlinking) {\n if (!this.cursor) return;\n // if in paused state, don't toggle blinking a 2nd time\n if (this.pause.status) return;\n if (this.cursorBlinking === isBlinking) return;\n this.cursorBlinking = isBlinking;\n if (isBlinking) {\n this.cursor.classList.add('typed-cursor--blink');\n } else {\n this.cursor.classList.remove('typed-cursor--blink');\n }\n }\n\n /**\n * Speed in MS to type\n * @param {number} speed\n * @private\n */\n humanizer(speed) {\n return Math.round((Math.random() * speed) / 2) + speed;\n }\n\n /**\n * Shuffle the sequence of the strings array\n * @private\n */\n shuffleStringsIfNeeded() {\n if (!this.shuffle) return;\n this.sequence = this.sequence.sort(() => Math.random() - 0.5);\n }\n\n /**\n * Adds a CSS class to fade out current string\n * @private\n */\n initFadeOut() {\n this.el.className += ` ${this.fadeOutClass}`;\n if (this.cursor) this.cursor.className += ` ${this.fadeOutClass}`;\n return setTimeout(() => {\n this.arrayPos++;\n this.replaceText('');\n\n // Resets current string if end of loop reached\n if (this.strings.length > this.arrayPos) {\n this.typewrite(this.strings[this.sequence[this.arrayPos]], 0);\n } else {\n this.typewrite(this.strings[0], 0);\n this.arrayPos = 0;\n }\n }, this.fadeOutDelay);\n }\n\n /**\n * Replaces current text in the HTML element\n * depending on element type\n * @param {string} str\n * @private\n */\n replaceText(str) {\n if (this.attr) {\n this.el.setAttribute(this.attr, str);\n } else {\n if (this.isInput) {\n this.el.value = str;\n } else if (this.contentType === 'html') {\n this.el.innerHTML = str;\n } else {\n this.el.textContent = str;\n }\n }\n }\n\n /**\n * If using input elements, bind focus in order to\n * start and stop the animation\n * @private\n */\n bindFocusEvents() {\n if (!this.isInput) return;\n this.el.addEventListener('focus', (e) => {\n this.stop();\n });\n this.el.addEventListener('blur', (e) => {\n if (this.el.value && this.el.value.length !== 0) {\n return;\n }\n this.start();\n });\n }\n\n /**\n * On init, insert the cursor element\n * @private\n */\n insertCursor() {\n if (!this.showCursor) return;\n if (this.cursor) return;\n this.cursor = document.createElement('span');\n this.cursor.className = 'typed-cursor';\n this.cursor.setAttribute('aria-hidden', true);\n this.cursor.innerHTML = this.cursorChar;\n this.el.parentNode &&\n this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling);\n }\n}\n"],"names":["defaults","strings","stringsElement","typeSpeed","startDelay","backSpeed","smartBackspace","shuffle","backDelay","fadeOut","fadeOutClass","fadeOutDelay","loop","loopCount","Infinity","showCursor","cursorChar","autoInsertCss","attr","bindInputFocusEvents","contentType","onBegin","self","onComplete","preStringTyped","arrayPos","onStringTyped","onLastStringBackspaced","onTypingPaused","onTypingResumed","onReset","onStop","onStart","onDestroy","initializer","Initializer","_proto","prototype","load","options","elementId","el","document","querySelector","_extends","isInput","tagName","toLowerCase","cursorBlinking","elContent","getAttribute","textContent","isPaused","map","s","trim","style","cssText","Array","slice","apply","children","stringsLength","length","i","push","innerHTML","strPos","stopNum","curLoop","sequence","pause","status","typewrite","curString","curStrPos","typingComplete","currentElContent","this","getCurrentElContent","appendAnimationCss","value","cssDataName","css","createElement","type","setAttribute","innerCss","body","appendChild","htmlParser","HTMLParser","typeHtmlChars","curChar","substr","charAt","endTag","backSpaceHtmlChars","Typed","begin","toggle","start","stop","toggleBlinking","backspace","destroy","reset","restart","clearInterval","timeout","replaceText","cursor","parentNode","removeChild","insertCursor","_this","shuffleStringsIfNeeded","bindFocusEvents","setTimeout","_this2","classList","contains","remove","humanize","humanizer","numChars","pauseTime","test","skip","exec","parseInt","temporaryPause","substring","stringBeforeSkip","stringSkipped","stringAfterSkip","doneTyping","keepTyping","setPauseStatus","nextString","_this3","complete","_this4","initFadeOut","curStringAtPosition","isTyping","isBlinking","add","speed","Math","round","random","sort","_this5","className","str","_this6","addEventListener","e","insertBefore","nextSibling"],"mappings":"4bAMA,IAAMA,EAAW,CAKfC,QAAS,CACP,kCACA,+BACA,gBACA,qBAEFC,eAAgB,KAKhBC,UAAW,EAKXC,WAAY,EAKZC,UAAW,EAKXC,gBAAgB,EAKhBC,SAAS,EAKTC,UAAW,IAOXC,SAAS,EACTC,aAAc,iBACdC,aAAc,IAMdC,MAAM,EACNC,UAAWC,SAOXC,YAAY,EACZC,WAAY,IACZC,eAAe,EAMfC,KAAM,KAKNC,sBAAsB,EAKtBC,YAAa,OAMbC,QAAS,SAACC,GAAW,EAMrBC,WAAY,SAACD,GAAS,EAOtBE,eAAgB,SAACC,EAA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