@electerm/electerm-react 2.3.36 → 2.3.48
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.
- package/client/common/constants.js +0 -37
- package/client/common/terminal-theme.js +8 -13
- package/client/common/theme-defaults.js +120 -0
- package/client/components/common/ref.js +35 -0
- package/client/components/file-transfer/transfer.styl +9 -4
- package/client/components/tabs/tab.jsx +3 -12
- package/client/components/tabs/tabs.styl +3 -3
- package/client/components/theme/theme-form.jsx +9 -3
- package/client/components/theme/theme-list-item.jsx +3 -3
- package/client/components/theme/theme-list.jsx +3 -2
- package/client/store/init-state.js +1 -4
- package/client/store/load-data.js +0 -1
- package/client/store/store.js +7 -2
- package/client/store/tab.js +2 -2
- package/client/store/terminal-theme.js +21 -43
- package/client/store/ui-theme.js +5 -2
- package/package.json +1 -1
- package/client/common/db-defaults.js +0 -123
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* constants
|
|
3
3
|
*/
|
|
4
|
-
import { getUiThemeConfig } from './ui-theme'
|
|
5
4
|
import logoPath1Ref from '@electerm/electerm-resource/res/imgs/electerm-round-128x128.png'
|
|
6
5
|
import logoPath2Ref from '@electerm/electerm-resource/res/imgs/electerm.png'
|
|
7
6
|
import logoPath3Ref from '@electerm/electerm-resource/res/imgs/electerm-watermark.png'
|
|
8
|
-
import dbDefaults from './db-defaults'
|
|
9
|
-
import { get as _get } from 'lodash-es'
|
|
10
7
|
export const packInfo = typeof window.et.packInfo === 'undefined' ? window.pre.packInfo : window.et.packInfo
|
|
11
8
|
const buildConst = (props) => {
|
|
12
9
|
return props.reduce((prev, key) => {
|
|
@@ -150,35 +147,6 @@ export const leftSidebarWidthKey = 'left-sidebar-width'
|
|
|
150
147
|
export const rightSidebarWidthKey = 'right-sidebar-width'
|
|
151
148
|
export const sftpDefaultSortSettingKey = 'sftp-default-sort'
|
|
152
149
|
export const qmSortByFrequencyKey = 'qm-sort-by-frequency'
|
|
153
|
-
// https://github.com/tinkertrain/panda-syntax-vscode/blob/master/themes/workbench.yaml
|
|
154
|
-
export const defaultTheme = {
|
|
155
|
-
id: 'default',
|
|
156
|
-
name: 'default',
|
|
157
|
-
themeConfig: {
|
|
158
|
-
foreground: '#bbbbbb',
|
|
159
|
-
background: '#141314',
|
|
160
|
-
cursor: '#b5bd68',
|
|
161
|
-
cursorAccent: '#1d1f21',
|
|
162
|
-
selectionBackground: 'rgba(255, 255, 255, 0.3)',
|
|
163
|
-
black: '#575757',
|
|
164
|
-
red: '#FF2C6D',
|
|
165
|
-
green: '#19f9d8',
|
|
166
|
-
yellow: '#FFB86C',
|
|
167
|
-
blue: '#45A9F9',
|
|
168
|
-
magenta: '#FF75B5',
|
|
169
|
-
cyan: '#B084EB',
|
|
170
|
-
white: '#CDCDCD',
|
|
171
|
-
brightBlack: '#757575',
|
|
172
|
-
brightRed: '#FF2C6D',
|
|
173
|
-
brightGreen: '#19f9d8',
|
|
174
|
-
brightYellow: '#FFCC95',
|
|
175
|
-
brightBlue: '#6FC1FF',
|
|
176
|
-
brightMagenta: '#FF9AC1',
|
|
177
|
-
brightCyan: '#BCAAFE',
|
|
178
|
-
brightWhite: '#E6E6E6'
|
|
179
|
-
},
|
|
180
|
-
uiThemeConfig: getUiThemeConfig()
|
|
181
|
-
}
|
|
182
150
|
|
|
183
151
|
export const commonBaudRates = [
|
|
184
152
|
110,
|
|
@@ -230,11 +198,6 @@ export const settingShortcutsId = 'setting-shortcuts'
|
|
|
230
198
|
export const settingAiId = 'setting-ai'
|
|
231
199
|
export const settingCommonId = 'setting-common'
|
|
232
200
|
export const defaultEnvLang = 'en_US.UTF-8'
|
|
233
|
-
const defaultThemeLightConf = _get(
|
|
234
|
-
dbDefaults, '[0].data[1]'
|
|
235
|
-
)
|
|
236
|
-
defaultThemeLightConf.id = defaultThemeLightConf._id
|
|
237
|
-
export const defaultThemeLight = defaultThemeLightConf
|
|
238
201
|
export const fileActions = {
|
|
239
202
|
cancel: 'cancel',
|
|
240
203
|
skip: 'skip',
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* theme control
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { settingMap } from '../common/constants'
|
|
6
6
|
import download from '../common/download'
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
defaultTheme
|
|
9
|
+
} from './theme-defaults'
|
|
10
|
+
|
|
8
11
|
const e = window.translate
|
|
9
12
|
const terminalPrefix = 'terminal:'
|
|
10
13
|
export const requiredThemeProps = [
|
|
@@ -46,21 +49,13 @@ export const validThemeProps = [
|
|
|
46
49
|
...requiredThemeProps,
|
|
47
50
|
'name'
|
|
48
51
|
]
|
|
49
|
-
/**
|
|
50
|
-
* build default themes
|
|
51
|
-
*/
|
|
52
|
-
export const buildDefaultThemes = () => {
|
|
53
|
-
return {
|
|
54
|
-
[defaultTheme.id]: defaultTheme
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
52
|
|
|
58
53
|
/**
|
|
59
54
|
* build new theme
|
|
60
55
|
*/
|
|
61
|
-
export const buildNewTheme = (theme = defaultTheme) => {
|
|
56
|
+
export const buildNewTheme = (theme = defaultTheme()) => {
|
|
62
57
|
return Object.assign(
|
|
63
|
-
|
|
58
|
+
theme,
|
|
64
59
|
{
|
|
65
60
|
id: '',
|
|
66
61
|
name: e('newTheme')
|
|
@@ -132,7 +127,7 @@ export const convertTheme = (themeTxt) => {
|
|
|
132
127
|
* @return {array} extra keys
|
|
133
128
|
*/
|
|
134
129
|
export const verifyTheme = (themeConfig) => {
|
|
135
|
-
const keysRight = Object.keys(defaultTheme.themeConfig)
|
|
130
|
+
const keysRight = Object.keys(defaultTheme().themeConfig)
|
|
136
131
|
const keys = Object.keys(themeConfig)
|
|
137
132
|
const extraKeys = keys.filter(k => !keysRight.includes(k))
|
|
138
133
|
return extraKeys
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* database default should init
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function parsor (themeTxt) {
|
|
6
|
+
return themeTxt.split('\n').reduce((prev, line) => {
|
|
7
|
+
let [key = '', value = ''] = line.split('=')
|
|
8
|
+
key = key.trim()
|
|
9
|
+
value = value.trim()
|
|
10
|
+
if (!key || !value) {
|
|
11
|
+
return prev
|
|
12
|
+
}
|
|
13
|
+
prev[key] = value
|
|
14
|
+
return prev
|
|
15
|
+
}, {})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const defaultThemeDark = () => {
|
|
19
|
+
return parsor(`
|
|
20
|
+
main = #20111b
|
|
21
|
+
main-dark = #000
|
|
22
|
+
main-light = #2E3338
|
|
23
|
+
text = #ddd
|
|
24
|
+
text-light = #fff
|
|
25
|
+
text-dark = #888
|
|
26
|
+
text-disabled = #777
|
|
27
|
+
primary = #08c
|
|
28
|
+
info = #FFD166
|
|
29
|
+
success = #06D6A0
|
|
30
|
+
error = #EF476F
|
|
31
|
+
warn = #E55934
|
|
32
|
+
`)
|
|
33
|
+
}
|
|
34
|
+
const defaultThemeLightFunc = () => {
|
|
35
|
+
return parsor(`
|
|
36
|
+
main=#ededed
|
|
37
|
+
main-dark=#cccccc
|
|
38
|
+
main-light=#fefefe
|
|
39
|
+
text=#555
|
|
40
|
+
text-light=#777
|
|
41
|
+
text-dark=#444
|
|
42
|
+
text-disabled=#888
|
|
43
|
+
primary=#08c
|
|
44
|
+
info=#FFD166
|
|
45
|
+
success=#06D6A0
|
|
46
|
+
error=#EF476F
|
|
47
|
+
warn=#E55934
|
|
48
|
+
`)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const defaultThemeLightTerminal = () => {
|
|
52
|
+
return parsor(`
|
|
53
|
+
foreground=#333333
|
|
54
|
+
background=#ededed
|
|
55
|
+
cursor=#b5bd68
|
|
56
|
+
cursorAccent=#1d1f21
|
|
57
|
+
selectionBackground=rgba(0, 0, 0, 0.3)
|
|
58
|
+
black=#575757
|
|
59
|
+
red=#FF2C6D
|
|
60
|
+
green=#19f9d8
|
|
61
|
+
yellow=#FFB86C
|
|
62
|
+
blue=#45A9F9
|
|
63
|
+
magenta=#FF75B5
|
|
64
|
+
cyan=#B084EB
|
|
65
|
+
white=#CDCDCD
|
|
66
|
+
brightBlack=#757575
|
|
67
|
+
brightRed=#FF2C6D
|
|
68
|
+
brightGreen=#19f9d8
|
|
69
|
+
brightYellow=#FFCC95
|
|
70
|
+
brightBlue=#6FC1FF
|
|
71
|
+
brightMagenta=#FF9AC1
|
|
72
|
+
brightCyan=#BCAAFE
|
|
73
|
+
brightWhite=#E6E6E6
|
|
74
|
+
`
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const defaultThemeDarkTerminal = () => {
|
|
79
|
+
return {
|
|
80
|
+
foreground: '#bbbbbb',
|
|
81
|
+
background: '#20111b',
|
|
82
|
+
cursor: '#b5bd68',
|
|
83
|
+
cursorAccent: '#1d1f21',
|
|
84
|
+
selectionBackground: 'rgba(255, 255, 255, 0.3)',
|
|
85
|
+
black: '#575757',
|
|
86
|
+
red: '#FF2C6D',
|
|
87
|
+
green: '#19f9d8',
|
|
88
|
+
yellow: '#FFB86C',
|
|
89
|
+
blue: '#45A9F9',
|
|
90
|
+
magenta: '#FF75B5',
|
|
91
|
+
cyan: '#B084EB',
|
|
92
|
+
white: '#CDCDCD',
|
|
93
|
+
brightBlack: '#757575',
|
|
94
|
+
brightRed: '#FF2C6D',
|
|
95
|
+
brightGreen: '#19f9d8',
|
|
96
|
+
brightYellow: '#FFCC95',
|
|
97
|
+
brightBlue: '#6FC1FF',
|
|
98
|
+
brightMagenta: '#FF9AC1',
|
|
99
|
+
brightCyan: '#BCAAFE',
|
|
100
|
+
brightWhite: '#E6E6E6'
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function defaultTheme () {
|
|
105
|
+
return {
|
|
106
|
+
id: 'default',
|
|
107
|
+
name: 'default',
|
|
108
|
+
themeConfig: defaultThemeDarkTerminal(),
|
|
109
|
+
uiThemeConfig: defaultThemeDark()
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function defaultThemeLight () {
|
|
114
|
+
return {
|
|
115
|
+
id: 'defaultLight',
|
|
116
|
+
name: 'default light',
|
|
117
|
+
themeConfig: defaultThemeLightTerminal(),
|
|
118
|
+
uiThemeConfig: defaultThemeLightFunc()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
window.refs = new Map()
|
|
3
3
|
window.refsStatic = new Map()
|
|
4
4
|
window.refsTransfers = new Map()
|
|
5
|
+
window.refsTabs = new Map()
|
|
5
6
|
|
|
6
7
|
class Ref {
|
|
7
8
|
constructor (key) {
|
|
@@ -21,6 +22,40 @@ class Ref {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
class TabsRef extends Ref {
|
|
26
|
+
constructor (key) {
|
|
27
|
+
super(key)
|
|
28
|
+
// Map to track add count for each key: key -> number
|
|
29
|
+
this.addCounts = new Map()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
add (key, inst) {
|
|
33
|
+
// Increment add count
|
|
34
|
+
const currentCount = this.addCounts.get(key) || 0
|
|
35
|
+
this.addCounts.set(key, currentCount + 1)
|
|
36
|
+
|
|
37
|
+
// Add/update the ref
|
|
38
|
+
window[this.key].set(key, inst)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
remove (key) {
|
|
42
|
+
const currentCount = this.addCounts.get(key) || 0
|
|
43
|
+
|
|
44
|
+
if (currentCount <= 0) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const newCount = currentCount - 1
|
|
49
|
+
if (newCount === 0) {
|
|
50
|
+
window[this.key].delete(key)
|
|
51
|
+
this.addCounts.delete(key)
|
|
52
|
+
} else {
|
|
53
|
+
this.addCounts.set(key, newCount)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
24
58
|
export const refs = new Ref('refs')
|
|
25
59
|
export const refsTransfers = new Ref('refsTransfers')
|
|
26
60
|
export const refsStatic = new Ref('refsStatic')
|
|
61
|
+
export const refsTabs = new TabsRef('refsTabs')
|
|
@@ -33,10 +33,15 @@
|
|
|
33
33
|
display flex
|
|
34
34
|
padding 8px 5px
|
|
35
35
|
&:hover
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
font-weight bold
|
|
37
|
+
.transfer-control-icon
|
|
38
|
+
padding-right 5px
|
|
39
|
+
padding-left 5px
|
|
40
|
+
margin-top -2px
|
|
41
|
+
&:hover
|
|
42
|
+
color var(--primary-contrast)
|
|
43
|
+
background var(--primary)
|
|
44
|
+
border-radius 20px
|
|
40
45
|
|
|
41
46
|
.flex-child + .flex-child
|
|
42
47
|
margin-left 5px
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { createRef } from 'react'
|
|
6
6
|
import { Component } from 'manate/react/class-components'
|
|
7
|
-
import {
|
|
7
|
+
import { refsTabs } from '../common/ref'
|
|
8
8
|
import {
|
|
9
9
|
CloseOutlined,
|
|
10
10
|
Loading3QuartersOutlined,
|
|
@@ -36,22 +36,13 @@ class Tab extends Component {
|
|
|
36
36
|
terminalOnData: false
|
|
37
37
|
}
|
|
38
38
|
this.id = 'tab-' + this.props.tab.id
|
|
39
|
-
|
|
39
|
+
refsTabs.add(this.id, this)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
tabRef = createRef()
|
|
43
43
|
|
|
44
|
-
componentDidUpdate (prevProps) {
|
|
45
|
-
if (this.props.openContextMenu && !prevProps.openContextMenu) {
|
|
46
|
-
this.handleContextMenu()
|
|
47
|
-
}
|
|
48
|
-
if (this.props.contextFunc && !prevProps.contextFunc) {
|
|
49
|
-
this[this.props.contextFunc](...this.props.contextArgs)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
44
|
componentWillUnmount () {
|
|
54
|
-
|
|
45
|
+
refsTabs.remove(this.id)
|
|
55
46
|
clearTimeout(this.timer)
|
|
56
47
|
this.timer = null
|
|
57
48
|
}
|
|
@@ -106,16 +106,17 @@
|
|
|
106
106
|
.is-terminal-active .tab-terminal-feed
|
|
107
107
|
display block
|
|
108
108
|
animation blink 2s infinite
|
|
109
|
+
background-color transparent !important
|
|
109
110
|
/* Remove opacity animation, use background-color */
|
|
110
111
|
.tab-terminal-feed
|
|
111
112
|
display none
|
|
112
113
|
left 20px
|
|
113
114
|
border-radius 0
|
|
114
115
|
color var(--success)
|
|
115
|
-
background none
|
|
116
116
|
font-size 8px
|
|
117
117
|
left 2px
|
|
118
118
|
top 24px
|
|
119
|
+
background none
|
|
119
120
|
.tab-close
|
|
120
121
|
position absolute
|
|
121
122
|
right 5px
|
|
@@ -131,8 +132,7 @@
|
|
|
131
132
|
line-height 16px
|
|
132
133
|
font-size 10px
|
|
133
134
|
&:hover
|
|
134
|
-
background var(--
|
|
135
|
-
color var(--primary-contast)
|
|
135
|
+
background var(--error)
|
|
136
136
|
|
|
137
137
|
.tabs-add-btn
|
|
138
138
|
display inline-block
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { useRef, useState } from 'react'
|
|
2
2
|
import { Button, Input, message, Upload, Form, Space } from 'antd'
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
convertTheme,
|
|
5
|
+
convertThemeToText,
|
|
6
|
+
exportTheme,
|
|
7
|
+
validThemeProps,
|
|
8
|
+
requiredThemeProps
|
|
9
|
+
} from '../../common/terminal-theme'
|
|
10
|
+
import { defaultTheme, defaultThemeLight } from '../../common/theme-defaults'
|
|
5
11
|
import generate from '../../common/uid'
|
|
6
12
|
import Link from '../common/external-link'
|
|
7
13
|
import InputAutoFocus from '../common/input-auto-focus'
|
|
@@ -229,7 +235,7 @@ export default function ThemeForm (props) {
|
|
|
229
235
|
themeName,
|
|
230
236
|
themeText: convertThemeToText(props.formData)
|
|
231
237
|
}
|
|
232
|
-
const isDefaultTheme = id === defaultTheme.id || id === defaultThemeLight.id
|
|
238
|
+
const isDefaultTheme = id === defaultTheme().id || id === defaultThemeLight().id
|
|
233
239
|
const disabled = readonly || isDefaultTheme
|
|
234
240
|
const switchTxt = editor === 'theme-editor-txt' ? e('editWithColorPicker') : e('editWithTextEditor')
|
|
235
241
|
const pickerProps = {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@ant-design/icons'
|
|
13
13
|
import { Tag, Tooltip, Button, Space } from 'antd'
|
|
14
14
|
import classnames from 'classnames'
|
|
15
|
-
import { defaultTheme } from '../../common/
|
|
15
|
+
import { defaultTheme } from '../../common/theme-defaults'
|
|
16
16
|
import highlight from '../common/highlight'
|
|
17
17
|
import isColorDark from '../../common/is-color-dark'
|
|
18
18
|
|
|
@@ -138,7 +138,7 @@ export default function ThemeListItem (props) {
|
|
|
138
138
|
active: activeItemId === id
|
|
139
139
|
}
|
|
140
140
|
)
|
|
141
|
-
let title = id === defaultTheme.id
|
|
141
|
+
let title = id === defaultTheme().id
|
|
142
142
|
? e(id)
|
|
143
143
|
: name
|
|
144
144
|
title = highlight(
|
|
@@ -160,7 +160,7 @@ export default function ThemeListItem (props) {
|
|
|
160
160
|
{renderTag()}{title}
|
|
161
161
|
</div>
|
|
162
162
|
{
|
|
163
|
-
id === defaultTheme.id || type === 'iterm'
|
|
163
|
+
id === defaultTheme().id || type === 'iterm'
|
|
164
164
|
? null
|
|
165
165
|
: props.renderDelBtn(item)
|
|
166
166
|
}
|
|
@@ -7,7 +7,8 @@ import { LoadingOutlined, CheckCircleOutlined } from '@ant-design/icons'
|
|
|
7
7
|
import { pick } from 'lodash-es'
|
|
8
8
|
import { Pagination } from 'antd'
|
|
9
9
|
import ThemeListItem from './theme-list-item'
|
|
10
|
-
import {
|
|
10
|
+
import { settingMap } from '../../common/constants'
|
|
11
|
+
import { defaultTheme } from '../../common/theme-defaults'
|
|
11
12
|
import getInitItem from '../../common/init-setting-item'
|
|
12
13
|
import './terminal-theme-list.styl'
|
|
13
14
|
|
|
@@ -48,7 +49,7 @@ export default class ThemeList extends List {
|
|
|
48
49
|
return null
|
|
49
50
|
}
|
|
50
51
|
const { name, id } = item
|
|
51
|
-
const title = id === defaultTheme.id
|
|
52
|
+
const title = id === defaultTheme().id
|
|
52
53
|
? e(id)
|
|
53
54
|
: name
|
|
54
55
|
return (
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
splitMap,
|
|
25
25
|
cmdHistoryKey
|
|
26
26
|
} from '../common/constants'
|
|
27
|
-
import { buildDefaultThemes } from '../common/terminal-theme'
|
|
28
27
|
import * as ls from '../common/safe-local-storage'
|
|
29
28
|
import { exclude } from 'manate'
|
|
30
29
|
import initSettingItem from '../common/init-setting-item'
|
|
@@ -61,9 +60,7 @@ export default () => {
|
|
|
61
60
|
profiles: [],
|
|
62
61
|
bookmarkGroups: getDefaultBookmarkGroups([]),
|
|
63
62
|
_config: {},
|
|
64
|
-
terminalThemes: [
|
|
65
|
-
buildDefaultThemes()
|
|
66
|
-
],
|
|
63
|
+
terminalThemes: [],
|
|
67
64
|
itermThemes: exclude([]),
|
|
68
65
|
currentBookmarkGroupId: defaultBookmarkGroupId,
|
|
69
66
|
expandedKeys: ls.getItemJSON(expandedKeysLsKey, [
|
package/client/store/store.js
CHANGED
|
@@ -40,7 +40,7 @@ import createTitle from '../common/create-title'
|
|
|
40
40
|
import {
|
|
41
41
|
theme
|
|
42
42
|
} from 'antd'
|
|
43
|
-
import {
|
|
43
|
+
import { refsTabs } from '../components/common/ref'
|
|
44
44
|
|
|
45
45
|
class Store {
|
|
46
46
|
constructor () {
|
|
@@ -79,7 +79,7 @@ class Store {
|
|
|
79
79
|
const {
|
|
80
80
|
activeTabId
|
|
81
81
|
} = this
|
|
82
|
-
const tab =
|
|
82
|
+
const tab = refsTabs.get('tab-' + activeTabId)
|
|
83
83
|
if (!tab) {
|
|
84
84
|
return null
|
|
85
85
|
}
|
|
@@ -106,18 +106,23 @@ class Store {
|
|
|
106
106
|
get inActiveTerminal () {
|
|
107
107
|
const { store } = window
|
|
108
108
|
if (store.showModal) {
|
|
109
|
+
console.log('inActiveTerminal because showModal')
|
|
109
110
|
return false
|
|
110
111
|
}
|
|
111
112
|
const { currentTab } = store
|
|
112
113
|
if (!currentTab) {
|
|
114
|
+
console.log('inActiveTerminal because no currentTab')
|
|
113
115
|
return false
|
|
114
116
|
}
|
|
115
117
|
const {
|
|
116
118
|
type
|
|
117
119
|
} = currentTab
|
|
118
120
|
if (type === 'web' || type === 'rdp' || type === 'vnc') {
|
|
121
|
+
console.log('inActiveTerminal because type', type)
|
|
119
122
|
return false
|
|
120
123
|
}
|
|
124
|
+
console.log('currentTab.sshSftpSplitView', currentTab.sshSftpSplitView)
|
|
125
|
+
console.log('currentTab.pane', currentTab.pane)
|
|
121
126
|
return currentTab.sshSftpSplitView ||
|
|
122
127
|
currentTab.pane === paneMap.terminal
|
|
123
128
|
}
|
package/client/store/tab.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
paneMap,
|
|
10
10
|
maxHistory
|
|
11
11
|
} from '../common/constants'
|
|
12
|
-
import { refs } from '../components/common/ref'
|
|
12
|
+
import { refs, refsTabs } from '../components/common/ref'
|
|
13
13
|
import { message } from 'antd'
|
|
14
14
|
import * as ls from '../common/safe-local-storage'
|
|
15
15
|
import deepCopy from 'json-deep-copy'
|
|
@@ -571,7 +571,7 @@ export default Store => {
|
|
|
571
571
|
})
|
|
572
572
|
|
|
573
573
|
Store.prototype.notifyTabOnData = function (tabId) {
|
|
574
|
-
const tab =
|
|
574
|
+
const tab = refsTabs.get('tab-' + tabId)
|
|
575
575
|
if (tab) {
|
|
576
576
|
tab.notifyOnData()
|
|
577
577
|
}
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
* theme related functions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { message } from 'antd'
|
|
6
|
-
import { isEqual } from 'lodash-es'
|
|
7
5
|
import {
|
|
8
|
-
|
|
9
|
-
settingMap,
|
|
10
|
-
defaultThemeLight
|
|
6
|
+
settingMap
|
|
11
7
|
} from '../common/constants'
|
|
12
|
-
import copy from 'json-deep-copy'
|
|
13
8
|
import { convertTheme } from '../common/terminal-theme'
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import {
|
|
10
|
+
defaultTheme,
|
|
11
|
+
defaultThemeLight
|
|
12
|
+
} from '../common/theme-defaults'
|
|
16
13
|
|
|
17
14
|
export default Store => {
|
|
18
15
|
Store.prototype.getTerminalThemes = function () {
|
|
19
|
-
|
|
16
|
+
const t1 = defaultTheme()
|
|
17
|
+
const t2 = defaultThemeLight()
|
|
18
|
+
return [
|
|
19
|
+
t1,
|
|
20
|
+
t2,
|
|
21
|
+
...window.store.getItems(settingMap.terminalThemes).filter(d => {
|
|
22
|
+
return d && d.id !== t1.id && d.id !== t2.id
|
|
23
|
+
})
|
|
24
|
+
]
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
Store.prototype.setTheme = function (id) {
|
|
@@ -47,14 +52,16 @@ export default Store => {
|
|
|
47
52
|
|
|
48
53
|
Store.prototype.fixThemes = function (themes) {
|
|
49
54
|
return themes.map(t => {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
55
|
+
const d1 = defaultTheme()
|
|
56
|
+
const d2 = defaultThemeLight()
|
|
57
|
+
const isDefaultTheme = t.id === d1.id
|
|
58
|
+
const isDefaultThemeLight = t.id === d2.id
|
|
52
59
|
if (isDefaultTheme) {
|
|
53
|
-
Object.assign(t,
|
|
60
|
+
Object.assign(t, d1)
|
|
54
61
|
} else if (isDefaultThemeLight) {
|
|
55
|
-
Object.assign(t,
|
|
62
|
+
Object.assign(t, d2)
|
|
56
63
|
} else if (!t.uiThemeConfig) {
|
|
57
|
-
t.uiThemeConfig =
|
|
64
|
+
t.uiThemeConfig = d1.uiThemeConfig
|
|
58
65
|
}
|
|
59
66
|
return t
|
|
60
67
|
})
|
|
@@ -78,33 +85,4 @@ export default Store => {
|
|
|
78
85
|
})
|
|
79
86
|
)
|
|
80
87
|
}
|
|
81
|
-
|
|
82
|
-
Store.prototype.checkDefaultTheme = async function (terminalThemes) {
|
|
83
|
-
const { store } = window
|
|
84
|
-
const themeId = defaultTheme.id
|
|
85
|
-
const currentDefaultTheme = store.terminalThemes.find(d => d.id === themeId)
|
|
86
|
-
if (
|
|
87
|
-
currentDefaultTheme &&
|
|
88
|
-
(
|
|
89
|
-
!isEqual(currentDefaultTheme.themeConfig, defaultTheme.themeConfig) || !isEqual(currentDefaultTheme.uiThemeConfig, defaultTheme.uiThemeConfig) ||
|
|
90
|
-
currentDefaultTheme.name !== defaultTheme.name
|
|
91
|
-
)
|
|
92
|
-
) {
|
|
93
|
-
store.editTheme(
|
|
94
|
-
themeId,
|
|
95
|
-
{
|
|
96
|
-
name: defaultTheme.name,
|
|
97
|
-
themeConfig: defaultTheme.themeConfig,
|
|
98
|
-
uiThemeConfig: defaultTheme.uiThemeConfig
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
message.info(
|
|
102
|
-
`${e('default')} ${e('themeConfig')} ${e('updated')}`
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
const hasLightTheme = store.getTerminalThemes().find(d => d.id === defaultThemeLight.id)
|
|
106
|
-
if (!hasLightTheme) {
|
|
107
|
-
store.addTheme(defaultThemeLight)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
88
|
}
|
package/client/store/ui-theme.js
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
defaultTheme,
|
|
7
6
|
settingMap
|
|
8
7
|
} from '../common/constants'
|
|
8
|
+
import {
|
|
9
|
+
defaultTheme
|
|
10
|
+
} from '../common/theme-defaults'
|
|
11
|
+
|
|
9
12
|
import copy from 'json-deep-copy'
|
|
10
13
|
|
|
11
14
|
export default Store => {
|
|
@@ -15,6 +18,6 @@ export default Store => {
|
|
|
15
18
|
.find(d => d.id === store.config.theme)
|
|
16
19
|
return theme && theme.uiThemeConfig
|
|
17
20
|
? copy(theme.uiThemeConfig)
|
|
18
|
-
: defaultTheme.uiThemeConfig
|
|
21
|
+
: defaultTheme().uiThemeConfig
|
|
19
22
|
}
|
|
20
23
|
}
|
package/package.json
CHANGED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* database default should init
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
function parsor (themeTxt) {
|
|
6
|
-
return themeTxt.split('\n').reduce((prev, line) => {
|
|
7
|
-
let [key = '', value = ''] = line.split('=')
|
|
8
|
-
key = key.trim()
|
|
9
|
-
value = value.trim()
|
|
10
|
-
if (!key || !value) {
|
|
11
|
-
return prev
|
|
12
|
-
}
|
|
13
|
-
prev[key] = value
|
|
14
|
-
return prev
|
|
15
|
-
}, {})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const defaultTheme = parsor(`
|
|
19
|
-
main = #141314
|
|
20
|
-
main-dark = #000
|
|
21
|
-
main-light = #2E3338
|
|
22
|
-
text = #ddd
|
|
23
|
-
text-light = #fff
|
|
24
|
-
text-dark = #888
|
|
25
|
-
text-disabled = #777
|
|
26
|
-
primary = #08c
|
|
27
|
-
info = #FFD166
|
|
28
|
-
success = #06D6A0
|
|
29
|
-
error = #EF476F
|
|
30
|
-
warn = #E55934
|
|
31
|
-
`)
|
|
32
|
-
const defaultThemeLight = parsor(`
|
|
33
|
-
main=#ededed
|
|
34
|
-
main-dark=#cccccc
|
|
35
|
-
main-light=#fefefe
|
|
36
|
-
text=#555
|
|
37
|
-
text-light=#777
|
|
38
|
-
text-dark=#444
|
|
39
|
-
text-disabled=#888
|
|
40
|
-
primary=#08c
|
|
41
|
-
info=#FFD166
|
|
42
|
-
success=#06D6A0
|
|
43
|
-
error=#EF476F
|
|
44
|
-
warn=#E55934
|
|
45
|
-
`)
|
|
46
|
-
const defaultThemeLightTerminal = parsor(`
|
|
47
|
-
foreground=#333333
|
|
48
|
-
background=#ededed
|
|
49
|
-
cursor=#b5bd68
|
|
50
|
-
cursorAccent=#1d1f21
|
|
51
|
-
selectionBackground=rgba(0, 0, 0, 0.3)
|
|
52
|
-
black=#575757
|
|
53
|
-
red=#FF2C6D
|
|
54
|
-
green=#19f9d8
|
|
55
|
-
yellow=#FFB86C
|
|
56
|
-
blue=#45A9F9
|
|
57
|
-
magenta=#FF75B5
|
|
58
|
-
cyan=#B084EB
|
|
59
|
-
white=#CDCDCD
|
|
60
|
-
brightBlack=#757575
|
|
61
|
-
brightRed=#FF2C6D
|
|
62
|
-
brightGreen=#19f9d8
|
|
63
|
-
brightYellow=#FFCC95
|
|
64
|
-
brightBlue=#6FC1FF
|
|
65
|
-
brightMagenta=#FF9AC1
|
|
66
|
-
brightCyan=#BCAAFE
|
|
67
|
-
brightWhite=#E6E6E6
|
|
68
|
-
`)
|
|
69
|
-
|
|
70
|
-
const defaultThemeTerminal = {
|
|
71
|
-
foreground: '#bbbbbb',
|
|
72
|
-
background: '#141314',
|
|
73
|
-
cursor: '#b5bd68',
|
|
74
|
-
cursorAccent: '#1d1f21',
|
|
75
|
-
selectionBackground: 'rgba(255, 255, 255, 0.3)',
|
|
76
|
-
black: '#575757',
|
|
77
|
-
red: '#FF2C6D',
|
|
78
|
-
green: '#19f9d8',
|
|
79
|
-
yellow: '#FFB86C',
|
|
80
|
-
blue: '#45A9F9',
|
|
81
|
-
magenta: '#FF75B5',
|
|
82
|
-
cyan: '#B084EB',
|
|
83
|
-
white: '#CDCDCD',
|
|
84
|
-
brightBlack: '#757575',
|
|
85
|
-
brightRed: '#FF2C6D',
|
|
86
|
-
brightGreen: '#19f9d8',
|
|
87
|
-
brightYellow: '#FFCC95',
|
|
88
|
-
brightBlue: '#6FC1FF',
|
|
89
|
-
brightMagenta: '#FF9AC1',
|
|
90
|
-
brightCyan: '#BCAAFE',
|
|
91
|
-
brightWhite: '#E6E6E6'
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export default [
|
|
95
|
-
{
|
|
96
|
-
db: 'terminalThemes',
|
|
97
|
-
data: [
|
|
98
|
-
{
|
|
99
|
-
_id: 'default',
|
|
100
|
-
name: 'default',
|
|
101
|
-
themeConfig: defaultThemeTerminal,
|
|
102
|
-
uiThemeConfig: defaultTheme
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
_id: 'defaultLight',
|
|
106
|
-
name: 'default light',
|
|
107
|
-
themeConfig: defaultThemeLightTerminal,
|
|
108
|
-
uiThemeConfig: defaultThemeLight
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
db: 'bookmarkGroups',
|
|
114
|
-
data: [
|
|
115
|
-
{
|
|
116
|
-
_id: 'default',
|
|
117
|
-
title: 'default',
|
|
118
|
-
bookmarkIds: [],
|
|
119
|
-
bookmarkGroupIds: []
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
]
|