Files
Netcatty/index.css
T
陈大猫andClaude Opus 4.6 0b7c52523e feat: 终端沉浸模式 (#517)
* feat: add terminal immersive mode

When enabled, the UI chrome (tab bar, sidebar, status bar) adapts its
colors to match the active terminal's theme, creating a visually
cohesive experience. Colors are derived from the terminal theme's
hex values and converted to HSL for CSS custom property overrides.

- Add useImmersiveMode hook with hex-to-HSL conversion and token derivation
- Add reapplyCurrentTheme to useSettingsState for restoring original theme
- Integrate with App.tsx to resolve active terminal's effective theme
- Add immersive mode toggle in Appearance settings with i18n (en/zh-CN)
- Add CSS transition class for smooth 300ms color changes
- Support cross-window sync via IPC for Settings window toggle
- Handle per-host theme overrides and workspace focused sessions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: 沉浸模式多项改进与 bug 修复

- 修复 primaryForeground 硬编码白色导致浅色 cursor 对比度不足
- 修复 SettingsPage 直接导入 infrastructure 层违反架构约束
- 修复 TerminalSession 类型未导入导致 TS 编译错误
- 修复 TopTabs memo 缺少 logViews 导致 logView 变化不触发重渲染
- 重构 useImmersiveMode 为纯 effect hook,状态由 useSettingsState 统一管理
- Workspace 多终端主题不一致时禁用沉浸模式
- 排除 logView tab 误触发沉浸模式
- 沉浸模式下禁用 dark/light 切换按钮
- Agent 图标使用 CSS mask 跟随文字颜色
- Agent 下拉菜单 overflow-hidden 修复 hover 溢出
- 退出沉浸模式使用 overlay 淡出避免闪烁
- immersive-transition class 仅在沉浸实际生效时添加

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: 沉浸模式默认开启

新用户默认启用沉浸模式,已有设置的用户不受影响。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* perf: 沉浸模式主题切换性能优化

- 启动时预计算所有内置主题的 CSS 字符串,切换时 O(1) 查表
- 自定义主题懒计算并缓存,后续切换同样 O(1)
- useLayoutEffect 替代 useEffect,paint 前完成避免闪烁
- 跳过无效的 dark/light class 切换
- apply 和 restore 逻辑拆分为独立 effect
- 去掉主题列表 hover 渐变动画

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: 修复 Codex review 提出的三个问题

- [P1] base UI theme 变化时不再覆盖沉浸模式的 dark/light class
- [P2] fingerprint 加入 theme.type,检测自定义主题 dark↔light 编辑
- [P2] 沉浸模式设置接入 sync pipeline (collect/apply/rehydrate)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: focus 模式 workspace 支持沉浸 + settingsVersion 加入 immersiveMode

- focus 模式 workspace 使用 focusedSessionId 的主题,不再要求所有 session 一致
- settingsVersion 加入 immersiveMode 依赖,确保 auto-sync 能检测到变化

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: 沉浸模式 sync 一致性修复

- 初始化时将默认值写入 localStorage,确保 collectSyncableSettings 能收集到
- rehydrateAllFromStorage 后通过 IPC 广播给其他窗口

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: focus 模式关闭 focused session 后 fallback 到剩余 session 的主题

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: 沉浸模式加入 storage event 跨窗口同步

将 immersiveMode 加入 settingsSnapshotRef 和 handleStorageChange,
确保 web/preview 场景下多窗口间沉浸模式状态同步。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: 沉浸模式同步 Electron 原生窗口背景色

切换沉浸主题时同步调用 setTheme/setBackgroundColor,
使 Windows 上的窗口边框颜色与沉浸主题一致。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 02:47:50 +08:00

397 lines
8.2 KiB
CSS

@import "tailwindcss";
/* ============================================
Tailwind CSS v4 Theme Configuration
============================================ */
@theme {
/* Default border color - ensures 'border' class uses theme color instead of currentColor */
--default-border-color: var(--color-border);
/* Colors - mapped from CSS variables */
--color-border: hsl(var(--border));
--color-input: hsl(var(--input));
--color-ring: hsl(var(--ring));
--color-background: hsl(var(--background));
--color-foreground: hsl(var(--foreground));
--color-primary: hsl(var(--primary));
--color-primary-foreground: hsl(var(--primary-foreground));
--color-secondary: hsl(var(--secondary));
--color-secondary-foreground: hsl(var(--secondary-foreground));
--color-destructive: hsl(var(--destructive));
--color-destructive-foreground: hsl(var(--destructive-foreground));
--color-muted: hsl(var(--muted));
--color-muted-foreground: hsl(var(--muted-foreground));
--color-accent: hsl(var(--accent));
--color-accent-foreground: hsl(var(--accent-foreground));
--color-popover: hsl(var(--popover));
--color-popover-foreground: hsl(var(--popover-foreground));
--color-card: hsl(var(--card));
--color-card-foreground: hsl(var(--card-foreground));
/* Border Radius */
--radius-lg: var(--radius);
--radius-md: calc(var(--radius) - 2px);
--radius-sm: calc(var(--radius) - 4px);
/* Fonts */
--font-sans: "Space Grotesk", system-ui, sans-serif;
--font-mono: "JetBrains Mono", monospace;
/* Animations */
--animate-accordion-down: accordion-down 0.2s ease-out;
--animate-accordion-up: accordion-up 0.2s ease-out;
--animate-fade-in: fade-in 0.2s ease-out;
@keyframes accordion-down {
from {
height: 0;
}
to {
height: var(--radix-collapsible-content-height);
}
}
@keyframes accordion-up {
from {
height: var(--radix-collapsible-content-height);
}
to {
height: 0;
}
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
}
:root {
color-scheme: light;
}
/* Global default border color - ensures 'border' class always uses theme color */
*,
*::before,
*::after {
border-color: hsl(var(--border));
}
body {
min-height: 100vh;
font-family: var(--font-sans);
background:
radial-gradient(900px circle at 15% 0%, hsl(var(--primary) / 0.10), transparent 38%),
radial-gradient(1200px circle at 85% 10%, hsl(var(--accent) / 0.16), transparent 40%),
hsl(var(--background));
color: hsl(var(--foreground));
}
.dark {
color-scheme: dark;
}
.dark body {
background:
radial-gradient(1200px circle at 10% 0%, hsl(var(--primary) / 0.08), transparent 32%),
radial-gradient(900px circle at 85% 10%, hsl(var(--accent) / 0.12), transparent 36%),
hsl(var(--background));
color: hsl(var(--foreground));
}
/* Immersive mode: fade-out overlay for smooth theme restoration */
.immersive-fade-overlay {
position: fixed;
inset: 0;
z-index: 9999;
pointer-events: none;
opacity: 1;
transition: opacity 200ms ease-out;
}
.immersive-fade-overlay.fade-out {
opacity: 0;
}
/* Immersive mode: override agent icon badge colors to follow the theme */
.immersive-transition [data-agent-badge] {
border-color: hsl(var(--primary) / 0.2) !important;
background-color: hsl(var(--primary) / 0.1) !important;
}
.netcatty-shell {
position: relative;
background: linear-gradient(180deg, hsl(var(--background)) 0%, hsl(var(--background)) 60%, hsl(var(--background) / 0.9) 100%);
}
@keyframes shimmer {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
.thinking-shimmer {
background: linear-gradient(
90deg,
currentColor 0%,
currentColor 40%,
rgba(255, 255, 255, 0.6) 50%,
currentColor 60%,
currentColor 100%
);
background-size: 200% 100%;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
animation: thinking-shimmer 1.5s ease-in-out infinite;
}
@keyframes thinking-shimmer {
0% {
background-position: 100% center;
}
100% {
background-position: -100% center;
}
}
@keyframes progress-shimmer {
0% {
transform: translateX(-200%);
}
100% {
transform: translateX(200%);
}
}
.glass-panel {
background: hsl(var(--secondary) / 0.95);
border: 1px solid hsl(var(--border) / 0.8);
backdrop-filter: blur(12px);
box-shadow: 0 14px 40px hsl(var(--foreground) / 0.12);
}
.soft-card {
background: hsl(var(--card));
border: 1px solid hsl(var(--border) / 0.8);
box-shadow: 0 4px 12px hsl(var(--foreground) / 0.06);
}
.card-highlight {
position: relative;
overflow: hidden;
}
.card-highlight::before {
content: "";
position: absolute;
inset: -40%;
background: radial-gradient(500px circle at 20% 20%, hsl(var(--primary) / 0.18), transparent 55%);
opacity: 0;
transition: opacity 180ms ease;
}
.card-highlight:hover::before {
opacity: 1;
}
.elevate {
transition: transform 140ms ease, border-color 140ms ease;
}
.elevate:hover {
transform: translateY(-2px);
}
::selection {
background: hsl(var(--primary) / 0.22);
color: hsl(var(--foreground));
}
/* Port Forwarding Traffic Animation */
@keyframes traffic-flow {
0% {
stroke-dashoffset: 24;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes traffic-flow-reverse {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 24;
}
}
@keyframes pulse-glow {
0%,
100% {
opacity: 0.6;
}
50% {
opacity: 1;
}
}
.traffic-line {
stroke-dasharray: 8 4;
animation: traffic-flow 0.8s linear infinite;
}
.traffic-line-reverse {
stroke-dasharray: 8 4;
animation: traffic-flow-reverse 0.8s linear infinite;
}
.traffic-glow {
animation: pulse-glow 1.5s ease-in-out infinite;
}
/* Custom titlebar drag regions for Electron */
.app-drag {
-webkit-app-region: drag;
app-region: drag;
user-select: none;
-webkit-user-select: none;
}
.app-no-drag {
-webkit-app-region: no-drag;
app-region: no-drag;
user-select: auto;
-webkit-user-select: auto;
}
.app-no-drag * {
-webkit-app-region: no-drag;
app-region: no-drag;
user-select: auto;
-webkit-user-select: auto;
}
.no-scrollbar {
scrollbar-width: none;
-ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.workspace-pane {
outline: none;
overflow: visible;
}
.workspace-pane::after {
content: "";
position: absolute;
inset: 0;
border-radius: 0;
border: 2px solid hsl(var(--primary));
pointer-events: none;
opacity: 0;
transition: opacity 120ms ease, box-shadow 120ms ease;
z-index: 40;
}
.workspace-pane:focus-within::after {
opacity: 1;
}
/* ── Streamdown code block overrides ── */
[data-streamdown="code-block"] {
position: relative !important;
border-radius: 10px !important;
background: hsl(var(--muted) / 0.5) !important;
overflow: hidden !important;
margin: 6px 0 !important;
padding: 0 !important;
border: none !important;
gap: 0 !important;
}
[data-streamdown="code-block-header"] {
height: auto !important;
padding: 4px 12px 0 !important;
font-size: 11px !important;
}
[data-streamdown="code-block-header"] span {
margin-left: 0 !important;
}
[data-streamdown="code-block-actions"] {
position: absolute !important;
top: 4px !important;
right: 4px !important;
border: none !important;
background: none !important;
backdrop-filter: none !important;
padding: 0 !important;
gap: 2px !important;
opacity: 0;
transition: opacity 0.15s;
}
[data-streamdown="code-block"]:hover [data-streamdown="code-block-actions"] {
opacity: 1;
}
[data-streamdown="code-block-actions"] button {
padding: 4px !important;
border-radius: 4px;
}
[data-streamdown="code-block-body"] {
border: none !important;
border-radius: 0 !important;
background: transparent !important;
padding: 0 !important;
margin: 0 !important;
overflow-x: auto !important;
font-size: 0 !important; /* collapse whitespace text nodes */
}
[data-streamdown="code-block-body"] pre {
font-size: 12px !important; /* restore in pre */
}
[data-streamdown="code-block"] pre {
margin: 0 !important;
background: transparent !important;
border: none !important;
border-radius: 0 !important;
padding: 0 12px 10px !important;
font-size: 12px !important;
line-height: 1.5 !important;
}