move typings into a separate directory

This commit is contained in:
Labhansh Agrawal 2023-07-25 15:09:51 +05:30
parent 33f7d2bad5
commit c62ed62752
56 changed files with 87 additions and 78 deletions

View file

@ -1,6 +1,6 @@
import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config';
import type {HyperActions} from '../hyper';
import type {configOptions} from '../config';
import type {HyperActions} from '../../typings/hyper';
import type {configOptions} from '../../typings/config';
export function loadConfig(config: configOptions): HyperActions {
return {

View file

@ -8,7 +8,7 @@ import {
} from '../constants/ui';
import rpc from '../rpc';
import {userExitTermGroup, setActiveGroup} from './term-groups';
import type {HyperDispatch} from '../hyper';
import type {HyperDispatch} from '../../typings/hyper';
export function closeTab(uid: string) {
return (dispatch: HyperDispatch) => {

View file

@ -1,6 +1,6 @@
import rpc from '../rpc';
import {INIT} from '../constants';
import type {HyperDispatch} from '../hyper';
import type {HyperDispatch} from '../../typings/hyper';
export default function init() {
return (dispatch: HyperDispatch) => {

View file

@ -1,5 +1,5 @@
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications';
import type {HyperActions} from '../hyper';
import type {HyperActions} from '../../typings/hyper';
export function dismissNotification(id: string): HyperActions {
return {

View file

@ -15,8 +15,8 @@ import {
SESSION_SET_XTERM_TITLE,
SESSION_SEARCH
} from '../constants/sessions';
import type {HyperState, HyperDispatch, HyperActions} from '../hyper';
import type {Session} from '../../common';
import type {HyperState, HyperDispatch, HyperActions} from '../../typings/hyper';
import type {Session} from '../../typings/common';
export function addSession({uid, shell, pid, cols = null, rows = null, splitDirection, activeUid, profile}: Session) {
return (dispatch: HyperDispatch, getState: () => HyperState) => {

View file

@ -10,7 +10,7 @@ import {SESSION_REQUEST} from '../constants/sessions';
import findBySession from '../utils/term-groups';
import {getRootGroups} from '../selectors';
import {setActiveSession, ptyExitSession, userExitSession} from './sessions';
import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../hyper';
import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../../typings/hyper';
function requestSplit(direction: 'VERTICAL' | 'HORIZONTAL') {
return (_activeUid: string | undefined, _profile: string | undefined) =>

View file

@ -28,7 +28,7 @@ import {
import {setActiveGroup} from './term-groups';
import type parseUrl from 'parse-url';
import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../hyper';
import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../../typings/hyper';
import type {Stats} from 'fs';
import {stat} from 'fs';

View file

@ -1,6 +1,6 @@
import {UPDATE_INSTALL, UPDATE_AVAILABLE} from '../constants/updater';
import rpc from '../rpc';
import type {HyperActions} from '../hyper';
import type {HyperActions} from '../../typings/hyper';
export function installUpdate(): HyperActions {
return {

View file

@ -1,5 +1,5 @@
import {ipcRenderer} from './utils/ipc';
import type {HyperDispatch} from './hyper';
import type {HyperDispatch} from '../typings/hyper';
import {closeSearch} from './actions/sessions';
let commands: Record<string, (event: any, dispatch: HyperDispatch) => void> = {

View file

@ -3,7 +3,7 @@ import React from 'react';
import {decorate, getTabsProps} from '../utils/plugins';
import Tabs_ from './tabs';
import type {HeaderProps} from '../hyper';
import type {HeaderProps} from '../../typings/hyper';
const Tabs = decorate(Tabs_, 'Tabs');

View file

@ -1,6 +1,6 @@
import React, {useRef, useState} from 'react';
import {VscChevronDown} from '@react-icons/all-files/vsc/VscChevronDown';
import type {configOptions} from '../config';
import type {configOptions} from '../../typings/config';
import useClickAway from 'react-use/lib/useClickAway';
interface Props {

View file

@ -1,5 +1,5 @@
import React, {forwardRef, useEffect, useRef, useState} from 'react';
import type {NotificationProps} from '../hyper';
import type {NotificationProps} from '../../typings/hyper';
const Notification = forwardRef<HTMLDivElement, React.PropsWithChildren<NotificationProps>>((props, ref) => {
const dismissTimer = useRef<NodeJS.Timeout | undefined>(undefined);

View file

@ -3,7 +3,7 @@ import React, {forwardRef} from 'react';
import {decorate} from '../utils/plugins';
import Notification_ from './notification';
import type {NotificationsProps} from '../hyper';
import type {NotificationsProps} from '../../typings/hyper';
const Notification = decorate(Notification_, 'Notification');

View file

@ -1,5 +1,5 @@
import React, {useCallback, useRef, useEffect, forwardRef} from 'react';
import type {SearchBoxProps} from '../hyper';
import type {SearchBoxProps} from '../../typings/hyper';
import {VscArrowUp} from '@react-icons/all-files/vsc/VscArrowUp';
import {VscArrowDown} from '@react-icons/all-files/vsc/VscArrowDown';
import {VscClose} from '@react-icons/all-files/vsc/VscClose';

View file

@ -1,6 +1,6 @@
import React from 'react';
import sum from 'lodash/sum';
import type {SplitPaneProps} from '../hyper';
import type {SplitPaneProps} from '../../typings/hyper';
export default class SplitPane extends React.PureComponent<
React.PropsWithChildren<SplitPaneProps>,

View file

@ -1,5 +1,5 @@
import React, {forwardRef} from 'react';
import type {StyleSheetProps} from '../hyper';
import type {StyleSheetProps} from '../../typings/hyper';
const StyleSheet = forwardRef<HTMLStyleElement, StyleSheetProps>((props, ref) => {
const {borderColor} = props;

View file

@ -1,5 +1,5 @@
import React, {forwardRef} from 'react';
import type {TabProps} from '../hyper';
import type {TabProps} from '../../typings/hyper';
const Tab = forwardRef<HTMLLIElement, TabProps>((props, ref) => {
const handleClick = (event: React.MouseEvent) => {

View file

@ -3,7 +3,7 @@ import React, {forwardRef} from 'react';
import {decorate, getTabProps} from '../utils/plugins';
import Tab_ from './tab';
import type {TabsProps} from '../hyper';
import type {TabsProps} from '../../typings/hyper';
import DropdownButton from './new-tab';
const Tab = decorate(Tab_, 'Tab');

View file

@ -4,7 +4,7 @@ import {decorate, getTermProps, getTermGroupProps} from '../utils/plugins';
import {resizeTermGroup} from '../actions/term-groups';
import Term_ from './term';
import SplitPane_ from './split-pane';
import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../hyper';
import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../../typings/hyper';
const Term = decorate(Term_, 'Term');
const SplitPane = decorate(SplitPane_, 'SplitPane');

View file

@ -14,7 +14,7 @@ import Color from 'color';
import terms from '../terms';
import processClipboard from '../utils/paste';
import _SearchBox from './searchBox';
import type {TermProps} from '../hyper';
import type {TermProps} from '../../typings/hyper';
import pickBy from 'lodash/pickBy';
import isEqual from 'lodash/isEqual';
import {decorate} from '../utils/plugins';

View file

@ -3,7 +3,7 @@ import {decorate, getTermGroupProps} from '../utils/plugins';
import {registerCommandHandlers} from '../command-registry';
import TermGroup_ from './term-group';
import StyleSheet_ from './style-sheet';
import type {TermsProps, HyperDispatch} from '../hyper';
import type {TermsProps, HyperDispatch} from '../../typings/hyper';
import type Term from './term';
import {ObjectTypedKeys} from '../utils/object';

242
lib/config.d.ts vendored
View file

@ -1,242 +0,0 @@
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[]>;
};

View file

@ -1,4 +1,4 @@
import type {configOptions} from '../config';
import type {configOptions} from '../../typings/config';
export const CONFIG_LOAD = 'CONFIG_LOAD';
export const CONFIG_RELOAD = 'CONFIG_RELOAD';

View file

@ -4,7 +4,7 @@ import Header from '../components/header';
import {closeTab, changeTab, maximize, openHamburgerMenu, unmaximize, minimize, close} from '../actions/header';
import {connect} from '../utils/plugins';
import {getRootGroups} from '../selectors';
import type {HyperState, HyperDispatch, ITab} from '../hyper';
import type {HyperState, HyperDispatch, ITab} from '../../typings/hyper';
import {requestTermGroup} from '../actions/term-groups';
const isMac = /Mac/.test(navigator.userAgent);

View file

@ -10,7 +10,7 @@ import stylis from 'stylis';
import {HeaderContainer} from './header';
import TermsContainer from './terms';
import NotificationsContainer from './notifications';
import type {HyperState, HyperProps, HyperDispatch} from '../hyper';
import type {HyperState, HyperProps, HyperDispatch} from '../../typings/hyper';
import type Terms from '../components/terms';
const isMac = /Mac/.test(navigator.userAgent);

View file

@ -2,7 +2,7 @@ import Notifications from '../components/notifications';
import {installUpdate} from '../actions/updater';
import {connect} from '../utils/plugins';
import {dismissNotification} from '../actions/notifications';
import type {HyperState, HyperDispatch} from '../hyper';
import type {HyperState, HyperDispatch} from '../../typings/hyper';
const mapStateToProps = (state: HyperState) => {
const {ui} = state;

View file

@ -11,7 +11,7 @@ import {
import {openContextMenu} from '../actions/ui';
import {getRootGroups} from '../selectors';
import type {HyperState, HyperDispatch} from '../hyper';
import type {HyperState, HyperDispatch} from '../../typings/hyper';
const mapStateToProps = (state: HyperState) => {
const {sessions} = state.sessions;

View file

@ -1,3 +0,0 @@
declare module 'php-escape-shell' {
export function php_escapeshellcmd(path: string): string;
}

403
lib/hyper.d.ts vendored
View file

@ -1,403 +0,0 @@
import type {Immutable} from 'seamless-immutable';
import type Client from './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 './constants/ui';
import type {ConfigActions} from './constants/config';
import type {SessionActions} from './constants/sessions';
import type {NotificationActions} from './constants/notifications';
import type {UpdateActions} from './constants/updater';
import type {TermGroupActions} from './constants/term-groups';
import type {InitActions} from './constants';
import type {TabActions} from './constants/tabs';
export type HyperActions = (
| UIActions
| ConfigActions
| SessionActions
| NotificationActions
| UpdateActions
| TermGroupActions
| InitActions
| TabActions
) & {effect?: () => void};
import type configureStore from './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 './containers/header';
export type HeaderProps = HeaderConnectedProps & extensionProps;
import type {HyperConnectedProps} from './containers/hyper';
export type HyperProps = HyperConnectedProps & extensionProps;
import type {NotificationsConnectedProps} from './containers/notifications';
export type NotificationsProps = NotificationsConnectedProps & extensionProps;
import type Terms from './components/terms';
import type {TermsConnectedProps} from './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 './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 './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>;

View file

@ -17,7 +17,7 @@ import {addNotificationMessage} from './actions/notifications';
import {loadConfig, reloadConfig} from './actions/config';
import HyperContainer from './containers/hyper';
import configureStore from './store/configure-store';
import type {configOptions} from './config';
import type {configOptions} from '../typings/config';
// On Linux, the default zoom was somehow changed with Electron 3 (or maybe 2).
// Setting zoom factor to 1.2 brings back the normal default size

View file

@ -3,7 +3,7 @@ import {combineReducers} from 'redux';
import ui from './ui';
import sessions from './sessions';
import termGroups from './term-groups';
import type {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../../typings/hyper';
export default combineReducers({
ui,

View file

@ -12,7 +12,7 @@ import {
SESSION_SET_CWD,
SESSION_SEARCH
} from '../constants/sessions';
import type {sessionState, session, Mutable, ISessionReducer} from '../hyper';
import type {sessionState, session, Mutable, ISessionReducer} from '../../typings/hyper';
const initialState: sessionState = Immutable<Mutable<sessionState>>({
sessions: {},

View file

@ -6,7 +6,7 @@ import type {SessionAddAction} from '../constants/sessions';
import {SESSION_ADD, SESSION_SET_ACTIVE} from '../constants/sessions';
import findBySession from '../utils/term-groups';
import {decorateTermGroupsReducer} from '../utils/plugins';
import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../hyper';
import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../../typings/hyper';
const MIN_SIZE = 0.05;
const initialState: ITermState = Immutable<Mutable<ITermState>>({

View file

@ -22,7 +22,7 @@ import {
SESSION_SET_CWD
} from '../constants/sessions';
import {UPDATE_AVAILABLE} from '../constants/updater';
import type {uiState, Mutable, IUiReducer} from '../hyper';
import type {uiState, Mutable, IUiReducer} from '../../typings/hyper';
import {release} from 'os';
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform) || process.platform === 'win32';

View file

@ -1,5 +1,5 @@
import {createSelector} from 'reselect';
import type {HyperState} from './hyper';
import type {HyperState} from '../typings/hyper';
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
export const getRootGroups = createSelector(getTermGroups, (termGroups) =>

View file

@ -6,7 +6,7 @@ import effects from '../utils/effects';
import * as plugins from '../utils/plugins';
import writeMiddleware from './write-middleware';
import {composeWithDevTools} from '@redux-devtools/extension';
import type {HyperState, HyperActions} from '../hyper';
import type {HyperState, HyperActions} from '../../typings/hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
export default () => {

View file

@ -5,7 +5,7 @@ import rootReducer from '../reducers/index';
import effects from '../utils/effects';
import * as plugins from '../utils/plugins';
import writeMiddleware from './write-middleware';
import type {HyperState, HyperActions} from '../hyper';
import type {HyperState, HyperActions} from '../../typings/hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
export default () =>

View file

@ -1,4 +1,4 @@
import type {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../../typings/hyper';
import terms from '../terms';
import type {Dispatch, Middleware} from 'redux';

View file

@ -1,5 +1,5 @@
import type {Dispatch, Middleware} from 'redux';
import type {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../../typings/hyper';
/**
* Simple redux middleware that executes
* the `effect` field if provided in an action

View file

@ -1,4 +1,4 @@
import {ipcRenderer as _ipc} from 'electron';
import type {IpcRendererWithCommands} from '../../common';
import type {IpcRendererWithCommands} from '../../typings/common';
export const ipcRenderer = _ipc as IpcRendererWithCommands;

View file

@ -28,7 +28,7 @@ import type {
TermProps,
Assignable,
HyperActions
} from '../hyper';
} from '../../typings/hyper';
import type {Dispatch, Middleware} from 'redux';
import {ObjectTypedKeys} from './object';
import IPCChildProcess from './ipc-child-process';

View file

@ -1,6 +1,12 @@
import {EventEmitter} from 'events';
import type {IpcRendererEvent} from 'electron';
import type {FilterNever, IpcRendererWithCommands, MainEvents, RendererEvents, TypedEmitter} from '../../common';
import type {
FilterNever,
IpcRendererWithCommands,
MainEvents,
RendererEvents,
TypedEmitter
} from '../../typings/common';
import {ipcRenderer} from './ipc';
export default class Client {

View file

@ -1,4 +1,4 @@
import type {ITermState} from '../hyper';
import type {ITermState} from '../../typings/hyper';
export default function findBySession(termGroupState: ITermState, sessionUid: string) {
const {termGroups} = termGroupState;