Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
/** The app's menu timings, named once; styles.css carries the same values as `--motion-*` on :root.
* A menu or popover enters over MENU_ENTER_MS (`animate-menu-in`: 40% opacity and 96% scale to full, a strong
* ease-out, transform and opacity only); a context menu and a dialog cut in on one frame; nothing animates out. */
export const MENU_ENTER_MS = 100;
export const MENU_EXIT_MS = 0;
/** A row's hover fill: a hard cut. A header pill's tint: a short ease-out. */
export const HOVER_MS = 0;
export const PILL_HOVER_MS = 80;
/** The class a menu or popover enters with, for one that is not drawn through useMenuMotion. */
export const MENU_ENTER = "animate-menu-in";
export function reducedMotion(): boolean {
if (typeof document === "undefined") return false;
if (document.documentElement.dataset.reducedMotion === "true") return true;
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
export interface MenuMotion {
shown: boolean;
/** Always false: a menu leaves on the frame it closes (MENU_EXIT_MS). Kept so callers read one shape. */
closing: boolean;
className: string;
exitProps: { inert?: boolean; "aria-hidden"?: boolean };
}
const NO_EXIT: MenuMotion["exitProps"] = {};
/** A menu or popover opened from a trigger: shown on the render it opens, gone on the render it closes.
* `instant` is a context menu's: it appears on one frame. Reduced motion is handled in styles.css. */
export function useMenuMotion(open: boolean, enter: "menu" | "instant" = "menu"): MenuMotion {
return { shown: open, closing: false, className: open && enter === "menu" ? MENU_ENTER : "", exitProps: NO_EXIT };
}
/** A menu placed at a point (a context menu, a row's actions): it appears on one frame and leaves on one. */
export function useHeldMenuMotion<T>(value: T | null): MenuMotion & { value: T | null } {
return { ...useMenuMotion(value != null, "instant"), value };
}