import { AlertTriangle, LoaderCircle } from "lucide-solid"; import { lazy, Show, Suspense, type Component } from "solid-js"; import { render } from "solid-js/web"; import { isView, type View } from "../lib/model"; import { createFrameBridge } from "../primitives/create-frame-bridge"; import "../styles/app.css"; import type { PageProps } from "./types"; // Each view is a dynamic import so a freshly-created iframe evaluates only the // page it owns. Destroying that iframe releases the chunk's runtime objects. const pages: Record> = { overview: lazy(() => import("./overview")), services: lazy(() => import("./services")), instances: lazy(() => import("./instances")), "wit-packages": lazy(() => import("./wit-packages")), activity: lazy(() => import("./activity")), settings: lazy(() => import("./settings")), }; function FramePage() { const requested = new URLSearchParams(window.location.search).get("view"); const view = isView(requested) ? requested : null; return (
未知页面 {requested ?? "(empty)"}
} > {(activeView) => { const bridge = createFrameBridge(activeView()); const Page = pages[activeView()]; document.title = `${activeView()} · Wasmeld`; return ( } > ); }}
); } const root = document.getElementById("app"); if (!root) throw new Error("missing #app root"); render(() => , root);