@electerm/electerm-react 2.3.6 → 2.3.30

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 (50) hide show
  1. package/client/common/constants.js +1 -1
  2. package/client/common/has-active-input.js +10 -0
  3. package/client/common/ui-theme.js +25 -12
  4. package/client/components/ai/ai.styl +1 -3
  5. package/client/components/bg/custom-css.jsx +2 -2
  6. package/client/components/common/highlight.styl +1 -2
  7. package/client/components/common/input-context-menu.jsx +294 -0
  8. package/client/components/file-transfer/transfer.styl +6 -8
  9. package/client/components/footer/footer.styl +2 -5
  10. package/client/components/layout/layout.styl +2 -3
  11. package/client/components/main/error-wrapper.jsx +3 -3
  12. package/client/components/main/main.jsx +2 -1
  13. package/client/components/main/ui-theme.jsx +46 -6
  14. package/client/components/main/upgrade.styl +4 -6
  15. package/client/components/main/wrapper.styl +5 -27
  16. package/client/components/quick-commands/qm.styl +3 -5
  17. package/client/components/session/session.styl +11 -13
  18. package/client/components/setting-panel/list.styl +5 -5
  19. package/client/components/setting-panel/setting-wrap.styl +1 -6
  20. package/client/components/setting-panel/terminal-bg-config.jsx +3 -0
  21. package/client/components/setting-sync/setting-sync-form.jsx +0 -1
  22. package/client/components/sftp/file-item.jsx +8 -5
  23. package/client/components/sftp/sftp-entry.jsx +18 -4
  24. package/client/components/sftp/sftp.styl +24 -28
  25. package/client/components/sftp/transfer-tag.styl +3 -5
  26. package/client/components/side-panel-r/right-side-panel.styl +7 -9
  27. package/client/components/sidebar/index.jsx +6 -0
  28. package/client/components/sidebar/info.styl +0 -12
  29. package/client/components/sidebar/sidebar.styl +15 -16
  30. package/client/components/sys-menu/sub-tab-menu.jsx +2 -2
  31. package/client/components/sys-menu/sys-menu.styl +11 -11
  32. package/client/components/tabs/add-btn.jsx +258 -0
  33. package/client/components/tabs/add-btn.styl +12 -0
  34. package/client/components/tabs/index.jsx +8 -56
  35. package/client/components/tabs/tabs.styl +30 -31
  36. package/client/components/terminal/term-search.styl +3 -3
  37. package/client/components/terminal/terminal.jsx +2 -2
  38. package/client/components/terminal/terminal.styl +21 -22
  39. package/client/components/terminal-info/terminal-info.styl +7 -7
  40. package/client/components/theme/terminal-theme-list.styl +2 -2
  41. package/client/components/theme/theme-list-item.jsx +62 -20
  42. package/client/components/tree-list/tree-expander.jsx +4 -2
  43. package/client/css/basic.styl +5 -8
  44. package/client/css/includes/theme.styl +16 -0
  45. package/client/store/ui-theme.js +0 -35
  46. package/package.json +1 -1
  47. package/client/components/common/native-input.styl +0 -7
  48. package/client/components/setting-sync/sync.styl +0 -7
  49. package/client/css/antd-overwrite.styl +0 -10
  50. package/client/css/includes/theme-default.styl +0 -20
@@ -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
 
@@ -4,10 +4,12 @@ import {
4
4
  } from '@ant-design/icons'
5
5
 
6
6
  export default function TreeExpander (props) {
7
- function onExpand () {
7
+ function onExpand (e) {
8
+ e.stopPropagation()
8
9
  props.onExpand(group)
9
10
  }
10
- function onUnExpand () {
11
+ function onUnExpand (e) {
12
+ e.stopPropagation()
11
13
  props.onUnExpand(group)
12
14
  }
13
15
  const { group } = props
@@ -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
- background main
6
+ background var(--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.30",
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