@electerm/electerm-react 5.5.66 → 5.5.76

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 (33) hide show
  1. package/client/common/constants.js +12 -0
  2. package/client/common/default-setting.js +1 -0
  3. package/client/common/distribute-tabs.js +42 -0
  4. package/client/common/import-task.js +46 -3
  5. package/client/common/parse-quick-connect.js +1 -0
  6. package/client/common/quick-connect-string.js +134 -0
  7. package/client/common/ui-theme-color.mjs +136 -0
  8. package/client/common/update-check.js +14 -0
  9. package/client/components/ai/ai-output.jsx +5 -0
  10. package/client/components/ai/ai.styl +19 -0
  11. package/client/components/bookmark-form/copy-bookmark.jsx +83 -0
  12. package/client/components/bookmark-form/form-renderer.jsx +13 -1
  13. package/client/components/bookmark-form/index.jsx +20 -1
  14. package/client/components/bookmark-form/render-form.jsx +2 -2
  15. package/client/components/main/ui-theme.jsx +1 -20
  16. package/client/components/main/upgrade.jsx +2 -0
  17. package/client/components/setting-panel/install-command.jsx +151 -0
  18. package/client/components/setting-panel/setting-common.jsx +5 -0
  19. package/client/components/setting-panel/setting-terminal.jsx +9 -1
  20. package/client/components/terminal/mixins/term-attach.js +10 -2
  21. package/client/components/terminal/mixins/term-socket.js +12 -2
  22. package/client/components/terminal/mixins/term-suggestions.js +16 -3
  23. package/client/components/terminal/osc52-addon.js +7 -2
  24. package/client/components/terminal/session-status-overlay.jsx +44 -0
  25. package/client/components/terminal/ssh-reload-state.js +41 -2
  26. package/client/components/terminal/startup-queue.js +6 -2
  27. package/client/components/terminal/terminal.jsx +13 -2
  28. package/client/components/terminal/terminal.styl +14 -5
  29. package/client/store/sync.js +46 -18
  30. package/client/store/tab.js +45 -2
  31. package/client/store/watch.js +8 -0
  32. package/package.json +1 -1
  33. package/client/components/terminal/reconnect-overlay.jsx +0 -14
@@ -19,6 +19,7 @@ import newTerm, { updateCount } from '../common/new-terminal.js'
19
19
  import { action } from 'manate'
20
20
  import { shouldCaptureTerminalReloadState } from '../components/terminal/ssh-reload-state.js'
21
21
  import dangerousSessionFields from '../common/dangerous-session-fields'
22
+ import { distributeTabsEvenly } from '../common/distribute-tabs'
22
23
 
23
24
  function captureSshSessionState (tab, config) {
24
25
  return shouldCaptureTerminalReloadState(tab, config)
@@ -491,12 +492,45 @@ export default Store => {
491
492
  }
492
493
  ntb.batch = (currentLayoutBatch + 1) % maxBatch
493
494
  if (layout === 'c1') {
494
- store.setLayout('c2')
495
+ store.setLayout('c2', false)
495
496
  }
496
497
  store.addTab(ntb)
497
498
  }
498
499
 
499
- Store.prototype.setLayout = function (layout) {
500
+ // Spread tabs over the panes of a layout with more panes.
501
+ // Only used when leaving the single layout: once more than one pane is on
502
+ // screen the arrangement is the user's, and is left alone.
503
+ Store.prototype.distributeTabs = function (newCount) {
504
+ const { store } = window
505
+ const { tabs } = store
506
+ if (tabs.length < 2) {
507
+ return
508
+ }
509
+ // contiguous chunks keep the tab order: [A B C D E] -> [A B] [C D] [E]
510
+ const batches = distributeTabsEvenly(tabs.length, newCount)
511
+ tabs.forEach((t, i) => {
512
+ t.batch = batches[i]
513
+ })
514
+ }
515
+
516
+ // make sure every pane has a valid active tab
517
+ Store.prototype.fixActiveTabIds = function (count) {
518
+ const { store } = window
519
+ for (let b = 0; b < count; b++) {
520
+ const inBatch = store.tabs.filter(t => t.batch === b)
521
+ const key = `activeTabId${b}`
522
+ if (!inBatch.some(t => t.id === store[key])) {
523
+ store[key] = inBatch.length ? inBatch[0].id : ''
524
+ }
525
+ }
526
+ const active = store.tabs.find(t => t.id === store.activeTabId)
527
+ if (active) {
528
+ store[`activeTabId${active.batch}`] = active.id
529
+ store.currentLayoutBatch = active.batch
530
+ }
531
+ }
532
+
533
+ Store.prototype.setLayout = function (layout, redistribute = true) {
500
534
  const { store } = window
501
535
  const prevLayout = store.layout
502
536
  const { activeTabId } = store
@@ -533,6 +567,15 @@ export default Store => {
533
567
  if (store.currentLayoutBatch >= newBatchCount) {
534
568
  store.currentLayoutBatch = newBatchCount - 1
535
569
  }
570
+ } else if (
571
+ redistribute &&
572
+ store.config.autoDistributeTabsWhenLayoutChange &&
573
+ prevBatchCount === 1 &&
574
+ newBatchCount > 1
575
+ ) {
576
+ // leaving the single layout: hand the tabs out evenly
577
+ store.distributeTabs(newBatchCount)
578
+ store.fixActiveTabIds(newBatchCount)
536
579
  }
537
580
  store.focus()
538
581
  }
@@ -82,6 +82,14 @@ export default store => {
82
82
  }
83
83
  return store[name]
84
84
  }, schedule)
85
+ // Make the current store contents the watcher's baseline, so a later
86
+ // start() diffs against the store rather than a snapshot that no longer
87
+ // describes it. Needed after a rolled-back import: the store has just been
88
+ // restored to its pre-import state, and diffing that against the snapshot
89
+ // taken before the import would be read as "every record was removed".
90
+ window[`watch${name}`].reseed = () => {
91
+ refsStatic.add('oldState-' + name, deepCopy(store.getItems(name)) || [])
92
+ }
85
93
  window[`watch${name}`].start()
86
94
  }
87
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "5.5.66",
3
+ "version": "5.5.76",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",
@@ -1,14 +0,0 @@
1
- import { memo } from 'react'
2
-
3
- const e = window.translate
4
-
5
- export default memo(function ReconnectOverlay ({ countdown }) {
6
- if (countdown === null || countdown === undefined) {
7
- return null
8
- }
9
- return (
10
- <div className='terminal-reconnect-overlay'>
11
- {e('autoReconnectTerminal')}: {countdown}s
12
- </div>
13
- )
14
- })