@vuer-ai/vuer
v0.1.0
Published
Keywords
Readme
@vuer-ai/vuer: A 3D Visualization Component Library for NeRFs, Gaussian Splatting, and More
This repository contains the core component library vuer-ts, for mixed AR and VR tooling for robotics.
Notes on CommonJS: This is an ESM-only module.
Install
pnpm add @vuer-ai/vuer react@^19 react-dom@^19 three @react-three/fiber@^9 @react-three/drei@^10 @react-three/xr@^6 \
@react-three/postprocessing@^3 leva zustand jotai immer camera-controls three-stdlib three-mesh-bvh \
three-gpu-pathtracer react-error-boundary react-gamepads react-reconciler react-streaming react-use-websocket \
@vuer-ai/react-helmet-asyncThe peer dependencies use version ranges: React 19, @react-three/fiber 9 and three 0.178 or later.
The @vuer-ai/vuer/workspace entry (editor panels) also needs the optional peer @dreamlake/uikit (see below).
@types/react and @types/react-dom are optional peers for TypeScript users.
Development
The package installs and builds on its own (pnpm install && pnpm typecheck && pnpm test && pnpm build),
or as packages/vuer-ts inside vuer-web-workspace. In the workspace, keep one copy of @types/react
and @types/three (root pnpm.overrides), otherwise tsc reports duplicate-type JSX errors.
Library mode (no server)
You can embed a vuer scene in any React 19 app without a Python server or a
WebSocket. The main @vuer-ai/vuer entry has everything for this and does
not import a UI kit.
VuerScene takes the scene as a prop (a Scene props object or a list of
nodes), and gives an imperative handle with the same operations as the
Python session.set / add / update / upsert / remove:
import { useRef } from 'react';
import { VuerScene, type VuerSceneHandle } from '@vuer-ai/vuer';
export function Viewer() {
const scene = useRef<VuerSceneHandle>(null);
return (
<>
<VuerScene
ref={scene}
scene={[{ tag: 'Box', key: 'box', args: [0.2, 0.2, 0.2] }]}
onEvent={(e) => console.log(e.etype, e.key, e.value)}
style={{ height: 480 }}
/>
<button
onClick={() => scene.current?.update({ key: 'box', position: [0, 0.5, 0] })}
>
Lift
</button>
</>
);
}- A new
sceneprop value replaces the scene. Leavesceneout to drive the scene only through the handle. onEventreceives the client events that would go to a server (clicks, camera moves,ON_MUJOCO_FRAME, ...). Events markedsilentare skipped.- The page URL's
?scene=parameter is ignored (loadSceneFromUrl={false}). - The scene lives in the shared
useSceneStore: one vuer scene per page.
To use vuer components inside your own react-three-fiber <Canvas> (for
example <MuJoCo> from @vuer-ai/mujoco-ts), wrap them in
VuerLocalProvider. It provides the socket context that useSocket()
needs, with no WebSocket. It replaces hand-written no-op socket shims:
import { Canvas } from '@react-three/fiber';
import { VuerLocalProvider } from '@vuer-ai/vuer';
<Canvas>
<VuerLocalProvider onEvent={(e) => e.etype === 'ON_MUJOCO_LOAD' && setReady(true)}>
<MuJoCo src={src} />
</VuerLocalProvider>
</Canvas>;createLocalSocket(onEvent) returns the same context value without React,
for code that provides SocketContext itself.
Testing scenes without WebGL
pnpm test:render mounts scenes with @react-three/test-renderer (vitest,
jsdom, no GPU). See src/vuer/library/scene.render.test.tsx: it applies
handle operations and asserts on the resulting three.js scene graph. These
tests load the full component tree, so they run locally and are not part
of pnpm test.
Entries, UI kit and theme
@vuer-ai/vuer(main entry) has no UI-kit dependency.@vuer-ai/vuer/workspace(SimpleVuer, the scene graph, properties and workspace panels) uses@dreamlake/uikit^0.3.0, an optional peer. Install it and load its tokens:@import "tailwindcss"; @import "@dreamlake/uikit/styles.css"; @source "../node_modules/@dreamlake/uikit/dist"; @source "../node_modules/@vuer-ai/vuer/dist";Vuer follows the host theme and has no theme switch.
useHostTheme()(main entry) resolves it in this order: a{ type: 'theme', theme }message from the parent window (DreamLake artifact host, orsource: 'vuer-host'for any other page),?theme=/#theme=on the URL, the host page'shtml[data-theme], thenprefers-color-scheme. When Vuer owns the document (its own page or an iframe) it writeshtml[data-theme]; it never writes when the host page already sets it.The panel layout (floating or docked) is a two-way button group above the panels;
?layout=docksets the initial value.
Selection and Transform System
The library includes a complete selection and transform control system for interactive 3D editing:
Features
- Object Selection: Click any 3D object to select it (when
editMode=true) - Transform Controls: Real-time translation, rotation, and scaling via 3D gizmos
- Visual Feedback: Bounding boxes and transform handles around selected objects
- State Management: Selection state tracked in
EditorStore - WebSocket Sync: Transform changes sync automatically via WebSocket
Components
EditorStore: Manages selection state (selectedNodeKey)VuerTransformControl: Custom 3D transform widget with axis arrows, plane sliders, rotation rings, and scaling spheresEditorTransformControls: Wrapper that converts transform events to scene updatesEditorControl: Conditionally renders transform controls when objects are selectedHydrate: Adds click handlers to scene objects in edit mode
Usage
Set editMode={true} on SceneContainer to enable the selection and transform system. See vuer-web implementation for example usage.
To build:
yarn buildYou can preview the build via
yarn previewQA Pairs
A QA Pair is a library paired with its primary consumer — the package or app you run to manually verify that the library works end-to-end.
| Library | QA Consumer | How to Test |
|---------|------------|-------------|
| @vuer-ai/vuer | vuer-web | Run vuer-web locally with a linked local build of vuer-ts |
| @vuer-ai/vuer | vuer-lab | Run vuer-lab with yarn clean-link && yarn link-src for local dev |
