layout
look
One
layout.json places the same screens for a phone and for a wide window. Flip the size class: nothing is redrawn, the screens only move.Size class
passes
layout::check against the site's contractDrawn
Today
strip
panel
3to water
12plants
4 mmrain tonight
Water the basildry since Mondaynow
Turn the lemon treeleaning to the windowtoday
Repot the fernroots out of the baseSat
Plants
strip
column
!Basilkitchen silldry
✓Fernbathroomfine
✓Lemon treeliving roomfine
✓Monsterahallfine
!Rosemarybalconydry
✓Mintbalconyfine
Weather
sheet
cards
4 mmrain tonight, from 21:00
Skip the balcony pots: the rain waters them.
Settings
menu
menu
Units, reminders and the garden's name.
Where each screen goes
Todaycompact: strip · wide: panel
Plantscompact: strip · wide: column
Weathercompact: sheet · wide: cards
Settingscompact: menu · wide: menu
layout.json
{
"format": 1,
"root": {
"type": "nav",
"slots": {
"main": [
{
"type": "screen",
"source": "garden",
"path": "/screens/today",
"id": "today",
"label": "Today",
"place": {
"compact": "strip",
"wide": "panel"
}
},
{
"type": "screen",
"source": "garden",
"path": "/screens/weather",
"id": "weather",
"label": "Weather",
"transition": "sheet",
"place": {
"compact": "sheet",
"wide": "cards"
}
}
],
"side": [
{
"type": "screen",
"source": "garden",
"path": "/screens/plants",
"id": "plants",
"label": "Plants",
"place": {
"compact": "strip",
"wide": "column"
}
}
],
"menu": [
{
"type": "screen",
"source": "garden",
"path": "/screens/settings",
"id": "settings",
"label": "Settings",
"place": "menu"
}
]
}
}
}Checked when the site builds
The site declares its own contract: no components beyond
nav, and one screen no file may place. A file that breaks a rule stops the build, with its line and column.const GARDEN: Contract = Contract {
components: &[],
locked: &["/screens/account"],
};
layout::check(LAYOUT_JSON, &GARDEN)?refused layout.json:14:24 · root.slots.main[0]: unknown place "tabs"
Every page here is a blocks
Screen, written by site::page: no hand-written HTML. Source: https://github.com/jirathip-dev/blocks