termites 1.0.21 → 1.0.22

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 (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +7 -53
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "termites",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Web terminal with server-client architecture for remote shell access",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server.js CHANGED
@@ -591,8 +591,6 @@ class TermitesServer {
591
591
  .header-title .sep { color: var(--sep-color, #657b83); }
592
592
  .no-client { color: #888; font-style: italic; }
593
593
  #terminal-container { flex: 1; padding: 4px; transition: background 0.3s; overflow: hidden; min-height: 0; position: relative; }
594
- #terminal-container.select-mode { cursor: text; }
595
- #terminal-container.select-mode::after { content: 'Select Mode'; position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 11px; pointer-events: none; }
596
594
  .xterm { height: 100%; }
597
595
  .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 99; opacity: 0; visibility: hidden; transition: all 0.3s; }
598
596
  .overlay.open { opacity: 1; visibility: visible; }
@@ -723,9 +721,9 @@ class TermitesServer {
723
721
  <button data-key="ArrowDown">↓</button>
724
722
  <div class="sep"></div>
725
723
  <button data-seq="/">/</button>
724
+ <button id="select-all-btn">SelAll</button>
726
725
  <button id="copy-btn">Copy</button>
727
726
  <button id="paste-btn">Paste</button>
728
- <button id="select-btn" class="mod-btn">Select</button>
729
727
  </div>
730
728
 
731
729
  <script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.min.js"></script>
@@ -1062,58 +1060,14 @@ class TermitesServer {
1062
1060
  pasteBtn.addEventListener('touchstart', handlePaste, { passive: false });
1063
1061
  pasteBtn.addEventListener('click', handlePaste);
1064
1062
 
1065
- // Select mode button - enables touch selection
1066
- let selectMode = false;
1067
- const selectBtn = document.getElementById('select-btn');
1068
- const termContainer = document.getElementById('terminal-container');
1069
-
1070
- const toggleSelectMode = (e) => {
1063
+ // Select All button
1064
+ const selectAllBtn = document.getElementById('select-all-btn');
1065
+ const handleSelectAll = (e) => {
1071
1066
  e.preventDefault();
1072
- e.stopPropagation();
1073
- selectMode = !selectMode;
1074
- selectBtn.classList.toggle('active', selectMode);
1075
- termContainer.style.touchAction = selectMode ? 'none' : '';
1076
- termContainer.style.userSelect = selectMode ? 'text' : '';
1077
- if (selectMode) {
1078
- // Enable selection overlay
1079
- termContainer.classList.add('select-mode');
1080
- } else {
1081
- termContainer.classList.remove('select-mode');
1082
- term.clearSelection();
1083
- }
1067
+ term.selectAll();
1084
1068
  };
1085
- selectBtn.addEventListener('touchstart', toggleSelectMode, { passive: false });
1086
- selectBtn.addEventListener('click', toggleSelectMode);
1087
-
1088
- // Handle touch selection
1089
- let touchStartPos = null;
1090
- termContainer.addEventListener('touchstart', (e) => {
1091
- if (selectMode && e.touches.length === 1) {
1092
- const touch = e.touches[0];
1093
- const rect = termContainer.getBoundingClientRect();
1094
- touchStartPos = { x: touch.clientX - rect.left, y: touch.clientY - rect.top };
1095
- }
1096
- }, { passive: true });
1097
-
1098
- termContainer.addEventListener('touchmove', (e) => {
1099
- if (selectMode && touchStartPos && e.touches.length === 1) {
1100
- e.preventDefault();
1101
- const touch = e.touches[0];
1102
- const rect = termContainer.getBoundingClientRect();
1103
- const currentPos = { x: touch.clientX - rect.left, y: touch.clientY - rect.top };
1104
-
1105
- // Convert pixel positions to terminal coordinates
1106
- const cellWidth = term._core._renderService.dimensions.css.cell.width;
1107
- const cellHeight = term._core._renderService.dimensions.css.cell.height;
1108
-
1109
- const startCol = Math.floor(touchStartPos.x / cellWidth);
1110
- const startRow = Math.floor(touchStartPos.y / cellHeight);
1111
- const endCol = Math.floor(currentPos.x / cellWidth);
1112
- const endRow = Math.floor(currentPos.y / cellHeight);
1113
-
1114
- term.select(startCol, startRow, (endRow - startRow) * term.cols + (endCol - startCol) + 1);
1115
- }
1116
- }, { passive: false });
1069
+ selectAllBtn.addEventListener('touchstart', handleSelectAll, { passive: false });
1070
+ selectAllBtn.addEventListener('click', handleSelectAll);
1117
1071
  }
1118
1072
 
1119
1073
  function updateClientList() {