Official
ui
The look of the app's components: buttons, list rows, cards, settings, callouts, and the blocks and tables of replies. Edit a component here and the whole app draws with it.
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/ui@0.1.2
Permissions in 0.1.2
Files
components/callout.tsx1.3 KB
/** @jsxRuntime classic */
/** @jsx template */
// A message with a tone: its icon, an optional title, the text, and
// actions (the children) at the end.
import { FILL, prop, type Definition, template } from "../define.ts";
const TINTS = {
info: "info/10",
success: "success/10",
warning: "warning/10",
danger: "danger/10",
primary: "primary/10",
};
const ICONS = { success: "circle-check", warning: "triangle-alert", danger: "circle-x" } as const;
export const callout: Definition = {
props: { tone: null, title: null, text: "", icon: null },
template: (
<div display="flex" flexDirection="row" alignItems="start" gap={8} width="fill" paddingX={10} paddingY={8} borderRadius="field" background={prop("tone", { map: TINTS, else: "mutedForeground/10" })}>
<div flexGrow={0} flexShrink={0} paddingTop={1}>
<icon name={prop("icon", { else: prop("tone", { map: ICONS, else: "info" }) })} small tone={prop("tone", { else: "muted" })} />
</div>
<div display="flex" flexDirection="column" gap={2} color="foreground" fontSize={12.5} {...FILL}>
<text $if="title" text={prop("title")} fontWeight={600} />
<text text={prop("text")} />
</div>
<div $if="children" display="flex" flexDirection="row" alignItems="center" gap={6} flexGrow={0} flexShrink={0}><slot /></div>
</div>
),
};
No comments yet.