waveterm/frontend/app/waveenv/waveenvimpl.ts
Mike Sawka 80cb181daf
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Docsite CI/CD / Build Docsite (push) Waiting to run
Docsite CI/CD / Deploy to GitHub Pages (push) Blocked by required conditions
TestDriver.ai Build / Build for TestDriver.ai (push) Waiting to run
add waveenv to builder app (#3225)
2026-04-16 16:23:28 -07:00

58 lines
1.8 KiB
TypeScript

// Copyright 2026, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { ContextMenuModel } from "@/app/store/contextmenu";
import {
atoms,
createBlock,
getBlockMetaKeyAtom,
getConfigBackgroundAtom,
getConnConfigKeyAtom,
getConnStatusAtom,
getLocalHostDisplayNameAtom,
getSettingsKeyAtom,
getTabMetaKeyAtom,
isDev,
WOS,
} from "@/app/store/global";
import { AllServiceImpls } from "@/app/store/services";
import { RpcApi } from "@/app/store/wshclientapi";
import { WaveEnv } from "@/app/waveenv/waveenv";
import { isMacOS, isWindows, PLATFORM } from "@/util/platformutil";
export function makeWaveEnvImpl(): WaveEnv {
return {
isMock: false,
electron: (window as any).api,
rpc: RpcApi,
getSettingsKeyAtom,
platform: PLATFORM,
isDev,
isWindows,
isMacOS,
atoms,
createBlock,
services: AllServiceImpls,
callBackendService: WOS.callBackendService,
showContextMenu: (menu: ContextMenuItem[], e: React.MouseEvent) => {
ContextMenuModel.getInstance().showContextMenu(menu, e);
},
getConnStatusAtom,
getLocalHostDisplayNameAtom,
wos: {
getWaveObjectAtom: WOS.getWaveObjectAtom,
getWaveObjectLoadingAtom: WOS.getWaveObjectLoadingAtom,
isWaveObjectNullAtom: WOS.isWaveObjectNullAtom,
useWaveObjectValue: WOS.useWaveObjectValue,
},
getBlockMetaKeyAtom,
getTabMetaKeyAtom,
getConfigBackgroundAtom,
getConnConfigKeyAtom,
mockSetWaveObj: <T extends WaveObj>(_oref: string, _obj: T) => {
throw new Error("mockSetWaveObj is only available in the preview server");
},
mockModels: new Map<any, any>(),
};
}