mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
Replace parallel preview/pending follow-app pipelines with a single runtime that drives xterm, side panel, host tree, and top tabs together in both follow-app and manual modes. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import { isActiveChromeThemeResolvable, resolveActiveChromeTheme } from '../app/activeChromeTheme';
|
|
import { clearTopTabsChromeThemeVars } from '../app/topTabsChromeTheme';
|
|
import type { TerminalAppearanceHostScope, ResolvedAppearance } from '../../domain/terminalAppearanceRuntime';
|
|
import type { Host, TerminalSession, TerminalTheme, Workspace } from '../../types';
|
|
import { activeTabStore } from './activeTabStore';
|
|
import type { EditorTab } from './editorTabStore';
|
|
import type { LogView } from './logViewState';
|
|
import { syncActiveChromeTheme } from './useActiveChromeTheme';
|
|
|
|
export type ActiveChromeThemeDeps = {
|
|
accentMode: 'theme' | 'custom';
|
|
applyAppTheme: () => void;
|
|
currentTerminalTheme: TerminalTheme;
|
|
customAccent: string;
|
|
editorTabs: readonly EditorTab[];
|
|
followAppTerminalTheme: boolean;
|
|
hostById: Map<string, Host>;
|
|
logViews: readonly LogView[];
|
|
resolveSessionAppearance?: (hostScope: TerminalAppearanceHostScope) => ResolvedAppearance;
|
|
sessionById: Map<string, TerminalSession>;
|
|
themeById: Map<string, TerminalTheme>;
|
|
workspaceById: Map<string, Workspace>;
|
|
};
|
|
|
|
let depsRef: ActiveChromeThemeDeps | null = null;
|
|
|
|
export function updateActiveChromeThemeDeps(deps: ActiveChromeThemeDeps): void {
|
|
depsRef = deps;
|
|
}
|
|
|
|
export function notifyActiveChromeThemeForTab(activeTabId: string): void {
|
|
if (!depsRef || typeof document === 'undefined') return;
|
|
if (activeTabId === 'vault' || activeTabId === 'sftp') {
|
|
clearTopTabsChromeThemeVars();
|
|
}
|
|
if (!isActiveChromeThemeResolvable({ ...depsRef, activeTabId })) return;
|
|
const activeTheme = resolveActiveChromeTheme({ ...depsRef, activeTabId });
|
|
syncActiveChromeTheme(activeTheme, depsRef.applyAppTheme);
|
|
}
|
|
|
|
activeTabStore.subscribeSync(notifyActiveChromeThemeForTab);
|