Architecture โ @gnome-ui¶
This document describes the package dependency graph and the role of each workspace in the monorepo.
Package dependency graph¶
graph TD
GNOME["๐ฅ๏ธ GNOME / GJS runtime\nGSettings ยท Gio ยท Gtk ยท Notifications\nXDG Portals ยท GDK Clipboard"]
subgraph "gnome-ui monorepo"
CORE["@gnome-ui/core\nDesign tokens ยท CSS variables\n(Adwaita colours, radii, typography)"]
ICONS["@gnome-ui/icons\nSVG icon components"]
PLATFORM["@gnome-ui/platform\nTypeScript API layer\nsettings ยท notifications ยท fileChooser\ncolorScheme ยท window ยท portals ยท clipboard"]
HOOKS["@gnome-ui/hooks\nReact hooks\nuseSettings ยท useNotification ยท useColorScheme\nuseFileChooser ยท useClipboard ยท useWindowState"]
REACT["@gnome-ui/react\nUI components\n(Button, Dialog, Sidebar, โฆ)"]
CHARTS["@gnome-ui/charts\nChart components\n(AreaChart, BarChart, LineChart)"]
WEB_COMPONENTS["@gnome-ui/web-components\nNative Custom Elements\n(Dialog, Toast, Popover)"]
end
APP["Your App (React, HTML, or htmx)"]
GNOME -->|WebKit bridge / XDG Portals| PLATFORM
PLATFORM --> HOOKS
CORE --> REACT
CORE --> CHARTS
CORE --> HOOKS
CORE --> WEB_COMPONENTS
ICONS --> REACT
REACT --> APP
CHARTS --> APP
HOOKS --> APP
WEB_COMPONENTS --> APP
Package roles¶
| Package | Role | React? | GNOME runtime? |
|---|---|---|---|
@gnome-ui/core |
Design tokens, CSS custom properties | No | No |
@gnome-ui/icons |
SVG icon components | Yes | No |
@gnome-ui/platform |
Low-level TypeScript bridge to GNOME APIs | No | Yes |
@gnome-ui/hooks |
React hooks that surface platform APIs |
Yes | Via platform |
@gnome-ui/react |
Full Adwaita UI component library | Yes | No |
@gnome-ui/charts |
Recharts-based chart components styled with Adwaita tokens | Yes | No |
@gnome-ui/web-components |
Native, light-DOM Custom Elements for framework-agnostic apps | No | No |
Communication model¶
@gnome-ui/platform communicates with the GNOME host process through one of two mechanisms, resolved at runtime:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React App (WebKitGTK WebView or browser) โ
โ โ
โ @gnome-ui/platform โ
โ โ โ
โ โโ WebKit bridge โโโบ window.webkit โ
โ โ (GJS host) .messageHandlers.* โ
โ โ โ
โ โโ XDG Portals โโโบ org.freedesktop.* โ
โ (Flatpak / via postMessage / โ
โ browser) fetch proxy โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
When neither bridge is available (unit tests, standard browsers) every call falls back to a no-op stub so the application renders without crashing.
Build order¶
@gnome-ui/core โ @gnome-ui/platform โ @gnome-ui/hooks
โ @gnome-ui/icons โ @gnome-ui/react
โ @gnome-ui/charts
โ @gnome-ui/web-components
@gnome-ui/hooks depends on both @gnome-ui/platform (runtime) and @gnome-ui/core (tokens for any bundled UI).