Skip to content

Commit

Permalink
0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorm committed Jun 7, 2024
1 parent 377ccc4 commit 56ade52
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 200 deletions.
1 change: 0 additions & 1 deletion docs/.nojekyll

This file was deleted.

88 changes: 11 additions & 77 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,22 @@
chafa-wasm
**chafa-wasm****Docs**

# chafa-wasm
***

## Table of contents
# chafa-wasm

### Namespaces
## Namespaces

- ["chafa-wasm"](modules/chafa_wasm_.md)
- ["chafa-wasm"](namespaces/chafa-wasm/README.md)

### Interfaces
## Interfaces

- [Callback](interfaces/Callback.md)
- [ChafaFactory](interfaces/ChafaFactory.md)
- [ChafaModule](interfaces/ChafaModule.md)

### Type Aliases

- [ChafaConfig](README.md#chafaconfig)
- [ImageDataLike](README.md#imagedatalike)
- [PartialChafaConfig](README.md#partialchafaconfig)
- [ReadonlyChafaConfig](README.md#readonlychafaconfig)

## Type Aliases

### ChafaConfig

Ƭ **ChafaConfig**: `Object`

An object that holds the output configuration.
Supports most of the options of the Chafa command-line utility, see its documentation for details.

**`See`**

https://hpjansson.org/chafa/man/

#### Type declaration

| Name | Type |
| :------ | :------ |
| `bg` | `number` |
| `colorExtractor` | `number` \| `string` |
| `colorSpace` | `number` \| `string` |
| `colors` | `number` \| `string` |
| `dither` | `number` \| `string` |
| `ditherGrainHeight` | `number` |
| `ditherGrainWidth` | `number` |
| `ditherIntensity` | `number` |
| `fg` | `number` |
| `fgOnly` | `boolean` |
| `fill` | `string` |
| `fontRatio` | `number` |
| `height` | `number` |
| `optimize` | `number` |
| `preprocess` | `boolean` |
| `symbols` | `string` |
| `threshold` | `number` |
| `width` | `number` |
| `work` | `number` |

___

### ImageDataLike

Ƭ **ImageDataLike**: `Object`

#### Index signature

[x: `string` \| `number` \| `symbol`]: `any`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `data` | `Uint8ClampedArray` |
| `height` | `number` |
| `width` | `number` |

___

### PartialChafaConfig

Ƭ **PartialChafaConfig**: \{ [P in keyof ChafaConfig]?: ChafaConfig[P] \| string }

___

### ReadonlyChafaConfig

Ƭ **ReadonlyChafaConfig**: \{ readonly [P in keyof ChafaConfig]: ChafaConfig[P] }
- [ChafaConfig](type-aliases/ChafaConfig.md)
- [ImageDataLike](type-aliases/ImageDataLike.md)
- [PartialChafaConfig](type-aliases/PartialChafaConfig.md)
- [ReadonlyChafaConfig](type-aliases/ReadonlyChafaConfig.md)
37 changes: 37 additions & 0 deletions docs/interfaces/Callback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[**chafa-wasm**](../README.md)**Docs**

***

[chafa-wasm](../README.md) / Callback

# Interface: Callback()\<T, U\>

## Type parameters

**T**

**U**

> **Callback**(`error`, `result`): `void`
## Parameters

**error**: `unknown`

**result**: `U`

## Returns

`void`

> **Callback**(`error`, `result`): `void`
## Parameters

**error**: `null`

**result**: `T`

## Returns

`void`
20 changes: 9 additions & 11 deletions docs/interfaces/ChafaFactory.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
[chafa-wasm](../README.md) / ChafaFactory
[**chafa-wasm**](../README.md) **Docs**

# Interface: ChafaFactory
***

A factory function that returns a promise that resolves to a ChafaModule object.
[chafa-wasm](../README.md) / ChafaFactory

## Callable
# Interface: ChafaFactory()

### ChafaFactory
A factory function that returns a promise that resolves to a ChafaModule object.

**ChafaFactory**(`moduleArg?`): `Promise`\<[`ChafaModule`](ChafaModule.md)\>
> **ChafaFactory**(`moduleArg`?): `Promise`\<[`ChafaModule`](ChafaModule.md)\>
#### Parameters
## Parameters

| Name | Type |
| :------ | :------ |
| `moduleArg?` | `Object` |
**moduleArg?**

#### Returns
## Returns

`Promise`\<[`ChafaModule`](ChafaModule.md)\>
134 changes: 51 additions & 83 deletions docs/interfaces/ChafaModule.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[**chafa-wasm**](../README.md)**Docs**

***

[chafa-wasm](../README.md) / ChafaModule

# Interface: ChafaModule
Expand All @@ -6,159 +10,123 @@ An object that contains the Chafa WebAssembly module API.

## Indexable

[x: `string` \| `number` \| `symbol`]: `any`

## Table of contents

### Properties

- [decodeImage](ChafaModule.md#decodeimage)
- [imageToAnsi](ChafaModule.md#imagetoansi)
- [imageToCanvas](ChafaModule.md#imagetocanvas)
- [imageToConsoleLogArgs](ChafaModule.md#imagetoconsolelogargs)
- [imageToHtml](ChafaModule.md#imagetohtml)
- [imageToMatrix](ChafaModule.md#imagetomatrix)
\[`x`: `string` \| `number` \| `symbol`\]: `any`

## Properties

### decodeImage
### decodeImage()

**decodeImage**: (`image`: `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike), `callback`: (`error`: ``null``, `image`: [`ImageDataLike`](../README.md#imagedatalike)) => `void`(`error`: `unknown`, `image`: ``null``) => `void`) => `void`
> **decodeImage**: (`image`, `callback`) => `void`
Decodes a PNG, JPEG or WebP image into an ImageDataLike object.
If an already decoded image is specified, it will be left as is.

#### Type declaration

▸ (`image`, `callback`): `void`
#### Parameters

##### Parameters
**image**: `ArrayBuffer` \| [`ImageDataLike`](../type-aliases/ImageDataLike.md)

| Name | Type |
| :------ | :------ |
| `image` | `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike) |
| `callback` | (`error`: ``null``, `image`: [`ImageDataLike`](../README.md#imagedatalike)) => `void`(`error`: `unknown`, `image`: ``null``) => `void` |
**callback**: [`Callback`](Callback.md)\<[`ImageDataLike`](../type-aliases/ImageDataLike.md), `null`\>

##### Returns
#### Returns

`void`

___
***

### imageToAnsi
### imageToAnsi()

**imageToAnsi**: (`image`: `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike), `config`: [`PartialChafaConfig`](../README.md#partialchafaconfig), `callback`: (`error`: ``null``, `data`: \{ `ansi`: `string` ; `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) }) => `void`(`error`: `unknown`, `data`: \{ `ansi`: ``null`` ; `config`: ``null`` }) => `void`) => `void`
> **imageToAnsi**: (`image`, `config`, `callback`) => `void`
Converts an image into an ANSI string.

#### Type declaration
#### Parameters

▸ (`image`, `config`, `callback`): `void`
**image**: `ArrayBuffer` \| [`ImageDataLike`](../type-aliases/ImageDataLike.md)

##### Parameters
**config**: [`PartialChafaConfig`](../type-aliases/PartialChafaConfig.md)

| Name | Type |
| :------ | :------ |
| `image` | `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike) |
| `config` | [`PartialChafaConfig`](../README.md#partialchafaconfig) |
| `callback` | (`error`: ``null``, `data`: \{ `ansi`: `string` ; `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) }) => `void`(`error`: `unknown`, `data`: \{ `ansi`: ``null`` ; `config`: ``null`` }) => `void` |
**callback**: [`Callback`](Callback.md)\<`object`, `object`\>

##### Returns
#### Returns

`void`

___
***

### imageToCanvas
### imageToCanvas()

**imageToCanvas**: (`image`: `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike), `config`: [`PartialChafaConfig`](../README.md#partialchafaconfig), `callback`: (`error`: ``null``, `data`: \{ `canvas`: `number` ; `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) }) => `void`(`error`: `unknown`, `data`: \{ `canvas`: ``null`` ; `config`: ``null`` }) => `void`) => `void`
> **imageToCanvas**: (`image`, `config`, `callback`) => `void`
Converts an image into a Chafa canvas pointer.

#### Type declaration
#### Parameters

▸ (`image`, `config`, `callback`): `void`
**image**: `ArrayBuffer` \| [`ImageDataLike`](../type-aliases/ImageDataLike.md)

##### Parameters
**config**: [`PartialChafaConfig`](../type-aliases/PartialChafaConfig.md)

| Name | Type |
| :------ | :------ |
| `image` | `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike) |
| `config` | [`PartialChafaConfig`](../README.md#partialchafaconfig) |
| `callback` | (`error`: ``null``, `data`: \{ `canvas`: `number` ; `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) }) => `void`(`error`: `unknown`, `data`: \{ `canvas`: ``null`` ; `config`: ``null`` }) => `void` |
**callback**: [`Callback`](Callback.md)\<`object`, `object`\>

##### Returns
#### Returns

`void`

___
***

### imageToConsoleLogArgs
### imageToConsoleLogArgs()

**imageToConsoleLogArgs**: (`image`: `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike), `config`: [`PartialChafaConfig`](../README.md#partialchafaconfig), `callback`: (`error`: ``null``, `data`: \{ `args`: `string`[] ; `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) }) => `void`(`error`: `unknown`, `data`: \{ `args`: ``null`` ; `config`: ``null`` }) => `void`) => `void`
> **imageToConsoleLogArgs**: (`image`, `config`, `callback`) => `void`
Converts an image into an array of `console.log` arguments.

#### Type declaration
#### Parameters

▸ (`image`, `config`, `callback`): `void`
**image**: `ArrayBuffer` \| [`ImageDataLike`](../type-aliases/ImageDataLike.md)

##### Parameters
**config**: [`PartialChafaConfig`](../type-aliases/PartialChafaConfig.md)

| Name | Type |
| :------ | :------ |
| `image` | `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike) |
| `config` | [`PartialChafaConfig`](../README.md#partialchafaconfig) |
| `callback` | (`error`: ``null``, `data`: \{ `args`: `string`[] ; `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) }) => `void`(`error`: `unknown`, `data`: \{ `args`: ``null`` ; `config`: ``null`` }) => `void` |
**callback**: [`Callback`](Callback.md)\<`object`, `object`\>

##### Returns
#### Returns

`void`

___
***

### imageToHtml
### imageToHtml()

**imageToHtml**: (`image`: `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike), `config`: [`PartialChafaConfig`](../README.md#partialchafaconfig), `callback`: (`error`: ``null``, `data`: \{ `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) ; `html`: `string` }) => `void`(`error`: `unknown`, `data`: \{ `config`: ``null`` ; `html`: ``null`` }) => `void`) => `void`
> **imageToHtml**: (`image`, `config`, `callback`) => `void`
Converts an image into an HTML string.

#### Type declaration
#### Parameters

▸ (`image`, `config`, `callback`): `void`
**image**: `ArrayBuffer` \| [`ImageDataLike`](../type-aliases/ImageDataLike.md)

##### Parameters
**config**: [`PartialChafaConfig`](../type-aliases/PartialChafaConfig.md)

| Name | Type |
| :------ | :------ |
| `image` | `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike) |
| `config` | [`PartialChafaConfig`](../README.md#partialchafaconfig) |
| `callback` | (`error`: ``null``, `data`: \{ `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) ; `html`: `string` }) => `void`(`error`: `unknown`, `data`: \{ `config`: ``null`` ; `html`: ``null`` }) => `void` |
**callback**: [`Callback`](Callback.md)\<`object`, `object`\>

##### Returns
#### Returns

`void`

___
***

### imageToMatrix
### imageToMatrix()

**imageToMatrix**: (`image`: `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike), `config`: [`PartialChafaConfig`](../README.md#partialchafaconfig), `callback`: (`error`: ``null``, `data`: \{ `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) ; `matrix`: `number`[][][] }) => `void`(`error`: `unknown`, `data`: \{ `config`: ``null`` ; `matrix`: ``null`` }) => `void`) => `void`
> **imageToMatrix**: (`image`, `config`, `callback`) => `void`
Converts an image into a matrix of characters.

#### Type declaration
#### Parameters

▸ (`image`, `config`, `callback`): `void`
**image**: `ArrayBuffer` \| [`ImageDataLike`](../type-aliases/ImageDataLike.md)

##### Parameters
**config**: [`PartialChafaConfig`](../type-aliases/PartialChafaConfig.md)

| Name | Type |
| :------ | :------ |
| `image` | `ArrayBuffer` \| [`ImageDataLike`](../README.md#imagedatalike) |
| `config` | [`PartialChafaConfig`](../README.md#partialchafaconfig) |
| `callback` | (`error`: ``null``, `data`: \{ `config`: [`ReadonlyChafaConfig`](../README.md#readonlychafaconfig) ; `matrix`: `number`[][][] }) => `void`(`error`: `unknown`, `data`: \{ `config`: ``null`` ; `matrix`: ``null`` }) => `void` |
**callback**: [`Callback`](Callback.md)\<`object`, `object`\>

##### Returns
#### Returns

`void`
Loading

0 comments on commit 56ade52

Please sign in to comment.