|
| 1 | +// Copyright 2026, Command Line Inc. |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +const previewElectronApi: ElectronApi = { |
| 5 | + getAuthKey: () => "", |
| 6 | + getIsDev: () => false, |
| 7 | + getCursorPoint: () => ({ x: 0, y: 0 }) as Electron.Point, |
| 8 | + getPlatform: () => "darwin", |
| 9 | + getEnv: (_varName: string) => "", |
| 10 | + getUserName: () => "", |
| 11 | + getHostName: () => "", |
| 12 | + getDataDir: () => "", |
| 13 | + getConfigDir: () => "", |
| 14 | + getHomeDir: () => "", |
| 15 | + getWebviewPreload: () => "", |
| 16 | + getAboutModalDetails: () => ({}) as AboutModalDetails, |
| 17 | + getZoomFactor: () => 1.0, |
| 18 | + showWorkspaceAppMenu: (_workspaceId: string) => {}, |
| 19 | + showBuilderAppMenu: (_builderId: string) => {}, |
| 20 | + showContextMenu: (_workspaceId: string, _menu: ElectronContextMenuItem[]) => {}, |
| 21 | + onContextMenuClick: (_callback: (id: string | null) => void) => {}, |
| 22 | + onNavigate: (_callback: (url: string) => void) => {}, |
| 23 | + onIframeNavigate: (_callback: (url: string) => void) => {}, |
| 24 | + downloadFile: (_path: string) => {}, |
| 25 | + openExternal: (_url: string) => {}, |
| 26 | + onFullScreenChange: (_callback: (isFullScreen: boolean) => void) => {}, |
| 27 | + onZoomFactorChange: (_callback: (zoomFactor: number) => void) => {}, |
| 28 | + onUpdaterStatusChange: (_callback: (status: UpdaterStatus) => void) => {}, |
| 29 | + getUpdaterStatus: () => "up-to-date", |
| 30 | + getUpdaterChannel: () => "", |
| 31 | + installAppUpdate: () => {}, |
| 32 | + onMenuItemAbout: (_callback: () => void) => {}, |
| 33 | + updateWindowControlsOverlay: (_rect: Dimensions) => {}, |
| 34 | + onReinjectKey: (_callback: (waveEvent: WaveKeyboardEvent) => void) => {}, |
| 35 | + setWebviewFocus: (_focusedId: number) => {}, |
| 36 | + registerGlobalWebviewKeys: (_keys: string[]) => {}, |
| 37 | + onControlShiftStateUpdate: (_callback: (state: boolean) => void) => {}, |
| 38 | + createWorkspace: () => {}, |
| 39 | + switchWorkspace: (_workspaceId: string) => {}, |
| 40 | + deleteWorkspace: (_workspaceId: string) => {}, |
| 41 | + setActiveTab: (_tabId: string) => {}, |
| 42 | + createTab: () => {}, |
| 43 | + closeTab: (_workspaceId: string, _tabId: string, _confirmClose: boolean) => Promise.resolve(false), |
| 44 | + setWindowInitStatus: (_status: "ready" | "wave-ready") => {}, |
| 45 | + onWaveInit: (_callback: (initOpts: WaveInitOpts) => void) => {}, |
| 46 | + onBuilderInit: (_callback: (initOpts: BuilderInitOpts) => void) => {}, |
| 47 | + sendLog: (_log: string) => {}, |
| 48 | + onQuicklook: (_filePath: string) => {}, |
| 49 | + openNativePath: (_filePath: string) => {}, |
| 50 | + captureScreenshot: (_rect: Electron.Rectangle) => Promise.resolve(""), |
| 51 | + setKeyboardChordMode: () => {}, |
| 52 | + clearWebviewStorage: (_webContentsId: number) => Promise.resolve(), |
| 53 | + setWaveAIOpen: (_isOpen: boolean) => {}, |
| 54 | + closeBuilderWindow: () => {}, |
| 55 | + incrementTermCommands: (_opts?: { isRemote?: boolean; isWsl?: boolean; isDurable?: boolean }) => {}, |
| 56 | + nativePaste: () => {}, |
| 57 | + openBuilder: (_appId?: string) => {}, |
| 58 | + setBuilderWindowAppId: (_appId: string) => {}, |
| 59 | + doRefresh: () => {}, |
| 60 | + saveTextFile: (_fileName: string, _content: string) => Promise.resolve(false), |
| 61 | + setIsActive: async () => {}, |
| 62 | +}; |
| 63 | + |
| 64 | +function installPreviewElectronApi() { |
| 65 | + (window as any).api = previewElectronApi; |
| 66 | +} |
| 67 | + |
| 68 | +export { installPreviewElectronApi }; |
0 commit comments