mien-avatar 0.1.0 → 0.2.1
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.
- package/README.md +95 -26
- package/avatars/aster.js +1 -1
- package/avatars/bloom.js +1 -1
- package/avatars/bombo.js +1 -1
- package/avatars/bud.js +1 -1
- package/avatars/cal.js +1 -1
- package/avatars/dew.js +1 -1
- package/avatars/dot.js +1 -1
- package/avatars/drift.js +1 -1
- package/avatars/ember.js +1 -1
- package/avatars/hex.js +1 -1
- package/avatars/hopper.js +1 -1
- package/avatars/kabo.js +1 -1
- package/avatars/kubo.js +1 -1
- package/avatars/lumi.js +1 -1
- package/avatars/mello.js +1 -1
- package/avatars/michi.js +1 -1
- package/avatars/miro.js +1 -1
- package/avatars/momo-solid.js +1 -1
- package/avatars/momo.js +1 -1
- package/avatars/moss.js +1 -1
- package/avatars/nimbus.js +1 -1
- package/avatars/nox.js +1 -1
- package/avatars/orbit.js +1 -1
- package/avatars/peony.js +1 -1
- package/avatars/pepo.js +1 -1
- package/avatars/pico.js +1 -1
- package/avatars/pip.js +1 -1
- package/avatars/pogo.js +1 -1
- package/avatars/puddle.js +1 -1
- package/avatars/puff.js +1 -1
- package/avatars/reed.js +1 -1
- package/avatars/rill.js +1 -1
- package/avatars/sable.js +1 -1
- package/avatars/sprig.js +1 -1
- package/avatars/sunny.js +1 -1
- package/avatars/taro.js +1 -1
- package/avatars/tempo.js +1 -1
- package/avatars/toque.js +1 -1
- package/avatars/wisp.js +1 -1
- package/avatars/zest.js +1 -1
- package/dist/core.js +1 -1
- package/dist/element.js +1 -1
- package/dist/format.js +1 -1
- package/dist/guide.md +21 -38
- package/dist/index.js +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/{activate-C80BK8CF.js → activate-C16bLpUy.js} +1 -1
- package/dist/runtime/{adapter-Dn8Z0VEL.js → adapter-BtyIFq4s.js} +1 -1
- package/dist/runtime/{depth-BA77ksjs.js → depth-Cj2wTnRA.js} +1 -1
- package/dist/runtime/{handle-BgLTnSgy.js → handle-p7slzKMG.js} +1 -1
- package/dist/runtime/live-3QIUR7dM.js +1 -0
- package/dist/runtime/{mount-DhC05CLb.js → mount-Do-RWK8s.js} +1 -1
- package/dist/runtime/{paint-DAEjGO2k.js → paint-T6aENHGJ.js} +1 -1
- package/dist/runtime/{playback-DxnlsAAY.js → playback-a02m3NQr.js} +1 -1
- package/dist/runtime/{playerPaint-DylZy_iE.js → playerPaint-DaCo2Clx.js} +1 -1
- package/dist/runtime/{poster-BxyQVVcf.js → poster-Cs69ty3T.js} +1 -1
- package/dist/runtime/reader-JcTNbEkh.js +1 -0
- package/dist/runtime/render-BZ-ifVuu.js +1 -0
- package/dist/runtime/{request-CGIlAb4P.js → request-Ca14lwoC.js} +1 -1
- package/dist/runtime/{response-DZAPeoVT.js → response-DPh_8Rji.js} +1 -1
- package/dist/runtime/runs-BQEucHaT.js +1 -0
- package/dist/runtime/{sampledProfiles-_9uwa85K.js → sampledProfiles-Bnlm4vdZ.js} +1 -1
- package/dist/runtime/{sculpt-DTgDSjd1.js → sculpt-CVu30RFI.js} +1 -1
- package/dist/runtime/{sockets-PNoBQrfx.js → sockets-n9lhW9hh.js} +1 -1
- package/dist/still.js +1 -1
- package/dist/types/format/types.d.ts +6 -0
- package/dist/types/playerPaint.d.ts +13 -2
- package/dist/vue.js +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/runtime/live-Cu0tA6c7.js +0 -1
- package/dist/runtime/reader-D8GMfJy6.js +0 -1
- package/dist/runtime/render-CubDnPM7.js +0 -1
- package/dist/runtime/runs-BIIveHSZ.js +0 -1
package/README.md
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
# mien-avatar
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Give your app's assistant a face. It thinks while a reply is on its way, speaks while it answers and smiles when it's done.
|
|
6
|
+
|
|
7
|
+
Works with React, Vue, plain JavaScript and any other framework.
|
|
6
8
|
|
|
7
9
|
```sh
|
|
8
10
|
npm install mien-avatar
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
> Read <https://mien.hazem.design/install.txt> and add Momo beside my chat input. Show `thinking` while a reply is pending and `idle` when it arrives.
|
|
14
|
-
|
|
15
|
-
[Open the install page](https://mien.hazem.design/install)
|
|
13
|
+
## Quick start
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
**React**
|
|
18
16
|
|
|
19
17
|
```tsx
|
|
20
18
|
import { Mien } from 'mien-avatar/react'
|
|
@@ -25,14 +23,13 @@ export function Assistant({ busy }: { busy: boolean }) {
|
|
|
25
23
|
}
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
**Vue**
|
|
29
27
|
|
|
30
28
|
```vue
|
|
31
|
-
<script setup>
|
|
29
|
+
<script setup lang="ts">
|
|
32
30
|
import { Mien } from 'mien-avatar/vue'
|
|
33
31
|
import momo from 'mien-avatar/avatars/momo'
|
|
34
|
-
|
|
35
|
-
defineProps({ busy: Boolean })
|
|
32
|
+
defineProps<{ busy: boolean }>()
|
|
36
33
|
</script>
|
|
37
34
|
|
|
38
35
|
<template>
|
|
@@ -40,32 +37,104 @@ defineProps({ busy: Boolean })
|
|
|
40
37
|
</template>
|
|
41
38
|
```
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
**Plain JavaScript**
|
|
44
41
|
|
|
45
42
|
```js
|
|
46
43
|
import { mount } from 'mien-avatar'
|
|
47
44
|
import momo from 'mien-avatar/avatars/momo'
|
|
48
45
|
|
|
49
|
-
const
|
|
50
|
-
const avatar = mount(host, momo, { size: 64, label: 'Assistant' })
|
|
46
|
+
const avatar = mount(document.querySelector('#assistant'), momo, { size: 64, label: 'Assistant' })
|
|
51
47
|
avatar.set('thinking')
|
|
48
|
+
|
|
49
|
+
// When you remove it from the page
|
|
50
|
+
avatar.destroy()
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Svelte, Angular, Solid or plain HTML**
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<mien-avatar src="/avatars/agent.mien.json" state="idle" size="64" label="Assistant"></mien-avatar>
|
|
57
|
+
|
|
58
|
+
<script type="module">
|
|
59
|
+
import { defineMien } from 'mien-avatar/element'
|
|
60
|
+
defineMien()
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Avatars
|
|
65
|
+
|
|
66
|
+
40 avatars come ready to use. Import any of them from `mien-avatar/avatars/<name>`.
|
|
67
|
+
|
|
68
|
+
`aster` `bloom` `bombo` `bud` `cal` `dew` `dot` `drift` `ember` `hex` `hopper` `kabo` `kubo` `lumi` `mello` `michi` `miro` `momo` `momo-solid` `moss` `nimbus` `nox` `orbit` `peony` `pepo` `pico` `pip` `pogo` `puddle` `puff` `reed` `rill` `sable` `sprig` `sunny` `taro` `tempo` `toque` `wisp` `zest`
|
|
69
|
+
|
|
70
|
+
See them all move in [Mien Studio](https://mien.hazem.design/).
|
|
71
|
+
|
|
72
|
+
### Make your own
|
|
73
|
+
|
|
74
|
+
Design one in [Mien Studio](https://mien.hazem.design/) and export it as a `.mien.json` file. It works like a ready-made avatar:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import agent from './agent.mien.json'
|
|
78
|
+
|
|
79
|
+
export const Agent = () => <Mien avatar={agent} state="idle" />
|
|
52
80
|
```
|
|
53
81
|
|
|
54
|
-
|
|
82
|
+
## States
|
|
83
|
+
|
|
84
|
+
A state is a named animation. Ready-made avatars have 62. These cover most apps:
|
|
85
|
+
|
|
86
|
+
| When your app is… | Use |
|
|
87
|
+
| -------------------- | ---------------------------------- |
|
|
88
|
+
| Waiting for the user | `idle`, `listening` |
|
|
89
|
+
| Working on a reply | `thinking`, `writing`, `searching` |
|
|
90
|
+
| Answering | `speaking` |
|
|
91
|
+
| Done | `success`, `happy`, `celebrate` |
|
|
92
|
+
| Something went wrong | `error`, `warning`, `confused` |
|
|
93
|
+
| Away | `sleeping`, `offline`, `paused` |
|
|
94
|
+
|
|
95
|
+
The [guide](https://mien.hazem.design/llms-full.txt) lists them all.
|
|
96
|
+
|
|
97
|
+
## Options
|
|
98
|
+
|
|
99
|
+
| Option | What it does |
|
|
100
|
+
| -------- | ------------------------------------------------------------------------------------------------ |
|
|
101
|
+
| `state` | The state to show. Ready-made avatars start in `idle`. |
|
|
102
|
+
| `size` | Width and height, in pixels (`64`) or any CSS length (`'4rem'`). Defaults to the parent's width. |
|
|
103
|
+
| `label` | A name for screen readers. Leave it out if the avatar is decoration. |
|
|
104
|
+
| `motion` | `'auto'` follows the system's reduce-motion setting. Use `'full'` or `'reduced'` to choose. |
|
|
105
|
+
|
|
106
|
+
## Do more
|
|
107
|
+
|
|
108
|
+
Play a reaction, look around or blink. `mount()` returns these controls; in React and Vue, use a ref.
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
await avatar.play('success') // play once and wait for it to end
|
|
112
|
+
avatar.look({ x: 0.5, y: -0.2 }) // look right and up
|
|
113
|
+
avatar.blink()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Use your brand colors:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { withColors } from 'mien-avatar/format'
|
|
120
|
+
|
|
121
|
+
const brand = withColors(momo, { body: '#ff5a1f', eyes: '#ffffff' })
|
|
122
|
+
|
|
123
|
+
export const Assistant = () => <Mien avatar={brand} />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The [guide](https://mien.hazem.design/llms-full.txt) covers the rest, including errors and server rendering.
|
|
127
|
+
|
|
128
|
+
## Using a coding agent?
|
|
55
129
|
|
|
56
|
-
|
|
130
|
+
Paste this into your agent:
|
|
57
131
|
|
|
58
|
-
|
|
59
|
-
| -------- | -------------------------------------------------------------------------------------------------- |
|
|
60
|
-
| `state` | Selects a named animation. Defaults to the avatar's initial state. |
|
|
61
|
-
| `size` | Sets width and height in pixels (`64`) or a CSS length (`'4rem'`). Defaults to the parent's width. |
|
|
62
|
-
| `label` | Gives the avatar a screen reader label. Omit for decorative avatars. |
|
|
63
|
-
| `motion` | `'auto'` follows the system's reduced-motion setting. Use `'full'` or `'reduced'` to override it. |
|
|
132
|
+
> Read https://mien.hazem.design/install.txt and add Momo beside my chat input. Show `thinking` while a reply is pending and `idle` when it arrives.
|
|
64
133
|
|
|
65
|
-
|
|
134
|
+
## Requirements
|
|
66
135
|
|
|
67
|
-
|
|
136
|
+
Modern browsers. React 19 or Vue 3.5 if you use those. Node 22.12 or later for server rendering.
|
|
68
137
|
|
|
69
138
|
## License
|
|
70
139
|
|
|
71
|
-
|
|
140
|
+
Free to use, change and share, including in commercial work, under the [0BSD license](https://opensource.org/license/0bsd).
|