diff --git a/package.json b/package.json index 3f9c9466a..dfc476e8c 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@tanstack/react-table": "^8.10.3", "autobind-decorator": "^2.4.0", "base64-js": "^1.5.1", - "classnames": "^2.3.1", + "clsx": "^2.1.1", "dayjs": "^1.11.3", "dompurify": "^3.0.2", "electron-squirrel-startup": "^1.0.0", @@ -70,7 +70,6 @@ "@babel/preset-typescript": "^7.17.12", "@electron/rebuild": "^3.6.0", "@svgr/webpack": "^8.1.0", - "@types/classnames": "^2.3.1", "@types/electron": "^1.6.10", "@types/node": "^20.11.0", "@types/papaparse": "^5.3.10", diff --git a/src/app/app.tsx b/src/app/app.tsx index b9e1a126d..e05e28ff4 100644 --- a/src/app/app.tsx +++ b/src/app/app.tsx @@ -4,7 +4,7 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; -import cn from "classnames"; +import { clsx } from "clsx"; import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; @@ -133,7 +133,7 @@ class App extends React.Component<{}, {}> { const rightSidebarCollapsed = GlobalModel.rightSidebarModel.getCollapsed(); const activeMainView = GlobalModel.activeMainView.get(); const lightDarkClass = GlobalModel.isDarkTheme.get() ? "is-dark" : "is-light"; - const mainClassName = cn( + const mainClassName = clsx( "platform-" + platform, { "mainsidebar-collapsed": mainSidebarCollapsed, diff --git a/src/app/bookmarks/bookmarks.tsx b/src/app/bookmarks/bookmarks.tsx index 31e31953d..1ba2b0747 100644 --- a/src/app/bookmarks/bookmarks.tsx +++ b/src/app/bookmarks/bookmarks.tsx @@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; -import cn from "classnames"; +import { clsx } from "clsx"; import { GlobalModel } from "@/models"; import { CmdStrCode, Markdown } from "@/common/elements"; @@ -152,11 +152,11 @@ class Bookmark extends React.Component { return (
-
+
@@ -198,12 +198,12 @@ class Bookmark extends React.Component { } return (
-
+
{bm.bookmarkid.substr(0, 8)}
diff --git a/src/app/common/elements/button.tsx b/src/app/common/elements/button.tsx index 325317437..092a1f566 100644 --- a/src/app/common/elements/button.tsx +++ b/src/app/common/elements/button.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { boundMethod } from "autobind-decorator"; -import cn from "classnames"; +import { clsx } from "clsx"; import "./button.less"; @@ -35,7 +35,7 @@ class Button extends React.Component { return (
-
+
0 && numSelected == items.length} @@ -498,7 +498,7 @@ class HistoryView extends React.Component<{}, {}> { />
{ Showing {offset + 1}-{offset + items.length}
@@ -538,7 +538,7 @@ class HistoryView extends React.Component<{}, {}> {
@@ -608,21 +608,21 @@ class HistoryView extends React.Component<{}, {}> {
Showing {offset + 1}-{offset + items.length}
diff --git a/src/app/line/linecomps.tsx b/src/app/line/linecomps.tsx index 7c88f39f2..1a33d7b38 100644 --- a/src/app/line/linecomps.tsx +++ b/src/app/line/linecomps.tsx @@ -11,7 +11,7 @@ import localizedFormat from "dayjs/plugin/localizedFormat"; import { Choose, If, Otherwise, When } from "tsx-control-statements/components"; import { GlobalModel, GlobalCommandRunner, Cmd } from "@/models"; import { termHeightFromRows } from "@/util/textmeasure"; -import cn from "classnames"; +import { clsx } from "clsx"; import { getTermPtyData } from "@/util/modelutil"; import { renderCmdText } from "@/common/elements"; @@ -172,7 +172,7 @@ class LineActions extends React.Component<{ screen: LineContainerType; line: Lin
@@ -180,7 +180,7 @@ class LineActions extends React.Component<{ screen: LineContainerType; line: Lin
@@ -220,7 +220,7 @@ class LineActions extends React.Component<{ screen: LineContainerType; line: Lin
@@ -254,7 +254,7 @@ class LineHeader extends React.Component<{ screen: LineContainerType; line: Line
+
{this.renderMeta1(cmd)} {this.renderCmdText(cmd)}
@@ -349,7 +349,7 @@ class SmallLineAvatar extends React.Component<{ line: LineType; cmd: Cmd; onRigh return ( <>
{lineNumStr}
-
+
{icon}
@@ -567,7 +567,7 @@ class LineCmd extends React.Component< const { screen, line, width } = this.props; contentHeight = screen.getUsedRows(lineutil.getRendererContext(line), line, cmd, width); } - const mainDivCn = cn("line", "line-cmd"); + const mainDivCn = clsx("line", "line-cmd"); if (DebugHeightProblems && line.linenum >= MinLine && line.linenum <= MaxLine) { heightLog[line.linenum] = heightLog[line.linenum] || {}; heightLog[line.linenum].contentHeight = contentHeight; @@ -582,7 +582,7 @@ class LineCmd extends React.Component< >
@@ -801,7 +801,7 @@ class LineCmd extends React.Component< .get(); const isRunning = cmd.isRunning(); const cmdError = cmdShouldMarkError(cmd); - const mainDivCn = cn( + const mainDivCn = clsx( "line", "line-cmd", { selected: isSelected }, @@ -830,7 +830,7 @@ class LineCmd extends React.Component< onContextMenu={this.handleContextMenu} > -
+
@@ -971,7 +971,7 @@ class LineText extends React.Component< name: "computed-isSelected", }) .get(); - const mainClass = cn("line", "line-text", "focus-parent", { selected: isSelected }); + const mainClass = clsx("line", "line-text", "focus-parent", { selected: isSelected }); return (
; lineElements.push(lineElem); } - let linesClass = cn("lines", renderMode == "normal" ? "lines-expanded" : "lines-collapsed", "wide-scrollbar"); + let linesClass = clsx("lines", renderMode == "normal" ? "lines-expanded" : "lines-collapsed", "wide-scrollbar"); return (
diff --git a/src/app/sidebar/main.tsx b/src/app/sidebar/main.tsx index 1131ebd70..6a22b84dc 100644 --- a/src/app/sidebar/main.tsx +++ b/src/app/sidebar/main.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import cn from "classnames"; +import { clsx } from "clsx"; import dayjs from "dayjs"; import { If } from "tsx-control-statements/components"; @@ -38,7 +38,7 @@ class SideBarItem extends React.Component<{ render() { return (
{this.props.frontIcon} @@ -201,7 +201,7 @@ class MainSideBar extends React.Component { return ( {index + 1}} contents={session.name.get()} endIcons={[ @@ -269,7 +269,7 @@ class MainSideBar extends React.Component { } - className={cn({ highlight: historyActive })} + className={clsx({ highlight: historyActive })} contents="History" endIcons={[]} onClick={this.handleHistoryClick} @@ -278,7 +278,7 @@ class MainSideBar extends React.Component { } - className={cn({ highlight: connectionsActive })} + className={clsx({ highlight: connectionsActive })} contents="Connections" onClick={this.handleConnectionsClick} /> @@ -325,7 +325,7 @@ class MainSideBar extends React.Component { } - className={cn({ highlight: settingsActive })} + className={clsx({ highlight: settingsActive })} contents="Settings" onClick={this.handleSettingsClick} /> diff --git a/src/app/workspace/cmdinput/auxview.tsx b/src/app/workspace/cmdinput/auxview.tsx index 829d1c65c..735814090 100644 --- a/src/app/workspace/cmdinput/auxview.tsx +++ b/src/app/workspace/cmdinput/auxview.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import * as React from "react"; -import cn from "classnames"; +import { clsx } from "clsx"; import { Choose, If, Otherwise, When } from "tsx-control-statements/components"; import { observer } from "mobx-react"; @@ -24,7 +24,7 @@ export const AuxiliaryCmdView: React.FC = observer((props const { title, className, iconClass, titleBarContents, children, onClose, onScrollbarInitialized } = props; return ( -
+
diff --git a/src/app/workspace/cmdinput/cmdinput.tsx b/src/app/workspace/cmdinput/cmdinput.tsx index c6b108bf7..cdf403871 100644 --- a/src/app/workspace/cmdinput/cmdinput.tsx +++ b/src/app/workspace/cmdinput/cmdinput.tsx @@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { Choose, If, When } from "tsx-control-statements/components"; -import cn from "classnames"; +import { clsx } from "clsx"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; @@ -185,7 +185,7 @@ class CmdInput extends React.Component<{}, {}> { } return ( -
+
@@ -239,7 +239,7 @@ class CmdInput extends React.Component<{}, {}> { 0}>
this.toggleFilter(screen)} > @@ -277,7 +277,7 @@ class CmdInput extends React.Component<{}, {}> {
{ onScrollbarInitialized={this.handleScrollbarInitialized} >
{
this.handleCompClick(istr)} key={idx} - className={cn( + className={clsx( "info-comp", { "has-space": this.hasSpace(istr) }, { "metacmd-comp": istr.startsWith("^") } diff --git a/src/app/workspace/cmdinput/textareainput.tsx b/src/app/workspace/cmdinput/textareainput.tsx index a12628dd1..170b83bed 100644 --- a/src/app/workspace/cmdinput/textareainput.tsx +++ b/src/app/workspace/cmdinput/textareainput.tsx @@ -7,7 +7,7 @@ import * as mobx from "mobx"; import * as util from "@/util/util"; import { If } from "tsx-control-statements/components"; import { boundMethod } from "autobind-decorator"; -import cn from "classnames"; +import { clsx } from "clsx"; import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; import { getMonoFontSize } from "@/util/textmeasure"; import * as appconst from "@/app/appconst"; @@ -652,7 +652,7 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: () onSelect={this.onSelect} placeholder="Type here..." maxLength={MaxInputLength} - className={cn("textarea", { "display-disabled": auxViewFocused })} + className={clsx("textarea", { "display-disabled": auxViewFocused })} > - +
), }} diff --git a/src/app/workspace/screen/screenview.tsx b/src/app/workspace/screen/screenview.tsx index 481779fa0..163cbb8d2 100644 --- a/src/app/workspace/screen/screenview.tsx +++ b/src/app/workspace/screen/screenview.tsx @@ -7,7 +7,7 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; -import cn from "classnames"; +import { clsx } from "clsx"; import { debounce } from "throttle-debounce"; import dayjs from "dayjs"; import { GlobalCommandRunner, ForwardLineContainer, GlobalModel, ScreenLines, Screen, Session } from "@/models"; @@ -116,7 +116,7 @@ class ScreenView extends React.Component<{ session: Session; screen: Screen }, {
-
+
[no workspace] @@ -136,7 +136,7 @@ class ScreenView extends React.Component<{ session: Session; screen: Screen }, {
-
+
[no active tab] @@ -479,7 +479,7 @@ class ScreenWindowView extends React.Component { return (
-
+
{message}
@@ -559,7 +559,7 @@ class ScreenWindowView extends React.Component {
-
+
[workspace="{session.name.get()}" tab="{screen.name.get()}"] diff --git a/src/app/workspace/screen/tab.tsx b/src/app/workspace/screen/tab.tsx index 88905e5a4..de62ef60c 100644 --- a/src/app/workspace/screen/tab.tsx +++ b/src/app/workspace/screen/tab.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import cn from "classnames"; +import { clsx } from "clsx"; import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; import { ActionsIcon, StatusIndicator, CenteredIcon } from "@/common/icons/icons"; import * as constants from "@/app/appconst"; @@ -131,7 +131,7 @@ class ScreenTab extends React.Component< value={screen} id={"screentab-" + screen.screenId} data-screenid={screen.screenId} - className={cn( + className={clsx( "screen-tab", { "is-active": activeScreenId == screen.screenId, "is-archived": screen.archived.get() }, "color-" + screen.getTabColor() diff --git a/src/app/workspace/screen/tabs.tsx b/src/app/workspace/screen/tabs.tsx index 294258202..5ebfda261 100644 --- a/src/app/workspace/screen/tabs.tsx +++ b/src/app/workspace/screen/tabs.tsx @@ -7,7 +7,7 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; import { boundMethod } from "autobind-decorator"; import { For, If } from "tsx-control-statements/components"; -import cn from "classnames"; +import { clsx } from "clsx"; import { GlobalModel, GlobalCommandRunner, Session, Screen } from "@/models"; import { ReactComponent as AddIcon } from "@/assets/icons/add.svg"; import { Reorder } from "framer-motion"; diff --git a/src/app/workspace/workspaceview.tsx b/src/app/workspace/workspaceview.tsx index 8b5908373..5b1f58a20 100644 --- a/src/app/workspace/workspaceview.tsx +++ b/src/app/workspace/workspaceview.tsx @@ -4,7 +4,7 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; -import cn from "classnames"; +import { clsx } from "clsx"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import { If } from "tsx-control-statements/components"; @@ -234,7 +234,7 @@ class WorkspaceView extends React.Component<{}, {}> { return (
{ -
+
diff --git a/src/plugins/code/code.tsx b/src/plugins/code/code.tsx index 21742e227..2f5fef458 100644 --- a/src/plugins/code/code.tsx +++ b/src/plugins/code/code.tsx @@ -6,7 +6,7 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import Editor, { Monaco } from "@monaco-editor/react"; import type * as MonacoTypes from "monaco-editor/esm/vs/editor/editor.api"; -import cn from "classnames"; +import { clsx } from "clsx"; import { If } from "tsx-control-statements/components"; import { Markdown, Button } from "@/elements"; import { GlobalModel, GlobalCommandRunner } from "@/models"; @@ -579,7 +579,7 @@ class SourceCodeRenderer extends React.Component<
-
+
{this.state.message.text}
diff --git a/src/plugins/core/basicrenderer.tsx b/src/plugins/core/basicrenderer.tsx index e0dde114b..2b84d6c4a 100644 --- a/src/plugins/core/basicrenderer.tsx +++ b/src/plugins/core/basicrenderer.tsx @@ -7,7 +7,7 @@ import * as mobx from "mobx"; import { debounce } from "throttle-debounce"; import * as util from "@/util/util"; import { GlobalModel } from "@/models"; -import cn from "classnames"; +import { clsx } from "clsx"; class SimpleBlobRendererModel { context: RendererContext; @@ -247,7 +247,7 @@ class SimpleBlobRenderer extends React.Component< return (
loading content @@ -260,7 +260,7 @@ class SimpleBlobRenderer extends React.Component< } let { festate, cmdstr, exitcode } = this.props.initParams.rawCmd; return ( -
+
= (props: Props) => { return (
diff --git a/src/plugins/terminal/terminal.tsx b/src/plugins/terminal/terminal.tsx index 09deab625..0f3a22108 100644 --- a/src/plugins/terminal/terminal.tsx +++ b/src/plugins/terminal/terminal.tsx @@ -10,7 +10,7 @@ import localizedFormat from "dayjs/plugin/localizedFormat"; import { If } from "tsx-control-statements/components"; import { GlobalModel } from "@/models"; import { termHeightFromRows } from "@/util/textmeasure"; -import cn from "classnames"; +import { clsx } from "clsx"; import * as lineutil from "@/app/line/lineutil"; import "./terminal.less"; @@ -207,7 +207,7 @@ class TerminalRenderer extends React.Component<{