mien-avatar 0.1.0 → 0.2.0

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.
Files changed (73) hide show
  1. package/README.md +95 -26
  2. package/avatars/aster.js +1 -1
  3. package/avatars/bloom.js +1 -1
  4. package/avatars/bombo.js +1 -1
  5. package/avatars/bud.js +1 -1
  6. package/avatars/cal.js +1 -1
  7. package/avatars/dew.js +1 -1
  8. package/avatars/dot.js +1 -1
  9. package/avatars/drift.js +1 -1
  10. package/avatars/ember.js +1 -1
  11. package/avatars/hex.js +1 -1
  12. package/avatars/hopper.js +1 -1
  13. package/avatars/kabo.js +1 -1
  14. package/avatars/kubo.js +1 -1
  15. package/avatars/lumi.js +1 -1
  16. package/avatars/mello.js +1 -1
  17. package/avatars/michi.js +1 -1
  18. package/avatars/miro.js +1 -1
  19. package/avatars/momo-solid.js +1 -1
  20. package/avatars/momo.js +1 -1
  21. package/avatars/moss.js +1 -1
  22. package/avatars/nimbus.js +1 -1
  23. package/avatars/nox.js +1 -1
  24. package/avatars/orbit.js +1 -1
  25. package/avatars/peony.js +1 -1
  26. package/avatars/pepo.js +1 -1
  27. package/avatars/pico.js +1 -1
  28. package/avatars/pip.js +1 -1
  29. package/avatars/pogo.js +1 -1
  30. package/avatars/puddle.js +1 -1
  31. package/avatars/puff.js +1 -1
  32. package/avatars/reed.js +1 -1
  33. package/avatars/rill.js +1 -1
  34. package/avatars/sable.js +1 -1
  35. package/avatars/sprig.js +1 -1
  36. package/avatars/sunny.js +1 -1
  37. package/avatars/taro.js +1 -1
  38. package/avatars/tempo.js +1 -1
  39. package/avatars/toque.js +1 -1
  40. package/avatars/wisp.js +1 -1
  41. package/avatars/zest.js +1 -1
  42. package/dist/core.js +1 -1
  43. package/dist/element.js +1 -1
  44. package/dist/format.js +1 -1
  45. package/dist/guide.md +21 -38
  46. package/dist/index.js +1 -1
  47. package/dist/react.js +1 -1
  48. package/dist/runtime/{activate-C80BK8CF.js → activate-CCUqRQyO.js} +1 -1
  49. package/dist/runtime/{adapter-Dn8Z0VEL.js → adapter-onjjGk6m.js} +1 -1
  50. package/dist/runtime/{depth-BA77ksjs.js → depth-C0ucFmd8.js} +1 -1
  51. package/dist/runtime/{handle-BgLTnSgy.js → handle-p7slzKMG.js} +1 -1
  52. package/dist/runtime/live-C2QiAIQ9.js +1 -0
  53. package/dist/runtime/{mount-DhC05CLb.js → mount-CzvXPeZF.js} +1 -1
  54. package/dist/runtime/{paint-DAEjGO2k.js → paint-CxkSCDga.js} +1 -1
  55. package/dist/runtime/{playback-DxnlsAAY.js → playback-BeRsJu6S.js} +1 -1
  56. package/dist/runtime/{playerPaint-DylZy_iE.js → playerPaint-DaCo2Clx.js} +1 -1
  57. package/dist/runtime/{poster-BxyQVVcf.js → poster-Cs69ty3T.js} +1 -1
  58. package/dist/runtime/reader-JcTNbEkh.js +1 -0
  59. package/dist/runtime/render-f6uGZFDG.js +1 -0
  60. package/dist/runtime/{request-CGIlAb4P.js → request-Ca14lwoC.js} +1 -1
  61. package/dist/runtime/{response-DZAPeoVT.js → response-DPh_8Rji.js} +1 -1
  62. package/dist/runtime/{sampledProfiles-_9uwa85K.js → sampledProfiles-BvP-O0oY.js} +1 -1
  63. package/dist/runtime/{sculpt-DTgDSjd1.js → sculpt-DWr8rXDB.js} +1 -1
  64. package/dist/runtime/{sockets-PNoBQrfx.js → sockets-CM-eyf8W.js} +1 -1
  65. package/dist/still.js +1 -1
  66. package/dist/types/format/types.d.ts +6 -0
  67. package/dist/types/playerPaint.d.ts +13 -2
  68. package/dist/vue.js +1 -1
  69. package/dist/worker.js +1 -1
  70. package/package.json +1 -1
  71. package/dist/runtime/live-Cu0tA6c7.js +0 -1
  72. package/dist/runtime/reader-D8GMfJy6.js +0 -1
  73. package/dist/runtime/render-CubDnPM7.js +0 -1
package/README.md CHANGED
@@ -1,20 +1,18 @@
1
1
  # mien-avatar
2
2
 
3
- ![Colorful Mien avatars on a black background](https://mien.hazem.design/og-image.png)
3
+ ![Rows of Mien avatars in soft colors, fading out at the edges](https://mien.hazem.design/mien-avatars-cover.webp)
4
4
 
5
- Animated SVG avatars for React, Vue, and plain JavaScript. Switch between states like `idle`, `thinking`, and `speaking` as your app runs. Use a built-in avatar or export your own from [Mien Studio](https://mien.hazem.design/).
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
- ## Tell your agent
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
- ## React
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
- ## Vue
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
- ## JavaScript
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 host = document.getElementById('assistant') // <div id="assistant"></div>
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
- Call `avatar.destroy()` when you remove the host.
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
- ## API
130
+ Paste this into your agent:
57
131
 
58
- | Option | What it does |
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
- Requires React 19 or Vue 3.5 when using those adapters.
134
+ ## Requirements
66
135
 
67
- The [full guide](https://mien.hazem.design/llms-full.txt) covers the `<mien-avatar>` custom element, playback controls, custom colors, and server rendering.
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
- The package and bundled avatars are free to use, modify, and redistribute, including commercially, under the [0BSD license](https://opensource.org/license/0bsd).
140
+ Free to use, change and share, including in commercial work, under the [0BSD license](https://opensource.org/license/0bsd).