diff --git a/.vscode/settings.json b/.vscode/settings.json index 8e110ef9bd..6f42af3c40 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "eslint.nodePath": "./tgui/.yarn/sdks", "eslint.workingDirectories": ["./tgui"], - "prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.js", + "prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.cjs", "typescript.tsdk": "./tgui/.yarn/sdks/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true, "search.exclude": { @@ -11,6 +11,9 @@ "workbench.editorAssociations": { "*.dmi": "imagePreview.previewEditor" }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, "files.eol": "\n", "files.encoding": "utf8", "files.insertFinalNewline": true, diff --git a/tgui/.prettierignore b/tgui/.prettierignore index c517b12e2e..73259d8a07 100644 --- a/tgui/.prettierignore +++ b/tgui/.prettierignore @@ -18,3 +18,6 @@ ## Build artifacts /public/.tmp/**/* /public/*.map + +## CHOMPEdit - Until removed +/packages/tgui_ch diff --git a/tgui/.prettierrc.yml b/tgui/.prettierrc.yml index 1eebe6098b..0176969226 100644 --- a/tgui/.prettierrc.yml +++ b/tgui/.prettierrc.yml @@ -1,15 +1 @@ -arrowParens: always -breakLongMethodChains: true -endOfLine: lf -importFormatting: oneline -jsxBracketSameLine: true -jsxSingleQuote: false -offsetTernaryExpressions: true -printWidth: 80 -proseWrap: preserve -quoteProps: preserve -semi: true singleQuote: true -tabWidth: 2 -trailingComma: es5 -useTabs: false diff --git a/tgui/.yarn/sdks/eslint/package.json b/tgui/.yarn/sdks/eslint/package.json index 744a773210..b29322a1ff 100644 --- a/tgui/.yarn/sdks/eslint/package.json +++ b/tgui/.yarn/sdks/eslint/package.json @@ -2,5 +2,8 @@ "name": "eslint", "version": "7.32.0-sdk", "main": "./lib/api.js", - "type": "commonjs" + "type": "commonjs", + "bin": { + "eslint": "./bin/eslint.js" + } } diff --git a/tgui/.yarn/sdks/prettier/index.cjs b/tgui/.yarn/sdks/prettier/index.cjs new file mode 100644 index 0000000000..d42808285a --- /dev/null +++ b/tgui/.yarn/sdks/prettier/index.cjs @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const { existsSync } = require(`fs`); +const { createRequire, createRequireFromPath } = require(`module`); +const { resolve } = require(`path`); + +const relPnpApiPath = '../../../.pnp.cjs'; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require prettier + require(absPnpApiPath).setup(); + } +} + +// Defer to the real prettier your application uses +module.exports = absRequire(`prettier`); diff --git a/tgui/.yarn/sdks/prettier/index.js b/tgui/.yarn/sdks/prettier/index.js deleted file mode 100644 index f6882d8097..0000000000 --- a/tgui/.yarn/sdks/prettier/index.js +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env node - -const {existsSync} = require(`fs`); -const {createRequire, createRequireFromPath} = require(`module`); -const {resolve} = require(`path`); - -const relPnpApiPath = "../../../.pnp.cjs"; - -const absPnpApiPath = resolve(__dirname, relPnpApiPath); -const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); - -if (existsSync(absPnpApiPath)) { - if (!process.versions.pnp) { - // Setup the environment to be able to require prettier/index.js - require(absPnpApiPath).setup(); - } -} - -// Defer to the real prettier/index.js your application uses -module.exports = absRequire(`prettier/index.js`); diff --git a/tgui/.yarn/sdks/prettier/package.json b/tgui/.yarn/sdks/prettier/package.json index 0cbd71ff32..c61f5117ba 100644 --- a/tgui/.yarn/sdks/prettier/package.json +++ b/tgui/.yarn/sdks/prettier/package.json @@ -1,6 +1,7 @@ { "name": "prettier", - "version": "0.19.0-sdk", - "main": "./index.js", - "type": "commonjs" + "version": "3.1.0-sdk", + "main": "./index.cjs", + "type": "commonjs", + "bin": "./bin/prettier.cjs" } diff --git a/tgui/.yarn/sdks/prettier/prettier.cjs b/tgui/.yarn/sdks/prettier/prettier.cjs new file mode 100644 index 0000000000..5efad688e7 --- /dev/null +++ b/tgui/.yarn/sdks/prettier/prettier.cjs @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire} = require(`module`); +const {resolve} = require(`path`); + +const relPnpApiPath = "../../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = createRequire(absPnpApiPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require prettier/bin/prettier.cjs + require(absPnpApiPath).setup(); + } +} + +// Defer to the real prettier/bin/prettier.cjs your application uses +module.exports = absRequire(`prettier/bin/prettier.cjs`); diff --git a/tgui/.yarn/sdks/typescript/lib/tsserver.js b/tgui/.yarn/sdks/typescript/lib/tsserver.js index 9f9f4d6f46..e1adb497b6 100644 --- a/tgui/.yarn/sdks/typescript/lib/tsserver.js +++ b/tgui/.yarn/sdks/typescript/lib/tsserver.js @@ -1,29 +1,31 @@ #!/usr/bin/env node -const {existsSync} = require(`fs`); -const {createRequire, createRequireFromPath} = require(`module`); -const {resolve} = require(`path`); +const { existsSync } = require(`fs`); +const { createRequire, createRequireFromPath } = require(`module`); +const { resolve } = require(`path`); -const relPnpApiPath = "../../../../.pnp.cjs"; +const relPnpApiPath = '../../../../.pnp.cjs'; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); -const moduleWrapper = tsserver => { +const moduleWrapper = (tsserver) => { if (!process.versions.pnp) { return tsserver; } - const {isAbsolute} = require(`path`); + const { isAbsolute } = require(`path`); const pnpApi = require(`pnpapi`); - const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//); - const isPortal = str => str.startsWith("portal:/"); - const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); + const isVirtual = (str) => str.match(/\/(\$\$virtual|__virtual__)\//); + const isPortal = (str) => str.startsWith('portal:/'); + const normalize = (str) => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); - const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => { - return `${locator.name}@${locator.reference}`; - })); + const dependencyTreeRoots = new Set( + pnpApi.getDependencyTreeRoots().map((locator) => { + return `${locator.name}@${locator.reference}`; + }) + ); // VSCode sends the zip paths to TS using the "zip://" prefix, that TS // doesn't understand. This layer makes sure to remove the protocol @@ -31,7 +33,11 @@ const moduleWrapper = tsserver => { function toEditorPath(str) { // We add the `zip:` prefix to both `.zip/` paths and virtual paths - if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) { + if ( + isAbsolute(str) && + !str.match(/^\^?(zip:|\/zip\/)/) && + (str.match(/\.zip\//) || isVirtual(str)) + ) { // We also take the opportunity to turn virtual paths into physical ones; // this makes it much easier to work with workspaces that list peer // dependencies, since otherwise Ctrl+Click would bring us to the virtual @@ -45,7 +51,11 @@ const moduleWrapper = tsserver => { const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str; if (resolved) { const locator = pnpApi.findPackageLocator(resolved); - if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) { + if ( + locator && + (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || + isPortal(locator.reference)) + ) { str = resolved; } } @@ -73,42 +83,58 @@ const moduleWrapper = tsserver => { // Before | ^/zip/c:/foo/bar.zip/package.json // After | ^/zip//c:/foo/bar.zip/package.json // - case `vscode <1.61`: { - str = `^zip:${str}`; - } break; + case `vscode <1.61`: + { + str = `^zip:${str}`; + } + break; - case `vscode <1.66`: { - str = `^/zip/${str}`; - } break; + case `vscode <1.66`: + { + str = `^/zip/${str}`; + } + break; - case `vscode <1.68`: { - str = `^/zip${str}`; - } break; + case `vscode <1.68`: + { + str = `^/zip${str}`; + } + break; - case `vscode`: { - str = `^/zip/${str}`; - } break; + case `vscode`: + { + str = `^/zip/${str}`; + } + break; // To make "go to definition" work, // We have to resolve the actual file system path from virtual path // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) - case `coc-nvim`: { - str = normalize(resolved).replace(/\.zip\//, `.zip::`); - str = resolve(`zipfile:${str}`); - } break; + case `coc-nvim`: + { + str = normalize(resolved).replace(/\.zip\//, `.zip::`); + str = resolve(`zipfile:${str}`); + } + break; // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server) // We have to resolve the actual file system path from virtual path, // everything else is up to neovim - case `neovim`: { - str = normalize(resolved).replace(/\.zip\//, `.zip::`); - str = `zipfile://${str}`; - } break; + case `neovim`: + { + str = normalize(resolved).replace(/\.zip\//, `.zip::`); + str = `zipfile://${str}`; + } + break; - default: { - str = `zip:${str}`; - } break; + default: + { + str = `zip:${str}`; + } + break; } + } else { + str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`); } } @@ -117,26 +143,35 @@ const moduleWrapper = tsserver => { function fromEditorPath(str) { switch (hostInfo) { - case `coc-nvim`: { - str = str.replace(/\.zip::/, `.zip/`); - // The path for coc-nvim is in format of //zipfile://.yarn/... - // So in order to convert it back, we use .* to match all the thing - // before `zipfile:` - return process.platform === `win32` - ? str.replace(/^.*zipfile:\//, ``) - : str.replace(/^.*zipfile:/, ``); - } break; + case `coc-nvim`: + { + str = str.replace(/\.zip::/, `.zip/`); + // The path for coc-nvim is in format of //zipfile://.yarn/... + // So in order to convert it back, we use .* to match all the thing + // before `zipfile:` + return process.platform === `win32` + ? str.replace(/^.*zipfile:\//, ``) + : str.replace(/^.*zipfile:/, ``); + } + break; - case `neovim`: { - str = str.replace(/\.zip::/, `.zip/`); - // The path for neovim is in format of zipfile:////.yarn/... - return str.replace(/^zipfile:\/\//, ``); - } break; + case `neovim`: + { + str = str.replace(/\.zip::/, `.zip/`); + // The path for neovim is in format of zipfile:////.yarn/... + return str.replace(/^zipfile:\/\//, ``); + } + break; case `vscode`: - default: { - return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`) - } break; + default: + { + return str.replace( + /^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, + process.platform === `win32` ? `` : `/` + ); + } + break; } } @@ -148,8 +183,9 @@ const moduleWrapper = tsserver => { // TypeScript already does local loads and if this code is running the user trusts the workspace // https://github.com/microsoft/vscode/issues/45856 const ConfiguredProject = tsserver.server.ConfiguredProject; - const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype; - ConfiguredProject.prototype.enablePluginsWithOptions = function() { + const { enablePluginsWithOptions: originalEnablePluginsWithOptions } = + ConfiguredProject.prototype; + ConfiguredProject.prototype.enablePluginsWithOptions = function () { this.projectService.allowLocalPluginLoads = true; return originalEnablePluginsWithOptions.apply(this, arguments); }; @@ -159,7 +195,8 @@ const moduleWrapper = tsserver => { // like an absolute path of ours and normalize it. const Session = tsserver.server.Session; - const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; + const { onMessage: originalOnMessage, send: originalSend } = + Session.prototype; let hostInfo = `unknown`; Object.assign(Session.prototype, { @@ -175,10 +212,12 @@ const moduleWrapper = tsserver => { ) { hostInfo = parsedMessage.arguments.hostInfo; if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) { - const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match( - // The RegExp from https://semver.org/ but without the caret at the start - /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ - ) ?? []).map(Number) + const [, major, minor] = ( + process.env.VSCODE_IPC_HOOK.match( + // The RegExp from https://semver.org/ but without the caret at the start + /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ + ) ?? [] + ).map(Number); if (major === 1) { if (minor < 61) { @@ -192,21 +231,31 @@ const moduleWrapper = tsserver => { } } - const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => { - return typeof value === 'string' ? fromEditorPath(value) : value; - }); + const processedMessageJSON = JSON.stringify( + parsedMessage, + (key, value) => { + return typeof value === 'string' ? fromEditorPath(value) : value; + } + ); return originalOnMessage.call( this, - isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON) + isStringMessage + ? processedMessageJSON + : JSON.parse(processedMessageJSON) ); }, send(/** @type {any} */ msg) { - return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => { - return typeof value === `string` ? toEditorPath(value) : value; - }))); - } + return originalSend.call( + this, + JSON.parse( + JSON.stringify(msg, (key, value) => { + return typeof value === `string` ? toEditorPath(value) : value; + }) + ) + ); + }, }); return tsserver; diff --git a/tgui/.yarn/sdks/typescript/lib/tsserverlibrary.js b/tgui/.yarn/sdks/typescript/lib/tsserverlibrary.js index 878b11946a..1fc12fde93 100644 --- a/tgui/.yarn/sdks/typescript/lib/tsserverlibrary.js +++ b/tgui/.yarn/sdks/typescript/lib/tsserverlibrary.js @@ -1,29 +1,31 @@ #!/usr/bin/env node -const {existsSync} = require(`fs`); -const {createRequire, createRequireFromPath} = require(`module`); -const {resolve} = require(`path`); +const { existsSync } = require(`fs`); +const { createRequire, createRequireFromPath } = require(`module`); +const { resolve } = require(`path`); -const relPnpApiPath = "../../../../.pnp.cjs"; +const relPnpApiPath = '../../../../.pnp.cjs'; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); -const moduleWrapper = tsserver => { +const moduleWrapper = (tsserver) => { if (!process.versions.pnp) { return tsserver; } - const {isAbsolute} = require(`path`); + const { isAbsolute } = require(`path`); const pnpApi = require(`pnpapi`); - const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//); - const isPortal = str => str.startsWith("portal:/"); - const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); + const isVirtual = (str) => str.match(/\/(\$\$virtual|__virtual__)\//); + const isPortal = (str) => str.startsWith('portal:/'); + const normalize = (str) => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); - const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => { - return `${locator.name}@${locator.reference}`; - })); + const dependencyTreeRoots = new Set( + pnpApi.getDependencyTreeRoots().map((locator) => { + return `${locator.name}@${locator.reference}`; + }) + ); // VSCode sends the zip paths to TS using the "zip://" prefix, that TS // doesn't understand. This layer makes sure to remove the protocol @@ -31,7 +33,11 @@ const moduleWrapper = tsserver => { function toEditorPath(str) { // We add the `zip:` prefix to both `.zip/` paths and virtual paths - if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) { + if ( + isAbsolute(str) && + !str.match(/^\^?(zip:|\/zip\/)/) && + (str.match(/\.zip\//) || isVirtual(str)) + ) { // We also take the opportunity to turn virtual paths into physical ones; // this makes it much easier to work with workspaces that list peer // dependencies, since otherwise Ctrl+Click would bring us to the virtual @@ -45,7 +51,11 @@ const moduleWrapper = tsserver => { const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str; if (resolved) { const locator = pnpApi.findPackageLocator(resolved); - if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) { + if ( + locator && + (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || + isPortal(locator.reference)) + ) { str = resolved; } } @@ -73,42 +83,58 @@ const moduleWrapper = tsserver => { // Before | ^/zip/c:/foo/bar.zip/package.json // After | ^/zip//c:/foo/bar.zip/package.json // - case `vscode <1.61`: { - str = `^zip:${str}`; - } break; + case `vscode <1.61`: + { + str = `^zip:${str}`; + } + break; - case `vscode <1.66`: { - str = `^/zip/${str}`; - } break; + case `vscode <1.66`: + { + str = `^/zip/${str}`; + } + break; - case `vscode <1.68`: { - str = `^/zip${str}`; - } break; + case `vscode <1.68`: + { + str = `^/zip${str}`; + } + break; - case `vscode`: { - str = `^/zip/${str}`; - } break; + case `vscode`: + { + str = `^/zip/${str}`; + } + break; // To make "go to definition" work, // We have to resolve the actual file system path from virtual path // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) - case `coc-nvim`: { - str = normalize(resolved).replace(/\.zip\//, `.zip::`); - str = resolve(`zipfile:${str}`); - } break; + case `coc-nvim`: + { + str = normalize(resolved).replace(/\.zip\//, `.zip::`); + str = resolve(`zipfile:${str}`); + } + break; // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server) // We have to resolve the actual file system path from virtual path, // everything else is up to neovim - case `neovim`: { - str = normalize(resolved).replace(/\.zip\//, `.zip::`); - str = `zipfile://${str}`; - } break; + case `neovim`: + { + str = normalize(resolved).replace(/\.zip\//, `.zip::`); + str = `zipfile://${str}`; + } + break; - default: { - str = `zip:${str}`; - } break; + default: + { + str = `zip:${str}`; + } + break; } + } else { + str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`); } } @@ -117,26 +143,35 @@ const moduleWrapper = tsserver => { function fromEditorPath(str) { switch (hostInfo) { - case `coc-nvim`: { - str = str.replace(/\.zip::/, `.zip/`); - // The path for coc-nvim is in format of //zipfile://.yarn/... - // So in order to convert it back, we use .* to match all the thing - // before `zipfile:` - return process.platform === `win32` - ? str.replace(/^.*zipfile:\//, ``) - : str.replace(/^.*zipfile:/, ``); - } break; + case `coc-nvim`: + { + str = str.replace(/\.zip::/, `.zip/`); + // The path for coc-nvim is in format of //zipfile://.yarn/... + // So in order to convert it back, we use .* to match all the thing + // before `zipfile:` + return process.platform === `win32` + ? str.replace(/^.*zipfile:\//, ``) + : str.replace(/^.*zipfile:/, ``); + } + break; - case `neovim`: { - str = str.replace(/\.zip::/, `.zip/`); - // The path for neovim is in format of zipfile:////.yarn/... - return str.replace(/^zipfile:\/\//, ``); - } break; + case `neovim`: + { + str = str.replace(/\.zip::/, `.zip/`); + // The path for neovim is in format of zipfile:////.yarn/... + return str.replace(/^zipfile:\/\//, ``); + } + break; case `vscode`: - default: { - return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`) - } break; + default: + { + return str.replace( + /^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, + process.platform === `win32` ? `` : `/` + ); + } + break; } } @@ -148,8 +183,9 @@ const moduleWrapper = tsserver => { // TypeScript already does local loads and if this code is running the user trusts the workspace // https://github.com/microsoft/vscode/issues/45856 const ConfiguredProject = tsserver.server.ConfiguredProject; - const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype; - ConfiguredProject.prototype.enablePluginsWithOptions = function() { + const { enablePluginsWithOptions: originalEnablePluginsWithOptions } = + ConfiguredProject.prototype; + ConfiguredProject.prototype.enablePluginsWithOptions = function () { this.projectService.allowLocalPluginLoads = true; return originalEnablePluginsWithOptions.apply(this, arguments); }; @@ -159,7 +195,8 @@ const moduleWrapper = tsserver => { // like an absolute path of ours and normalize it. const Session = tsserver.server.Session; - const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; + const { onMessage: originalOnMessage, send: originalSend } = + Session.prototype; let hostInfo = `unknown`; Object.assign(Session.prototype, { @@ -175,10 +212,12 @@ const moduleWrapper = tsserver => { ) { hostInfo = parsedMessage.arguments.hostInfo; if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) { - const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match( - // The RegExp from https://semver.org/ but without the caret at the start - /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ - ) ?? []).map(Number) + const [, major, minor] = ( + process.env.VSCODE_IPC_HOOK.match( + // The RegExp from https://semver.org/ but without the caret at the start + /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ + ) ?? [] + ).map(Number); if (major === 1) { if (minor < 61) { @@ -192,21 +231,31 @@ const moduleWrapper = tsserver => { } } - const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => { - return typeof value === 'string' ? fromEditorPath(value) : value; - }); + const processedMessageJSON = JSON.stringify( + parsedMessage, + (key, value) => { + return typeof value === 'string' ? fromEditorPath(value) : value; + } + ); return originalOnMessage.call( this, - isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON) + isStringMessage + ? processedMessageJSON + : JSON.parse(processedMessageJSON) ); }, send(/** @type {any} */ msg) { - return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => { - return typeof value === `string` ? toEditorPath(value) : value; - }))); - } + return originalSend.call( + this, + JSON.parse( + JSON.stringify(msg, (key, value) => { + return typeof value === `string` ? toEditorPath(value) : value; + }) + ) + ); + }, }); return tsserver; diff --git a/tgui/.yarn/sdks/typescript/lib/typescript.js b/tgui/.yarn/sdks/typescript/lib/typescript.js index cbdbf1500f..384f448c1f 100644 --- a/tgui/.yarn/sdks/typescript/lib/typescript.js +++ b/tgui/.yarn/sdks/typescript/lib/typescript.js @@ -1,20 +1,20 @@ #!/usr/bin/env node -const {existsSync} = require(`fs`); -const {createRequire, createRequireFromPath} = require(`module`); -const {resolve} = require(`path`); +const { existsSync } = require(`fs`); +const { createRequire, createRequireFromPath } = require(`module`); +const { resolve } = require(`path`); -const relPnpApiPath = "../../../../.pnp.cjs"; +const relPnpApiPath = '../../../../.pnp.cjs'; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { - // Setup the environment to be able to require typescript/lib/typescript.js + // Setup the environment to be able to require typescript require(absPnpApiPath).setup(); } } -// Defer to the real typescript/lib/typescript.js your application uses -module.exports = absRequire(`typescript/lib/typescript.js`); +// Defer to the real typescript your application uses +module.exports = absRequire(`typescript`); diff --git a/tgui/.yarn/sdks/typescript/package.json b/tgui/.yarn/sdks/typescript/package.json index ea85e133e8..9d77f1ac3a 100644 --- a/tgui/.yarn/sdks/typescript/package.json +++ b/tgui/.yarn/sdks/typescript/package.json @@ -2,5 +2,9 @@ "name": "typescript", "version": "4.3.5-sdk", "main": "./lib/typescript.js", - "type": "commonjs" + "type": "commonjs", + "bin": { + "tsc": "./bin/tsc", + "tsserver": "./bin/tsserver" + } } diff --git a/tgui/babel.config.js b/tgui/babel.config.js deleted file mode 100644 index 69a5a401cc..0000000000 --- a/tgui/babel.config.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file - * @copyright 2020 Aleksej Komarov - * @license MIT - */ - -const createBabelConfig = (options) => { - const { presets = [], plugins = [], removeConsole } = options; - return { - presets: [ - [ - require.resolve('@babel/preset-typescript'), - { - allowDeclareFields: true, - }, - ], - [ - require.resolve('@babel/preset-env'), - { - modules: 'commonjs', - useBuiltIns: 'entry', - corejs: '3.3.2', - spec: false, - loose: true, - targets: [], - }, - ], - [require.resolve('@babel/preset-react'), { runtime: 'automatic' }], - ...presets, - ].filter(Boolean), - plugins: [ - [ - require.resolve('@babel/plugin-transform-class-properties'), - { - loose: true, - }, - ], - require.resolve('@babel/plugin-transform-jscript'), - removeConsole && require.resolve('babel-plugin-transform-remove-console'), - require.resolve('common/string.babel-plugin.cjs'), - ...plugins, - ].filter(Boolean), - }; -}; - -module.exports = (api) => { - api.cache(true); - const mode = process.env.NODE_ENV; - return createBabelConfig({ mode }); -}; - -module.exports.createBabelConfig = createBabelConfig; diff --git a/tgui/bin/tgui_.ps1 b/tgui/bin/tgui_.ps1 new file mode 100644 index 0000000000..eb9c7a1a97 --- /dev/null +++ b/tgui/bin/tgui_.ps1 @@ -0,0 +1,177 @@ +## Copyright (c) 2020 Aleksej Komarov +## SPDX-License-Identifier: MIT + +## Initial set-up +## -------------------------------------------------------- + +## Enable strict mode and stop of first cmdlet error +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" +$PSDefaultParameterValues['*:ErrorAction'] = 'Stop' + +## Validates exit code of external commands +function Throw-On-Native-Failure { + if (-not $?) { + exit 1 + } +} + +## Normalize current directory +$basedir = Split-Path $MyInvocation.MyCommand.Path +$basedir = Resolve-Path "$($basedir)\.." +Set-Location $basedir +[Environment]::CurrentDirectory = $basedir + + +## Functions +## -------------------------------------------------------- + +function yarn { + $YarnRelease = Get-ChildItem -Filter ".yarn\releases\yarn-*.cjs" | Select-Object -First 1 + node ".yarn\releases\$YarnRelease" @Args + Throw-On-Native-Failure +} + +function Remove-Quiet { + Remove-Item -ErrorAction SilentlyContinue @Args +} + +function task-install { + yarn install +} + +## Runs webpack +function task-webpack { + yarn run webpack-cli @Args +} + +## Runs a development server +function task-dev-server { + yarn node --experimental-modules "packages/tgui-dev-server/index.js" @Args +} + +function task-bench { + yarn tgui:bench @Args +} + +function task-prettier { + yarn tgui:prettier @Args +} + +function task-prettify { + yarn prettier --write packages @Args +} + +## Run a linter through all packages +function task-lint { + yarn run tsc + Write-Output "tgui: type check passed" + yarn run eslint packages --ext ".js,.cjs,.ts,.tsx" @Args + Write-Output "tgui: eslint check passed" +} + +function task-test { + yarn run jest +} + +## Mr. Proper +function task-clean { + ## Build artifacts + Remove-Quiet -Recurse -Force "public\.tmp" + Remove-Quiet -Force "public\*.map" + Remove-Quiet -Force "public\*.hot-update.*" + ## Yarn artifacts + Remove-Quiet -Recurse -Force ".yarn\cache" + Remove-Quiet -Recurse -Force ".yarn\unplugged" + Remove-Quiet -Recurse -Force ".yarn\webpack" + Remove-Quiet -Force ".yarn\build-state.yml" + Remove-Quiet -Force ".yarn\install-state.gz" + Remove-Quiet -Force ".yarn\install-target" + Remove-Quiet -Force ".pnp.*" + ## NPM artifacts + Get-ChildItem -Path "." -Include "node_modules" -Recurse -File:$false | Remove-Item -Recurse -Force + Remove-Quiet -Force "package-lock.json" +} + + +## Main +## -------------------------------------------------------- + +if ($Args.Length -gt 0) { + if ($Args[0] -eq "--clean") { + task-clean + exit 0 + } + + if ($Args[0] -eq "--dev") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-dev-server @Rest + exit 0 + } + + if ($Args[0] -eq "--lint") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-lint @Rest + exit 0 + } + + if ($Args[0] -eq "--lint-harder") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-lint -c ".eslintrc-harder.yml" @Rest + exit 0 + } + + if ($Args[0] -eq "--fix") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-lint --fix @Rest + exit 0 + } + + if ($Args[0] -eq "--test") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-test @Rest + exit 0 + } + + if ($Args[0] -eq "--pretty") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-prettify + task-prettier + task-lint + task-webpack --mode=production + exit 0 + } + + ## Analyze the bundle + if ($Args[0] -eq "--analyze") { + task-install + task-webpack --mode=production --analyze + exit 0 + } + + if ($Args[0] -eq "--bench") { + $Rest = $Args | Select-Object -Skip 1 + task-install + task-bench --wait-on-error + exit 0 + } +} + +## Make a production webpack build +if ($Args.Length -eq 0) { + task-install + task-prettier + task-lint + task-webpack --mode=production + exit 0 +} + +## Run webpack with custom flags +task-install +task-webpack @Args diff --git a/tgui/package.json b/tgui/package.json index 4c9f50f979..1370aacc48 100644 --- a/tgui/package.json +++ b/tgui/package.json @@ -12,7 +12,7 @@ "tgui:build": "BROWSERSLIST_IGNORE_OLD_DATA=true webpack", "tgui:dev": "node --experimental-modules packages/tgui-dev-server/index.js", "tgui:lint": "eslint packages --ext .js,.cjs,.ts,.tsx", - "tgui:prettier": "prettierx --check .", + "tgui:prettier": "prettier --check .", "tgui:sonar": "eslint packages -c .eslintrc-sonar.yml", "tgui:test": "jest --watch", "tgui:test-simple": "CI=true jest --color", @@ -42,7 +42,7 @@ "jest-environment-jsdom": "^29.7.0", "jsdom": "^22.1.0", "mini-css-extract-plugin": "^2.7.6", - "prettier": "npm:prettierx@0.19.0", + "prettier": "^3.1.0", "sass": "^1.69.5", "sass-loader": "^13.3.2", "style-loader": "^3.3.3", diff --git a/tgui/packages/common/collections.ts b/tgui/packages/common/collections.ts index a005da7aa1..5bfcee8588 100644 --- a/tgui/packages/common/collections.ts +++ b/tgui/packages/common/collections.ts @@ -32,12 +32,12 @@ export const filter = }; type MapFunction = { - (iterateeFn: (value: T, index: number, collection: T[]) => U): ( - collection: T[] - ) => U[]; + ( + iterateeFn: (value: T, index: number, collection: T[]) => U, + ): (collection: T[]) => U[]; ( - iterateeFn: (value: T, index: K, collection: Record) => U + iterateeFn: (value: T, index: K, collection: Record) => U, ): (collection: Record) => U[]; }; @@ -75,7 +75,7 @@ export const map: MapFunction = */ export const filterMap = ( collection: T[], - iterateeFn: (value: T) => U | undefined + iterateeFn: (value: T) => U | undefined, ): U[] => { const finalCollection: U[] = []; @@ -261,7 +261,7 @@ export const zipWith = const binarySearch = ( getKey: (value: T) => U, collection: readonly T[], - inserting: T + inserting: T, ): number => { if (collection.length === 0) { return 0; diff --git a/tgui/packages/common/color.js b/tgui/packages/common/color.js index b59d82247a..59935931d8 100644 --- a/tgui/packages/common/color.js +++ b/tgui/packages/common/color.js @@ -30,7 +30,7 @@ export class Color { this.r - this.r * percent, this.g - this.g * percent, this.b - this.b * percent, - this.a + this.a, ); } @@ -48,7 +48,7 @@ Color.fromHex = (hex) => new Color( parseInt(hex.substr(1, 2), 16), parseInt(hex.substr(3, 2), 16), - parseInt(hex.substr(5, 2), 16) + parseInt(hex.substr(5, 2), 16), ); /** @@ -59,7 +59,7 @@ Color.lerp = (c1, c2, n) => (c2.r - c1.r) * n + c1.r, (c2.g - c1.g) * n + c1.g, (c2.b - c1.b) * n + c1.b, - (c2.a - c1.a) * n + c1.a + (c2.a - c1.a) * n + c1.a, ); /** diff --git a/tgui/packages/common/redux.test.ts b/tgui/packages/common/redux.test.ts index 2657d7b800..d4af99907c 100644 --- a/tgui/packages/common/redux.test.ts +++ b/tgui/packages/common/redux.test.ts @@ -1,4 +1,11 @@ -import { Action, applyMiddleware, combineReducers, createAction, createStore, Reducer } from './redux'; +import { + Action, + applyMiddleware, + combineReducers, + createAction, + createStore, + Reducer, +} from './redux'; // Dummy Reducer const counterReducer: Reducer> = (state = 0, action) => { @@ -31,7 +38,7 @@ describe('Redux implementation tests', () => { test('createStore with applyMiddleware works', () => { const store = createStore( counterReducer, - applyMiddleware(loggingMiddleware) + applyMiddleware(loggingMiddleware), ); expect(store.getState()).toBe(0); }); diff --git a/tgui/packages/common/redux.ts b/tgui/packages/common/redux.ts index 7b4999d93b..997cc1d2d6 100644 --- a/tgui/packages/common/redux.ts +++ b/tgui/packages/common/redux.ts @@ -6,7 +6,7 @@ export type Reducer = ( state: State | undefined, - action: ActionType + action: ActionType, ) => State; export type Store = { @@ -21,7 +21,7 @@ type MiddlewareAPI = { }; export type Middleware = ( - storeApi: MiddlewareAPI + storeApi: MiddlewareAPI, ) => (next: Dispatch) => Dispatch; export type Action = { @@ -33,7 +33,7 @@ export type AnyAction = Action & { }; export type Dispatch = ( - action: ActionType + action: ActionType, ) => void; type StoreEnhancer = (createStoreFunction: Function) => Function; @@ -48,7 +48,7 @@ type PreparedAction = { */ export const createStore = ( reducer: Reducer, - enhancer?: StoreEnhancer + enhancer?: StoreEnhancer, ): Store => { // Apply a store enhancer (applyMiddleware is one of them). if (enhancer) { @@ -90,14 +90,14 @@ export const applyMiddleware = ( ...middlewares: Middleware[] ): StoreEnhancer => { return ( - createStoreFunction: (reducer: Reducer, enhancer?: StoreEnhancer) => Store + createStoreFunction: (reducer: Reducer, enhancer?: StoreEnhancer) => Store, ) => { return (reducer, ...args): Store => { const store = createStoreFunction(reducer, ...args); let dispatch: Dispatch = () => { throw new Error( - 'Dispatching while constructing your middleware is not allowed.' + 'Dispatching while constructing your middleware is not allowed.', ); }; @@ -109,7 +109,7 @@ export const applyMiddleware = ( const chain = middlewares.map((middleware) => middleware(storeApi)); dispatch = chain.reduceRight( (next, middleware) => middleware(next), - store.dispatch + store.dispatch, ); return { @@ -129,7 +129,7 @@ export const applyMiddleware = ( * is also more flexible than the redux counterpart. */ export const combineReducers = ( - reducersObj: Record + reducersObj: Record, ): Reducer => { const keys = Object.keys(reducersObj); @@ -170,7 +170,7 @@ export const combineReducers = ( */ export const createAction = ( type: TAction, - prepare?: (...args: any[]) => PreparedAction + prepare?: (...args: any[]) => PreparedAction, ) => { const actionCreator = (...args: any[]) => { let action: Action & PreparedAction = { type }; diff --git a/tgui/packages/common/timer.ts b/tgui/packages/common/timer.ts index 49d3648420..1fc3e11fd3 100644 --- a/tgui/packages/common/timer.ts +++ b/tgui/packages/common/timer.ts @@ -13,7 +13,7 @@ export const debounce = any>( fn: F, time: number, - immediate = false + immediate = false, ): ((...args: Parameters) => void) => { let timeout: ReturnType | null; return (...args: Parameters) => { @@ -38,7 +38,7 @@ export const debounce = any>( */ export const throttle = any>( fn: F, - time: number + time: number, ): ((...args: Parameters) => void) => { let previouslyRun: number | null, queuedToRun: ReturnType | null; @@ -53,7 +53,7 @@ export const throttle = any>( } else { queuedToRun = setTimeout( () => invokeFn(...args), - time - (now - (previouslyRun ?? 0)) + time - (now - (previouslyRun ?? 0)), ); } }; diff --git a/tgui/packages/tgui-bench/lib/benchmark.d.ts b/tgui/packages/tgui-bench/lib/benchmark.d.ts index 7f3310005f..3eac568d41 100644 --- a/tgui/packages/tgui-bench/lib/benchmark.d.ts +++ b/tgui/packages/tgui-bench/lib/benchmark.d.ts @@ -27,7 +27,7 @@ declare class Benchmark { static reduce( arr: T[], callback: (accumulator: K, value: T) => K, - thisArg?: any + thisArg?: any, ): K; static options: Benchmark.Options; diff --git a/tgui/packages/tgui-bench/lib/benchmark.js b/tgui/packages/tgui-bench/lib/benchmark.js index 33a645f294..5cb8b15f59 100644 --- a/tgui/packages/tgui-bench/lib/benchmark.js +++ b/tgui/packages/tgui-bench/lib/benchmark.js @@ -15,8 +15,8 @@ module.exports = function () { /** Used to determine if values are of the language type Object. */ var objectTypes = { - 'function': true, - 'object': true, + function: true, + object: true, }; /** Used as a reference to the global object. */ @@ -58,11 +58,11 @@ module.exports = function () { /** Used to avoid hz of Infinity. */ var divisors = { - '1': 4096, - '2': 512, - '3': 64, - '4': 8, - '5': 0, + 1: 4096, + 2: 512, + 3: 64, + 4: 8, + 5: 0, }; /** @@ -70,37 +70,37 @@ module.exports = function () { * For more info see http://www.itl.nist.gov/div898/handbook/eda/section3/eda3672.htm. */ var tTable = { - '1': 12.706, - '2': 4.303, - '3': 3.182, - '4': 2.776, - '5': 2.571, - '6': 2.447, - '7': 2.365, - '8': 2.306, - '9': 2.262, - '10': 2.228, - '11': 2.201, - '12': 2.179, - '13': 2.16, - '14': 2.145, - '15': 2.131, - '16': 2.12, - '17': 2.11, - '18': 2.101, - '19': 2.093, - '20': 2.086, - '21': 2.08, - '22': 2.074, - '23': 2.069, - '24': 2.064, - '25': 2.06, - '26': 2.056, - '27': 2.052, - '28': 2.048, - '29': 2.045, - '30': 2.042, - 'infinity': 1.96, + 1: 12.706, + 2: 4.303, + 3: 3.182, + 4: 2.776, + 5: 2.571, + 6: 2.447, + 7: 2.365, + 8: 2.306, + 9: 2.262, + 10: 2.228, + 11: 2.201, + 12: 2.179, + 13: 2.16, + 14: 2.145, + 15: 2.131, + 16: 2.12, + 17: 2.11, + 18: 2.101, + 19: 2.093, + 20: 2.086, + 21: 2.08, + 22: 2.074, + 23: 2.069, + 24: 2.064, + 25: 2.06, + 26: 2.056, + 27: 2.052, + 28: 2.048, + 29: 2.045, + 30: 2.042, + infinity: 1.96, }; /** @@ -108,61 +108,61 @@ module.exports = function () { * For more info see http://www.saburchill.com/IBbiology/stats/003.html. */ var uTable = { - '5': [0, 1, 2], - '6': [1, 2, 3, 5], - '7': [1, 3, 5, 6, 8], - '8': [2, 4, 6, 8, 10, 13], - '9': [2, 4, 7, 10, 12, 15, 17], - '10': [3, 5, 8, 11, 14, 17, 20, 23], - '11': [3, 6, 9, 13, 16, 19, 23, 26, 30], - '12': [4, 7, 11, 14, 18, 22, 26, 29, 33, 37], - '13': [4, 8, 12, 16, 20, 24, 28, 33, 37, 41, 45], - '14': [5, 9, 13, 17, 22, 26, 31, 36, 40, 45, 50, 55], - '15': [5, 10, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59, 64], - '16': [6, 11, 15, 21, 26, 31, 37, 42, 47, 53, 59, 64, 70, 75], - '17': [6, 11, 17, 22, 28, 34, 39, 45, 51, 57, 63, 67, 75, 81, 87], - '18': [7, 12, 18, 24, 30, 36, 42, 48, 55, 61, 67, 74, 80, 86, 93, 99], - '19': [7, 13, 19, 25, 32, 38, 45, 52, 58, 65, 72, 78, 85, 92, 99, 106, 113], - '20': [ + 5: [0, 1, 2], + 6: [1, 2, 3, 5], + 7: [1, 3, 5, 6, 8], + 8: [2, 4, 6, 8, 10, 13], + 9: [2, 4, 7, 10, 12, 15, 17], + 10: [3, 5, 8, 11, 14, 17, 20, 23], + 11: [3, 6, 9, 13, 16, 19, 23, 26, 30], + 12: [4, 7, 11, 14, 18, 22, 26, 29, 33, 37], + 13: [4, 8, 12, 16, 20, 24, 28, 33, 37, 41, 45], + 14: [5, 9, 13, 17, 22, 26, 31, 36, 40, 45, 50, 55], + 15: [5, 10, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59, 64], + 16: [6, 11, 15, 21, 26, 31, 37, 42, 47, 53, 59, 64, 70, 75], + 17: [6, 11, 17, 22, 28, 34, 39, 45, 51, 57, 63, 67, 75, 81, 87], + 18: [7, 12, 18, 24, 30, 36, 42, 48, 55, 61, 67, 74, 80, 86, 93, 99], + 19: [7, 13, 19, 25, 32, 38, 45, 52, 58, 65, 72, 78, 85, 92, 99, 106, 113], + 20: [ 8, 14, 20, 27, 34, 41, 48, 55, 62, 69, 76, 83, 90, 98, 105, 112, 119, 127, ], - '21': [ + 21: [ 8, 15, 22, 29, 36, 43, 50, 58, 65, 73, 80, 88, 96, 103, 111, 119, 126, 134, 142, ], - '22': [ + 22: [ 9, 16, 23, 30, 38, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125, 133, 141, 150, 158, ], - '23': [ + 23: [ 9, 17, 24, 32, 40, 48, 56, 64, 73, 81, 89, 98, 106, 115, 123, 132, 140, 149, 157, 166, 175, ], - '24': [ + 24: [ 10, 17, 25, 33, 42, 50, 59, 67, 76, 85, 94, 102, 111, 120, 129, 138, 147, 156, 165, 174, 183, 192, ], - '25': [ + 25: [ 10, 18, 27, 35, 44, 53, 62, 71, 80, 89, 98, 107, 117, 126, 135, 145, 154, 163, 173, 182, 192, 201, 211, ], - '26': [ + 26: [ 11, 19, 28, 37, 46, 55, 64, 74, 83, 93, 102, 112, 122, 132, 141, 151, 161, 171, 181, 191, 200, 210, 220, 230, ], - '27': [ + 27: [ 11, 20, 29, 38, 48, 57, 67, 77, 87, 97, 107, 118, 125, 138, 147, 158, 168, 178, 188, 199, 209, 219, 230, 240, 250, ], - '28': [ + 28: [ 12, 21, 30, 40, 50, 60, 70, 80, 90, 101, 111, 122, 132, 143, 154, 164, 175, 186, 196, 207, 218, 228, 239, 250, 261, 272, ], - '29': [ + 29: [ 13, 22, 32, 42, 52, 62, 73, 83, 94, 105, 116, 127, 138, 149, 160, 171, 182, 193, 204, 215, 226, 238, 249, 260, 271, 282, 294, ], - '30': [ + 30: [ 13, 23, 33, 43, 54, 65, 76, 87, 98, 109, 120, 131, 143, 154, 166, 177, 189, 200, 212, 223, 235, 247, 258, 270, 282, 293, 305, 317, ], @@ -285,12 +285,12 @@ module.exports = function () { ( 'return (' + function (x) { - return { 'x': '' + (1 + x) + '', 'y': 0 }; + return { x: '' + (1 + x) + '', y: 0 }; } + ')' ) // Avoid issues with code added by Istanbul. - .replace(/__cov__[^;]+;/g, '') + .replace(/__cov__[^;]+;/g, ''), )()(0).x === '1'; } catch (e) { support.decompilation = false; @@ -311,7 +311,7 @@ module.exports = function () { * @memberOf timer * @type {Function|Object} */ - 'ns': Date, + ns: Date, /** * Starts the deferred timer. @@ -320,7 +320,7 @@ module.exports = function () { * @memberOf timer * @param {Object} deferred The deferred instance. */ - 'start': null, // Lazy defined in `clock()`. + start: null, // Lazy defined in `clock()`. /** * Stops the deferred timer. @@ -329,7 +329,7 @@ module.exports = function () { * @memberOf timer * @param {Object} deferred The deferred instance. */ - 'stop': null, // Lazy defined in `clock()`. + stop: null, // Lazy defined in `clock()`. }; /*------------------------------------------------------------------------*/ @@ -478,10 +478,10 @@ module.exports = function () { } return event instanceof Event ? _.assign( - event, - { 'timeStamp': _.now() }, - typeof type == 'string' ? { 'type': type } : type - ) + event, + { timeStamp: _.now() }, + typeof type == 'string' ? { type: type } : type, + ) : new Event(type); } @@ -584,7 +584,7 @@ module.exports = function () { args + '){' + body + - '}' + '}', ); result = anchor[prop]; delete anchor[prop]; @@ -672,7 +672,7 @@ module.exports = function () { // Detect strings containing only the "use strict" directive. return /^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test( - result + result, ) ? '' : result; @@ -772,7 +772,7 @@ module.exports = function () { options = object.options = _.assign( {}, cloneDeep(object.constructor.options), - cloneDeep(options) + cloneDeep(options), ); _.forOwn(options, function (value, key) { @@ -927,11 +927,11 @@ module.exports = function () { bench, queued, index = -1, - eventProps = { 'currentTarget': benches }, + eventProps = { currentTarget: benches }, options = { - 'onStart': _.noop, - 'onCycle': _.noop, - 'onComplete': _.noop, + onStart: _.noop, + onCycle: _.noop, + onComplete: _.noop, }, result = _.toArray(benches); @@ -1167,7 +1167,7 @@ module.exports = function () { function add(name, fn, options) { var suite = this, bench = new Benchmark(name, fn, options), - event = Event({ 'type': 'add', 'target': bench }); + event = Event({ type: 'add', target: bench }); if ((suite.emit(event), !event.cancelled)) { suite.push(bench); @@ -1269,21 +1269,21 @@ module.exports = function () { options || (options = {}); invoke(suite, { - 'name': 'run', - 'args': options, - 'queued': options.queued, - 'onStart': function (event) { + name: 'run', + args: options, + queued: options.queued, + onStart: function (event) { suite.emit(event); }, - 'onCycle': function (event) { + onCycle: function (event) { var bench = event.target; if (bench.error) { - suite.emit({ 'type': 'error', 'target': bench }); + suite.emit({ type: 'error', target: bench }); } suite.emit(event); event.aborted = suite.aborted; }, - 'onComplete': function (event) { + onComplete: function (event) { suite.running = false; suite.emit(event); }, @@ -1415,7 +1415,7 @@ module.exports = function () { _.each(type.split(' '), function (type) { (_.has(events, type) ? events[type] : (events[type] = [])).push( - listener + listener, ); }); return object; @@ -1476,7 +1476,7 @@ module.exports = function () { result.options = _.assign( {}, cloneDeep(bench.options), - cloneDeep(options) + cloneDeep(options), ); // Copy own custom properties. @@ -1521,7 +1521,7 @@ module.exports = function () { function (total, xB) { return total + (xB > xA ? 0 : xB < xA ? 1 : 0.5); }, - 0 + 0, ); } @@ -1531,7 +1531,7 @@ module.exports = function () { function (total, xA) { return total + getScore(xA, sampleB); }, - 0 + 0, ); } @@ -1577,11 +1577,11 @@ module.exports = function () { // A non-recursive solution to check if properties have changed. // For more information see http://www.jslab.dk/articles/non.recursive.preorder.traversal.part4. var data = { - 'destination': bench, - 'source': _.assign( + destination: bench, + source: _.assign( {}, cloneDeep(bench.constructor.prototype), - cloneDeep(bench.options) + cloneDeep(bench.options), ), }; @@ -1615,12 +1615,12 @@ module.exports = function () { // Register a changed object. if (changed) { changes.push({ - 'destination': destination, - 'key': key, - 'value': currValue, + destination: destination, + key: key, + value: currValue, }); } - queue.push({ 'destination': currValue, 'source': value }); + queue.push({ destination: currValue, source: value }); } // Register a changed primitive. else if ( @@ -1628,9 +1628,9 @@ module.exports = function () { !(value == null || _.isFunction(value)) ) { changes.push({ - 'destination': destination, - 'key': key, - 'value': value, + destination: destination, + key: key, + value: value, }); } }); @@ -1674,7 +1674,7 @@ module.exports = function () { } else { // Error#name and Error#message properties are non-enumerable. errorStr = join( - _.assign({ 'name': error.name, 'message': error.message }, error) + _.assign({ name: error.name, message: error.message }, error), ); } result += ': ' + errorStr; @@ -1706,9 +1706,7 @@ module.exports = function () { function clock() { var options = Benchmark.options, templateData = {}, - timers = [ - { 'ns': timer.ns, 'res': max(0.0015, getRes('ms')), 'unit': 'ms' }, - ]; + timers = [{ ns: timer.ns, res: max(0.0015, getRes('ms')), unit: 'ms' }]; // Lazy define for hi-res timers. clock = function (clone) { @@ -1740,20 +1738,20 @@ module.exports = function () { // to avoid potential engine optimizations enabled over the life of the test. var funcBody = deferred ? 'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;' + - // When `deferred.cycles` is `0` then... - 'if(!d#.cycles){' + - // set `deferred.fn`, - 'd#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};' + - // set `deferred.teardown`, - 'd#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};' + - // execute the benchmark's `setup`, - 'if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};' + - // start timer, - 't#.start(d#);' + - // and then execute `deferred.fn` and return a dummy object. - '}d#.fn();return{uid:"${uid}"}' + // When `deferred.cycles` is `0` then... + 'if(!d#.cycles){' + + // set `deferred.fn`, + 'd#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};' + + // set `deferred.teardown`, + 'd#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};' + + // execute the benchmark's `setup`, + 'if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};' + + // start timer, + 't#.start(d#);' + + // and then execute `deferred.fn` and return a dummy object. + '}d#.fn();return{uid:"${uid}"}' : 'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};' + - 'while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}'; + 'while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}'; var compiled = (bench.compiled = @@ -1768,7 +1766,7 @@ module.exports = function () { throw new Error( 'The test "' + name + - '" is empty. This may be the result of dead code removal.' + '" is empty. This may be the result of dead code removal.', ); } else if (!deferred) { // Pretest to determine if compiled code exits early, usually by a @@ -1833,14 +1831,14 @@ module.exports = function () { templateData.uid = uid + uidCounter++; _.assign(templateData, { - 'setup': decompilable + setup: decompilable ? getSource(bench.setup) : interpolate('m#.setup()'), - 'fn': decompilable + fn: decompilable ? getSource(fn) : interpolate('m#.fn(' + fnArg + ')'), - 'fnArg': fnArg, - 'teardown': decompilable + fnArg: fnArg, + teardown: decompilable ? getSource(bench.teardown) : interpolate('m#.teardown()'), }); @@ -1848,48 +1846,48 @@ module.exports = function () { // Use API of chosen timer. if (timer.unit == 'ns') { _.assign(templateData, { - 'begin': interpolate('s#=n#()'), - 'end': interpolate('r#=n#(s#);r#=r#[0]+(r#[1]/1e9)'), + begin: interpolate('s#=n#()'), + end: interpolate('r#=n#(s#);r#=r#[0]+(r#[1]/1e9)'), }); } else if (timer.unit == 'us') { if (timer.ns.stop) { _.assign(templateData, { - 'begin': interpolate('s#=n#.start()'), - 'end': interpolate('r#=n#.microseconds()/1e6'), + begin: interpolate('s#=n#.start()'), + end: interpolate('r#=n#.microseconds()/1e6'), }); } else { _.assign(templateData, { - 'begin': interpolate('s#=n#()'), - 'end': interpolate('r#=(n#()-s#)/1e6'), + begin: interpolate('s#=n#()'), + end: interpolate('r#=(n#()-s#)/1e6'), }); } } else if (timer.ns.now) { _.assign(templateData, { - 'begin': interpolate('s#=n#.now()'), - 'end': interpolate('r#=(n#.now()-s#)/1e3'), + begin: interpolate('s#=n#.now()'), + end: interpolate('r#=(n#.now()-s#)/1e3'), }); } else { _.assign(templateData, { - 'begin': interpolate('s#=new n#().getTime()'), - 'end': interpolate('r#=(new n#().getTime()-s#)/1e3'), + begin: interpolate('s#=new n#().getTime()'), + end: interpolate('r#=(new n#().getTime()-s#)/1e3'), }); } // Define `timer` methods. timer.start = createFunction( interpolate('o#'), - interpolate('var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#') + interpolate('var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#'), ); timer.stop = createFunction( interpolate('o#'), - interpolate('var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#') + interpolate('var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#'), ); // Create compiled test. return createFunction( interpolate('window,t#'), 'var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n' + - interpolate(body) + interpolate(body), ); } @@ -1947,7 +1945,7 @@ module.exports = function () { function interpolate(string) { // Replaces all occurrences of `#` with a unique number and template tokens with content. return _.template(string.replace(/\#/g, /\d+/.exec(templateData.uid)))( - templateData + templateData, ); } @@ -1958,7 +1956,7 @@ module.exports = function () { // line switch in at least Chrome 7 to use chrome.Interval try { if ((timer.ns = new (context.chrome || context.chromium).Interval())) { - timers.push({ 'ns': timer.ns, 'res': getRes('us'), 'unit': 'us' }); + timers.push({ ns: timer.ns, res: getRes('us'), unit: 'us' }); } } catch (e) {} @@ -1967,7 +1965,7 @@ module.exports = function () { processObject && typeof (timer.ns = processObject.hrtime) == 'function' ) { - timers.push({ 'ns': timer.ns, 'res': getRes('ns'), 'unit': 'ns' }); + timers.push({ ns: timer.ns, res: getRes('ns'), unit: 'ns' }); } // Pick timer with highest resolution. timer = _.minBy(timers, 'res'); @@ -2007,14 +2005,14 @@ module.exports = function () { function enqueue() { queue.push( bench.clone({ - '_original': bench, - 'events': { - 'abort': [update], - 'cycle': [update], - 'error': [update], - 'start': [update], + _original: bench, + events: { + abort: [update], + cycle: [update], + error: [update], + start: [update], }, - }) + }), ); } @@ -2096,12 +2094,12 @@ module.exports = function () { rme = (moe / mean) * 100 || 0; _.assign(bench.stats, { - 'deviation': sd, - 'mean': mean, - 'moe': moe, - 'rme': rme, - 'sem': sem, - 'variance': variance, + deviation: sd, + mean: mean, + moe: moe, + rme: rme, + sem: sem, + variance: variance, }); // Abort the cycle loop when the minimum sample size has been collected @@ -2133,11 +2131,11 @@ module.exports = function () { // Init queue and begin. enqueue(); invoke(queue, { - 'name': 'run', - 'args': { 'async': async }, - 'queued': true, - 'onCycle': evaluate, - 'onComplete': function () { + name: 'run', + args: { async: async }, + queued: true, + onCycle: evaluate, + onComplete: function () { bench.emit('complete'); }, }); @@ -2277,7 +2275,7 @@ module.exports = function () { if (!event.cancelled) { options = { - 'async': + async: ((options = options && options.async) == null ? bench.async : options) && support.timeout, @@ -2315,7 +2313,7 @@ module.exports = function () { * @memberOf Benchmark * @type Object */ - 'options': { + options: { /** * A flag to indicate that benchmark cycles will execute asynchronously * by default. @@ -2323,7 +2321,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type boolean */ - 'async': false, + async: false, /** * A flag to indicate that the benchmark clock is deferred. @@ -2331,14 +2329,14 @@ module.exports = function () { * @memberOf Benchmark.options * @type boolean */ - 'defer': false, + defer: false, /** * The delay between test cycles (secs). * @memberOf Benchmark.options * @type number */ - 'delay': 0.005, + delay: 0.005, /** * Displayed by `Benchmark#toString` when a `name` is not available @@ -2347,7 +2345,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type string */ - 'id': undefined, + id: undefined, /** * The default number of times to execute a test on a benchmark's first cycle. @@ -2355,7 +2353,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type number */ - 'initCount': 1, + initCount: 1, /** * The maximum time a benchmark is allowed to run before finishing (secs). @@ -2365,7 +2363,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type number */ - 'maxTime': 5, + maxTime: 5, /** * The minimum sample size required to perform statistical analysis. @@ -2373,7 +2371,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type number */ - 'minSamples': 5, + minSamples: 5, /** * The time needed to reduce the percent uncertainty of measurement to 1% (secs). @@ -2381,7 +2379,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type number */ - 'minTime': 0, + minTime: 0, /** * The name of the benchmark. @@ -2389,7 +2387,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type string */ - 'name': undefined, + name: undefined, /** * An event listener called when the benchmark is aborted. @@ -2397,7 +2395,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type Function */ - 'onAbort': undefined, + onAbort: undefined, /** * An event listener called when the benchmark completes running. @@ -2405,7 +2403,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type Function */ - 'onComplete': undefined, + onComplete: undefined, /** * An event listener called after each run cycle. @@ -2413,7 +2411,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type Function */ - 'onCycle': undefined, + onCycle: undefined, /** * An event listener called when a test errors. @@ -2421,7 +2419,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type Function */ - 'onError': undefined, + onError: undefined, /** * An event listener called when the benchmark is reset. @@ -2429,7 +2427,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type Function */ - 'onReset': undefined, + onReset: undefined, /** * An event listener called when the benchmark starts running. @@ -2437,7 +2435,7 @@ module.exports = function () { * @memberOf Benchmark.options * @type Function */ - 'onStart': undefined, + onStart: undefined, }, /** @@ -2448,18 +2446,18 @@ module.exports = function () { * @memberOf Benchmark * @type Object */ - 'platform': context.platform || + platform: context.platform || require('platform') || { - 'description': + description: (context.navigator && context.navigator.userAgent) || null, - 'layout': null, - 'product': null, - 'name': null, - 'manufacturer': null, - 'os': null, - 'prerelease': null, - 'version': null, - 'toString': function () { + layout: null, + product: null, + name: null, + manufacturer: null, + os: null, + prerelease: null, + version: null, + toString: function () { return this.description || ''; }, }, @@ -2471,16 +2469,16 @@ module.exports = function () { * @memberOf Benchmark * @type string */ - 'version': '2.1.2', + version: '2.1.2', }); _.assign(Benchmark, { - 'filter': filter, - 'formatNumber': formatNumber, - 'invoke': invoke, - 'join': join, - 'runInContext': runInContext, - 'support': support, + filter: filter, + formatNumber: formatNumber, + invoke: invoke, + join: join, + runInContext: runInContext, + support: support, }); // Add lodash methods to Benchmark. @@ -2488,7 +2486,7 @@ module.exports = function () { ['each', 'forEach', 'forOwn', 'has', 'indexOf', 'map', 'reduce'], function (methodName) { Benchmark[methodName] = _[methodName]; - } + }, ); /*------------------------------------------------------------------------*/ @@ -2500,7 +2498,7 @@ module.exports = function () { * @memberOf Benchmark * @type number */ - 'count': 0, + count: 0, /** * The number of cycles performed while benchmarking. @@ -2508,7 +2506,7 @@ module.exports = function () { * @memberOf Benchmark * @type number */ - 'cycles': 0, + cycles: 0, /** * The number of executions per second. @@ -2516,7 +2514,7 @@ module.exports = function () { * @memberOf Benchmark * @type number */ - 'hz': 0, + hz: 0, /** * The compiled test function. @@ -2524,7 +2522,7 @@ module.exports = function () { * @memberOf Benchmark * @type {Function|string} */ - 'compiled': undefined, + compiled: undefined, /** * The error object if the test failed. @@ -2532,7 +2530,7 @@ module.exports = function () { * @memberOf Benchmark * @type Object */ - 'error': undefined, + error: undefined, /** * The test to benchmark. @@ -2540,7 +2538,7 @@ module.exports = function () { * @memberOf Benchmark * @type {Function|string} */ - 'fn': undefined, + fn: undefined, /** * A flag to indicate if the benchmark is aborted. @@ -2548,7 +2546,7 @@ module.exports = function () { * @memberOf Benchmark * @type boolean */ - 'aborted': false, + aborted: false, /** * A flag to indicate if the benchmark is running. @@ -2556,7 +2554,7 @@ module.exports = function () { * @memberOf Benchmark * @type boolean */ - 'running': false, + running: false, /** * Compiled into the test and executed immediately **before** the test loop. @@ -2619,7 +2617,7 @@ module.exports = function () { * }()) * }()) */ - 'setup': _.noop, + setup: _.noop, /** * Compiled into the test and executed immediately **after** the test loop. @@ -2627,7 +2625,7 @@ module.exports = function () { * @memberOf Benchmark * @type {Function|string} */ - 'teardown': _.noop, + teardown: _.noop, /** * An object of stats including mean, margin or error, and standard deviation. @@ -2635,14 +2633,14 @@ module.exports = function () { * @memberOf Benchmark * @type Object */ - 'stats': { + stats: { /** * The margin of error. * * @memberOf Benchmark#stats * @type number */ - 'moe': 0, + moe: 0, /** * The relative margin of error (expressed as a percentage of the mean). @@ -2650,7 +2648,7 @@ module.exports = function () { * @memberOf Benchmark#stats * @type number */ - 'rme': 0, + rme: 0, /** * The standard error of the mean. @@ -2658,7 +2656,7 @@ module.exports = function () { * @memberOf Benchmark#stats * @type number */ - 'sem': 0, + sem: 0, /** * The sample standard deviation. @@ -2666,7 +2664,7 @@ module.exports = function () { * @memberOf Benchmark#stats * @type number */ - 'deviation': 0, + deviation: 0, /** * The sample arithmetic mean (secs). @@ -2674,7 +2672,7 @@ module.exports = function () { * @memberOf Benchmark#stats * @type number */ - 'mean': 0, + mean: 0, /** * The array of sampled periods. @@ -2682,7 +2680,7 @@ module.exports = function () { * @memberOf Benchmark#stats * @type Array */ - 'sample': [], + sample: [], /** * The sample variance. @@ -2690,7 +2688,7 @@ module.exports = function () { * @memberOf Benchmark#stats * @type number */ - 'variance': 0, + variance: 0, }, /** @@ -2699,14 +2697,14 @@ module.exports = function () { * @memberOf Benchmark * @type Object */ - 'times': { + times: { /** * The time taken to complete the last cycle (secs). * * @memberOf Benchmark#times * @type number */ - 'cycle': 0, + cycle: 0, /** * The time taken to complete the benchmark (secs). @@ -2714,7 +2712,7 @@ module.exports = function () { * @memberOf Benchmark#times * @type number */ - 'elapsed': 0, + elapsed: 0, /** * The time taken to execute the test once (secs). @@ -2722,7 +2720,7 @@ module.exports = function () { * @memberOf Benchmark#times * @type number */ - 'period': 0, + period: 0, /** * A timestamp of when the benchmark started (ms). @@ -2730,21 +2728,21 @@ module.exports = function () { * @memberOf Benchmark#times * @type number */ - 'timeStamp': 0, + timeStamp: 0, }, }); _.assign(Benchmark.prototype, { - 'abort': abort, - 'clone': clone, - 'compare': compare, - 'emit': emit, - 'listeners': listeners, - 'off': off, - 'on': on, - 'reset': reset, - 'run': run, - 'toString': toStringBench, + abort: abort, + clone: clone, + compare: compare, + emit: emit, + listeners: listeners, + off: off, + on: on, + reset: reset, + run: run, + toString: toStringBench, }); /*------------------------------------------------------------------------*/ @@ -2756,7 +2754,7 @@ module.exports = function () { * @memberOf Benchmark.Deferred * @type Object */ - 'benchmark': null, + benchmark: null, /** * The number of deferred cycles performed while benchmarking. @@ -2764,7 +2762,7 @@ module.exports = function () { * @memberOf Benchmark.Deferred * @type number */ - 'cycles': 0, + cycles: 0, /** * The time taken to complete the deferred benchmark (secs). @@ -2772,7 +2770,7 @@ module.exports = function () { * @memberOf Benchmark.Deferred * @type number */ - 'elapsed': 0, + elapsed: 0, /** * A timestamp of when the deferred benchmark started (ms). @@ -2780,11 +2778,11 @@ module.exports = function () { * @memberOf Benchmark.Deferred * @type number */ - 'timeStamp': 0, + timeStamp: 0, }); _.assign(Deferred.prototype, { - 'resolve': resolve, + resolve: resolve, }); /*------------------------------------------------------------------------*/ @@ -2796,7 +2794,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type boolean */ - 'aborted': false, + aborted: false, /** * A flag to indicate if the default action is cancelled. @@ -2804,7 +2802,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type boolean */ - 'cancelled': false, + cancelled: false, /** * The object whose listeners are currently being processed. @@ -2812,7 +2810,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type Object */ - 'currentTarget': undefined, + currentTarget: undefined, /** * The return value of the last executed listener. @@ -2820,7 +2818,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type Mixed */ - 'result': undefined, + result: undefined, /** * The object to which the event was originally emitted. @@ -2828,7 +2826,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type Object */ - 'target': undefined, + target: undefined, /** * A timestamp of when the event was created (ms). @@ -2836,7 +2834,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type number */ - 'timeStamp': 0, + timeStamp: 0, /** * The event type. @@ -2844,7 +2842,7 @@ module.exports = function () { * @memberOf Benchmark.Event * @type string */ - 'type': '', + type: '', }); /*------------------------------------------------------------------------*/ @@ -2863,7 +2861,7 @@ module.exports = function () { * @memberOf Benchmark.Suite.options * @type string */ - 'name': undefined, + name: undefined, }; /*------------------------------------------------------------------------*/ @@ -2875,7 +2873,7 @@ module.exports = function () { * @memberOf Benchmark.Suite * @type number */ - 'length': 0, + length: 0, /** * A flag to indicate if the suite is aborted. @@ -2883,7 +2881,7 @@ module.exports = function () { * @memberOf Benchmark.Suite * @type boolean */ - 'aborted': false, + aborted: false, /** * A flag to indicate if the suite is running. @@ -2891,38 +2889,38 @@ module.exports = function () { * @memberOf Benchmark.Suite * @type boolean */ - 'running': false, + running: false, }); _.assign(Suite.prototype, { - 'abort': abortSuite, - 'add': add, - 'clone': cloneSuite, - 'emit': emit, - 'filter': filterSuite, - 'join': arrayRef.join, - 'listeners': listeners, - 'off': off, - 'on': on, - 'pop': arrayRef.pop, - 'push': push, - 'reset': resetSuite, - 'run': runSuite, - 'reverse': arrayRef.reverse, - 'shift': shift, - 'slice': slice, - 'sort': arrayRef.sort, - 'splice': arrayRef.splice, - 'unshift': unshift, + abort: abortSuite, + add: add, + clone: cloneSuite, + emit: emit, + filter: filterSuite, + join: arrayRef.join, + listeners: listeners, + off: off, + on: on, + pop: arrayRef.pop, + push: push, + reset: resetSuite, + run: runSuite, + reverse: arrayRef.reverse, + shift: shift, + slice: slice, + sort: arrayRef.sort, + splice: arrayRef.splice, + unshift: unshift, }); /*------------------------------------------------------------------------*/ // Expose Deferred, Event, and Suite. _.assign(Benchmark, { - 'Deferred': Deferred, - 'Event': Event, - 'Suite': Suite, + Deferred: Deferred, + Event: Event, + Suite: Suite, }); /*------------------------------------------------------------------------*/ @@ -2937,7 +2935,7 @@ module.exports = function () { push.apply(args, arguments); return func.apply(_, args); }; - } + }, ); // Avoid array-like object bugs with `Array#shift` and `Array#splice` diff --git a/tgui/packages/tgui-bench/tests/DisposalBin.test.tsx b/tgui/packages/tgui-bench/tests/DisposalBin.test.tsx index 03e4232733..63093f42f7 100644 --- a/tgui/packages/tgui-bench/tests/DisposalBin.test.tsx +++ b/tgui/packages/tgui-bench/tests/DisposalBin.test.tsx @@ -11,7 +11,7 @@ const renderUi = createRenderer((dataJson: string) => { store.dispatch( backendUpdate({ data: Byond.parseJson(dataJson), - }) + }), ); return ; }); diff --git a/tgui/packages/tgui-bench/tests/Tooltip.test.tsx b/tgui/packages/tgui-bench/tests/Tooltip.test.tsx index ea43a61f0b..9dae16f5c0 100644 --- a/tgui/packages/tgui-bench/tests/Tooltip.test.tsx +++ b/tgui/packages/tgui-bench/tests/Tooltip.test.tsx @@ -12,7 +12,7 @@ export const ListOfTooltips = () => { Tooltip #{i} - + , ); } diff --git a/tgui/packages/tgui-dev-server/dreamseeker.js b/tgui/packages/tgui-dev-server/dreamseeker.js index a5ace7f6b2..d1ca2a9ac5 100644 --- a/tgui/packages/tgui-dev-server/dreamseeker.js +++ b/tgui/packages/tgui-dev-server/dreamseeker.js @@ -31,7 +31,7 @@ export class DreamSeeker { + '=' + encodeURIComponent(params[key])) .join('&'); logger.log( - `topic call at ${this.client.defaults.baseURL + '/dummy?' + query}` + `topic call at ${this.client.defaults.baseURL + '/dummy?' + query}`, ); return this.client.get('/dummy?' + query); } diff --git a/tgui/packages/tgui-dev-server/link/retrace.js b/tgui/packages/tgui-dev-server/link/retrace.js index cc7e242b75..083ddb37d1 100644 --- a/tgui/packages/tgui-dev-server/link/retrace.js +++ b/tgui/packages/tgui-dev-server/link/retrace.js @@ -31,7 +31,7 @@ export const loadSourceMaps = async (bundleDir) => { try { const file = basename(path).replace('.map', ''); const consumer = await new SourceMapConsumer( - JSON.parse(fs.readFileSync(path, 'utf8')) + JSON.parse(fs.readFileSync(path, 'utf8')), ); sourceMaps.push({ file, consumer }); } catch (err) { diff --git a/tgui/packages/tgui-dev-server/reloader.js b/tgui/packages/tgui-dev-server/reloader.js index 6ef7e03f6b..cb477a6523 100644 --- a/tgui/packages/tgui-dev-server/reloader.js +++ b/tgui/packages/tgui-dev-server/reloader.js @@ -84,19 +84,19 @@ export const reloadByondCache = async (bundleDir) => { } // Get dreamseeker instances const pids = cacheDirs.map((cacheDir) => - parseInt(cacheDir.split('/cache/tmp').pop(), 10) + parseInt(cacheDir.split('/cache/tmp').pop(), 10), ); const dssPromise = DreamSeeker.getInstancesByPids(pids); // Copy assets const assets = await resolveGlob( bundleDir, - './*.+(bundle|chunk|hot-update).*' + './*.+(bundle|chunk|hot-update).*', ); for (let cacheDir of cacheDirs) { // Clear garbage const garbage = await resolveGlob( cacheDir, - './*.+(bundle|chunk|hot-update).*' + './*.+(bundle|chunk|hot-update).*', ); try { // Plant a dummy browser window file, we'll be using this to avoid world topic. For byond 515. diff --git a/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx b/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx index 8260ee8c23..903dacf284 100644 --- a/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx +++ b/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx @@ -22,10 +22,10 @@ export const NowPlayingWidget = (props) => { duration = audio.meta?.duration, date = !isNaN(upload_date) ? upload_date?.substring(0, 4) + - '-' + - upload_date?.substring(4, 6) + - '-' + - upload_date?.substring(6, 8) + '-' + + upload_date?.substring(4, 6) + + '-' + + upload_date?.substring(6, 8) : upload_date; return ( @@ -38,7 +38,8 @@ export const NowPlayingWidget = (props) => { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', - }}> + }} + > {
diff --git a/tgui/packages/tgui-panel/chat/ChatPageSettings.jsx b/tgui/packages/tgui-panel/chat/ChatPageSettings.jsx index b451efbe93..85f3b278e3 100644 --- a/tgui/packages/tgui-panel/chat/ChatPageSettings.jsx +++ b/tgui/packages/tgui-panel/chat/ChatPageSettings.jsx @@ -5,8 +5,21 @@ */ import { useDispatch, useSelector } from 'tgui/backend'; -import { Button, Collapsible, Divider, Input, Section, Stack } from 'tgui/components'; -import { moveChatPageLeft, moveChatPageRight, removeChatPage, toggleAcceptedType, updateChatPage } from './actions'; +import { + Button, + Collapsible, + Divider, + Input, + Section, + Stack, +} from 'tgui/components'; +import { + moveChatPageLeft, + moveChatPageRight, + removeChatPage, + toggleAcceptedType, + updateChatPage, +} from './actions'; import { MESSAGE_TYPES } from './constants'; import { selectCurrentChatPage } from './selectors'; @@ -25,7 +38,7 @@ export const ChatPageSettings = (props) => { updateChatPage({ pageId: page.id, name: value, - }) + }), ) } /> @@ -39,9 +52,10 @@ export const ChatPageSettings = (props) => { dispatch( removeChatPage({ pageId: page.id, - }) + }), ) - }> + } + > Remove @@ -60,9 +74,10 @@ export const ChatPageSettings = (props) => { dispatch( moveChatPageLeft({ pageId: page.id, - }) + }), ) - }> + } + > « @@ -84,7 +100,7 @@ export const ChatPageSettings = (props) => {
{MESSAGE_TYPES.filter( - (typeDef) => !typeDef.important && !typeDef.admin + (typeDef) => !typeDef.important && !typeDef.admin, ).map((typeDef) => ( { toggleAcceptedType({ pageId: page.id, type: typeDef.type, - }) + }), ) - }> + } + > {typeDef.name} ))} {MESSAGE_TYPES.filter( - (typeDef) => !typeDef.important && typeDef.admin + (typeDef) => !typeDef.important && typeDef.admin, ).map((typeDef) => ( { toggleAcceptedType({ pageId: page.id, type: typeDef.type, - }) + }), ) - }> + } + > {typeDef.name} ))} diff --git a/tgui/packages/tgui-panel/chat/ChatPanel.jsx b/tgui/packages/tgui-panel/chat/ChatPanel.jsx index 166705361f..36e86876f5 100644 --- a/tgui/packages/tgui-panel/chat/ChatPanel.jsx +++ b/tgui/packages/tgui-panel/chat/ChatPanel.jsx @@ -26,7 +26,7 @@ export class ChatPanel extends Component { chatRenderer.mount(this.ref.current); chatRenderer.events.on( 'scrollTrackingChanged', - this.handleScrollTrackingChange + this.handleScrollTrackingChange, ); this.componentDidUpdate(); } @@ -34,7 +34,7 @@ export class ChatPanel extends Component { componentWillUnmount() { chatRenderer.events.off( 'scrollTrackingChanged', - this.handleScrollTrackingChange + this.handleScrollTrackingChange, ); } @@ -63,7 +63,8 @@ export class ChatPanel extends Component { )} diff --git a/tgui/packages/tgui-panel/chat/ChatTabs.jsx b/tgui/packages/tgui-panel/chat/ChatTabs.jsx index 04d5f25b4b..ed3a285c20 100644 --- a/tgui/packages/tgui-panel/chat/ChatTabs.jsx +++ b/tgui/packages/tgui-panel/chat/ChatTabs.jsx @@ -19,7 +19,8 @@ const UnreadCountWidget = ({ value }) => ( lineHeight: '1.55em', backgroundColor: 'crimson', color: '#fff', - }}> + }} + > {Math.min(value, 99)} ); @@ -45,9 +46,10 @@ export const ChatTabs = (props) => { dispatch( changeChatPage({ pageId: page.id, - }) + }), ) - }> + } + > {page.name} ))} diff --git a/tgui/packages/tgui-panel/chat/middleware.js b/tgui/packages/tgui-panel/chat/middleware.js index f7d68ba011..ca04222463 100644 --- a/tgui/packages/tgui-panel/chat/middleware.js +++ b/tgui/packages/tgui-panel/chat/middleware.js @@ -7,9 +7,28 @@ import { storage } from 'common/storage'; import DOMPurify from 'dompurify'; -import { addHighlightSetting, loadSettings, removeHighlightSetting, updateHighlightSetting, updateSettings } from '../settings/actions'; +import { + addHighlightSetting, + loadSettings, + removeHighlightSetting, + updateHighlightSetting, + updateSettings, +} from '../settings/actions'; import { selectSettings } from '../settings/selectors'; -import { addChatPage, changeChatPage, changeScrollTracking, loadChat, moveChatPageLeft, moveChatPageRight, purgeChatMessageArchive, rebuildChat, removeChatPage, saveChatToDisk, toggleAcceptedType, updateMessageCount } from './actions'; +import { + addChatPage, + changeChatPage, + changeScrollTracking, + loadChat, + moveChatPageLeft, + moveChatPageRight, + purgeChatMessageArchive, + rebuildChat, + removeChatPage, + saveChatToDisk, + toggleAcceptedType, + updateMessageCount, +} from './actions'; import { MESSAGE_SAVE_INTERVAL } from './constants'; import { createMessage, serializeMessage } from './model'; import { chatRenderer } from './renderer'; @@ -23,7 +42,7 @@ const saveChatToStorage = async (store) => { const settings = selectSettings(store.getState()); const fromIndex = Math.max( 0, - chatRenderer.messages.length - settings.persistentMessageLimit + chatRenderer.messages.length - settings.persistentMessageLimit, ); const messages = chatRenderer.messages .slice(fromIndex) @@ -32,7 +51,7 @@ const saveChatToStorage = async (store) => { storage.set('chat-messages', messages); storage.set( 'chat-messages-archive', - chatRenderer.archivedMessages.map((message) => serializeMessage(message)) + chatRenderer.archivedMessages.map((message) => serializeMessage(message)), ); // FIXME: Better chat history }; @@ -123,7 +142,7 @@ export const chatMiddleware = (store) => { settings.visibleMessageLimit, settings.combineMessageLimit, settings.combineIntervalLimit, - settings.logLineCount + settings.logLineCount, ); if (!initialized) { initialized = true; @@ -205,7 +224,7 @@ export const chatMiddleware = (store) => { next(action); chatRenderer.setHighlight( settings.highlightSettings, - settings.highlightSettingById + settings.highlightSettingById, ); return; diff --git a/tgui/packages/tgui-panel/chat/reducer.js b/tgui/packages/tgui-panel/chat/reducer.js index 034ccefec4..effc942395 100644 --- a/tgui/packages/tgui-panel/chat/reducer.js +++ b/tgui/packages/tgui-panel/chat/reducer.js @@ -4,7 +4,18 @@ * @license MIT */ -import { addChatPage, changeChatPage, changeScrollTracking, loadChat, moveChatPageLeft, moveChatPageRight, removeChatPage, toggleAcceptedType, updateChatPage, updateMessageCount } from './actions'; +import { + addChatPage, + changeChatPage, + changeScrollTracking, + loadChat, + moveChatPageLeft, + moveChatPageRight, + removeChatPage, + toggleAcceptedType, + updateChatPage, + updateMessageCount, +} from './actions'; import { canPageAcceptType, createMainPage } from './model'; const mainPage = createMainPage(); diff --git a/tgui/packages/tgui-panel/chat/renderer.jsx b/tgui/packages/tgui-panel/chat/renderer.jsx index a2bfba6d2e..a3513fb6c4 100644 --- a/tgui/packages/tgui-panel/chat/renderer.jsx +++ b/tgui/packages/tgui-panel/chat/renderer.jsx @@ -7,9 +7,22 @@ import { EventEmitter } from 'common/events'; import { classes } from 'common/react'; import { createLogger } from 'tgui/logging'; -import { IMAGE_RETRY_DELAY, IMAGE_RETRY_LIMIT, IMAGE_RETRY_MESSAGE_AGE, MESSAGE_PRUNE_INTERVAL, MESSAGE_TYPES, MESSAGE_TYPE_INTERNAL, MESSAGE_TYPE_UNKNOWN } from './constants'; +import { + IMAGE_RETRY_DELAY, + IMAGE_RETRY_LIMIT, + IMAGE_RETRY_MESSAGE_AGE, + MESSAGE_PRUNE_INTERVAL, + MESSAGE_TYPES, + MESSAGE_TYPE_INTERNAL, + MESSAGE_TYPE_UNKNOWN, +} from './constants'; import { render } from 'react-dom'; -import { canPageAcceptType, createMessage, isSameMessage, serializeMessage } from './model'; +import { + canPageAcceptType, + createMessage, + isSameMessage, + serializeMessage, +} from './model'; import { highlightNode, linkifyNode } from './replaceInTextNode'; import { Tooltip } from '../../tgui/components'; @@ -27,8 +40,8 @@ export const TGUI_CHAT_COMPONENTS = { // List of injectable attibute names mapped to their proper prop // We need this because attibutes don't support lowercase names export const TGUI_CHAT_ATTRIBUTES_TO_PROPS = { - 'position': 'position', - 'content': 'content', + position: 'position', + content: 'content', }; const findNearestScrollableParent = (startingNode) => { @@ -213,7 +226,7 @@ class ChatRenderer { // Must be alphanumeric (with some punctuation) allowedRegex.test(str) && // Reset lastIndex so it does not mess up the next word - ((allowedRegex.lastIndex = 0) || true) + ((allowedRegex.lastIndex = 0) || true), ); let highlightWords; let highlightRegex; @@ -232,7 +245,7 @@ class ChatRenderer { // Must be alphanumeric (with some punctuation) allowedRegex.test(str) && // Reset lastIndex so it does not mess up the next word - ((allowedRegex.lastIndex = 0) || true) + ((allowedRegex.lastIndex = 0) || true), ); let blacklistWords; let blacklistregex; @@ -302,7 +315,7 @@ class ChatRenderer { highlightRegex = new RegExp('(' + regexStr + ')', flags); } else { const pattern = `${matchWord ? '\\b' : ''}(${highlightWords.join( - '|' + '|', )})${matchWord ? '\\b' : ''}`; highlightRegex = new RegExp(pattern, flags); } @@ -361,7 +374,7 @@ class ChatRenderer { visibleMessageLimit, combineMessageLimit, combineIntervalLimit, - exportLimit + exportLimit, ) { this.visibleMessageLimit = visibleMessageLimit; this.combineMessageLimit = combineMessageLimit; @@ -485,7 +498,7 @@ class ChatRenderer { , - childNode + childNode, ); /* eslint-enable react/no-danger */ } @@ -504,7 +517,7 @@ class ChatRenderer { node, parser.highlightRegex, parser.highlightWords, - (text) => createHighlightNode(text, parser.highlightColor) + (text) => createHighlightNode(text, parser.highlightColor), ); if (highlighted && parser.highlightWholeMessage) { node.className += ' ChatMessage--highlighted'; @@ -537,7 +550,7 @@ class ChatRenderer { !Byond.IS_LTE_IE8 && MESSAGE_TYPES.find( (typeDef) => - typeDef.selector && node.querySelector(typeDef.selector) + typeDef.selector && node.querySelector(typeDef.selector), ); message.type = typeDef?.type || MESSAGE_TYPE_UNKNOWN; } @@ -598,7 +611,7 @@ class ChatRenderer { // Remove pruned messages from the message array this.messages = this.messages.filter( - (message) => message.node !== 'pruned' + (message) => message.node !== 'pruned', ); logger.log(`pruned ${fromIndex} visible messages`); } @@ -607,7 +620,7 @@ class ChatRenderer { { const fromIndex = Math.max( 0, - this.messages.length - this.persistentMessageLimit + this.messages.length - this.persistentMessageLimit, ); if (fromIndex > 0) { this.messages = this.messages.slice(fromIndex); diff --git a/tgui/packages/tgui-panel/chat/replaceInTextNode.js b/tgui/packages/tgui-panel/chat/replaceInTextNode.js index 5c345e90a1..4c91b604da 100644 --- a/tgui/packages/tgui-panel/chat/replaceInTextNode.js +++ b/tgui/packages/tgui-panel/chat/replaceInTextNode.js @@ -149,7 +149,7 @@ export const highlightNode = ( node, regex, words, - createNode = createHighlightNode + createNode = createHighlightNode, ) => { if (!createNode) { createNode = createHighlightNode; diff --git a/tgui/packages/tgui-panel/index.tsx b/tgui/packages/tgui-panel/index.tsx index a458c6f350..c1fb8ac792 100644 --- a/tgui/packages/tgui-panel/index.tsx +++ b/tgui/packages/tgui-panel/index.tsx @@ -82,14 +82,14 @@ const setupApp = () => { Byond.winset('browseroutput', { 'is-visible': true, 'is-disabled': false, - 'pos': '0x0', - 'size': '0x0', + pos: '0x0', + size: '0x0', }); // Resize the panel to match the non-browser output Byond.winget('output').then((output: { size: string }) => { Byond.winset('browseroutput', { - 'size': output.size, + size: output.size, }); }); @@ -110,7 +110,7 @@ const setupApp = () => { ], () => { renderApp(); - } + }, ); } }; diff --git a/tgui/packages/tgui-panel/ping/reducer.ts b/tgui/packages/tgui-panel/ping/reducer.ts index 5d38e939d2..10531d23d8 100644 --- a/tgui/packages/tgui-panel/ping/reducer.ts +++ b/tgui/packages/tgui-panel/ping/reducer.ts @@ -7,7 +7,11 @@ import { clamp01, scale } from 'common/math'; import { pingFail, pingSuccess } from './actions'; -import { PING_MAX_FAILS, PING_ROUNDTRIP_BEST, PING_ROUNDTRIP_WORST } from './constants'; +import { + PING_MAX_FAILS, + PING_ROUNDTRIP_BEST, + PING_ROUNDTRIP_WORST, +} from './constants'; type PingState = { roundtrip: number | undefined; @@ -36,7 +40,7 @@ export const pingReducer = (state = {} as PingState, action) => { if (type === pingFail.type) { const { failCount = 0 } = state; const networkQuality = clamp01( - state.networkQuality - failCount / PING_MAX_FAILS + state.networkQuality - failCount / PING_MAX_FAILS, ); const nextState: PingState = { ...state, diff --git a/tgui/packages/tgui-panel/reconnect.tsx b/tgui/packages/tgui-panel/reconnect.tsx index 4674aa8e22..69bab020bd 100644 --- a/tgui/packages/tgui-panel/reconnect.tsx +++ b/tgui/packages/tgui-panel/reconnect.tsx @@ -25,7 +25,8 @@ export const ReconnectButton = (props) => { color="white" onClick={() => { Byond.command('.reconnect'); - }}> + }} + > Reconnect diff --git a/tgui/packages/tgui-panel/settings/SettingsPanel.jsx b/tgui/packages/tgui-panel/settings/SettingsPanel.jsx index 5a1db9dc5a..a2f171259d 100644 --- a/tgui/packages/tgui-panel/settings/SettingsPanel.jsx +++ b/tgui/packages/tgui-panel/settings/SettingsPanel.jsx @@ -7,13 +7,42 @@ import { toFixed } from 'common/math'; import { useLocalState } from 'tgui/backend'; import { useDispatch, useSelector } from 'tgui/backend'; -import { Box, Button, ColorBox, Divider, Dropdown, Flex, Input, LabeledList, NumberInput, Section, Stack, Tabs, TextArea } from 'tgui/components'; +import { + Box, + Button, + ColorBox, + Divider, + Dropdown, + Flex, + Input, + LabeledList, + NumberInput, + Section, + Stack, + Tabs, + TextArea, +} from 'tgui/components'; import { ChatPageSettings } from '../chat'; -import { rebuildChat, saveChatToDisk, purgeChatMessageArchive } from '../chat/actions'; +import { + rebuildChat, + saveChatToDisk, + purgeChatMessageArchive, +} from '../chat/actions'; import { THEMES } from '../themes'; -import { changeSettingsTab, updateSettings, addHighlightSetting, removeHighlightSetting, updateHighlightSetting } from './actions'; +import { + changeSettingsTab, + updateSettings, + addHighlightSetting, + removeHighlightSetting, + updateHighlightSetting, +} from './actions'; import { SETTINGS_TABS, FONTS, MAX_HIGHLIGHT_SETTINGS } from './constants'; -import { selectActiveTab, selectSettings, selectHighlightSettings, selectHighlightSettingById } from './selectors'; +import { + selectActiveTab, + selectSettings, + selectHighlightSettings, + selectHighlightSettingById, +} from './selectors'; export const SettingsPanel = (props) => { const activeTab = useSelector(selectActiveTab); @@ -31,9 +60,10 @@ export const SettingsPanel = (props) => { dispatch( changeSettingsTab({ tabId: tab.id, - }) + }), ) - }> + } + > {tab.name} ))} @@ -67,7 +97,7 @@ export const SettingsGeneral = (props) => { dispatch( updateSettings({ theme: value, - }) + }), ) } /> @@ -83,7 +113,7 @@ export const SettingsGeneral = (props) => { dispatch( updateSettings({ fontFamily: value, - }) + }), ) } /> @@ -94,7 +124,7 @@ export const SettingsGeneral = (props) => { dispatch( updateSettings({ fontFamily: value, - }) + }), ) } /> @@ -127,7 +157,7 @@ export const SettingsGeneral = (props) => { dispatch( updateSettings({ fontSize: value, - }) + }), ) } /> @@ -145,7 +175,7 @@ export const SettingsGeneral = (props) => { dispatch( updateSettings({ lineHeight: value, - }) + }), ) } /> @@ -160,7 +190,7 @@ export const SettingsGeneral = (props) => { dispatch( updateSettings({ showReconnectWarning: !showReconnectWarning, - }) + }), ) } /> @@ -194,7 +224,7 @@ export const MessageLimits = (props) => { dispatch( updateSettings({ visibleMessageLimit: value, - }) + }), ) } /> @@ -212,7 +242,7 @@ export const MessageLimits = (props) => { dispatch( updateSettings({ persistentMessageLimit: value, - }) + }), ) } /> @@ -230,7 +260,7 @@ export const MessageLimits = (props) => { dispatch( updateSettings({ combineMessageLimit: value, - }) + }), ) } /> @@ -249,7 +279,7 @@ export const MessageLimits = (props) => { dispatch( updateSettings({ combineIntervalLimit: value, - }) + }), ) } /> @@ -296,7 +326,7 @@ export const ExportTab = (props) => { dispatch( updateSettings({ logLineCount: value, - }) + }), ) } /> @@ -316,7 +346,8 @@ export const ExportTab = (props) => { onClick={() => { dispatch(purgeChatMessageArchive()); setPurgeConfirm(2); - }}> + }} + > {purgeConfirm > 1 ? 'Purged!' : 'Are you sure?'} ) : ( @@ -328,7 +359,8 @@ export const ExportTab = (props) => { setTimeout(() => { setPurgeConfirm(false); }, 5000); - }}> + }} + > Purge message archive )} @@ -402,7 +434,7 @@ const TextHighlightSetting = (props) => { dispatch( removeHighlightSetting({ id: id, - }) + }), ) } /> @@ -418,7 +450,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, highlightBlacklist: !highlightBlacklist, - }) + }), ) } /> @@ -434,7 +466,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, highlightWholeMessage: !highlightWholeMessage, - }) + }), ) } /> @@ -450,7 +482,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, matchWord: !matchWord, - }) + }), ) } /> @@ -465,7 +497,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, matchCase: !matchCase, - }) + }), ) } /> @@ -482,7 +514,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, highlightColor: value, - }) + }), ) } /> @@ -497,7 +529,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, highlightText: value, - }) + }), ) } /> @@ -511,7 +543,7 @@ const TextHighlightSetting = (props) => { updateHighlightSetting({ id: id, blacklistText: value, - }) + }), ) } /> diff --git a/tgui/packages/tgui-panel/settings/actions.ts b/tgui/packages/tgui-panel/settings/actions.ts index f4b31565c2..55e5db1126 100644 --- a/tgui/packages/tgui-panel/settings/actions.ts +++ b/tgui/packages/tgui-panel/settings/actions.ts @@ -17,11 +17,11 @@ export const addHighlightSetting = createAction( 'settings/addHighlightSetting', () => ({ payload: createHighlightSetting(), - }) + }), ); export const removeHighlightSetting = createAction( - 'settings/removeHighlightSetting' + 'settings/removeHighlightSetting', ); export const updateHighlightSetting = createAction( - 'settings/updateHighlightSetting' + 'settings/updateHighlightSetting', ); diff --git a/tgui/packages/tgui-panel/settings/middleware.js b/tgui/packages/tgui-panel/settings/middleware.js index 8518f15d2a..edb16a51c4 100644 --- a/tgui/packages/tgui-panel/settings/middleware.js +++ b/tgui/packages/tgui-panel/settings/middleware.js @@ -7,7 +7,13 @@ import { storage } from 'common/storage'; import { setClientTheme } from '../themes'; -import { addHighlightSetting, loadSettings, removeHighlightSetting, updateHighlightSetting, updateSettings } from './actions'; +import { + addHighlightSetting, + loadSettings, + removeHighlightSetting, + updateHighlightSetting, + updateSettings, +} from './actions'; import { FONTS_DISABLED } from './constants'; import { selectSettings } from './selectors'; diff --git a/tgui/packages/tgui-panel/settings/reducer.js b/tgui/packages/tgui-panel/settings/reducer.js index 036c15a5c7..82e14ffa3e 100644 --- a/tgui/packages/tgui-panel/settings/reducer.js +++ b/tgui/packages/tgui-panel/settings/reducer.js @@ -4,7 +4,16 @@ * @license MIT */ -import { addHighlightSetting, changeSettingsTab, loadSettings, openChatSettings, removeHighlightSetting, toggleSettings, updateHighlightSetting, updateSettings } from './actions'; +import { + addHighlightSetting, + changeSettingsTab, + loadSettings, + openChatSettings, + removeHighlightSetting, + toggleSettings, + updateHighlightSetting, + updateSettings, +} from './actions'; import { FONTS, MAX_HIGHLIGHT_SETTINGS, SETTINGS_TABS } from './constants'; import { createDefaultHighlightSetting } from './model'; @@ -139,7 +148,7 @@ export const settingsReducer = (state = initialState, action) => { } else { delete nextState.highlightSettingById[id]; nextState.highlightSettings = nextState.highlightSettings.filter( - (sid) => sid !== id + (sid) => sid !== id, ); if (!nextState.highlightSettings.length) { nextState.highlightSettings.push(defaultHighlightSetting.id); diff --git a/tgui/packages/tgui-panel/styles/main.scss b/tgui/packages/tgui-panel/styles/main.scss index ee96a9c5a6..08e60d18ee 100644 --- a/tgui/packages/tgui-panel/styles/main.scss +++ b/tgui/packages/tgui-panel/styles/main.scss @@ -10,7 +10,7 @@ @use '~tgui/styles/base.scss' with ( $color-bg: #202020, $color-bg-section: color.adjust(#202020, $lightness: -5%), - $color-bg-grad-spread: 0%, + $color-bg-grad-spread: 0% ); // Core styles diff --git a/tgui/packages/tgui-panel/styles/themes/light.scss b/tgui/packages/tgui-panel/styles/themes/light.scss index 1f752d51d6..19ddd3642c 100644 --- a/tgui/packages/tgui-panel/styles/themes/light.scss +++ b/tgui/packages/tgui-panel/styles/themes/light.scss @@ -22,7 +22,7 @@ $color-fg: #000000, $color-bg: #eeeeee, $color-bg-section: #ffffff, - $color-bg-grad-spread: 0%, + $color-bg-grad-spread: 0% ); // A fat warning to anyone who wants to use this: this only half works. diff --git a/tgui/packages/tgui-panel/styles/themes/vchatlight.scss b/tgui/packages/tgui-panel/styles/themes/vchatlight.scss index 9acaef59d8..1679f55976 100644 --- a/tgui/packages/tgui-panel/styles/themes/vchatlight.scss +++ b/tgui/packages/tgui-panel/styles/themes/vchatlight.scss @@ -7,23 +7,23 @@ @use 'sass:meta'; @use '~tgui/styles/colors.scss' with ( - $primary: #ffffff, - $bg-lightness: -25%, - $fg-lightness: -10%, - $label: #3b3b3b, - // Makes button look actually grey due to weird maths. - $grey: #ffffff, - // Commenting out color maps will adjust all colors based on the lightness - // settings above, but will add extra 10KB to the theme. - // $fg-map-keys: (), - // $bg-map-keys: (), - ); + $primary: #ffffff, + $bg-lightness: -25%, + $fg-lightness: -10%, + $label: #3b3b3b, + // Makes button look actually grey due to weird maths. + $grey: #ffffff, + // Commenting out color maps will adjust all colors based on the lightness + // settings above, but will add extra 10KB to the theme. + // $fg-map-keys: (), + // $bg-map-keys: (), +); @use '~tgui/styles/base.scss' with ( - $color-fg: #000000, - $color-bg: #eeeeee, - $color-bg-section: #ffffff, - $color-bg-grad-spread: 0%, - ); + $color-fg: #000000, + $color-bg: #eeeeee, + $color-bg-section: #ffffff, + $color-bg-grad-spread: 0% +); // A fat warning to anyone who wants to use this: this only half works. // It was made almost purely for the nuke ui, and requires a good amount of manual hacks to get it working as intended. diff --git a/tgui/packages/tgui-panel/telemetry.js b/tgui/packages/tgui-panel/telemetry.js index bade3c6391..3b1eb9a950 100644 --- a/tgui/packages/tgui-panel/telemetry.js +++ b/tgui/packages/tgui-panel/telemetry.js @@ -58,7 +58,7 @@ export const telemetryMiddleware = (store) => { let telemetryMutated = false; const duplicateConnection = telemetry.connections.find((conn) => - connectionsMatch(conn, client) + connectionsMatch(conn, client), ); if (!duplicateConnection) { telemetryMutated = true; diff --git a/tgui/packages/tgui/backend.ts b/tgui/packages/tgui/backend.ts index 0d872aefd7..2a79354c9b 100644 --- a/tgui/packages/tgui/backend.ts +++ b/tgui/packages/tgui/backend.ts @@ -229,7 +229,7 @@ export const backendMiddleware = (store) => { if (process.env.NODE_ENV !== 'production') { logger.log( 'visible in', - perf.measure('render/finish', 'resume/finish') + perf.measure('render/finish', 'resume/finish'), ); } }); @@ -328,7 +328,7 @@ type StateWithSetter = [T, (nextState: T) => void]; */ export const useLocalState = ( key: string, - initialState: T + initialState: T, ): StateWithSetter => { const state = globalStore?.getState()?.backend; const sharedStates = state?.shared ?? {}; @@ -343,7 +343,7 @@ export const useLocalState = ( typeof nextState === 'function' ? nextState(sharedState) : nextState, - }) + }), ); }, ]; @@ -365,7 +365,7 @@ export const useLocalState = ( */ export const useSharedState = ( key: string, - initialState: T + initialState: T, ): StateWithSetter => { const state = globalStore?.getState()?.backend; const sharedStates = state?.shared ?? {}; @@ -378,7 +378,9 @@ export const useSharedState = ( key, value: JSON.stringify( - typeof nextState === 'function' ? nextState(sharedState) : nextState + typeof nextState === 'function' + ? nextState(sharedState) + : nextState, ) || '', }); }, diff --git a/tgui/packages/tgui/components/Blink.jsx b/tgui/packages/tgui/components/Blink.jsx index bf92fe02b4..7d7bb16170 100644 --- a/tgui/packages/tgui/components/Blink.jsx +++ b/tgui/packages/tgui/components/Blink.jsx @@ -60,7 +60,8 @@ export class Blink extends Component { + }} + > {props.children} ); diff --git a/tgui/packages/tgui/components/BodyZoneSelector.tsx b/tgui/packages/tgui/components/BodyZoneSelector.tsx index ca9f76016b..39f7aa4073 100644 --- a/tgui/packages/tgui/components/BodyZoneSelector.tsx +++ b/tgui/packages/tgui/components/BodyZoneSelector.tsx @@ -85,7 +85,8 @@ export class BodyZoneSelector extends Component< width: `${32 * scale}px`, height: `${32 * scale}px`, position: 'relative', - }}> + }} + > { ...computedProps, className: computedClassName, }, - children + children, ); }; diff --git a/tgui/packages/tgui/components/Button.jsx b/tgui/packages/tgui/components/Button.jsx index 9c0be413ed..e352df2f8f 100644 --- a/tgui/packages/tgui/components/Button.jsx +++ b/tgui/packages/tgui/components/Button.jsx @@ -85,7 +85,8 @@ export const Button = (props) => { return; } }} - {...computeBoxProps(rest)}> + {...computeBoxProps(rest)} + >
{icon && iconPosition !== 'right' && ( this.setInInput(true)}> + onClick={() => this.setInInput(true)} + > {icon && }
{content}
{ if (data.length === 0) { return []; @@ -138,7 +138,8 @@ class LineChart extends Component { right: 0, bottom: 0, overflow: 'hidden', - }}> + }} + > this.setState({ open: !open })} - {...rest}> + {...rest} + > {title}
diff --git a/tgui/packages/tgui/components/ColorBox.jsx b/tgui/packages/tgui/components/ColorBox.jsx index ce3c202d8c..48916efa9b 100644 --- a/tgui/packages/tgui/components/ColorBox.jsx +++ b/tgui/packages/tgui/components/ColorBox.jsx @@ -22,7 +22,8 @@ export const ColorBox = (props) => { return (
+ {...computeBoxProps(rest)} + > {content || '.'}
); diff --git a/tgui/packages/tgui/components/Dialog.tsx b/tgui/packages/tgui/components/Dialog.tsx index 277a03b284..897ce236a4 100644 --- a/tgui/packages/tgui/components/Dialog.tsx +++ b/tgui/packages/tgui/components/Dialog.tsx @@ -52,7 +52,8 @@ const DialogButton = (props: DialogButtonProps) => { ); diff --git a/tgui/packages/tgui/components/DraggableControl.jsx b/tgui/packages/tgui/components/DraggableControl.jsx index 456f804a0e..7a8671c17f 100644 --- a/tgui/packages/tgui/components/DraggableControl.jsx +++ b/tgui/packages/tgui/components/DraggableControl.jsx @@ -96,13 +96,13 @@ export class DraggableControl extends Component { state.internalValue = clamp( state.internalValue + (offset * step) / stepPixelSize, minValue - step, - maxValue + step + maxValue + step, ); // Clamp the final value state.value = clamp( state.internalValue - (state.internalValue % step) + stepOffset, minValue, - maxValue + maxValue, ); state.origin = getScalarScreenOffset(e, dragMatrix); } else if (Math.abs(offset) > 4) { diff --git a/tgui/packages/tgui/components/Dropdown.tsx b/tgui/packages/tgui/components/Dropdown.tsx index 407a08e750..4fabfbf0bb 100644 --- a/tgui/packages/tgui/components/Dropdown.tsx +++ b/tgui/packages/tgui/components/Dropdown.tsx @@ -88,7 +88,7 @@ export function Dropdown(props: Props) { const endIndex = options.length - 1; let selectedIndex = options.findIndex( - (option) => getOptionValue(option) === selected + (option) => getOptionValue(option) === selected, ); if (selectedIndex < 0) { @@ -104,7 +104,7 @@ export function Dropdown(props: Props) { onSelected?.(getOptionValue(options[newIndex])); }, - [disabled, onSelected, options, selected] + [disabled, onSelected, options, selected], ); /** Allows the menu to be scrollable on open */ @@ -123,7 +123,8 @@ export function Dropdown(props: Props) {
+ ref={innerRef} + > {options.length === 0 && (
No options
)} @@ -141,13 +142,15 @@ export function Dropdown(props: Props) { onClick={() => { setOpen(false); onSelected?.(value); - }}> + }} + > {typeof option === 'string' ? option : option.displayText}
); })} - }> + } + >
+ }} + > {icon && ( + }} + > {displayText || selected} {!noChevron && ( diff --git a/tgui/packages/tgui/components/FitText.tsx b/tgui/packages/tgui/components/FitText.tsx index 63bc1c0132..049c887ed7 100644 --- a/tgui/packages/tgui/components/FitText.tsx +++ b/tgui/packages/tgui/components/FitText.tsx @@ -1,4 +1,10 @@ -import { Component, createRef, HTMLAttributes, PropsWithChildren, RefObject } from 'react'; +import { + Component, + createRef, + HTMLAttributes, + PropsWithChildren, + RefObject, +} from 'react'; const DEFAULT_ACCEPTABLE_DIFFERENCE = 5; @@ -84,7 +90,8 @@ export class FitText extends Component { ...(typeof this.props.native?.style === 'object' ? this.props.native.style : {}), - }}> + }} + > {this.props.children} ); diff --git a/tgui/packages/tgui/components/Icon.tsx b/tgui/packages/tgui/components/Icon.tsx index 9a54426828..79d3aa5f07 100644 --- a/tgui/packages/tgui/components/Icon.tsx +++ b/tgui/packages/tgui/components/Icon.tsx @@ -87,7 +87,8 @@ export const IconStack = (props: IconStackProps) => { return ( + {...computeBoxProps(rest)} + > {children} ); diff --git a/tgui/packages/tgui/components/InfinitePlane.jsx b/tgui/packages/tgui/components/InfinitePlane.jsx index c7b3aff382..3f2bf598c2 100644 --- a/tgui/packages/tgui/components/InfinitePlane.jsx +++ b/tgui/packages/tgui/components/InfinitePlane.jsx @@ -139,7 +139,8 @@ export class InfinitePlane extends Component { overflow: 'hidden', position: 'relative', }, - })}> + })} + >
+ }} + > {children}
@@ -174,7 +176,8 @@ export class InfinitePlane extends Component { + maxValue={ZOOM_MAX_VAL} + > {zoom}x diff --git a/tgui/packages/tgui/components/Input.jsx b/tgui/packages/tgui/components/Input.jsx index b6bcbf8493..a6d4c4ba8b 100644 --- a/tgui/packages/tgui/components/Input.jsx +++ b/tgui/packages/tgui/components/Input.jsx @@ -138,7 +138,8 @@ export class Input extends Component { monospace && 'Input--monospace', className, ])} - {...rest}> + {...rest} + >
.
{ suppressFlicker, unit, value, - }}> + }} + > {(control) => { const { dragging, @@ -65,7 +66,7 @@ export const Knob = (props) => { const scaledFillValue = scale( fillValue ?? displayValue, minValue, - maxValue + maxValue, ); const scaledDisplayValue = scale(displayValue, minValue, maxValue); const effectiveColor = @@ -87,13 +88,15 @@ export const Knob = (props) => { }, ...rest, })} - onMouseDown={handleDragStart}> + onMouseDown={handleDragStart} + >
+ }} + >
@@ -102,12 +105,14 @@ export const Knob = (props) => { )} + viewBox="0 0 100 100" + > + viewBox="0 0 100 100" + > { ((bipolar ? 2.75 : 2.0) - scaledFillValue * 1.5) * Math.PI * 50, - 0 + 0, ), }} cx="50" diff --git a/tgui/packages/tgui/components/LabeledControls.jsx b/tgui/packages/tgui/components/LabeledControls.jsx index eea3b2c29b..f19bd4eb93 100644 --- a/tgui/packages/tgui/components/LabeledControls.jsx +++ b/tgui/packages/tgui/components/LabeledControls.jsx @@ -14,7 +14,8 @@ export const LabeledControls = (props) => { wrap={wrap} align="stretch" justify="space-between" - {...rest}> + {...rest} + > {children} ); @@ -30,7 +31,8 @@ const LabeledControlsItem = (props) => { align="center" textAlign="center" justify="space-between" - {...rest}> + {...rest} + > {children} {label} diff --git a/tgui/packages/tgui/components/LabeledList.tsx b/tgui/packages/tgui/components/LabeledList.tsx index 154b1aaacc..2c2baa9c34 100644 --- a/tgui/packages/tgui/components/LabeledList.tsx +++ b/tgui/packages/tgui/components/LabeledList.tsx @@ -60,7 +60,8 @@ const LabeledListItem = (props: LabeledListItemProps) => { as="span" style={{ borderBottom: '2px dotted rgba(255, 255, 255, 0.8)', - }}> + }} + > {innerLabel} @@ -76,7 +77,8 @@ const LabeledListItem = (props: LabeledListItemProps) => { // Kinda flipped because we want nowrap as default. Cleaner CSS this way though. !labelWrap && 'LabeledList__label--nowrap', ])} - verticalAlign={verticalAlign}> + verticalAlign={verticalAlign} + > {innerLabel} ); @@ -90,7 +92,8 @@ const LabeledListItem = (props: LabeledListItemProps) => { textAlign={textAlign} className={classes(['LabeledList__cell', 'LabeledList__content'])} colSpan={buttons ? undefined : 2} - verticalAlign={verticalAlign}> + verticalAlign={verticalAlign} + > {content} {children} @@ -114,7 +117,8 @@ const LabeledListDivider = (props: LabeledListDividerProps) => { style={{ paddingTop: padding, paddingBottom: padding, - }}> + }} + > diff --git a/tgui/packages/tgui/components/MenuBar.tsx b/tgui/packages/tgui/components/MenuBar.tsx index 40a2027f26..acf35e8281 100644 --- a/tgui/packages/tgui/components/MenuBar.tsx +++ b/tgui/packages/tgui/components/MenuBar.tsx @@ -54,7 +54,8 @@ class Menu extends Component { className={'MenuBar__menu'} style={{ width: width, - }}> + }} + > {children}
); @@ -107,14 +108,16 @@ class MenuBarButton extends Component { ])} {...rest} onClick={disabled ? () => null : onClick} - onMouseOver={onMouseOver}> + onMouseOver={onMouseOver} + > {display} {open && ( + onOutsideClick={onOutsideClick} + > {children} )} @@ -170,7 +173,8 @@ export const Dropdown = (props: MenuBarItemProps) => { if (openOnHover) { setOpenMenuBar(entry); } - }}> + }} + > {children} ); @@ -186,7 +190,8 @@ const MenuItemToggle = (props) => { 'MenuBar__MenuItemToggle', 'MenuBar__hover', ])} - onClick={() => onClick(value)}> + onClick={() => onClick(value)} + >
{checked && }
@@ -206,7 +211,8 @@ const MenuItem = (props) => { 'MenuBar__MenuItem', 'MenuBar__hover', ])} - onClick={() => onClick(value)}> + onClick={() => onClick(value)} + > {displayText} ); diff --git a/tgui/packages/tgui/components/Modal.jsx b/tgui/packages/tgui/components/Modal.jsx index 54c8c090ec..9cad4de810 100644 --- a/tgui/packages/tgui/components/Modal.jsx +++ b/tgui/packages/tgui/components/Modal.jsx @@ -25,7 +25,8 @@ export const Modal = (props) => {
+ {...computeBoxProps(rest)} + > {children}
diff --git a/tgui/packages/tgui/components/NanoMap.jsx b/tgui/packages/tgui/components/NanoMap.jsx index ad21c6efc9..d4f6d7a58c 100644 --- a/tgui/packages/tgui/components/NanoMap.jsx +++ b/tgui/packages/tgui/components/NanoMap.jsx @@ -132,13 +132,13 @@ export class NanoMap extends Component { height: mapSize, 'margin-top': offsetY + 'px', 'margin-left': offsetX + 'px', - 'overflow': 'hidden', - 'position': 'relative', + overflow: 'hidden', + position: 'relative', 'background-image': 'url(' + mapUrl + ')', 'background-size': 'cover', 'background-repeat': 'no-repeat', 'text-align': 'center', - 'cursor': dragging ? 'move' : 'auto', + cursor: dragging ? 'move' : 'auto', }; return ( @@ -147,7 +147,8 @@ export class NanoMap extends Component { style={newStyle} textAlign="center" onMouseDown={this.handleDragStart} - onClick={this.handleOnClick}> + onClick={this.handleOnClick} + > {children} @@ -176,7 +177,8 @@ const NanoMapMarker = (props, context) => { lineHeight="0" bottom={ry + 'px'} left={rx + 'px'} - onMouseDown={handleOnClick}> + onMouseDown={handleOnClick} + > @@ -210,7 +212,7 @@ const NanoMapZoomer = (props) => { selected={~~level === ~~config.mapZLevel} content={level} onClick={() => { - act('setZLevel', { 'mapZLevel': level }); + act('setZLevel', { mapZLevel: level }); }} /> ))} diff --git a/tgui/packages/tgui/components/NumberInput.jsx b/tgui/packages/tgui/components/NumberInput.jsx index 1910c14eb8..24c7a7d7ac 100644 --- a/tgui/packages/tgui/components/NumberInput.jsx +++ b/tgui/packages/tgui/components/NumberInput.jsx @@ -40,7 +40,7 @@ export class NumberInput extends Component { this.setState({ suppressingFlicker: false, }), - suppressFlicker + suppressFlicker, ); } }; @@ -87,13 +87,13 @@ export class NumberInput extends Component { state.internalValue = clamp( state.internalValue + (offset * step) / stepPixelSize, minValue - step, - maxValue + step + maxValue + step, ); // Clamp the final value state.value = clamp( state.internalValue - (state.internalValue % step) + stepOffset, minValue, - maxValue + maxValue, ); state.origin = e.screenY; } else if (Math.abs(offset) > 4) { @@ -190,7 +190,8 @@ export class NumberInput extends Component { minHeight={height} lineHeight={lineHeight} fontSize={fontSize} - onMouseDown={this.handleDragStart}> + onMouseDown={this.handleDragStart} + >
diff --git a/tgui/packages/tgui/components/Popper.tsx b/tgui/packages/tgui/components/Popper.tsx index b3907e59e4..dbc7c18f7b 100644 --- a/tgui/packages/tgui/components/Popper.tsx +++ b/tgui/packages/tgui/components/Popper.tsx @@ -1,5 +1,11 @@ import { Placement } from '@popperjs/core'; -import { PropsWithChildren, ReactNode, useEffect, useRef, useState } from 'react'; +import { + PropsWithChildren, + ReactNode, + useEffect, + useRef, + useState, +} from 'react'; import { usePopper } from 'react-popper'; type RequiredProps = { @@ -29,7 +35,7 @@ export function Popper(props: PropsWithChildren) { const [referenceElement, setReferenceElement] = useState(null); const [popperElement, setPopperElement] = useState( - null + null, ); // One would imagine we could just use useref here, but it's against react-popper documentation and causes a positioning bug @@ -69,7 +75,8 @@ export function Popper(props: PropsWithChildren) { ref={(node) => { setReferenceElement(node); parentRef.current = node; - }}> + }} + > {children}
{isOpen && ( @@ -79,7 +86,8 @@ export function Popper(props: PropsWithChildren) { popperRef.current = node; }} style={{ ...styles.popper, zIndex: 5 }} - {...attributes.popper}> + {...attributes.popper} + > {content}
)} diff --git a/tgui/packages/tgui/components/RestrictedInput.jsx b/tgui/packages/tgui/components/RestrictedInput.jsx index ad2b19d2dc..362510fbfa 100644 --- a/tgui/packages/tgui/components/RestrictedInput.jsx +++ b/tgui/packages/tgui/components/RestrictedInput.jsx @@ -47,7 +47,7 @@ export class RestrictedInput extends Component { e.target.value, minValue, maxValue, - allowFloats + allowFloats, ); if (onChange) { onChange(e, +e.target.value); @@ -76,7 +76,7 @@ export class RestrictedInput extends Component { e.target.value, minValue, maxValue, - allowFloats + allowFloats, ); this.setEditing(false); if (onChange) { @@ -110,7 +110,7 @@ export class RestrictedInput extends Component { nextValue, minValue, maxValue, - allowFloats + allowFloats, ); } if (this.props.autoFocus || this.props.autoSelect) { @@ -136,7 +136,7 @@ export class RestrictedInput extends Component { nextValue, minValue, maxValue, - allowFloats + allowFloats, ); } } @@ -158,7 +158,8 @@ export class RestrictedInput extends Component { monospace && 'Input--monospace', className, ])} - {...rest}> + {...rest} + >
.
{ ...style, }, ...rest, - })}> + })} + > {(alertAfter || alertBefore) && ( + ])} + > )} @@ -96,7 +98,7 @@ export const RoundGauge = (props) => { style={{ strokeDashoffset: Math.max( (2.0 - (col_ranges[1] - col_ranges[0])) * Math.PI * 50, - 0 + 0, ), }} transform={`rotate(${180 + 180 * col_ranges[0]} 50 50)`} @@ -109,7 +111,8 @@ export const RoundGauge = (props) => { + transform={`rotate(${clampedValue * 180 - 90} 50 50)`} + > { className, computeBoxClassName(rest), ])} - {...computeBoxProps(rest)}> + {...computeBoxProps(rest)} + > {hasTitle && (
{title} @@ -89,7 +90,8 @@ export const Section = (props: SectionProps) => { 'Section__content', !!stretchContents && 'Section__content--stretchContents', // VOREStation Addition !!noTopPadding && 'Section__content--noTopPadding', // VOREStation Addition - ])}> + ])} + > {children}
diff --git a/tgui/packages/tgui/components/Slider.jsx b/tgui/packages/tgui/components/Slider.jsx index 206029e663..aa84a41728 100644 --- a/tgui/packages/tgui/components/Slider.jsx +++ b/tgui/packages/tgui/components/Slider.jsx @@ -47,7 +47,8 @@ export const Slider = (props) => { suppressFlicker, unit, value, - }}> + }} + > {(control) => { const { dragging, @@ -63,7 +64,7 @@ export const Slider = (props) => { const scaledFillValue = scale( fillValue ?? displayValue, minValue, - maxValue + maxValue, ); const scaledDisplayValue = scale(displayValue, minValue, maxValue); // prettier-ignore @@ -79,7 +80,8 @@ export const Slider = (props) => { computeBoxClassName(rest), ])} {...computeBoxProps(rest)} - onMouseDown={handleDragStart}> + onMouseDown={handleDragStart} + >
{ className="Slider__cursorOffset" style={{ width: clamp01(scaledDisplayValue) * 100 + '%', - }}> + }} + >
{dragging && ( diff --git a/tgui/packages/tgui/components/Stack.tsx b/tgui/packages/tgui/components/Stack.tsx index e12c2ed76a..2564d20a18 100644 --- a/tgui/packages/tgui/components/Stack.tsx +++ b/tgui/packages/tgui/components/Stack.tsx @@ -7,7 +7,14 @@ import { classes } from 'common/react'; import { RefObject } from 'react'; -import { computeFlexClassName, computeFlexItemClassName, computeFlexItemProps, computeFlexProps, FlexItemProps, FlexProps } from './Flex'; +import { + computeFlexClassName, + computeFlexItemClassName, + computeFlexItemProps, + computeFlexProps, + FlexItemProps, + FlexProps, +} from './Flex'; type Props = Partial<{ vertical: boolean; diff --git a/tgui/packages/tgui/components/Table.jsx b/tgui/packages/tgui/components/Table.jsx index 60e7ea1cd2..f9a59b36c7 100644 --- a/tgui/packages/tgui/components/Table.jsx +++ b/tgui/packages/tgui/components/Table.jsx @@ -17,7 +17,8 @@ export const Table = (props) => { className, computeBoxClassName(rest), ])} - {...computeBoxProps(rest)}> + {...computeBoxProps(rest)} + > {children} ); diff --git a/tgui/packages/tgui/components/Tabs.tsx b/tgui/packages/tgui/components/Tabs.tsx index 0e0bbf9852..84779bcf74 100644 --- a/tgui/packages/tgui/components/Tabs.tsx +++ b/tgui/packages/tgui/components/Tabs.tsx @@ -44,7 +44,8 @@ export const Tabs = (props: Props) => { className, computeBoxClassName(rest), ])} - {...computeBoxProps(rest)}> + {...computeBoxProps(rest)} + > {children}
); @@ -72,7 +73,8 @@ const Tab = (props: TabProps) => { className, computeBoxClassName(rest), ])} - {...computeBoxProps(rest)}> + {...computeBoxProps(rest)} + > {(canRender(leftSlot) &&
{leftSlot}
) || (!!icon && (
diff --git a/tgui/packages/tgui/components/TextArea.jsx b/tgui/packages/tgui/components/TextArea.jsx index 7831ea9c19..e5d67cedf4 100644 --- a/tgui/packages/tgui/components/TextArea.jsx +++ b/tgui/packages/tgui/components/TextArea.jsx @@ -197,7 +197,8 @@ export class TextArea extends Component { noborder && 'TextArea--noborder', className, ])} - {...rest}> + {...rest} + > {!!displayedValue && (
+ }} + > {displayedValue}
diff --git a/tgui/packages/tgui/components/Tooltip.tsx b/tgui/packages/tgui/components/Tooltip.tsx index ee7b40e0b8..f3936f32c6 100644 --- a/tgui/packages/tgui/components/Tooltip.tsx +++ b/tgui/packages/tgui/components/Tooltip.tsx @@ -117,7 +117,7 @@ export class Tooltip extends Component { { ...DEFAULT_OPTIONS, placement: this.props.position || 'auto', - } + }, ); Tooltip.singletonPopper = singletonPopper; diff --git a/tgui/packages/tgui/constants.ts b/tgui/packages/tgui/constants.ts index f4cb574dbb..909f804179 100644 --- a/tgui/packages/tgui/constants.ts +++ b/tgui/packages/tgui/constants.ts @@ -91,94 +91,94 @@ export const CSS_COLORS = [ // go use /client/verb/generate_tgui_radio_constants() in communications.dm. export const RADIO_CHANNELS = [ { - 'name': 'Mercenary', - 'freq': 1213, - 'color': '#6D3F40', + name: 'Mercenary', + freq: 1213, + color: '#6D3F40', }, { - 'name': 'Raider', - 'freq': 1277, - 'color': '#6D3F40', + name: 'Raider', + freq: 1277, + color: '#6D3F40', }, { - 'name': 'Special Ops', - 'freq': 1341, - 'color': '#5C5C8A', + name: 'Special Ops', + freq: 1341, + color: '#5C5C8A', }, { - 'name': 'AI Private', - 'freq': 1343, - 'color': '#FF00FF', + name: 'AI Private', + freq: 1343, + color: '#FF00FF', }, { - 'name': 'Response Team', - 'freq': 1345, - 'color': '#5C5C8A', + name: 'Response Team', + freq: 1345, + color: '#5C5C8A', }, { - 'name': 'Supply', - 'freq': 1347, - 'color': '#5F4519', + name: 'Supply', + freq: 1347, + color: '#5F4519', }, { - 'name': 'Service', - 'freq': 1349, - 'color': '#6eaa2c', + name: 'Service', + freq: 1349, + color: '#6eaa2c', }, { - 'name': 'Science', - 'freq': 1351, - 'color': '#993399', + name: 'Science', + freq: 1351, + color: '#993399', }, { - 'name': 'Command', - 'freq': 1353, - 'color': '#193A7A', + name: 'Command', + freq: 1353, + color: '#193A7A', }, { - 'name': 'Medical', - 'freq': 1355, - 'color': '#008160', + name: 'Medical', + freq: 1355, + color: '#008160', }, { - 'name': 'Engineering', - 'freq': 1357, - 'color': '#A66300', + name: 'Engineering', + freq: 1357, + color: '#A66300', }, { - 'name': 'Security', - 'freq': 1359, - 'color': '#A30000', + name: 'Security', + freq: 1359, + color: '#A30000', }, { - 'name': 'Explorer', - 'freq': 1361, - 'color': '#555555', + name: 'Explorer', + freq: 1361, + color: '#555555', }, { - 'name': 'Talon', - 'freq': 1363, - 'color': '#555555', + name: 'Talon', + freq: 1363, + color: '#555555', }, { - 'name': 'Common', - 'freq': 1459, - 'color': '#008000', + name: 'Common', + freq: 1459, + color: '#008000', }, { - 'name': 'Entertainment', - 'freq': 1461, - 'color': '#339966', + name: 'Entertainment', + freq: 1461, + color: '#339966', }, { - 'name': 'Security(I)', - 'freq': 1475, - 'color': '#008000', + name: 'Security(I)', + freq: 1475, + color: '#008000', }, { - 'name': 'Medical(I)', - 'freq': 1485, - 'color': '#008000', + name: 'Medical(I)', + freq: 1485, + color: '#008000', }, ] as const; @@ -187,58 +187,58 @@ Entries must match /code/defines/gases.dm entries. */ const GASES = [ { - 'id': 'oxygen', - 'name': 'Oxygen', - 'label': 'Oâ‚‚', - 'color': 'blue', + id: 'oxygen', + name: 'Oxygen', + label: 'Oâ‚‚', + color: 'blue', }, { - 'id': 'nitrogen', - 'name': 'Nitrogen', - 'label': 'Nâ‚‚', - 'color': 'green', + id: 'nitrogen', + name: 'Nitrogen', + label: 'Nâ‚‚', + color: 'green', }, { - 'id': 'carbon_dioxide', - 'name': 'Carbon Dioxide', - 'label': 'COâ‚‚', - 'color': 'grey', + id: 'carbon_dioxide', + name: 'Carbon Dioxide', + label: 'COâ‚‚', + color: 'grey', }, { - 'id': 'phoron', - 'name': 'Phoron', - 'label': 'Phoron', - 'color': 'pink', + id: 'phoron', + name: 'Phoron', + label: 'Phoron', + color: 'pink', }, { - 'id': 'volatile_fuel', - 'name': 'Volatile Fuel', - 'label': 'EXP', - 'color': 'teal', + id: 'volatile_fuel', + name: 'Volatile Fuel', + label: 'EXP', + color: 'teal', }, { - 'id': 'nitrous_oxide', - 'name': 'Nitrous Oxide', - 'label': 'Nâ‚‚O', - 'color': 'red', + id: 'nitrous_oxide', + name: 'Nitrous Oxide', + label: 'Nâ‚‚O', + color: 'red', }, { - 'id': 'other', - 'name': 'Other', - 'label': 'Other', - 'color': 'white', + id: 'other', + name: 'Other', + label: 'Other', + color: 'white', }, { - 'id': 'pressure', - 'name': 'Pressure', - 'label': 'Pressure', - 'color': 'average', + id: 'pressure', + name: 'Pressure', + label: 'Pressure', + color: 'average', }, { - 'id': 'temperature', - 'name': 'Temperature', - 'label': 'Temperature', - 'color': 'yellow', + id: 'temperature', + name: 'Temperature', + label: 'Temperature', + color: 'yellow', }, ] as const; @@ -252,7 +252,7 @@ export const getGasLabel = (gasId: string, fallbackValue?: string) => { const gasSearchId = gasId.toLowerCase(); const gasSearchName = gasId.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => - letter.toUpperCase() + letter.toUpperCase(), ); for (let idx = 0; idx < GASES.length; idx++) { @@ -272,7 +272,7 @@ export const getGasColor = (gasId: string) => { const gasSearchId = gasId.toLowerCase(); const gasSearchName = gasId.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => - letter.toUpperCase() + letter.toUpperCase(), ); for (let idx = 0; idx < GASES.length; idx++) { @@ -292,7 +292,7 @@ export const getGasFromId = (gasId: string): Gas | undefined => { const gasSearchId = gasId.toLowerCase(); const gasSearchName = gasId.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => - letter.toUpperCase() + letter.toUpperCase(), ); for (let idx = 0; idx < GASES.length; idx++) { diff --git a/tgui/packages/tgui/debug/KitchenSink.jsx b/tgui/packages/tgui/debug/KitchenSink.jsx index cd6ba33c42..d215ab777d 100644 --- a/tgui/packages/tgui/debug/KitchenSink.jsx +++ b/tgui/packages/tgui/debug/KitchenSink.jsx @@ -38,7 +38,8 @@ export const KitchenSink = (props) => { key={i} color="transparent" selected={i === pageIndex} - onClick={() => setPageIndex(i)}> + onClick={() => setPageIndex(i)} + > {story.meta.title} ))} diff --git a/tgui/packages/tgui/debug/middleware.js b/tgui/packages/tgui/debug/middleware.js index 519d8b5272..3f7414335e 100644 --- a/tgui/packages/tgui/debug/middleware.js +++ b/tgui/packages/tgui/debug/middleware.js @@ -8,7 +8,11 @@ import { KEY_BACKSPACE, KEY_F10, KEY_F11, KEY_F12 } from 'common/keycodes'; import { globalEvents } from '../events'; import { acquireHotKey } from '../hotkeys'; -import { openExternalBrowser, toggleDebugLayout, toggleKitchenSink } from './actions'; +import { + openExternalBrowser, + toggleDebugLayout, + toggleKitchenSink, +} from './actions'; // prettier-ignore const relayedTypes = [ diff --git a/tgui/packages/tgui/drag.ts b/tgui/packages/tgui/drag.ts index c26df518b7..584666a97a 100644 --- a/tgui/packages/tgui/drag.ts +++ b/tgui/packages/tgui/drag.ts @@ -76,7 +76,7 @@ const getScreenSize = (): [number, number] => [ export const touchRecents = ( recents: string[], touchedItem: string, - limit = 50 + limit = 50, ): [string[], string | undefined] => { const nextRecents: string[] = [touchedItem]; let trimmedItem: string | undefined; @@ -105,7 +105,7 @@ const storeWindowGeometry = async () => { // Update the list of stored geometries const [geometries, trimmedKey] = touchRecents( (await storage.get('geometries')) || [], - windowKey + windowKey, ); if (trimmedKey) { storage.remove(trimmedKey); @@ -120,7 +120,7 @@ export const recallWindowGeometry = async ( pos?: [number, number]; size?: [number, number]; locked?: boolean; - } = {} + } = {}, ) => { const geometry = options.fancy && (await storage.get(windowKey)); if (geometry) { @@ -157,7 +157,7 @@ export const recallWindowGeometry = async ( pos = vecAdd( vecScale(areaAvailable, 0.5), vecScale(size, -0.5), - vecScale(screenOffset, -1.0) + vecScale(screenOffset, -1.0), ); setWindowPosition(pos); } @@ -182,7 +182,7 @@ export const setupDrag = async () => { */ const constraintPosition = ( pos: [number, number], - size: [number, number] + size: [number, number], ): [boolean, [number, number]] => { const screenPos = getScreenPosition(); const screenSize = getScreenSize(); @@ -208,7 +208,7 @@ export const dragStartHandler = (event) => { dragging = true; dragPointOffset = vecSubtract( [event.screenX, event.screenY], - getWindowPosition() + getWindowPosition(), ); // Focus click target (event.target as HTMLElement)?.focus(); @@ -234,7 +234,7 @@ const dragMoveHandler = (event: MouseEvent) => { } event.preventDefault(); setWindowPosition( - vecSubtract([event.screenX, event.screenY], dragPointOffset) + vecSubtract([event.screenX, event.screenY], dragPointOffset), ); }; @@ -246,7 +246,7 @@ export const resizeStartHandler = resizing = true; dragPointOffset = vecSubtract( [event.screenX, event.screenY], - getWindowPosition() + getWindowPosition(), ); initialSize = getWindowSize(); // Focus click target @@ -274,7 +274,7 @@ const resizeMoveHandler = (event: MouseEvent) => { event.preventDefault(); const currentOffset = vecSubtract( [event.screenX, event.screenY], - getWindowPosition() + getWindowPosition(), ); const delta = vecSubtract(currentOffset, dragPointOffset); // Extra 1x1 area is added to ensure the browser can see the cursor diff --git a/tgui/packages/tgui/events.test.ts b/tgui/packages/tgui/events.test.ts index 5acee62cba..e7a6c25018 100644 --- a/tgui/packages/tgui/events.test.ts +++ b/tgui/packages/tgui/events.test.ts @@ -1,4 +1,10 @@ -import { addScrollableNode, canStealFocus, KeyEvent, removeScrollableNode, setupGlobalEvents } from './events'; +import { + addScrollableNode, + canStealFocus, + KeyEvent, + removeScrollableNode, + setupGlobalEvents, +} from './events'; describe('focusEvents', () => { afterEach(() => { diff --git a/tgui/packages/tgui/events.ts b/tgui/packages/tgui/events.ts index 62aca2046b..a31f4821d6 100644 --- a/tgui/packages/tgui/events.ts +++ b/tgui/packages/tgui/events.ts @@ -13,7 +13,7 @@ export const globalEvents = new EventEmitter(); let ignoreWindowFocus = false; export const setupGlobalEvents = ( - options: { ignoreWindowFocus?: boolean } = {} + options: { ignoreWindowFocus?: boolean } = {}, ): void => { ignoreWindowFocus = !!options.ignoreWindowFocus; }; diff --git a/tgui/packages/tgui/format.test.ts b/tgui/packages/tgui/format.test.ts index 011d9e9e6c..8fdc6683c4 100644 --- a/tgui/packages/tgui/format.test.ts +++ b/tgui/packages/tgui/format.test.ts @@ -1,4 +1,10 @@ -import { formatDb, formatMoney, formatSiBaseTenUnit, formatSiUnit, formatTime } from './format'; +import { + formatDb, + formatMoney, + formatSiBaseTenUnit, + formatSiUnit, + formatTime, +} from './format'; describe('formatSiUnit', () => { it('formats base values correctly', () => { diff --git a/tgui/packages/tgui/format.ts b/tgui/packages/tgui/format.ts index eb76bd2255..4ebc03e710 100644 --- a/tgui/packages/tgui/format.ts +++ b/tgui/packages/tgui/format.ts @@ -36,7 +36,7 @@ const SI_BASE_INDEX = SI_SYMBOLS.indexOf(' '); export const formatSiUnit = ( value: number, minBase1000 = -SI_BASE_INDEX, - unit = '' + unit = '', ): string => { if (!isFinite(value)) { return value.toString(); @@ -123,7 +123,7 @@ const SI_BASE_TEN_UNITS = [ export const formatSiBaseTenUnit = ( value: number, minBase1000 = 0, - unit = '' + unit = '', ): string => { if (!isFinite(value)) { return 'NaN'; @@ -147,7 +147,7 @@ export const formatSiBaseTenUnit = ( */ export const formatTime = ( val: number, - formatType: 'short' | 'default' = 'default' + formatType: 'short' | 'default' = 'default', ): string => { const totalSeconds = Math.floor(val / 10); const hours = Math.floor(totalSeconds / 3600); diff --git a/tgui/packages/tgui/http.ts b/tgui/packages/tgui/http.ts index a0ea97c3b6..b9dfe9c60c 100644 --- a/tgui/packages/tgui/http.ts +++ b/tgui/packages/tgui/http.ts @@ -4,7 +4,7 @@ export const fetchRetry = ( url: string, options?: RequestInit, - retryTimer: number = 1000 + retryTimer: number = 1000, ): Promise => { return fetch(url, options).catch(() => { return new Promise((resolve) => { diff --git a/tgui/packages/tgui/interfaces/APC.jsx b/tgui/packages/tgui/interfaces/APC.jsx index a03ca643e1..410cf83d63 100644 --- a/tgui/packages/tgui/interfaces/APC.jsx +++ b/tgui/packages/tgui/interfaces/APC.jsx @@ -1,6 +1,14 @@ import { Fragment } from 'react'; import { useBackend } from '../backend'; -import { Box, Button, Dimmer, Icon, LabeledList, ProgressBar, Section } from '../components'; +import { + Box, + Button, + Dimmer, + Icon, + LabeledList, + ProgressBar, + Section, +} from '../components'; import { Window } from '../layouts'; import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox'; import { FullscreenNotice } from './common/FullscreenNotice'; @@ -103,7 +111,8 @@ const ApcContent = (props) => { disabled={locked} onClick={() => act('breaker')} /> - }> + } + > [ {externalPowerStatus.externalPowerText} ] @@ -120,7 +129,8 @@ const ApcContent = (props) => { disabled={locked} onClick={() => act('charge')} /> - }> + } + > [ {chargingStatus.chargingText} ] @@ -138,7 +148,8 @@ const ApcContent = (props) => { = 2 ? 'good' : 'bad'}> + color={channel.status >= 2 ? 'good' : 'bad'} + > {channel.status >= 2 ? 'On' : 'Off'}
); diff --git a/tgui/packages/tgui/interfaces/CrewMonitor.jsx b/tgui/packages/tgui/interfaces/CrewMonitor.jsx index 8f8f1f8cfc..6ca8cb56e7 100644 --- a/tgui/packages/tgui/interfaces/CrewMonitor.jsx +++ b/tgui/packages/tgui/interfaces/CrewMonitor.jsx @@ -130,13 +130,15 @@ export const CrewMonitorContent = (props) => { setTabIndex(0)}> + onClick={() => setTabIndex(0)} + > Data View setTabIndex(1)}> + onClick={() => setTabIndex(1)} + > Map View @@ -153,7 +155,7 @@ const CrewMonitorMapView = (props) => { setZoom(v)}> {data.crewmembers .filter( - (x) => x.sensor_type === 3 && ~~x.realZ === ~~config.mapZLevel + (x) => x.sensor_type === 3 && ~~x.realZ === ~~config.mapZLevel, ) .map((cm) => ( { - }> + } + > {hasOccupant ? ( @@ -71,13 +82,15 @@ const CryoContent = (props) => { min={occupant.health} max={occupant.maxHealth} value={occupant.health / occupant.maxHealth} - color={occupant.health > 0 ? 'good' : 'average'}> + color={occupant.health > 0 ? 'good' : 'average'} + > + color={statNames[occupant.stat][0]} + > {statNames[occupant.stat][1]} @@ -89,7 +102,8 @@ const CryoContent = (props) => { + ranges={{ bad: [0.01, Infinity] }} + > @@ -113,16 +127,19 @@ const CryoContent = (props) => { - }> + } + > diff --git a/tgui/packages/tgui/interfaces/CryoStorage.jsx b/tgui/packages/tgui/interfaces/CryoStorage.jsx index d78d886fb2..94b726643a 100644 --- a/tgui/packages/tgui/interfaces/CryoStorage.jsx +++ b/tgui/packages/tgui/interfaces/CryoStorage.jsx @@ -59,13 +59,15 @@ export const CryoStorageItems = (props) => { - }> + } + > {(items.length && items.map((item) => ( ))) || No items stored.} diff --git a/tgui/packages/tgui/interfaces/DNAForensics.jsx b/tgui/packages/tgui/interfaces/DNAForensics.jsx index cf4bb1a64a..64d297d04c 100644 --- a/tgui/packages/tgui/interfaces/DNAForensics.jsx +++ b/tgui/packages/tgui/interfaces/DNAForensics.jsx @@ -17,17 +17,20 @@ export const DNAForensics = (props) => { selected={scanning} disabled={!bloodsamp} icon="power-off" - onClick={() => act('scanItem')}> + onClick={() => act('scanItem')} + > {scanning ? 'Halt Scan' : 'Begin Scan'} - }> + } + > { onClick={() => act('ejectOccupant')} /> - }> + } + > {hasOccupant ? ( <> @@ -182,7 +194,8 @@ const DNAModifierMain = (props) => { act('selectMenuKey', { key: op[0] })}> + onClick={() => act('selectMenuKey', { key: op[0] })} + > {op[1]} @@ -363,7 +376,8 @@ const DNAModifierMainBuffersElement = (props) => { } /> - }> + } + >
@@ -576,7 +586,8 @@ const DockingConsoleSimple = (props) => { onClick={() => act('toggle_override')} /> - }> + } + > @@ -608,7 +619,8 @@ const DockingConsoleMulti = (props) => { + label={airlock.name} + > {airlock.override_enabled ? 'OVERRIDE ENABLED' : 'STATUS OK'} ))} @@ -664,7 +676,8 @@ const DoorAccessConsole = (props) => { }} /> - }> + } + > {data.exterior_status.state === 'closed' ? 'Locked' : 'Open'} diff --git a/tgui/packages/tgui/interfaces/EntityNarrate.tsx b/tgui/packages/tgui/interfaces/EntityNarrate.tsx index e4fea4ff0f..2152ccebdc 100644 --- a/tgui/packages/tgui/interfaces/EntityNarrate.tsx +++ b/tgui/packages/tgui/interfaces/EntityNarrate.tsx @@ -1,7 +1,15 @@ import { BooleanLike } from 'common/react'; import { useBackend, useLocalState } from '../backend'; -import { Box, Button, Divider, Flex, Section, Tabs, TextArea } from '../components'; +import { + Box, + Button, + Divider, + Flex, + Section, + Tabs, + TextArea, +} from '../components'; import { Window } from '../layouts'; type data = { @@ -74,13 +82,15 @@ export const EntitySelection = (props) => { content="Multi-Selection" onClick={() => act('change_mode_multi')} /> - }> + } + > {entity_names.map((name) => ( act('select_entity', { id_selected: name })}> + onClick={() => act('select_entity', { id_selected: name })} + > {name} ))} @@ -168,7 +178,8 @@ export const NarrationInput = (props) => { onClick={() => act('narrate', { message: narration })} content="Send Narration" /> - }> + } + >