typed.js 2.0.12 → 2.0.132

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 +31 -21
  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 +131 -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,131 @@
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
+ export default class Typed {
8
+ constructor(elementId: any, options: any);
9
+ /**
10
+ * Toggle start() and stop() of the Typed instance
11
+ * @public
12
+ */
13
+ public toggle(): void;
14
+ /**
15
+ * Stop typing / backspacing and enable cursor blinking
16
+ * @public
17
+ */
18
+ public stop(): void;
19
+ /**
20
+ * Start typing / backspacing after being stopped
21
+ * @public
22
+ */
23
+ public start(): void;
24
+ /**
25
+ * Destroy this instance of Typed
26
+ * @public
27
+ */
28
+ public destroy(): void;
29
+ /**
30
+ * Reset Typed and optionally restarts
31
+ * @param {boolean} restart
32
+ * @public
33
+ */
34
+ public reset(restart?: boolean): void;
35
+ cursor: HTMLSpanElement;
36
+ strPos: number;
37
+ arrayPos: number;
38
+ curLoop: number;
39
+ /**
40
+ * Begins the typing animation
41
+ * @private
42
+ */
43
+ private begin;
44
+ typingComplete: boolean;
45
+ timeout: any;
46
+ /**
47
+ * Called for each character typed
48
+ * @param {string} curString the current string in the strings array
49
+ * @param {number} curStrPos the current position in the curString
50
+ * @private
51
+ */
52
+ private typewrite;
53
+ temporaryPause: boolean;
54
+ /**
55
+ * Continue to the next string & begin typing
56
+ * @param {string} curString the current string in the strings array
57
+ * @param {number} curStrPos the current position in the curString
58
+ * @private
59
+ */
60
+ private keepTyping;
61
+ /**
62
+ * We're done typing the current string
63
+ * @param {string} curString the current string in the strings array
64
+ * @param {number} curStrPos the current position in the curString
65
+ * @private
66
+ */
67
+ private doneTyping;
68
+ /**
69
+ * Backspaces 1 character at a time
70
+ * @param {string} curString the current string in the strings array
71
+ * @param {number} curStrPos the current position in the curString
72
+ * @private
73
+ */
74
+ private backspace;
75
+ stopNum: number;
76
+ /**
77
+ * Full animation is complete
78
+ * @private
79
+ */
80
+ private complete;
81
+ /**
82
+ * Has the typing been stopped
83
+ * @param {string} curString the current string in the strings array
84
+ * @param {number} curStrPos the current position in the curString
85
+ * @param {boolean} isTyping
86
+ * @private
87
+ */
88
+ private setPauseStatus;
89
+ /**
90
+ * Toggle the blinking cursor
91
+ * @param {boolean} isBlinking
92
+ * @private
93
+ */
94
+ private toggleBlinking;
95
+ cursorBlinking: any;
96
+ /**
97
+ * Speed in MS to type
98
+ * @param {number} speed
99
+ * @private
100
+ */
101
+ private humanizer;
102
+ /**
103
+ * Shuffle the sequence of the strings array
104
+ * @private
105
+ */
106
+ private shuffleStringsIfNeeded;
107
+ sequence: any;
108
+ /**
109
+ * Adds a CSS class to fade out current string
110
+ * @private
111
+ */
112
+ private initFadeOut;
113
+ /**
114
+ * Replaces current text in the HTML element
115
+ * depending on element type
116
+ * @param {string} str
117
+ * @private
118
+ */
119
+ private replaceText;
120
+ /**
121
+ * If using input elements, bind focus in order to
122
+ * start and stop the animation
123
+ * @private
124
+ */
125
+ private bindFocusEvents;
126
+ /**
127
+ * On init, insert the cursor element
128
+ * @private
129
+ */
130
+ private insertCursor;
131
+ }
package/package.json CHANGED
@@ -1,41 +1,34 @@
1
1
  {
2
2
  "name": "typed.js",
3
- "version": "2.0.12",
3
+ "version": "2.0.132",
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
- }
@@ -1,11 +0,0 @@
1
- {
2
- "eslint.enable": true,
3
- "eslint.options": { "configFile": "./.eslintrc.yml" },
4
- "search.exclude": {
5
- "**/.git": true,
6
- "**/node_modules": true,
7
- "**/bower_components": true,
8
- "**/tmp": true,
9
- "**/lib": true
10
- }
11
- }
@@ -1,46 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- ## Our Standards
8
-
9
- Examples of behavior that contributes to creating a positive environment include:
10
-
11
- * Using welcoming and inclusive language
12
- * Being respectful of differing viewpoints and experiences
13
- * Gracefully accepting constructive criticism
14
- * Focusing on what is best for the community
15
- * Showing empathy towards other community members
16
-
17
- Examples of unacceptable behavior by participants include:
18
-
19
- * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
- * Trolling, insulting/derogatory comments, and personal or political attacks
21
- * Public or private harassment
22
- * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
- * Other conduct which could reasonably be considered inappropriate in a professional setting
24
-
25
- ## Our Responsibilities
26
-
27
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
-
29
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
-
31
- ## Scope
32
-
33
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
-
35
- ## Enforcement
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at me@mattboldt.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
-
39
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
-
41
- ## Attribution
42
-
43
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
-
45
- [homepage]: http://contributor-covenant.org
46
- [version]: http://contributor-covenant.org/version/1/4/
package/app.js DELETED
@@ -1,12 +0,0 @@
1
- const express = require('express')
2
- const app = express()
3
-
4
- app.get('/', (req, res) => {
5
- res.sendFile(`${__dirname}/index.html`)
6
- })
7
-
8
- app.listen(3000, () => {
9
- console.log('Example app listening on port 3000!')
10
- })
11
-
12
- app.use(express.static(`${__dirname}/`))