/// import { computed, type Default, ifElse, NAME, pattern, UI } from "commontools"; type ImageInput = { url: Default; caption: Default; }; type ImageOutput = { [NAME]: unknown; [UI]: unknown; url: string; caption: string; }; export default pattern(({ url, caption }) => { const hasCaption = computed(() => !!caption); const displayName = computed(() => caption || "Image"); return { [NAME]: displayName, [UI]: ( {caption {ifElse( hasCaption,
{caption}
, null, )}
), url, caption, }; });