Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: add game view panel, enhance output panel, fix preview restart

esengine93ca6aa0c09e
diff --git a/desktop/src-tauri/src/preview_server.rs b/desktop/src-tauri/src/preview_server.rs
index db177cbe2..52108d030 100644
--- a/desktop/src-tauri/src/preview_server.rs
+++ b/desktop/src-tauri/src/preview_server.rs
@@ -16,6 +16,7 @@ const MAX_PORT_ATTEMPTS: u16 = 10;
pub struct PreviewServer {
server: Option<Arc<Server>>,
+ worker_handle: Option<thread::JoinHandle<()>>,
reload_signal: Arc<ReloadSignal>,
project_dir: PathBuf,
port: u16,
@@ -71,6 +72,7 @@ impl PreviewServer {
pub fn new(project_dir: PathBuf, port: u16) -> Self {
Self {
server: None,
+ worker_handle: None,
reload_signal: Arc::new(ReloadSignal::new()),
project_dir,
port,
@@ -91,7 +93,7 @@ impl PreviewServer {
let project_dir = self.project_dir.clone();
let reload_signal = Arc::clone(&self.reload_signal);
- thread::spawn(move || {
+ let handle = thread::spawn(move || {
for request in server.incoming_requests() {
let url = request.url().to_string();
let path = url.trim_start_matches('/');
@@ -128,6 +130,7 @@ impl PreviewServer {
let _ = request.respond(response);
}
});
+ self.worker_handle = Some(handle);
Ok(self.port)
}
@@ -138,6 +141,9 @@ impl PreviewServer {
server.unblock();
}
self.server = None;
+ if let Some(handle) = self.worker_handle.take() {
+ let _ = handle.join();
+ }
}
pub fn notify_reload(&self) {
diff --git a/desktop/src-tauri/src/preview_template.html b/desktop/src-tauri/src/preview_template.html
index c79f71e4c..f62a758f4 100644
--- a/desktop/src-tauri/src/preview_template.html
+++ b/desktop/src-tauri/src/preview_template.html
@@ -94,17 +94,44 @@
});
}
+ function fetchWithRetry(url, options = {}, maxRetries = 3) {
+ let attempt = 0;
+ async function tryFetch() {
+ try {
+ const resp = await fetch(url, options);
+ if (!resp.ok) throw new Error(`HTTP ${resp.status} for ${url}`);
+ return resp;
+ } catch (err) {
+ attempt++;
+ if (attempt >= maxRetries) throw err;
+ await new Promise(r => setTimeout(r, 500 * attempt));
+ return tryFetch();
+ }
+ }
+ return tryFetch();
+ }
+
+ function withTimeout(promise, ms, label) {
+ return Promise.race([
+ promise,
+ new Promise((_, reject) =>
+ setTimeout(() => reject(new Error(`${label} timed out after ${ms / 1000}s`)), ms)
+ ),
+ ]);
+ }
+
async function loadPreview() {
let step = 'init';
try {
step = 'load WASM module';
updateLoading('Loading WASM module...');
- const ModuleLoader = await import('/wasm/esengine.js');
- const Module = await ModuleLoader.default();
+ await fetchWithRetry('/wasm/esengine.js');
+ const ModuleLoader = await withTimeout(import('/wasm/esengine.js'), 30000, 'WASM module import');
+ const Module = await withTimeout(ModuleLoader.default(), 30000, 'WASM instantiation');
step = 'load SDK';
updateLoading('Loading SDK...');
- const sdk = await import('/sdk/index.js');
+ const sdk = await withTimeout(import('/sdk/index.js'), 30000, 'SDK import');
let spinePlugin = null;
let physicsPlugin = null;
@@ -195,7 +222,7 @@
app.addPlugin(previewPlugin);
step = 'waitForReady (scene load)';
- await previewPlugin.waitForReady();
+ await withTimeout(previewPlugin.waitForReady(), 30000, 'scene loading');
if (app.physicsInitPromise) {
step = 'physics init';
diff --git a/editor/src/panels/OutputPanel.ts b/editor/src/panels/OutputPanel.ts
index 90121b111..7e22c5736 100644
--- a/editor/src/panels/OutputPanel.ts
+++ b/editor/src/panels/OutputPanel.ts
@@ -1,57 +1,155 @@
import type { PanelInstance } from './PanelRegistry';
import { icons } from '../utils/icons';
+type OutputType = 'command' | 'stdout' | 'stderr' | 'error' | 'success';
+
+const MAX_LINES = 5000;
+
+const TYPE_LABELS: Record<OutputType, string> = {
+ command: 'Cmd',
+ stdout: 'Out',
+ stderr: 'Warn',
+ error: 'Error',
+ success: 'OK',
+};
+
+interface LogEntry {
+ text: string;
+ type: OutputType;
+ timestamp: string;
+ el: HTMLElement;
+ repeatCount: number;
+ groupId: string;
+}
+
+function formatTimestamp(): string {
+ const d = new Date();
+ const h = String(d.getHours()).padStart(2, '0');
+ const m = String(d.getMinutes()).padStart(2, '0');
+ const s = String(d.getSeconds()).padStart(2, '0');
+ return `${h}:${m}:${s}`;
+}
+
export class OutputPanel implements PanelInstance {
private container_: HTMLElement;
private contentEl_: HTMLElement | null = null;
- private lastText_: string = '';
- private lastType_: string = '';
- private lastLine_: HTMLElement | null = null;
- private repeatCount_ = 0;
+ private entries_: LogEntry[] = [];
+ private lastEntry_: LogEntry | null = null;
+ private autoScroll_ = true;
+ private searchText_ = '';
+ private activeFilters_ = new Set<OutputType>(['command', 'stdout', 'stderr', 'error', 'success']);
+ private typeCounts_ = new Map<OutputType, number>();
+ private currentGroupId_ = '';
+ private groupHeaders_ = new Map<string, HTMLElement>();
+ private collapsedGroups_ = new Set<string>();
+ private filterBtns_ = new Map<OutputType, HTMLElement>();
+ private scrollBtn_: HTMLElement | null = null;
+ private searchInput_: HTMLElement | null = null;
constructor(container: HTMLElement) {
this.container_ = container;
this.render();
}
- appendOutput(text: string, type: 'command' | 'stdout' | 'stderr' | 'error' | 'success'): void {
+ appendOutput(text: string, type: OutputType): void {
if (!this.contentEl_) return;
const empty = this.contentEl_.querySelector('.es-output-empty');
if (empty) empty.remove();
- if (text === this.lastText_ && type === this.lastType_ && this.lastLine_) {
- this.repeatCount_++;
- let badge = this.lastLine_.querySelector('.es-output-badge') as HTMLElement;
+ if (type === 'command') {
+ this.currentGroupId_ = text;
+ }
+
+ if (
+ this.lastEntry_ &&
+ text === this.lastEntry_.text &&
+ type === this.lastEntry_.type
+ ) {
+ this.lastEntry_.repeatCount++;
+ let badge = this.lastEntry_.el.querySelector('.es-output-badge') as HTMLElement;
if (!badge) {
badge = document.createElement('span');
badge.className = 'es-output-badge';
- this.lastLine_.prepend(badge);
+ this.lastEntry_.el.prepend(badge);
}
- badge.textContent = String(this.repeatCount_);
- this.contentEl_.scrollTop = this.contentEl_.scrollHeight;
+ badge.textContent = String(this.lastEntry_.repeatCount);
+ this.scrollIfNeeded();
return;
}
- this.lastText_ = text;
- this.lastType_ = type;
- this.repeatCount_ = 1;
+ const timestamp = formatTimestamp();
+ const groupId = this.currentGroupId_;
+
+ if (type === 'command' && groupId && !this.groupHeaders_.has(groupId)) {
+ const header = document.createElement('div');
+ header.className = 'es-output-group-header';
+ header.innerHTML = `<span class="es-output-group-toggle">${icons.chevronDown(10)}</span>`;
+ header.addEventListener('click', () => this.toggleGroup(groupId));
+ this.contentEl_.appendChild(header);
+ this.groupHeaders_.set(groupId, header);
+ }
const line = document.createElement('div');
line.className = `es-output-line es-output-${type}`;
- line.textContent = text;
+ if (groupId && type !== 'command') {
+ line.dataset.group = groupId;
+ }
+
+ const tsSpan = document.createElement('span');
+ tsSpan.className = 'es-output-timestamp';
+ tsSpan.textContent = timestamp;
+ line.appendChild(tsSpan);
+
+ const textNode = document.createTextNode(text);
+ line.appendChild(textNode);
+
+ const entry: LogEntry = {
+ text,
+ type,
+ timestamp,
+ el: line,
+ repeatCount: 1,
+ groupId,
+ };
+
+ this.entries_.push(entry);
+ this.lastEntry_ = entry;
+
+ this.typeCounts_.set(type, (this.typeCounts_.get(type) ?? 0) + 1);
+ this.updateFilterBadge(type);
+
+ if (this.entries_.length > MAX_LINES) {
+ this.trimOldest();
+ }
+
+ const visible = this.isEntryVisible(entry);
+ if (!visible) {
+ line.style.display = 'none';
+ }
+
+ if (groupId && type !== 'command' && this.collapsedGroups_.has(groupId)) {
+ line.style.display = 'none';
+ }
+
this.contentEl_.appendChild(line);
- this.lastLine_ = line;
- this.contentEl_.scrollTop = this.contentEl_.scrollHeight;
+ this.scrollIfNeeded();
+
+ line.addEventListener('contextmenu', (e) => this.showContextMenu(e, entry));
}
clear(): void {
if (!this.contentEl_) return;
this.contentEl_.innerHTML = '<div class="es-output-empty">No output messages</div>';
- this.lastText_ = '';
- this.lastType_ = '';
- this.lastLine_ = null;
- this.repeatCount_ = 0;
+ this.entries_ = [];
+ this.lastEntry_ = null;
+ this.typeCounts_.clear();
+ this.currentGroupId_ = '';
+ this.groupHeaders_.clear();
+ this.collapsedGroups_.clear();
+ for (const type of Object.keys(TYPE_LABELS) as OutputType[]) {
+ this.updateFilterBadge(type);
+ }
}
dispose(): void {
@@ -63,7 +161,14 @@ export class OutputPanel implements PanelInstance {
<div class="es-output-panel">
<div class="es-output-header">
<span class="es-output-title">${icons.list(14)} Output</span>
+ <div class="es-output-toolbar">
+ <div class="es-output-filters"></div>
+ <div class="es-output-search-wrap">
+ <input type="text" class="es-output-search" placeholder="Filter output..." spellcheck="false" />
+ </div>
+ </div>
<div class="es-output-actions">
+ <button class="es-btn es-btn-icon es-output-scroll-btn es-active" data-action="toggle-scroll" title="Auto-scroll">${icons.arrowDown(12)}</button>
<button class="es-btn es-btn-icon" data-action="clear-output" title="Clear">${icons.trash(12)}</button>
</div>
</div>
@@ -75,7 +180,169 @@ export class OutputPanel implements PanelInstance {
this.contentEl_ = this.container_.querySelector('.es-output-content');
+ const filtersEl = this.container_.querySelector('.es-output-filters')!;
+ for (const type of Object.keys(TYPE_LABELS) as OutputType[]) {
+ const btn = document.createElement('button');
+ btn.className = `es-btn es-btn-icon es-output-filter-btn es-active es-output-filter-${type}`;
+ btn.title = `Toggle ${type}`;
+ btn.innerHTML = `${TYPE_LABELS[type]} <span class="es-output-filter-count">0</span>`;
+ btn.addEventListener('click', () => this.toggleFilter(type));
+ filtersEl.appendChild(btn);
+ this.filterBtns_.set(type, btn);
+ }
+
+ this.scrollBtn_ = this.container_.querySelector('[data-action="toggle-scroll"]');
+ this.scrollBtn_?.addEventListener('click', () => this.toggleAutoScroll());
+
+ this.searchInput_ = this.container_.querySelector('.es-output-search');
+ this.searchInput_?.addEventListener('input', (e) => {
+ this.searchText_ = (e.target as HTMLInputElement).value.toLowerCase();
+ this.applyFilters();
+ });
+
const clearBtn = this.container_.querySelector('[data-action="clear-output"]');
clearBtn?.addEventListener('click', () => this.clear());
+
+ this.contentEl_?.addEventListener('scroll', () => {
+ if (!this.contentEl_) return;
+ const { scrollTop, scrollHeight, clientHeight } = this.contentEl_;
+ const atBottom = scrollHeight - scrollTop - clientHeight < 30;
+ if (atBottom && !this.autoScroll_) {
+ this.autoScroll_ = true;
+ this.scrollBtn_?.classList.add('es-active');
+ } else if (!atBottom && this.autoScroll_) {
+ this.autoScroll_ = false;
+ this.scrollBtn_?.classList.remove('es-active');
+ }
+ });
+ }
+
+ private toggleFilter(type: OutputType): void {
+ const btn = this.filterBtns_.get(type);
+ if (this.activeFilters_.has(type)) {
+ this.activeFilters_.delete(type);
+ btn?.classList.remove('es-active');
+ } else {
+ this.activeFilters_.add(type);
+ btn?.classList.add('es-active');
+ }
+ this.applyFilters();
+ }
+
+ private toggleAutoScroll(): void {
+ this.autoScroll_ = !this.autoScroll_;
+ if (this.autoScroll_) {
+ this.scrollBtn_?.classList.add('es-active');
+ this.scrollIfNeeded();
+ } else {
+ this.scrollBtn_?.classList.remove('es-active');
+ }
+ }
+
+ private toggleGroup(groupId: string): void {
+ const header = this.groupHeaders_.get(groupId);
+ if (!header) return;
+
+ if (this.collapsedGroups_.has(groupId)) {
+ this.collapsedGroups_.delete(groupId);
+ header.classList.remove('es-collapsed');
+ } else {
+ this.collapsedGroups_.add(groupId);
+ header.classList.add('es-collapsed');
+ }
+
+ for (const entry of this.entries_) {
+ if (entry.groupId === groupId && entry.type !== 'command') {
+ const hidden = this.collapsedGroups_.has(groupId) || !this.isEntryVisible(entry);
+ entry.el.style.display = hidden ? 'none' : '';
+ }
+ }
+ }
+
+ private isEntryVisible(entry: LogEntry): boolean {
+ if (!this.activeFilters_.has(entry.type)) return false;
+ if (this.searchText_ && !entry.text.toLowerCase().includes(this.searchText_)) return false;
+ return true;
+ }
+
+ private applyFilters(): void {
+ for (const entry of this.entries_) {
+ const visible = this.isEntryVisible(entry);
+ const collapsed = entry.groupId &&
+ entry.type !== 'command' &&
+ this.collapsedGroups_.has(entry.groupId);
+ entry.el.style.display = (!visible || collapsed) ? 'none' : '';
+ }
+ }
+
+ private updateFilterBadge(type: OutputType): void {
+ const btn = this.filterBtns_.get(type);
+ if (!btn) return;
+ const count = this.typeCounts_.get(type) ?? 0;
+ const badge = btn.querySelector('.es-output-filter-count') as HTMLElement;
+ if (badge) badge.textContent = String(count);
+ }
+
+ private trimOldest(): void {
+ const excess = this.entries_.length - MAX_LINES;
+ for (let i = 0; i < excess; i++) {
+ const entry = this.entries_[i];
+ entry.el.remove();
+ const count = (this.typeCounts_.get(entry.type) ?? 1) - 1;
+ if (count <= 0) {
+ this.typeCounts_.delete(entry.type);
+ } else {
+ this.typeCounts_.set(entry.type, count);
+ }
+ this.updateFilterBadge(entry.type);
+ }
+ this.entries_.splice(0, excess);
+ }
+
+ private scrollIfNeeded(): void {
+ if (this.autoScroll_ && this.contentEl_) {
+ this.contentEl_.scrollTop = this.contentEl_.scrollHeight;
+ }
+ }
+
+ private showContextMenu(e: MouseEvent, entry: LogEntry): void {
+ e.preventDefault();
+ const existing = document.querySelector('.es-output-context-menu');
+ if (existing) existing.remove();
+
+ const menu = document.createElement('div');
+ menu.className = 'es-output-context-menu';
+ menu.innerHTML = `
+ <div class="es-output-context-item" data-action="copy-line">Copy Line</div>
+ <div class="es-output-context-item" data-action="copy-all">Copy All</div>
+ `;
+
+ menu.style.left = `${e.clientX}px`;
+ menu.style.top = `${e.clientY}px`;
+ document.body.appendChild(menu);
+
+ const copyLine = menu.querySelector('[data-action="copy-line"]');
+ copyLine?.addEventListener('click', () => {
+ navigator.clipboard.writeText(`[${entry.timestamp}] ${entry.text}`);
+ menu.remove();
+ });
+
+ const copyAll = menu.querySelector('[data-action="copy-all"]');
+ copyAll?.addEventListener('click', () => {
+ const allText = this.entries_
+ .filter(e => this.isEntryVisible(e))
+ .map(e => `[${e.timestamp}] ${e.text}`)
+ .join('\n');
+ navigator.clipboard.writeText(allText);
+ menu.remove();
+ });
+
+ const dismiss = (ev: MouseEvent) => {
+ if (!menu.contains(ev.target as Node)) {
+ menu.remove();
+ document.removeEventListener('click', dismiss);
+ }
+ };
+ setTimeout(() => document.addEventListener('click', dismiss), 0);
}
}
diff --git a/editor/src/panels/builtinPanels.ts b/editor/src/panels/builtinPanels.ts
index e5429060f..4b45a6691 100644
--- a/editor/src/panels/builtinPanels.ts
+++ b/editor/src/panels/builtinPanels.ts
@@ -2,6 +2,7 @@ import { registerPanel } from './PanelRegistry';
import { HierarchyPanel } from './hierarchy/HierarchyPanel';
import { InspectorPanel } from './InspectorPanel';
import { SceneViewPanel } from './scene-view/SceneViewPanel';
+import { GameViewPanel } from './game-view/GameViewPanel';
import { ContentBrowserPanel } from './content-browser/ContentBrowserPanel';
import { OutputPanel } from './OutputPanel';
import { icons } from '../utils/icons';
@@ -31,6 +32,16 @@ export function registerBuiltinPanels(options: BuiltinPanelOptions): void {
factory: (c, s) => new SceneViewPanel(c, s, { projectPath: options.projectPath }),
});
+ registerPanel({
+ id: 'game',
+ title: 'Game',
+ icon: icons.play(14),
+ position: 'center',
+ order: 1,
+ defaultVisible: false,
+ factory: (c, s) => new GameViewPanel(c, s, { projectPath: options.projectPath }),
+ });
+
registerPanel({
id: 'inspector',
title: 'Inspector',
diff --git a/editor/src/panels/game-view/GameInstanceManager.ts b/editor/src/panels/game-view/GameInstanceManager.ts
new file mode 100644
index 000000000..dbef2596c
--- /dev/null
+++ b/editor/src/panels/game-view/GameInstanceManager.ts
@@ -0,0 +1,207 @@
+import type { App, ESEngineModule, SceneData } from 'esengine';
+import { createWebApp, loadRuntimeScene, type RuntimeAssetProvider } from 'esengine';
+import type { SceneData as EditorSceneData } from '../../types/SceneTypes';
+import { getPlatformAdapter } from '../../platform/PlatformAdapter';
+import { isUUID, getAssetLibrary } from '../../asset/AssetDatabase';
+
+export type GameState = 'stopped' | 'playing' | 'paused';
+
+export interface GameInstanceCallbacks {
+ onStateChange(state: GameState): void;
+ onFpsUpdate(fps: number): void;
+ onError(error: Error): void;
+}
+
+class EditorRuntimeAssetProvider implements RuntimeAssetProvider {
+ private projectDir_: string;
+
+ constructor(projectDir: string) {
+ this.projectDir_ = projectDir;
+ }
+
+ async loadPixels(ref: string): Promise<{ width: number; height: number; pixels: Uint8Array }> {
+ const resolved = this.resolvePath(ref);
+ const url = getPlatformAdapter().convertFilePathToUrl(`${this.projectDir_}/${resolved}`);
+ const img = await this.loadImage(url);
+ const canvas = document.createElement('canvas');
+ canvas.width = img.width;
+ canvas.height = img.height;
+ const ctx = canvas.getContext('2d')!;
+ ctx.drawImage(img, 0, 0);
+ const imageData = ctx.getImageData(0, 0, img.width, img.height);
+ return { width: img.width, height: img.height, pixels: new Uint8Array(imageData.data.buffer) };
+ }
+
+ async readText(ref: string): Promise<string> {
+ const resolved = this.resolvePath(ref);
+ const url = getPlatformAdapter().convertFilePathToUrl(`${this.projectDir_}/${resolved}`);
+ const resp = await fetch(url);
+ return resp.text();
+ }
+
+ async readBinary(ref: string): Promise<Uint8Array> {
+ const resolved = this.resolvePath(ref);
+ const url = getPlatformAdapter().convertFilePathToUrl(`${this.projectDir_}/${resolved}`);
+ const resp = await fetch(url);
+ const buf = await resp.arrayBuffer();
+ return new Uint8Array(buf);
+ }
+
+ resolvePath(ref: string): string {
+ if (isUUID(ref)) {
+ return getAssetLibrary().getPath(ref) ?? ref;
+ }
+ return ref;
+ }
+
+ private loadImage(url: string): Promise<HTMLImageElement> {
+ return new Promise((resolve, reject) => {
+ const img = new Image();
+ img.onload = () => resolve(img);
+ img.onerror = () => reject(new Error(`Failed to load image: ${url}`));
+ img.src = url;
+ });
+ }
+}
+
+export class GameInstanceManager {
+ private app_: App | null = null;
+ private editorModule_: ESEngineModule | null = null;
+ private state_: GameState = 'stopped';
+ private callbacks_: GameInstanceCallbacks;
+ private canvasSelector_ = '';
+ private projectDir_ = '';
+ private frameCount_ = 0;
+ private lastFpsTime_ = 0;
+ private fpsInterval_: ReturnType<typeof setInterval> | null = null;
+
+ constructor(callbacks: GameInstanceCallbacks) {
+ this.callbacks_ = callbacks;
+ }
+
+ get state(): GameState {
+ return this.state_;
+ }
+
+ setEditorModule(module: ESEngineModule): void {
+ this.editorModule_ = module;
+ }
+
+ setProjectDir(projectDir: string): void {
+ this.projectDir_ = projectDir;
+ }
+
+ setCanvasSelector(selector: string): void {
+ this.canvasSelector_ = selector;
+ }
+
+ async play(sceneData: EditorSceneData): Promise<void> {
+ if (this.state_ === 'paused') {
+ this.resume();
+ return;
+ }
+
+ if (this.state_ === 'playing') return;
+ if (!this.editorModule_) {
+ this.callbacks_.onError(new Error('WASM module not available'));
+ return;
+ }
+
+ try {
+ this.editorModule_.shutdownRenderer();
+
+ const success = this.editorModule_.initRendererWithCanvas(this.canvasSelector_);
+ if (!success) {
+ this.callbacks_.onError(new Error('Failed to initialize WebGL context for Game View'));
+ return;
+ }
+
+ const canvasSelector = this.canvasSelector_;
+ const getViewportSize = () => {
+ const canvas = document.querySelector(canvasSelector) as HTMLCanvasElement;
+ if (!canvas) return { width: 0, height: 0 };
+ return { width: canvas.width, height: canvas.height };
+ };
+
+ this.app_ = createWebApp(this.editorModule_, { getViewportSize });
+
+ const sdkSceneData = JSON.parse(JSON.stringify(sceneData)) as SceneData;
+ const provider = new EditorRuntimeAssetProvider(this.projectDir_);
+ await loadRuntimeScene(this.app_, this.editorModule_, sdkSceneData, provider);
+
+ this.app_.run();
+ this.setState('playing');
+ this.startFpsCounter();
+ } catch (e) {
+ this.stop();
+ this.callbacks_.onError(e instanceof Error ? e : new Error(String(e)));
+ }
+ }
+
+ pause(): void {
+ if (this.state_ !== 'playing' || !this.app_) return;
+ this.setState('paused');
+ }
+
+ private resume(): void {
+ if (this.state_ !== 'paused' || !this.app_) return;
+ this.setState('playing');
+ }
+
+ step(): void {
+ if (this.state_ !== 'paused') return;
+ }
+
+ stop(): void {
+ if (this.app_) {
+ try {
+ this.app_.quit();
+ } catch (e) {
+ console.warn('[GameView] Error during quit:', e);
+ }
+ this.app_ = null;
+ }
+
+ this.stopFpsCounter();
+ this.setState('stopped');
+ }
+
+ dispose(): void {
+ this.stop();
+ this.editorModule_ = null;
+ }
+
+ private setState(state: GameState): void {
+ this.state_ = state;
+ this.callbacks_.onStateChange(state);
+ }
+
+ private startFpsCounter(): void {
+ this.frameCount_ = 0;
+ this.lastFpsTime_ = performance.now();
+ this.fpsInterval_ = setInterval(() => {
+ const now = performance.now();
+ const elapsed = (now - this.lastFpsTime_) / 1000;
+ if (elapsed > 0) {
+ this.callbacks_.onFpsUpdate(Math.round(this.frameCount_ / elapsed));
+ }
+ this.frameCount_ = 0;
+ this.lastFpsTime_ = now;
+ }, 1000);
+
+ const countFrames = () => {
+ if (this.state_ === 'stopped') return;
+ this.frameCount_++;
+ requestAnimationFrame(countFrames);
+ };
+ requestAnimationFrame(countFrames);
+ }
+
+ private stopFpsCounter(): void {
+ if (this.fpsInterval_ !== null) {
+ clearInterval(this.fpsInterval_);
+ this.fpsInterval_ = null;
+ }
+ this.callbacks_.onFpsUpdate(0);
+ }
+}
diff --git a/editor/src/panels/game-view/GameViewPanel.ts b/editor/src/panels/game-view/GameViewPanel.ts
new file mode 100644
index 000000000..6b072b4fe
--- /dev/null
+++ b/editor/src/panels/game-view/GameViewPanel.ts
@@ -0,0 +1,157 @@
+import type { App } from 'esengine';
+import type { EditorStore } from '../../store/EditorStore';
+import type { AppAware, PanelInstance, Resizable } from '../PanelRegistry';
+import { GameInstanceManager, type GameState } from './GameInstanceManager';
+import { GameViewToolbar } from './GameViewToolbar';
+
+export interface GameViewPanelOptions {
+ projectPath?: string;
+}
+
+export class GameViewPanel implements PanelInstance, Resizable, AppAware {
+ private container_: HTMLElement;
+ private store_: EditorStore;
+ private app_: App | null = null;
+ private projectPath_: string | null;
+ private canvas_: HTMLCanvasElement | null = null;
+ private canvasId_: string;
+ private toolbar_: GameViewToolbar;
+ private gameManager_: GameInstanceManager;
+ private viewport_: HTMLElement | null = null;
+ private resizeObserver_: ResizeObserver | null = null;
+ private placeholder_: HTMLElement | null = null;
+
+ constructor(container: HTMLElement, store: EditorStore, options?: GameViewPanelOptions) {
+ this.container_ = container;
+ this.store_ = store;
+ this.projectPath_ = options?.projectPath ?? null;
+ this.canvasId_ = `es-gameview-canvas-${Date.now()}`;
+
+ this.gameManager_ = new GameInstanceManager({
+ onStateChange: (state) => this.onStateChange(state),
+ onFpsUpdate: (fps) => this.toolbar_.updateFps(fps),
+ onError: (err) => console.error('[GameView]', err.message),
+ });
+
+ this.toolbar_ = new GameViewToolbar(container, {
+ onPlay: () => this.play(),
+ onPause: () => this.gameManager_.pause(),
+ onStep: () => this.gameManager_.step(),
+ onStop: () => this.gameManager_.stop(),
+ onResolutionChange: () => this.updateCanvasSize(),
+ });
+
+ this.buildUI();
+ }
+
+ setApp(app: App): void {
+ this.app_ = app;
+ if (app.wasmModule) {
+ this.gameManager_.setEditorModule(app.wasmModule);
+ }
+ }
+
+ resize(): void {
+ this.updateCanvasSize();
+ }
+
+ dispose(): void {
+ this.gameManager_.dispose();
+ this.toolbar_.dispose();
+ if (this.resizeObserver_) {
+ this.resizeObserver_.disconnect();
+ this.resizeObserver_ = null;
+ }
+ }
+
+ private buildUI(): void {
+ this.container_.className = 'es-gameview-panel';
+ this.container_.innerHTML = `
+ <div class="es-panel-header">
+ <span class="es-panel-title">Game</span>
+ <div class="es-gameview-tools">
+ ${this.toolbar_.buildHTML()}
+ </div>
+ </div>
+ <div class="es-gameview-viewport">
+ <canvas id="${this.canvasId_}" class="es-gameview-canvas"></canvas>
+ <div class="es-gameview-placeholder">
+ <span>Click Play to start</span>
+ </div>
+ </div>
+ `;
+
+ this.canvas_ = this.container_.querySelector(`#${this.canvasId_}`)!;
+ this.viewport_ = this.container_.querySelector('.es-gameview-viewport')!;
+ this.placeholder_ = this.container_.querySelector('.es-gameview-placeholder')!;
+
+ this.toolbar_.setup();
+
+ if (this.projectPath_) {
+ const projectDir = this.projectPath_.replace(/\\/g, '/').replace(/\/[^/]+$/, '');
+ this.gameManager_.setProjectDir(projectDir);
+ }
+
+ this.gameManager_.setCanvasSelector(`#${this.canvasId_}`);
+
+ this.resizeObserver_ = new ResizeObserver(() => this.updateCanvasSize());
+ this.resizeObserver_.observe(this.viewport_);
+
+ this.updateCanvasSize();
+ }
+
+ private play(): void {
+ if (!this.app_?.wasmModule) {
+ console.warn('[GameView] WASM module not available yet');
+ return;
+ }
+ this.gameManager_.setEditorModule(this.app_.wasmModule);
+ this.updateCanvasSize();
+ this.gameManager_.play(this.store_.scene);
+ }
+
+ private onStateChange(state: GameState): void {
+ this.toolbar_.updateState(state);
+
+ if (this.placeholder_) {
+ this.placeholder_.style.display = state === 'stopped' ? 'flex' : 'none';
+ }
+ if (this.canvas_) {
+ this.canvas_.style.display = state === 'stopped' ? 'none' : 'block';
+ }
+ }
+
+ private updateCanvasSize(): void {
+ if (!this.canvas_ || !this.viewport_) return;
+
+ const rect = this.viewport_.getBoundingClientRect();
+ const dpr = window.devicePixelRatio || 1;
+ const preset = this.toolbar_.currentPreset;
+
+ if (preset.width > 0 && preset.height > 0) {
+ const targetAspect = preset.width / preset.height;
+ const viewportAspect = rect.width / rect.height;
+
+ let displayW: number;
+ let displayH: number;
+
+ if (viewportAspect > targetAspect) {
+ displayH = rect.height;
+ displayW = displayH * targetAspect;
+ } else {
+ displayW = rect.width;
+ displayH = displayW / targetAspect;
+ }
+
+ this.canvas_.style.width = `${displayW}px`;
+ this.canvas_.style.height = `${displayH}px`;
+ this.canvas_.width = displayW * dpr;
+ this.canvas_.height = displayH * dpr;
+ } else {
+ this.canvas_.style.width = `${rect.width}px`;
+ this.canvas_.style.height = `${rect.height}px`;
+ this.canvas_.width = rect.width * dpr;
+ this.canvas_.height = rect.height * dpr;
+ }
+ }
+}
diff --git a/editor/src/panels/game-view/GameViewToolbar.ts b/editor/src/panels/game-view/GameViewToolbar.ts
new file mode 100644
index 000000000..6038fc26d
--- /dev/null
+++ b/editor/src/panels/game-view/GameViewToolbar.ts
@@ -0,0 +1,114 @@
+import { icons } from '../../utils/icons';
+import type { GameState } from './GameInstanceManager';
+
+export interface ResolutionPreset {
+ label: string;
+ width: number;
+ height: number;
+}
+
+const RESOLUTION_PRESETS: ResolutionPreset[] = [
+ { label: 'Free', width: 0, height: 0 },
+ { label: '16:9 (1920x1080)', width: 1920, height: 1080 },
+ { label: '9:16 (1080x1920)', width: 1080, height: 1920 },
+ { label: '4:3 (1024x768)', width: 1024, height: 768 },
+ { label: '3:4 (768x1024)', width: 768, height: 1024 },
+];
+
+export interface GameViewToolbarCallbacks {
+ onPlay(): void;
+ onPause(): void;
+ onStep(): void;
+ onStop(): void;
+ onResolutionChange(preset: ResolutionPreset): void;
+}
+
+export class GameViewToolbar {
+ private container_: HTMLElement;
+ private callbacks_: GameViewToolbarCallbacks;
+ private playBtn_: HTMLButtonElement | null = null;
+ private pauseBtn_: HTMLButtonElement | null = null;
+ private stepBtn_: HTMLButtonElement | null = null;
+ private stopBtn_: HTMLButtonElement | null = null;
+ private fpsDisplay_: HTMLSpanElement | null = null;
+ private resolutionSelect_: HTMLSelectElement | null = null;
+ private currentPreset_: ResolutionPreset = RESOLUTION_PRESETS[0];
+
+ constructor(container: HTMLElement, callbacks: GameViewToolbarCallbacks) {
+ this.container_ = container;
+ this.callbacks_ = callbacks;
+ }
+
+ buildHTML(): string {
+ const options = RESOLUTION_PRESETS.map((p, i) =>
+ `<option value="${i}">${p.label}</option>`
+ ).join('');
+
+ return `
+ <div class="es-gameview-toolbar">
+ <div class="es-gameview-controls">
+ <button class="es-btn es-btn-icon es-gameview-play" title="Play">${icons.play(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-pause" title="Pause" disabled>${icons.pause(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-step" title="Step Forward" disabled>${icons.stepForward(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-stop" title="Stop" disabled>${icons.stop(14)}</button>
+ </div>
+ <div class="es-toolbar-divider"></div>
+ <select class="es-gameview-resolution">${options}</select>
+ <span class="es-gameview-fps"></span>
+ </div>
+ `;
+ }
+
+ setup(): void {
+ this.playBtn_ = this.container_.querySelector('.es-gameview-play');
+ this.pauseBtn_ = this.container_.querySelector('.es-gameview-pause');
+ this.stepBtn_ = this.container_.querySelector('.es-gameview-step');
+ this.stopBtn_ = this.container_.querySelector('.es-gameview-stop');
+ this.fpsDisplay_ = this.container_.querySelector('.es-gameview-fps');
+ this.resolutionSelect_ = this.container_.querySelector('.es-gameview-resolution');
+
+ this.playBtn_?.addEventListener('click', () => this.callbacks_.onPlay());
+ this.pauseBtn_?.addEventListener('click', () => this.callbacks_.onPause());
+ this.stepBtn_?.addEventListener('click', () => this.callbacks_.onStep());
+ this.stopBtn_?.addEventListener('click', () => this.callbacks_.onStop());
+
+ this.resolutionSelect_?.addEventListener('change', () => {
+ const idx = parseInt(this.resolutionSelect_!.value, 10);
+ this.currentPreset_ = RESOLUTION_PRESETS[idx];
+ this.callbacks_.onResolutionChange(this.currentPreset_);
+ });
+ }
+
+ updateState(state: GameState): void {
+ if (!this.playBtn_) return;
+
+ const playing = state === 'playing';
+ const paused = state === 'paused';
+ const stopped = state === 'stopped';
+
+ this.playBtn_.disabled = playing;
+ this.pauseBtn_!.disabled = !playing;
+ this.stepBtn_!.disabled = !paused;
+ this.stopBtn_!.disabled = stopped;
+
+ this.playBtn_.classList.toggle('es-active', playing);
+ }
+
+ updateFps(fps: number): void {
+ if (!this.fpsDisplay_) return;
+ this.fpsDisplay_.textContent = fps > 0 ? `${fps} FPS` : '';
+ }
+
+ get currentPreset(): ResolutionPreset {
+ return this.currentPreset_;
+ }
+
+ dispose(): void {
+ this.playBtn_ = null;
+ this.pauseBtn_ = null;
+ this.stepBtn_ = null;
+ this.stopBtn_ = null;
+ this.fpsDisplay_ = null;
+ this.resolutionSelect_ = null;
+ }
+}
diff --git a/editor/src/panels/game-view/index.ts b/editor/src/panels/game-view/index.ts
new file mode 100644
index 000000000..8b898a914
--- /dev/null
+++ b/editor/src/panels/game-view/index.ts
@@ -0,0 +1,3 @@
+export { GameViewPanel, type GameViewPanelOptions } from './GameViewPanel';
+export { GameInstanceManager, type GameState, type GameInstanceCallbacks } from './GameInstanceManager';
+export { GameViewToolbar, type ResolutionPreset, type GameViewToolbarCallbacks } from './GameViewToolbar';
diff --git a/editor/src/panels/index.ts b/editor/src/panels/index.ts
index 1a3353b03..91c94620a 100644
--- a/editor/src/panels/index.ts
+++ b/editor/src/panels/index.ts
@@ -6,6 +6,7 @@
export { HierarchyPanel } from './hierarchy/HierarchyPanel';
export { InspectorPanel } from './InspectorPanel';
export { SceneViewPanel } from './scene-view/SceneViewPanel';
+export { GameViewPanel } from './game-view/GameViewPanel';
export { OutputPanel } from './OutputPanel';
export {
diff --git a/editor/src/preview/PreviewService.ts b/editor/src/preview/PreviewService.ts
index bb50b9e37..4d9b6a5c2 100644
--- a/editor/src/preview/PreviewService.ts
+++ b/editor/src/preview/PreviewService.ts
@@ -48,6 +48,8 @@ export class PreviewService {
return;
}
+ await this.stopPreview();
+
console.log('PreviewService: Preparing files in', this.previewDir_);
await this.preparePreviewFiles(fs, scene, compiledScript, spineVersion, enablePhysics, physicsConfig, runtimeConfig);
console.log('PreviewService: Files prepared');
diff --git a/editor/src/styles/builder.css b/editor/src/styles/builder.css
index 03d61afd8..4827b29eb 100644
--- a/editor/src/styles/builder.css
+++ b/editor/src/styles/builder.css
@@ -660,10 +660,11 @@
.es-output-header {
display: flex;
align-items: center;
- justify-content: space-between;
- padding: 6px 12px;
+ gap: 8px;
+ padding: 4px 8px;
background: var(--es-bg-secondary);
border-bottom: 1px solid var(--es-border);
+ flex-shrink: 0;
}
.es-output-title {
@@ -672,15 +673,85 @@
gap: 6px;
font-weight: 600;
font-size: 12px;
+ white-space: nowrap;
}
.es-output-title svg {
stroke: var(--es-text-secondary);
}
+.es-output-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex: 1;
+ min-width: 0;
+}
+
+.es-output-filters {
+ display: flex;
+ gap: 2px;
+ flex-shrink: 0;
+}
+
+.es-output-filter-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
+ padding: 2px 6px;
+ font-size: 11px;
+ border-radius: 3px;
+ color: var(--es-text-secondary);
+ opacity: 0.5;
+ cursor: pointer;
+}
+
+.es-output-filter-btn.es-active {
+ opacity: 1;
+ color: var(--es-text-primary);
+}
+
+.es-output-filter-command.es-active { color: var(--es-accent); }
+.es-output-filter-stderr.es-active { color: #e5c07b; }
+.es-output-filter-error.es-active { color: var(--es-danger); }
+.es-output-filter-success.es-active { color: var(--es-success); }
+
+.es-output-filter-count {
+ font-size: 10px;
+ opacity: 0.7;
+ min-width: 8px;
+ text-align: center;
+}
+
+.es-output-search-wrap {
+ flex: 1;
+ min-width: 60px;
+ max-width: 200px;
+}
+
+.es-output-search {
+ width: 100%;
+ padding: 2px 6px;
+ font-size: 11px;
+ border: 1px solid var(--es-border);
+ border-radius: 3px;
+ background: var(--es-bg-primary);
+ color: var(--es-text-primary);
+ outline: none;
+}
+
+.es-output-search:focus {
+ border-color: var(--es-accent);
+}
+
.es-output-actions {
display: flex;
- gap: 4px;
+ gap: 2px;
+ flex-shrink: 0;
+}
+
+.es-output-scroll-btn.es-active {
+ color: var(--es-accent);
}
.es-output-content {
@@ -750,6 +821,62 @@
color: var(--es-success);
}
+.es-output-timestamp {
+ color: var(--es-text-secondary);
+ opacity: 0.6;
+ margin-right: 8px;
+ font-size: 11px;
+ user-select: none;
+}
+
+.es-output-group-header {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ padding: 4px 0 2px;
+ cursor: pointer;
+ user-select: none;
+ border-top: 1px solid var(--es-border);
+ margin-top: 4px;
+}
+
+.es-output-group-header:first-child {
+ border-top: none;
+ margin-top: 0;
+}
+
+.es-output-group-toggle {
+ display: inline-flex;
+ transition: transform 0.15s;
+}
+
+.es-output-group-header.es-collapsed .es-output-group-toggle {
+ transform: rotate(-90deg);
+}
+
+.es-output-context-menu {
+ position: fixed;
+ z-index: 10000;
+ min-width: 120px;
+ padding: 4px 0;
+ background: var(--es-bg-secondary);
+ border: 1px solid var(--es-border);
+ border-radius: 4px;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
+}
+
+.es-output-context-item {
+ padding: 5px 12px;
+ font-size: 12px;
+ cursor: pointer;
+ color: var(--es-text-primary);
+}
+
+.es-output-context-item:hover {
+ background: var(--es-accent);
+ color: #fff;
+}
+
/* =============================================================================
* Build Settings Dialog - Three Column Layout
* ============================================================================= */
diff --git a/editor/src/styles/editor.css b/editor/src/styles/editor.css
index 93b536635..48d660dc6 100644
--- a/editor/src/styles/editor.css
+++ b/editor/src/styles/editor.css
@@ -2292,10 +2292,11 @@
.es-output-header {
display: flex;
align-items: center;
- justify-content: space-between;
- padding: 6px 12px;
+ gap: 8px;
+ padding: 4px 8px;
background: var(--es-bg-secondary);
border-bottom: 1px solid var(--es-border);
+ flex-shrink: 0;
}
.es-output-title {
@@ -2304,15 +2305,85 @@
gap: 6px;
font-weight: 600;
font-size: 12px;
+ white-space: nowrap;
}
.es-output-title svg {
stroke: var(--es-text-secondary);
}
+.es-output-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex: 1;
+ min-width: 0;
+}
+
+.es-output-filters {
+ display: flex;
+ gap: 2px;
+ flex-shrink: 0;
+}
+
+.es-output-filter-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
+ padding: 2px 6px;
+ font-size: 11px;
+ border-radius: 3px;
+ color: var(--es-text-secondary);
+ opacity: 0.5;
+ cursor: pointer;
+}
+
+.es-output-filter-btn.es-active {
+ opacity: 1;
+ color: var(--es-text-primary);
+}
+
+.es-output-filter-command.es-active { color: var(--es-accent); }
+.es-output-filter-stderr.es-active { color: #e5c07b; }
+.es-output-filter-error.es-active { color: var(--es-danger); }
+.es-output-filter-success.es-active { color: var(--es-success); }
+
+.es-output-filter-count {
+ font-size: 10px;
+ opacity: 0.7;
+ min-width: 8px;
+ text-align: center;
+}
+
+.es-output-search-wrap {
+ flex: 1;
+ min-width: 60px;
+ max-width: 200px;
+}
+
+.es-output-search {
+ width: 100%;
+ padding: 2px 6px;
+ font-size: 11px;
+ border: 1px solid var(--es-border);
+ border-radius: 3px;
+ background: var(--es-bg-primary);
+ color: var(--es-text-primary);
+ outline: none;
+}
+
+.es-output-search:focus {
+ border-color: var(--es-accent);
+}
+
.es-output-actions {
display: flex;
- gap: 4px;
+ gap: 2px;
+ flex-shrink: 0;
+}
+
+.es-output-scroll-btn.es-active {
+ color: var(--es-accent);
}
.es-output-content {
@@ -4171,6 +4242,62 @@
color: var(--es-success);
}
+.es-output-timestamp {
+ color: var(--es-text-secondary);
+ opacity: 0.6;
+ margin-right: 8px;
+ font-size: 11px;
+ user-select: none;
+}
+
+.es-output-group-header {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ padding: 4px 0 2px;
+ cursor: pointer;
+ user-select: none;
+ border-top: 1px solid var(--es-border);
+ margin-top: 4px;
+}
+
+.es-output-group-header:first-child {
+ border-top: none;
+ margin-top: 0;
+}
+
+.es-output-group-toggle {
+ display: inline-flex;
+ transition: transform 0.15s;
+}
+
+.es-output-group-header.es-collapsed .es-output-group-toggle {
+ transform: rotate(-90deg);
+}
+
+.es-output-context-menu {
+ position: fixed;
+ z-index: 10000;
+ min-width: 120px;
+ padding: 4px 0;
+ background: var(--es-bg-secondary);
+ border: 1px solid var(--es-border);
+ border-radius: 4px;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
+}
+
+.es-output-context-item {
+ padding: 5px 12px;
+ font-size: 12px;
+ cursor: pointer;
+ color: var(--es-text-primary);
+}
+
+.es-output-context-item:hover {
+ background: var(--es-accent);
+ color: #fff;
+}
+
/* =============================================================================
* Build Settings Dialog - Three Column Layout
* ============================================================================= */
diff --git a/editor/src/styles/game-view.css b/editor/src/styles/game-view.css
new file mode 100644
index 000000000..764e2aa25
--- /dev/null
+++ b/editor/src/styles/game-view.css
@@ -0,0 +1,89 @@
+/* =============================================================================
+ * GameView Panel
+ * ============================================================================= */
+
+.es-gameview-panel {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.es-gameview-tools {
+ display: flex;
+ align-items: center;
+}
+
+.es-gameview-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.es-gameview-controls {
+ display: flex;
+ gap: 2px;
+ background: var(--es-bg-tertiary);
+ border-radius: 4px;
+ padding: 2px;
+}
+
+.es-gameview-controls .es-btn-icon {
+ padding: 4px;
+ border-radius: 3px;
+}
+
+.es-gameview-controls .es-btn-icon:disabled {
+ opacity: 0.3;
+ cursor: default;
+}
+
+.es-gameview-controls .es-btn-icon:disabled:hover {
+ background: transparent;
+}
+
+.es-gameview-resolution {
+ background: var(--es-input-bg);
+ color: var(--es-text-primary);
+ border: 1px solid var(--es-border);
+ border-radius: 3px;
+ font-size: 11px;
+ padding: 2px 4px;
+ height: 22px;
+ outline: none;
+}
+
+.es-gameview-resolution:focus {
+ border-color: var(--es-accent);
+}
+
+.es-gameview-fps {
+ font-size: 11px;
+ color: var(--es-text-secondary);
+ min-width: 50px;
+ text-align: right;
+}
+
+.es-gameview-viewport {
+ flex: 1;
+ position: relative;
+ overflow: hidden;
+ background: #1a1a1a;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.es-gameview-canvas {
+ display: none;
+}
+
+.es-gameview-placeholder {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ color: var(--es-text-secondary);
+ font-size: 14px;
+ user-select: none;
+}
diff --git a/editor/src/styles/index.css b/editor/src/styles/index.css
index d98c752e1..6e8eb9066 100644
--- a/editor/src/styles/index.css
+++ b/editor/src/styles/index.css
@@ -4,6 +4,7 @@
@import './hierarchy.css';
@import './inspector.css';
@import './scene-view.css';
+@import './game-view.css';
@import './content-browser.css';
@import './dialogs.css';
@import './builder.css';
diff --git a/editor/src/utils/icons.ts b/editor/src/utils/icons.ts
index dfeae9eb3..7e728f97d 100644
--- a/editor/src/utils/icons.ts
+++ b/editor/src/utils/icons.ts
@@ -62,6 +62,8 @@ import {
Shield,
RotateCcw,
Clipboard,
+ Pause,
+ StepForward,
} from 'lucide';
// =============================================================================
@@ -180,6 +182,8 @@ export const icons = {
shield: (size?: number) => renderIcon(Shield as IconNode, size),
rotateCcw: (size?: number) => renderIcon(RotateCcw as IconNode, size),
clipboard: (size?: number) => renderIcon(Clipboard as IconNode, size),
+ pause: (size?: number) => renderIcon(Pause as IconNode, size),
+ stepForward: (size?: number) => renderIcon(StepForward as IconNode, size),
};
export type IconName = keyof typeof icons;
diff --git a/sdk/package.json b/sdk/package.json
index 1138dcc59..ee9a055fa 100644
--- a/sdk/package.json
+++ b/sdk/package.json
@@ -25,6 +25,10 @@
"./physics": {
"import": "./dist/physics/index.js",
"types": "./dist/physics/index.d.ts"
+ },
+ "./factory": {
+ "import": "./dist/webAppFactory.js",
+ "types": "./dist/webAppFactory.d.ts"
}
},
"files": [