// ssr-counter/Counter.el // // A counter component that demonstrates: // - State with initial value // - {#if} conditional rendering // - {#each} list rendering // - Interpolation // - Event binding // - SSR + client hydration // // Run `node render.js Counter` to see the server-rendered HTML. // Open index.html in a browser to see the full SSR + hydration lifecycle. component Counter { props { initialValue: Int = 0 label: String = "Counter" } state { count: Int = 0 history: String = "" } fn increment() -> Void { count = count + 1 history = history + "+" + count + " " } fn decrement() -> Void { count = count - 1 history = history + "-" + count + " " } fn reset() -> Void { count = 0 history = "" } template {

{label}

0 ? "count positive" : count < 0 ? "count negative" : "count zero"}> {count}
{#if history != ""}
history: {history}
{/if} {#if count == 0}

Press + or - to begin.

{/if}
} } component CounterPair { template {
} } component App { template {

el-ui SSR + Hydration

Server-rendered, client-hydrated with spreading activation

} }