Files
repo-vis/web/index.html
Fam Zheng 4aec9510e4 Add syntax highlighting, OSD, search, perf optimizations, and UX improvements
- troika-three-text MSDF rendering for resolution-independent code text
- highlight.js syntax highlighting with Catppuccin Mocha colors
- Lazy text pool: max 25 concurrent code meshes, created on demand
- LOD throttled to every 3 frames, OSD every 10
- 45° tiled watermark (repo/path/filename) behind code
- OSD: breadcrumb, file stats, zoom level
- Search: / or Ctrl+F to find and fly to files
- Keybindings: WASD pan, Q/E rotate, Z/C zoom, Space overview, ? help modal
- Mouse wheel zoom vs trackpad pan detection via event frequency
- Zip GBK filename encoding fallback for Chinese filenames
- Docker volume persistence for SQLite cache
2026-04-06 16:30:28 +01:00

450 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>repo-vis</title>
<!-- Terminus (code) + LXGW WenKai Mono (CJK) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xz/fonts@1/serve/terminus.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lxgw-wenkai-mono-webfont@1.7.0/style.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
background: #11111b;
color: #cdd6f4;
overflow: hidden;
}
/* Landing page */
#landing {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
gap: 32px;
}
#landing h1 {
font-size: 48px;
font-weight: 300;
letter-spacing: -1px;
color: #cba6f7;
}
#landing .subtitle {
font-size: 16px;
color: #6c7086;
margin-top: -20px;
}
.input-group {
display: flex;
flex-direction: column;
gap: 16px;
width: 500px;
max-width: 90vw;
}
.input-row {
display: flex;
gap: 8px;
}
.input-row input[type="text"] {
flex: 1;
padding: 12px 16px;
border: 1px solid #313244;
border-radius: 8px;
background: #1e1e2e;
color: #cdd6f4;
font-size: 15px;
outline: none;
transition: border-color 0.2s;
}
.input-row input[type="text"]:focus {
border-color: #cba6f7;
}
.input-row input[type="text"]::placeholder {
color: #585b70;
}
button {
padding: 12px 24px;
border: none;
border-radius: 8px;
background: #cba6f7;
color: #1e1e2e;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
button:hover { background: #b4befe; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.divider {
display: flex;
align-items: center;
gap: 16px;
color: #585b70;
font-size: 13px;
}
.divider::before, .divider::after {
content: "";
flex: 1;
height: 1px;
background: #313244;
}
.drop-zone {
border: 2px dashed #313244;
border-radius: 12px;
padding: 32px;
text-align: center;
color: #6c7086;
cursor: pointer;
transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.dragover {
border-color: #cba6f7;
background: rgba(203, 166, 247, 0.05);
}
.drop-zone input { display: none; }
/* Loading state */
#loading {
display: none;
position: fixed;
inset: 0;
background: #11111b;
z-index: 100;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
}
#loading.active { display: flex; }
.spinner {
width: 40px;
height: 40px;
border: 3px solid #313244;
border-top-color: #cba6f7;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: #6c7086; font-size: 14px; }
/* Visualization */
#viewport {
display: none;
width: 100vw;
height: 100vh;
}
#viewport.active { display: block; }
/* Tooltip */
#tooltip {
display: none;
position: fixed;
bottom: 16px;
left: 50%;
transform: translateX(-50%);
padding: 8px 16px;
background: rgba(30, 30, 46, 0.9);
backdrop-filter: blur(8px);
border: 1px solid #313244;
border-radius: 8px;
font-size: 13px;
font-family: Terminus, "LXGW WenKai Mono", monospace;
color: #cdd6f4;
pointer-events: none;
z-index: 50;
white-space: nowrap;
}
/* Controls hint */
#controls-hint {
position: fixed;
top: 16px;
right: 16px;
padding: 8px 12px;
background: rgba(30, 30, 46, 0.8);
border: 1px solid #313244;
border-radius: 8px;
font-size: 11px;
color: #585b70;
line-height: 1.8;
z-index: 50;
display: none;
}
#controls-hint.active { display: block; }
/* OSD info bar (bottom-left) */
#osd-info {
position: fixed;
bottom: 16px;
left: 16px;
padding: 6px 12px;
background: rgba(30, 30, 46, 0.8);
border: 1px solid #313244;
border-radius: 8px;
font-size: 12px;
color: #6c7086;
z-index: 50;
display: none;
font-family: monospace;
}
#osd-info.active { display: block; }
/* Breadcrumb (top-left) */
#osd-breadcrumb {
display: none;
position: fixed;
top: 16px;
left: 16px;
padding: 6px 12px;
background: rgba(30, 30, 46, 0.85);
backdrop-filter: blur(8px);
border: 1px solid #313244;
border-radius: 8px;
font-size: 13px;
font-family: monospace;
color: #89b4fa;
z-index: 50;
pointer-events: none;
}
/* Search overlay */
#search-overlay {
display: none;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 480px;
max-width: 90vw;
margin-top: 60px;
flex-direction: column;
z-index: 200;
}
#search-input {
padding: 12px 16px;
border: 1px solid #585b70;
border-radius: 10px 10px 0 0;
background: rgba(30, 30, 46, 0.95);
backdrop-filter: blur(12px);
color: #cdd6f4;
font-size: 15px;
font-family: monospace;
outline: none;
}
#search-input:focus { border-color: #cba6f7; }
#search-input::placeholder { color: #585b70; }
#search-results {
background: rgba(30, 30, 46, 0.95);
border: 1px solid #585b70;
border-top: none;
border-radius: 0 0 10px 10px;
max-height: 300px;
overflow-y: auto;
}
.search-item {
padding: 8px 16px;
font-size: 13px;
font-family: monospace;
color: #cdd6f4;
cursor: pointer;
}
.search-item:hover { background: rgba(203, 166, 247, 0.1); }
/* Help modal */
#help-modal {
display: none;
position: fixed;
inset: 0;
z-index: 300;
align-items: center;
justify-content: center;
background: rgba(0,0,0,0.6);
backdrop-filter: blur(4px);
}
.help-content {
background: #1e1e2e;
border: 1px solid #313244;
border-radius: 12px;
padding: 28px 36px;
min-width: 360px;
color: #cdd6f4;
}
.help-content h2 {
font-size: 18px;
font-weight: 600;
margin-bottom: 16px;
color: #cba6f7;
}
.help-content table { width: 100%; border-collapse: collapse; }
.help-content td {
padding: 5px 0;
font-size: 13px;
}
.help-content td:first-child {
font-family: monospace;
color: #89b4fa;
padding-right: 20px;
white-space: nowrap;
}
.help-content td:last-child { color: #a6adc8; }
.help-close {
margin-top: 16px;
text-align: right;
font-size: 12px;
color: #585b70;
}
/* History */
#history {
display: none;
width: 500px;
max-width: 90vw;
margin-top: 8px;
}
#history.has-items { display: block; }
#history h3 {
font-size: 13px;
font-weight: 500;
color: #585b70;
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 1px;
}
.history-list {
display: flex;
flex-direction: column;
gap: 4px;
}
.history-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 14px;
background: #1e1e2e;
border: 1px solid #313244;
border-radius: 8px;
cursor: pointer;
transition: border-color 0.2s;
}
.history-item:hover { border-color: #cba6f7; }
.history-item .name {
font-size: 14px;
font-weight: 500;
color: #cdd6f4;
}
.history-item .meta {
font-size: 12px;
color: #585b70;
}
</style>
</head>
<body>
<div id="landing">
<h1>repo-vis</h1>
<p class="subtitle">Visualize any codebase in 3D</p>
<div class="input-group">
<div class="input-row">
<input type="text" id="git-url" placeholder="https://github.com/user/repo">
<button id="btn-clone">Clone & Visualize</button>
</div>
<div class="divider">or</div>
<div class="drop-zone" id="drop-zone">
<p>Drop a .zip file here, or click to browse</p>
<input type="file" id="file-input" accept=".zip">
</div>
</div>
<div id="history">
<h3>Recent</h3>
<div class="history-list" id="history-list"></div>
</div>
</div>
<div id="loading">
<div class="spinner"></div>
<div id="loading-text">Cloning repository...</div>
</div>
<div id="viewport"></div>
<div id="tooltip"></div>
<div id="osd-breadcrumb"></div>
<div id="osd-info"></div>
<div id="controls-hint">
WASD move · Q/E rotate · Z/C zoom<br>
Space file view / overview · Esc reset<br>
/ search · dbl-click focus · scroll pan
</div>
<div id="search-overlay">
<input type="text" id="search-input" placeholder="Search files... (/ or Ctrl+F)">
<div id="search-results"></div>
</div>
<div id="help-modal">
<div class="help-content">
<h2>Keyboard Shortcuts</h2>
<table>
<tr><td>W A S D</td><td>Pan (move on XZ plane)</td></tr>
<tr><td>Q / E</td><td>Rotate view left / right</td></tr>
<tr><td>Z / C</td><td>Zoom in / out</td></tr>
<tr><td>Space</td><td>File overview → project overview</td></tr>
<tr><td>Esc</td><td>Reset to project overview</td></tr>
<tr><td>/ or Ctrl+F</td><td>Search files</td></tr>
<tr><td>?</td><td>Toggle this help</td></tr>
<tr><td>Double-click</td><td>Focus on file</td></tr>
</table>
<div class="help-close">Press ? or Esc to close</div>
</div>
</div>
<script type="module" src="/src/app.js"></script>
</body>
</html>