move typings into a separate directory
This commit is contained in:
parent
33f7d2bad5
commit
c62ed62752
56 changed files with 87 additions and 78 deletions
142
typings/common.d.ts
vendored
Normal file
142
typings/common.d.ts
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
import type parseUrl from 'parse-url';
|
||||
import type {IpcMain, IpcRenderer} from 'electron';
|
||||
import type {ExecFileOptions, ExecOptions} from 'child_process';
|
||||
import type {configOptions} from './config';
|
||||
|
||||
export type Session = {
|
||||
uid: string;
|
||||
rows?: number | null;
|
||||
cols?: number | null;
|
||||
splitDirection?: 'HORIZONTAL' | 'VERTICAL';
|
||||
shell: string | null;
|
||||
pid: number | null;
|
||||
activeUid?: string;
|
||||
profile: string;
|
||||
};
|
||||
|
||||
export type sessionExtraOptions = {
|
||||
cwd?: string;
|
||||
splitDirection?: 'HORIZONTAL' | 'VERTICAL';
|
||||
activeUid?: string | null;
|
||||
isNewGroup?: boolean;
|
||||
rows?: number;
|
||||
cols?: number;
|
||||
shell?: string;
|
||||
shellArgs?: string[];
|
||||
profile?: string;
|
||||
};
|
||||
|
||||
export type MainEvents = {
|
||||
close: never;
|
||||
command: string;
|
||||
data: {uid: string | null; data: string; escaped?: boolean};
|
||||
exit: {uid: string};
|
||||
'info renderer': {uid: string; type: string};
|
||||
init: null;
|
||||
maximize: never;
|
||||
minimize: never;
|
||||
new: sessionExtraOptions;
|
||||
'open context menu': string;
|
||||
'open external': {url: string};
|
||||
'open hamburger menu': {x: number; y: number};
|
||||
'quit and install': never;
|
||||
resize: {uid: string; cols: number; rows: number};
|
||||
unmaximize: never;
|
||||
};
|
||||
|
||||
export type RendererEvents = {
|
||||
ready: never;
|
||||
'add notification': {text: string; url: string; dismissable: boolean};
|
||||
'update available': {releaseNotes: string; releaseName: string; releaseUrl: string; canInstall: boolean};
|
||||
'open ssh': ReturnType<typeof parseUrl>;
|
||||
'open file': {path: string};
|
||||
'move jump req': number | 'last';
|
||||
'reset fontSize req': never;
|
||||
'move left req': never;
|
||||
'move right req': never;
|
||||
'prev pane req': never;
|
||||
'decrease fontSize req': never;
|
||||
'increase fontSize req': never;
|
||||
'next pane req': never;
|
||||
'session break req': never;
|
||||
'session quit req': never;
|
||||
'session search close': never;
|
||||
'session search': never;
|
||||
'session stop req': never;
|
||||
'session tmux req': never;
|
||||
'session del line beginning req': never;
|
||||
'session del line end req': never;
|
||||
'session del word left req': never;
|
||||
'session del word right req': never;
|
||||
'session move line beginning req': never;
|
||||
'session move line end req': never;
|
||||
'session move word left req': never;
|
||||
'session move word right req': never;
|
||||
'term selectAll': never;
|
||||
reload: never;
|
||||
'session clear req': never;
|
||||
'split request horizontal': {activeUid?: string; profile?: string};
|
||||
'split request vertical': {activeUid?: string; profile?: string};
|
||||
'termgroup add req': {activeUid?: string; profile?: string};
|
||||
'termgroup close req': never;
|
||||
'session add': Session;
|
||||
'session data': string;
|
||||
'session exit': {uid: string};
|
||||
'windowGeometry change': {isMaximized: boolean};
|
||||
move: {bounds: {x: number; y: number}};
|
||||
'enter full screen': never;
|
||||
'leave full screen': never;
|
||||
'session data send': {uid: string | null; data: string; escaped?: boolean};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get keys of T where the value is not never
|
||||
*/
|
||||
export type FilterNever<T> = {[K in keyof T]: T[K] extends never ? never : K}[keyof T];
|
||||
|
||||
export interface TypedEmitter<Events> {
|
||||
on<E extends keyof Events>(event: E, listener: (args: Events[E]) => void): this;
|
||||
once<E extends keyof Events>(event: E, listener: (args: Events[E]) => void): this;
|
||||
emit<E extends Exclude<keyof Events, FilterNever<Events>>>(event: E): boolean;
|
||||
emit<E extends FilterNever<Events>>(event: E, data: Events[E]): boolean;
|
||||
emit<E extends keyof Events>(event: E, data?: Events[E]): boolean;
|
||||
removeListener<E extends keyof Events>(event: E, listener: (args: Events[E]) => void): this;
|
||||
removeAllListeners<E extends keyof Events>(event?: E): this;
|
||||
}
|
||||
|
||||
type OptionalPromise<T> = T | Promise<T>;
|
||||
|
||||
export type IpcCommands = {
|
||||
'child_process.exec': (command: string, options: ExecOptions) => {stdout: string; stderr: string};
|
||||
'child_process.execFile': (
|
||||
file: string,
|
||||
args: string[],
|
||||
options: ExecFileOptions
|
||||
) => {
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
};
|
||||
getLoadedPluginVersions: () => {name: string; version: string}[];
|
||||
getPaths: () => {plugins: string[]; localPlugins: string[]};
|
||||
getBasePaths: () => {path: string; localPath: string};
|
||||
getDeprecatedConfig: () => Record<string, {css: string[]}>;
|
||||
getDecoratedConfig: (profile: string) => configOptions;
|
||||
getDecoratedKeymaps: () => Record<string, string[]>;
|
||||
};
|
||||
|
||||
export interface IpcMainWithCommands extends IpcMain {
|
||||
handle<E extends keyof IpcCommands>(
|
||||
channel: E,
|
||||
listener: (
|
||||
event: Electron.IpcMainInvokeEvent,
|
||||
...args: Parameters<IpcCommands[E]>
|
||||
) => OptionalPromise<ReturnType<IpcCommands[E]>>
|
||||
): void;
|
||||
}
|
||||
|
||||
export interface IpcRendererWithCommands extends IpcRenderer {
|
||||
invoke<E extends keyof IpcCommands>(
|
||||
channel: E,
|
||||
...args: Parameters<IpcCommands[E]>
|
||||
): Promise<ReturnType<IpcCommands[E]>>;
|
||||
}
|
||||
242
typings/config.d.ts
vendored
Normal file
242
typings/config.d.ts
vendored
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
import type {FontWeight} from 'xterm';
|
||||
|
||||
export type ColorMap = {
|
||||
black: string;
|
||||
blue: string;
|
||||
cyan: string;
|
||||
green: string;
|
||||
lightBlack: string;
|
||||
lightBlue: string;
|
||||
lightCyan: string;
|
||||
lightGreen: string;
|
||||
lightMagenta: string;
|
||||
lightRed: string;
|
||||
lightWhite: string;
|
||||
lightYellow: string;
|
||||
magenta: string;
|
||||
red: string;
|
||||
white: string;
|
||||
yellow: string;
|
||||
};
|
||||
|
||||
type rootConfigOptions = {
|
||||
/**
|
||||
* if `true` (default), Hyper will update plugins every 5 hours
|
||||
* you can also set it to a custom time e.g. `1d` or `2h`
|
||||
*/
|
||||
autoUpdatePlugins: boolean | string;
|
||||
/** if `true` hyper will be set as the default protocol client for SSH */
|
||||
defaultSSHApp: boolean;
|
||||
/** if `true` hyper will not check for updates */
|
||||
disableAutoUpdates: boolean;
|
||||
/** choose either `'stable'` for receiving highly polished, or `'canary'` for less polished but more frequent updates */
|
||||
updateChannel: 'stable' | 'canary';
|
||||
useConpty?: boolean;
|
||||
};
|
||||
|
||||
type profileConfigOptions = {
|
||||
/**
|
||||
* terminal background color
|
||||
*
|
||||
* opacity is only supported on macOS
|
||||
*/
|
||||
backgroundColor: string;
|
||||
/**
|
||||
* Supported Options:
|
||||
* 1. 'SOUND' -> Enables the bell as a sound
|
||||
* 2. false: turns off the bell
|
||||
*/
|
||||
bell: 'SOUND' | false;
|
||||
/**
|
||||
* base64 encoded string of the sound file to use for the bell
|
||||
* if null, the default bell will be used
|
||||
* @nullable
|
||||
*/
|
||||
bellSound: string | null;
|
||||
/**
|
||||
* An absolute file path to a sound file on the machine.
|
||||
* @nullable
|
||||
*/
|
||||
bellSoundURL: string | null;
|
||||
/** border color (window, tabs) */
|
||||
borderColor: string;
|
||||
/**
|
||||
* the full list. if you're going to provide the full color palette,
|
||||
* including the 6 x 6 color cubes and the grayscale map, just provide
|
||||
* an array here instead of a color map object
|
||||
*/
|
||||
colors: ColorMap;
|
||||
/** if `true` selected text will automatically be copied to the clipboard */
|
||||
copyOnSelect: boolean;
|
||||
/** custom CSS to embed in the main window */
|
||||
css: string;
|
||||
/** terminal text color under BLOCK cursor */
|
||||
cursorAccentColor: string;
|
||||
/** set to `true` for blinking cursor */
|
||||
cursorBlink: boolean;
|
||||
/** terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) */
|
||||
cursorColor: string;
|
||||
/** `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █ */
|
||||
cursorShape: 'BEAM' | 'UNDERLINE' | 'BLOCK';
|
||||
/** if `false` Hyper will use ligatures provided by some fonts */
|
||||
disableLigatures: boolean;
|
||||
/** for environment variables */
|
||||
env: {[k: string]: string};
|
||||
/** font family with optional fallbacks */
|
||||
fontFamily: string;
|
||||
/** default font size in pixels for all tabs */
|
||||
fontSize: number;
|
||||
/** default font weight eg:'normal', '400', 'bold' */
|
||||
fontWeight: FontWeight;
|
||||
/** font weight for bold characters eg:'normal', '600', 'bold' */
|
||||
fontWeightBold: FontWeight;
|
||||
/** color of the text */
|
||||
foregroundColor: string;
|
||||
/**
|
||||
* Whether to enable Sixel and iTerm2 inline image protocol support or not.
|
||||
*/
|
||||
imageSupport: boolean;
|
||||
/** letter spacing as a relative unit */
|
||||
letterSpacing: number;
|
||||
/** line height as a relative unit */
|
||||
lineHeight: number;
|
||||
/**
|
||||
* choose either `'vertical'`, if you want the column mode when Option key is hold during selection (Default)
|
||||
* or `'force'`, if you want to force selection regardless of whether the terminal is in mouse events mode
|
||||
* (inside tmux or vim with mouse mode enabled for example).
|
||||
*/
|
||||
macOptionSelectionMode: string;
|
||||
modifierKeys?: {
|
||||
altIsMeta: boolean;
|
||||
cmdIsMeta: boolean;
|
||||
};
|
||||
/** custom padding (CSS format, i.e.: `top right bottom left` or `top horizontal bottom` or `vertical horizontal` or `all`) */
|
||||
padding: string;
|
||||
/**
|
||||
* set to true to preserve working directory when creating splits or tabs
|
||||
*/
|
||||
preserveCWD: boolean;
|
||||
/**
|
||||
* if `true` on right click selected text will be copied or pasted if no
|
||||
* selection is present (`true` by default on Windows and disables the context menu feature)
|
||||
*/
|
||||
quickEdit: boolean;
|
||||
/**
|
||||
* set to true to enable screen reading apps (like NVDA) to read the contents of the terminal
|
||||
*/
|
||||
screenReaderMode: boolean;
|
||||
scrollback: number;
|
||||
/** terminal selection color */
|
||||
selectionColor: string;
|
||||
/**
|
||||
* the shell to run when spawning a new session (e.g. /usr/local/bin/fish)
|
||||
* if left empty, your system's login shell will be used by default
|
||||
*
|
||||
* Windows
|
||||
* - Make sure to use a full path if the binary name doesn't work
|
||||
* - Remove `--login` in shellArgs
|
||||
*
|
||||
* Windows Subsystem for Linux (WSL) - previously Bash on Windows
|
||||
* - Example: `C:\\Windows\\System32\\wsl.exe`
|
||||
*
|
||||
* Git-bash on Windows
|
||||
* - Example: `C:\\Program Files\\Git\\bin\\bash.exe`
|
||||
*
|
||||
* PowerShell on Windows
|
||||
* - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
|
||||
*
|
||||
* Cygwin
|
||||
* - Example: `C:\\cygwin64\\bin\\bash.exe`
|
||||
*
|
||||
* Git Bash
|
||||
* - Example: `C:\\Program Files\\Git\\git-cmd.exe`
|
||||
* Then Add `--command=usr/bin/bash.exe` to shellArgs
|
||||
*/
|
||||
shell: string;
|
||||
/**
|
||||
* for setting shell arguments (e.g. for using interactive shellArgs: `['-i']`)
|
||||
* by default `['--login']` will be used
|
||||
*/
|
||||
shellArgs: string[];
|
||||
/**
|
||||
* if you're using a Linux setup which show native menus, set to false
|
||||
*
|
||||
* default: `true` on Linux, `true` on Windows, ignored on macOS
|
||||
*/
|
||||
showHamburgerMenu: boolean | '';
|
||||
/**
|
||||
* set to `false` if you want to hide the minimize, maximize and close buttons
|
||||
*
|
||||
* additionally, set to `'left'` if you want them on the left, like in Ubuntu
|
||||
*
|
||||
* default: `true` on Windows and Linux, ignored on macOS
|
||||
*/
|
||||
showWindowControls: boolean | 'left' | '';
|
||||
/** custom CSS to embed in the terminal window */
|
||||
termCSS: string;
|
||||
uiFontFamily?: string;
|
||||
/**
|
||||
* Whether to use the WebGL renderer. Set it to false to use canvas-based
|
||||
* rendering (slower, but supports transparent backgrounds)
|
||||
*/
|
||||
webGLRenderer: boolean;
|
||||
// TODO: does not pick up config changes automatically, need to restart terminal
|
||||
/**
|
||||
* keypress required for weblink activation: [ctrl | alt | meta | shift]
|
||||
*/
|
||||
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
||||
/** Initial window size in pixels */
|
||||
windowSize?: [number, number];
|
||||
/** set custom startup directory (must be an absolute path) */
|
||||
workingDirectory: string;
|
||||
};
|
||||
|
||||
export type configOptions = rootConfigOptions &
|
||||
profileConfigOptions & {
|
||||
/**
|
||||
* The default profile name to use when launching a new session
|
||||
*/
|
||||
defaultProfile: string;
|
||||
/**
|
||||
* A list of profiles to use
|
||||
*/
|
||||
profiles: {
|
||||
name: string;
|
||||
/**
|
||||
* Specify all the options you want to override for each profile.
|
||||
* Options set here override the defaults set in the root.
|
||||
*/
|
||||
config: Partial<profileConfigOptions>;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type rawConfig = {
|
||||
config?: configOptions;
|
||||
/**
|
||||
* a list of plugins to fetch and install from npm
|
||||
* format: [@org/]project[#version]
|
||||
* examples:
|
||||
* `hyperpower`
|
||||
* `@company/project`
|
||||
* `project#1.0.1`
|
||||
*/
|
||||
plugins?: string[];
|
||||
/**
|
||||
* in development, you can create a directory under
|
||||
* `plugins/local/` and include it here
|
||||
* to load it and avoid it being `npm install`ed
|
||||
*/
|
||||
localPlugins?: string[];
|
||||
/**
|
||||
* Example
|
||||
* 'window:devtools': 'cmd+alt+o',
|
||||
*/
|
||||
keymaps?: {[k: string]: string | string[]};
|
||||
};
|
||||
|
||||
export type parsedConfig = {
|
||||
config: configOptions;
|
||||
plugins: string[];
|
||||
localPlugins: string[];
|
||||
keymaps: Record<string, string[]>;
|
||||
};
|
||||
20
typings/ext-modules.d.ts
vendored
Normal file
20
typings/ext-modules.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
declare module 'php-escape-shell' {
|
||||
export function php_escapeshellcmd(path: string): string;
|
||||
}
|
||||
|
||||
declare module 'git-describe' {
|
||||
export function gitDescribe(...args: any[]): void;
|
||||
}
|
||||
|
||||
declare module 'default-shell' {
|
||||
const val: string;
|
||||
export default val;
|
||||
}
|
||||
|
||||
declare module 'sudo-prompt' {
|
||||
export function exec(
|
||||
cmd: string,
|
||||
options: {name?: string; icns?: string; env?: {[key: string]: string}},
|
||||
callback: (error?: Error, stdout?: string | Buffer, stderr?: string | Buffer) => void
|
||||
): void;
|
||||
}
|
||||
29
typings/extend-electron.d.ts
vendored
Normal file
29
typings/extend-electron.d.ts
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import type {Server} from '../app/rpc';
|
||||
|
||||
declare global {
|
||||
namespace Electron {
|
||||
interface App {
|
||||
config: typeof import('../app/config');
|
||||
plugins: typeof import('../app/plugins');
|
||||
getWindows: () => Set<BrowserWindow>;
|
||||
getLastFocusedWindow: () => BrowserWindow | null;
|
||||
windowCallback?: (win: BrowserWindow) => void;
|
||||
createWindow: (
|
||||
fn?: (win: BrowserWindow) => void,
|
||||
options?: {size?: [number, number]; position?: [number, number]},
|
||||
profileName?: string
|
||||
) => BrowserWindow;
|
||||
setVersion: (version: string) => void;
|
||||
}
|
||||
|
||||
// type Server = import('./rpc').Server;
|
||||
interface BrowserWindow {
|
||||
uid: string;
|
||||
sessions: Map<any, any>;
|
||||
focusTime: number;
|
||||
clean: () => void;
|
||||
rpc: Server;
|
||||
profileName: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
403
typings/hyper.d.ts
vendored
Normal file
403
typings/hyper.d.ts
vendored
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
import type {Immutable} from 'seamless-immutable';
|
||||
import type Client from '../lib/utils/rpc';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__rpcId: string;
|
||||
rpc: Client;
|
||||
focusActiveTerm: (uid?: string) => void;
|
||||
profileName: string;
|
||||
}
|
||||
|
||||
const snapshotResult: {
|
||||
customRequire: {
|
||||
(module: string): NodeModule;
|
||||
cache: Record<string, {exports: NodeModule}>;
|
||||
definitions: Record<string, {exports: any}>;
|
||||
};
|
||||
setGlobals(global: any, process: any, window: any, document: any, console: any, require: any): void;
|
||||
};
|
||||
|
||||
const __non_webpack_require__: NodeRequire;
|
||||
}
|
||||
|
||||
export type ITermGroup = Immutable<{
|
||||
uid: string;
|
||||
sessionUid: string | null;
|
||||
parentUid: string | null;
|
||||
direction: 'HORIZONTAL' | 'VERTICAL' | null;
|
||||
sizes: number[] | null;
|
||||
children: string[];
|
||||
}>;
|
||||
|
||||
export type ITermGroups = Immutable<Record<string, ITermGroup>>;
|
||||
|
||||
export type ITermState = Immutable<{
|
||||
termGroups: Mutable<ITermGroups>;
|
||||
activeSessions: Record<string, string>;
|
||||
activeRootGroup: string | null;
|
||||
}>;
|
||||
|
||||
export type cursorShapes = 'BEAM' | 'UNDERLINE' | 'BLOCK';
|
||||
import type {FontWeight, IWindowsPty, Terminal} from 'xterm';
|
||||
import type {ColorMap, configOptions} from './config';
|
||||
|
||||
export type uiState = Immutable<{
|
||||
_lastUpdate: number | null;
|
||||
activeUid: string | null;
|
||||
activityMarkers: Record<string, boolean>;
|
||||
backgroundColor: string;
|
||||
bell: 'SOUND' | false;
|
||||
bellSoundURL: string | null;
|
||||
bellSound: string | null;
|
||||
borderColor: string;
|
||||
colors: ColorMap;
|
||||
cols: number | null;
|
||||
copyOnSelect: boolean;
|
||||
css: string;
|
||||
cursorAccentColor: string;
|
||||
cursorBlink: boolean;
|
||||
cursorColor: string;
|
||||
cursorShape: cursorShapes;
|
||||
cwd?: string;
|
||||
disableLigatures: boolean;
|
||||
fontFamily: string;
|
||||
fontSize: number;
|
||||
fontSizeOverride: null | number;
|
||||
fontSmoothingOverride: string;
|
||||
fontWeight: FontWeight;
|
||||
fontWeightBold: FontWeight;
|
||||
foregroundColor: string;
|
||||
fullScreen: boolean;
|
||||
imageSupport: boolean;
|
||||
letterSpacing: number;
|
||||
lineHeight: number;
|
||||
macOptionSelectionMode: string;
|
||||
maximized: boolean;
|
||||
messageDismissable: null | boolean;
|
||||
messageText: string | null;
|
||||
messageURL: string | null;
|
||||
modifierKeys: {
|
||||
altIsMeta: boolean;
|
||||
cmdIsMeta: boolean;
|
||||
};
|
||||
notifications: {
|
||||
font: boolean;
|
||||
message: boolean;
|
||||
resize: boolean;
|
||||
updates: boolean;
|
||||
};
|
||||
openAt: Record<string, number>;
|
||||
padding: string;
|
||||
quickEdit: boolean;
|
||||
resizeAt: number;
|
||||
rows: number | null;
|
||||
screenReaderMode: boolean;
|
||||
scrollback: number;
|
||||
selectionColor: string;
|
||||
showHamburgerMenu: boolean | '';
|
||||
showWindowControls: boolean | 'left' | '';
|
||||
termCSS: string;
|
||||
uiFontFamily: string;
|
||||
updateCanInstall: null | boolean;
|
||||
updateNotes: string | null;
|
||||
updateReleaseUrl: string | null;
|
||||
updateVersion: string | null;
|
||||
webGLRenderer: boolean;
|
||||
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
||||
windowsPty?: IWindowsPty;
|
||||
defaultProfile: string;
|
||||
profiles: configOptions['profiles'];
|
||||
}>;
|
||||
|
||||
export type session = {
|
||||
cleared: boolean;
|
||||
cols: number | null;
|
||||
pid: number | null;
|
||||
resizeAt?: number;
|
||||
rows: number | null;
|
||||
search: boolean;
|
||||
shell: string | null;
|
||||
title: string;
|
||||
uid: string;
|
||||
splitDirection?: 'HORIZONTAL' | 'VERTICAL';
|
||||
activeUid?: string;
|
||||
profile: string;
|
||||
};
|
||||
|
||||
export type sessionState = Immutable<{
|
||||
sessions: Record<string, session>;
|
||||
activeUid: string | null;
|
||||
write?: any;
|
||||
}>;
|
||||
|
||||
export type ITermGroupReducer = Reducer<ITermState, HyperActions>;
|
||||
|
||||
export type IUiReducer = Reducer<uiState, HyperActions>;
|
||||
|
||||
export type ISessionReducer = Reducer<sessionState, HyperActions>;
|
||||
|
||||
import type {Middleware, Reducer} from 'redux';
|
||||
export type hyperPlugin = {
|
||||
getTabProps: any;
|
||||
getTabsProps: any;
|
||||
getTermGroupProps: any;
|
||||
getTermProps: any;
|
||||
mapHeaderDispatch: any;
|
||||
mapHyperDispatch: any;
|
||||
mapHyperTermDispatch: any;
|
||||
mapNotificationsDispatch: any;
|
||||
mapTermsDispatch: any;
|
||||
mapHeaderState: any;
|
||||
mapHyperState: any;
|
||||
mapHyperTermState: any;
|
||||
mapNotificationsState: any;
|
||||
mapTermsState: any;
|
||||
middleware: Middleware;
|
||||
onRendererUnload: any;
|
||||
onRendererWindow: any;
|
||||
reduceSessions: ISessionReducer;
|
||||
reduceTermGroups: ITermGroupReducer;
|
||||
reduceUI: IUiReducer;
|
||||
};
|
||||
|
||||
export type HyperState = {
|
||||
ui: uiState;
|
||||
sessions: sessionState;
|
||||
termGroups: ITermState;
|
||||
};
|
||||
|
||||
import type {UIActions} from '../lib/constants/ui';
|
||||
import type {ConfigActions} from '../lib/constants/config';
|
||||
import type {SessionActions} from '../lib/constants/sessions';
|
||||
import type {NotificationActions} from '../lib/constants/notifications';
|
||||
import type {UpdateActions} from '../lib/constants/updater';
|
||||
import type {TermGroupActions} from '../lib/constants/term-groups';
|
||||
import type {InitActions} from '../lib/constants';
|
||||
import type {TabActions} from '../lib/constants/tabs';
|
||||
|
||||
export type HyperActions = (
|
||||
| UIActions
|
||||
| ConfigActions
|
||||
| SessionActions
|
||||
| NotificationActions
|
||||
| UpdateActions
|
||||
| TermGroupActions
|
||||
| InitActions
|
||||
| TabActions
|
||||
) & {effect?: () => void};
|
||||
|
||||
import type configureStore from '../lib/store/configure-store';
|
||||
export type HyperDispatch = ReturnType<typeof configureStore>['dispatch'];
|
||||
|
||||
import type {ReactChild} from 'react';
|
||||
type extensionProps = Partial<{
|
||||
customChildren: ReactChild | ReactChild[];
|
||||
customChildrenBefore: ReactChild | ReactChild[];
|
||||
customCSS: string;
|
||||
customInnerChildren: ReactChild | ReactChild[];
|
||||
}>;
|
||||
|
||||
import type {HeaderConnectedProps} from '../lib/containers/header';
|
||||
export type HeaderProps = HeaderConnectedProps & extensionProps;
|
||||
|
||||
import type {HyperConnectedProps} from '../lib/containers/hyper';
|
||||
export type HyperProps = HyperConnectedProps & extensionProps;
|
||||
|
||||
import type {NotificationsConnectedProps} from '../lib/containers/notifications';
|
||||
export type NotificationsProps = NotificationsConnectedProps & extensionProps;
|
||||
|
||||
import type Terms from '../lib/components/terms';
|
||||
import type {TermsConnectedProps} from '../lib/containers/terms';
|
||||
export type TermsProps = TermsConnectedProps & extensionProps & {ref_: (terms: Terms | null) => void};
|
||||
|
||||
export type StyleSheetProps = {
|
||||
backgroundColor: string;
|
||||
borderColor: string;
|
||||
fontFamily: string;
|
||||
foregroundColor: string;
|
||||
} & extensionProps;
|
||||
|
||||
export type TabProps = {
|
||||
borderColor: string;
|
||||
hasActivity: boolean;
|
||||
isActive: boolean;
|
||||
isFirst: boolean;
|
||||
isLast: boolean;
|
||||
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
onClose: () => void;
|
||||
onSelect: () => void;
|
||||
text: string;
|
||||
} & extensionProps;
|
||||
|
||||
export type ITab = {
|
||||
uid: string;
|
||||
title: string;
|
||||
isActive: boolean;
|
||||
hasActivity: boolean;
|
||||
};
|
||||
|
||||
export type TabsProps = {
|
||||
tabs: ITab[];
|
||||
borderColor: string;
|
||||
backgroundColor: string;
|
||||
onChange: (uid: string) => void;
|
||||
onClose: (uid: string) => void;
|
||||
fullScreen: boolean;
|
||||
defaultProfile: string;
|
||||
profiles: configOptions['profiles'];
|
||||
openNewTab: (profile: string) => void;
|
||||
} & extensionProps;
|
||||
|
||||
export type NotificationProps = {
|
||||
backgroundColor: string;
|
||||
color?: string;
|
||||
dismissAfter?: number;
|
||||
onDismiss: Function;
|
||||
text?: string | null;
|
||||
userDismissable?: boolean | null;
|
||||
userDismissColor?: string;
|
||||
} & extensionProps;
|
||||
|
||||
export type SplitPaneProps = {
|
||||
borderColor: string;
|
||||
direction: 'horizontal' | 'vertical';
|
||||
onResize: Function;
|
||||
sizes?: Immutable<number[]> | null;
|
||||
};
|
||||
|
||||
import type Term from '../lib/components/term';
|
||||
|
||||
export type TermGroupOwnProps = {
|
||||
cursorAccentColor?: string;
|
||||
fontSmoothing?: string;
|
||||
parentProps: TermsProps;
|
||||
ref_: (uid: string, term: Term | null) => void;
|
||||
termGroup: ITermGroup;
|
||||
terms: Record<string, Term | null>;
|
||||
} & Pick<
|
||||
TermsProps,
|
||||
| 'activeSession'
|
||||
| 'backgroundColor'
|
||||
| 'bell'
|
||||
| 'bellSound'
|
||||
| 'bellSoundURL'
|
||||
| 'borderColor'
|
||||
| 'colors'
|
||||
| 'copyOnSelect'
|
||||
| 'cursorBlink'
|
||||
| 'cursorColor'
|
||||
| 'cursorShape'
|
||||
| 'disableLigatures'
|
||||
| 'fontFamily'
|
||||
| 'fontSize'
|
||||
| 'fontWeight'
|
||||
| 'fontWeightBold'
|
||||
| 'foregroundColor'
|
||||
| 'letterSpacing'
|
||||
| 'lineHeight'
|
||||
| 'macOptionSelectionMode'
|
||||
| 'modifierKeys'
|
||||
| 'onActive'
|
||||
| 'onContextMenu'
|
||||
| 'onCloseSearch'
|
||||
| 'onData'
|
||||
| 'onOpenSearch'
|
||||
| 'onResize'
|
||||
| 'onTitle'
|
||||
| 'padding'
|
||||
| 'quickEdit'
|
||||
| 'screenReaderMode'
|
||||
| 'scrollback'
|
||||
| 'selectionColor'
|
||||
| 'sessions'
|
||||
| 'uiFontFamily'
|
||||
| 'webGLRenderer'
|
||||
| 'webLinksActivationKey'
|
||||
| 'windowsPty'
|
||||
| 'imageSupport'
|
||||
>;
|
||||
|
||||
import type {TermGroupConnectedProps} from '../lib/components/term-group';
|
||||
export type TermGroupProps = TermGroupConnectedProps & TermGroupOwnProps;
|
||||
|
||||
export type SearchBoxProps = {
|
||||
caseSensitive: boolean;
|
||||
wholeWord: boolean;
|
||||
regex: boolean;
|
||||
results: {resultIndex: number; resultCount: number} | undefined;
|
||||
toggleCaseSensitive: () => void;
|
||||
toggleWholeWord: () => void;
|
||||
toggleRegex: () => void;
|
||||
next: (searchTerm: string) => void;
|
||||
prev: (searchTerm: string) => void;
|
||||
close: () => void;
|
||||
backgroundColor: string;
|
||||
foregroundColor: string;
|
||||
borderColor: string;
|
||||
selectionColor: string;
|
||||
font: string;
|
||||
};
|
||||
|
||||
import type {FitAddon} from 'xterm-addon-fit';
|
||||
import type {SearchAddon} from 'xterm-addon-search';
|
||||
export type TermProps = {
|
||||
backgroundColor: string;
|
||||
bell: 'SOUND' | false;
|
||||
bellSound: string | null;
|
||||
bellSoundURL: string | null;
|
||||
borderColor: string;
|
||||
cleared: boolean;
|
||||
colors: ColorMap;
|
||||
cols: number | null;
|
||||
copyOnSelect: boolean;
|
||||
cursorAccentColor?: string;
|
||||
cursorBlink: boolean;
|
||||
cursorColor: string;
|
||||
cursorShape: cursorShapes;
|
||||
disableLigatures: boolean;
|
||||
fitAddon: FitAddon | null;
|
||||
fontFamily: string;
|
||||
fontSize: number;
|
||||
fontSmoothing?: string;
|
||||
fontWeight: FontWeight;
|
||||
fontWeightBold: FontWeight;
|
||||
foregroundColor: string;
|
||||
imageSupport: boolean;
|
||||
isTermActive: boolean;
|
||||
letterSpacing: number;
|
||||
lineHeight: number;
|
||||
macOptionSelectionMode: string;
|
||||
modifierKeys: Immutable<{altIsMeta: boolean; cmdIsMeta: boolean}>;
|
||||
onActive: () => void;
|
||||
onCloseSearch: () => void;
|
||||
onContextMenu: (selection: any) => void;
|
||||
onCursorMove?: (cursorFrame: {x: number; y: number; width: number; height: number; col: number; row: number}) => void;
|
||||
onData: (data: string) => void;
|
||||
onOpenSearch: () => void;
|
||||
onResize: (cols: number, rows: number) => void;
|
||||
onTitle: (title: string) => void;
|
||||
padding: string;
|
||||
quickEdit: boolean;
|
||||
rows: number | null;
|
||||
screenReaderMode: boolean;
|
||||
scrollback: number;
|
||||
search: boolean;
|
||||
searchAddon: SearchAddon | null;
|
||||
selectionColor: string;
|
||||
term: Terminal | null;
|
||||
uid: string;
|
||||
uiFontFamily: string;
|
||||
webGLRenderer: boolean;
|
||||
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
||||
windowsPty?: IWindowsPty;
|
||||
ref_: (uid: string, term: Term | null) => void;
|
||||
} & extensionProps;
|
||||
|
||||
// Utility types
|
||||
|
||||
export type Mutable<T> = T extends Immutable<infer U> ? (Exclude<U, T> extends never ? U : Exclude<U, T>) : T;
|
||||
|
||||
export type immutableRecord<T> = {[k in keyof T]: Immutable<T[k]>};
|
||||
|
||||
export type Assignable<T, U> = {[k in keyof U]: k extends keyof T ? T[k] : U[k]} & Partial<T>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue