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: replace dockview with custom dock system

esengined20dedd6d1f5
diff --git a/editor/package.json b/editor/package.json
index 3009ebd33..57eb20155 100644
--- a/editor/package.json
+++ b/editor/package.json
@@ -24,7 +24,6 @@
"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
index 5dab9cf70..6a2f7a0a6 100644
--- a/editor/src/DockLayoutManager.ts
+++ b/editor/src/DockLayoutManager.ts
@@ -1,20 +1,19 @@
-import {
- createDockview,
- themeDark,
- type DockviewApi,
- type IContentRenderer,
- type GroupPanelPartInitParameters,
- type SerializedDockview,
-} from 'dockview-core';
+import { DockLayout, type DockLayoutCallbacks, type AreaId } from './dock/DockLayout';
+import { type DockRegion, type RegionId } from './dock/DockRegion';
import type { EditorStore } from './store/EditorStore';
-import { getPanel, type PanelDescriptor } from './panels/PanelRegistry';
+import { getPanel, getAllPanels, type PanelDescriptor, type PanelPosition } from './panels/PanelRegistry';
import type { PanelManager } from './PanelManager';
-import { showErrorToast } from './ui/Toast';
import { showContextMenu } from './ui/ContextMenu';
-const LAYOUT_STORAGE_KEY = 'esengine.editor.layout';
const NON_DETACHABLE_PANELS = new Set(['scene']);
+const POSITION_TO_AREA: Record<PanelPosition, AreaId> = {
+ left: 'left',
+ center: 'center',
+ right: 'right',
+ bottom: 'bottom',
+};
+
export interface DetachPanelHandler {
detachPanel(panelId: string, title: string): Promise<void>;
detachGameView(previewUrl: string): Promise<void>;
@@ -27,46 +26,12 @@ export interface DetachContext {
onPanelClosed: (callback: (panelId: string) => void) => (() => void);
}
-class EditorPanelRenderer implements IContentRenderer {
- private readonly element_: HTMLElement;
- private panelId_: string;
- private panelManager_: PanelManager;
-
- get element(): HTMLElement {
- return this.element_;
- }
-
- constructor(panelId: string, panelManager: PanelManager) {
- this.panelId_ = panelId;
- this.panelManager_ = panelManager;
- 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_);
- }
-
- dispose(): void {
- this.panelManager_.removePanelInstance(this.panelId_);
- }
-}
-
export class DockLayoutManager {
- private api_: DockviewApi | null = null;
+ private dock_: DockLayout | null = null;
private panelManager_: PanelManager;
private store_: EditorStore;
- private layoutChangeDisposable_: { dispose(): void } | null = null;
- private activePanelDisposable_: { dispose(): void } | null = null;
- private saveTimer_: ReturnType<typeof setTimeout> | null = null;
private lastActivePanelId_: string | null = null;
private detachContext_: DetachContext | null = null;
- private contextMenuHandler_: ((e: MouseEvent) => void) | null = null;
- private contextMenuContainer_: HTMLElement | null = null;
private panelClosedUnlisten_: (() => void) | null = null;
constructor(panelManager: PanelManager, store: EditorStore) {
@@ -74,258 +39,243 @@ export class DockLayoutManager {
this.store_ = store;
}
- setDetachContext(context: DetachContext): void {
- this.detachContext_ = context;
- this.listenPanelClosed();
+ get dock(): DockLayout | null {
+ return this.dock_;
}
- get api(): DockviewApi | null {
- return this.api_;
+ setDetachContext(context: DetachContext): void {
+ this.detachContext_ = context;
+ this.panelClosedUnlisten_ = context.onPanelClosed(() => {
+ // Detached panel closed externally — user can re-open via View menu.
+ });
}
initialize(container: HTMLElement): void {
- this.api_ = createDockview(container, {
- theme: themeDark,
- createComponent: (options) => {
- return new EditorPanelRenderer(
- options.id,
- this.panelManager_,
- );
+ const callbacks: DockLayoutCallbacks = {
+ onPanelActivated: (panelId) => {
+ if (panelId === this.lastActivePanelId_) return;
+ if (this.lastActivePanelId_) this.panelManager_.hidePanel(this.lastActivePanelId_);
+ this.panelManager_.showPanel(panelId);
+ this.lastActivePanelId_ = panelId;
},
- disableFloatingGroups: false,
- });
+ onTabContextMenu: (panelId, region, x, y) => {
+ this.showTabContextMenu_(panelId, region, x, y);
+ },
+ onTabClose: (panelId) => {
+ this.removePanel(panelId);
+ },
+ };
- this.setupTabContextMenu(container);
+ this.dock_ = new DockLayout(container, callbacks);
+ this.applyDefaultLayout_();
+ }
- this.activePanelDisposable_ = this.api_.onDidActivePanelChange((panel) => {
- const newId = panel?.id ?? null;
- if (newId === this.lastActivePanelId_) return;
- if (this.lastActivePanelId_) {
- this.panelManager_.hidePanel(this.lastActivePanelId_);
- }
- if (newId) {
- this.panelManager_.showPanel(newId);
- }
- this.lastActivePanelId_ = newId;
- });
+ private applyDefaultLayout_(): void {
+ if (!this.dock_) return;
+
+ const saved = this.dock_.getSerializedPanelOrder();
- const saved = this.loadSavedLayout();
if (saved) {
- try {
- this.api_.fromJSON(saved);
- this.ensureRequiredPanels_();
- this.startSavingLayout();
- return;
- } catch {
- localStorage.removeItem(LAYOUT_STORAGE_KEY);
- showErrorToast('Layout Restore Failed', 'The saved layout could not be restored. Using default layout.');
+ const placed = new Set<string>();
+
+ const areas: AreaId[] = ['left', 'center', 'right', 'bottom'];
+ for (const areaId of areas) {
+ const paneDataList = saved[areaId];
+ if (!Array.isArray(paneDataList)) continue;
+
+ const group = this.dock_.getGroup(areaId);
+
+ for (let i = 0; i < paneDataList.length; i++) {
+ const paneData = paneDataList[i];
+ if (!paneData?.panels) continue;
+
+ const targetPane = (i === 0)
+ ? (group.panes[0] ?? group.addPane())
+ : group.addPane();
+
+ for (const panelId of paneData.panels) {
+ const desc = getPanel(panelId);
+ if (!desc || placed.has(panelId)) continue;
+ this.addPanelToRegion_(desc, targetPane);
+ placed.add(panelId);
+ }
+ if (paneData.active) {
+ targetPane.activate(paneData.active);
+ }
+ }
}
- }
- this.applyDefaultLayout();
- this.startSavingLayout();
- }
+ const defaultPanels: Array<{ id: string; area: AreaId }> = [
+ { id: 'hierarchy', area: 'left' },
+ { id: 'scene', area: 'center' },
+ { id: 'game', area: 'center' },
+ { id: 'inspector', area: 'right' },
+ { id: 'content-browser', area: 'bottom' },
+ { id: 'output', area: 'bottom' },
+ ];
+
+ for (const dp of defaultPanels) {
+ if (placed.has(dp.id)) continue;
+ const desc = getPanel(dp.id);
+ if (desc) this.addPanelToRegion_(desc, dp.area);
+ }
+ } else {
+ this.addPanelToRegion_(getPanel('hierarchy')!, 'left');
- private ensureRequiredPanels_(): void {
- // no-op: all required panels are created via default layout
- }
+ const centerGroup = this.dock_.getGroup('center');
+ const scenePane = centerGroup.panes[0] ?? centerGroup.addPane();
+ this.addPanelToRegion_(getPanel('scene')!, scenePane);
- private applyDefaultLayout(): void {
- if (!this.api_) return;
+ const gamePane = centerGroup.addPane();
+ this.addPanelToRegion_(getPanel('game')!, gamePane);
- this.api_.addPanel({
- id: 'hierarchy',
- component: 'hierarchy',
- title: 'Hierarchy',
- initialWidth: 250,
- });
+ this.addPanelToRegion_(getPanel('inspector')!, 'right');
+ this.addPanelToRegion_(getPanel('content-browser')!, 'bottom');
+ this.addPanelToRegion_(getPanel('output')!, 'bottom');
- this.api_.addPanel({
- id: 'scene',
- component: 'scene',
- title: 'Scene',
- position: { referencePanel: 'hierarchy', direction: 'right' },
- });
+ scenePane.activate('scene');
+ gamePane.activate('game');
+ }
+ }
- this.api_.addPanel({
- id: 'game',
- component: 'game',
- title: 'Game',
- position: { referencePanel: 'scene', direction: 'within' },
- inactive: true,
- });
+ private addPanelToRegion_(desc: PanelDescriptor, regionOrId: DockRegion | AreaId): void {
+ if (!this.dock_) return;
- this.api_.addPanel({
- id: 'inspector',
- component: 'inspector',
- title: 'Inspector',
- position: { referencePanel: 'scene', direction: 'right' },
- initialWidth: 260,
- });
+ const contentEl = document.createElement('div');
+ contentEl.className = 'es-panel-container';
+ contentEl.dataset.panelId = desc.id;
- this.api_.addPanel({
- id: 'content-browser',
- component: 'content-browser',
- title: 'Content Browser',
- position: { referencePanel: 'scene', direction: 'below' },
- initialHeight: 200,
- });
+ if (typeof regionOrId === 'string') {
+ const group = this.dock_.getGroup(regionOrId);
+ const target = group.panes[0] ?? group.addPane();
+ this.dock_.addPanel(target, { id: desc.id, title: desc.title, contentEl });
+ } else {
+ this.dock_.addPanel(regionOrId, { id: desc.id, title: desc.title, contentEl });
+ }
- this.api_.addPanel({
- id: 'output',
- component: 'output',
- title: 'Output',
- position: { referencePanel: 'content-browser', direction: 'within' },
- inactive: true,
- });
+ this.panelManager_.createPanelInContainer(desc.id, contentEl);
}
- private startSavingLayout(): void {
- if (!this.api_) return;
- this.layoutChangeDisposable_ = this.api_.onDidLayoutChange(() => {
- if (this.saveTimer_) clearTimeout(this.saveTimer_);
- this.saveTimer_ = setTimeout(() => {
- this.saveTimer_ = null;
- this.saveLayout();
- }, 500);
- });
+ showPanel(id: string): void {
+ if (!this.dock_) return;
+
+ const region = this.dock_.findPanelRegion(id);
+ if (region) {
+ const area = this.dock_.findRegionArea(region);
+ if (area && this.dock_.isRegionCollapsed(area)) this.dock_.expandRegion(area);
+ region.activate(id);
+ return;
+ }
+
+ const desc = getPanel(id);
+ if (!desc) return;
+ const areaId = POSITION_TO_AREA[desc.position];
+ this.addPanelToRegion_(desc, areaId);
+ if (this.dock_.isRegionCollapsed(areaId)) this.dock_.expandRegion(areaId);
+ this.dock_.activatePanel(id);
}
- saveLayout(): void {
- if (!this.api_) return;
- try {
- const json = this.api_.toJSON();
- localStorage.setItem(LAYOUT_STORAGE_KEY, JSON.stringify(json));
- } catch {
- // ignore serialization failures
+ removePanel(id: string): void {
+ if (!this.dock_) return;
+ const entry = this.dock_.removePanel(id);
+ if (entry) {
+ this.panelManager_.removePanelInstance(id);
}
}
- private loadSavedLayout(): SerializedDockview | null {
- try {
- const raw = localStorage.getItem(LAYOUT_STORAGE_KEY);
- if (raw) return JSON.parse(raw);
- } catch {
- // ignore parse failures
- }
- return null;
+ addPanel(desc: PanelDescriptor): void {
+ if (!this.dock_) return;
+ if (this.dock_.findPanelRegion(desc.id)) return;
+ const areaId = POSITION_TO_AREA[desc.position];
+ this.addPanelToRegion_(desc, areaId);
}
resetLayout(): void {
- if (!this.api_) return;
- localStorage.removeItem(LAYOUT_STORAGE_KEY);
- this.api_.clear();
- this.applyDefaultLayout();
+ this.dock_?.resetLayout();
}
- showPanel(id: string): void {
- if (!this.api_) return;
-
- let panel = this.api_.getPanel(id);
- if (!panel) {
- const desc = getPanel(id);
- if (!desc) return;
-
- if (desc.position === 'center') {
- this.api_.addPanel({
- id: desc.id,
- component: desc.id,
- title: desc.title,
- position: { referencePanel: 'scene', direction: 'within' },
- inactive: true,
- });
- } else {
- this.api_.addPanel({
- id: desc.id,
- component: desc.id,
- title: desc.title,
- position: { referencePanel: 'scene', direction: 'below' },
- initialHeight: 200,
- });
- }
- panel = this.api_.getPanel(id);
- }
- panel?.api.setActive();
+ saveLayout(): void {
+ this.dock_?.saveLayout();
}
- 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 === 'left') referenceId = 'hierarchy';
- else if (position === 'right') referenceId = 'inspector';
-
- const refPanel = this.api_.getPanel(referenceId);
- if (!refPanel) return;
+ findPanelRegion(panelId: string): RegionId | null {
+ return this.dock_?.findPanelRegion(panelId)?.id ?? null;
+ }
- const direction = position === 'bottom' ? 'below' : undefined;
+ collapseRegion(regionId: RegionId): void {
+ this.dock_?.collapseRegion(regionId as AreaId);
+ }
- this.api_.addPanel({
- id: desc.id,
- component: desc.id,
- title: desc.title,
- position: direction
- ? { referencePanel: refPanel, direction }
- : { referencePanel: refPanel },
- inactive: true,
- });
+ expandRegion(regionId: RegionId): void {
+ this.dock_?.expandRegion(regionId as AreaId);
}
- removePanel(id: string): void {
- if (!this.api_) return;
- const panel = this.api_.getPanel(id);
- if (panel) {
- this.api_.removePanel(panel);
- }
+ isRegionCollapsed(regionId: RegionId): boolean {
+ return this.dock_?.isRegionCollapsed(regionId as AreaId) ?? false;
}
- private setupTabContextMenu(container: HTMLElement): void {
- this.contextMenuHandler_ = (e: MouseEvent) => {
- if (!this.detachContext_) return;
+ isPanelActive(panelId: string): boolean {
+ return this.dock_?.isPanelActive(panelId) ?? false;
+ }
- const target = e.target as HTMLElement;
- const tab = target.closest('.dv-tab') as HTMLElement | null;
- if (!tab) return;
+ private showTabContextMenu_(panelId: string, region: DockRegion, x: number, y: number): void {
+ if (!this.dock_) return;
- const panelId = this.resolvePanelIdFromTab(tab);
- if (!panelId || NON_DETACHABLE_PANELS.has(panelId)) return;
+ const area = this.dock_.findRegionArea(region);
+ if (!area) return;
- e.preventDefault();
- e.stopPropagation();
+ const group = this.dock_.getGroup(area);
+ const canClose = !(area === 'center' && group.paneCount <= 1 && region.panelCount <= 1);
+ const canDetach = this.detachContext_ && !NON_DETACHABLE_PANELS.has(panelId);
- const isGame = panelId === 'game';
- const items = [{
- label: 'Open in New Window',
- onClick: () => this.handleDetachPanel(panelId, isGame),
- }];
+ const items: Array<{ label: string; onClick: () => void }> = [];
- showContextMenu({ items, x: e.clientX, y: e.clientY });
- };
+ if (canClose) {
+ items.push({ label: 'Close', onClick: () => this.removePanel(panelId) });
+ }
- container.addEventListener('contextmenu', this.contextMenuHandler_);
- this.contextMenuContainer_ = container;
- }
+ if (region.panelCount > 1) {
+ if (group.direction === 'horizontal') {
+ items.push({ label: 'Split Right', onClick: () => { group.splitPane(region, panelId, 'right'); this.dock_?.saveLayout(); } });
+ items.push({ label: 'Split Left', onClick: () => { group.splitPane(region, panelId, 'left'); this.dock_?.saveLayout(); } });
+ } else {
+ items.push({ label: 'Split Down', onClick: () => { group.splitPane(region, panelId, 'bottom'); this.dock_?.saveLayout(); } });
+ items.push({ label: 'Split Up', onClick: () => { group.splitPane(region, panelId, 'top'); this.dock_?.saveLayout(); } });
+ }
+ }
- private resolvePanelIdFromTab(tab: HTMLElement): string | null {
- if (!this.api_) return null;
- const content = tab.querySelector('.dv-default-tab-content');
- const title = content?.textContent?.trim();
- if (!title) return null;
+ const moveTargets: Array<{ label: string; areaId: AreaId }> = [
+ { label: 'Left', areaId: 'left' },
+ { label: 'Center', areaId: 'center' },
+ { label: 'Right', areaId: 'right' },
+ { label: 'Bottom', areaId: 'bottom' },
+ ];
+ for (const mt of moveTargets) {
+ if (mt.areaId === area) continue;
+ items.push({
+ label: `Move to ${mt.label}`,
+ onClick: () => {
+ const target = this.dock_?.getGroup(mt.areaId).primary;
+ if (target) this.dock_?.onTabMoved(panelId, region, target, target.panelCount);
+ },
+ });
+ }
- for (const panel of this.api_.panels) {
- if (panel.title === title) return panel.id;
+ if (canDetach) {
+ items.push({
+ label: 'Open in New Window',
+ onClick: () => this.handleDetachPanel_(panelId),
+ });
}
- return null;
+
+ showContextMenu({ items, x, y });
}
- private async handleDetachPanel(panelId: string, isGame: boolean): Promise<void> {
+ private async handleDetachPanel_(panelId: string): Promise<void> {
if (!this.detachContext_) return;
try {
+ const isGame = panelId === 'game';
if (isGame) {
const url = await this.detachContext_.getPreviewUrl();
if (!url) return;
@@ -336,37 +286,15 @@ export class DockLayoutManager {
await this.detachContext_.handler.detachPanel(panelId, title);
}
this.removePanel(panelId);
- this.panelManager_.removePanelInstance(panelId);
} catch (err) {
console.error(`Failed to detach panel "${panelId}":`, err);
}
}
- private listenPanelClosed(): void {
- if (!this.detachContext_) return;
- this.panelClosedUnlisten_ = this.detachContext_.onPanelClosed((_panelId) => {
- // Detached panel was closed externally — do NOT re-show in main editor.
- // User can re-open via View menu if needed.
- });
- }
-
dispose(): void {
- if (this.saveTimer_) {
- clearTimeout(this.saveTimer_);
- this.saveTimer_ = null;
- }
- if (this.contextMenuHandler_ && this.contextMenuContainer_) {
- this.contextMenuContainer_.removeEventListener('contextmenu', this.contextMenuHandler_);
- this.contextMenuHandler_ = null;
- this.contextMenuContainer_ = null;
- }
this.panelClosedUnlisten_?.();
this.panelClosedUnlisten_ = null;
- this.activePanelDisposable_?.dispose();
- this.activePanelDisposable_ = null;
- this.layoutChangeDisposable_?.dispose();
- this.layoutChangeDisposable_ = null;
- this.api_?.dispose();
- this.api_ = null;
+ this.dock_?.dispose();
+ this.dock_ = null;
}
}
diff --git a/editor/src/Editor.ts b/editor/src/Editor.ts
index 7762f0901..cd3306ee2 100644
--- a/editor/src/Editor.ts
+++ b/editor/src/Editor.ts
@@ -14,7 +14,6 @@ import { builtinPlugins, coreStatusbarPlugin } from './plugins';
import { PluginManager as PluginManagerService } from './services/PluginManager';
import { getEditorStore } from './store';
import { DockLayoutManager } from './DockLayoutManager';
-import { ContentDrawer } from './ui/ContentDrawer';
import { closeAddressableWindow, hasAddressableWindow } from './dialogs/AddressableWindow';
import { OutputService } from './services/OutputService';
@@ -64,7 +63,6 @@ export class Editor {
private menuManager_: MenuManager;
private dockLayout_: DockLayoutManager | null = null;
- private contentDrawer_: ContentDrawer | null = null;
private escapeHandler_: ((e: KeyboardEvent) => void) | null = null;
private contextMenuHandler_: ((e: Event) => void) | null = null;
private pluginManager_!: PluginManagerService;
@@ -198,7 +196,6 @@ export class Editor {
this.escapeHandler_ = null;
}
this.multiWindowService_.dispose();
- this.contentDrawer_?.dispose();
this.menuManager_.dispose();
this.scriptService_.dispose();
this.extensionService_.dispose();
@@ -229,7 +226,7 @@ export class Editor {
this.shellService_ = new ShellService(
this.projectPath_, this.outputService_,
- (id) => this.navigationService_.showPanel(id),
+ (id: string) => this.navigationService_.showPanel(id),
);
const sk = 'default';
@@ -282,16 +279,8 @@ export class Editor {
this.dockLayout_ = new DockLayoutManager(this.panelManager_, this.store_);
this.dockLayout_.initialize(dockContainer);
- this.contentDrawer_ = new ContentDrawer(
- this.container_, this.dockLayout_, this.store_,
- {
- projectPath: this.projectPath_ ?? undefined,
- onOpenScene: (scenePath) => this.sceneService_.openSceneFromPath(scenePath),
- },
- );
-
this.navigationService_.setDockLayout(this.dockLayout_);
- this.navigationService_.setContentDrawer(this.contentDrawer_);
+
this.extensionService_.setDockLayout(this.dockLayout_);
this.previewService_ = new PreviewService(
@@ -361,11 +350,6 @@ export class Editor {
return;
}
- if (this.contentDrawer_?.state === 'open') {
- this.contentDrawer_.closeDrawer();
- return;
- }
-
if (hasAddressableWindow()) {
closeAddressableWindow();
return;
diff --git a/editor/src/dialogs/ShortcutHelpDialog.ts b/editor/src/dialogs/ShortcutHelpDialog.ts
new file mode 100644
index 000000000..f750fb588
--- /dev/null
+++ b/editor/src/dialogs/ShortcutHelpDialog.ts
@@ -0,0 +1,142 @@
+import { getAllMenus, getMenuItems } from '../menus/MenuRegistry';
+import { getAllGizmos } from '../gizmos';
+
+interface ShortcutEntry {
+ label: string;
+ shortcut: string;
+}
+
+interface ShortcutGroup {
+ name: string;
+ entries: ShortcutEntry[];
+}
+
+function collectShortcuts(): ShortcutGroup[] {
+ const groups: ShortcutGroup[] = [];
+
+ const menus = getAllMenus();
+ for (const menu of menus) {
+ const items = getMenuItems(menu.id);
+ const entries: ShortcutEntry[] = [];
+ for (const item of items) {
+ if (item.shortcut && !item.hidden) {
+ entries.push({ label: item.label, shortcut: formatShortcut(item.shortcut) });
+ }
+ }
+ if (entries.length > 0) {
+ groups.push({ name: menu.label, entries });
+ }
+ }
+
+ const gizmos = getAllGizmos();
+ const gizmoEntries: ShortcutEntry[] = [];
+ for (const g of gizmos) {
+ if (g.shortcut) {
+ gizmoEntries.push({ label: g.name, shortcut: g.shortcut.toUpperCase() });
+ }
+ }
+ if (gizmoEntries.length > 0) {
+ groups.push({ name: 'Gizmos', entries: gizmoEntries });
+ }
+
+ groups.push({
+ name: 'Scene View',
+ entries: [
+ { label: 'Cycle selection (overlap)', shortcut: formatShortcut('Alt') },
+ { label: 'Deep select (deepest child)', shortcut: formatShortcut('Cmd+Click') },
+ { label: 'Enter child', shortcut: 'Enter' },
+ { label: 'Select parent', shortcut: 'Esc' },
+ ],
+ });
+
+ groups.push({
+ name: 'Hierarchy',
+ entries: [
+ { label: 'Recursive expand/collapse', shortcut: formatShortcut('Alt+Click') },
+ { label: 'Move up in siblings', shortcut: formatShortcut('Cmd+[') },
+ { label: 'Move down in siblings', shortcut: formatShortcut('Cmd+]') },
+ { label: 'Select all', shortcut: formatShortcut('Cmd+A') },
+ { label: 'Rename', shortcut: 'F2' },
+ ],
+ });
+
+ groups.push({
+ name: 'Inspector',
+ entries: [
+ { label: 'Fine drag (0.1x)', shortcut: 'Shift+Drag' },
+ { label: 'Coarse drag (10x)', shortcut: 'Alt+Drag' },
+ ],
+ });
+
+ return groups;
+}
+
+const isMac = navigator.platform.includes('Mac');
+
+function formatShortcut(shortcut: string): string {
+ if (isMac) {
+ return shortcut
+ .replace(/Ctrl\+/g, '\u2318')
+ .replace(/Cmd\+/g, '\u2318')
+ .replace(/Shift\+/g, '\u21E7')
+ .replace(/Alt\+/g, '\u2325');
+ }
+ return shortcut.replace(/Cmd\+/g, 'Ctrl+');
+}
+
+function renderGroup(group: ShortcutGroup): string {
+ const rows = group.entries.map(e =>
+ `<div class="es-shortcut-row">
+ <span class="es-shortcut-label">${e.label}</span>
+ <kbd class="es-shortcut-key">${e.shortcut}</kbd>
+ </div>`
+ ).join('');
+ return `<div class="es-shortcut-group">
+ <div class="es-shortcut-group-title">${group.name}</div>
+ ${rows}
+ </div>`;
+}
+
+export function showShortcutHelpDialog(): void {
+ const groups = collectShortcuts();
+
+ const overlay = document.createElement('div');
+ overlay.className = 'es-dialog-overlay';
+
+ const mid = Math.ceil(groups.length / 2);
+ const leftGroups = groups.slice(0, mid);
+ const rightGroups = groups.slice(mid);
+
+ overlay.innerHTML = `
+ <div class="es-dialog" style="max-width: 640px;">
+ <div class="es-dialog-header">
+ <span class="es-dialog-title">Keyboard Shortcuts</span>
+ <button class="es-dialog-close">&times;</button>
+ </div>
+ <div class="es-dialog-body" style="padding: 16px; max-height: 70vh; overflow-y: auto;">
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px;">
+ <div>${leftGroups.map(renderGroup).join('')}</div>
+ <div>${rightGroups.map(renderGroup).join('')}</div>
+ </div>
+ </div>
+ <div class="es-dialog-footer">
+ <button class="es-dialog-btn es-dialog-btn-primary">OK</button>
+ </div>
+ </div>
+ `;
+
+ const close = () => overlay.remove();
+ overlay.querySelector('.es-dialog-close')?.addEventListener('click', close);
+ overlay.querySelector('.es-dialog-btn-primary')?.addEventListener('click', close);
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) close();
+ });
+ document.addEventListener('keydown', function onKey(e: KeyboardEvent) {
+ if (e.key === 'Escape') {
+ close();
+ document.removeEventListener('keydown', onKey);
+ }
+ });
+
+ document.body.appendChild(overlay);
+}
diff --git a/editor/src/dock/DockLayout.ts b/editor/src/dock/DockLayout.ts
new file mode 100644
index 000000000..a876fe24e
--- /dev/null
+++ b/editor/src/dock/DockLayout.ts
@@ -0,0 +1,597 @@
+import { DockRegion, type RegionId, type DockPanelEntry, type DockRegionOptions } from './DockRegion';
+import { DockSplitter } from './DockSplitter';
+import { DockPaneGroup } from './DockPaneGroup';
+import { DockTabDrag, type TabDragHost } from './DockTabDrag';
+import { showContextMenu } from '../ui/ContextMenu';
+
+const LAYOUT_STORAGE_KEY = 'esengine.editor.layout.v3';
+const OLD_LAYOUT_KEYS = ['esengine.editor.layout', 'esengine.editor.layout.v2'];
+
+const MIN_SIDE_WIDTH = 120;
+const MIN_CENTER_WIDTH = 200;
+const MIN_BOTTOM_HEIGHT = 80;
+
+const DEFAULT_LEFT_WIDTH = 250;
+const DEFAULT_RIGHT_WIDTH = 260;
+const DEFAULT_BOTTOM_HEIGHT = 200;
+
+interface SerializedRegion {
+ panels: string[];
+ active: string | null;
+ width?: number;
+ height?: number;
+}
+
+interface SerializedLayout {
+ v: number;
+ left: SerializedRegion[];
+ center: SerializedRegion[];
+ bottom: SerializedRegion[];
+ right: SerializedRegion[];
+ collapsed: string[];
+}
+
+export type AreaId = 'left' | 'center' | 'right' | 'bottom';
+
+export interface DockLayoutCallbacks {
+ onPanelActivated?: (panelId: string) => void;
+ onLayoutChange?: () => void;
+ onTabContextMenu?: (panelId: string, region: DockRegion, x: number, y: number) => void;
+ onTabClose?: (panelId: string) => void;
+}
+
+export class DockLayout implements TabDragHost {
+ readonly element: HTMLElement;
+
+ private leftGroup_: DockPaneGroup;
+ private centerGroup_: DockPaneGroup;
+ private rightGroup_: DockPaneGroup;
+ private bottomGroup_: DockPaneGroup;
+
+ private leftSplitter_: DockSplitter;
+ private rightSplitter_: DockSplitter;
+ private bottomSplitter_: DockSplitter;
+ private tabDrag_: DockTabDrag;
+ private callbacks_: DockLayoutCallbacks;
+ private saveTimer_: ReturnType<typeof setTimeout> | null = null;
+
+ private leftWidth_ = DEFAULT_LEFT_WIDTH;
+ private rightWidth_ = DEFAULT_RIGHT_WIDTH;
+ private bottomHeight_ = DEFAULT_BOTTOM_HEIGHT;
+
+ private collapsed_: Set<AreaId> = new Set();
+ private savedSizes_: Map<AreaId, number> = new Map();
+
+ private resizeObserver_: ResizeObserver;
+
+ constructor(container: HTMLElement, callbacks: DockLayoutCallbacks = {}) {
+ this.callbacks_ = callbacks;
+
+ const makeOpts = (id: RegionId): DockRegionOptions => this.makeRegionOpts_(id);
+
+ this.leftGroup_ = new DockPaneGroup({ regionId: 'left', direction: 'vertical', makeRegionOpts: makeOpts, onSplitterResizeEnd: () => this.scheduleSave_() });
+ this.centerGroup_ = new DockPaneGroup({ regionId: 'center', direction: 'horizontal', makeRegionOpts: makeOpts, onSplitterResizeEnd: () => this.scheduleSave_() });
+ this.rightGroup_ = new DockPaneGroup({ regionId: 'right', direction: 'vertical', makeRegionOpts: makeOpts, onSplitterResizeEnd: () => this.scheduleSave_() });
+ this.bottomGroup_ = new DockPaneGroup({ regionId: 'bottom', direction: 'horizontal', makeRegionOpts: makeOpts, onSplitterResizeEnd: () => this.scheduleSave_() });
+
+ this.leftSplitter_ = new DockSplitter({
+ direction: 'vertical',
+ onResize: (d) => this.resizeLeft_(d),
+ onResizeEnd: () => this.scheduleSave_(),
+ onDoubleClick: () => { this.leftWidth_ = DEFAULT_LEFT_WIDTH; this.applyLayout_(); this.scheduleSave_(); },
+ });
+
+ this.rightSplitter_ = new DockSplitter({
+ direction: 'vertical',
+ onResize: (d) => this.resizeRight_(d),
+ onResizeEnd: () => this.scheduleSave_(),
+ onDoubleClick: () => { this.rightWidth_ = DEFAULT_RIGHT_WIDTH; this.applyLayout_(); this.scheduleSave_(); },
+ });
+
+ this.bottomSplitter_ = new DockSplitter({
+ direction: 'horizontal',
+ onResize: (d) => this.resizeBottom_(d),
+ onResizeEnd: () => this.scheduleSave_(),
+ onDoubleClick: () => { this.bottomHeight_ = DEFAULT_BOTTOM_HEIGHT; this.applyLayout_(); this.scheduleSave_(); },
+ });
+
+ this.tabDrag_ = new DockTabDrag(this);
+
+ this.element = document.createElement('div');
+ this.element.className = 'es-dock';
+
+ const leftWrapper = document.createElement('div');
+ leftWrapper.className = 'es-dock-area es-dock-area-left';
+ leftWrapper.appendChild(this.leftGroup_.container);
+
+ const rightWrapper = document.createElement('div');
+ rightWrapper.className = 'es-dock-area es-dock-area-right';
+ rightWrapper.appendChild(this.rightGroup_.container);
+
+ const bottomWrapper = document.createElement('div');
+ bottomWrapper.className = 'es-dock-area es-dock-area-bottom';
+ bottomWrapper.appendChild(this.bottomGroup_.container);
+
+ const centerArea = document.createElement('div');
+ centerArea.className = 'es-dock-center-area';
+ centerArea.appendChild(this.centerGroup_.container);
+ centerArea.appendChild(this.bottomSplitter_.element);
+ centerArea.appendChild(bottomWrapper);
+
+ this.element.appendChild(leftWrapper);
+ this.element.appendChild(this.leftSplitter_.element);
+ this.element.appendChild(centerArea);
+ this.element.appendChild(this.rightSplitter_.element);
+ this.element.appendChild(rightWrapper);
+
+ container.appendChild(this.element);
+
+ this.resizeObserver_ = new ResizeObserver(() => this.onContainerResize_());
+ this.resizeObserver_.observe(this.element);
+
+ this.loadLayout_();
+ this.applyLayout_();
+ }
+
+ // =========================================================================
+ // Public API
+ // =========================================================================
+
+ get leftRegion(): DockRegion { return this.leftGroup_.primary; }
+ get rightRegion(): DockRegion { return this.rightGroup_.primary; }
+ get bottomRegion(): DockRegion { return this.bottomGroup_.primary; }
+ get centerPanes(): readonly DockRegion[] { return this.centerGroup_.panes; }
+
+ getGroup(area: AreaId): DockPaneGroup {
+ switch (area) {
+ case 'left': return this.leftGroup_;
+ case 'center': return this.centerGroup_;
+ case 'right': return this.rightGroup_;
+ case 'bottom': return this.bottomGroup_;
+ }
+ }
+
+ getFixedRegion(id: 'left' | 'right' | 'bottom'): DockRegion {
+ return this.getGroup(id).primary;
+ }
+
+ addCenterPane(): DockRegion {
+ return this.centerGroup_.addPane();
+ }
+
+ removeCenterPane(region: DockRegion): void {
+ this.centerGroup_.removePane(region);
+ }
+
+ addPanel(regionOrId: DockRegion | RegionId, entry: DockPanelEntry, index?: number): void {
+ const region = typeof regionOrId === 'string' ? this.resolveRegion_(regionOrId) : regionOrId;
+ region.addPanel(entry, index);
+ this.scheduleSave_();
+ }
+
+ removePanel(panelId: string): DockPanelEntry | null {
+ const region = this.findPanelRegion(panelId);
+ if (!region) return null;
+ const entry = region.removePanel(panelId);
+ this.scheduleSave_();
+ return entry;
+ }
+
+ findPanelRegion(panelId: string): DockRegion | null {
+ return this.leftGroup_.hasPanel(panelId)
+ ?? this.centerGroup_.hasPanel(panelId)
+ ?? this.rightGroup_.hasPanel(panelId)
+ ?? this.bottomGroup_.hasPanel(panelId);
+ }
+
+ findPanelArea(panelId: string): AreaId | null {
+ if (this.leftGroup_.hasPanel(panelId)) return 'left';
+ if (this.centerGroup_.hasPanel(panelId)) return 'center';
+ if (this.rightGroup_.hasPanel(panelId)) return 'right';
+ if (this.bottomGroup_.hasPanel(panelId)) return 'bottom';
+ return null;
+ }
+
+ findRegionArea(region: DockRegion): AreaId | null {
+ if (this.leftGroup_.containsPane(region)) return 'left';
+ if (this.centerGroup_.containsPane(region)) return 'center';
+ if (this.rightGroup_.containsPane(region)) return 'right';
+ if (this.bottomGroup_.containsPane(region)) return 'bottom';
+ return null;
+ }
+
+ activatePanel(panelId: string): void {
+ const region = this.findPanelRegion(panelId);
+ if (!region) return;
+ const area = this.findRegionArea(region);
+ if (area && this.collapsed_.has(area)) this.expandRegion(area);
+ region.activate(panelId);
+ }
+
+ collapseRegion(areaId: AreaId): void {
+ if (areaId === 'center' || this.collapsed_.has(areaId)) return;
+
+ const size = areaId === 'bottom' ? this.bottomHeight_
+ : areaId === 'left' ? this.leftWidth_
+ : this.rightWidth_;
+ this.savedSizes_.set(areaId, size);
+ this.collapsed_.add(areaId);
+ this.updateAreaCollapsed_(areaId, true);
+ this.updateSplitterVisibility_();
+ this.applyLayout_();
+ this.scheduleSave_();
+ }
+
+ expandRegion(areaId: AreaId): void {
+ if (areaId === 'center' || !this.collapsed_.has(areaId)) return;
+
+ const saved = this.savedSizes_.get(areaId);
+ if (areaId === 'left') this.leftWidth_ = saved || DEFAULT_LEFT_WIDTH;
+ else if (areaId === 'right') this.rightWidth_ = saved || DEFAULT_RIGHT_WIDTH;
+ else if (areaId === 'bottom') this.bottomHeight_ = saved || DEFAULT_BOTTOM_HEIGHT;
+
+ this.collapsed_.delete(areaId);
+ this.updateAreaCollapsed_(areaId, false);
+ this.updateSplitterVisibility_();
+ this.applyLayout_();
+ this.scheduleSave_();
+ }
+
+ isRegionCollapsed(areaId: AreaId | RegionId): boolean {
+ if (areaId === 'center') return false;
+ return this.collapsed_.has(areaId as AreaId);
+ }
+
+ isPanelActive(panelId: string): boolean {
+ const region = this.findPanelRegion(panelId);
+ if (!region) return false;
+ const area = this.findRegionArea(region);
+ if (area && this.collapsed_.has(area)) return false;
+ return region.activeId === panelId;
+ }
+
+ splitCenterPane(sourceRegion: DockRegion, panelId: string, side: 'left' | 'right'): void {
+ this.centerGroup_.splitPane(sourceRegion, panelId, side);
+ this.scheduleSave_();
+ }
+
+ resetLayout(): void {
+ this.leftWidth_ = DEFAULT_LEFT_WIDTH;
+ this.rightWidth_ = DEFAULT_RIGHT_WIDTH;
+ this.bottomHeight_ = DEFAULT_BOTTOM_HEIGHT;
+ this.collapsed_.clear();
+ this.savedSizes_.clear();
+ for (const area of [this.leftGroup_, this.centerGroup_, this.rightGroup_, this.bottomGroup_]) {
+ this.updateAreaCollapsed_(area === this.leftGroup_ ? 'left'
+ : area === this.centerGroup_ ? 'center'
+ : area === this.rightGroup_ ? 'right' : 'bottom', false);
+ }
+ this.updateSplitterVisibility_();
+ this.applyLayout_();
+ localStorage.removeItem(LAYOUT_STORAGE_KEY);
+ }
+
+ saveLayout(): void {
+ const data: SerializedLayout = {
+ v: 3,
+ left: this.leftGroup_.serialize(),
+ center: this.centerGroup_.serialize(),
+ bottom: this.bottomGroup_.serialize(),
+ right: this.rightGroup_.serialize(),
+ collapsed: Array.from(this.collapsed_),
+ };
+
+ if (!this.collapsed_.has('left')) (data as any).leftWidth = this.leftWidth_;
+ if (!this.collapsed_.has('right')) (data as any).rightWidth = this.rightWidth_;
+ if (!this.collapsed_.has('bottom')) (data as any).bottomHeight = this.bottomHeight_;
+
+ try {
+ localStorage.setItem(LAYOUT_STORAGE_KEY, JSON.stringify(data));
+ } catch {
+ // ignore
+ }
+ }
+
+ getSerializedPanelOrder(): SerializedLayout | null {
+ try {
+ const raw = localStorage.getItem(LAYOUT_STORAGE_KEY);
+ if (!raw) return null;
+ const data = JSON.parse(raw);
+ if (data.v === 3) return data as SerializedLayout;
+ return null;
+ } catch {
+ return null;
+ }
+ }
+
+ // =========================================================================
+ // TabDragHost implementation
+ // =========================================================================
+
+ getRegions(): DockRegion[] {
+ return [
+ ...this.leftGroup_.panes,
+ ...this.centerGroup_.panes,
+ ...this.rightGroup_.panes,
+ ...this.bottomGroup_.panes,
+ ];
+ }
+
+ getEdgeDirections(region: DockRegion): Array<'left' | 'right' | 'top' | 'bottom'> {
+ const area = this.findRegionArea(region);
+ if (!area) return [];
+
+ const group = this.getGroup(area);
+ if (group.direction === 'horizontal') return ['left', 'right'];
+ return ['top', 'bottom'];
+ }
+
+ onTabReordered(panelId: string, region: DockRegion, newIndex: number): void {
+ region.reorderPanel(panelId, newIndex);
+ this.scheduleSave_();
+ }
+
+ onTabMoved(panelId: string, source: DockRegion, target: DockRegion, index: number): void {
+ const sourceArea = this.findRegionArea(source);
+ const sourceGroup = sourceArea ? this.getGroup(sourceArea) : null;
+ if (sourceGroup && sourceGroup.containsPane(source) && source.panelCount <= 1 && sourceGroup.paneCount <= 1) {
+ if (sourceArea === 'center') return;
+ }
+
+ const entry = source.removePanel(panelId);
+ if (!entry) return;
+
+ const targetArea = this.findRegionArea(target);
+ if (targetArea && this.collapsed_.has(targetArea)) this.expandRegion(targetArea);
+ target.addPanel(entry, index);
+ target.activate(panelId);
+
+ this.scheduleSave_();
+ }
+
+ onEdgeDrop(panelId: string, source: DockRegion, target: DockRegion, side: 'left' | 'right' | 'top' | 'bottom'): void {
+ const targetArea = this.findRegionArea(target);
+ if (!targetArea) return;
+
+ const sourceArea = this.findRegionArea(source);
+ const sourceGroup = sourceArea ? this.getGroup(sourceArea) : null;
+ if (sourceGroup && sourceGroup.containsPane(source) && source.panelCount <= 1 && sourceGroup.paneCount <= 1) {
+ if (sourceArea === 'center') return;
+ }
+
+ const entry = source.removePanel(panelId);
+ if (!entry) return;
+
+ const group = this.getGroup(targetArea);
+ group.insertPane(entry, target, side);
+ this.scheduleSave_();
+ }
+
+ // =========================================================================
+ // Private: region factory
+ // =========================================================================
+
+ private makeRegionOpts_(id: RegionId): DockRegionOptions {
+ return {
+ id,
+ onPanelActivated: (panelId: string) => {
+ this.callbacks_.onPanelActivated?.(panelId);
+ this.scheduleSave_();
+ },
+ onTabContextMenu: (panelId: string, x: number, y: number) => {
+ const region = this.findPanelRegion(panelId);
+ if (!region) return;
+ if (this.callbacks_.onTabContextMenu) {
+ this.callbacks_.onTabContextMenu(panelId, region, x, y);
+ } else {
+ this.showDefaultTabContextMenu_(panelId, region, x, y);
+ }
+ },
+ onTabDragStart: (panelId: string, e: MouseEvent) => {
+ const region = this.findPanelRegion(panelId);
+ if (region) this.tabDrag_.startDrag(panelId, region, e);
+ },
+ onTabClose: (panelId: string) => {
+ if (this.callbacks_.onTabClose) {
+ this.callbacks_.onTabClose(panelId);
+ } else {
+ this.removePanel(panelId);
+ }
+ },
+ onEmpty: (region: DockRegion) => {
+ const area = this.findRegionArea(region);
+ if (!area) return;
+ const group = this.getGroup(area);
+ if (group.paneCount > 1) {
+ group.removePane(region);
+ } else if (area !== 'center') {
+ this.collapseRegion(area);
+ }
+ },
+ };
+ }
+
+ private resolveRegion_(id: RegionId): DockRegion {
+ return this.getGroup(id as AreaId).primary;
+ }
+
+ // =========================================================================
+ // Private: layout
+ // =========================================================================
+
+ private resizeLeft_(delta: number): void {
+ this.leftWidth_ = Math.max(MIN_SIDE_WIDTH, this.leftWidth_ + delta);
+ this.clampWidths_();
+ this.applyLayout_();
+ }
+
+ private resizeRight_(delta: number): void {
+ this.rightWidth_ = Math.max(MIN_SIDE_WIDTH, this.rightWidth_ - delta);
+ this.clampWidths_();
+ this.applyLayout_();
+ }
+
+ private resizeBottom_(delta: number): void {
+ this.bottomHeight_ = Math.max(MIN_BOTTOM_HEIGHT, this.bottomHeight_ - delta);
+ this.applyLayout_();
+ }
+
+ private clampWidths_(): void {
+ const totalWidth = this.element.clientWidth;
+ const splitterWidth = 8;
+ const leftW = this.collapsed_.has('left') ? 0 : this.leftWidth_;
+ const rightW = this.collapsed_.has('right') ? 0 : this.rightWidth_;
+ const available = totalWidth - (this.collapsed_.has('left') ? 0 : splitterWidth) - (this.collapsed_.has('right') ? 0 : splitterWidth);
+
+ if (leftW + rightW + MIN_CENTER_WIDTH > available) {
+ const excess = leftW + rightW + MIN_CENTER_WIDTH - available;
+ const halfExcess = excess / 2;
+ if (!this.collapsed_.has('left')) this.leftWidth_ = Math.max(MIN_SIDE_WIDTH, this.leftWidth_ - halfExcess);
+ if (!this.collapsed_.has('right')) this.rightWidth_ = Math.max(MIN_SIDE_WIDTH, this.rightWidth_ - halfExcess);
+ }
+ }
+
+ private applyLayout_(): void {
+ const leftEl = this.leftGroup_.container.parentElement;
+ const rightEl = this.rightGroup_.container.parentElement;
+ const bottomEl = this.bottomGroup_.container.parentElement;
+
+ if (leftEl) leftEl.style.width = this.collapsed_.has('left') ? '0' : `${this.leftWidth_}px`;
+ if (rightEl) rightEl.style.width = this.collapsed_.has('right') ? '0' : `${this.rightWidth_}px`;
+ if (bottomEl) bottomEl.style.height = this.collapsed_.has('bottom') ? '0' : `${this.bottomHeight_}px`;
+
+ this.callbacks_.onLayoutChange?.();
+ }
+
+ private updateAreaCollapsed_(areaId: AreaId, collapsed: boolean): void {
+ const group = this.getGroup(areaId);
+ const wrapper = group.container.parentElement;
+ if (wrapper) {
+ wrapper.classList.toggle('es-dock-area-collapsed', collapsed);
+ }
+ for (const pane of group.panes) {
+ if (collapsed) {
+ pane.element.classList.add('es-dock-collapsed');
+ } else {
+ pane.element.classList.remove('es-dock-collapsed');
+ if (pane.activeId) {
+ const p = pane.panels.find(e => e.id === pane.activeId);
+ if (p) p.contentEl.style.display = '';
+ }
+ }
+ }
+ }
+
+ private updateSplitterVisibility_(): void {
+ this.leftSplitter_.setVisible(!this.collapsed_.has('left'));
+ this.rightSplitter_.setVisible(!this.collapsed_.has('right'));
+ this.bottomSplitter_.setVisible(!this.collapsed_.has('bottom'));
+ }
+
+ private onContainerResize_(): void {
+ this.clampWidths_();
+ this.applyLayout_();
+ }
+
+ private loadLayout_(): void {
+ for (const key of OLD_LAYOUT_KEYS) {
+ localStorage.removeItem(key);
+ }
+
+ try {
+ const raw = localStorage.getItem(LAYOUT_STORAGE_KEY);
+ if (!raw) return;
+ const data = JSON.parse(raw);
+ if (data.v !== 3) {
+ localStorage.removeItem(LAYOUT_STORAGE_KEY);
+ return;
+ }
+
+ if (data.leftWidth) this.leftWidth_ = data.leftWidth;
+ if (data.rightWidth) this.rightWidth_ = data.rightWidth;
+ if (data.bottomHeight) this.bottomHeight_ = data.bottomHeight;
+
+ if (data.collapsed) {
+ for (const id of data.collapsed) {
+ if (id === 'left' || id === 'right' || id === 'bottom') {
+ this.collapsed_.add(id);
+ this.savedSizes_.set(id, id === 'left' ? this.leftWidth_ : id === 'right' ? this.rightWidth_ : this.bottomHeight_);
+ this.updateAreaCollapsed_(id, true);
+ }
+ }
+ }
+
+ this.updateSplitterVisibility_();
+ } catch {
+ localStorage.removeItem(LAYOUT_STORAGE_KEY);
+ }
+ }
+
+ private scheduleSave_(): void {
+ if (this.saveTimer_) clearTimeout(this.saveTimer_);
+ this.saveTimer_ = setTimeout(() => {
+ this.saveTimer_ = null;
+ this.saveLayout();
+ }, 500);
+ }
+
+ private showDefaultTabContextMenu_(panelId: string, region: DockRegion, x: number, y: number): void {
+ const area = this.findRegionArea(region);
+ if (!area) return;
+
+ const group = this.getGroup(area);
+ const canClose = !(group.paneCount <= 1 && region.panelCount <= 1 && area === 'center');
+
+ const items: Array<{ label: string; onClick: () => void }> = [];
+
+ if (canClose) {
+ items.push({ label: 'Close', onClick: () => this.removePanel(panelId) });
+ }
+
+ if (region.panelCount > 1) {
+ if (group.direction === 'horizontal') {
+ items.push({ label: 'Split Right', onClick: () => { group.splitPane(region, panelId, 'right'); this.scheduleSave_(); } });
+ items.push({ label: 'Split Left', onClick: () => { group.splitPane(region, panelId, 'left'); this.scheduleSave_(); } });
+ } else {
+ items.push({ label: 'Split Down', onClick: () => { group.splitPane(region, panelId, 'bottom'); this.scheduleSave_(); } });
+ items.push({ label: 'Split Up', onClick: () => { group.splitPane(region, panelId, 'top'); this.scheduleSave_(); } });
+ }
+ }
+
+ const moveTargets: Array<{ label: string; areaId: AreaId }> = [
+ { label: 'Left', areaId: 'left' },
+ { label: 'Center', areaId: 'center' },
+ { label: 'Right', areaId: 'right' },
+ { label: 'Bottom', areaId: 'bottom' },
+ ];
+ for (const mt of moveTargets) {
+ if (mt.areaId === area) continue;
+ items.push({
+ label: `Move to ${mt.label}`,
+ onClick: () => {
+ const target = this.getGroup(mt.areaId).primary;
+ this.onTabMoved(panelId, region, target, target.panelCount);
+ },
+ });
+ }
+
+ showContextMenu({ items, x, y });
+ }
+
+ dispose(): void {
+ if (this.saveTimer_) {
+ clearTimeout(this.saveTimer_);
+ this.saveLayout();
+ }
+ this.resizeObserver_.disconnect();
+ this.tabDrag_.dispose();
+ this.leftSplitter_.dispose();
+ this.rightSplitter_.dispose();
+ this.bottomSplitter_.dispose();
+ this.leftGroup_.dispose();
+ this.centerGroup_.dispose();
+ this.rightGroup_.dispose();
+ this.bottomGroup_.dispose();
+ this.element.remove();
+ }
+}
diff --git a/editor/src/dock/DockPaneGroup.ts b/editor/src/dock/DockPaneGroup.ts
new file mode 100644
index 000000000..ab33a82c4
--- /dev/null
+++ b/editor/src/dock/DockPaneGroup.ts
@@ -0,0 +1,193 @@
+import { DockRegion, type RegionId, type DockRegionOptions, type DockPanelEntry } from './DockRegion';
+import { DockSplitter } from './DockSplitter';
+
+const MIN_PANE_SIZE = 80;
+
+export type SplitDirection = 'horizontal' | 'vertical';
+
+export interface DockPaneGroupOptions {
+ regionId: RegionId;
+ direction: SplitDirection;
+ makeRegionOpts: (id: RegionId) => DockRegionOptions;
+ onSplitterResizeEnd?: () => void;
+}
+
+export class DockPaneGroup {
+ readonly container: HTMLElement;
+ readonly direction: SplitDirection;
+ private regionId_: RegionId;
+ private panes_: DockRegion[] = [];
+ private splitters_: DockSplitter[] = [];
+ private makeRegionOpts_: (id: RegionId) => DockRegionOptions;
+ private onSplitterResizeEnd_?: () => void;
+
+ constructor(options: DockPaneGroupOptions) {
+ this.regionId_ = options.regionId;
+ this.direction = options.direction;
+ this.makeRegionOpts_ = options.makeRegionOpts;
+ this.onSplitterResizeEnd_ = options.onSplitterResizeEnd;
+
+ this.container = document.createElement('div');
+ this.container.className = `es-dock-pane-group es-dock-pane-group-${options.direction}`;
+ }
+
+ get panes(): readonly DockRegion[] {
+ return this.panes_;
+ }
+
+ get primary(): DockRegion {
+ return this.panes_[0];
+ }
+
+ get paneCount(): number {
+ return this.panes_.length;
+ }
+
+ addPane(): DockRegion {
+ const region = new DockRegion(this.makeRegionOpts_(this.regionId_));
+
+ if (this.panes_.length > 0) {
+ const splitter = this.makeSplitter_(this.splitters_.length);
+ this.splitters_.push(splitter);
+ }
+
+ this.panes_.push(region);
+ this.rebuildDOM_();
+ this.applyEqualFlex_();
+ return region;
+ }
+
+ removePane(region: DockRegion): void {
+ const idx = this.panes_.indexOf(region);
+ if (idx < 0 || this.panes_.length <= 1) return;
+
+ region.element.remove();
+ this.panes_.splice(idx, 1);
+
+ if (this.splitters_.length > 0) {
+ const splitterIdx = Math.min(idx, this.splitters_.length - 1);
+ this.splitters_[splitterIdx].element.remove();
+ this.splitters_[splitterIdx].dispose();
+ this.splitters_.splice(splitterIdx, 1);
+ }
+
+ this.rebuildDOM_();
+ this.applyEqualFlex_();
+ region.dispose();
+ }
+
+ splitPane(sourceRegion: DockRegion, panelId: string, side: string): void {
+ const entry = sourceRegion.removePanel(panelId);
+ if (!entry) return;
+
+ const sourceIdx = this.panes_.indexOf(sourceRegion);
+ if (sourceIdx < 0) return;
+
+ const isBefore = (this.direction === 'horizontal')
+ ? (side === 'left')
+ : (side === 'top');
+ const insertIdx = isBefore ? sourceIdx : sourceIdx + 1;
+
+ const newRegion = new DockRegion(this.makeRegionOpts_(this.regionId_));
+ const splitter = this.makeSplitter_(this.splitters_.length);
+ this.splitters_.push(splitter);
+ this.panes_.splice(insertIdx, 0, newRegion);
+
+ this.rebuildDOM_();
+ newRegion.addPanel(entry);
+ newRegion.activate(panelId);
+ this.applyEqualFlex_();
+ }
+
+ insertPane(entry: DockPanelEntry, targetRegion: DockRegion, side: string): DockRegion {
+ const targetIdx = this.panes_.indexOf(targetRegion);
+ if (targetIdx < 0) return targetRegion;
+
+ const isBefore = (this.direction === 'horizontal')
+ ? (side === 'left')
+ : (side === 'top');
+ const insertIdx = isBefore ? targetIdx : targetIdx + 1;
+
+ const newRegion = new DockRegion(this.makeRegionOpts_(this.regionId_));
+ const splitter = this.makeSplitter_(this.splitters_.length);
+ this.splitters_.push(splitter);
+ this.panes_.splice(insertIdx, 0, newRegion);
+
+ this.rebuildDOM_();
+ newRegion.addPanel(entry);
+ newRegion.activate(entry.id);
+ this.applyEqualFlex_();
+ return newRegion;
+ }
+
+ containsPane(region: DockRegion): boolean {
+ return this.panes_.includes(region);
+ }
+
+ hasPanel(panelId: string): DockRegion | null {
+ for (const pane of this.panes_) {
+ if (pane.hasPanel(panelId)) return pane;
+ }
+ return null;
+ }
+
+ serialize(): Array<{ panels: string[]; active: string | null }> {
+ return this.panes_.map(p => ({
+ panels: p.panels.map(e => e.id),
+ active: p.activeId,
+ }));
+ }
+
+ private makeSplitter_(index: number): DockSplitter {
+ const dir = this.direction === 'horizontal' ? 'vertical' : 'horizontal';
+ return new DockSplitter({
+ direction: dir,
+ onResize: (d) => this.resizeSplitter_(index, d),
+ onResizeEnd: () => this.onSplitterResizeEnd_?.(),
+ });
+ }
+
+ private resizeSplitter_(splitterIdx: number): void;
+ private resizeSplitter_(splitterIdx: number, delta: number): void;
+ private resizeSplitter_(splitterIdx: number, delta?: number): void {
+ if (delta === undefined || splitterIdx >= this.panes_.length - 1) return;
+ const a = this.panes_[splitterIdx];
+ const b = this.panes_[splitterIdx + 1];
+
+ const isHoriz = this.direction === 'horizontal';
+ const aSize = isHoriz ? a.element.offsetWidth : a.element.offsetHeight;
+ const bSize = isHoriz ? b.element.offsetWidth : b.element.offsetHeight;
+
+ const newA = aSize + delta;
+ const newB = bSize - delta;
+
+ if (newA >= MIN_PANE_SIZE && newB >= MIN_PANE_SIZE) {
+ a.element.style.flex = `0 0 ${newA}px`;
+ b.element.style.flex = `0 0 ${newB}px`;
+ }
+ }
+
+ applyEqualFlex_(): void {
+ for (const pane of this.panes_) {
+ pane.element.style.flex = '1 1 0';
+ }
+ }
+
+ private rebuildDOM_(): void {
+ this.container.innerHTML = '';
+ for (let i = 0; i < this.panes_.length; i++) {
+ if (i > 0 && i - 1 < this.splitters_.length) {
+ this.container.appendChild(this.splitters_[i - 1].element);
+ }
+ this.container.appendChild(this.panes_[i].element);
+ }
+ }
+
+ dispose(): void {
+ for (const s of this.splitters_) s.dispose();
+ for (const p of this.panes_) p.dispose();
+ this.splitters_ = [];
+ this.panes_ = [];
+ this.container.remove();
+ }
+}
diff --git a/editor/src/dock/DockRegion.ts b/editor/src/dock/DockRegion.ts
new file mode 100644
index 000000000..008d5e598
--- /dev/null
+++ b/editor/src/dock/DockRegion.ts
@@ -0,0 +1,280 @@
+import { icon } from '../utils/icons';
+
+export type RegionId = 'left' | 'center' | 'right' | 'bottom';
+
+export interface DockPanelEntry {
+ id: string;
+ title: string;
+ contentEl: HTMLElement;
+}
+
+export interface DockRegionOptions {
+ id: RegionId;
+ instanceId?: string;
+ onTabContextMenu?: (panelId: string, x: number, y: number) => void;
+ onPanelActivated?: (panelId: string) => void;
+ onTabDragStart?: (panelId: string, e: MouseEvent) => void;
+ onTabClose?: (panelId: string) => void;
+ onEmpty?: (region: DockRegion) => void;
+}
+
+let regionCounter = 0;
+
+export class DockRegion {
+ readonly id: RegionId;
+ readonly instanceId: string;
+ readonly element: HTMLElement;
+ readonly tabBar: HTMLElement;
+ readonly contentArea: HTMLElement;
+
+ private panels_: DockPanelEntry[] = [];
+ private activeId_: string | null = null;
+ private collapsed_ = false;
+ private savedSize_ = 0;
+ private options_: DockRegionOptions;
+
+ private scrollLeftBtn_: HTMLElement | null = null;
+ private scrollRightBtn_: HTMLElement | null = null;
+ private tabsInner_: HTMLElement;
+
+ constructor(options: DockRegionOptions) {
+ this.id = options.id;
+ this.instanceId = options.instanceId ?? `region-${regionCounter++}`;
+ this.options_ = options;
+
+ this.element = document.createElement('div');
+ this.element.className = `es-dock-region es-dock-${options.id}`;
+ this.element.dataset.region = options.id;
+ this.element.dataset.instanceId = this.instanceId;
+
+ this.tabBar = document.createElement('div');
+ this.tabBar.className = 'es-dock-tabs';
+ this.tabBar.dataset.region = options.id;
+ this.tabBar.dataset.instanceId = this.instanceId;
+
+ this.tabsInner_ = document.createElement('div');
+ this.tabsInner_.className = 'es-dock-tabs-inner';
+ this.tabBar.appendChild(this.tabsInner_);
+
+ this.contentArea = document.createElement('div');
+ this.contentArea.className = 'es-dock-content';
+ this.contentArea.dataset.instanceId = this.instanceId;
+
+ this.element.appendChild(this.tabBar);
+ this.element.appendChild(this.contentArea);
+
+ this.tabBar.addEventListener('wheel', (e) => {
+ e.preventDefault();
+ this.tabsInner_.scrollLeft += e.deltaY;
+ }, { passive: false });
+ }
+
+ get panels(): readonly DockPanelEntry[] {
+ return this.panels_;
+ }
+
+ get activeId(): string | null {
+ return this.activeId_;
+ }
+
+ get panelCount(): number {
+ return this.panels_.length;
+ }
+
+ get isCollapsed(): boolean {
+ return this.collapsed_;
+ }
+
+ get savedSize(): number {
+ return this.savedSize_;
+ }
+
+ addPanel(entry: DockPanelEntry, index?: number): void {
+ const idx = index !== undefined ? Math.min(index, this.panels_.length) : this.panels_.length;
+ this.panels_.splice(idx, 0, entry);
+
+ entry.contentEl.classList.add('es-dock-panel');
+ entry.contentEl.style.display = 'none';
+ this.contentArea.appendChild(entry.contentEl);
+
+ this.rebuildTabs_();
+
+ if (this.panels_.length === 1 || !this.activeId_) {
+ this.activate(entry.id);
+ }
+ }
+
+ removePanel(panelId: string): DockPanelEntry | null {
+ const idx = this.panels_.findIndex(p => p.id === panelId);
+ if (idx < 0) return null;
+
+ const [entry] = this.panels_.splice(idx, 1);
+ entry.contentEl.style.display = 'none';
+ entry.contentEl.remove();
+
+ if (this.activeId_ === panelId) {
+ const newActive = this.panels_[Math.min(idx, this.panels_.length - 1)];
+ this.activeId_ = null;
+ if (newActive) {
+ this.activate(newActive.id);
+ }
+ }
+
+ this.rebuildTabs_();
+
+ if (this.panels_.length === 0) {
+ this.options_.onEmpty?.(this);
+ }
+
+ return entry;
+ }
+
+ hasPanel(panelId: string): boolean {
+ return this.panels_.some(p => p.id === panelId);
+ }
+
+ activate(panelId: string): void {
+ if (this.activeId_ === panelId) return;
+
+ for (const p of this.panels_) {
+ const isActive = p.id === panelId;
+ p.contentEl.style.display = isActive ? '' : 'none';
+ }
+
+ this.activeId_ = panelId;
+ this.updateTabActive_();
+ this.scrollTabIntoView_(panelId);
+ this.options_.onPanelActivated?.(panelId);
+ }
+
+ reorderPanel(panelId: string, newIndex: number): void {
+ const oldIdx = this.panels_.findIndex(p => p.id === panelId);
+ if (oldIdx < 0 || oldIdx === newIndex) return;
+
+ const [entry] = this.panels_.splice(oldIdx, 1);
+ this.panels_.splice(Math.min(newIndex, this.panels_.length), 0, entry);
+ this.rebuildTabs_();
+ }
+
+ collapse(size?: number): void {
+ if (this.collapsed_) return;
+ if (size !== undefined) this.savedSize_ = size;
+ this.collapsed_ = true;
+ this.element.classList.add('es-dock-collapsed');
+ }
+
+ expand(): void {
+ if (!this.collapsed_) return;
+ this.collapsed_ = false;
+ this.element.classList.remove('es-dock-collapsed');
+
+ if (this.activeId_) {
+ const p = this.panels_.find(e => e.id === this.activeId_);
+ if (p) p.contentEl.style.display = '';
+ }
+ }
+
+ setSavedSize(size: number): void {
+ this.savedSize_ = size;
+ }
+
+ getTabElement(panelId: string): HTMLElement | null {
+ return this.tabsInner_.querySelector(`[data-panel-id="${panelId}"]`);
+ }
+
+ getInsertIndexAtX(clientX: number): number {
+ const tabs = Array.from(this.tabsInner_.children) as HTMLElement[];
+ for (let i = 0; i < tabs.length; i++) {
+ const rect = tabs[i].getBoundingClientRect();
+ if (clientX < rect.left + rect.width / 2) return i;
+ }
+ return tabs.length;
+ }
+
+ private rebuildTabs_(): void {
+ this.tabsInner_.innerHTML = '';
+
+ for (const p of this.panels_) {
+ const tab = document.createElement('div');
+ tab.className = 'es-dock-tab';
+ tab.dataset.panelId = p.id;
+
+ const label = document.createElement('span');
+ label.className = 'es-dock-tab-label';
+ label.textContent = p.title;
+ tab.appendChild(label);
+
+ const closeBtn = document.createElement('span');
+ closeBtn.className = 'es-dock-tab-close';
+ closeBtn.innerHTML = icon('x', 12);
+ closeBtn.addEventListener('mousedown', (e) => e.stopPropagation());
+ closeBtn.addEventListener('click', (e) => {
+ e.stopPropagation();
+ this.options_.onTabClose?.(p.id);
+ });
+ tab.appendChild(closeBtn);
+
+ tab.addEventListener('mousedown', (e) => {
+ if (e.button === 0 && !(e.target as HTMLElement).closest('.es-dock-tab-close')) {
+ this.activate(p.id);
+ this.options_.onTabDragStart?.(p.id, e);
+ }
+ });
+
+ tab.addEventListener('contextmenu', (e) => {
+ e.preventDefault();
+ this.options_.onTabContextMenu?.(p.id, e.clientX, e.clientY);
+ });
+
+ this.tabsInner_.appendChild(tab);
+ }
+
+ this.updateTabActive_();
+ this.updateScrollButtons_();
+ }
+
+ private updateTabActive_(): void {
+ const tabs = this.tabsInner_.children;
+ for (let i = 0; i < tabs.length; i++) {
+ const tab = tabs[i] as HTMLElement;
+ tab.classList.toggle('es-dock-tab-active', tab.dataset.panelId === this.activeId_);
+ }
+ }
+
+ private scrollTabIntoView_(panelId: string): void {
+ const tab = this.getTabElement(panelId);
+ if (tab) tab.scrollIntoView({ block: 'nearest', inline: 'nearest' });
+ }
+
+ private updateScrollButtons_(): void {
+ const needsScroll = this.tabsInner_.scrollWidth > this.tabsInner_.clientWidth;
+
+ if (needsScroll && !this.scrollLeftBtn_) {
+ this.scrollLeftBtn_ = document.createElement('div');
+ this.scrollLeftBtn_.className = 'es-dock-tabs-scroll es-dock-tabs-scroll-left';
+ this.scrollLeftBtn_.innerHTML = icon('chevronLeft', 12);
+ this.scrollLeftBtn_.addEventListener('click', () => {
+ this.tabsInner_.scrollBy({ left: -100, behavior: 'smooth' });
+ });
+ this.tabBar.insertBefore(this.scrollLeftBtn_, this.tabsInner_);
+
+ this.scrollRightBtn_ = document.createElement('div');
+ this.scrollRightBtn_.className = 'es-dock-tabs-scroll es-dock-tabs-scroll-right';
+ this.scrollRightBtn_.innerHTML = icon('chevronRight', 12);
+ this.scrollRightBtn_.addEventListener('click', () => {
+ this.tabsInner_.scrollBy({ left: 100, behavior: 'smooth' });
+ });
+ this.tabBar.appendChild(this.scrollRightBtn_);
+ } else if (!needsScroll && this.scrollLeftBtn_) {
+ this.scrollLeftBtn_.remove();
+ this.scrollRightBtn_?.remove();
+ this.scrollLeftBtn_ = null;
+ this.scrollRightBtn_ = null;
+ }
+ }
+
+ dispose(): void {
+ this.panels_ = [];
+ this.element.remove();
+ }
+}
diff --git a/editor/src/dock/DockSplitter.ts b/editor/src/dock/DockSplitter.ts
new file mode 100644
index 000000000..4e5cee168
--- /dev/null
+++ b/editor/src/dock/DockSplitter.ts
@@ -0,0 +1,91 @@
+export type SplitterDirection = 'horizontal' | 'vertical';
+
+export interface DockSplitterOptions {
+ direction: SplitterDirection;
+ onResize: (delta: number) => void;
+ onResizeEnd?: () => void;
+ onDoubleClick?: () => void;
+}
+
+export class DockSplitter {
+ readonly element: HTMLElement;
+ private direction_: SplitterDirection;
+ private onResize_: (delta: number) => void;
+ private onResizeEnd_?: () => void;
+ private overlay_: HTMLElement | null = null;
+ private startPos_ = 0;
+ private lastPos_ = 0;
+
+ private onMouseMove_: (e: MouseEvent) => void;
+ private onMouseUp_: (e: MouseEvent) => void;
+
+ constructor(options: DockSplitterOptions) {
+ this.direction_ = options.direction;
+ this.onResize_ = options.onResize;
+ this.onResizeEnd_ = options.onResizeEnd;
+
+ this.element = document.createElement('div');
+ this.element.className = `es-dock-splitter es-splitter-${options.direction === 'vertical' ? 'v' : 'h'}`;
+
+ this.onMouseMove_ = this.handleMouseMove_.bind(this);
+ this.onMouseUp_ = this.handleMouseUp_.bind(this);
+
+ this.element.addEventListener('mousedown', this.handleMouseDown_.bind(this));
+
+ if (options.onDoubleClick) {
+ this.element.addEventListener('dblclick', options.onDoubleClick);
+ }
+ }
+
+ setVisible(visible: boolean): void {
+ this.element.style.display = visible ? '' : 'none';
+ }
+
+ private handleMouseDown_(e: MouseEvent): void {
+ if (e.button !== 0) return;
+ e.preventDefault();
+
+ this.startPos_ = this.direction_ === 'vertical' ? e.clientX : e.clientY;
+ this.lastPos_ = this.startPos_;
+
+ this.element.classList.add('es-dock-splitter-active');
+
+ this.overlay_ = document.createElement('div');
+ this.overlay_.className = 'es-dock-drag-overlay';
+ this.overlay_.style.cursor = this.direction_ === 'vertical' ? 'col-resize' : 'row-resize';
+ document.body.appendChild(this.overlay_);
+
+ document.addEventListener('mousemove', this.onMouseMove_);
+ document.addEventListener('mouseup', this.onMouseUp_);
+ }
+
+ private handleMouseMove_(e: MouseEvent): void {
+ const pos = this.direction_ === 'vertical' ? e.clientX : e.clientY;
+ const delta = pos - this.lastPos_;
+ if (delta !== 0) {
+ this.onResize_(delta);
+ this.lastPos_ = pos;
+ }
+ }
+
+ private handleMouseUp_(_e: MouseEvent): void {
+ document.removeEventListener('mousemove', this.onMouseMove_);
+ document.removeEventListener('mouseup', this.onMouseUp_);
+
+ this.element.classList.remove('es-dock-splitter-active');
+
+ if (this.overlay_) {
+ this.overlay_.remove();
+ this.overlay_ = null;
+ }
+
+ this.onResizeEnd_?.();
+ }
+
+ dispose(): void {
+ document.removeEventListener('mousemove', this.onMouseMove_);
+ document.removeEventListener('mouseup', this.onMouseUp_);
+ this.overlay_?.remove();
+ this.element.remove();
+ }
+}
diff --git a/editor/src/dock/DockTabDrag.ts b/editor/src/dock/DockTabDrag.ts
new file mode 100644
index 000000000..8aff5554b
--- /dev/null
+++ b/editor/src/dock/DockTabDrag.ts
@@ -0,0 +1,283 @@
+import type { DockRegion } from './DockRegion';
+import { icon } from '../utils/icons';
+
+const DRAG_THRESHOLD = 5;
+const EDGE_ZONE_SIZE = 40;
+
+export type EdgeSide = 'left' | 'right' | 'top' | 'bottom';
+
+export type DropResult =
+ | { type: 'tab'; region: DockRegion; index: number }
+ | { type: 'edge'; region: DockRegion; side: EdgeSide };
+
+export interface TabDragHost {
+ getRegions(): DockRegion[];
+ getEdgeDirections(region: DockRegion): EdgeSide[];
+ onTabMoved(panelId: string, sourceRegion: DockRegion, targetRegion: DockRegion, index: number): void;
+ onTabReordered(panelId: string, region: DockRegion, newIndex: number): void;
+ onEdgeDrop(panelId: string, source: DockRegion, target: DockRegion, side: EdgeSide): void;
+}
+
+export class DockTabDrag {
+ private host_: TabDragHost;
+ private dragging_ = false;
+ private panelId_: string | null = null;
+ private sourceRegion_: DockRegion | null = null;
+ private ghost_: HTMLElement | null = null;
+ private indicator_: HTMLElement | null = null;
+ private edgeOverlay_: HTMLElement | null = null;
+ private overlay_: HTMLElement | null = null;
+ private startX_ = 0;
+ private startY_ = 0;
+ private thresholdMet_ = false;
+ private lastDrop_: DropResult | null = null;
+
+ private onMouseMove_: (e: MouseEvent) => void;
+ private onMouseUp_: (e: MouseEvent) => void;
+
+ constructor(host: TabDragHost) {
+ this.host_ = host;
+ this.onMouseMove_ = this.handleMouseMove_.bind(this);
+ this.onMouseUp_ = this.handleMouseUp_.bind(this);
+ }
+
+ startDrag(panelId: string, sourceRegion: DockRegion, e: MouseEvent): void {
+ if (this.dragging_) return;
+
+ this.panelId_ = panelId;
+ this.sourceRegion_ = sourceRegion;
+ this.startX_ = e.clientX;
+ this.startY_ = e.clientY;
+ this.thresholdMet_ = false;
+ this.dragging_ = true;
+ this.lastDrop_ = null;
+
+ document.addEventListener('mousemove', this.onMouseMove_);
+ document.addEventListener('mouseup', this.onMouseUp_);
+ }
+
+ private handleMouseMove_(e: MouseEvent): void {
+ if (!this.dragging_ || !this.panelId_ || !this.sourceRegion_) return;
+
+ if (!this.thresholdMet_) {
+ const dx = e.clientX - this.startX_;
+ const dy = e.clientY - this.startY_;
+ if (Math.abs(dx) < DRAG_THRESHOLD && Math.abs(dy) < DRAG_THRESHOLD) return;
+ this.thresholdMet_ = true;
+ this.createDragVisuals_();
+ }
+
+ if (this.ghost_) {
+ this.ghost_.style.left = `${e.clientX + 10}px`;
+ this.ghost_.style.top = `${e.clientY + 10}px`;
+ }
+
+ this.updateDropTarget_(e.clientX, e.clientY);
+ }
+
+ private handleMouseUp_(_e: MouseEvent): void {
+ document.removeEventListener('mousemove', this.onMouseMove_);
+ document.removeEventListener('mouseup', this.onMouseUp_);
+
+ if (this.thresholdMet_ && this.panelId_ && this.sourceRegion_ && this.lastDrop_) {
+ const drop = this.lastDrop_;
+ if (drop.type === 'edge') {
+ this.host_.onEdgeDrop(this.panelId_, this.sourceRegion_, drop.region, drop.side);
+ } else if (drop.region === this.sourceRegion_) {
+ this.host_.onTabReordered(this.panelId_, this.sourceRegion_, drop.index);
+ } else {
+ this.host_.onTabMoved(this.panelId_, this.sourceRegion_, drop.region, drop.index);
+ }
+ }
+
+ this.cleanup_();
+ }
+
+ private createDragVisuals_(): void {
+ if (!this.panelId_ || !this.sourceRegion_) return;
+
+ const sourceTab = this.sourceRegion_.getTabElement(this.panelId_);
+ if (sourceTab) sourceTab.classList.add('es-dock-tab-dragging');
+
+ this.ghost_ = document.createElement('div');
+ this.ghost_.className = 'es-dock-tab-ghost';
+ const gripSvg = icon('grip', 12);
+ const entry = this.sourceRegion_.panels.find(p => p.id === this.panelId_);
+ this.ghost_.innerHTML = `${gripSvg}<span>${entry?.title ?? this.panelId_}</span>`;
+ document.body.appendChild(this.ghost_);
+
+ this.indicator_ = document.createElement('div');
+ this.indicator_.className = 'es-dock-drop-indicator';
+ this.indicator_.style.display = 'none';
+ document.body.appendChild(this.indicator_);
+
+ this.edgeOverlay_ = document.createElement('div');
+ this.edgeOverlay_.className = 'es-dock-edge-overlay';
+ this.edgeOverlay_.style.display = 'none';
+ document.body.appendChild(this.edgeOverlay_);
+
+ this.overlay_ = document.createElement('div');
+ this.overlay_.className = 'es-dock-drag-overlay';
+ document.body.appendChild(this.overlay_);
+ }
+
+ private updateDropTarget_(x: number, y: number): void {
+ if (!this.indicator_ || !this.edgeOverlay_) return;
+
+ this.lastDrop_ = null;
+ this.indicator_.style.display = 'none';
+ this.edgeOverlay_.style.display = 'none';
+
+ for (const region of this.host_.getRegions()) {
+ region.tabBar.classList.remove('es-dock-tabs-drop-target');
+ }
+
+ const edgeDrop = this.findEdgeDrop_(x, y);
+ if (edgeDrop && edgeDrop.type === 'edge') {
+ this.lastDrop_ = edgeDrop;
+ this.showEdgeOverlay_(edgeDrop.region, edgeDrop.side);
+ return;
+ }
+
+ const tabDrop = this.findTabDrop_(x, y);
+ if (tabDrop && tabDrop.type === 'tab') {
+ this.lastDrop_ = tabDrop;
+ tabDrop.region.tabBar.classList.add('es-dock-tabs-drop-target');
+ this.showTabIndicator_(tabDrop.region, tabDrop.index);
+ }
+ }
+
+ private findEdgeDrop_(x: number, y: number): DropResult | null {
+ for (const region of this.host_.getRegions()) {
+ const contentRect = region.contentArea.getBoundingClientRect();
+ if (x < contentRect.left || x > contentRect.right || y < contentRect.top || y > contentRect.bottom) continue;
+
+ const directions = this.host_.getEdgeDirections(region);
+
+ for (const dir of directions) {
+ if (dir === 'left' && x < contentRect.left + EDGE_ZONE_SIZE) {
+ return { type: 'edge', region, side: 'left' };
+ }
+ if (dir === 'right' && x > contentRect.right - EDGE_ZONE_SIZE) {
+ return { type: 'edge', region, side: 'right' };
+ }
+ if (dir === 'top' && y < contentRect.top + EDGE_ZONE_SIZE) {
+ return { type: 'edge', region, side: 'top' };
+ }
+ if (dir === 'bottom' && y > contentRect.bottom - EDGE_ZONE_SIZE) {
+ return { type: 'edge', region, side: 'bottom' };
+ }
+ }
+ }
+ return null;
+ }
+
+ private showEdgeOverlay_(region: DockRegion, side: EdgeSide): void {
+ if (!this.edgeOverlay_) return;
+
+ const rect = region.contentArea.getBoundingClientRect();
+ this.edgeOverlay_.style.display = '';
+
+ switch (side) {
+ case 'left':
+ this.edgeOverlay_.style.left = `${rect.left}px`;
+ this.edgeOverlay_.style.top = `${rect.top}px`;
+ this.edgeOverlay_.style.width = `${rect.width / 2}px`;
+ this.edgeOverlay_.style.height = `${rect.height}px`;
+ break;
+ case 'right':
+ this.edgeOverlay_.style.left = `${rect.left + rect.width / 2}px`;
+ this.edgeOverlay_.style.top = `${rect.top}px`;
+ this.edgeOverlay_.style.width = `${rect.width / 2}px`;
+ this.edgeOverlay_.style.height = `${rect.height}px`;
+ break;
+ case 'top':
+ this.edgeOverlay_.style.left = `${rect.left}px`;
+ this.edgeOverlay_.style.top = `${rect.top}px`;
+ this.edgeOverlay_.style.width = `${rect.width}px`;
+ this.edgeOverlay_.style.height = `${rect.height / 2}px`;
+ break;
+ case 'bottom':
+ this.edgeOverlay_.style.left = `${rect.left}px`;
+ this.edgeOverlay_.style.top = `${rect.top + rect.height / 2}px`;
+ this.edgeOverlay_.style.width = `${rect.width}px`;
+ this.edgeOverlay_.style.height = `${rect.height / 2}px`;
+ break;
+ }
+ }
+
+ private findTabDrop_(x: number, y: number): DropResult | null {
+ for (const region of this.host_.getRegions()) {
+ const rect = region.tabBar.getBoundingClientRect();
+ const hitArea = {
+ left: rect.left,
+ right: rect.right,
+ top: rect.top - 10,
+ bottom: rect.bottom + 20,
+ };
+ if (x >= hitArea.left && x <= hitArea.right && y >= hitArea.top && y <= hitArea.bottom) {
+ return { type: 'tab', region, index: region.getInsertIndexAtX(x) };
+ }
+ }
+ return null;
+ }
+
+ private showTabIndicator_(region: DockRegion, insertIdx: number): void {
+ if (!this.indicator_) return;
+
+ const tabs = Array.from(region.tabBar.querySelector('.es-dock-tabs-inner')?.children ?? []) as HTMLElement[];
+
+ if (tabs.length === 0) {
+ const barRect = region.tabBar.getBoundingClientRect();
+ this.indicator_.style.display = '';
+ this.indicator_.style.left = `${barRect.left + 4}px`;
+ this.indicator_.style.top = `${barRect.top + 2}px`;
+ this.indicator_.style.height = `${barRect.height - 4}px`;
+ } else if (insertIdx < tabs.length) {
+ const tabRect = tabs[insertIdx].getBoundingClientRect();
+ this.indicator_.style.display = '';
+ this.indicator_.style.left = `${tabRect.left - 1}px`;
+ this.indicator_.style.top = `${tabRect.top + 2}px`;
+ this.indicator_.style.height = `${tabRect.height - 4}px`;
+ } else {
+ const lastTab = tabs[tabs.length - 1];
+ const tabRect = lastTab.getBoundingClientRect();
+ this.indicator_.style.display = '';
+ this.indicator_.style.left = `${tabRect.right - 1}px`;
+ this.indicator_.style.top = `${tabRect.top + 2}px`;
+ this.indicator_.style.height = `${tabRect.height - 4}px`;
+ }
+ }
+
+ private cleanup_(): void {
+ if (this.panelId_ && this.sourceRegion_) {
+ const sourceTab = this.sourceRegion_.getTabElement(this.panelId_);
+ sourceTab?.classList.remove('es-dock-tab-dragging');
+ }
+
+ this.ghost_?.remove();
+ this.indicator_?.remove();
+ this.edgeOverlay_?.remove();
+ this.overlay_?.remove();
+ this.ghost_ = null;
+ this.indicator_ = null;
+ this.edgeOverlay_ = null;
+ this.overlay_ = null;
+
+ for (const region of this.host_.getRegions()) {
+ region.tabBar.classList.remove('es-dock-tabs-drop-target');
+ }
+
+ this.dragging_ = false;
+ this.panelId_ = null;
+ this.sourceRegion_ = null;
+ this.thresholdMet_ = false;
+ this.lastDrop_ = null;
+ }
+
+ dispose(): void {
+ document.removeEventListener('mousemove', this.onMouseMove_);
+ document.removeEventListener('mouseup', this.onMouseUp_);
+ this.cleanup_();
+ }
+}
diff --git a/editor/src/menus/builtinMenus.ts b/editor/src/menus/builtinMenus.ts
index d5dc52f9b..fe1907ca9 100644
--- a/editor/src/menus/builtinMenus.ts
+++ b/editor/src/menus/builtinMenus.ts
@@ -3,9 +3,11 @@ import type { PluginRegistrar } from '../container';
import { MENU, MENU_ITEM } from '../container/tokens';
import { getEditorContext } from '../context/EditorContext';
import { showAboutDialog } from '../dialogs/AboutDialog';
+import { showShortcutHelpDialog } from '../dialogs/ShortcutHelpDialog';
import { showAddressableWindow } from '../dialogs/AddressableWindow';
import { showStatusBarMessage } from './builtinStatusbar';
import { showConfirmDialog } from '../ui/dialog';
+import { showCommandPalette } from '../ui/CommandPalette';
import { getEditorStore } from '../store';
import {
getSceneService,
@@ -25,7 +27,7 @@ export function registerBuiltinMenus(registrar: PluginRegistrar): void {
registerMenu({ id: 'file', label: 'File', order: 0 });
registerMenu({ id: 'edit', label: 'Edit', order: 1 });
registerMenu({ id: 'view', label: 'View', order: 2 });
- registerMenu({ id: 'help', label: 'Help', order: 3 });
+ registerMenu({ id: 'help', label: '\u22EF', order: 3 });
registerMenuItem({
id: 'file.new', menu: 'file', label: 'New Scene',
@@ -148,28 +150,40 @@ export function registerBuiltinMenus(registrar: PluginRegistrar): void {
},
hidden: true,
});
+ registerMenuItem({
+ id: 'edit.command-palette', menu: 'edit', label: 'Command Palette',
+ shortcut: 'Ctrl+K', order: 9, separator: true,
+ action: () => showCommandPalette(),
+ });
registerMenuItem({
id: 'edit.preferences', menu: 'edit', label: 'Settings...',
- shortcut: 'Ctrl+,', order: 10, separator: true,
+ shortcut: 'Ctrl+,', order: 10,
action: () => getProjectService().showSettings(),
});
registerMenuItem({
id: 'view.hierarchy', menu: 'view', label: 'Hierarchy', order: 0,
- action: () => getNavigationService().showPanel('hierarchy'),
+ shortcut: 'Ctrl+Shift+H',
+ action: () => getNavigationService().togglePanel('hierarchy'),
});
registerMenuItem({
id: 'view.inspector', menu: 'view', label: 'Inspector', order: 1,
- action: () => getNavigationService().showPanel('inspector'),
+ shortcut: 'Ctrl+Shift+I',
+ action: () => getNavigationService().togglePanel('inspector'),
+ });
+ registerMenuItem({
+ id: 'view.toggle-bottom', menu: 'view', label: 'Toggle Bottom Panel',
+ shortcut: 'Ctrl+J', order: 1.5,
+ action: () => getNavigationService().toggleRegion('bottom'),
});
registerMenuItem({
id: 'view.content-browser', menu: 'view', label: 'Content Browser',
shortcut: 'Ctrl+Space', order: 2,
- action: () => getNavigationService().showPanel('content-browser'),
+ action: () => getNavigationService().togglePanel('content-browser'),
});
registerMenuItem({
id: 'view.output', menu: 'view', label: 'Output', order: 3,
- action: () => getNavigationService().showPanel('output'),
+ action: () => getNavigationService().togglePanel('output'),
});
registerMenuItem({
id: 'view.game', menu: 'view', label: 'Game', order: 4,
@@ -183,7 +197,7 @@ export function registerBuiltinMenus(registrar: PluginRegistrar): void {
registerMenuItem({
id: 'view.timeline', menu: 'view', label: 'Timeline',
order: 5.5,
- action: () => getNavigationService().showPanel('timeline'),
+ action: () => getNavigationService().togglePanel('timeline'),
});
registerMenuItem({
id: 'view.frame-debugger', menu: 'view', label: 'Frame Debugger',
@@ -193,16 +207,21 @@ export function registerBuiltinMenus(registrar: PluginRegistrar): void {
registerMenuItem({
id: 'view.extensions', menu: 'view', label: 'Extensions',
order: 5.7,
- action: () => getNavigationService().showPanel('extensions'),
+ action: () => getNavigationService().togglePanel('extensions'),
});
registerMenuItem({
id: 'view.addressable', menu: 'view', label: 'Addressable Groups',
order: 6,
action: () => showAddressableWindow(),
});
+ registerMenuItem({
+ id: 'view.toggle-sidebars', menu: 'view', label: 'Toggle Sidebars',
+ shortcut: 'Ctrl+\\', order: 5.9, separator: true,
+ action: () => getNavigationService().toggleAllSidebars(),
+ });
registerMenuItem({
id: 'view.reset-layout', menu: 'view', label: 'Reset Layout',
- order: 6, separator: true,
+ order: 6,
action: () => getNavigationService().resetLayout(),
});
registerMenuItem({
@@ -261,6 +280,11 @@ export function registerBuiltinMenus(registrar: PluginRegistrar): void {
}
},
});
+ registerMenuItem({
+ id: 'help.shortcuts', menu: 'help', label: 'Keyboard Shortcuts', order: 0.5,
+ shortcut: '?',
+ action: () => showShortcutHelpDialog(),
+ });
registerMenuItem({
id: 'help.about', menu: 'help', label: 'About ESEngine', order: 1, separator: true,
action: () => showAboutDialog(),
diff --git a/editor/src/menus/builtinStatusbar.ts b/editor/src/menus/builtinStatusbar.ts
index dd80ef374..62c66363d 100644
--- a/editor/src/menus/builtinStatusbar.ts
+++ b/editor/src/menus/builtinStatusbar.ts
@@ -1,10 +1,10 @@
import type { StatusbarItemDescriptor } from './MenuRegistry';
import { getPanelsByPosition } from '../panels/PanelRegistry';
-import { icons } from '../utils/icons';
import type { PluginRegistrar } from '../container';
import { STATUSBAR_ITEM } from '../container/tokens';
import { getEditorStore } from '../store';
import { getNavigationService, getShellService, getProjectService } from '../services';
+import { icons } from '../utils/icons';
let statusMessageTimer_: ReturnType<typeof setTimeout> | null = null;
let statusMessageEl_: HTMLElement | null = null;
@@ -19,32 +19,75 @@ export function showStatusBarMessage(text: string, durationMs = 2000): void {
}, durationMs);
}
+function createPanelToggleButton(panelId: string, label: string, icon: string | undefined, isPrimary: boolean): HTMLButtonElement {
+ const btn = document.createElement('button');
+ btn.className = `es-statusbar-btn${isPrimary ? ' es-statusbar-btn-primary' : ''}`;
+ btn.dataset.panelToggle = panelId;
+ btn.innerHTML = `${icon ?? ''}<span>${label}</span>`;
+ btn.addEventListener('click', () => getNavigationService().togglePanel(panelId));
+ return btn;
+}
+
+function updatePanelButtonState(btn: HTMLElement, panelId: string): void {
+ const nav = getNavigationService();
+ const collapsed = nav.isCollapsed(panelId);
+ btn.classList.toggle('es-active', !collapsed);
+}
+
export function registerBuiltinStatusbarItems(registrar: PluginRegistrar): void {
const registerStatusbarItem = (d: StatusbarItemDescriptor) => registrar.provide(STATUSBAR_ITEM, d.id, d);
- const bottomPanels = getPanelsByPosition('bottom');
- for (const panel of bottomPanels) {
- const isPrimary = panel.defaultVisible;
+ const leftPanels = getPanelsByPosition('left');
+ const PERMANENT_BOTTOM_PANELS = new Set(['content-browser', 'output']);
+ const bottomPanels = getPanelsByPosition('bottom').filter(p => PERMANENT_BOTTOM_PANELS.has(p.id));
+ const rightPanels = getPanelsByPosition('right');
+
+ let orderCounter = 0;
+
+ for (const panel of leftPanels) {
registerStatusbarItem({
id: `toggle-${panel.id}`,
position: 'left',
- order: panel.order ?? 0,
+ order: orderCounter++,
render: (container) => {
- const btn = document.createElement('button');
- btn.className = `es-statusbar-btn${isPrimary ? ' es-statusbar-btn-primary' : ''}`;
- btn.dataset.bottomPanel = panel.id;
- btn.innerHTML = `${panel.icon ?? ''}<span>${panel.title}</span>`;
+ const btn = createPanelToggleButton(panel.id, panel.title, panel.icon, false);
+ container.appendChild(btn);
- if (isPrimary) {
- btn.innerHTML += icons.chevronDown(10);
- }
+ const unlisten = getNavigationService().onPanelToggle(() => updatePanelButtonState(btn, panel.id));
+ updatePanelButtonState(btn, panel.id);
+
+ return { dispose() { btn.remove(); unlisten(); } };
+ },
+ });
+ }
+
+ if (leftPanels.length > 0 && bottomPanels.length > 0) {
+ registerStatusbarItem({
+ id: 'divider-left-bottom',
+ position: 'left',
+ order: orderCounter++,
+ render: (container) => {
+ const div = document.createElement('div');
+ div.className = 'es-statusbar-divider';
+ container.appendChild(div);
+ return { dispose() { div.remove(); } };
+ },
+ });
+ }
- btn.addEventListener('click', () => getNavigationService().showPanel(panel.id));
+ for (const panel of bottomPanels) {
+ registerStatusbarItem({
+ id: `toggle-${panel.id}`,
+ position: 'left',
+ order: orderCounter++,
+ render: (container) => {
+ const btn = createPanelToggleButton(panel.id, panel.title, panel.icon, true);
container.appendChild(btn);
- return {
- dispose() { btn.remove(); },
- };
+ const unlisten = getNavigationService().onPanelToggle(() => updatePanelButtonState(btn, panel.id));
+ updatePanelButtonState(btn, panel.id);
+
+ return { dispose() { btn.remove(); unlisten(); } };
},
});
}
@@ -52,7 +95,7 @@ export function registerBuiltinStatusbarItems(registrar: PluginRegistrar): void
registerStatusbarItem({
id: 'cmd-input',
position: 'left',
- order: 100,
+ order: 200,
render: (container) => {
const wrapper = document.createElement('span');
wrapper.className = 'es-statusbar-cmd-wrapper';
@@ -78,6 +121,23 @@ export function registerBuiltinStatusbarItems(registrar: PluginRegistrar): void
},
});
+ for (const panel of rightPanels) {
+ registerStatusbarItem({
+ id: `toggle-${panel.id}`,
+ position: 'right',
+ order: -20 + (panel.order ?? 0),
+ render: (container) => {
+ const btn = createPanelToggleButton(panel.id, panel.title, panel.icon, false);
+ container.appendChild(btn);
+
+ const unlisten = getNavigationService().onPanelToggle(() => updatePanelButtonState(btn, panel.id));
+ updatePanelButtonState(btn, panel.id);
+
+ return { dispose() { btn.remove(); unlisten(); } };
+ },
+ });
+ }
+
registerStatusbarItem({
id: 'status-message',
position: 'right',
@@ -93,75 +153,17 @@ export function registerBuiltinStatusbarItems(registrar: PluginRegistrar): void
});
registerStatusbarItem({
- id: 'undo',
- position: 'right',
- order: 0,
- render: (container) => {
- const wrapper = document.createElement('div');
- wrapper.className = 'es-statusbar-icons';
-
- const undoBtn = document.createElement('button');
- undoBtn.title = 'Undo';
- undoBtn.innerHTML = '<span>Undo</span>';
- undoBtn.addEventListener('click', () => {
- const store = getEditorStore();
- const desc = store.undoDescription;
- store.undo();
- if (desc) showStatusBarMessage(`Undo: ${desc}`);
- });
-
- const redoBtn = document.createElement('button');
- redoBtn.title = 'Redo';
- redoBtn.innerHTML = '<span>Redo</span>';
- redoBtn.addEventListener('click', () => {
- const store = getEditorStore();
- const desc = store.redoDescription;
- store.redo();
- if (desc) showStatusBarMessage(`Redo: ${desc}`);
- });
-
- wrapper.appendChild(undoBtn);
- wrapper.appendChild(redoBtn);
- container.appendChild(wrapper);
-
- return {
- dispose() { wrapper.remove(); },
- update() {
- const store = getEditorStore();
- const undoDesc = store.undoDescription;
- const redoDesc = store.redoDescription;
- undoBtn.title = undoDesc ? `Undo: ${undoDesc}` : 'Undo';
- redoBtn.title = redoDesc ? `Redo: ${redoDesc}` : 'Redo';
- undoBtn.disabled = !store.canUndo;
- redoBtn.disabled = !store.canRedo;
- },
- };
- },
- });
-
- registerStatusbarItem({
- id: 'notifications',
+ id: 'settings',
position: 'right',
order: 10,
render: (container) => {
- const wrapper = document.createElement('div');
- wrapper.className = 'es-statusbar-icons';
-
- const notifBtn = document.createElement('button');
- notifBtn.title = 'Notifications';
- notifBtn.innerHTML = icons.list(12);
- notifBtn.addEventListener('click', () => getNavigationService().showPanel('output'));
-
- const settingsBtn = document.createElement('button');
- settingsBtn.title = 'Settings';
- settingsBtn.innerHTML = icons.settings(12);
- settingsBtn.addEventListener('click', () => getProjectService().showSettings());
-
- wrapper.appendChild(notifBtn);
- wrapper.appendChild(settingsBtn);
- container.appendChild(wrapper);
-
- return { dispose() { wrapper.remove(); } };
+ const btn = document.createElement('button');
+ btn.className = 'es-statusbar-btn';
+ btn.title = 'Settings';
+ btn.innerHTML = icons.settings(12);
+ btn.addEventListener('click', () => getProjectService().showSettings());
+ container.appendChild(btn);
+ return { dispose() { btn.remove(); } };
},
});
@@ -170,30 +172,19 @@ export function registerBuiltinStatusbarItems(registrar: PluginRegistrar): void
position: 'right',
order: 100,
render: (container) => {
- container.innerHTML = `
- <span class="es-status-indicator es-status-saved">
- ${icons.check(12)}
- <span>All Saved</span>
- </span>
- <span class="es-status-indicator es-status-unsaved" style="display: none;">
- <span class="es-unsaved-dot"></span>
- <span>Unsaved Changes</span>
- </span>
- `;
+ const indicator = document.createElement('span');
+ indicator.className = 'es-status-indicator es-status-saved';
+ indicator.innerHTML = icons.check(12);
+ indicator.title = 'All saved';
+ container.appendChild(indicator);
return {
- dispose() { container.innerHTML = ''; },
+ dispose() { indicator.remove(); },
update() {
- const store = getEditorStore();
- const saved = container.querySelector('.es-status-saved') as HTMLElement;
- const unsaved = container.querySelector('.es-status-unsaved') as HTMLElement;
- if (store.isDirty) {
- if (saved) saved.style.display = 'none';
- if (unsaved) unsaved.style.display = '';
- } else {
- if (saved) saved.style.display = '';
- if (unsaved) unsaved.style.display = 'none';
- }
+ const dirty = getEditorStore().isDirty;
+ indicator.className = `es-status-indicator ${dirty ? 'es-status-unsaved' : 'es-status-saved'}`;
+ indicator.innerHTML = dirty ? '<span class="es-unsaved-dot"></span>' : icons.check(12);
+ indicator.title = dirty ? 'Unsaved changes' : 'All saved';
},
};
},
diff --git a/editor/src/panels/InspectorPanel.ts b/editor/src/panels/InspectorPanel.ts
index 2c8f581c3..00db04756 100644
--- a/editor/src/panels/InspectorPanel.ts
+++ b/editor/src/panels/InspectorPanel.ts
@@ -8,7 +8,6 @@ import type { EditorStore, AssetSelection, DirtyFlag } from '../store/EditorStor
import { getDefaultComponentData } from '../schemas/ComponentSchemas';
import { icons } from '../utils/icons';
import type { EditorInfo } from './inspector/InspectorHelpers';
-import { getAssetTypeDisplayName } from '../asset/AssetTypeRegistry';
import { renderEntityHeader, renderComponent, renderAddComponentButton, renderEntityExtensionSections, renderAssetExtensionSections } from './inspector/EntityInspector';
import type { InspectorSectionInstance } from './inspector/InspectorRegistry';
import { type MaterialPreviewState, renderMaterialPreview, hideMaterialPreview } from './inspector/MaterialPreviewSection';
@@ -37,7 +36,6 @@ export class InspectorPanel {
private currentComponentOrder_: string = '';
private imageUrlRef_: ImageUrlRef = { current: null };
- private footerContainer_: HTMLElement | null = null;
private lockBtn_: HTMLElement | null = null;
private locked_: boolean = false;
private materialPreviewState_: MaterialPreviewState;
@@ -59,7 +57,6 @@ export class InspectorPanel {
</div>
<div class="es-inspector-content"></div>
<div class="es-material-preview-panel es-expanded"></div>
- <div class="es-inspector-footer">No selection</div>
`;
this.contentContainer_ = this.container_.querySelector('.es-inspector-content')!;
@@ -67,7 +64,6 @@ export class InspectorPanel {
container: this.container_.querySelector('.es-material-preview-panel')!,
expanded: true,
};
- this.footerContainer_ = this.container_.querySelector('.es-inspector-footer');
this.lockBtn_ = this.container_.querySelector('.es-lock-btn');
this.setupLockButton();
@@ -206,7 +202,6 @@ export class InspectorPanel {
this.cleanupImageUrl();
this.contentContainer_.innerHTML = '<div class="es-inspector-empty">No selection</div>';
hideMaterialPreview(this.materialPreviewState_);
- this.updateFooter('No selection');
}
// =========================================================================
@@ -229,7 +224,6 @@ export class InspectorPanel {
if (!entityData) {
this.contentContainer_.innerHTML = '<div class="es-inspector-empty">Entity not found</div>';
- this.updateFooter('Error');
return;
}
@@ -245,7 +239,6 @@ export class InspectorPanel {
renderAddComponentButton(this.contentContainer_, entity, entityData.components, this.store_);
this.extensionSections_ = renderEntityExtensionSections(this.contentContainer_, entity, this.store_);
renderMaterialPreview(this.materialPreviewState_, entity, entityData.components, this.store_);
- this.updateFooter(`${entityData.components.length} components`);
}
private updateVisibilityIcon(): void {
@@ -291,7 +284,6 @@ export class InspectorPanel {
}
hideMaterialPreview(this.materialPreviewState_);
- this.updateFooter(`${entities.length} entities selected`);
}
private getCommonComponents(entities: Entity[]): string[] {
@@ -340,7 +332,6 @@ export class InspectorPanel {
}
this.extensionSections_ = renderAssetExtensionSections(this.contentContainer_, asset.path, asset.type, this.store_);
- this.updateFooter(getAssetTypeDisplayName(asset.type));
}
// =========================================================================
@@ -365,7 +356,6 @@ export class InspectorPanel {
const entityData = proxy.getEntityData(entity as number);
if (!entityData) {
this.contentContainer_.innerHTML = '<div class="es-inspector-empty">Entity not found</div>';
- this.updateFooter('Error');
return;
}
@@ -388,7 +378,6 @@ export class InspectorPanel {
}
renderAddComponentButton(this.contentContainer_, entity, entityData.components, proxy);
- this.updateFooter(`${componentCount} components (Live)`);
}
private updatePlayModeEditors(editorEntityId: number): void {
@@ -423,7 +412,6 @@ export class InspectorPanel {
this.currentAssetPath_ = null;
this.contentContainer_.innerHTML = '<div class="es-inspector-empty">Select an entity</div>';
hideMaterialPreview(this.materialPreviewState_);
- this.updateFooter('Live mode');
}
private startSharedRefreshLoop(entityId: number): void {
@@ -433,7 +421,6 @@ export class InspectorPanel {
const fresh = pms.querySharedEntity(entityId);
if (!fresh) {
this.contentContainer_.innerHTML = '<div class="es-inspector-empty">Entity despawned</div>';
- this.updateFooter('Live mode');
return;
}
if (this.runtimeProxy_) {
@@ -501,12 +488,6 @@ export class InspectorPanel {
// Helpers
// =========================================================================
- private updateFooter(text: string): void {
- if (this.footerContainer_) {
- this.footerContainer_.textContent = text;
- }
- }
-
private cleanupImageUrl(): void {
if (this.imageUrlRef_.current) {
URL.revokeObjectURL(this.imageUrlRef_.current);
diff --git a/editor/src/panels/content-browser/ContentBrowserPanel.ts b/editor/src/panels/content-browser/ContentBrowserPanel.ts
index cb7cb267e..866377466 100644
--- a/editor/src/panels/content-browser/ContentBrowserPanel.ts
+++ b/editor/src/panels/content-browser/ContentBrowserPanel.ts
@@ -6,6 +6,7 @@ import type { ContentBrowserState, ContentBrowserOptions, FolderNode, AssetItem,
import { getNativeFS, getNativeShell, VIEW_MODE_KEY, SEARCH_RESULTS_LIMIT } from './ContentBrowserTypes';
import { ThumbnailCache } from './ThumbnailCache';
import { loadFolderChildren, toggleFolder, expandFolder, selectFolder, findFolder, collectExpandedPaths, renderFolderNode } from './FolderTree';
+import { showContextMenu } from '../../ui/ContextMenu';
import { renderGrid } from './AssetGrid';
import {
showAssetContextMenu, showMultiSelectContextMenu, showFolderContextMenu,
@@ -42,6 +43,7 @@ export class ContentBrowserPanel implements ContentBrowserState {
private refreshPending_ = false;
private thumbnailCache_ = new ThumbnailCache();
private disposeNavReg_: (() => void) | null = null;
+ private treeVisible_ = localStorage.getItem('esengine.cb.treeVisible') !== 'false';
constructor(container: HTMLElement, store: EditorStore, options?: ContentBrowserOptions) {
this.container = container;
@@ -58,31 +60,33 @@ export class ContentBrowserPanel implements ContentBrowserState {
this.container.classList.add('es-content-browser');
this.container.innerHTML = `
<div class="es-content-browser-header">
- <div class="es-content-browser-actions">
- <button class="es-btn es-btn-icon es-refresh-btn" title="Refresh">${icons.refresh(12)}</button>
- </div>
+ <button class="es-btn es-btn-icon es-cb-tree-toggle${this.treeVisible_ ? ' es-active' : ''}" title="Toggle folder tree">${icons.panelLeft(14)}</button>
+ <button class="es-btn es-btn-icon es-cb-up-btn" title="Parent folder">${icons.arrowUp(14)}</button>
+ <div class="es-content-breadcrumb"></div>
+ </div>
+ <div class="es-content-browser-toolbar">
+ <input type="text" class="es-input es-content-search" placeholder="Search...">
+ <button class="es-btn es-btn-icon es-refresh-btn" title="Refresh">${icons.refresh(12)}</button>
+ <button class="es-btn es-btn-icon es-cb-view-toggle" title="Toggle view"></button>
</div>
<div class="es-content-browser-body">
<div class="es-content-browser-tree"></div>
<div class="es-content-browser-main">
- <div class="es-content-browser-toolbar">
- <button class="es-btn es-btn-icon es-cb-up-btn" title="Parent folder">${icons.arrowUp(14)}</button>
- <div class="es-content-breadcrumb"></div>
- <input type="text" class="es-input es-content-search" placeholder="Search assets...">
- <button class="es-btn es-btn-icon es-cb-view-toggle" title="Toggle view"></button>
- </div>
<div class="es-content-browser-grid" tabindex="0" role="grid"></div>
</div>
</div>
- <div class="es-content-browser-footer">0 items</div>
`;
this.treeContainer = this.container.querySelector('.es-content-browser-tree');
this.gridContainer = this.container.querySelector('.es-content-browser-grid');
- this.footerContainer = this.container.querySelector('.es-content-browser-footer');
+ this.footerContainer = null;
this.searchInput = this.container.querySelector('.es-content-search');
this.breadcrumbContainer = this.container.querySelector('.es-content-breadcrumb');
+ if (!this.treeVisible_) {
+ this.container.querySelector('.es-content-browser-body')?.classList.add('es-cb-tree-hidden');
+ }
+
this.updateViewToggleButton();
this.setupEvents();
this.initialize();
@@ -176,7 +180,7 @@ export class ContentBrowserPanel implements ContentBrowserState {
this.breadcrumbContainer.innerHTML = crumbs
.map((crumb, index) => {
const isLast = index === crumbs.length - 1;
- const separator = isLast ? '' : `<span class="es-breadcrumb-separator">${icons.chevronRight(10)}</span>`;
+ const separator = isLast ? '' : `<span class="es-breadcrumb-separator" data-parent-path="${crumb.path}">${icons.chevronRight(10)}</span>`;
return `<span class="es-breadcrumb-item${isLast ? ' es-active' : ''}" data-path="${crumb.path}">${crumb.name}</span>${separator}`;
})
.join('');
@@ -304,6 +308,16 @@ export class ContentBrowserPanel implements ContentBrowserState {
if (this.breadcrumbContainer) {
this.disposables_.addListener(this.breadcrumbContainer, 'click', (e) => {
const target = (e as MouseEvent).target as HTMLElement;
+
+ const sep = target.closest('.es-breadcrumb-separator') as HTMLElement;
+ if (sep) {
+ const parentPath = sep.dataset.parentPath;
+ if (parentPath) {
+ this.showBreadcrumbDropdown_(sep, parentPath);
+ }
+ return;
+ }
+
const item = target.closest('.es-breadcrumb-item') as HTMLElement;
if (!item) return;
const path = item.dataset.path;
@@ -313,6 +327,16 @@ export class ContentBrowserPanel implements ContentBrowserState {
});
}
+ const treeToggle = this.container.querySelector('.es-cb-tree-toggle');
+ if (treeToggle) {
+ this.disposables_.addListener(treeToggle, 'click', () => {
+ this.treeVisible_ = !this.treeVisible_;
+ localStorage.setItem('esengine.cb.treeVisible', String(this.treeVisible_));
+ this.container.querySelector('.es-content-browser-body')?.classList.toggle('es-cb-tree-hidden', !this.treeVisible_);
+ treeToggle.classList.toggle('es-active', this.treeVisible_);
+ });
+ }
+
const upBtn = this.container.querySelector('.es-cb-up-btn');
if (upBtn) {
this.disposables_.addListener(upBtn, 'click', () => {
@@ -516,6 +540,26 @@ export class ContentBrowserPanel implements ContentBrowserState {
}
}
+ private async showBreadcrumbDropdown_(anchor: HTMLElement, parentPath: string): Promise<void> {
+ const folder = findFolder(this.rootFolder, parentPath);
+ if (!folder) return;
+ if (!folder.loaded) {
+ await loadFolderChildren(folder);
+ }
+ if (folder.children.length === 0) return;
+
+ const rect = anchor.getBoundingClientRect();
+ showContextMenu({
+ x: rect.left,
+ y: rect.bottom + 4,
+ items: folder.children.map(child => ({
+ label: child.name,
+ icon: icons.folder(12),
+ onClick: () => selectFolder(this, child.path),
+ })),
+ });
+ }
+
private navigateToParent(): void {
if (!this.rootFolder) return;
if (this.currentPath === this.rootFolder.path) return;
diff --git a/editor/src/panels/game-view/GameViewToolbar.ts b/editor/src/panels/game-view/GameViewToolbar.ts
index ea6380a4b..e80c47424 100644
--- a/editor/src/panels/game-view/GameViewToolbar.ts
+++ b/editor/src/panels/game-view/GameViewToolbar.ts
@@ -63,11 +63,11 @@ export class GameViewToolbar {
return `
<div class="es-gameview-toolbar">
<div class="es-gameview-controls">
- <button class="es-btn es-btn-icon es-gameview-play" title="Play">${icons.play(14)}</button>
- <button class="es-btn es-btn-icon es-gameview-pause" title="Pause" disabled>${icons.pause(14)}</button>
- <button class="es-btn es-btn-icon es-gameview-resume" title="Resume" style="display:none">${icons.play(14)}</button>
- <button class="es-btn es-btn-icon es-gameview-step" title="Step Frame" disabled>${icons.stepForward(14)}</button>
- <button class="es-btn es-btn-icon es-gameview-stop" title="Stop" disabled>${icons.stop(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-play" data-tooltip="Play">${icons.play(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-pause" data-tooltip="Pause" disabled>${icons.pause(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-resume" data-tooltip="Resume" style="display:none">${icons.play(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-step" data-tooltip="Step Frame" disabled>${icons.stepForward(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-stop" data-tooltip="Stop" disabled>${icons.stop(14)}</button>
</div>
<div class="es-toolbar-divider"></div>
<select class="es-gameview-speed" title="Play Speed">
@@ -77,8 +77,8 @@ export class GameViewToolbar {
<option value="2">2x</option>
<option value="4">4x</option>
</select>
- <button class="es-btn es-btn-icon es-gameview-mute" title="Mute Audio">${icons.volume(14)}</button>
- <button class="es-btn es-btn-icon es-gameview-physics-debug" title="Physics Debug Draw">${icons.bug(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-mute" data-tooltip="Mute Audio">${icons.volume(14)}</button>
+ <button class="es-btn es-btn-icon es-gameview-physics-debug" data-tooltip="Physics Debug Draw">${icons.bug(14)}</button>
<div class="es-toolbar-divider"></div>
<select class="es-gameview-resolution">${options}<option value="custom">Custom</option></select>
<div class="es-gameview-custom-size" style="display:none">
diff --git a/editor/src/panels/hierarchy/HierarchyKeyboard.ts b/editor/src/panels/hierarchy/HierarchyKeyboard.ts
index fc3350db2..2f6b26e70 100644
--- a/editor/src/panels/hierarchy/HierarchyKeyboard.ts
+++ b/editor/src/panels/hierarchy/HierarchyKeyboard.ts
@@ -41,6 +41,25 @@ export function setupKeyboard(state: HierarchyState, scrollToEntity: (id: number
return;
}
+ if ((e.key === ']' || e.key === '[') && (e.ctrlKey || e.metaKey)) {
+ e.preventDefault();
+ const sel = state.store.selectedEntity;
+ if (sel === null) return;
+ const entityData = state.store.getEntityData(sel as number);
+ if (!entityData) return;
+ const parent = entityData.parent;
+ const parentData = parent !== null ? state.store.getEntityData(parent) : null;
+ const siblings = parentData
+ ? parentData.children
+ : state.store.scene.entities.filter(ent => ent.parent === null).map(ent => ent.id);
+ const idx = siblings.indexOf(sel as number);
+ if (idx === -1) return;
+ const newIdx = e.key === ']' ? idx + 1 : idx - 1;
+ if (newIdx < 0 || newIdx >= siblings.length) return;
+ state.store.moveEntity(sel, parent as Entity | null, newIdx);
+ return;
+ }
+
const selected = state.store.selectedEntity;
const selectedIndex = selected !== null
? state.flatRows.findIndex(r => r.entity.id === (selected as number))
diff --git a/editor/src/panels/hierarchy/HierarchyPanel.ts b/editor/src/panels/hierarchy/HierarchyPanel.ts
index eb5ebcd2d..9b0ae4d77 100644
--- a/editor/src/panels/hierarchy/HierarchyPanel.ts
+++ b/editor/src/panels/hierarchy/HierarchyPanel.ts
@@ -6,7 +6,7 @@ import { escapeHtml } from '../../utils/html';
import { getInitialComponentData } from '../../schemas/ComponentSchemas';
import type { HierarchyState, FlattenedRow } from './HierarchyTypes';
import { ROW_HEIGHT, OVERSCAN, SLOW_DOUBLE_CLICK_MIN, SLOW_DOUBLE_CLICK_MAX } from './HierarchyTypes';
-import { buildFlatRows, expandAncestors, renderSingleRow, getEntityTypeCategory } from './HierarchyTree';
+import { buildFlatRows, expandAncestors, renderSingleRow } from './HierarchyTree';
import { performSearch, selectNextResult, selectPreviousResult, focusSelectedResult, clearSearch } from './HierarchySearch';
import { setupKeyboard, selectRange } from './HierarchyKeyboard';
import { setupDragAndDrop } from './HierarchyDragDrop';
@@ -21,7 +21,6 @@ export class HierarchyPanel implements HierarchyState {
store: EditorStore;
treeContainer: HTMLElement;
searchInput: HTMLInputElement | null = null;
- private footerContainer_: HTMLElement | null = null;
private prefabEditBar_: HTMLElement | null = null;
searchFilter: string = '';
searchResults: HierarchyState['searchResults'] = [];
@@ -68,7 +67,6 @@ export class HierarchyPanel implements HierarchyState {
<span class="es-hierarchy-col-type">Type</span>
</div>
<div class="es-hierarchy-tree" role="tree"></div>
- <div class="es-hierarchy-footer">0 entities</div>
`;
this.treeContainer = this.container_.querySelector('.es-hierarchy-tree')!;
@@ -81,7 +79,6 @@ export class HierarchyPanel implements HierarchyState {
this.treeContainer.appendChild(this.scrollContent);
this.disposables_.addListener(this.treeContainer, 'scroll', () => this.onScroll());
this.searchInput = this.container_.querySelector('.es-hierarchy-search');
- this.footerContainer_ = this.container_.querySelector('.es-hierarchy-footer');
this.prefabEditBar_ = this.container_.querySelector('.es-prefab-edit-bar');
const backBtn = this.container_.querySelector('.es-prefab-back-btn');
@@ -178,7 +175,6 @@ export class HierarchyPanel implements HierarchyState {
}
}
this.renderVisibleRows();
- this.updateFooter();
if (dirtyFlags?.has('selection')) {
const sel = this.store.selectedEntity;
if (sel !== null) {
@@ -271,10 +267,13 @@ export class HierarchyPanel implements HierarchyState {
const item = row?.parentElement as HTMLElement;
const entityId = parseInt(item?.dataset.entityId ?? '', 10);
if (!isNaN(entityId)) {
- if (this.expandedIds.has(entityId)) {
- this.expandedIds.delete(entityId);
- } else {
+ const shouldExpand = !this.expandedIds.has(entityId);
+ if (e.altKey) {
+ this.setExpandedRecursive_(entityId as Entity, shouldExpand);
+ } else if (shouldExpand) {
this.expandedIds.add(entityId);
+ } else {
+ this.expandedIds.delete(entityId);
}
this.render();
}
@@ -503,52 +502,11 @@ export class HierarchyPanel implements HierarchyState {
this.lastVisibleEnd_ = -1;
this.renderVisibleRows();
- this.updateFooter();
-
if (selectionChanged) {
this.scrollToEntity(selectedEntity as number);
}
}
- private updateFooter(): void {
- if (!this.footerContainer_) return;
-
- if (this.playMode) {
- const count = this.runtimeEntities?.length ?? 0;
- this.footerContainer_.textContent = `${count} entities (Live)`;
- return;
- }
-
- if (this.searchFilter) {
- const count = this.searchResults.length;
- this.footerContainer_.textContent = `${count} ${count === 1 ? 'match' : 'matches'}`;
- return;
- }
-
- const entities = this.store.scene.entities;
- const count = entities.length;
- const selectedCount = this.store.selectedEntities.size;
-
- if (selectedCount > 1) {
- this.footerContainer_.textContent = `${count} entities · ${selectedCount} selected`;
- return;
- }
-
- const typeCounts = new Map<string, number>();
- for (const entity of entities) {
- const cat = getEntityTypeCategory(entity);
- if (cat !== 'default') {
- typeCounts.set(cat, (typeCounts.get(cat) ?? 0) + 1);
- }
- }
-
- let text = `${count} ${count === 1 ? 'entity' : 'entities'}`;
- for (const [cat, n] of typeCounts) {
- text += ` · ${n} ${cat.charAt(0).toUpperCase() + cat.slice(1)}`;
- }
- this.footerContainer_.textContent = text;
- }
-
renderVisibleRows(): void {
const { start, end } = this.getVisibleRange();
const selectedEntity = this.store.selectedEntity;
@@ -599,6 +557,20 @@ export class HierarchyPanel implements HierarchyState {
}
}
+ private setExpandedRecursive_(entityId: Entity, expand: boolean): void {
+ if (expand) {
+ this.expandedIds.add(entityId);
+ } else {
+ this.expandedIds.delete(entityId);
+ }
+ const data = this.store.getEntityData(entityId);
+ if (data?.children) {
+ for (const childId of data.children) {
+ this.setExpandedRecursive_(childId as Entity, expand);
+ }
+ }
+ }
+
private onScroll(): void {
if (this.scrollRafId_) return;
this.scrollRafId_ = requestAnimationFrame(() => {
diff --git a/editor/src/panels/inspector/EntityInspector.ts b/editor/src/panels/inspector/EntityInspector.ts
index bf7dc38c8..e436e951b 100644
--- a/editor/src/panels/inspector/EntityInspector.ts
+++ b/editor/src/panels/inspector/EntityInspector.ts
@@ -28,6 +28,23 @@ import {
} from './InspectorHelpers';
import { showContextMenu, type ContextMenuItem } from '../../ui/ContextMenu';
import { isPropertyOverridden, hasAnyOverrides } from '../../prefab';
+
+const COLLAPSED_STORAGE_KEY = 'inspector-collapsed';
+
+function loadCollapsedSet(): Set<string> {
+ try {
+ const raw = localStorage.getItem(COLLAPSED_STORAGE_KEY);
+ return raw ? new Set(JSON.parse(raw)) : new Set();
+ } catch {
+ return new Set();
+ }
+}
+
+function saveCollapsedSet(set: Set<string>): void {
+ localStorage.setItem(COLLAPSED_STORAGE_KEY, JSON.stringify([...set]));
+}
+
+const collapsedComponents = loadCollapsedSet();
import {
getComponentInspector,
getInspectorSections,
@@ -195,7 +212,8 @@ export function renderComponent(
const displayTitle = schema?.displayName ?? component.type;
const section = document.createElement('div');
- section.className = 'es-component-section es-collapsible es-expanded';
+ const isCollapsed = collapsedComponents.has(component.type);
+ section.className = `es-component-section es-collapsible${isCollapsed ? '' : ' es-expanded'}`;
const icon = getComponentIcon(component.type);
const removable = isComponentRemovable(component.type);
@@ -239,6 +257,12 @@ export function renderComponent(
if ((e.target as HTMLElement).closest('.es-btn-remove')) return;
if ((e.target as HTMLElement).closest('.es-component-enabled-toggle')) return;
section.classList.toggle('es-expanded');
+ if (section.classList.contains('es-expanded')) {
+ collapsedComponents.delete(component.type);
+ } else {
+ collapsedComponents.add(component.type);
+ }
+ saveCollapsedSet(collapsedComponents);
});
header.addEventListener('contextmenu', (e) => {
diff --git a/editor/src/panels/scene-view/GizmoToolbar.ts b/editor/src/panels/scene-view/GizmoToolbar.ts
index 226ba85f7..8eb2f3498 100644
--- a/editor/src/panels/scene-view/GizmoToolbar.ts
+++ b/editor/src/panels/scene-view/GizmoToolbar.ts
@@ -21,14 +21,14 @@ export class GizmoToolbar {
return gizmos.map(g => {
const isActive = g.id === this.gizmoManager_.getActiveId();
const shortcutLabel = g.shortcut ? ` (${g.shortcut.toUpperCase()})` : '';
- return `<button class="es-btn es-btn-icon es-gizmo-btn${isActive ? ' es-active' : ''}" data-mode="${g.id}" title="${g.name}${shortcutLabel}">${g.icon}</button>`;
+ return `<button class="es-btn es-btn-icon es-gizmo-btn${isActive ? ' es-active' : ''}" data-mode="${g.id}" data-tooltip="${g.name}${shortcutLabel}">${g.icon}</button>`;
}).join('');
}
buildSettingsHTML(): string {
return `
<div class="es-gizmo-settings-wrapper">
- <button class="es-btn es-btn-icon" data-action="gizmo-settings" title="Gizmo Settings">${icons.settings(14)}</button>
+ <button class="es-btn es-btn-icon" data-action="gizmo-settings" data-tooltip="Gizmo Settings">${icons.settings(14)}</button>
<div class="es-gizmo-settings-dropdown" style="display: none;">
<div class="es-settings-row">
<label class="es-settings-checkbox">
diff --git a/editor/src/property/editorUtils.ts b/editor/src/property/editorUtils.ts
index ded31819a..aebfb5484 100644
--- a/editor/src/property/editorUtils.ts
+++ b/editor/src/property/editorUtils.ts
@@ -12,7 +12,8 @@ export function setupDragLabel(
const onMouseMove = (e: MouseEvent) => {
if (!isDragging) return;
- const delta = (e.clientX - startX) * step;
+ const modifier = e.shiftKey ? 0.1 : e.altKey ? 10 : 1;
+ const delta = (e.clientX - startX) * step * modifier;
let newValue = startValue + delta;
if (min !== undefined && newValue < min) newValue = min;
if (max !== undefined && newValue > max) newValue = max;
diff --git a/editor/src/services/NavigationService.ts b/editor/src/services/NavigationService.ts
index d6ddbf638..95281bfd4 100644
--- a/editor/src/services/NavigationService.ts
+++ b/editor/src/services/NavigationService.ts
@@ -1,18 +1,32 @@
import type { PanelManager } from '../PanelManager';
import type { DockLayoutManager } from '../DockLayoutManager';
-import type { ContentDrawer } from '../ui/ContentDrawer';
import type { EditorAssetServer } from '../asset/EditorAssetServer';
+import { getPanel, getPanelsByPosition, type PanelPosition } from '../panels/PanelRegistry';
+import type { RegionId } from '../dock/DockRegion';
export type NavigateToAssetHandler = (path: string) => Promise<void>;
export type AssetServerProvider = () => EditorAssetServer | null;
+type CollapsibleRegion = 'left' | 'right' | 'bottom';
+
+const POSITION_TO_REGION: Record<PanelPosition, CollapsibleRegion | null> = {
+ left: 'left',
+ right: 'right',
+ bottom: 'bottom',
+ center: null,
+};
+
+const SIDEBAR_REGIONS: CollapsibleRegion[] = ['left', 'right'];
+
export class NavigationService {
private panelManager_: PanelManager;
private dockLayout_: DockLayoutManager | null = null;
- private contentDrawer_: ContentDrawer | null = null;
private navigateHandler_: NavigateToAssetHandler | null = null;
private assetServerProvider_: AssetServerProvider | null = null;
+ private lastActiveBottom_: string | null = null;
+ private panelToggleListeners_: Array<() => void> = [];
+
constructor(panelManager: PanelManager) {
this.panelManager_ = panelManager;
}
@@ -21,10 +35,6 @@ export class NavigationService {
this.dockLayout_ = dockLayout;
}
- setContentDrawer(contentDrawer: ContentDrawer | null): void {
- this.contentDrawer_ = contentDrawer;
- }
-
registerNavigateToAsset(handler: NavigateToAssetHandler): () => void {
this.navigateHandler_ = handler;
return () => { this.navigateHandler_ = null; };
@@ -35,13 +45,23 @@ export class NavigationService {
return () => { this.assetServerProvider_ = null; };
}
+ // =========================================================================
+ // Panel visibility (Godot-style toggle)
+ // =========================================================================
+
showPanel(id: string): void {
- if (id === 'content-browser') {
- this.contentDrawer_?.toggle();
+ const region = this.getRegion_(id);
+ if (!region) {
+ this.dockLayout_?.showPanel(id);
return;
}
- this.dockLayout_?.showPanel(id);
- this.panelManager_.showPanel(id);
+
+ if (region === 'bottom') {
+ this.expandBottomRegion_(id);
+ } else {
+ this.expandRegion_(region);
+ this.dockLayout_?.dock?.activatePanel(id);
+ }
}
hidePanel(id: string): void {
@@ -49,24 +69,78 @@ export class NavigationService {
}
togglePanel(id: string): void {
- if (id === 'content-browser') {
- this.contentDrawer_?.toggle();
+ const region = this.getRegion_(id);
+ if (!region) {
+ this.dockLayout_?.showPanel(id);
return;
}
- const panel = this.dockLayout_?.api?.getPanel(id);
- if (panel) {
- this.dockLayout_!.removePanel(id);
- this.panelManager_.removePanelInstance(id);
+
+ if (region === 'bottom') {
+ this.toggleBottomPanel_(id);
+ } else {
+ this.toggleSidePanel_(id, region);
+ }
+ }
+
+ toggleRegion(region: CollapsibleRegion): void {
+ if (region === 'bottom') {
+ this.toggleBottomRegion_();
} else {
- this.showPanel(id);
+ if (this.dockLayout_?.isRegionCollapsed(region)) {
+ this.expandRegion_(region);
+ } else {
+ this.collapseRegion_(region);
+ }
}
}
+ toggleAllSidebars(): void {
+ const anyVisible = SIDEBAR_REGIONS.some(r => !this.dockLayout_?.isRegionCollapsed(r));
+
+ for (const r of SIDEBAR_REGIONS) {
+ if (anyVisible) {
+ if (!this.dockLayout_?.isRegionCollapsed(r)) this.collapseRegion_(r);
+ } else {
+ if (this.dockLayout_?.isRegionCollapsed(r)) this.expandRegion_(r);
+ }
+ }
+ }
+
+ isCollapsed(id: string): boolean {
+ if (!this.dockLayout_) return false;
+ const actualRegion = this.dockLayout_.findPanelRegion(id);
+ if (actualRegion) return this.dockLayout_.isRegionCollapsed(actualRegion);
+
+ const region = this.getRegion_(id);
+ return region ? this.dockLayout_.isRegionCollapsed(region) : false;
+ }
+
+ isRegionCollapsed(region: CollapsibleRegion): boolean {
+ return this.dockLayout_?.isRegionCollapsed(region) ?? false;
+ }
+
+ isBottomCollapsed(): boolean {
+ return this.isRegionCollapsed('bottom');
+ }
+
resetLayout(): void {
- this.contentDrawer_?.onResetLayout();
+ this.lastActiveBottom_ = null;
this.dockLayout_?.resetLayout();
+ this.notifyToggleListeners_();
+ }
+
+ onPanelToggle(listener: () => void): () => void {
+ this.panelToggleListeners_.push(listener);
+ return () => {
+ const idx = this.panelToggleListeners_.indexOf(listener);
+ if (idx >= 0) this.panelToggleListeners_.splice(idx, 1);
+ };
}
+ // =========================================================================
+ // Navigation
+ // =========================================================================
+
async navigateToAsset(assetPath: string): Promise<void> {
await this.navigateHandler_?.(assetPath);
}
@@ -74,4 +148,102 @@ export class NavigationService {
getAssetServer(): EditorAssetServer | null {
return this.assetServerProvider_?.() ?? null;
}
+
+ // =========================================================================
+ // Private: side panels (left / right)
+ // =========================================================================
+
+ private toggleSidePanel_(id: string, region: CollapsibleRegion): void {
+ if (!this.dockLayout_) return;
+
+ if (this.dockLayout_.isRegionCollapsed(region)) {
+ this.expandRegion_(region);
+ this.ensureAndActivate_(id);
+ } else if (this.dockLayout_.isPanelActive(id)) {
+ this.collapseRegion_(region);
+ } else {
+ this.ensureAndActivate_(id);
+ }
+ this.notifyToggleListeners_();
+ }
+
+ private collapseRegion_(region: CollapsibleRegion): void {
+ this.dockLayout_?.collapseRegion(region);
+ this.notifyToggleListeners_();
+ }
+
+ private expandRegion_(region: CollapsibleRegion): void {
+ this.dockLayout_?.expandRegion(region);
+ this.notifyToggleListeners_();
+ }
+
+ // =========================================================================
+ // Private: bottom region
+ // =========================================================================
+
+ private toggleBottomPanel_(id: string): void {
+ if (!this.dockLayout_) return;
+
+ if (this.dockLayout_.isRegionCollapsed('bottom')) {
+ this.expandBottomRegion_(id);
+ return;
+ }
+
+ if (this.dockLayout_.isPanelActive(id)) {
+ this.lastActiveBottom_ = id;
+ this.collapseRegion_('bottom');
+ } else {
+ this.ensureAndActivate_(id);
+ this.lastActiveBottom_ = id;
+ this.notifyToggleListeners_();
+ }
+ }
+
+ private toggleBottomRegion_(): void {
+ if (this.dockLayout_?.isRegionCollapsed('bottom')) {
+ const restoreId = this.lastActiveBottom_ ?? 'content-browser';
+ this.expandBottomRegion_(restoreId);
+ } else {
+ const activeId = this.dockLayout_?.dock?.bottomRegion.activeId;
+ if (activeId) this.lastActiveBottom_ = activeId;
+ this.collapseRegion_('bottom');
+ }
+ }
+
+ private expandBottomRegion_(activeId: string): void {
+ if (!this.dockLayout_) return;
+
+ this.expandRegion_('bottom');
+ this.ensureAndActivate_(activeId);
+ this.lastActiveBottom_ = activeId;
+ this.notifyToggleListeners_();
+ }
+
+ // =========================================================================
+ // Private: utils
+ // =========================================================================
+
+ private getRegion_(panelId: string): CollapsibleRegion | null {
+ const actualRegion = this.dockLayout_?.findPanelRegion(panelId);
+ if (actualRegion && actualRegion !== 'center') return actualRegion as CollapsibleRegion;
+
+ const desc = getPanel(panelId);
+ if (!desc) return null;
+ return POSITION_TO_REGION[desc.position];
+ }
+
+ private ensureAndActivate_(id: string): void {
+ if (!this.dockLayout_) return;
+ if (this.dockLayout_.findPanelRegion(id)) {
+ this.dockLayout_.dock?.activatePanel(id);
+ } else {
+ this.dockLayout_.showPanel(id);
+ }
+ }
+
+ private notifyToggleListeners_(): void {
+ for (const fn of this.panelToggleListeners_) {
+ fn();
+ }
+ }
}
diff --git a/editor/src/store/EditorStore.ts b/editor/src/store/EditorStore.ts
index 6d7e2a385..0b441882f 100644
--- a/editor/src/store/EditorStore.ts
+++ b/editor/src/store/EditorStore.ts
@@ -10,6 +10,7 @@ import { PrefabEditService } from './PrefabEditService';
import { PropertyWritePipeline } from './PropertyWritePipeline';
import { registerBuiltinTransformHooks } from './propertyHooks';
import { getPrefabDependencyTracker } from '../prefab';
+import { showToast } from '../ui/Toast';
// =============================================================================
// Types
@@ -539,6 +540,9 @@ export class EditorStore {
if (this.history_.undo()) {
this.applyCommandSideEffects(cmd, true);
cmd.emitChangeEvents(this, true);
+ if (cmd.description) {
+ showToast({ type: 'info', title: `Undo: ${cmd.description}`, duration: 1500 });
+ }
}
}
@@ -548,6 +552,9 @@ export class EditorStore {
if (this.history_.redo()) {
this.applyCommandSideEffects(cmd, false);
cmd.emitChangeEvents(this, false);
+ if (cmd.description) {
+ showToast({ type: 'info', title: `Redo: ${cmd.description}`, duration: 1500 });
+ }
}
}
diff --git a/editor/src/styles/base.css b/editor/src/styles/base.css
index 3ebdef78b..60caa926f 100644
--- a/editor/src/styles/base.css
+++ b/editor/src/styles/base.css
@@ -219,6 +219,9 @@
}
.es-btn-icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
padding: 2px 6px;
min-width: 20px;
border-radius: var(--es-radius-sm);
diff --git a/editor/src/styles/content-browser.css b/editor/src/styles/content-browser.css
index 32fa03035..ab12325a7 100644
--- a/editor/src/styles/content-browser.css
+++ b/editor/src/styles/content-browser.css
@@ -12,17 +12,12 @@
.es-content-browser-header {
display: flex;
align-items: center;
- justify-content: space-between;
- padding: 6px 12px;
+ gap: 4px;
+ padding: 4px 8px;
background: var(--es-bg-secondary);
border-bottom: 1px solid var(--es-border);
}
-.es-content-browser-actions {
- display: flex;
- gap: 4px;
-}
-
.es-content-browser-body {
display: flex;
flex: 1;
@@ -48,12 +43,17 @@
.es-content-browser-toolbar {
display: flex;
align-items: center;
- gap: 12px;
- padding: 8px;
+ gap: 4px;
+ padding: 4px 8px;
background: var(--es-bg-secondary);
border-bottom: 1px solid var(--es-border);
}
+.es-content-browser-toolbar .es-content-search {
+ flex: 1;
+ min-width: 60px;
+}
+
.es-content-breadcrumb {
display: flex;
align-items: center;
@@ -93,6 +93,14 @@
display: flex;
align-items: center;
flex-shrink: 0;
+ cursor: pointer;
+ padding: 2px;
+ border-radius: 3px;
+}
+
+.es-breadcrumb-separator:hover {
+ color: var(--es-text-primary);
+ background: var(--es-bg-hover);
}
.es-content-search {
@@ -110,14 +118,6 @@
align-content: flex-start;
}
-.es-content-browser-footer {
- padding: 6px 12px;
- font-size: 11px;
- color: var(--es-text-secondary);
- background: var(--es-bg-secondary);
- border-top: 1px solid var(--es-border);
-}
-
/* Folder Tree */
.es-folder-item {
display: flex;
@@ -347,117 +347,13 @@
color: var(--es-text-muted);
}
+/* Tree hidden mode */
+.es-cb-tree-hidden .es-content-browser-tree {
+ display: none;
+}
+
/* Grid focus */
.es-content-browser-grid:focus {
outline: none;
}
-/* =============================================================================
- * Content Drawer
- * ============================================================================= */
-
-.es-content-drawer {
- position: relative;
- height: 0;
- overflow: hidden;
- transition: height 0.2s ease;
- border-top: 1px solid var(--es-border);
- display: flex;
- flex-direction: column;
- flex-shrink: 0;
-}
-
-.es-content-drawer.es-drawer-open {
- height: var(--drawer-height, 300px);
- box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
-}
-
-.es-content-drawer.es-drawer-resizing {
- transition: none;
-}
-
-.es-content-drawer-resize {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 4px;
- cursor: ns-resize;
- z-index: 10;
-}
-
-.es-content-drawer-resize:hover,
-.es-content-drawer-resize:active {
- background: var(--es-accent);
-}
-
-.es-content-drawer-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 28px;
- min-height: 28px;
- padding: 0 8px;
- background: var(--es-bg-tertiary);
- border-bottom: 1px solid var(--es-border);
- user-select: none;
-}
-
-.es-content-drawer-title {
- display: flex;
- align-items: center;
- gap: 6px;
- font-size: 12px;
- color: var(--es-text-primary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.es-content-drawer-title svg {
- stroke: var(--es-text-secondary);
-}
-
-.es-content-drawer-actions {
- display: flex;
- align-items: center;
- gap: 2px;
-}
-
-.es-content-drawer-actions .es-btn-icon {
- width: 22px;
- height: 22px;
- display: flex;
- align-items: center;
- justify-content: center;
- background: transparent;
- border: none;
- border-radius: 3px;
- cursor: pointer;
- padding: 0;
-}
-
-.es-content-drawer-actions .es-btn-icon:hover {
- background: var(--es-bg-hover);
-}
-
-.es-content-drawer-actions .es-btn-icon svg {
- stroke: var(--es-text-secondary);
-}
-
-.es-content-drawer-actions .es-btn-icon:hover svg {
- stroke: var(--es-text-primary);
-}
-
-.es-content-drawer-actions .es-btn-icon.es-active svg {
- stroke: var(--es-accent);
-}
-
-.es-content-drawer-body {
- flex: 1;
- overflow: hidden;
-}
-
-.es-content-drawer-body .es-content-browser-header {
- display: none;
-}
diff --git a/editor/src/styles/dialogs.css b/editor/src/styles/dialogs.css
index 94a37f29b..65d8b81ed 100644
--- a/editor/src/styles/dialogs.css
+++ b/editor/src/styles/dialogs.css
@@ -1431,3 +1431,162 @@
border-color: var(--es-accent);
color: var(--es-accent);
}
+
+/* =============================================================================
+ * Shortcut Help Dialog
+ * ============================================================================= */
+
+.es-shortcut-group {
+ margin-bottom: 16px;
+}
+
+.es-shortcut-group-title {
+ font-size: 11px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ color: var(--es-text-secondary);
+ margin-bottom: 6px;
+ padding-bottom: 4px;
+ border-bottom: 1px solid var(--es-border);
+}
+
+.es-shortcut-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 3px 0;
+ font-size: 12px;
+}
+
+.es-shortcut-label {
+ color: var(--es-text-primary);
+}
+
+.es-shortcut-key {
+ font-family: var(--es-font-mono, monospace);
+ font-size: 11px;
+ padding: 2px 6px;
+ background: var(--es-bg-deep);
+ border: 1px solid var(--es-border);
+ border-radius: 3px;
+ color: var(--es-text-secondary);
+ white-space: nowrap;
+}
+
+/* =============================================================================
+ * Command Palette
+ * ============================================================================= */
+
+.es-command-palette-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.4);
+ display: flex;
+ justify-content: center;
+ padding-top: 15vh;
+ z-index: 5000;
+}
+
+.es-command-palette {
+ width: 500px;
+ max-height: 400px;
+ background: var(--es-bg-elevated);
+ border: 1px solid var(--es-border);
+ border-radius: 8px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ align-self: flex-start;
+}
+
+.es-command-palette-input-row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 10px 12px;
+ border-bottom: 1px solid var(--es-border);
+}
+
+.es-command-palette-icon {
+ flex-shrink: 0;
+ color: var(--es-text-secondary);
+}
+
+.es-command-palette-input {
+ flex: 1;
+ background: none;
+ border: none;
+ outline: none;
+ color: var(--es-text-primary);
+ font-size: 14px;
+ font-family: inherit;
+}
+
+.es-command-palette-input::placeholder {
+ color: var(--es-text-muted);
+}
+
+.es-command-palette-list {
+ overflow-y: auto;
+ padding: 4px 0;
+}
+
+.es-command-palette-item {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 6px 12px;
+ cursor: pointer;
+ transition: background 0.05s;
+}
+
+.es-command-palette-item:hover,
+.es-command-palette-item.es-highlighted {
+ background: var(--es-bg-hover);
+}
+
+.es-command-palette-item-icon {
+ flex-shrink: 0;
+ color: var(--es-text-secondary);
+}
+
+.es-kind-entity .es-command-palette-item-icon {
+ color: var(--es-accent);
+}
+
+.es-kind-asset .es-command-palette-item-icon {
+ color: var(--es-accent-gold);
+}
+
+.es-command-palette-item-label {
+ flex: 1;
+ font-size: 13px;
+ color: var(--es-text-primary);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.es-command-palette-item-label mark {
+ background: none;
+ color: var(--es-accent);
+ font-weight: 600;
+}
+
+.es-command-palette-item-detail {
+ font-size: 11px;
+ color: var(--es-text-muted);
+ flex-shrink: 0;
+}
+
+.es-command-palette-empty {
+ padding: 16px;
+ text-align: center;
+ color: var(--es-text-muted);
+ font-size: 13px;
+}
diff --git a/editor/src/styles/dock.css b/editor/src/styles/dock.css
new file mode 100644
index 000000000..85a2a79f3
--- /dev/null
+++ b/editor/src/styles/dock.css
@@ -0,0 +1,401 @@
+/* =============================================================================
+ * Dock Layout
+ * ============================================================================= */
+
+.es-dock {
+ display: flex;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+}
+
+.es-dock-center-area {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ min-width: 200px;
+ overflow: hidden;
+}
+
+.es-dock-region {
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+}
+
+.es-dock-region.es-dock-center {
+ flex: 1;
+ min-height: 0;
+}
+
+.es-dock-region.es-dock-left,
+.es-dock-region.es-dock-right {
+ overflow: hidden;
+}
+
+.es-dock-region.es-dock-bottom {
+ overflow: hidden;
+ flex-shrink: 0;
+}
+
+.es-dock-region.es-dock-collapsed .es-dock-tabs,
+.es-dock-region.es-dock-collapsed .es-dock-content {
+ display: none;
+}
+
+/* =============================================================================
+ * Tabs
+ * ============================================================================= */
+
+.es-dock-tabs {
+ display: flex;
+ align-items: stretch;
+ height: 28px;
+ min-height: 28px;
+ background: var(--es-bg-secondary);
+ border-bottom: 1px solid var(--es-border);
+ user-select: none;
+ overflow: hidden;
+}
+
+.es-dock-tabs-inner {
+ display: flex;
+ align-items: stretch;
+ flex: 1;
+ height: 100%;
+ overflow-x: auto;
+ overflow-y: hidden;
+ scrollbar-width: none;
+ gap: 0;
+}
+
+.es-dock-tabs-inner::-webkit-scrollbar {
+ display: none;
+}
+
+.es-dock-tab {
+ position: relative;
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ height: 100%;
+ padding: 0 8px 0 10px;
+ font-size: var(--es-font-xs);
+ color: var(--es-text-secondary);
+ white-space: nowrap;
+ cursor: pointer;
+ border-right: 1px solid var(--es-border-subtle);
+ transition: color var(--es-transition-fast), background var(--es-transition-fast);
+ min-width: 0;
+ flex-shrink: 0;
+}
+
+.es-dock-tab::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 2px;
+ background: transparent;
+ transition: background var(--es-transition-fast);
+}
+
+.es-dock-tab:hover {
+ background: var(--es-bg-hover);
+ color: var(--es-text-primary);
+}
+
+.es-dock-tab-active {
+ color: var(--es-text-bright);
+ background: var(--es-bg-primary);
+}
+
+.es-dock-tab-active::after {
+ background: var(--es-accent);
+}
+
+.es-dock-tab-active:hover {
+ color: var(--es-text-bright);
+}
+
+.es-dock-tab-label {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ line-height: 28px;
+}
+
+.es-dock-tab-close {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ width: 16px;
+ height: 16px;
+ border-radius: var(--es-radius-sm);
+ color: var(--es-text-muted);
+ opacity: 0;
+ transition: opacity var(--es-transition-fast), background var(--es-transition-fast), color var(--es-transition-fast);
+}
+
+.es-dock-tab:hover .es-dock-tab-close {
+ opacity: 0.7;
+}
+
+.es-dock-tab-close:hover {
+ opacity: 1 !important;
+ background: hsla(4, 80%, 60%, 0.2);
+ color: var(--es-danger);
+}
+
+.es-dock-content {
+ flex: 1;
+ position: relative;
+ overflow: hidden;
+ background: var(--es-bg-primary);
+}
+
+.es-dock-panel {
+ position: absolute;
+ inset: 0;
+ overflow: hidden;
+}
+
+/* =============================================================================
+ * Tab scroll buttons
+ * ============================================================================= */
+
+.es-dock-tabs-scroll {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 22px;
+ height: 100%;
+ color: var(--es-text-muted);
+ cursor: pointer;
+ flex-shrink: 0;
+ transition: color var(--es-transition-fast), background var(--es-transition-fast);
+}
+
+.es-dock-tabs-scroll:hover {
+ background: var(--es-bg-hover);
+ color: var(--es-text-primary);
+}
+
+.es-dock-tabs-scroll svg {
+ width: 12px;
+ height: 12px;
+}
+
+/* =============================================================================
+ * Splitter
+ * ============================================================================= */
+
+.es-dock-splitter {
+ position: relative;
+ flex-shrink: 0;
+ z-index: 10;
+ transition: background var(--es-transition-fast);
+}
+
+.es-dock-splitter.es-splitter-v {
+ width: 5px;
+ cursor: col-resize;
+ background: transparent;
+ border-left: 1px solid var(--es-border-subtle);
+}
+
+.es-dock-splitter.es-splitter-h {
+ height: 5px;
+ cursor: row-resize;
+ background: transparent;
+ border-top: 1px solid var(--es-border-subtle);
+}
+
+.es-dock-splitter::after {
+ content: '';
+ position: absolute;
+ opacity: 0;
+ transition: opacity var(--es-transition-normal);
+}
+
+.es-dock-splitter.es-splitter-v::after {
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 2px;
+ height: 24px;
+ border-radius: 1px;
+ background: var(--es-text-muted);
+}
+
+.es-dock-splitter.es-splitter-h::after {
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 24px;
+ height: 2px;
+ border-radius: 1px;
+ background: var(--es-text-muted);
+}
+
+.es-dock-splitter:hover::after {
+ opacity: 0.5;
+}
+
+.es-dock-splitter:hover {
+ border-color: var(--es-accent);
+}
+
+.es-dock-splitter:active,
+.es-dock-splitter-active {
+ border-color: var(--es-accent);
+}
+
+.es-dock-splitter:active::after,
+.es-dock-splitter-active::after {
+ opacity: 0.8;
+ background: var(--es-accent);
+}
+
+/* =============================================================================
+ * Drag overlay (prevents iframe from stealing mouse events)
+ * ============================================================================= */
+
+.es-dock-drag-overlay {
+ position: fixed;
+ inset: 0;
+ z-index: 9999;
+ cursor: inherit;
+}
+
+/* =============================================================================
+ * Tab drag & drop
+ * ============================================================================= */
+
+.es-dock-tab-dragging {
+ opacity: 0.25;
+ pointer-events: none;
+}
+
+.es-dock-tab-ghost {
+ position: fixed;
+ z-index: 10000;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 5px 12px;
+ font-size: var(--es-font-xs);
+ color: var(--es-text-bright);
+ background: var(--es-bg-elevated);
+ border: 1px solid var(--es-accent);
+ border-radius: var(--es-radius-md);
+ box-shadow: var(--es-shadow-lg);
+ pointer-events: none;
+ white-space: nowrap;
+ animation: es-ghost-appear 0.12s ease-out;
+}
+
+@keyframes es-ghost-appear {
+ from {
+ opacity: 0;
+ transform: scale(0.92);
+ }
+ to {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+
+.es-dock-drop-indicator {
+ position: fixed;
+ z-index: 10001;
+ width: 2px;
+ background: var(--es-accent);
+ pointer-events: none;
+ border-radius: 1px;
+ box-shadow: 0 0 6px var(--es-accent), 0 0 2px var(--es-accent);
+}
+
+.es-dock-tabs-drop-target {
+ background: var(--es-accent-subtle);
+}
+
+/* =============================================================================
+ * Edge drop overlay (center pane splitting)
+ * ============================================================================= */
+
+.es-dock-edge-overlay {
+ position: fixed;
+ z-index: 10001;
+ background: var(--es-accent-subtle);
+ border: 2px dashed var(--es-accent);
+ pointer-events: none;
+ border-radius: var(--es-radius-sm);
+ animation: es-edge-fade-in 0.15s ease-out;
+}
+
+.es-dock-edge-overlay::after {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 32px;
+ height: 32px;
+ border-radius: var(--es-radius-md);
+ background: var(--es-accent-subtle);
+ border: 2px solid var(--es-accent);
+}
+
+@keyframes es-edge-fade-in {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+/* =============================================================================
+ * Area wrappers & pane groups
+ * ============================================================================= */
+
+.es-dock-area {
+ display: flex;
+ overflow: hidden;
+}
+
+.es-dock-area-left,
+.es-dock-area-right {
+ transition: width 150ms ease-out;
+}
+
+.es-dock-area-bottom {
+ transition: height 150ms ease-out;
+ flex-shrink: 0;
+}
+
+.es-dock-area-collapsed {
+ width: 0 !important;
+ height: 0 !important;
+ overflow: hidden;
+}
+
+.es-dock-pane-group {
+ display: flex;
+ flex: 1;
+ overflow: hidden;
+ min-width: 0;
+ min-height: 0;
+}
+
+.es-dock-pane-group-horizontal {
+ flex-direction: row;
+}
+
+.es-dock-pane-group-vertical {
+ flex-direction: column;
+}
diff --git a/editor/src/styles/hierarchy.css b/editor/src/styles/hierarchy.css
index 3c7e0b15c..a610f3e20 100644
--- a/editor/src/styles/hierarchy.css
+++ b/editor/src/styles/hierarchy.css
@@ -111,28 +111,46 @@
.es-hierarchy-item.es-drop-before > .es-hierarchy-row::before {
content: '';
position: absolute;
- top: 0;
+ top: -1px;
left: 20px;
right: 0;
height: 2px;
- background: var(--es-drag);
+ background: var(--es-accent);
+ box-shadow: 0 0 4px var(--es-accent);
pointer-events: none;
+ z-index: 1;
+}
+
+.es-hierarchy-item.es-drop-before > .es-hierarchy-row::after {
+ content: '';
+ position: absolute;
+ top: -4px;
+ left: 17px;
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: var(--es-accent);
+ pointer-events: none;
+ z-index: 1;
}
.es-hierarchy-item.es-drop-after > .es-hierarchy-row::after {
content: '';
position: absolute;
- bottom: 0;
+ bottom: -1px;
left: 20px;
right: 0;
height: 2px;
- background: var(--es-drag);
+ background: var(--es-accent);
+ box-shadow: 0 0 4px var(--es-accent);
pointer-events: none;
+ z-index: 1;
}
.es-hierarchy-item.es-drop-inside > .es-hierarchy-row {
- background: hsla(210, 80%, 66%, 0.3);
- border-left-color: var(--es-drag);
+ background: hsla(210, 80%, 66%, 0.15);
+ outline: 1px solid var(--es-accent);
+ outline-offset: -1px;
}
.es-hierarchy-item.es-dragging {
@@ -313,10 +331,3 @@
margin-left: auto;
}
-.es-hierarchy-footer {
- padding: 6px 12px;
- font-size: 11px;
- color: var(--es-text-secondary);
- background: var(--es-bg-secondary);
- border-top: 1px solid var(--es-border);
-}
diff --git a/editor/src/styles/index.css b/editor/src/styles/index.css
index d2e781e06..33217f5ad 100644
--- a/editor/src/styles/index.css
+++ b/editor/src/styles/index.css
@@ -1,4 +1,5 @@
@import './base.css';
+@import './dock.css';
@import './panels.css';
@import './menus.css';
@import './hierarchy.css';
diff --git a/editor/src/styles/inspector.css b/editor/src/styles/inspector.css
index ef281d9fd..e47cba779 100644
--- a/editor/src/styles/inspector.css
+++ b/editor/src/styles/inspector.css
@@ -457,14 +457,6 @@
border-style: solid;
}
-.es-inspector-footer {
- padding: 6px 12px;
- font-size: 11px;
- color: var(--es-text-secondary);
- background: var(--es-bg-secondary);
- border-top: 1px solid var(--es-border);
-}
-
/* Asset Inspector */
.es-inspector-asset-header {
diff --git a/editor/src/styles/menus.css b/editor/src/styles/menus.css
index 9185a1b65..3bb0a028f 100644
--- a/editor/src/styles/menus.css
+++ b/editor/src/styles/menus.css
@@ -195,28 +195,9 @@
.es-editor-dock {
flex: 1;
overflow: hidden;
+ position: relative;
}
-.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: var(--es-accent-gold);
- --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: var(--es-accent-subtle);
- --dv-drag-over-border-color: var(--es-accent);
-}
/* =============================================================================
* Context Menu
diff --git a/editor/src/styles/panels.css b/editor/src/styles/panels.css
index a495aebd4..f0baa59d0 100644
--- a/editor/src/styles/panels.css
+++ b/editor/src/styles/panels.css
@@ -6,7 +6,7 @@
display: flex;
align-items: center;
justify-content: space-between;
- padding: 6px 12px;
+ padding: 4px 8px;
min-height: var(--es-toolbar-height);
box-sizing: border-box;
background: var(--es-bg-secondary);
@@ -30,3 +30,4 @@
display: flex;
gap: 4px;
}
+
diff --git a/editor/src/ui/CommandPalette.ts b/editor/src/ui/CommandPalette.ts
new file mode 100644
index 000000000..c2a6e0df3
--- /dev/null
+++ b/editor/src/ui/CommandPalette.ts
@@ -0,0 +1,215 @@
+import type { Entity } from 'esengine';
+import { icons } from '../utils/icons';
+import { fuzzyMatch } from '../utils/fuzzy';
+import { getEditorStore } from '../store';
+import { getAllMenus, getMenuItems } from '../menus/MenuRegistry';
+import { getAssetDatabase } from '../asset/AssetDatabase';
+import { getNavigationService } from '../services';
+
+type ResultKind = 'entity' | 'asset' | 'action';
+
+interface PaletteResult {
+ kind: ResultKind;
+ label: string;
+ detail?: string;
+ icon: string;
+ score: number;
+ matches: number[];
+ execute: () => void;
+}
+
+const MAX_RESULTS = 20;
+
+let activeInstance: CommandPaletteInstance | null = null;
+
+class CommandPaletteInstance {
+ private overlay_: HTMLElement;
+ private input_: HTMLInputElement;
+ private list_: HTMLElement;
+ private results_: PaletteResult[] = [];
+ private highlightIndex_ = 0;
+
+ constructor() {
+ this.overlay_ = document.createElement('div');
+ this.overlay_.className = 'es-command-palette-overlay';
+ this.overlay_.innerHTML = `
+ <div class="es-command-palette">
+ <div class="es-command-palette-input-row">
+ <span class="es-command-palette-icon">${icons.search(14)}</span>
+ <input type="text" class="es-command-palette-input" placeholder="Search entities, assets, actions..." />
+ </div>
+ <div class="es-command-palette-list"></div>
+ </div>
+ `;
+
+ this.input_ = this.overlay_.querySelector('.es-command-palette-input')!;
+ this.list_ = this.overlay_.querySelector('.es-command-palette-list')!;
+
+ this.input_.addEventListener('input', () => this.onInput());
+ this.overlay_.addEventListener('mousedown', (e) => {
+ if (e.target === this.overlay_) this.close();
+ });
+ this.list_.addEventListener('click', (e) => {
+ const item = (e.target as HTMLElement).closest('.es-command-palette-item') as HTMLElement;
+ if (item) {
+ const idx = parseInt(item.dataset.index ?? '', 10);
+ if (!isNaN(idx) && idx < this.results_.length) {
+ this.results_[idx].execute();
+ this.close();
+ }
+ }
+ });
+ document.addEventListener('keydown', this.onKeyDown_);
+
+ document.body.appendChild(this.overlay_);
+ requestAnimationFrame(() => this.input_.focus());
+ this.onInput();
+ }
+
+ private onInput(): void {
+ const query = this.input_.value.trim();
+ this.results_ = this.search(query);
+ this.highlightIndex_ = 0;
+ this.renderList();
+ }
+
+ private search(query: string): PaletteResult[] {
+ const results: PaletteResult[] = [];
+
+ const store = getEditorStore();
+ for (const entity of store.scene.entities) {
+ const m = fuzzyMatch(query, entity.name);
+ if (m) {
+ results.push({
+ kind: 'entity',
+ label: entity.name,
+ detail: entity.parent !== null ? 'Entity' : 'Root Entity',
+ icon: icons.box(14),
+ score: m.score + 2,
+ matches: m.matches,
+ execute: () => store.selectEntity(entity.id as Entity, 'replace'),
+ });
+ }
+ }
+
+ const db = getAssetDatabase();
+ if (db) {
+ for (const entry of db.getAllEntries()) {
+ const name = entry.path.split('/').pop() ?? entry.path;
+ const m = fuzzyMatch(query, name);
+ if (m) {
+ results.push({
+ kind: 'asset',
+ label: name,
+ detail: entry.type,
+ icon: icons.file(14),
+ score: m.score,
+ matches: m.matches,
+ execute: () => getNavigationService().navigateToAsset(entry.path),
+ });
+ }
+ }
+ }
+
+ const menus = getAllMenus();
+ for (const menu of menus) {
+ const items = getMenuItems(menu.id);
+ for (const item of items) {
+ if (item.hidden) continue;
+ if (item.enabled && !item.enabled()) continue;
+ const m = fuzzyMatch(query, item.label);
+ if (m) {
+ results.push({
+ kind: 'action',
+ label: item.label,
+ detail: item.shortcut ? `${menu.label} · ${item.shortcut}` : menu.label,
+ icon: icons.cog(14),
+ score: m.score + 1,
+ matches: m.matches,
+ execute: () => item.action(),
+ });
+ }
+ }
+ }
+
+ results.sort((a, b) => b.score - a.score);
+ return results.slice(0, MAX_RESULTS);
+ }
+
+ private renderList(): void {
+ if (this.results_.length === 0) {
+ this.list_.innerHTML = '<div class="es-command-palette-empty">No results</div>';
+ return;
+ }
+
+ this.list_.innerHTML = this.results_.map((r, i) => {
+ const highlighted = i === this.highlightIndex_ ? ' es-highlighted' : '';
+ const kindClass = `es-kind-${r.kind}`;
+ return `<div class="es-command-palette-item${highlighted} ${kindClass}" data-index="${i}">
+ <span class="es-command-palette-item-icon">${r.icon}</span>
+ <span class="es-command-palette-item-label">${this.highlightMatches(r.label, r.matches)}</span>
+ ${r.detail ? `<span class="es-command-palette-item-detail">${r.detail}</span>` : ''}
+ </div>`;
+ }).join('');
+ }
+
+ private highlightMatches(text: string, matches: number[]): string {
+ if (matches.length === 0) return text;
+ const set = new Set(matches);
+ let result = '';
+ for (let i = 0; i < text.length; i++) {
+ if (set.has(i)) {
+ result += `<mark>${text[i]}</mark>`;
+ } else {
+ result += text[i];
+ }
+ }
+ return result;
+ }
+
+ private onKeyDown_ = (e: KeyboardEvent): void => {
+ if (e.key === 'Escape') {
+ e.preventDefault();
+ this.close();
+ return;
+ }
+ if (e.key === 'ArrowDown') {
+ e.preventDefault();
+ this.highlightIndex_ = (this.highlightIndex_ + 1) % Math.max(1, this.results_.length);
+ this.renderList();
+ this.scrollToHighlight();
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault();
+ this.highlightIndex_ = this.highlightIndex_ > 0
+ ? this.highlightIndex_ - 1
+ : this.results_.length - 1;
+ this.renderList();
+ this.scrollToHighlight();
+ } else if (e.key === 'Enter') {
+ e.preventDefault();
+ if (this.highlightIndex_ >= 0 && this.highlightIndex_ < this.results_.length) {
+ this.results_[this.highlightIndex_].execute();
+ this.close();
+ }
+ }
+ };
+
+ private scrollToHighlight(): void {
+ const item = this.list_.querySelector('.es-highlighted');
+ item?.scrollIntoView({ block: 'nearest' });
+ }
+
+ close(): void {
+ document.removeEventListener('keydown', this.onKeyDown_);
+ this.overlay_.remove();
+ activeInstance = null;
+ }
+}
+
+export function showCommandPalette(): void {
+ if (activeInstance) {
+ activeInstance.close();
+ return;
+ }
+ activeInstance = new CommandPaletteInstance();
+}
diff --git a/editor/src/ui/ContentDrawer.ts b/editor/src/ui/ContentDrawer.ts
deleted file mode 100644
index ea33fb04d..000000000
--- a/editor/src/ui/ContentDrawer.ts
+++ /dev/null
@@ -1,241 +0,0 @@
-import type { DockLayoutManager } from '../DockLayoutManager';
-import type { EditorStore } from '../store/EditorStore';
-import { ContentBrowserPanel } from '../panels/content-browser/ContentBrowserPanel';
-import type { ContentBrowserOptions } from '../panels/content-browser/ContentBrowserTypes';
-import { icons } from '../utils/icons';
-
-type DrawerState = 'hidden' | 'open';
-
-const DRAWER_HEIGHT_KEY = 'esengine.content-drawer.height';
-const DRAWER_PINNED_KEY = 'esengine.content-drawer.pinned';
-const DEFAULT_HEIGHT = 300;
-const MIN_HEIGHT = 150;
-const MAX_HEIGHT = 600;
-
-export class ContentDrawer {
- private state_: DrawerState = 'hidden';
- private drawerEl_: HTMLElement | null = null;
- private panelBody_: HTMLElement | null = null;
- private panel_: ContentBrowserPanel | null = null;
- private drawerHeight_: number;
- private outsideClickHandler_: ((e: MouseEvent) => void) | null = null;
- private resizing_ = false;
- private pinned_: boolean;
- private pinBtn_: HTMLElement | null = null;
-
- constructor(
- private editorContainer_: HTMLElement,
- private dockLayout_: DockLayoutManager,
- private store_: EditorStore,
- private panelOptions_: ContentBrowserOptions,
- ) {
- this.drawerHeight_ = parseInt(localStorage.getItem(DRAWER_HEIGHT_KEY) ?? '', 10) || DEFAULT_HEIGHT;
- this.pinned_ = localStorage.getItem(DRAWER_PINNED_KEY) === 'true';
- }
-
- get state(): DrawerState {
- return this.state_;
- }
-
- toggle(): void {
- if (this.state_ === 'open') {
- this.closeDrawer();
- } else {
- this.openDrawer();
- }
- }
-
- openDrawer(): void {
- if (this.state_ === 'open') return;
-
- if (!this.drawerEl_) {
- this.createDrawerDOM_();
- }
-
- this.ensurePanel_();
-
- this.drawerEl_!.style.setProperty('--drawer-height', `${this.drawerHeight_}px`);
-
- requestAnimationFrame(() => {
- this.drawerEl_!.classList.add('es-drawer-open');
- this.state_ = 'open';
- this.updateStatusbarButton_(true);
- });
-
- if (!this.pinned_) {
- this.attachOutsideClick_();
- }
-
- this.drawerEl_!.addEventListener('transitionend', () => {
- window.dispatchEvent(new Event('resize'));
- }, { once: true });
- }
-
- closeDrawer(): void {
- if (this.state_ !== 'open' || !this.drawerEl_) return;
-
- this.drawerEl_.classList.remove('es-drawer-open');
- this.state_ = 'hidden';
- this.detachOutsideClick_();
- this.updateStatusbarButton_(false);
-
- this.drawerEl_.addEventListener('transitionend', () => {
- window.dispatchEvent(new Event('resize'));
- }, { once: true });
- }
-
- dockInLayout(): void {
- this.closeDrawer();
- this.destroyPanel_();
-
- this.dockLayout_.showPanel('content-browser');
- }
-
- onResetLayout(): void {
- this.closeDrawer();
- this.destroyPanel_();
- }
-
- dispose(): void {
- this.detachOutsideClick_();
- this.destroyPanel_();
- if (this.drawerEl_) {
- this.drawerEl_.remove();
- this.drawerEl_ = null;
- }
- this.panelBody_ = null;
- }
-
- private ensurePanel_(): void {
- if (this.panel_ || !this.panelBody_) return;
- this.panelBody_.innerHTML = '';
- this.panel_ = new ContentBrowserPanel(this.panelBody_, this.store_, this.panelOptions_);
- }
-
- private destroyPanel_(): void {
- if (!this.panel_) return;
- this.panel_.dispose();
- this.panel_ = null;
- if (this.panelBody_) {
- this.panelBody_.innerHTML = '';
- }
- }
-
- private createDrawerDOM_(): void {
- this.drawerEl_ = document.createElement('div');
- this.drawerEl_.className = 'es-content-drawer';
- this.drawerEl_.innerHTML = `
- <div class="es-content-drawer-resize"></div>
- <div class="es-content-drawer-header">
- <span class="es-content-drawer-title">${icons.folder(14)} Content Browser</span>
- <div class="es-content-drawer-actions">
- <button class="es-btn-icon" title="Dock in Layout">${icons.template(14)}</button>
- <button class="es-btn-icon es-drawer-pin-btn${this.pinned_ ? ' es-active' : ''}" title="${this.pinned_ ? 'Unpin' : 'Pin'}">${this.pinned_ ? icons.lock(14) : icons.lockOpen(14)}</button>
- <button class="es-btn-icon" title="Close">${icons.x(14)}</button>
- </div>
- </div>
- <div class="es-content-drawer-body"></div>
- `;
-
- const statusbar = this.editorContainer_.querySelector('.es-editor-statusbar');
- if (statusbar) {
- this.editorContainer_.insertBefore(this.drawerEl_, statusbar);
- } else {
- this.editorContainer_.appendChild(this.drawerEl_);
- }
-
- this.panelBody_ = this.drawerEl_.querySelector('.es-content-drawer-body') as HTMLElement;
-
- const dockBtn = this.drawerEl_.querySelector('[title="Dock in Layout"]');
- this.pinBtn_ = this.drawerEl_.querySelector('.es-drawer-pin-btn') as HTMLElement;
- const closeBtn = this.drawerEl_.querySelector('[title="Close"]');
-
- dockBtn?.addEventListener('click', () => this.dockInLayout());
- this.pinBtn_?.addEventListener('click', () => this.togglePin_());
- closeBtn?.addEventListener('click', () => this.closeDrawer());
-
- this.setupResize_();
- }
-
- private setupResize_(): void {
- const handle = this.drawerEl_!.querySelector('.es-content-drawer-resize') as HTMLElement;
- if (!handle) return;
-
- handle.addEventListener('mousedown', (e: MouseEvent) => {
- e.preventDefault();
- const startY = e.clientY;
- const startHeight = this.drawerHeight_;
-
- this.resizing_ = true;
- this.drawerEl_!.classList.add('es-drawer-resizing');
-
- const onMove = (ev: MouseEvent) => {
- const delta = startY - ev.clientY;
- const newHeight = Math.max(MIN_HEIGHT, Math.min(MAX_HEIGHT, startHeight + delta));
- this.drawerHeight_ = newHeight;
- this.drawerEl_!.style.setProperty('--drawer-height', `${newHeight}px`);
- };
-
- const onUp = () => {
- document.removeEventListener('mousemove', onMove);
- document.removeEventListener('mouseup', onUp);
- this.resizing_ = false;
- this.drawerEl_!.classList.remove('es-drawer-resizing');
- localStorage.setItem(DRAWER_HEIGHT_KEY, String(this.drawerHeight_));
- window.dispatchEvent(new Event('resize'));
- };
-
- document.addEventListener('mousemove', onMove);
- document.addEventListener('mouseup', onUp);
- });
- }
-
- private togglePin_(): void {
- this.pinned_ = !this.pinned_;
- localStorage.setItem(DRAWER_PINNED_KEY, String(this.pinned_));
-
- if (this.pinBtn_) {
- this.pinBtn_.innerHTML = this.pinned_ ? icons.lock(14) : icons.lockOpen(14);
- this.pinBtn_.title = this.pinned_ ? 'Unpin' : 'Pin';
- this.pinBtn_.classList.toggle('es-active', this.pinned_);
- }
-
- if (this.pinned_) {
- this.detachOutsideClick_();
- } else if (this.state_ === 'open') {
- this.attachOutsideClick_();
- }
- }
-
- private attachOutsideClick_(): void {
- this.detachOutsideClick_();
-
- requestAnimationFrame(() => {
- this.outsideClickHandler_ = (e: MouseEvent) => {
- if (this.resizing_) return;
- const target = e.target as HTMLElement;
- if (!target) return;
- if (this.drawerEl_?.contains(target)) return;
- if (target.closest('[data-bottom-panel="content-browser"]')) return;
- if (target.closest('.es-context-menu')) return;
- if (target.closest('.es-dialog-overlay')) return;
- this.closeDrawer();
- };
- document.addEventListener('mousedown', this.outsideClickHandler_);
- });
- }
-
- private detachOutsideClick_(): void {
- if (this.outsideClickHandler_) {
- document.removeEventListener('mousedown', this.outsideClickHandler_);
- this.outsideClickHandler_ = null;
- }
- }
-
- private updateStatusbarButton_(active: boolean): void {
- const btn = this.editorContainer_.querySelector('[data-bottom-panel="content-browser"]');
- if (btn) {
- btn.classList.toggle('es-active', active);
- }
- }
-}
diff --git a/editor/src/ui/Toast.ts b/editor/src/ui/Toast.ts
index 070a19477..b87004b07 100644
--- a/editor/src/ui/Toast.ts
+++ b/editor/src/ui/Toast.ts
@@ -172,6 +172,8 @@ class ToastManager {
return icons.x(18);
case 'progress':
return `<div class="es-toast-spinner"></div>`;
+ case 'info':
+ return icons.info(18);
default:
return icons.cog(18);
}
diff --git a/editor/src/utils/icons.ts b/editor/src/utils/icons.ts
index eeb2fabcc..9541b46ac 100644
--- a/editor/src/utils/icons.ts
+++ b/editor/src/utils/icons.ts
@@ -10,6 +10,7 @@ import {
Settings,
Eye,
Star,
+ ChevronLeft,
ChevronRight,
ChevronDown,
Box,
@@ -80,6 +81,7 @@ import {
GripVertical,
Info,
TriangleAlert,
+ PanelLeft,
} from 'lucide';
// =============================================================================
@@ -144,6 +146,7 @@ export const icons = {
eye: (size?: number) => renderIcon(Eye as IconNode, size),
eyeOff: (size?: number) => renderIcon(EyeOff as IconNode, size),
star: (size?: number) => renderIcon(Star as IconNode, size),
+ chevronLeft: (size?: number) => renderIcon(ChevronLeft as IconNode, size),
chevronRight: (size?: number) => renderIcon(ChevronRight as IconNode, size),
chevronDown: (size?: number) => renderIcon(ChevronDown as IconNode, size),
box: (size?: number) => renderIcon(Box as IconNode, size),
@@ -193,6 +196,7 @@ export const icons = {
arrowDown: (size?: number) => renderIcon(ArrowDown as IconNode, size),
layoutGrid: (size?: number) => renderIcon(LayoutGrid as IconNode, size),
layoutList: (size?: number) => renderIcon(LayoutList as IconNode, size),
+ panelLeft: (size?: number) => renderIcon(PanelLeft as IconNode, size),
zap: (size?: number) => renderIcon(Zap as IconNode, size),
film: (size?: number) => renderIcon(Film as IconNode, size),
scan: (size?: number) => renderIcon(Scan as IconNode, size),
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 88c749dba..103f187ef 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -63,9 +63,6 @@ importers:
editor:
dependencies:
- dockview-core:
- specifier: ^4.13.1
- version: 4.13.1
esbuild-wasm:
specifier: ^0.27.2
version: 0.27.2