import { signal, derived } from '../signal.js';
import { mount } from '../dom.js';
import { Column, Row, Heading, Text, Button } from '../elements.js';
const [count, setCount] = signal(0);
const doubled = derived(() => count() * 2);
export function main(container) {
return mount(
Column(undefined, {}, [
Heading(() => 'Counter'),
Text(count),
Text(doubled),
Row(undefined, {}, [
Button(() => 'minus one', { onClick: () => setCount(count() - 1) }),
Button(() => 'plus one', { onClick: () => setCount(count() + 1) }),
Button(() => 'reset', { onClick: () => setCount(0) }),
]),
]),
container
);
}