merge dev

This commit is contained in:
phyzical
2022-04-07 16:25:33 +08:00
176 changed files with 3905 additions and 3147 deletions
+4 -4
View File
@@ -3637,9 +3637,9 @@ export interface Sleeve {
* @param sleeveNumber - Index of the sleeve to work for the faction.
* @param factionName - Name of the faction to work for.
* @param factionWorkType - Name of the action to perform for this faction.
* @returns True if the sleeve started working on this faction, false otherwise.
* @returns True if the sleeve started working on this faction, false otherwise, can also throw on errors
*/
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: string): boolean;
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: string): boolean | undefined;
/**
* Set a sleeve to work for a company.
@@ -4642,7 +4642,7 @@ export interface NS extends Singularity {
* ```
* @returns
*/
sleep(millis: number): Promise<void>;
sleep(millis: number): Promise<true>;
/**
* Suspends the script for n milliseconds. Doesn't block with concurrent calls.
@@ -4652,7 +4652,7 @@ export interface NS extends Singularity {
* @param millis - Number of milliseconds to sleep.
* @returns
*/
asleep(millis: number): Promise<void>;
asleep(millis: number): Promise<true>;
/**
* Prints one or move values or variables to the scripts logs.
+1 -1
View File
@@ -1,4 +1,4 @@
export type WordWrapOptions = 'on' | 'off' | 'bounded' | 'wordWrapColumn';
export type WordWrapOptions = "on" | "off" | "bounded" | "wordWrapColumn";
export interface Options {
theme: string;
insertSpaces: boolean;
+30 -25
View File
@@ -235,7 +235,7 @@ export function Root(props: IProps): React.ReactElement {
MonacoVim.VimMode.Vim.mapCommand("gT", "action", "prevTabs", {}, { context: "normal" });
editor.focus();
});
} catch { }
} catch {}
} else if (!options.vim) {
// Whem vim mode is disabled
vimEditor?.dispose();
@@ -481,7 +481,7 @@ export function Root(props: IProps): React.ReactElement {
}
try {
infLoop(newCode);
} catch (err) { }
} catch (err) {}
}
function saveScript(scriptToSave: OpenScript): void {
@@ -794,11 +794,11 @@ export function Root(props: IProps): React.ReactElement {
setFilter(event.target.value);
}
function handleExpandSearch(): void {
setFilter("")
setSearchExpanded(!searchExpanded)
setFilter("");
setSearchExpanded(!searchExpanded);
}
const filteredOpenScripts = Object.values(openScripts).filter(
(script) => (script.hostname.includes(filter) || script.fileName.includes(filter))
(script) => script.hostname.includes(filter) || script.fileName.includes(filter),
);
// Toolbars are roughly 112px:
@@ -835,7 +835,7 @@ export function Root(props: IProps): React.ReactElement {
}}
>
<Tooltip title={"Search Open Scripts"}>
{searchExpanded ?
{searchExpanded ? (
<TextField
value={filter}
onChange={handleFilterChange}
@@ -843,9 +843,14 @@ export function Root(props: IProps): React.ReactElement {
InputProps={{
startAdornment: <SearchIcon />,
spellCheck: false,
endAdornment: <CloseIcon onClick={handleExpandSearch} />
endAdornment: <CloseIcon onClick={handleExpandSearch} />,
}}
/> : <Button onClick={handleExpandSearch} ><SearchIcon /></Button>}
/>
) : (
<Button onClick={handleExpandSearch}>
<SearchIcon />
</Button>
)}
</Tooltip>
{filteredOpenScripts.map(({ fileName, hostname }, index) => {
const iconButtonStyle = {
@@ -855,15 +860,15 @@ export function Root(props: IProps): React.ReactElement {
maxHeight: "38.5px",
...(currentScript?.fileName === filteredOpenScripts[index].fileName
? {
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
: {
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
}),
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
}),
};
const scriptTabText = `${hostname}:~/${fileName} ${dirty(index)}`;
@@ -896,19 +901,19 @@ export function Root(props: IProps): React.ReactElement {
}}
style={{
maxWidth: `${tabTextWidth}px`,
minHeight: '38.5px',
minHeight: "38.5px",
overflow: "hidden",
...(currentScript?.fileName === filteredOpenScripts[index].fileName
? {
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
background: Settings.theme.button,
borderColor: Settings.theme.button,
color: Settings.theme.primary,
}
: {
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
}),
background: Settings.theme.backgroundsecondary,
borderColor: Settings.theme.backgroundsecondary,
color: Settings.theme.secondary,
}),
}}
>
<span style={{ overflow: "hidden", direction: "rtl", textOverflow: "ellipsis" }}>
+4 -5
View File
@@ -260,7 +260,6 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
token: "ns",
foreground: "FFB86C",
fontStyle: "italic",
},
{
token: "netscriptfunction",
@@ -273,7 +272,7 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
{
token: "type.identifier.js",
foreground: "7EE9FD",
fontStyle: "italic"
fontStyle: "italic",
},
{
token: "delimiter.square.js",
@@ -281,7 +280,7 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
},
{
token: "delimiter.parenthesis.js",
foreground: "FFD709"
foreground: "FFD709",
},
{
token: "delimiter.bracket.js",
@@ -293,7 +292,7 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
fontStyle: "italic",
},
],
"colors": {
colors: {
"editor.foreground": "#F8F8F2",
"editor.background": "#282A36",
"editorLineNumber.foreground": "#6272A4",
@@ -402,6 +401,6 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
"scrollbarSlider.background": "#4E566680",
"scrollbarSlider.activeBackground": "#747D9180",
"scrollbarSlider.hoverBackground": "#5A637580",
}
},
});
}