Dashboards 0.2.1: Touch drag from the catalog and fixes for widget sizes
Dashboards 0.2.1 is a clean-up release from a code review: dragging a widget out of the catalog now works on touch screens, and moving a widget with an unusual stored size no longer crashes the builder.
On a touch screen, every drop from the Widget catalog onto the board was cancelled, because the page kept treating the finger as being over the catalog. The check now uses the finger’s position.
A widget whose stored width or height had been saved as text crashed the builder when it was dragged to another cell or switched to a view with a larger minimum size, and resizing ignored its stored height. Sizes are now read as numbers everywhere.
Enabling the module now rebuilds the widget catalog, so widgets from a module installed alongside it show up without a restart. Much of the code was reorganised with no change in behaviour.
Full release notes: Dashboards 0.2.1
0.2.1 · 18 July 2026
Changed
- Resolved the 15-finding 2026-07-16 code review: touch drag-out pointer-capture
loss, pixel-canvas resize rubber-band, mixed-type numeric coercion in grid
math, clock-widget size docs, dead/unwired API removal, permission-check
consolidation onto
Web.Helpers.viewable_by?/manageable_by?, registry cache invalidation on enable, context↔LiveView geometry duplication collapsed intoLattice/Sizing/Grid. builder_live.ex(2028→991 lines): presentational layer extracted to the newWeb.BuilderComponents.dashboards.ex(1503→1459 lines): pure helpers extracted toLayouts; the packer consolidated ontoGrid.slot/5+Grid.pack/4, withGrid.compact/3kept as a distinct size-preserving reflow (a multi-AI re-review caught and fixed a regression where the two briefly shared code andcompactstarted silently rewriting a caller’s storedh).bp/“tier” vocabulary renamed tolayout_id/“layout” throughout (the JSONB storage key stays"bp"for back-compat).- JS collision math (
rectsOverlap/fitSpan) deduped, pinned againstGrid.fit_size/8via a Node test harness. - Converted ~109 call sites from
Gettext.gettext(PhoenixKitWeb.Gettext, "...")to thegettext/1macro idiom (compile-time extraction); pure syntax change, identical msgids.
Fixed
Dashboards.place_at_cell/5(a grid drag-to-cell drop) crashed withArithmeticErroron a widget instance carrying a legacy/tampered string span ("h" => "4") —Layout.placement/2’s"w"/"h"were used in arithmetic without theLattice.to_int/2coercion every other geometry call site applies.Dashboards.grow_on_layout/5(a widget view switch that raises the view’s minimum size) had the same gap and could likewise crash withArithmeticErroron a legacy string"w".Dashboards.resize_instance/7passed an uncoerced"h"intoGrid.fit_size/8, silently discarding a legacy/tampered stored height instead of using it.- A widget-count caption in
DashboardsLiveused the runtimeGettext.ngettext/4form, left over from the gettext idiom conversion above — invisible tomix gettext.extract, so it could never gain a translation. Converted to thengettext/3macro.
Dashboards 0.2.1. Install or update: {:phoenix_kit_dashboards, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.