@ignifx/editor-host 0.19.0 → 0.20.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignifx/editor-host",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "ignifx editor host: runs a project's own engine inside the ignifx editor's scene view and play view, over a versioned protocol.",
5
5
  "keywords": [
6
6
  "ignifx"
@@ -52,19 +52,19 @@
52
52
  "typescript-native": "npm:typescript@7.0.2",
53
53
  "vite": "^8.2.2",
54
54
  "vitest": "^5.0.0",
55
- "@ignifx/2d": "0.19.0",
56
- "@ignifx/3d": "0.19.0",
57
- "@ignifx/core": "0.19.0",
58
- "@ignifx/input": "0.19.0",
59
- "@ignifx/physics": "0.19.0",
60
- "@ignifx/physics-2d": "0.19.0",
61
- "@ignifx/vite-plugin": "0.19.0"
55
+ "@ignifx/2d": "0.20.0",
56
+ "@ignifx/3d": "0.20.0",
57
+ "@ignifx/core": "0.20.0",
58
+ "@ignifx/input": "0.20.0",
59
+ "@ignifx/physics": "0.20.0",
60
+ "@ignifx/physics-2d": "0.20.0",
61
+ "@ignifx/vite-plugin": "0.20.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@babylonjs/lite": "1.34.0",
65
65
  "vite": "^8.2.2",
66
- "@ignifx/core": "0.19.0",
67
- "@ignifx/vite-plugin": "0.19.0"
66
+ "@ignifx/core": "0.20.0",
67
+ "@ignifx/vite-plugin": "0.20.0"
68
68
  },
69
69
  "peerDependenciesMeta": {
70
70
  "@ignifx/vite-plugin": {
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: editor-host
3
- description: Connects an ignifx project to the ignifx editor with @ignifx/editor-host: the Vite plugin that serves the editor's scene view from the project's own dev server, the virtual:ignifx/editor play controls a game's main.ts hands its app to (play, pause, step, stop, playState, playStateChanged, playStats, screenshot, queryRuntime, sendInput), and the host half of the editor protocol 0.3 over a MessagePort (hello/ready, heartbeat, and the scene document methods openScene, applyOps, readBack, select, pick, frame, setGizmo, setViewMode, screenshot, getSchemas, describeSettings, setAnimateMaterials, getColliderOutlines, sampleAnimation, sampleSpriteAnimation), including the 2D view mode. Use when wiring a project or template for the editor, when the user mentions @ignifx/editor-host, editorHostPlugin, attachEditorPlayControls, virtual:ignifx/editor, startEditorHost or /__ignifx_editor__/, or when debugging why the editor cannot connect to a view or why the scene view disagrees with the editor's document.
3
+ description: Connects an ignifx project to the ignifx editor with @ignifx/editor-host: the Vite plugin that serves the editor's scene view from the project's own dev server, the virtual:ignifx/editor play controls a game's main.ts hands its app to (play, pause, step, stop, playState, playStateChanged, playStats, screenshot, queryRuntime, sendInput), and the host half of the editor protocol 0.3 over a MessagePort (hello/ready, heartbeat, and the scene document methods openScene, applyOps, readBack, select, pick, pickRect, frame, setGizmo, setViewMode, screenshot, getSchemas, describeSettings, setAnimateMaterials, getColliderOutlines, sampleAnimation, sampleSpriteAnimation), including the 2D view mode. Use when wiring a project or template for the editor, when the user mentions @ignifx/editor-host, editorHostPlugin, attachEditorPlayControls, virtual:ignifx/editor, startEditorHost or /__ignifx_editor__/, or when debugging why the editor cannot connect to a view or why the scene view disagrees with the editor's document.
4
4
  license: Apache-2.0
5
5
  metadata:
6
- ignifx-version: "0.19.0"
6
+ ignifx-version: "0.20.0"
7
7
  ---
8
8
 
9
9
  # @ignifx/editor-host
@@ -25,7 +25,7 @@ editor's, even though its name starts with `editor-`.
25
25
 
26
26
  ## Environment
27
27
 
28
- - Engine: ignifx `0.19.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
28
+ - Engine: ignifx `0.20.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
29
29
  - Peers: `@ignifx/core` and `@babylonjs/lite` (the scene view's gizmos); for the `./vite` entry,
30
30
  `@ignifx/vite-plugin` and `vite`.
31
31
  - A development dependency of the project, at the same version as its `@ignifx/core`.
@@ -69,7 +69,7 @@ each view ◀── MessagePort ──▶ editor JSON-RPC 2.0, protocol 0.3
69
69
  scene view: schemasChanged → openScene → applyOps… / readBack / select / pick / frame / setGizmo / screenshot
70
70
  / setViewMode / getSchemas / describeSettings (on request only)
71
71
  / setAnimateMaterials / getColliderOutlines / sampleAnimation / sampleSpriteAnimation
72
- / setGrid / setTilemapCells
72
+ / setGrid / setTilemapCells / pickRect (with a canvas)
73
73
  / setEditorLines / clearEditorLines (with a canvas)
74
74
  ← sceneOpened, selectionChanged, transformDragging/Dragged, hotReloaded, assetReloaded,
75
75
  hostError, log
@@ -139,27 +139,30 @@ host.dispose();
139
139
 
140
140
  `skills/ignifx/references/api/editor-host.md` and `editor-host-vite.md` have the generated surface.
141
141
 
142
- | Member | What it does |
143
- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
144
- | `editorHostPlugin(options)` (`/vite`) | The two Vite plugins: the scene view's page (dev only) and `virtual:ignifx/editor` |
145
- | `attachEditorPlayControls(app)` | From `virtual:ignifx/editor`: hands the game's app to the editor; returns a detach |
146
- | `startEditorHost(options)` | Starts the scene view's host and its edit-mode app; resolves to a disposable `EditorHost` |
147
- | `listenForEditorPlayControls(options)` | What `virtual:ignifx/editor` calls in development: keeps the editor's port until `attach(app)` starts the controls on it |
148
- | `startEditorPlayControls(app, options)` | The play controls on their own, listening from the call |
149
- | `EDITOR_CONNECT_MESSAGE_TYPE`, `isEditorConnectMessage` | The window message that carries the port, and its check |
150
- | `PROTOCOL_VERSION`, `RpcErrorCode`, `isRpcMessage`, `isPlayState` | The protocol 0.3 values and checks, mirrored from `@ignifx/editor-protocol`; before 1.0 the major and minor must both match |
151
- | `SceneMethod`, `SceneNotification`, `SceneOp`, `isApplyOpsParams`, … | The scene document methods, notifications, the thirteen ops, and their guards |
152
- | `EditorHost.editorScene` | The persistent `editor` scene instance holding the host's own objects |
153
- | `EditorHost.assetChanged(change)` | Reloads an asset changed on disk in place and sends `assetReloaded`; the generated page calls it on `ignifx:asset-changed` |
154
- | `PlayMethod`, `PlayState` | `play`, `pause`, `step`, `stop`, and what each answers; `playState` reads the state without changing it |
155
- | `PlayNotification`, `PlayPhase`, `isPlayStateReport` | `playStateChanged` and `playState`'s `{ state: "playing" \| "paused" \| "stopped", frameCount, time }` |
156
- | `PlayStats`, `isPlayStats` | `playStats`'s `{ fps, frameTimeMs, entityCount, frameCount }`: the newest second of `app.diagnostics` frames, the world's entities |
157
- | `HostCapability.hotReloadDefaults` | The scene view gives fields the document leaves out their new default after a script's hot reload |
158
- | `RenderViewMethod`, `HostCapability.gameView`, `.thumbnails` | `setGameView`/`gameViewFrame`: the document's own camera as an image; `renderThumbnail`: a model or prefab rendered alone |
159
- | `HostCapability.gameViewOnDemand`, `.gameViewSize`, `.gameView2d` | `gameViewFrame` answers while the host is hidden, takes `width`/`height`, and renders a `Camera2D` scene's sprites |
160
- | `HostCapability.logRelay`, `isAppErrorData`, `LoggedError` | Both views relay `log` (with the first `Error` a line carries), `hostError` (entity, component, phase, stack) and `hotReloaded` |
161
- | `HOST_TEXT_MAX_LENGTH`, `HOST_LIST_MAX_LENGTH` | The editor's caps on a report's strings (1 MiB) and lists (4096); both views clip to them, a string ending `… [clipped]` |
162
- | `EditorHostErrorCode` | `IGX-1801` bad origin, `IGX-1802` no window, `IGX-1803` bad option |
142
+ | Member | What it does |
143
+ | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
144
+ | `editorHostPlugin(options)` (`/vite`) | The two Vite plugins: the scene view's page (dev only) and `virtual:ignifx/editor` |
145
+ | `attachEditorPlayControls(app)` | From `virtual:ignifx/editor`: hands the game's app to the editor; returns a detach |
146
+ | `startEditorHost(options)` | Starts the scene view's host and its edit-mode app; resolves to a disposable `EditorHost` |
147
+ | `listenForEditorPlayControls(options)` | What `virtual:ignifx/editor` calls in development: keeps the editor's port until `attach(app)` starts the controls on it |
148
+ | `startEditorPlayControls(app, options)` | The play controls on their own, listening from the call |
149
+ | `EDITOR_CONNECT_MESSAGE_TYPE`, `isEditorConnectMessage` | The window message that carries the port, and its check |
150
+ | `PROTOCOL_VERSION`, `RpcErrorCode`, `isRpcMessage`, `isPlayState` | The protocol 0.3 values and checks, mirrored from `@ignifx/editor-protocol`; before 1.0 the major and minor must both match |
151
+ | `SceneMethod`, `SceneNotification`, `SceneOp`, `isApplyOpsParams`, … | The scene document methods, notifications, the thirteen ops, and their guards |
152
+ | `EditorHost.editorScene` | The persistent `editor` scene instance holding the host's own objects |
153
+ | `EditorHost.assetChanged(change)` | Reloads an asset changed on disk in place and sends `assetReloaded`; the generated page calls it on `ignifx:asset-changed` |
154
+ | `PlayMethod`, `PlayState` | `play`, `pause`, `step`, `stop`, and what each answers; `playState` reads the state without changing it |
155
+ | `PlayNotification`, `PlayPhase`, `isPlayStateReport` | `playStateChanged` and `playState`'s `{ state: "playing" \| "paused" \| "stopped", frameCount, time }` |
156
+ | `PlayStats`, `isPlayStats` | `playStats`'s `{ fps, frameTimeMs, entityCount, frameCount }`: the newest second of `app.diagnostics` frames, the world's entities |
157
+ | `HostCapability.hotReloadDefaults` | The scene view gives fields the document leaves out their new default after a script's hot reload |
158
+ | `RenderViewMethod`, `HostCapability.gameView`, `.thumbnails` | `setGameView`/`gameViewFrame`: the document's own camera as an image; `renderThumbnail`: a model or prefab rendered alone |
159
+ | `HostCapability.thumbnailMaterials`, `.thumbnailAtlases`, `.thumbnailTextures` | `renderThumbnail` also takes a `.material.json` (on a sphere), an `.atlas.json` and a `.png`/`.jpg`/`.jpeg`/`.webp` (fitted, transparent) |
160
+ | `LightProbeBakeMethod`, `HostCapability.bakeLightProbes`, `isBakeLightProbesResult` | `bakeLightProbes { volume, counts? \| spacing?, directLight?, sky?, rays? }` bakes a `LightProbeVolume` over the live world and answers the `.probes.json` document; `bakeProgress` (≤ 10/s), `cancelBake`; a document change cancels it |
161
+ | `SceneMethod.pickRect`, `HostCapability.pickRect`, `PICK_RECT_MAX_ENTITIES` | Box selection: the document entities whose drawn bounds a view rectangle overlaps or contains, capped at 2 000 with `truncated` |
162
+ | `HostCapability.gameViewOnDemand`, `.gameViewSize`, `.gameView2d` | `gameViewFrame` answers while the host is hidden, takes `width`/`height`, and renders a `Camera2D` scene's sprites |
163
+ | `HostCapability.logRelay`, `isAppErrorData`, `LoggedError` | Both views relay `log` (with the first `Error` a line carries), `hostError` (entity, component, phase, stack) and `hotReloaded` |
164
+ | `HOST_TEXT_MAX_LENGTH`, `HOST_LIST_MAX_LENGTH` | The editor's caps on a report's strings (1 MiB) and lists (4096); both views clip to them, a string ending `… [clipped]` |
165
+ | `EditorHostErrorCode` | `IGX-1801` bad origin, `IGX-1802` no window, `IGX-1803` bad option |
163
166
 
164
167
  ## Recipes
165
168
 
@@ -357,6 +360,12 @@ object `openScene` sends, through `world.loadSceneFile`; `readBack` answers with
357
360
  `ray: { origin, direction }` (world space, from the editor camera's `screenToRay` at the converted
358
361
  backing pixel) and, when the ray crosses `z = 0` ahead of the camera, `plane: [x, y, 0]`. A 3D
359
362
  editor drops an asset where `ray` meets `y = 0`; a 2D one uses `plane`.
363
+ - **Box selection is `pickRect`.** `pickRect { x0, y0, x1, y1, unit, mode? }` takes two opposite
364
+ corners in `pick`'s unit and answers `{ entities, truncated }`: the document entities whose drawn
365
+ bounds (each visible mesh's 8 bounds corners projected through the editor camera; sprites and
366
+ tilemaps too in 2D view mode) overlap the rectangle, or with `mode: "contain"` lie wholly inside
367
+ it and in front of the camera, in document order. A prefab member counts for its instance root,
368
+ as with `pick`; an entity that draws nothing (a light, an empty) is never listed.
360
369
  - **The 2D view mode needs a canvas, not a dependency.** On a canvas the host lists `viewMode2d` and
361
370
  `pick2d`. `openScene` and `sceneOpened` report `viewMode`: `"2d"` for `twoD.mode: "sprite"` or a
362
371
  scene whose cameras are all `Camera2D`. `setViewMode { mode: "2d" }` enables the host's own