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.

refactor: Separate editor into standalone package

esengine78b83f967b0a
diff --git a/editor/package.json b/editor/package.json
new file mode 100644
index 000000000..850f35b02
--- /dev/null
+++ b/editor/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "@esengine/editor",
+ "version": "0.1.0",
+ "type": "module",
+ "description": "Web-based scene editor for ESEngine",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "exports": {
+ ".": {
+ "import": "./dist/index.js",
+ "types": "./dist/index.d.ts"
+ }
+ },
+ "files": [
+ "dist"
+ ],
+ "scripts": {
+ "build": "rollup -c",
+ "watch": "rollup -c -w",
+ "clean": "rimraf dist"
+ },
+ "dependencies": {
+ "esengine": "workspace:*"
+ },
+ "devDependencies": {
+ "@rollup/plugin-typescript": "^11.1.5",
+ "rimraf": "^5.0.5",
+ "rollup": "^4.9.0",
+ "rollup-plugin-dts": "^6.1.0",
+ "tslib": "^2.6.2",
+ "typescript": "^5.3.0"
+ },
+ "author": "ESEngine Team",
+ "license": "MIT"
+}
diff --git a/editor/rollup.config.js b/editor/rollup.config.js
new file mode 100644
index 000000000..21a446232
--- /dev/null
+++ b/editor/rollup.config.js
@@ -0,0 +1,28 @@
+import typescript from '@rollup/plugin-typescript';
+import dts from 'rollup-plugin-dts';
+
+export default [
+ {
+ input: 'src/index.ts',
+ output: {
+ file: 'dist/index.js',
+ format: 'es',
+ },
+ external: ['esengine'],
+ plugins: [
+ typescript({
+ tsconfig: './tsconfig.json',
+ declaration: false,
+ }),
+ ],
+ },
+ {
+ input: 'src/index.ts',
+ output: {
+ file: 'dist/index.d.ts',
+ format: 'es',
+ },
+ external: ['esengine'],
+ plugins: [dts()],
+ },
+];
diff --git a/editor/src/Editor.ts b/editor/src/Editor.ts
new file mode 100644
index 000000000..367232187
--- /dev/null
+++ b/editor/src/Editor.ts
@@ -0,0 +1,205 @@
+/**
+ * @file Editor.ts
+ * @brief Main editor component
+ */
+
+import type { App } from 'esengine';
+import { EditorStore } from './store/EditorStore';
+import { EditorBridge } from './bridge/EditorBridge';
+import { HierarchyPanel } from './panels/HierarchyPanel';
+import { InspectorPanel } from './panels/InspectorPanel';
+import { SceneViewPanel } from './panels/SceneViewPanel';
+import { registerBuiltinEditors } from './property/editors';
+import { registerBuiltinSchemas } from './schemas/ComponentSchemas';
+import { saveSceneToFile, loadSceneFromFile } from './io/SceneSerializer';
+
+// =============================================================================
+// Editor
+// =============================================================================
+
+export class Editor {
+ private container_: HTMLElement;
+ private app_: App | null = null;
+ private store_: EditorStore;
+ private bridge_: EditorBridge | null = null;
+
+ private hierarchyPanel_: HierarchyPanel | null = null;
+ private inspectorPanel_: InspectorPanel | null = null;
+ private sceneViewPanel_: SceneViewPanel | null = null;
+
+ constructor(container: HTMLElement) {
+ this.container_ = container;
+ this.store_ = new EditorStore();
+
+ registerBuiltinEditors();
+ registerBuiltinSchemas();
+
+ this.setupLayout();
+ this.setupKeyboardShortcuts();
+ }
+
+ setApp(app: App): void {
+ this.app_ = app;
+ this.bridge_ = new EditorBridge(app, this.store_);
+
+ if (this.sceneViewPanel_) {
+ this.sceneViewPanel_.setBridge(this.bridge_);
+ }
+ }
+
+ get store(): EditorStore {
+ return this.store_;
+ }
+
+ // =========================================================================
+ // Scene Operations
+ // =========================================================================
+
+ newScene(): void {
+ this.store_.newScene();
+ }
+
+ async saveScene(): Promise<void> {
+ await saveSceneToFile(this.store_.scene);
+ this.store_.markSaved();
+ }
+
+ async loadScene(): Promise<void> {
+ const scene = await loadSceneFromFile();
+ if (scene) {
+ this.store_.loadScene(scene);
+ }
+ }
+
+ // =========================================================================
+ // Private Methods
+ // =========================================================================
+
+ private setupLayout(): void {
+ this.container_.className = 'es-editor';
+ this.container_.innerHTML = `
+ <div class="es-editor-toolbar">
+ <button class="es-btn" data-action="new">New</button>
+ <button class="es-btn" data-action="open">Open</button>
+ <button class="es-btn" data-action="save">Save</button>
+ <div class="es-toolbar-spacer"></div>
+ <button class="es-btn" data-action="undo" disabled>Undo</button>
+ <button class="es-btn" data-action="redo" disabled>Redo</button>
+ </div>
+ <div class="es-editor-main">
+ <div class="es-editor-left">
+ <div class="es-hierarchy-container"></div>
+ </div>
+ <div class="es-editor-center">
+ <div class="es-sceneview-container"></div>
+ </div>
+ <div class="es-editor-right">
+ <div class="es-inspector-container"></div>
+ </div>
+ </div>
+ `;
+
+ const hierarchyContainer = this.container_.querySelector('.es-hierarchy-container') as HTMLElement;
+ const inspectorContainer = this.container_.querySelector('.es-inspector-container') as HTMLElement;
+ const sceneViewContainer = this.container_.querySelector('.es-sceneview-container') as HTMLElement;
+
+ this.hierarchyPanel_ = new HierarchyPanel(hierarchyContainer, this.store_);
+ this.inspectorPanel_ = new InspectorPanel(inspectorContainer, this.store_);
+ this.sceneViewPanel_ = new SceneViewPanel(sceneViewContainer, this.store_);
+
+ this.setupToolbarEvents();
+ this.store_.subscribe(() => this.updateToolbarState());
+ }
+
+ private setupToolbarEvents(): void {
+ const toolbar = this.container_.querySelector('.es-editor-toolbar');
+ if (!toolbar) return;
+
+ toolbar.addEventListener('click', (e) => {
+ const target = e.target as HTMLElement;
+ const action = target.dataset.action;
+
+ switch (action) {
+ case 'new':
+ this.newScene();
+ break;
+ case 'open':
+ this.loadScene();
+ break;
+ case 'save':
+ this.saveScene();
+ break;
+ case 'undo':
+ this.store_.undo();
+ break;
+ case 'redo':
+ this.store_.redo();
+ break;
+ }
+ });
+ }
+
+ private updateToolbarState(): void {
+ const undoBtn = this.container_.querySelector('[data-action="undo"]') as HTMLButtonElement;
+ const redoBtn = this.container_.querySelector('[data-action="redo"]') as HTMLButtonElement;
+
+ if (undoBtn) {
+ undoBtn.disabled = !this.store_.canUndo;
+ }
+ if (redoBtn) {
+ redoBtn.disabled = !this.store_.canRedo;
+ }
+ }
+
+ private setupKeyboardShortcuts(): void {
+ document.addEventListener('keydown', (e) => {
+ if (e.ctrlKey || e.metaKey) {
+ switch (e.key.toLowerCase()) {
+ case 'z':
+ e.preventDefault();
+ if (e.shiftKey) {
+ this.store_.redo();
+ } else {
+ this.store_.undo();
+ }
+ break;
+ case 'y':
+ e.preventDefault();
+ this.store_.redo();
+ break;
+ case 's':
+ e.preventDefault();
+ this.saveScene();
+ break;
+ case 'o':
+ e.preventDefault();
+ this.loadScene();
+ break;
+ case 'n':
+ e.preventDefault();
+ this.newScene();
+ break;
+ }
+ } else if (e.key === 'Delete') {
+ const selected = this.store_.selectedEntity;
+ if (selected !== null) {
+ this.store_.deleteEntity(selected);
+ }
+ }
+ });
+ }
+
+ dispose(): void {
+ this.hierarchyPanel_?.dispose();
+ this.inspectorPanel_?.dispose();
+ this.sceneViewPanel_?.dispose();
+ }
+}
+
+// =============================================================================
+// Factory Function
+// =============================================================================
+
+export function createEditor(container: HTMLElement): Editor {
+ return new Editor(container);
+}
diff --git a/editor/src/bridge/EditorBridge.ts b/editor/src/bridge/EditorBridge.ts
new file mode 100644
index 000000000..a4b965191
--- /dev/null
+++ b/editor/src/bridge/EditorBridge.ts
@@ -0,0 +1,171 @@
+/**
+ * @file EditorBridge.ts
+ * @brief Bridge between editor and ESEngine runtime
+ */
+
+import type { Entity, App, ESEngineModule, CppRegistry } from 'esengine';
+import type { SceneData, ComponentData as EditorComponentData } from '../types/SceneTypes';
+import type { EditorStore } from '../store/EditorStore';
+
+// =============================================================================
+// EditorBridge
+// =============================================================================
+
+export class EditorBridge {
+ private app_: App;
+ private store_: EditorStore;
+ private module_: ESEngineModule | null = null;
+ private registry_: CppRegistry | null = null;
+
+ constructor(app: App, store: EditorStore) {
+ this.app_ = app;
+ this.store_ = store;
+ this.module_ = app.wasmModule ?? null;
+
+ if (this.module_) {
+ this.registry_ = new this.module_.Registry();
+ }
+ }
+
+ // =========================================================================
+ // Sync Operations
+ // =========================================================================
+
+ syncToRuntime(): void {
+ if (!this.module_ || !this.registry_) return;
+
+ const scene = this.store_.scene;
+
+ for (const entityData of scene.entities) {
+ const entity = this.registry_.create();
+
+ for (const comp of entityData.components) {
+ this.addComponentToRuntime(entity, comp);
+ }
+ }
+ }
+
+ syncFromRuntime(): SceneData {
+ return this.store_.scene;
+ }
+
+ updateEntityInRuntime(entity: Entity): void {
+ if (!this.registry_) return;
+
+ const entityData = this.store_.scene.entities.find(e => e.id === entity);
+ if (!entityData) return;
+
+ for (const comp of entityData.components) {
+ this.updateComponentInRuntime(entity, comp);
+ }
+ }
+
+ // =========================================================================
+ // Rendering
+ // =========================================================================
+
+ render(width: number, height: number): void {
+ if (!this.module_ || !this.registry_) return;
+
+ this.module_.renderFrame(this.registry_, width, height);
+ }
+
+ // =========================================================================
+ // Preview Mode
+ // =========================================================================
+
+ private savedScene_: SceneData | null = null;
+ private isPreviewMode_ = false;
+
+ enterPreviewMode(): void {
+ if (this.isPreviewMode_) return;
+
+ this.savedScene_ = JSON.parse(JSON.stringify(this.store_.scene));
+ this.isPreviewMode_ = true;
+ this.syncToRuntime();
+ }
+
+ exitPreviewMode(): void {
+ if (!this.isPreviewMode_) return;
+
+ if (this.savedScene_) {
+ this.store_.loadScene(this.savedScene_);
+ this.savedScene_ = null;
+ }
+
+ this.isPreviewMode_ = false;
+ }
+
+ get isPreviewMode(): boolean {
+ return this.isPreviewMode_;
+ }
+
+ // =========================================================================
+ // Private Methods
+ // =========================================================================
+
+ private addComponentToRuntime(entity: Entity, comp: EditorComponentData): void {
+ if (!this.registry_) return;
+
+ switch (comp.type) {
+ case 'LocalTransform':
+ this.registry_.addLocalTransform(entity, {
+ position: comp.data.position ?? { x: 0, y: 0, z: 0 },
+ rotation: comp.data.rotation ?? { x: 0, y: 0, z: 0, w: 1 },
+ scale: comp.data.scale ?? { x: 1, y: 1, z: 1 },
+ });
+ break;
+
+ case 'Sprite':
+ this.registry_.addSprite(entity, {
+ texture: comp.data.texture ?? 0,
+ color: comp.data.color ?? { x: 1, y: 1, z: 1, w: 1 },
+ size: comp.data.size ?? { x: 100, y: 100 },
+ uvOffset: comp.data.uvOffset ?? { x: 0, y: 0 },
+ uvScale: comp.data.uvScale ?? { x: 1, y: 1 },
+ layer: comp.data.layer ?? 0,
+ flipX: comp.data.flipX ?? false,
+ flipY: comp.data.flipY ?? false,
+ });
+ break;
+
+ case 'Camera':
+ this.registry_.addCamera(entity, {
+ isActive: comp.data.isActive ?? true,
+ projectionType: comp.data.projectionType ?? 0,
+ fov: comp.data.fov ?? 60,
+ orthoSize: comp.data.orthoSize ?? 5,
+ nearPlane: comp.data.nearPlane ?? 0.1,
+ farPlane: comp.data.farPlane ?? 1000,
+ });
+ break;
+ }
+ }
+
+ private updateComponentInRuntime(entity: Entity, comp: EditorComponentData): void {
+ if (!this.registry_) return;
+
+ switch (comp.type) {
+ case 'LocalTransform':
+ if (this.registry_.hasLocalTransform(entity)) {
+ this.registry_.removeLocalTransform(entity);
+ }
+ this.addComponentToRuntime(entity, comp);
+ break;
+
+ case 'Sprite':
+ if (this.registry_.hasSprite(entity)) {
+ this.registry_.removeSprite(entity);
+ }
+ this.addComponentToRuntime(entity, comp);
+ break;
+
+ case 'Camera':
+ if (this.registry_.hasCamera(entity)) {
+ this.registry_.removeCamera(entity);
+ }
+ this.addComponentToRuntime(entity, comp);
+ break;
+ }
+ }
+}
diff --git a/editor/src/bridge/index.ts b/editor/src/bridge/index.ts
new file mode 100644
index 000000000..1e648eb2f
--- /dev/null
+++ b/editor/src/bridge/index.ts
@@ -0,0 +1,6 @@
+/**
+ * @file index.ts
+ * @brief Editor bridge exports
+ */
+
+export { EditorBridge } from './EditorBridge';
diff --git a/editor/src/commands/Command.ts b/editor/src/commands/Command.ts
new file mode 100644
index 000000000..954edbd7e
--- /dev/null
+++ b/editor/src/commands/Command.ts
@@ -0,0 +1,50 @@
+/**
+ * @file Command.ts
+ * @brief Command interface for undo/redo system
+ */
+
+// =============================================================================
+// Command Interface
+// =============================================================================
+
+export interface Command {
+ readonly id: string;
+ readonly type: string;
+ readonly timestamp: number;
+ readonly description: string;
+
+ execute(): void;
+ undo(): void;
+
+ canMerge(other: Command): boolean;
+ merge(other: Command): Command;
+}
+
+// =============================================================================
+// Base Command
+// =============================================================================
+
+let commandIdCounter = 0;
+
+export abstract class BaseCommand implements Command {
+ readonly id: string;
+ readonly timestamp: number;
+ abstract readonly type: string;
+ abstract readonly description: string;
+
+ constructor() {
+ this.id = `cmd_${++commandIdCounter}_${Date.now()}`;
+ this.timestamp = Date.now();
+ }
+
+ abstract execute(): void;
+ abstract undo(): void;
+
+ canMerge(_other: Command): boolean {
+ return false;
+ }
+
+ merge(_other: Command): Command {
+ return this;
+ }
+}
diff --git a/editor/src/commands/CommandHistory.ts b/editor/src/commands/CommandHistory.ts
new file mode 100644
index 000000000..51984f46b
--- /dev/null
+++ b/editor/src/commands/CommandHistory.ts
@@ -0,0 +1,96 @@
+/**
+ * @file CommandHistory.ts
+ * @brief Undo/Redo command history manager
+ */
+
+import type { Command } from './Command';
+
+// =============================================================================
+// Constants
+// =============================================================================
+
+const MAX_HISTORY_SIZE = 100;
+
+// =============================================================================
+// CommandHistory
+// =============================================================================
+
+export class CommandHistory {
+ private commands_: Command[] = [];
+ private index_ = -1;
+ private maxSize_: number;
+
+ constructor(maxSize: number = MAX_HISTORY_SIZE) {
+ this.maxSize_ = maxSize;
+ }
+
+ execute(command: Command): void {
+ command.execute();
+
+ if (this.index_ < this.commands_.length - 1) {
+ this.commands_ = this.commands_.slice(0, this.index_ + 1);
+ }
+
+ const lastCommand = this.commands_[this.commands_.length - 1];
+ if (lastCommand && lastCommand.canMerge(command)) {
+ this.commands_[this.commands_.length - 1] = lastCommand.merge(command);
+ } else {
+ this.commands_.push(command);
+ this.index_++;
+ }
+
+ while (this.commands_.length > this.maxSize_) {
+ this.commands_.shift();
+ this.index_--;
+ }
+ }
+
+ undo(): boolean {
+ if (!this.canUndo()) return false;
+
+ const command = this.commands_[this.index_];
+ command.undo();
+ this.index_--;
+ return true;
+ }
+
+ redo(): boolean {
+ if (!this.canRedo()) return false;
+
+ this.index_++;
+ const command = this.commands_[this.index_];
+ command.execute();
+ return true;
+ }
+
+ canUndo(): boolean {
+ return this.index_ >= 0;
+ }
+
+ canRedo(): boolean {
+ return this.index_ < this.commands_.length - 1;
+ }
+
+ clear(): void {
+ this.commands_ = [];
+ this.index_ = -1;
+ }
+
+ get undoDescription(): string | null {
+ if (!this.canUndo()) return null;
+ return this.commands_[this.index_].description;
+ }
+
+ get redoDescription(): string | null {
+ if (!this.canRedo()) return null;
+ return this.commands_[this.index_ + 1].description;
+ }
+
+ get historySize(): number {
+ return this.commands_.length;
+ }
+
+ get currentIndex(): number {
+ return this.index_;
+ }
+}
diff --git a/editor/src/commands/EntityCommands.ts b/editor/src/commands/EntityCommands.ts
new file mode 100644
index 000000000..b7e618b9d
--- /dev/null
+++ b/editor/src/commands/EntityCommands.ts
@@ -0,0 +1,268 @@
+/**
+ * @file EntityCommands.ts
+ * @brief Commands for entity operations (create, delete, reparent)
+ */
+
+import type { SceneData, EntityData } from '../types/SceneTypes';
+import { createEntityData } from '../types/SceneTypes';
+import { BaseCommand } from './Command';
+
+// =============================================================================
+// CreateEntityCommand
+// =============================================================================
+
+export class CreateEntityCommand extends BaseCommand {
+ readonly type = 'create_entity';
+ readonly description: string;
+ private entityData_: EntityData;
+
+ constructor(
+ private scene_: SceneData,
+ private entityId_: number,
+ private name_: string,
+ private parent_: number | null = null
+ ) {
+ super();
+ this.description = `Create entity "${name_}"`;
+ this.entityData_ = createEntityData(entityId_, name_, parent_);
+ }
+
+ execute(): void {
+ this.scene_.entities.push(this.entityData_);
+
+ if (this.parent_ !== null) {
+ const parentData = this.scene_.entities.find(e => e.id === this.parent_);
+ if (parentData && !parentData.children.includes(this.entityId_)) {
+ parentData.children.push(this.entityId_);
+ }
+ }
+ }
+
+ undo(): void {
+ const idx = this.scene_.entities.findIndex(e => e.id === this.entityId_);
+ if (idx !== -1) {
+ this.scene_.entities.splice(idx, 1);
+ }
+
+ if (this.parent_ !== null) {
+ const parentData = this.scene_.entities.find(e => e.id === this.parent_);
+ if (parentData) {
+ const childIdx = parentData.children.indexOf(this.entityId_);
+ if (childIdx !== -1) {
+ parentData.children.splice(childIdx, 1);
+ }
+ }
+ }
+ }
+
+ get entityId(): number {
+ return this.entityId_;
+ }
+}
+
+// =============================================================================
+// DeleteEntityCommand
+// =============================================================================
+
+export class DeleteEntityCommand extends BaseCommand {
+ readonly type = 'delete_entity';
+ readonly description: string;
+ private deletedData_: EntityData | null = null;
+ private deletedChildren_: EntityData[] = [];
+
+ constructor(
+ private scene_: SceneData,
+ private entityId_: number
+ ) {
+ super();
+ const entity = scene_.entities.find(e => e.id === entityId_);
+ this.description = `Delete entity "${entity?.name ?? entityId_}"`;
+ }
+
+ execute(): void {
+ this.deletedData_ = this.scene_.entities.find(e => e.id === this.entityId_) ?? null;
+ if (!this.deletedData_) return;
+
+ this.deletedChildren_ = this.collectDescendants(this.entityId_);
+
+ if (this.deletedData_.parent !== null) {
+ const parentData = this.scene_.entities.find(e => e.id === this.deletedData_!.parent);
+ if (parentData) {
+ const idx = parentData.children.indexOf(this.entityId_);
+ if (idx !== -1) {
+ parentData.children.splice(idx, 1);
+ }
+ }
+ }
+
+ const idsToRemove = new Set([this.entityId_, ...this.deletedChildren_.map(e => e.id)]);
+ this.scene_.entities = this.scene_.entities.filter(e => !idsToRemove.has(e.id));
+ }
+
+ undo(): void {
+ if (!this.deletedData_) return;
+
+ this.scene_.entities.push(this.deletedData_);
+ this.scene_.entities.push(...this.deletedChildren_);
+
+ if (this.deletedData_.parent !== null) {
+ const parentData = this.scene_.entities.find(e => e.id === this.deletedData_!.parent);
+ if (parentData && !parentData.children.includes(this.entityId_)) {
+ parentData.children.push(this.entityId_);
+ }
+ }
+ }
+
+ private collectDescendants(entityId: number): EntityData[] {
+ const result: EntityData[] = [];
+ const entity = this.scene_.entities.find(e => e.id === entityId);
+ if (!entity) return result;
+
+ for (const childId of entity.children) {
+ const child = this.scene_.entities.find(e => e.id === childId);
+ if (child) {
+ result.push(child);
+ result.push(...this.collectDescendants(childId));
+ }
+ }
+ return result;
+ }
+}
+
+// =============================================================================
+// ReparentCommand
+// =============================================================================
+
+export class ReparentCommand extends BaseCommand {
+ readonly type = 'reparent';
+ readonly description: string;
+ private oldParent_: number | null;
+
+ constructor(
+ private scene_: SceneData,
+ private entityId_: number,
+ private newParent_: number | null
+ ) {
+ super();
+ const entity = scene_.entities.find(e => e.id === entityId_);
+ this.oldParent_ = entity?.parent ?? null;
+ this.description = `Reparent entity "${entity?.name ?? entityId_}"`;
+ }
+
+ execute(): void {
+ this.setParent(this.newParent_);
+ }
+
+ undo(): void {
+ this.setParent(this.oldParent_);
+ }
+
+ private setParent(newParent: number | null): void {
+ const entity = this.scene_.entities.find(e => e.id === this.entityId_);
+ if (!entity) return;
+
+ const oldParent = entity.parent;
+
+ if (oldParent !== null) {
+ const oldParentData = this.scene_.entities.find(e => e.id === oldParent);
+ if (oldParentData) {
+ const idx = oldParentData.children.indexOf(this.entityId_);
+ if (idx !== -1) {
+ oldParentData.children.splice(idx, 1);
+ }
+ }
+ }
+
+ entity.parent = newParent;
+
+ if (newParent !== null) {
+ const newParentData = this.scene_.entities.find(e => e.id === newParent);
+ if (newParentData && !newParentData.children.includes(this.entityId_)) {
+ newParentData.children.push(this.entityId_);
+ }
+ }
+ }
+}
+
+// =============================================================================
+// AddComponentCommand
+// =============================================================================
+
+export class AddComponentCommand extends BaseCommand {
+ readonly type = 'add_component';
+ readonly description: string;
+
+ constructor(
+ private scene_: SceneData,
+ private entityId_: number,
+ private componentType_: string,
+ private componentData_: Record<string, unknown>
+ ) {
+ super();
+ this.description = `Add ${componentType_}`;
+ }
+
+ execute(): void {
+ const entity = this.scene_.entities.find(e => e.id === this.entityId_);
+ if (!entity) return;
+
+ if (!entity.components.find(c => c.type === this.componentType_)) {
+ entity.components.push({
+ type: this.componentType_,
+ data: { ...this.componentData_ },
+ });
+ }
+ }
+
+ undo(): void {
+ const entity = this.scene_.entities.find(e => e.id === this.entityId_);
+ if (!entity) return;
+
+ const idx = entity.components.findIndex(c => c.type === this.componentType_);
+ if (idx !== -1) {
+ entity.components.splice(idx, 1);
+ }
+ }
+}
+
+// =============================================================================
+// RemoveComponentCommand
+// =============================================================================
+
+export class RemoveComponentCommand extends BaseCommand {
+ readonly type = 'remove_component';
+ readonly description: string;
+ private removedData_: Record<string, unknown> | null = null;
+
+ constructor(
+ private scene_: SceneData,
+ private entityId_: number,
+ private componentType_: string
+ ) {
+ super();
+ this.description = `Remove ${componentType_}`;
+ }
+
+ execute(): void {
+ const entity = this.scene_.entities.find(e => e.id === this.entityId_);
+ if (!entity) return;
+
+ const idx = entity.components.findIndex(c => c.type === this.componentType_);
+ if (idx !== -1) {
+ this.removedData_ = { ...entity.components[idx].data };
+ entity.components.splice(idx, 1);
+ }
+ }
+
+ undo(): void {
+ if (!this.removedData_) return;
+
+ const entity = this.scene_.entities.find(e => e.id === this.entityId_);
+ if (!entity) return;
+
+ entity.components.push({
+ type: this.componentType_,
+ data: this.removedData_,
+ });
+ }
+}
diff --git a/editor/src/commands/PropertyCommand.ts b/editor/src/commands/PropertyCommand.ts
new file mode 100644
index 000000000..6147a1da5
--- /dev/null
+++ b/editor/src/commands/PropertyCommand.ts
@@ -0,0 +1,77 @@
+/**
+ * @file PropertyCommand.ts
+ * @brief Command for component property changes with merge support
+ */
+
+import type { Entity } from 'esengine';
+import type { SceneData, EntityData } from '../types/SceneTypes';
+import { BaseCommand, type Command } from './Command';
+
+// =============================================================================
+// Constants
+// =============================================================================
+
+const MERGE_WINDOW_MS = 500;
+
+// =============================================================================
+// PropertyCommand
+// =============================================================================
+
+export class PropertyCommand extends BaseCommand {
+ readonly type = 'property';
+ readonly description: string;
+
+ constructor(
+ private scene_: SceneData,
+ private entity_: Entity,
+ private componentType_: string,
+ private propertyName_: string,
+ private oldValue_: unknown,
+ private newValue_: unknown
+ ) {
+ super();
+ this.description = `Change ${componentType_}.${propertyName_}`;
+ }
+
+ execute(): void {
+ this.setPropertyValue(this.newValue_);
+ }
+
+ undo(): void {
+ this.setPropertyValue(this.oldValue_);
+ }
+
+ canMerge(other: Command): boolean {
+ if (!(other instanceof PropertyCommand)) return false;
+ if (other.entity_ !== this.entity_) return false;
+ if (other.componentType_ !== this.componentType_) return false;
+ if (other.propertyName_ !== this.propertyName_) return false;
+ return other.timestamp - this.timestamp < MERGE_WINDOW_MS;
+ }
+
+ merge(other: Command): Command {
+ const otherProp = other as PropertyCommand;
+ return new PropertyCommand(
+ this.scene_,
+ this.entity_,
+ this.componentType_,
+ this.propertyName_,
+ this.oldValue_,
+ otherProp.newValue_
+ );
+ }
+
+ private setPropertyValue(value: unknown): void {
+ const entityData = this.findEntityData();
+ if (!entityData) return;
+
+ const component = entityData.components.find(c => c.type === this.componentType_);
+ if (component) {
+ component.data[this.propertyName_] = value;
+ }
+ }
+
+ private findEntityData(): EntityData | undefined {
+ return this.scene_.entities.find(e => e.id === this.entity_);
+ }
+}
diff --git a/editor/src/commands/index.ts b/editor/src/commands/index.ts
new file mode 100644
index 000000000..78c8a282e
--- /dev/null
+++ b/editor/src/commands/index.ts
@@ -0,0 +1,15 @@
+/**
+ * @file index.ts
+ * @brief Command system exports
+ */
+
+export { type Command, BaseCommand } from './Command';
+export { PropertyCommand } from './PropertyCommand';
+export {
+ CreateEntityCommand,
+ DeleteEntityCommand,
+ ReparentCommand,
+ AddComponentCommand,
+ RemoveComponentCommand,
+} from './EntityCommands';
+export { CommandHistory } from './CommandHistory';
diff --git a/editor/src/index.ts b/editor/src/index.ts
new file mode 100644
index 000000000..4b15aa2a0
--- /dev/null
+++ b/editor/src/index.ts
@@ -0,0 +1,115 @@
+/**
+ * @file index.ts
+ * @brief ESEngine Web Editor exports
+ */
+
+// =============================================================================
+// Editor
+// =============================================================================
+
+export { Editor, createEditor } from './Editor';
+
+// =============================================================================
+// Types
+// =============================================================================
+
+export {
+ type SceneData,
+ type EntityData,
+ type ComponentData,
+ type SelectionState,
+ type ViewportState,
+ createEmptyScene,
+ createEntityData,
+} from './types';
+
+// =============================================================================
+// Store
+// =============================================================================
+
+export {
+ EditorStore,
+ getEditorStore,
+ resetEditorStore,
+ type EditorState,
+ type EditorListener,
+} from './store';
+
+// =============================================================================
+// Commands
+// =============================================================================
+
+export {
+ type Command,
+ BaseCommand,
+ PropertyCommand,
+ CreateEntityCommand,
+ DeleteEntityCommand,
+ ReparentCommand,
+ AddComponentCommand,
+ RemoveComponentCommand,
+ CommandHistory,
+} from './commands';
+
+// =============================================================================
+// Panels
+// =============================================================================
+
+export {
+ HierarchyPanel,
+ InspectorPanel,
+ SceneViewPanel,
+} from './panels';
+
+// =============================================================================
+// Property Editors
+// =============================================================================
+
+export {
+ type PropertyMeta,
+ type PropertyEditorContext,
+ type PropertyEditorFactory,
+ type PropertyEditorInstance,
+ registerPropertyEditor,
+ getPropertyEditor,
+ createPropertyEditor,
+ registerBuiltinEditors,
+} from './property';
+
+// =============================================================================
+// Schemas
+// =============================================================================
+
+export {
+ type ComponentSchema,
+ LocalTransformSchema,
+ SpriteSchema,
+ CameraSchema,
+ TextSchema,
+ registerComponentSchema,
+ getComponentSchema,
+ getAllComponentSchemas,
+ registerBuiltinSchemas,
+} from './schemas';
+
+// =============================================================================
+// Bridge
+// =============================================================================
+
+export { EditorBridge } from './bridge';
+
+// =============================================================================
+// IO
+// =============================================================================
+
+export {
+ SceneSerializer,
+ saveSceneToFile,
+ loadSceneFromFile,
+} from './io';
+
+// =============================================================================
+// Styles
+// =============================================================================
+
+export { EDITOR_STYLES_URL, injectEditorStyles } from './styles';
diff --git a/editor/src/io/SceneSerializer.ts b/editor/src/io/SceneSerializer.ts
new file mode 100644
index 000000000..e41b9986b
--- /dev/null
+++ b/editor/src/io/SceneSerializer.ts
@@ -0,0 +1,132 @@
+/**
+ * @file SceneSerializer.ts
+ * @brief Scene save/load functionality
+ */
+
+import type { SceneData, EntityData, ComponentData } from '../types/SceneTypes';
+
+// =============================================================================
+// SceneSerializer
+// =============================================================================
+
+export class SceneSerializer {
+ serialize(scene: SceneData): string {
+ return JSON.stringify(scene, null, 2);
+ }
+
+ deserialize(json: string): SceneData {
+ const data = JSON.parse(json) as SceneData;
+ this.validateScene(data);
+ return data;
+ }
+
+ private validateScene(scene: SceneData): void {
+ if (!scene.version) {
+ scene.version = '1.0';
+ }
+ if (!scene.name) {
+ scene.name = 'Untitled';
+ }
+ if (!Array.isArray(scene.entities)) {
+ scene.entities = [];
+ }
+
+ for (const entity of scene.entities) {
+ this.validateEntity(entity);
+ }
+ }
+
+ private validateEntity(entity: EntityData): void {
+ if (typeof entity.id !== 'number') {
+ throw new Error('Entity must have numeric id');
+ }
+ if (!entity.name) {
+ entity.name = `Entity_${entity.id}`;
+ }
+ if (!Array.isArray(entity.children)) {
+ entity.children = [];
+ }
+ if (!Array.isArray(entity.components)) {
+ entity.components = [];
+ }
+
+ for (const component of entity.components) {
+ this.validateComponent(component);
+ }
+ }
+
+ private validateComponent(component: ComponentData): void {
+ if (!component.type) {
+ throw new Error('Component must have type');
+ }
+ if (!component.data || typeof component.data !== 'object') {
+ component.data = {};
+ }
+ }
+}
+
+// =============================================================================
+// File Operations (Browser)
+// =============================================================================
+
+export async function saveSceneToFile(scene: SceneData, fileName?: string): Promise<void> {
+ const serializer = new SceneSerializer();
+ const json = serializer.serialize(scene);
+ const blob = new Blob([json], { type: 'application/json' });
+
+ const name = fileName ?? `${scene.name}.esscene`;
+
+ if ('showSaveFilePicker' in window) {
+ try {
+ const handle = await (window as any).showSaveFilePicker({
+ suggestedName: name,
+ types: [{
+ description: 'ESEngine Scene',
+ accept: { 'application/json': ['.esscene'] },
+ }],
+ });
+ const writable = await handle.createWritable();
+ await writable.write(blob);
+ await writable.close();
+ return;
+ } catch (e) {
+ if ((e as Error).name === 'AbortError') return;
+ }
+ }
+
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = name;
+ a.click();
+ URL.revokeObjectURL(url);
+}
+
+export async function loadSceneFromFile(): Promise<SceneData | null> {
+ return new Promise((resolve) => {
+ const input = document.createElement('input');
+ input.type = 'file';
+ input.accept = '.esscene,.json';
+
+ input.onchange = async () => {
+ const file = input.files?.[0];
+ if (!file) {
+ resolve(null);
+ return;
+ }
+
+ try {
+ const text = await file.text();
+ const serializer = new SceneSerializer();
+ const scene = serializer.deserialize(text);
+ resolve(scene);
+ } catch (e) {
+ console.error('Failed to load scene:', e);
+ resolve(null);
+ }
+ };
+
+ input.oncancel = () => resolve(null);
+ input.click();
+ });
+}
diff --git a/editor/src/io/index.ts b/editor/src/io/index.ts
new file mode 100644
index 000000000..8351affd2
--- /dev/null
+++ b/editor/src/io/index.ts
@@ -0,0 +1,6 @@
+/**
+ * @file index.ts
+ * @brief IO module exports
+ */
+
+export { SceneSerializer, saveSceneToFile, loadSceneFromFile } from './SceneSerializer';
diff --git a/editor/src/panels/HierarchyPanel.ts b/editor/src/panels/HierarchyPanel.ts
new file mode 100644
index 000000000..a7cebfdb9
--- /dev/null
+++ b/editor/src/panels/HierarchyPanel.ts
@@ -0,0 +1,177 @@
+/**
+ * @file HierarchyPanel.ts
+ * @brief Entity hierarchy tree panel
+ */
+
+import type { Entity } from 'esengine';
+import type { EntityData, SceneData } from '../types/SceneTypes';
+import type { EditorStore } from '../store/EditorStore';
+
+// =============================================================================
+// HierarchyPanel
+// =============================================================================
+
+export class HierarchyPanel {
+ private container_: HTMLElement;
+ private store_: EditorStore;
+ private treeContainer_: HTMLElement;
+ private unsubscribe_: (() => void) | null = null;
+
+ constructor(container: HTMLElement, store: EditorStore) {
+ this.container_ = container;
+ this.store_ = store;
+
+ this.container_.className = 'es-hierarchy-panel';
+ this.container_.innerHTML = `
+ <div class="es-panel-header">
+ <span class="es-panel-title">Hierarchy</span>
+ <button class="es-btn es-btn-icon" data-action="add">+</button>
+ </div>
+ <div class="es-hierarchy-tree"></div>
+ `;
+
+ this.treeContainer_ = this.container_.querySelector('.es-hierarchy-tree')!;
+
+ this.setupEvents();
+ this.unsubscribe_ = store.subscribe(() => this.render());
+ this.render();
+ }
+
+ dispose(): void {
+ if (this.unsubscribe_) {
+ this.unsubscribe_();
+ this.unsubscribe_ = null;
+ }
+ }
+
+ private setupEvents(): void {
+ const addBtn = this.container_.querySelector('[data-action="add"]');
+ addBtn?.addEventListener('click', () => {
+ this.store_.createEntity();
+ });
+
+ this.treeContainer_.addEventListener('click', (e) => {
+ const target = e.target as HTMLElement;
+ const item = target.closest('.es-hierarchy-item') as HTMLElement;
+ if (!item) return;
+
+ const entityId = parseInt(item.dataset.entityId ?? '', 10);
+ if (isNaN(entityId)) return;
+
+ if (target.classList.contains('es-hierarchy-expand')) {
+ item.classList.toggle('es-expanded');
+ return;
+ }
+
+ this.store_.selectEntity(entityId as Entity);
+ });
+
+ this.treeContainer_.addEventListener('contextmenu', (e) => {
+ e.preventDefault();
+ const target = e.target as HTMLElement;
+ const item = target.closest('.es-hierarchy-item') as HTMLElement;
+
+ if (item) {
+ const entityId = parseInt(item.dataset.entityId ?? '', 10);
+ if (!isNaN(entityId)) {
+ this.showContextMenu(e.clientX, e.clientY, entityId as Entity);
+ }
+ } else {
+ this.showContextMenu(e.clientX, e.clientY, null);
+ }
+ });
+ }
+
+ private render(): void {
+ const scene = this.store_.scene;
+ const selectedEntity = this.store_.selectedEntity;
+
+ const rootEntities = scene.entities.filter(e => e.parent === null);
+ this.treeContainer_.innerHTML = this.renderEntities(rootEntities, scene, selectedEntity);
+ }
+
+ private renderEntities(
+ entities: EntityData[],
+ scene: SceneData,
+ selectedEntity: Entity | null
+ ): string {
+ return entities.map(entity => {
+ const children = scene.entities.filter(e => e.parent === entity.id);
+ const hasChildren = children.length > 0;
+ const isSelected = entity.id === selectedEntity;
+
+ return `
+ <div class="es-hierarchy-item ${isSelected ? 'es-selected' : ''} ${hasChildren ? 'es-has-children' : ''}"
+ data-entity-id="${entity.id}">
+ <div class="es-hierarchy-row">
+ ${hasChildren ? '<span class="es-hierarchy-expand">▶</span>' : '<span class="es-hierarchy-spacer"></span>'}
+ <span class="es-hierarchy-name">${this.escapeHtml(entity.name)}</span>
+ </div>
+ ${hasChildren ? `<div class="es-hierarchy-children">${this.renderEntities(children, scene, selectedEntity)}</div>` : ''}
+ </div>
+ `;
+ }).join('');
+ }
+
+ private showContextMenu(x: number, y: number, entity: Entity | null): void {
+ const existingMenu = document.querySelector('.es-context-menu');
+ existingMenu?.remove();
+
+ const menu = document.createElement('div');
+ menu.className = 'es-context-menu';
+ menu.style.left = `${x}px`;
+ menu.style.top = `${y}px`;
+
+ const items: { label: string; action: () => void }[] = [
+ { label: 'Create Entity', action: () => this.store_.createEntity(undefined, entity) },
+ ];
+
+ if (entity !== null) {
+ items.push(
+ { label: 'Duplicate', action: () => this.duplicateEntity(entity) },
+ { label: 'Delete', action: () => this.store_.deleteEntity(entity) }
+ );
+ }
+
+ menu.innerHTML = items.map(item =>
+ `<div class="es-context-menu-item">${item.label}</div>`
+ ).join('');
+
+ menu.querySelectorAll('.es-context-menu-item').forEach((el, i) => {
+ el.addEventListener('click', () => {
+ items[i].action();
+ menu.remove();
+ });
+ });
+
+ document.body.appendChild(menu);
+
+ const closeMenu = (e: MouseEvent) => {
+ if (!menu.contains(e.target as Node)) {
+ menu.remove();
+ document.removeEventListener('click', closeMenu);
+ }
+ };
+ setTimeout(() => document.addEventListener('click', closeMenu), 0);
+ }
+
+ private duplicateEntity(entity: Entity): void {
+ const entityData = this.store_.scene.entities.find(e => e.id === entity);
+ if (!entityData) return;
+
+ const newEntity = this.store_.createEntity(
+ `${entityData.name}_copy`,
+ entityData.parent as Entity | null
+ );
+
+ for (const comp of entityData.components) {
+ this.store_.addComponent(newEntity, comp.type, { ...comp.data });
+ }
+ }
+
+ private escapeHtml(text: string): string {
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+ }
+}
diff --git a/editor/src/panels/InspectorPanel.ts b/editor/src/panels/InspectorPanel.ts
new file mode 100644
index 000000000..c45266e29
--- /dev/null
+++ b/editor/src/panels/InspectorPanel.ts
@@ -0,0 +1,280 @@
+/**
+ * @file InspectorPanel.ts
+ * @brief Entity inspector panel for editing components
+ */
+
+import type { Entity } from 'esengine';
+import type { ComponentData } from '../types/SceneTypes';
+import type { EditorStore } from '../store/EditorStore';
+import {
+ createPropertyEditor,
+ type PropertyEditorInstance,
+} from '../property/PropertyEditor';
+import { getComponentSchema, getAllComponentSchemas } from '../schemas/ComponentSchemas';
+
+// =============================================================================
+// InspectorPanel
+// =============================================================================
+
+export class InspectorPanel {
+ private container_: HTMLElement;
+ private store_: EditorStore;
+ private contentContainer_: HTMLElement;
+ private unsubscribe_: (() => void) | null = null;
+ private editors_: PropertyEditorInstance[] = [];
+ private currentEntity_: Entity | null = null;
+
+ constructor(container: HTMLElement, store: EditorStore) {
+ this.container_ = container;
+ this.store_ = store;
+
+ this.container_.className = 'es-inspector-panel';
+ this.container_.innerHTML = `
+ <div class="es-panel-header">
+ <span class="es-panel-title">Inspector</span>
+ </div>
+ <div class="es-inspector-content"></div>
+ `;
+
+ this.contentContainer_ = this.container_.querySelector('.es-inspector-content')!;
+
+ this.unsubscribe_ = store.subscribe(() => this.render());
+ this.render();
+ }
+
+ dispose(): void {
+ this.disposeEditors();
+ if (this.unsubscribe_) {
+ this.unsubscribe_();
+ this.unsubscribe_ = null;
+ }
+ }
+
+ private render(): void {
+ const entity = this.store_.selectedEntity;
+
+ if (entity === this.currentEntity_) {
+ this.updateEditors();
+ return;
+ }
+
+ this.currentEntity_ = entity;
+ this.disposeEditors();
+ this.contentContainer_.innerHTML = '';
+
+ if (entity === null) {
+ this.contentContainer_.innerHTML = '<div class="es-inspector-empty">No entity selected</div>';
+ return;
+ }
+
+ const entityData = this.store_.getSelectedEntityData();
+ if (!entityData) return;
+
+ this.renderEntityHeader(entityData.name, entity);
+
+ for (const component of entityData.components) {
+ this.renderComponent(entity, component);
+ }
+
+ this.renderAddComponentButton(entity, entityData.components);
+ }
+
+ private renderEntityHeader(name: string, entity: Entity): void {
+ const header = document.createElement('div');
+ header.className = 'es-inspector-entity-header';
+
+ const nameInput = document.createElement('input');
+ nameInput.type = 'text';
+ nameInput.className = 'es-input es-entity-name-input';
+ nameInput.value = name;
+
+ nameInput.addEventListener('change', () => {
+ this.store_.renameEntity(entity, nameInput.value);
+ });
+
+ header.appendChild(nameInput);
+ this.contentContainer_.appendChild(header);
+ }
+
+ private renderComponent(entity: Entity, component: ComponentData): void {
+ const section = document.createElement('div');
+ section.className = 'es-component-section';
+
+ const header = document.createElement('div');
+ header.className = 'es-component-header';
+
+ const title = document.createElement('span');
+ title.className = 'es-component-title';
+ title.textContent = component.type;
+
+ const removeBtn = document.createElement('button');
+ removeBtn.className = 'es-btn es-btn-icon es-btn-remove';
+ removeBtn.textContent = '×';
+ removeBtn.addEventListener('click', () => {
+ this.store_.removeComponent(entity, component.type);
+ });
+
+ header.appendChild(title);
+ header.appendChild(removeBtn);
+ section.appendChild(header);
+
+ const schema = getComponentSchema(component.type);
+ if (schema) {
+ const propsContainer = document.createElement('div');
+ propsContainer.className = 'es-component-properties';
+
+ for (const propMeta of schema.properties) {
+ const row = document.createElement('div');
+ row.className = 'es-property-row';
+
+ const label = document.createElement('label');
+ label.className = 'es-property-label';
+ label.textContent = propMeta.name;
+
+ const editorContainer = document.createElement('div');
+ editorContainer.className = 'es-property-editor';
+
+ const currentValue = component.data[propMeta.name];
+ const editor = createPropertyEditor(editorContainer, {
+ value: currentValue,
+ meta: propMeta,
+ onChange: (newValue) => {
+ this.store_.updateProperty(
+ entity,
+ component.type,
+ propMeta.name,
+ currentValue,
+ newValue
+ );
+ },
+ });
+
+ if (editor) {
+ this.editors_.push(editor);
+ }
+
+ row.appendChild(label);
+ row.appendChild(editorContainer);
+ propsContainer.appendChild(row);
+ }
+
+ section.appendChild(propsContainer);
+ } else {
+ const rawView = document.createElement('pre');
+ rawView.className = 'es-component-raw';
+ rawView.textContent = JSON.stringify(component.data, null, 2);
+ section.appendChild(rawView);
+ }
+
+ this.contentContainer_.appendChild(section);
+ }
+
+ private renderAddComponentButton(entity: Entity, existingComponents: ComponentData[]): void {
+ const wrapper = document.createElement('div');
+ wrapper.className = 'es-add-component-wrapper';
+
+ const btn = document.createElement('button');
+ btn.className = 'es-btn es-btn-add-component';
+ btn.textContent = 'Add Component';
+
+ btn.addEventListener('click', () => {
+ this.showAddComponentMenu(btn, entity, existingComponents);
+ });
+
+ wrapper.appendChild(btn);
+ this.contentContainer_.appendChild(wrapper);
+ }
+
+ private showAddComponentMenu(
+ anchor: HTMLElement,
+ entity: Entity,
+ existingComponents: ComponentData[]
+ ): void {
+ const existingTypes = new Set(existingComponents.map(c => c.type));
+ const availableSchemas = getAllComponentSchemas().filter(
+ s => !existingTypes.has(s.name)
+ );
+
+ if (availableSchemas.length === 0) return;
+
+ const existingMenu = document.querySelector('.es-context-menu');
+ existingMenu?.remove();
+
+ const rect = anchor.getBoundingClientRect();
+ const menu = document.createElement('div');
+ menu.className = 'es-context-menu';
+ menu.style.left = `${rect.left}px`;
+ menu.style.top = `${rect.bottom}px`;
+
+ availableSchemas.forEach(schema => {
+ const item = document.createElement('div');
+ item.className = 'es-context-menu-item';
+ item.textContent = schema.name;
+
+ item.addEventListener('click', () => {
+ const defaultData = this.createDefaultComponentData(schema.name);
+ this.store_.addComponent(entity, schema.name, defaultData);
+ menu.remove();
+ });
+
+ menu.appendChild(item);
+ });
+
+ document.body.appendChild(menu);
+
+ const closeMenu = (e: MouseEvent) => {
+ if (!menu.contains(e.target as Node)) {
+ menu.remove();
+ document.removeEventListener('click', closeMenu);
+ }
+ };
+ setTimeout(() => document.addEventListener('click', closeMenu), 0);
+ }
+
+ private createDefaultComponentData(type: string): Record<string, unknown> {
+ const schema = getComponentSchema(type);
+ if (!schema) return {};
+
+ const data: Record<string, unknown> = {};
+ for (const prop of schema.properties) {
+ switch (prop.type) {
+ case 'number':
+ data[prop.name] = 0;
+ break;
+ case 'string':
+ data[prop.name] = '';
+ break;
+ case 'boolean':
+ data[prop.name] = false;
+ break;
+ case 'vec2':
+ data[prop.name] = { x: 0, y: 0 };
+ break;
+ case 'vec3':
+ data[prop.name] = { x: 0, y: 0, z: 0 };
+ break;
+ case 'vec4':
+ data[prop.name] = { x: 0, y: 0, z: 0, w: 1 };
+ break;
+ case 'color':
+ data[prop.name] = { x: 1, y: 1, z: 1, w: 1 };
+ break;
+ case 'enum':
+ data[prop.name] = prop.options?.[0]?.value ?? 0;
+ break;
+ }
+ }
+ return data;
+ }
+
+ private updateEditors(): void {
+ // TODO: Update existing editors with new values
+ }
+
+ private disposeEditors(): void {
+ for (const editor of this.editors_) {
+ editor.dispose();
+ }
+ this.editors_ = [];
+ }
+}
diff --git a/editor/src/panels/SceneViewPanel.ts b/editor/src/panels/SceneViewPanel.ts
new file mode 100644
index 000000000..50edaf17c
--- /dev/null
+++ b/editor/src/panels/SceneViewPanel.ts
@@ -0,0 +1,346 @@
+/**
+ * @file SceneViewPanel.ts
+ * @brief Scene viewport panel with canvas rendering
+ */
+
+import type { Entity } from 'esengine';
+import type { EditorStore } from '../store/EditorStore';
+import type { EditorBridge } from '../bridge/EditorBridge';
+
+// =============================================================================
+// SceneViewPanel
+// =============================================================================
+
+export class SceneViewPanel {
+ private container_: HTMLElement;
+ private store_: EditorStore;
+ private bridge_: EditorBridge | null = null;
+ private canvas_: HTMLCanvasElement;
+ private unsubscribe_: (() => void) | null = null;
+ private animationId_: number | null = null;
+
+ private panX_ = 0;
+ private panY_ = 0;
+ private zoom_ = 1;
+ private isDragging_ = false;
+ private lastMouseX_ = 0;
+ private lastMouseY_ = 0;
+
+ constructor(container: HTMLElement, store: EditorStore) {
+ this.container_ = container;
+ this.store_ = store;
+
+ this.container_.className = 'es-sceneview-panel';
+ this.container_.innerHTML = `
+ <div class="es-panel-header">
+ <span class="es-panel-title">Scene</span>
+ <div class="es-sceneview-tools">
+ <button class="es-btn es-btn-icon" data-action="reset-view" title="Reset View">⟲</button>
+ <span class="es-zoom-display">100%</span>
+ </div>
+ </div>
+ <div class="es-sceneview-viewport">
+ <canvas class="es-sceneview-canvas"></canvas>
+ </div>
+ `;
+
+ this.canvas_ = this.container_.querySelector('.es-sceneview-canvas')!;
+
+ this.setupEvents();
+ this.unsubscribe_ = store.subscribe(() => this.requestRender());
+ this.resize();
+ }
+
+ dispose(): void {
+ if (this.animationId_ !== null) {
+ cancelAnimationFrame(this.animationId_);
+ this.animationId_ = null;
+ }
+ if (this.unsubscribe_) {
+ this.unsubscribe_();
+ this.unsubscribe_ = null;
+ }
+ }
+
+ setBridge(bridge: EditorBridge): void {
+ this.bridge_ = bridge;
+ this.requestRender();
+ }
+
+ get canvas(): HTMLCanvasElement {
+ return this.canvas_;
+ }
+
+ resize(): void {
+ const viewport = this.container_.querySelector('.es-sceneview-viewport') as HTMLElement;
+ if (!viewport) return;
+
+ const rect = viewport.getBoundingClientRect();
+ const dpr = window.devicePixelRatio || 1;
+
+ this.canvas_.width = rect.width * dpr;
+ this.canvas_.height = rect.height * dpr;
+ this.canvas_.style.width = `${rect.width}px`;
+ this.canvas_.style.height = `${rect.height}px`;
+
+ this.requestRender();
+ }
+
+ private setupEvents(): void {
+ const resetBtn = this.container_.querySelector('[data-action="reset-view"]');
+ resetBtn?.addEventListener('click', () => {
+ this.panX_ = 0;
+ this.panY_ = 0;
+ this.zoom_ = 1;
+ this.updateZoomDisplay();
+ this.requestRender();
+ });
+
+ this.canvas_.addEventListener('mousedown', this.onMouseDown.bind(this));
+ this.canvas_.addEventListener('mousemove', this.onMouseMove.bind(this));
+ this.canvas_.addEventListener('mouseup', this.onMouseUp.bind(this));
+ this.canvas_.addEventListener('mouseleave', this.onMouseUp.bind(this));
+ this.canvas_.addEventListener('wheel', this.onWheel.bind(this));
+ this.canvas_.addEventListener('click', this.onClick.bind(this));
+
+ window.addEventListener('resize', () => this.resize());
+ }
+
+ private onMouseDown(e: MouseEvent): void {
+ if (e.button === 1 || (e.button === 0 && e.altKey)) {
+ this.isDragging_ = true;
+ this.lastMouseX_ = e.clientX;
+ this.lastMouseY_ = e.clientY;
+ this.canvas_.style.cursor = 'grabbing';
+ }
+ }
+
+ private onMouseMove(e: MouseEvent): void {
+ if (!this.isDragging_) return;
+
+ const dx = e.clientX - this.lastMouseX_;
+ const dy = e.clientY - this.lastMouseY_;
+
+ this.panX_ += dx / this.zoom_;
+ this.panY_ += dy / this.zoom_;
+
+ this.lastMouseX_ = e.clientX;
+ this.lastMouseY_ = e.clientY;
+
+ this.requestRender();
+ }
+
+ private onMouseUp(_e: MouseEvent): void {
+ this.isDragging_ = false;
+ this.canvas_.style.cursor = 'default';
+ }
+
+ private onWheel(e: WheelEvent): void {
+ e.preventDefault();
+
+ const zoomFactor = e.deltaY > 0 ? 0.9 : 1.1;
+ const newZoom = Math.max(0.1, Math.min(10, this.zoom_ * zoomFactor));
+
+ const rect = this.canvas_.getBoundingClientRect();
+ const mouseX = e.clientX - rect.left;
+ const mouseY = e.clientY - rect.top;
+
+ const worldX = (mouseX - this.canvas_.width / 2) / this.zoom_ - this.panX_;
+ const worldY = (mouseY - this.canvas_.height / 2) / this.zoom_ - this.panY_;
+
+ this.zoom_ = newZoom;
+
+ this.panX_ = (mouseX - this.canvas_.width / 2) / this.zoom_ - worldX;
+ this.panY_ = (mouseY - this.canvas_.height / 2) / this.zoom_ - worldY;
+
+ this.updateZoomDisplay();
+ this.requestRender();
+ }
+
+ private onClick(e: MouseEvent): void {
+ if (this.isDragging_) return;
+
+ const rect = this.canvas_.getBoundingClientRect();
+ const x = e.clientX - rect.left;
+ const y = e.clientY - rect.top;
+
+ const worldX = (x - rect.width / 2) / this.zoom_ - this.panX_;
+ const worldY = -(y - rect.height / 2) / this.zoom_ - this.panY_;
+
+ const entity = this.findEntityAtPosition(worldX, worldY);
+ this.store_.selectEntity(entity);
+ }
+
+ private findEntityAtPosition(worldX: number, worldY: number): Entity | null {
+ const scene = this.store_.scene;
+
+ for (let i = scene.entities.length - 1; i >= 0; i--) {
+ const entity = scene.entities[i];
+ const transform = entity.components.find(c => c.type === 'LocalTransform');
+ const sprite = entity.components.find(c => c.type === 'Sprite');
+
+ if (!transform || !sprite) continue;
+
+ const pos = transform.data.position as { x: number; y: number; z: number };
+ const size = sprite.data.size as { x: number; y: number };
+
+ const halfW = (size?.x ?? 100) / 2;
+ const halfH = (size?.y ?? 100) / 2;
+
+ if (
+ worldX >= (pos?.x ?? 0) - halfW &&
+ worldX <= (pos?.x ?? 0) + halfW &&
+ worldY >= (pos?.y ?? 0) - halfH &&
+ worldY <= (pos?.y ?? 0) + halfH
+ ) {
+ return entity.id as Entity;
+ }
+ }
+
+ return null;
+ }
+
+ private updateZoomDisplay(): void {
+ const display = this.container_.querySelector('.es-zoom-display');
+ if (display) {
+ display.textContent = `${Math.round(this.zoom_ * 100)}%`;
+ }
+ }
+
+ private requestRender(): void {
+ if (this.animationId_ !== null) return;
+
+ this.animationId_ = requestAnimationFrame(() => {
+ this.animationId_ = null;
+ this.render();
+ });
+ }
+
+ private render(): void {
+ if (this.bridge_) {
+ this.bridge_.render(this.canvas_.width, this.canvas_.height);
+ } else {
+ this.renderPreview();
+ }
+ }
+
+ private renderPreview(): void {
+ const ctx = this.canvas_.getContext('2d');
+ if (!ctx) return;
+
+ const w = this.canvas_.width;
+ const h = this.canvas_.height;
+
+ ctx.fillStyle = '#1a1a1a';
+ ctx.fillRect(0, 0, w, h);
+
+ ctx.save();
+ ctx.translate(w / 2 + this.panX_ * this.zoom_, h / 2 + this.panY_ * this.zoom_);
+ ctx.scale(this.zoom_, this.zoom_);
+
+ this.drawGrid(ctx, w, h);
+
+ const scene = this.store_.scene;
+ const selectedEntity = this.store_.selectedEntity;
+
+ for (const entity of scene.entities) {
+ this.drawEntity(ctx, entity, entity.id === selectedEntity);
+ }
+
+ ctx.restore();
+ }
+
+ private drawGrid(ctx: CanvasRenderingContext2D, w: number, h: number): void {
+ const gridSize = 50;
+ const gridExtent = Math.max(w, h) / this.zoom_;
+
+ ctx.strokeStyle = '#333';
+ ctx.lineWidth = 1 / this.zoom_;
+
+ for (let x = -gridExtent; x <= gridExtent; x += gridSize) {
+ ctx.beginPath();
+ ctx.moveTo(x, -gridExtent);
+ ctx.lineTo(x, gridExtent);
+ ctx.stroke();
+ }
+
+ for (let y = -gridExtent; y <= gridExtent; y += gridSize) {
+ ctx.beginPath();
+ ctx.moveTo(-gridExtent, y);
+ ctx.lineTo(gridExtent, y);
+ ctx.stroke();
+ }
+
+ ctx.strokeStyle = '#555';
+ ctx.lineWidth = 2 / this.zoom_;
+ ctx.beginPath();
+ ctx.moveTo(-gridExtent, 0);
+ ctx.lineTo(gridExtent, 0);
+ ctx.stroke();
+ ctx.beginPath();
+ ctx.moveTo(0, -gridExtent);
+ ctx.lineTo(0, gridExtent);
+ ctx.stroke();
+ }
+
+ private drawEntity(
+ ctx: CanvasRenderingContext2D,
+ entity: import('../types/SceneTypes').EntityData,
+ isSelected: boolean
+ ): void {
+ const transform = entity.components.find(c => c.type === 'LocalTransform');
+ const sprite = entity.components.find(c => c.type === 'Sprite');
+
+ if (!transform) return;
+
+ const pos = transform.data.position as { x: number; y: number; z: number } ?? { x: 0, y: 0, z: 0 };
+ const scale = transform.data.scale as { x: number; y: number; z: number } ?? { x: 1, y: 1, z: 1 };
+
+ let w = 50;
+ let h = 50;
+ let color = 'rgba(100, 100, 200, 0.5)';
+
+ if (sprite) {
+ const size = sprite.data.size as { x: number; y: number };
+ const col = sprite.data.color as { x: number; y: number; z: number; w: number };
+
+ if (size) {
+ w = size.x * scale.x;
+ h = size.y * scale.y;
+ }
+ if (col) {
+ const r = Math.round(col.x * 255);
+ const g = Math.round(col.y * 255);
+ const b = Math.round(col.z * 255);
+ const a = col.w;
+ color = `rgba(${r}, ${g}, ${b}, ${a})`;
+ }
+ }
+
+ ctx.save();
+ ctx.translate(pos.x, -pos.y);
+
+ ctx.fillStyle = color;
+ ctx.fillRect(-w / 2, -h / 2, w, h);
+
+ if (isSelected) {
+ ctx.strokeStyle = '#00aaff';
+ ctx.lineWidth = 2 / this.zoom_;
+ ctx.strokeRect(-w / 2, -h / 2, w, h);
+
+ ctx.fillStyle = '#00aaff';
+ const handleSize = 6 / this.zoom_;
+ const corners = [
+ [-w / 2, -h / 2],
+ [w / 2, -h / 2],
+ [-w / 2, h / 2],
+ [w / 2, h / 2],
+ ];
+ for (const [cx, cy] of corners) {
+ ctx.fillRect(cx - handleSize / 2, cy - handleSize / 2, handleSize, handleSize);
+ }
+ }
+
+ ctx.restore();
+ }
+}
diff --git a/editor/src/panels/index.ts b/editor/src/panels/index.ts
new file mode 100644
index 000000000..89a55dee0
--- /dev/null
+++ b/editor/src/panels/index.ts
@@ -0,0 +1,8 @@
+/**
+ * @file index.ts
+ * @brief Editor panels exports
+ */
+
+export { HierarchyPanel } from './HierarchyPanel';
+export { InspectorPanel } from './InspectorPanel';
+export { SceneViewPanel } from './SceneViewPanel';
diff --git a/editor/src/property/PropertyEditor.ts b/editor/src/property/PropertyEditor.ts
new file mode 100644
index 000000000..1e1a9d8b7
--- /dev/null
+++ b/editor/src/property/PropertyEditor.ts
@@ -0,0 +1,56 @@
+/**
+ * @file PropertyEditor.ts
+ * @brief Base property editor interface and registry
+ */
+
+// =============================================================================
+// Types
+// =============================================================================
+
+export interface PropertyMeta {
+ name: string;
+ type: string;
+ min?: number;
+ max?: number;
+ step?: number;
+ options?: { label: string; value: unknown }[];
+}
+
+export interface PropertyEditorContext {
+ value: unknown;
+ meta: PropertyMeta;
+ onChange: (value: unknown) => void;
+}
+
+export type PropertyEditorFactory = (
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+) => PropertyEditorInstance;
+
+export interface PropertyEditorInstance {
+ update(value: unknown): void;
+ dispose(): void;
+}
+
+// =============================================================================
+// Registry
+// =============================================================================
+
+const editorRegistry = new Map<string, PropertyEditorFactory>();
+
+export function registerPropertyEditor(type: string, factory: PropertyEditorFactory): void {
+ editorRegistry.set(type, factory);
+}
+
+export function getPropertyEditor(type: string): PropertyEditorFactory | undefined {
+ return editorRegistry.get(type);
+}
+
+export function createPropertyEditor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance | null {
+ const factory = editorRegistry.get(ctx.meta.type);
+ if (!factory) return null;
+ return factory(container, ctx);
+}
diff --git a/editor/src/property/editors.ts b/editor/src/property/editors.ts
new file mode 100644
index 000000000..e2d9aa722
--- /dev/null
+++ b/editor/src/property/editors.ts
@@ -0,0 +1,424 @@
+/**
+ * @file editors.ts
+ * @brief Built-in property editors
+ */
+
+import {
+ registerPropertyEditor,
+ type PropertyEditorContext,
+ type PropertyEditorInstance,
+} from './PropertyEditor';
+
+// =============================================================================
+// Number Editor
+// =============================================================================
+
+function createNumberEditor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, meta, onChange } = ctx;
+ const input = document.createElement('input');
+ input.type = 'number';
+ input.className = 'es-input es-input-number';
+ input.value = String(value ?? 0);
+
+ if (meta.min !== undefined) input.min = String(meta.min);
+ if (meta.max !== undefined) input.max = String(meta.max);
+ if (meta.step !== undefined) input.step = String(meta.step);
+
+ input.addEventListener('change', () => {
+ onChange(parseFloat(input.value) || 0);
+ });
+
+ container.appendChild(input);
+
+ return {
+ update(v: unknown) {
+ input.value = String(v ?? 0);
+ },
+ dispose() {
+ input.remove();
+ },
+ };
+}
+
+// =============================================================================
+// String Editor
+// =============================================================================
+
+function createStringEditor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, onChange } = ctx;
+ const input = document.createElement('input');
+ input.type = 'text';
+ input.className = 'es-input es-input-string';
+ input.value = String(value ?? '');
+
+ input.addEventListener('change', () => {
+ onChange(input.value);
+ });
+
+ container.appendChild(input);
+
+ return {
+ update(v: unknown) {
+ input.value = String(v ?? '');
+ },
+ dispose() {
+ input.remove();
+ },
+ };
+}
+
+// =============================================================================
+// Boolean Editor
+// =============================================================================
+
+function createBooleanEditor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, onChange } = ctx;
+ const input = document.createElement('input');
+ input.type = 'checkbox';
+ input.className = 'es-input es-input-checkbox';
+ input.checked = Boolean(value);
+
+ input.addEventListener('change', () => {
+ onChange(input.checked);
+ });
+
+ container.appendChild(input);
+
+ return {
+ update(v: unknown) {
+ input.checked = Boolean(v);
+ },
+ dispose() {
+ input.remove();
+ },
+ };
+}
+
+// =============================================================================
+// Vec2 Editor
+// =============================================================================
+
+interface Vec2 {
+ x: number;
+ y: number;
+}
+
+function createVec2Editor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, onChange } = ctx;
+ const vec = (value as Vec2) ?? { x: 0, y: 0 };
+
+ const wrapper = document.createElement('div');
+ wrapper.className = 'es-vec-editor es-vec2-editor';
+
+ const inputs: HTMLInputElement[] = [];
+ const labels = ['X', 'Y'];
+
+ labels.forEach((label, i) => {
+ const group = document.createElement('div');
+ group.className = 'es-vec-field';
+
+ const span = document.createElement('span');
+ span.className = 'es-vec-label';
+ span.textContent = label;
+
+ const input = document.createElement('input');
+ input.type = 'number';
+ input.className = 'es-input es-input-number';
+ input.step = '0.01';
+ input.value = String(i === 0 ? vec.x : vec.y);
+
+ input.addEventListener('change', () => {
+ const newVec = { ...vec };
+ if (i === 0) newVec.x = parseFloat(input.value) || 0;
+ else newVec.y = parseFloat(input.value) || 0;
+ onChange(newVec);
+ });
+
+ group.appendChild(span);
+ group.appendChild(input);
+ wrapper.appendChild(group);
+ inputs.push(input);
+ });
+
+ container.appendChild(wrapper);
+
+ return {
+ update(v: unknown) {
+ const newVec = (v as Vec2) ?? { x: 0, y: 0 };
+ inputs[0].value = String(newVec.x);
+ inputs[1].value = String(newVec.y);
+ },
+ dispose() {
+ wrapper.remove();
+ },
+ };
+}
+
+// =============================================================================
+// Vec3 Editor
+// =============================================================================
+
+interface Vec3 {
+ x: number;
+ y: number;
+ z: number;
+}
+
+function createVec3Editor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, onChange } = ctx;
+ const vec = (value as Vec3) ?? { x: 0, y: 0, z: 0 };
+
+ const wrapper = document.createElement('div');
+ wrapper.className = 'es-vec-editor es-vec3-editor';
+
+ const inputs: HTMLInputElement[] = [];
+ const labels = ['X', 'Y', 'Z'];
+ const keys: (keyof Vec3)[] = ['x', 'y', 'z'];
+
+ labels.forEach((label, i) => {
+ const group = document.createElement('div');
+ group.className = 'es-vec-field';
+
+ const span = document.createElement('span');
+ span.className = 'es-vec-label';
+ span.textContent = label;
+
+ const input = document.createElement('input');
+ input.type = 'number';
+ input.className = 'es-input es-input-number';
+ input.step = '0.01';
+ input.value = String(vec[keys[i]]);
+
+ input.addEventListener('change', () => {
+ const newVec = { ...vec };
+ newVec[keys[i]] = parseFloat(input.value) || 0;
+ onChange(newVec);
+ });
+
+ group.appendChild(span);
+ group.appendChild(input);
+ wrapper.appendChild(group);
+ inputs.push(input);
+ });
+
+ container.appendChild(wrapper);
+
+ return {
+ update(v: unknown) {
+ const newVec = (v as Vec3) ?? { x: 0, y: 0, z: 0 };
+ inputs[0].value = String(newVec.x);
+ inputs[1].value = String(newVec.y);
+ inputs[2].value = String(newVec.z);
+ },
+ dispose() {
+ wrapper.remove();
+ },
+ };
+}
+
+// =============================================================================
+// Vec4 Editor
+// =============================================================================
+
+interface Vec4 {
+ x: number;
+ y: number;
+ z: number;
+ w: number;
+}
+
+function createVec4Editor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, onChange } = ctx;
+ const vec = (value as Vec4) ?? { x: 0, y: 0, z: 0, w: 1 };
+
+ const wrapper = document.createElement('div');
+ wrapper.className = 'es-vec-editor es-vec4-editor';
+
+ const inputs: HTMLInputElement[] = [];
+ const labels = ['X', 'Y', 'Z', 'W'];
+ const keys: (keyof Vec4)[] = ['x', 'y', 'z', 'w'];
+
+ labels.forEach((label, i) => {
+ const group = document.createElement('div');
+ group.className = 'es-vec-field';
+
+ const span = document.createElement('span');
+ span.className = 'es-vec-label';
+ span.textContent = label;
+
+ const input = document.createElement('input');
+ input.type = 'number';
+ input.className = 'es-input es-input-number';
+ input.step = '0.01';
+ input.value = String(vec[keys[i]]);
+
+ input.addEventListener('change', () => {
+ const newVec = { ...vec };
+ newVec[keys[i]] = parseFloat(input.value) || 0;
+ onChange(newVec);
+ });
+
+ group.appendChild(span);
+ group.appendChild(input);
+ wrapper.appendChild(group);
+ inputs.push(input);
+ });
+
+ container.appendChild(wrapper);
+
+ return {
+ update(v: unknown) {
+ const newVec = (v as Vec4) ?? { x: 0, y: 0, z: 0, w: 1 };
+ inputs[0].value = String(newVec.x);
+ inputs[1].value = String(newVec.y);
+ inputs[2].value = String(newVec.z);
+ inputs[3].value = String(newVec.w);
+ },
+ dispose() {
+ wrapper.remove();
+ },
+ };
+}
+
+// =============================================================================
+// Color Editor
+// =============================================================================
+
+function createColorEditor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, onChange } = ctx;
+ const color = (value as Vec4) ?? { x: 1, y: 1, z: 1, w: 1 };
+
+ const wrapper = document.createElement('div');
+ wrapper.className = 'es-color-editor';
+
+ const colorInput = document.createElement('input');
+ colorInput.type = 'color';
+ colorInput.className = 'es-input es-input-color';
+ colorInput.value = vec4ToHex(color);
+
+ const alphaInput = document.createElement('input');
+ alphaInput.type = 'number';
+ alphaInput.className = 'es-input es-input-number es-input-alpha';
+ alphaInput.min = '0';
+ alphaInput.max = '1';
+ alphaInput.step = '0.01';
+ alphaInput.value = String(color.w);
+
+ const updateColor = () => {
+ const hex = colorInput.value;
+ const newColor = hexToVec4(hex);
+ newColor.w = parseFloat(alphaInput.value) || 1;
+ onChange(newColor);
+ };
+
+ colorInput.addEventListener('change', updateColor);
+ alphaInput.addEventListener('change', updateColor);
+
+ wrapper.appendChild(colorInput);
+ wrapper.appendChild(alphaInput);
+ container.appendChild(wrapper);
+
+ return {
+ update(v: unknown) {
+ const newColor = (v as Vec4) ?? { x: 1, y: 1, z: 1, w: 1 };
+ colorInput.value = vec4ToHex(newColor);
+ alphaInput.value = String(newColor.w);
+ },
+ dispose() {
+ wrapper.remove();
+ },
+ };
+}
+
+function vec4ToHex(color: Vec4): string {
+ const r = Math.round(color.x * 255).toString(16).padStart(2, '0');
+ const g = Math.round(color.y * 255).toString(16).padStart(2, '0');
+ const b = Math.round(color.z * 255).toString(16).padStart(2, '0');
+ return `#${r}${g}${b}`;
+}
+
+function hexToVec4(hex: string): Vec4 {
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
+ return { x: r, y: g, z: b, w: 1 };
+}
+
+// =============================================================================
+// Enum Editor
+// =============================================================================
+
+function createEnumEditor(
+ container: HTMLElement,
+ ctx: PropertyEditorContext
+): PropertyEditorInstance {
+ const { value, meta, onChange } = ctx;
+ const options = meta.options ?? [];
+
+ const select = document.createElement('select');
+ select.className = 'es-input es-input-select';
+
+ options.forEach(opt => {
+ const option = document.createElement('option');
+ option.value = String(opt.value);
+ option.textContent = opt.label;
+ if (opt.value === value) {
+ option.selected = true;
+ }
+ select.appendChild(option);
+ });
+
+ select.addEventListener('change', () => {
+ const selected = options.find(o => String(o.value) === select.value);
+ if (selected) {
+ onChange(selected.value);
+ }
+ });
+
+ container.appendChild(select);
+
+ return {
+ update(v: unknown) {
+ select.value = String(v);
+ },
+ dispose() {
+ select.remove();
+ },
+ };
+}
+
+// =============================================================================
+// Register All Editors
+// =============================================================================
+
+export function registerBuiltinEditors(): void {
+ registerPropertyEditor('number', createNumberEditor);
+ registerPropertyEditor('string', createStringEditor);
+ registerPropertyEditor('boolean', createBooleanEditor);
+ registerPropertyEditor('vec2', createVec2Editor);
+ registerPropertyEditor('vec3', createVec3Editor);
+ registerPropertyEditor('vec4', createVec4Editor);
+ registerPropertyEditor('color', createColorEditor);
+ registerPropertyEditor('enum', createEnumEditor);
+}
diff --git a/editor/src/property/index.ts b/editor/src/property/index.ts
new file mode 100644
index 000000000..69846354b
--- /dev/null
+++ b/editor/src/property/index.ts
@@ -0,0 +1,16 @@
+/**
+ * @file index.ts
+ * @brief Property editor exports
+ */
+
+export {
+ type PropertyMeta,
+ type PropertyEditorContext,
+ type PropertyEditorFactory,
+ type PropertyEditorInstance,
+ registerPropertyEditor,
+ getPropertyEditor,
+ createPropertyEditor,
+} from './PropertyEditor';
+
+export { registerBuiltinEditors } from './editors';
diff --git a/editor/src/schemas/ComponentSchemas.ts b/editor/src/schemas/ComponentSchemas.ts
new file mode 100644
index 000000000..2134693cf
--- /dev/null
+++ b/editor/src/schemas/ComponentSchemas.ts
@@ -0,0 +1,114 @@
+/**
+ * @file ComponentSchemas.ts
+ * @brief Component property schemas for the inspector
+ */
+
+import type { PropertyMeta } from '../property/PropertyEditor';
+
+// =============================================================================
+// Types
+// =============================================================================
+
+export interface ComponentSchema {
+ name: string;
+ properties: PropertyMeta[];
+}
+
+// =============================================================================
+// Built-in Schemas
+// =============================================================================
+
+export const LocalTransformSchema: ComponentSchema = {
+ name: 'LocalTransform',
+ properties: [
+ { name: 'position', type: 'vec3' },
+ { name: 'rotation', type: 'vec4' },
+ { name: 'scale', type: 'vec3' },
+ ],
+};
+
+export const SpriteSchema: ComponentSchema = {
+ name: 'Sprite',
+ properties: [
+ { name: 'texture', type: 'number' },
+ { name: 'color', type: 'color' },
+ { name: 'size', type: 'vec2' },
+ { name: 'uvOffset', type: 'vec2' },
+ { name: 'uvScale', type: 'vec2' },
+ { name: 'layer', type: 'number', min: -1000, max: 1000 },
+ { name: 'flipX', type: 'boolean' },
+ { name: 'flipY', type: 'boolean' },
+ ],
+};
+
+export const CameraSchema: ComponentSchema = {
+ name: 'Camera',
+ properties: [
+ { name: 'isActive', type: 'boolean' },
+ {
+ name: 'projectionType',
+ type: 'enum',
+ options: [
+ { label: 'Orthographic', value: 0 },
+ { label: 'Perspective', value: 1 },
+ ],
+ },
+ { name: 'fov', type: 'number', min: 1, max: 179 },
+ { name: 'orthoSize', type: 'number', min: 0.1 },
+ { name: 'nearPlane', type: 'number', step: 0.1 },
+ { name: 'farPlane', type: 'number', step: 1 },
+ ],
+};
+
+export const TextSchema: ComponentSchema = {
+ name: 'Text',
+ properties: [
+ { name: 'content', type: 'string' },
+ { name: 'fontSize', type: 'number', min: 8, max: 200 },
+ { name: 'fontFamily', type: 'string' },
+ { name: 'color', type: 'color' },
+ {
+ name: 'align',
+ type: 'enum',
+ options: [
+ { label: 'Left', value: 'left' },
+ { label: 'Center', value: 'center' },
+ { label: 'Right', value: 'right' },
+ ],
+ },
+ {
+ name: 'baseline',
+ type: 'enum',
+ options: [
+ { label: 'Top', value: 'top' },
+ { label: 'Middle', value: 'middle' },
+ { label: 'Bottom', value: 'bottom' },
+ ],
+ },
+ ],
+};
+
+// =============================================================================
+// Registry
+// =============================================================================
+
+const schemaRegistry = new Map<string, ComponentSchema>();
+
+export function registerComponentSchema(schema: ComponentSchema): void {
+ schemaRegistry.set(schema.name, schema);
+}
+
+export function getComponentSchema(name: string): ComponentSchema | undefined {
+ return schemaRegistry.get(name);
+}
+
+export function getAllComponentSchemas(): ComponentSchema[] {
+ return Array.from(schemaRegistry.values());
+}
+
+export function registerBuiltinSchemas(): void {
+ registerComponentSchema(LocalTransformSchema);
+ registerComponentSchema(SpriteSchema);
+ registerComponentSchema(CameraSchema);
+ registerComponentSchema(TextSchema);
+}
diff --git a/editor/src/schemas/index.ts b/editor/src/schemas/index.ts
new file mode 100644
index 000000000..df702d698
--- /dev/null
+++ b/editor/src/schemas/index.ts
@@ -0,0 +1,16 @@
+/**
+ * @file index.ts
+ * @brief Component schemas exports
+ */
+
+export {
+ type ComponentSchema,
+ LocalTransformSchema,
+ SpriteSchema,
+ CameraSchema,
+ TextSchema,
+ registerComponentSchema,
+ getComponentSchema,
+ getAllComponentSchemas,
+ registerBuiltinSchemas,
+} from './ComponentSchemas';
diff --git a/editor/src/store/EditorStore.ts b/editor/src/store/EditorStore.ts
new file mode 100644
index 000000000..94a6175d2
--- /dev/null
+++ b/editor/src/store/EditorStore.ts
@@ -0,0 +1,268 @@
+/**
+ * @file EditorStore.ts
+ * @brief Editor state management
+ */
+
+import type { Entity } from 'esengine';
+import type { SceneData, EntityData, ComponentData } from '../types/SceneTypes';
+import { createEmptyScene, createEntityData } from '../types/SceneTypes';
+import {
+ CommandHistory,
+ PropertyCommand,
+ CreateEntityCommand,
+ DeleteEntityCommand,
+ ReparentCommand,
+ AddComponentCommand,
+ RemoveComponentCommand,
+} from '../commands';
+
+// =============================================================================
+// Types
+// =============================================================================
+
+export interface EditorState {
+ scene: SceneData;
+ selectedEntity: Entity | null;
+ isDirty: boolean;
+ filePath: string | null;
+}
+
+export type EditorListener = (state: EditorState) => void;
+
+// =============================================================================
+// EditorStore
+// =============================================================================
+
+export class EditorStore {
+ private state_: EditorState;
+ private history_: CommandHistory;
+ private listeners_: Set<EditorListener> = new Set();
+ private nextEntityId_ = 1;
+
+ constructor() {
+ this.state_ = {
+ scene: createEmptyScene(),
+ selectedEntity: null,
+ isDirty: false,
+ filePath: null,
+ };
+ this.history_ = new CommandHistory();
+ }
+
+ // =========================================================================
+ // State Access
+ // =========================================================================
+
+ get state(): Readonly<EditorState> {
+ return this.state_;
+ }
+
+ get scene(): SceneData {
+ return this.state_.scene;
+ }
+
+ get selectedEntity(): Entity | null {
+ return this.state_.selectedEntity;
+ }
+
+ get canUndo(): boolean {
+ return this.history_.canUndo();
+ }
+
+ get canRedo(): boolean {
+ return this.history_.canRedo();
+ }
+
+ // =========================================================================
+ // Scene Operations
+ // =========================================================================
+
+ newScene(name: string = 'Untitled'): void {
+ this.state_.scene = createEmptyScene(name);
+ this.state_.selectedEntity = null;
+ this.state_.isDirty = false;
+ this.state_.filePath = null;
+ this.history_.clear();
+ this.nextEntityId_ = 1;
+ this.notify();
+ }
+
+ loadScene(scene: SceneData, filePath: string | null = null): void {
+ this.state_.scene = scene;
+ this.state_.selectedEntity = null;
+ this.state_.isDirty = false;
+ this.state_.filePath = filePath;
+ this.history_.clear();
+
+ const maxId = scene.entities.reduce((max, e) => Math.max(max, e.id), 0);
+ this.nextEntityId_ = maxId + 1;
+
+ this.notify();
+ }
+
+ markSaved(filePath: string | null = null): void {
+ this.state_.isDirty = false;
+ if (filePath) {
+ this.state_.filePath = filePath;
+ }
+ this.notify();
+ }
+
+ // =========================================================================
+ // Selection
+ // =========================================================================
+
+ selectEntity(entity: Entity | null): void {
+ if (this.state_.selectedEntity !== entity) {
+ this.state_.selectedEntity = entity;
+ this.notify();
+ }
+ }
+
+ getSelectedEntityData(): EntityData | null {
+ if (this.state_.selectedEntity === null) return null;
+ return this.state_.scene.entities.find(
+ e => e.id === this.state_.selectedEntity
+ ) ?? null;
+ }
+
+ // =========================================================================
+ // Entity Operations
+ // =========================================================================
+
+ createEntity(name?: string, parent: Entity | null = null): Entity {
+ const id = this.nextEntityId_++;
+ const entityName = name ?? `Entity_${id}`;
+
+ const cmd = new CreateEntityCommand(
+ this.state_.scene,
+ id,
+ entityName,
+ parent
+ );
+ this.executeCommand(cmd);
+
+ return id as Entity;
+ }
+
+ deleteEntity(entity: Entity): void {
+ const cmd = new DeleteEntityCommand(this.state_.scene, entity);
+ this.executeCommand(cmd);
+
+ if (this.state_.selectedEntity === entity) {
+ this.state_.selectedEntity = null;
+ }
+ }
+
+ reparentEntity(entity: Entity, newParent: Entity | null): void {
+ const cmd = new ReparentCommand(this.state_.scene, entity, newParent);
+ this.executeCommand(cmd);
+ }
+
+ renameEntity(entity: Entity, name: string): void {
+ const entityData = this.state_.scene.entities.find(e => e.id === entity);
+ if (entityData) {
+ entityData.name = name;
+ this.state_.isDirty = true;
+ this.notify();
+ }
+ }
+
+ // =========================================================================
+ // Component Operations
+ // =========================================================================
+
+ addComponent(entity: Entity, type: string, data: Record<string, unknown>): void {
+ const cmd = new AddComponentCommand(this.state_.scene, entity, type, data);
+ this.executeCommand(cmd);
+ }
+
+ removeComponent(entity: Entity, type: string): void {
+ const cmd = new RemoveComponentCommand(this.state_.scene, entity, type);
+ this.executeCommand(cmd);
+ }
+
+ updateProperty(
+ entity: Entity,
+ componentType: string,
+ propertyName: string,
+ oldValue: unknown,
+ newValue: unknown
+ ): void {
+ const cmd = new PropertyCommand(
+ this.state_.scene,
+ entity,
+ componentType,
+ propertyName,
+ oldValue,
+ newValue
+ );
+ this.executeCommand(cmd);
+ }
+
+ getComponent(entity: Entity, type: string): ComponentData | null {
+ const entityData = this.state_.scene.entities.find(e => e.id === entity);
+ if (!entityData) return null;
+ return entityData.components.find(c => c.type === type) ?? null;
+ }
+
+ // =========================================================================
+ // Undo/Redo
+ // =========================================================================
+
+ undo(): void {
+ if (this.history_.undo()) {
+ this.state_.isDirty = true;
+ this.notify();
+ }
+ }
+
+ redo(): void {
+ if (this.history_.redo()) {
+ this.state_.isDirty = true;
+ this.notify();
+ }
+ }
+
+ // =========================================================================
+ // Subscription
+ // =========================================================================
+
+ subscribe(listener: EditorListener): () => void {
+ this.listeners_.add(listener);
+ return () => this.listeners_.delete(listener);
+ }
+
+ // =========================================================================
+ // Private
+ // =========================================================================
+
+ private executeCommand(cmd: import('../commands').Command): void {
+ this.history_.execute(cmd);
+ this.state_.isDirty = true;
+ this.notify();
+ }
+
+ private notify(): void {
+ for (const listener of this.listeners_) {
+ listener(this.state_);
+ }
+ }
+}
+
+// =============================================================================
+// Singleton Instance
+// =============================================================================
+
+let editorStore: EditorStore | null = null;
+
+export function getEditorStore(): EditorStore {
+ if (!editorStore) {
+ editorStore = new EditorStore();
+ }
+ return editorStore;
+}
+
+export function resetEditorStore(): void {
+ editorStore = null;
+}
diff --git a/editor/src/store/index.ts b/editor/src/store/index.ts
new file mode 100644
index 000000000..f965f83f8
--- /dev/null
+++ b/editor/src/store/index.ts
@@ -0,0 +1,12 @@
+/**
+ * @file index.ts
+ * @brief Editor store exports
+ */
+
+export {
+ EditorStore,
+ getEditorStore,
+ resetEditorStore,
+ type EditorState,
+ type EditorListener,
+} from './EditorStore';
diff --git a/editor/src/styles/editor.css b/editor/src/styles/editor.css
new file mode 100644
index 000000000..affd906b9
--- /dev/null
+++ b/editor/src/styles/editor.css
@@ -0,0 +1,430 @@
+/**
+ * ESEngine Web Editor Styles
+ */
+
+/* =============================================================================
+ * Variables
+ * ============================================================================= */
+
+:root {
+ --es-bg-primary: #1e1e1e;
+ --es-bg-secondary: #252526;
+ --es-bg-tertiary: #2d2d30;
+ --es-bg-hover: #3e3e42;
+ --es-border: #3c3c3c;
+ --es-text-primary: #cccccc;
+ --es-text-secondary: #808080;
+ --es-accent: #0078d4;
+ --es-accent-hover: #1084d8;
+ --es-danger: #f44336;
+ --es-success: #4caf50;
+}
+
+/* =============================================================================
+ * Editor Layout
+ * ============================================================================= */
+
+.es-editor {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ height: 100%;
+ background: var(--es-bg-primary);
+ color: var(--es-text-primary);
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ font-size: 13px;
+}
+
+.es-editor-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px;
+ background: var(--es-bg-secondary);
+ border-bottom: 1px solid var(--es-border);
+}
+
+.es-toolbar-spacer {
+ flex: 1;
+}
+
+.es-editor-main {
+ display: flex;
+ flex: 1;
+ overflow: hidden;
+}
+
+.es-editor-left {
+ width: 250px;
+ min-width: 200px;
+ border-right: 1px solid var(--es-border);
+}
+
+.es-editor-center {
+ flex: 1;
+ min-width: 300px;
+}
+
+.es-editor-right {
+ width: 300px;
+ min-width: 250px;
+ border-left: 1px solid var(--es-border);
+}
+
+/* =============================================================================
+ * Panels
+ * ============================================================================= */
+
+.es-panel-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 8px 12px;
+ background: var(--es-bg-secondary);
+ border-bottom: 1px solid var(--es-border);
+}
+
+.es-panel-title {
+ font-weight: 600;
+ font-size: 12px;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+}
+
+/* =============================================================================
+ * Hierarchy Panel
+ * ============================================================================= */
+
+.es-hierarchy-panel {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.es-hierarchy-tree {
+ flex: 1;
+ overflow: auto;
+ padding: 4px;
+}
+
+.es-hierarchy-item {
+ user-select: none;
+}
+
+.es-hierarchy-row {
+ display: flex;
+ align-items: center;
+ padding: 4px 8px;
+ border-radius: 3px;
+ cursor: pointer;
+}
+
+.es-hierarchy-row:hover {
+ background: var(--es-bg-hover);
+}
+
+.es-hierarchy-item.es-selected > .es-hierarchy-row {
+ background: var(--es-accent);
+ color: white;
+}
+
+.es-hierarchy-expand {
+ width: 16px;
+ font-size: 10px;
+ transition: transform 0.15s;
+}
+
+.es-hierarchy-item.es-expanded > .es-hierarchy-row > .es-hierarchy-expand {
+ transform: rotate(90deg);
+}
+
+.es-hierarchy-spacer {
+ width: 16px;
+}
+
+.es-hierarchy-name {
+ flex: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.es-hierarchy-children {
+ display: none;
+ padding-left: 16px;
+}
+
+.es-hierarchy-item.es-expanded > .es-hierarchy-children {
+ display: block;
+}
+
+/* =============================================================================
+ * Inspector Panel
+ * ============================================================================= */
+
+.es-inspector-panel {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.es-inspector-content {
+ flex: 1;
+ overflow: auto;
+ padding: 8px;
+}
+
+.es-inspector-empty {
+ color: var(--es-text-secondary);
+ text-align: center;
+ padding: 20px;
+}
+
+.es-inspector-entity-header {
+ margin-bottom: 12px;
+}
+
+.es-entity-name-input {
+ width: 100%;
+ font-size: 14px;
+ font-weight: 600;
+}
+
+.es-component-section {
+ background: var(--es-bg-secondary);
+ border-radius: 4px;
+ margin-bottom: 8px;
+ overflow: hidden;
+}
+
+.es-component-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 8px 12px;
+ background: var(--es-bg-tertiary);
+}
+
+.es-component-title {
+ font-weight: 600;
+}
+
+.es-component-properties {
+ padding: 8px;
+}
+
+.es-component-raw {
+ padding: 8px;
+ font-size: 11px;
+ overflow: auto;
+ background: var(--es-bg-primary);
+ margin: 0;
+}
+
+.es-property-row {
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 8px;
+}
+
+.es-property-label {
+ width: 80px;
+ flex-shrink: 0;
+ padding: 6px 8px 6px 0;
+ color: var(--es-text-secondary);
+ font-size: 12px;
+}
+
+.es-property-editor {
+ flex: 1;
+}
+
+.es-add-component-wrapper {
+ margin-top: 8px;
+}
+
+.es-btn-add-component {
+ width: 100%;
+}
+
+/* =============================================================================
+ * SceneView Panel
+ * ============================================================================= */
+
+.es-sceneview-panel {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.es-sceneview-tools {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.es-zoom-display {
+ font-size: 11px;
+ color: var(--es-text-secondary);
+ min-width: 40px;
+}
+
+.es-sceneview-viewport {
+ flex: 1;
+ position: relative;
+ overflow: hidden;
+ background: #1a1a1a;
+}
+
+.es-sceneview-canvas {
+ display: block;
+}
+
+/* =============================================================================
+ * Common Elements
+ * ============================================================================= */
+
+.es-btn {
+ padding: 6px 12px;
+ background: var(--es-bg-tertiary);
+ border: 1px solid var(--es-border);
+ border-radius: 3px;
+ color: var(--es-text-primary);
+ font-size: 12px;
+ cursor: pointer;
+ transition: background 0.15s;
+}
+
+.es-btn:hover:not(:disabled) {
+ background: var(--es-bg-hover);
+}
+
+.es-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
+.es-btn-icon {
+ padding: 4px 8px;
+ min-width: 24px;
+}
+
+.es-btn-remove {
+ background: transparent;
+ border: none;
+ color: var(--es-text-secondary);
+ font-size: 16px;
+}
+
+.es-btn-remove:hover {
+ color: var(--es-danger);
+}
+
+.es-input {
+ padding: 6px 8px;
+ background: var(--es-bg-primary);
+ border: 1px solid var(--es-border);
+ border-radius: 3px;
+ color: var(--es-text-primary);
+ font-size: 12px;
+ width: 100%;
+}
+
+.es-input:focus {
+ outline: none;
+ border-color: var(--es-accent);
+}
+
+.es-input-number {
+ width: 100%;
+}
+
+.es-input-checkbox {
+ width: auto;
+}
+
+.es-input-select {
+ width: 100%;
+}
+
+/* =============================================================================
+ * Vector Editors
+ * ============================================================================= */
+
+.es-vec-editor {
+ display: flex;
+ gap: 4px;
+}
+
+.es-vec-field {
+ display: flex;
+ align-items: center;
+ flex: 1;
+}
+
+.es-vec-label {
+ width: 16px;
+ text-align: center;
+ font-size: 11px;
+ color: var(--es-text-secondary);
+}
+
+.es-vec-field .es-input {
+ flex: 1;
+ min-width: 0;
+}
+
+/* =============================================================================
+ * Color Editor
+ * ============================================================================= */
+
+.es-color-editor {
+ display: flex;
+ gap: 8px;
+}
+
+.es-input-color {
+ width: 48px;
+ height: 28px;
+ padding: 2px;
+ cursor: pointer;
+}
+
+.es-input-alpha {
+ width: 60px;
+}
+
+/* =============================================================================
+ * Context Menu
+ * ============================================================================= */
+
+.es-context-menu {
+ position: fixed;
+ 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);
+ min-width: 150px;
+ z-index: 1000;
+ overflow: hidden;
+}
+
+.es-context-menu-item {
+ padding: 8px 12px;
+ cursor: pointer;
+}
+
+.es-context-menu-item:hover {
+ background: var(--es-accent);
+ color: white;
+}
+
+/* =============================================================================
+ * Container Classes
+ * ============================================================================= */
+
+.es-hierarchy-container,
+.es-inspector-container,
+.es-sceneview-container {
+ height: 100%;
+}
diff --git a/editor/src/styles/index.ts b/editor/src/styles/index.ts
new file mode 100644
index 000000000..f7d9ecbd3
--- /dev/null
+++ b/editor/src/styles/index.ts
@@ -0,0 +1,18 @@
+/**
+ * @file index.ts
+ * @brief Editor styles loader
+ */
+
+export const EDITOR_STYLES_URL = new URL('./editor.css', import.meta.url).href;
+
+export function injectEditorStyles(): void {
+ if (document.querySelector('link[data-es-editor-styles]')) {
+ return;
+ }
+
+ const link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.href = EDITOR_STYLES_URL;
+ link.setAttribute('data-es-editor-styles', 'true');
+ document.head.appendChild(link);
+}
diff --git a/editor/src/types/SceneTypes.ts b/editor/src/types/SceneTypes.ts
new file mode 100644
index 000000000..3db207fa3
--- /dev/null
+++ b/editor/src/types/SceneTypes.ts
@@ -0,0 +1,72 @@
+/**
+ * @file SceneTypes.ts
+ * @brief Scene data types for the Web Editor
+ */
+
+import type { Entity } from 'esengine';
+
+// =============================================================================
+// Scene Data Types
+// =============================================================================
+
+export interface SceneData {
+ version: string;
+ name: string;
+ entities: EntityData[];
+}
+
+export interface EntityData {
+ id: number;
+ name: string;
+ parent: number | null;
+ children: number[];
+ components: ComponentData[];
+}
+
+export interface ComponentData {
+ type: string;
+ data: Record<string, unknown>;
+}
+
+// =============================================================================
+// Editor Types
+// =============================================================================
+
+export interface SelectionState {
+ entity: Entity | null;
+ entities: Entity[];
+}
+
+export interface ViewportState {
+ width: number;
+ height: number;
+ zoom: number;
+ panX: number;
+ panY: number;
+}
+
+// =============================================================================
+// Factory Functions
+// =============================================================================
+
+export function createEmptyScene(name: string = 'Untitled'): SceneData {
+ return {
+ version: '1.0',
+ name,
+ entities: [],
+ };
+}
+
+export function createEntityData(
+ id: number,
+ name: string = `Entity_${id}`,
+ parent: number | null = null
+): EntityData {
+ return {
+ id,
+ name,
+ parent,
+ children: [],
+ components: [],
+ };
+}
diff --git a/editor/src/types/index.ts b/editor/src/types/index.ts
new file mode 100644
index 000000000..a37e86b45
--- /dev/null
+++ b/editor/src/types/index.ts
@@ -0,0 +1,14 @@
+/**
+ * @file index.ts
+ * @brief Editor types exports
+ */
+
+export {
+ type SceneData,
+ type EntityData,
+ type ComponentData,
+ type SelectionState,
+ type ViewportState,
+ createEmptyScene,
+ createEntityData,
+} from './SceneTypes';
diff --git a/editor/tsconfig.json b/editor/tsconfig.json
new file mode 100644
index 000000000..25a4e8569
--- /dev/null
+++ b/editor/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "strict": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true
+ },
+ "include": ["src"]
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 000000000..4947e9269
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -0,0 +1,738 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ editor:
+ dependencies:
+ esengine:
+ specifier: workspace:*
+ version: link:../sdk
+ devDependencies:
+ '@rollup/plugin-typescript':
+ specifier: ^11.1.5
+ rimraf:
+ specifier: ^5.0.5
+ version: 5.0.10
+ rollup:
+ specifier: ^4.9.0
+ version: 4.57.1
+ rollup-plugin-dts:
+ specifier: ^6.1.0
+ tslib:
+ specifier: ^2.6.2
+ version: 2.8.1
+ typescript:
+ specifier: ^5.3.0
+ version: 5.9.3
+
+ sdk:
+ devDependencies:
+ '@rollup/plugin-typescript':
+ specifier: ^11.1.5
+ rimraf:
+ specifier: ^5.0.5
+ version: 5.0.10
+ rollup:
+ specifier: ^4.9.0
+ version: 4.57.1
+ rollup-plugin-dts:
+ specifier: ^6.1.0
+ tslib:
+ specifier: ^2.6.2
+ version: 2.8.1
+ typescript:
+ specifier: ^5.3.0
+ version: 5.9.3
+
+packages:
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
+ engines: {node: '>=6.9.0'}
+
+ '@isaacs/[email protected]':
+ resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
+ engines: {node: '>=12'}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
+
+ '@pkgjs/[email protected]':
+ resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
+ engines: {node: '>=14'}
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==}
+ engines: {node: '>=14.0.0'}
+ peerDependencies:
+ rollup: ^2.14.0||^3.0.0||^4.0.0
+ tslib: '*'
+ typescript: '>=3.7.0'
+ peerDependenciesMeta:
+ rollup:
+ optional: true
+ tslib:
+ optional: true
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==}
+ engines: {node: '>=14.0.0'}
+ peerDependencies:
+ rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
+ peerDependenciesMeta:
+ rollup:
+ optional: true
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==}
+ cpu: [arm]
+ os: [android]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==}
+ cpu: [arm64]
+ os: [android]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==}
+ cpu: [arm64]
+ os: [freebsd]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==}
+ cpu: [arm]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==}
+ cpu: [arm]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==}
+ cpu: [loong64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==}
+ cpu: [loong64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==}
+ cpu: [ppc64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==}
+ cpu: [ppc64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==}
+ cpu: [riscv64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==}
+ cpu: [riscv64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==}
+ cpu: [s390x]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==}
+ cpu: [x64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==}
+ cpu: [x64]
+ os: [linux]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==}
+ cpu: [x64]
+ os: [openbsd]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==}
+ cpu: [arm64]
+ os: [openharmony]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==}
+ cpu: [arm64]
+ os: [win32]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==}
+ cpu: [ia32]
+ os: [win32]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==}
+ cpu: [x64]
+ os: [win32]
+
+ '@rollup/[email protected]':
+ resolution: {integrity: sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==}
+ cpu: [x64]
+ os: [win32]
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
+
+ resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
+
+ resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==}
+
+ resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
+ engines: {node: '>=7.0.0'}
+
+ resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
+
+ resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
+
+ resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
+
+ resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
+
+ resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
+
+ resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
+ os: [darwin]
+
+ resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
+
+ resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==}
+ hasBin: true
+
+ resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
+
+ resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
+
+ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
+
+ resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
+
+ resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
+
+ resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
+ engines: {node: '>=16 || 14 >=14.17'}
+
+ resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
+ engines: {node: '>=16 || 14 >=14.17'}
+
+ resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
+
+ resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
+
+ resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
+ engines: {node: '>=16 || 14 >=14.18'}
+
+ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
+
+ resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==}
+ engines: {node: '>= 0.4'}
+ hasBin: true
+
+ resolution: {integrity: sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==}
+ hasBin: true
+
+ resolution: {integrity: sha512-d0UrqxYd8KyZ6i3M2Nx7WOMy708qsV/7fTHMHxCMCBOAe3V/U7OMPu5GkX8hC+cmkHhzGnfeYongl1IgiooddA==}
+ engines: {node: '>=16'}
+ peerDependencies:
+ rollup: ^3.29.4 || ^4
+ typescript: ^4.5 || ^5.0
+
+ resolution: {integrity: sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==}
+ engines: {node: '>=18.0.0', npm: '>=8.0.0'}
+ hasBin: true
+
+ resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
+ engines: {node: '>=14'}
+
+ resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+
+ resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+
+ resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
+ engines: {node: '>= 8'}
+ hasBin: true
+
+ resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==}
+ engines: {node: '>=12'}
+
+snapshots:
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/helper-validator-identifier': 7.28.5
+ js-tokens: 4.0.0
+ picocolors: 1.1.1
+ optional: true
+
+ '@babel/[email protected]':
+ optional: true
+
+ '@isaacs/[email protected]':
+ dependencies:
+ string-width: 5.1.2
+ string-width-cjs: [email protected]
+ strip-ansi: 7.1.2
+ strip-ansi-cjs: [email protected]
+ wrap-ansi: 8.1.0
+ wrap-ansi-cjs: [email protected]
+
+ '@jridgewell/[email protected]': {}
+
+ '@pkgjs/[email protected]':
+ optional: true
+
+ dependencies:
+ '@rollup/pluginutils': 5.3.0([email protected])
+ resolve: 1.22.11
+ typescript: 5.9.3
+ optionalDependencies:
+ rollup: 4.57.1
+ tslib: 2.8.1
+
+ dependencies:
+ '@types/estree': 1.0.8
+ estree-walker: 2.0.2
+ picomatch: 4.0.3
+ optionalDependencies:
+ rollup: 4.57.1
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@rollup/[email protected]':
+ optional: true
+
+ '@types/[email protected]': {}
+
+
+
+ dependencies:
+ color-convert: 2.0.1
+
+
+
+ dependencies:
+ balanced-match: 1.0.2
+
+ dependencies:
+ color-name: 1.1.4
+
+
+ dependencies:
+ path-key: 3.1.1
+ shebang-command: 2.0.0
+ which: 2.0.2
+
+
+
+
+
+ dependencies:
+ cross-spawn: 7.0.6
+ signal-exit: 4.1.0
+
+ optional: true
+
+
+ dependencies:
+ foreground-child: 3.3.1
+ jackspeak: 3.4.3
+ minimatch: 9.0.5
+ minipass: 7.1.2
+ package-json-from-dist: 1.0.1
+ path-scurry: 1.11.1
+
+ dependencies:
+ function-bind: 1.1.2
+
+ dependencies:
+ hasown: 2.0.2
+
+
+
+ dependencies:
+ '@isaacs/cliui': 8.0.2
+ optionalDependencies:
+ '@pkgjs/parseargs': 0.11.0
+
+ optional: true
+
+
+ dependencies:
+ '@jridgewell/sourcemap-codec': 1.5.5
+
+ dependencies:
+ brace-expansion: 2.0.2
+
+
+
+
+
+ dependencies:
+ lru-cache: 10.4.3
+ minipass: 7.1.2
+
+ optional: true
+
+
+ dependencies:
+ is-core-module: 2.16.1
+ path-parse: 1.0.7
+ supports-preserve-symlinks-flag: 1.0.0
+
+ dependencies:
+ glob: 10.5.0
+
+ dependencies:
+ magic-string: 0.30.21
+ rollup: 4.57.1
+ typescript: 5.9.3
+ optionalDependencies:
+ '@babel/code-frame': 7.29.0
+
+ dependencies:
+ '@types/estree': 1.0.8
+ optionalDependencies:
+ '@rollup/rollup-android-arm-eabi': 4.57.1
+ '@rollup/rollup-android-arm64': 4.57.1
+ '@rollup/rollup-darwin-arm64': 4.57.1
+ '@rollup/rollup-darwin-x64': 4.57.1
+ '@rollup/rollup-freebsd-arm64': 4.57.1
+ '@rollup/rollup-freebsd-x64': 4.57.1
+ '@rollup/rollup-linux-arm-gnueabihf': 4.57.1
+ '@rollup/rollup-linux-arm-musleabihf': 4.57.1
+ '@rollup/rollup-linux-arm64-gnu': 4.57.1
+ '@rollup/rollup-linux-arm64-musl': 4.57.1
+ '@rollup/rollup-linux-loong64-gnu': 4.57.1
+ '@rollup/rollup-linux-loong64-musl': 4.57.1
+ '@rollup/rollup-linux-ppc64-gnu': 4.57.1
+ '@rollup/rollup-linux-ppc64-musl': 4.57.1
+ '@rollup/rollup-linux-riscv64-gnu': 4.57.1
+ '@rollup/rollup-linux-riscv64-musl': 4.57.1
+ '@rollup/rollup-linux-s390x-gnu': 4.57.1
+ '@rollup/rollup-linux-x64-gnu': 4.57.1
+ '@rollup/rollup-linux-x64-musl': 4.57.1
+ '@rollup/rollup-openbsd-x64': 4.57.1
+ '@rollup/rollup-openharmony-arm64': 4.57.1
+ '@rollup/rollup-win32-arm64-msvc': 4.57.1
+ '@rollup/rollup-win32-ia32-msvc': 4.57.1
+ '@rollup/rollup-win32-x64-gnu': 4.57.1
+ '@rollup/rollup-win32-x64-msvc': 4.57.1
+ fsevents: 2.3.3
+
+ dependencies:
+ shebang-regex: 3.0.0
+
+
+
+ dependencies:
+ emoji-regex: 8.0.0
+ is-fullwidth-code-point: 3.0.0
+ strip-ansi: 6.0.1
+
+ dependencies:
+ eastasianwidth: 0.2.0
+ emoji-regex: 9.2.2
+ strip-ansi: 7.1.2
+
+ dependencies:
+ ansi-regex: 5.0.1
+
+ dependencies:
+ ansi-regex: 6.2.2
+
+
+
+
+ dependencies:
+ isexe: 2.0.0
+
+ dependencies:
+ ansi-styles: 4.3.0
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+
+ dependencies:
+ ansi-styles: 6.2.3
+ string-width: 5.1.2
+ strip-ansi: 7.1.2
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
new file mode 100644
index 000000000..8841361ee
--- /dev/null
+++ b/pnpm-workspace.yaml
@@ -0,0 +1,3 @@
+packages:
+ - 'sdk'
+ - 'editor'