waygraph / defineLayout
Function: defineLayout()
defineLayout<
G,D,R>(options):Layout<G,D,R>
Defined in: src/engine/block/kinds/layout.ts:213
Type Parameters
G
G extends Record<string, LayoutLink> = Record<never, never>
D
D extends Record<string, PageMethodEntry> = Record<never, never>
R
R extends PageRead = Record<never, never>
Parameters
options
LayoutOptions<G, D, R>
Returns
Layout<G, D, R>
Deprecated
A page covers pages: definePageBlock({ covers: "children", links: (self) => ({ docs: self.link({ to: "Docs", click }) }) }); no separate layout kind.
A layout: the UI many pages share. In src/map/<folder>/_layout.block.ts it covers every page in that folder and below (nested layouts stack); on names the pages instead.
Example
ts
export const Sidebar = defineLayout({
name: "sidebar",
go: {
plan: { to: ProductionPlan, click: SidebarSel.plan },
equipment: { to: EquipmentRegistry, click: SidebarSel.equipment, for: [PlantManager] },
},
read: (ctx) => ({ links: ctx.page.texts(SidebarSel.link) }),
});
engine.map({ as: PlantManager }).gotoPage(Sidebar.go.equipment)