diff --git a/assets/svelte/components/ComponentsSidebar.svelte b/assets/svelte/components/ComponentsSidebar.svelte index c56211c8..8361cca6 100644 --- a/assets/svelte/components/ComponentsSidebar.svelte +++ b/assets/svelte/components/ComponentsSidebar.svelte @@ -3,9 +3,11 @@ import { translate } from '$lib/utils/animations'; import { currentComponentCategory } from '$lib/stores/currentComponentCategory'; import { draggedObject } from '$lib/stores/dragAndDrop'; - import type { ComponentCategory, ComponentDefinition } from '$lib/types'; - export let components; + import type { ComponentCategory, ComponentDefinition, MenuCategory } from '$lib/types'; + export let components: ComponentDefinition[]; + export let live; + let menuCategories: MenuCategory[] = []; $: menuCategories = [{ name: 'Base', items: Array.from(new Set(componentDefinitions.map(d => d.category))).map(id => ({ id, name: id })) diff --git a/assets/svelte/components/PagePreview.svelte b/assets/svelte/components/PagePreview.svelte index ff99eba6..608756fe 100644 --- a/assets/svelte/components/PagePreview.svelte +++ b/assets/svelte/components/PagePreview.svelte @@ -1,42 +1,46 @@
- +
- {#each page.layout.ast as layoutAstNode} + {#each $page.layout.ast as layoutAstNode} - {#each page.ast as astNode, index} + {#each $page.ast as astNode, index} {/each} diff --git a/assets/svelte/components/PropertiesSidebar.svelte b/assets/svelte/components/PropertiesSidebar.svelte index 3865de33..91f4d9ee 100644 --- a/assets/svelte/components/PropertiesSidebar.svelte +++ b/assets/svelte/components/PropertiesSidebar.svelte @@ -2,7 +2,6 @@ import Pill from '$lib/components/Pill.svelte'; import SidebarSection from '$lib/components/SidebarSection.svelte'; import { createEventDispatcher } from 'svelte'; - // import { updatePage } from '$lib/utils/renderer'; import { draggedObject } from '$lib/stores/dragAndDrop'; import { page, selectedAstElement, selectedAstElementId, findAstElement, isAstElement } from '$lib/stores/page'; import type { AstNode } from '$lib/types'; diff --git a/assets/svelte/components/UiBuilder.svelte b/assets/svelte/components/UiBuilder.svelte index c0f328b0..7ec8f455 100644 --- a/assets/svelte/components/UiBuilder.svelte +++ b/assets/svelte/components/UiBuilder.svelte @@ -21,7 +21,7 @@ - + component_id, "page_id" => page_id }, socket) do + page = Content.get_page(socket.assigns.beacon_page.site, page_id) + component = Content.get_component(socket.assigns.beacon_page.site, component_id) + # path = for segment <- String.split(page.path, "/"), segment != "", do: segment + # beacon_live_data = Beacon.DataSource.live_data(page.site, path, []) + # {:ok, ast} = Beacon.Template.HEEx.JSONEncoder.encode(component.site, component.body, assigns) + # data = Map.put(data(component), :ast, ast) + # %{data: data} + {:reply, %{ "ast" => "sample_data" }, socket} + end + def handle_event("update_page_ast", %{ "id" => id, "ast" => ast }, socket) do page = Content.get_page(socket.assigns.beacon_page.site, id, preloads: [:layout])