Skip to content

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

feat: integrate dockview-core layout system and fix component reorder refresh

esengine9a03a8d4af53
diff --git a/desktop/package.json b/desktop/package.json
index 515008366..79eecbf4e 100644
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -11,13 +11,14 @@
},
"dependencies": {
"@esengine/editor": "workspace:*",
- "esengine": "workspace:*",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-dialog": "^2.0.0",
"@tauri-apps/plugin-fs": "^2.0.0",
- "@tauri-apps/plugin-shell": "^2.0.0",
"@tauri-apps/plugin-process": "^2.0.0",
- "@tauri-apps/plugin-updater": "^2.0.0"
+ "@tauri-apps/plugin-shell": "^2.0.0",
+ "@tauri-apps/plugin-updater": "^2.0.0",
+ "dockview-core": "^4.13.1",
+ "esengine": "workspace:*"
},
"devDependencies": {
"@tauri-apps/cli": "^2.0.0",
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index 3ecd0be89..3b1e90e2c 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -3,6 +3,7 @@
* @brief Desktop application entry point
*/
+import 'dockview-core/dist/styles/dockview.css';
import '@esengine/editor/styles';
import { createEditor, ProjectLauncher, setPlatformAdapter, setEditorContext, loadProjectConfig, showToast, dismissToast, showProgressToast, updateToast, type Editor } from '@esengine/editor';
import { TauriPlatformAdapter } from './TauriPlatformAdapter';
diff --git a/editor/package.json b/editor/package.json
index ba5d4bf78..845a81012 100644
--- a/editor/package.json
+++ b/editor/package.json
@@ -24,6 +24,7 @@
"test:coverage": "vitest --coverage"
},
"dependencies": {
+ "dockview-core": "^4.13.1",
"esbuild-wasm": "^0.27.2",
"esengine": "workspace:*",
"lucide": "^0.563.0"
diff --git a/editor/src/DockLayoutManager.ts b/editor/src/DockLayoutManager.ts
new file mode 100644
index 000000000..edbe26e52
--- /dev/null
+++ b/editor/src/DockLayoutManager.ts
@@ -0,0 +1,201 @@
+import {
+ createDockview,
+ themeDark,
+ type DockviewApi,
+ type IContentRenderer,
+ type GroupPanelPartInitParameters,
+ type SerializedDockview,
+} from 'dockview-core';
+import type { EditorStore } from './store/EditorStore';
+import type { PanelDescriptor } from './panels/PanelRegistry';
+import type { PanelManager } from './PanelManager';
+
+const LAYOUT_STORAGE_KEY = 'esengine.editor.layout';
+
+class EditorPanelRenderer implements IContentRenderer {
+ private readonly element_: HTMLElement;
+ private panelId_: string;
+ private panelManager_: PanelManager;
+ private store_: EditorStore;
+
+ get element(): HTMLElement {
+ return this.element_;
+ }
+
+ constructor(panelId: string, panelManager: PanelManager, store: EditorStore) {
+ this.panelId_ = panelId;
+ this.panelManager_ = panelManager;
+ this.store_ = store;
+ this.element_ = document.createElement('div');
+ this.element_.className = 'es-panel-container';
+ this.element_.dataset.panelId = panelId;
+ this.element_.style.width = '100%';
+ this.element_.style.height = '100%';
+ this.element_.style.overflow = 'hidden';
+ }
+
+ init(_params: GroupPanelPartInitParameters): void {
+ this.panelManager_.createPanelInContainer(this.panelId_, this.element_, this.store_);
+ }
+
+ dispose(): void {}
+}
+
+export class DockLayoutManager {
+ private api_: DockviewApi | null = null;
+ private panelManager_: PanelManager;
+ private store_: EditorStore;
+ private layoutChangeDisposable_: { dispose(): void } | null = null;
+
+ constructor(panelManager: PanelManager, store: EditorStore) {
+ this.panelManager_ = panelManager;
+ this.store_ = store;
+ }
+
+ get api(): DockviewApi | null {
+ return this.api_;
+ }
+
+ initialize(container: HTMLElement): void {
+ this.api_ = createDockview(container, {
+ theme: themeDark,
+ createComponent: (options) => {
+ return new EditorPanelRenderer(
+ options.id,
+ this.panelManager_,
+ this.store_,
+ );
+ },
+ disableFloatingGroups: true,
+ });
+
+ const saved = this.loadSavedLayout();
+ if (saved) {
+ try {
+ this.api_.fromJSON(saved);
+ this.startSavingLayout();
+ return;
+ } catch {
+ localStorage.removeItem(LAYOUT_STORAGE_KEY);
+ }
+ }
+
+ this.applyDefaultLayout();
+ this.startSavingLayout();
+ }
+
+ private applyDefaultLayout(): void {
+ if (!this.api_) return;
+
+ this.api_.addPanel({
+ id: 'hierarchy',
+ component: 'hierarchy',
+ title: 'Hierarchy',
+ initialWidth: 250,
+ });
+
+ this.api_.addPanel({
+ id: 'scene',
+ component: 'scene',
+ title: 'Scene',
+ position: { referencePanel: 'hierarchy', direction: 'right' },
+ });
+
+ this.api_.addPanel({
+ id: 'inspector',
+ component: 'inspector',
+ title: 'Inspector',
+ position: { referencePanel: 'scene', direction: 'right' },
+ initialWidth: 260,
+ });
+
+ this.api_.addPanel({
+ id: 'content-browser',
+ component: 'content-browser',
+ title: 'Content Browser',
+ position: { referencePanel: 'scene', direction: 'below' },
+ initialHeight: 250,
+ });
+
+ this.api_.addPanel({
+ id: 'output',
+ component: 'output',
+ title: 'Output',
+ position: { referencePanel: 'content-browser' },
+ inactive: true,
+ });
+ }
+
+ private startSavingLayout(): void {
+ if (!this.api_) return;
+ this.layoutChangeDisposable_ = this.api_.onDidLayoutChange(() => {
+ this.saveLayout();
+ });
+ }
+
+ saveLayout(): void {
+ if (!this.api_) return;
+ try {
+ const json = this.api_.toJSON();
+ localStorage.setItem(LAYOUT_STORAGE_KEY, JSON.stringify(json));
+ } catch {
+ // ignore serialization failures
+ }
+ }
+
+ private loadSavedLayout(): SerializedDockview | null {
+ try {
+ const raw = localStorage.getItem(LAYOUT_STORAGE_KEY);
+ if (raw) return JSON.parse(raw);
+ } catch {
+ // ignore parse failures
+ }
+ return null;
+ }
+
+ resetLayout(): void {
+ if (!this.api_) return;
+ localStorage.removeItem(LAYOUT_STORAGE_KEY);
+ this.api_.clear();
+ this.applyDefaultLayout();
+ }
+
+ addPanel(desc: PanelDescriptor): void {
+ if (!this.api_) return;
+
+ const existing = this.api_.getPanel(desc.id);
+ if (existing) return;
+
+ const position = desc.position ?? 'bottom';
+ let referenceId = 'scene';
+ if (position === 'bottom') referenceId = 'content-browser';
+ else if (position === 'left') referenceId = 'hierarchy';
+ else if (position === 'right') referenceId = 'inspector';
+
+ const refPanel = this.api_.getPanel(referenceId);
+ if (!refPanel) return;
+
+ this.api_.addPanel({
+ id: desc.id,
+ component: desc.id,
+ title: desc.title,
+ position: { referencePanel: refPanel },
+ inactive: true,
+ });
+ }
+
+ removePanel(id: string): void {
+ if (!this.api_) return;
+ const panel = this.api_.getPanel(id);
+ if (panel) {
+ this.api_.removePanel(panel);
+ }
+ }
+
+ dispose(): void {
+ this.layoutChangeDisposable_?.dispose();
+ this.layoutChangeDisposable_ = null;
+ this.api_?.dispose();
+ this.api_ = null;
+ }
+}
diff --git a/editor/src/Editor.ts b/editor/src/Editor.ts
index 7533cb58c..7fa896811 100644
--- a/editor/src/Editor.ts
+++ b/editor/src/Editor.ts
@@ -14,7 +14,7 @@ import { MenuManager } from './MenuManager';
import { PreviewManager } from './PreviewManager';
import {
registerPanel,
- getPanelsByPosition,
+ getAllPanels,
isBuiltinPanel,
} from './panels/PanelRegistry';
import { registerBuiltinPanels } from './panels/builtinPanels';
@@ -70,7 +70,7 @@ import {
} from './settings';
import { loadProjectConfig, loadEditorLocalSettings, saveEditorLocalSetting } from './launcher/ProjectService';
import type { SpineVersion } from './types/ProjectTypes';
-import { Splitter } from './ui/Splitter';
+import { DockLayoutManager } from './DockLayoutManager';
import {
lockBuiltinPanels, clearExtensionPanels,
} from './panels/PanelRegistry';
@@ -96,7 +96,7 @@ export class Editor {
private baseAPI_: Record<string, unknown> | null = null;
private scriptLoader_: ScriptLoader | null = null;
private extensionLoader_: ExtensionLoader | null = null;
- private splitters_: Splitter[] = [];
+ private dockLayout_: DockLayoutManager | null = null;
private assetLibraryReady_: Promise<void> = Promise.resolve();
private clipboard_: EntityData[] | null = null;
private addressableWindow_: { element: HTMLElement; panel: AddressablePanel; keyHandler: (e: KeyboardEvent) => void } | null = null;
@@ -168,10 +168,6 @@ export class Editor {
return this.store_.filePath;
}
- get activeBottomPanelId(): string | null {
- return this.panelManager_.activeBottomPanelId;
- }
-
setApp(app: App): void {
this.app_ = app;
this.bridge_ = new EditorBridge(app, this.store_);
@@ -218,6 +214,12 @@ export class Editor {
// =========================================================================
showPanel(id: string): void {
+ if (this.dockLayout_?.api) {
+ const panel = this.dockLayout_.api.getPanel(id);
+ if (panel) {
+ panel.api.setActive();
+ }
+ }
this.panelManager_.showPanel(id);
}
@@ -226,12 +228,11 @@ export class Editor {
}
togglePanel(id: string): void {
- this.panelManager_.togglePanel(id);
+ this.showPanel(id);
}
- toggleBottomPanel(id: string): void {
- this.panelManager_.toggleBottomPanel(id, this.container_);
- this.menuManager_.updateStatusbar();
+ resetLayout(): void {
+ this.dockLayout_?.resetLayout();
}
// =========================================================================
@@ -751,7 +752,14 @@ export class Editor {
}
private cleanupExtensionUI(): void {
- this.panelManager_.cleanupExtensionPanels(this.container_);
+ if (this.dockLayout_) {
+ for (const [id] of this.panelManager_.panelInstances) {
+ if (!isBuiltinPanel(id)) {
+ this.dockLayout_.removePanel(id);
+ }
+ }
+ }
+ this.panelManager_.cleanupExtensionPanels();
this.container_.querySelectorAll('[data-statusbar-id^="toggle-"]').forEach(el => {
const panelId = el.getAttribute('data-statusbar-id')?.replace('toggle-', '');
@@ -770,14 +778,12 @@ export class Editor {
}
private applyExtensionUI(): void {
- this.panelManager_.instantiateExtensionPanels(
- this.container_, this.store_, this.bridge_, this.app_,
- );
- this.menuManager_.addExtensionBottomPanelToggles(
- this.container_,
- this.panelManager_.activeBottomPanelId,
- (id) => this.toggleBottomPanel(id),
- );
+ if (this.dockLayout_) {
+ for (const desc of getAllPanels()) {
+ if (isBuiltinPanel(desc.id)) continue;
+ this.dockLayout_.addPanel(desc);
+ }
+ }
this.menuManager_.rebuildMenuBar(this.container_);
}
@@ -857,8 +863,7 @@ export class Editor {
const projectDir = this.projectPath_.replace(/[/\\][^/\\]+$/, '');
- this.panelManager_.showBottomPanel('output', this.container_);
- this.menuManager_.updateStatusbar();
+ this.showPanel('output');
const parts = fullCommand.split(/\s+/);
const cmd = parts[0];
@@ -948,22 +953,13 @@ export class Editor {
</div>
<button class="es-btn es-btn-preview" data-action="preview">${icons.play(14)} Preview</button>
</div>
- <div class="es-editor-tabs">
- ${this.panelManager_.buildTabBarHTML()}
- </div>
- <div class="es-editor-body">
- ${this.panelManager_.buildMainPanelsHTML()}
- <div class="es-editor-bottom">
- ${this.panelManager_.buildBottomPanelsHTML()}
- </div>
- </div>
+ <div class="es-editor-dock"></div>
${this.menuManager_.buildStatusBarHTML()}
`;
- this.panelManager_.instantiatePanels(this.container_, this.store_);
- this.panelManager_.setupTabEvents(this.container_);
- this.panelManager_.updateBottomPanelVisibility(this.container_);
- this.setupSplitters();
+ const dockContainer = this.container_.querySelector('.es-editor-dock') as HTMLElement;
+ this.dockLayout_ = new DockLayoutManager(this.panelManager_, this.store_);
+ this.dockLayout_.initialize(dockContainer);
setEditorInstance(this);
@@ -986,75 +982,6 @@ export class Editor {
this.installConsoleCapture();
}
- private setupSplitters(): void {
- const main = this.container_.querySelector('.es-editor-main');
- if (!main) return;
-
- const leftPanel = main.querySelector('.es-editor-left') as HTMLElement;
- const centerPanel = main.querySelector('.es-editor-center') as HTMLElement;
- const rightPanel = main.querySelector('.es-editor-right') as HTMLElement;
-
- if (leftPanel && centerPanel) {
- const leftSize = this.loadPanelSize('panelSizeLeft', 250);
- const leftSplitter = new Splitter({
- direction: 'horizontal',
- container: main as HTMLElement,
- leftPanel,
- rightPanel: centerPanel,
- minSize: 200,
- defaultPosition: leftSize,
- onResize: (size) => {
- this.savePanelSize('panelSizeLeft', size);
- },
- });
- this.splitters_.push(leftSplitter);
- }
-
- if (centerPanel && rightPanel) {
- const rightSize = this.loadPanelSize('panelSizeRight', 260);
- const rightSplitter = new Splitter({
- direction: 'horizontal',
- container: main as HTMLElement,
- leftPanel: centerPanel,
- rightPanel,
- minSize: 220,
- defaultPosition: rightSize,
- onResize: (_, size) => {
- this.savePanelSize('panelSizeRight', size);
- },
- });
- this.splitters_.push(rightSplitter);
- }
-
- const body = this.container_.querySelector('.es-editor-body') as HTMLElement;
- const bottomPanel = this.container_.querySelector('.es-editor-bottom') as HTMLElement;
- if (body && main && bottomPanel) {
- const bottomSize = this.loadPanelSize('panelSizeBottom', 250);
- bottomPanel.style.height = `${bottomSize}px`;
- (main as HTMLElement).style.flex = '1';
- const bottomSplitter = new Splitter({
- direction: 'vertical',
- container: body,
- leftPanel: main as HTMLElement,
- rightPanel: bottomPanel,
- minSize: 120,
- onResize: (_, size) => {
- this.savePanelSize('panelSizeBottom', size);
- },
- });
- this.splitters_.push(bottomSplitter);
- }
- }
-
- private loadPanelSize(key: string, defaultValue: number): number {
- const stored = localStorage.getItem(`esengine.editor.${key}`);
- return stored ? parseInt(stored, 10) : defaultValue;
- }
-
- private savePanelSize(key: string, value: number): void {
- localStorage.setItem(`esengine.editor.${key}`, String(value));
- }
-
private updateSceneNameDisplay(): void {
const el = this.container_.querySelector('.es-menubar-scene-name');
if (!el) return;
@@ -1137,6 +1064,7 @@ export class Editor {
this.menuManager_.dispose();
this.scriptLoader_?.dispose();
this.extensionLoader_?.dispose();
+ this.dockLayout_?.dispose();
this.panelManager_.dispose();
this.previewManager_.dispose();
clearEditorAPI();
diff --git a/editor/src/PanelManager.ts b/editor/src/PanelManager.ts
index b5b4c556e..57c604469 100644
--- a/editor/src/PanelManager.ts
+++ b/editor/src/PanelManager.ts
@@ -3,11 +3,8 @@ import type { SpineModuleController, SpineWasmModule } from 'esengine/spine';
import { wrapSpineModule, SpineModuleController as SpineModuleControllerClass } from 'esengine/spine';
import type { EditorStore } from './store/EditorStore';
import type { EditorBridge } from './bridge/EditorBridge';
-import type { PanelInstance, PanelPosition, PanelDescriptor } from './panels/PanelRegistry';
+import type { PanelInstance, PanelDescriptor } from './panels/PanelRegistry';
import {
- getAllPanels,
- getPanelsByPosition,
- isResizable,
isBridgeAware,
isAppAware,
isAssetServerProvider,
@@ -16,18 +13,15 @@ import {
isSpineControllerAware,
isSpineInfoProvider,
isBuiltinPanel,
+ getPanel,
} from './panels/PanelRegistry';
import type { EditorAssetServer } from './asset/EditorAssetServer';
import { icons } from './utils/icons';
export class PanelManager {
private panelInstances_ = new Map<string, PanelInstance>();
- private activeBottomPanelId_: string | null = 'content-browser';
- private activeTabIds_ = new Map<string, string>();
-
- get activeBottomPanelId(): string | null {
- return this.activeBottomPanelId_;
- }
+ private bridge_: EditorBridge | null = null;
+ private app_: App | null = null;
get panelInstances(): Map<string, PanelInstance> {
return this.panelInstances_;
@@ -40,45 +34,11 @@ export class PanelManager {
return null;
}
- instantiatePanels(container: HTMLElement, store: EditorStore): void {
- for (const desc of getAllPanels()) {
- if (!desc.defaultVisible && desc.position !== 'bottom') continue;
- const el = container.querySelector(`[data-panel-id="${desc.id}"]`) as HTMLElement;
- if (!el) continue;
- this.createPanelWithErrorBoundary(desc, el, store);
- }
- }
-
- instantiateExtensionPanels(
- container: HTMLElement,
- store: EditorStore,
- bridge: EditorBridge | null,
- app: App | null,
- ): void {
- for (const desc of getAllPanels()) {
- if (this.panelInstances_.has(desc.id)) continue;
-
- const position = desc.position ?? 'bottom';
- let parentEl: HTMLElement | null = null;
-
- if (position === 'bottom') {
- parentEl = container.querySelector('.es-editor-bottom');
- } else {
- parentEl = container.querySelector(`.es-editor-${position}`);
- }
- if (!parentEl) continue;
-
- const panelContainer = document.createElement('div');
- panelContainer.className = 'es-panel-container';
- panelContainer.dataset.panelId = desc.id;
-
- if (position === 'bottom') {
- panelContainer.style.display = 'none';
- }
-
- parentEl.appendChild(panelContainer);
- this.createPanelWithErrorBoundary(desc, panelContainer, store, bridge, app);
- }
+ createPanelInContainer(panelId: string, container: HTMLElement, store: EditorStore): void {
+ if (this.panelInstances_.has(panelId)) return;
+ const desc = getPanel(panelId);
+ if (!desc) return;
+ this.createPanelWithErrorBoundary(desc, container, store, this.bridge_, this.app_);
}
private createPanelWithErrorBoundary(
@@ -137,6 +97,8 @@ export class PanelManager {
}
setApp(app: App, bridge: EditorBridge): void {
+ this.app_ = app;
+ this.bridge_ = bridge;
for (const panel of this.panelInstances_.values()) {
if (isBridgeAware(panel)) panel.setBridge(bridge);
if (isAppAware(panel)) panel.setApp(app);
@@ -196,80 +158,6 @@ export class PanelManager {
}
}
- togglePanel(id: string): void {
- try {
- this.panelInstances_.get(id)?.onShow?.();
- } catch (err) {
- console.error(`Panel "${id}" onShow failed:`, err);
- }
- }
-
- showBottomPanel(id: string, container: HTMLElement): void {
- if (this.activeBottomPanelId_ === id) return;
- const prev = this.activeBottomPanelId_;
- this.activeBottomPanelId_ = id;
- this.updateBottomPanelVisibility(container);
- if (prev) {
- try {
- this.panelInstances_.get(prev)?.onHide?.();
- } catch (err) {
- console.error(`Panel "${prev}" onHide failed:`, err);
- }
- }
- try {
- this.panelInstances_.get(id)?.onShow?.();
- } catch (err) {
- console.error(`Panel "${id}" onShow failed:`, err);
- }
- }
-
- toggleBottomPanel(id: string, container: HTMLElement): void {
- const prev = this.activeBottomPanelId_;
- if (prev === id) {
- this.activeBottomPanelId_ = null;
- } else {
- this.activeBottomPanelId_ = id;
- }
- this.updateBottomPanelVisibility(container);
- if (prev && prev !== id) {
- try {
- this.panelInstances_.get(prev)?.onHide?.();
- } catch (err) {
- console.error(`Panel "${prev}" onHide failed:`, err);
- }
- }
- if (this.activeBottomPanelId_) {
- try {
- this.panelInstances_.get(this.activeBottomPanelId_)?.onShow?.();
- } catch (err) {
- console.error(`Panel "${this.activeBottomPanelId_}" onShow failed:`, err);
- }
- }
- }
-
- updateBottomPanelVisibility(container: HTMLElement): void {
- const bottomSection = container.querySelector('.es-editor-bottom') as HTMLElement;
- const bottomPanels = getPanelsByPosition('bottom');
-
- for (const desc of bottomPanels) {
- const el = container.querySelector(`[data-panel-id="${desc.id}"]`) as HTMLElement;
- if (el) {
- el.style.display = desc.id === this.activeBottomPanelId_ ? '' : 'none';
- }
- }
-
- if (bottomSection) {
- bottomSection.style.display = this.activeBottomPanelId_ ? '' : 'none';
- }
-
- for (const panel of this.panelInstances_.values()) {
- if (isResizable(panel)) {
- requestAnimationFrame(() => panel.resize());
- break;
- }
- }
- }
-
appendOutput(text: string, type: 'command' | 'stdout' | 'stderr' | 'error' | 'success'): void {
const outputPanel = this.panelInstances_.get('output');
if (outputPanel && isOutputAppendable(outputPanel)) {
@@ -277,104 +165,14 @@ export class PanelManager {
}
}
- cleanupExtensionPanels(container: HTMLElement): void {
+ cleanupExtensionPanels(): void {
for (const [id, instance] of this.panelInstances_) {
if (isBuiltinPanel(id)) continue;
instance.dispose();
this.panelInstances_.delete(id);
- container.querySelector(`[data-panel-id="${id}"]`)?.remove();
}
}
- buildMainPanelsHTML(): string {
- const sections = (['left', 'center', 'right'] as const).map(pos => {
- const panels = getPanelsByPosition(pos).filter(p => p.defaultVisible);
- const containers = panels.map(p =>
- `<div class="es-panel-container" data-panel-id="${p.id}"></div>`
- ).join('');
- return `<div class="es-editor-${pos}">${containers}</div>`;
- }).join('');
- return `<div class="es-editor-main">${sections}</div>`;
- }
-
- buildBottomPanelsHTML(): string {
- const panels = getPanelsByPosition('bottom');
- return panels.map(p =>
- `<div class="es-panel-container" data-panel-id="${p.id}" style="display: none;"></div>`
- ).join('');
- }
-
- buildTabBarHTML(): string {
- const positions: PanelPosition[] = ['left', 'center', 'right'];
- const allPanels = positions.flatMap(pos => getPanelsByPosition(pos))
- .filter(p => p.defaultVisible);
-
- for (const p of allPanels) {
- const pos = p.position ?? 'center';
- if (!this.activeTabIds_.has(pos)) {
- this.activeTabIds_.set(pos, p.id);
- }
- }
-
- return allPanels.map(p => {
- const pos = p.position ?? 'center';
- const isActive = this.activeTabIds_.get(pos) === p.id;
- return `
- <div class="es-tab${isActive ? ' es-tab-active' : ''}" data-panel="${p.id}" data-position="${pos}">
- <span class="es-tab-label">${p.title}</span>
- <button class="es-tab-close">${icons.x(10)}</button>
- </div>
- `;
- }).join('');
- }
-
- setupTabEvents(container: HTMLElement): void {
- const tabBar = container.querySelector('.es-editor-tabs');
- if (!tabBar) return;
-
- tabBar.addEventListener('click', (e) => {
- const target = e.target as HTMLElement;
- const closeBtn = target.closest('.es-tab-close');
- const tab = target.closest('.es-tab') as HTMLElement;
- if (!tab) return;
-
- const panelId = tab.dataset.panel;
- if (!panelId) return;
-
- if (closeBtn) {
- const panelEl = container.querySelector(`[data-panel-id="${panelId}"]`) as HTMLElement;
- if (panelEl) {
- panelEl.style.display = 'none';
- }
- tab.style.display = 'none';
- this.hidePanel(panelId);
- return;
- }
-
- const pos = tab.dataset.position;
- if (pos) {
- this.activeTabIds_.set(pos, panelId);
- }
-
- tabBar.querySelectorAll('.es-tab').forEach(t => {
- const el = t as HTMLElement;
- if (el.dataset.position === pos) {
- el.classList.toggle('es-tab-active', el.dataset.panel === panelId);
- }
- });
-
- const panels = getPanelsByPosition(pos as PanelPosition);
- for (const p of panels) {
- const panelEl = container.querySelector(`[data-panel-id="${p.id}"]`) as HTMLElement;
- if (panelEl) {
- panelEl.style.display = p.id === panelId ? '' : 'none';
- }
- }
-
- this.showPanel(panelId);
- });
- }
-
dispose(): void {
for (const panel of this.panelInstances_.values()) {
panel.dispose();
diff --git a/editor/src/menus/builtinMenus.ts b/editor/src/menus/builtinMenus.ts
index 0157378a5..28ef68a18 100644
--- a/editor/src/menus/builtinMenus.ts
+++ b/editor/src/menus/builtinMenus.ts
@@ -117,25 +117,30 @@ export function registerBuiltinMenus(editor: Editor): void {
registerMenuItem({
id: 'view.hierarchy', menu: 'view', label: 'Hierarchy', order: 0,
- action: () => editor.togglePanel('hierarchy'),
+ action: () => editor.showPanel('hierarchy'),
});
registerMenuItem({
id: 'view.inspector', menu: 'view', label: 'Inspector', order: 1,
- action: () => editor.togglePanel('inspector'),
+ action: () => editor.showPanel('inspector'),
});
registerMenuItem({
id: 'view.content-browser', menu: 'view', label: 'Content Browser', order: 2,
- action: () => editor.toggleBottomPanel('content-browser'),
+ action: () => editor.showPanel('content-browser'),
});
registerMenuItem({
id: 'view.output', menu: 'view', label: 'Output', order: 3,
- action: () => editor.toggleBottomPanel('output'),
+ action: () => editor.showPanel('output'),
});
registerMenuItem({
id: 'view.addressable', menu: 'view', label: 'Addressable Groups',
order: 4, separator: true,
action: () => editor.showAddressableWindow(),
});
+ registerMenuItem({
+ id: 'view.reset-layout', menu: 'view', label: 'Reset Layout',
+ order: 5, separator: true,
+ action: () => editor.resetLayout(),
+ });
registerMenuItem({
id: 'view.reload-extensions', menu: 'view', label: 'Reload Extensions',
order: 10, separator: true,
diff --git a/editor/src/menus/builtinStatusbar.ts b/editor/src/menus/builtinStatusbar.ts
index 7d9aac920..325b746f7 100644
--- a/editor/src/menus/builtinStatusbar.ts
+++ b/editor/src/menus/builtinStatusbar.ts
@@ -35,15 +35,11 @@ export function registerBuiltinStatusbarItems(editor: Editor): void {
btn.innerHTML += icons.chevronDown(10);
}
- btn.addEventListener('click', () => editor.toggleBottomPanel(panel.id));
+ btn.addEventListener('click', () => editor.showPanel(panel.id));
container.appendChild(btn);
return {
dispose() { btn.remove(); },
- update() {
- const isActive = editor.activeBottomPanelId === panel.id;
- btn.classList.toggle('es-active', isActive);
- },
};
},
});
@@ -147,7 +143,7 @@ export function registerBuiltinStatusbarItems(editor: Editor): void {
const notifBtn = document.createElement('button');
notifBtn.title = 'Notifications';
notifBtn.innerHTML = icons.list(12);
- notifBtn.addEventListener('click', () => editor.toggleBottomPanel('output'));
+ notifBtn.addEventListener('click', () => editor.showPanel('output'));
const settingsBtn = document.createElement('button');
settingsBtn.title = 'Settings';
diff --git a/editor/src/panels/InspectorPanel.ts b/editor/src/panels/InspectorPanel.ts
index a2a3ed785..8db94f334 100644
--- a/editor/src/panels/InspectorPanel.ts
+++ b/editor/src/panels/InspectorPanel.ts
@@ -34,6 +34,7 @@ export class InspectorPanel {
private currentAssetPath_: string | null = null;
private currentComponentCount_: number = 0;
private currentPrefabPath_: string | undefined = undefined;
+ private currentComponentOrder_: string = '';
private imageUrlRef_: ImageUrlRef = { current: null };
private footerContainer_: HTMLElement | null = null;
@@ -154,8 +155,11 @@ export class InspectorPanel {
const entityData = this.store_.getSelectedEntityData();
const componentCount = entityData?.components.length ?? 0;
const prefabPath = entityData?.prefab?.prefabPath;
+ const componentOrder = entityData?.components.map(c => c.type).join(',') ?? '';
- return componentCount !== this.currentComponentCount_ || prefabPath !== this.currentPrefabPath_;
+ return componentCount !== this.currentComponentCount_
+ || prefabPath !== this.currentPrefabPath_
+ || componentOrder !== this.currentComponentOrder_;
}
private renderEmptyState(): void {
@@ -166,6 +170,7 @@ export class InspectorPanel {
this.currentEntity_ = null;
this.currentAssetPath_ = null;
this.currentComponentCount_ = 0;
+ this.currentComponentOrder_ = '';
this.disposeEditors();
this.cleanupImageUrl();
this.contentContainer_.innerHTML = '<div class="es-inspector-empty">No selection</div>';
@@ -185,6 +190,7 @@ export class InspectorPanel {
this.currentEntity_ = entity;
this.currentAssetPath_ = null;
this.currentComponentCount_ = componentCount;
+ this.currentComponentOrder_ = entityData?.components.map(c => c.type).join(',') ?? '';
this.currentPrefabPath_ = prefabPath;
this.disposeEditors();
this.cleanupImageUrl();
@@ -225,6 +231,7 @@ export class InspectorPanel {
this.currentEntity_ = null;
this.currentAssetPath_ = null;
this.currentComponentCount_ = 0;
+ this.currentComponentOrder_ = '';
this.disposeEditors();
this.cleanupImageUrl();
this.contentContainer_.innerHTML = '';
@@ -252,6 +259,7 @@ export class InspectorPanel {
this.currentAssetPath_ = asset.path;
this.currentEntity_ = null;
this.currentComponentCount_ = 0;
+ this.currentComponentOrder_ = '';
this.disposeEditors();
this.cleanupImageUrl();
this.contentContainer_.innerHTML = '';
diff --git a/editor/src/styles/editor.css b/editor/src/styles/editor.css
index a63251d88..6835207da 100644
--- a/editor/src/styles/editor.css
+++ b/editor/src/styles/editor.css
@@ -272,78 +272,30 @@ svg {
background: #c9302c;
}
-.es-editor-body {
- display: flex;
- flex-direction: column;
- flex: 1;
- overflow: hidden;
-}
-
-.es-editor-main {
- display: flex;
+.es-editor-dock {
flex: 1;
overflow: hidden;
}
-.es-editor-left {
- width: 250px;
- min-width: 200px;
- display: flex;
- flex-direction: column;
-}
-
-.es-editor-center {
- flex: 1;
- min-width: 300px;
- display: flex;
- flex-direction: column;
-}
-
-.es-editor-right {
- width: 260px;
- min-width: 220px;
- display: flex;
- flex-direction: column;
-}
-
-.es-splitter {
- background: var(--es-border);
- flex-shrink: 0;
- position: relative;
- transition: background 0.15s;
-}
-
-.es-splitter:hover {
- background: var(--es-accent);
-}
-
-.es-splitter-horizontal {
- width: 4px;
- cursor: col-resize;
-}
-
-.es-splitter-vertical {
- height: 4px;
- cursor: row-resize;
-}
-
-.es-splitter::after {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
-}
-
-.es-splitter-horizontal::after {
- left: -2px;
- right: -2px;
-}
-
-.es-splitter-vertical::after {
- top: -2px;
- bottom: -2px;
+.dockview-theme-dark {
+ --dv-background-color: var(--es-bg-primary);
+ --dv-group-view-background-color: var(--es-bg-primary);
+ --dv-tabs-and-actions-container-background-color: var(--es-bg-secondary);
+ --dv-tabs-and-actions-container-height: 30px;
+ --dv-tabs-and-actions-container-font-size: 12px;
+ --dv-activegroup-visiblepanel-tab-background-color: var(--es-bg-primary);
+ --dv-activegroup-hiddenpanel-tab-background-color: var(--es-bg-secondary);
+ --dv-inactivegroup-visiblepanel-tab-background-color: var(--es-bg-tertiary);
+ --dv-inactivegroup-hiddenpanel-tab-background-color: var(--es-bg-secondary);
+ --dv-activegroup-visiblepanel-tab-color: #d19a66;
+ --dv-activegroup-hiddenpanel-tab-color: var(--es-text-secondary);
+ --dv-inactivegroup-visiblepanel-tab-color: var(--es-text-primary);
+ --dv-inactivegroup-hiddenpanel-tab-color: var(--es-text-secondary);
+ --dv-separator-border: var(--es-border);
+ --dv-tab-divider-color: var(--es-border);
+ --dv-active-sash-color: var(--es-accent);
+ --dv-drag-over-background-color: rgba(0, 120, 212, 0.15);
+ --dv-drag-over-border-color: var(--es-accent);
}
/* =============================================================================
@@ -1782,91 +1734,9 @@ svg {
height: 100%;
}
-/* =============================================================================
- * Tab Bar
- * ============================================================================= */
-
-.es-editor-tabs {
- display: flex;
- background: var(--es-bg-primary);
- border-bottom: 1px solid var(--es-border);
- gap: 0;
-}
-
-.es-tab {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 8px 16px;
- background: var(--es-bg-secondary);
- border-right: 1px solid var(--es-border);
- cursor: pointer;
- user-select: none;
-}
-
-.es-tab:hover {
- background: var(--es-bg-tertiary);
-}
-
-.es-tab.es-tab-active {
- background: var(--es-bg-primary);
- border-bottom: 2px solid #d19a66;
- margin-bottom: -1px;
-}
-
-.es-tab.es-tab-active .es-tab-label {
- color: #d19a66;
-}
-
-.es-tab-label {
- font-size: 12px;
- font-weight: 500;
-}
-
-.es-tab-close {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 2px;
- background: transparent;
- border: none;
- border-radius: 2px;
- cursor: pointer;
-}
-
-.es-tab-close:hover {
- background: var(--es-bg-hover);
-}
-
-.es-tab-close svg {
- stroke: var(--es-text-secondary);
-}
-
-.es-tab-close:hover svg {
- stroke: var(--es-text-primary);
-}
-
-/* =============================================================================
- * Bottom Panel
- * ============================================================================= */
-
-.es-editor-bottom {
- display: flex;
- flex-direction: column;
- height: 250px;
- min-height: 150px;
- border-top: 1px solid var(--es-border);
- background: var(--es-bg-primary);
-}
-
-.es-editor-bottom > .es-panel-container {
- flex: 1;
- overflow: hidden;
-}
-
-.es-content-browser-container,
-.es-output-container {
- flex: 1;
+.es-panel-container {
+ width: 100%;
+ height: 100%;
overflow: hidden;
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 430d8f180..a1018df1b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -44,6 +44,9 @@ importers:
'@tauri-apps/plugin-updater':
specifier: ^2.0.0
version: 2.10.0
+ dockview-core:
+ specifier: ^4.13.1
+ version: 4.13.1
esengine:
specifier: workspace:*
version: link:../sdk
@@ -60,6 +63,9 @@ importers:
editor:
dependencies:
+ dockview-core:
+ specifier: ^4.13.1
+ version: 4.13.1
esbuild-wasm:
specifier: ^0.27.2
version: 0.27.2
@@ -974,6 +980,9 @@ packages:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
+ resolution: {integrity: sha512-+7vR0ZEoL8CNck6NqDVUMqBT22niwBu5CMMI137dZ3c8NDc7c5Si+3dGEqQgM4lNtHBLAtvypo1C4p21J2wkiQ==}
+
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
@@ -2116,7 +2125,7 @@ snapshots:
sirv: 3.0.2
tinyglobby: 0.2.15
tinyrainbow: 1.2.0
'@vitest/[email protected]':
dependencies:
@@ -2240,6 +2249,8 @@ snapshots:
+
dependencies:
call-bind-apply-helpers: 1.0.2