mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-22 05:48:31 +08:00
* Update phoenix deps
* Update reference to LiveDashboard encode_pid
* Fix form input id references
* Move to HEEx
* Update back to filesystem LV npm package
* Further HEEx rewrites
* Refactor icons into function components
* .html.leex -> .html.heex
* Further refactoring
* Move render helpers into function components
* Add doctype back
* Further refactoring
* Refactor cell component
* Further refactoring
* Compose sidebar using function components
* Rewrite notebook card component as function component
* Fruther refactoring
* Fix race condition in runtime tests
* Rewrite tooltips into function component
* Update Tailwind purge rules
* Revert "Rewrite tooltips into function component"
This reverts commit bd6ca8f0b5
.
* Refactor conditional tooltip
32 lines
835 B
Elixir
32 lines
835 B
Elixir
defmodule LivebookWeb.Output.VegaLiteDynamicLive do
|
|
use LivebookWeb, :live_view
|
|
|
|
@impl true
|
|
def mount(_params, %{"pid" => pid, "id" => id}, socket) do
|
|
send(pid, {:connect, self()})
|
|
|
|
{:ok, assign(socket, id: id)}
|
|
end
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<div id={"vega-lite-#{@id}"} phx-hook="VegaLite" phx-update="ignore" data-id={@id}>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def handle_info({:connect_reply, %{spec: spec}}, socket) do
|
|
{:noreply, push_event(socket, "vega_lite:#{socket.assigns.id}:init", %{"spec" => spec})}
|
|
end
|
|
|
|
def handle_info({:push, %{data: data, dataset: dataset, window: window}}, socket) do
|
|
{:noreply,
|
|
push_event(socket, "vega_lite:#{socket.assigns.id}:push", %{
|
|
"data" => data,
|
|
"dataset" => dataset,
|
|
"window" => window
|
|
})}
|
|
end
|
|
end
|