@glyphcss/react 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Layoutit
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,83 @@
1
+ > **Status: pre-1.0. APIs may still change before a stable 1.0 release.**
2
+
3
+ # @glyphcss/react
4
+
5
+ React components for glyphcss — an ASCII polygon mesh renderer that projects 3D scenes into a single `<pre>` element. Loads OBJ, glTF, GLB, and MagicaVoxel `.vox` files; renders the result as monospace text in the browser.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @glyphcss/react
11
+ ```
12
+
13
+ Requires React 18 or 19 as a peer dependency.
14
+
15
+ ## Quickstart
16
+
17
+ ```tsx
18
+ import {
19
+ GlyphcssScene,
20
+ GlyphcssCamera,
21
+ GlyphcssMesh,
22
+ GlyphcssOrbitControls,
23
+ } from "@glyphcss/react";
24
+
25
+ export function App() {
26
+ return (
27
+ <GlyphcssScene cols={80} rows={40}>
28
+ <GlyphcssCamera rotX={65} rotY={45}>
29
+ <GlyphcssOrbitControls />
30
+ <GlyphcssMesh src="/cottage.glb" />
31
+ </GlyphcssCamera>
32
+ </GlyphcssScene>
33
+ );
34
+ }
35
+ ```
36
+
37
+ ## Component reference
38
+
39
+ ### `<GlyphcssScene>`
40
+
41
+ Root of every React glyphcss render tree. Owns the `<pre>` output element and rasterizes all meshes on camera or state change.
42
+
43
+ | Prop | Type | Default | Description |
44
+ |---|---|---|---|
45
+ | `cols` | `number` | `80` | Grid width in character cells |
46
+ | `rows` | `number` | `40` | Grid height in character cells |
47
+ | `mode` | `"wireframe" \| "solid" \| "voxel"` | `"solid"` | Render mode |
48
+ | `className` | `string` | — | CSS class on the `<pre>` container |
49
+
50
+ ### `<GlyphcssCamera>` / `<GlyphcssPerspectiveCamera>`
51
+
52
+ Perspective camera. `GlyphcssCamera` is the ergonomic alias.
53
+
54
+ | Prop | Type | Default | Description |
55
+ |---|---|---|---|
56
+ | `fov` | `number` | `60` | Vertical field of view in degrees |
57
+ | `rotX` | `number` | `35` | Tilt in degrees |
58
+ | `rotY` | `number` | `45` | Azimuth in degrees |
59
+ | `zoom` | `number` | `1` | Zoom multiplier |
60
+
61
+ ### `<GlyphcssMesh>`
62
+
63
+ Loads and displays a 3D mesh. Supports `.obj`, `.glb`, `.gltf`, `.vox`.
64
+
65
+ | Prop | Type | Description |
66
+ |---|---|---|
67
+ | `src` | `string` | URL of the mesh file |
68
+ | `color` | `string` | Override mesh color |
69
+
70
+ ### `<GlyphcssOrbitControls>` / `<GlyphcssMapControls>`
71
+
72
+ Mouse/touch/keyboard camera controls.
73
+
74
+ ### Hooks
75
+
76
+ - `useGlyphcssCamera()` — access the camera context
77
+ - `useGlyphcssSceneContext()` — access scene state
78
+ - `useGlyphcssMesh(handle)` — mesh state and imperative API
79
+ - `useGlyphcssAnimation(clips, controller)` — three.js-style animation mixer
80
+
81
+ ## License
82
+
83
+ MIT