Primitives / DOM

The Commands

share(data) posts { title?, text?, url? } to the platform sheet: Shared on success, Dismissed when the user cancels the sheet (its own outcome, not a failure), ShareFailed otherwise.

loadScript(src) appends a head script unless one carries the URL already, so concurrent loads collapse onto the first tag and share its fate, yielding Loaded or LoadFailed. A dead tag is removed, so a retry fetches afresh.

decodeImage(source) fetches and decodes a picture before it is shown, so a lightbox or carousel switches to the next image on Decoded, never through a blank frame. Given an img's srcset and sizes (foldkit-media's Picture.Img has them), the browser decodes the candidate it would draw.

Denial, an insecure context, a missing API (a server), and a network error all become the failure Message. No Command here throws.