Dala.Preview.Live (dala v0.0.6)

Copy Markdown View Source

Standalone Phoenix LiveView server for Dala Preview with live updates.

This module provides a live, interactive preview that automatically updates when the UI code changes. It runs as a standalone server in dev mode.

Features:

  • Live Updates: Preview updates when code changes (via LiveView)
  • Hot Reload: No manual refresh needed
  • Interactive: All tap, drag, swipe, etc. work
  • Event Log: Real-time event logging

Usage:

In dev mode, run:

iex -S mix
iex> Dala.Preview.Live.start_server(module: YourApp.YourScreen)

Or with a UI tree:

iex> Dala.Preview.Live.start_server(ui_tree: your_ui_tree)

Summary

Functions

Handle refresh request.

Mount the preview with live updates.

Render the preview.

Start a standalone LiveView server for preview.

Functions

handle_event(binary, params, socket)

Handle refresh request.

mount(params, session, socket)

Mount the preview with live updates.

render(assigns)

Render the preview.

start_server(opts \\ [])

Start a standalone LiveView server for preview.

Options:

  • :module - The module to preview (atom)
  • :ui_tree - A pre-built UI tree (map)
  • :port - The port to run on (default: 4000)

Example:

Dala.Preview.Live.start_server(module: MyApp.HomeScreen, port: 4000)