1.2 KiB
1.2 KiB
Dashboard widget contract
- Render every widget inside the shared minimal base card using existing CSS tokens. Keep widget data and business logic outside the card.
- Register widgets with a stable type ID and validated title, description, icon, template, span, settings keys, permissions, and multi-instance policy.
- The dashboard layout engine alone owns add, drag, drop, order, size, and per-user, per-page persistence. Widget scripts must initialize and clean up within their own root, including after partial page updates.
- Provide keyboard and touch alternatives to dragging, clear focus, screen-reader status, reduced motion, and WCAG 2.2 AA interaction and contrast.
- Show loading, empty, error, and stale states honestly. Show visible provider attribution when required.
- Require Django authentication and CSRF for layout changes. Validate configuration on the server, enforce ownership, and keep upstream secrets out of browser code.
- Test registry validation, user and page isolation, reorder persistence, and widget lifecycle when adding widgets.
- The card's
data-widget-platformanddata-instance-idare passive geometry hooks for future integrations. Do not add companion behavior here.