Window
A window is an OS window. Each directory under windows/ is one, and its
index.tsx default-exports a <Window>.
Window
doneimport { cn, Outlet, Window } from "dziry";
import { route } from "./router.ts";
import { isLight } from "./state.ts";
export default function Main() {
return (
<Window
title="dziry — compiled UI"
width={1040}
height={700}
minWidth={520}
minHeight={400}
route={route}
className={cn({ light: isLight })}
>
<Outlet />
</Window>
);
}
<Window> is the body element. That is why a theme rule written body.light ...
is toggled by putting the class here.
Props
| Prop | Type | Notes |
|---|---|---|
title | string | Required. What the OS shows in the title bar and task switcher. |
width height | number | Compile-time integers, physical pixels. |
minWidth minHeight | number | Size floor. |
route | ReadonlySignal<string> | This window's route signal. |
Every configuration field is a compile-time constant, and that is why they are props rather than signals: a window's size floor and title are known before the process starts.
An empty or missing title is an error — there is no sensible default, and a window
with no title is a window nobody can find. A non-integer or non-positive size is an
error for the same reason.
route
// windows/main/router.ts
export const route = signal("/");
The route signal is passed in rather than imported from the framework: the host subscribes to it, looks the path up in the route table, and updates visibility for the routes that entered or left the active chain.
A global currentRoute inside Dziry would force every window to share one
route, and two windows on different routes is the normal case. Passing the
signal in makes the ownership explicit. Everything else about a route is
resolved at compile time — see Routing.
Outlet
done<Outlet />
Where the matched route renders. Takes no props.
Boundary props — fallback, error, notFound — are tracked in the API
table as undecided proposals and are not documented here until they are.
One table set per window
doneEvery route in a window compiles into one set of tables with a hidden
column. Navigation builds nothing: it sets hidden on the routes that left
the active chain and clears it on the ones that joined — integer writes, then
a repaint.
Types
import type { WindowConfig, WindowProps } from "dziry";
WindowConfig is the compile-time configuration — title and sizes — and is defined
alongside the IR, because that is what it becomes. WindowProps is Props plus
WindowConfig plus route.