EditorPanels beta
Class of @v12-engine/editor
export declare class EditorPanelsThe editor's panels (editor.panels), there as long as the editor is, with its dock or not: their definitions, the editor's own (EDITOR_PANELS), the game's (EditorOptions.panels) and those added in code, in that order. The dock draws what is here, whenever it is there: a panel added, or opened, before the dock is, is drawn (and opened) when it is. What is about the dock itself (its layouts, its sides, pinning) is editor.dock
Members
constructor
constructor(own: readonly (EditorPanelInfo & {
search?: EditorPanelDef['search'];
})[], changed: () => void,
bus?: EditorBus);Constructs a new instance of the EditorPanels class
actionsOf
actionsOf(id: string): {
open: string;
toggle: string;
};The names of the actions that open a panel and that open or close it (open-<id>, toggle-<id>), in editor.keys: for a menu's line, a button, a key
add
add(def: EditorPanelDef): () => void;Adds a panel, or one in the place of the panel of its id (the editor's own too). Gives back what takes it away
api
api<K extends string>(id: K): PanelApi<K> | undefined;What a panel offers the others (panel.provide), while it is open and has: typed by EditorPanelApis
close
close(id: string): void;Closes a panel; or, before the dock is there, does not open it after all
get
get(id: string): EditorPanelDef | undefined;A panel's definition, by its id
handle
handle<K extends string>(id: K): EditorPanel<PanelApi<K>> | undefined;The handle of a panel that is open (EditorPanel). None while it is closed, or while there is no dock
has
has(id: string): boolean;Whether there is a panel of that id
isOwn
isOwn(id: string): boolean;Whether the panel of an id is the editor's own, as it comes (nothing put in its place)
list
list(): EditorPanelDef[];Every panel there is, open or not, in the order they were made known
onAdded
onAdded(listener: (def: EditorPanelDef) => void): () => void;Told of each panel added (or in the place of another). Gives back what stops it
onRemoved
onRemoved(listener: (id: string) => void): () => void;Told of each panel taken away, by its id. Gives back what stops it
open
open(id: string, options?: {
over?: boolean;
}): void;Opens a panel: now, or as soon as the dock is there
panelOf
panelOf(action: string): EditorPanelDef | undefined;The panel an action opens or opens and closes (actionsOf), by the action's name
remove
remove(id: string): void;Takes a panel away for good, one of the editor's own too: closed, and its icon gone
reveal
reveal(id: string, entry: string): Promise<void>;Shows one of a panel's entries (EditorPanelDef.search, by the entry's id): the panel opened and brought to the front, then told the id (panel.onReveal). What picking the entry in the search does
when
when<K extends string>(id: K, options?: {
open?: boolean;
}): Promise<EditorPanel<PanelApi<K>>>;The handle of a panel once it is open, and what it offers with it: now, or as soon as it opens. With open, it is opened (rejected when there is no such panel); without, it waits for whoever opens it