@codexo/exojs-react 0.16.2 → 0.18.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 (2) hide show
  1. package/README.md +10 -23
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # @codexo/exojs-react
2
2
 
3
- React 18 / 19 bindings for [ExoJS](https://exojs.dev) — mount an ExoJS
4
- `Application` into your React tree, drive scenes declaratively, and overlay React
5
- HUD on the canvas.
3
+ React 18 / 19 bindings for [ExoJS](https://exoridus.github.io/ExoJS/) - mount an ExoJS `Application` into your React tree, drive scenes declaratively, and overlay React HUD on the canvas.
6
4
 
7
5
  ## Installation
8
6
 
@@ -10,30 +8,25 @@ HUD on the canvas.
10
8
  npm install @codexo/exojs @codexo/exojs-react react
11
9
  ```
12
10
 
13
- `@codexo/exojs` and `react` (>= 18) are peer dependencies; `react-dom` is an
14
- optional peer. The package ships pre-built ESM (`dist/esm`) with type
15
- declarations and works on both `@types/react` 18 and 19.
11
+ `@codexo/exojs` and `react` (>= 18) are peer dependencies; `react-dom` is an optional peer. The package ships pre-built ESM (`dist/esm`) with type declarations and works on both `@types/react` 18 and 19.
16
12
 
17
13
  ## Two layers, pick what you need
18
14
 
19
15
  This package is intentionally layered:
20
16
 
21
- - **`useExoApplication` — headless.** Creates and owns the `Application`, binds
22
- it to a `<canvas>` you render yourself. No DOM, no wrapper, no styling
23
- opinions — full control.
24
- - **`<ExoCanvas>` — batteries-included.** Renders a positioned wrapper `<div>` +
25
- a React-managed `<canvas>` and provides the app via context, so HUD overlays
26
- work out of the box.
17
+ - **`useExoApplication` — headless.** Creates and owns the `Application`, binds it to a `<canvas>` you render yourself. No DOM, no wrapper, no styling opinions — full control.
18
+ - **`<ExoCanvas>` — batteries-included.** Renders a positioned wrapper `<div>` + a React-managed `<canvas>` and provides the app via context, so HUD overlays work out of the box.
27
19
 
28
20
  ## Quick start — `<ExoCanvas>`
29
21
 
30
22
  ```tsx
23
+ import { Color } from '@codexo/exojs';
31
24
  import { ExoCanvas, Scenes, Scene, useExoApp } from '@codexo/exojs-react';
32
25
  import { TitleScene, GameScene } from './scenes';
33
26
 
34
27
  function Game() {
35
28
  return (
36
- <ExoCanvas options={{ canvas: { width: 1280, height: 720 }, clearColor: someColor }} style={{ width: 1280, height: 720 }}>
29
+ <ExoCanvas options={{ canvas: { width: 1280, height: 720 }, clearColor: Color.black }} style={{ width: 1280, height: 720 }}>
37
30
  <Scenes active="game" transition={{ type: 'fade', duration: 300 }}>
38
31
  <Scene name="title" component={TitleScene} />
39
32
  <Scene name="game" component={GameScene}>
@@ -50,8 +43,7 @@ function Hud() {
50
43
  }
51
44
  ```
52
45
 
53
- Layout props (`style`, `className`, …) apply to the **wrapper**; size it to
54
- drive `'fill'`/`'letterbox'` sizing. Style the canvas itself via `canvasProps`.
46
+ Layout props (`style`, `className`, …) apply to the **wrapper**; size it to drive `'fill'`/`'letterbox'` sizing. Style the canvas itself via `canvasProps`.
55
47
 
56
48
  ## Quick start — headless hook (full control)
57
49
 
@@ -81,19 +73,14 @@ function Game() {
81
73
 
82
74
  ### Reactivity model
83
75
 
84
- The `Application` is recreated only when an **identity** option changes — the
85
- render `backend` (WebGL2 ↔ WebGPU cannot be hot-swapped). Other supported options
86
- are applied **live**:
76
+ The `Application` is recreated only when an **identity** option changes — the render `backend` (WebGL2 ↔ WebGPU cannot be hot-swapped). Other supported options are applied **live**:
87
77
 
88
78
  - `canvas.width` / `canvas.height` → `app.resize(...)`
89
79
  - `clearColor` → `app.clearColor`
90
80
 
91
- Options without a live setter (`canvas.pixelRatio`, `seed`, `extensions`, …) are
92
- captured at creation; change the `backend` or remount to apply them.
81
+ Options without a live setter (`canvas.pixelRatio`, `seed`, `extensions`, …) are captured at creation; change the `backend` or remount to apply them.
93
82
 
94
- `canvas.sizing` is captured at creation as well: a sizing policy is an object, so
95
- a fresh instance on every render would detach and re-attach the previous one each
96
- time. Assign `app.sizing` yourself to switch strategies at runtime.
83
+ `canvas.sizing` is captured at creation as well: a sizing policy is an object, so a fresh instance on every render would detach and re-attach the previous one each time. Assign `app.sizing` yourself to switch strategies at runtime.
97
84
 
98
85
  ## License
99
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexo/exojs-react",
3
- "version": "0.16.2",
3
+ "version": "0.18.0",
4
4
  "description": "React integration for ExoJS.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "LICENSE"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@codexo/exojs": "0.16.x",
29
+ "@codexo/exojs": "0.18.x",
30
30
  "react": ">=18.0.0",
31
31
  "react-dom": ">=18.0.0"
32
32
  },
@@ -41,8 +41,8 @@
41
41
  "@types/react": "^19.2.17",
42
42
  "eslint": "~10.9.1",
43
43
  "eslint-config-prettier": "^10.1.8",
44
- "@codexo/exojs": "0.16.2",
45
- "@codexo/exojs-config": "0.0.0"
44
+ "@codexo/exojs-config": "0.0.0",
45
+ "@codexo/exojs": "0.18.0"
46
46
  },
47
47
  "license": "MIT",
48
48
  "publishConfig": {