PhoenixKitDashboards.Sizing (PhoenixKitDashboards v0.2.1)

Copy Markdown View Source

The single source of truth for a widget instance's resize bounds.

The context (placement clamps) and the builder LiveView (the limits fed to the DashboardResize hook as data-*) MUST agree, or the client snaps to a span the server then rejects. This module is that shared rule — replacing the two verbatim size_bounds/instance_min copies that previously lived in Dashboards and Web.BuilderLive and drifted independently.

Summary

Functions

Min/max span {min_size, max_size} for an instance on a layout.

Functions

bounds(item, layout_id)

Min/max span {min_size, max_size} for an instance on a layout.

The min comes from the instance's selected view when that view declares one (Widget.min_size_for/2; an analog clock has a squarer floor than a text one). The per-instance min_override drops the floor to 1×1 — minimums are RECOMMENDATIONS (content renders degraded below them) and a user cramming a dense dashboard may opt out. Falls back to a permissive range when the type is unknown (a stale instance whose provider was uninstalled).