38 lines
1.8 KiB
TypeScript
38 lines
1.8 KiB
TypeScript
import type { Token } from "markdown-it";
|
|
import type { Dispose } from "./sdk.ts";
|
|
|
|
export type TerminalAction = "toggle" | "new" | "window" | "split" | "previous" | "next" | "commands" | "directories";
|
|
export interface TerminalProps {
|
|
cwd: string; visible: boolean; maximized?: boolean; standalone?: boolean;
|
|
onClose: () => void; onMaximize?: () => void; activeFile?: boolean;
|
|
onRunFile?: () => Promise<string | null>; getSelection?: () => string; onConfigureTasks?: () => Promise<void>;
|
|
}
|
|
export interface TerminalMount {
|
|
update(props: TerminalProps): void;
|
|
command(action: Exclude<TerminalAction, "toggle">): void | Promise<void>;
|
|
dispose: Dispose;
|
|
}
|
|
export type FormulaErrorCode = "#ERROR!" | "#REF!" | "#VALUE!" | "#NAME?" | "#DIV/0!" | "#CYCLE!" | "#NUM!" | "#LIMIT!";
|
|
export type FormulaResult = { formula: string; text: string; value?: number; error?: FormulaErrorCode };
|
|
export interface Contributions {
|
|
browser: {
|
|
newTab?(): Promise<void>;
|
|
mountSettings(container: HTMLElement): Dispose | Promise<Dispose>;
|
|
mountBookmarks(container: HTMLElement): Dispose | Promise<Dispose>;
|
|
open(url: string): Promise<boolean>;
|
|
};
|
|
terminal: {
|
|
mount(container: HTMLElement, props: TerminalProps): TerminalMount;
|
|
shortcut(event: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "altKey" | "shiftKey" | "code" | "key">): TerminalAction | null;
|
|
};
|
|
tableFormulas: {
|
|
formulaErrors: Record<FormulaErrorCode, string>;
|
|
isTableFormula(text: string): boolean;
|
|
cellAddress(row: number, column: number): string;
|
|
evaluateTableFormulas(rows: string[][]): (FormulaResult | null)[][];
|
|
tableFormulaHtml(result: FormulaResult): string;
|
|
renderTableFormulas(tokens: Token[]): void;
|
|
createFormulaTools(finish: () => void, measure: () => void): { formulaTools: HTMLDivElement; formulaStatus: HTMLSpanElement; formulaHint: HTMLDivElement };
|
|
};
|
|
}
|