# `LivePanels.Item.Capabilities`
[🔗](https://github.com/livepanels/livepanels/blob/v0.1.0/lib/livepanels/item/capabilities.ex#L1)

Capability buckets and capability-owned item behavior.

`LivePanels.Item` is the canonical record. This module owns the optional
behavior attached to that record: content, vector state, connectors, ports,
render surface, interaction hints, layout participation, autosize, resize,
drag/drop, regions, reserved areas, and placement locks.

# `autosize`

```elixir
@type autosize() :: %{
  debounce_ms: non_neg_integer(),
  min_w: pos_integer(),
  min_h: pos_integer(),
  max_w: pos_integer(),
  max_h: pos_integer()
}
```

# `capability_map`

```elixir
@type capability_map() :: %{optional(atom() | String.t()) =&gt; term()}
```

# `port_anchor`

```elixir
@type port_anchor() :: map()
```

# `port_declaration`

```elixir
@type port_declaration() :: %{
  :name =&gt; String.t(),
  :direction =&gt; :input | :output,
  :label =&gt; String.t(),
  :type =&gt; port_type(),
  :max_connections =&gt; pos_integer() | :unlimited,
  optional(:anchor) =&gt; port_anchor()
}
```

# `port_type`

```elixir
@type port_type() :: atom() | String.t() | term()
```

# `viewport_dimension`

```elixir
@type viewport_dimension() :: pos_integer() | viewport_fill_dimension()
```

# `viewport_fill_dimension`

```elixir
@type viewport_fill_dimension() :: %{
  :mode =&gt; :fill,
  :inset =&gt; non_neg_integer(),
  optional(:min) =&gt; pos_integer(),
  optional(:max) =&gt; pos_integer()
}
```

# `viewport_frame`

```elixir
@type viewport_frame() :: %{
  optional(:anchor) =&gt; LivePanels.Canvas.Placement.anchor(),
  optional(:x) =&gt; integer(),
  optional(:y) =&gt; integer(),
  optional(:w) =&gt; viewport_dimension(),
  optional(:h) =&gt; viewport_dimension()
}
```

# `viewport_frames`

```elixir
@type viewport_frames() :: %{optional(String.t()) =&gt; viewport_frame()}
```

# `autosize`

```elixir
@spec autosize(LivePanels.Item.t()) :: autosize() | nil
```

Returns an item's normalized autosize capability.

# `autosize?`

```elixir
@spec autosize?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item owns its frame size from rendered content.

# `clusterable?`

```elixir
@spec clusterable?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item can participate in clustering.

# `connectable?`

```elixir
@spec connectable?(LivePanels.Item.t()) :: boolean()
```

Returns true when this item participates in the connector/port graph.

An item is connectable when it declares a non-empty `:ports` capability.

# `connector?`

```elixir
@spec connector?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item is a connector item.

# `content?`

```elixir
@spec content?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item has a content capability.

# `content_items`

```elixir
@spec content_items(map()) :: map()
```

Returns the items that carry content.

# `contentless_items`

```elixir
@spec contentless_items(map()) :: map()
```

Returns the items that do not carry content.

# `drag_drop`

```elixir
@spec drag_drop(LivePanels.Item.t()) :: LivePanels.Canvas.DragDrop.capability()
```

Returns an item's normalized drag/drop capability.

# `find_port`

```elixir
@spec find_port(LivePanels.Item.t(), String.t()) :: port_declaration() | nil
```

Finds a declared connector port by name.

# `interaction_hints`

```elixir
@spec interaction_hints(LivePanels.Item.t()) :: map()
```

Returns application interaction hints declared by an item.

# `item_without_content?`

```elixir
@spec item_without_content?(map(), String.t()) :: boolean()
```

Returns true when an item id points to a contentless item.

# `max_connections`

```elixir
@spec max_connections(port_declaration() | map()) :: pos_integer() | :unlimited
```

Returns the connector port connection limit.

# `placement_locked?`

```elixir
@spec placement_locked?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item's placement is locked.

# `placement_unlocked?`

```elixir
@spec placement_unlocked?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item's placement is not locked.

# `port_direction`

```elixir
@spec port_direction(port_declaration() | map()) :: :input | :output | nil
```

Returns a normalized connector port direction.

# `port_label`

```elixir
@spec port_label(port_declaration() | map()) :: String.t()
```

Returns the connector port label.

# `port_name`

```elixir
@spec port_name(port_declaration() | map()) :: String.t()
```

Returns the connector port name as a string.

# `port_type`

```elixir
@spec port_type(port_declaration() | map()) :: port_type()
```

Returns the connector port type.

# `ports`

```elixir
@spec ports(LivePanels.Item.t()) :: [port_declaration()]
```

Returns the declared connector ports for an item.

# `ports_for_direction`

```elixir
@spec ports_for_direction(LivePanels.Item.t(), :input | :output) :: [
  {integer(), port_declaration()}
]
```

Returns declared connector ports for the requested direction.

# `presentable?`

```elixir
@spec presentable?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item may be presented by user interaction.

# `promote_on_focus?`

```elixir
@spec promote_on_focus?(LivePanels.Item.t()) :: boolean()
```

Returns true when focusing an item should promote it in the canvas stack.

# `region?`

```elixir
@spec region?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item declares a region capability.

# `region_name`

```elixir
@spec region_name(LivePanels.Item.t()) :: String.t() | nil
```

Returns the region name declared by an item.

# `removable?`

```elixir
@spec removable?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item may be removed by user interaction.

# `render_surface`

```elixir
@spec render_surface(LivePanels.Item.t()) ::
  :world_html | :world_svg | :viewport_html | :none | nil
```

Returns the render surface declared by an item.

# `reserved_area?`

```elixir
@spec reserved_area?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item reserves layout area.

# `reserved_area_policy`

```elixir
@spec reserved_area_policy(LivePanels.Item.t()) ::
  :avoid | :overlay | :collapse_shell | nil
```

Returns the reserved-area policy declared by an item.

# `resizable?`

```elixir
@spec resizable?(LivePanels.Item.t()) :: boolean()
```

Returns true when this item may be interactively resized by users.

Resizability is expressed by the presence of a `:resize` capability.

# `tileable?`

```elixir
@spec tileable?(LivePanels.Item.t()) :: boolean()
```

Returns true when this item participates in bulk tiling / layout operations.

An item is tileable when either it has an explicit `:tile` capability whose
value is non-falsy, or it has a `:content` capability and no explicit `:tile`
opt-out. Items without a `:content` capability and without `:tile` opt-in are
excluded from bulk layout placements.

# `tiling_axis`

```elixir
@spec tiling_axis(LivePanels.Item.t()) :: :horizontal | :vertical | nil
```

Returns the axis declared by an item's tiling container capability.

# `tiling_container?`

```elixir
@spec tiling_container?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item is a tiling container.

# `tiling_gap`

```elixir
@spec tiling_gap(LivePanels.Item.t()) :: non_neg_integer()
```

Returns the gap declared by an item's tiling container capability.

# `tiling_ratios`

```elixir
@spec tiling_ratios(LivePanels.Item.t()) :: map()
```

Returns per-child tiling ratios declared by an item.

# `vector?`

```elixir
@spec vector?(LivePanels.Item.t()) :: boolean()
```

Returns true when an item has vector state.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
