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.
Files changed (63) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +88 -37
  3. package/dist/typed.cjs +2 -0
  4. package/dist/typed.cjs.map +1 -0
  5. package/dist/typed.module.js +2 -0
  6. package/dist/typed.module.js.map +1 -0
  7. package/dist/typed.umd.js +3 -0
  8. package/dist/typed.umd.js.map +1 -0
  9. package/index.d.ts +253 -134
  10. package/package.json +21 -28
  11. package/.codeclimate.yml +0 -31
  12. package/.csslintrc +0 -2
  13. package/.esdoc.json +0 -4
  14. package/.eslintignore +0 -3
  15. package/.eslintrc.yml +0 -25
  16. package/.github/CONTRIBUTING.md +0 -44
  17. package/.github/ISSUE_TEMPLATE.md +0 -27
  18. package/.github/PULL_REQUEST_TEMPLATE.md +0 -38
  19. package/.prettierrc +0 -4
  20. package/.travis.yml +0 -16
  21. package/.vscode/launch.json +0 -14
  22. package/.vscode/settings.json +0 -11
  23. package/CODE_OF_CONDUCT.md +0 -46
  24. package/app.js +0 -12
  25. package/assets/demos.css +0 -61
  26. package/assets/demos.js +0 -133
  27. package/bower.json +0 -11
  28. package/docs/API.md +0 -231
  29. package/docs/assets/anchor.js +0 -197
  30. package/docs/assets/bass-addons.css +0 -12
  31. package/docs/assets/bass.css +0 -543
  32. package/docs/assets/fonts/EOT/SourceCodePro-Bold.eot +0 -0
  33. package/docs/assets/fonts/EOT/SourceCodePro-Regular.eot +0 -0
  34. package/docs/assets/fonts/LICENSE.txt +0 -93
  35. package/docs/assets/fonts/OTF/SourceCodePro-Bold.otf +0 -0
  36. package/docs/assets/fonts/OTF/SourceCodePro-Regular.otf +0 -0
  37. package/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf +0 -0
  38. package/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf +0 -0
  39. package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff +0 -0
  40. package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff +0 -0
  41. package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff +0 -0
  42. package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff +0 -0
  43. package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 +0 -0
  44. package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 +0 -0
  45. package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 +0 -0
  46. package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 +0 -0
  47. package/docs/assets/fonts/source-code-pro.css +0 -23
  48. package/docs/assets/github.css +0 -123
  49. package/docs/assets/site.js +0 -108
  50. package/docs/assets/style.css +0 -136
  51. package/docs/index.html +0 -2187
  52. package/gulpfile.js +0 -95
  53. package/index.html +0 -184
  54. package/lib/typed.js +0 -1052
  55. package/lib/typed.min.js +0 -11
  56. package/lib/typed.min.js.map +0 -1
  57. package/logo-cropped.png +0 -0
  58. package/logo.png +0 -0
  59. package/src/defaults.js +0 -164
  60. package/src/html-parser.js +0 -67
  61. package/src/initializer.js +0 -207
  62. package/src/typed.js +0 -433
  63. package/webpack.config.js +0 -45
package/index.d.ts CHANGED
@@ -1,134 +1,253 @@
1
- /**
2
- * Declaration for typed.js
3
- * Typed.js version: v2.0.12
4
- */
5
-
6
- declare module 'typed.js' {
7
- interface TypedOptions {
8
- /**
9
- * strings to be typed
10
- */
11
- strings?: string[];
12
- /**
13
- * ID or instance of HTML element of element containing string children
14
- */
15
- stringsElement?: string | Element;
16
- /**
17
- * type speed in milliseconds
18
- */
19
- typeSpeed?: number;
20
- /**
21
- * time before typing starts in milliseconds
22
- */
23
- startDelay?: number;
24
- /**
25
- * backspacing speed in milliseconds
26
- */
27
- backSpeed?: number;
28
- /**
29
- * only backspace what doesn't match the previous string
30
- */
31
- smartBackspace?: boolean;
32
- /**
33
- * shuffle the strings
34
- */
35
- shuffle?: boolean;
36
- /**
37
- * time before backspacing in milliseconds
38
- */
39
- backDelay?: number;
40
- /**
41
- * Fade out instead of backspace
42
- */
43
- fadeOut?: boolean;
44
- /**
45
- * css class for fade animation
46
- */
47
- fadeOutClass?: string;
48
- /**
49
- * Fade out delay in milliseconds
50
- */
51
- fadeOutDelay?: number;
52
- /**
53
- * loop strings
54
- */
55
- loop?: boolean;
56
- /**
57
- * amount of loops
58
- */
59
- loopCount?: number;
60
- /**
61
- * show cursor
62
- */
63
- showCursor?: boolean;
64
- /**
65
- * character for cursor
66
- */
67
- cursorChar?: string;
68
- /**
69
- * insert CSS for cursor and fadeOut into HTML
70
- */
71
- autoInsertCss?: boolean;
72
- /**
73
- * attribute for typing Ex: input placeholder, value, or just HTML text
74
- */
75
- attr?: string;
76
- /**
77
- * bind to focus and blur if el is text input
78
- */
79
- bindInputFocusEvents?: boolean;
80
- /**
81
- * 'html' or 'null' for plaintext
82
- */
83
- contentType?: string;
84
- /**
85
- * All typing is complete
86
- */
87
- onComplete?(self: Typed): void;
88
- /**
89
- * Before each string is typed
90
- */
91
- preStringTyped?(arrayPos: number, self: Typed): void;
92
- /**
93
- * After each string is typed
94
- */
95
- onStringTyped?(arrayPos: number, self: Typed): void;
96
- /**
97
- * During looping, after last string is typed
98
- */
99
- onLastStringBackspaced?(self: Typed): void;
100
- /**
101
- * Typing has been stopped
102
- */
103
- onTypingPaused?(arrayPos: number, self: Typed): void;
104
- /**
105
- * Typing has been started after being stopped
106
- */
107
- onTypingResumed?(arrayPos: number, self: Typed): void;
108
- /**
109
- * After reset
110
- */
111
- onReset?(self: Typed): void;
112
- /**
113
- * After stop
114
- */
115
- onStop?(arrayPos: number, self: Typed): void;
116
- /**
117
- * After start
118
- */
119
- onStart?(arrayPos: number, self: Typed): void;
120
- /**
121
- * After destroy
122
- */
123
- onDestroy?(self: Typed): void;
124
- }
125
-
126
- export default class Typed {
127
- constructor(elementId: string | Element, options: TypedOptions);
128
- toggle(): void;
129
- stop(): void;
130
- start(): void;
131
- destroy(): void;
132
- reset(restart?: boolean): void;
133
- }
134
- }
1
+ /**
2
+ * Welcome to Typed.js!
3
+ * @param {string} elementId HTML element ID _OR_ HTML element
4
+ * @param {object} options options object
5
+ * @returns {object} a new Typed object
6
+ */
7
+
8
+ declare module 'typed.js' {
9
+ export interface TypedOptions {
10
+ /**
11
+ * strings to be typed
12
+ */
13
+ strings?: string[];
14
+ /**
15
+ * ID or instance of HTML element of element containing string children
16
+ */
17
+ stringsElement?: string | Element;
18
+ /**
19
+ * type speed in milliseconds
20
+ */
21
+ typeSpeed?: number;
22
+ /**
23
+ * time before typing starts in milliseconds
24
+ */
25
+ startDelay?: number;
26
+ /**
27
+ * backspacing speed in milliseconds
28
+ */
29
+ backSpeed?: number;
30
+ /**
31
+ * only backspace what doesn't match the previous string
32
+ */
33
+ smartBackspace?: boolean;
34
+ /**
35
+ * shuffle the strings
36
+ */
37
+ shuffle?: boolean;
38
+ /**
39
+ * time before backspacing in milliseconds
40
+ */
41
+ backDelay?: number;
42
+ /**
43
+ * Fade out instead of backspace
44
+ */
45
+ fadeOut?: boolean;
46
+ /**
47
+ * css class for fade animation
48
+ */
49
+ fadeOutClass?: string;
50
+ /**
51
+ * Fade out delay in milliseconds
52
+ */
53
+ fadeOutDelay?: number;
54
+ /**
55
+ * loop strings
56
+ */
57
+ loop?: boolean;
58
+ /**
59
+ * amount of loops
60
+ */
61
+ loopCount?: number;
62
+ /**
63
+ * show cursor
64
+ */
65
+ showCursor?: boolean;
66
+ /**
67
+ * character for cursor
68
+ */
69
+ cursorChar?: string;
70
+ /**
71
+ * insert CSS for cursor and fadeOut into HTML
72
+ */
73
+ autoInsertCss?: boolean;
74
+ /**
75
+ * attribute for typing Ex: input placeholder, value, or just HTML text
76
+ */
77
+ attr?: string;
78
+ /**
79
+ * bind to focus and blur if el is text input
80
+ */
81
+ bindInputFocusEvents?: boolean;
82
+ /**
83
+ * 'html' or 'null' for plaintext
84
+ */
85
+ contentType?: string;
86
+ /**
87
+ * All typing is complete
88
+ */
89
+ onComplete?(self: Typed): void;
90
+ /**
91
+ * Before each string is typed
92
+ */
93
+ preStringTyped?(arrayPos: number, self: Typed): void;
94
+ /**
95
+ * After each string is typed
96
+ */
97
+ onStringTyped?(arrayPos: number, self: Typed): void;
98
+ /**
99
+ * During looping, after last string is typed
100
+ */
101
+ onLastStringBackspaced?(self: Typed): void;
102
+ /**
103
+ * Typing has been stopped
104
+ */
105
+ onTypingPaused?(arrayPos: number, self: Typed): void;
106
+ /**
107
+ * Typing has been started after being stopped
108
+ */
109
+ onTypingResumed?(arrayPos: number, self: Typed): void;
110
+ /**
111
+ * After reset
112
+ */
113
+ onReset?(self: Typed): void;
114
+ /**
115
+ * After stop
116
+ */
117
+ onStop?(arrayPos: number, self: Typed): void;
118
+ /**
119
+ * After start
120
+ */
121
+ onStart?(arrayPos: number, self: Typed): void;
122
+ /**
123
+ * After destroy
124
+ */
125
+ onDestroy?(self: Typed): void;
126
+ }
127
+
128
+ export default class Typed {
129
+ constructor(elementId: any, options: TypedOptions);
130
+ /**
131
+ * Toggle start() and stop() of the Typed instance
132
+ * @public
133
+ */
134
+ public toggle(): void;
135
+ /**
136
+ * Stop typing / backspacing and enable cursor blinking
137
+ * @public
138
+ */
139
+ public stop(): void;
140
+ /**
141
+ * Start typing / backspacing after being stopped
142
+ * @public
143
+ */
144
+ public start(): void;
145
+ /**
146
+ * Destroy this instance of Typed
147
+ * @public
148
+ */
149
+ public destroy(): void;
150
+ /**
151
+ * Reset Typed and optionally restarts
152
+ * @param {boolean} restart
153
+ * @public
154
+ */
155
+ public reset(restart?: boolean): void;
156
+ cursor: HTMLSpanElement;
157
+ strPos: number;
158
+ arrayPos: number;
159
+ curLoop: number;
160
+ /**
161
+ * Begins the typing animation
162
+ * @private
163
+ */
164
+ private begin;
165
+ typingComplete: boolean;
166
+ timeout: any;
167
+ /**
168
+ * Called for each character typed
169
+ * @param {string} curString the current string in the strings array
170
+ * @param {number} curStrPos the current position in the curString
171
+ * @private
172
+ */
173
+ private typewrite;
174
+ temporaryPause: boolean;
175
+ /**
176
+ * Continue to the next string & begin typing
177
+ * @param {string} curString the current string in the strings array
178
+ * @param {number} curStrPos the current position in the curString
179
+ * @private
180
+ */
181
+ private keepTyping;
182
+ /**
183
+ * We're done typing the current string
184
+ * @param {string} curString the current string in the strings array
185
+ * @param {number} curStrPos the current position in the curString
186
+ * @private
187
+ */
188
+ private doneTyping;
189
+ /**
190
+ * Backspaces 1 character at a time
191
+ * @param {string} curString the current string in the strings array
192
+ * @param {number} curStrPos the current position in the curString
193
+ * @private
194
+ */
195
+ private backspace;
196
+ stopNum: number;
197
+ /**
198
+ * Full animation is complete
199
+ * @private
200
+ */
201
+ private complete;
202
+ /**
203
+ * Has the typing been stopped
204
+ * @param {string} curString the current string in the strings array
205
+ * @param {number} curStrPos the current position in the curString
206
+ * @param {boolean} isTyping
207
+ * @private
208
+ */
209
+ private setPauseStatus;
210
+ /**
211
+ * Toggle the blinking cursor
212
+ * @param {boolean} isBlinking
213
+ * @private
214
+ */
215
+ private toggleBlinking;
216
+ cursorBlinking: any;
217
+ /**
218
+ * Speed in MS to type
219
+ * @param {number} speed
220
+ * @private
221
+ */
222
+ private humanizer;
223
+ /**
224
+ * Shuffle the sequence of the strings array
225
+ * @private
226
+ */
227
+ private shuffleStringsIfNeeded;
228
+ sequence: any;
229
+ /**
230
+ * Adds a CSS class to fade out current string
231
+ * @private
232
+ */
233
+ private initFadeOut;
234
+ /**
235
+ * Replaces current text in the HTML element
236
+ * depending on element type
237
+ * @param {string} str
238
+ * @private
239
+ */
240
+ private replaceText;
241
+ /**
242
+ * If using input elements, bind focus in order to
243
+ * start and stop the animation
244
+ * @private
245
+ */
246
+ private bindFocusEvents;
247
+ /**
248
+ * On init, insert the cursor element
249
+ * @private
250
+ */
251
+ private insertCursor;
252
+ }
253
+ }
package/package.json CHANGED
@@ -1,41 +1,34 @@
1
1
  {
2
2
  "name": "typed.js",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "homepage": "https://github.com/mattboldt/typed.js",
5
5
  "repository": "https://github.com/mattboldt/typed.js",
6
6
  "license": "MIT",
7
- "author": "Matt Boldt <me@mattboldt.com>",
7
+ "author": "Matt Boldt",
8
8
  "description": "A JavaScript Typing Animation Library",
9
- "main": "lib/typed.js",
9
+ "type": "module",
10
+ "source": "src/typed.js",
11
+ "types": "./index.d.ts",
12
+ "files": [
13
+ "dist",
14
+ "index.d.ts"
15
+ ],
16
+ "exports": {
17
+ "require": "./dist/typed.cjs",
18
+ "import": "./dist/typed.module.js"
19
+ },
20
+ "main": "./dist/typed.cjs",
21
+ "module": "./dist/typed.module.js",
22
+ "unpkg": "./dist/typed.umd.js",
10
23
  "keywords": [
11
24
  "typed",
12
25
  "animation"
13
26
  ],
14
27
  "devDependencies": {
15
- "babel": "^5.8.23",
16
- "babel-core": "^5.8.24",
17
- "babel-eslint": "^4.1.1",
18
- "babel-loader": "^5.3.2",
19
- "documentation": "^8.0.0",
20
- "eslint": "^3.19.0",
21
- "eslint-config-standard": "^10.2.1",
22
- "eslint-plugin-import": "^2.6.0",
23
- "eslint-plugin-node": "^5.1.0",
24
- "eslint-plugin-promise": "^3.5.0",
25
- "eslint-plugin-standard": "^3.0.1",
26
- "express": "^4.15.3",
27
- "gulp": "^3.9.0",
28
- "gulp-documentation": "^3.2.0",
29
- "gulp-eslint": "^4.0.0",
30
- "gulp-express": "^0.3.5",
31
- "gulp-livereload": "^3.8.1",
32
- "gulp-rename": "^1.2.2",
33
- "gulp-sourcemaps": "^1.5.2",
34
- "gulp-uglify": "^1.4.1",
35
- "webpack": "^1.12.1",
36
- "webpack-stream": "^2.1.0",
37
- "lodash": "^4.17.5",
38
- "mime": "^1.4.1",
39
- "debug": "^2.6.9"
28
+ "microbundle": "^0.15.1"
29
+ },
30
+ "scripts": {
31
+ "build": "microbundle --name=Typed",
32
+ "dev": "microbundle --name=Typed watch"
40
33
  }
41
34
  }
package/.codeclimate.yml DELETED
@@ -1,31 +0,0 @@
1
- ---
2
- engines:
3
- csslint:
4
- enabled: false
5
- duplication:
6
- enabled: true
7
- config:
8
- languages:
9
- - ruby
10
- - javascript
11
- - python
12
- - php
13
- eslint:
14
- enabled: true
15
- fixme:
16
- enabled: false
17
- ratings:
18
- paths:
19
- - "**.css"
20
- - "**.inc"
21
- - "**.js"
22
- - "**.jsx"
23
- - "**.module"
24
- - "**.php"
25
- - "**.py"
26
- - "**.rb"
27
- exclude_paths:
28
- - dist/
29
- - lib/
30
- - docs/
31
- - assets/
package/.csslintrc DELETED
@@ -1,2 +0,0 @@
1
- --exclude-exts=.min.css
2
- --ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes
package/.esdoc.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "source": "./src",
3
- "destination": "./docs"
4
- }
package/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- **/*{.,-}min.js
2
- ./demos/**.js
3
- gulpfile.js
package/.eslintrc.yml DELETED
@@ -1,25 +0,0 @@
1
- ---
2
- extends: standard
3
- rules:
4
- semi: 0
5
- no-extra-semi: 0
6
- space-before-function-paren: [error, never]
7
-
8
- plugins:
9
- - standard
10
-
11
- parserOptions:
12
- sourceType: module
13
- ecmaFeatures:
14
- modules: true
15
-
16
- env:
17
- amd: true
18
- browser: true
19
- es6: true
20
- jquery: true
21
- node: true
22
-
23
- overrides:
24
- - files: ["./demos*.js"]
25
- excludedFiles: "./demos/*.js"
@@ -1,44 +0,0 @@
1
- # Contributing
2
-
3
- 🎉🎉🎉 Thank you for contributing! 🎉🎉🎉
4
-
5
- I greatly appreciate anyone taking the time to help make Typed.js better.
6
-
7
- ## Development
8
-
9
- First, clone the repo onto your local machine.
10
- ```
11
- git clone git@github.com:mattboldt/typed.js.git
12
- cd typed.js
13
- ```
14
-
15
- Then, make sure you have all the development dependencies installed.
16
- ```
17
- yarn install
18
- ```
19
- (note: you will need Node.js, `yarn`, and `gulp` installed globally on your system)
20
-
21
- To get things going:
22
- ```
23
- gulp serve
24
- open http://localhost:3000
25
- ```
26
- There you will see a list of pre-made demos showing each feature of Typed.js in action.
27
-
28
- **Comb through these demos carefully and insure all features are working as expected with your additions**
29
-
30
- ## Pull Request Etiquette
31
-
32
- If this is purely a README update, you can skip everything below.
33
-
34
- You need to include a demo of your changes (new features, a bug fix, etc) in a fork of this JSFiddle: https://jsfiddle.net/mattboldt/1xs3LLmL/
35
-
36
- To include your branch's version of Typed.js, simply add this JavaScript url as a dependency in JSFiddle, and remove the default:
37
-
38
- ```
39
- https://rawgit.com/<YOUR GITHUB USERNAME>/typed.js/<YOUR BRANCH NAME>/lib/typed.min.js
40
- ```
41
-
42
- Include a link to the fiddle in the details of your pull request.
43
-
44
- Thank you, and happy typing!
@@ -1,27 +0,0 @@
1
- <!--
2
- IMPORTANT: If applicable, please use the following format to create a new issue.
3
- If your issue is not created using the format below, it will be closed.
4
- -->
5
-
6
- ### Description
7
-
8
- [Description of the issue]
9
-
10
- ### Demo
11
- [If possible, include a demo of your issue in a fork of this JSFiddle: https://jsfiddle.net/mattboldt/1xs3LLmL/]
12
-
13
- ### Steps to Reproduce
14
-
15
- 1. [First Step]
16
- 2. [Second Step]
17
- 3. [and so on...]
18
-
19
- **Expected behavior:** [What you expect to happen]
20
-
21
- **Actual behavior:** [What actually happens]
22
-
23
- **Reproduces how often:** [What percentage of the time does it reproduce?]
24
-
25
- ### Additional Information
26
-
27
- Any additional information, configuration or data that might be necessary to reproduce the issue.
@@ -1,38 +0,0 @@
1
- ### Requirements
2
-
3
- <!--
4
- Filling out this template is required.
5
- -->
6
-
7
- - [ ] Have you viewed your changes locally on the demos page, located on https://github.com/mattboldt/typed.js/blob/master/index.html?
8
-
9
- - [ ] If necessary, have you added a new demo to the index.html list of demos? If it's an improvement or small addition, have you added it to an existing demo on the demos page?
10
-
11
- - [ ] If applicable, have you created a fork of the following JSFiddle with your branch's code and your new feature showcased?
12
-
13
- <!--
14
-
15
- To include your branch's version of Typed.js, simply add this JavaScript url as a dependency in JSFiddle, and remove the default:
16
-
17
- https://jsfiddle.net/mattboldt/1xs3LLmL/
18
-
19
- ```
20
- https://rawgit.com/<YOUR GITHUB USERNAME>/typed.js/<YOUR BRANCH NAME>/lib/typed.min.js
21
- ```
22
- -->
23
-
24
- ### Description of the Change
25
-
26
- <!--
27
-
28
- We must be able to understand the design of your change from this description. If we can't get a good idea of what the code will be doing from the description here, the pull request may be closed at the maintainers' discretion.
29
-
30
- -->
31
-
32
- ### Benefits
33
-
34
- <!-- What benefits will be realized by the code change? -->
35
-
36
- ### Issues
37
-
38
- <!-- Enter any applicable Issues here -->
package/.prettierrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- singleQuote: true,
3
- arrowParens: "always"
4
- }
package/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: node_js
2
- notifications:
3
- email:
4
- on_success: never
5
- on_failure: never
6
- node_js:
7
- - '6'
8
- addons:
9
- sauce_connect: true
10
- env:
11
- global:
12
- before_install:
13
- - yarn install
14
- before_script:
15
- - yarn global add gulp
16
- - gulp
@@ -1,14 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible Node.js debug attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "Launch Program",
11
- "program": "${file}"
12
- }
13
- ]
14
- }