Design ====== This page records how the v0.1 specification (``ideas/``) was matured into an implementation: the open questions it left, and the decisions taken. Principles ---------- * Composition over inheritance for styles and reusable behaviour. * Explicit remote exposure: Python methods are never callable from browsers by accident. * Predictable execution: it is always clear whether code runs on the server or in the browser. * Immutable style values and render nodes; state is explicitly mutable. * Secure by default; progressive enhancement; a small stable core with inspectable output. Non-goals for 0.x: a Python-to-JavaScript compiler, a React replacement, automatic distributed state, reimplementing SQLAlchemy, Bootstrap/Tailwind parity. Decisions --------- .. list-table:: :header-rows: 1 :widths: 20 80 * - Area - Decision * - Rendering - Async render pass → immutable node IR → deterministic HTML serializer. * - Updates - The server re-renders each *dirty component* and sends its HTML; the runtime **morphs** the live DOM toward it (keyed by ``data-rw-key``/``data-rw-c``/``id``), preserving focus and caret. The ``op`` field leaves room for finer patches later. * - Transport - HTTP ``POST`` per event, one in flight per tab (client queue; input coalescing). WebSockets are deferred. * - Identity - ``parent/Class:n`` or ``parent/Class#key``. Same identity and class ⇒ the instance is reused (state kept, props refreshed). Unvisited instances are unmounted. * - DOM boundary - A single-root render carries ``data-rw-c``; otherwise a ``
`` wrapper is emitted. * - State - ``State(default | factory, scope=component|page|session)``; reads during render are tracked; changed writes mark readers dirty; outermost dirty components re-render first. In-place mutation needs ``touch()``. * - Handlers - Registered at render time under opaque ids ``.``, stable across re-renders so double clicks are not lost. Payloads validated from annotations. * - Manifest - JSON in ``