import { lazy, Show, Suspense, type ParentProps } from "solid-js" import { createStore } from "solid-js/store" import { createMediaQuery } from "@solid-primitives/media" import { ResizeHandle } from "@opencode/ui/resize-handle" import { Titlebar, type TitlebarUpdate } from "@/shell/titlebar/titlebar" import { usePlatform } from "@/runtime/platform/platform" import { ToastRegion } from "@/shell/notifications/toast" import { UploadToastHost } from "@/composer/attachments/uploads" import { TitlebarRightProvider } from "@/shell/titlebar/right-slot" import { useSettingsSurface } from "@/settings/surface" import { useSettings } from "@/settings/model" import { SshAuthentication } from "@/servers/ssh/authentication" import { useUpdaterInstall } from "@/shell/updates/download" import { useCommand } from "@/shell/commands/command" import { useLanguage } from "@/runtime/i18n/language" const DebugBar = lazy(() => import("@/shell/debug/debug-bar").then((module) => ({ default: module.DebugBar }))) export default function Layout(props: ParentProps) { const platform = usePlatform() const settings = useSettingsSurface() const preferences = useSettings() const installUpdate = useUpdaterInstall() const command = useCommand() const language = useLanguage() const mobile = createMediaQuery("(max-width: 767px)") const [state, setState] = createStore({ debugTools: false, tabsWidth: 260, tabsMount: undefined as HTMLElement | undefined, }) const verticalTabs = () => preferences.appearance.tabLayout() === "vertical" && !mobile() const bottomTitlebar = () => mobile() && preferences.general.mobileTitlebarPosition() === "bottom" const update: TitlebarUpdate = { get state() { return platform.updater?.state() }, install: installUpdate, } // A plain object avoids the compiler's conditional-prop memo, which leaks when read from event handlers. const debugTools = { get visible() { return state.debugTools }, toggle: () => setState("debugTools", (value) => !value), } command.register("debug-bar", () => [ { id: "debugBar.toggle", title: language.t("command.debugBar.toggle"), category: language.t("command.category.view"), onSelect: debugTools.toggle, }, ]) return (
{/* Size containment collapses percentage-height descendants in WebKit. */}
{props.children}
) }