Widget checklist
What to check before you save a widget, share it with the team or export it as a widget file.
Go through this before you save a widget, put it on a shared dashboard or export it. Each item links to the page that explains it. The assistant is told most of these; check them anyway in the Studio preview.
Data
- Every source is a read-only tool that is installed here, or a web source, and its
keyis a plain identifier (tasks,open_deals). (Sources) - Each web source's URL is the public API you mean, read in full, with no key or personal data in it, and
refreshSecondsrespects the API's rate limits. (Web sources) - A count shows
total, not the length ofitems: a collection'slistreturns at mostlimititems, 20 by default. (Sources) - Heavy reads are sources, not
spacemix.calls at render time: sources are cached, calls aren't. (Data) -
refreshSecondsfits the data: the default day for most widgets, 3600 for data that must be current within the hour, rarely less. (The data cache) - The widget shows nothing a viewer shouldn't see in a shared place: it runs as each viewer, but whatever it reads is on screen wherever it's placed. (Runs as the viewer)
Code
- It renders from
spacemix.onData, never fromspacemix.dataread once at load. (spacemixin the widget) - Every source is checked with
failed(result)and rendered witherror(result); empty data is rendered withempty(text); everyspacemix.callhas acatch. (Handling errors) - Markup is built with
html`…`, so every value from the data is escaped. (Building markup) - It is self-contained: inline
<style>and<script>, images only asdata:URIs, no external scripts, stylesheets, fonts,fetchor links that navigate. (Widgets) - The Studio shows no error, and the status dot is not red.
- The HTML is small: under about 15 KB, and never more than 60,000 characters. (Limits)
Look
- It is built from
.op-widgetand the kit's classes and helpers, with little CSS of its own, on its own classes and ids only. (Look and feel) - No hard-coded colors:
var(--op-…)andspacemix.ui.color(i)only, and it reads well in light and in dark. (Colors and the theme) - It fits any size: no fixed pixel widths, lists scroll with
.op-scroll, long text is truncated. Try Small and Large in the Studio. (The grid and sizing) - It still reads at one column, about 350 px wide, as on a phone. (On a phone)
- Animations of its own sit inside
@media (prefers-reduced-motion: no-preference). (Reduced motion) - It is quiet and clear: one big number or a compact list beats clutter. Rows that stand for an extension's records open it with
data-open.
Sharing
- The name is short and the description says in one line what it shows; both show in the gallery, the add-widget picker and Team Chat.
- It is saved: a widget that was never saved shows only in its Studio. (Save, discard, and unsaved widgets)
- Before exporting: whoever imports the file needs the same extensions installed, or the widget shows the missing-extension pill. (Importing)
- Before importing or opening someone else's never-saved widget: read the list of tools it reads in the confirm, and every web address the server will fetch for it. It runs with your access. (Runs as the viewer)