# `Dala.Screen`
[🔗](https://github.com/manhvu/dala/blob/main/lib/dala/screen.ex#L1)

Behaviour and macros for Dala screens.

This module delegates to `Dala.Screen.Screen` for screen functionality.

# `__using__`
*macro* 

Defines a screen module.

# `dispatch`

```elixir
@spec dispatch(pid(), String.t(), map()) :: :ok
```

Dispatch a UI event to the screen process. Returns `:ok` synchronously once
the event has been processed and the state updated.

# `get_current_module`

```elixir
@spec get_current_module(pid()) :: module()
```

Return the module of the currently active screen in the navigation stack.
Intended for testing and debugging.

# `get_nav_history`

```elixir
@spec get_nav_history(pid()) :: [{module(), Dala.Socket.t()}]
```

Return the navigation history (list of `{module, socket}` pairs, head = most recent).
Intended for testing and debugging.

# `get_socket`

```elixir
@spec get_socket(pid()) :: any()
```

Return the current socket state of a running screen.
Intended for testing and debugging — not for production app logic.

# `list`

```elixir
@spec list() :: [%{id: integer(), name: atom() | nil, pid: pid(), module: module()}]
```

List all registered screens.

Returns a list of maps with `:id`, `:name`, `:pid`, `:module`.

# `start_link`

```elixir
@spec start_link(module(), map(), keyword()) :: GenServer.on_start()
```

Start a screen process linked to the calling process.

`params` is passed as the first argument to `mount/3`.

# `start_root`

```elixir
@spec start_root(module(), map(), keyword()) :: GenServer.on_start()
```

Start a screen as the root UI screen. Calls mount, renders the component tree
via `Dala.Ui.Renderer`, and calls `set_root_binary` on the resulting view.

This is the main entry point for production use. `start_link/3` is for tests
(no NIF calls).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
