@electerm/electerm-react 2.3.6 → 2.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/client/common/constants.js +1 -1
  2. package/client/common/ui-theme.js +25 -12
  3. package/client/components/ai/ai.styl +1 -3
  4. package/client/components/bg/custom-css.jsx +2 -2
  5. package/client/components/common/highlight.styl +1 -2
  6. package/client/components/common/input-context-menu.jsx +294 -0
  7. package/client/components/file-transfer/transfer.styl +5 -8
  8. package/client/components/footer/footer.styl +2 -5
  9. package/client/components/layout/layout.styl +2 -3
  10. package/client/components/main/error-wrapper.jsx +3 -3
  11. package/client/components/main/main.jsx +2 -1
  12. package/client/components/main/ui-theme.jsx +46 -6
  13. package/client/components/main/upgrade.styl +4 -6
  14. package/client/components/main/wrapper.styl +5 -27
  15. package/client/components/quick-commands/qm.styl +3 -5
  16. package/client/components/session/session.styl +11 -13
  17. package/client/components/setting-panel/list.styl +5 -5
  18. package/client/components/setting-panel/setting-wrap.styl +1 -6
  19. package/client/components/setting-panel/terminal-bg-config.jsx +3 -0
  20. package/client/components/setting-sync/setting-sync-form.jsx +0 -1
  21. package/client/components/sftp/file-item.jsx +3 -0
  22. package/client/components/sftp/sftp.styl +21 -26
  23. package/client/components/sftp/transfer-tag.styl +3 -5
  24. package/client/components/side-panel-r/right-side-panel.styl +7 -9
  25. package/client/components/sidebar/info.styl +0 -12
  26. package/client/components/sidebar/sidebar.styl +15 -16
  27. package/client/components/sys-menu/sys-menu.styl +8 -10
  28. package/client/components/tabs/tabs.styl +29 -31
  29. package/client/components/terminal/term-search.styl +3 -3
  30. package/client/components/terminal/terminal.jsx +2 -2
  31. package/client/components/terminal/terminal.styl +21 -22
  32. package/client/components/terminal-info/terminal-info.styl +7 -7
  33. package/client/components/theme/terminal-theme-list.styl +2 -2
  34. package/client/components/theme/theme-list-item.jsx +62 -20
  35. package/client/css/basic.styl +4 -7
  36. package/client/css/includes/theme.styl +16 -0
  37. package/client/store/ui-theme.js +0 -35
  38. package/package.json +1 -1
  39. package/client/components/common/native-input.styl +0 -7
  40. package/client/components/setting-sync/sync.styl +0 -7
  41. package/client/css/antd-overwrite.styl +0 -10
  42. package/client/css/includes/theme-default.styl +0 -20
@@ -1,9 +1,9 @@
1
- @require '../../css/includes/theme-default'
1
+
2
2
  .tabs
3
3
  position relative
4
4
  height 36px
5
5
  overflow hidden
6
- background main-dark
6
+ background var(--main-dark)
7
7
  z-index 12
8
8
  ::-webkit-scrollbar
9
9
  width 0
@@ -41,17 +41,17 @@
41
41
  line-height 36px
42
42
  margin 0 1px 0 0
43
43
  border-radius 3px 3px 0 0
44
- background main-dark
44
+ background var(--main-darker)
45
45
  text-align center
46
- color text-dark
46
+ color var(--text-dark)
47
47
  &.tab-last
48
48
  margin-right 5px
49
49
  .tab-reload
50
50
  .tab-close
51
51
  display none
52
52
  &.active
53
- color text
54
- background main
53
+ color var(--text)
54
+ background var(--main)
55
55
  .tab-count
56
56
  opacity 1
57
57
  &:hover
@@ -63,12 +63,12 @@
63
63
  left -2px
64
64
  top 0
65
65
  width 1px
66
- border 1px dashed text-dark
66
+ border 1px dashed var(--text-dark)
67
67
  height 36px
68
68
  &.error
69
69
  .tab-reload
70
70
  display inline-block
71
- color text-light
71
+ color var(--text-light)
72
72
  @keyframes blink
73
73
  0%
74
74
  background-color #e0e0e0
@@ -86,13 +86,13 @@
86
86
  width 5px
87
87
  height 5px
88
88
  border-radius 5px
89
- background-color text-dark
89
+ background-color var(--text-dark)
90
90
  &.success
91
- background-color success
91
+ background-color var(--success)
92
92
  &.error
93
- background-color error
93
+ background-color var(--error)
94
94
  &.processing
95
- background-color primary
95
+ background-color var(--primary)
96
96
  .is-transporting .tab-traffic
97
97
  display block
98
98
  animation blink 2s infinite
@@ -102,7 +102,7 @@
102
102
  left 10px
103
103
  width 5px
104
104
  border-radius 0
105
- background-color success
105
+ background-color var(--success)
106
106
  .is-terminal-active .tab-terminal-feed
107
107
  display block
108
108
  animation blink 2s infinite
@@ -111,7 +111,7 @@
111
111
  display none
112
112
  left 20px
113
113
  border-radius 0
114
- color success
114
+ color var(--success)
115
115
  background none
116
116
  font-size 8px
117
117
  left 2px
@@ -122,28 +122,27 @@
122
122
  cursor pointer
123
123
  top 50%
124
124
  margin-top -8px
125
- background text-dark
125
+ background var(--text-dark)
126
126
  border-radius 100%
127
- color text
127
+ color var(--text)
128
128
  height 16px
129
129
  width 16px
130
130
  text-align center
131
131
  line-height 16px
132
132
  font-size 10px
133
133
  &:hover
134
- color text-light
134
+ color var(--text-light)
135
135
 
136
136
  .tabs-add-btn
137
137
  display inline-block
138
138
  vertical-align middle
139
139
  margin 0 3px 0 3px
140
- color text
141
140
  &.empty
142
141
  font-size 20px
143
142
  margin-left 20px
144
143
  margin-top 10px
145
144
  &:hover
146
- color text-light
145
+ color var(--text-light)
147
146
  .tabs-extra
148
147
  position absolute
149
148
  height 40px
@@ -153,7 +152,6 @@
153
152
  z-index 20
154
153
 
155
154
  .tabs-dd-icon
156
- color text
157
155
  font-size 12px
158
156
  .tabs-add-btn
159
157
  margin-top 0
@@ -165,21 +163,21 @@
165
163
  z-index 900
166
164
  border-radius 0 0 3px 3px
167
165
  padding 0
168
- background main-light
166
+ background var(--main-lighter)
169
167
 
170
168
  .window-control-box
171
169
  display inline-block
172
170
  padding 5px 10px
173
- color text
171
+ color var(--text)
174
172
  &:hover
175
- color primary
173
+ color var(--primary)
176
174
  cursor pointer
177
175
  .icon-maximize
178
- border-color primary
176
+ border-color var(--primary)
179
177
  .icon-maximize
180
178
  width 10px
181
179
  height 7px
182
- border 1px solid text
180
+ border 1px solid var(--text)
183
181
  cursor pointer
184
182
  &.is-max
185
183
  height 6px
@@ -196,11 +194,11 @@
196
194
  border-right none
197
195
 
198
196
  .control-icon:hover
199
- color text-light
197
+ color var(--text-light)
200
198
  .tab-scroll-icon
201
- color text-dark
199
+ color var(--text-dark)
202
200
  &:hover
203
- color text
201
+ color var(--text)
204
202
 
205
203
  .add-menu-wrap
206
204
  overflow-y scroll
@@ -208,9 +206,9 @@
208
206
  .window-control-minimize
209
207
  .window-control-maximize
210
208
  &:hover
211
- background main-dark
209
+ background var(--main-darker)
212
210
  .window-control-close:hover
213
- background error
211
+ background var(--error)
214
212
 
215
213
  .system-ui
216
214
  .window-controls
@@ -219,7 +217,7 @@
219
217
  margin-right 5px
220
218
  font-size 14px
221
219
  .no-sessions
222
- background main
220
+ background var(--main)
223
221
  text-align center
224
222
  padding 50px 0
225
223
  position absolute
@@ -1,10 +1,10 @@
1
- @require '../../css/includes/theme-default'
1
+
2
2
  .term-search-opt-icon
3
3
  margin 0 3px
4
- color text-light
4
+ color var(--text-light)
5
5
  font-size 15px
6
6
  &:hover
7
- color text
7
+ color var(--text)
8
8
  &.term-search-on
9
9
  background #333
10
10
  color #aaa
@@ -1429,8 +1429,8 @@ class Term extends Component {
1429
1429
  ref: this.domRef,
1430
1430
  className: 'absolute term-wrap-2',
1431
1431
  style: {
1432
- left: '10px',
1433
- top: '10px',
1432
+ left: 0,
1433
+ top: 0,
1434
1434
  right: 0,
1435
1435
  bottom: 0
1436
1436
  }
@@ -1,6 +1,6 @@
1
- @require '../../css/includes/theme-default'
1
+
2
2
  .terms-box
3
- background main
3
+ background var(--main)
4
4
  position relative
5
5
  .loading-wrapper
6
6
  padding 30px
@@ -12,22 +12,22 @@
12
12
  z-index 30
13
13
 
14
14
  .terminal-control
15
- background main
15
+ background var(--main)
16
16
  line-height 32px
17
17
  padding 0 10px
18
18
 
19
19
  .terms-box
20
20
  position relative
21
21
  .term-wrap
22
- background main
22
+ background var(--main)
23
23
  position absolute
24
24
 
25
25
  .vertical
26
26
  .term-wrap.not-first-term
27
- border-top 1px solid main-light
27
+ border-top 1px solid var(--main-lighter)
28
28
  .horizontal
29
29
  .term-wrap.not-first-term
30
- border-left 1px solid main-light
30
+ border-left 1px solid var(--main-lighter)
31
31
  .term-sftp-tabs
32
32
  margin-left 5px
33
33
 
@@ -48,9 +48,9 @@
48
48
  left 0
49
49
  top 0
50
50
  width 100%
51
- background main
52
- color text
53
- box-shadow 0px 3px 3px 0px lighten(main, 25%)
51
+ background var(--main)
52
+ color var(--text)
53
+ box-shadow 0px 3px 3px 0px var(--main-lighter)
54
54
  z-index 66
55
55
  padding-bottom 32px
56
56
  .terminal-normal-buffer-body
@@ -59,9 +59,9 @@
59
59
  .terminal-normal-buffer-close
60
60
  cursor pointer
61
61
  font-size 14px
62
- color text
62
+ color var(--text)
63
63
  &:hover
64
- color text-light
64
+ color var(--text-light)
65
65
  .terminal-normal-buffer-footer
66
66
  position absolute
67
67
  left 0
@@ -69,25 +69,24 @@
69
69
  width 100%
70
70
  height 32px
71
71
  line-height 32px
72
- box-shadow 0px -3px 3px 0px lighten(main, 25%)
73
- background main-light
72
+ box-shadow 0px -3px 3px 0px var(--main)
73
+ background var(--main-lighter)
74
74
  .batch-input-wrap
75
75
  width calc(100% - 80px)
76
76
 
77
77
  .terminal-suggestions-wrap
78
78
  position absolute
79
79
  z-index 100
80
- color text
81
80
  max-height 300px
82
81
  max-width 300px
83
82
  min-width 200px
84
- box-shadow 0px 0px 3px 3px main-light
83
+ box-shadow 0px 0px 3px 3px var(--main-lighter)
85
84
  display flex
86
85
  flex-direction column
87
- background main
86
+ background var(--main)
88
87
  border-radius 4px
89
88
  &.reverse .terminal-suggestions-list
90
- border-top 1px solid main-light
89
+ border-top 1px solid var(--main-lighter)
91
90
  border-bottom none
92
91
 
93
92
  .terminal-suggestions-list
@@ -96,7 +95,7 @@
96
95
  overflow-y auto
97
96
  max-height 268px
98
97
  max-width 300px
99
- border-bottom 1px solid main-light
98
+ border-bottom 1px solid var(--main-lighter)
100
99
 
101
100
  .terminal-suggestions-sticky
102
101
  flex-shrink 0
@@ -109,9 +108,9 @@
109
108
  align-items center
110
109
  padding 5px 10px
111
110
  cursor pointer
112
- color text
111
+ color var(--text)
113
112
  &:hover
114
- background-color main-light
113
+ background-color var(--main-lighter)
115
114
  .suggestion-delete
116
115
  visibility visible
117
116
 
@@ -124,9 +123,9 @@
124
123
  .suggestion-type
125
124
  margin-left 5px
126
125
  font-size 0.8em
127
- color lighten(text, 20%)
126
+ color var(--text)
128
127
  &:hover
129
- color text
128
+ color var(--success)
130
129
 
131
130
  .suggestion-delete
132
131
  margin-left 5px
@@ -1,19 +1,19 @@
1
- @require '../../css/includes/theme-default'
1
+
2
2
  .terminal-info-icon
3
- color text-dark
3
+ color var(--text-dark)
4
4
  &:hover
5
- color text
5
+ color var(--text)
6
6
  .info-panel-wrap
7
7
  position fixed
8
8
  right 0
9
9
  top 100px
10
10
  bottom 0
11
11
  width 500px
12
- background main
13
- border 1px solid darken(main, 30%)
12
+ background var(--main)
13
+ border 1px solid var(--main-darker)
14
14
  border-radius 5px 0 0 5px
15
15
  border-right none
16
- color text
16
+ color var(--text)
17
17
  z-index 100
18
18
  overflow-y scroll
19
19
 
@@ -36,4 +36,4 @@
36
36
  max-height none
37
37
  .info-panel-wrap-pin
38
38
  .toggle-info-panel-wrap
39
- color success
39
+ color var(--success)
@@ -1,3 +1,3 @@
1
- @require '../../css/includes/theme-default'
1
+
2
2
  .theme-item.current
3
- border-left 3px solid success
3
+ border-left 3px solid var(--success)
@@ -2,13 +2,15 @@
2
2
  * theme list render
3
3
  */
4
4
 
5
+ import { useState } from 'react'
5
6
  import {
6
7
  CheckCircleOutlined,
7
8
  PlusOutlined,
8
9
  SunOutlined,
9
- MoonOutlined
10
+ MoonOutlined,
11
+ EyeOutlined
10
12
  } from '@ant-design/icons'
11
- import { Tag } from 'antd'
13
+ import { Tag, Tooltip, Button, Space } from 'antd'
12
14
  import classnames from 'classnames'
13
15
  import { defaultTheme } from '../../common/constants'
14
16
  import highlight from '../common/highlight'
@@ -25,25 +27,60 @@ export default function ThemeListItem (props) {
25
27
  } = props
26
28
  const { store } = window
27
29
 
30
+ const [tooltipVisible, setTooltipVisible] = useState(false)
31
+ const [isPreviewing, setIsPreviewing] = useState(false)
32
+
28
33
  function handleClickApply () {
34
+ setTooltipVisible(false)
35
+ setIsPreviewing(false)
29
36
  delete window.originalTheme
30
37
  store.setTheme(item.id)
31
38
  }
32
39
 
33
- function handleMouseEnter () {
34
- // Store current theme ID before changing
35
- const currentTheme = window.store.config.theme
36
- window.originalTheme = currentTheme
37
- // Apply the hovered theme
38
- store.setTheme(item.id)
40
+ function handleClickPreview () {
41
+ if (!isPreviewing) {
42
+ // Store current theme ID before changing
43
+ const currentTheme = window.store.config.theme
44
+ window.originalTheme = currentTheme
45
+ // Apply the preview theme
46
+ store.setTheme(item.id)
47
+ setIsPreviewing(true)
48
+ }
39
49
  }
40
50
 
41
- function handleMouseLeave () {
42
- if (!window.originalTheme) return
43
- // Restore the original theme
44
- store.setTheme(window.originalTheme)
45
- // Clean up
46
- delete window.originalTheme
51
+ function handleTooltipVisibleChange (visible) {
52
+ setTooltipVisible(visible)
53
+ if (!visible && isPreviewing) {
54
+ // Restore original theme when tooltip closes during preview
55
+ if (window.originalTheme) {
56
+ store.setTheme(window.originalTheme)
57
+ delete window.originalTheme
58
+ }
59
+ setIsPreviewing(false)
60
+ }
61
+ }
62
+
63
+ function renderTooltipContent () {
64
+ return (
65
+ <Space>
66
+ <Button
67
+ size='small'
68
+ icon={<EyeOutlined />}
69
+ onClick={handleClickPreview}
70
+ type={isPreviewing ? 'primary' : 'default'}
71
+ >
72
+ {e('preview')}
73
+ </Button>
74
+ <Button
75
+ size='small'
76
+ icon={<CheckCircleOutlined />}
77
+ onClick={handleClickApply}
78
+ type='primary'
79
+ >
80
+ {e('apply')}
81
+ </Button>
82
+ </Space>
83
+ )
47
84
  }
48
85
 
49
86
  function renderApplyBtn () {
@@ -51,12 +88,17 @@ export default function ThemeListItem (props) {
51
88
  return null
52
89
  }
53
90
  return (
54
- <CheckCircleOutlined
55
- className='pointer list-item-apply'
56
- onClick={handleClickApply}
57
- onMouseEnter={handleMouseEnter}
58
- onMouseLeave={handleMouseLeave}
59
- />
91
+ <Tooltip
92
+ title={renderTooltipContent()}
93
+ trigger='click'
94
+ open={tooltipVisible}
95
+ onOpenChange={handleTooltipVisibleChange}
96
+ placement='top'
97
+ >
98
+ <CheckCircleOutlined
99
+ className='pointer list-item-apply'
100
+ />
101
+ </Tooltip>
60
102
  )
61
103
  }
62
104
 
@@ -1,15 +1,14 @@
1
1
  @require './includes'
2
- @require './antd-overwrite'
3
- @require './includes/theme-default'
2
+ @require './includes/theme'
4
3
 
5
4
  body
6
- color text
7
5
  overflow hidden
8
6
  background main
9
7
  font-size 12px
10
8
  line-height 1.5715
11
9
  font-family -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
12
10
  font-variant: tabular-nums
11
+ color var(--text)
13
12
 
14
13
  ::-webkit-scrollbar
15
14
  background transparent
@@ -23,7 +22,7 @@ body
23
22
  -webkit-box-shadow none
24
23
 
25
24
  ::-webkit-scrollbar-thumb
26
- background-color primary
25
+ background-color var(--primary)
27
26
  outline none
28
27
 
29
28
  .common-err
@@ -31,11 +30,9 @@ body
31
30
  overflow-y scroll
32
31
  overflow-x hidden
33
32
  word-break break-all
34
- .hide-resize-observer
35
- display: none !important
36
33
 
37
34
  a
38
- color primary
35
+ color var(--primary)
39
36
 
40
37
  .cap
41
38
  text-transform capitalize
@@ -0,0 +1,16 @@
1
+ :root
2
+ --main #141314
3
+ --main-dark #000
4
+ --main-light #2E3338
5
+ --text #ddd
6
+ --text-light #fff
7
+ --text-dark #888
8
+ --text-disabled #777
9
+ --primary #08c
10
+ --info #FFD166
11
+ --success #06D6A0
12
+ --error #EF476F
13
+ --warn #E55934
14
+ --primary-contrast #fff
15
+ --main-darker #0e0d0e
16
+ --main-lighter #5b5a5b
@@ -2,7 +2,6 @@
2
2
  * ui theme functions
3
3
  */
4
4
 
5
- import { escapeRegExp } from 'lodash-es'
6
5
  import {
7
6
  defaultTheme,
8
7
  settingMap
@@ -10,40 +9,6 @@ import {
10
9
  import copy from 'json-deep-copy'
11
10
 
12
11
  export default Store => {
13
- Store.prototype.getDefaultUiThemeConfig = function (stylus) {
14
- const reg = /[^\n]+ = [^\n]+\n/g
15
- const arr = stylus.match(reg)
16
- const sep = ' = '
17
- return arr.reduce((p, x) => {
18
- if (!x.includes(sep)) {
19
- return p
20
- }
21
- const [k, v] = x.split(sep)
22
- return {
23
- ...p,
24
- [k.trim()]: v.trim()
25
- }
26
- }, {})
27
- }
28
-
29
- Store.prototype.buildTheme = function (config) {
30
- let { stylus } = window.et
31
- const keys = Object.keys(config)
32
- for (const key of keys) {
33
- const reg = new RegExp(escapeRegExp(key) + ' = [^\\n]+\\n')
34
- const v = config[key]
35
- stylus = stylus.replace(reg, `${key} = ${v}\n`)
36
- }
37
- return window.pre.runGlobalAsync('toCss', stylus)
38
- }
39
-
40
- // Store.prototype.sortTheme = function (a, b) {
41
- // const theme = window.originalTheme || window.store.config.theme
42
- // const ax = a.id === theme ? -1 : 1
43
- // const bx = b.id === theme ? -1 : 1
44
- // return ax > bx ? 1 : -1
45
- // }
46
-
47
12
  Store.prototype.getUiThemeConfig = function () {
48
13
  const { store } = window
49
14
  const theme = store.getSidebarList(settingMap.terminalThemes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "2.3.6",
3
+ "version": "2.3.18",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",
@@ -1,7 +0,0 @@
1
- @require '../../css/includes/theme-default'
2
- .native-input
3
- color text
4
- background-color main-light
5
- border-color main-light
6
- &:focus
7
- border-color main-light
@@ -1,7 +0,0 @@
1
- @require '../../css/includes/theme-default'
2
- .sync-control
3
- margin-bottom 0
4
- .sync-control-link
5
- color primary
6
- &:hover
7
- color text-light
@@ -1,10 +0,0 @@
1
-
2
-
3
- #container .ant-spin-blur
4
- opacity 1 !important
5
- .ant-tree-indent-unit
6
- width 5px
7
- .ant-tree .ant-tree-switcher.ant-tree-switcher-noop
8
- width 0px
9
- td.ant-table-column-sort
10
- background none
@@ -1,20 +0,0 @@
1
-
2
- // Function to determine font color based on background color
3
- contrastColor(color)
4
- if (luminance(color) > 0.5)
5
- return #000000 // Black font for bright colors
6
- else
7
- return #ffffff // White font for dark colors
8
-
9
- main = #141314
10
- main-dark = #000
11
- main-light = #2E3338
12
- text = #ddd
13
- text-light = #fff
14
- text-dark = #888
15
- text-disabled = #777
16
- primary = #08c
17
- info = #FFD166
18
- success = #06D6A0
19
- error = #EF476F
20
- warn = #E55934