Compare commits

..

2 Commits

Author SHA1 Message Date
Red Adaya 5ccb1cb2ac fix wrong colors 2024-02-23 10:54:33 +08:00
Red Adaya 6e3ab22a07 initial implementation for lines.less 2024-02-22 22:17:53 +08:00
18 changed files with 270 additions and 162 deletions
-1
View File
@@ -1,4 +1,3 @@
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11 h1:3/gm/JTX9bX8CpzTgIlrtYpB3EVBDxyg/GY/QdcIEZw=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
+4 -8
View File
@@ -1,4 +1,4 @@
@import "./common/themes/themes.less";
@import "@/common/themes/themes.less";
@font-face {
font-family: "Martian Mono";
@@ -8,10 +8,6 @@
}
:root {
/* updated by GlobalModel to user's preferred fontsize */
--termfontsize: 12px;
--termlineheight: 15px;
--fa-style-family: "Font Awesome 6 Sharp";
}
@@ -23,7 +19,7 @@ body {
font-weight: 300;
line-height: 1.5;
background: @base-background-transparent;
color: @base-color;
color: var(--base-color);
}
body.is-dev {
@@ -37,7 +33,7 @@ textarea {
font-weight: 300;
line-height: 1.5;
background: @base-background;
color: @base-color;
color: var(--base-color);
}
// typography
@@ -107,7 +103,7 @@ body code {
}
svg.icon {
fill: @base-color;
fill: var(--base-color);
width: 100%;
height: 100%;
display: inline-block;
+3
View File
@@ -20,6 +20,9 @@ import { MainSideBar } from "./sidebar/sidebar";
import { DisconnectedModal, ClientStopModal } from "./common/modals";
import { ModalsProvider } from "./common/modals/provider";
import { ErrorBoundary } from "./common/error/errorboundary";
import "@/common/themes/fonts.less";
import "@/common/themes/themes.less";
import "./app.less";
dayjs.extend(localizedFormat);
+2 -2
View File
@@ -14,7 +14,7 @@
svg {
width: 1.5em;
height: 1.5em;
fill: @base-color;
fill: var(--base-color);
}
}
@@ -31,7 +31,7 @@
.icon {
width: 1em;
height: 1em;
fill: @base-color;
fill: var(--base-color);
}
.bookmarks-list {
+1 -1
View File
@@ -17,7 +17,7 @@
i {
display: inline;
font-size: 13px;
fill: @base-color;
fill: var(--base-color);
padding-top: 0.2em;
}
}
+9
View File
@@ -0,0 +1,9 @@
:root {
--fixed-font: "Martian Mono", sans-serif;
--terminal-font: "JetBrains Mono", sans-serif;
--text-s1-font: "Martian Mono", sans-serif;
--markdown-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji";
}
+135
View File
@@ -77,3 +77,138 @@
@markdown-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji";
@markdown-highlight: rgb(35, 35, 35);
:root {
--base-color: #eceeec;
// semantic vars based on --base-color
--line-avatar-color: #eceeec;
--line-text-color: #f2f4f2;
--line-svg-fill: var(--line-text-color);
--line-svg-hover-fill: #eceeec;
--line-selected-border-color: rgb(193, 195, 193);
--line-separator-color: rgb(126, 126, 126);
--line-meta-line1-color: rgb(150, 152, 150);
--base-background: rgba(21, 23, 21, 1);
// semantic vars based on --base-background
--line-background: rgba(21, 23, 21, 1);
--base-background-transparent: rgba(21, 23, 21, 0.7);
--base-background-dev: rgba(21, 23, 48, 0.7);
--base-border: rgba(241, 246, 243, 0.08);
--background-session: rgba(13, 13, 13, 0.85);
--background-session-components: rgba(48, 49, 48, 0.6);
--background-session-components-solid: rgb(33, 34, 33);
--wave-green: rgb(88, 193, 66);
// semantic vars based on --wave-green
--line-status-success-fill: rgb(88, 193, 66);
--wave-green-faded: rgba(88, 193, 66, 0.4);
--cmd-input-border-color: rgba(88, 193, 66, 0.8);
--disabled-background: rgba(76, 81, 75, 1);
--disabled-color: #adadad;
--disabled-color-faded: rgba(173, 173, 173, 0.6);
--scrollbar-background: rgba(21, 23, 21, 1);
--scrollbar-thumb-background: rgb(134, 134, 134);
--button-background: rgb(38, 38, 38);
--button-disabled-background: rgb(30, 29, 29);
--success-green: rgb(38, 97, 26);
--error-red: #cc0000;
// semantic vars based on --error-red
--line-base-error-color: #cc0000;
// semantic vars based on --error-red
--line-status-error-fill: #cc0000;
--warning-yellow: #ffa500;
// semantic vars based on --warning-yellow
--line-status-warning-fill: #ffa500;
--textarea-background: #2a2a2a;
--text-primary: #fff;
--text-secondary: #c3c8c2;
--text-caption: #8b918a;
--status-connected: #46a758;
--status-connecting: #f5d90a;
--status-error: #e54d2e;
--status-disconnected: #c3c8c2;
--term-black: #000000;
--term-red: #cc0000;
// semantic vars based on --term-red
--line-load-error-text-color: #cc0000;
--term-green: #4e9a06;
// semantic vars based on --term-green
--line-active-border-color: rgb(97, 158, 72);
--term-yellow: #c4a000;
// semantic vars based on --term-yellow
--line-base-yellow-color: #fce94f;
// semantic vars based on --term-yellow
--line-sidebar-message-text-color: #c4a000;
--term-blue: #3465a4;
--term-cyan: #06989a;
--term-white: #d3d7cf;
// semantic vars based on --term-white
--line-base-white-color: #d3d7cf;
--term-bright-red: #ef2929;
--term-bright-green: #58c142;
--term-bright-yellow: #fce94f;
--term-bright-blue: #32afff;
--term-bright-magenta: #ad7fa8;
--term-bright-cyan: #34e2e2;
--term-bright-white: #ffffff;
--button-bg-yellow: #e9be68;
--button-bg-red: #d06c68;
--history-error-red: #d06c68;
--history-selected-error-red: #f79494;
--tab-red: #e54d2e;
--tab-orange: #ef713b;
--tab-yellow: #e0b956;
--tab-green: #58c142;
--tab-mint: #4bffa9;
--tab-cyan: #4bdfff;
--tab-blue: #3971ff;
--tab-violet: #ba76ff;
--tab-pink: #e05677;
--tab-white: #ffffff;
--soft-blue: #729fcf;
// semantic vars based on --soft-blue
--line-base-soft-blue-color: #729fcf;
--line-meta-user-color: #89afd7;
--active-menu-color: rgb(0, 71, 171);
--fixed-font: "Martian Mono", sans-serif;
--terminal-font: "JetBrains Mono", sans-serif;
--text-s1-font: "Martian Mono", sans-serif;
--markdown-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji";
--markdown-highlight: rgb(35, 35, 35);
}
+5 -5
View File
@@ -6,7 +6,7 @@
.icon {
width: 1.3em !important;
height: 1.3em !important;
fill: @base-color;
fill: var(--base-color);
}
.history-checkbox {
@@ -51,7 +51,7 @@
svg {
width: 1.5em;
height: 1.5em;
fill: @base-color;
fill: var(--base-color);
}
}
@@ -70,7 +70,7 @@
font-size: 1em;
padding: 0.5em 1em;
background-color: @background-session-components;
color: @base-color;
color: var(--base-color);
}
}
@@ -99,7 +99,7 @@
.label {
display: inline;
vertical-align: middle;
color: @base-color;
color: var(--base-color);
}
.icon {
vertical-align: middle;
@@ -163,7 +163,7 @@
.reset-button {
margin-left: 1em;
color: @base-color;
color: var(--base-color);
line-height: 1.75em;
}
}
+26
View File
@@ -753,6 +753,32 @@ class LineCmd extends React.Component<
/>
</If>
</ErrorBoundary>
<If condition={cmd.getRtnState()}>
<div
key="rtnstate"
className="cmd-rtnstate"
style={{
visibility: cmd.getStatus() == "done" ? "visible" : "hidden",
}}
>
<If condition={rsdiff == null || rsdiff == ""}>
<div className="cmd-rtnstate-label">state unchanged</div>
<div className="cmd-rtnstate-sep"></div>
</If>
<If condition={rsdiff != null && rsdiff != ""}>
<div className="cmd-rtnstate-label">new state</div>
<div className="cmd-rtnstate-sep"></div>
<div className="cmd-rtnstate-diff" style={{ fontSize: rtnStateDiffSize }}>
<div className="cmd-rtnstate-diff-inner">{this.rtnStateDiff.get()}</div>
</div>
</If>
</div>
</If>
<If condition={isSelected && !isFocused && rendererType == "terminal"}>
<div className="cmd-hints">
<div className="hint-item color-nohover-white">focus line ({renderCmdText("L")})</div>
</div>
</If>
</If>
</div>
);
+66 -45
View File
@@ -1,5 +1,3 @@
@import "@/common/themes/themes.less";
.line.line-text {
flex-direction: row;
padding-top: 5px;
@@ -13,7 +11,7 @@
}
.line .load-error-text {
color: @term-red;
color: var(--line-load-error-text-color);
padding-top: 5px;
}
@@ -23,11 +21,20 @@
.line.line-cmd {
flex-direction: column;
scroll-margin-bottom: var(--termlineheight);
scroll-margin-bottom: 20px;
position: relative;
.plus {
opacity: 0.5;
}
&:hover {
.plus {
opacity: 1;
}
}
.sidebar-message {
color: @term-yellow;
color: var(--line-sidebar-message-text-color);
}
.line-header {
@@ -36,14 +43,13 @@
padding-bottom: 0.7rem;
width: 100%;
line-height: 1.2;
height: calc(var(--termlineheight) * 2);
&.is-expanded {
height: auto;
}
&.hide-prompt {
height: calc(var(--termlineheight) * 2);
height: 32px;
}
.line-icon {
@@ -73,15 +79,15 @@
display: block;
opacity: 1;
}
}
.meta.meta-line1 {
color: rgba(@base-color, 0.6) !important;
font-size: var(--termfontsize);
}
.meta.meta-line1 {
color: var(--line-meta-line1-color) !important;
font-size: 11px;
}
.meta.meta-line2 {
margin-left: -2px;
}
.meta.meta-line2 {
margin-left: -2px;
}
&.has-rtnstate .terminal-wrapper {
@@ -124,7 +130,7 @@
position: relative;
.cmd-rtnstate-label {
font-family: @terminal-font;
font-family: var(--terminal-font);
position: relative;
font-size: 10px;
z-index: 2;
@@ -132,13 +138,13 @@
padding: 2px 5px 0px 5px;
display: inline-block;
font-size: 10px;
color: @term-white;
color: var(--line-base-white-color);
background-color: #151715;
}
.cmd-rtnstate-diff {
font-family: @terminal-font;
color: @term-white;
font-family: var(--terminal-font);
color: var(--line-base-white-color);
white-space: pre;
margin-left: 10px;
padding-left: 10px;
@@ -173,16 +179,16 @@
overflow: hidden;
flex-shrink: 0;
position: relative;
background: @base-background;
background: var(--line-background);
border: 1px solid transparent;
&.selected {
border: 1px solid rgba(@base-color, 0.8) !important;
border: 1px solid var(--line-selected-border-color) !important;
box-shadow: 0px 0px 0.5px 0px rgba(255, 255, 255, 0.5) inset, 0px 0.5px 0px 0px rgba(255, 255, 255, 0.2) inset;
}
&.active {
border: 1px solid rgba(@wave-green, 0.8) !important;
border: 1px solid var(--line-active-border-color) !important;
box-shadow: 0px 0px 0.5px 0px rgba(255, 255, 255, 0.5) inset, 0px 0.5px 0px 0px rgba(255, 255, 255, 0.2) inset;
}
@@ -194,10 +200,11 @@
&.line-simple {
font-size: 11px;
line-height: 1.2;
color: rgba(@base-color, 0.6);
color: var(--line-text-color);
.simple-line-header {
display: flex;
margin-top: 5px;
flex-direction: row;
}
@@ -223,19 +230,19 @@
height: 1em;
margin: 0 0.5em;
vertical-align: text-top;
fill: @base-color;
fill: var(--line-avatar-color);
}
.success {
fill: @wave-green;
fill: var(--line-status-success-fill);
}
.fail {
fill: @error-red;
fill: var(--line-status-error-fill);
}
.warning {
fill: @warning-yellow;
fill: var(--line-status-warning-fill);
}
}
@@ -266,7 +273,8 @@
align-items: center;
justify-content: center;
font-weight: bold;
color: @term-white;
// color: @term-white;
color: var(--line-avatar-color);
border-radius: 5px;
position: relative;
@@ -298,30 +306,30 @@
&.status-error {
.status-icon {
color: @error-red;
color: var(--line-base-error-color);
}
}
&.status-hangup {
.status-icon {
color: @term-yellow;
color: var(--line-base-yellow-color);
}
}
&.status-running {
background-color: @soft-blue;
background-color: var(--line-base-soft-blue-color);
}
&.status-waiting {
background-color: @term-yellow;
background-color: var(--line-base-yellow-color);
}
&.status-detached {
background-color: @soft-blue;
background-color: var(--line-base-soft-blue-color);
.status-icon {
top: 3px;
right: 3px;
color: @term-white;
color: var(--line-base-soft-blue-color);
}
}
}
@@ -339,9 +347,14 @@
display: flex;
flex-direction: row;
.simple-line-status {
margin-top: 5px;
}
.user {
color: lighten(@soft-blue, 10%);
color: var(--line-meta-user-color);
font-weight: bold;
margin-top: 1px;
margin-right: 10px;
}
@@ -349,34 +362,38 @@
.termopts,
.renderer {
display: flex;
margin-top: 5px;
}
.renderer {
margin-left: 3px;
margin-top: 5px;
svg {
width: 1em;
margin-right: 0.5em;
fill: rgba(@base-color, 0.6);
fill: var(--line-meta-line1-color);
}
}
.settings {
display: none;
margin-left: 0.5em;
margin-top: 0.65em;
cursor: pointer;
width: 1em;
height: 1em;
border-radius: 50%;
line-height: 1em;
svg {
fill: rgba(@base-color, 0.6);
fill: var(--line-meta-line1-color);
&:hover {
fill: @base-color;
fill: var(--line-svg-hover-fill);
}
}
}
.termopts {
margin-top: 5px;
display: none;
.resize-button {
cursor: pointer;
@@ -387,6 +404,7 @@
.metapart-mono {
margin-left: 8px;
margin-top: 4px;
white-space: nowrap;
}
@@ -398,7 +416,7 @@
.cmdtext-overflow {
flex-shrink: 0;
padding-right: 2px;
color: @term-white;
color: var(--line-base-white-color);
cursor: pointer;
margin-top: 4px;
@@ -416,7 +434,7 @@
.cmdtext-expanded {
white-space: pre;
color: @term-white;
color: var(--line-base-white-color);
padding-bottom: 5px;
}
}
@@ -434,7 +452,7 @@
}
.line.line-invalid {
color: @term-white;
color: var(--line-base-white-color);
margin-left: 5px;
}
@@ -458,10 +476,14 @@
&:focus,
&:focus-within {
&::-webkit-scrollbar-thumb {
background-color: @scrollbar-thumb !important;
background-color: var(--scrollbar-thumb-background) !important;
}
}
.line:nth-child(2) {
padding-top: 1px;
}
.lines-spacer {
flex-grow: 1;
}
@@ -469,9 +491,8 @@
.line-sep {
display: flex;
align-items: center;
height: var(--termlineheight);
font-size: var(--termfontsize);
color: rgba(@base-color, 0.5);
margin-top: 1em;
color: var(--line-separator-color);
}
.line-sep::before,
@@ -479,7 +500,7 @@
content: "";
height: 1px;
flex-grow: 1;
background-color: rgba(@base-color, 0.5);
background-color: var(--line-separator-color);
}
.line-sep::before {
+1 -1
View File
@@ -23,7 +23,7 @@
svg {
width: 1.5em;
height: 1.5em;
fill: @base-color;
fill: var(--base-color);
}
}
}
+1 -1
View File
@@ -221,7 +221,7 @@
}
.menu-label {
color: @base-color;
color: var(--base-color);
}
.menu-list {
+2 -2
View File
@@ -5,7 +5,7 @@ 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 { isBlank } from "@/util";
import { boundMethod } from "autobind-decorator";
import cn from "classnames";
import { For } from "tsx-control-statements/components";
@@ -92,7 +92,7 @@ class AIChat extends React.Component<{}, {}> {
if (checkKeyPressed(waveEvent, "Escape")) {
e.preventDefault();
e.stopPropagation();
inputModel.closeAIAssistantChat(true);
inputModel.closeAIAssistantChat();
}
if (checkKeyPressed(waveEvent, "Ctrl:l")) {
+1 -1
View File
@@ -91,7 +91,7 @@
height: 1em;
margin: 0 0.5em;
vertical-align: text-top;
fill: @base-color;
fill: var(--base-color);
}
.warning {
+1 -1
View File
@@ -232,7 +232,7 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: ()
if (inputModel.inputMode.get() != null) {
inputModel.resetInputMode();
}
inputModel.closeAIAssistantChat(true);
inputModel.closeAIAssistantChat();
return;
}
if (checkKeyPressed(waveEvent, "Cmd:e")) {
+3 -10
View File
@@ -618,17 +618,10 @@ class InputModel {
})();
}
// pass true to give focus to the input (e.g. if this is an 'active' close of the chat)
// when resetting the input (when switching screens, don't give focus)
closeAIAssistantChat(giveFocus: boolean): void {
if (!this.aIChatShow.get()) {
return;
}
closeAIAssistantChat(): void {
mobx.action(() => {
this.aIChatShow.set(false);
if (giveFocus) {
this.giveFocus();
}
this.giveFocus();
})();
}
@@ -730,7 +723,7 @@ class InputModel {
resetInput(): void {
mobx.action(() => {
this.setHistoryShow(false);
this.closeAIAssistantChat(false);
this.closeAIAssistantChat();
this.infoShow.set(false);
this.inputMode.set(null);
this.resetHistory();
+10 -8
View File
@@ -157,10 +157,6 @@ class Model {
}
return fontSize;
});
mobx.autorun(() => {
const fontSize = this.termFontSize.get();
this._setCssTermFontSize(fontSize);
});
getApi().onTCmd(this.onTCmd.bind(this));
getApi().onICmd(this.onICmd.bind(this));
getApi().onLCmd(this.onLCmd.bind(this));
@@ -318,10 +314,16 @@ class Model {
return appconst.ProdServerEndpoint;
}
_setCssTermFontSize(fontSize: number) {
const root = document.documentElement;
root.style.setProperty("--termfontsize", fontSize + "px");
root.style.setProperty("--termlinehight", Math.ceil(fontSize * 1.2) + "px");
setTermFontSize(fontSize: number) {
if (fontSize < appconst.MinFontSize) {
fontSize = appconst.MinFontSize;
}
if (fontSize > appconst.MaxFontSize) {
fontSize = appconst.MaxFontSize;
}
mobx.action(() => {
this.termFontSize.set(fontSize);
})();
}
getBaseWsHostPort(): string {
-76
View File
@@ -1,76 +0,0 @@
// Copyright 2023, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
package sstore
import "sync"
// This file contains structures related to holding display state for screens / UI
const (
// ideal sizes for Sections/Zone
// we allow these to drift a bit to deal with adding/removing lines
DispZoneLines = 16 * 16
DispSectionLines = 16
DispMaxRatio = 1.6
)
// this will be a map at some point when we have multiple windows, singleton for now
var GlobalDisplayState *DispWindowInfo
// (row, px) <- we use this format so JS is
type DispHeight [2]int
type DispLineRange [2]int // [start, end] (inclusive). set to [0,0] if no lines
// this struct comes from the FE
type DispWindowInfo struct {
Lock *sync.Mutex `json:"-"`
ActiveSessionId string `json:"activesessionid"`
ActiveScreenId string `json:"activescreenid"`
Screens map[string]DispScreenInfo `json:"screens"` // key is "sessionid:screenid" (not a struct for JS integration)
}
type DispScreenInfo struct {
SessionId string `json:"sessionid"`
ScreenId string `json:"screenid"`
SelectedLine int `json:"selectedline"`
AnchorLine int `json:"anchorline"`
AnchorOffset int `json:"anchoroffset"`
}
type DispZoneInfo struct {
ScreenId string `json:"screenid"`
ZoneId int `json:"zoneid"`
Height DispHeight `json:"height"`
NumLines int `json:"numlines"`
LineRange DispLineRange `json:"linerange"`
}
type DispSectionInfo struct {
ScreenId string `json:"screenid"`
ZoneId int `json:"zoneid"`
SectionId int `json:"sectionid"`
Height DispHeight `json:"height"`
LineRange DispLineRange `json:"linerange"`
Parts []DispLineInfo `json:"parts"`
}
// includes separators. combined into one struct for efficiency / JS transport
type DispLineInfo struct {
// for separators
IsSep bool `json:"issep,omitempty"`
SepString string `json:"sepstring,omitempty"`
// for lines
LineId string `json:"lineid,omitempty"`
LineNum int `json:"linenum,omitempty"`
LineType string `json:"linetype,omitempty"`
Ts int64 `json:"ts,omitempty"`
Status string `json:"status,omitempty"`
Renderer string `json:"renderer,omitempty"`
Prompt string `json:"prompt,omitempty"`
CmdStr string `json:"cmdstr,omitempty"`
Min bool `json:"min,omitempty"`
TermOpts string `json:"termopts,omitempty"`
Height DispHeight `json:"height,omitempty"`
}