@retro-antlitz-kartei/react-editor 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DracoBlue
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @retro-antlitz-kartei/react-editor
2
+
3
+ React components for **retro pixel-art avatars**: a full editor with three retro
4
+ themes and a standalone preview. Built on
5
+ [`@retro-antlitz-kartei/generator`](../generator) and
6
+ [`@retro-antlitz-kartei/animate`](../animate). MIT licensed.
7
+
8
+ ```bash
9
+ pnpm add @retro-antlitz-kartei/react-editor react react-dom
10
+ ```
11
+
12
+ ## Editor
13
+
14
+ ```tsx
15
+ import { AvatarEditor } from "@retro-antlitz-kartei/react-editor";
16
+
17
+ // Uncontrolled, seeded initial avatar
18
+ <AvatarEditor seed="Ada" onChange={(cfg) => save(cfg)} />;
19
+
20
+ // Controlled
21
+ const [cfg, setCfg] = useState(() => normalizeConfig({ hut: 2 }));
22
+ <AvatarEditor value={cfg} onChange={setCfg} defaultLayout="kompakt" />;
23
+ ```
24
+
25
+ The editor renders a live preview, part cyclers, skin/clothing/background
26
+ swatches, a view switcher (left/front/right), a layout switcher
27
+ (arcade/compact/wanted), a shareable code box, a seed input, and a tap-to-open
28
+ **combat modal** with pose buttons.
29
+
30
+ ### Props
31
+
32
+ | Prop | Default | Notes |
33
+ | --- | --- | --- |
34
+ | `value` / `defaultValue` | — | Controlled / uncontrolled config. |
35
+ | `seed` | — | Initial avatar from a seed when no value is given. |
36
+ | `onChange` | — | `(config) => void` on every edit. |
37
+ | `layout` / `defaultLayout` / `onLayoutChange` | `"arcade"` | `arcade` · `kompakt` · `steckbrief`. |
38
+ | `showLayoutPicker` `showCombat` `showCode` `showSeed` | `true` | Toggle chrome. |
39
+ | `loadFonts` | `true` | Inject Press Start 2P + VT323 into `<head>`. |
40
+ | `className` / `style` | — | On the outer stage. |
41
+
42
+ ## Preview only
43
+
44
+ ```tsx
45
+ import { AvatarPreview } from "@retro-antlitz-kartei/react-editor";
46
+
47
+ <AvatarPreview config={cfg} width={320} height={400} />;
48
+ ```
49
+
50
+ Re-renders whenever `config` changes. `background` accepts `true` (palette),
51
+ a hex string, or `false` (transparent); `floor` toggles the ground strip.
52
+
53
+ Also exported: `CombatModal`, and the theme helpers `theme`, `LAYOUTS`,
54
+ `FONT_HREFS` with the `Layout` / `Theme` types.
55
+
56
+ ## License
57
+
58
+ [MIT](./LICENSE) © DracoBlue