Data structure representing a lens that provides a specific view onto the graph.
A lens filters the graph to a subset relevant for a certain audience and defines how that filtered view should be presented, including the starting vertex and default content ordering.
Summary
Functions
Default vertex type filter that shows all vertex types.
Default content sorter that sorts by priority, then alphabetically by name, then by id for deterministic ordering.
Types
@type content_sorter_fn() :: (Clarity.Content.t(), Clarity.Content.t() -> boolean())
@type icon_fn() :: (-> Phoenix.LiveView.Rendered.t())
@type t() :: %Clarity.Perspective.Lens{ content_sorter: content_sorter_fn(), description: String.t() | nil, filter: Clarity.Graph.Filter.filter(), icon: icon_fn(), id: String.t(), name: String.t(), show_vertex_types: show_vertex_types_fn() }
Functions
Default vertex type filter that shows all vertex types.
This is the default function used by lenses unless they specify their own show_vertex_types function. Returns all types unchanged.
@spec sort_alphabetically(Clarity.Content.t(), Clarity.Content.t()) :: boolean()
Default content sorter that sorts by priority, then alphabetically by name, then by id for deterministic ordering.
This is the default sorting function used by lenses unless they specify
their own content_sorter function. Content providers can implement the
sort_priority/0 callback to control their position (lower values first).