redweb 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ The room is a noticeboard managed by the server. Each visitor gets a little wind
8
8
 
9
9
  ## Follow the design
10
10
 
11
- 1. The [application entrypoint](../../recipes/chat/app.tsx) starts a page created by `createChatroomPage()`. The component source shown below is copied from the maintained example, not a separate implementation.
11
+ 1. The [application entrypoint](../../recipes/chat/app.tsx) imports `ChatroomPage` and registers it with `defineApp({ pages: [ChatroomPage] })`. The component source shown below is copied from the maintained example, not a separate implementation.
12
12
  2. `ChatRoom` owns shared message/member data. `ChatroomComponent` owns a participant's state, server-callable actions and view. Normal TypeScript conditions choose the join screen or conversation screen.
13
13
  3. Decorated join/send actions validate form values through the starter's Zod schemas. Redweb provides loading/error feedback; invalid input does not require custom browser glue to preserve the draft.
14
14
  4. `connected()` restores online participation when a retained participant reconnects. `disconnected()` removes online presence; later disposal releases retained identity. A name reserved briefly for reconnect does not mean the person is still online.
@@ -8,12 +8,24 @@ The page class is a recipe and the server is the kitchen. `render()` prepares HT
8
8
 
9
9
  ## Follow the design
10
10
 
11
- 1. The initializer supplies `redweb/tsconfig.json` inheritance, TypeScript, the stylesheet and the entrypoint helper. Keep the file as `.tsx`; do not point its JSX settings at `react/jsx-runtime`.
11
+ 1. The initializer supplies `redweb/tsconfig.json` inheritance, TypeScript and asset copying. Keep the file as `.tsx`; do not point its JSX settings at `react/jsx-runtime`.
12
12
  2. `defineSite()` supplies one layout and CSS declaration. Its page decorators register `/` and `/about`, with metadata beside each page.
13
13
  3. Each `render()` returns ordinary TSX. Function components can share presentation; page-specific data remains in your server code. Text and attribute values are escaped, and URL protocols are restricted.
14
14
  4. `defineApp({ pages: [HomePage, AboutPage] })` combines both pages on one listener. `app.run()` owns startup and bounded shutdown; importing the definition starts nothing.
15
15
 
16
- Keep CSS in external files. The [rendering reference](../LIVE_HTML.md) covers components, templates, assets and static export. For interactive pages, start from the [realtime counter](../../recipes/realtime/README.md): assignments to decorated state update the browser through Redweb's runtime. Non-live site pages do not acquire that behavior just because their markup is JSX.
16
+ Keep CSS in external files. The [rendering reference](../LIVE_HTML.md) covers components, templates, assets and static export. For interactive pages, start from the [realtime counter](../../recipes/realtime/README.md): assignments to decorated state update the browser through Redweb's runtime. Non-live site pages do not acquire that behavior just because their markup is JSX.
17
+
18
+ ## The page code
19
+
20
+ After initializing the site recipe below, this is a minimal replacement for `src/app.tsx`:
21
+
22
+ <!-- source: docs/snippets/site.tsx -->
23
+
24
+ Save this stylesheet beside it as `src/site.css`; the starter copies it beside the compiled page:
25
+
26
+ <!-- source: docs/snippets/site.css -->
27
+
28
+ `app.run()` returns a Promise. Await it when surrounding startup depends on completion; top-level `await` requires ESM. The direct call above works with the initializer's CommonJS configuration too. Ports, environment settings and test-import guards belong in the complete recipe, not in the first page example.
17
29
 
18
30
  ## Check that it works
19
31