termites 1.0.20 → 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 -58
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "termites",
3
- "version": "1.0.20",
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,14 +721,9 @@ class TermitesServer {
723
721
  <button data-key="ArrowDown">↓</button>
724
722
  <div class="sep"></div>
725
723
  <button data-seq="/">/</button>
726
- <button data-seq="\\x03">^C</button>
727
- <button data-seq="\\x04">^D</button>
728
- <button data-seq="\\x1a">^Z</button>
729
- <button data-seq="\\x0c">^L</button>
730
- <div class="sep"></div>
724
+ <button id="select-all-btn">SelAll</button>
731
725
  <button id="copy-btn">Copy</button>
732
726
  <button id="paste-btn">Paste</button>
733
- <button id="select-btn" class="mod-btn">Select</button>
734
727
  </div>
735
728
 
736
729
  <script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.min.js"></script>
@@ -1067,58 +1060,14 @@ class TermitesServer {
1067
1060
  pasteBtn.addEventListener('touchstart', handlePaste, { passive: false });
1068
1061
  pasteBtn.addEventListener('click', handlePaste);
1069
1062
 
1070
- // Select mode button - enables touch selection
1071
- let selectMode = false;
1072
- const selectBtn = document.getElementById('select-btn');
1073
- const termContainer = document.getElementById('terminal-container');
1074
-
1075
- const toggleSelectMode = (e) => {
1063
+ // Select All button
1064
+ const selectAllBtn = document.getElementById('select-all-btn');
1065
+ const handleSelectAll = (e) => {
1076
1066
  e.preventDefault();
1077
- e.stopPropagation();
1078
- selectMode = !selectMode;
1079
- selectBtn.classList.toggle('active', selectMode);
1080
- termContainer.style.touchAction = selectMode ? 'none' : '';
1081
- termContainer.style.userSelect = selectMode ? 'text' : '';
1082
- if (selectMode) {
1083
- // Enable selection overlay
1084
- termContainer.classList.add('select-mode');
1085
- } else {
1086
- termContainer.classList.remove('select-mode');
1087
- term.clearSelection();
1088
- }
1067
+ term.selectAll();
1089
1068
  };
1090
- selectBtn.addEventListener('touchstart', toggleSelectMode, { passive: false });
1091
- selectBtn.addEventListener('click', toggleSelectMode);
1092
-
1093
- // Handle touch selection
1094
- let touchStartPos = null;
1095
- termContainer.addEventListener('touchstart', (e) => {
1096
- if (selectMode && e.touches.length === 1) {
1097
- const touch = e.touches[0];
1098
- const rect = termContainer.getBoundingClientRect();
1099
- touchStartPos = { x: touch.clientX - rect.left, y: touch.clientY - rect.top };
1100
- }
1101
- }, { passive: true });
1102
-
1103
- termContainer.addEventListener('touchmove', (e) => {
1104
- if (selectMode && touchStartPos && e.touches.length === 1) {
1105
- e.preventDefault();
1106
- const touch = e.touches[0];
1107
- const rect = termContainer.getBoundingClientRect();
1108
- const currentPos = { x: touch.clientX - rect.left, y: touch.clientY - rect.top };
1109
-
1110
- // Convert pixel positions to terminal coordinates
1111
- const cellWidth = term._core._renderService.dimensions.css.cell.width;
1112
- const cellHeight = term._core._renderService.dimensions.css.cell.height;
1113
-
1114
- const startCol = Math.floor(touchStartPos.x / cellWidth);
1115
- const startRow = Math.floor(touchStartPos.y / cellHeight);
1116
- const endCol = Math.floor(currentPos.x / cellWidth);
1117
- const endRow = Math.floor(currentPos.y / cellHeight);
1118
-
1119
- term.select(startCol, startRow, (endRow - startRow) * term.cols + (endCol - startCol) + 1);
1120
- }
1121
- }, { passive: false });
1069
+ selectAllBtn.addEventListener('touchstart', handleSelectAll, { passive: false });
1070
+ selectAllBtn.addEventListener('click', handleSelectAll);
1122
1071
  }
1123
1072
 
1124
1073
  function updateClientList() {