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/setting.tsx2 KB
/** @jsxRuntime classic */
/** @jsx template */
// A setting: its title and description, and the control (the children)
// beside them, or under them when `stacked`. `wide` gives a control with
// no width of its own (a text field) 260px; `heading` makes it the title
// of the card below it, lined up with the text of the card's rows.
import { FILL, prop, when, type Definition, template } from "../define.ts";
export const setting: Definition = {
props: { title: "", description: null, stacked: false, wide: false, heading: false },
template: (
<div display="flex" flexDirection="row" alignItems="center" gap={16} width="fill" paddingX="density.settingPadding" $when={[
when("!heading", { paddingY: "density.settingPadding" }),
when("stacked", { flexDirection: "column", alignItems: "stretch", gap: 8 }),
when("heading", {
paddingX: "density.settingPadding + 4",
paddingTop: "density.settingPadding * 0.5",
paddingBottom: "density.settingPadding * 0.5 + 2",
}),
]}>
<div display="flex" flexDirection="column" gap={2} {...FILL}>
<text text={prop("title")} fontSize="type.strongSize" fontWeight={600} color="foreground" />
<text $if="description" text={prop("description")} fontSize="type.descriptionSize" color="mutedForeground" />
</div>
<div $if="children" display="flex" $when={[
when(["!stacked", "!wide"], {
flexDirection: "row",
alignItems: "center",
gap: 6,
flexGrow: 0,
flexShrink: 0,
}),
when(["wide", "!stacked"], {
flexDirection: "column",
alignItems: "stretch",
width: 260,
flexGrow: 0,
flexShrink: 0,
}),
when("stacked", { flexDirection: "column", width: "fill" }),
]}><slot /></div>
</div>
),
};
No comments yet.