diff --git a/src/app/app.tsx b/src/app/app.tsx index bd626a78f..381c18e3c 100644 --- a/src/app/app.tsx +++ b/src/app/app.tsx @@ -8,8 +8,8 @@ import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel } from "../models"; -import { isBlank } from "../util/util"; +import { GlobalModel } from "@/models"; +import { isBlank } from "@/util/util"; import { WorkspaceView } from "./workspace/workspaceview"; import { PluginsView } from "./pluginsview/pluginsview"; import { BookmarksView } from "./bookmarks/bookmarks"; diff --git a/src/app/bookmarks/bookmarks.less b/src/app/bookmarks/bookmarks.less index 462a94b36..f781a5a3a 100644 --- a/src/app/bookmarks/bookmarks.less +++ b/src/app/bookmarks/bookmarks.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .bookmarks-view { background-color: @background-session; diff --git a/src/app/bookmarks/bookmarks.tsx b/src/app/bookmarks/bookmarks.tsx index d86d13c1d..133fa3d89 100644 --- a/src/app/bookmarks/bookmarks.tsx +++ b/src/app/bookmarks/bookmarks.tsx @@ -7,14 +7,14 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel } from "../../models"; -import { CmdStrCode, Markdown } from "../common/elements"; +import { GlobalModel } from "@/models"; +import { CmdStrCode, Markdown } from "@/common/elements"; -import { ReactComponent as XmarkIcon } from "../assets/icons/line/xmark.svg"; -import { ReactComponent as CopyIcon } from "../assets/icons/favourites/copy.svg"; -import { ReactComponent as PenIcon } from "../assets/icons/favourites/pen.svg"; -import { ReactComponent as TrashIcon } from "../assets/icons/favourites/trash.svg"; -import { ReactComponent as FavoritesIcon } from "../assets/icons/favourites.svg"; +import { ReactComponent as XmarkIcon } from "@/assets/icons/line/xmark.svg"; +import { ReactComponent as CopyIcon } from "@/assets/icons/favourites/copy.svg"; +import { ReactComponent as PenIcon } from "@/assets/icons/favourites/pen.svg"; +import { ReactComponent as TrashIcon } from "@/assets/icons/favourites/trash.svg"; +import { ReactComponent as FavoritesIcon } from "@/assets/icons/favourites.svg"; import "./bookmarks.less"; diff --git a/src/app/clientsettings/clientsettings.less b/src/app/clientsettings/clientsettings.less index 034953ecf..2d7b97cd3 100644 --- a/src/app/clientsettings/clientsettings.less +++ b/src/app/clientsettings/clientsettings.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .clientsettings-view { background-color: @background-session; diff --git a/src/app/clientsettings/clientsettings.tsx b/src/app/clientsettings/clientsettings.tsx index 2024c054a..48c7b0ea2 100644 --- a/src/app/clientsettings/clientsettings.tsx +++ b/src/app/clientsettings/clientsettings.tsx @@ -6,10 +6,10 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../models"; -import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "../common/elements"; -import { commandRtnHandler, isBlank } from "../../util/util"; -import * as appconst from "../appconst"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; +import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "@/common/elements"; +import { commandRtnHandler, isBlank } from "@/util/util"; +import * as appconst from "@/app/appconst"; import "./clientsettings.less"; diff --git a/src/app/common/elements/button.less b/src/app/common/elements/button.less index ac10dbdbe..d2303acc4 100644 --- a/src/app/common/elements/button.less +++ b/src/app/common/elements/button.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-button { background: none; diff --git a/src/app/common/elements/checkbox.less b/src/app/common/elements/checkbox.less index f0c52877e..82e126b7c 100644 --- a/src/app/common/elements/checkbox.less +++ b/src/app/common/elements/checkbox.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .checkbox { display: flex; diff --git a/src/app/common/elements/cmdstrcode.less b/src/app/common/elements/cmdstrcode.less index 83bb17fc4..2f54d4301 100644 --- a/src/app/common/elements/cmdstrcode.less +++ b/src/app/common/elements/cmdstrcode.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .cmdstr-code { position: relative; diff --git a/src/app/common/elements/cmdstrcode.tsx b/src/app/common/elements/cmdstrcode.tsx index 8063d8732..67c993251 100644 --- a/src/app/common/elements/cmdstrcode.tsx +++ b/src/app/common/elements/cmdstrcode.tsx @@ -6,8 +6,8 @@ import { boundMethod } from "autobind-decorator"; import cn from "classnames"; import { If } from "tsx-control-statements/components"; -import { ReactComponent as CheckIcon } from "../../assets/icons/line/check.svg"; -import { ReactComponent as CopyIcon } from "../../assets/icons/history/copy.svg"; +import { ReactComponent as CheckIcon } from "@/assets/icons/line/check.svg"; +import { ReactComponent as CopyIcon } from "@/assets/icons/history/copy.svg"; import "./cmdstrcode.less"; diff --git a/src/app/common/elements/dropdown.less b/src/app/common/elements/dropdown.less index 267fbffcf..8a6ad050f 100644 --- a/src/app/common/elements/dropdown.less +++ b/src/app/common/elements/dropdown.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-dropdown { position: relative; diff --git a/src/app/common/elements/inlinesettingstextedit.less b/src/app/common/elements/inlinesettingstextedit.less index bab9243bc..31a77ffbd 100644 --- a/src/app/common/elements/inlinesettingstextedit.less +++ b/src/app/common/elements/inlinesettingstextedit.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .inline-edit { .icon { diff --git a/src/app/common/elements/inlinesettingstextedit.tsx b/src/app/common/elements/inlinesettingstextedit.tsx index ed2b6277c..d6cf9497b 100644 --- a/src/app/common/elements/inlinesettingstextedit.tsx +++ b/src/app/common/elements/inlinesettingstextedit.tsx @@ -7,7 +7,7 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; import { If } from "tsx-control-statements/components"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../../util/keyutil"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; import "./inlinesettingstextedit.less"; diff --git a/src/app/common/elements/inputdecoration.less b/src/app/common/elements/inputdecoration.less index 0ae5f74b5..27f0df9f2 100644 --- a/src/app/common/elements/inputdecoration.less +++ b/src/app/common/elements/inputdecoration.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-input-decoration { display: flex; diff --git a/src/app/common/elements/markdown.less b/src/app/common/elements/markdown.less index 1e68db420..e6ef018c1 100644 --- a/src/app/common/elements/markdown.less +++ b/src/app/common/elements/markdown.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .markdown { color: @term-white; diff --git a/src/app/common/elements/markdown.tsx b/src/app/common/elements/markdown.tsx index 89ea05a37..86c558973 100644 --- a/src/app/common/elements/markdown.tsx +++ b/src/app/common/elements/markdown.tsx @@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react"; import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import cn from "classnames"; -import { GlobalModel } from "../../../models"; +import { GlobalModel } from "@/models"; import "./markdown.less"; diff --git a/src/app/common/elements/modal.less b/src/app/common/elements/modal.less index 7ac04104f..432291f62 100644 --- a/src/app/common/elements/modal.less +++ b/src/app/common/elements/modal.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-modal-container { position: fixed; diff --git a/src/app/common/elements/passwordfield.less b/src/app/common/elements/passwordfield.less index 88c6e948d..753403dec 100644 --- a/src/app/common/elements/passwordfield.less +++ b/src/app/common/elements/passwordfield.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-password { .wave-textfield-inner-eye { diff --git a/src/app/common/elements/resizablesidebar.less b/src/app/common/elements/resizablesidebar.less index 819c05ad1..a67363df7 100644 --- a/src/app/common/elements/resizablesidebar.less +++ b/src/app/common/elements/resizablesidebar.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .sidebar-handle { position: absolute; diff --git a/src/app/common/elements/resizablesidebar.tsx b/src/app/common/elements/resizablesidebar.tsx index 29806ce10..2652c308c 100644 --- a/src/app/common/elements/resizablesidebar.tsx +++ b/src/app/common/elements/resizablesidebar.tsx @@ -6,8 +6,8 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { MagicLayout } from "../../magiclayout"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { MagicLayout } from "@/app/magiclayout"; import "./resizablesidebar.less"; diff --git a/src/app/common/elements/showwaveshellinstallprompt.tsx b/src/app/common/elements/showwaveshellinstallprompt.tsx index 42679ecd0..647cd74d4 100644 --- a/src/app/common/elements/showwaveshellinstallprompt.tsx +++ b/src/app/common/elements/showwaveshellinstallprompt.tsx @@ -1,8 +1,8 @@ // Copyright 2023, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { GlobalModel } from "../../../models"; -import * as appconst from "../../appconst"; +import { GlobalModel } from "@/models"; +import * as appconst from "@/app/appconst"; function ShowWaveShellInstallPrompt(callbackFn: () => void) { let message: string = ` diff --git a/src/app/common/elements/status.less b/src/app/common/elements/status.less index 9c1028b83..e7d15dd98 100644 --- a/src/app/common/elements/status.less +++ b/src/app/common/elements/status.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-status-container { display: flex; diff --git a/src/app/common/elements/textfield.less b/src/app/common/elements/textfield.less index 12261ce69..2354c808f 100644 --- a/src/app/common/elements/textfield.less +++ b/src/app/common/elements/textfield.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-textfield { display: flex; diff --git a/src/app/common/elements/toggle.less b/src/app/common/elements/toggle.less index d920b9b0b..81ef1c485 100644 --- a/src/app/common/elements/toggle.less +++ b/src/app/common/elements/toggle.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .checkbox-toggle { position: relative; diff --git a/src/app/common/elements/tooltip.less b/src/app/common/elements/tooltip.less index e51b85152..f37f925c6 100644 --- a/src/app/common/elements/tooltip.less +++ b/src/app/common/elements/tooltip.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-tooltip { display: flex; diff --git a/src/app/common/icons/icons.less b/src/app/common/icons/icons.less index 800d18856..64b081c8f 100644 --- a/src/app/common/icons/icons.less +++ b/src/app/common/icons/icons.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .front-icon { margin-right: 5px; diff --git a/src/app/common/icons/icons.tsx b/src/app/common/icons/icons.tsx index a24cf673b..80f4b63ce 100644 --- a/src/app/common/icons/icons.tsx +++ b/src/app/common/icons/icons.tsx @@ -1,12 +1,12 @@ import React from "react"; import cn from "classnames"; -import { ReactComponent as SpinnerIndicator } from "../../assets/icons/spinner-indicator.svg"; +import { ReactComponent as SpinnerIndicator } from "@/assets/icons/spinner-indicator.svg"; import { boundMethod } from "autobind-decorator"; import * as mobx from "mobx"; import * as mobxReact from "mobx-react"; -import * as appconst from "../../appconst"; +import * as appconst from "@/app/appconst"; -import { ReactComponent as RotateIconSvg } from "../../assets/icons/line/rotate.svg"; +import { ReactComponent as RotateIconSvg } from "@/assets/icons/line/rotate.svg"; interface PositionalIconProps { children?: React.ReactNode; diff --git a/src/app/common/modals/about.less b/src/app/common/modals/about.less index 025246493..e6ec8869b 100644 --- a/src/app/common/modals/about.less +++ b/src/app/common/modals/about.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .about-modal { .wave-modal-content { diff --git a/src/app/common/modals/about.tsx b/src/app/common/modals/about.tsx index c8ab58f74..7c844f13b 100644 --- a/src/app/common/modals/about.tsx +++ b/src/app/common/modals/about.tsx @@ -5,12 +5,12 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel } from "../../../models"; -import { Modal, LinkButton } from "../elements"; -import * as util from "../../../util/util"; -import * as appconst from "../../appconst"; +import { GlobalModel } from "@/models"; +import { Modal, LinkButton } from "@/elements"; +import * as util from "@/util/util"; +import * as appconst from "@/app/appconst"; -import logo from "../../assets/waveterm-logo-with-bg.svg"; +import logo from "@/assets/waveterm-logo-with-bg.svg"; import "./about.less"; @mobxReact.observer diff --git a/src/app/common/modals/alert.less b/src/app/common/modals/alert.less index ddec18c57..953ce7996 100644 --- a/src/app/common/modals/alert.less +++ b/src/app/common/modals/alert.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .alert-modal { width: 500px; diff --git a/src/app/common/modals/alert.tsx b/src/app/common/modals/alert.tsx index b6fbf99c7..a65d6f173 100644 --- a/src/app/common/modals/alert.tsx +++ b/src/app/common/modals/alert.tsx @@ -5,8 +5,8 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; -import { Markdown, Modal, Button, Checkbox } from "../elements"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; +import { Markdown, Modal, Button, Checkbox } from "@/elements"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; import "./alert.less"; diff --git a/src/app/common/modals/clientstop.less b/src/app/common/modals/clientstop.less index 4ce7d7594..bad36c4b6 100644 --- a/src/app/common/modals/clientstop.less +++ b/src/app/common/modals/clientstop.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .clientstop-modal { .inner-content { diff --git a/src/app/common/modals/clientstop.tsx b/src/app/common/modals/clientstop.tsx index 9b381fe01..9a6f99eea 100644 --- a/src/app/common/modals/clientstop.tsx +++ b/src/app/common/modals/clientstop.tsx @@ -5,8 +5,8 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; -import { GlobalModel } from "../../../models"; -import { Modal, Button } from "../elements"; +import { GlobalModel } from "@/models"; +import { Modal, Button } from "@/elements"; import "./clientstop.less"; diff --git a/src/app/common/modals/createremoteconn.less b/src/app/common/modals/createremoteconn.less index f6e3a1f00..e92036056 100644 --- a/src/app/common/modals/createremoteconn.less +++ b/src/app/common/modals/createremoteconn.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .crconn-modal { width: 452px; diff --git a/src/app/common/modals/createremoteconn.tsx b/src/app/common/modals/createremoteconn.tsx index 019832b29..297e67973 100644 --- a/src/app/common/modals/createremoteconn.tsx +++ b/src/app/common/modals/createremoteconn.tsx @@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; -import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../models"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; import { Modal, TextField, @@ -16,8 +16,8 @@ import { PasswordField, Tooltip, ShowWaveShellInstallPrompt, -} from "../elements"; -import * as util from "../../../util/util"; +} from "@/elements"; +import * as util from "@/util/util"; import "./createremoteconn.less"; diff --git a/src/app/common/modals/disconnected.less b/src/app/common/modals/disconnected.less index 1439c9298..7ff50c612 100644 --- a/src/app/common/modals/disconnected.less +++ b/src/app/common/modals/disconnected.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .disconnected-modal { .wave-modal-content { diff --git a/src/app/common/modals/disconnected.tsx b/src/app/common/modals/disconnected.tsx index 97f42b695..623729e8b 100644 --- a/src/app/common/modals/disconnected.tsx +++ b/src/app/common/modals/disconnected.tsx @@ -5,8 +5,8 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel } from "../../../models"; -import { Modal, Button } from "../elements"; +import { GlobalModel } from "@/models"; +import { Modal, Button } from "@/elements"; import "./disconnected.less"; diff --git a/src/app/common/modals/editremoteconn.less b/src/app/common/modals/editremoteconn.less index bb98eb3d6..ff5284250 100644 --- a/src/app/common/modals/editremoteconn.less +++ b/src/app/common/modals/editremoteconn.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .erconn-modal { width: 502px; diff --git a/src/app/common/modals/editremoteconn.tsx b/src/app/common/modals/editremoteconn.tsx index 9752755b1..c59813801 100644 --- a/src/app/common/modals/editremoteconn.tsx +++ b/src/app/common/modals/editremoteconn.tsx @@ -6,9 +6,9 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { If } from "tsx-control-statements/components"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../models"; -import { Modal, TextField, InputDecoration, Dropdown, PasswordField, Tooltip } from "../elements"; -import * as util from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; +import { Modal, TextField, InputDecoration, Dropdown, PasswordField, Tooltip } from "@/elements"; +import * as util from "@/util/util"; import "./editremoteconn.less"; diff --git a/src/app/common/modals/linesettings.less b/src/app/common/modals/linesettings.less index d7f2c03b0..23cb8d497 100644 --- a/src/app/common/modals/linesettings.less +++ b/src/app/common/modals/linesettings.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .line-settings-modal { width: 640px; diff --git a/src/app/common/modals/linesettings.tsx b/src/app/common/modals/linesettings.tsx index 32a6e7d08..d9af09fb2 100644 --- a/src/app/common/modals/linesettings.tsx +++ b/src/app/common/modals/linesettings.tsx @@ -5,10 +5,10 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { SettingsError, Modal, Dropdown } from "../elements"; -import { PluginModel } from "../../../plugins/plugins"; -import { commandRtnHandler } from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { SettingsError, Modal, Dropdown } from "@/elements"; +import { PluginModel } from "@/plugins/plugins"; +import { commandRtnHandler } from "@/util/util"; import "./linesettings.less"; diff --git a/src/app/common/modals/provider.tsx b/src/app/common/modals/provider.tsx index a0bfec656..27acbd308 100644 --- a/src/app/common/modals/provider.tsx +++ b/src/app/common/modals/provider.tsx @@ -3,7 +3,7 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; -import { GlobalModel } from "../../../models"; +import { GlobalModel } from "@/models"; import { TosModal } from "./tos"; @mobxReact.observer diff --git a/src/app/common/modals/registry.tsx b/src/app/common/modals/registry.tsx index 4f073c776..7853742c4 100644 --- a/src/app/common/modals/registry.tsx +++ b/src/app/common/modals/registry.tsx @@ -13,8 +13,8 @@ import { ScreenSettingsModal, LineSettingsModal, UserInputModal, -} from "../modals"; -import * as constants from "../../appconst"; +} from "@/modals"; +import * as constants from "@/app/appconst"; const modalsRegistry: { [key: string]: React.ComponentType } = { [constants.ABOUT]: AboutModal, diff --git a/src/app/common/modals/screensettings.less b/src/app/common/modals/screensettings.less index 5d2d7674d..1719a9c0f 100644 --- a/src/app/common/modals/screensettings.less +++ b/src/app/common/modals/screensettings.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .screen-settings-modal { width: 640px; diff --git a/src/app/common/modals/screensettings.tsx b/src/app/common/modals/screensettings.tsx index 792d10b8a..3e3a5fc21 100644 --- a/src/app/common/modals/screensettings.tsx +++ b/src/app/common/modals/screensettings.tsx @@ -7,14 +7,13 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, Screen } from "../../../models"; -import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Dropdown, Tooltip } from "../elements"; -import * as util from "../../../util/util"; -import { commandRtnHandler } from "../../../util/util"; -import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg"; -import { ReactComponent as GlobeIcon } from "../../assets/icons/globe.svg"; -import { ReactComponent as StatusCircleIcon } from "../../assets/icons/statuscircle.svg"; -import * as appconst from "../../appconst"; +import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; +import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Dropdown, Tooltip } from "@/elements"; +import * as util from "@/util/util"; +import { ReactComponent as SquareIcon } from "@/assets/icons/tab/square.svg"; +import { ReactComponent as GlobeIcon } from "@/assets/icons/globe.svg"; +import { ReactComponent as StatusCircleIcon } from "@/assets/icons/statuscircle.svg"; +import * as appconst from "@/app/appconst"; import "./screensettings.less"; @@ -95,7 +94,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenSetSettings(this.screenId, { tabcolor: color }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -116,7 +115,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenArchive(this.screenId, val); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -134,7 +133,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenWebShare(this.screen.screenId, val); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); }); } @@ -167,7 +166,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenSetSettings(this.screenId, { name: val }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -179,7 +178,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenSetSettings(this.screenId, { sharename: val }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -206,7 +205,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenDelete(this.screenId, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); GlobalModel.modalsModel.popModal(); }); } diff --git a/src/app/common/modals/sessionsettings.less b/src/app/common/modals/sessionsettings.less index a28564cc4..d8c7535ce 100644 --- a/src/app/common/modals/sessionsettings.less +++ b/src/app/common/modals/sessionsettings.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .session-settings-modal { width: 640px; diff --git a/src/app/common/modals/sessionsettings.tsx b/src/app/common/modals/sessionsettings.tsx index ffc097980..c7590b8be 100644 --- a/src/app/common/modals/sessionsettings.tsx +++ b/src/app/common/modals/sessionsettings.tsx @@ -5,10 +5,9 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel, GlobalCommandRunner, Session } from "../../../models"; -import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Tooltip } from "../elements"; -import * as util from "../../../util/util"; -import { commandRtnHandler } from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner, Session } from "@/models"; +import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Tooltip } from "@/elements"; +import * as util from "@/util/util"; import "./sessionsettings.less"; @@ -50,7 +49,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionSetSettings(this.sessionId, { name: newVal }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -62,7 +61,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionArchive(this.sessionId, val); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -74,7 +73,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionDelete(this.sessionId); - commandRtnHandler(prtn, this.errorMessage, () => GlobalModel.modalsModel.popModal()); + util.commandRtnHandler(prtn, this.errorMessage, () => GlobalModel.modalsModel.popModal()); }); } diff --git a/src/app/common/modals/tabswitcher.less b/src/app/common/modals/tabswitcher.less index 1bbfee5af..17f8a78a3 100644 --- a/src/app/common/modals/tabswitcher.less +++ b/src/app/common/modals/tabswitcher.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .tabswitcher-modal { width: 452px; diff --git a/src/app/common/modals/tabswitcher.tsx b/src/app/common/modals/tabswitcher.tsx index 3618c4ac1..9b0f207fc 100644 --- a/src/app/common/modals/tabswitcher.tsx +++ b/src/app/common/modals/tabswitcher.tsx @@ -7,11 +7,11 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { Modal, TextField, InputDecoration, Tooltip } from "../elements"; -import * as util from "../../../util/util"; -import { Screen } from "../../../models"; -import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { Modal, TextField, InputDecoration, Tooltip } from "@/elements"; +import * as util from "@/util/util"; +import { Screen } from "@/models"; +import { ReactComponent as SquareIcon } from "@/assets/icons/tab/square.svg"; import "./tabswitcher.less"; diff --git a/src/app/common/modals/tos.less b/src/app/common/modals/tos.less index fddb8efc7..6327a7a74 100644 --- a/src/app/common/modals/tos.less +++ b/src/app/common/modals/tos.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .tos-modal { width: 640px; diff --git a/src/app/common/modals/tos.tsx b/src/app/common/modals/tos.tsx index b6c04ece8..1252c9c87 100644 --- a/src/app/common/modals/tos.tsx +++ b/src/app/common/modals/tos.tsx @@ -4,13 +4,13 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { Toggle, Modal, Button } from "../elements"; -import * as util from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { Toggle, Modal, Button } from "@/elements"; +import * as util from "@/util/util"; -import shield from "../../assets/icons/shield_check.svg"; -import help from "../../assets/icons/help_filled.svg"; -import github from "../../assets/icons/github.svg"; +import shield from "@/assets/icons/shield_check.svg"; +import help from "@/assets/icons/help_filled.svg"; +import github from "@/assets/icons/github.svg"; import "./tos.less"; diff --git a/src/app/common/modals/userinput.less b/src/app/common/modals/userinput.less index a672fa28d..ae143ad3e 100644 --- a/src/app/common/modals/userinput.less +++ b/src/app/common/modals/userinput.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .userinput-modal { width: 500px; diff --git a/src/app/common/modals/userinput.tsx b/src/app/common/modals/userinput.tsx index 436a63c2b..89223783f 100644 --- a/src/app/common/modals/userinput.tsx +++ b/src/app/common/modals/userinput.tsx @@ -1,7 +1,7 @@ import * as React from "react"; -import { GlobalModel } from "../../../models"; +import { GlobalModel } from "@/models"; import { Choose, When, If } from "tsx-control-statements/components"; -import { Modal, PasswordField, Markdown } from "../elements"; +import { Modal, PasswordField, Markdown } from "@/elements"; import "./userinput.less"; diff --git a/src/app/common/modals/viewremoteconndetail.less b/src/app/common/modals/viewremoteconndetail.less index 68b9fb3f3..f59838f6f 100644 --- a/src/app/common/modals/viewremoteconndetail.less +++ b/src/app/common/modals/viewremoteconndetail.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .rconndetail-modal { width: 631px; diff --git a/src/app/common/modals/viewremoteconndetail.tsx b/src/app/common/modals/viewremoteconndetail.tsx index 662dd5d78..6c654b3c7 100644 --- a/src/app/common/modals/viewremoteconndetail.tsx +++ b/src/app/common/modals/viewremoteconndetail.tsx @@ -7,11 +7,11 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../models"; -import { Modal, Tooltip, Button, Status } from "../elements"; -import * as util from "../../../util/util"; -import * as textmeasure from "../../../util/textmeasure"; -import * as appconst from "../../appconst"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; +import { Modal, Tooltip, Button, Status } from "@/elements"; +import * as util from "@/util/util"; +import * as textmeasure from "@/util/textmeasure"; +import * as appconst from "@/app/appconst"; import "./viewremoteconndetail.less"; diff --git a/src/app/common/prompt/prompt.less b/src/app/common/prompt/prompt.less index f0e5eeddb..8cef8da6b 100644 --- a/src/app/common/prompt/prompt.less +++ b/src/app/common/prompt/prompt.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .term-prompt { font-weight: 300; diff --git a/src/app/common/prompt/prompt.tsx b/src/app/common/prompt/prompt.tsx index 7c67d2ffe..66e337990 100644 --- a/src/app/common/prompt/prompt.tsx +++ b/src/app/common/prompt/prompt.tsx @@ -5,10 +5,10 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel } from "../../../models"; +import { GlobalModel } from "@/models"; import cn from "classnames"; -import { isBlank } from "../../../util/util"; -import { ReactComponent as FolderIcon } from "../../assets/icons/folder.svg"; +import { isBlank } from "@/util/util"; +import { ReactComponent as FolderIcon } from "@/assets/icons/folder.svg"; import "./prompt.less"; diff --git a/src/app/connections/connections.less b/src/app/connections/connections.less index 4b0b9c8dc..48cf9378e 100644 --- a/src/app/connections/connections.less +++ b/src/app/connections/connections.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .connections-view { .no-items { diff --git a/src/app/connections/connections.tsx b/src/app/connections/connections.tsx index cd4553d1d..6e733cd02 100644 --- a/src/app/connections/connections.tsx +++ b/src/app/connections/connections.tsx @@ -7,9 +7,9 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel, RemotesModel, GlobalCommandRunner } from "../../models"; -import { Button, Status, ShowWaveShellInstallPrompt } from "../common/elements"; -import * as util from "../../util/util"; +import { GlobalModel, RemotesModel, GlobalCommandRunner } from "@/models"; +import { Button, Status, ShowWaveShellInstallPrompt } from "@/common/elements"; +import * as util from "@/util/util"; import "./connections.less"; diff --git a/src/app/history/history.less b/src/app/history/history.less index 5349fd5dc..161e23404 100644 --- a/src/app/history/history.less +++ b/src/app/history/history.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .history-view { background-color: @background-session; diff --git a/src/app/history/history.tsx b/src/app/history/history.tsx index a6b4a3db9..f16d0927a 100644 --- a/src/app/history/history.tsx +++ b/src/app/history/history.tsx @@ -8,24 +8,24 @@ import { If, For } from "tsx-control-statements/components"; import { sprintf } from "sprintf-js"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, Cmd } from "../../models"; +import { GlobalModel, GlobalCommandRunner, Cmd } from "@/models"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import customParseFormat from "dayjs/plugin/customParseFormat"; -import { Line } from "../line/linecomps"; -import { CmdStrCode } from "../common/elements"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../util/keyutil"; +import { Line } from "@/app/line/linecomps"; +import { CmdStrCode } from "@/common/elements"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; -import { ReactComponent as XmarkIcon } from "../assets/icons/line/xmark.svg"; -import { ReactComponent as AngleDownIcon } from "../assets/icons/history/angle-down.svg"; -import { ReactComponent as ChevronLeftIcon } from "../assets/icons/history/chevron-left.svg"; -import { ReactComponent as ChevronRightIcon } from "../assets/icons/history/chevron-right.svg"; -import { ReactComponent as RightIcon } from "../assets/icons/history/right.svg"; -import { ReactComponent as SearchIcon } from "../assets/icons/history/search.svg"; -import { ReactComponent as TrashIcon } from "../assets/icons/trash.svg"; -import { ReactComponent as CheckedCheckbox } from "../assets/icons/checked-checkbox.svg"; -import { ReactComponent as CheckIcon } from "../assets/icons/line/check.svg"; -import { ReactComponent as CopyIcon } from "../assets/icons/history/copy.svg"; +import { ReactComponent as XmarkIcon } from "@/assets/icons/line/xmark.svg"; +import { ReactComponent as AngleDownIcon } from "@/assets/icons/history/angle-down.svg"; +import { ReactComponent as ChevronLeftIcon } from "@/assets/icons/history/chevron-left.svg"; +import { ReactComponent as ChevronRightIcon } from "@/assets/icons/history/chevron-right.svg"; +import { ReactComponent as RightIcon } from "@/assets/icons/history/right.svg"; +import { ReactComponent as SearchIcon } from "@/assets/icons/history/search.svg"; +import { ReactComponent as TrashIcon } from "@/assets/icons/trash.svg"; +import { ReactComponent as CheckedCheckbox } from "@/assets/icons/checked-checkbox.svg"; +import { ReactComponent as CheckIcon } from "@/assets/icons/line/check.svg"; +import { ReactComponent as CopyIcon } from "@/assets/icons/history/copy.svg"; import "./history.less"; diff --git a/src/app/line/linecomps.tsx b/src/app/line/linecomps.tsx index 9650bc33a..306b03588 100644 --- a/src/app/line/linecomps.tsx +++ b/src/app/line/linecomps.tsx @@ -9,31 +9,31 @@ import { boundMethod } from "autobind-decorator"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import { If } from "tsx-control-statements/components"; -import { GlobalModel, GlobalCommandRunner, Cmd } from "../../models"; -import { termHeightFromRows } from "../../util/textmeasure"; +import { GlobalModel, GlobalCommandRunner, Cmd } from "@/models"; +import { termHeightFromRows } from "@/util/textmeasure"; import cn from "classnames"; -import { getTermPtyData } from "../../util/modelutil"; +import { getTermPtyData } from "@/util/modelutil"; -import { renderCmdText } from "../common/elements"; -import { SimpleBlobRenderer } from "../../plugins/core/basicrenderer"; -import { IncrementalRenderer } from "../../plugins/core/incrementalrenderer"; -import { TerminalRenderer } from "../../plugins/terminal/terminal"; -import { isBlank } from "../../util/util"; -import { PluginModel } from "../../plugins/plugins"; -import { Prompt } from "../common/prompt/prompt"; +import { renderCmdText } from "@/common/elements"; +import { SimpleBlobRenderer } from "@/plugins/core/basicrenderer"; +import { IncrementalRenderer } from "@/plugins/core/incrementalrenderer"; +import { TerminalRenderer } from "@/plugins/terminal/terminal"; +import { isBlank } from "@/util/util"; +import { PluginModel } from "@/plugins/plugins"; +import { Prompt } from "@/common/prompt/prompt"; import * as lineutil from "./lineutil"; -import { ErrorBoundary } from "../../app/common/error/errorboundary"; -import * as appconst from "../appconst"; +import { ErrorBoundary } from "@/common/error/errorboundary"; +import * as appconst from "@/app/appconst"; -import { ReactComponent as CheckIcon } from "../assets/icons/line/check.svg"; -import { ReactComponent as CommentIcon } from "../assets/icons/line/comment.svg"; -import { ReactComponent as QuestionIcon } from "../assets/icons/line/question.svg"; -import { ReactComponent as WarningIcon } from "../assets/icons/line/triangle-exclamation.svg"; -import { ReactComponent as XmarkIcon } from "../assets/icons/line/xmark.svg"; -import { ReactComponent as FillIcon } from "../assets/icons/line/fill.svg"; -import { ReactComponent as GearIcon } from "../assets/icons/line/gear.svg"; +import { ReactComponent as CheckIcon } from "@/assets/icons/line/check.svg"; +import { ReactComponent as CommentIcon } from "@/assets/icons/line/comment.svg"; +import { ReactComponent as QuestionIcon } from "@/assets/icons/line/question.svg"; +import { ReactComponent as WarningIcon } from "@/assets/icons/line/triangle-exclamation.svg"; +import { ReactComponent as XmarkIcon } from "@/assets/icons/line/xmark.svg"; +import { ReactComponent as FillIcon } from "@/assets/icons/line/fill.svg"; +import { ReactComponent as GearIcon } from "@/assets/icons/line/gear.svg"; -import { RotateIcon } from "../common/icons/icons"; +import { RotateIcon } from "@/common/icons/icons"; import "./lines.less"; diff --git a/src/app/line/lines.less b/src/app/line/lines.less index 8fc4a747b..520eee0aa 100644 --- a/src/app/line/lines.less +++ b/src/app/line/lines.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .line.line-text { flex-direction: row; diff --git a/src/app/line/linesview.tsx b/src/app/line/linesview.tsx index ac6fa4e8c..ce22bedf4 100644 --- a/src/app/line/linesview.tsx +++ b/src/app/line/linesview.tsx @@ -11,7 +11,7 @@ import cn from "classnames"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import { debounce, throttle } from "throttle-debounce"; -import * as util from "../../util/util"; +import * as util from "@/util/util"; import * as lineutil from "./lineutil"; import "./lines.less"; diff --git a/src/app/line/lineutil.ts b/src/app/line/lineutil.ts index dd8d5a01e..3b7b4033e 100644 --- a/src/app/line/lineutil.ts +++ b/src/app/line/lineutil.ts @@ -3,7 +3,7 @@ import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { isBlank, getDateStr } from "../../util/util"; +import { isBlank, getDateStr } from "@/util/util"; dayjs.extend(localizedFormat); diff --git a/src/app/line/renderer/basicrenderer.tsx b/src/app/line/renderer/basicrenderer.tsx index 71ebb8e4e..3f4af2ea2 100644 --- a/src/app/line/renderer/basicrenderer.tsx +++ b/src/app/line/renderer/basicrenderer.tsx @@ -6,8 +6,8 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { debounce } from "throttle-debounce"; -import * as util from "../../../util/util"; -import { GlobalModel } from "../../../models"; +import * as util from "@/util"; +import { GlobalModel } from "@/models"; class SimpleBlobRendererModel { context: RendererContext; diff --git a/src/app/pluginsview/pluginsview.less b/src/app/pluginsview/pluginsview.less index 4ea715c06..ba46d1862 100644 --- a/src/app/pluginsview/pluginsview.less +++ b/src/app/pluginsview/pluginsview.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .plugins-view { background-color: @background-session; diff --git a/src/app/pluginsview/pluginsview.tsx b/src/app/pluginsview/pluginsview.tsx index 377d8d665..7cfab2f09 100644 --- a/src/app/pluginsview/pluginsview.tsx +++ b/src/app/pluginsview/pluginsview.tsx @@ -5,11 +5,11 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel } from "../../models"; -import { PluginModel } from "../../plugins/plugins"; -import { Markdown } from "../common/elements"; +import { GlobalModel } from "@/models"; +import { PluginModel } from "@/plugins/plugins"; +import { Markdown } from "@/common/elements"; -import { ReactComponent as XmarkIcon } from "../assets/icons/line/xmark.svg"; +import { ReactComponent as XmarkIcon } from "@/assets/icons/line/xmark.svg"; import "./pluginsview.less"; diff --git a/src/app/sidebar/sidebar.less b/src/app/sidebar/sidebar.less index f91bc1883..96e4e1803 100644 --- a/src/app/sidebar/sidebar.less +++ b/src/app/sidebar/sidebar.less @@ -1,5 +1,5 @@ -@import "../../app/common/themes/themes.less"; -@import "../../app/common/icons/icons.less"; +@import "@/common/themes/themes.less"; +@import "@/common/icons/icons.less"; .main-sidebar { padding: 0; diff --git a/src/app/sidebar/sidebar.tsx b/src/app/sidebar/sidebar.tsx index f29247ee2..fe0f67438 100644 --- a/src/app/sidebar/sidebar.tsx +++ b/src/app/sidebar/sidebar.tsx @@ -10,19 +10,19 @@ import dayjs from "dayjs"; import { If } from "tsx-control-statements/components"; import { compareLoose } from "semver"; -import { ReactComponent as LeftChevronIcon } from "../assets/icons/chevron_left.svg"; -import { ReactComponent as AppsIcon } from "../assets/icons/apps.svg"; -import { ReactComponent as WorkspacesIcon } from "../assets/icons/workspaces.svg"; -import { ReactComponent as SettingsIcon } from "../assets/icons/settings.svg"; +import { ReactComponent as LeftChevronIcon } from "@/assets/icons/chevron_left.svg"; +import { ReactComponent as AppsIcon } from "@/assets/icons/apps.svg"; +import { ReactComponent as WorkspacesIcon } from "@/assets/icons/workspaces.svg"; +import { ReactComponent as SettingsIcon } from "@/assets/icons/settings.svg"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel, GlobalCommandRunner, Session } from "../../models"; -import { isBlank, openLink } from "../../util/util"; -import { ResizableSidebar } from "../common/elements"; -import * as appconst from "../appconst"; +import { GlobalModel, GlobalCommandRunner, Session } from "@/models"; +import { isBlank, openLink } from "@/util/util"; +import { ResizableSidebar } from "@/common/elements"; +import * as appconst from "@/app/appconst"; import "./sidebar.less"; -import { ActionsIcon, CenteredIcon, FrontIcon, StatusIndicator } from "../common/icons/icons"; +import { ActionsIcon, CenteredIcon, FrontIcon, StatusIndicator } from "@/common/icons/icons"; dayjs.extend(localizedFormat); diff --git a/src/app/workspace/cmdinput/aichat.tsx b/src/app/workspace/cmdinput/aichat.tsx index 8ffe6a60d..47ca309c1 100644 --- a/src/app/workspace/cmdinput/aichat.tsx +++ b/src/app/workspace/cmdinput/aichat.tsx @@ -4,13 +4,13 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; -import { GlobalModel } from "../../../models"; -import { isBlank } from "../../../util/util"; +import { GlobalModel } from "@/models"; +import { isBlank } from "@/util"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; import { For } from "tsx-control-statements/components"; -import { Markdown } from "../../common/elements"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../../util/keyutil"; +import { Markdown } from "@/elements"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; @mobxReact.observer class AIChat extends React.Component<{}, {}> { diff --git a/src/app/workspace/cmdinput/cmdinput.less b/src/app/workspace/cmdinput/cmdinput.less index 8df242d0d..0dc5b0397 100644 --- a/src/app/workspace/cmdinput/cmdinput.less +++ b/src/app/workspace/cmdinput/cmdinput.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .cmd-input { border-radius: 6px; diff --git a/src/app/workspace/cmdinput/cmdinput.tsx b/src/app/workspace/cmdinput/cmdinput.tsx index 92ba455f0..70cc8c863 100644 --- a/src/app/workspace/cmdinput/cmdinput.tsx +++ b/src/app/workspace/cmdinput/cmdinput.tsx @@ -9,14 +9,14 @@ import { If } from "tsx-control-statements/components"; import cn from "classnames"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel, GlobalCommandRunner, Screen } from "../../../models"; -import { renderCmdText } from "../../common/elements"; +import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; +import { renderCmdText } from "@/elements"; import { TextAreaInput } from "./textareainput"; import { InfoMsg } from "./infomsg"; import { HistoryInfo } from "./historyinfo"; -import { Prompt } from "../../common/prompt/prompt"; -import { ReactComponent as ExecIcon } from "../../assets/icons/exec.svg"; -import { RotateIcon } from "../../common/icons/icons"; +import { Prompt } from "@/common/prompt/prompt"; +import { ReactComponent as ExecIcon } from "@/assets/icons/exec.svg"; +import { RotateIcon } from "@/common/icons/icons"; import { AIChat } from "./aichat"; import "./cmdinput.less"; diff --git a/src/app/workspace/cmdinput/historyinfo.tsx b/src/app/workspace/cmdinput/historyinfo.tsx index 072218ac3..84b4236d3 100644 --- a/src/app/workspace/cmdinput/historyinfo.tsx +++ b/src/app/workspace/cmdinput/historyinfo.tsx @@ -10,8 +10,8 @@ import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel } from "../../../models"; -import { isBlank } from "../../../util/util"; +import { GlobalModel } from "@/models"; +import { isBlank } from "@/util/util"; dayjs.extend(localizedFormat); diff --git a/src/app/workspace/cmdinput/infomsg.tsx b/src/app/workspace/cmdinput/infomsg.tsx index b1a9d1ede..533a17b24 100644 --- a/src/app/workspace/cmdinput/infomsg.tsx +++ b/src/app/workspace/cmdinput/infomsg.tsx @@ -7,8 +7,8 @@ import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel } from "../../../models"; -import { makeExternLink } from "../../../util/util"; +import { GlobalModel } from "@/models"; +import { makeExternLink } from "@/util/util"; dayjs.extend(localizedFormat); diff --git a/src/app/workspace/cmdinput/textareainput.tsx b/src/app/workspace/cmdinput/textareainput.tsx index e5af01572..14e575467 100644 --- a/src/app/workspace/cmdinput/textareainput.tsx +++ b/src/app/workspace/cmdinput/textareainput.tsx @@ -4,15 +4,14 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; -import * as util from "../../../util/util"; +import * as util from "@/util/util"; import { If } from "tsx-control-statements/components"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, Screen } from "../../../models"; -import { getMonoFontSize } from "../../../util/textmeasure"; -import { isModKeyPress, hasNoModifiers } from "../../../util/util"; -import * as appconst from "../../appconst"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../../util/keyutil"; +import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; +import { getMonoFontSize } from "@/util/textmeasure"; +import * as appconst from "@/app/appconst"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; type OV = mobx.IObservableValue; @@ -168,7 +167,7 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: () @boundMethod onKeyDown(e: any) { mobx.action(() => { - if (isModKeyPress(e)) { + if (util.isModKeyPress(e)) { return; } let model = GlobalModel; diff --git a/src/app/workspace/screen/screenview.less b/src/app/workspace/screen/screenview.less index 17bcee722..9f092f5e1 100644 --- a/src/app/workspace/screen/screenview.less +++ b/src/app/workspace/screen/screenview.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .main-content { .screen-view { @@ -6,7 +6,8 @@ position: relative; } - .screen-sidebar, .window-view { + .screen-sidebar, + .window-view { transition: width 0.5s ease-in-out; } diff --git a/src/app/workspace/screen/screenview.tsx b/src/app/workspace/screen/screenview.tsx index 483b378f4..9e88fb2f2 100644 --- a/src/app/workspace/screen/screenview.tsx +++ b/src/app/workspace/screen/screenview.tsx @@ -10,19 +10,19 @@ import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; import { debounce } from "throttle-debounce"; import dayjs from "dayjs"; -import { GlobalCommandRunner, ForwardLineContainer, GlobalModel, ScreenLines, Screen, Session } from "../../../models"; +import { GlobalCommandRunner, ForwardLineContainer, GlobalModel, ScreenLines, Screen, Session } from "@/models"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { Button, TextField, Dropdown } from "../../common/elements"; -import { getRemoteStr } from "../../common/prompt/prompt"; -import { Line } from "../../line/linecomps"; -import { LinesView } from "../../line/linesview"; -import * as util from "../../../util/util"; -import { ReactComponent as EllipseIcon } from "../../assets/icons/ellipse.svg"; -import { ReactComponent as Check12Icon } from "../../assets/icons/check12.svg"; -import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg"; -import { ReactComponent as GlobeIcon } from "../../assets/icons/globe.svg"; -import { ReactComponent as StatusCircleIcon } from "../../assets/icons/statuscircle.svg"; -import * as appconst from "../../appconst"; +import { Button, TextField, Dropdown } from "@/elements"; +import { getRemoteStr } from "@/common/prompt/prompt"; +import { Line } from "@/app/line/linecomps"; +import { LinesView } from "@/app/line/linesview"; +import * as util from "@/util/util"; +import { ReactComponent as EllipseIcon } from "@/assets/icons/ellipse.svg"; +import { ReactComponent as Check12Icon } from "@/assets/icons/check12.svg"; +import { ReactComponent as SquareIcon } from "@/assets/icons/tab/square.svg"; +import { ReactComponent as GlobeIcon } from "@/assets/icons/globe.svg"; +import { ReactComponent as StatusCircleIcon } from "@/assets/icons/statuscircle.svg"; +import * as appconst from "@/app/appconst"; import "./screenview.less"; import "./tabs.less"; diff --git a/src/app/workspace/screen/tab.tsx b/src/app/workspace/screen/tab.tsx index a1528e7d5..639d93147 100644 --- a/src/app/workspace/screen/tab.tsx +++ b/src/app/workspace/screen/tab.tsx @@ -6,13 +6,13 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, Screen } from "../../../models"; -import { ActionsIcon, StatusIndicator, CenteredIcon } from "../../common/icons/icons"; -import { renderCmdText } from "../../common/elements"; -import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg"; -import * as constants from "../../appconst"; +import { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; +import { ActionsIcon, StatusIndicator, CenteredIcon } from "@/common/icons/icons"; +import { renderCmdText } from "@/elements"; +import { ReactComponent as SquareIcon } from "@/assets/icons/tab/square.svg"; +import * as constants from "@/app/appconst"; import { Reorder } from "framer-motion"; -import { MagicLayout } from "../../magiclayout"; +import { MagicLayout } from "@/app/magiclayout"; @mobxReact.observer class ScreenTab extends React.Component< diff --git a/src/app/workspace/screen/tabs.less b/src/app/workspace/screen/tabs.less index 3fdc1a572..ba951dc90 100644 --- a/src/app/workspace/screen/tabs.less +++ b/src/app/workspace/screen/tabs.less @@ -1,5 +1,5 @@ -@import "../../../app/common/themes/themes.less"; -@import "../../../app/common/icons/icons.less"; +@import "@/common/themes/themes.less"; +@import "@/common/icons/icons.less"; #main .screen-tabs .screen-tab { border-top: 1px solid transparent; diff --git a/src/app/workspace/screen/tabs.tsx b/src/app/workspace/screen/tabs.tsx index de27c5f3c..24c5cd80b 100644 --- a/src/app/workspace/screen/tabs.tsx +++ b/src/app/workspace/screen/tabs.tsx @@ -7,8 +7,8 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; import { boundMethod } from "autobind-decorator"; import { For } from "tsx-control-statements/components"; -import { GlobalModel, GlobalCommandRunner, Session, Screen } from "../../../models"; -import { ReactComponent as AddIcon } from "../../assets/icons/add.svg"; +import { GlobalModel, GlobalCommandRunner, Session, Screen } from "@/models"; +import { ReactComponent as AddIcon } from "@/assets/icons/add.svg"; import { Reorder } from "framer-motion"; import { ScreenTab } from "./tab"; diff --git a/src/app/workspace/workspace.less b/src/app/workspace/workspace.less index af57ba156..3ae9c0f5f 100644 --- a/src/app/workspace/workspace.less +++ b/src/app/workspace/workspace.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .session-view { flex-grow: 1; diff --git a/src/app/workspace/workspaceview.tsx b/src/app/workspace/workspaceview.tsx index 3f9bea8da..6e811091a 100644 --- a/src/app/workspace/workspaceview.tsx +++ b/src/app/workspace/workspaceview.tsx @@ -7,11 +7,11 @@ import * as mobx from "mobx"; import cn from "classnames"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; -import { GlobalModel } from "../../models"; +import { GlobalModel } from "@/models"; import { CmdInput } from "./cmdinput/cmdinput"; import { ScreenView } from "./screen/screenview"; import { ScreenTabs } from "./screen/tabs"; -import { ErrorBoundary } from "../../app/common/error/errorboundary"; +import { ErrorBoundary } from "@/common/error/errorboundary"; import { MagicLayout } from "../magiclayout"; import "./workspace.less"; diff --git a/src/electron/emain.ts b/src/electron/emain.ts index 5befa0436..a9ce352bf 100644 --- a/src/electron/emain.ts +++ b/src/electron/emain.ts @@ -7,14 +7,13 @@ import * as fs from "fs"; import fetch from "node-fetch"; import * as child_process from "node:child_process"; import { debounce } from "throttle-debounce"; -import { handleJsonFetchResponse } from "../util/util"; import * as winston from "winston"; -import * as util from "util"; import { sprintf } from "sprintf-js"; +import * as util from "util"; +import { handleJsonFetchResponse } from "@/util/util"; import { v4 as uuidv4 } from "uuid"; -import { checkKeyPressed, adaptFromElectronKeyEvent, setKeyUtilPlatform } from "../util/keyutil"; +import { checkKeyPressed, adaptFromElectronKeyEvent, setKeyUtilPlatform } from "@/util/keyutil"; import { platform } from "os"; -import type * as T from "../types/types"; const WaveAppPathVarName = "WAVETERM_APP_PATH"; const WaveDevVarName = "WAVETERM_DEV"; @@ -257,7 +256,7 @@ function shFrameNavHandler(event: Electron.Event { }); async function createMainWindowWrap() { - let clientData: T.ClientDataType | null = null; + let clientData: ClientDataType | null = null; try { clientData = await getClientDataPoll(1); } catch (e) { diff --git a/src/index.ts b/src/index.ts index f4ed308e8..7b415a4b0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import * as mobx from "mobx"; import * as React from "react"; import { createRoot } from "react-dom/client"; import { sprintf } from "sprintf-js"; -import { App } from "./app/app"; +import { App } from "@/app/app"; import * as DOMPurify from "dompurify"; import { loadFonts } from "./util/util"; diff --git a/src/models/bookmarks.ts b/src/models/bookmarks.ts index 226efe3dc..ea69c6a45 100644 --- a/src/models/bookmarks.ts +++ b/src/models/bookmarks.ts @@ -4,8 +4,8 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; import { boundMethod } from "autobind-decorator"; -import { genMergeSimpleData } from "../util/util"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../util/keyutil"; +import { genMergeSimpleData } from "@/util/util"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; import { GlobalCommandRunner } from "./global"; import { Model } from "./model"; diff --git a/src/models/cmd.ts b/src/models/cmd.ts index 103a6b60b..a55eb0749 100644 --- a/src/models/cmd.ts +++ b/src/models/cmd.ts @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 import * as mobx from "mobx"; -import { stringToBase64 } from "../util/util"; -import { TermWrap } from "../plugins/terminal/term"; -import { cmdStatusIsRunning } from "../app/line/lineutil"; +import { stringToBase64 } from "@/util/util"; +import { TermWrap } from "@/plugins/terminal/term"; +import { cmdStatusIsRunning } from "@/app/line/lineutil"; import { Model } from "./model"; const InputChunkSize = 500; diff --git a/src/models/forwardlinecontainer.ts b/src/models/forwardlinecontainer.ts index 1757d62d9..ce0aed3b0 100644 --- a/src/models/forwardlinecontainer.ts +++ b/src/models/forwardlinecontainer.ts @@ -1,9 +1,9 @@ // Copyright 2023, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { TermWrap } from "../plugins/terminal/term"; -import { windowWidthToCols, windowHeightToRows } from "../util/textmeasure"; -import { MagicLayout } from "../app/magiclayout"; +import { TermWrap } from "@/plugins/terminal/term"; +import { windowWidthToCols, windowHeightToRows } from "@/util/textmeasure"; +import { MagicLayout } from "@/app/magiclayout"; import { Model } from "./model"; import { GlobalCommandRunner } from "./global"; import { Cmd } from "./cmd"; diff --git a/src/models/historyview.ts b/src/models/historyview.ts index d7630d516..44c0649a0 100644 --- a/src/models/historyview.ts +++ b/src/models/historyview.ts @@ -3,11 +3,11 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { isBlank } from "../util/util"; -import { termWidthFromCols, termHeightFromRows } from "../util/textmeasure"; +import { isBlank } from "@/util/util"; +import { termWidthFromCols, termHeightFromRows } from "@/util/textmeasure"; import dayjs from "dayjs"; -import * as appconst from "../app/appconst"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../util/keyutil"; +import * as appconst from "@/app/appconst"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; import { GlobalCommandRunner } from "./global"; import { Model } from "./model"; import { Cmd } from "./cmd"; diff --git a/src/models/input.ts b/src/models/input.ts index 325604ea7..aa8d180bb 100644 --- a/src/models/input.ts +++ b/src/models/input.ts @@ -4,8 +4,8 @@ import type React from "react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { isBlank } from "../util/util"; -import * as appconst from "../app/appconst"; +import { isBlank } from "@/util/util"; +import * as appconst from "@/app/appconst"; import { Model } from "./model"; import { GlobalCommandRunner } from "./global"; diff --git a/src/models/mainsidebar.ts b/src/models/mainsidebar.ts index d52c215b7..dce8bf2a1 100644 --- a/src/models/mainsidebar.ts +++ b/src/models/mainsidebar.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import * as mobx from "mobx"; -import { MagicLayout } from "../app/magiclayout"; +import { MagicLayout } from "@/app/magiclayout"; import { Model } from "./model"; class MainSidebarModel { diff --git a/src/models/modals.ts b/src/models/modals.ts index 6d78f1b56..528c4992a 100644 --- a/src/models/modals.ts +++ b/src/models/modals.ts @@ -3,7 +3,7 @@ import * as mobx from "mobx"; import { v4 as uuidv4 } from "uuid"; -import { modalsRegistry } from "../app/common/modals/registry"; +import { modalsRegistry } from "@/modals/registry"; class ModalsModel { store: OArr = mobx.observable.array([], { name: "ModalsModel-store", deep: false }); diff --git a/src/models/model.ts b/src/models/model.ts index c6db96a02..3c65a6582 100644 --- a/src/models/model.ts +++ b/src/models/model.ts @@ -12,12 +12,12 @@ import { genMergeSimpleData, isModKeyPress, isBlank, -} from "../util/util"; +} from "@/util/util"; import { WSControl } from "./ws"; -import { cmdStatusIsRunning } from "../app/line/lineutil"; -import * as appconst from "../app/appconst"; -import { remotePtrToString, cmdPacketString } from "../util/modelutil"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent, setKeyUtilPlatform } from "../util/keyutil"; +import { cmdStatusIsRunning } from "@/app/line/lineutil"; +import * as appconst from "@/app/appconst"; +import { remotePtrToString, cmdPacketString } from "@/util/modelutil"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent, setKeyUtilPlatform } from "@/util/keyutil"; import { Session } from "./session"; import { ScreenLines } from "./screenlines"; import { InputModel } from "./input"; diff --git a/src/models/model_old.ts-deprecated b/src/models/model_old.ts-deprecated index b6580148b..5368a8937 100644 --- a/src/models/model_old.ts-deprecated +++ b/src/models/model_old.ts-deprecated @@ -18,9 +18,9 @@ import { genMergeSimpleData, boundInt, isModKeyPress, -} from "../util/util"; -import { TermWrap } from "../plugins/terminal/term"; -import { PluginModel } from "../plugins/plugins"; +} from "@/util/util"; +import { TermWrap } from "@/plugins/terminal/term"; +import { PluginModel } from "@/plugins/plugins"; import { SessionDataType, LineType, @@ -76,15 +76,15 @@ import { windowHeightToRows, termWidthFromCols, termHeightFromRows, -} from "../util/textmeasure"; +} from "@/util/textmeasure"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import customParseFormat from "dayjs/plugin/customParseFormat"; -import { getRendererContext, cmdStatusIsRunning } from "../app/line/lineutil"; -import { MagicLayout } from "../app/magiclayout"; -import { modalsRegistry } from "../app/common/modals/registry"; -import * as appconst from "../app/appconst"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent, setKeyUtilPlatform } from "../util/keyutil"; +import { getRendererContext, cmdStatusIsRunning } from "@/app/line/lineutil"; +import { MagicLayout } from "@/app/magiclayout"; +import { modalsRegistry } from "@/modals/registry"; +import * as appconst from "@/app/appconst"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent, setKeyUtilPlatform } from "@/util/keyutil"; dayjs.extend(customParseFormat); dayjs.extend(localizedFormat); diff --git a/src/models/plugins.ts b/src/models/plugins.ts index dff68cbae..031b3a021 100644 --- a/src/models/plugins.ts +++ b/src/models/plugins.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import * as mobx from "mobx"; -import { PluginModel } from "../plugins/plugins"; +import { PluginModel } from "@/plugins/plugins"; import { Model } from "./model"; class PluginsModel { diff --git a/src/models/remotes.ts b/src/models/remotes.ts index dde3cd7b5..db3c65d1c 100644 --- a/src/models/remotes.ts +++ b/src/models/remotes.ts @@ -3,12 +3,12 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { stringToBase64 } from "../util/util"; -import { TermWrap } from "../plugins/terminal/term"; -import * as appconst from "../app/appconst"; +import { stringToBase64 } from "@/util/util"; +import { TermWrap } from "@/plugins/terminal/term"; +import * as appconst from "@/app/appconst"; import { GlobalCommandRunner } from "./global"; import { Model } from "./model"; -import { getTermPtyData } from "../util/modelutil"; +import { getTermPtyData } from "@/util/modelutil"; class RemotesModel { globalModel: Model; diff --git a/src/models/screen.ts b/src/models/screen.ts index c84fe352a..9b0366711 100644 --- a/src/models/screen.ts +++ b/src/models/screen.ts @@ -4,18 +4,18 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; import { debounce } from "throttle-debounce"; -import { base64ToArray, boundInt, isModKeyPress, isBlank } from "../util/util"; -import { TermWrap } from "../plugins/terminal/term"; -import { windowWidthToCols, windowHeightToRows, termWidthFromCols, termHeightFromRows } from "../util/textmeasure"; -import { getRendererContext } from "../app/line/lineutil"; -import { MagicLayout } from "../app/magiclayout"; -import * as appconst from "../app/appconst"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../util/keyutil"; +import { base64ToArray, boundInt, isModKeyPress, isBlank } from "@/util/util"; +import { TermWrap } from "@/plugins/terminal/term"; +import { windowWidthToCols, windowHeightToRows, termWidthFromCols, termHeightFromRows } from "@/util/textmeasure"; +import { getRendererContext } from "@/app/line/lineutil"; +import { MagicLayout } from "@/app/magiclayout"; +import * as appconst from "@/app/appconst"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; import { Model } from "./model"; import { GlobalCommandRunner } from "./global"; import { Cmd } from "./cmd"; import { ScreenLines } from "./screenlines"; -import { getTermPtyData } from "../util/modelutil"; +import { getTermPtyData } from "@/util/modelutil"; class Screen { globalModel: Model; diff --git a/src/models/screenlines.ts b/src/models/screenlines.ts index c423a01a0..f34b29751 100644 --- a/src/models/screenlines.ts +++ b/src/models/screenlines.ts @@ -3,8 +3,8 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; -import { genMergeSimpleData } from "../util/util"; -import { cmdStatusIsRunning } from "../app/line/lineutil"; +import { genMergeSimpleData } from "@/util/util"; +import { cmdStatusIsRunning } from "@/app/line/lineutil"; import { Cmd } from "./cmd"; class ScreenLines { diff --git a/src/models/session.ts b/src/models/session.ts index 03756ff7b..6da101002 100644 --- a/src/models/session.ts +++ b/src/models/session.ts @@ -3,7 +3,7 @@ import * as mobx from "mobx"; import { sprintf } from "sprintf-js"; -import { genMergeSimpleData, isBlank, ces } from "../util/util"; +import { genMergeSimpleData, isBlank, ces } from "@/util/util"; import { Model } from "./model"; import { Screen } from "./screen"; diff --git a/src/models/speciallinecontainer.ts b/src/models/speciallinecontainer.ts index 88af6e653..b055631fa 100644 --- a/src/models/speciallinecontainer.ts +++ b/src/models/speciallinecontainer.ts @@ -1,10 +1,10 @@ // Copyright 2023, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { TermWrap } from "../plugins/terminal/term"; -import { windowWidthToCols } from "../util/textmeasure"; -import { getRendererContext } from "../app/line/lineutil"; -import { getTermPtyData } from "../util/modelutil"; +import { TermWrap } from "@/plugins/terminal/term"; +import { windowWidthToCols } from "@/util/textmeasure"; +import { getRendererContext } from "@/app/line/lineutil"; +import { getTermPtyData } from "@/util/modelutil"; import { Cmd } from "./cmd"; import { Model } from "./model"; diff --git a/src/plugins/code/code.less b/src/plugins/code/code.less index a0dc746c5..e534e3f8b 100644 --- a/src/plugins/code/code.less +++ b/src/plugins/code/code.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .code-renderer { .monaco-editor { diff --git a/src/plugins/code/code.tsx b/src/plugins/code/code.tsx index d60049877..521276b73 100644 --- a/src/plugins/code/code.tsx +++ b/src/plugins/code/code.tsx @@ -4,12 +4,12 @@ import * as React from "react"; import Editor, { Monaco } from "@monaco-editor/react"; import type * as MonacoTypes from "monaco-editor/esm/vs/editor/editor.api"; -import { Markdown } from "../../app/common/elements"; -import { GlobalModel, GlobalCommandRunner } from "../../models"; +import { Markdown } from "@/elements"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; import Split from "react-split-it"; import loader from "@monaco-editor/loader"; loader.config({ paths: { vs: "./node_modules/monaco-editor/min/vs" } }); -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../util/keyutil"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; import "./code.less"; diff --git a/src/plugins/core/basicrenderer.tsx b/src/plugins/core/basicrenderer.tsx index 473f9685b..49aaab99f 100644 --- a/src/plugins/core/basicrenderer.tsx +++ b/src/plugins/core/basicrenderer.tsx @@ -5,8 +5,8 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { debounce } from "throttle-debounce"; -import * as util from "../../util/util"; -import { GlobalModel } from "../../models"; +import * as util from "@/util/util"; +import { GlobalModel } from "@/models"; class SimpleBlobRendererModel { context: RendererContext; diff --git a/src/plugins/core/ptydata.ts b/src/plugins/core/ptydata.ts index 96627c598..a5540e002 100644 --- a/src/plugins/core/ptydata.ts +++ b/src/plugins/core/ptydata.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import * as mobx from "mobx"; -import { incObs } from "../../util/util"; +import { incObs } from "@/util/util"; const InitialSize = 10 * 1024; const IncreaseFactor = 1.5; diff --git a/src/plugins/csv/csv.less b/src/plugins/csv/csv.less index 1c8398dad..28457d7d5 100644 --- a/src/plugins/csv/csv.less +++ b/src/plugins/csv/csv.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .csv-renderer { opacity: 0; /* Start with an opacity of 0, meaning it's invisible */ diff --git a/src/plugins/csv/csv.tsx b/src/plugins/csv/csv.tsx index e2be1827d..35bfe4a9e 100644 --- a/src/plugins/csv/csv.tsx +++ b/src/plugins/csv/csv.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import React, { FC, useEffect, useState, useRef, useMemo } from "react"; -import { GlobalModel } from "../../models"; +import { GlobalModel } from "@/models"; import Papa from "papaparse"; import { createColumnHelper, diff --git a/src/plugins/image/image.less b/src/plugins/image/image.less index a1f199839..9c4208fe2 100644 --- a/src/plugins/image/image.less +++ b/src/plugins/image/image.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .image-renderer { padding: 10px; diff --git a/src/plugins/markdown/markdown.less b/src/plugins/markdown/markdown.less index b83dc8d87..96c0e7d73 100644 --- a/src/plugins/markdown/markdown.less +++ b/src/plugins/markdown/markdown.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .markdown-renderer { color: @term-white; diff --git a/src/plugins/markdown/markdown.tsx b/src/plugins/markdown/markdown.tsx index 4385440f4..939949215 100644 --- a/src/plugins/markdown/markdown.tsx +++ b/src/plugins/markdown/markdown.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as mobx from "mobx"; import * as mobxReact from "mobx-react"; import { sprintf } from "sprintf-js"; -import { Markdown } from "../../app/common/elements"; +import { Markdown } from "@/elements"; import "./markdown.less"; diff --git a/src/plugins/mustache/mustache.less b/src/plugins/mustache/mustache.less index 29404d4dc..4ef591fe5 100644 --- a/src/plugins/mustache/mustache.less +++ b/src/plugins/mustache/mustache.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .mustache-renderer { color: @term-white; diff --git a/src/plugins/mustache/mustache.tsx b/src/plugins/mustache/mustache.tsx index bfff2e2d5..2c97279fd 100644 --- a/src/plugins/mustache/mustache.tsx +++ b/src/plugins/mustache/mustache.tsx @@ -5,10 +5,10 @@ import * as React from "react"; import * as mobx from "mobx"; import * as mobxReact from "mobx-react"; import { boundMethod } from "autobind-decorator"; -import { isBlank } from "../../util/util"; +import { isBlank } from "@/util/util"; import mustache from "mustache"; import * as DOMPurify from "dompurify"; -import { GlobalModel } from "../../models"; +import { GlobalModel } from "@/models"; import "./mustache.less"; diff --git a/src/plugins/openai/openai.less b/src/plugins/openai/openai.less index a3b3d6637..1450cb3ac 100644 --- a/src/plugins/openai/openai.less +++ b/src/plugins/openai/openai.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .openai-renderer { .openai-message { diff --git a/src/plugins/openai/openai.tsx b/src/plugins/openai/openai.tsx index e0aa618ba..00309225c 100644 --- a/src/plugins/openai/openai.tsx +++ b/src/plugins/openai/openai.tsx @@ -7,7 +7,7 @@ import * as mobxReact from "mobx-react"; import { debounce } from "throttle-debounce"; import { boundMethod } from "autobind-decorator"; import { PacketDataBuffer } from "../core/ptydata"; -import { Markdown } from "../../app/common/elements"; +import { Markdown } from "@/elements"; import "./openai.less"; diff --git a/src/plugins/plugins.ts b/src/plugins/plugins.ts index db34a695f..0ef90c1b0 100644 --- a/src/plugins/plugins.ts +++ b/src/plugins/plugins.ts @@ -7,7 +7,7 @@ import { SourceCodeRenderer } from "./code/code"; import { SimpleMustacheRenderer } from "./mustache/mustache"; import { CSVRenderer } from "./csv/csv"; import { OpenAIRenderer, OpenAIRendererModel } from "./openai/openai"; -import { isBlank } from "../util/util"; +import { isBlank } from "@/util/util"; import { sprintf } from "sprintf-js"; // TODO: @mike - I did refactoring with the though that I can move config out of this plugins.ts file to a @@ -119,30 +119,22 @@ class PluginModelClass { try { switch (plugin.name) { case "image": - screenshotsContext = require.context(`../plugins/image/screenshots`, false, /\.(png|jpe?g|gif)$/); + screenshotsContext = require.context(`@/plugins/image/screenshots`, false, /\.(png|jpe?g|gif)$/); break; case "markdown": - screenshotsContext = require.context( - `../plugins/markdown/screenshots`, - false, - /\.(png|jpe?g|gif)$/ - ); + screenshotsContext = require.context(`@/plugins/markdown/screenshots`, false, /\.(png|jpe?g|gif)$/); break; case "mustache": - screenshotsContext = require.context( - `../plugins/mustache/screenshots`, - false, - /\.(png|jpe?g|gif)$/ - ); + screenshotsContext = require.context(`@/plugins/mustache/screenshots`, false, /\.(png|jpe?g|gif)$/); break; case "code": - screenshotsContext = require.context(`../plugins/code/screenshots`, false, /\.(png|jpe?g|gif)$/); + screenshotsContext = require.context(`@/plugins/code/screenshots`, false, /\.(png|jpe?g|gif)$/); break; case "openai": - screenshotsContext = require.context(`../plugins/openai/screenshots`, false, /\.(png|jpe?g|gif)$/); + screenshotsContext = require.context(`@/plugins/openai/screenshots`, false, /\.(png|jpe?g|gif)$/); break; case "csv": - screenshotsContext = require.context(`../plugins/csv/screenshots`, false, /\.(png|jpe?g|gif)$/); + screenshotsContext = require.context(`@/plugins/csv/screenshots`, false, /\.(png|jpe?g|gif)$/); break; default: return; @@ -160,13 +152,13 @@ class PluginModelClass { // attach other resources, these show an error because all plugins should have an icon, readme, and meta const handleImportError = (error, resourceType) => console.error(`Failed to load ${resourceType} for plugin ${plugin.name}`); - const iconPromise = import(`../plugins/${plugin.name}/icon.svg`) + const iconPromise = import(`@/plugins/${plugin.name}/icon.svg`) .then((icon) => (plugin.iconComp = icon.ReactComponent)) .catch((error) => handleImportError(error, "icon")); - const readmePromise = import(`../plugins/${plugin.name}/readme.md`) + const readmePromise = import(`@/plugins/${plugin.name}/readme.md`) .then((content) => (plugin.readme = content.default)) .catch((error) => handleImportError(error, "readme")); - const metaPromise = import(`../plugins/${plugin.name}/meta.json`) + const metaPromise = import(`@/plugins/${plugin.name}/meta.json`) .then((json) => Object.assign(plugin, json)) .catch((error) => handleImportError(error, "meta")); return Promise.allSettled([iconPromise, readmePromise, metaPromise]); diff --git a/src/plugins/terminal/term.ts b/src/plugins/terminal/term.ts index 63519b1f6..2beb6baf0 100644 --- a/src/plugins/terminal/term.ts +++ b/src/plugins/terminal/term.ts @@ -7,10 +7,10 @@ import { Terminal } from "xterm"; import { WebLinksAddon } from "xterm-addon-web-links"; import { sprintf } from "sprintf-js"; import { boundMethod } from "autobind-decorator"; -import { windowWidthToCols, windowHeightToRows } from "../../util/textmeasure"; -import { boundInt } from "../../util/util"; -import { GlobalModel } from "../../models"; -import { getTheme } from "../../app/common/themes/themes"; +import { windowWidthToCols, windowHeightToRows } from "@/util/textmeasure"; +import { boundInt } from "@/util/util"; +import { GlobalModel } from "@/models"; +import { getTheme } from "@/common/themes/themes"; type DataUpdate = { data: Uint8Array; diff --git a/src/plugins/terminal/terminal.less b/src/plugins/terminal/terminal.less index 9f9d63ae9..7eab938b0 100644 --- a/src/plugins/terminal/terminal.less +++ b/src/plugins/terminal/terminal.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; @import "./xterm.less"; .terminal-wrapper { diff --git a/src/plugins/terminal/terminal.tsx b/src/plugins/terminal/terminal.tsx index 9df6d1ef5..261056265 100644 --- a/src/plugins/terminal/terminal.tsx +++ b/src/plugins/terminal/terminal.tsx @@ -8,10 +8,10 @@ import { boundMethod } from "autobind-decorator"; import dayjs from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import { If } from "tsx-control-statements/components"; -import { GlobalModel } from "../../models"; -import { termHeightFromRows } from "../../util/textmeasure"; +import { GlobalModel } from "@/models"; +import { termHeightFromRows } from "@/util/textmeasure"; import cn from "classnames"; -import * as lineutil from "../../app/line/lineutil"; +import * as lineutil from "@/app/line/lineutil"; import "./terminal.less"; diff --git a/src/types/types.ts b/src/types/types.ts deleted file mode 100644 index affeeb7de..000000000 --- a/src/types/types.ts +++ /dev/null @@ -1,906 +0,0 @@ -// Copyright 2023, Command Line Inc. -// SPDX-License-Identifier: Apache-2.0 - -import * as React from "react"; -import * as mobx from "mobx"; -import { TermWrap } from "../plugins/terminal/term"; -import { Cmd, Model } from "../models"; - -type ShareModeType = "local" | "web"; -type FocusTypeStrs = "input" | "cmd"; -type HistoryTypeStrs = "global" | "session" | "screen"; -type RemoteStatusTypeStrs = "connected" | "connecting" | "disconnected" | "error"; -type LineContainerStrs = "main" | "sidebar" | "history"; - -type OV = mobx.IObservableValue; -type OArr = mobx.IObservableArray; -type OMap = mobx.ObservableMap; -type CV = mobx.IComputedValue; - -type SessionDataType = { - sessionid: string; - name: string; - notifynum: number; - activescreenid: string; - sessionidx: number; - sharemode: ShareModeType; - archived?: boolean; - remotes: RemoteInstanceType[]; - - // for updates - remove?: boolean; -}; - -type LineStateType = { [k: string]: any }; - -type LineType = { - screenid: string; - userid: string; - lineid: string; - ts: number; - linenum: number; - linenumtemp: boolean; - linelocal: boolean; - linetype: string; - linestate: LineStateType; - text: string; - renderer: string; - contentheight?: number; - star?: number; - archived?: boolean; - pinned?: boolean; - ephemeral?: boolean; - remove?: boolean; -}; - -type ScreenOptsType = { - tabcolor?: string; - tabicon?: string; - pterm?: string; -}; - -type WebShareOpts = { - sharename: string; - viewkey: string; -}; - -type ScreenViewOptsType = { - sidebar: ScreenSidebarOptsType; -}; - -type ScreenSidebarOptsType = { - open: boolean; - width: string; - sidebarlineid: string; -}; - -type ScreenDataType = { - sessionid: string; - screenid: string; - screenidx: number; - name: string; - sharemode: ShareModeType; - webshareopts?: WebShareOpts; - archived?: boolean; - screenopts: ScreenOptsType; - screenviewopts: ScreenViewOptsType; - curremote: RemotePtrType; - nextlinenum: number; - selectedline: number; - focustype: FocusTypeStrs; - anchor: { anchorline: number; anchoroffset: number }; - - // for updates - remove?: boolean; -}; - -type RemoteOptsType = { - color: string; -}; - -type RemoteType = { - remotetype: string; - remoteid: string; - remotealias: string; - remotecanonicalname: string; - remotevars: Record; - status: RemoteStatusTypeStrs; - connecttimeout: number; - errorstr: string; - installstatus: string; - installerrorstr: string; - defaultfestate: Record; - connectmode: string; - autoinstall: boolean; - remoteidx: number; - sshconfigsrc: string; - archived: boolean; - uname: string; - mshellversion: string; - needsmshellupgrade: boolean; - noinitpk: boolean; - authtype: string; - waitingforpassword: boolean; - remoteopts?: RemoteOptsType; - local: boolean; - remove?: boolean; - shellpref: string; - defaultshelltype: string; -}; - -type RemoteStateType = { - cwd: string; - env0: string; // in base64 "env -0" form -}; - -type RemoteInstanceType = { - riid: string; - name: string; - sessionid: string; - screenid: string; - remoteownerid: string; - remoteid: string; - festate: Record; - shelltype: string; - - remove?: boolean; -}; - -type RemotePtrType = { - remoteid: string; - ownerid?: string; - name?: string; -}; - -type HistoryItem = { - historyid: string; - ts: number; - userid: string; - sessionid: string; - screenid: string; - lineid: string; - haderror: boolean; - cmdstr: string; - remove: boolean; - remote: RemotePtrType; - ismetacmd: boolean; - historynum: string; - linenum: number; -}; - -type CmdRemoteStateType = { - remoteid: string; - remotename: string; - cwd: string; -}; - -type UIContextType = { - sessionid: string; - screenid: string; - remote: RemotePtrType; - winsize: TermWinSize; - linenum: number; - build: string; -}; - -type FeCmdPacketType = { - type: string; - metacmd: string; - metasubcmd?: string; - args: string[]; - kwargs: Record; - rawstr?: string; - uicontext: UIContextType; - interactive: boolean; -}; - -type FeInputPacketType = { - type: string; - ck: string; - remote: RemotePtrType; - inputdata64?: string; - signame?: string; - winsize?: TermWinSize; -}; - -type RemoteInputPacketType = { - type: string; - remoteid: string; - inputdata64: string; -}; - -type WatchScreenPacketType = { - type: string; - sessionid: string; - screenid: string; - connect: boolean; - authkey: string; -}; - -type CmdInputTextPacketType = { - type: string; - seqnum: number; - screenid: string; - text: StrWithPos; -}; - -type TermWinSize = { - rows: number; - cols: number; -}; - -type TermOptsType = { - rows: number; - cols: number; - flexrows?: boolean; - maxptysize?: number; -}; - -type CmdDataType = { - screenid: string; - lineid: string; - remote: RemotePtrType; - cmdstr: string; - rawcmdstr: string; - festate: Record; - termopts: TermOptsType; - origtermopts: TermOptsType; - status: string; - cmdpid: number; - remotepid: number; - restartts: number; - donets: number; - exitcode: number; - durationms: number; - runout: any[]; - rtnstate: boolean; - remove?: boolean; - restarted?: boolean; -}; - -type LineUpdateType = { - line: LineType; - cmd: CmdDataType; -}; - -type PtyDataUpdateType = { - screenid: string; - lineid: string; - remoteid: string; - ptypos: number; - ptydata64: string; - ptydatalen: number; -}; - -type ScreenLinesType = { - screenid: string; - lines: LineType[]; - cmds: CmdDataType[]; -}; - -type OpenAIPacketOutputType = { - model: string; - created: number; - finish_reason: string; - message: string; - error?: string; -}; - -type OpenAICmdInfoChatMessageType = { - isassistantresponse?: boolean; - assistantresponse?: OpenAIPacketOutputType; - userquery?: string; -}; - -/** - * Levels for the screen status indicator - */ -enum StatusIndicatorLevel { - None = 0, - Output = 1, - Success = 2, - Error = 3, -} - -type ScreenStatusIndicatorUpdateType = { - screenid: string; - status: StatusIndicatorLevel; -}; - -type ScreenNumRunningCommandsUpdateType = { - screenid: string; - num: number; -}; - -type ConnectUpdateType = { - sessions: SessionDataType[]; - screens: ScreenDataType[]; - remotes: RemoteType[]; - screenstatusindicators: ScreenStatusIndicatorUpdateType[]; - screennumrunningcommands: ScreenNumRunningCommandsUpdateType[]; - activesessionid: string; -}; - -type BookmarksUpdateType = { - bookmarks: BookmarkType[]; - selectedbookmark: string; -}; - -type MainViewUpdateType = { - mainview: string; - historyview?: HistoryViewDataType; - bookmarksview?: BookmarksUpdateType; -}; - -type ModelUpdateType = { - interactive: boolean; - session?: SessionDataType; - activesessionid?: string; - screen?: ScreenDataType; - screenlines?: ScreenLinesType; - line?: LineUpdateType; - cmd?: CmdDataType; - info?: InfoType; - cmdline?: StrWithPos; - remote?: RemoteType; - history?: HistoryInfoType; - connect?: ConnectUpdateType; - mainview?: MainViewUpdateType; - bookmarks?: BookmarksUpdateType; - clientdata?: ClientDataType; - remoteview?: RemoteViewType; - openaicmdinfochat?: OpenAICmdInfoChatMessageType[]; - alertmessage?: AlertMessageType; - screenstatusindicator?: ScreenStatusIndicatorUpdateType; - screennumrunningcommands?: ScreenNumRunningCommandsUpdateType; - userinputrequest?: UserInputRequest; -}; - -type HistoryViewDataType = { - items: HistoryItem[]; - offset: number; - rawoffset: number; - nextrawoffset: number; - hasmore: boolean; - lines: LineType[]; - cmds: CmdDataType[]; -}; - -type BookmarkType = { - bookmarkid: string; - createdts: number; - cmdstr: string; - alias: string; - tags: string[]; - description: string; - cmds: string[]; - orderidx: number; - remove?: boolean; -}; - -type HistoryInfoType = { - historytype: HistoryTypeStrs; - sessionid: string; - screenid: string; - items: HistoryItem[]; - show: boolean; -}; - -type CmdLineUpdateType = { - cmdline: string; - cursorpos: number; -}; - -type RemoteEditType = { - remoteedit: boolean; - remoteid?: string; - errorstr?: string; - infostr?: string; - keystr?: string; - haspassword?: boolean; - // @TODO: this is a hack to determine which create modal to show - old?: boolean; -}; - -type InfoType = { - infotitle?: string; - infomsg?: string; - infomsghtml?: boolean; - websharelink?: boolean; - infoerror?: string; - infolines?: string[]; - infocomps?: string[]; - infocompsmore?: boolean; - timeoutms?: number; -}; - -type RemoteViewType = { - ptyremoteid?: string; - remoteedit?: RemoteEditType; - remoteshowall?: boolean; -}; - -type HistoryQueryOpts = { - queryType: "global" | "session" | "screen"; - limitRemote: boolean; - limitRemoteInstance: boolean; - limitUser: boolean; - queryStr: string; - maxItems: number; - includeMeta: boolean; - fromTs: number; -}; - -type ContextMenuOpts = { - showCut?: boolean; -}; - -type UpdateMessage = PtyDataUpdateType | ModelUpdateType[]; - -type RendererContext = { - screenId: string; - lineId: string; - lineNum: number; -}; - -type RemoteTermContext = { remoteId: string }; - -type TermContextUnion = RendererContext | RemoteTermContext; - -type RendererOpts = { - maxSize: WindowSize; - idealSize: WindowSize; - termOpts: TermOptsType; - termFontSize: number; -}; - -type RendererOptsUpdate = { - maxSize?: WindowSize; - idealSize?: WindowSize; - termOpts?: TermOptsType; - termFontSize?: number; -}; - -type RendererPluginType = { - name: string; - rendererType: "simple" | "full"; - heightType: "rows" | "pixels"; - dataType: "json" | "blob" | "model"; - collapseType: "hide" | "remove"; - hidePrompt?: boolean; - globalCss?: string; - mimeTypes?: string[]; - modelCtor?: () => RendererModel; - simpleComponent?: SimpleBlobRendererComponent; - fullComponent?: FullRendererComponent; - readme?: string; - screenshots?: any[]; - vendor?: string; - summary?: string; - title?: string; - iconComp?: React.Component<{}, {}>; -}; - -type RendererModelContainerApi = { - onFocusChanged: (focus: boolean) => void; - saveHeight: (height: number) => void; - dataHandler: (data: string, model: RendererModel) => void; -}; - -type RendererModelInitializeParams = { - context: RendererContext; - isDone: boolean; - rawCmd: WebCmd; - savedHeight: number; - opts: RendererOpts; - lineState: LineStateType; - api: RendererModelContainerApi; - ptyDataSource: (termContext: TermContextUnion) => Promise; -}; - -type RendererModel = { - initialize: (params: RendererModelInitializeParams) => void; - dispose: () => void; - reload: (delayMs: number) => void; - giveFocus: () => void; - updateOpts: (opts: RendererOptsUpdate) => void; - setIsDone: () => void; - receiveData: (pos: number, data: Uint8Array, reason?: string) => void; - updateHeight: (newHeight: number) => void; -}; - -type SimpleBlobRendererComponent = React.ComponentType<{ - data: ExtBlob; - readOnly?: boolean; - notFound?: boolean; - isSelected?: boolean; - rendererApi?: RendererModelContainerApi; - shouldFocus?: boolean; - cmdstr?: string; - cwd?: string; - exitcode?: number; - context: RendererContext; - opts: RendererOpts; - savedHeight: number; - scrollToBringIntoViewport?: () => void; - lineState?: LineStateType; -}>; -type FullRendererComponent = React.ComponentType<{ model: any }>; - -type WindowSize = { - height: number; - width: number; -}; - -type PtyDataType = { - pos: number; - data: Uint8Array; -}; - -type FeOptsType = { - termfontsize: number; -}; - -type ConfirmFlagsType = { - [k: string]: boolean; -}; - -type ClientOptsType = { - notelemetry: boolean; - noreleasecheck: boolean; - acceptedtos: number; - confirmflags: ConfirmFlagsType; - mainsidebar: { - collapsed: boolean; - width: number; - }; -}; - -type ReleaseInfoType = { - latestversion: string; -}; - -type ClientWinSize = { - width: number; - height: number; - top: number; - left: number; - fullscreen: boolean; -}; - -type ClientDataType = { - clientid: string; - userid: string; - feopts: FeOptsType; - clientopts: ClientOptsType; - cmdstoretype: "session" | "screen"; - dbversion: number; - openaiopts?: OpenAIOptsType; - releaseinfo?: ReleaseInfoType; - winsize: ClientWinSize; -}; - -type OpenAIOptsType = { - model?: string; - apitoken?: string; - maxtokens?: number; - maxchoices?: number; -}; - -type PlaybookType = { - playbookid: string; - playbookname: string; - description: string; - entryids: string[]; - entries: PlaybookEntryType[]; -}; - -type PlaybookEntryType = { - entryid: string; - playbookid: string; - alias: string; - cmdstr: string; - description: string; - createdts: number; - updatedts: number; - remove: boolean; -}; - -type AlertMessageType = { - title?: string; - message: string; - confirm?: boolean; - markdown?: boolean; - confirmflag?: string; -}; - -type HistorySearchParams = { - offset: number; - rawOffset: number; - searchText?: string; - searchSessionId?: string; - searchRemoteId?: string; - fromTs?: number; - noMeta?: boolean; - filterCmds?: boolean; -}; - -type UserInputRequest = { - requestid: string; - querytext: string; - responsetype: string; - title: string; - markdown: boolean; - timeoutms: number; -}; - -type UserInputResponsePacket = { - type: string; - requestid: string; - text?: string; - confirm?: boolean; - errormsg?: string; -}; - -type RenderModeType = "normal" | "collapsed" | "expanded"; - -type WebScreen = { - screenid: string; - sharename: string; - vts: number; - selectedline: number; -}; - -type WebLine = { - screenid: string; - lineid: string; - ts: number; - linenum: number; - linetype: string; - text: string; - contentheight: number; - renderer: string; - archived: boolean; - vts: number; -}; - -type WebRemote = { - remoteid: string; - alias: string; - canonicalname: string; - name: string; - homedir: string; - isroot: boolean; -}; - -type WebCmd = { - screenid: string; - lineid: string; - remote: WebRemote; - cmdstr: string; - rawcmdstr: string; - festate: Record; - termopts: TermOptsType; - status: string; - cmdpid: number; - remotepid: number; - donets: number; - exitcode: number; - durationms: number; - rtnstate: boolean; - rtnstatestr: string; - vts: number; -}; - -type WebFullScreen = { - screenid: string; - screen: WebScreen; - lines: WebLine[]; - cmds: WebCmd[]; - cmdptymap: Record; - vts: number; -}; - -type PtyDataUpdate = { - screenid: string; - lineid: string; - ptypos: number; - data: string; -}; - -type WebShareWSMessage = { - type: string; - screenid: string; - viewkey: string; -}; - -type LineInterface = { - lineid: string; - linenum: number; - ts: number; -}; - -type LineFactoryProps = { - line: LineInterface; - width: number; - visible: OV; - staticRender: boolean; - onHeightChange: LineHeightChangeCallbackType; - overrideCollapsed: OV; - topBorder: boolean; - renderMode: RenderModeType; - noSelect?: boolean; -}; - -type RendererContainerType = { - registerRenderer: (lineId: string, model: RendererModel) => void; - unloadRenderer: (lineId: string) => void; -}; - -type CommandRtnType = { - success: boolean; - error?: string; -}; - -type LineHeightChangeCallbackType = (lineNum: number, newHeight: number, oldHeight: number) => void; - -type OpenAIPacketType = { - type: string; - model: string; - created: number; - finish_reason: string; - usage: Record; - index: number; - text: string; - error: string; -}; - -type FileInfoType = { - name: string; - size: number; - modts: number; - isdir: boolean; - perm: number; - notfound: boolean; -}; - -type ExtBlob = Blob & { - notFound: boolean; - name?: string; -}; - -type ExtFile = File & { - notFound: boolean; -}; - -type ModalStoreEntry = { - id: string; - component: React.ComponentType; - uniqueKey: string; - props?: any; -}; - -type StrWithPos = { - str: string; - pos: number; -}; - -type LineFocusType = { - cmdInputFocus: boolean; - lineid?: string; - linenum?: number; - screenid?: string; -}; - -type LineContainerType = { - loadTerminalRenderer: (elem: Element, line: LineType, cmd: Cmd, width: number) => void; - registerRenderer: (lineId: string, renderer: RendererModel) => void; - unloadRenderer: (lineId: string) => void; - getIsFocused: (lineNum: number) => boolean; - getTermWrap: (lineId: string) => TermWrap; - getRenderer: (lineId: string) => RendererModel; - getFocusType: () => FocusTypeStrs; - getSelectedLine: () => number; - getCmd: (line: LineType) => Cmd; - setLineFocus: (lineNum: number, focus: boolean) => void; - getUsedRows: (context: RendererContext, line: LineType, cmd: Cmd, width: number) => number; - getContentHeight: (context: RendererContext) => number; - setContentHeight: (context: RendererContext, height: number) => void; - getMaxContentSize(): WindowSize; - getIdealContentSize(): WindowSize; - isSidebarOpen(): boolean; - isLineIdInSidebar(lineId: string): boolean; - getContainerType(): LineContainerStrs; -}; - -export type { - SessionDataType, - LineStateType, - LineType, - LineFocusType, - RemoteType, - RemoteStateType, - RemoteInstanceType, - HistoryItem, - CmdRemoteStateType, - FeCmdPacketType, - TermOptsType, - CmdDataType, - ScreenViewOptsType, - ScreenSidebarOptsType, - ScreenDataType, - ScreenOptsType, - PtyDataUpdateType, - ModelUpdateType, - UpdateMessage, - InfoType, - CmdLineUpdateType, - RemotePtrType, - UIContextType, - HistoryInfoType, - HistoryQueryOpts, - WatchScreenPacketType, - TermWinSize, - FeInputPacketType, - RemoteInputPacketType, - RemoteEditType, - ContextMenuOpts, - RendererContext, - WindowSize, - RendererModel, - PtyDataType, - BookmarkType, - ClientDataType, - PlaybookType, - PlaybookEntryType, - HistoryViewDataType, - RenderModeType, - AlertMessageType, - HistorySearchParams, - UserInputRequest, - UserInputResponsePacket, - ScreenLinesType, - FocusTypeStrs, - HistoryTypeStrs, - RendererOpts, - RendererPluginType, - SimpleBlobRendererComponent, - RendererModelContainerApi, - RendererModelInitializeParams, - RendererOptsUpdate, - WebShareOpts, - RemoteStatusTypeStrs, - WebFullScreen, - WebScreen, - WebLine, - WebCmd, - RemoteTermContext, - TermContextUnion, - WebRemote, - PtyDataUpdate, - WebShareWSMessage, - LineHeightChangeCallbackType, - LineFactoryProps, - LineInterface, - RendererContainerType, - RemoteViewType, - CommandRtnType, - OpenAIPacketType, - FileInfoType, - ExtBlob, - ExtFile, - LineContainerStrs, - ModalStoreEntry, - StrWithPos, - CmdInputTextPacketType, - OpenAICmdInfoChatMessageType, - ScreenStatusIndicatorUpdateType, - ScreenNumRunningCommandsUpdateType, - OV, - OArr, - OMap, - CV, - LineContainerType, -}; - -export { StatusIndicatorLevel }; diff --git a/src/util/modelutil.ts b/src/util/modelutil.ts index 558e83262..a0cfac899 100644 --- a/src/util/modelutil.ts +++ b/src/util/modelutil.ts @@ -1,5 +1,5 @@ import { sprintf } from "sprintf-js"; -import { GlobalModel } from "../models"; +import { GlobalModel } from "@/models"; import { isBlank } from "./util"; function getTermPtyData(termContext: TermContextUnion): Promise { diff --git a/src/util/textmeasure.ts b/src/util/textmeasure.ts index 0c37e9706..9551e00bd 100644 --- a/src/util/textmeasure.ts +++ b/src/util/textmeasure.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { boundInt } from "./util"; -import { MagicLayout } from "../app/magiclayout"; +import { MagicLayout } from "@/app/magiclayout"; const MinTermCols = 10; const MaxTermCols = 1024; diff --git a/tsconfig.json b/tsconfig.json index ac90ce757..f7fd46eb6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "include": ["src/**/*", "types/**/*"], - "exclude": ["src/electron/emain.ts"], + // "exclude": ["src/electron/emain.ts"], "compilerOptions": { "target": "es5", "module": "commonjs", @@ -13,6 +13,20 @@ "resolveJsonModule": true, "isolatedModules": true, "experimentalDecorators": true, - "downlevelIteration": true + "downlevelIteration": true, + "baseUrl": "./", + "paths": { + "@/app/*": ["src/app/*"], // Points to the src folder + "@/util/*": ["src/util/*"], // Points to the src folder + "@/models": ["src/models/index"], // Points directly to the index file + "@/models/*": ["src/models/*"], // For everything else inside models + "@/common/*": ["src/app/common/*"], // For everything else inside models + "@/elements": ["src/app/common/elements/index"], // Points directly to the index file + "@/elements/*": ["src/app/common/elements/*"], // For everything else inside models + "@/modals": ["src/app/common/modals/index"], // Points directly to the index file + "@/modals/*": ["src/app/common/modals/*"], // For everything else inside models + "@/assets/*": ["src/app/assets/*"], // For everything else inside models + "@/plugins/*": ["src/plugins/*"], // For everything else inside models + } } } diff --git a/webpack/webpack.electron.js b/webpack/webpack.electron.js index e1fcd343e..a6940b3f0 100644 --- a/webpack/webpack.electron.js +++ b/webpack/webpack.electron.js @@ -58,6 +58,16 @@ var electronCommon = { }, resolve: { extensions: [".ts", ".tsx", ".js"], + alias: { + "@/app": path.resolve(__dirname, "../src/app/"), + "@/util": path.resolve(__dirname, "../src/util/"), + "@/models": path.resolve(__dirname, "../src/models/"), + "@/common": path.resolve(__dirname, "../src/app/common/"), + "@/elements": path.resolve(__dirname, "../src/app/common/elements/"), + "@/modals": path.resolve(__dirname, "../src/app/common/modals/"), + "@/assets": path.resolve(__dirname, "../src/app/assets/"), + "@/plugins": path.resolve(__dirname, "../src/plugins/"), + }, }, }; @@ -100,4 +110,4 @@ var electronProd = webpackMerge.merge(electronCommon, { }, }); -module.exports = {electronDev: electronDev, electronProd: electronProd}; +module.exports = { electronDev: electronDev, electronProd: electronProd }; diff --git a/webpack/webpack.web.js b/webpack/webpack.web.js index dbe7186fa..836bb9201 100644 --- a/webpack/webpack.web.js +++ b/webpack/webpack.web.js @@ -79,6 +79,16 @@ var webCommon = { }, resolve: { extensions: [".ts", ".tsx", ".js", ".mjs", ".cjs", ".wasm", ".json", ".less", ".css"], + alias: { + "@/app": path.resolve(__dirname, "../src/app/"), + "@/util": path.resolve(__dirname, "../src/util/"), + "@/models": path.resolve(__dirname, "../src/models/"), + "@/common": path.resolve(__dirname, "../src/app/common/"), + "@/elements": path.resolve(__dirname, "../src/app/common/elements/"), + "@/modals": path.resolve(__dirname, "../src/app/common/modals/"), + "@/assets": path.resolve(__dirname, "../src/app/assets/"), + "@/plugins": path.resolve(__dirname, "../src/plugins/"), + }, }, };