Local widget development
This guide covers tooling for widget authors working in a Vite project (Vue, React, or vanilla).
vite-plugin-doohnut-widget
The workspace package vite-plugin-doohnut-widget improves day-to-day widget development:
- Dev overlay — Open the dev server at
/. You get a mock host (INIT, FRAME_ENTER, CONFIG_UPDATE, TIME_TICK, STATE_*) and an iframe that loads your real app under/__widget-app__/so Vite HMR works inside the iframe. Use the Viewport panel to change iframe width/height (and Apply) or use presets fromdoohnut.devOverlay.viewportPresetsor the plugin optionviewportPresetsto test different section geometries. - Validation — On
pnpm devandvite build, checks thatpackage.jsonhas a validdoohnutblock withwidthandheightin a sane range, optionalaspectRatioPolicy(mandatory|optional), and optionaldevOverlay.viewportPresets. - Optional pack — With
DOOHNUT_PACK=1orpack: true, after build writes a.tgzcontainingdist/contents pluspackage.jsonat the archive root (suitable for upload as a widget asset).
Optional doohnut.devOverlay.presets in package.json adds named buttons in the overlay that merge preset config into the mock CONFIG_UPDATE JSON. Optional doohnut.devOverlay.viewportPresets adds named viewport size buttons. The overlay also shows a live STATE_* mock store. On Windows, prefer cross-env DOOHNUT_PACK=1 for pack scripts (see plugin README).
See the plugin README: packages/vite-plugin-doohnut-widget/README.md.
package.json manifest conventions
aspectRatioPolicy: Useoptionalwhen the widget should tolerate playlist sections whose aspect differs fromdoohnut.width×doohnut.height(letterboxing / fill). Usemandatoryor omit the field when you want the default strict match. During dev, use the overlay Viewport panel ordoohnut.devOverlay.viewportPresetsto try sizes that differ from your reference dimensions.
Examples
- dx-walkthrough-vue — minimal Vue + TypeScript + Tailwind sample for learning: SDK handshake,
CONFIG_UPDATE,TIME_TICK, and frame visibility;aspectRatioPolicy:optionaland responsive layout inside the design canvas. Start here for a short end-to-end path; the developer hub walkthrough narrates bootstrap, dev, debug, and deploy around this folder. - footer-clock-weather-vue — 1920×200 reference footer with clock, Open-Meteo weather,
aspectRatioPolicy:optional,ScaleToFitView, responsive stacking on narrow viewports, andDOOHNUT_PACK=1packing.
Protocol reference
Wire-level message types and payloads: Widget runtime protocol.