update embedding docs

master
Vladimir Mandic 2021-03-15 12:14:24 -04:00
parent 97d0de349c
commit 4f67b66626
37 changed files with 4037 additions and 18 deletions

@ -6,7 +6,8 @@ Demos are included in `/demo`:
## Browser
- `index.html`: Full demo using Browser with ESM module, includes selectable backends and webworkers
- `index.html`: Full demo using Browser with ESM module,
includes selectable backends and WebWorkers
*You can run browser demo either live from git pages, by serving demo folder from your web server or use
included micro http2 server with source file monitoring and dynamic rebuild*
@ -44,6 +45,21 @@ all configurable in `browse.js:ui` configuration object and in the UI itself:
<br><hr><br>
### Face Recognition Demo
To see a demo of all all face embedding features,
see `demo/embedding.html` which uses `demo/embedding.js` as JavaSript module
It highlights functionality such as:
- Loading images
- Extracting faces from images
- Calculating face embedding descriptors
- Finding face simmilarity and sorting them by simmilarity
- Finding best face match based on a known list of faces and printing matches
<br><hr><br>
## NodeJS
- `node.js`: Demo using NodeJS with CommonJS module
@ -118,14 +134,3 @@ node demo/node.js
2021-03-06 10:28:54 DATA: Gesture: [ { body: 0, gesture: 'leaning right' }, [length]: 1 ]
10:28:54.968 Human: Warmup full 621 ms
```
<br><hr><br>
## Face Recognition Demo
`Human` contains an additional browser-based demo that enumerates number of images,
extracts all faces from them, processed them and then allows
for a selection of any face which sorts faces by simmilarity
Demo is available in `demo/embedding.html` which uses `demo/embedding.js` as JavaSript module
And can be hosted independently or accessed using built-in dev server

@ -2,6 +2,19 @@
<br>
## Demo
To see a demo of all all face embedding features, see `/demo/embedding.js`
It highlights functionality such as:
- Loading images
- Extracting faces from images
- Calculating face embedding descriptors
- Finding face simmilarity and sorting them by simmilarity
- Finding best face match based on a known list of faces and printing matches
<br>
## Usage
To use face simmilaity compare feature, you must first enable `face.embedding` module
@ -55,12 +68,16 @@ of a face image that can be further visualized with
<br>
## Embedding Vectors
## Face Descriptor
Embedding vectors are calulated feature vector values uniquely identifying a given face and presented as array of 256 float values
Face descriptor or embedding vectors are calulated feature vector values uniquely identifying a given face and presented as array of 128 float values
They can be stored as normal arrays and reused as needed
<br>
## Face Simmilarity
Simmilarity function is based on general *Minkowski distance* between all points in vector
*[Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) is a nth root of sum of nth powers of distances between each point (each value in 192-member array)*
@ -80,7 +97,46 @@ How simmilarity is calculated:
const distance = ((firstEmbedding.map((val, i) => (val - secondEmbedding[i])).reduce((dist, diff) => dist + (diff ** order), 0) ** (1 / order)));
```
*Once embedding values are calculated and stored, if you want to use stored embedding values without requiring `Human` library you can use above formula to calculate simmilarity on the fly.*
*Once embedding values are calculated and stored, if you want to use stored embedding values without requiring `Human` library you can use above formula to calculate simmilarity on the fly*
<br>
## Face Recognition
Once you run face embedding analysis, you can store results in an annotated form
to be used at the later time to find the best match for any given face
Format of annotated database is:
```js
const db = [
{ name: 'person a', source: 'optional-tag', embedding: [...]}
{ name: 'person b', source: 'optional-tag', embedding: [...]}
...
]
```
where embedding is a result received in `face.embedding` after running detection
Note that you can have multiple entries for the same person and best match will be used
To find the best match, simply use function while providing embedding descriptor to compare and pre-prepared database
Last parameter is optional and notes a minimal threshold for a match
```js
const best = human.match(current.embedding, db, 0)
// return is object: { name: 'person a', simmilarity '0.99', source 'some-image-file' }
```
Database can be further stored in a JS or JSON file and retrieved when needed to have
a permanent database of faces that can be expanded over time to cover any number of known faces
For example, see `/demo/embedding.js`:
```js
// download db with known faces
let res = await fetch('/demo/faces.json');
db = (res && res.ok) ? await res.json() : [];
```
<br>

@ -22,7 +22,7 @@ JavaScript module using TensorFlow/JS Machine Learning library
- [**Code Repository**](https://github.com/vladmandic/human)
- [**NPM Package**](https://www.npmjs.com/package/@vladmandic/human)
- [**Issues Tracker**](https://github.com/vladmandic/human/issues)
- [**API Specification**](https://vladmandic.github.io/human/typedoc/classes/human.html)
- [**API Specification**](https://vladmandic.github.io/human/typedoc/index.html)
- [**Change Log**](https://github.com/vladmandic/human/blob/main/CHANGELOG.md)
<br>
@ -35,7 +35,7 @@ JavaScript module using TensorFlow/JS Machine Learning library
- [**Usage & Functions**](https://github.com/vladmandic/human/wiki/Usage)
- [**Configuration Details**](https://github.com/vladmandic/human/wiki/Configuration)
- [**Output Details**](https://github.com/vladmandic/human/wiki/Outputs)
- [**Face Embedding and Recognition**](https://github.com/vladmandic/human/wiki/Embedding)
- [**Face Recognition & Face Embedding**](https://github.com/vladmandic/human/wiki/Embedding)
- [**Gesture Recognition**](https://github.com/vladmandic/human/wiki/Gesture)
<br>

@ -41,11 +41,28 @@ Additionally, `Human` library exposes several objects and methods:
// vectors for source and target must be previously detected using
// face.embedding module
human.enhance(face) // returns enhanced tensor of a previously detected face that can be used for visualizations
```
Additional functions used for face recognition:
For details, see [embedding documentation](https://github.com/vladmandic/human/wiki/Embedding)
```js
human.simmilarity(embedding1, embedding2) // runs simmilarity calculation between two provided embedding vectors
// vectors for source and target must be previously detected using
// face.embedding module
human.match(embedding, db, threshold) // finds best match for current face in a provided list of faces
human.enhance(face) // returns enhanced tensor of a previously detected face that can be used for visualizations
```
Internal list of modules and objects used by current instance of `Human`:
```js
human.models // dynamically maintained list of object of any loaded models
human.classes // dynamically maintained list of classes that perform detection on each model
```
Plus additional helper functions inside `human.draw`:
Additional helper functions inside `human.draw`:
```js
human.draw.canvas(inCanvas, outCanvas) // simply copies one canvas to another,

BIN
theme/assets/icons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
theme/assets/icons@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

2494
theme/assets/typedoc.css Normal file

File diff suppressed because it is too large Load Diff

248
theme/assets/typedoc.js Normal file

File diff suppressed because one or more lines are too long

BIN
theme/assets/widgets.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

BIN
theme/assets/widgets@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

49
theme/layouts/default.hbs Normal file

@ -0,0 +1,49 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{#ifCond model.name '==' project.name}}{{project.name}}{{else}}{{model.name}} | {{project.name}}{{/ifCond}}</title>
<meta name="description" content="Documentation for {{project.name}}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{relativeURL "assets/typedoc.css"}}">
</head>
<body>
{{> header}}
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
{{{contents}}}
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
{{#each navigation.children}}
{{> navigation}}
{{/each}}
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
{{#each toc.children}}
{{> toc.root}}
{{/each}}
</ul>
</nav>
</div>
</div>
</div>
{{> footer}}
<div class="overlay"></div>
<script src="{{relativeURL "assets/typedoc.js"}}"></script>
{{> analytics}}
</body>
</html>

@ -0,0 +1,11 @@
{{#if settings.gaID}}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{settings.gaID}}', '{{settings.gaSite}}');
ga('send', 'pageview');
</script>
{{/if}}

@ -0,0 +1,16 @@
{{#if parent}}
{{#with parent}}{{> breadcrumb}}{{/with}}
<li>
{{#if url}}
<a href="{{relativeURL url}}">{{name}}</a>
{{else}}
<span>{{name}}</span>
{{/if}}
</li>
{{else}}
{{#if url}}
<li>
<a href="{{relativeURL url}}">{{ name }}</a>
</li>
{{/if}}
{{/if}}

@ -0,0 +1,22 @@
{{#with comment}}
{{#if hasVisibleComponent}}
<div class="tsd-comment tsd-typography">
{{#if shortText}}
<div class="lead">
{{#markdown}}{{{shortText}}}{{/markdown}}
</div>
{{/if}}
{{#if text}}
{{#markdown}}{{{text}}}{{/markdown}}
{{/if}}
{{#if tags}}
<dl class="tsd-comment-tags">
{{#each tags}}
<dt>{{tagName}}</dt>
<dd>{{#markdown}}{{{text}}}{{/markdown}}</dd>
{{/each}}
</dl>
{{/if}}
</div>
{{/if}}
{{/with}}

21
theme/partials/footer.hbs Normal file

@ -0,0 +1,21 @@
<footer{{#unless settings.hideGenerator}} class="with-border-bottom"{{/unless}}>
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
{{#each legend}}
<ul class="tsd-legend">
{{#each .}}
<li class="{{#compact}}{{#each classes}} {{.}}{{/each}}{{/compact}}"><span class="tsd-kind-icon">{{name}}</span></li>
{{/each}}
</ul>
{{/each}}
</div>
</div>
</footer>
{{#unless settings.hideGenerator}}
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
{{/unless}}

70
theme/partials/header.hbs Normal file

@ -0,0 +1,70 @@
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="{{relativeURL "assets/js/search.json"}}" data-base="{{relativeURL "./"}}">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="{{relativeURL "index.html"}}" class="title">{{project.name}}</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
{{#unless settings.excludeExternals}}
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
{{/unless}}
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
{{#if model.parent}} {{! Don't show breadcrumbs on main project page, it is the root page. !}}
<ul class="tsd-breadcrumb">
{{#with model}}{{> breadcrumb}}{{/with}}
</ul>
{{/if}}
<h1>{{#compact}}
{{#ifCond model.kindString "!==" "Project" }}
{{model.kindString}}&nbsp;
{{/ifCond}}
{{model.name}}
{{#if model.typeParameters}}
&lt;
{{#each model.typeParameters}}
{{#if @index}},&nbsp;{{/if}}
{{name}}
{{/each}}
&gt;
{{/if}}
{{/compact}}</h1>
</div>
</div>
</header>

@ -0,0 +1,17 @@
<ul class="tsd-hierarchy">
{{#each types}}
<li>
{{#if ../isTarget}}
<span class="target">{{this}}</span>
{{else}}
{{#compact}}{{> type}}{{/compact}}
{{/if}}
{{#if @last}}
{{#with ../next}}
{{> hierarchy}}
{{/with}}
{{/if}}
</li>
{{/each}}
</ul>

50
theme/partials/index.hbs Normal file

@ -0,0 +1,50 @@
{{#if categories}}
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
{{#each categories}}
<section class="tsd-index-section">
<h3>{{title}}</h3>
<ul class="tsd-index-list">
{{#each children}}
<li class="{{cssClasses}}"><a href="{{relativeURL url}}" class="tsd-kind-icon">{{#if name}}{{{wbr name}}}{{else}}<em>{{{wbr kindString}}}</em>{{/if}}</a></li>
{{/each}}
</ul>
</section>
{{/each}}
</div>
</section>
</section>
{{else}}
{{#if groups}}
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
{{#each groups}}
<section class="tsd-index-section {{cssClasses}}">
{{#if categories}}
{{#each categories}}
<h3>{{#if title}}{{title}} {{/if}}{{../title}}</h3>
<ul class="tsd-index-list">
{{#each children}}
<li class="{{cssClasses}}"><a href="{{relativeURL url}}" class="tsd-kind-icon">{{#if name}}{{{wbr name}}}{{else}}<em>{{{wbr kindString}}}</em>{{/if}}</a></li>
{{/each}}
</ul>
{{/each}}
{{else}}
<h3>{{title}}</h3>
<ul class="tsd-index-list">
{{#each children}}
<li class="{{cssClasses}}"><a href="{{relativeURL url}}" class="tsd-kind-icon">{{#if name}}{{{wbr name}}}{{else}}<em>{{{wbr kindString}}}</em>{{/if}}</a></li>
{{/each}}
</ul>
{{/if}}
</section>
{{/each}}
</div>
</section>
</section>
{{/if}}
{{/if}}

@ -0,0 +1,36 @@
<div class="tsd-signature tsd-kind-icon">{{#compact}}
{{{wbr name}}}
{{#if typeParameters}}
&lt;
{{#each typeParameters}}
{{#if @index}},&nbsp;{{/if}}
{{name}}
{{/each}}
&gt;
{{/if}}
<span class="tsd-signature-symbol">{{#if isOptional}}?{{/if}}:</span>&nbsp;{{#with type}}{{>type}}{{/with}}
{{#if defaultValue}}
<span class="tsd-signature-symbol">
&nbsp;=&nbsp;
{{defaultValue}}
</span>
{{/if}}
{{/compact}}</div>
{{> member.sources}}
{{> comment}}
{{#if typeParameters}}
<h4 class="tsd-type-parameters-title">Type parameters</h4>
{{> typeParameters}}
{{/if}}
{{#if type.declaration}}
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
{{#with type.declaration}}
{{> parameter}}
{{/with}}
</div>
{{/if}}

@ -0,0 +1,37 @@
<ul class="tsd-signatures {{cssClasses}}">
{{#if getSignature}}
{{#with getSignature}}
<li class="tsd-signature tsd-kind-icon">{{#compact}}
<span class="tsd-signature-symbol">get</span>&nbsp;
{{../name}}
{{> member.signature.title hideName=true }}
{{/compact}}</li>
{{/with}}
{{/if}}
{{#if setSignature}}
{{#with setSignature}}
<li class="tsd-signature tsd-kind-icon">{{#compact}}
<span class="tsd-signature-symbol">set</span>&nbsp;
{{../name}}
{{> member.signature.title hideName=true }}
{{/compact}}</li>
{{/with}}
{{/if}}
</ul>
<ul class="tsd-descriptions">
{{#if getSignature}}
{{#with getSignature}}
<li class="tsd-description">
{{> member.signature.body }}
</li>
{{/with}}
{{/if}}
{{#if setSignature}}
{{#with setSignature}}
<li class="tsd-description">
{{> member.signature.body }}
</li>
{{/with}}
{{/if}}
</ul>

24
theme/partials/member.hbs Normal file

@ -0,0 +1,24 @@
<section class="tsd-panel tsd-member {{cssClasses}}">
<a name="{{anchor}}" class="tsd-anchor"></a>
{{#if name}}
<h3>{{#each flags}}<span class="tsd-flag ts-flag{{this}}">{{this}}</span> {{/each}}{{{wbr name}}}</h3>
{{/if}}
{{#if signatures}}
{{> member.signatures}}
{{else}}{{#if hasGetterOrSetter}}
{{> member.getterSetter}}
{{else}}{{#if isReference}}
{{> member.reference}}
{{else}}
{{> member.declaration}}
{{/if}}{{/if}}{{/if}}
{{#each groups}}
{{#each children}}
{{#unless hasOwnDocument}}
{{> member}}
{{/unless}}
{{/each}}
{{/each}}
</section>

@ -0,0 +1,11 @@
{{#with tryGetTargetReflectionDeep}}
{{#ifCond ../name '===' name}}
Re-exports <a href="{{relativeURL url}}">{{name}}</a>
{{else if flags.isExported}}
Renames and re-exports <a href="{{relativeURL url}}">{{name}}</a>
{{else}}
Renames and exports <a href="{{relativeURL url}}">{{name}}</a>
{{/ifCond}}
{{else}}
Re-exports {{name}}
{{/with}}

@ -0,0 +1,56 @@
{{#unless hideSources}}
{{> member.sources}}
{{/unless}}
{{> comment}}
{{#if typeParameters}}
<h4 class="tsd-type-parameters-title">Type parameters</h4>
{{> typeParameters}}
{{/if}}
{{#if parameters}}
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
{{#each parameters}}
<li>
<h5>{{#compact}}
{{#each flags}}
<span class="tsd-flag ts-flag{{this}}">{{this}}</span>&nbsp;
{{/each}}
{{#if flags.isRest}}<span class="tsd-signature-symbol">...</span>{{/if}}
{{name}}:&nbsp;
{{#with type}}{{>type}}{{/with}}
{{#if defaultValue}}
<span class="tsd-signature-symbol">
&nbsp;=&nbsp;
{{defaultValue}}
</span>
{{/if}}
{{/compact}}</h5>
{{> comment}}
{{#if type.declaration}}
{{#with type.declaration}}
{{> parameter}}
{{/with}}
{{/if}}
</li>
{{/each}}
</ul>
{{/if}}
{{#if type}}
<h4 class="tsd-returns-title">Returns {{#compact}}{{#with type}}{{>type}}{{/with}}{{/compact}}</h4>
{{#if comment.returns}}
{{#markdown}}{{{comment.returns}}}{{/markdown}}
{{/if}}
{{#if type.declaration}}
{{#with type.declaration}}
{{> parameter}}
{{/with}}
{{/if}}
{{/if}}

@ -0,0 +1,41 @@
{{#unless hideName}}
{{{wbr name}}}
{{else}} {{! This ugliness goes away when we stop naming constructor signatures "new X"}}
{{#ifCond kindString "===" "Constructor signature"}}
{{#if flags.isAbstract}}
<span class="tsd-signature-symbol">abstract </span>
{{/if}}
<span class="tsd-signature-symbol">new </span>
{{/ifCond}}
{{/unless}}
{{#if typeParameters}}
&lt;
{{#each typeParameters}}
{{#if @index}},&nbsp;{{/if}}
{{name}}
{{/each}}
&gt;
{{/if}}
<span class="tsd-signature-symbol">(</span>
{{#each parameters}}
{{#if @index}},&nbsp;{{/if}}
{{#if flags.isRest}}<span class="tsd-signature-symbol">...</span>{{/if}}
{{name}}
<span class="tsd-signature-symbol">
{{#if flags.isOptional}}?{{/if}}
{{#if defaultValue}}?{{/if}}
:&nbsp;
</span>
{{#with type}}{{>type}}{{/with}}
{{/each}}
<span class="tsd-signature-symbol">)</span>
{{#if type}}
{{#if arrowStyle}}
<span class="tsd-signature-symbol"> =&gt; </span>
{{else}}
<span class="tsd-signature-symbol">: </span>
{{/if}}
{{#with type}}
{{>type}}
{{/with}}
{{/if}}

@ -0,0 +1,13 @@
<ul class="tsd-signatures {{cssClasses}}">
{{#each signatures}}
<li class="tsd-signature tsd-kind-icon">{{#compact}}{{> member.signature.title }}{{/compact}}</li>
{{/each}}
</ul>
<ul class="tsd-descriptions">
{{#each signatures}}
<li class="tsd-description">
{{> member.signature.body }}
</li>
{{/each}}
</ul>

@ -0,0 +1,22 @@
<aside class="tsd-sources">
{{#if implementationOf}}
<p>Implementation of {{#with implementationOf}}{{> typeAndParent}}{{/with}}</p>
{{/if}}
{{#if inheritedFrom}}
<p>Inherited from {{#with inheritedFrom}}{{> typeAndParent}}{{/with}}</p>
{{/if}}
{{#if overwrites}}
<p>Overrides {{#with overwrites}}{{> typeAndParent}}{{/with}}</p>
{{/if}}
{{#if sources}}
<ul>
{{#each sources}}
{{#if url}}
<li>Defined in <a href="{{url}}">{{fileName}}:{{line}}</a></li>
{{else}}
<li>Defined in {{fileName}}:{{line}}</li>
{{/if}}
{{/each}}
</ul>
{{/if}}
</aside>

@ -0,0 +1,21 @@
{{#if categories}}
{{#each categories}}
<section class="tsd-panel-group tsd-member-group {{cssClasses}}">
<h2>{{#if title}}{{title}} {{/if}}{{../title}}</h2>
{{#each children}}
{{#unless hasOwnDocument}}
{{> member}}
{{/unless}}
{{/each}}
</section>
{{/each}}
{{else}}
<section class="tsd-panel-group tsd-member-group {{cssClasses}}">
<h2>{{title}}</h2>
{{#each children}}
{{#unless hasOwnDocument}}
{{> member}}
{{/unless}}
{{/each}}
</section>
{{/if}}

@ -0,0 +1,20 @@
{{#if categories}}
{{#each categories}}
{{#unless allChildrenHaveOwnDocument}}
<section class="tsd-panel-group tsd-member-group {{cssClasses}}">
<h2>{{title}}</h2>
{{#each children}}
{{#unless hasOwnDocument}}
{{> member}}
{{/unless}}
{{/each}}
</section>
{{/unless}}
{{/each}}
{{else}}
{{#each groups}}
{{#unless allChildrenHaveOwnDocument}}
{{> members.group}}
{{/unless}}
{{/each}}
{{/if}}

@ -0,0 +1,26 @@
{{#if isVisible}}
{{#if isLabel}}
<li class="label {{cssClasses}}">
<span>{{{wbr title}}}</span>
</li>
{{else}}
{{#if isGlobals}}
<li class="globals {{#if isInPath}}current{{/if}} {{cssClasses}}">
<a href="{{relativeURL url}}"><em>{{{wbr title}}}</em></a>
</li>
{{else}}
<li class="{{#if isInPath}}current{{/if}} {{cssClasses}}">
<a href="{{relativeURL url}}">{{{wbr title}}}</a>
{{#if isInPath}}
{{#if children}}
<ul>
{{#each children}}
{{> navigation}}
{{/each}}
</ul>
{{/if}}
{{/if}}
</li>
{{/if}}
{{/if}}
{{/if}}

@ -0,0 +1,132 @@
<ul class="tsd-parameters">
{{#if signatures}}
<li class="tsd-parameter-signature">
<ul class="tsd-signatures {{cssClasses}}">
{{#each signatures}}
<li class="tsd-signature tsd-kind-icon">{{#compact}}
{{> member.signature.title hideName=true }}
{{/compact}}</li>
{{/each}}
</ul>
<ul class="tsd-descriptions">
{{#each signatures}}
<li class="tsd-description">{{> member.signature.body hideSources=true }}</li>
{{/each}}
</ul>
</li>
{{/if}}
{{#if indexSignature}}
<li class="tsd-parameter-index-signature">
<h5>{{#compact}}
<span class="tsd-signature-symbol">[</span>
{{#each indexSignature.parameters}}
{{#if flags.isRest}}<span class="tsd-signature-symbol">...</span>{{/if}}{{name}}:&nbsp;{{#with type}}{{>type}}{{/with}}
{{/each}}
<span class="tsd-signature-symbol">]:&nbsp;</span>
{{#with indexSignature.type}}{{>type}}{{/with}}
{{/compact}}</h5>
{{#with indexSignature}}
{{> comment}}
{{/with}}
{{#if indexSignature.type.declaration}}
{{#with indexSignature.type.declaration}}
{{> parameter}}
{{/with}}
{{/if}}
</li>
{{/if}}
{{#each children}}
{{#if signatures}}
<li class="tsd-parameter">
<h5>{{#compact}}
{{#if flags.isRest}}<span class="tsd-signature-symbol">...</span>{{/if}}
{{{wbr name}}}
<span class="tsd-signature-symbol">
{{#if isOptional}}?{{/if}}
:&nbsp;
</span>
function
{{/compact}}</h5>
{{> member.signatures}}
</li>
{{else}}{{#if type}} {{! standard type }}
<li class="tsd-parameter">
<h5>{{#compact}}
{{#each flags}}
<span class="tsd-flag ts-flag{{this}}">{{this}}</span>&nbsp;
{{/each}}
{{#if flags.isRest}}<span class="tsd-signature-symbol">...</span>{{/if}}
{{#with type}}
{{{wbr ../name}}}
<span class="tsd-signature-symbol">
{{#if ../flags.isOptional}}?{{/if}}
:&nbsp;
</span>
{{>type}}
{{/with}}
{{/compact}}</h5>
{{> comment}}
{{#if children}}
{{> parameter}}
{{/if}}
{{#if type.declaration}}
{{#with type.declaration}}
{{> parameter}}
{{/with}}
{{/if}}
</li>
{{else}} {{! getter/setter }}
{{#with getSignature}} {{! getter }}
<li class="tsd-parameter">
<h5>{{#compact}}
{{#each flags}}
<span class="tsd-flag ts-flag{{this}}">{{this}}</span>&nbsp;
{{/each}}
<span class="tsd-signature-symbol">get&nbsp;</span>
{{{wbr ../name}}}
<span class="tsd-signature-symbol">():&nbsp;</span>
{{#with type}}
{{> type}}
{{/with}}
{{/compact}}</h5>
{{> comment }}
</li>
{{/with}}
{{#with setSignature}} {{! setter }}
<li class="tsd-parameter">
<h5>{{#compact}}
{{#each flags}}
<span class="tsd-flag ts-flag{{this}}">{{this}}</span>&nbsp;
{{/each}}
<span class="tsd-signature-symbol">set&nbsp;</span>
{{{wbr ../name}}}
<span class="tsd-signature-symbol">(</span>
{{#each parameters}}
{{name}}
<span class="tsd-signature-symbol">: </span>
{{#with type}}
{{> type}}
{{else}}
<span class="tsd-signature-type">any</span>
{{/with}}
{{/each}}
<span class="tsd-signature-symbol">):&nbsp;</span>
{{#with type}}
{{> type}}
{{/with}}
{{/compact}}</h5>
{{> comment }}
</li>
{{/with}}
{{/if}}{{/if}}
{{/each}}
</ul>

10
theme/partials/toc.hbs Normal file

@ -0,0 +1,10 @@
<li class="{{#if isInPath}}current{{/if}} {{cssClasses}}">
<a href="{{relativeURL url}}" class="tsd-kind-icon">{{{wbr title}}}</a>
{{#if children}}
<ul>
{{#each children}}
{{> toc}}
{{/each}}
</ul>
{{/if}}
</li>

@ -0,0 +1,18 @@
{{#if isInPath}}
</ul>
<ul class="current">
{{/if}}
<li class="{{#if isInPath}}current{{/if}} {{cssClasses}}">
<a href="{{relativeURL url}}" class="tsd-kind-icon">{{{wbr title}}}</a>
{{#if children}}
<ul>
{{#each children}}
{{> toc}}
{{/each}}
</ul>
{{/if}}
</li>
{{#if isInPath}}
</ul>
<ul class="after-current">
{{/if}}

335
theme/partials/type.hbs Normal file

@ -0,0 +1,335 @@
{{! Each type gets its own inline helper to determine how it is rendered. }}
{{! The name of the helper is the value of the 'type' property on the type.}}
{{!
The type helper accepts an optional needsParens parameter that is checked
if an inner type may result in invalid output without them. For example:
1 | 2[] !== (1 | 2)[]
() => 1 | 2 !== (() => 1) | 2
}}
{{#*inline 'array'}}
{{#with elementType}}
{{> type needsParens=true}}
<span class="tsd-signature-symbol">[]</span>
{{/with}}
{{/inline}}
{{#*inline 'conditional'}}
{{#if needsParens}}
<span class="tsd-signature-symbol">(</span>
{{/if}}
{{#with checkType}}
{{> type needsParens=true}}
{{/with}}
<span class="tsd-signature-symbol"> extends </span>
{{#with extendsType}}
{{> type}}
{{/with}}
<span class="tsd-signature-symbol"> ? </span>
{{#with trueType}}
{{> type}}
{{/with}}
<span class="tsd-signature-symbol"> : </span>
{{#with falseType}}
{{> type}}
{{/with}}
{{#if needsParens}}
<span class="tsd-signature-symbol">)</span>
{{/if}}
{{/inline}}
{{#*inline 'indexedAccess'}}
{{#with objectType}}
{{> type}}
{{/with}}
<span class="tsd-signature-symbol">[</span>
{{#with indexType}}
{{> type}}
{{/with}}
<span class="tsd-signature-symbol">]</span>
{{/inline}}
{{#*inline 'inferred'}}
<span class="tsd-signature-symbol">infer </span> {{name}}
{{/inline}}
{{#*inline 'intersection'}}
{{#if needsParens}}
<span class="tsd-signature-symbol">(</span>
{{/if}}
{{#each types}}
{{#unless @first}}
<span class="tsd-signature-symbol"> &amp; </span>
{{/unless}}
{{> type}}
{{/each}}
{{#if needsParens}}
<span class="tsd-signature-symbol">)</span>
{{/if}}
{{/inline}}
{{#*inline 'intrinsic'}}
<span class="tsd-signature-type">{{name}}</span>
{{/inline}}
{{#*inline 'literal'}}
<span class="tsd-signature-type">{{stringify value}}</span>
{{/inline}}
{{#*inline 'mapped'}}
<span class="tsd-signature-symbol">{</span>
{{#ifCond readonlyModifier '===' '+'}}
<span class="tsd-signature-symbol">readonly </span>
{{else}}
{{#ifCond readonlyModifier '===' '-'}}
<span class="tsd-signature-symbol">-readonly </span>
{{/ifCond}}
{{/ifCond}}
<span class="tsd-signature-symbol">[ </span>
<span class="tsd-signature-type">{{parameter}}</span>
<span class="tsd-signature-symbol"> in </span>
{{#with parameterType}}
{{>type}}
{{/with}}
{{#with nameType}}
<span class="tsd-signature-symbol"> as </span>
{{>type}}
{{/with}}
<span class="tsd-signature-symbol">]</span>
{{#ifCond readonlyModifier '===' '+'}}
<span class="tsd-signature-symbol">?: </span>
{{else}}
{{#ifCond readonlyModifier '===' '-'}}
<span class="tsd-signature-symbol">-?: </span>
{{else}}
<span class="tsd-signature-symbol">: </span>
{{/ifCond}}
{{/ifCond}}
{{#with templateType}}
{{>type}}
{{/with}}
<span class="tsd-signature-symbol"> }</span>
{{/inline}}
{{#*inline 'optional'}}
{{#with elementType}}
{{> type}}
{{/with}}
<span class="tsd-signature-symbol">?</span>
{{/inline}}
{{#*inline 'predicate'}}
{{#if asserts}}
<span class="tsd-signature-symbol">asserts </span>
{{/if}}
<span class="tsd-signature-type">{{name}}</span>
{{#if targetType}}
<span class="tsd-signature-symbol"> is </span>
{{#with targetType}}
{{>type}}
{{/with}}
{{/if}}
{{/inline}}
{{#*inline 'query'}}
<span class="tsd-signature-symbol">typeof </span>
{{#with queryType}}
{{> type}}
{{/with}}
{{/inline}}
{{#*inline 'reference'}}
{{#with getReflection }}
<a href="{{relativeURL url}}" class="tsd-signature-type" data-tsd-kind="{{kindString}}">
{{name}}
</a>
{{else}}
<span class="tsd-signature-type">{{name}}</span>
{{/with}}
{{#if typeArguments}}
<span class="tsd-signature-symbol">&lt;</span>
{{#each typeArguments}}
{{#unless @first}}
<span class="tsd-signature-symbol">, </span>
{{/unless}}
{{> type}}
{{/each}}
<span class="tsd-signature-symbol">&gt;</span>
{{/if}}
{{/inline}}
{{#*inline 'reflection'}}
{{#if declaration.children}} {{! object literal }}
<span class="tsd-signature-symbol">{ </span>
{{#each declaration.children}}
{{#unless @first}}
<span class="tsd-signature-symbol">; </span>
{{/unless}}
{{#if getSignature}}
{{#if setSignature}}
{{name}}
<span class="tsd-signature-symbol">: </span>
{{#with getSignature.type}}
{{> type}}
{{else}}
<span class="tsd-signature-type">any</span>
{{/with}}
{{else}}
<span class="tsd-signature-symbol">get </span>
{{name}}
<span class="tsd-signature-symbol">(): </span>
{{#with getSignature.type}}
{{> type}}
{{else}}
<span class="tsd-signature-type">any</span>
{{/with}}
{{/if}}
{{else}}
{{#if setSignature}}
<span class="tsd-signature-symbol">set </span>
{{name}}
<span class="tsd-signature-symbol">(</span>
{{! Rather hacky to use each here... but we know there is exactly one. }}
{{#each setSignature.parameters}}
{{name}}
<span class="tsd-signature-symbol">: </span>
{{#with type}}
{{> type}}
{{else}}
<span class="tsd-signature-type">any</span>
{{/with}}
{{/each}}
<span class="tsd-signature-symbol">)</span>
{{else}}
{{name}}
{{#if flags.isOptional }}
<span class="tsd-signature-symbol">?: </span>
{{else}}
<span class="tsd-signature-symbol">: </span>
{{/if}}
{{#with type}}
{{> type}}
{{else}}
<span class="tsd-signature-type">any</span>
{{/with}}
{{/if}}
{{/if}}
{{/each}}
<span class="tsd-signature-symbol"> }</span>
{{else if declaration.signatures}}
{{#if (lookup declaration.signatures 1) }} {{! more than one signature}}
<span class="tsd-signature-symbol">{ </span>
{{#each declaration.signatures}}
{{> member.signature.title hideName=true}}
{{#unless @last}}
<span class="tsd-signature-symbol">; </span>
{{/unless}}
{{/each}}
<span class="tsd-signature-symbol"> }</span>
{{else}}
{{#if needsParens}}
<span class="tsd-signature-symbol">(</span>
{{/if}}
{{#with (lookup declaration.signatures '0') }}
{{> member.signature.title hideName=true arrowStyle=true}}
{{/with}}
{{#if needsParens}}
<span class="tsd-signature-symbol">)</span>
{{/if}}
{{/if}}
{{else}}
<span class="tsd-signature-symbol">{}</span>
{{/if}}
{{/inline}}
{{#*inline 'rest'}}
<span class="tsd-signature-symbol">...</span>
{{#with elementType}}
{{> type}}
{{/with}}
{{/inline}}
{{#*inline 'tuple'}}
<span class="tsd-signature-symbol">[</span>
{{#each elements}}
{{#unless @first}}
<span class="tsd-signature-symbol">, </span>
{{/unless}}
{{> type}}
{{/each}}
<span class="tsd-signature-symbol">]</span>
{{/inline}}
{{#*inline 'template-literal'}}
<span class="tsd-signature-symbol">`</span>
{{#if head}}
<span class="tsd-signature-type">{{head}}</span>
{{/if}}
{{#each tail}}
<span class="tsd-signature-symbol">${</span>
{{#with this.[0]}}
{{>type}}
{{/with}}
<span class="tsd-signature-symbol">}</span>
{{#if this.[1]}}
<span class="tsd-signature-type">{{this.[1]}}</span>
{{/if}}
{{/each}}
<span class="tsd-signature-symbol">`</span>
{{/inline}}
{{#*inline 'typeOperator'}}
<span class="tsd-signature-symbol">{{operator}} </span>
{{#with target}}
{{> type}}
{{/with}}
{{/inline}}
{{#*inline 'typeParameter'}}
<span class="tsd-signature-type">{{name}}</span>
{{/inline}}
{{#*inline 'union'}}
{{#if needsParens}}
<span class="tsd-signature-symbol">(</span>
{{/if}}
{{#each types}}
{{#unless @first}}
<span class="tsd-signature-symbol"> | </span>
{{/unless}}
{{> type needsParens=true}}
{{/each}}
{{#if needsParens}}
<span class="tsd-signature-symbol">)</span>
{{/if}}
{{/inline}}
{{#*inline 'unknown'}}
<span class="tsd-signature-type">{{name}}</span>
{{/inline}}
{{#*inline 'named-tuple-member'}}
{{name}}
{{#if isOptional}}
<span class="tsd-signature-symbol">?: </span>
{{else}}
<span class="tsd-signature-symbol">: </span>
{{/if}}
{{#with element}}
{{> type}}
{{/with}}
{{/inline}}
{{#if this}}
{{> (lookup . 'type') }}
{{else}}
<span class="tsd-signature-type">void</span>
{{/if}}

@ -0,0 +1,42 @@
{{#compact}}
{{#if this}}
{{#if elementType}}
{{#with elementType}}
{{> typeAndParent}}
{{/with}}
[]
{{else}}
{{#if reflection}}
{{#ifSignature reflection}}
{{#if reflection.parent.parent.url}}
<a href="{{relativeURL reflection.parent.parent.url}}">{{reflection.parent.parent.name}}</a>
{{else}}
{{reflection.parent.parent.name}}
{{/if}}
.
{{#if reflection.parent.url}}
<a href="{{relativeURL reflection.parent.url}}">{{reflection.parent.name}}</a>
{{else}}
{{reflection.parent.name}}
{{/if}}
{{else}}
{{#if reflection.parent.url}}
<a href="{{relativeURL reflection.parent.url}}">{{reflection.parent.name}}</a>
{{else}}
{{reflection.parent.name}}
{{/if}}
.
{{#if reflection.url}}
<a href="{{relativeURL reflection.url}}">{{reflection.name}}</a>
{{else}}
{{reflection.name}}
{{/if}}
{{/ifSignature}}
{{else}}
{{this}}
{{/if}}
{{/if}}
{{else}}
void
{{/if}}
{{/compact}}

@ -0,0 +1,17 @@
<ul class="tsd-type-parameters">
{{#each typeParameters}}
<li>
<h4>{{#compact}}
{{name}}
{{#if type}}
<span class="tsd-signature-symbol">:&nbsp;</span>
{{#with type}}{{> type}}{{/with}}
{{/if}}
{{#if default}}
&nbsp;=&nbsp;{{#with default}}{{> type}}{{/with}}
{{/if}}
{{/compact}}</h4>
{{> comment}}
</li>
{{/each}}
</ul>

@ -0,0 +1,3 @@
<div class="tsd-panel tsd-typography">
{{#markdown}}{{{model.readme}}}{{/markdown}}
</div>

@ -0,0 +1,79 @@
{{#with model}}
{{#if hasComment}}
<section class="tsd-panel tsd-comment">
{{> comment}}
</section>
{{/if}}
{{/with}}
{{#if model.typeParameters}}
<section class="tsd-panel tsd-type-parameters">
<h3>Type parameters</h3>
{{#with model}}{{> typeParameters}}{{/with}}
</section>
{{/if}}
{{#if model.typeHierarchy}}
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
{{#with model.typeHierarchy}}{{> hierarchy}}{{/with}}
</section>
{{/if}}
{{#if model.implementedTypes}}
<section class="tsd-panel">
<h3>Implements</h3>
<ul class="tsd-hierarchy">
{{#each model.implementedTypes}}
<li>{{#compact}}{{> type}}{{/compact}}</li>
{{/each}}
</ul>
</section>
{{/if}}
{{#if model.implementedBy}}
<section class="tsd-panel">
<h3>Implemented by</h3>
<ul class="tsd-hierarchy">
{{#each model.implementedBy}}
<li>{{#compact}}{{> type}}{{/compact}}</li>
{{/each}}
</ul>
</section>
{{/if}}
{{#if model.signatures}}
<section class="tsd-panel">
<h3 class="tsd-before-signature">Callable</h3>
{{#with model}}{{> member.signatures}}{{/with}}
</section>
{{/if}}
{{#if model.indexSignature}}
<section class="tsd-panel {{model.cssClasses}}">
<h3 class="tsd-before-signature">Indexable</h3>
<div class="tsd-signature tsd-kind-icon">{{#compact}}
<span class="tsd-signature-symbol">[</span>
{{#each model.indexSignature.parameters}}
{{name}}:&nbsp;{{#with type}}{{>type}}{{/with}}
{{/each}}
<span class="tsd-signature-symbol">]:&nbsp;</span>
{{#with model.indexSignature.type}}{{>type}}{{/with}}
{{/compact}}</div>
{{#with model.indexSignature}}
{{> comment}}
{{/with}}
{{#if model.indexSignature.type.declaration}}
{{#with model.indexSignature.type.declaration}}
{{> parameter}}
{{/with}}
{{/if}}
</section>
{{/if}}
{{#with model}}
{{> index}}
{{> members}}
{{/with}}