Merge branch 'main' into feat/topbar-nav
This commit is contained in:
commit
bc429cd351
171 files changed
+1900
-11223
No files matched your search
@@ -416,7 +416,6 @@ export const api = {
|
||||
request<T>(`/api/bindings/${encodeURIComponent(id)}/pause`, { method: "POST" }),
|
||||
bindingResume: <T = unknown>(id: string) =>
|
||||
request<T>(`/api/bindings/${encodeURIComponent(id)}/resume`, { method: "POST" }),
|
||||
harnessBindings: <T = unknown>() => request<T>("/api/harness/bindings"),
|
||||
sources: <T = unknown>(workspace?: string) =>
|
||||
request<T>("/api/sources" + qs({ workspace })),
|
||||
// sourceCreate makes a source in one of the org's workspaces; an empty
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* The xterm palette, read from the --terminal-* theme tokens so a terminal
|
||||
* follows the dashboard theme instead of hard-coded hex. DOM-bound, unlike
|
||||
* the pure helpers in format.ts.
|
||||
*/
|
||||
|
||||
/** Structural subset of xterm's ITheme, so this module need not import @xterm/xterm. */
|
||||
export interface TerminalTheme {
|
||||
background: string;
|
||||
foreground: string;
|
||||
cursor: string;
|
||||
selectionBackground: string;
|
||||
}
|
||||
|
||||
function readToken(name: string): string {
|
||||
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
||||
}
|
||||
|
||||
/** The current terminal palette from the theme tokens in style.css. */
|
||||
export function terminalTheme(): TerminalTheme {
|
||||
return {
|
||||
background: readToken("--terminal-bg"),
|
||||
foreground: readToken("--terminal-fg"),
|
||||
cursor: readToken("--terminal-cursor"),
|
||||
selectionBackground: readToken("--terminal-selection"),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the terminal theme now and again on every theme switch. The
|
||||
* appearance store rewrites data-theme on <html> — including OS-level
|
||||
* changes while the preference is "system" — so watching that one attribute
|
||||
* covers live switching. Returns the stop function.
|
||||
*/
|
||||
export function followTerminalTheme(apply: (theme: TerminalTheme) => void): () => void {
|
||||
apply(terminalTheme());
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
if (mutations.some((m) => m.attributeName === "data-theme")) apply(terminalTheme());
|
||||
});
|
||||
observer.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: ["data-theme"],
|
||||
});
|
||||
return () => observer.disconnect();
|
||||
}
|
||||
Reference in new issue
Block a user