mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 15:41:17 +00:00
Updates terminal to ghostty-web 0.4.0 and improves font support
Upgrades the terminal dependency for better compatibility and API alignment. Refactors initialization to match upstream changes, removing direct WASM loading. Expands the terminal font stack and adds extended Unicode font-face for improved box drawing and symbol rendering in the terminal interface.
This commit is contained in:
4 files changed
+23
-16
No files matched your search
+11
-9
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef, useState, memo } from 'react';
|
||||
import { Ghostty, Terminal as GhosttyTerminal, FitAddon } from 'ghostty-web';
|
||||
import { init as initGhostty, Terminal as GhosttyTerminal, FitAddon } from 'ghostty-web';
|
||||
import { Host, SSHKey, Snippet, TerminalSession, TerminalTheme } from '../types';
|
||||
import { Zap, FolderInput, Loader2, AlertCircle, ShieldCheck, Clock, Play, X, Lock, Key, User, Eye, EyeOff, ChevronDown } from 'lucide-react';
|
||||
import { DistroAvatar } from './DistroAvatar';
|
||||
@@ -28,12 +28,15 @@ interface TerminalProps {
|
||||
onUpdateHost?: (host: Host) => void;
|
||||
}
|
||||
|
||||
let ghosttyPromise: Promise<Ghostty> | null = null;
|
||||
const ensureGhostty = () => {
|
||||
if (!ghosttyPromise) {
|
||||
ghosttyPromise = Ghostty.load('ghostty-vt.wasm');
|
||||
let ghosttyInitialized = false;
|
||||
let ghosttyInitPromise: Promise<void> | null = null;
|
||||
const ensureGhostty = async () => {
|
||||
if (ghosttyInitialized) return;
|
||||
if (!ghosttyInitPromise) {
|
||||
ghosttyInitPromise = initGhostty();
|
||||
}
|
||||
return ghosttyPromise;
|
||||
await ghosttyInitPromise;
|
||||
ghosttyInitialized = true;
|
||||
};
|
||||
|
||||
const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
@@ -149,18 +152,17 @@ const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
|
||||
const boot = async () => {
|
||||
try {
|
||||
const ghostty = await ensureGhostty();
|
||||
await ensureGhostty();
|
||||
if (disposed || !containerRef.current) return;
|
||||
|
||||
const term = new GhosttyTerminal({
|
||||
cursorBlink: true,
|
||||
fontSize,
|
||||
fontFamily: '"JetBrains Mono", monospace',
|
||||
fontFamily: '"JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono", "Menlo", "DejaVu Sans Mono", monospace',
|
||||
theme: {
|
||||
...terminalTheme.colors,
|
||||
selectionBackground: terminalTheme.colors.selection,
|
||||
},
|
||||
ghostty,
|
||||
});
|
||||
|
||||
const fitAddon = new FitAddon();
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css" />
|
||||
<style>
|
||||
/* Load extended Unicode ranges for terminal box drawing characters */
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono Extended';
|
||||
src: local('JetBrains Mono'), local('JetBrainsMono-Regular');
|
||||
unicode-range: U+2500-257F, U+2580-259F, U+25A0-25FF, U+2700-27BF;
|
||||
}
|
||||
:root {
|
||||
--background: 216 33% 96%;
|
||||
--foreground: 222 47% 12%;
|
||||
|
||||
Generated
+4
-5
@@ -19,7 +19,7 @@
|
||||
"@radix-ui/react-slot": "1.2.4",
|
||||
"@radix-ui/react-tabs": "1.1.13",
|
||||
"clsx": "2.1.0",
|
||||
"ghostty-web": "^0.3.0",
|
||||
"ghostty-web": "^0.4.0",
|
||||
"lucide-react": "0.556.0",
|
||||
"node-pty": "^1.0.0",
|
||||
"react": "^19.2.1",
|
||||
@@ -3866,10 +3866,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ghostty-web": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/ghostty-web/-/ghostty-web-0.3.0.tgz",
|
||||
"integrity": "sha512-SAdSHWYF20GMZUB0n8kh1N6Z4ljMnuUqT8iTB2n5FAPswEV10MejEpLlhW/769GL5+BQa1NYwEg9y/XCckV5+A==",
|
||||
"license": "MIT"
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/ghostty-web/-/ghostty-web-0.4.0.tgz",
|
||||
"integrity": "sha512-0puDBik2qapbD/QQBW9o5ZHfXnZBqZWx/ctBiVtKZ6ZLds4NYb+wZuw1cRLXZk9zYovIQ908z3rvFhexAvc5Hg=="
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "10.5.0",
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@
|
||||
"@radix-ui/react-slot": "1.2.4",
|
||||
"@radix-ui/react-tabs": "1.1.13",
|
||||
"clsx": "2.1.0",
|
||||
"ghostty-web": "^0.3.0",
|
||||
"ghostty-web": "^0.4.0",
|
||||
"lucide-react": "0.556.0",
|
||||
"node-pty": "^1.0.0",
|
||||
"react": "^19.2.1",
|
||||
@@ -46,4 +46,4 @@
|
||||
"vite": "^6.2.0",
|
||||
"wait-on": "^7.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user