PhoenixKitDashboards.Lattice (PhoenixKitDashboards v0.2.1)

Copy Markdown View Source

The grid design space: a GAPLESS lattice of nominal 25px square cells.

A layout's cols × rows is exactly one screenful of STANDARD cells — nothing ever scrolls. The fit hook stretches per-axis only to absorb the last ~4% (a fitted screen fills exactly edge-to-edge); otherwise the intact artboard shrinks into a smaller pane, or floats centered at natural size in a bigger one — never blown up (a bigger display wants its own fitted layout). Widget cards carry a small internal margin instead of grid gaps, and content self-fits via container-query type scaling. All widget sizes (default, min, per-view minimums) are declared in lattice units.

Summary

Functions

The nominal square cell size in design px.

Clamp an integer into [lo, hi] — the single clamp shared across the module. A non-integer value (tampered/legacy JSONB) collapses to lo rather than raising in downstream cell arithmetic.

Design-space canvas height for a row count.

Design-space canvas width for a column count.

Absolute hard cap for a free/pixel-canvas position (px).

Maximum free/pixel-canvas widget size in px (also the per-move growth budget).

Minimum free/pixel-canvas widget size in px.

Hard upper bound for layout dimensions and widget spans.

Hard lower bound for layout dimensions.

Per-axis stretch tolerance (see moduledoc).

Coerce a stored geometry value to an integer — the single coercion for tampered/legacy JSONB that may carry a string or float where an int is expected. Floats truncate; numeric strings parse; anything else falls back to default.

Functions

cell()

@spec cell() :: pos_integer()

The nominal square cell size in design px.

clamp(v, lo, hi)

@spec clamp(term(), integer(), integer()) :: integer()

Clamp an integer into [lo, hi] — the single clamp shared across the module. A non-integer value (tampered/legacy JSONB) collapses to lo rather than raising in downstream cell arithmetic.

design_height(rows)

@spec design_height(pos_integer()) :: pos_integer()

Design-space canvas height for a row count.

design_width(cols)

@spec design_width(pos_integer()) :: pos_integer()

Design-space canvas width for a column count.

free_max_pos()

@spec free_max_pos() :: pos_integer()

Absolute hard cap for a free/pixel-canvas position (px).

free_max_px()

@spec free_max_px() :: pos_integer()

Maximum free/pixel-canvas widget size in px (also the per-move growth budget).

free_min_px()

@spec free_min_px() :: pos_integer()

Minimum free/pixel-canvas widget size in px.

max_dim()

@spec max_dim() :: pos_integer()

Hard upper bound for layout dimensions and widget spans.

min_dim()

@spec min_dim() :: pos_integer()

Hard lower bound for layout dimensions.

stretch_tolerance()

@spec stretch_tolerance() :: float()

Per-axis stretch tolerance (see moduledoc).

to_int(v, default)

@spec to_int(term(), integer()) :: integer()

Coerce a stored geometry value to an integer — the single coercion for tampered/legacy JSONB that may carry a string or float where an int is expected. Floats truncate; numeric strings parse; anything else falls back to default.