defmodule ReflectOS.Kernel.Layout.Definition do @moduledoc """ Holds the layout definition struct. ## Struct Fields * **name** [required]: The name of the layout type when it's displayed in the Console UI. * **icon** [required]: An SVG in raw string format which will be displayed next to layout in the Console UI. * **description** [optional]: A short description of the layout. If provided, must be a single arity function an argument called `assigns` which returns a compiled `HEEx` component. The best way to accomplish this is to use the `Phoenix.LiveView.sigil_H/2` macro. * **locations** [required]: A list of locations in the format `%{key: :my_location, label: "MyLocation"}` indicating where users can place sections in your layout. ## Example Here an example adapted from the `FourCorner` layout in ReflectOS Core: %Definition{ name: "Four Corner", description: fn assigns -> ~H\"\"\" Allows placing sections in each of the four corners of the screen, with options for stacking (vertical vs. horizontal) and spacing. \"\"\" end, icon: \"\"\" \"\"\", locations: [ %{key: :top_left, label: "Top Left"}, %{key: :top_right, label: "Top Right"}, %{key: :bottom_left, label: "Bottom Left"}, %{key: :bottom_right, label: "Bottom Right"} ] } """ @enforce_keys [:name, :icon] @type t :: %__MODULE__{ name: binary(), description: (map() -> Macro.t()) | nil, icon: binary(), locations: list(%{key: atom(), label: binary()}) } defstruct name: nil, description: nil, icon: nil, locations: [] end