-- packages/view.wo — the VIEW for /packages and /packages/:name. -- -- Three components: a card for the index, the index itself (holding its -- cards as CHILDREN through the structural interface), and the detail -- page. None of them knows where the catalogue came from. use html pub class PackageCard { name: Text summary: Text fn render() -> Text { return `

{{ self.name }}

{{ self.summary }}

`; } } pub class PackagesPage { cards: multi Component fn render() -> Text { return `

Packages

A package is a git repository with a wo.toml that says kind = "library". There is no registry and no publish step: you depend on a URL and a revision, and wo.lock pins exactly what you built against. These are the libraries this site itself is built on.

${render_all(self.cards)}
`; } } pub class PackagePage { name: Text summary: Text git: Text rev: Text what: Text usage: Text fn render() -> Text { let dep = code_block("[deps]\n" .. self.name .. " = { git = \"" .. self.git .. "\", rev = \"" .. self.rev .. "\" }"); let head = `

{{ self.name }}

{{ self.summary }}

Install

Add it to your wo.toml. The KEY is the module name — that is what use imports.

`; let what = `

What you get

${self.what}`; let usage = `

Usage

${self.usage}`; let back = el("p", "mt-8", link("/packages", "", "← all packages")); return head .. dep .. what .. usage .. back; } }