@electerm/electerm-react 1.34.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 (273) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/client/common/auto-complete-data-mapper.js +6 -0
  4. package/client/common/byte-format.js +14 -0
  5. package/client/common/class.js +52 -0
  6. package/client/common/clipboard.js +49 -0
  7. package/client/common/constants.js +308 -0
  8. package/client/common/create-lang-edit-link.js +7 -0
  9. package/client/common/create-title.js +29 -0
  10. package/client/common/db-fix.js +24 -0
  11. package/client/common/db.js +155 -0
  12. package/client/common/download-mirrors.js +10 -0
  13. package/client/common/download.js +16 -0
  14. package/client/common/error-handler.jsx +27 -0
  15. package/client/common/fetch-from-server.js +47 -0
  16. package/client/common/fetch.jsx +71 -0
  17. package/client/common/find-bookmark-group-id.js +15 -0
  18. package/client/common/find-parent.js +30 -0
  19. package/client/common/form-layout.js +27 -0
  20. package/client/common/fs.js +21 -0
  21. package/client/common/get-proxy.js +8 -0
  22. package/client/common/id-with-stamp.js +10 -0
  23. package/client/common/index-sorter.js +4 -0
  24. package/client/common/init-setting-item.js +32 -0
  25. package/client/common/is-absolute-path.js +3 -0
  26. package/client/common/is-ip.js +16 -0
  27. package/client/common/is-valid-path.js +7 -0
  28. package/client/common/key-control-pressed.js +13 -0
  29. package/client/common/key-pressed.js +13 -0
  30. package/client/common/key-shift-pressed.js +7 -0
  31. package/client/common/mode2permission.js +81 -0
  32. package/client/common/new-terminal.js +31 -0
  33. package/client/common/parse-int10.js +3 -0
  34. package/client/common/parse-json-safe.js +11 -0
  35. package/client/common/pass-enc.js +25 -0
  36. package/client/common/post-msg.js +3 -0
  37. package/client/common/pre.js +156 -0
  38. package/client/common/promise-timeout.js +27 -0
  39. package/client/common/resolve.js +31 -0
  40. package/client/common/run-idle.js +1 -0
  41. package/client/common/safe-local-storage.js +35 -0
  42. package/client/common/safe-name.js +19 -0
  43. package/client/common/sftp.js +74 -0
  44. package/client/common/terminal-theme.js +158 -0
  45. package/client/common/test-connection.js +12 -0
  46. package/client/common/time.js +30 -0
  47. package/client/common/to-simple-obj.js +5 -0
  48. package/client/common/track.js +7 -0
  49. package/client/common/transfer.js +76 -0
  50. package/client/common/trzsz.js +62 -0
  51. package/client/common/ui-theme.js +44 -0
  52. package/client/common/uid.js +5 -0
  53. package/client/common/update-check.js +79 -0
  54. package/client/common/upgrade.js +68 -0
  55. package/client/common/wait.js +8 -0
  56. package/client/common/ws.js +161 -0
  57. package/client/components/batch-op/batch-op.jsx +650 -0
  58. package/client/components/bookmark-form/bookmark-form.styl +8 -0
  59. package/client/components/bookmark-form/bookmark-group-tree-format.js +39 -0
  60. package/client/components/bookmark-form/encodes.js +44 -0
  61. package/client/components/bookmark-form/form-ssh-common.jsx +208 -0
  62. package/client/components/bookmark-form/form-tabs.jsx +69 -0
  63. package/client/components/bookmark-form/index.jsx +159 -0
  64. package/client/components/bookmark-form/local-form-ui.jsx +152 -0
  65. package/client/components/bookmark-form/local-form.jsx +16 -0
  66. package/client/components/bookmark-form/proxy.jsx +49 -0
  67. package/client/components/bookmark-form/quick-command-list.jsx +31 -0
  68. package/client/components/bookmark-form/quick-command.jsx +228 -0
  69. package/client/components/bookmark-form/render-auth-ssh.jsx +104 -0
  70. package/client/components/bookmark-form/render-connection-hopping.jsx +229 -0
  71. package/client/components/bookmark-form/render-delayed-scripts.jsx +88 -0
  72. package/client/components/bookmark-form/render-ssh-tunnel.jsx +116 -0
  73. package/client/components/bookmark-form/serial-form-ui.jsx +311 -0
  74. package/client/components/bookmark-form/serial-form.jsx +20 -0
  75. package/client/components/bookmark-form/sftp-enable.jsx +33 -0
  76. package/client/components/bookmark-form/ssh-form-ui.jsx +100 -0
  77. package/client/components/bookmark-form/ssh-form.jsx +348 -0
  78. package/client/components/bookmark-form/telnet-form-ui.jsx +154 -0
  79. package/client/components/bookmark-form/telnet-form.jsx +16 -0
  80. package/client/components/bookmark-form/tree-delete.jsx +87 -0
  81. package/client/components/bookmark-form/use-form-funcs.jsx +50 -0
  82. package/client/components/bookmark-form/use-quick-commands.jsx +83 -0
  83. package/client/components/bookmark-form/use-submit.jsx +77 -0
  84. package/client/components/bookmark-form/use-ui.jsx +82 -0
  85. package/client/components/bookmark-form/x11.jsx +23 -0
  86. package/client/components/common/animate-text.jsx +37 -0
  87. package/client/components/common/animate-text.styl +54 -0
  88. package/client/components/common/external-link.jsx +28 -0
  89. package/client/components/common/help-icon.jsx +25 -0
  90. package/client/components/common/highlight.jsx +23 -0
  91. package/client/components/common/highlight.styl +3 -0
  92. package/client/components/common/input-auto-focus.jsx +68 -0
  93. package/client/components/common/input-confirm.jsx +66 -0
  94. package/client/components/common/logo-elem.jsx +22 -0
  95. package/client/components/common/markdown.jsx +27 -0
  96. package/client/components/common/react-subx.jsx +1 -0
  97. package/client/components/common/resize-wrap.jsx +222 -0
  98. package/client/components/common/resize-wrap.styl +9 -0
  99. package/client/components/common/search.jsx +9 -0
  100. package/client/components/common/show-item.jsx +27 -0
  101. package/client/components/context-menu/boomarks.jsx +15 -0
  102. package/client/components/context-menu/context-menu.jsx +340 -0
  103. package/client/components/context-menu/context-menu.styl +90 -0
  104. package/client/components/context-menu/history.jsx +27 -0
  105. package/client/components/context-menu/icon-holder.jsx +5 -0
  106. package/client/components/context-menu/menu-btn.jsx +224 -0
  107. package/client/components/context-menu/sub-tab-menu.jsx +23 -0
  108. package/client/components/context-menu/tabs.jsx +22 -0
  109. package/client/components/context-menu/zoom.jsx +40 -0
  110. package/client/components/footer/batch-input.jsx +177 -0
  111. package/client/components/footer/footer-entry.jsx +141 -0
  112. package/client/components/footer/footer.styl +47 -0
  113. package/client/components/icons/match-case.jsx +10 -0
  114. package/client/components/icons/match-whole-word.jsx +13 -0
  115. package/client/components/icons/regular-exp.jsx +10 -0
  116. package/client/components/main/css-overwrite.jsx +92 -0
  117. package/client/components/main/error-wrapper.jsx +59 -0
  118. package/client/components/main/index.jsx +11 -0
  119. package/client/components/main/loading.jsx +25 -0
  120. package/client/components/main/main.jsx +149 -0
  121. package/client/components/main/term-fullscreen-control.jsx +21 -0
  122. package/client/components/main/term-fullscreen.styl +27 -0
  123. package/client/components/main/ui-theme.jsx +31 -0
  124. package/client/components/main/upgrade.jsx +351 -0
  125. package/client/components/main/upgrade.styl +27 -0
  126. package/client/components/main/wrapper.styl +41 -0
  127. package/client/components/quick-commands/qm.styl +29 -0
  128. package/client/components/quick-commands/quick-command-item.jsx +36 -0
  129. package/client/components/quick-commands/quick-command-transport-mod.jsx +54 -0
  130. package/client/components/quick-commands/quick-command-transport.jsx +12 -0
  131. package/client/components/quick-commands/quick-commands-box.jsx +233 -0
  132. package/client/components/quick-commands/quick-commands-form-elem.jsx +119 -0
  133. package/client/components/quick-commands/quick-commands-form.jsx +33 -0
  134. package/client/components/quick-commands/quick-commands-list.jsx +128 -0
  135. package/client/components/quick-commands/quick-commands-select.jsx +38 -0
  136. package/client/components/session/session.jsx +533 -0
  137. package/client/components/session/session.styl +53 -0
  138. package/client/components/session/sessions.jsx +445 -0
  139. package/client/components/setting-panel/bookmark-transport.jsx +148 -0
  140. package/client/components/setting-panel/bookmark-tree-list.jsx +14 -0
  141. package/client/components/setting-panel/col.jsx +18 -0
  142. package/client/components/setting-panel/list.jsx +186 -0
  143. package/client/components/setting-panel/list.styl +33 -0
  144. package/client/components/setting-panel/on-tree-drop.js +222 -0
  145. package/client/components/setting-panel/setting-modal.jsx +163 -0
  146. package/client/components/setting-panel/setting-wrap.jsx +37 -0
  147. package/client/components/setting-panel/setting-wrap.styl +52 -0
  148. package/client/components/setting-panel/setting.jsx +858 -0
  149. package/client/components/setting-panel/setting.styl +4 -0
  150. package/client/components/setting-panel/start-session-select.jsx +91 -0
  151. package/client/components/setting-panel/tab-bookmarks.jsx +37 -0
  152. package/client/components/setting-panel/tab-history.jsx +44 -0
  153. package/client/components/setting-panel/tab-quick-commands.jsx +38 -0
  154. package/client/components/setting-panel/tab-settings.jsx +42 -0
  155. package/client/components/setting-panel/tab-themes.jsx +34 -0
  156. package/client/components/setting-panel/tree-list.jsx +978 -0
  157. package/client/components/setting-panel/tree-list.styl +57 -0
  158. package/client/components/setting-sync/data-import.jsx +65 -0
  159. package/client/components/setting-sync/setting-sync-form.jsx +271 -0
  160. package/client/components/setting-sync/setting-sync.jsx +81 -0
  161. package/client/components/setting-sync/sync.styl +7 -0
  162. package/client/components/sftp/address-bar.jsx +139 -0
  163. package/client/components/sftp/address-bookmark-item.jsx +47 -0
  164. package/client/components/sftp/address-bookmark.jsx +81 -0
  165. package/client/components/sftp/address-bookmark.styl +8 -0
  166. package/client/components/sftp/confirm-modal.jsx +184 -0
  167. package/client/components/sftp/file-icon.jsx +22 -0
  168. package/client/components/sftp/file-item.jsx +1226 -0
  169. package/client/components/sftp/file-mode-modal.jsx +205 -0
  170. package/client/components/sftp/file-props-modal.jsx +211 -0
  171. package/client/components/sftp/file-read.js +81 -0
  172. package/client/components/sftp/list-table-ui.jsx +547 -0
  173. package/client/components/sftp/owner-list.js +97 -0
  174. package/client/components/sftp/paged-list.jsx +60 -0
  175. package/client/components/sftp/permission-render.jsx +42 -0
  176. package/client/components/sftp/sftp-entry.jsx +1069 -0
  177. package/client/components/sftp/sftp.styl +217 -0
  178. package/client/components/sftp/transfer-common.js +9 -0
  179. package/client/components/sftp/transfer-conflict.jsx +315 -0
  180. package/client/components/sftp/transfer-speed-format.js +60 -0
  181. package/client/components/sftp/transfer-tag.jsx +40 -0
  182. package/client/components/sftp/transfer-tag.styl +11 -0
  183. package/client/components/sftp/transfer.styl +55 -0
  184. package/client/components/sftp/transport-action.jsx +410 -0
  185. package/client/components/sftp/transport-entry.jsx +108 -0
  186. package/client/components/sftp/transport-types.js +8 -0
  187. package/client/components/sftp/transports-action.jsx +111 -0
  188. package/client/components/sftp/transports-ui.jsx +93 -0
  189. package/client/components/sftp/zip.js +42 -0
  190. package/client/components/sidebar/bookmark-select.jsx +48 -0
  191. package/client/components/sidebar/bookmark.jsx +82 -0
  192. package/client/components/sidebar/history.jsx +66 -0
  193. package/client/components/sidebar/index.jsx +230 -0
  194. package/client/components/sidebar/info-modal.jsx +250 -0
  195. package/client/components/sidebar/info.styl +27 -0
  196. package/client/components/sidebar/side-icon.jsx +25 -0
  197. package/client/components/sidebar/sidebar.styl +128 -0
  198. package/client/components/sidebar/transfer-history-modal.jsx +110 -0
  199. package/client/components/sidebar/transfer-history.styl +3 -0
  200. package/client/components/sidebar/transfer-list-control.jsx +205 -0
  201. package/client/components/sidebar/transfer-list.jsx +55 -0
  202. package/client/components/sidebar/transfer-modal.jsx +76 -0
  203. package/client/components/sidebar/transfer.styl +8 -0
  204. package/client/components/sidebar/transport-ui.jsx +109 -0
  205. package/client/components/tabs/index.jsx +320 -0
  206. package/client/components/tabs/tab.jsx +427 -0
  207. package/client/components/tabs/tabs.styl +220 -0
  208. package/client/components/tabs/window-control.jsx +55 -0
  209. package/client/components/terminal/attach-addon-custom.js +70 -0
  210. package/client/components/terminal/build-ls-term-id.js +5 -0
  211. package/client/components/terminal/index.jsx +1358 -0
  212. package/client/components/terminal/normal-buffer.jsx +33 -0
  213. package/client/components/terminal/term-search.jsx +224 -0
  214. package/client/components/terminal/term-search.styl +15 -0
  215. package/client/components/terminal/terminal-apis.js +31 -0
  216. package/client/components/terminal/terminal-interactive.jsx +148 -0
  217. package/client/components/terminal/terminal.styl +96 -0
  218. package/client/components/terminal/xterm-zmodem.js +48 -0
  219. package/client/components/terminal/zmodem-transfer.jsx +98 -0
  220. package/client/components/terminal/zmodem.styl +14 -0
  221. package/client/components/terminal-info/activity.jsx +54 -0
  222. package/client/components/terminal-info/base.jsx +25 -0
  223. package/client/components/terminal-info/content.jsx +101 -0
  224. package/client/components/terminal-info/data-cols-parser.jsx +50 -0
  225. package/client/components/terminal-info/disk.jsx +29 -0
  226. package/client/components/terminal-info/index.jsx +25 -0
  227. package/client/components/terminal-info/network.jsx +114 -0
  228. package/client/components/terminal-info/resource.jsx +80 -0
  229. package/client/components/terminal-info/run-cmd.jsx +273 -0
  230. package/client/components/terminal-info/terminal-info.styl +29 -0
  231. package/client/components/terminal-info/up.jsx +15 -0
  232. package/client/components/terminal-theme/index.jsx +264 -0
  233. package/client/components/terminal-theme/terminal-theme-list.styl +3 -0
  234. package/client/components/terminal-theme/theme-list.jsx +146 -0
  235. package/client/components/text-editor/text-editor-form.jsx +97 -0
  236. package/client/components/text-editor/text-editor.jsx +182 -0
  237. package/client/css/antd-overwrite.styl +14 -0
  238. package/client/css/basic.styl +38 -0
  239. package/client/css/includes/box.styl +154 -0
  240. package/client/css/includes/font-size.styl +6 -0
  241. package/client/css/includes/index.styl +3 -0
  242. package/client/css/includes/text.styl +31 -0
  243. package/client/css/includes/theme-default.styl +20 -0
  244. package/client/entry/basic.js +58 -0
  245. package/client/entry/index.jsx +15 -0
  246. package/client/entry/worker.js +137 -0
  247. package/client/store/address-bookmark.js +25 -0
  248. package/client/store/app-upgrade.js +23 -0
  249. package/client/store/batch-input-history.js +26 -0
  250. package/client/store/bookmark-group.js +128 -0
  251. package/client/store/bookmark.js +22 -0
  252. package/client/store/common.js +140 -0
  253. package/client/store/context-menu.js +23 -0
  254. package/client/store/db-upgrade.js +43 -0
  255. package/client/store/event.js +70 -0
  256. package/client/store/index.js +335 -0
  257. package/client/store/init-state.js +191 -0
  258. package/client/store/item.js +120 -0
  259. package/client/store/load-data.js +198 -0
  260. package/client/store/quick-command.js +43 -0
  261. package/client/store/session.js +54 -0
  262. package/client/store/setting.js +208 -0
  263. package/client/store/sidebar.js +48 -0
  264. package/client/store/sync.js +390 -0
  265. package/client/store/system-menu.js +120 -0
  266. package/client/store/tab.js +74 -0
  267. package/client/store/terminal-theme.js +116 -0
  268. package/client/store/transfer-history.js +27 -0
  269. package/client/store/transfer-list.js +20 -0
  270. package/client/store/ui-theme.js +71 -0
  271. package/client/store/watch.js +116 -0
  272. package/client/views/index.pug +58 -0
  273. package/package.json +34 -0
@@ -0,0 +1,10 @@
1
+ import Icon from '@ant-design/icons'
2
+
3
+ // from https://icon-sets.iconify.design/codicon/case-sensitive/
4
+ const matchCaseSvg = () => (
5
+ <svg width='1em' height='1em' viewBox='0 0 16 16'>
6
+ <path fill='currentColor' d='M8.854 11.702h-1l-.816-2.159H3.772l-.768 2.16H2L4.954 4h.935l2.965 7.702Zm-2.111-2.97L5.534 5.45a3.142 3.142 0 0 1-.118-.515h-.021c-.036.218-.077.39-.124.515L4.073 8.732h2.67Zm7.013 2.97h-.88v-.86h-.022c-.383.66-.947.99-1.692.99c-.548 0-.978-.146-1.29-.436c-.307-.29-.461-.675-.461-1.155c0-1.027.605-1.625 1.815-1.794l1.65-.23c0-.935-.379-1.403-1.134-1.403c-.663 0-1.26.226-1.794.677V6.59c.54-.344 1.164-.516 1.87-.516c1.292 0 1.938.684 1.938 2.052v3.577Zm-.88-2.782l-1.327.183c-.409.057-.717.159-.924.306c-.208.143-.312.399-.312.768c0 .268.095.489.285.66c.193.169.45.253.768.253a1.41 1.41 0 0 0 1.08-.457c.286-.308.43-.696.43-1.165V8.92Z' />
7
+ </svg>
8
+ )
9
+
10
+ export const MatchCaseIcon = props => (<Icon component={matchCaseSvg} {...props} />)
@@ -0,0 +1,13 @@
1
+ import Icon from '@ant-design/icons'
2
+
3
+ // from https://icon-sets.iconify.design/codicon/whole-word/
4
+ const matchWholeWordSvg = () => (
5
+ <svg width='1em' height='1em' viewBox='0 0 16 16'>
6
+ <g fill='currentColor'>
7
+ <path fillRule='evenodd' d='M0 11h1v2h14v-2h1v3H0v-3Z' clipRule='evenodd' />
8
+ <path d='M6.84 11h-.88v-.86h-.022c-.383.66-.947.989-1.692.989c-.548 0-.977-.145-1.289-.435c-.308-.29-.462-.675-.462-1.155c0-1.028.605-1.626 1.816-1.794l1.649-.23c0-.935-.378-1.403-1.134-1.403c-.662 0-1.26.226-1.794.677v-.902c.541-.344 1.164-.516 1.87-.516c1.292 0 1.938.684 1.938 2.052V11Zm-.88-2.782L4.633 8.4c-.408.058-.716.16-.924.307c-.208.143-.311.399-.311.768c0 .268.095.488.284.66c.194.168.45.253.768.253a1.41 1.41 0 0 0 1.08-.457c.286-.308.43-.696.43-1.165v-.548Zm3.388 1.987h-.022V11h-.88V2.857h.88v3.61h.021c.434-.73 1.068-1.096 1.902-1.096c.705 0 1.257.247 1.654.741c.401.49.602 1.15.602 1.977c0 .92-.224 1.658-.672 2.213c-.447.551-1.06.827-1.837.827c-.726 0-1.276-.308-1.649-.924Zm-.022-2.218v.768c0 .455.147.841.44 1.16c.298.315.674.473 1.128.473c.534 0 .951-.204 1.252-.613c.304-.408.456-.975.456-1.702c0-.613-.141-1.092-.424-1.44c-.283-.347-.666-.52-1.15-.52c-.511 0-.923.178-1.235.536c-.311.355-.467.8-.467 1.338Z' />
9
+ </g>
10
+ </svg>
11
+ )
12
+
13
+ export const MatchWholWordIcon = props => <Icon component={matchWholeWordSvg} {...props} />
@@ -0,0 +1,10 @@
1
+ import Icon from '@ant-design/icons'
2
+
3
+ // from https://icon-sets.iconify.design/codicon/regex/
4
+ const regExpSvg = () => (
5
+ <svg width='1em' height='1em' viewBox='0 0 16 16'>
6
+ <path fill='currentColor' fillRule='evenodd' d='M10.012 2h.976v3.113l2.56-1.557l.486.885L11.47 6l2.564 1.559l-.485.885l-2.561-1.557V10h-.976V6.887l-2.56 1.557l-.486-.885L9.53 6L6.966 4.441l.485-.885l2.561 1.557V2zM2 10h4v4H2v-4z' clipRule='evenodd' />
7
+ </svg>
8
+ )
9
+
10
+ export const RegularExpIcon = props => (<Icon component={regExpSvg} {...props} />)
@@ -0,0 +1,92 @@
1
+ /**
2
+ * btns
3
+ */
4
+
5
+ import { PureComponent } from 'react'
6
+ import fs from '../../common/fs'
7
+ import { noTerminalBgValue } from '../../common/constants'
8
+
9
+ export default class CssOverwrite extends PureComponent {
10
+ // componentDidMount () {
11
+ // setTimeout(this.writeCss, 3000)
12
+ // }
13
+
14
+ componentDidUpdate (prevProps) {
15
+ Object.keys(this.props).some(key => {
16
+ if (key.startsWith('terminalBackground') && prevProps[key] !== this.props[key]) {
17
+ this.updateCss()
18
+ return true
19
+ }
20
+ return false
21
+ })
22
+ if (!prevProps.wsInited && this.props.wsInited) {
23
+ this.writeCss()
24
+ }
25
+ }
26
+
27
+ createStyle = async () => {
28
+ const { terminalBackgroundImagePath } = this.props
29
+ let content = ''
30
+ let st = ''
31
+ const isWebImg = /^https?:\/\//.test(terminalBackgroundImagePath)
32
+ if (noTerminalBgValue === terminalBackgroundImagePath) {
33
+ st = 'none'
34
+ } else if (terminalBackgroundImagePath && !isWebImg) {
35
+ content = await fs.readFileAsBase64(terminalBackgroundImagePath)
36
+ .catch(log.error)
37
+ if (content) {
38
+ st = `url(data:image;base64,${content}) !important`
39
+ }
40
+ } else if (terminalBackgroundImagePath && isWebImg) {
41
+ st = `url(${terminalBackgroundImagePath}) !important`
42
+ }
43
+ if (!st) {
44
+ return `#container .session-current .xterm-viewport {
45
+ background-image: url("./images/electerm-watermark.png");
46
+ }`
47
+ }
48
+
49
+ const styles = [
50
+ `background-image: ${st}`,
51
+ 'background-size: cover',
52
+ 'background-position: center'
53
+ ]
54
+
55
+ if (st !== 'none') {
56
+ styles.push(`filter: blur(${
57
+ this.props.terminalBackgroundFilterBlur
58
+ }px) opacity(${
59
+ +this.props.terminalBackgroundFilterOpacity
60
+ }) brightness(${
61
+ +this.props.terminalBackgroundFilterBrightness
62
+ }) contrast(${
63
+ +this.props.terminalBackgroundFilterContrast
64
+ }) grayscale(${
65
+ +this.props.terminalBackgroundFilterGrayscale
66
+ })`)
67
+ }
68
+
69
+ return `#container .session-current .xterm-viewport {
70
+ ${styles.join(';')}
71
+ }`
72
+ }
73
+
74
+ writeCss = async () => {
75
+ const style = document.createElement('style')
76
+ style.type = 'text/css'
77
+ style.innerHTML = await this.createStyle()
78
+ style.id = 'css-overwrite'
79
+ document.getElementsByTagName('head')[0].appendChild(style)
80
+ }
81
+
82
+ updateCss = async () => {
83
+ const style = document.getElementById('css-overwrite')
84
+ if (style) {
85
+ style.innerHTML = await this.createStyle()
86
+ }
87
+ }
88
+
89
+ render () {
90
+ return null
91
+ }
92
+ }
@@ -0,0 +1,59 @@
1
+ import React from 'react'
2
+ import { FrownOutlined, ReloadOutlined } from '@ant-design/icons'
3
+ import { Button } from 'antd'
4
+ import {
5
+ logoPath1
6
+ } from '../../common/constants'
7
+
8
+ const { prefix } = window
9
+ const e = prefix('main')
10
+ const m = prefix('menu')
11
+
12
+ export default class ErrorBoundary extends React.PureComponent {
13
+ constructor (props) {
14
+ super(props)
15
+ this.state = {
16
+ hasError: false,
17
+ error: {}
18
+ }
19
+ }
20
+
21
+ componentDidCatch (error) {
22
+ log.error(error)
23
+ this.setState({
24
+ hasError: true,
25
+ error
26
+ })
27
+ }
28
+
29
+ handleReload = () => {
30
+ window.location.reload()
31
+ }
32
+
33
+ render () {
34
+ if (this.state.hasError) {
35
+ const { stack, message } = this.state.error
36
+ return (
37
+ <div className='pd3 aligncenter error-wrapper'>
38
+ <div className='pd2y aligncenter'>
39
+ <img src={logoPath1} className='iblock mwm-100' />
40
+ </div>
41
+ <h1>
42
+ <FrownOutlined className='mg1r iblock' />
43
+ <span className='iblock mg1r'>{e('error')}</span>
44
+ <Button
45
+ onClick={this.handleReload}
46
+ className='iblock'
47
+ icon={<ReloadOutlined />}
48
+ >
49
+ {m('reload')}
50
+ </Button>
51
+ </h1>
52
+ <div className='pd1y'>{message}</div>
53
+ <div className='pd1y'>{stack}</div>
54
+ </div>
55
+ )
56
+ }
57
+ return this.props.children
58
+ }
59
+ }
@@ -0,0 +1,11 @@
1
+ import ErrorBoundary from './error-wrapper'
2
+ import Main from './main'
3
+ import store from '../../store'
4
+
5
+ export default function MainEntry () {
6
+ return (
7
+ <ErrorBoundary>
8
+ <Main store={store} />
9
+ </ErrorBoundary>
10
+ )
11
+ }
@@ -0,0 +1,25 @@
1
+ import LogoElem from '../common/logo-elem'
2
+ import { PureComponent } from 'react'
3
+
4
+ export class LoadingUI extends PureComponent {
5
+ state = {
6
+ show: true
7
+ }
8
+
9
+ hide = () => {
10
+ this.setState({
11
+ show: false
12
+ })
13
+ }
14
+
15
+ render () {
16
+ if (!this.state.show) {
17
+ return null
18
+ }
19
+ return (
20
+ <div className='loading-data'>
21
+ <LogoElem />
22
+ </div>
23
+ )
24
+ }
25
+ }
@@ -0,0 +1,149 @@
1
+ import { Component } from '../common/react-subx'
2
+ import Sessions from '../session/sessions'
3
+ import ContextMenu from '../context-menu/context-menu'
4
+ import FileInfoModal from '../sftp/file-props-modal'
5
+ import FileModeModal from '../sftp/file-mode-modal'
6
+ import UpdateCheck from './upgrade'
7
+ import SettingModal from '../setting-panel/setting-modal'
8
+ import TextEditor from '../text-editor/text-editor'
9
+ import Sidebar from '../sidebar'
10
+ import BatchOp from '../batch-op/batch-op'
11
+ import CssOverwrite from './css-overwrite'
12
+ import UiTheme from './ui-theme'
13
+ import TerminalInteractive from '../terminal/terminal-interactive'
14
+ import classnames from 'classnames'
15
+ import { isMac, isWin } from '../../common/constants'
16
+ import TermFullscreenControl from './term-fullscreen-control'
17
+ import { LoadingUI } from './loading'
18
+ import { ConfigProvider, notification } from 'antd'
19
+ import './wrapper.styl'
20
+
21
+ export default class Index extends Component {
22
+ componentDidMount () {
23
+ notification.config({
24
+ placement: 'bottomRight'
25
+ })
26
+ const { store } = this.props
27
+ window.addEventListener('resize', store.onResize)
28
+ store.onResize()
29
+ store.initStoreEvents()
30
+ const { ipcOnEvent } = window.pre
31
+ ipcOnEvent('checkupdate', store.onCheckUpdate)
32
+ ipcOnEvent('open-about', store.openAbout)
33
+ ipcOnEvent('new-ssh', store.onNewSsh)
34
+ ipcOnEvent('add-tab-from-command-line', store.addTabFromCommandLine)
35
+ ipcOnEvent('openSettings', store.openSetting)
36
+ ipcOnEvent('selectall', store.selectall)
37
+ ipcOnEvent('focused', store.focus)
38
+ ipcOnEvent('blur', store.onBlur)
39
+ ipcOnEvent('zoom-reset', store.onZoomReset)
40
+ ipcOnEvent('zoomin', store.onZoomIn)
41
+ ipcOnEvent('zoomout', store.onZoomout)
42
+
43
+ document.addEventListener('drop', function (e) {
44
+ e.preventDefault()
45
+ e.stopPropagation()
46
+ })
47
+ document.addEventListener('dragover', function (e) {
48
+ e.preventDefault()
49
+ e.stopPropagation()
50
+ })
51
+ window.addEventListener('offline', store.setOffline)
52
+ window.addEventListener('mousewheel', store.onMouseWheel)
53
+ window.addEventListener('keydown', store.onKeyDown)
54
+ store.isSencondInstance = window.pre.runSync('isSencondInstance')
55
+ store.initData()
56
+ store.checkForDbUpgrade()
57
+ }
58
+
59
+ render () {
60
+ const { store } = this.props
61
+ const {
62
+ configLoaded,
63
+ config,
64
+ terminalFullScreen,
65
+ pinned,
66
+ isSencondInstance,
67
+ pinnedQuickCommandBar,
68
+ wsInited,
69
+ upgradeInfo,
70
+ installSrc,
71
+ uiThemeConfig
72
+ } = store
73
+ const cls = classnames({
74
+ loaded: configLoaded,
75
+ 'system-ui': store.config.useSystemTitleBar,
76
+ 'is-mac': isMac,
77
+ 'is-win': isWin,
78
+ pinned,
79
+ 'qm-pinned': pinnedQuickCommandBar,
80
+ 'term-fullscreen': terminalFullScreen,
81
+ 'is-main': !isSencondInstance
82
+ })
83
+ const ext1 = {
84
+ className: cls
85
+ }
86
+ const cpConf = config
87
+ const confsCss = Object
88
+ .keys((cpConf))
89
+ .filter(d => d.startsWith('terminalBackground'))
90
+ .reduce((p, k) => {
91
+ return {
92
+ ...p,
93
+ [k]: cpConf[k]
94
+ }
95
+ }, {})
96
+ const themeProps = {
97
+ themeConfig: store.getUiThemeConfig()
98
+ }
99
+ const outerProps = {
100
+ style: {
101
+ opacity: config.opacity
102
+ }
103
+ }
104
+ return (
105
+ <ConfigProvider
106
+ theme={uiThemeConfig}
107
+ >
108
+ <div {...ext1}>
109
+ <LoadingUI
110
+ wsInited={wsInited}
111
+ />
112
+ <TermFullscreenControl
113
+ terminalFullScreen={terminalFullScreen}
114
+ />
115
+ <CssOverwrite
116
+ {...confsCss}
117
+ wsInited={wsInited}
118
+ />
119
+ <TerminalInteractive />
120
+ <UiTheme
121
+ {...themeProps}
122
+ buildTheme={store.buildTheme}
123
+ />
124
+ <TextEditor />
125
+ <UpdateCheck
126
+ skipVersion={cpConf.skipVersion}
127
+ upgradeInfo={upgradeInfo}
128
+ installSrc={installSrc}
129
+ />
130
+ <FileInfoModal />
131
+ <FileModeModal />
132
+ <SettingModal store={store} />
133
+ <BatchOp store={store} />
134
+ <div
135
+ id='outside-context'
136
+ {...outerProps}
137
+ >
138
+ <Sidebar store={store} />
139
+ <Sessions
140
+ store={store}
141
+ config={cpConf}
142
+ />
143
+ </div>
144
+ <ContextMenu store={store} />
145
+ </div>
146
+ </ConfigProvider>
147
+ )
148
+ }
149
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * btns
3
+ */
4
+
5
+ import { FullscreenExitOutlined } from '@ant-design/icons'
6
+ import './term-fullscreen.styl'
7
+
8
+ export default function TermFullscreenControl (props) {
9
+ const handleExitFullscreen = () => {
10
+ window.store.toggleTermFullscreen(false)
11
+ }
12
+ if (!props.terminalFullScreen) {
13
+ return null
14
+ }
15
+ return (
16
+ <FullscreenExitOutlined
17
+ className='mg1r icon-info font16 pointer spliter term-fullscreen-control'
18
+ onClick={handleExitFullscreen}
19
+ />
20
+ )
21
+ }
@@ -0,0 +1,27 @@
1
+ .term-fullscreen
2
+ .sidebar
3
+ .tabs
4
+ .terminal-footer
5
+ .terminal-control
6
+ .qm-wrap-tooltip
7
+ .main-footer
8
+ display none
9
+ .term-fullscreen-control
10
+ display block
11
+ right 10px
12
+ top 10px
13
+ position fixed
14
+ z-index 100
15
+ .term-wrap
16
+ position fixed
17
+ left 0 !important
18
+ top 0 !important
19
+ height 100% !important
20
+ width 100% !important
21
+ .term-wrap-1
22
+ left 10px !important
23
+ top 10px !important
24
+ right 10px !important
25
+ bottom 10px !important
26
+ .term-fullscreen-control
27
+ display none
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ui theme
3
+ */
4
+
5
+ import { useEffect } from 'react'
6
+ import { useDelta, useConditionalEffect } from 'react-delta'
7
+ import eq from 'fast-deep-equal'
8
+
9
+ const themeDomId = 'theme-css'
10
+
11
+ export default function UiTheme (props) {
12
+ const { themeConfig, buildTheme } = props
13
+
14
+ const delta = useDelta(themeConfig)
15
+
16
+ async function applyTheme () {
17
+ const stylus = document.getElementById(themeDomId)
18
+ const {
19
+ stylusCss
20
+ } = await buildTheme(themeConfig)
21
+ stylus.innerHTML = stylusCss
22
+ }
23
+
24
+ useEffect(() => {
25
+ applyTheme()
26
+ }, [])
27
+ useConditionalEffect(() => {
28
+ applyTheme()
29
+ }, delta && delta.prev && !eq(delta.prev, delta.curr))
30
+ return null
31
+ }