Context
The flagship surface: a visual drag-and-drop report builder. A user composes a report from blocks on a 12-column grid, configures each block's query and viz, and sees live data as they build. This is the page that sells the product - read stacks-design-taste (and stacks-design-output) first, budget real time for interaction polish, and be picky.
Drag interactions come from @ts-charts/drag (our D3 rewrite's drag package) plus pointer events - no third-party drag-and-drop library.
Scope
- Builder route per report (
/reports/{slug}/edit), edit access per #4 authz. - Canvas: 12-column grid, drag from a block palette to place, drag to move, resize handles, collision push-down, snap guides, 8px baseline; selection state with keyboard movement (arrows) and delete - the grid math mirrors
ReportBlock.{x,y,w,h}(#9) exactly. - Block config panel: event/measure/dimension/filter/grain/comparison pickers driven by the same
@stacksjs/validationschema as the server (#9); friendly names from the taxonomy doc (#6); viz options per block kind (#11). - Live preview: debounced
POST /api/projects/{id}/query(#10) per edited block; skeleton while in flight; errors surface inline in the block, never as toasts alone. - Autosave to
ReportRevision(#9) with visible save-state indicator; undo/redo across layout + config edits (bounded stack, in-memory, seeded from revisions on load). - Draft vs published: publishing snapshots the draft into the served report; viewers (#13) only ever see published.
- Empty state: a designed "start from a template or a blank grid" moment (templates arrive with #14; wire the hook now).
- Reduced motion: all drag/snap affordances usable with
prefers-reduced-motion; no scroll-hijack; touch works (pointer events, not mouse-only). - Feature tests for the server surface (revision writes, publish snapshot, authz); browser QA via
stacks-browsefor drag/resize/undo flows.
Acceptance
- Build a three-block report from scratch on the seeded project, publish, reload: layout and data identical. Pre-flight passes in both themes at mobile and desktop widths (builder may be read-only on small screens if honest about it).
Depends on #9, #10, #11. Part of #1 (M4 Builder and viewing). Ground rules: see #1.