Skip to content

Commit

Permalink
Fix type declaration and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
mattboldt committed Mar 26, 2023
1 parent 3d2dd9c commit 82b42ff
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 149 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Typed.js is a library that types. Enter in any string, and watch it type at the
### CDN

```html
<script src="https://unpkg.com/typed.js@2.0.132/dist/typed.umd.js"></script>
<script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script>
```

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

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

<!-- Setup and start animation! -->
<script>
Expand Down
2 changes: 1 addition & 1 deletion dist/typed.module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/typed.module.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ <h4 id="yarn">Yarn</h4>
<pre><code><code class="source-code prettyprint">yarn add typed.js</code>
</code></pre>
<h4 id="cdn">CDN</h4>
<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>
<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>
</code></pre>
<h4 id="setup">Setup</h4>
<p>This is really all you need to get going.</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.json

Large diffs are not rendered by default.

126 changes: 124 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,129 @@
* @param {object} options options object
* @returns {object} a new Typed object
*/
export default class Typed {
constructor(elementId: any, options: any);

declare module 'typed.js' {
export interface TypedOptions {
/**
* strings to be typed
*/
strings?: string[];
/**
* ID or instance of HTML element of element containing string children
*/
stringsElement?: string | Element;
/**
* type speed in milliseconds
*/
typeSpeed?: number;
/**
* time before typing starts in milliseconds
*/
startDelay?: number;
/**
* backspacing speed in milliseconds
*/
backSpeed?: number;
/**
* only backspace what doesn't match the previous string
*/
smartBackspace?: boolean;
/**
* shuffle the strings
*/
shuffle?: boolean;
/**
* time before backspacing in milliseconds
*/
backDelay?: number;
/**
* Fade out instead of backspace
*/
fadeOut?: boolean;
/**
* css class for fade animation
*/
fadeOutClass?: string;
/**
* Fade out delay in milliseconds
*/
fadeOutDelay?: number;
/**
* loop strings
*/
loop?: boolean;
/**
* amount of loops
*/
loopCount?: number;
/**
* show cursor
*/
showCursor?: boolean;
/**
* character for cursor
*/
cursorChar?: string;
/**
* insert CSS for cursor and fadeOut into HTML
*/
autoInsertCss?: boolean;
/**
* attribute for typing Ex: input placeholder, value, or just HTML text
*/
attr?: string;
/**
* bind to focus and blur if el is text input
*/
bindInputFocusEvents?: boolean;
/**
* 'html' or 'null' for plaintext
*/
contentType?: string;
/**
* All typing is complete
*/
onComplete?(self: Typed): void;
/**
* Before each string is typed
*/
preStringTyped?(arrayPos: number, self: Typed): void;
/**
* After each string is typed
*/
onStringTyped?(arrayPos: number, self: Typed): void;
/**
* During looping, after last string is typed
*/
onLastStringBackspaced?(self: Typed): void;
/**
* Typing has been stopped
*/
onTypingPaused?(arrayPos: number, self: Typed): void;
/**
* Typing has been started after being stopped
*/
onTypingResumed?(arrayPos: number, self: Typed): void;
/**
* After reset
*/
onReset?(self: Typed): void;
/**
* After stop
*/
onStop?(arrayPos: number, self: Typed): void;
/**
* After start
*/
onStart?(arrayPos: number, self: Typed): void;
/**
* After destroy
*/
onDestroy?(self: Typed): void;
}

export default class Typed {
constructor(elementId: any, options: TypedOptions);
/**
* Toggle start() and stop() of the Typed instance
* @public
Expand Down Expand Up @@ -128,4 +249,5 @@ export default class Typed {
* @private
*/
private insertCursor;
}
}
13 changes: 7 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ <h1 class="title">Typed.js</h1>
<h2 id="basic">Basic Demo</h2>
<div class="type-wrap">
<div id="typed-strings">
<span>Typed.js^10 is a <strong>JavaScript</strong> library.</span>
<p>It <em>types</em> out sentences.</p>
<p>`And` `then` `deletes` `them`.</p>
<p>Try it out!</p>
<span>Typed.js^500 is a <strong>JavaScript</strong> library.</span>
<span>It <em>types</em> out sentences.</span>
<span>`And` `then` `deletes` `them`.</span>
<span>Try it out!</span>
</div>
<span id="typed" style="white-space: pre"></span>
<span id="typed" style="white-space: pre">some text</span>
</div>
<button class="toggle">Toggle</button>
<button class="start">Start</button>
Expand Down Expand Up @@ -181,7 +181,8 @@ <h2 id="bulk">Bulk Typing</h2>
})();
</script>

<script src="https://unpkg.com/typed.js@2.0.132/dist/typed.umd.js"></script>
<!-- <script src="https://unpkg.com/typed.js@2.0.14/dist/typed.umd.js"></script> -->
<script src="dist/typed.umd.js"></script>
<script src="assets/demos.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typed.js",
"version": "2.0.132",
"version": "2.0.14",
"homepage": "https://github.com/mattboldt/typed.js",
"repository": "https://github.com/mattboldt/typed.js",
"license": "MIT",
Expand Down
131 changes: 0 additions & 131 deletions typed.d.ts

This file was deleted.

0 comments on commit 82b42ff

Please sign in to comment.