BTerminal/v2/src/lib/components/Layout/PaneContainer.svelte
Hibryda 4db7ccff60 feat(v2): add SSH management, ctx integration, themes, detached mode, auto-updater
SSH session management:
- SshSession struct + ssh_sessions SQLite table in session.rs
- CRUD Tauri commands (ssh_session_list/save/delete) in lib.rs
- SshDialog.svelte (create/edit modal), SshSessionList.svelte (sidebar)
- SSH pane routes to TerminalPane with shell=/usr/bin/ssh + args

ctx context database integration:
- ctx.rs: read-only CtxDb (SQLITE_OPEN_READ_ONLY for ~/.claude-context/context.db)
- 5 Tauri commands (ctx_list_projects/get_context/get_shared/get_summaries/search)
- ContextPane.svelte with project selector, tabs, search
- ctx-bridge.ts adapter

Catppuccin theme flavors (Latte/Frappe/Macchiato/Mocha):
- themes.ts: all 4 palette definitions + buildXtermTheme/applyCssVariables
- theme.svelte.ts: reactive store with SQLite persistence
- SettingsDialog flavor dropdown, TerminalPane theme-aware

Detached pane mode (pop-out windows):
- detach.ts: isDetachedMode/getDetachedConfig from URL params
- App.svelte: conditional rendering of single pane without chrome

Other additions:
- Shiki syntax highlighting (highlight.ts, lazy singleton, 13 languages)
- Tauri auto-updater plugin (tauri-plugin-updater + updater.ts)
- AgentPane markdown rendering with Shiki code highlighting
- New deps: shiki, @tauri-apps/plugin-updater, tauri-plugin-updater
2026-03-06 14:50:00 +01:00

113 lines
2.3 KiB
Svelte

<script lang="ts">
import type { Snippet } from 'svelte';
interface Props {
title: string;
status?: 'idle' | 'running' | 'error' | 'done';
onClose?: () => void;
onDetach?: () => void;
children: Snippet;
}
let { title, status = 'idle', onClose, onDetach, children }: Props = $props();
</script>
<div class="pane-container">
<div class="pane-header">
<span class="pane-title">{title}</span>
<div class="pane-controls">
{#if status !== 'idle'}
<span class="status {status}">{status}</span>
{/if}
{#if onDetach}
<button class="detach-btn" onclick={onDetach} title="Pop out to new window">&#8599;</button>
{/if}
{#if onClose}
<button class="close-btn" onclick={onClose} title="Close pane">&times;</button>
{/if}
</div>
</div>
<div class="pane-content">
{@render children()}
</div>
</div>
<style>
.pane-container {
display: flex;
flex-direction: column;
background: var(--bg-secondary);
border-radius: var(--border-radius);
overflow: hidden;
border: 1px solid var(--border);
height: 100%;
}
.pane-header {
height: var(--pane-header-height);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
background: var(--bg-tertiary);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.pane-title {
font-size: 12px;
font-weight: 500;
color: var(--text-secondary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.pane-controls {
display: flex;
align-items: center;
gap: 6px;
}
.status {
font-size: 10px;
padding: 1px 5px;
border-radius: 3px;
}
.status.running { color: var(--ctp-blue); }
.status.error { color: var(--ctp-red); }
.status.done { color: var(--ctp-green); }
.detach-btn {
background: none;
border: none;
color: var(--text-muted);
font-size: 12px;
cursor: pointer;
padding: 0 2px;
line-height: 1;
}
.detach-btn:hover { color: var(--ctp-blue); }
.close-btn {
background: none;
border: none;
color: var(--text-muted);
font-size: 16px;
cursor: pointer;
padding: 0 2px;
line-height: 1;
}
.close-btn:hover {
color: var(--ctp-red);
}
.pane-content {
flex: 1;
overflow: hidden;
min-height: 0;
}
</style>