claude-opencode-viewer 2.6.46 → 2.6.47

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 (3) hide show
  1. package/index-pc.html +32 -3
  2. package/index.html +19 -34
  3. package/package.json +1 -1
package/index-pc.html CHANGED
@@ -390,8 +390,26 @@
390
390
  content: '';
391
391
  animation: loading-dots 1.2s steps(4, end) infinite;
392
392
  }
393
- #terminal.transitioning #switch-overlay { display: flex;
393
+ #terminal.transitioning #switch-overlay { display: flex; }
394
+ #init-overlay {
395
+ display: none;
396
+ position: absolute;
397
+ top: 0; left: 0; right: 0; bottom: 0;
398
+ background: #0a0a0a;
399
+ color: #ccc;
400
+ align-items: center;
401
+ justify-content: center;
402
+ font-size: 18px;
403
+ font-weight: 600;
404
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;
405
+ letter-spacing: 1px;
406
+ z-index: 10;
407
+ }
408
+ #init-overlay::after {
409
+ content: '';
410
+ animation: loading-dots 1.2s steps(4, end) infinite;
394
411
  }
412
+ #init-overlay.visible { display: flex; }
395
413
 
396
414
 
397
415
  /* 选择模式:原位文本层 */
@@ -1019,6 +1037,7 @@
1019
1037
  <div id="terminal-container">
1020
1038
  <div id="terminal" style="position:relative;">
1021
1039
  <div id="switch-overlay">正在切换</div>
1040
+ <div id="init-overlay"></div>
1022
1041
  <div id="select-text-layer">
1023
1042
  <div id="select-hint">长按选择文本 · 点右上角 ✕ 返回终端</div>
1024
1043
  <pre id="select-text-pre"></pre>
@@ -1054,7 +1073,7 @@
1054
1073
  selectionBackground: '#264f78',
1055
1074
  },
1056
1075
  allowProposedApi: true,
1057
- scrollback: isIOS ? 200 : isMobile ? 1000 : 3000,
1076
+ scrollback: isIOS ? 2000 : isMobile ? 5000 : 50000,
1058
1077
  smoothScrollDuration: 0,
1059
1078
  scrollOnUserInput: true,
1060
1079
  });
@@ -1592,12 +1611,18 @@
1592
1611
  modeSelect.value = mode;
1593
1612
  document.getElementById('mode-label').textContent = '';
1594
1613
  var label = mode === 'claude' ? 'Claude' : 'OpenCode';
1595
- term.write('\r\n 正在启动 ' + label + (sessionId ? '(恢复会话)' : '') + '...\r\n');
1614
+ var initOv = document.getElementById('init-overlay');
1615
+ initOv.textContent = '正在启动 ' + label + (sessionId ? '(恢复会话)' : '');
1616
+ initOv.classList.add('visible');
1596
1617
  var msg = { type: 'init', mode: mode };
1597
1618
  if (sessionId) msg.sessionId = sessionId;
1598
1619
  ws.send(JSON.stringify(msg));
1599
1620
  }
1600
1621
 
1622
+ function hideInitOverlay() {
1623
+ document.getElementById('init-overlay').classList.remove('visible');
1624
+ }
1625
+
1601
1626
  function getTimeAgo(ts) {
1602
1627
  var diff = Date.now() - ts;
1603
1628
  var min = Math.floor(diff / 60000);
@@ -1673,6 +1698,7 @@
1673
1698
  }
1674
1699
  }
1675
1700
  else if (msg.type === 'restored') {
1701
+ hideInitOverlay();
1676
1702
  if (writeTimer) { cancelAnimationFrame(writeTimer); writeTimer = null; }
1677
1703
  writeBuffer = '';
1678
1704
  term.reset();
@@ -1681,13 +1707,16 @@
1681
1707
  }
1682
1708
  }
1683
1709
  else if (msg.type === 'restore-error') {
1710
+ hideInitOverlay();
1684
1711
  term.write('恢复失败: ' + msg.error + '\r\n');
1685
1712
  }
1686
1713
  else if (msg.type === 'started') {
1714
+ hideInitOverlay();
1687
1715
  rebindTouchScroll();
1688
1716
  preloadData();
1689
1717
  }
1690
1718
  else if (msg.type === 'new-session-ok') {
1719
+ hideInitOverlay();
1691
1720
  if (writeTimer) { cancelAnimationFrame(writeTimer); writeTimer = null; }
1692
1721
  writeBuffer = '';
1693
1722
  term.reset();
package/index.html CHANGED
@@ -38,7 +38,6 @@
38
38
  /* 隐藏 xterm textarea 的闪烁光标 (cc-viewer TerminalPanel.module.css) */
39
39
  .xterm-helper-textarea { caret-color: transparent !important; }
40
40
 
41
- /* 参考 cc-viewer 的 App.jsx 行 1319: 移动端容器使用 100vw/100vh */
42
41
  #layout {
43
42
  position: fixed;
44
43
  top: 0;
@@ -57,8 +56,7 @@
57
56
  background: #111;
58
57
  border-bottom: 1px solid #222;
59
58
  display: flex;
60
- align-items: flex-start;
61
- padding-top: 40px;
59
+ align-items: center;
62
60
  justify-content: space-between;
63
61
  flex-shrink: 0;
64
62
  height: 40px;
@@ -94,8 +92,7 @@
94
92
 
95
93
  #session-history-header {
96
94
  display: flex;
97
- align-items: flex-start;
98
- padding-top: 40px;
95
+ align-items: center;
99
96
  justify-content: space-between;
100
97
  padding: 12px 16px;
101
98
  background: #111;
@@ -129,8 +126,7 @@
129
126
 
130
127
  .session-item {
131
128
  display: flex;
132
- align-items: flex-start;
133
- padding-top: 40px;
129
+ align-items: center;
134
130
  gap: 8px;
135
131
  padding: 8px 12px;
136
132
  background: #1a1a1a;
@@ -214,8 +210,7 @@
214
210
  cursor: pointer;
215
211
  border-radius: 4px;
216
212
  display: flex;
217
- align-items: flex-start;
218
- padding-top: 40px;
213
+ align-items: center;
219
214
  gap: 3px;
220
215
  flex-shrink: 0;
221
216
  }
@@ -256,8 +251,7 @@
256
251
  cursor: pointer;
257
252
  border-radius: 50%;
258
253
  display: flex;
259
- align-items: flex-start;
260
- padding-top: 40px;
254
+ align-items: center;
261
255
  justify-content: center;
262
256
  transition: all 0.15s;
263
257
  -webkit-tap-highlight-color: transparent;
@@ -302,8 +296,7 @@
302
296
 
303
297
  #claude-detail-header {
304
298
  display: flex;
305
- align-items: flex-start;
306
- padding-top: 40px;
299
+ align-items: center;
307
300
  padding: 10px 12px;
308
301
  background: #111;
309
302
  border-bottom: 1px solid #222;
@@ -356,8 +349,7 @@
356
349
  #mode-switcher {
357
350
  display: flex;
358
351
  gap: 4px;
359
- align-items: flex-start;
360
- padding-top: 40px;
352
+ align-items: center;
361
353
  }
362
354
 
363
355
  #mode-label {
@@ -410,8 +402,7 @@
410
402
  top: 0; left: 0; right: 0; bottom: 0;
411
403
  background: #0a0a0a;
412
404
  color: #ccc;
413
- align-items: flex-start;
414
- padding-top: 40px;
405
+ align-items: center;
415
406
  justify-content: center;
416
407
  font-size: 16px;
417
408
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
@@ -481,8 +472,7 @@
481
472
  }
482
473
  #msg-viewer-header {
483
474
  display: flex;
484
- align-items: flex-start;
485
- padding-top: 40px;
475
+ align-items: center;
486
476
  justify-content: space-between;
487
477
  padding: 10px 14px;
488
478
  background: #111;
@@ -616,8 +606,7 @@
616
606
 
617
607
  #git-diff-header {
618
608
  display: flex;
619
- align-items: flex-start;
620
- padding-top: 40px;
609
+ align-items: center;
621
610
  justify-content: space-between;
622
611
  padding: 12px 16px;
623
612
  background: #111;
@@ -641,8 +630,7 @@
641
630
 
642
631
  .git-diff-file-item {
643
632
  display: flex;
644
- align-items: flex-start;
645
- padding-top: 40px;
633
+ align-items: center;
646
634
  padding: 6px 12px;
647
635
  cursor: pointer;
648
636
  color: #ccc;
@@ -686,8 +674,7 @@
686
674
 
687
675
  .git-diff-content-header {
688
676
  display: flex;
689
- align-items: flex-start;
690
- padding-top: 40px;
677
+ align-items: center;
691
678
  gap: 10px;
692
679
  padding: 8px 12px;
693
680
  border-bottom: 1px solid #2a2a2a;
@@ -727,8 +714,7 @@
727
714
  flex: 1;
728
715
  display: flex;
729
716
  flex-direction: column;
730
- align-items: flex-start;
731
- padding-top: 40px;
717
+ align-items: center;
732
718
  justify-content: center;
733
719
  gap: 12px;
734
720
  color: #333;
@@ -761,8 +747,7 @@
761
747
  #docs-bar.visible { display: flex; }
762
748
  #docs-header {
763
749
  display: flex;
764
- align-items: flex-start;
765
- padding-top: 40px;
750
+ align-items: center;
766
751
  justify-content: space-between;
767
752
  padding: 12px 16px;
768
753
  background: #111;
@@ -782,8 +767,7 @@
782
767
  }
783
768
  .docs-file-item {
784
769
  display: flex;
785
- align-items: flex-start;
786
- padding-top: 40px;
770
+ align-items: center;
787
771
  padding: 8px 12px;
788
772
  cursor: pointer;
789
773
  color: #ccc;
@@ -829,8 +813,7 @@
829
813
  flex: 1;
830
814
  display: flex;
831
815
  flex-direction: column;
832
- align-items: flex-start;
833
- padding-top: 40px;
816
+ align-items: center;
834
817
  justify-content: center;
835
818
  gap: 12px;
836
819
  color: #333;
@@ -1153,13 +1136,14 @@
1153
1136
  selectionBackground: '#264f78',
1154
1137
  },
1155
1138
  allowProposedApi: true,
1156
- scrollback: isIOS ? 200 : isMobile ? 1000 : 3000,
1139
+ scrollback: isIOS ? 2000 : isMobile ? 5000 : 50000,
1157
1140
  smoothScrollDuration: 0,
1158
1141
  scrollOnUserInput: true,
1159
1142
  });
1160
1143
 
1161
1144
  term.open(document.getElementById('terminal'));
1162
1145
 
1146
+
1163
1147
  // Unicode 11 宽字符支持:box-drawing、CJK、emoji 等字符宽度精确计算
1164
1148
  if (window.Unicode11Addon) {
1165
1149
  try {
@@ -1326,6 +1310,7 @@
1326
1310
  var lineHeight = (newCellDims && newCellDims.height) || cellDims.height;
1327
1311
  var rows = Math.max(5, Math.min(Math.floor(availH / lineHeight), 100));
1328
1312
  term.resize(MOBILE_COLS, rows);
1313
+ term.scrollToBottom();
1329
1314
  if (ws && ws.readyState === 1 && !isTransitioning) {
1330
1315
  ws.send(JSON.stringify({ type: 'resize', cols: MOBILE_COLS, rows: rows, mobile: true }));
1331
1316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-opencode-viewer",
3
- "version": "2.6.46",
3
+ "version": "2.6.47",
4
4
  "description": "A unified terminal viewer for Claude Code and OpenCode with seamless switching",
5
5
  "type": "module",
6
6
  "main": "server.js",