Skip to content

Commit b8f4497

Browse files
authored
Phase 15 - Canonical Renderer Convergence (#136)
* Implement Phase 15.1 - Retarget Canonical Rendering to Widget Components Update the canonical renderer to use widget component boundaries for all constructs, ensuring canonical UnifiedIUR rendering targets the same widget component boundaries used by direct native usage. **Changes to LiveUi.Renderer:** - Replace all widget `.render` function component calls with `.component` LiveComponent calls - This applies to 38 widget modules across all families: - Foundational (7): Text, Label, Icon, Image, Button, Link, Separator, Spacer - Containers (3): Content, Box, Container - Layouts (3): Row, Column, Grid - Forms (3): FormBuilder, FieldGroup, Field - Inputs (3): TextInput, Toggle, Select - Navigation (3): Menu, Tabs, CommandPalette - Data (5): List, Table, TreeView, MarkdownViewer, LogViewer, StreamWidget - Feedback (4): Status, Progress, Gauge, InlineFeedback, Sparkline - Charts (3): BarChart, LineChart - Overlays (5): Dialog, AlertDialog, Toast, ContextMenu, OverlaySurface - Display (4): Viewport, ScrollBar, SplitPane, Canvas - Operational (4): ProcessMonitor, ClusterDashboard, SupervisionTreeViewer **Result:** - Canonical rendering now goes through widget LiveComponent boundaries - Widget identity preservation is maintained across native and canonical paths - Event routing works consistently for both native and canonical rendering - Integration tests pass (canonical/canonical constructs render correctly through Runtime) **Note:** Some tests that rendered the renderer directly (advanced_renderer_test.exs, validation_test.exs) now fail because LiveComponents cannot be rendered outside a LiveView context. These tests should use Runtime.mount/mount_iur instead, which is the intended usage pattern. * Fix Phase 15.1 - Complete canonical renderer to widget component convergence - Update tooling.ex to use Phoenix.LiveViewTest.render_component/3 for LiveComponent rendering - Update demo.ex to use render_component/3 instead of direct .render/1 + to_iodata - Fix advanced_renderer_test.exs to use Foundational.text instead of undefined Element.text - All 416 tests now pass The canonical renderer now correctly uses widget component boundaries and the tooling/demo layers properly render LiveComponents in test contexts.
1 parent c4784d8 commit b8f4497

4 files changed

Lines changed: 98 additions & 128 deletions

File tree

packages/live_ui/lib/live_ui/demo.ex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ defmodule LiveUi.Demo do
33
Package-local example workbench for `live_ui`.
44
"""
55

6+
import Phoenix.LiveViewTest
7+
68
alias LiveUi.Demo.{Catalog, Screen, Server, WidgetPreviewState}
79

810
@type view :: :home | :example
@@ -154,12 +156,13 @@ defmodule LiveUi.Demo do
154156
end
155157

156158
defp render_runtime(runtime_state) do
157-
LiveUi.Runtime.component().render(%{
159+
# Use render_component/3 from LiveViewTest to properly handle LiveComponents
160+
# The direct .render/1 approach doesn't work when the rendered content
161+
# contains nested LiveComponents (our widget components)
162+
render_component(LiveUi.Runtime.component(), %{
158163
id: "live-ui-demo-runtime",
159164
runtime_state: runtime_state,
160165
show_demo_panels: false
161166
})
162-
|> Phoenix.HTML.Safe.to_iodata()
163-
|> IO.iodata_to_binary()
164167
end
165168
end

0 commit comments

Comments
 (0)