feat(ui): add the shared design-system components and type scale

This commit is contained in:
sam committed 2026-10-24 12:20:01 +11:00
1 parent 332e444397
commit 522dfa5703
53 files changed
+440 -328

No files matched your search

+1 -1
View File
@@ -270,7 +270,7 @@ const resume = () => transition(api.bindingResume, "pending_approval");
v-model="newSource"
aria-label="New source path"
placeholder="path, e.g. alertmanager"
class="h-8 w-full font-mono text-[13px]"
class="h-8 w-full font-mono text-label"
/>
<Button v-if="source === NEW_SOURCE" type="button" size="sm" :disabled="creatingSource || !sourcePath" @click="createSource"><Spinner v-if="creatingSource" />Create source</Button>
</section>
+1 -1
View File
@@ -8,7 +8,7 @@ defineProps<{ data: StepNodeData }>();
<template>
<div class="pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30">
<div class="flex items-center gap-1 px-2.5 pt-1.5 text-[11px] text-fg-subtle">
<div class="flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle">
<template v-if="data.lane === 'switch'">
<Split class="size-3" aria-hidden="true" />
<span v-if="data.title === 'default'">otherwise</span>
+13 -13
View File
@@ -184,7 +184,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
<Textarea
v-else-if="fields.lead.kind === 'text'"
:model-value="text(fields.lead.key)"
class="min-h-32 text-[13px] leading-relaxed"
class="min-h-32 text-label leading-relaxed"
@focus="focused = fields.lead.key"
@update:model-value="setSetting(fields.lead.key, String($event))"
/>
@@ -195,7 +195,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
@update:model-value="setSetting(fields.lead.key, String($event))"
/>
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
<span class="text-[11px] text-fg-subtle">Insert</span>
<span class="text-caption text-fg-subtle">Insert</span>
<Button v-for="id in earlier" :key="id" type="button" variant="outline" size="xs" class="font-mono" :title="`{{ steps.${id}.summary }}`" @click="reference(id)">{{ id }}</Button>
</div>
</section>
@@ -209,7 +209,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
<template v-if="more">
<section v-if="fields.compact.length" class="divide-y divide-border rounded-md border border-border">
<div v-for="field in fields.compact" :key="field.key" class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex flex-1 items-center gap-1 text-[13px]" :title="field.schema.description">
<span class="flex flex-1 items-center gap-1 text-label" :title="field.schema.description">
{{ label(field.key, field.schema) }}
<CircleHelp v-if="field.schema.description" class="size-3 text-fg-subtle" />
</span>
@@ -219,11 +219,11 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
<Input
v-else-if="field.kind === 'number'"
type="number"
class="h-8 w-24 text-right text-[13px]"
class="h-8 w-24 text-right text-label"
:model-value="(settings[field.key] as number | undefined) ?? ''"
@update:model-value="(value) => setSetting(field.key, String(value) === '' ? undefined : Number(String(value)))"
/>
<Input v-else class="h-8 w-40 text-[13px]" :model-value="text(field.key)" @focus="focused = field.key" @update:model-value="(value) => setSetting(field.key, String(value))" />
<Input v-else class="h-8 w-40 text-label" :model-value="text(field.key)" @focus="focused = field.key" @update:model-value="(value) => setSetting(field.key, String(value))" />
</div>
</section>
@@ -231,7 +231,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
<section v-if="callInputs.length" class="space-y-3">
<div class="text-xs font-medium text-fg-muted">Inputs</div>
<div v-for="[name, spec] in callInputs" :key="name" class="space-y-1.5">
<div class="text-[13px]">{{ name }}<span v-if="spec.required" class="text-danger"> *</span><span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
<div class="text-label">{{ name }}<span v-if="spec.required" class="text-danger"> *</span><span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
<OptionSelect
v-if="!structured(spec)"
class="w-full"
@@ -248,7 +248,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
<section v-if="callOutputs.length" class="space-y-3">
<div class="text-xs font-medium text-fg-muted">Outputs</div>
<div v-for="[name, spec] in callOutputs" :key="name" class="space-y-1.5">
<div class="text-[13px]">{{ name }}<span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
<div class="text-label">{{ name }}<span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
<OptionSelect class="w-full" :aria-label="`${name} output`" :disabled="settings.wait !== true" :model-value="outputMap[name] ?? ''" :options="[{ value: '', label: 'Do not publish' }, ...matching(callerOutputs, spec, 'outputs')]" @update:model-value="setSetting('outputs', { ...outputMap, [name]: $event || undefined })" />
</div>
</section>
@@ -259,7 +259,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
{{ label(field.key, field.schema) }}
<CircleHelp v-if="field.schema.description" class="size-3 text-fg-subtle" />
</div>
<Textarea v-if="field.kind === 'text'" :model-value="text(field.key)" class="min-h-20 text-[13px]" @focus="focused = field.key" @update:model-value="setSetting(field.key, String($event))" />
<Textarea v-if="field.kind === 'text'" :model-value="text(field.key)" class="min-h-20 text-label" @focus="focused = field.key" @update:model-value="setSetting(field.key, String($event))" />
<Textarea
v-else-if="field.kind === 'lines'"
:model-value="Array.isArray(settings[field.key]) ? (settings[field.key] as string[]).join('\n') : ''"
@@ -277,7 +277,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
<p v-if="flowProblem" role="alert" class="text-xs text-danger">{{ flowProblem }}</p>
<div class="divide-y divide-border rounded-md border border-border">
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]" title="Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true">Run only when</span>
<span class="flex-1 text-label" title="Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true">Run only when</span>
<Input
class="h-8 w-48 font-mono text-xs"
placeholder="inputs.enabled"
@@ -287,23 +287,23 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
/>
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">If it fails</span>
<span class="flex-1 text-label">If it fails</span>
<OptionSelect class="w-36" aria-label="If it fails" :model-value="(step.on_failure as string) ?? ''" :options="ON_FAILURE" @update:model-value="setField('on_failure', $event || undefined)" />
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Attempts</span>
<span class="flex-1 text-label">Attempts</span>
<Input
type="number"
min="1"
max="10"
placeholder="1"
class="h-8 w-20 text-right text-[13px]"
class="h-8 w-20 text-right text-label"
:model-value="(step.retry as { attempts?: number } | undefined)?.attempts ?? ''"
@update:model-value="(value) => setRetry({ attempts: String(value) === '' ? undefined : Number(String(value)) })"
/>
</label>
<div class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<label :for="`${uid}-backoff`" class="flex-1 text-[13px]">Retry backoff</label>
<label :for="`${uid}-backoff`" class="flex-1 text-label">Retry backoff</label>
<DurationInput
:id="`${uid}-backoff`"
:model-value="(step.retry as { backoff?: string } | undefined)?.backoff ?? ''"
+4 -4
View File
@@ -119,7 +119,7 @@ function commitRename(event: Event): void {
<Badge variant="outline" class="max-w-40 gap-1 bg-background">
<component :is="badge.icon" class="text-primary" aria-hidden="true" /><span class="truncate" :title="badge.label">{{ badge.label }}</span>
</Badge>
<span v-if="data.run?.duration_ms !== undefined" class="ml-auto font-mono text-[11px] text-fg-subtle">{{ duration(data.run.duration_ms) }}</span>
<span v-if="data.run?.duration_ms !== undefined" class="ml-auto font-mono text-caption text-fg-subtle">{{ duration(data.run.duration_ms) }}</span>
<component :is="status.icon" v-if="status" class="size-4 shrink-0" :class="[status.class, data.run?.duration_ms === undefined && 'ml-auto']" :aria-label="status.label" :title="data.run?.error || status.label" />
<span v-else class="ml-auto" />
<DropdownMenu v-if="data.editable && data.kind === 'step'">
@@ -150,7 +150,7 @@ function commitRename(event: Event): void {
/>
<span v-else class="truncate" :title="data.title">{{ data.title }}</span>
</div>
<div v-if="data.mark" class="text-[11px] font-medium" :class="{ 'text-ok': data.mark === 'added', 'text-danger': data.mark === 'removed', 'text-warn': data.mark === 'changed' }">{{ data.mark === "added" ? "Added" : data.mark === "removed" ? "Removed" : "Changed" }}</div>
<div v-if="data.mark" class="text-caption font-medium" :class="{ 'text-ok': data.mark === 'added', 'text-danger': data.mark === 'removed', 'text-warn': data.mark === 'changed' }">{{ data.mark === "added" ? "Added" : data.mark === "removed" ? "Removed" : "Changed" }}</div>
<template v-if="!data.expanded">
<ul v-if="data.kind === 'start' && data.triggers?.length" class="mt-1 space-y-0.5">
<li v-for="trigger in data.triggers" :key="trigger.kind + trigger.label" class="flex min-w-0 items-center gap-1 text-xs text-fg-muted" :title="[TRIGGER_KINDS[trigger.kind].label, trigger.detail].filter(Boolean).join(': ')">
@@ -160,7 +160,7 @@ function commitRename(event: Event): void {
</ul>
<div v-else-if="data.kind === 'start'" class="mt-0.5 text-xs text-fg-muted">Manual runs only</div>
<div v-else-if="data.summary || data.detail" class="mt-0.5 truncate text-xs text-fg-muted" :title="[data.detail, data.summary].filter(Boolean).join('\n')">{{ data.summary || data.detail }}</div>
<div v-if="data.when || data.retry || data.continues" class="mt-1 flex flex-wrap gap-1 text-[11px]">
<div v-if="data.when || data.retry || data.continues" class="mt-1 flex flex-wrap gap-1 text-caption">
<span v-if="data.when" class="flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono" :title="`Runs only when ${data.when}`">
<Flag class="size-3 shrink-0" aria-hidden="true" /><span class="truncate">{{ data.when }}</span>
</span>
@@ -170,7 +170,7 @@ function commitRename(event: Event): void {
<span v-if="data.continues" class="flex items-center gap-0.5 rounded bg-secondary px-1" title="A failure does not stop the run">
<SkipForward class="size-3" aria-hidden="true" />continues</span>
</div>
<p v-if="data.run?.error" class="mt-1 line-clamp-2 text-[11px] text-danger" :title="data.run.error">{{ data.run.error }}</p>
<p v-if="data.run?.error" class="mt-1 line-clamp-2 text-caption text-danger" :title="data.run.error">{{ data.run.error }}</p>
</template>
</div>
<Transition enter-from-class="opacity-0 -translate-y-1" enter-active-class="transition duration-200" leave-to-class="opacity-0" leave-active-class="transition duration-100">
+1 -1
View File
@@ -28,7 +28,7 @@ function bound(): void {
<Button type="button" variant="ghost" size="xs" @click="binding = null"><Plus data-icon="inline-start" />Bind an event</Button>
</div>
<ul v-if="triggers.length" class="divide-y divide-border rounded-md border border-border">
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-[13px]">
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-label">
<button v-if="trigger.binding" type="button" class="flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-secondary" @click="binding = trigger.binding">
<span class="truncate">{{ trigger.label }}</span>
<Badge v-if="trigger.binding.status !== 'armed'" :variant="statusKind(trigger.binding.status)">{{ statusLabel(trigger.binding.status) }}</Badge>
+7 -16
View File
@@ -9,18 +9,14 @@ import {
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
import { CircleAlert, Ellipsis, RotateCcw, Trash2 } from "@lucide/vue";
import { CircleAlert, RotateCcw, Trash2 } from "@lucide/vue";
import { isSending, setTurnHooks } from "@/chat/state";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { Spinner } from "@/components/ui/spinner";
import { MoreMenu } from "@/components/ui/more-menu";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Textarea } from "@/components/ui/textarea";
import StepRun from "./StepRun.vue";
@@ -438,11 +434,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
<Button type="submit" size="sm" class="disabled:bg-muted disabled:text-fg-muted disabled:opacity-100" :disabled="state.saving || !!publishBlocked">
<Spinner v-if="state.saving" data-icon="inline-start" />Publish</Button>
</span>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button type="button" variant="outline" size="icon-sm" aria-label="More"><Ellipsis /></Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" class="w-48">
<MoreMenu>
<DropdownMenuItem v-if="stored !== undefined" class="xl:hidden" @select="view = 'history'">History</DropdownMenuItem>
<DropdownMenuItem v-if="$slots.performance" class="xl:hidden" @select="view = 'performance'">Performance</DropdownMenuItem>
<DropdownMenuItem v-if="$slots.runs && stored !== undefined" class="xl:hidden" @select="view = 'runs'">Runs <span class="ml-auto font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></DropdownMenuItem>
@@ -453,8 +445,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
<DropdownMenuItem v-if="changes.length" @select="draftOpen = true">Draft changes <span class="ml-auto font-mono text-xs text-fg-subtle">{{ changes.length }}</span></DropdownMenuItem>
<DropdownMenuItem v-if="dirty" :disabled="archieWorking" @select="restorePublished"><RotateCcw />Restore</DropdownMenuItem>
<DropdownMenuItem v-if="view === 'canvas' || view === 'yaml'" variant="destructive" @select="confirmDelete = true"><Trash2 />Delete workflow</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</MoreMenu>
</div>
</div>
<p v-if="runsLoading && !runs.length" class="text-xs text-fg-muted" role="status">Loading recent runs…</p>
@@ -529,7 +520,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
screen reader reach.
-->
<div
class="relative overflow-hidden rounded-lg border border-input font-mono max-md:h-full text-[13px] leading-6 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50"
class="relative overflow-hidden rounded-lg border border-input font-mono max-md:h-full text-label leading-6 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50"
>
<div
aria-hidden="true"
@@ -570,7 +561,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
name="workflow-yaml"
required
:readonly="archieWorking"
class="relative min-h-96 resize-y max-md:h-full max-md:min-h-0 max-md:resize-none rounded-none border-0 bg-transparent pt-3 pr-3 pb-[calc(0.75rem+var(--code-overscroll))] pl-14 text-[13px] leading-6 break-words whitespace-pre-wrap text-transparent caret-foreground shadow-none md:text-[13px] focus-visible:ring-0"
class="relative min-h-96 resize-y max-md:h-full max-md:min-h-0 max-md:resize-none rounded-none border-0 bg-transparent pt-3 pr-3 pb-[calc(0.75rem+var(--code-overscroll))] pl-14 text-label leading-6 break-words whitespace-pre-wrap text-transparent caret-foreground shadow-none md:text-label focus-visible:ring-0"
spellcheck="false"
wrap="soft"
:style="{ maxWidth: `calc(3.5rem + var(--code-print-width) + 0.75rem + ${scrollbar}px)` }"
+1 -1
View File
@@ -69,7 +69,7 @@ const CHANGE_VARIANTS = { added: "default", edited: "secondary", removed: "destr
<RotateCcw data-icon="inline-start" /> Restore this version</Button>
</div>
<p v-if="then === null" class="rounded-lg border border-border p-4 text-sm text-fg-muted">Workflow removed in this revision.</p>
<pre v-else-if="mode === 'yaml'" class="min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-[13px] leading-6"><code><span
<pre v-else-if="mode === 'yaml'" class="min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6"><code><span
v-for="(line, i) in diff"
:key="i"
class="block min-h-6 px-3 whitespace-pre-wrap"
+7 -7
View File
@@ -81,7 +81,7 @@ const needs = computed<{ captures?: boolean; gate_retries?: number }>(() => {
<div class="space-y-4 px-3 py-3">
<div class="divide-y divide-border rounded-md border border-border">
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Runs as</span>
<span class="flex-1 text-label">Runs as</span>
<OptionSelect
:key="String(identitiesLoading)"
:model-value="text('identity')"
@@ -96,11 +96,11 @@ const needs = computed<{ captures?: boolean; gate_retries?: number }>(() => {
<p v-if="identitiesError" role="alert" class="px-3 py-2 text-xs text-danger">{{ identitiesError }} <Button variant="link" size="xs" @click="loadAgents">Retry</Button></p>
<p v-else-if="!identitiesLoading && !agents.length" class="px-3 py-2 text-xs text-fg-subtle">No active agents in your organisation.</p>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Container profile</span>
<span class="flex-1 text-label">Container profile</span>
<OptionSelect :model-value="text('profile')" :options="profileOptions" aria-label="Container profile" class="w-44" @update:model-value="set('profile', $event || undefined)" />
</label>
<div class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Works on</span>
<span class="flex-1 text-label">Works on</span>
<ToggleGroup
type="single"
variant="outline"
@@ -113,16 +113,16 @@ const needs = computed<{ captures?: boolean; gate_retries?: number }>(() => {
</ToggleGroup>
</div>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]" title="Stages return structured output through capture tools">Captures</span>
<span class="flex-1 text-label" title="Stages return structured output through capture tools">Captures</span>
<Switch :model-value="needs.captures === true" @update:model-value="set('needs', { ...needs, captures: $event || undefined })" />
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Gate retries</span>
<span class="flex-1 text-label">Gate retries</span>
<Input
type="number"
min="0"
placeholder="0"
class="h-8 w-20 text-right text-[13px]"
class="h-8 w-20 text-right text-label"
:model-value="needs.gate_retries ?? ''"
@update:model-value="(value) => set('needs', { ...needs, gate_retries: String(value) === '' ? undefined : Number(String(value)) })"
/>
@@ -135,7 +135,7 @@ const needs = computed<{ captures?: boolean; gate_retries?: number }>(() => {
id="workflow-instructions"
:model-value="text('instructions')"
:rows="4"
class="font-mono text-[13px]"
class="font-mono text-label"
@change="set('instructions', ($event.target as HTMLTextAreaElement).value)"
/>
</section>
+4 -3
View File
@@ -12,6 +12,7 @@ import {
EmptyTitle,
} from "@/components/ui/empty";
import { Badge } from "@/components/ui/badge";
import { StatusDot } from "@/components/ui/status-dot";
import { Switch } from "@/components/ui/switch";
import { api } from "@/lib/api";
import { delivered } from "@/lib/delivered";
@@ -185,13 +186,13 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
@click="selected = row.id"
>
<span class="flex items-baseline gap-2">
<span class="min-w-0 flex-1 truncate text-[13px]" :class="row.id === selected && 'font-medium'">{{ row.id }}</span>
<span class="min-w-0 flex-1 truncate text-label" :class="row.id === selected && 'font-medium'">{{ row.id }}</span>
<Badge v-if="store.drafts.some((draft) => draft.id === row.id)" variant="outline">Draft</Badge>
<span v-if="row.avg_tokens" class="font-mono text-xs text-fg-subtle" :title="`${row.avg_tokens.toLocaleString()} tokens per run on average`">{{ compact(row.avg_tokens) }} tok</span>
</span>
<span class="mt-1.5 flex items-center gap-2 text-xs text-fg-subtle">
<span v-if="live.get(row.id)?.running" class="flex w-20 shrink-0 items-center gap-1.5 text-info">
<span class="size-1.5 animate-pulse rounded-full bg-current" aria-hidden="true" />{{ live.get(row.id)?.running }} running
<StatusDot tone="info" live />{{ live.get(row.id)?.running }} running
</span>
<span v-else-if="live.get(row.id)?.last" class="w-20 shrink-0 truncate" :title="`Latest run: ${statusLabel(live.get(row.id)?.last?.status ?? '')}`">{{ statusLabel(live.get(row.id)?.last?.status ?? "") }}</span>
<span v-else class="w-20 shrink-0">–</span>
@@ -221,7 +222,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
</header>
<WorkflowEditor v-model:selected="selected" :runs-count="workflowRuns.length">
<template #title>
<h2 class="min-w-0 truncate text-[15px] font-medium">{{ selected }}</h2>
<h2 class="min-w-0 truncate text-title font-medium">{{ selected }}</h2>
<Badge v-if="provenance" variant="outline" class="shrink-0">{{ provenance }}</Badge>
<ApplyStatusRows kind="workflow-definitions" compact />
</template>