{caption}
} component List(props) { @@ -136,14 +136,14 @@ export default component App() { `Row` sees its declaration site, not its caller (RG-7a). -``` +```rx -- reject: UNKNOWN_COMPONENT export default component App() {{shout} {props.children}
@@ -34,7 +34,7 @@ recreated with it (RG-4a, RG-1a). ## Rejected variants -``` +```rx -- reject: RG-4a component Greeting(props) {{props.name}
} export default component App() { diff --git a/scenarios/S-region-6.md b/scenarios/S-region-6.md index 8b419a9b..a74af44b 100644 --- a/scenarios/S-region-6.md +++ b/scenarios/S-region-6.md @@ -4,7 +4,7 @@ Rules exercised: E-9, E-10 (diagnostic), RG-6a, RG-6b, RG-6c. ## Program -``` +```rx export default component App() { fn double(v) => v * 2 fn counter(ref base, step) { @@ -36,7 +36,7 @@ of `n` — the body did not re-run (instant 3 shows 3 + 5 + 10). ## Rejected variants -``` +```rx -- reject: SNAPSHOT_ARGUMENT export default component App() { fn watch(v) { @@ -50,7 +50,7 @@ export default component App() { } ``` -``` +```rx -- reject: E-9 export default component App() { fn counter(ref base) { diff --git a/scenarios/S-region-7.md b/scenarios/S-region-7.md index 427a906f..d5225dde 100644 --- a/scenarios/S-region-7.md +++ b/scenarios/S-region-7.md @@ -18,7 +18,7 @@ RG-7c, and a field wrote `use fields := …` with any value it liked.) ## Program -``` +```rx type Row = { ok: boolean } context fields: { add: (r: Row) => void; remove: (r: Row) => void } // RG-7: declared; it carries the writes the form allows (O-4) component Form(props) { @@ -73,7 +73,7 @@ keep `add` and `remove` in step: nothing calls one without the other. ## Rejected variants -``` +```rx -- reject: RG-7b context fields: { add: (r: unknown) => void } component Field(props) { diff --git a/scenarios/S-region-8.md b/scenarios/S-region-8.md index ba8eba0e..9642c062 100644 --- a/scenarios/S-region-8.md +++ b/scenarios/S-region-8.md @@ -4,7 +4,7 @@ Rules exercised: RG-8 (PT-1–PT-3), RG-1a, RG-7b, O-4. ## Program -``` +```rx context tone: string = "plain" source open := false source n := 0 @@ -42,7 +42,7 @@ Served, the page is `count 0`: the server renders nothing for a portal ## Rejected variants -``` +```rx -- reject: CONTENT_MODEL export default component App() { portal {{props.w}
} @@ -86,7 +86,7 @@ export default component App() { Through a prop: the component reads it where nothing holds it. -``` +```rx -- reject: CLIENT_NOT_AWAITED import { viewport } from "./api" export default component App() { diff --git a/scenarios/S-server-4.md b/scenarios/S-server-4.md index fa5ceebc..1f8ecae1 100644 --- a/scenarios/S-server-4.md +++ b/scenarios/S-server-4.md @@ -4,14 +4,14 @@ Rules exercised: SV-7d; SV-3a; MO-3. ## Modules -``` +```rx -- module: ./row.rx export component Row(props) {{props.children}
} export default component App() { @@ -35,7 +35,7 @@ children in a ``; a `` is phrasing content, so it stays there.
## Rejected variants
-```
+```rx
-- reject: CONTENT_MODEL
import { Row } from "./row.rx"
export default component App() {
@@ -49,7 +49,7 @@ The server's ` `: the served ` ` is empty and the panel is
its sibling.
-```
+```rx
-- reject: CONTENT_MODEL
component Line(props) { ` and ` x` is parsed with a ` ` the client never
builds (it inserts each row into the table). Solid's compiler assumes "table
partials are used in the right place"; this is the place.
-```
+```rx
-- reject: CONTENT_MODEL
import { Row } from "./row.rx"
@@ -60,7 +60,7 @@ export default component App() {
Outside a table the parser drops the `` and ` ` tags.
-```
+```rx
-- reject: CONTENT_MODEL
component Panel(props) { {props.children} }
@@ -84,7 +84,7 @@ export default component App() {
Children land where the component puts them: here, a `` in a
``, which the parser moves out of the table.
-```
+```rx
-- reject: CONTENT_MODEL
export default component App() {
source ok := true
@@ -96,7 +96,7 @@ export default component App() {
A branch is its own template: Solid's compiler sees ` {user.name}
{if open {
@@ -189,7 +189,7 @@ attributes are equations, children are readers, components are applied as
Imperative scope is: an `effect`'s apply block, an `action` body, and any
arrow function written in imperative scope or as an element's event handler.
-```
+```rx
effect (count) {
@@ -249,7 +249,7 @@ action { refresh user; affects user } // inline, one run (AC-1)
In a component body the same thing is `effect () { … }` (EF-4).
- The optimistic-action idiom, with a spinner:
- ```
+ ```rx
action placeOrder() {
let items = cart // a snapshot of what is being ordered
optimistic cart := [] // the guess shows now (AC-3)
@@ -272,7 +272,7 @@ action { refresh user; affects user } // inline, one run (AC-1)
## 6. Components (RG-4)
-```
+```rx
component Card(props: { title: string; children: View }) {
source open := false