Skip to content

Commit 82b42ff

Browse files
committed
Fix type declaration and bump version
1 parent 3d2dd9c commit 82b42ff

10 files changed

+141
-149
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Typed.js is a library that types. Enter in any string, and watch it type at the
1616
### CDN
1717

1818
```html
19-
<script src="https://unpkg.com/typed.js@2.0.132/dist/typed.umd.js"></script>
19+
<script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script>
2020
```
2121

2222
For use directly in the browser via `<script>` tag:
@@ -26,7 +26,7 @@ For use directly in the browser via `<script>` tag:
2626
<span id="element"></span>
2727

2828
<!-- Load library from the CDN -->
29-
<script src="https://unpkg.com/typed.js@2.0.132/dist/typed.umd.js"></script>
29+
<script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script>
3030

3131
<!-- Setup and start animation! -->
3232
<script>

dist/typed.module.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/typed.module.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ <h4 id="yarn">Yarn</h4>
170170
<pre><code><code class="source-code prettyprint">yarn add typed.js</code>
171171
</code></pre>
172172
<h4 id="cdn">CDN</h4>
173-
<pre><code class="lang-html"><code class="source-code prettyprint">&lt;script src=&quot;https://cdn.jsdelivr.net/npm/typed.js@2.0.132&quot;&gt;&lt;/script&gt;</code>
173+
<pre><code class="lang-html"><code class="source-code prettyprint">&lt;script src=&quot;https://cdn.jsdelivr.net/npm/typed.js@2.0.14&quot;&gt;&lt;/script&gt;</code>
174174
</code></pre>
175175
<h4 id="setup">Setup</h4>
176176
<p>This is really all you need to get going.</p>

docs/index.json

+2-2
Large diffs are not rendered by default.

index.d.ts

+124-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,129 @@
44
* @param {object} options options object
55
* @returns {object} a new Typed object
66
*/
7-
export default class Typed {
8-
constructor(elementId: any, options: any);
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);
9130
/**
10131
* Toggle start() and stop() of the Typed instance
11132
* @public
@@ -128,4 +249,5 @@ export default class Typed {
128249
* @private
129250
*/
130251
private insertCursor;
252+
}
131253
}

index.html

+7-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ <h1 class="title">Typed.js</h1>
2626
<h2 id="basic">Basic Demo</h2>
2727
<div class="type-wrap">
2828
<div id="typed-strings">
29-
<span>Typed.js^10 is a <strong>JavaScript</strong> library.</span>
30-
<p>It <em>types</em> out sentences.</p>
31-
<p>`And` `then` `deletes` `them`.</p>
32-
<p>Try it out!</p>
29+
<span>Typed.js^500 is a <strong>JavaScript</strong> library.</span>
30+
<span>It <em>types</em> out sentences.</span>
31+
<span>`And` `then` `deletes` `them`.</span>
32+
<span>Try it out!</span>
3333
</div>
34-
<span id="typed" style="white-space: pre"></span>
34+
<span id="typed" style="white-space: pre">some text</span>
3535
</div>
3636
<button class="toggle">Toggle</button>
3737
<button class="start">Start</button>
@@ -181,7 +181,8 @@ <h2 id="bulk">Bulk Typing</h2>
181181
})();
182182
</script>
183183

184-
<script src="https://unpkg.com/typed.js@2.0.132/dist/typed.umd.js"></script>
184+
<!-- <script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script> -->
185+
<script src="dist/typed.umd.js"></script>
185186
<script src="assets/demos.js"></script>
186187
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
187188
<script>

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typed.js",
3-
"version": "2.0.132",
3+
"version": "2.0.14",
44
"homepage": "https://github.com/mattboldt/typed.js",
55
"repository": "https://github.com/mattboldt/typed.js",
66
"license": "MIT",

typed.d.ts

-131
This file was deleted.

0 commit comments

Comments
 (0)