Files
NomadArch/packages/ui/src/stores/command-palette.ts
Gemini AI b448d11991 fix: restore complete source code and fix launchers
- Copy complete source code packages from original CodeNomad project
- Add root package.json with npm workspace configuration
- Include electron-app, server, ui, tauri-app, and opencode-config packages
- Fix Launch-Windows.bat and Launch-Dev-Windows.bat to work with correct npm scripts
- Fix Launch-Unix.sh to work with correct npm scripts
- Launchers now correctly call npm run dev:electron which launches Electron app
2025-12-23 12:57:55 +04:00

37 lines
879 B
TypeScript

import { createSignal } from "solid-js"
const [openStates, setOpenStates] = createSignal<Map<string, boolean>>(new Map())
function updateState(instanceId: string, open: boolean) {
setOpenStates((prev) => {
const next = new Map(prev)
next.set(instanceId, open)
return next
})
}
export function showCommandPalette(instanceId: string) {
if (!instanceId) return
updateState(instanceId, true)
}
export function hideCommandPalette(instanceId?: string) {
if (!instanceId) {
setOpenStates(new Map())
return
}
updateState(instanceId, false)
}
export function toggleCommandPalette(instanceId: string) {
if (!instanceId) return
const current = openStates().get(instanceId) ?? false
updateState(instanceId, !current)
}
export function isOpen(instanceId: string): boolean {
return openStates().get(instanceId) ?? false
}
export { openStates }