dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
108 lines (107 loc) • 3.54 kB
TypeScript
import { Emitter, Event } from '../events';
import { CompositeDisposable } from '../lifecycle';
/**
* A valid JSON type
*/
export declare type StateObject = number | string | boolean | null | object | StateObject[] | {
[key: string]: StateObject;
};
/**
* A JSON-serializable object
*/
export interface State {
[key: string]: StateObject;
}
export interface FocusEvent {
readonly isFocused: boolean;
}
export interface PanelDimensionChangeEvent {
readonly width: number;
readonly height: number;
}
export interface VisibilityEvent {
readonly isVisible: boolean;
}
export interface ActiveEvent {
readonly isActive: boolean;
}
export interface PanelApi {
readonly onDidDimensionsChange: Event<PanelDimensionChangeEvent>;
readonly onDidStateChange: Event<void>;
readonly onDidFocusChange: Event<FocusEvent>;
readonly onDidVisibilityChange: Event<VisibilityEvent>;
readonly onDidActiveChange: Event<ActiveEvent>;
readonly onFocusEvent: Event<void>;
setVisible(isVisible: boolean): void;
setActive(): void;
setState(key: string, value: StateObject): void;
setState(state: State): void;
getState: () => State;
getStateKey: <T extends StateObject>(key: string) => T;
/**
* The id of the panel that would have been assigned when the panel was created
*/
readonly id: string;
/**
* Whether the panel holds the current focus
*/
readonly isFocused: boolean;
/**
* Whether the panel is the actively selected panel
*/
readonly isActive: boolean;
/**
* Whether the panel is visible
*/
readonly isVisible: boolean;
/**
* The panel width in pixels
*/
readonly width: number;
/**
* The panel height in pixels
*/
readonly height: number;
}
/**
* A core api implementation that should be used across all panel-like objects
*/
export declare class PanelApiImpl extends CompositeDisposable implements PanelApi {
readonly id: string;
private _state;
private _isFocused;
private _isActive;
private _isVisible;
private _width;
private _height;
readonly _onDidStateChange: Emitter<void>;
readonly onDidStateChange: Event<void>;
readonly _onDidPanelDimensionChange: Emitter<PanelDimensionChangeEvent>;
readonly onDidDimensionsChange: Event<PanelDimensionChangeEvent>;
readonly _onDidChangeFocus: Emitter<FocusEvent>;
readonly onDidFocusChange: Event<FocusEvent>;
readonly _onFocusEvent: Emitter<void>;
readonly onFocusEvent: Event<void>;
readonly _onDidVisibilityChange: Emitter<VisibilityEvent>;
readonly onDidVisibilityChange: Event<VisibilityEvent>;
readonly _onVisibilityChange: Emitter<VisibilityEvent>;
readonly onVisibilityChange: Event<VisibilityEvent>;
readonly _onDidActiveChange: Emitter<ActiveEvent>;
readonly onDidActiveChange: Event<ActiveEvent>;
readonly _onActiveChange: Emitter<void>;
readonly onActiveChange: Event<void>;
get isFocused(): boolean;
get isActive(): boolean;
get isVisible(): boolean;
get width(): number;
get height(): number;
constructor(id: string);
setVisible(isVisible: boolean): void;
setActive(): void;
setState(key: string | {
[key: string]: StateObject;
}, value?: StateObject): void;
getState(): State;
getStateKey<T extends StateObject>(key: string): T;
dispose(): void;
}