mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Add action types
This commit is contained in:
parent
f40496f127
commit
38c534b3aa
10 changed files with 291 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import rpc from '../rpc';
|
import rpc from '../rpc';
|
||||||
import INIT from '../constants';
|
import {INIT} from '../constants';
|
||||||
import {Dispatch} from 'redux';
|
import {Dispatch} from 'redux';
|
||||||
|
|
||||||
export default function init() {
|
export default function init() {
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,16 @@
|
||||||
export const CONFIG_LOAD = 'CONFIG_LOAD';
|
export const CONFIG_LOAD = 'CONFIG_LOAD';
|
||||||
export const CONFIG_RELOAD = 'CONFIG_RELOAD';
|
export const CONFIG_RELOAD = 'CONFIG_RELOAD';
|
||||||
|
|
||||||
|
export interface ConfigLoadAction {
|
||||||
|
type: typeof CONFIG_LOAD;
|
||||||
|
config: any;
|
||||||
|
now?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConfigReloadAction {
|
||||||
|
type: typeof CONFIG_RELOAD;
|
||||||
|
config: any;
|
||||||
|
now: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ConfigActions = ConfigLoadAction | ConfigReloadAction;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
const INIT = 'INIT';
|
export const INIT = 'INIT';
|
||||||
|
|
||||||
export default INIT;
|
export interface InitAction {
|
||||||
|
type: typeof INIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type InitActions = InitAction;
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,15 @@
|
||||||
export const NOTIFICATION_MESSAGE = 'NOTIFICATION_MESSAGE';
|
export const NOTIFICATION_MESSAGE = 'NOTIFICATION_MESSAGE';
|
||||||
export const NOTIFICATION_DISMISS = 'NOTIFICATION_DISMISS';
|
export const NOTIFICATION_DISMISS = 'NOTIFICATION_DISMISS';
|
||||||
|
|
||||||
|
export interface NotificationMessageAction {
|
||||||
|
type: typeof NOTIFICATION_MESSAGE;
|
||||||
|
text: string;
|
||||||
|
url: string | null;
|
||||||
|
dismissable: boolean;
|
||||||
|
}
|
||||||
|
export interface NotificationDismissAction {
|
||||||
|
type: typeof NOTIFICATION_DISMISS;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NotificationActions = NotificationMessageAction | NotificationDismissAction;
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,95 @@ export const SESSION_SET_XTERM_TITLE = 'SESSION_SET_XTERM_TITLE';
|
||||||
export const SESSION_SET_CWD = 'SESSION_SET_CWD';
|
export const SESSION_SET_CWD = 'SESSION_SET_CWD';
|
||||||
export const SESSION_SEARCH = 'SESSION_SEARCH';
|
export const SESSION_SEARCH = 'SESSION_SEARCH';
|
||||||
export const SESSION_SEARCH_CLOSE = 'SESSION_SEARCH_CLOSE';
|
export const SESSION_SEARCH_CLOSE = 'SESSION_SEARCH_CLOSE';
|
||||||
|
|
||||||
|
export interface SessionAddAction {
|
||||||
|
type: typeof SESSION_ADD;
|
||||||
|
uid: string;
|
||||||
|
shell: string | null;
|
||||||
|
pid: number | null;
|
||||||
|
cols: number | null;
|
||||||
|
rows: number | null;
|
||||||
|
splitDirection?: string;
|
||||||
|
activeUid: string | null;
|
||||||
|
now: number;
|
||||||
|
}
|
||||||
|
export interface SessionResizeAction {
|
||||||
|
type: typeof SESSION_RESIZE;
|
||||||
|
uid: string;
|
||||||
|
cols: number;
|
||||||
|
rows: number;
|
||||||
|
isStandaloneTerm: boolean;
|
||||||
|
now: number;
|
||||||
|
}
|
||||||
|
export interface SessionRequestAction {
|
||||||
|
type: typeof SESSION_REQUEST;
|
||||||
|
}
|
||||||
|
export interface SessionAddDataAction {
|
||||||
|
type: typeof SESSION_ADD_DATA;
|
||||||
|
}
|
||||||
|
export interface SessionPtyDataAction {
|
||||||
|
type: typeof SESSION_PTY_DATA;
|
||||||
|
uid: string;
|
||||||
|
now: number;
|
||||||
|
}
|
||||||
|
export interface SessionPtyExitAction {
|
||||||
|
type: typeof SESSION_PTY_EXIT;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface SessionUserExitAction {
|
||||||
|
type: typeof SESSION_USER_EXIT;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface SessionSetActiveAction {
|
||||||
|
type: typeof SESSION_SET_ACTIVE;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface SessionClearActiveAction {
|
||||||
|
type: typeof SESSION_CLEAR_ACTIVE;
|
||||||
|
}
|
||||||
|
export interface SessionUserDataAction {
|
||||||
|
type: typeof SESSION_USER_DATA;
|
||||||
|
}
|
||||||
|
export interface SessionUrlSetAction {
|
||||||
|
type: typeof SESSION_URL_SET;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface SessionUrlUnsetAction {
|
||||||
|
type: typeof SESSION_URL_UNSET;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface SessionSetXtermTitleAction {
|
||||||
|
type: typeof SESSION_SET_XTERM_TITLE;
|
||||||
|
uid: string;
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
export interface SessionSetCwdAction {
|
||||||
|
type: typeof SESSION_SET_CWD;
|
||||||
|
cwd: string;
|
||||||
|
}
|
||||||
|
export interface SessionSearchAction {
|
||||||
|
type: typeof SESSION_SEARCH;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface SessionSearchCloseAction {
|
||||||
|
type: typeof SESSION_SEARCH_CLOSE;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SessionActions =
|
||||||
|
| SessionAddAction
|
||||||
|
| SessionResizeAction
|
||||||
|
| SessionRequestAction
|
||||||
|
| SessionAddDataAction
|
||||||
|
| SessionPtyDataAction
|
||||||
|
| SessionPtyExitAction
|
||||||
|
| SessionUserExitAction
|
||||||
|
| SessionSetActiveAction
|
||||||
|
| SessionClearActiveAction
|
||||||
|
| SessionUserDataAction
|
||||||
|
| SessionUrlSetAction
|
||||||
|
| SessionUrlUnsetAction
|
||||||
|
| SessionSetXtermTitleAction
|
||||||
|
| SessionSetCwdAction
|
||||||
|
| SessionSearchAction
|
||||||
|
| SessionSearchCloseAction;
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,11 @@
|
||||||
export const CLOSE_TAB = 'CLOSE_TAB';
|
export const CLOSE_TAB = 'CLOSE_TAB';
|
||||||
export const CHANGE_TAB = 'CHANGE_TAB';
|
export const CHANGE_TAB = 'CHANGE_TAB';
|
||||||
|
|
||||||
|
export interface CloseTabAction {
|
||||||
|
type: typeof CLOSE_TAB;
|
||||||
|
}
|
||||||
|
export interface ChangeTabAction {
|
||||||
|
type: typeof CHANGE_TAB;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TabActions = CloseTabAction | ChangeTabAction;
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,25 @@ export const DIRECTION = {
|
||||||
HORIZONTAL: 'HORIZONTAL',
|
HORIZONTAL: 'HORIZONTAL',
|
||||||
VERTICAL: 'VERTICAL'
|
VERTICAL: 'VERTICAL'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface TermGroupRequestAction {
|
||||||
|
type: typeof TERM_GROUP_REQUEST;
|
||||||
|
}
|
||||||
|
export interface TermGroupExitAction {
|
||||||
|
type: typeof TERM_GROUP_EXIT;
|
||||||
|
uid: string;
|
||||||
|
}
|
||||||
|
export interface TermGroupResizeAction {
|
||||||
|
type: typeof TERM_GROUP_RESIZE;
|
||||||
|
uid: string;
|
||||||
|
sizes: number[];
|
||||||
|
}
|
||||||
|
export interface TermGroupExitActiveAction {
|
||||||
|
type: typeof TERM_GROUP_EXIT_ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TermGroupActions =
|
||||||
|
| TermGroupRequestAction
|
||||||
|
| TermGroupExitAction
|
||||||
|
| TermGroupResizeAction
|
||||||
|
| TermGroupExitActiveAction;
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,104 @@ export const UI_ENTER_FULLSCREEN = 'UI_ENTER_FULLSCREEN';
|
||||||
export const UI_LEAVE_FULLSCREEN = 'UI_LEAVE_FULLSCREEN';
|
export const UI_LEAVE_FULLSCREEN = 'UI_LEAVE_FULLSCREEN';
|
||||||
export const UI_CONTEXTMENU_OPEN = 'UI_CONTEXTMENU_OPEN';
|
export const UI_CONTEXTMENU_OPEN = 'UI_CONTEXTMENU_OPEN';
|
||||||
export const UI_COMMAND_EXEC = 'UI_COMMAND_EXEC';
|
export const UI_COMMAND_EXEC = 'UI_COMMAND_EXEC';
|
||||||
|
|
||||||
|
export interface UIFontSizeSetAction {
|
||||||
|
type: typeof UI_FONT_SIZE_SET;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
export interface UIFontSizeIncrAction {
|
||||||
|
type: typeof UI_FONT_SIZE_INCR;
|
||||||
|
}
|
||||||
|
export interface UIFontSizeDecrAction {
|
||||||
|
type: typeof UI_FONT_SIZE_DECR;
|
||||||
|
}
|
||||||
|
export interface UIFontSizeResetAction {
|
||||||
|
type: typeof UI_FONT_SIZE_RESET;
|
||||||
|
}
|
||||||
|
export interface UIFontSmoothingSetAction {
|
||||||
|
type: typeof UI_FONT_SMOOTHING_SET;
|
||||||
|
fontSmoothing: string;
|
||||||
|
}
|
||||||
|
export interface UIMoveLeftAction {
|
||||||
|
type: typeof UI_MOVE_LEFT;
|
||||||
|
}
|
||||||
|
export interface UIMoveRightAction {
|
||||||
|
type: typeof UI_MOVE_RIGHT;
|
||||||
|
}
|
||||||
|
export interface UIMoveToAction {
|
||||||
|
type: typeof UI_MOVE_TO;
|
||||||
|
}
|
||||||
|
export interface UIMoveNextPaneAction {
|
||||||
|
type: typeof UI_MOVE_NEXT_PANE;
|
||||||
|
}
|
||||||
|
export interface UIMovePrevPaneAction {
|
||||||
|
type: typeof UI_MOVE_PREV_PANE;
|
||||||
|
}
|
||||||
|
export interface UIShowPreferencesAction {
|
||||||
|
type: typeof UI_SHOW_PREFERENCES;
|
||||||
|
}
|
||||||
|
export interface UIWindowMoveAction {
|
||||||
|
type: typeof UI_WINDOW_MOVE;
|
||||||
|
}
|
||||||
|
export interface UIWindowMaximizeAction {
|
||||||
|
type: typeof UI_WINDOW_MAXIMIZE;
|
||||||
|
}
|
||||||
|
export interface UIWindowUnmaximizeAction {
|
||||||
|
type: typeof UI_WINDOW_UNMAXIMIZE;
|
||||||
|
}
|
||||||
|
export interface UIWindowGeometryChangedAction {
|
||||||
|
type: typeof UI_WINDOW_GEOMETRY_CHANGED;
|
||||||
|
}
|
||||||
|
export interface UIOpenFileAction {
|
||||||
|
type: typeof UI_OPEN_FILE;
|
||||||
|
}
|
||||||
|
export interface UIOpenSshUrlAction {
|
||||||
|
type: typeof UI_OPEN_SSH_URL;
|
||||||
|
}
|
||||||
|
export interface UIOpenHamburgerMenuAction {
|
||||||
|
type: typeof UI_OPEN_HAMBURGER_MENU;
|
||||||
|
}
|
||||||
|
export interface UIWindowMinimizeAction {
|
||||||
|
type: typeof UI_WINDOW_MINIMIZE;
|
||||||
|
}
|
||||||
|
export interface UIWindowCloseAction {
|
||||||
|
type: typeof UI_WINDOW_CLOSE;
|
||||||
|
}
|
||||||
|
export interface UIEnterFullscreenAction {
|
||||||
|
type: typeof UI_ENTER_FULLSCREEN;
|
||||||
|
}
|
||||||
|
export interface UILeaveFullscreenAction {
|
||||||
|
type: typeof UI_LEAVE_FULLSCREEN;
|
||||||
|
}
|
||||||
|
export interface UIContextmenuOpenAction {
|
||||||
|
type: typeof UI_CONTEXTMENU_OPEN;
|
||||||
|
}
|
||||||
|
export interface UICommandExecAction {
|
||||||
|
type: typeof UI_COMMAND_EXEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UIActions =
|
||||||
|
| UIFontSizeSetAction
|
||||||
|
| UIFontSizeIncrAction
|
||||||
|
| UIFontSizeDecrAction
|
||||||
|
| UIFontSizeResetAction
|
||||||
|
| UIFontSmoothingSetAction
|
||||||
|
| UIMoveLeftAction
|
||||||
|
| UIMoveRightAction
|
||||||
|
| UIMoveToAction
|
||||||
|
| UIMoveNextPaneAction
|
||||||
|
| UIMovePrevPaneAction
|
||||||
|
| UIShowPreferencesAction
|
||||||
|
| UIWindowMoveAction
|
||||||
|
| UIWindowMaximizeAction
|
||||||
|
| UIWindowUnmaximizeAction
|
||||||
|
| UIWindowGeometryChangedAction
|
||||||
|
| UIOpenFileAction
|
||||||
|
| UIOpenSshUrlAction
|
||||||
|
| UIOpenHamburgerMenuAction
|
||||||
|
| UIWindowMinimizeAction
|
||||||
|
| UIWindowCloseAction
|
||||||
|
| UIEnterFullscreenAction
|
||||||
|
| UILeaveFullscreenAction
|
||||||
|
| UIContextmenuOpenAction
|
||||||
|
| UICommandExecAction;
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,15 @@
|
||||||
export const UPDATE_INSTALL = 'UPDATE_INSTALL';
|
export const UPDATE_INSTALL = 'UPDATE_INSTALL';
|
||||||
export const UPDATE_AVAILABLE = 'UPDATE_AVAILABLE';
|
export const UPDATE_AVAILABLE = 'UPDATE_AVAILABLE';
|
||||||
|
|
||||||
|
export interface UpdateInstallAction {
|
||||||
|
type: typeof UPDATE_INSTALL;
|
||||||
|
}
|
||||||
|
export interface UpdateAvailableAction {
|
||||||
|
type: typeof UPDATE_AVAILABLE;
|
||||||
|
version: string;
|
||||||
|
notes: string | null;
|
||||||
|
releaseUrl: string;
|
||||||
|
canInstall: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UpdateActions = UpdateInstallAction | UpdateAvailableAction;
|
||||||
|
|
|
||||||
20
lib/hyper.d.ts
vendored
20
lib/hyper.d.ts
vendored
|
|
@ -155,6 +155,26 @@ export type hyperPlugin = {
|
||||||
import rootReducer from './reducers/index';
|
import rootReducer from './reducers/index';
|
||||||
export type HyperState = ReturnType<typeof rootReducer>;
|
export type HyperState = ReturnType<typeof rootReducer>;
|
||||||
|
|
||||||
|
import {UIActions} from './constants/ui';
|
||||||
|
import {ConfigActions} from './constants/config';
|
||||||
|
import {SessionActions} from './constants/sessions';
|
||||||
|
import {NotificationActions} from './constants/notifications';
|
||||||
|
import {UpdateActions} from './constants/updater';
|
||||||
|
import {TermGroupActions} from './constants/term-groups';
|
||||||
|
import {InitActions} from './constants';
|
||||||
|
import {TabActions} from './constants/tabs';
|
||||||
|
|
||||||
|
export type HyperActions = (
|
||||||
|
| UIActions
|
||||||
|
| ConfigActions
|
||||||
|
| SessionActions
|
||||||
|
| NotificationActions
|
||||||
|
| UpdateActions
|
||||||
|
| TermGroupActions
|
||||||
|
| InitActions
|
||||||
|
| TabActions
|
||||||
|
) & {effect?: () => void};
|
||||||
|
|
||||||
type immutableRecord<T> = {[k in keyof T]: Immutable<T[k]>};
|
type immutableRecord<T> = {[k in keyof T]: Immutable<T[k]>};
|
||||||
|
|
||||||
export type TermsProps = {
|
export type TermsProps = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue