import { MiniCodeContext } from "./context"; import type { LanguageSpec } from "./languages"; import type { HighlightStyle } from "@codemirror/language"; import { TerminalFactory } from "./modules/terminal/types"; import { Theme, ThemeInput } from "./modules/theme/themes"; import { LspTransportFactory } from "./modules/lsp/types"; import { FormatterFactory } from "./modules/formatter/types"; import { KeyBinding } from "@codemirror/view"; export type Dirent = { isDirectory(): boolean; isFile(): boolean; isSymbolicLink(): boolean; name: string; }; export interface Filesystem { readdir(path: string): Promise; readdir(path: string, opts: { withFileTypes: true; }): Promise; readFile(path: string): Promise; readFile(path: string, encoding: "utf-8"): Promise; writeFile(path: string, data: string): Promise; unlink(path: string): Promise; rename(oldPath: string, newPath: string): Promise; copyFile(src: string, dest: string): Promise; rm(path: string, opts?: { recursive?: boolean; force?: boolean; }): Promise; mkdir(path: string, opts?: { recursive?: boolean; }): Promise; watch(path: string, options?: { recursive?: boolean; signal?: AbortSignal; }): AsyncIterable<{ eventType: string; filename: string; }>; } export type Storage = { getItem(key: string): string | null; setItem(key: string, value: string): void; removeItem(key: string): void; }; export type TitleBarButton = { position?: "left" | "right"; content?: string | Element; handler?: (ev: PointerEvent & { target: HTMLButtonElement; }) => void; nostyle?: boolean; }; export type MinicodeKeybind = { key: string; macKey?: string; run: (ctx: MiniCodeContext) => void; }; export type LanguageConfig = { /** * List of extensions this config applies to. If multiple * configs specify the same extension, the last one wins. * * @example ext: [".js", ".jsx", ".ts", ".tsx"] */ ext: string[]; /** Codemirror extension for providing the syntax support. */ spec?: LanguageSpec; /** Function that can be used to format this language code. */ fromatter?: FormatterFactory; formatOnSave?: boolean; }; export type LspServerConfig = { name: string; /** Factory that creates the transport to the LSP server. */ transport: LspTransportFactory; /** Extensions this server handles (e.g. [".ts", ".tsx", ".js", ".jsx"]). */ extensions: string[]; }; export type MiniCodeOptions = { root: string; filesystem: Filesystem; theme?: ThemeInput; themes?: Theme[]; syntaxTheme?: HighlightStyle; languages?: LanguageConfig[]; lsp?: LspServerConfig[]; terminal?: TerminalFactory; storage?: Storage; titleBarButtons?: Array; keymaps?: { global?: Array; editor?: Array; }; }; export declare function MiniCode(opts: MiniCodeOptions): HTMLDivElement & { minicode: MiniCodeContext; }; export declare namespace MiniCode { var File: (f: string, opts: Omit) => HTMLDivElement & { minicode: MiniCodeContext; }; } //# sourceMappingURL=mini-code.d.ts.map