release: WRNexusJS 0.3.5
This commit is contained in:
@@ -357,6 +357,26 @@ page Dashboard {
|
||||
Pages with no `layout` fall back to a `default` layout if one exists; `layout = "none"`
|
||||
opts out. Layouts can mount components (nav, theme-toggle) like any page.
|
||||
|
||||
**Document layout.** A conventional `app/layouts/document.wrn` is applied outside
|
||||
the selected page layout and may own `<html>`, `<head>`, `<body>`, and `#app`.
|
||||
The framework passes `cookies`, `theme`, `language`, `url`, and `pathname` as
|
||||
SSR props, then safely merges page SEO, global head entries, styles, and scripts:
|
||||
|
||||
```wrn
|
||||
layout Document {
|
||||
props { cookies = {} theme = "light" language = "en" }
|
||||
view {
|
||||
<html data-density="{cookies['density'] || 'default'}">
|
||||
<head></head>
|
||||
<body><div id="app"><slot /></div></body>
|
||||
</html>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Cookie-backed document attributes are present in the first server response, so
|
||||
CSS can apply before paint instead of correcting the page after hydration.
|
||||
|
||||
## API routes
|
||||
|
||||
`app/api/hello.ts` → `/api/hello`:
|
||||
|
||||
Reference in New Issue
Block a user