Skip to content

@web-engine-dev/editor-core

Core editor framework providing undo/redo command system, editor plugin architecture, selection management, and workspace state. Acts as the backbone for the full editor application.

Layer 8 · Content

Features

  • Command System: Complete undo/redo with command grouping, macros, and history serialization
  • Plugin Architecture: Modular editor extensions with lifecycle hooks and dependency resolution
  • Selection Manager: Multi-select with selection sets, locking, and filter predicates
  • Workspace State: Project settings, recently opened files, editor preferences
  • Asset Database: Track all project assets with metadata, thumbnails, and dependency graphs
  • Scene Operations: Create, duplicate, delete, reparent, copy/paste entities
  • Editor Modes: Scene, Game, Animation, Timeline, Terrain painting
  • Keyboard Shortcuts: Rebindable shortcuts with conflict detection and chording
  • Multi-Window: Detachable panels with layout save/restore

Installation

bash
npm install @web-engine-dev/editor-core
# or
pnpm add @web-engine-dev/editor-core

Quick Start

typescript
import { Editor, Command, EditorPlugin } from '@web-engine-dev/editor-core';

// Execute undoable commands
class MoveEntityCommand extends Command {
  constructor(
    private entity: Entity,
    private delta: Vec3
  ) {
    super();
  }

  execute() {
    this.entity.position.add(this.delta);
  }
  undo() {
    this.entity.position.sub(this.delta);
  }
}

editor.execute(new MoveEntityCommand(entity, { x: 1, y: 0, z: 0 }));
editor.undo(); // Reverts the move
editor.redo(); // Re-applies the move

// Create an editor plugin
class TerrainBrushPlugin extends EditorPlugin {
  name = 'terrain-brush';
  dependencies = ['viewport', 'selection'];

  onActivate(editor: Editor) {
    editor.registerTool('terrain-brush', this.brushTool);
  }

  onDeactivate() {
    // Cleanup
  }
}

Architecture

ModuleResponsibility
CommandManagerUndo/redo stack, command grouping, macro recording
SelectionManagerEntity selection state, multi-select, selection events
PluginRegistryLoad, initialize, and manage editor plugins
ShortcutManagerKey binding registration, conflict detection
WorkspaceManagerProject configuration, layout persistence
AssetDatabaseAsset tracking, metadata, dependency resolution

Dependencies

  • @web-engine-dev/ecs — Entity-Component-System
  • @web-engine-dev/scene — Scene management
  • @web-engine-dev/events — Event system
  • @web-engine-dev/serialization — State serialization

Proprietary software. All rights reserved.